SHOW:
|
|
- or go back to the newest paste.
1 | - | case GOSSIP_ACTION_INFO_DEF+1: |
1 | + | #include "ScriptPCH.h" |
2 | - | if (m_Player1GUID == 0) |
2 | + | |
3 | - | { |
3 | + | std::vector<Player*> Players; |
4 | - | m_Player1GUID = player->GetGUID(); |
4 | + | bool BgRunning = false; |
5 | - | player1Name = player->GetName(); |
5 | + | |
6 | - | } |
6 | + | class TEST : public CreatureScript |
7 | - | else if (m_Player2GUID == 0) |
7 | + | { |
8 | - | { |
8 | + | public: |
9 | - | m_Player2GUID = player->GetGUID(); |
9 | + | TEST() : CreatureScript("TEST") {} |
10 | - | player2Name = player->GetName(); |
10 | + | |
11 | - | } |
11 | + | bool OnGossipHello(Player* player, Creature* creature) |
12 | - | else if (m_Player3GUID == 0) |
12 | + | { |
13 | - | { |
13 | + | // blah blah |
14 | - | m_Player3GUID = player->GetGUID(); |
14 | + | } |
15 | - | player3Name = player->GetName(); |
15 | + | |
16 | - | } |
16 | + | bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 uiAction) |
17 | - | else if (m_Player4GUID == 0) |
17 | + | { |
18 | - | { |
18 | + | switch(uiAction) |
19 | - | m_Player4GUID = player->GetGUID(); |
19 | + | { |
20 | - | player4Name = player->GetName(); |
20 | + | case GOSSIP_ACTION_INFO_DEF+1: |
21 | - | } |
21 | + | { |
22 | - | else if (m_Player5GUID == 0) |
22 | + | if(BgRunning) |
23 | - | { |
23 | + | { |
24 | - | m_Player5GUID * player->GetGUID(); |
24 | + | player->GetSession()->SendNotification("BG is already running"); |
25 | - | player5Name * player->GetName(); |
25 | + | return true; |
26 | - | EventOn = True; |
26 | + | } |
27 | - | |
27 | + | Players.push_back(player); // add player to the list |
28 | - | } |
28 | + | if (Players.size() >= 5) |
29 | - | m_Player5GUID-> |
29 | + | { |
30 | - | player->CastSpell(player, 9454); |
30 | + | for (auto it = Players.begin() ; it < Players.end(); it++ ) |
31 | - | player->CastSpell(player, SPELL_TELEPORT_VISUAL); |
31 | + | { |
32 | - | player->TeleportTo(1, -3739.533447f, 1095.419434f, 131.969559f, 3.029968f); |
32 | + | if(!(*it)->IsInWorld()) |
33 | - | player->AddAura(58549, player); |
33 | + | Players.erase(it); |
34 | - | player->SetAuraStack(58549, player, 20); |
34 | + | } |
35 | - | player->PlayerTalkClass->SendCloseGossip(); |
35 | + | if (Players.size() >= 5) |
36 | - | break; |
36 | + | for (auto it = Players.begin() ; it < Players.end(); it++ ) |
37 | { | |
38 | (*it)->TeleportTo(0, 0.0, 0.0, 0.0, 0.0); | |
39 | BgRunning = true; | |
40 | } | |
41 | } | |
42 | } | |
43 | } | |
44 | return true; | |
45 | } | |
46 | }; |