// process the capture events bool OutdoorPvPNA::HandleEvent(uint32 eventId, GameObject* go, Unit* pInvoker, uint32 spellId) { // If we are not using the Halaa banner return if (go->GetEntry() != GO_HALAA_BANNER) return false; bool eventHandled = true; switch (eventId) { case EVENT_HALAA_BANNER_WIN_ALLIANCE: ProcessCaptureEvent(go, ALLIANCE); eventHandled = false; break; case EVENT_HALAA_BANNER_WIN_HORDE: ProcessCaptureEvent(go, HORDE); eventHandled = false; break; case EVENT_HALAA_BANNER_PROGRESS_ALLIANCE: SetBannerVisual(go, CAPTURE_ARTKIT_ALLIANCE, CAPTURE_ANIM_ALLIANCE); sWorld.SendDefenseMessage(ZONE_ID_NAGRAND, LANG_OPVP_NA_PROGRESS_A); break; case EVENT_HALAA_BANNER_PROGRESS_HORDE: SetBannerVisual(go, CAPTURE_ARTKIT_HORDE, CAPTURE_ANIM_HORDE); sWorld.SendDefenseMessage(ZONE_ID_NAGRAND, LANG_OPVP_NA_PROGRESS_H); break; } // there are some events which required further DB script return eventHandled; }
void OutdoorPvPTF::ProcessCaptureEvent(GameObject* pGo, uint32 uiTowerId, Team team, uint32 uiNewWorldState) { if (team != TEAM_NONE) { if (team == ALLIANCE) { SetBannerVisual(pGo, CAPTURE_ARTKIT_ALLIANCE, CAPTURE_ANIM_ALLIANCE); ++m_uiTowersAlliance; } else { SetBannerVisual(pGo, CAPTURE_ARTKIT_HORDE, CAPTURE_ANIM_HORDE); ++m_uiTowersHorde; } // if all towers are captured then process event if (m_uiTowersAlliance == MAX_TF_TOWERS || m_uiTowersHorde == MAX_TF_TOWERS) { SendUpdateWorldState(m_uiZoneWorldState, WORLD_STATE_REMOVE); m_uiZoneWorldState = team == ALLIANCE ? WORLD_STATE_TF_LOCKED_ALLIANCE : WORLD_STATE_TF_LOCKED_HORDE; SendUpdateWorldState(m_uiZoneWorldState, WORLD_STATE_ADD); m_uiZoneLockTimer = TIMER_TF_LOCK_TIME; UpdateTimerWorldState(); m_zoneOwner = team; BuffTeam(team, SPELL_AUCHINDOUN_BLESSING); // lock the towers LockTowers(pGo); } } else { SetBannerVisual(pGo, CAPTURE_ARTKIT_NEUTRAL, CAPTURE_ANIM_NEUTRAL); if (m_capturePointOwner[uiTowerId] == ALLIANCE) --m_uiTowersAlliance; else --m_uiTowersHorde; } // update tower state SendUpdateWorldState(m_uiTowerWorldState[uiTowerId], WORLD_STATE_REMOVE); m_uiTowerWorldState[uiTowerId] = uiNewWorldState; SendUpdateWorldState(m_uiTowerWorldState[uiTowerId], WORLD_STATE_ADD); // update tower count SendUpdateWorldState(WORLD_STATE_TF_TOWER_COUNT_A, m_uiTowersAlliance); SendUpdateWorldState(WORLD_STATE_TF_TOWER_COUNT_H, m_uiTowersHorde); // update capture point owner m_capturePointOwner[uiTowerId] = team; }
// process the capture events bool OutdoorPvPGH::HandleEvent(uint32 eventId, GameObject* go, Unit* invoker) { // If we are not using the lighthouse return if (go->GetEntry() != GO_VENTURE_BAY_LIGHTHOUSE) return false; bool eventHandled = true; switch (eventId) { case EVENT_LIGHTHOUSE_WIN_ALLIANCE: // Ignore the event if the zone is already in alliance control if (m_zoneOwner == ALLIANCE) return true; // Spawn the npcs only when the tower is fully controlled. Also allow the event to handle summons in DB. m_zoneOwner = ALLIANCE; LockLighthouse(go); DespawnVendors(go); eventHandled = false; break; case EVENT_LIGHTHOUSE_WIN_HORDE: // Ignore the event if the zone is already in horde control if (m_zoneOwner == HORDE) return true; // Spawn the npcs only when the tower is fully controlled. Also allow the event to handle summons in DB. m_zoneOwner = HORDE; LockLighthouse(go); DespawnVendors(go); eventHandled = false; break; case EVENT_LIGHTHOUSE_PROGRESS_ALLIANCE: SetBannerVisual(go, CAPTURE_ARTKIT_ALLIANCE, CAPTURE_ANIM_ALLIANCE); break; case EVENT_LIGHTHOUSE_PROGRESS_HORDE: SetBannerVisual(go, CAPTURE_ARTKIT_HORDE, CAPTURE_ANIM_HORDE); break; case EVENT_LIGHTHOUSE_NEUTRAL_ALLIANCE: case EVENT_LIGHTHOUSE_NEUTRAL_HORDE: m_zoneOwner = TEAM_NONE; SetBannerVisual(go, CAPTURE_ARTKIT_NEUTRAL, CAPTURE_ANIM_NEUTRAL); break; } // there are some events which required further DB script return eventHandled; }
void OutdoorPvPTF::ResetTowers(const WorldObject* objRef) { for (uint8 i = 0; i < MAX_TF_TOWERS; ++i) { if (GameObject* go = objRef->GetMap()->GetGameObject(m_TowerBannerGUID[i])) { go->SetCapturePointSlider(CAPTURE_SLIDER_NEUTRAL); SetBannerVisual(go, CAPTURE_ARTKIT_NEUTRAL, CAPTURE_ANIM_NEUTRAL); } else // if grid is unloaded, resetting the slider value is enough SetCapturePointSliderValue(aTerokkarTowers[i], CAPTURE_SLIDER_NEUTRAL); } }
// Handle towers reset when the timer expires void OutdoorPvPTF::ResetTowers(const WorldObject* objRef) { for (uint8 i = 0; i < MAX_TF_TOWERS; ++i) { if (GameObject* go = objRef->GetMap()->GetGameObject(m_towerBanners[i])) { go->SetCapturePointSlider(CAPTURE_SLIDER_MIDDLE); // visual update needed because banner still has artkit from previous owner SetBannerVisual(go, CAPTURE_ARTKIT_NEUTRAL, CAPTURE_ANIM_NEUTRAL); } else // if grid is unloaded, resetting the saved slider value is enough sOutdoorPvPMgr.SetCapturePointSlider(terokkarTowers[i], CAPTURE_SLIDER_MIDDLE); } }
void OutdoorPvP::SetBannerVisual(const WorldObject* objRef, ObjectGuid goGuid, uint32 artKit, uint32 animId) { if (GameObject* go = objRef->GetMap()->GetGameObject(goGuid)) SetBannerVisual(go, artKit, animId); }
bool OutdoorPvPTF::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team, uint32 newWorldState) { if (team == ALLIANCE) { // update banner SetBannerVisual(go, CAPTURE_ARTKIT_ALLIANCE, CAPTURE_ANIM_ALLIANCE); // update tower count ++m_towersAlliance; // if all towers are captured then process event if (m_towersAlliance == MAX_TF_TOWERS) { LockZone(go, towerId, team, newWorldState); return true; } // update tower count world state SendUpdateWorldState(WORLD_STATE_TF_TOWER_COUNT_A, m_towersAlliance); } else if (team == HORDE) { // update banner SetBannerVisual(go, CAPTURE_ARTKIT_HORDE, CAPTURE_ANIM_HORDE); // update tower count ++m_towersHorde; // if all towers are captured then process event if (m_towersHorde == MAX_TF_TOWERS) { LockZone(go, towerId, team, newWorldState); return true; } // update tower count world state SendUpdateWorldState(WORLD_STATE_TF_TOWER_COUNT_H, m_towersHorde); } else { // update banner SetBannerVisual(go, CAPTURE_ARTKIT_NEUTRAL, CAPTURE_ANIM_NEUTRAL); // update tower count if (m_towerOwner[towerId] == ALLIANCE) { --m_towersAlliance; SendUpdateWorldState(WORLD_STATE_TF_TOWER_COUNT_A, m_towersAlliance); } else { --m_towersHorde; SendUpdateWorldState(WORLD_STATE_TF_TOWER_COUNT_H, m_towersHorde); } } // update tower state SendUpdateWorldState(m_towerWorldState[towerId], WORLD_STATE_REMOVE); m_towerWorldState[towerId] = newWorldState; SendUpdateWorldState(m_towerWorldState[towerId], WORLD_STATE_ADD); // update capture point owner m_towerOwner[towerId] = team; // the are no DB exceptions in this case return true; }
bool OutdoorPvPHP::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team, uint32 newWorldState, uint32 towerArtKit, uint32 towerAnim) { // set artkits and process buffs if (team == ALLIANCE) { SetBannerVisual(go, CAPTURE_ARTKIT_ALLIANCE, CAPTURE_ANIM_ALLIANCE); // update counter state ++m_towersAlliance; SendUpdateWorldState(WORLD_STATE_HP_TOWER_COUNT_ALLIANCE, m_towersAlliance); if (m_towersAlliance == MAX_HP_TOWERS) BuffTeam(ALLIANCE, SPELL_HELLFIRE_SUPERIORITY_ALLIANCE); } else if (team == HORDE) { SetBannerVisual(go, CAPTURE_ARTKIT_HORDE, CAPTURE_ANIM_HORDE); // update counter ++m_towersHorde; SendUpdateWorldState(WORLD_STATE_HP_TOWER_COUNT_HORDE, m_towersHorde); if (m_towersHorde == MAX_HP_TOWERS) BuffTeam(HORDE, SPELL_HELLFIRE_SUPERIORITY_HORDE); } else { SetBannerVisual(go, CAPTURE_ARTKIT_NEUTRAL, CAPTURE_ANIM_NEUTRAL); if (m_towerOwner[towerId] == ALLIANCE) { if (m_towersAlliance == MAX_HP_TOWERS) BuffTeam(ALLIANCE, SPELL_HELLFIRE_SUPERIORITY_ALLIANCE, true); // update counter --m_towersAlliance; SendUpdateWorldState(WORLD_STATE_HP_TOWER_COUNT_ALLIANCE, m_towersAlliance); } else { if (m_towersHorde == MAX_HP_TOWERS) BuffTeam(HORDE, SPELL_HELLFIRE_SUPERIORITY_HORDE, true); // update counter --m_towersHorde; SendUpdateWorldState(WORLD_STATE_HP_TOWER_COUNT_HORDE, m_towersHorde); } } SetBannerVisual(go, m_banners[towerId], towerArtKit, towerAnim); // update tower state SendUpdateWorldState(m_towerWorldState[towerId], WORLD_STATE_REMOVE); m_towerWorldState[towerId] = newWorldState; SendUpdateWorldState(m_towerWorldState[towerId], WORLD_STATE_ADD); // update capture point owner m_towerOwner[towerId] = team; // the are no DB exceptions in this case return true; }
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; }
void OutdoorPvPEP::ProcessCaptureEvent(GameObject* pGo, uint32 uiTowerId, Team team, uint32 uiNewWorldState) { if (team == ALLIANCE) { for (std::list<ObjectGuid>::iterator itr = m_lTowerBanners[uiTowerId].begin(); itr != m_lTowerBanners[uiTowerId].end(); ++itr) SetBannerVisual(pGo, (*itr), CAPTURE_ARTKIT_ALLIANCE, CAPTURE_ANIM_ALLIANCE); ++m_uiTowersAlliance; BuffTeam(ALLIANCE, m_aPlaguelandsTowerBuffs[m_uiTowersAlliance - 1].uiSpellIdAlliance); } else if (team == HORDE) { for (std::list<ObjectGuid>::iterator itr = m_lTowerBanners[uiTowerId].begin(); itr != m_lTowerBanners[uiTowerId].end(); ++itr) SetBannerVisual(pGo, (*itr), CAPTURE_ARTKIT_HORDE, CAPTURE_ANIM_HORDE); ++m_uiTowersHorde; BuffTeam(HORDE, m_aPlaguelandsTowerBuffs[m_uiTowersHorde - 1].uiSpellIdHorde); } else { for (std::list<ObjectGuid>::iterator itr = m_lTowerBanners[uiTowerId].begin(); itr != m_lTowerBanners[uiTowerId].end(); ++itr) SetBannerVisual(pGo, (*itr), CAPTURE_ARTKIT_NEUTRAL, CAPTURE_ANIM_NEUTRAL); if (m_capturePointOwner[uiTowerId] == ALLIANCE) { if (--m_uiTowersAlliance == 0) BuffTeam(ALLIANCE, m_aPlaguelandsTowerBuffs[0].uiSpellIdAlliance, true); } else { if (--m_uiTowersHorde == 0) BuffTeam(HORDE, m_aPlaguelandsTowerBuffs[0].uiSpellIdHorde, true); } } // handle rewards of each tower if (team != TEAM_NONE) { // update capture point owner m_capturePointOwner[uiTowerId] = team; switch (uiTowerId) { case TOWER_ID_NORTHPASS: UpdateShrine(pGo); break; case TOWER_ID_CROWNGUARD: SetGraveyard(); break; case TOWER_ID_EASTWALL: if (m_capturePointOwner[TOWER_ID_NORTHPASS] != team) SummonSoldiers(pGo); break; case TOWER_ID_PLAGUEWOOD: SummonFlightMaster(pGo); break; } } else { switch (uiTowerId) { case TOWER_ID_NORTHPASS: UpdateShrine(pGo, true); break; case TOWER_ID_CROWNGUARD: SetGraveyard(true); break; case TOWER_ID_EASTWALL: UnsummonSoldiers(pGo); break; case TOWER_ID_PLAGUEWOOD: UnsummonFlightMaster(pGo); break; } // update capture point owner m_capturePointOwner[uiTowerId] = team; } // update tower state SendUpdateWorldState(m_uiTowerWorldState[uiTowerId], WORLD_STATE_REMOVE); m_uiTowerWorldState[uiTowerId] = uiNewWorldState; SendUpdateWorldState(m_uiTowerWorldState[uiTowerId], WORLD_STATE_ADD); // update counter state UpdateWorldState(); }