void BattlefieldWG::SendInitWorldStatesToAll() { for (uint8 team = 0; team < 2; team++) for (GuidSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) if (Player* player = sObjectAccessor->FindPlayer(*itr)) SendInitWorldStatesTo(player); }
void BattlefieldWG::OnPlayerJoinWar(Player* player) { RemoveAurasFromPlayer(player); player->CastSpell(player, SPELL_RECRUIT, true); if (player->GetZoneId() != m_ZoneId) { if (player->GetTeamId() == GetDefenderTeam()) player->TeleportTo(571, 5345, 2842, 410, 3.14f); else { if (player->GetTeamId() == TEAM_HORDE) player->TeleportTo(571, 5025.857422f, 3674.628906f, 362.737122f, 4.135169f); else player->TeleportTo(571, 5101.284f, 2186.564f, 373.549f, 3.812f); } } UpdateTenacity(); if (player->GetTeamId() == GetAttackerTeam()) { if (GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT) < 3) player->SetAuraStack(SPELL_TOWER_CONTROL, player, 3 - GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT)); } else { if (GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT) > 0) player->SetAuraStack(SPELL_TOWER_CONTROL, player, GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT)); } SendInitWorldStatesTo(player); }
void BattlefieldTB::OnPlayerJoinWar(Player* player) { player->RemoveAurasDueToSpell(SPELL_VETERAN); player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY_TB); player->RemoveAurasDueToSpell(SPELL_TOWER_BONUS); if (player->GetZoneId() != m_ZoneId) if (player->GetTeamId() == GetDefenderTeam()) { player->TeleportTo(732, -1244.58f, 981.233f, 155.426f, 0); player->CastSpell(player, SPELL_SLOW_FALL_TB, true); } else player->TeleportTo(732, -827.212646f, 1187.948608f, 112.81f, 3.092834f); if (player->GetTeamId() == GetAttackerTeam()) { player->CastSpell(player, SPELL_VETERAN, true); if (3-m_Data32[BATTLEFIELD_TB_DATA_BROKEN_TOWER_DEF]>0) player->SetAuraStack(SPELL_TOWER_BONUS, player, 3-m_Data32[BATTLEFIELD_TB_DATA_BROKEN_TOWER_DEF]); } else { if (m_Data32[BATTLEFIELD_TB_DATA_BROKEN_TOWER_DEF]>0) player->SetAuraStack(SPELL_TOWER_BONUS, player, m_Data32[BATTLEFIELD_TB_DATA_BROKEN_TOWER_DEF]); } SendInitWorldStatesTo(player); }
void BattlefieldTB::OnPlayerEnterZone(Player* player) { if (!m_isActive) RemoveAurasFromPlayer(player); SendInitWorldStatesTo(player); }
void BattlefieldWG::OnPlayerEnterZone(Player* player) { if (!m_isActive) RemoveAurasFromPlayer(player); player->AddAura(m_DefenderTeam == TEAM_HORDE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player); // Send worldstate to player SendInitWorldStatesTo(player); }
void OPvPWintergrasp::HandlePlayerEnterZone(Player * plr, uint32 zone) { if (m_wartime && !plr->HasAura(SPELL_RECRUIT) && !plr->HasAura(SPELL_CORPORAL) && !plr->HasAura(SPELL_LIEUTENANT)) plr->CastSpell(plr, SPELL_RECRUIT, true); SendInitWorldStatesTo(plr); OutdoorPvP::HandlePlayerEnterZone(plr, zone); UpdateTenacityStack(); }
void BattlefieldTB::OnPlayerEnterZone(Player* plr) { if (!m_WarTime) { plr->RemoveAurasDueToSpell(SPELL_TB_TOL_BARAD_VETERAN); plr->RemoveAurasDueToSpell(SPELL_TB_SPIRITUAL_IMMUNITY); plr->RemoveAurasDueToSpell(SPELL_TB_TOL_BARAD_TOWER_BONUS); } SendInitWorldStatesTo(plr); }
void BattlefieldTB::OnPlayerEnterZone(Player* player) { if(!m_WarTime) { player->RemoveAurasDueToSpell(SPELL_VETERAN); player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY_TB); player->RemoveAurasDueToSpell(SPELL_TOWER_BONUS); } // Send worldstate to player SendInitWorldStatesTo(player); }
bool OPvPWintergrasp::Update(uint32 diff) { if (m_timer > diff) { m_timer -= diff; if (m_wartime) OutdoorPvP::Update(diff); // update capture points UpdateClock(); } else { m_sendUpdate = false; if (m_wartime) { if (m_changeDefender) { m_changeDefender = false; m_defender = OTHER_TEAM(m_defender); if (m_defender == TEAM_ALLIANCE) sWorld.SendZoneText(ZONE_WINTERGRASP, "Alliance has taken over the fortress!"); else sWorld.SendZoneText(ZONE_WINTERGRASP, "Horde has taken over the fortress!"); } else { if (m_defender == TEAM_ALLIANCE) sWorld.SendZoneText(ZONE_WINTERGRASP, "Alliance has successfully defended the fortress!"); else sWorld.SendZoneText(ZONE_WINTERGRASP, "Horde has successfully defended the fortress!"); } EndBattle(); } else { sWorld.SendZoneText(ZONE_WINTERGRASP, "Battle begins!"); StartBattle(); } UpdateAllWorldObject(); UpdateClock(); SendInitWorldStatesTo(); m_sendUpdate = true; } return false; }
void OPvPWintergrasp::UpdateAllWorldObject() { // update cre and go factions for(GameObjectSet::iterator itr = m_gobjects.begin(); itr != m_gobjects.end(); ++itr) UpdateGameObjectInfo(*itr); for(CreatureSet::iterator itr = m_creatures.begin(); itr != m_creatures.end(); ++itr) UpdateCreatureInfo(*itr); // rebuild and update building states RebuildAllBuildings(); // update capture points for(OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) if(SiegeWorkshop *workshop = dynamic_cast<SiegeWorkshop*>(itr->second)) workshop->SetStateByBuildingState(); SendInitWorldStatesTo(); }
void BattlefieldWG::OnPlayerJoinWar(Player* player) { player->RemoveAurasDueToSpell(SPELL_RECRUIT); player->RemoveAurasDueToSpell(SPELL_CORPORAL); player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); player->RemoveAurasDueToSpell(SPELL_TENACITY); player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP); player->CastSpell(player, SPELL_RECRUIT, true); if (player->GetZoneId() != m_ZoneId) { if (player->GetTeamId() == GetDefenderTeam()) { player->TeleportTo(571, 5345, 2842, 410, 3.14f); } else { if (player->GetTeamId() == TEAM_HORDE) player->TeleportTo(571, 5025.857422f, 3674.628906f, 362.737122f, 4.135169f); else player->TeleportTo(571, 5101.284f, 2186.564f, 373.549f, 3.812f); } } UpdateTenacity(); if (player->GetTeamId() == GetAttackerTeam()) { if (3 - m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] > 0) player->SetAuraStack(SPELL_TOWER_CONTROL, player, 3 - m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT]); } else { if (m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] > 0) player->SetAuraStack(SPELL_TOWER_CONTROL, player, m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT]); } SendInitWorldStatesTo(player); }
void BattlefieldWG::OnPlayerEnterZone(Player* player) { player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP); if (!m_BattlefieldActive) { player->RemoveAurasDueToSpell(SPELL_RECRUIT); player->RemoveAurasDueToSpell(SPELL_CORPORAL); player->RemoveAurasDueToSpell(SPELL_LIEUTENANT); player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY); player->RemoveAurasDueToSpell(SPELL_TENACITY); player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA); player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL); if (player->GetTeamId() == GetDefenderTeam()) player->AddAura(SPELL_ESSENCE_OF_WINTERGRASP, player); } player->AddAura(m_DefenderTeam == TEAM_HORDE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player); // Send worldstate to player SendInitWorldStatesTo(player); }
void BattlefieldTB::SendInitWorldStatesToAll() { // Save sWorld->setWorldState(TB_WS_STATE_BATTLE, uint32(IsWarTime() ? 1 : 0)); sWorld->setWorldState(TB_WS_ALLIANCE_CONTROLS_SHOW, uint32(!IsWarTime() && GetDefenderTeam() == TEAM_ALLIANCE ? 1 : 0)); sWorld->setWorldState(TB_WS_HORDE_CONTROLS_SHOW, uint32(!IsWarTime() && GetDefenderTeam() == TEAM_HORDE ? 1 : 0)); sWorld->setWorldState(TB_WS_ALLIANCE_ATTACKING_SHOW, uint32(IsWarTime() && GetAttackerTeam() == TEAM_ALLIANCE ? 1 : 0)); sWorld->setWorldState(TB_WS_HORDE_ATTACKING_SHOW, uint32(IsWarTime() && GetAttackerTeam() == TEAM_HORDE ? 1 : 0)); sWorld->setWorldState(TB_WS_TIME_NEXT_BATTLE, uint32(!IsWarTime() ? m_Timer : 0)); sWorld->setWorldState(TB_WS_TIME_NEXT_BATTLE_SHOW, uint32(!IsWarTime() ? 1 : 0)); // Tol Barad for (uint8 team = 0; team < BG_TEAMS_COUNT; team++) for (ObjectGuid const& guid : m_players[team]) if (Player* player = ObjectAccessor::FindPlayer(guid)) SendInitWorldStatesTo(player); // Tol Barad Peninsula Map::PlayerList const& players = m_Map->GetPlayers(); for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) if (Player* player = itr->GetSource()->ToPlayer()) if (player->GetZoneId() == 5389) // ZONE_TOL_BARAD_PENINSULA player->SendInitWorldStates(5389, player->GetAreaId()); }
void BattlefieldWG::OnBattleStart() { // Spawn titan relic if (GameObject* relic = SpawnGameObject(GO_WINTERGRASP_TITAN_S_RELIC, 5440.0f, 2840.8f, 430.43f, 0)) { // Update faction of relic, only attacker can click on relic->SetFaction(WintergraspFaction[GetAttackerTeam()]); // Set in use (not allow to click on before last door is broken) relic->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); m_titansRelicGUID = relic->GetGUID(); } else TC_LOG_ERROR("bg.battlefield", "WG: Failed to spawn titan relic."); // Update tower visibility and update faction for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr) { if (Creature* creature = GetCreature(*itr)) { ShowNpc(creature, true); creature->setFaction(WintergraspFaction[GetDefenderTeam()]); } } // Rebuild all wall for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr) { if (*itr) { (*itr)->Rebuild(); (*itr)->UpdateTurretAttack(false); } } SetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT, 0); SetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF, 0); SetData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, 0); SetData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF, 0); // Update graveyard (in no war time all graveyard is to deffender, in war time, depend of base) for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) if (*itr) (*itr)->UpdateGraveyardAndWorkshop(); for (uint8 team = 0; team < 2; ++team) for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) { // Kick player in orb room, TODO: offline player ? if (Player* player = sObjectAccessor->FindPlayer(*itr)) { float x, y, z; player->GetPosition(x, y, z); if (5500 > x && x > 5392 && y < 2880 && y > 2800 && z < 480) player->TeleportTo(571, 5349.8686f, 2838.481f, 409.240f, 0.046328f); SendInitWorldStatesTo(player); } } // Initialize vehicle counter UpdateCounterVehicle(true); // Send start warning to all players SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_START); }