bool OutdoorPvPHP::Update(uint32 diff) { bool changed = false; if(changed = OutdoorPvP::Update(diff)) { 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 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 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 OutdoorPvP::TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2) { TeamCastSpell(team, spellId); TeamCastSpell(OTHER_TEAM(team), spellId2 ? -(int32)spellId2 : -(int32)spellId); }
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 OutdoorPvP::TeamApplyBuff(BattleGroundTeamId team, uint32 spellId, uint32 spellId2) { TeamCastSpell(team, spellId); TeamCastSpell(BattleGroundTeamId(BattleGround::GetOtherTeam(team)), spellId2 ? -(int32)spellId2 : -(int32)spellId); }
void OutdoorPvP::TeamApplyBuff(TeamId teamId, uint32 spellId, uint32 spellId2, Player* sameMapPlr) { TeamCastSpell(teamId, spellId, sameMapPlr); TeamCastSpell(teamId == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE, spellId2 ? -(int32)spellId2 : -(int32)spellId, sameMapPlr); }