void WorldPvPTF::Update(uint32 diff) { if (m_uiZoneLockTimer) { if (m_uiZoneLockTimer < diff) { // remove buffs DoProcessTeamBuff(ALLIANCE, SPELL_AUCHINDOUN_BLESSING, true); DoProcessTeamBuff(HORDE, SPELL_AUCHINDOUN_BLESSING, true); // reset world states and towers UpdateWorldState(0); m_uiZoneController = NEUTRAL; m_uiControllerWorldState = WORLD_STATE_TF_TOWERS_CONTROLLED; m_uiTowersAlly = 0; m_uiTowersHorde = 0; m_uiTowerWorldState[0] = WORLD_STATE_TOWER_1_NEUTRAL; m_uiTowerWorldState[1] = WORLD_STATE_TOWER_2_NEUTRAL; m_uiTowerWorldState[2] = WORLD_STATE_TOWER_3_NEUTRAL; m_uiTowerWorldState[3] = WORLD_STATE_TOWER_4_NEUTRAL; m_uiTowerWorldState[4] = WORLD_STATE_TOWER_5_NEUTRAL; UpdateWorldState(1); // update towers count SendUpdateWorldState(WORLD_STATE_TF_TOWER_COUNT_A, m_uiTowersAlly); SendUpdateWorldState(WORLD_STATE_TF_TOWER_COUNT_H, m_uiTowersHorde); for (uint8 i = 0; i < MAX_TF_TOWERS; ++i) { SetBannerArtKit(m_TowerBannerGUID[i], GO_ARTKIT_BANNER_NEUTRAL); // if grid is unloaded the slider reset is enough ResetCapturePoint(aTerokkarTowers[i], CAPTURE_SLIDER_NEUTRAL); // if grid is not unloaded then reset the tower manually DoResetCapturePoints(m_TowerBannerGUID[i]); LockCapturePoint(aTerokkarTowers[i], false); } m_uiZoneLockTimer = 0; } else { if (m_uiZoneUpdateTimer < diff) { // update timer UpdateTimerWorldState(); m_uiZoneUpdateTimer = TIMER_TF_UPDATE_TIME; } else m_uiZoneUpdateTimer -= diff; m_uiZoneLockTimer -= diff; } } }
void WorldPvPNA::OnCreatureDeath(Creature* pCreature) { if (pCreature->GetEntry() != NPC_HORDE_HALAANI_GUARD && pCreature->GetEntry() != NPC_ALLIANCE_HANAANI_GUARD) return; --m_uiGuardsLeft; SendUpdateWorldState(WORLD_STATE_NA_GUARDS_LEFT, m_uiGuardsLeft); if (m_uiGuardsLeft == 0) { // make capturable LockCapturePoint(GO_HALAA_BANNER, false); SendUpdateWorldState(m_uiControllerMapState, 0); m_uiControllerMapState = m_uiZoneController == ALLIANCE ? WORLD_STATE_NA_HALAA_NEU_A : WORLD_STATE_NA_HALAA_NEU_H; SendUpdateWorldState(m_uiControllerMapState, 1); } }
void WorldPvPNA::OnCreatureRespawn(Creature* pCreature) { if (pCreature->GetEntry() != NPC_HORDE_HALAANI_GUARD && pCreature->GetEntry() != NPC_ALLIANCE_HANAANI_GUARD) return; ++m_uiGuardsLeft; SendUpdateWorldState(WORLD_STATE_NA_GUARDS_LEFT, m_uiGuardsLeft); if (m_uiGuardsLeft > 0) LockCapturePoint(GO_HALAA_BANNER, true); if (m_uiGuardsLeft == MAX_NA_GUARDS) { SendUpdateWorldState(m_uiControllerMapState, 0); m_uiControllerMapState = m_uiZoneController == ALLIANCE ? WORLD_STATE_NA_HALAA_ALLIANCE : WORLD_STATE_NA_HALAA_HORDE; SendUpdateWorldState(m_uiControllerMapState, 1); } }
void WorldPvPTF::ProcessCaptureEvent(uint32 uiCaptureType, uint32 uiTeam, uint32 uiNewWorldState, uint32 uiTower) { for (uint8 i = 0; i < MAX_TF_TOWERS; ++i) { if (uiTower == i) { // remove old tower state SendUpdateWorldState(m_uiTowerWorldState[i], 0); if (uiCaptureType == PROGRESS) { SetBannerArtKit(m_TowerBannerGUID[i], uiTeam == ALLIANCE ? GO_ARTKIT_BANNER_ALLIANCE : GO_ARTKIT_BANNER_HORDE); if (uiTeam == ALLIANCE) ++m_uiTowersAlly; else ++m_uiTowersHorde; } else if (uiCaptureType == NEUTRAL) { SetBannerArtKit(m_TowerBannerGUID[i], GO_ARTKIT_BANNER_NEUTRAL); if (uiTeam == ALLIANCE) --m_uiTowersHorde; else --m_uiTowersAlly; } // send new tower state m_uiTowerWorldState[i] = uiNewWorldState; SendUpdateWorldState(m_uiTowerWorldState[i], 1); } } // update towers count SendUpdateWorldState(WORLD_STATE_TF_TOWER_COUNT_A, m_uiTowersAlly); SendUpdateWorldState(WORLD_STATE_TF_TOWER_COUNT_H, m_uiTowersHorde); // If all towers are captured then process event if (m_uiTowersAlly == MAX_TF_TOWERS) { SendUpdateWorldState(m_uiControllerWorldState, 0); m_uiControllerWorldState = WORLD_STATE_TF_LOCKED_ALLIANCE; SendUpdateWorldState(m_uiControllerWorldState, 1); m_uiZoneLockTimer = TIMER_TF_LOCK_TIME; UpdateTimerWorldState(); m_uiZoneController = ALLIANCE; DoProcessTeamBuff(ALLIANCE, SPELL_AUCHINDOUN_BLESSING); // lock the towers for (uint8 i = 0; i < MAX_TF_TOWERS; i++) LockCapturePoint(aTerokkarTowers[i], true); } else if (m_uiTowersHorde == MAX_TF_TOWERS) { SendUpdateWorldState(m_uiControllerWorldState, 0); m_uiControllerWorldState = WORLD_STATE_TF_LOCKED_HORDE; SendUpdateWorldState(m_uiControllerWorldState, 1); m_uiZoneLockTimer = TIMER_TF_LOCK_TIME; UpdateTimerWorldState(); m_uiZoneController = HORDE; DoProcessTeamBuff(HORDE, SPELL_AUCHINDOUN_BLESSING); // lock the towers for (uint8 i = 0; i < MAX_TF_TOWERS; i++) LockCapturePoint(aTerokkarTowers[i], true); } }