fix(Core/Weather): Improve weather system thread safety (#22772)

Co-authored-by: Shauren <shauren.trinity@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Takenbacon
2025-09-29 07:43:30 -07:00
committed by GitHub
parent 5f17121117
commit 22f93eaca6
20 changed files with 186 additions and 247 deletions

View File

@@ -1289,13 +1289,9 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea, bool force)
return;
if (sWorld->getBoolConfig(CONFIG_WEATHER))
{
if (Weather* weather = WeatherMgr::FindWeather(zone->ID))
weather->SendWeatherUpdateToPlayer(this);
else if (!WeatherMgr::AddWeather(zone->ID))
// send fine weather packet to remove old zone's weather
WeatherMgr::SendFineWeatherUpdateToPlayer(this);
}
GetMap()->GetOrGenerateZoneDefaultWeather(newZone);
GetMap()->SendZoneDynamicInfo(newZone, this);
sScriptMgr->OnPlayerUpdateZone(this, newZone, newArea);

View File

@@ -1179,7 +1179,6 @@ void WorldSession::HandlePlayerLoginToCharInWorld(Player* pCurrChar)
// necessary actions from AddPlayerToMap:
pCurrChar->GetMap()->SendInitTransports(pCurrChar);
pCurrChar->GetMap()->SendInitSelf(pCurrChar);
pCurrChar->GetMap()->SendZoneDynamicInfo(pCurrChar);
// If we are logging into an existing player, simply clear visibility references
// so player will receive a fresh list of new objects on the next vis update.

View File

