Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Custom City Battle Flags
- class go_city_battle_flags : public GameObjectScript
- {
- public:
- go_city_battle_flags() : GameObjectScript("go_city_battle_flags") { }
- struct go_city_battle_flagsAI : public GameObjectAI
- {
- go_city_battle_flagsAI(GameObject* go) : GameObjectAI(go)
- {
- }
- enum ZoneIds
- {
- ZONE_ID_STORMWIND = 1519,
- ZONE_ID_ORGRIMMAR = 1637
- };
- void OnGameEvent(bool start, uint16 eventId) override
- {
- if(!start)
- return;
- if (eventId != 76) // check if eventId is the city battle event id
- return;
- int flagEntry = me->GetEntry();
- int zoneId = me->GetZoneId();
- ObjectGuid guid = me->GetGUID();
- GameObjectData const *data;
- bool removeMe = false;
- if (!guid)
- return;
- data = sObjectMgr->GetGameObjectData(guid);
- if (!data)
- return;
- if (zoneId == ZONE_ID_ORGRIMMAR)
- {
- switch (flagEntry)
- {
- case FLAG_ALLY:
- if (!sCityBattle->isHordeCaptured)
- removeMe = true;
- break;
- case FLAG_HORDE:
- if (sCityBattle->isHordeCaptured)
- removeMe = true;
- break;
- }
- }
- else if (zoneId == ZONE_ID_STORMWIND)
- {
- switch (flagEntry)
- {
- case FLAG_ALLY:
- if (sCityBattle->isAllianceCaptured)
- removeMe = true;
- break;
- case FLAG_HORDE:
- if (!sCityBattle->isAllianceCaptured)
- removeMe = true;
- break;
- }
- }
- if (removeMe)
- me->SetPhaseMask(4,true);
- sWorld->SendGlobalText("|cffffcc00[CityBattle]|r |cFF00FF00CityBattle started!", NULL);
- //sObjectMgr->RemoveGameobjectFromGrid(guid, data);
- }
- bool GossipHello(Player* player) override
- {
- if (!sCityBattle->CityBattle_Enable)
- return true;
- if (player->GetMapId() == 1 && player->GetZoneId() == ZONE_ID_ORGRIMMAR && player->GetTeamId() == TEAM_ALLIANCE)
- {
- if (sCityBattle->isAllianceCaptured)
- {
- ChatHandler(player->GetSession()).PSendSysMessage("You must recapture your base!");
- return true;
- }
- if (sCityBattle->isHordeCaptured) // incase there're 2 Horde flags spawned
- {
- ChatHandler(player->GetSession()).PSendSysMessage("|cff00FF00The flag is already captured.|r");
- return true;
- }
- }
- else if (player->GetMapId() == 0 && player->GetZoneId() == ZONE_ID_STORMWIND && player->GetTeamId() == TEAM_HORDE)
- {
- if (sCityBattle->isHordeCaptured)
- {
- ChatHandler(player->GetSession()).PSendSysMessage("You must recapture your base!");
- return true;
- }
- if (sCityBattle->isAllianceCaptured) // incase there're 2 Horde flags spawned
- {
- ChatHandler(player->GetSession()).PSendSysMessage("|cff00FF00The flag is already captured.|r");
- return true;
- }
- }
- else if (player->GetMapId() == 1 && player->GetZoneId() == ZONE_ID_ORGRIMMAR && player->GetTeamId() == TEAM_HORDE)
- {
- if (!sCityBattle->isHordeCaptured)
- {
- ChatHandler(player->GetSession()).PSendSysMessage("Flag is not captured to recapture.");
- return true;
- }
- }
- else if (player->GetMapId() == 0 && player->GetZoneId() == ZONE_ID_STORMWIND && player->GetTeamId() == TEAM_ALLIANCE)
- {
- if (!sCityBattle->isAllianceCaptured)
- {
- ChatHandler(player->GetSession()).PSendSysMessage("Flag is not captured to recapture.");
- return true;
- }
- }
- player->SetPvP(true);
- player->SetPlrTeleDestMap(-2); // effect flag capture
- player->CastSpell(player, 799, false); (loading thingy)
- return true;
- }
- };
- GameObjectAI* GetAI(GameObject* go) const override
- {
- return new go_city_battle_flagsAI(go);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment