void OutdoorPvPTF::UpdateTimerWorldState() { // Calculate time uint32 minutesLeft = m_zoneLockTimer / 60000; uint32 hoursLeft = minutesLeft / 60; minutesLeft -= hoursLeft * 60; uint32 firstDigit = minutesLeft / 10; SendUpdateWorldState(WORLD_STATE_TF_TIME_MIN_FIRST_DIGIT, firstDigit); SendUpdateWorldState(WORLD_STATE_TF_TIME_MIN_SECOND_DIGIT, minutesLeft - firstDigit * 10); SendUpdateWorldState(WORLD_STATE_TF_TIME_HOURS, hoursLeft); }
void OPvPCapturePoint::SendChangePhase() { if (!m_capturePoint) return; // send this too, sometimes the slider disappears, dunno why :( SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 1); // send these updates to only the ones in this objective SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f)); // send this too, sometimes it resets :S SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct); }
void BattlefieldTB::TowerDamaged(TBTowerId tbTowerId) { if (!IsWarTime()) return; SendWarning(TBTowers[tbTowerId].textDamaged); SetData(BATTLEFIELD_TB_DATA_TOWERS_INTACT, GetData(BATTLEFIELD_TB_DATA_TOWERS_INTACT) - 1); SendUpdateWorldState(uint32(TBTowers[tbTowerId].wsIntact[GetDefenderTeam()]), int32(0)); SendUpdateWorldState(uint32(TBTowers[tbTowerId].wsDamaged[GetDefenderTeam()]), int32(1)); TeamCastSpell(GetAttackerTeam(), SPELL_REWARD_TOWER_DAMAGED); }
void WorldPvPNA::UpdateWorldState(uint8 uiValue) { SendUpdateWorldState(m_uiControllerWorldState, uiValue); SendUpdateWorldState(m_uiControllerMapState, uiValue); // Update guards only for positive states if (uiValue) { SendUpdateWorldState(WORLD_STATE_NA_GUARDS_MAX, MAX_NA_GUARDS); SendUpdateWorldState(WORLD_STATE_NA_GUARDS_LEFT, m_uiGuardsLeft); } UpdateWyvernsWorldState(uiValue); }
void BfCapturePoint::SendChangePhase() { if (!m_capturePointGUID) return; if (GameObject* capturePoint = m_Bf->GetGameObject(m_capturePointGUID)) { // send this too, sometimes the slider disappears, dunno why :( SendUpdateWorldState(capturePoint->GetGOInfo()->controlZone.worldState1, 1); // send these updates to only the ones in this objective SendUpdateWorldState(capturePoint->GetGOInfo()->controlZone.worldstate2, (uint32)std::ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f)); // send this too, sometimes it resets :S SendUpdateWorldState(capturePoint->GetGOInfo()->controlZone.worldstate3, m_neutralValuePct); } }
bool OutdoorPvPHP::Update(uint32 diff) { bool changed = OutdoorPvP::Update(diff); if (changed) { if (m_AllianceTowersControlled == 3) TeamApplyBuff(TEAM_ALLIANCE, AllianceBuff, HordeBuff); else if (m_HordeTowersControlled == 3) TeamApplyBuff(TEAM_HORDE, HordeBuff, AllianceBuff); else { TeamCastSpell(TEAM_ALLIANCE, -AllianceBuff); TeamCastSpell(TEAM_HORDE, -HordeBuff); } SendUpdateWorldState(HP_UI_TOWER_COUNT_A, m_AllianceTowersControlled); SendUpdateWorldState(HP_UI_TOWER_COUNT_H, m_HordeTowersControlled); } return changed; }
bool OutdoorPvPHP::Update(uint32 diff) { bool changed = false; if(changed = OutdoorPvP::Update(diff)) { if(m_AllianceTowersControlled == 3) BuffTeam(ALLIANCE); else if(m_HordeTowersControlled == 3) BuffTeam(HORDE); else BuffTeam(NULL); SendUpdateWorldState(HP_UI_TOWER_COUNT_A, m_AllianceTowersControlled); SendUpdateWorldState(HP_UI_TOWER_COUNT_H, m_HordeTowersControlled); } return changed; }
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); } }
bool OutdoorPvPEP::Update(uint32 diff) { if (OutdoorPvP::Update(diff)) { m_AllianceTowersControlled = 0; m_HordeTowersControlled = 0; for (int i = 0; i < EP_TOWER_NUM; ++i) { if (EP_Controls[i] == ALLIANCE) ++m_AllianceTowersControlled; else if (EP_Controls[i] == HORDE) ++m_HordeTowersControlled; SendUpdateWorldState(EP_UI_TOWER_COUNT_A, m_AllianceTowersControlled); SendUpdateWorldState(EP_UI_TOWER_COUNT_H, m_HordeTowersControlled); BuffTeams(); } return true; } return false; }
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 OPvPWintergrasp::UpdateClockDigit(uint32 &timer, uint32 digit, uint32 mod) { uint32 value = timer%mod; timer /= mod; if (m_clock[digit] != value) { m_clock[digit] = value; SendUpdateWorldState(ClockWorldState[digit], value); } }
// Handle scout activation, when both beacons are captured void OutdoorPvPZM::UpdateScoutState(Team team, bool spawned) { if (team == ALLIANCE) { SendUpdateWorldState(m_scoutWorldStateAlliance, WORLD_STATE_REMOVE); m_scoutWorldStateAlliance = spawned ? WORLD_STATE_ZM_FLAG_READY_ALLIANCE : WORLD_STATE_ZM_FLAG_NOT_READY_ALLIANCE; SendUpdateWorldState(m_scoutWorldStateAlliance, WORLD_STATE_ADD); if (spawned) sWorld.SendDefenseMessage(ZONE_ID_ZANGARMARSH, LANG_OPVP_ZM_SPAWN_FIELD_SCOUT_A); } else { SendUpdateWorldState(m_scoutWorldStateHorde, WORLD_STATE_REMOVE); m_scoutWorldStateHorde = spawned ? WORLD_STATE_ZM_FLAG_READY_HORDE : WORLD_STATE_ZM_FLAG_NOT_READY_HORDE; SendUpdateWorldState(m_scoutWorldStateHorde, WORLD_STATE_ADD); if (spawned) sWorld.SendDefenseMessage(ZONE_ID_ZANGARMARSH, LANG_OPVP_ZM_SPAWN_FIELD_SCOUT_H); } }
void TolBaradCapturePoint::ChangeTeam(TeamId /*oldTeam*/) { // Find out index uint8 iBase = TB_BASE_COUNT; for (uint8 i = 0; i < TB_BASE_COUNT; i++) if (GetCapturePointEntry() == TBCapturePoints[i].entryFlagPole[m_Bf->GetDefenderTeam()]) iBase = i; if (iBase == TB_BASE_COUNT) return; // Turn off previous world state icon switch (m_OldState) { case BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE: case BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE: SendUpdateWorldState(TBCapturePoints[iBase].wsControlled[GetTeamId()], uint32(0)); break; case BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE: case BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: SendUpdateWorldState(TBCapturePoints[iBase].wsCapturing[TEAM_ALLIANCE], uint32(0)); break; case BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE: case BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: SendUpdateWorldState(TBCapturePoints[iBase].wsCapturing[TEAM_HORDE], uint32(0)); break; default: break; } // Turn on new world state icon and send warning switch (m_State) { case BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE: case BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE: m_Bf->SendWarning(TBCapturePoints[iBase].textGained[GetTeamId()]); SendUpdateWorldState(TBCapturePoints[iBase].wsControlled[GetTeamId()], uint32(1)); GetCapturePointGo()->SetGoArtKit(GetTeamId() == TEAM_ALLIANCE ? TB_GO_ARTKIT_FLAG_ALLIANCE : TB_GO_ARTKIT_FLAG_HORDE); break; case BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE: m_Bf->SendWarning(TBCapturePoints[iBase].textLost[TEAM_HORDE]); //no break here! case BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: SendUpdateWorldState(TBCapturePoints[iBase].wsCapturing[TEAM_ALLIANCE], uint32(1)); GetCapturePointGo()->SetGoArtKit(TB_GO_ARTKIT_FLAG_NONE); break; case BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE: m_Bf->SendWarning(TBCapturePoints[iBase].textLost[TEAM_ALLIANCE]); //no break here! case BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: SendUpdateWorldState(TBCapturePoints[iBase].wsCapturing[TEAM_HORDE], uint32(1)); GetCapturePointGo()->SetGoArtKit(TB_GO_ARTKIT_FLAG_NONE); break; default: break; } // Update counter m_Bf->ProcessEvent(NULL, EVENT_COUNT_CAPTURED_BASE); }
// Handle the zone reset when the timer expires void OutdoorPvPTF::UnlockZone() { // remove buffs BuffTeam(m_zoneOwner, SPELL_AUCHINDOUN_BLESSING, true); m_zoneOwner = TEAM_NONE; // reset world states and towers SendUpdateWorldState(m_zoneWorldState, WORLD_STATE_REMOVE); m_zoneWorldState = WORLD_STATE_TF_TOWERS_CONTROLLED; SendUpdateWorldState(m_zoneWorldState, WORLD_STATE_ADD); // reset tower states m_towerWorldState[0] = WORLD_STATE_TF_WEST_TOWER_NEUTRAL; m_towerWorldState[1] = WORLD_STATE_TF_NORTH_TOWER_NEUTRAL; m_towerWorldState[2] = WORLD_STATE_TF_EAST_TOWER_NEUTRAL; m_towerWorldState[3] = WORLD_STATE_TF_SOUTH_EAST_TOWER_NEUTRAL; m_towerWorldState[4] = WORLD_STATE_TF_SOUTH_TOWER_NEUTRAL; for (uint8 i = 0; i < MAX_TF_TOWERS; ++i) SendUpdateWorldState(m_towerWorldState[i], WORLD_STATE_ADD); // update tower count m_towersAlliance = 0; m_towersHorde = 0; SendUpdateWorldState(WORLD_STATE_TF_TOWER_COUNT_A, m_towersAlliance); SendUpdateWorldState(WORLD_STATE_TF_TOWER_COUNT_H, m_towersHorde); for (GuidZoneMap::iterator itr = m_zonePlayers.begin(); itr != m_zonePlayers.end(); ++itr) { // Find player who is in main zone (Terokkar Forest) to get correct map reference if (!itr->second) continue; if (Player* player = sObjectMgr.GetPlayer(itr->first)) { ResetTowers(player); break; } } }
bool OutdoorPvPEP::Update(uint32 diff) { bool changed = false; if (changed = OutdoorPvP::Update(diff)) { for (uint8 i = 0; i < OutdoorPvPEPTeamsBuffNum; ++i) { TeamCastSpell(TEAM_ALLIANCE, -EP_AllianceBuffs[i]); TeamCastSpell(TEAM_HORDE, -EP_HordeBuffs[i]); } uint32 AllianceBuff = m_AllianceTowersControlled > 0 ? EP_AllianceBuffs[m_AllianceTowersControlled-1] : 0; uint32 HordeBuff = m_HordeTowersControlled > 0 ? EP_HordeBuffs[m_HordeTowersControlled-1] : 0; if (m_AllianceTowersControlled > 0) TeamApplyBuff(TEAM_ALLIANCE, AllianceBuff, HordeBuff); if (m_HordeTowersControlled > 0) TeamApplyBuff(TEAM_HORDE, HordeBuff, AllianceBuff); SendUpdateWorldState(EP_UI_TOWER_COUNT_A, m_AllianceTowersControlled); SendUpdateWorldState(EP_UI_TOWER_COUNT_H, m_HordeTowersControlled); } return changed; }
void OPvPWintergrasp::ModifyWorkshopCount(TeamId team, bool add) { if (team == TEAM_NEUTRAL) return; if (add) ++m_workshopCount[team]; else if (m_workshopCount[team]) --m_workshopCount[team]; else sLog.outError("OPvPWintergrasp::ModifyWorkshopCount: negative workshop count!"); SendUpdateWorldState(MaxVehNumWorldState[team], m_workshopCount[team] * MAX_VEHICLE_PER_WORKSHOP); }
// Handle the zone lock when the timer is activated void OutdoorPvPTF::LockZone(GameObject* go, uint32 towerId, Team team, uint32 newWorldState) { SendUpdateWorldState(m_zoneWorldState, WORLD_STATE_REMOVE); m_zoneWorldState = team == ALLIANCE ? WORLD_STATE_TF_LOCKED_ALLIANCE : WORLD_STATE_TF_LOCKED_HORDE; SendUpdateWorldState(m_zoneWorldState, WORLD_STATE_ADD); m_zoneLockTimer = TIMER_TF_LOCK_TIME; UpdateTimerWorldState(); m_zoneOwner = team; BuffTeam(team, SPELL_AUCHINDOUN_BLESSING); // lock the towers LockTowers(go); sWorld.SendDefenseMessage(ZONE_ID_TEROKKAR_FOREST, team == ALLIANCE ? LANG_OPVP_TF_CAPTURE_ALL_TOWERS_A : LANG_OPVP_TF_CAPTURE_ALL_TOWERS_H); // remove tower states when zone has been captured and locked for (uint8 i = 0; i < MAX_TF_TOWERS; ++i) SendUpdateWorldState(m_towerWorldState[i], WORLD_STATE_REMOVE); m_towerWorldState[towerId] = newWorldState; }
void OutdoorPvPNA::HandleCreatureCreate(Creature* creature) { switch (creature->GetEntry()) { case NPC_RESEARCHER_KARTOS: case NPC_QUARTERMASTER_DAVIAN: case NPC_MERCHANT_ALDRAAN: case NPC_VENDOR_CENDRII: case NPC_AMMUNITIONER_BANRO: case NPC_RESEARCHER_AMERELDINE: case NPC_QUARTERMASTER_NORELIQE: case NPC_MERCHANT_COREIEL: case NPC_VENDOR_EMBELAR: case NPC_AMMUNITIONER_TASALDAN: m_teamVendors.push_back(creature->GetObjectGuid()); break; case NPC_HORDE_HALAANI_GUARD: case NPC_ALLIANCE_HANAANI_GUARD: // prevent updating guard counter on owner take over if (m_guardsLeft == MAX_NA_GUARDS) return; if (m_guardsLeft == 0) { LockHalaa(creature); // update world state SendUpdateWorldState(m_zoneMapState, WORLD_STATE_REMOVE); m_zoneMapState = m_zoneOwner == ALLIANCE ? WORLD_STATE_NA_HALAA_ALLIANCE : WORLD_STATE_NA_HALAA_HORDE; SendUpdateWorldState(m_zoneMapState, WORLD_STATE_ADD); } ++m_guardsLeft; SendUpdateWorldState(WORLD_STATE_NA_GUARDS_LEFT, m_guardsLeft); break; } }
void BattlefieldTB::UpdateCapturedBaseCount() { uint32 numCapturedBases = 0; // How many bases attacker has captured for (BfCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) if (itr->second->GetTeamId() == GetAttackerTeam()) numCapturedBases += 1; SetData(BATTLEFIELD_TB_DATA_BUILDINGS_CAPTURED, numCapturedBases); SendUpdateWorldState(TB_WS_BUILDINGS_CAPTURED, uint32(numCapturedBases)); // Check if attackers won if (numCapturedBases == TB_BASE_COUNT) EndBattle(false); }
void BattlefieldTB::OnStartGrouping() { UpdateNPCsAndGameObjects(); SendUpdateWorldState(TB_WS_STATE_PREPARATIONS, uint32(1)); // Teleport players out of questing area for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team) for (ObjectGuid const& guid : m_players[team]) if (Player* player = ObjectAccessor::FindPlayer(guid)) if (player->GetAreaId() == TBQuestAreas[m_iCellblockRandom].entry) player->CastSpell(player, TBQuestAreas[m_iCellblockRandom].teleportSpell, true); // Should we also teleport players out of Baradin Hold underground area? };
void BattlefieldTB::CapturePoint(uint32 team) { if (team == BATTLEFIELD_TB_TEAM_NEUTRAL) return; if (team == GetDefenderTeam()) m_Data32[BATTLEFIELD_TB_DATA_CAPTURED]--; else m_Data32[BATTLEFIELD_TB_DATA_CAPTURED]++; if (m_Data32[BATTLEFIELD_TB_DATA_CAPTURED] < 0) m_Data32[BATTLEFIELD_TB_DATA_CAPTURED] = 0; SendUpdateWorldState(WS_TB_COUNTER_BUILDINGS, m_Data32[BATTLEFIELD_TB_DATA_CAPTURED]); }
void OutdoorPvPNA::HandleCreatureDeath(Creature* creature) { if (creature->GetEntry() != NPC_HORDE_HALAANI_GUARD && creature->GetEntry() != NPC_ALLIANCE_HANAANI_GUARD) return; // get the location of the dead guard for future respawn float x, y, z, o; creature->GetRespawnCoord(x, y, z, &o); HalaaSoldiersSpawns location = {x, y, z, o}; m_deadSoldiers.push(location); // set the respawn timer after the last guard died - 5 min for the first time, or 1 hour if the city is under siege if (!m_soldiersRespawnTimer) m_soldiersRespawnTimer = m_isUnderSiege ? HOUR * IN_MILLISECONDS : 5 * MINUTE * IN_MILLISECONDS; // decrease the counter --m_guardsLeft; SendUpdateWorldState(WORLD_STATE_NA_GUARDS_LEFT, m_guardsLeft); if (m_guardsLeft == 0) { // set the zone under siege and increase the respawn timer m_isUnderSiege = true; m_soldiersRespawnTimer = HOUR * IN_MILLISECONDS; // make capturable UnlockHalaa(creature); // update world state SendUpdateWorldState(m_zoneMapState, WORLD_STATE_REMOVE); m_zoneMapState = m_zoneOwner == ALLIANCE ? WORLD_STATE_NA_HALAA_NEUTRAL_A : WORLD_STATE_NA_HALAA_NEUTRAL_H; SendUpdateWorldState(m_zoneMapState, WORLD_STATE_ADD); sWorld.SendDefenseMessage(ZONE_ID_NAGRAND, LANG_OPVP_NA_DEFENSELESS); } }
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; }
void WorldPvPEP::ProcessCaptureEvent(uint32 uiCaptureType, uint32 uiTeam, uint32 uiTower) { switch(uiTower) { case TOWER_ID_CROWNGUARD: // remove old tower state SendUpdateWorldState(m_uiCrownguardWorldState, 0); // update data SetData(TYPE_CROWNGUARD_STATE, uiCaptureType); SetData(TYPE_CROWNGUARD_CONTROLLER, uiTeam); // send new tower state SendUpdateWorldState(m_uiCrownguardWorldState, 1); break; case TOWER_ID_EASTWALL: // remove old tower state SendUpdateWorldState(m_uiEastwallWorldState, 0); // update data SetData(TYPE_EASTWALL_STATE, uiCaptureType); SetData(TYPE_EASTWALL_CONTROLLER, uiTeam); // send new tower state SendUpdateWorldState(m_uiEastwallWorldState, 1); break; case TOWER_ID_NORTHPASS: // remove old tower state SendUpdateWorldState(m_uiNorthpassWorldState, 0); // update data SetData(TYPE_NORTHPASS_STATE, uiCaptureType); SetData(TYPE_NORTHPASS_CONTROLLER, uiTeam); // send new tower state SendUpdateWorldState(m_uiNorthpassWorldState, 1); break; case TOWER_ID_PLAGUEWOOD: // remove old tower state SendUpdateWorldState(m_uiPlaguewoodWorldState, 0); // update data SetData(TYPE_PLAGUEWOOD_STATE, uiCaptureType); SetData(TYPE_PLAGUEWOOD_CONTROLLER, uiTeam); // send new tower state SendUpdateWorldState(m_uiPlaguewoodWorldState, 1); break; } }
void OutdoorPvPNA::ProcessCaptureEvent(GameObject* go, Team team) { BuffTeam(m_zoneOwner, SPELL_STRENGTH_HALAANI, true); // update capture point owner m_zoneOwner = team; LockHalaa(go); m_guardsLeft = MAX_NA_GUARDS; m_isUnderSiege = false; m_soldiersRespawnTimer = 0; UpdateWorldState(WORLD_STATE_REMOVE); DespawnVendors(go); sObjectMgr.SetGraveYardLinkTeam(GRAVEYARD_ID_HALAA, GRAVEYARD_ZONE_ID_HALAA, m_zoneOwner); if (m_zoneOwner == ALLIANCE) { m_zoneWorldState = WORLD_STATE_NA_GUARDS_ALLIANCE; m_zoneMapState = WORLD_STATE_NA_HALAA_ALLIANCE; } else { m_zoneWorldState = WORLD_STATE_NA_GUARDS_HORDE; m_zoneMapState = WORLD_STATE_NA_HALAA_HORDE; } HandleFactionObjects(go); UpdateWorldState(WORLD_STATE_ADD); SendUpdateWorldState(WORLD_STATE_NA_GUARDS_LEFT, m_guardsLeft); BuffTeam(m_zoneOwner, SPELL_STRENGTH_HALAANI); sWorld.SendDefenseMessage(ZONE_ID_NAGRAND, m_zoneOwner == ALLIANCE ? LANG_OPVP_NA_CAPTURE_A : LANG_OPVP_NA_CAPTURE_H); }
void OutdoorPvPNA::UpdateWyvernsWorldState(uint32 value) { for (uint8 i = 0; i < MAX_NA_ROOSTS; ++i) SendUpdateWorldState(m_roostWorldState[i], value); }
// Handle case when player returns a silithyst bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 triggerId) { if (player->isGameMaster() || player->isDead()) return false; switch (triggerId) { case AREATRIGGER_SILITHUS_ALLIANCE: if (player->GetTeam() != ALLIANCE || !player->HasAura(SPELL_SILITHYST)) return false; // update counter ++ m_resourcesAlliance; SendUpdateWorldState(WORLD_STATE_SI_GATHERED_A, m_resourcesAlliance); // handle the case when the faction has reached maximum resources allowed if (m_resourcesAlliance == MAX_SILITHYST) { // NOTE: On retail it would not reset until server restart but we do not support weekly restart :) m_zoneOwner = ALLIANCE; m_resourcesAlliance = 0; m_resourcesHorde = 0; // also update the horde counter if resources were reset SendUpdateWorldState(WORLD_STATE_SI_GATHERED_H, m_resourcesHorde); // apply buff to owner team BuffTeam(ALLIANCE, SPELL_CENARION_FAVOR); // Send defense message sWorld.SendDefenseMessage(ZONE_ID_SILITHUS, LANG_OPVP_SI_CAPTURE_A); } // give quest credit if necessary if (player->GetQuestStatus(QUEST_SCOURING_DESERT_ALLIANCE) == QUEST_STATUS_INCOMPLETE) player->KilledMonsterCredit(NPC_SILITHUS_DUST_QUEST_ALLIANCE); break; case AREATRIGGER_SILITHUS_HORDE: if (player->GetTeam() != HORDE || !player->HasAura(SPELL_SILITHYST)) return false; // update counter ++ m_resourcesHorde; SendUpdateWorldState(WORLD_STATE_SI_GATHERED_H, m_resourcesHorde); // handle the case when the faction has reached maximum resources allowed if (m_resourcesHorde == MAX_SILITHYST) { // NOTE: On retail it would not reset until server restart but we do not support weekly restart :) m_zoneOwner = HORDE; m_resourcesAlliance = 0; m_resourcesHorde = 0; // also update the alliance counter if resources were reset SendUpdateWorldState(WORLD_STATE_SI_GATHERED_A, m_resourcesAlliance); // apply buff to owner team BuffTeam(HORDE, SPELL_CENARION_FAVOR); // Send defense message sWorld.SendDefenseMessage(ZONE_ID_SILITHUS, LANG_OPVP_SI_CAPTURE_H); } // give quest credit if necessary if (player->GetQuestStatus(QUEST_SCOURING_DESERT_HORDE) == QUEST_STATUS_INCOMPLETE) player->KilledMonsterCredit(NPC_SILITHUS_DUST_QUEST_HORDE); break; default: return false; } // remove silithyst aura player->RemoveAurasDueToSpell(SPELL_SILITHYST); // reward the player player->CastSpell(player, SPELL_TRACES_OF_SILITHYST, true); player->RewardHonor(NULL, 1, HONOR_REWARD_SILITHYST); player->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(FACTION_CENARION_CIRCLE), REPUTATION_REWARD_SILITHYST); return true; }
bool OutdoorPvPTF::Update(uint32 diff) { bool changed = OutdoorPvP::Update(diff); if (changed) { if (m_AllianceTowersControlled == TF_TOWER_NUM) { TeamApplyBuff(TEAM_ALLIANCE, TF_CAPTURE_BUFF); m_IsLocked = true; SendUpdateWorldState(TF_UI_LOCKED_DISPLAY_NEUTRAL, uint32(0)); SendUpdateWorldState(TF_UI_LOCKED_DISPLAY_HORDE, uint32(0)); SendUpdateWorldState(TF_UI_LOCKED_DISPLAY_ALLIANCE, uint32(1)); SendUpdateWorldState(TF_UI_TOWERS_CONTROLLED_DISPLAY, uint32(0)); } else if (m_HordeTowersControlled == TF_TOWER_NUM) { TeamApplyBuff(TEAM_HORDE, TF_CAPTURE_BUFF); m_IsLocked = true; SendUpdateWorldState(TF_UI_LOCKED_DISPLAY_NEUTRAL, uint32(0)); SendUpdateWorldState(TF_UI_LOCKED_DISPLAY_HORDE, uint32(1)); SendUpdateWorldState(TF_UI_LOCKED_DISPLAY_ALLIANCE, uint32(0)); SendUpdateWorldState(TF_UI_TOWERS_CONTROLLED_DISPLAY, uint32(0)); } else { TeamCastSpell(TEAM_ALLIANCE, -TF_CAPTURE_BUFF); TeamCastSpell(TEAM_HORDE, -TF_CAPTURE_BUFF); } SendUpdateWorldState(TF_UI_TOWER_COUNT_A, m_AllianceTowersControlled); SendUpdateWorldState(TF_UI_TOWER_COUNT_H, m_HordeTowersControlled); } if (m_IsLocked) { // lock timer is down, release lock if (m_LockTimer < diff) { m_LockTimer = TF_LOCK_TIME; m_LockTimerUpdate = 0; m_IsLocked = false; SendUpdateWorldState(TF_UI_TOWERS_CONTROLLED_DISPLAY, uint32(1)); SendUpdateWorldState(TF_UI_LOCKED_DISPLAY_NEUTRAL, uint32(0)); SendUpdateWorldState(TF_UI_LOCKED_DISPLAY_HORDE, uint32(0)); SendUpdateWorldState(TF_UI_LOCKED_DISPLAY_ALLIANCE, uint32(0)); } else { // worldstateui update timer is down, update ui with new time data if (m_LockTimerUpdate < diff) { m_LockTimerUpdate = TF_LOCK_TIME_UPDATE; uint32 minutes_left = m_LockTimer / 60000; hours_left = minutes_left / 60; minutes_left -= hours_left * 60; second_digit = minutes_left % 10; first_digit = minutes_left / 10; SendUpdateWorldState(TF_UI_LOCKED_TIME_MINUTES_FIRST_DIGIT, first_digit); SendUpdateWorldState(TF_UI_LOCKED_TIME_MINUTES_SECOND_DIGIT, second_digit); SendUpdateWorldState(TF_UI_LOCKED_TIME_HOURS, hours_left); } else m_LockTimerUpdate -= diff; m_LockTimer -= diff; } } return changed; }
void WorldPvPNA::UpdateWyvernsWorldState(uint8 uiValue) { for (uint8 i = 0; i < MAX_NA_ROOSTS; ++i) SendUpdateWorldState(m_uiRoostWorldState[i], uiValue); }
bool WorldPvPZM::HandleObjectUse(Player* pPlayer, GameObject* pGo) { if (!pPlayer->HasAura(pPlayer->GetTeam() == ALLIANCE ? SPELL_BATTLE_STANDARD_ALY : SPELL_BATTLE_STANDARD_HORDE)) return false; switch (pGo->GetEntry()) { case GO_ZANGA_BANNER_CENTER_ALY: // clicked only by the horde if (pPlayer->GetTeam() == ALLIANCE) return false; // change banners SendUpdateWorldState(m_uiGraveyardWorldState, 0); DoHandleBanners(m_TowerBannerCenterAlyGUID, false); DoHandleBanners(m_TowerBannerCenterHordeGUID, true); DoSetBeaconArtkit(m_BeamCenterBlueGUID, false); sWorld.SendZoneText(ZONE_ID_ZANGARMARSH, sObjectMgr.GetMangosStringForDBCLocale(LANG_OPVP_ZM_LOOSE_GY_A)); // remove buff and graveyard from ally DoProcessTeamBuff(ALLIANCE, SPELL_TWIN_SPIRE_BLESSING, true); DoSetGraveyard(ALLIANCE, true); // add the buff and the graveyard to horde m_uiGraveyardWorldState = WORLD_STATE_GRAVEYARD_HORDE; SendUpdateWorldState(m_uiGraveyardWorldState, 1); DoProcessTeamBuff(HORDE, SPELL_TWIN_SPIRE_BLESSING); DoSetGraveyard(HORDE); // reset scout and remove player aura DoResetScouts(HORDE); m_uiGraveyardController = HORDE; pPlayer->RemoveAurasDueToSpell(SPELL_BATTLE_STANDARD_HORDE); DoSetBeaconArtkit(m_BeamCenterRedGUID, true); sWorld.SendZoneText(ZONE_ID_ZANGARMARSH, sObjectMgr.GetMangosStringForDBCLocale(LANG_OPVP_ZM_CAPTURE_GY_H)); return true; case GO_ZANGA_BANNER_CENTER_HORDE: // clicked only by the alliance if (pPlayer->GetTeam() == HORDE) return false; // change banners SendUpdateWorldState(m_uiGraveyardWorldState, 0); DoHandleBanners(m_TowerBannerCenterHordeGUID, false); DoHandleBanners(m_TowerBannerCenterAlyGUID, true); DoSetBeaconArtkit(m_BeamCenterRedGUID, false); sWorld.SendZoneText(ZONE_ID_ZANGARMARSH, sObjectMgr.GetMangosStringForDBCLocale(LANG_OPVP_ZM_LOOSE_GY_H)); // remove buff and graveyard from ally DoProcessTeamBuff(HORDE, SPELL_TWIN_SPIRE_BLESSING, true); DoSetGraveyard(HORDE, true); // add the buff and the graveyard to horde m_uiGraveyardWorldState = WORLD_STATE_GRAVEYARD_ALY; SendUpdateWorldState(m_uiGraveyardWorldState, 1); DoProcessTeamBuff(ALLIANCE, SPELL_TWIN_SPIRE_BLESSING); DoSetGraveyard(ALLIANCE); // reset scout and remove player aura DoResetScouts(ALLIANCE); m_uiGraveyardController = ALLIANCE; pPlayer->RemoveAurasDueToSpell(SPELL_BATTLE_STANDARD_ALY); DoSetBeaconArtkit(m_BeamCenterBlueGUID, true); sWorld.SendZoneText(ZONE_ID_ZANGARMARSH, sObjectMgr.GetMangosStringForDBCLocale(LANG_OPVP_ZM_CAPTURE_GY_A)); return true; case GO_ZANGA_BANNER_CENTER_NEUTRAL: // remove old world state SendUpdateWorldState(m_uiGraveyardWorldState, 0); if (pPlayer->GetTeam() == ALLIANCE) { // change banners DoHandleBanners(m_TowerBannerCenterNeutralGUID, false); DoHandleBanners(m_TowerBannerCenterAlyGUID, true); // add the buff and the graveyard to horde m_uiGraveyardWorldState= WORLD_STATE_GRAVEYARD_ALY; DoProcessTeamBuff(ALLIANCE, SPELL_TWIN_SPIRE_BLESSING); DoSetGraveyard(ALLIANCE); // reset scout and remove player aura DoResetScouts(ALLIANCE); m_uiGraveyardController = ALLIANCE; pPlayer->RemoveAurasDueToSpell(SPELL_BATTLE_STANDARD_ALY); DoSetBeaconArtkit(m_BeamCenterBlueGUID, true); sWorld.SendZoneText(ZONE_ID_ZANGARMARSH, sObjectMgr.GetMangosStringForDBCLocale(LANG_OPVP_ZM_CAPTURE_GY_H)); } else if (pPlayer->GetTeam() == HORDE) { // change banners DoHandleBanners(m_TowerBannerCenterNeutralGUID, false); DoHandleBanners(m_TowerBannerCenterHordeGUID, true); // add the buff and the graveyard to horde m_uiGraveyardWorldState = WORLD_STATE_GRAVEYARD_HORDE; DoProcessTeamBuff(HORDE, SPELL_TWIN_SPIRE_BLESSING); DoSetGraveyard(HORDE); // reset scout and remove player aura DoResetScouts(HORDE); m_uiGraveyardController = HORDE; pPlayer->RemoveAurasDueToSpell(SPELL_BATTLE_STANDARD_HORDE); DoSetBeaconArtkit(m_BeamCenterRedGUID, true); sWorld.SendZoneText(ZONE_ID_ZANGARMARSH, sObjectMgr.GetMangosStringForDBCLocale(LANG_OPVP_ZM_CAPTURE_GY_H)); } // add new world state SendUpdateWorldState(m_uiGraveyardWorldState, 1); return true; } return false; }