@@ -43,10 +43,11 @@
#include "Vehicle.h"
#include "VMapMgr2.h"
#include "Weather.h"
#include "WeatherMgr.h"
#define MAP_INVALID_ZONE 0xFFFFFFFF
ZoneDynamicInfo::ZoneDynamicInfo() : MusicId(0), WeatherId(WEATHER_STATE_FINE),
ZoneDynamicInfo::ZoneDynamicInfo() : MusicId(0), DefaultWeather(nullptr), WeatherId(WEATHER_STATE_FINE),
WeatherGrade(0.0f), OverrideLightId(0), LightFadeInTime(0) { }
Map::~Map()
@@ -74,6 +75,7 @@ Map::Map(uint32 id, uint32 InstanceId, uint8 SpawnMode, Map* _parent) :
//lets initialize visibility distance for map
Map::InitVisibilityDistance();
_weatherUpdateTimer.SetInterval(1 * IN_MILLISECONDS);
_corpseUpdateTimer.SetInterval(20 * MINUTE * IN_MILLISECONDS);
}
@@ -268,7 +270,6 @@ bool Map::AddPlayerToMap(Player* player)
SendInitTransports(player);
SendInitSelf(player);
SendZoneDynamicInfo(player);
player->UpdateObjectVisibility(false);
@@ -500,6 +501,7 @@ void Map::Update(const uint32 t_diff, const uint32 s_diff, bool /*thread*/)
HandleDelayedVisibility();
UpdateWeather(t_diff);
UpdateExpiredCorpses(t_diff);
sScriptMgr->OnMapUpdate(this, t_diff);
@@ -2767,9 +2769,37 @@ void Map::ScheduleCreatureRespawn(ObjectGuid creatureGuid, Milliseconds respawnT
});
}
void Map::SendZoneDynamicInfo(Player* player)
/// Send a packet to all players (or players selected team) in the zone (except self if mentioned)
bool Map::SendZoneMessage(uint32 zone, WorldPacket const* packet, WorldSession const* self, TeamId teamId) const
{
bool foundPlayerToSend = false;
for (MapReference const& ref : GetPlayers())
{
Player* player = ref.GetSource();
if (player->IsInWorld() &&
player->GetZoneId() == zone &&
player->GetSession() != self &&
(teamId == TEAM_NEUTRAL || player->GetTeamId() == teamId))
{
player->SendDirectMessage(packet);
foundPlayerToSend = true;
}
}
return foundPlayerToSend;
}
/// Send a System Message to all players in the zone (except self if mentioned)
void Map::SendZoneText(uint32 zoneId, char const* text, WorldSession const* self, TeamId teamId) const
{
WorldPacket data;
ChatHandler::BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, text);
SendZoneMessage(zoneId, &data, self, teamId);
}
void Map::SendZoneDynamicInfo(uint32 zoneId, Player* player) const
{
uint32 zoneId = player->GetZoneId();
ZoneDynamicInfoMap::const_iterator itr = _zoneDynamicInfo.find(zoneId);
if (itr == _zoneDynamicInfo.end())
return;
@@ -2777,15 +2807,11 @@ void Map::SendZoneDynamicInfo(Player* player)
if (uint32 music = itr->second.MusicId)
player->SendDirectMessage(WorldPackets::Misc::PlayMusic(music).Write());
if (WeatherState weatherId = itr->second.WeatherId)
{
WorldPackets::Misc::Weather weather(weatherId, itr->second.WeatherGrade);
player->SendDirectMessage(weather.Write());
}
SendZoneWeather(itr->second, player);
if (uint32 overrideLight = itr->second.OverrideLightId)
{
WorldPacket data(SMSG_OVERRIDE_LIGHT, 4 + 4 + 1);
WorldPacket data(SMSG_OVERRIDE_LIGHT, 4 + 4 + 4);
data << uint32(_defaultLight);
data << uint32(overrideLight);
data << uint32(itr->second.LightFadeInTime);
@@ -2793,6 +2819,41 @@ void Map::SendZoneDynamicInfo(Player* player)
}
}
void Map::SendZoneWeather(uint32 zoneId, Player* player) const
{
ZoneDynamicInfoMap::const_iterator itr = _zoneDynamicInfo.find(zoneId);
if (itr == _zoneDynamicInfo.end())
return;
SendZoneWeather(itr->second, player);
}
void Map::SendZoneWeather(ZoneDynamicInfo const& zoneDynamicInfo, Player* player) const
{
if (WeatherState weatherId = zoneDynamicInfo.WeatherId)
{
WorldPackets::Misc::Weather weather(weatherId, zoneDynamicInfo.WeatherGrade);
player->SendDirectMessage(weather.Write());
}
else if (zoneDynamicInfo.DefaultWeather)
zoneDynamicInfo.DefaultWeather->SendWeatherUpdateToPlayer(player);
else
Weather::SendFineWeatherUpdateToPlayer(player);
}
void Map::UpdateWeather(uint32 const diff)
{
_weatherUpdateTimer.Update(diff);
if (!_weatherUpdateTimer.Passed())
return;
for (auto&& zoneInfo : _zoneDynamicInfo)
if (zoneInfo.second.DefaultWeather && !zoneInfo.second.DefaultWeather->Update(_weatherUpdateTimer.GetInterval()))
zoneInfo.second.DefaultWeather.reset();
_weatherUpdateTimer.Reset();
}
void Map::PlayDirectSoundToMap(uint32 soundId, uint32 zoneId)
{
Map::PlayerList const& players = GetPlayers();
@@ -2810,67 +2871,50 @@ void Map::PlayDirectSoundToMap(uint32 soundId, uint32 zoneId)
void Map::SetZoneMusic(uint32 zoneId, uint32 musicId)
{
if (_zoneDynamicInfo.find(zoneId) == _zoneDynamicInfo.end())
_zoneDynamicInfo.insert(ZoneDynamicInfoMap::value_type(zoneId, ZoneDynamicInfo()));
_zoneDynamicInfo[zoneId].MusicId = musicId;
Map::PlayerList const& players = GetPlayers();
if (!players.IsEmpty())
{
WorldPackets::Misc::PlayMusic playMusic(musicId);
playMusic.Write();
WorldPackets::Misc::PlayMusic playMusic(musicId);
SendZoneMessage(zoneId, WorldPackets::Misc::PlayMusic(musicId).Write());
}
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
if (Player* player = itr->GetSource())
if (player->GetZoneId() == zoneId)
player->SendDirectMessage(playMusic.GetRawPacket());
Weather* Map::GetOrGenerateZoneDefaultWeather(uint32 zoneId)
{
WeatherData const* weatherData = WeatherMgr::GetWeatherData(zoneId);
if (!weatherData)
return nullptr;
ZoneDynamicInfo& info = _zoneDynamicInfo[zoneId];
if (!info.DefaultWeather)
{
info.DefaultWeather = std::make_unique<Weather>(this, zoneId, weatherData);
info.DefaultWeather->ReGenerate();
info.DefaultWeather->UpdateWeather();
}
return info.DefaultWeather.get();
}
void Map::SetZoneWeather(uint32 zoneId, WeatherState weatherId, float weatherGrade)
{
if (_zoneDynamicInfo.find(zoneId) == _zoneDynamicInfo.end())
_zoneDynamicInfo.insert(ZoneDynamicInfoMap::value_type(zoneId, ZoneDynamicInfo()));
ZoneDynamicInfo& info = _zoneDynamicInfo[zoneId];
info.WeatherId = weatherId;
info.WeatherGrade = weatherGrade;
Map::PlayerList const& players = GetPlayers();
if (!players.IsEmpty())
{
WorldPackets::Misc::Weather weather(weatherId, weatherGrade);
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
if (Player* player = itr->GetSource())
if (player->GetZoneId() == zoneId)
player->SendDirectMessage(weather.Write());
}
SendZoneMessage(zoneId, WorldPackets::Misc::Weather(weatherId, weatherGrade).Write());
}
void Map::SetZoneOverrideLight(uint32 zoneId, uint32 lightId, Milliseconds fadeInTime)
{
if (_zoneDynamicInfo.find(zoneId) == _zoneDynamicInfo.end())
_zoneDynamicInfo.insert(ZoneDynamicInfoMap::value_type(zoneId, ZoneDynamicInfo()));
ZoneDynamicInfo& info = _zoneDynamicInfo[zoneId];
info.OverrideLightId = lightId;
info.LightFadeInTime = static_cast<uint32>(fadeInTime.count());
Map::PlayerList const& players = GetPlayers();
if (!players.IsEmpty())
{
WorldPacket data(SMSG_OVERRIDE_LIGHT, 4 + 4 + 4);
data << uint32(_defaultLight);
data << uint32(lightId);
data << uint32(static_cast<uint32>(fadeInTime.count()));
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
if (Player* player = itr->GetSource())
if (player->GetZoneId() == zoneId)
player->SendDirectMessage(&data);
}
WorldPacket data(SMSG_OVERRIDE_LIGHT, 4 + 4 + 4);
data << uint32(_defaultLight);
data << uint32(lightId);
data << uint32(static_cast<uint32>(fadeInTime.count()));
SendZoneMessage(zoneId, &data);
}
void Map::DoForAllPlayers(std::function<void(Player*)> exec)

View File

@@ -47,6 +47,7 @@ class InstanceScript;
class Group;
class InstanceSave;
class Object;
class Weather;
class WorldObject;
class TempSummon;
class Player;
@@ -62,6 +63,7 @@ class Transport;
class StaticTransport;
class MotionTransport;
class PathGenerator;
class WorldSession;
enum WeatherState : uint32;
@@ -132,6 +134,7 @@ struct ZoneDynamicInfo
ZoneDynamicInfo();
uint32 MusicId;
std::unique_ptr<Weather> DefaultWeather;
WeatherState WeatherId;
float WeatherGrade;
uint32 OverrideLightId;
@@ -440,15 +443,22 @@ public:
static void DeleteRespawnTimesInDB(uint16 mapId, uint32 instanceId);
bool SendZoneMessage(uint32 zone, WorldPacket const* packet, WorldSession const* self = nullptr, TeamId teamId = TEAM_NEUTRAL) const;
void SendZoneText(uint32 zoneId, char const* text, WorldSession const* self = nullptr, TeamId teamId = TEAM_NEUTRAL) const;
void SendInitTransports(Player* player);
void SendRemoveTransports(Player* player);
void SendZoneDynamicInfo(Player* player);
void SendZoneDynamicInfo(uint32 zoneId, Player* player) const;
void SendZoneWeather(uint32 zoneId, Player* player) const;
void SendZoneWeather(ZoneDynamicInfo const& zoneDynamicInfo, Player* player) const;
void SendInitSelf(Player* player);
void UpdateWeather(uint32 const diff);
void UpdateExpiredCorpses(uint32 const diff);
void PlayDirectSoundToMap(uint32 soundId, uint32 zoneId = 0);
void SetZoneMusic(uint32 zoneId, uint32 musicId);
Weather* GetOrGenerateZoneDefaultWeather(uint32 zoneId);
void SetZoneWeather(uint32 zoneId, WeatherState weatherId, float weatherGrade);
void SetZoneOverrideLight(uint32 zoneId, uint32 lightId, Milliseconds fadeInTime);
@@ -584,6 +594,7 @@ private:
std::unordered_map<uint32, uint32> _zonePlayerCountMap;
ZoneDynamicInfoMap _zoneDynamicInfo;
IntervalTimer _weatherUpdateTimer;
uint32 _defaultLight;
IntervalTimer _corpseUpdateTimer;

View File

@@ -398,29 +398,6 @@ void WorldSessionMgr::SendGlobalGMMessage(WorldPacket const* packet, WorldSessio
}
}
/// Send a packet to all players (or players selected team) in the zone (except self if mentioned)
bool WorldSessionMgr::SendZoneMessage(uint32 zone, WorldPacket const* packet, WorldSession* self, TeamId teamId)
{
bool foundPlayerToSend = false;
SessionMap::const_iterator itr;
for (itr = _sessions.begin(); itr != _sessions.end(); ++itr)
{
if (itr->second &&
itr->second->GetPlayer() &&
itr->second->GetPlayer()->IsInWorld() &&
itr->second->GetPlayer()->GetZoneId() == zone &&
itr->second != self &&
(teamId == TEAM_NEUTRAL || itr->second->GetPlayer()->GetTeamId() == teamId))
{
itr->second->SendPacket(packet);
foundPlayerToSend = true;
}
}
return foundPlayerToSend;
}
/// Send a server message to the user(s)
void WorldSessionMgr::SendServerMessage(ServerMessageType messageID, std::string stringParam /*= ""*/, Player* player /*= nullptr*/)
{
@@ -435,14 +412,6 @@ void WorldSessionMgr::SendServerMessage(ServerMessageType messageID, std::string
SendGlobalMessage(chatServerMessage.Write());
}
/// Send a System Message to all players in the zone (except self if mentioned)
void WorldSessionMgr::SendZoneText(uint32 zone, std::string text, WorldSession* self, TeamId teamId)
{
WorldPacket data;
ChatHandler::BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, text.c_str());
SendZoneMessage(zone, &data, self, teamId);
}
void WorldSessionMgr::DoForAllOnlinePlayers(std::function<void(Player*)> exec)
{
std::shared_lock lock(*HashMapHolder<Player>::GetLock());

View File

@@ -81,8 +81,6 @@ public:
void SendGlobalMessage(WorldPacket const* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL);
void SendGlobalGMMessage(WorldPacket const* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL);
bool SendZoneMessage(uint32 zone, WorldPacket const* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL);
void SendZoneText(uint32 zone, std::string text, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL);
void SendServerMessage(ServerMessageType messageID, std::string stringParam = "", Player* player = nullptr);
void DoForAllOnlinePlayers(std::function<void(Player*)> exec);

View File

@@ -20,16 +20,16 @@
*/
#include "Weather.h"
#include "Map.h"
#include "MiscPackets.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "Util.h"
#include "World.h"
#include "WorldSessionMgr.h"
/// Create the Weather object
Weather::Weather(uint32 zone, WeatherData const* weatherChances)
: m_zone(zone), m_weatherChances(weatherChances)
Weather::Weather(Map* map, uint32 zone, WeatherData const* weatherChances)
: m_map(map), m_zone(zone), m_weatherChances(weatherChances)
{
m_timer.SetInterval(sWorld->getIntConfig(CONFIG_INTERVAL_CHANGEWEATHER));
m_type = WEATHER_TYPE_FINE;
@@ -190,6 +190,12 @@ void Weather::SendWeatherUpdateToPlayer(Player* player)
player->SendDirectMessage(weather.Write());
}
void Weather::SendFineWeatherUpdateToPlayer(Player* player)
{
WorldPackets::Misc::Weather weather(WEATHER_STATE_FINE);
player->SendDirectMessage(weather.Write());
}
/// Send the new weather to all players in the zone
bool Weather::UpdateWeather()
{
@@ -204,7 +210,7 @@ bool Weather::UpdateWeather()
WorldPackets::Misc::Weather weather(state, m_grade);
//- Returns false if there were no players found to update
if (!sWorldSessionMgr->SendZoneMessage(m_zone, weather.Write()))
if (!m_map->SendZoneMessage(m_zone, weather.Write()))
return false;
///- Log the event

View File

@@ -25,6 +25,7 @@
#include "SharedDefines.h"
#include "Timer.h"
class Map;
class Player;
#define WEATHER_SEASONS 4
@@ -63,7 +64,7 @@ enum WeatherState : uint32
class Weather
{
public:
Weather(uint32 zone, WeatherData const* weatherChances);
Weather(Map* map, uint32 zone, WeatherData const* weatherChances);
~Weather() = default;
bool Update(uint32 diff);
@@ -71,6 +72,7 @@ public:
bool UpdateWeather();
void SendWeatherUpdateToPlayer(Player* player);
static void SendFineWeatherUpdateToPlayer(Player* player);
void SetWeather(WeatherType type, float grade);
/// For which zone is this weather?
@@ -79,6 +81,7 @@ public:
private:
[[nodiscard]] WeatherState GetWeatherState() const;
Map* m_map;
uint32 m_zone;
WeatherType m_type;
float m_grade;

View File

@@ -20,63 +20,25 @@
*/
#include "WeatherMgr.h"
#include "Containers.h"
#include "DatabaseEnv.h"
#include "Log.h"
#include "MiscPackets.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "QueryResult.h"
#include "Timer.h"
#include "Weather.h"
#include "WorldSession.h"
namespace WeatherMgr
{
namespace
{
typedef std::unordered_map<uint32, std::unique_ptr<Weather>> WeatherMap;
typedef std::unordered_map<uint32, WeatherData> WeatherZoneMap;
WeatherMap m_weathers;
WeatherZoneMap mWeatherZoneMap;
WeatherData const* GetWeatherData(uint32 zone_id)
{
WeatherZoneMap::const_iterator itr = mWeatherZoneMap.find(zone_id);
return (itr != mWeatherZoneMap.end()) ? &itr->second : nullptr;
}
std::unordered_map<uint32, WeatherData> _weatherData;
}
/// Find a Weather object by the given zoneid
Weather* FindWeather(uint32 id)
WeatherData const* GetWeatherData(uint32 zone_id)
{
WeatherMap::const_iterator itr = m_weathers.find(id);
return (itr != m_weathers.end()) ? itr->second.get() : 0;
}
/// Remove a Weather object for the given zoneid
void RemoveWeather(uint32 id)
{
// not called at the moment. Kept for completeness
WeatherMap::iterator itr = m_weathers.find(id);
if (itr != m_weathers.end())
m_weathers.erase(itr);
}
/// Add a Weather object to the list
Weather* AddWeather(uint32 zone_id)
{
WeatherData const* weatherChances = GetWeatherData(zone_id);
// zone does not have weather, ignore
if (!weatherChances)
return nullptr;
Weather* w = new Weather(zone_id, weatherChances);
m_weathers[w->GetZone()].reset(w);
w->ReGenerate();
w->UpdateWeather();
return w;
return Acore::Containers::MapGetValuePtr(_weatherData, zone_id);
}
void LoadWeatherData()
@@ -105,7 +67,7 @@ namespace WeatherMgr
uint32 zone_id = fields[0].Get<uint32>();
WeatherData& wzc = mWeatherZoneMap[zone_id];
WeatherData& wzc = _weatherData[zone_id];
for (uint8 season = 0; season < WEATHER_SEASONS; ++season)
{
@@ -140,27 +102,4 @@ namespace WeatherMgr
LOG_INFO("server.loading", ">> Loaded {} Weather Definitions in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server.loading", " ");
}
void SendFineWeatherUpdateToPlayer(Player* player)
{
WorldPackets::Misc::Weather weather(WEATHER_STATE_FINE);
player->SendDirectMessage(weather.Write());
}
void Update(uint32 diff)
{
///- Send an update signal to Weather objects
WeatherMap::iterator itr, next;
for (itr = m_weathers.begin(); itr != m_weathers.end(); itr = next)
{
next = itr;
++next;
///- and remove Weather objects for zones with no player
// As interval > WorldTick
if (!itr->second->Update(diff))
m_weathers.erase(itr);
}
}
} // namespace

View File

@@ -25,19 +25,12 @@
#include "Define.h"
class Weather;
class Player;
struct WeatherData;
namespace WeatherMgr
{
void LoadWeatherData();
Weather* FindWeather(uint32 id);
Weather* AddWeather(uint32 zone_id);
void RemoveWeather(uint32 zone_id);
void SendFineWeatherUpdateToPlayer(Player* player);
void Update(uint32 diff);
WeatherData const* GetWeatherData(uint32 zone_id);
}
#endif

View File

@@ -884,7 +884,6 @@ void World::SetInitialWorldSettings()
stmt->SetData(2, GitRevision::GetFullVersion());
LoginDatabase.Execute(stmt);
_timers[WUPDATE_WEATHERS].SetInterval(1 * IN_MILLISECONDS);
_timers[WUPDATE_UPTIME].SetInterval(getIntConfig(CONFIG_UPTIME_UPDATE)*MINUTE * IN_MILLISECONDS);
//Update "uptime" table based on configuration entry in minutes.
@@ -1186,13 +1185,6 @@ void World::Update(uint32 diff)
sWorldSessionMgr->UpdateSessions(diff);
}
/// <li> Handle weather updates when the timer has passed
if (_timers[WUPDATE_WEATHERS].Passed())
{
_timers[WUPDATE_WEATHERS].Reset();
WeatherMgr::Update(uint32(_timers[WUPDATE_WEATHERS].GetInterval()));
}
/// <li> Clean logs table
if (getIntConfig(CONFIG_LOGDB_CLEARTIME) > 0) // if not enabled, ignore the timer
{

View File

@@ -58,7 +58,6 @@ enum ShutdownExitCode : uint8
/// Timers for different object refresh rates
enum WorldTimers
{
WUPDATE_WEATHERS,
WUPDATE_UPTIME,
WUPDATE_EVENTS,
WUPDATE_CLEANDB,

View File

@@ -1895,13 +1895,7 @@ public:
Player* player = handler->GetSession()->GetPlayer();
uint32 zoneid = player->GetZoneId();
Weather* weather = WeatherMgr::FindWeather(zoneid);
if (!weather)
{
weather = WeatherMgr::AddWeather(zoneid);
}
Weather* weather = player->GetMap()->GetOrGenerateZoneDefaultWeather(zoneid);
if (!weather)
{
handler->SendErrorMessage(LANG_NO_WEATHER);

View File

@@ -43,12 +43,12 @@ void OPvPCapturePointEP_EWT::ChangeState()
// if changing from controlling alliance to horde or vice versa
if (_oldState == OBJECTIVESTATE_ALLIANCE && _oldState != _state)
{
sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_EWT_A));
_pvp->GetMap()->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_EWT_A).c_str());
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_EWT, TEAM_NEUTRAL);
}
else if (_oldState == OBJECTIVESTATE_HORDE && _oldState != _state)
{
sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_EWT_H));
_pvp->GetMap()->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_EWT_H).c_str());
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_EWT, TEAM_NEUTRAL);
}
@@ -61,14 +61,16 @@ void OPvPCapturePointEP_EWT::ChangeState()
artkit = 2;
SummonSupportUnitAtNorthpassTower(TEAM_ALLIANCE);
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_EWT, TEAM_ALLIANCE);
if (_oldState != _state) sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_EWT_A));
if (_oldState != _state)
_pvp->GetMap()->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_EWT_A).c_str());
break;
case OBJECTIVESTATE_HORDE:
m_TowerState = EP_TS_H;
artkit = 1;
SummonSupportUnitAtNorthpassTower(TEAM_HORDE);
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_EWT, TEAM_HORDE);
if (_oldState != _state) sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_EWT_H));
if (_oldState != _state)
_pvp->GetMap()->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_EWT_H).c_str());
break;
case OBJECTIVESTATE_NEUTRAL:
m_TowerState = EP_TS_N;
@@ -176,12 +178,12 @@ void OPvPCapturePointEP_NPT::ChangeState()
// if changing from controlling alliance to horde or vice versa
if (_oldState == OBJECTIVESTATE_ALLIANCE && _oldState != _state)
{
sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_NPT_A));
_pvp->GetMap()->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_NPT_A).c_str());
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_NPT, TEAM_NEUTRAL);
}
else if (_oldState == OBJECTIVESTATE_HORDE && _oldState != _state)
{
sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_NPT_H));
_pvp->GetMap()->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_NPT_H).c_str());
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_NPT, TEAM_NEUTRAL);
}
@@ -194,14 +196,16 @@ void OPvPCapturePointEP_NPT::ChangeState()
artkit = 2;
SummonGO(TEAM_ALLIANCE);
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_NPT, TEAM_ALLIANCE);
if (_oldState != _state) sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_A));
if (_oldState != _state)
_pvp->GetMap()->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_A).c_str());
break;
case OBJECTIVESTATE_HORDE:
m_TowerState = EP_TS_H;
artkit = 1;
SummonGO(TEAM_HORDE);
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_NPT, TEAM_HORDE);
if (_oldState != _state) sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_H));
if (_oldState != _state)
_pvp->GetMap()->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_H).c_str());
break;
case OBJECTIVESTATE_NEUTRAL:
m_TowerState = EP_TS_N;
@@ -319,12 +323,12 @@ void OPvPCapturePointEP_CGT::ChangeState()
// if changing from controlling alliance to horde or vice versa
if (_oldState == OBJECTIVESTATE_ALLIANCE && _oldState != _state)
{
sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_CGT_A));
_pvp->GetMap()->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_CGT_A).c_str());
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_CGT, TEAM_NEUTRAL);
}
else if (_oldState == OBJECTIVESTATE_HORDE && _oldState != _state)
{
sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_CGT_H));
_pvp->GetMap()->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_CGT_H).c_str());
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_CGT, TEAM_NEUTRAL);
}
@@ -337,14 +341,16 @@ void OPvPCapturePointEP_CGT::ChangeState()
artkit = 2;
LinkGraveyard(TEAM_ALLIANCE);
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_CGT, TEAM_ALLIANCE);
if (_oldState != _state) sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_CGT_A));
if (_oldState != _state)
_pvp->GetMap()->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_CGT_A).c_str());
break;
case OBJECTIVESTATE_HORDE:
m_TowerState = EP_TS_H;
artkit = 1;
LinkGraveyard(TEAM_HORDE);
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_CGT, TEAM_HORDE);
if (_oldState != _state) sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_CGT_H));
if (_oldState != _state)
_pvp->GetMap()->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_CGT_H).c_str());
break;
case OBJECTIVESTATE_NEUTRAL:
m_TowerState = EP_TS_N;
@@ -447,12 +453,12 @@ void OPvPCapturePointEP_PWT::ChangeState()
// if changing from controlling alliance to horde or vice versa
if (_oldState == OBJECTIVESTATE_ALLIANCE && _oldState != _state)
{
sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_PWT_A));
_pvp->GetMap()->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_PWT_A).c_str());
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_PWT, TEAM_NEUTRAL);
}
else if (_oldState == OBJECTIVESTATE_HORDE && _oldState != _state)
{
sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_PWT_H));
_pvp->GetMap()->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_PWT_H).c_str());
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_PWT, TEAM_NEUTRAL);
}
@@ -465,14 +471,16 @@ void OPvPCapturePointEP_PWT::ChangeState()
SummonFlightMaster(TEAM_ALLIANCE);
artkit = 2;
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_PWT, TEAM_ALLIANCE);
if (_oldState != _state) sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_A));
if (_oldState != _state)
_pvp->GetMap()->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_A).c_str());
break;
case OBJECTIVESTATE_HORDE:
m_TowerState = EP_TS_H;
SummonFlightMaster(TEAM_HORDE);
artkit = 1;
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_PWT, TEAM_HORDE);
if (_oldState != _state) sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_H));
if (_oldState != _state)
_pvp->GetMap()->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_H).c_str());
break;
case OBJECTIVESTATE_NEUTRAL:
m_TowerState = EP_TS_N;

View File

@@ -184,13 +184,13 @@ void OPvPCapturePointHP::ChangeState()
field = HP_MAP_A[m_TowerType];
if (uint32 alliance_towers = ((OutdoorPvPHP*)_pvp)->GetAllianceTowersControlled())
((OutdoorPvPHP*)_pvp)->SetAllianceTowersControlled(--alliance_towers);
sWorldSessionMgr->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(HP_LANG_LOSE_A[m_TowerType]));
_pvp->GetMap()->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(HP_LANG_LOSE_A[m_TowerType]).c_str());
break;
case OBJECTIVESTATE_HORDE:
field = HP_MAP_H[m_TowerType];
if (uint32 horde_towers = ((OutdoorPvPHP*)_pvp)->GetHordeTowersControlled())
((OutdoorPvPHP*)_pvp)->SetHordeTowersControlled(--horde_towers);
sWorldSessionMgr->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(HP_LANG_LOSE_H[m_TowerType]));
_pvp->GetMap()->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(HP_LANG_LOSE_H[m_TowerType]).c_str());
break;
case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE:
field = HP_MAP_N[m_TowerType];
@@ -227,7 +227,7 @@ void OPvPCapturePointHP::ChangeState()
uint32 alliance_towers = ((OutdoorPvPHP*)_pvp)->GetAllianceTowersControlled();
if (alliance_towers < 3)
((OutdoorPvPHP*)_pvp)->SetAllianceTowersControlled(++alliance_towers);
sWorldSessionMgr->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(HP_LANG_CAPTURE_A[m_TowerType]));
_pvp->GetMap()->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(HP_LANG_CAPTURE_A[m_TowerType]).c_str());
break;
}
case OBJECTIVESTATE_HORDE:
@@ -238,7 +238,7 @@ void OPvPCapturePointHP::ChangeState()
uint32 horde_towers = ((OutdoorPvPHP*)_pvp)->GetHordeTowersControlled();
if (horde_towers < 3)
((OutdoorPvPHP*)_pvp)->SetHordeTowersControlled(++horde_towers);
sWorldSessionMgr->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(HP_LANG_CAPTURE_H[m_TowerType]));
_pvp->GetMap()->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(HP_LANG_CAPTURE_H[m_TowerType]).c_str());
break;
}
case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE:

