// Handle the gameobjects spawn/despawn depending on the controller faction void OutdoorPvPNA::HandleFactionObjects(const WorldObject* objRef) { if (m_zoneOwner == ALLIANCE) { for (uint8 i = 0; i < MAX_NA_ROOSTS; ++i) { RespawnGO(objRef, m_wagonsHorde[i], false); RespawnGO(objRef, m_roostsBrokenAlliance[i], false); RespawnGO(objRef, m_roostsAlliance[i], false); RespawnGO(objRef, m_wagonsAlliance[i], false); RespawnGO(objRef, m_roostsBrokenHorde[i], true); m_roostWorldState[i] = nagrandRoostStatesHordeNeutral[i]; } } else { for (uint8 i = 0; i < MAX_NA_ROOSTS; ++i) { RespawnGO(objRef, m_wagonsAlliance[i], false); RespawnGO(objRef, m_roostsBrokenHorde[i], false); RespawnGO(objRef, m_roostsHorde[i], false); RespawnGO(objRef, m_wagonsHorde[i], false); RespawnGO(objRef, m_roostsBrokenAlliance[i], true); m_roostWorldState[i] = nagrandRoostStatesAllianceNeutral[i]; } } }
bool OutdoorPvPNA::HandleGameObjectUse(Player* player, GameObject* go) { if (player->GetTeam() == ALLIANCE) { for (uint8 i = 0; i < MAX_NA_ROOSTS; ++i) { if (go->GetEntry() == nagrandWagonsAlliance[i]) { // update roost states UpdateWyvernsWorldState(WORLD_STATE_REMOVE); m_roostWorldState[i] = nagrandRoostStatesHordeNeutral[i]; UpdateWyvernsWorldState(WORLD_STATE_ADD); // spawn the broken roost and despawn the other one RespawnGO(go, m_roostsHorde[i], false); RespawnGO(go, m_roostsBrokenHorde[i], true); // no need to iterate the other roosts return false; } else if (go->GetEntry() == nagrandRoostsBrokenAlliance[i]) { // update roost states UpdateWyvernsWorldState(WORLD_STATE_REMOVE); m_roostWorldState[i] = nagrandRoostStatesAlliance[i]; UpdateWyvernsWorldState(WORLD_STATE_ADD); // spawn the repaired one along with the explosive wagon - the broken one despawns by self RespawnGO(go, m_wagonsHorde[i], true); RespawnGO(go, m_roostsAlliance[i], true); // no need to iterate the other roosts return false; } else if (go->GetEntry() == nagrandRoostsAlliance[i]) { // mark player as pvp player->UpdatePvP(true, true); player->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP); // prevent despawning after go use go->SetRespawnTime(0); // no need to iterate the other roosts return false; } } } else if (player->GetTeam() == HORDE) { for (uint8 i = 0; i < MAX_NA_ROOSTS; ++i) { if (go->GetEntry() == nagrandWagonsHorde[i]) { // update roost states UpdateWyvernsWorldState(WORLD_STATE_REMOVE); m_roostWorldState[i] = nagrandRoostStatesAllianceNeutral[i]; UpdateWyvernsWorldState(WORLD_STATE_ADD); // spawn the broken roost and despawn the other one RespawnGO(go, m_roostsAlliance[i], false); RespawnGO(go, m_roostsBrokenAlliance[i], true); // no need to iterate the other roosts return false; } else if (go->GetEntry() == nagrandRoostsBrokenHorde[i]) { // update roost states UpdateWyvernsWorldState(WORLD_STATE_REMOVE); m_roostWorldState[i] = nagrandRoostStatesHorde[i]; UpdateWyvernsWorldState(WORLD_STATE_ADD); // spawn the repaired one along with the explosive wagon - the broken one despawns by self RespawnGO(go, m_wagonsAlliance[i], true); RespawnGO(go, m_roostsHorde[i], true); // no need to iterate the other roosts return false; } else if (go->GetEntry() == nagrandRoostsHorde[i]) { // mark player as pvp player->UpdatePvP(true, true); player->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP); // prevent despawning after go use go->SetRespawnTime(0); // no need to iterate the other roosts return false; } } } return false; }
// Handle the graveyard banner use bool OutdoorPvPZM::HandleGameObjectUse(Player* player, GameObject* go) { Team team = player->GetTeam(); switch (go->GetEntry()) { case GO_ZANGA_BANNER_CENTER_NEUTRAL: break; case GO_ZANGA_BANNER_CENTER_ALLIANCE: if (team == ALLIANCE || !player->HasAura(SPELL_BATTLE_STANDARD_HORDE)) return false; break; case GO_ZANGA_BANNER_CENTER_HORDE: if (team == HORDE || !player->HasAura(SPELL_BATTLE_STANDARD_ALLIANCE)) return false; break; default: return false; } // disable old banners - note the alliance and horde banners can despawn by self if (m_graveyardOwner == ALLIANCE) { //RespawnGO(go, m_graveyardBannerAlliance, false); SetBeaconArtKit(go, m_beamGraveyardBlue, 0); } else if (m_graveyardOwner == HORDE) { //RespawnGO(go, m_graveyardBannerHorde, false); SetBeaconArtKit(go, m_beamGraveyardRed, 0); } else RespawnGO(go, m_graveyardBannerNeutral, false); if (team == ALLIANCE) { // change banners RespawnGO(go, m_graveyardBannerAlliance, true); SetBeaconArtKit(go, m_beamGraveyardBlue, SPELL_BEAM_BLUE); // update world state SendUpdateWorldState(m_graveyardWorldState, WORLD_STATE_REMOVE); m_graveyardWorldState = WORLD_STATE_ZM_GRAVEYARD_ALLIANCE; SendUpdateWorldState(m_graveyardWorldState, WORLD_STATE_ADD); // remove player flag aura player->RemoveAurasDueToSpell(SPELL_BATTLE_STANDARD_ALLIANCE); // send defense message sWorld.SendDefenseMessage(ZONE_ID_ZANGARMARSH, LANG_OPVP_ZM_CAPTURE_GRAVEYARD_A); } else { // change banners RespawnGO(go, m_graveyardBannerHorde, true); SetBeaconArtKit(go, m_beamGraveyardRed, SPELL_BEAM_RED); // update world state SendUpdateWorldState(m_graveyardWorldState, WORLD_STATE_REMOVE); m_graveyardWorldState = WORLD_STATE_ZM_GRAVEYARD_HORDE; SendUpdateWorldState(m_graveyardWorldState, WORLD_STATE_ADD); // remove player flag aura player->RemoveAurasDueToSpell(SPELL_BATTLE_STANDARD_HORDE); // send defense message sWorld.SendDefenseMessage(ZONE_ID_ZANGARMARSH, LANG_OPVP_ZM_CAPTURE_GRAVEYARD_H); } // change the graveyard link sObjectMgr.SetGraveYardLinkTeam(GRAVEYARD_ID_TWIN_SPIRE, GRAVEYARD_ZONE_TWIN_SPIRE, team); // apply zone buff if (m_graveyardOwner != TEAM_NONE) BuffTeam(m_graveyardOwner, SPELL_TWIN_SPIRE_BLESSING, true); BuffTeam(team, SPELL_TWIN_SPIRE_BLESSING); // reset scout so that team cannot take flag UpdateScoutState(team, false); // update graveyard owner m_graveyardOwner = team; return false; }
bool OutdoorPvPEP::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team, uint32 newWorldState) { if (team == ALLIANCE) { // update banner for (GuidList::const_iterator itr = m_towerBanners[towerId].begin(); itr != m_towerBanners[towerId].end(); ++itr) SetBannerVisual(go, (*itr), CAPTURE_ARTKIT_ALLIANCE, CAPTURE_ANIM_ALLIANCE); // update counter ++m_towersAlliance; SendUpdateWorldState(WORLD_STATE_EP_TOWER_COUNT_ALLIANCE, m_towersAlliance); // buff players BuffTeam(ALLIANCE, plaguelandsTowerBuffs[m_towersAlliance - 1].spellIdAlliance); } else if (team == HORDE) { // update banner for (GuidList::const_iterator itr = m_towerBanners[towerId].begin(); itr != m_towerBanners[towerId].end(); ++itr) SetBannerVisual(go, (*itr), CAPTURE_ARTKIT_HORDE, CAPTURE_ANIM_HORDE); // update counter ++m_towersHorde; SendUpdateWorldState(WORLD_STATE_EP_TOWER_COUNT_HORDE, m_towersHorde); // buff players BuffTeam(HORDE, plaguelandsTowerBuffs[m_towersHorde - 1].spellIdHorde); } else { // update banner for (GuidList::const_iterator itr = m_towerBanners[towerId].begin(); itr != m_towerBanners[towerId].end(); ++itr) SetBannerVisual(go, (*itr), CAPTURE_ARTKIT_NEUTRAL, CAPTURE_ANIM_NEUTRAL); if (m_towerOwner[towerId] == ALLIANCE) { // update counter --m_towersAlliance; SendUpdateWorldState(WORLD_STATE_EP_TOWER_COUNT_ALLIANCE, m_towersAlliance); if (m_towersAlliance == 0) BuffTeam(ALLIANCE, plaguelandsTowerBuffs[0].spellIdAlliance, true); } else { // update counter --m_towersHorde; SendUpdateWorldState(WORLD_STATE_EP_TOWER_COUNT_HORDE, m_towersHorde); if (m_towersHorde == 0) BuffTeam(HORDE, plaguelandsTowerBuffs[0].spellIdHorde, true); } } bool eventHandled = true; if (team != TEAM_NONE) { // update capture point owner before rewards are applied m_towerOwner[towerId] = team; // apply rewards of changed tower switch (towerId) { case TOWER_ID_NORTHPASS: RespawnGO(go, team == ALLIANCE ? m_lordaeronShrineAlliance : m_lordaeronShrineHorde, true); break; case TOWER_ID_CROWNGUARD: sObjectMgr.SetGraveYardLinkTeam(GRAVEYARD_ID_EASTERN_PLAGUE, GRAVEYARD_ZONE_EASTERN_PLAGUE, team); break; case TOWER_ID_EASTWALL: // Return false - allow the DB to handle summons if (m_towerOwner[TOWER_ID_NORTHPASS] != team) eventHandled = false; break; case TOWER_ID_PLAGUEWOOD: // Return false - allow the DB to handle summons eventHandled = false; break; } } else { // remove rewards of changed tower switch (towerId) { case TOWER_ID_NORTHPASS: RespawnGO(go, m_towerOwner[TOWER_ID_NORTHPASS] == ALLIANCE ? m_lordaeronShrineAlliance : m_lordaeronShrineHorde, false); break; case TOWER_ID_CROWNGUARD: sObjectMgr.SetGraveYardLinkTeam(GRAVEYARD_ID_EASTERN_PLAGUE, GRAVEYARD_ZONE_EASTERN_PLAGUE, TEAM_INVALID); break; case TOWER_ID_EASTWALL: UnsummonSoldiers(go); break; case TOWER_ID_PLAGUEWOOD: UnsummonFlightMaster(go); break; } // update capture point owner after rewards have been removed m_towerOwner[towerId] = team; } // update tower state SendUpdateWorldState(m_towerWorldState[towerId], WORLD_STATE_REMOVE); m_towerWorldState[towerId] = newWorldState; SendUpdateWorldState(m_towerWorldState[towerId], WORLD_STATE_ADD); // there are some events which required further DB script return eventHandled; }