View File

@@ -197,9 +197,9 @@ void OPvPCapturePointNA::FactionTakeOver(TeamId teamId)
if (m_ControllingFaction != TEAM_NEUTRAL)
sGraveyard->RemoveGraveyardLink(NA_HALAA_GRAVEYARD, NA_HALAA_GRAVEYARD_ZONE, m_ControllingFaction, false);
if (m_ControllingFaction == TEAM_ALLIANCE)
sWorldSessionMgr->SendZoneText(NA_HALAA_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_NA_LOSE_A));
_pvp->GetMap()->SendZoneText(NA_HALAA_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_NA_LOSE_A).c_str());
else if (m_ControllingFaction == TEAM_HORDE)
sWorldSessionMgr->SendZoneText(NA_HALAA_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_NA_LOSE_H));
_pvp->GetMap()->SendZoneText(NA_HALAA_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_NA_LOSE_H).c_str());
DespawnCreatures(GetControllingFaction() == TEAM_HORDE ? halaaNPCHorde : halaaNPCAlly);
m_ControllingFaction = teamId;
if (m_ControllingFaction != TEAM_NEUTRAL)
@@ -221,7 +221,7 @@ void OPvPCapturePointNA::FactionTakeOver(TeamId teamId)
_pvp->SendUpdateWorldState(WORLD_STATE_OPVP_NA_UI_HORDE_GUARDS_SHOW, 0);
_pvp->SendUpdateWorldState(WORLD_STATE_OPVP_NA_UI_ALLIANCE_GUARDS_SHOW, 1);
_pvp->SendUpdateWorldState(WORLD_STATE_OPVP_NA_UI_GUARDS_LEFT, m_GuardsAlive);
sWorldSessionMgr->SendZoneText(NA_HALAA_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_NA_CAPTURE_A));
_pvp->GetMap()->SendZoneText(NA_HALAA_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_NA_CAPTURE_A).c_str());
}
else
{
@@ -233,7 +233,7 @@ void OPvPCapturePointNA::FactionTakeOver(TeamId teamId)
_pvp->SendUpdateWorldState(WORLD_STATE_OPVP_NA_UI_HORDE_GUARDS_SHOW, 1);
_pvp->SendUpdateWorldState(WORLD_STATE_OPVP_NA_UI_ALLIANCE_GUARDS_SHOW, 0);
_pvp->SendUpdateWorldState(WORLD_STATE_OPVP_NA_UI_GUARDS_LEFT, m_GuardsAlive);
sWorldSessionMgr->SendZoneText(NA_HALAA_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_NA_CAPTURE_H));
_pvp->GetMap()->SendZoneText(NA_HALAA_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_NA_CAPTURE_H).c_str());
}
UpdateWyvernRoostWorldState(NA_ROOST_S);
UpdateWyvernRoostWorldState(NA_ROOST_N);
@@ -637,7 +637,7 @@ bool OPvPCapturePointNA::Update(uint32 diff)
{
m_capturable = true;
m_RespawnTimer = NA_RESPAWN_TIME;
sWorldSessionMgr->SendZoneText(NA_HALAA_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_NA_DEFENSELESS));
_pvp->GetMap()->SendZoneText(NA_HALAA_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_NA_DEFENSELESS).c_str());
}
else
m_capturable = false;

View File

@@ -106,7 +106,7 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 trigger)
if (m_Gathered_A >= SI_MAX_RESOURCES)
{
TeamApplyBuff(TEAM_ALLIANCE, SI_CENARION_FAVOR, 0, player);
sWorldSessionMgr->SendZoneText(OutdoorPvPSIBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_SI_CAPTURE_A));
GetMap()->SendZoneText(OutdoorPvPSIBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_SI_CAPTURE_A).c_str());
m_LastController = TEAM_ALLIANCE;
m_Gathered_A = 0;
m_Gathered_H = 0;
@@ -132,7 +132,7 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 trigger)
if (m_Gathered_H >= SI_MAX_RESOURCES)
{
TeamApplyBuff(TEAM_HORDE, SI_CENARION_FAVOR, 0, player);
sWorldSessionMgr->SendZoneText(OutdoorPvPSIBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_SI_CAPTURE_H));
GetMap()->SendZoneText(OutdoorPvPSIBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_SI_CAPTURE_H).c_str());
m_LastController = TEAM_HORDE;
m_Gathered_A = 0;
m_Gathered_H = 0;

View File

@@ -400,14 +400,14 @@ void OPvPCapturePointTF::ChangeState()
{
if (uint32 alliance_towers = ((OutdoorPvPTF*)_pvp)->GetAllianceTowersControlled())
((OutdoorPvPTF*)_pvp)->SetAllianceTowersControlled(--alliance_towers);
sWorldSessionMgr->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_TF_LOSE_A));
_pvp->GetMap()->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_TF_LOSE_A).c_str());
}
// if changing from controlling horde to alliance
else if (_oldState == OBJECTIVESTATE_HORDE)
{
if (uint32 horde_towers = ((OutdoorPvPTF*)_pvp)->GetHordeTowersControlled())
((OutdoorPvPTF*)_pvp)->SetHordeTowersControlled(--horde_towers);
sWorldSessionMgr->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_TF_LOSE_H));
_pvp->GetMap()->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_TF_LOSE_H).c_str());
}
uint32 artkit = 21;
@@ -422,7 +422,7 @@ void OPvPCapturePointTF::ChangeState()
if (alliance_towers < TF_TOWER_NUM)
((OutdoorPvPTF*)_pvp)->SetAllianceTowersControlled(++alliance_towers);
sWorldSessionMgr->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_TF_CAPTURE_A));
_pvp->GetMap()->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_TF_CAPTURE_A).c_str());
for (PlayerSet::iterator itr = _activePlayers[0].begin(); itr != _activePlayers[0].end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(*itr))
@@ -437,7 +437,7 @@ void OPvPCapturePointTF::ChangeState()
if (horde_towers < TF_TOWER_NUM)
((OutdoorPvPTF*)_pvp)->SetHordeTowersControlled(++horde_towers);
sWorldSessionMgr->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_TF_CAPTURE_H));
_pvp->GetMap()->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_TF_CAPTURE_H).c_str());
for (PlayerSet::iterator itr = _activePlayers[1].begin(); itr != _activePlayers[1].end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(*itr))

View File

@@ -82,14 +82,14 @@ void OPvPCapturePointZM_Beacon::ChangeState()
{
if (uint32 alliance_towers = ((OutdoorPvPZM*)_pvp)->GetAllianceTowersControlled())
((OutdoorPvPZM*)_pvp)->SetAllianceTowersControlled(--alliance_towers);
sWorldSessionMgr->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(ZMBeaconLoseA[m_TowerType]));
_pvp->GetMap()->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(ZMBeaconLoseA[m_TowerType]).c_str());
}
// if changing from controlling horde to alliance
else if (_oldState == OBJECTIVESTATE_HORDE)
{
if (uint32 horde_towers = ((OutdoorPvPZM*)_pvp)->GetHordeTowersControlled())
((OutdoorPvPZM*)_pvp)->SetHordeTowersControlled(--horde_towers);
sWorldSessionMgr->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(ZMBeaconLoseH[m_TowerType]));
_pvp->GetMap()->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(ZMBeaconLoseH[m_TowerType]).c_str());
}
switch (_state)
@@ -100,7 +100,7 @@ void OPvPCapturePointZM_Beacon::ChangeState()
uint32 alliance_towers = ((OutdoorPvPZM*)_pvp)->GetAllianceTowersControlled();
if (alliance_towers < ZM_NUM_BEACONS)
((OutdoorPvPZM*)_pvp)->SetAllianceTowersControlled(++alliance_towers);
sWorldSessionMgr->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(ZMBeaconCaptureA[m_TowerType]));
_pvp->GetMap()->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(ZMBeaconCaptureA[m_TowerType]).c_str());
break;
}
case OBJECTIVESTATE_HORDE:
@@ -109,7 +109,7 @@ void OPvPCapturePointZM_Beacon::ChangeState()
uint32 horde_towers = ((OutdoorPvPZM*)_pvp)->GetHordeTowersControlled();
if (horde_towers < ZM_NUM_BEACONS)
((OutdoorPvPZM*)_pvp)->SetHordeTowersControlled(++horde_towers);
sWorldSessionMgr->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(ZMBeaconCaptureH[m_TowerType]));
_pvp->GetMap()->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(ZMBeaconCaptureH[m_TowerType]).c_str());
break;
}
case OBJECTIVESTATE_NEUTRAL:
@@ -227,7 +227,7 @@ int32 OPvPCapturePointZM_Graveyard::HandleOpenGo(Player* player, GameObject* go)
if (player->HasAura(ZM_BATTLE_STANDARD_A) && m_GraveyardState != ZM_GRAVEYARD_A)
{
if (m_GraveyardState == ZM_GRAVEYARD_H)
sWorldSessionMgr->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_ZM_LOSE_GY_H));
_pvp->GetMap()->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_ZM_LOSE_GY_H).c_str());
m_GraveyardState = ZM_GRAVEYARD_A;
DelObject(0); // only one gotype is used in the whole outdoor pvp, no need to call it a constant
AddObject(0, ZM_Banner_A.entry, ZM_Banner_A.map, ZM_Banner_A.x, ZM_Banner_A.y, ZM_Banner_A.z, ZM_Banner_A.o, ZM_Banner_A.rot0, ZM_Banner_A.rot1, ZM_Banner_A.rot2, ZM_Banner_A.rot3);
@@ -235,12 +235,12 @@ int32 OPvPCapturePointZM_Graveyard::HandleOpenGo(Player* player, GameObject* go)
sGraveyard->AddGraveyardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, TEAM_ALLIANCE, false); // add gy
_pvp->TeamApplyBuff(TEAM_ALLIANCE, ZM_CAPTURE_BUFF, 0, player);
player->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_A);
sWorldSessionMgr->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_ZM_CAPTURE_GY_A));
_pvp->GetMap()->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_ZM_CAPTURE_GY_A).c_str());
}
else if (player->HasAura(ZM_BATTLE_STANDARD_H) && m_GraveyardState != ZM_GRAVEYARD_H)
{
if (m_GraveyardState == ZM_GRAVEYARD_A)
sWorldSessionMgr->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_ZM_LOSE_GY_A));
_pvp->GetMap()->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_ZM_LOSE_GY_A).c_str());
m_GraveyardState = ZM_GRAVEYARD_H;
DelObject(0); // only one gotype is used in the whole outdoor pvp, no need to call it a constant
AddObject(0, ZM_Banner_H.entry, ZM_Banner_H.map, ZM_Banner_H.x, ZM_Banner_H.y, ZM_Banner_H.z, ZM_Banner_H.o, ZM_Banner_H.rot0, ZM_Banner_H.rot1, ZM_Banner_H.rot2, ZM_Banner_H.rot3);
@@ -248,7 +248,7 @@ int32 OPvPCapturePointZM_Graveyard::HandleOpenGo(Player* player, GameObject* go)
sGraveyard->AddGraveyardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, TEAM_HORDE, false); // add gy
_pvp->TeamApplyBuff(TEAM_HORDE, ZM_CAPTURE_BUFF, 0, player);
player->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_H);
sWorldSessionMgr->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_ZM_CAPTURE_GY_H));
_pvp->GetMap()->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_ZM_CAPTURE_GY_H).c_str());
}
UpdateTowerState();
}

View File

@@ -63,14 +63,8 @@ struct npc_herald_of_the_lich_king : public ScriptedAI
void UpdateWeather(bool startEvent)
{
if (Weather* weather = WeatherMgr::FindWeather(me->GetZoneId()))
{
if (startEvent)
weather->SetWeather(WEATHER_TYPE_STORM, 0.25f);
else
weather->SetWeather(WEATHER_TYPE_RAIN, 0.0f);
}
else if (Weather* weather = WeatherMgr::AddWeather(me->GetZoneId()))
Weather* weather = me->GetMap()->GetOrGenerateZoneDefaultWeather(me->GetZoneId());
if (weather)
{
if (startEvent)
weather->SetWeather(WEATHER_TYPE_STORM, 0.25f);
@@ -956,14 +950,8 @@ struct npc_pallid_horror : public ScriptedAI
void UpdateWeather(bool startEvent)
{
if (Weather* weather = WeatherMgr::FindWeather(me->GetZoneId()))
{
if (startEvent)
weather->SetWeather(WEATHER_TYPE_STORM, 0.25f);
else
weather->SetWeather(WEATHER_TYPE_RAIN, 0.0f);
}
else if (Weather* weather = WeatherMgr::AddWeather(me->GetZoneId()))
Weather* weather = me->GetMap()->GetOrGenerateZoneDefaultWeather(me->GetZoneId());
if (weather)
{
if (startEvent)
weather->SetWeather(WEATHER_TYPE_STORM, 0.25f);