mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-30 09:03:47 +00:00
chore(Core/OutdoorPvP): cleanup ptr's, rename private fields (#17778)
chore(Game/OutdoorPvP): cleanup ptr's, private fields
This commit is contained in:
@@ -26,41 +26,46 @@
|
||||
#include "OutdoorPvPMgr.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
OPvPCapturePoint::OPvPCapturePoint(OutdoorPvP* pvp):
|
||||
m_capturePointSpawnId(0), m_capturePoint(nullptr), m_maxValue(0.0f), m_minValue(0.0f), m_maxSpeed(0),
|
||||
m_value(0), m_team(TEAM_NEUTRAL), m_OldState(OBJECTIVESTATE_NEUTRAL),
|
||||
m_State(OBJECTIVESTATE_NEUTRAL), m_neutralValuePct(0), m_PvP(pvp)
|
||||
{ }
|
||||
OPvPCapturePoint::OPvPCapturePoint(OutdoorPvP* pvp) :
|
||||
_pvp(pvp)
|
||||
{
|
||||
}
|
||||
|
||||
bool OPvPCapturePoint::HandlePlayerEnter(Player* player)
|
||||
{
|
||||
if (m_capturePoint)
|
||||
if (_capturePoint)
|
||||
{
|
||||
player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 1);
|
||||
player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f));
|
||||
player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct);
|
||||
player->SendUpdateWorldState(_capturePoint->GetGOInfo()->capturePoint.worldState1, 1);
|
||||
player->SendUpdateWorldState(_capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32)std::ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f));
|
||||
player->SendUpdateWorldState(_capturePoint->GetGOInfo()->capturePoint.worldstate3, _neutralValuePct);
|
||||
}
|
||||
return m_activePlayers[player->GetTeamId()].insert(player->GetGUID()).second;
|
||||
|
||||
return _activePlayers[player->GetTeamId()].insert(player->GetGUID()).second;
|
||||
}
|
||||
|
||||
void OPvPCapturePoint::HandlePlayerLeave(Player* player)
|
||||
{
|
||||
if (m_capturePoint)
|
||||
player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0);
|
||||
m_activePlayers[player->GetTeamId()].erase(player->GetGUID());
|
||||
if (_capturePoint)
|
||||
{
|
||||
player->SendUpdateWorldState(_capturePoint->GetGOInfo()->capturePoint.worldState1, 0);
|
||||
}
|
||||
|
||||
_activePlayers[player->GetTeamId()].erase(player->GetGUID());
|
||||
}
|
||||
|
||||
void OPvPCapturePoint::SendChangePhase()
|
||||
{
|
||||
if (!m_capturePoint)
|
||||
if (!_capturePoint)
|
||||
return;
|
||||
|
||||
// send this too, sometimes the slider disappears, dunno why :(
|
||||
SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 1);
|
||||
SendUpdateWorldState(_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));
|
||||
SendUpdateWorldState(_capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32)std::ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f));
|
||||
|
||||
// send this too, sometimes it resets :S
|
||||
SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct);
|
||||
SendUpdateWorldState(_capturePoint->GetGOInfo()->capturePoint.worldstate3, _neutralValuePct);
|
||||
}
|
||||
|
||||
void OPvPCapturePoint::AddGO(uint32 type, ObjectGuid::LowType guid, uint32 entry)
|
||||
@@ -69,11 +74,15 @@ void OPvPCapturePoint::AddGO(uint32 type, ObjectGuid::LowType guid, uint32 entry
|
||||
{
|
||||
const GameObjectData* data = sObjectMgr->GetGameObjectData(guid);
|
||||
if (!data)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entry = data->id;
|
||||
}
|
||||
m_Objects[type] = guid;
|
||||
m_ObjectTypes[m_Objects[type]] = type;
|
||||
|
||||
_objects[type] = guid;
|
||||
_objectTypes[_objects[type]] = type;
|
||||
}
|
||||
|
||||
void OPvPCapturePoint::AddCre(uint32 type, ObjectGuid::LowType guid, uint32 entry)
|
||||
@@ -82,11 +91,15 @@ void OPvPCapturePoint::AddCre(uint32 type, ObjectGuid::LowType guid, uint32 entr
|
||||
{
|
||||
const CreatureData* data = sObjectMgr->GetCreatureData(guid);
|
||||
if (!data)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entry = data->id1;
|
||||
}
|
||||
m_Creatures[type] = guid;
|
||||
m_CreatureTypes[m_Creatures[type]] = type;
|
||||
|
||||
_creatures[type] = guid;
|
||||
_creatureTypes[_creatures[type]] = type;
|
||||
}
|
||||
|
||||
bool OPvPCapturePoint::AddObject(uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3)
|
||||
@@ -100,9 +113,9 @@ bool OPvPCapturePoint::AddObject(uint32 type, uint32 entry, uint32 map, float x,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OPvPCapturePoint::AddCreature(uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay)
|
||||
bool OPvPCapturePoint::AddCreature(uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o, uint32 spawntimeDelay)
|
||||
{
|
||||
if (ObjectGuid::LowType guid = sObjectMgr->AddCreData(entry, map, x, y, z, o, spawntimedelay))
|
||||
if (ObjectGuid::LowType guid = sObjectMgr->AddCreData(entry, map, x, y, z, o, spawntimeDelay))
|
||||
{
|
||||
AddCre(type, guid, entry);
|
||||
return true;
|
||||
@@ -128,34 +141,37 @@ bool OPvPCapturePoint::SetCapturePointData(uint32 entry, uint32 map, float x, fl
|
||||
return false;
|
||||
|
||||
// get the needed values from goinfo
|
||||
m_maxValue = (float)goinfo->capturePoint.maxTime;
|
||||
m_maxSpeed = m_maxValue / (goinfo->capturePoint.minTime ? goinfo->capturePoint.minTime : 60);
|
||||
m_neutralValuePct = goinfo->capturePoint.neutralPercent;
|
||||
m_minValue = CalculatePct(m_maxValue, m_neutralValuePct);
|
||||
_maxValue = (float)goinfo->capturePoint.maxTime;
|
||||
_maxSpeed = _maxValue / float(goinfo->capturePoint.minTime ? goinfo->capturePoint.minTime : 60);
|
||||
_neutralValuePct = goinfo->capturePoint.neutralPercent;
|
||||
_minValue = CalculatePct(_maxValue, _neutralValuePct);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OPvPCapturePoint::DelCreature(uint32 type)
|
||||
{
|
||||
ObjectGuid::LowType spawnId = m_Creatures[type];
|
||||
ObjectGuid::LowType spawnId = _creatures[type];
|
||||
if (!spawnId)
|
||||
{
|
||||
LOG_DEBUG("outdoorpvp", "opvp creature type {} was already deleted", type);
|
||||
LOG_DEBUG("outdoorpvp", "OutdoorPvP: Creature type {} was already deleted", type);
|
||||
return false;
|
||||
}
|
||||
|
||||
auto bounds = m_PvP->GetMap()->GetCreatureBySpawnIdStore().equal_range(spawnId);
|
||||
auto bounds = _pvp->GetMap()->GetCreatureBySpawnIdStore().equal_range(spawnId);
|
||||
for (auto itr = bounds.first; itr != bounds.second;)
|
||||
{
|
||||
// can happen when closing the core
|
||||
Creature* c = itr->second;
|
||||
++itr;
|
||||
|
||||
// Don't save respawn time
|
||||
c->SetRespawnTime(0);
|
||||
c->RemoveCorpse();
|
||||
c->AddObjectToRemoveList();
|
||||
}
|
||||
LOG_DEBUG("outdoorpvp", "deleting opvp creature type {}", type);
|
||||
|
||||
LOG_DEBUG("outdoorpvp", "OutdoorPvP: Deleting creature type {}", type);
|
||||
|
||||
// explicit removal from map
|
||||
// beats me why this is needed, but with the recent removal "cleanup" some creatures stay in the map if "properly" deleted
|
||||
// so this is a big fat workaround, if AddObjectToRemoveList and DoDelayedMovesAndRemoves worked correctly, this wouldn't be needed
|
||||
@@ -164,23 +180,23 @@ bool OPvPCapturePoint::DelCreature(uint32 type)
|
||||
// delete respawn time for this creature
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CREATURE_RESPAWN);
|
||||
stmt->SetData(0, spawnId);
|
||||
stmt->SetData(1, m_PvP->GetMap()->GetId());
|
||||
stmt->SetData(1, _pvp->GetMap()->GetId());
|
||||
stmt->SetData(2, 0); // instance id, always 0 for world maps
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
sObjectMgr->DeleteCreatureData(spawnId);
|
||||
m_CreatureTypes[m_Creatures[type]] = 0;
|
||||
m_Creatures[type] = 0;
|
||||
_creatureTypes[_creatures[type]] = 0;
|
||||
_creatures[type] = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OPvPCapturePoint::DelObject(uint32 type)
|
||||
{
|
||||
ObjectGuid::LowType spawnId = m_Objects[type];
|
||||
ObjectGuid::LowType spawnId = _objects[type];
|
||||
if (!spawnId)
|
||||
return false;
|
||||
|
||||
auto bounds = m_PvP->GetMap()->GetGameObjectBySpawnIdStore().equal_range(spawnId);
|
||||
auto bounds = _pvp->GetMap()->GetGameObjectBySpawnIdStore().equal_range(spawnId);
|
||||
for (auto itr = bounds.first; itr != bounds.second;)
|
||||
{
|
||||
GameObject* go = itr->second;
|
||||
@@ -191,8 +207,8 @@ bool OPvPCapturePoint::DelObject(uint32 type)
|
||||
}
|
||||
|
||||
sObjectMgr->DeleteGOData(spawnId);
|
||||
m_ObjectTypes[m_Objects[type]] = 0;
|
||||
m_Objects[type] = 0;
|
||||
_objectTypes[_objects[type]] = 0;
|
||||
_objects[type] = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -201,10 +217,10 @@ bool OPvPCapturePoint::DelCapturePoint()
|
||||
sObjectMgr->DeleteGOData(m_capturePointSpawnId);
|
||||
m_capturePointSpawnId = 0;
|
||||
|
||||
if (m_capturePoint)
|
||||
if (_capturePoint)
|
||||
{
|
||||
m_capturePoint->SetRespawnTime(0); // not save respawn time
|
||||
m_capturePoint->Delete();
|
||||
_capturePoint->SetRespawnTime(0); // not save respawn time
|
||||
_capturePoint->Delete();
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -212,39 +228,46 @@ bool OPvPCapturePoint::DelCapturePoint()
|
||||
|
||||
void OPvPCapturePoint::DeleteSpawns()
|
||||
{
|
||||
for (std::map<uint32, ObjectGuid::LowType>::iterator i = m_Objects.begin(); i != m_Objects.end(); ++i)
|
||||
DelObject(i->first);
|
||||
for (std::map<uint32, ObjectGuid::LowType>::iterator i = m_Creatures.begin(); i != m_Creatures.end(); ++i)
|
||||
DelCreature(i->first);
|
||||
for (auto const& [type, guid] : _objects)
|
||||
{
|
||||
DelObject(type);
|
||||
}
|
||||
|
||||
for (auto const& [type, guid] : _creatures)
|
||||
{
|
||||
DelCreature(type);
|
||||
}
|
||||
|
||||
DelCapturePoint();
|
||||
}
|
||||
|
||||
void OutdoorPvP::DeleteSpawns()
|
||||
{
|
||||
// Remove script from any registered gameobjects/creatures
|
||||
for (auto itr = m_GoScriptStore.begin(); itr != m_GoScriptStore.end(); ++itr)
|
||||
for (auto& itr : _goScriptStore)
|
||||
{
|
||||
if (GameObject* go = itr->second)
|
||||
if (GameObject* go = itr.second)
|
||||
go->ClearZoneScript();
|
||||
}
|
||||
m_GoScriptStore.clear();
|
||||
|
||||
for (auto itr = m_CreatureScriptStore.begin(); itr != m_CreatureScriptStore.end(); ++itr)
|
||||
_goScriptStore.clear();
|
||||
|
||||
for (auto& itr : _creatureScriptStore)
|
||||
{
|
||||
if (Creature* creature = itr->second)
|
||||
if (Creature* creature = itr.second)
|
||||
creature->ClearZoneScript();
|
||||
}
|
||||
m_CreatureScriptStore.clear();
|
||||
|
||||
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
_creatureScriptStore.clear();
|
||||
|
||||
for (auto& capturePoint : _capturePoints)
|
||||
{
|
||||
itr->second->DeleteSpawns();
|
||||
delete itr->second;
|
||||
capturePoint.second->DeleteSpawns();
|
||||
delete capturePoint.second;
|
||||
}
|
||||
m_capturePoints.clear();
|
||||
}
|
||||
|
||||
OutdoorPvP::OutdoorPvP() : m_TypeId(0), m_sendUpdate(true), m_map(nullptr) { }
|
||||
_capturePoints.clear();
|
||||
}
|
||||
|
||||
OutdoorPvP::~OutdoorPvP()
|
||||
{
|
||||
@@ -253,149 +276,173 @@ OutdoorPvP::~OutdoorPvP()
|
||||
|
||||
void OutdoorPvP::HandlePlayerEnterZone(Player* player, uint32 /*zone*/)
|
||||
{
|
||||
m_players[player->GetTeamId()].insert(player->GetGUID());
|
||||
_players[player->GetTeamId()].insert(player->GetGUID());
|
||||
}
|
||||
|
||||
void OutdoorPvP::HandlePlayerLeaveZone(Player* player, uint32 /*zone*/)
|
||||
{
|
||||
// inform the objectives of the leaving
|
||||
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
itr->second->HandlePlayerLeave(player);
|
||||
for (auto& _capturePoint : _capturePoints)
|
||||
{
|
||||
_capturePoint.second->HandlePlayerLeave(player);
|
||||
}
|
||||
|
||||
// remove the world state information from the player (we can't keep everyone up to date, so leave out those who are not in the concerning zones)
|
||||
if (!player->GetSession()->PlayerLogout())
|
||||
{
|
||||
SendRemoveWorldStates(player);
|
||||
m_players[player->GetTeamId()].erase(player->GetGUID());
|
||||
LOG_DEBUG("outdoorpvp", "Player {} left an outdoorpvp zone", player->GetName());
|
||||
}
|
||||
|
||||
_players[player->GetTeamId()].erase(player->GetGUID());
|
||||
LOG_DEBUG("outdoorpvp", "OutdoorPvP: Player {} left an outdoorpvp zone", player->GetName());
|
||||
}
|
||||
|
||||
void OutdoorPvP::HandlePlayerResurrects(Player* /*player*/, uint32 /*zone*/)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool OutdoorPvP::Update(uint32 diff)
|
||||
{
|
||||
bool objective_changed = false;
|
||||
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
for (auto& capturePoint : _capturePoints)
|
||||
{
|
||||
if (itr->second->Update(diff))
|
||||
if (capturePoint.second->Update(diff))
|
||||
objective_changed = true;
|
||||
}
|
||||
|
||||
return objective_changed;
|
||||
}
|
||||
|
||||
bool OPvPCapturePoint::Update(uint32 diff)
|
||||
{
|
||||
if (!m_capturePoint)
|
||||
if (!_capturePoint)
|
||||
return false;
|
||||
|
||||
float radius = (float)m_capturePoint->GetGOInfo()->capturePoint.radius;
|
||||
auto radius = (float)_capturePoint->GetGOInfo()->capturePoint.radius;
|
||||
|
||||
for (uint32 team = 0; team < 2; ++team)
|
||||
for (auto const& activePlayer : _activePlayers)
|
||||
{
|
||||
for (PlayerSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end();)
|
||||
for (auto itr = activePlayer.begin(); itr != activePlayer.end();)
|
||||
{
|
||||
ObjectGuid playerGuid = *itr;
|
||||
++itr;
|
||||
|
||||
if (Player* player = ObjectAccessor::FindPlayer(playerGuid))
|
||||
if (!m_capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive())
|
||||
if (!_capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive())
|
||||
HandlePlayerLeave(player);
|
||||
}
|
||||
}
|
||||
|
||||
std::list<Player*> players;
|
||||
Acore::AnyPlayerInObjectRangeCheck checker(m_capturePoint, radius);
|
||||
Acore::PlayerListSearcher<Acore::AnyPlayerInObjectRangeCheck> searcher(m_capturePoint, players, checker);
|
||||
Cell::VisitWorldObjects(m_capturePoint, searcher, radius);
|
||||
Acore::AnyPlayerInObjectRangeCheck checker(_capturePoint, radius);
|
||||
Acore::PlayerListSearcher<Acore::AnyPlayerInObjectRangeCheck> searcher(_capturePoint, players, checker);
|
||||
Cell::VisitWorldObjects(_capturePoint, searcher, radius);
|
||||
|
||||
for (std::list<Player*>::iterator itr = players.begin(); itr != players.end(); ++itr)
|
||||
for (auto& itr : players)
|
||||
{
|
||||
Player* const player = *itr;
|
||||
Player* const player = itr;
|
||||
if (player->IsOutdoorPvPActive())
|
||||
{
|
||||
if (m_activePlayers[player->GetTeamId()].insert(player->GetGUID()).second)
|
||||
HandlePlayerEnter(*itr);
|
||||
if (_activePlayers[player->GetTeamId()].insert(player->GetGUID()).second)
|
||||
HandlePlayerEnter(itr);
|
||||
}
|
||||
}
|
||||
|
||||
// get the difference of numbers
|
||||
float fact_diff = ((float)m_activePlayers[0].size() - (float)m_activePlayers[1].size()) * diff / OUTDOORPVP_OBJECTIVE_UPDATE_INTERVAL;
|
||||
if (!fact_diff)
|
||||
float factDiff = ((float)_activePlayers[0].size() - (float)_activePlayers[1].size()) * float(diff) / OUTDOORPVP_OBJECTIVE_UPDATE_INTERVAL;
|
||||
if (factDiff == 0.f)
|
||||
return false;
|
||||
|
||||
TeamId ChallengerId = TEAM_NEUTRAL;
|
||||
float maxDiff = m_maxSpeed * diff;
|
||||
float maxDiff = _maxSpeed * float(diff);
|
||||
|
||||
if (fact_diff < 0)
|
||||
if (factDiff < 0.f)
|
||||
{
|
||||
// horde is in majority, but it's already horde-controlled -> no change
|
||||
if (m_State == OBJECTIVESTATE_HORDE && m_value <= -m_maxValue)
|
||||
if (_state == OBJECTIVESTATE_HORDE && _value <= -_maxValue)
|
||||
return false;
|
||||
|
||||
if (fact_diff < -maxDiff)
|
||||
fact_diff = -maxDiff;
|
||||
if (factDiff < -maxDiff)
|
||||
factDiff = -maxDiff;
|
||||
|
||||
ChallengerId = TEAM_HORDE;
|
||||
}
|
||||
else
|
||||
{
|
||||
// ally is in majority, but it's already ally-controlled -> no change
|
||||
if (m_State == OBJECTIVESTATE_ALLIANCE && m_value >= m_maxValue)
|
||||
if (_state == OBJECTIVESTATE_ALLIANCE && _value >= _maxValue)
|
||||
return false;
|
||||
|
||||
if (fact_diff > maxDiff)
|
||||
fact_diff = maxDiff;
|
||||
if (factDiff > maxDiff)
|
||||
factDiff = maxDiff;
|
||||
|
||||
ChallengerId = TEAM_ALLIANCE;
|
||||
}
|
||||
|
||||
float oldValue = m_value;
|
||||
TeamId oldTeam = m_team;
|
||||
float oldValue = _value;
|
||||
TeamId oldTeam = _team;
|
||||
|
||||
m_OldState = m_State;
|
||||
_oldState = _state;
|
||||
_value += factDiff;
|
||||
|
||||
m_value += fact_diff;
|
||||
|
||||
if (m_value < -m_minValue) // red
|
||||
if (_value < -_minValue) // red
|
||||
{
|
||||
if (m_value < -m_maxValue)
|
||||
m_value = -m_maxValue;
|
||||
m_State = OBJECTIVESTATE_HORDE;
|
||||
m_team = TEAM_HORDE;
|
||||
if (_value < -_maxValue)
|
||||
{
|
||||
_value = -_maxValue;
|
||||
}
|
||||
|
||||
_state = OBJECTIVESTATE_HORDE;
|
||||
_team = TEAM_HORDE;
|
||||
}
|
||||
else if (m_value > m_minValue) // blue
|
||||
else if (_value > _minValue) // blue
|
||||
{
|
||||
if (m_value > m_maxValue)
|
||||
m_value = m_maxValue;
|
||||
m_State = OBJECTIVESTATE_ALLIANCE;
|
||||
m_team = TEAM_ALLIANCE;
|
||||
if (_value > _maxValue)
|
||||
{
|
||||
_value = _maxValue;
|
||||
}
|
||||
|
||||
_state = OBJECTIVESTATE_ALLIANCE;
|
||||
_team = TEAM_ALLIANCE;
|
||||
}
|
||||
else if (oldValue * m_value <= 0) // grey, go through mid point
|
||||
else if (oldValue * _value <= 0) // grey, go through mid-point
|
||||
{
|
||||
// if challenger is ally, then n->a challenge
|
||||
if (ChallengerId == TEAM_ALLIANCE)
|
||||
m_State = OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE;
|
||||
// if challenger is horde, then n->h challenge
|
||||
else if (ChallengerId == TEAM_HORDE)
|
||||
m_State = OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE;
|
||||
m_team = TEAM_NEUTRAL;
|
||||
{
|
||||
_state = OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE;
|
||||
}
|
||||
else if (ChallengerId == TEAM_HORDE) // if challenger is horde, then n->h challenge
|
||||
{
|
||||
_state = OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE;
|
||||
}
|
||||
|
||||
_team = TEAM_NEUTRAL;
|
||||
}
|
||||
else // grey, did not go through mid point
|
||||
else // grey, did not go through mid-point
|
||||
{
|
||||
// old phase and current are on the same side, so one team challenges the other
|
||||
if (ChallengerId == TEAM_ALLIANCE && (m_OldState == OBJECTIVESTATE_HORDE || m_OldState == OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE))
|
||||
m_State = OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE;
|
||||
else if (ChallengerId == TEAM_HORDE && (m_OldState == OBJECTIVESTATE_ALLIANCE || m_OldState == OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE))
|
||||
m_State = OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE;
|
||||
m_team = TEAM_NEUTRAL;
|
||||
if (ChallengerId == TEAM_ALLIANCE && (_oldState == OBJECTIVESTATE_HORDE || _oldState == OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE))
|
||||
{
|
||||
_state = OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE;
|
||||
}
|
||||
else if (ChallengerId == TEAM_HORDE && (_oldState == OBJECTIVESTATE_ALLIANCE || _oldState == OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE))
|
||||
{
|
||||
_state = OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE;
|
||||
}
|
||||
|
||||
_team = TEAM_NEUTRAL;
|
||||
}
|
||||
|
||||
if (m_value != oldValue)
|
||||
SendChangePhase();
|
||||
|
||||
if (m_OldState != m_State)
|
||||
if (_value != oldValue)
|
||||
{
|
||||
if (oldTeam != m_team)
|
||||
SendChangePhase();
|
||||
}
|
||||
|
||||
if (_oldState != _state)
|
||||
{
|
||||
if (oldTeam != _team)
|
||||
{
|
||||
ChangeTeam(oldTeam);
|
||||
}
|
||||
@@ -409,20 +456,20 @@ bool OPvPCapturePoint::Update(uint32 diff)
|
||||
|
||||
void OutdoorPvP::SendUpdateWorldState(uint32 field, uint32 value)
|
||||
{
|
||||
if (m_sendUpdate)
|
||||
for (int i = 0; i < 2; ++i)
|
||||
for (PlayerSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
|
||||
if (Player* const player = ObjectAccessor::FindPlayer(*itr))
|
||||
if (_sendUpdate)
|
||||
for (auto const& _player : _players)
|
||||
for (auto itr : _player)
|
||||
if (Player* const player = ObjectAccessor::FindPlayer(itr))
|
||||
player->SendUpdateWorldState(field, value);
|
||||
}
|
||||
|
||||
void OPvPCapturePoint::SendUpdateWorldState(uint32 field, uint32 value)
|
||||
{
|
||||
for (uint32 team = 0; team < 2; ++team)
|
||||
for (auto const& activePlayer : _activePlayers)
|
||||
{
|
||||
// send to all players present in the area
|
||||
for (PlayerSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr)
|
||||
if (Player* const player = ObjectAccessor::FindPlayer(*itr))
|
||||
for (auto itr : activePlayer)
|
||||
if (Player* const player = ObjectAccessor::FindPlayer(itr))
|
||||
player->SendUpdateWorldState(field, value);
|
||||
}
|
||||
}
|
||||
@@ -430,7 +477,7 @@ void OPvPCapturePoint::SendUpdateWorldState(uint32 field, uint32 value)
|
||||
void OPvPCapturePoint::SendObjectiveComplete(uint32 id, ObjectGuid guid)
|
||||
{
|
||||
uint32 team;
|
||||
switch (m_State)
|
||||
switch (_state)
|
||||
{
|
||||
case OBJECTIVESTATE_ALLIANCE:
|
||||
team = 0;
|
||||
@@ -443,19 +490,20 @@ void OPvPCapturePoint::SendObjectiveComplete(uint32 id, ObjectGuid guid)
|
||||
}
|
||||
|
||||
// send to all players present in the area
|
||||
for (PlayerSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr)
|
||||
if (Player* const player = ObjectAccessor::FindPlayer(*itr))
|
||||
for (auto itr : _activePlayers[team])
|
||||
if (Player* const player = ObjectAccessor::FindPlayer(itr))
|
||||
player->KilledMonsterCredit(id, guid);
|
||||
}
|
||||
|
||||
void OutdoorPvP::HandleKill(Player* killer, Unit* killed)
|
||||
{
|
||||
ASSERT(killer);
|
||||
|
||||
if (Group* group = killer->GetGroup())
|
||||
{
|
||||
for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
|
||||
{
|
||||
Player* groupGuy = itr->GetSource();
|
||||
|
||||
if (!groupGuy)
|
||||
continue;
|
||||
|
||||
@@ -474,7 +522,7 @@ void OutdoorPvP::HandleKill(Player* killer, Unit* killed)
|
||||
else
|
||||
{
|
||||
// creature kills must be notified, even if not inside objective / not outdoor pvp active
|
||||
if (killer && ((killer->IsOutdoorPvPActive() && IsInsideObjective(killer)) || killed->GetTypeId() == TYPEID_UNIT))
|
||||
if ((killer->IsOutdoorPvPActive() && IsInsideObjective(killer)) || killed->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
HandleKillImpl(killer, killed);
|
||||
}
|
||||
@@ -483,8 +531,8 @@ void OutdoorPvP::HandleKill(Player* killer, Unit* killed)
|
||||
|
||||
bool OutdoorPvP::IsInsideObjective(Player* player) const
|
||||
{
|
||||
for (OPvPCapturePointMap::const_iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
if (itr->second->IsInsideObjective(player))
|
||||
for (auto& capturePoint : _capturePoints)
|
||||
if (capturePoint.second->IsInsideObjective(player))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -492,14 +540,14 @@ bool OutdoorPvP::IsInsideObjective(Player* player) const
|
||||
|
||||
bool OPvPCapturePoint::IsInsideObjective(Player* player) const
|
||||
{
|
||||
PlayerSet const& plSet = m_activePlayers[player->GetTeamId()];
|
||||
PlayerSet const& plSet = _activePlayers[player->GetTeamId()];
|
||||
return plSet.find(player->GetGUID()) != plSet.end();
|
||||
}
|
||||
|
||||
bool OutdoorPvP::HandleCustomSpell(Player* player, uint32 spellId, GameObject* go)
|
||||
{
|
||||
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
if (itr->second->HandleCustomSpell(player, spellId, go))
|
||||
for (auto& capturePoint : _capturePoints)
|
||||
if (capturePoint.second->HandleCustomSpell(player, spellId, go))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -507,15 +555,13 @@ bool OutdoorPvP::HandleCustomSpell(Player* player, uint32 spellId, GameObject* g
|
||||
|
||||
bool OPvPCapturePoint::HandleCustomSpell(Player* player, uint32 /*spellId*/, GameObject* /*go*/)
|
||||
{
|
||||
if (!player->IsOutdoorPvPActive())
|
||||
return false;
|
||||
return false;
|
||||
return player->IsOutdoorPvPActive();
|
||||
}
|
||||
|
||||
bool OutdoorPvP::HandleOpenGo(Player* player, GameObject* go)
|
||||
{
|
||||
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
if (itr->second->HandleOpenGo(player, go) >= 0)
|
||||
for (auto& capturePoint : _capturePoints)
|
||||
if (capturePoint.second->HandleOpenGo(player, go) >= 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -523,8 +569,8 @@ bool OutdoorPvP::HandleOpenGo(Player* player, GameObject* go)
|
||||
|
||||
bool OutdoorPvP::HandleGossipOption(Player* player, Creature* creature, uint32 id)
|
||||
{
|
||||
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
if (itr->second->HandleGossipOption(player, creature, id))
|
||||
for (auto& capturePoint : _capturePoints)
|
||||
if (capturePoint.second->HandleGossipOption(player, creature, id))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -532,8 +578,8 @@ bool OutdoorPvP::HandleGossipOption(Player* player, Creature* creature, uint32 i
|
||||
|
||||
bool OutdoorPvP::CanTalkTo(Player* player, Creature* c, GossipMenuItems const& gso)
|
||||
{
|
||||
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
if (itr->second->CanTalkTo(player, c, gso))
|
||||
for (auto& capturePoint : _capturePoints)
|
||||
if (capturePoint.second->CanTalkTo(player, c, gso))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -541,8 +587,8 @@ bool OutdoorPvP::CanTalkTo(Player* player, Creature* c, GossipMenuItems const& g
|
||||
|
||||
bool OutdoorPvP::HandleDropFlag(Player* player, uint32 id)
|
||||
{
|
||||
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
if (itr->second->HandleDropFlag(player, id))
|
||||
for (auto& capturePoint : _capturePoints)
|
||||
if (capturePoint.second->HandleDropFlag(player, id))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -565,14 +611,20 @@ bool OPvPCapturePoint::HandleDropFlag(Player* /*player*/, uint32 /*id*/)
|
||||
|
||||
int32 OPvPCapturePoint::HandleOpenGo(Player* /*player*/, GameObject* go)
|
||||
{
|
||||
std::map<ObjectGuid::LowType, uint32>::iterator itr = m_ObjectTypes.find(go->GetSpawnId());
|
||||
if (itr != m_ObjectTypes.end())
|
||||
auto const itr = _objectTypes.find(go->GetSpawnId());
|
||||
if (itr != _objectTypes.end())
|
||||
{
|
||||
return itr->second;
|
||||
return (int32)itr->second;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void OPvPCapturePoint::SetSlider(float slider)
|
||||
{
|
||||
_value = std::clamp<float>(slider, -_maxValue, _maxValue);
|
||||
}
|
||||
|
||||
bool OutdoorPvP::HandleAreaTrigger(Player* /*player*/, uint32 /*trigger*/)
|
||||
{
|
||||
return false;
|
||||
@@ -581,9 +633,9 @@ bool OutdoorPvP::HandleAreaTrigger(Player* /*player*/, uint32 /*trigger*/)
|
||||
void OutdoorPvP::BroadcastPacket(WorldPacket& data) const
|
||||
{
|
||||
// This is faster than sWorld->SendZoneMessage
|
||||
for (uint32 team = 0; team < 2; ++team)
|
||||
for (PlayerSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
if (Player* const player = ObjectAccessor::FindPlayer(*itr))
|
||||
for (auto const& playerSet : _players)
|
||||
for (auto itr : playerSet)
|
||||
if (Player* const player = ObjectAccessor::FindPlayer(itr))
|
||||
player->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
@@ -594,7 +646,7 @@ void OutdoorPvP::RegisterZone(uint32 zoneId)
|
||||
|
||||
bool OutdoorPvP::HasPlayer(Player const* player) const
|
||||
{
|
||||
PlayerSet const& plSet = m_players[player->GetTeamId()];
|
||||
PlayerSet const& plSet = _players[player->GetTeamId()];
|
||||
return plSet.find(player->GetGUID()) != plSet.end();
|
||||
}
|
||||
|
||||
@@ -602,15 +654,15 @@ void OutdoorPvP::TeamCastSpell(TeamId team, int32 spellId, Player* sameMapPlr)
|
||||
{
|
||||
if (spellId > 0)
|
||||
{
|
||||
for (PlayerSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
if (Player* const player = ObjectAccessor::FindPlayer(*itr))
|
||||
for (auto itr : _players[team])
|
||||
if (Player* const player = ObjectAccessor::FindPlayer(itr))
|
||||
if (!sameMapPlr || sameMapPlr->FindMap() == player->FindMap())
|
||||
player->CastSpell(player, (uint32)spellId, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (PlayerSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
if (Player* const player = ObjectAccessor::FindPlayer(*itr))
|
||||
for (auto itr : _players[team])
|
||||
if (Player* const player = ObjectAccessor::FindPlayer(itr))
|
||||
if (!sameMapPlr || sameMapPlr->FindMap() == player->FindMap())
|
||||
player->RemoveAura((uint32) - spellId); // by stack?
|
||||
}
|
||||
@@ -618,49 +670,69 @@ void OutdoorPvP::TeamCastSpell(TeamId team, int32 spellId, Player* sameMapPlr)
|
||||
|
||||
void OutdoorPvP::TeamApplyBuff(TeamId teamId, uint32 spellId, uint32 spellId2, Player* sameMapPlr)
|
||||
{
|
||||
TeamCastSpell(teamId, spellId, sameMapPlr);
|
||||
TeamCastSpell(teamId, (int32)spellId, sameMapPlr);
|
||||
TeamCastSpell(teamId == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE, spellId2 ? -(int32)spellId2 : -(int32)spellId, sameMapPlr);
|
||||
}
|
||||
|
||||
void OutdoorPvP::OnGameObjectCreate(GameObject* go)
|
||||
{
|
||||
GoScriptPair sp(go->GetGUID().GetCounter(), go);
|
||||
m_GoScriptStore.insert(sp);
|
||||
_goScriptStore.insert(sp);
|
||||
|
||||
if (go->GetGoType() != GAMEOBJECT_TYPE_CAPTURE_POINT)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (OPvPCapturePoint* cp = GetCapturePoint(go->GetSpawnId()))
|
||||
cp->m_capturePoint = go;
|
||||
{
|
||||
cp->_capturePoint = go;
|
||||
}
|
||||
}
|
||||
|
||||
void OutdoorPvP::OnGameObjectRemove(GameObject* go)
|
||||
{
|
||||
m_GoScriptStore.erase(go->GetGUID().GetCounter());
|
||||
_goScriptStore.erase(go->GetGUID().GetCounter());
|
||||
|
||||
if (go->GetGoType() != GAMEOBJECT_TYPE_CAPTURE_POINT)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (OPvPCapturePoint* cp = GetCapturePoint(go->GetSpawnId()))
|
||||
cp->m_capturePoint = nullptr;
|
||||
{
|
||||
cp->_capturePoint = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void OutdoorPvP::OnCreatureCreate(Creature* creature)
|
||||
{
|
||||
CreatureScriptPair sp(creature->GetGUID().GetCounter(), creature);
|
||||
m_CreatureScriptStore.insert(sp);
|
||||
_creatureScriptStore.insert(sp);
|
||||
}
|
||||
|
||||
void OutdoorPvP::OnCreatureRemove(Creature* creature)
|
||||
{
|
||||
m_CreatureScriptStore.erase(creature->GetGUID().GetCounter());
|
||||
_creatureScriptStore.erase(creature->GetGUID().GetCounter());
|
||||
}
|
||||
|
||||
void OutdoorPvP::SetMapFromZone(uint32 zone)
|
||||
{
|
||||
AreaTableEntry const* areaTable = sAreaTableStore.LookupEntry(zone);
|
||||
ASSERT(areaTable);
|
||||
|
||||
Map* map = sMapMgr->CreateBaseMap(areaTable->mapid);
|
||||
ASSERT(!map->Instanceable());
|
||||
m_map = map;
|
||||
_map = map;
|
||||
}
|
||||
|
||||
OPvPCapturePoint* OutdoorPvP::GetCapturePoint(ObjectGuid::LowType spawnId) const
|
||||
{
|
||||
auto const itr = _capturePoints.find(spawnId);
|
||||
if (itr != _capturePoints.end())
|
||||
{
|
||||
return itr->second;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "SharedDefines.h"
|
||||
#include "Util.h"
|
||||
#include "ZoneScript.h"
|
||||
#include <array>
|
||||
|
||||
class GameObject;
|
||||
|
||||
@@ -80,17 +81,17 @@ class GameObject;
|
||||
class WorldPacket;
|
||||
class Creature;
|
||||
class Unit;
|
||||
struct GossipMenuItems;
|
||||
class OutdoorPvP;
|
||||
|
||||
struct GossipMenuItems;
|
||||
|
||||
typedef GuidSet PlayerSet;
|
||||
|
||||
class OPvPCapturePoint
|
||||
{
|
||||
public:
|
||||
OPvPCapturePoint(OutdoorPvP* pvp);
|
||||
|
||||
virtual ~OPvPCapturePoint() {}
|
||||
explicit OPvPCapturePoint(OutdoorPvP* pvp);
|
||||
virtual ~OPvPCapturePoint() = default;
|
||||
|
||||
virtual void FillInitialWorldStates(WorldPacket& /*data*/) {}
|
||||
|
||||
@@ -113,24 +114,16 @@ public:
|
||||
|
||||
// returns true if the state of the objective has changed, in this case, the OutdoorPvP must send a world state ui update.
|
||||
virtual bool Update(uint32 diff);
|
||||
|
||||
virtual void ChangeState() = 0;
|
||||
|
||||
virtual void ChangeTeam(TeamId /*oldTeam*/) {}
|
||||
|
||||
virtual void SendChangePhase();
|
||||
|
||||
virtual bool HandleGossipOption(Player* player, Creature* creature, uint32 gossipid);
|
||||
|
||||
virtual bool HandleGossipOption(Player* player, Creature* creature, uint32 gossipId);
|
||||
virtual bool CanTalkTo(Player* player, Creature* c, GossipMenuItems const& gso);
|
||||
|
||||
virtual bool HandleDropFlag(Player* player, uint32 spellId);
|
||||
|
||||
virtual void DeleteSpawns();
|
||||
|
||||
ObjectGuid::LowType m_capturePointSpawnId;
|
||||
|
||||
GameObject* m_capturePoint;
|
||||
ObjectGuid::LowType m_capturePointSpawnId{};
|
||||
GameObject* _capturePoint{};
|
||||
|
||||
void AddGO(uint32 type, ObjectGuid::LowType guid, uint32 entry = 0);
|
||||
void AddCre(uint32 type, ObjectGuid::LowType guid, uint32 entry = 0);
|
||||
@@ -138,58 +131,54 @@ public:
|
||||
bool SetCapturePointData(uint32 entry, uint32 map, float x, float y, float z, float o = 0,
|
||||
float rotation0 = 0, float rotation1 = 0, float rotation2 = 0, float rotation3 = 0);
|
||||
|
||||
void SetSlider(float slider)
|
||||
{
|
||||
m_value = std::clamp<float>(slider, -m_maxValue, m_maxValue);
|
||||
}
|
||||
void SetSlider(float slider);
|
||||
|
||||
float GetSlider()
|
||||
[[nodiscard]] float GetSlider() const
|
||||
{
|
||||
return m_value;
|
||||
return _value;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool AddObject(uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o,
|
||||
float rotation0, float rotation1, float rotation2, float rotation3);
|
||||
bool AddCreature(uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay = 0);
|
||||
|
||||
bool AddCreature(uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o, uint32 spawntimeDelay = 0);
|
||||
bool DelCreature(uint32 type);
|
||||
bool DelObject(uint32 type);
|
||||
|
||||
bool DelCapturePoint();
|
||||
|
||||
protected:
|
||||
// active players in the area of the objective, 0 - alliance, 1 - horde
|
||||
PlayerSet m_activePlayers[2];
|
||||
std::array<PlayerSet, 2> _activePlayers;
|
||||
|
||||
// total shift needed to capture the objective
|
||||
float m_maxValue;
|
||||
float m_minValue;
|
||||
float _maxValue{};
|
||||
float _minValue{};
|
||||
|
||||
// maximum speed of capture
|
||||
float m_maxSpeed;
|
||||
float _maxSpeed{};
|
||||
|
||||
// the status of the objective
|
||||
float m_value;
|
||||
float _value{};
|
||||
|
||||
TeamId m_team;
|
||||
TeamId _team{ TEAM_NEUTRAL };
|
||||
|
||||
// objective states
|
||||
ObjectiveStates m_OldState;
|
||||
ObjectiveStates m_State;
|
||||
ObjectiveStates _oldState{ OBJECTIVESTATE_NEUTRAL };
|
||||
ObjectiveStates _state{ OBJECTIVESTATE_NEUTRAL };
|
||||
|
||||
// neutral value on capture bar
|
||||
uint32 m_neutralValuePct;
|
||||
uint32 _neutralValuePct{};
|
||||
|
||||
// pointer to the OutdoorPvP this objective belongs to
|
||||
OutdoorPvP* m_PvP;
|
||||
OutdoorPvP* _pvp{};
|
||||
|
||||
// map to store the various gameobjects and creatures spawned by the objective
|
||||
// map to store the various game objects and creatures
|
||||
// spawned by the objective
|
||||
// type, guid
|
||||
std::map<uint32, ObjectGuid::LowType> m_Objects;
|
||||
std::map<uint32, ObjectGuid::LowType> m_Creatures;
|
||||
std::map<ObjectGuid::LowType, uint32> m_ObjectTypes;
|
||||
std::map<ObjectGuid::LowType, uint32> m_CreatureTypes;
|
||||
std::unordered_map<uint32, ObjectGuid::LowType> _objects;
|
||||
std::unordered_map<uint32, ObjectGuid::LowType> _creatures;
|
||||
std::unordered_map<ObjectGuid::LowType, uint32> _objectTypes;
|
||||
std::unordered_map<ObjectGuid::LowType, uint32> _creatureTypes;
|
||||
};
|
||||
|
||||
// base class for specific outdoor pvp handlers
|
||||
@@ -199,7 +188,7 @@ class OutdoorPvP : public ZoneScript
|
||||
|
||||
public:
|
||||
// ctor
|
||||
OutdoorPvP();
|
||||
OutdoorPvP() = default;
|
||||
|
||||
// dtor
|
||||
~OutdoorPvP() override;
|
||||
@@ -213,7 +202,7 @@ public:
|
||||
|
||||
virtual void FillInitialWorldStates(WorldPacket& /*data*/) {}
|
||||
|
||||
// called when a player triggers an areatrigger
|
||||
// called when a player triggers an area trigger
|
||||
virtual bool HandleAreaTrigger(Player* player, uint32 trigger);
|
||||
|
||||
// called on custom spell
|
||||
@@ -246,63 +235,43 @@ public:
|
||||
// awards rewards for player kill
|
||||
virtual void AwardKillBonus(Player* /*player*/) {}
|
||||
|
||||
uint32 GetTypeId() {return m_TypeId;}
|
||||
|
||||
uint32 GetTypeId() const { return _typeId; }
|
||||
virtual bool HandleDropFlag(Player* player, uint32 spellId);
|
||||
|
||||
virtual bool HandleGossipOption(Player* player, Creature* creature, uint32 gossipid);
|
||||
|
||||
virtual bool HandleGossipOption(Player* player, Creature* creature, uint32 gossipId);
|
||||
virtual bool CanTalkTo(Player* player, Creature* c, GossipMenuItems const& gso);
|
||||
|
||||
void TeamApplyBuff(TeamId teamId, uint32 spellId, uint32 spellId2 = 0, Player* sameMapPlr = nullptr);
|
||||
|
||||
Map* GetMap() const { return m_map; }
|
||||
Map* GetMap() const { return _map; }
|
||||
|
||||
protected:
|
||||
// the map of the objectives belonging to this outdoorpvp
|
||||
OPvPCapturePointMap m_capturePoints;
|
||||
|
||||
PlayerSet m_players[2];
|
||||
|
||||
uint32 m_TypeId;
|
||||
|
||||
bool m_sendUpdate;
|
||||
|
||||
// world state stuff
|
||||
virtual void SendRemoveWorldStates(Player* /*player*/) {}
|
||||
|
||||
void BroadcastPacket(WorldPacket& data) const;
|
||||
|
||||
virtual void SendRemoveWorldStates(Player* /*player*/) {} // world state stuff
|
||||
virtual void HandlePlayerEnterZone(Player* player, uint32 zone);
|
||||
virtual void HandlePlayerLeaveZone(Player* player, uint32 zone);
|
||||
|
||||
virtual void HandlePlayerResurrects(Player* player, uint32 zone);
|
||||
|
||||
void AddCapturePoint(OPvPCapturePoint* cp)
|
||||
{
|
||||
m_capturePoints[cp->m_capturePointSpawnId] = cp;
|
||||
}
|
||||
|
||||
OPvPCapturePoint* GetCapturePoint(ObjectGuid::LowType spawnId) const
|
||||
{
|
||||
OutdoorPvP::OPvPCapturePointMap::const_iterator itr = m_capturePoints.find(spawnId);
|
||||
if (itr != m_capturePoints.end())
|
||||
return itr->second;
|
||||
return nullptr;
|
||||
_capturePoints[cp->m_capturePointSpawnId] = cp;
|
||||
}
|
||||
|
||||
OPvPCapturePoint* GetCapturePoint(ObjectGuid::LowType spawnId) const;
|
||||
void RegisterZone(uint32 zoneid);
|
||||
|
||||
bool HasPlayer(Player const* player) const;
|
||||
|
||||
void TeamCastSpell(TeamId team, int32 spellId, Player* sameMapPlr = nullptr);
|
||||
|
||||
// Hack to store map
|
||||
void SetMapFromZone(uint32 zone);
|
||||
std::map<ObjectGuid::LowType, GameObject*> m_GoScriptStore;
|
||||
std::map<ObjectGuid::LowType, Creature*> m_CreatureScriptStore;
|
||||
|
||||
Map* m_map;
|
||||
// the map of the objectives belonging to this outdoor pvp
|
||||
OPvPCapturePointMap _capturePoints;
|
||||
std::array<PlayerSet, 2> _players;
|
||||
uint32 _typeId{};
|
||||
bool _sendUpdate{ true };
|
||||
Map* _map{};
|
||||
std::unordered_map<ObjectGuid::LowType, GameObject*> _goScriptStore;
|
||||
std::unordered_map<ObjectGuid::LowType, Creature*> _creatureScriptStore;
|
||||
};
|
||||
|
||||
#endif /*OUTDOOR_PVP_H_*/
|
||||
|
||||
@@ -35,12 +35,8 @@ OutdoorPvPMgr* OutdoorPvPMgr::instance()
|
||||
|
||||
void OutdoorPvPMgr::Die()
|
||||
{
|
||||
//LOG_DEBUG("outdoorpvp", "Deleting OutdoorPvPMgr");
|
||||
for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr)
|
||||
delete *itr;
|
||||
|
||||
for (OutdoorPvPDataMap::iterator itr = m_OutdoorPvPDatas.begin(); itr != m_OutdoorPvPDatas.end(); ++itr)
|
||||
delete itr->second;
|
||||
m_OutdoorPvPSet.clear();
|
||||
m_OutdoorPvPDatas.clear();
|
||||
}
|
||||
|
||||
void OutdoorPvPMgr::InitOutdoorPvP()
|
||||
@@ -60,10 +56,8 @@ void OutdoorPvPMgr::InitOutdoorPvP()
|
||||
uint32 count = 0;
|
||||
uint32 typeId = 0;
|
||||
|
||||
do
|
||||
for (auto const& fields : *result)
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
typeId = fields[0].Get<uint8>();
|
||||
|
||||
if (DisableMgr::IsDisabledFor(DISABLE_TYPE_OUTDOORPVP, typeId, nullptr))
|
||||
@@ -75,26 +69,25 @@ void OutdoorPvPMgr::InitOutdoorPvP()
|
||||
continue;
|
||||
}
|
||||
|
||||
OutdoorPvPData* data = new OutdoorPvPData();
|
||||
OutdoorPvPTypes realTypeId = OutdoorPvPTypes(typeId);
|
||||
auto data = std::make_unique<OutdoorPvPData>();
|
||||
auto realTypeId = OutdoorPvPTypes(typeId);
|
||||
data->TypeId = realTypeId;
|
||||
data->ScriptId = sObjectMgr->GetScriptId(fields[1].Get<std::string>());
|
||||
m_OutdoorPvPDatas[realTypeId] = data;
|
||||
m_OutdoorPvPDatas[realTypeId] = std::move(data);
|
||||
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
}
|
||||
|
||||
OutdoorPvP* pvp;
|
||||
for (uint8 i = 1; i < MAX_OUTDOORPVP_TYPES; ++i)
|
||||
{
|
||||
OutdoorPvPDataMap::iterator iter = m_OutdoorPvPDatas.find(OutdoorPvPTypes(i));
|
||||
auto iter = m_OutdoorPvPDatas.find(OutdoorPvPTypes(i));
|
||||
if (iter == m_OutdoorPvPDatas.end())
|
||||
{
|
||||
LOG_ERROR("sql.sql", "Could not initialize OutdoorPvP object for type ID {}; no entry in database.", uint32(i));
|
||||
continue;
|
||||
}
|
||||
|
||||
pvp = sScriptMgr->CreateOutdoorPvP(iter->second);
|
||||
auto pvp = std::unique_ptr<OutdoorPvP>(sScriptMgr->CreateOutdoorPvP(iter->second.get()));
|
||||
if (!pvp)
|
||||
{
|
||||
LOG_ERROR("outdoorpvp", "Could not initialize OutdoorPvP object for type ID {}; got nullptr pointer from script.", uint32(i));
|
||||
@@ -104,11 +97,10 @@ void OutdoorPvPMgr::InitOutdoorPvP()
|
||||
if (!pvp->SetupOutdoorPvP())
|
||||
{
|
||||
LOG_ERROR("outdoorpvp", "Could not initialize OutdoorPvP object for type ID {}; SetupOutdoorPvP failed.", uint32(i));
|
||||
delete pvp;
|
||||
continue;
|
||||
}
|
||||
|
||||
m_OutdoorPvPSet.push_back(pvp);
|
||||
m_OutdoorPvPSet.emplace_back(std::move(pvp));
|
||||
}
|
||||
|
||||
LOG_INFO("server.loading", ">> Loaded {} outdoor PvP definitions in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
@@ -122,7 +114,7 @@ void OutdoorPvPMgr::AddZone(uint32 zoneid, OutdoorPvP* handle)
|
||||
|
||||
void OutdoorPvPMgr::HandlePlayerEnterZone(Player* player, uint32 zoneid)
|
||||
{
|
||||
OutdoorPvPMap::iterator itr = m_OutdoorPvPMap.find(zoneid);
|
||||
auto itr = m_OutdoorPvPMap.find(zoneid);
|
||||
if (itr == m_OutdoorPvPMap.end())
|
||||
return;
|
||||
|
||||
@@ -137,7 +129,7 @@ void OutdoorPvPMgr::HandlePlayerEnterZone(Player* player, uint32 zoneid)
|
||||
|
||||
void OutdoorPvPMgr::HandlePlayerLeaveZone(Player* player, uint32 zoneid)
|
||||
{
|
||||
OutdoorPvPMap::iterator itr = m_OutdoorPvPMap.find(zoneid);
|
||||
auto itr = m_OutdoorPvPMap.find(zoneid);
|
||||
if (itr == m_OutdoorPvPMap.end())
|
||||
return;
|
||||
|
||||
@@ -153,22 +145,27 @@ void OutdoorPvPMgr::HandlePlayerLeaveZone(Player* player, uint32 zoneid)
|
||||
|
||||
OutdoorPvP* OutdoorPvPMgr::GetOutdoorPvPToZoneId(uint32 zoneid)
|
||||
{
|
||||
OutdoorPvPMap::iterator itr = m_OutdoorPvPMap.find(zoneid);
|
||||
auto itr = m_OutdoorPvPMap.find(zoneid);
|
||||
if (itr == m_OutdoorPvPMap.end())
|
||||
{
|
||||
// no handle for this zone, return
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return itr->second;
|
||||
}
|
||||
|
||||
void OutdoorPvPMgr::Update(uint32 diff)
|
||||
{
|
||||
m_UpdateTimer += diff;
|
||||
|
||||
if (m_UpdateTimer > OUTDOORPVP_OBJECTIVE_UPDATE_INTERVAL)
|
||||
{
|
||||
for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr)
|
||||
(*itr)->Update(m_UpdateTimer);
|
||||
for (auto const& itr : m_OutdoorPvPSet)
|
||||
{
|
||||
itr->Update(m_UpdateTimer);
|
||||
}
|
||||
|
||||
m_UpdateTimer = 0;
|
||||
}
|
||||
}
|
||||
@@ -176,72 +173,91 @@ void OutdoorPvPMgr::Update(uint32 diff)
|
||||
bool OutdoorPvPMgr::HandleCustomSpell(Player* player, uint32 spellId, GameObject* go)
|
||||
{
|
||||
// pussywizard: no mutex because not affecting other players
|
||||
for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr)
|
||||
for (auto& itr : m_OutdoorPvPSet)
|
||||
{
|
||||
if ((*itr)->HandleCustomSpell(player, spellId, go))
|
||||
if (itr->HandleCustomSpell(player, spellId, go))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
ZoneScript* OutdoorPvPMgr::GetZoneScript(uint32 zoneId)
|
||||
{
|
||||
OutdoorPvPMap::iterator itr = m_OutdoorPvPMap.find(zoneId);
|
||||
auto itr = m_OutdoorPvPMap.find(zoneId);
|
||||
if (itr != m_OutdoorPvPMap.end())
|
||||
{
|
||||
return itr->second;
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool OutdoorPvPMgr::HandleOpenGo(Player* player, GameObject* go)
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(_lock); // pussywizard
|
||||
for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr)
|
||||
|
||||
for (auto& itr : m_OutdoorPvPSet)
|
||||
{
|
||||
if ((*itr)->HandleOpenGo(player, go))
|
||||
if (itr->HandleOpenGo(player, go))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void OutdoorPvPMgr::HandleGossipOption(Player* player, Creature* creature, uint32 gossipid)
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(_lock); // pussywizard
|
||||
for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr)
|
||||
|
||||
for (auto& itr : m_OutdoorPvPSet)
|
||||
{
|
||||
if ((*itr)->HandleGossipOption(player, creature, gossipid))
|
||||
if (itr->HandleGossipOption(player, creature, gossipid))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool OutdoorPvPMgr::CanTalkTo(Player* player, Creature* creature, GossipMenuItems const& gso)
|
||||
{
|
||||
for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr)
|
||||
for (auto& itr : m_OutdoorPvPSet)
|
||||
{
|
||||
if ((*itr)->CanTalkTo(player, creature, gso))
|
||||
if (itr->CanTalkTo(player, creature, gso))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void OutdoorPvPMgr::HandleDropFlag(Player* player, uint32 spellId)
|
||||
{
|
||||
// pussywizard: no mutex because not affecting other players
|
||||
for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr)
|
||||
for (auto& itr : m_OutdoorPvPSet)
|
||||
{
|
||||
if ((*itr)->HandleDropFlag(player, spellId))
|
||||
if (itr->HandleDropFlag(player, spellId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OutdoorPvPMgr::HandlePlayerResurrects(Player* player, uint32 zoneid)
|
||||
{
|
||||
OutdoorPvPMap::iterator itr = m_OutdoorPvPMap.find(zoneid);
|
||||
auto itr = m_OutdoorPvPMap.find(zoneid);
|
||||
if (itr == m_OutdoorPvPMap.end())
|
||||
return;
|
||||
|
||||
// pussywizard: no mutex because not affecting other players
|
||||
|
||||
if (itr->second->HasPlayer(player))
|
||||
{
|
||||
itr->second->HandlePlayerResurrects(player, zoneid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#define OUTDOORPVP_OBJECTIVE_UPDATE_INTERVAL 1000
|
||||
|
||||
#include "OutdoorPvP.h"
|
||||
#include <memory>
|
||||
|
||||
class Player;
|
||||
class GameObject;
|
||||
@@ -39,7 +40,7 @@ class OutdoorPvPMgr
|
||||
{
|
||||
private:
|
||||
OutdoorPvPMgr();
|
||||
~OutdoorPvPMgr() {};
|
||||
~OutdoorPvPMgr() = default;
|
||||
|
||||
public:
|
||||
static OutdoorPvPMgr* instance();
|
||||
@@ -80,24 +81,20 @@ public:
|
||||
|
||||
void HandleDropFlag(Player* player, uint32 spellId);
|
||||
|
||||
// pussywizard: lock required because different functions affect m_players
|
||||
// pussywizard: lock required because different functions affect _players
|
||||
std::mutex _lock;
|
||||
|
||||
private:
|
||||
typedef std::vector<OutdoorPvP*> OutdoorPvPSet;
|
||||
typedef std::map<uint32 /* zoneid */, OutdoorPvP*> OutdoorPvPMap;
|
||||
typedef std::map<OutdoorPvPTypes, OutdoorPvPData*> OutdoorPvPDataMap;
|
||||
|
||||
// contains all initiated outdoor pvp events
|
||||
// used when initing / cleaning up
|
||||
OutdoorPvPSet m_OutdoorPvPSet;
|
||||
std::vector<std::unique_ptr<OutdoorPvP>> m_OutdoorPvPSet;
|
||||
|
||||
// maps the zone ids to an outdoor pvp event
|
||||
// used in player event handling
|
||||
OutdoorPvPMap m_OutdoorPvPMap;
|
||||
std::map<uint32/*zoneid*/, OutdoorPvP*> m_OutdoorPvPMap;
|
||||
|
||||
// Holds the outdoor PvP templates
|
||||
OutdoorPvPDataMap m_OutdoorPvPDatas;
|
||||
std::map<OutdoorPvPTypes, std::unique_ptr<OutdoorPvPData>> m_OutdoorPvPDatas;
|
||||
|
||||
// update interval
|
||||
uint32 m_UpdateTimer;
|
||||
|
||||
@@ -38,34 +38,34 @@ OPvPCapturePointEP_EWT::OPvPCapturePointEP_EWT(OutdoorPvP* pvp)
|
||||
void OPvPCapturePointEP_EWT::ChangeState()
|
||||
{
|
||||
// if changing from controlling alliance to horde or vice versa
|
||||
if ( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State )
|
||||
if ( _oldState == OBJECTIVESTATE_ALLIANCE && _oldState != _state )
|
||||
{
|
||||
sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_EWT_A));
|
||||
((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_EWT, TEAM_NEUTRAL);
|
||||
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_EWT, TEAM_NEUTRAL);
|
||||
}
|
||||
else if ( m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State )
|
||||
else if ( _oldState == OBJECTIVESTATE_HORDE && _oldState != _state )
|
||||
{
|
||||
sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_EWT_H));
|
||||
((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_EWT, TEAM_NEUTRAL);
|
||||
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_EWT, TEAM_NEUTRAL);
|
||||
}
|
||||
|
||||
uint32 artkit = 21;
|
||||
|
||||
switch (m_State)
|
||||
switch (_state)
|
||||
{
|
||||
case OBJECTIVESTATE_ALLIANCE:
|
||||
m_TowerState = EP_TS_A;
|
||||
artkit = 2;
|
||||
SummonSupportUnitAtNorthpassTower(TEAM_ALLIANCE);
|
||||
((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_EWT, TEAM_ALLIANCE);
|
||||
if (m_OldState != m_State) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_EWT_A));
|
||||
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_EWT, TEAM_ALLIANCE);
|
||||
if (_oldState != _state) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_EWT_A));
|
||||
break;
|
||||
case OBJECTIVESTATE_HORDE:
|
||||
m_TowerState = EP_TS_H;
|
||||
artkit = 1;
|
||||
SummonSupportUnitAtNorthpassTower(TEAM_HORDE);
|
||||
((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_EWT, TEAM_HORDE);
|
||||
if (m_OldState != m_State) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_EWT_H));
|
||||
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_EWT, TEAM_HORDE);
|
||||
if (_oldState != _state) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_EWT_H));
|
||||
break;
|
||||
case OBJECTIVESTATE_NEUTRAL:
|
||||
m_TowerState = EP_TS_N;
|
||||
@@ -85,7 +85,7 @@ void OPvPCapturePointEP_EWT::ChangeState()
|
||||
for (auto itr = bounds.first; itr != bounds.second; ++itr)
|
||||
itr->second->SetGoArtKit(artkit);
|
||||
|
||||
bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_Objects[EP_EWT_FLAGS]);
|
||||
bounds = map->GetGameObjectBySpawnIdStore().equal_range(_objects[EP_EWT_FLAGS]);
|
||||
for (auto itr = bounds.first; itr != bounds.second; ++itr)
|
||||
itr->second->SetGoArtKit(artkit);
|
||||
|
||||
@@ -101,10 +101,10 @@ void OPvPCapturePointEP_EWT::SendChangePhase()
|
||||
// send this too, sometimes the slider disappears, dunno why :(
|
||||
SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1);
|
||||
// send these updates to only the ones in this objective
|
||||
uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f);
|
||||
uint32 phase = (uint32)ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f);
|
||||
SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS, phase);
|
||||
// send this too, sometimes it resets :S
|
||||
SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_neutralValuePct);
|
||||
SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, _neutralValuePct);
|
||||
}
|
||||
|
||||
void OPvPCapturePointEP_EWT::FillInitialWorldStates(WorldPacket& data)
|
||||
@@ -118,11 +118,11 @@ void OPvPCapturePointEP_EWT::FillInitialWorldStates(WorldPacket& data)
|
||||
|
||||
void OPvPCapturePointEP_EWT::UpdateTowerState()
|
||||
{
|
||||
m_PvP->SendUpdateWorldState(EP_EWT_A, bool(m_TowerState & EP_TS_A));
|
||||
m_PvP->SendUpdateWorldState(EP_EWT_H, bool(m_TowerState & EP_TS_H));
|
||||
m_PvP->SendUpdateWorldState(EP_EWT_N_A, bool(m_TowerState & EP_TS_N_A));
|
||||
m_PvP->SendUpdateWorldState(EP_EWT_N_H, bool(m_TowerState & EP_TS_N_H));
|
||||
m_PvP->SendUpdateWorldState(EP_EWT_N, bool(m_TowerState & EP_TS_N));
|
||||
_pvp->SendUpdateWorldState(EP_EWT_A, bool(m_TowerState & EP_TS_A));
|
||||
_pvp->SendUpdateWorldState(EP_EWT_H, bool(m_TowerState & EP_TS_H));
|
||||
_pvp->SendUpdateWorldState(EP_EWT_N_A, bool(m_TowerState & EP_TS_N_A));
|
||||
_pvp->SendUpdateWorldState(EP_EWT_N_H, bool(m_TowerState & EP_TS_N_H));
|
||||
_pvp->SendUpdateWorldState(EP_EWT_N, bool(m_TowerState & EP_TS_N));
|
||||
}
|
||||
|
||||
bool OPvPCapturePointEP_EWT::HandlePlayerEnter(Player* player)
|
||||
@@ -130,9 +130,9 @@ bool OPvPCapturePointEP_EWT::HandlePlayerEnter(Player* player)
|
||||
if (OPvPCapturePoint::HandlePlayerEnter(player))
|
||||
{
|
||||
player->SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1);
|
||||
uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f);
|
||||
uint32 phase = (uint32)ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f);
|
||||
player->SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS, phase);
|
||||
player->SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_neutralValuePct);
|
||||
player->SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, _neutralValuePct);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -170,34 +170,34 @@ OPvPCapturePointEP_NPT::OPvPCapturePointEP_NPT(OutdoorPvP* pvp)
|
||||
void OPvPCapturePointEP_NPT::ChangeState()
|
||||
{
|
||||
// if changing from controlling alliance to horde or vice versa
|
||||
if ( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State )
|
||||
if ( _oldState == OBJECTIVESTATE_ALLIANCE && _oldState != _state )
|
||||
{
|
||||
sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_NPT_A));
|
||||
((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_NPT, TEAM_NEUTRAL);
|
||||
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_NPT, TEAM_NEUTRAL);
|
||||
}
|
||||
else if ( m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State )
|
||||
else if ( _oldState == OBJECTIVESTATE_HORDE && _oldState != _state )
|
||||
{
|
||||
sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_NPT_H));
|
||||
((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_NPT, TEAM_NEUTRAL);
|
||||
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_NPT, TEAM_NEUTRAL);
|
||||
}
|
||||
|
||||
uint32 artkit = 21;
|
||||
|
||||
switch (m_State)
|
||||
switch (_state)
|
||||
{
|
||||
case OBJECTIVESTATE_ALLIANCE:
|
||||
m_TowerState = EP_TS_A;
|
||||
artkit = 2;
|
||||
SummonGO(TEAM_ALLIANCE);
|
||||
((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_NPT, TEAM_ALLIANCE);
|
||||
if (m_OldState != m_State) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_A));
|
||||
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_NPT, TEAM_ALLIANCE);
|
||||
if (_oldState != _state) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_A));
|
||||
break;
|
||||
case OBJECTIVESTATE_HORDE:
|
||||
m_TowerState = EP_TS_H;
|
||||
artkit = 1;
|
||||
SummonGO(TEAM_HORDE);
|
||||
((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_NPT, TEAM_HORDE);
|
||||
if (m_OldState != m_State) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_H));
|
||||
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_NPT, TEAM_HORDE);
|
||||
if (_oldState != _state) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_H));
|
||||
break;
|
||||
case OBJECTIVESTATE_NEUTRAL:
|
||||
m_TowerState = EP_TS_N;
|
||||
@@ -227,7 +227,7 @@ void OPvPCapturePointEP_NPT::ChangeState()
|
||||
for (auto itr = bounds.first; itr != bounds.second; ++itr)
|
||||
itr->second->SetGoArtKit(artkit);
|
||||
|
||||
bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_Objects[EP_NPT_FLAGS]);
|
||||
bounds = map->GetGameObjectBySpawnIdStore().equal_range(_objects[EP_NPT_FLAGS]);
|
||||
for (auto itr = bounds.first; itr != bounds.second; ++itr)
|
||||
itr->second->SetGoArtKit(artkit);
|
||||
|
||||
@@ -243,10 +243,10 @@ void OPvPCapturePointEP_NPT::SendChangePhase()
|
||||
// send this too, sometimes the slider disappears, dunno why :(
|
||||
SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1);
|
||||
// send these updates to only the ones in this objective
|
||||
uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f);
|
||||
uint32 phase = (uint32)ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f);
|
||||
SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS, phase);
|
||||
// send this too, sometimes it resets :S
|
||||
SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_neutralValuePct);
|
||||
SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, _neutralValuePct);
|
||||
}
|
||||
|
||||
void OPvPCapturePointEP_NPT::FillInitialWorldStates(WorldPacket& data)
|
||||
@@ -260,11 +260,11 @@ void OPvPCapturePointEP_NPT::FillInitialWorldStates(WorldPacket& data)
|
||||
|
||||
void OPvPCapturePointEP_NPT::UpdateTowerState()
|
||||
{
|
||||
m_PvP->SendUpdateWorldState(EP_NPT_A, bool(m_TowerState & EP_TS_A));
|
||||
m_PvP->SendUpdateWorldState(EP_NPT_H, bool(m_TowerState & EP_TS_H));
|
||||
m_PvP->SendUpdateWorldState(EP_NPT_N_A, bool(m_TowerState & EP_TS_N_A));
|
||||
m_PvP->SendUpdateWorldState(EP_NPT_N_H, bool(m_TowerState & EP_TS_N_H));
|
||||
m_PvP->SendUpdateWorldState(EP_NPT_N, bool(m_TowerState & EP_TS_N));
|
||||
_pvp->SendUpdateWorldState(EP_NPT_A, bool(m_TowerState & EP_TS_A));
|
||||
_pvp->SendUpdateWorldState(EP_NPT_H, bool(m_TowerState & EP_TS_H));
|
||||
_pvp->SendUpdateWorldState(EP_NPT_N_A, bool(m_TowerState & EP_TS_N_A));
|
||||
_pvp->SendUpdateWorldState(EP_NPT_N_H, bool(m_TowerState & EP_TS_N_H));
|
||||
_pvp->SendUpdateWorldState(EP_NPT_N, bool(m_TowerState & EP_TS_N));
|
||||
}
|
||||
|
||||
bool OPvPCapturePointEP_NPT::HandlePlayerEnter(Player* player)
|
||||
@@ -272,9 +272,9 @@ bool OPvPCapturePointEP_NPT::HandlePlayerEnter(Player* player)
|
||||
if (OPvPCapturePoint::HandlePlayerEnter(player))
|
||||
{
|
||||
player->SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1);
|
||||
uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f);
|
||||
uint32 phase = (uint32)ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f);
|
||||
player->SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS, phase);
|
||||
player->SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_neutralValuePct);
|
||||
player->SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, _neutralValuePct);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -294,7 +294,7 @@ void OPvPCapturePointEP_NPT::SummonGO(TeamId teamId)
|
||||
DelObject(EP_NPT_BUFF);
|
||||
AddObject(EP_NPT_BUFF, EP_NPT_LordaeronShrine.entry, EP_NPT_LordaeronShrine.map, EP_NPT_LordaeronShrine.x, EP_NPT_LordaeronShrine.y, EP_NPT_LordaeronShrine.z, EP_NPT_LordaeronShrine.o, EP_NPT_LordaeronShrine.rot0, EP_NPT_LordaeronShrine.rot1, EP_NPT_LordaeronShrine.rot2, EP_NPT_LordaeronShrine.rot3);
|
||||
Map* map = sMapMgr->FindMap(0, 0);
|
||||
auto bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_Objects[EP_NPT_BUFF]);
|
||||
auto bounds = map->GetGameObjectBySpawnIdStore().equal_range(_objects[EP_NPT_BUFF]);
|
||||
for (auto itr = bounds.first; itr != bounds.second; ++itr)
|
||||
if (GameObject* go = itr->second)
|
||||
go->SetUInt32Value(GAMEOBJECT_FACTION, (teamId == TEAM_ALLIANCE ? 84 : 83));
|
||||
@@ -312,34 +312,34 @@ OPvPCapturePointEP_CGT::OPvPCapturePointEP_CGT(OutdoorPvP* pvp)
|
||||
void OPvPCapturePointEP_CGT::ChangeState()
|
||||
{
|
||||
// if changing from controlling alliance to horde or vice versa
|
||||
if ( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State )
|
||||
if ( _oldState == OBJECTIVESTATE_ALLIANCE && _oldState != _state )
|
||||
{
|
||||
sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_CGT_A));
|
||||
((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_CGT, TEAM_NEUTRAL);
|
||||
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_CGT, TEAM_NEUTRAL);
|
||||
}
|
||||
else if ( m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State )
|
||||
else if ( _oldState == OBJECTIVESTATE_HORDE && _oldState != _state )
|
||||
{
|
||||
sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_CGT_H));
|
||||
((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_CGT, TEAM_NEUTRAL);
|
||||
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_CGT, TEAM_NEUTRAL);
|
||||
}
|
||||
|
||||
uint32 artkit = 21;
|
||||
|
||||
switch (m_State)
|
||||
switch (_state)
|
||||
{
|
||||
case OBJECTIVESTATE_ALLIANCE:
|
||||
m_TowerState = EP_TS_A;
|
||||
artkit = 2;
|
||||
LinkGraveyard(TEAM_ALLIANCE);
|
||||
((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_CGT, TEAM_ALLIANCE);
|
||||
if (m_OldState != m_State) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_CGT_A));
|
||||
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_CGT, TEAM_ALLIANCE);
|
||||
if (_oldState != _state) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_CGT_A));
|
||||
break;
|
||||
case OBJECTIVESTATE_HORDE:
|
||||
m_TowerState = EP_TS_H;
|
||||
artkit = 1;
|
||||
LinkGraveyard(TEAM_HORDE);
|
||||
((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_CGT, TEAM_HORDE);
|
||||
if (m_OldState != m_State) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_CGT_H));
|
||||
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_CGT, TEAM_HORDE);
|
||||
if (_oldState != _state) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_CGT_H));
|
||||
break;
|
||||
case OBJECTIVESTATE_NEUTRAL:
|
||||
m_TowerState = EP_TS_N;
|
||||
@@ -359,7 +359,7 @@ void OPvPCapturePointEP_CGT::ChangeState()
|
||||
for (auto itr = bounds.first; itr != bounds.second; ++itr)
|
||||
itr->second->SetGoArtKit(artkit);
|
||||
|
||||
bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_Objects[EP_CGT_FLAGS]);
|
||||
bounds = map->GetGameObjectBySpawnIdStore().equal_range(_objects[EP_CGT_FLAGS]);
|
||||
for (auto itr = bounds.first; itr != bounds.second; ++itr)
|
||||
itr->second->SetGoArtKit(artkit);
|
||||
|
||||
@@ -375,10 +375,10 @@ void OPvPCapturePointEP_CGT::SendChangePhase()
|
||||
// send this too, sometimes the slider disappears, dunno why :(
|
||||
SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1);
|
||||
// send these updates to only the ones in this objective
|
||||
uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f);
|
||||
uint32 phase = (uint32)ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f);
|
||||
SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS, phase);
|
||||
// send this too, sometimes it resets :S
|
||||
SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_neutralValuePct);
|
||||
SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, _neutralValuePct);
|
||||
}
|
||||
|
||||
void OPvPCapturePointEP_CGT::FillInitialWorldStates(WorldPacket& data)
|
||||
@@ -392,11 +392,11 @@ void OPvPCapturePointEP_CGT::FillInitialWorldStates(WorldPacket& data)
|
||||
|
||||
void OPvPCapturePointEP_CGT::UpdateTowerState()
|
||||
{
|
||||
m_PvP->SendUpdateWorldState(EP_CGT_A, bool(m_TowerState & EP_TS_A));
|
||||
m_PvP->SendUpdateWorldState(EP_CGT_H, bool(m_TowerState & EP_TS_H));
|
||||
m_PvP->SendUpdateWorldState(EP_CGT_N_A, bool(m_TowerState & EP_TS_N_A));
|
||||
m_PvP->SendUpdateWorldState(EP_CGT_N_H, bool(m_TowerState & EP_TS_N_H));
|
||||
m_PvP->SendUpdateWorldState(EP_CGT_N, bool(m_TowerState & EP_TS_N));
|
||||
_pvp->SendUpdateWorldState(EP_CGT_A, bool(m_TowerState & EP_TS_A));
|
||||
_pvp->SendUpdateWorldState(EP_CGT_H, bool(m_TowerState & EP_TS_H));
|
||||
_pvp->SendUpdateWorldState(EP_CGT_N_A, bool(m_TowerState & EP_TS_N_A));
|
||||
_pvp->SendUpdateWorldState(EP_CGT_N_H, bool(m_TowerState & EP_TS_N_H));
|
||||
_pvp->SendUpdateWorldState(EP_CGT_N, bool(m_TowerState & EP_TS_N));
|
||||
}
|
||||
|
||||
bool OPvPCapturePointEP_CGT::HandlePlayerEnter(Player* player)
|
||||
@@ -404,9 +404,9 @@ bool OPvPCapturePointEP_CGT::HandlePlayerEnter(Player* player)
|
||||
if (OPvPCapturePoint::HandlePlayerEnter(player))
|
||||
{
|
||||
player->SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1);
|
||||
uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f);
|
||||
uint32 phase = (uint32)ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f);
|
||||
player->SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS, phase);
|
||||
player->SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_neutralValuePct);
|
||||
player->SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, _neutralValuePct);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -439,34 +439,34 @@ OPvPCapturePointEP_PWT::OPvPCapturePointEP_PWT(OutdoorPvP* pvp)
|
||||
void OPvPCapturePointEP_PWT::ChangeState()
|
||||
{
|
||||
// if changing from controlling alliance to horde or vice versa
|
||||
if ( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State )
|
||||
if ( _oldState == OBJECTIVESTATE_ALLIANCE && _oldState != _state )
|
||||
{
|
||||
sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_PWT_A));
|
||||
((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_PWT, TEAM_NEUTRAL);
|
||||
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_PWT, TEAM_NEUTRAL);
|
||||
}
|
||||
else if ( m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State )
|
||||
else if ( _oldState == OBJECTIVESTATE_HORDE && _oldState != _state )
|
||||
{
|
||||
sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_PWT_H));
|
||||
((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_PWT, TEAM_NEUTRAL);
|
||||
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_PWT, TEAM_NEUTRAL);
|
||||
}
|
||||
|
||||
uint32 artkit = 21;
|
||||
|
||||
switch (m_State)
|
||||
switch (_state)
|
||||
{
|
||||
case OBJECTIVESTATE_ALLIANCE:
|
||||
m_TowerState = EP_TS_A;
|
||||
SummonFlightMaster(TEAM_ALLIANCE);
|
||||
artkit = 2;
|
||||
((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_PWT, TEAM_ALLIANCE);
|
||||
if (m_OldState != m_State) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_A));
|
||||
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_PWT, TEAM_ALLIANCE);
|
||||
if (_oldState != _state) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_A));
|
||||
break;
|
||||
case OBJECTIVESTATE_HORDE:
|
||||
m_TowerState = EP_TS_H;
|
||||
SummonFlightMaster(TEAM_HORDE);
|
||||
artkit = 1;
|
||||
((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_PWT, TEAM_HORDE);
|
||||
if (m_OldState != m_State) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_H));
|
||||
((OutdoorPvPEP*)_pvp)->SetControlledState(EP_PWT, TEAM_HORDE);
|
||||
if (_oldState != _state) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_H));
|
||||
break;
|
||||
case OBJECTIVESTATE_NEUTRAL:
|
||||
m_TowerState = EP_TS_N;
|
||||
@@ -496,7 +496,7 @@ void OPvPCapturePointEP_PWT::ChangeState()
|
||||
for (auto itr = bounds.first; itr != bounds.second; ++itr)
|
||||
itr->second->SetGoArtKit(artkit);
|
||||
|
||||
bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_Objects[EP_PWT_FLAGS]);
|
||||
bounds = map->GetGameObjectBySpawnIdStore().equal_range(_objects[EP_PWT_FLAGS]);
|
||||
for (auto itr = bounds.first; itr != bounds.second; ++itr)
|
||||
itr->second->SetGoArtKit(artkit);
|
||||
|
||||
@@ -512,10 +512,10 @@ void OPvPCapturePointEP_PWT::SendChangePhase()
|
||||
// send this too, sometimes the slider disappears, dunno why :(
|
||||
SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1);
|
||||
// send these updates to only the ones in this objective
|
||||
uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f);
|
||||
uint32 phase = (uint32)ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f);
|
||||
SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS, phase);
|
||||
// send this too, sometimes it resets :S
|
||||
SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_neutralValuePct);
|
||||
SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, _neutralValuePct);
|
||||
}
|
||||
|
||||
void OPvPCapturePointEP_PWT::FillInitialWorldStates(WorldPacket& data)
|
||||
@@ -529,11 +529,11 @@ void OPvPCapturePointEP_PWT::FillInitialWorldStates(WorldPacket& data)
|
||||
|
||||
void OPvPCapturePointEP_PWT::UpdateTowerState()
|
||||
{
|
||||
m_PvP->SendUpdateWorldState(EP_PWT_A, bool(m_TowerState & EP_TS_A));
|
||||
m_PvP->SendUpdateWorldState(EP_PWT_H, bool(m_TowerState & EP_TS_H));
|
||||
m_PvP->SendUpdateWorldState(EP_PWT_N_A, bool(m_TowerState & EP_TS_N_A));
|
||||
m_PvP->SendUpdateWorldState(EP_PWT_N_H, bool(m_TowerState & EP_TS_N_H));
|
||||
m_PvP->SendUpdateWorldState(EP_PWT_N, bool(m_TowerState & EP_TS_N));
|
||||
_pvp->SendUpdateWorldState(EP_PWT_A, bool(m_TowerState & EP_TS_A));
|
||||
_pvp->SendUpdateWorldState(EP_PWT_H, bool(m_TowerState & EP_TS_H));
|
||||
_pvp->SendUpdateWorldState(EP_PWT_N_A, bool(m_TowerState & EP_TS_N_A));
|
||||
_pvp->SendUpdateWorldState(EP_PWT_N_H, bool(m_TowerState & EP_TS_N_H));
|
||||
_pvp->SendUpdateWorldState(EP_PWT_N, bool(m_TowerState & EP_TS_N));
|
||||
}
|
||||
|
||||
bool OPvPCapturePointEP_PWT::HandlePlayerEnter(Player* player)
|
||||
@@ -541,9 +541,9 @@ bool OPvPCapturePointEP_PWT::HandlePlayerEnter(Player* player)
|
||||
if (OPvPCapturePoint::HandlePlayerEnter(player))
|
||||
{
|
||||
player->SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1);
|
||||
uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f);
|
||||
uint32 phase = (uint32)ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f);
|
||||
player->SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS, phase);
|
||||
player->SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_neutralValuePct);
|
||||
player->SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, _neutralValuePct);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -565,7 +565,7 @@ void OPvPCapturePointEP_PWT::SummonFlightMaster(TeamId teamId)
|
||||
/*
|
||||
// sky - we need update gso code
|
||||
|
||||
Creature* c = HashMapHolder<Creature>::Find(m_Creatures[EP_PWT_FLIGHTMASTER]);
|
||||
Creature* c = HashMapHolder<Creature>::Find(_creatures[EP_PWT_FLIGHTMASTER]);
|
||||
//Spawn flight master as friendly to capturing team
|
||||
c->SetUInt32Value(GAMEOBJECT_FACTION, (teamId == TEAM_ALLIANCE ? 55 : 68));
|
||||
if (c)
|
||||
@@ -608,7 +608,7 @@ void OPvPCapturePointEP_PWT::SummonFlightMaster(TeamId teamId)
|
||||
// ep
|
||||
OutdoorPvPEP::OutdoorPvPEP()
|
||||
{
|
||||
m_TypeId = OUTDOOR_PVP_EP;
|
||||
_typeId = OUTDOOR_PVP_EP;
|
||||
memset(EP_ControlsId, TEAM_NEUTRAL, sizeof(EP_ControlsId));
|
||||
m_AllianceTowersControlled = 0;
|
||||
m_HordeTowersControlled = 0;
|
||||
@@ -684,7 +684,7 @@ void OutdoorPvPEP::HandlePlayerLeaveZone(Player* player, uint32 zone)
|
||||
|
||||
void OutdoorPvPEP::BuffTeams()
|
||||
{
|
||||
for (PlayerSet::iterator itr = m_players[0].begin(); itr != m_players[0].end(); ++itr)
|
||||
for (PlayerSet::iterator itr = _players[0].begin(); itr != _players[0].end(); ++itr)
|
||||
{
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
{
|
||||
@@ -694,7 +694,7 @@ void OutdoorPvPEP::BuffTeams()
|
||||
player->CastSpell(player, EP_AllianceBuffs[m_AllianceTowersControlled - 1], true);
|
||||
}
|
||||
}
|
||||
for (PlayerSet::iterator itr = m_players[1].begin(); itr != m_players[1].end(); ++itr)
|
||||
for (PlayerSet::iterator itr = _players[1].begin(); itr != _players[1].end(); ++itr)
|
||||
{
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
{
|
||||
@@ -718,7 +718,7 @@ void OutdoorPvPEP::FillInitialWorldStates(WorldPacket& data)
|
||||
data << EP_UI_TOWER_SLIDER_DISPLAY << uint32(0);
|
||||
data << EP_UI_TOWER_SLIDER_POS << uint32(50);
|
||||
data << EP_UI_TOWER_SLIDER_N << uint32(100);
|
||||
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
for (OPvPCapturePointMap::iterator itr = _capturePoints.begin(); itr != _capturePoints.end(); ++itr)
|
||||
{
|
||||
itr->second->FillInitialWorldStates(data);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
OutdoorPvPGH::OutdoorPvPGH()
|
||||
{
|
||||
m_TypeId = OUTDOOR_PVP_GH;
|
||||
_typeId = OUTDOOR_PVP_GH;
|
||||
}
|
||||
|
||||
bool OutdoorPvPGH::SetupOutdoorPvP()
|
||||
@@ -61,9 +61,9 @@ void OPvPCapturePointGH::SendChangePhase()
|
||||
// send this too, sometimes the slider disappears, dunno why :(
|
||||
SendUpdateWorldState(GH_UI_SLIDER_DISPLAY, 1);
|
||||
// send these updates to only the ones in this objective
|
||||
uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f);
|
||||
uint32 phase = (uint32)ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f);
|
||||
SendUpdateWorldState(GH_UI_SLIDER_POS, phase);
|
||||
SendUpdateWorldState(GH_UI_SLIDER_N, m_neutralValuePct);
|
||||
SendUpdateWorldState(GH_UI_SLIDER_N, _neutralValuePct);
|
||||
}
|
||||
|
||||
bool OPvPCapturePointGH::HandlePlayerEnter(Player* player)
|
||||
@@ -71,9 +71,9 @@ bool OPvPCapturePointGH::HandlePlayerEnter(Player* player)
|
||||
if (OPvPCapturePoint::HandlePlayerEnter(player))
|
||||
{
|
||||
player->SendUpdateWorldState(GH_UI_SLIDER_DISPLAY, 1);
|
||||
uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f);
|
||||
uint32 phase = (uint32)ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f);
|
||||
player->SendUpdateWorldState(GH_UI_SLIDER_POS, phase);
|
||||
player->SendUpdateWorldState(GH_UI_SLIDER_N, m_neutralValuePct);
|
||||
player->SendUpdateWorldState(GH_UI_SLIDER_N, _neutralValuePct);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -88,7 +88,7 @@ void OPvPCapturePointGH::HandlePlayerLeave(Player* player)
|
||||
void OPvPCapturePointGH::ChangeState()
|
||||
{
|
||||
uint32 artkit = 21;
|
||||
switch (m_State)
|
||||
switch (_state)
|
||||
{
|
||||
case OBJECTIVESTATE_ALLIANCE:
|
||||
sGameEventMgr->StopEvent(GH_ALLIANCE_DEFENSE_EVENT);
|
||||
|
||||
@@ -62,7 +62,7 @@ OPvPCapturePointHP::OPvPCapturePointHP(OutdoorPvP* pvp, OutdoorPvPHPTowerType ty
|
||||
|
||||
OutdoorPvPHP::OutdoorPvPHP()
|
||||
{
|
||||
m_TypeId = OUTDOOR_PVP_HP;
|
||||
_typeId = OUTDOOR_PVP_HP;
|
||||
m_AllianceTowersControlled = 0;
|
||||
m_HordeTowersControlled = 0;
|
||||
}
|
||||
@@ -162,7 +162,7 @@ void OutdoorPvPHP::FillInitialWorldStates(WorldPacket& data)
|
||||
data << uint32(HP_UI_TOWER_SLIDER_DISPLAY) << uint32(0);
|
||||
data << uint32(HP_UI_TOWER_SLIDER_POS) << uint32(50);
|
||||
data << uint32(HP_UI_TOWER_SLIDER_N) << uint32(100);
|
||||
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
for (OPvPCapturePointMap::iterator itr = _capturePoints.begin(); itr != _capturePoints.end(); ++itr)
|
||||
{
|
||||
itr->second->FillInitialWorldStates(data);
|
||||
}
|
||||
@@ -171,21 +171,21 @@ void OutdoorPvPHP::FillInitialWorldStates(WorldPacket& data)
|
||||
void OPvPCapturePointHP::ChangeState()
|
||||
{
|
||||
uint32 field = 0;
|
||||
switch (m_OldState)
|
||||
switch (_oldState)
|
||||
{
|
||||
case OBJECTIVESTATE_NEUTRAL:
|
||||
field = HP_MAP_N[m_TowerType];
|
||||
break;
|
||||
case OBJECTIVESTATE_ALLIANCE:
|
||||
field = HP_MAP_A[m_TowerType];
|
||||
if (uint32 alliance_towers = ((OutdoorPvPHP*)m_PvP)->GetAllianceTowersControlled())
|
||||
((OutdoorPvPHP*)m_PvP)->SetAllianceTowersControlled(--alliance_towers);
|
||||
if (uint32 alliance_towers = ((OutdoorPvPHP*)_pvp)->GetAllianceTowersControlled())
|
||||
((OutdoorPvPHP*)_pvp)->SetAllianceTowersControlled(--alliance_towers);
|
||||
sWorld->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(HP_LANG_LOSE_A[m_TowerType]));
|
||||
break;
|
||||
case OBJECTIVESTATE_HORDE:
|
||||
field = HP_MAP_H[m_TowerType];
|
||||
if (uint32 horde_towers = ((OutdoorPvPHP*)m_PvP)->GetHordeTowersControlled())
|
||||
((OutdoorPvPHP*)m_PvP)->SetHordeTowersControlled(--horde_towers);
|
||||
if (uint32 horde_towers = ((OutdoorPvPHP*)_pvp)->GetHordeTowersControlled())
|
||||
((OutdoorPvPHP*)_pvp)->SetHordeTowersControlled(--horde_towers);
|
||||
sWorld->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(HP_LANG_LOSE_H[m_TowerType]));
|
||||
break;
|
||||
case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE:
|
||||
@@ -205,12 +205,12 @@ void OPvPCapturePointHP::ChangeState()
|
||||
// send world state update
|
||||
if (field)
|
||||
{
|
||||
m_PvP->SendUpdateWorldState(field, 0);
|
||||
_pvp->SendUpdateWorldState(field, 0);
|
||||
field = 0;
|
||||
}
|
||||
uint32 artkit = 21;
|
||||
uint32 artkit2 = HP_TowerArtKit_N[m_TowerType];
|
||||
switch (m_State)
|
||||
switch (_state)
|
||||
{
|
||||
case OBJECTIVESTATE_NEUTRAL:
|
||||
field = HP_MAP_N[m_TowerType];
|
||||
@@ -220,9 +220,9 @@ void OPvPCapturePointHP::ChangeState()
|
||||
field = HP_MAP_A[m_TowerType];
|
||||
artkit = 2;
|
||||
artkit2 = HP_TowerArtKit_A[m_TowerType];
|
||||
uint32 alliance_towers = ((OutdoorPvPHP*)m_PvP)->GetAllianceTowersControlled();
|
||||
uint32 alliance_towers = ((OutdoorPvPHP*)_pvp)->GetAllianceTowersControlled();
|
||||
if (alliance_towers < 3)
|
||||
((OutdoorPvPHP*)m_PvP)->SetAllianceTowersControlled(++alliance_towers);
|
||||
((OutdoorPvPHP*)_pvp)->SetAllianceTowersControlled(++alliance_towers);
|
||||
sWorld->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(HP_LANG_CAPTURE_A[m_TowerType]));
|
||||
break;
|
||||
}
|
||||
@@ -231,9 +231,9 @@ void OPvPCapturePointHP::ChangeState()
|
||||
field = HP_MAP_H[m_TowerType];
|
||||
artkit = 1;
|
||||
artkit2 = HP_TowerArtKit_H[m_TowerType];
|
||||
uint32 horde_towers = ((OutdoorPvPHP*)m_PvP)->GetHordeTowersControlled();
|
||||
uint32 horde_towers = ((OutdoorPvPHP*)_pvp)->GetHordeTowersControlled();
|
||||
if (horde_towers < 3)
|
||||
((OutdoorPvPHP*)m_PvP)->SetHordeTowersControlled(++horde_towers);
|
||||
((OutdoorPvPHP*)_pvp)->SetHordeTowersControlled(++horde_towers);
|
||||
sWorld->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(HP_LANG_CAPTURE_H[m_TowerType]));
|
||||
break;
|
||||
}
|
||||
@@ -250,24 +250,24 @@ void OPvPCapturePointHP::ChangeState()
|
||||
for (auto itr = bounds.first; itr != bounds.second; ++itr)
|
||||
itr->second->SetGoArtKit(artkit);
|
||||
|
||||
bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_Objects[m_TowerType]);
|
||||
bounds = map->GetGameObjectBySpawnIdStore().equal_range(_objects[m_TowerType]);
|
||||
for (auto itr = bounds.first; itr != bounds.second; ++itr)
|
||||
itr->second->SetGoArtKit(artkit2);
|
||||
|
||||
// send world state update
|
||||
if (field)
|
||||
m_PvP->SendUpdateWorldState(field, 1);
|
||||
_pvp->SendUpdateWorldState(field, 1);
|
||||
|
||||
// complete quest objective
|
||||
if (m_State == OBJECTIVESTATE_ALLIANCE || m_State == OBJECTIVESTATE_HORDE)
|
||||
if (_state == OBJECTIVESTATE_ALLIANCE || _state == OBJECTIVESTATE_HORDE)
|
||||
SendObjectiveComplete(HP_CREDITMARKER[m_TowerType]);
|
||||
}
|
||||
|
||||
void OPvPCapturePointHP::SendChangePhase()
|
||||
{
|
||||
SendUpdateWorldState(HP_UI_TOWER_SLIDER_N, m_neutralValuePct);
|
||||
SendUpdateWorldState(HP_UI_TOWER_SLIDER_N, _neutralValuePct);
|
||||
// send these updates to only the ones in this objective
|
||||
uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f);
|
||||
uint32 phase = (uint32)ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f);
|
||||
SendUpdateWorldState(HP_UI_TOWER_SLIDER_POS, phase);
|
||||
// send this too, sometimes the slider disappears, dunno why :(
|
||||
SendUpdateWorldState(HP_UI_TOWER_SLIDER_DISPLAY, 1);
|
||||
@@ -275,7 +275,7 @@ void OPvPCapturePointHP::SendChangePhase()
|
||||
|
||||
void OPvPCapturePointHP::FillInitialWorldStates(WorldPacket& data)
|
||||
{
|
||||
switch (m_State)
|
||||
switch (_state)
|
||||
{
|
||||
case OBJECTIVESTATE_ALLIANCE:
|
||||
case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE:
|
||||
@@ -305,9 +305,9 @@ bool OPvPCapturePointHP::HandlePlayerEnter(Player* player)
|
||||
if (OPvPCapturePoint::HandlePlayerEnter(player))
|
||||
{
|
||||
player->SendUpdateWorldState(HP_UI_TOWER_SLIDER_DISPLAY, 1);
|
||||
uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f);
|
||||
uint32 phase = (uint32)ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f);
|
||||
player->SendUpdateWorldState(HP_UI_TOWER_SLIDER_POS, phase);
|
||||
player->SendUpdateWorldState(HP_UI_TOWER_SLIDER_N, m_neutralValuePct);
|
||||
player->SendUpdateWorldState(HP_UI_TOWER_SLIDER_N, _neutralValuePct);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
OutdoorPvPNA::OutdoorPvPNA()
|
||||
{
|
||||
m_TypeId = OUTDOOR_PVP_NA;
|
||||
_typeId = OUTDOOR_PVP_NA;
|
||||
m_obj = nullptr;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ void OutdoorPvPNA::HandleKillImpl(Player* player, Unit* killed)
|
||||
uint32 OPvPCapturePointNA::GetAliveGuardsCount()
|
||||
{
|
||||
uint32 cnt = 0;
|
||||
for (std::map<uint32, ObjectGuid::LowType>::iterator itr = m_Creatures.begin(); itr != m_Creatures.end(); ++itr)
|
||||
for (auto itr = _creatures.begin(); itr != _creatures.end(); ++itr)
|
||||
{
|
||||
switch (itr->first)
|
||||
{
|
||||
@@ -64,7 +64,7 @@ uint32 OPvPCapturePointNA::GetAliveGuardsCount()
|
||||
case NA_NPC_GUARD_14:
|
||||
case NA_NPC_GUARD_15:
|
||||
{
|
||||
auto bounds = m_PvP->GetMap()->GetCreatureBySpawnIdStore().equal_range(itr->second);
|
||||
auto bounds = _pvp->GetMap()->GetCreatureBySpawnIdStore().equal_range(itr->second);
|
||||
for (auto itr2 = bounds.first; itr2 != bounds.second; ++itr2)
|
||||
if (itr2->second->IsAlive())
|
||||
++cnt;
|
||||
@@ -158,10 +158,10 @@ void OPvPCapturePointNA::FactionTakeOver(TeamId teamId)
|
||||
m_WyvernStateNorth = WYVERN_NEU_HORDE;
|
||||
m_WyvernStateEast = WYVERN_NEU_HORDE;
|
||||
m_WyvernStateWest = WYVERN_NEU_HORDE;
|
||||
m_PvP->TeamApplyBuff(TEAM_ALLIANCE, NA_CAPTURE_BUFF);
|
||||
m_PvP->SendUpdateWorldState(NA_UI_HORDE_GUARDS_SHOW, 0);
|
||||
m_PvP->SendUpdateWorldState(NA_UI_ALLIANCE_GUARDS_SHOW, 1);
|
||||
m_PvP->SendUpdateWorldState(NA_UI_GUARDS_LEFT, m_GuardsAlive);
|
||||
_pvp->TeamApplyBuff(TEAM_ALLIANCE, NA_CAPTURE_BUFF);
|
||||
_pvp->SendUpdateWorldState(NA_UI_HORDE_GUARDS_SHOW, 0);
|
||||
_pvp->SendUpdateWorldState(NA_UI_ALLIANCE_GUARDS_SHOW, 1);
|
||||
_pvp->SendUpdateWorldState(NA_UI_GUARDS_LEFT, m_GuardsAlive);
|
||||
sWorld->SendZoneText(NA_HALAA_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_NA_CAPTURE_A));
|
||||
}
|
||||
else
|
||||
@@ -170,10 +170,10 @@ void OPvPCapturePointNA::FactionTakeOver(TeamId teamId)
|
||||
m_WyvernStateNorth = WYVERN_NEU_ALLIANCE;
|
||||
m_WyvernStateEast = WYVERN_NEU_ALLIANCE;
|
||||
m_WyvernStateWest = WYVERN_NEU_ALLIANCE;
|
||||
m_PvP->TeamApplyBuff(TEAM_HORDE, NA_CAPTURE_BUFF);
|
||||
m_PvP->SendUpdateWorldState(NA_UI_HORDE_GUARDS_SHOW, 1);
|
||||
m_PvP->SendUpdateWorldState(NA_UI_ALLIANCE_GUARDS_SHOW, 0);
|
||||
m_PvP->SendUpdateWorldState(NA_UI_GUARDS_LEFT, m_GuardsAlive);
|
||||
_pvp->TeamApplyBuff(TEAM_HORDE, NA_CAPTURE_BUFF);
|
||||
_pvp->SendUpdateWorldState(NA_UI_HORDE_GUARDS_SHOW, 1);
|
||||
_pvp->SendUpdateWorldState(NA_UI_ALLIANCE_GUARDS_SHOW, 0);
|
||||
_pvp->SendUpdateWorldState(NA_UI_GUARDS_LEFT, m_GuardsAlive);
|
||||
sWorld->SendZoneText(NA_HALAA_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_NA_CAPTURE_H));
|
||||
}
|
||||
UpdateWyvernRoostWorldState(NA_ROOST_S);
|
||||
@@ -187,9 +187,9 @@ bool OPvPCapturePointNA::HandlePlayerEnter(Player* player)
|
||||
if (OPvPCapturePoint::HandlePlayerEnter(player))
|
||||
{
|
||||
player->SendUpdateWorldState(NA_UI_TOWER_SLIDER_DISPLAY, 1);
|
||||
uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f);
|
||||
uint32 phase = (uint32)ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f);
|
||||
player->SendUpdateWorldState(NA_UI_TOWER_SLIDER_POS, phase);
|
||||
player->SendUpdateWorldState(NA_UI_TOWER_SLIDER_N, m_neutralValuePct);
|
||||
player->SendUpdateWorldState(NA_UI_TOWER_SLIDER_N, _neutralValuePct);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -211,7 +211,7 @@ OPvPCapturePointNA::OPvPCapturePointNA(OutdoorPvP* pvp) :
|
||||
|
||||
bool OutdoorPvPNA::SetupOutdoorPvP()
|
||||
{
|
||||
// m_TypeId = OUTDOOR_PVP_NA; _MUST_ be set in ctor, because of spawns cleanup
|
||||
// _typeId = OUTDOOR_PVP_NA; _MUST_ be set in ctor, because of spawns cleanup
|
||||
// add the zones affected by the pvp buff
|
||||
RegisterZone(NA_BUFF_ZONE);
|
||||
SetMapFromZone(NA_BUFF_ZONE);
|
||||
@@ -535,9 +535,9 @@ bool OPvPCapturePointNA::Update(uint32 diff)
|
||||
{
|
||||
// let the controlling faction advance in phase
|
||||
bool capturable = false;
|
||||
if (m_ControllingFaction == TEAM_ALLIANCE && m_activePlayers[0].size() > m_activePlayers[1].size())
|
||||
if (m_ControllingFaction == TEAM_ALLIANCE && _activePlayers[0].size() > _activePlayers[1].size())
|
||||
capturable = true;
|
||||
else if (m_ControllingFaction == TEAM_HORDE && m_activePlayers[0].size() < m_activePlayers[1].size())
|
||||
else if (m_ControllingFaction == TEAM_HORDE && _activePlayers[0].size() < _activePlayers[1].size())
|
||||
capturable = true;
|
||||
|
||||
if (m_GuardCheckTimer < diff)
|
||||
@@ -550,7 +550,7 @@ bool OPvPCapturePointNA::Update(uint32 diff)
|
||||
if (m_GuardsAlive == 0)
|
||||
m_capturable = true;
|
||||
// update the guard count for the players in zone
|
||||
m_PvP->SendUpdateWorldState(NA_UI_GUARDS_LEFT, m_GuardsAlive);
|
||||
_pvp->SendUpdateWorldState(NA_UI_GUARDS_LEFT, m_GuardsAlive);
|
||||
}
|
||||
}
|
||||
else m_GuardCheckTimer -= diff;
|
||||
@@ -573,7 +573,7 @@ bool OPvPCapturePointNA::Update(uint32 diff)
|
||||
void OPvPCapturePointNA::ChangeState()
|
||||
{
|
||||
uint32 artkit = 21;
|
||||
switch (m_State)
|
||||
switch (_state)
|
||||
{
|
||||
case OBJECTIVESTATE_NEUTRAL:
|
||||
m_HalaaState = HALAA_N;
|
||||
@@ -616,18 +616,18 @@ void OPvPCapturePointNA::SendChangePhase()
|
||||
// send this too, sometimes the slider disappears, dunno why :(
|
||||
SendUpdateWorldState(NA_UI_TOWER_SLIDER_DISPLAY, 1);
|
||||
// send these updates to only the ones in this objective
|
||||
uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f);
|
||||
uint32 phase = (uint32)ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f);
|
||||
SendUpdateWorldState(NA_UI_TOWER_SLIDER_POS, phase);
|
||||
SendUpdateWorldState(NA_UI_TOWER_SLIDER_N, m_neutralValuePct);
|
||||
SendUpdateWorldState(NA_UI_TOWER_SLIDER_N, _neutralValuePct);
|
||||
}
|
||||
|
||||
void OPvPCapturePointNA::UpdateHalaaWorldState()
|
||||
{
|
||||
m_PvP->SendUpdateWorldState(NA_MAP_HALAA_NEUTRAL, uint32(bool(m_HalaaState & HALAA_N)));
|
||||
m_PvP->SendUpdateWorldState(NA_MAP_HALAA_NEU_A, uint32(bool(m_HalaaState & HALAA_N_A)));
|
||||
m_PvP->SendUpdateWorldState(NA_MAP_HALAA_NEU_H, uint32(bool(m_HalaaState & HALAA_N_H)));
|
||||
m_PvP->SendUpdateWorldState(NA_MAP_HALAA_HORDE, uint32(bool(m_HalaaState & HALAA_H)));
|
||||
m_PvP->SendUpdateWorldState(NA_MAP_HALAA_ALLIANCE, uint32(bool(m_HalaaState & HALAA_A)));
|
||||
_pvp->SendUpdateWorldState(NA_MAP_HALAA_NEUTRAL, uint32(bool(m_HalaaState & HALAA_N)));
|
||||
_pvp->SendUpdateWorldState(NA_MAP_HALAA_NEU_A, uint32(bool(m_HalaaState & HALAA_N_A)));
|
||||
_pvp->SendUpdateWorldState(NA_MAP_HALAA_NEU_H, uint32(bool(m_HalaaState & HALAA_N_H)));
|
||||
_pvp->SendUpdateWorldState(NA_MAP_HALAA_HORDE, uint32(bool(m_HalaaState & HALAA_H)));
|
||||
_pvp->SendUpdateWorldState(NA_MAP_HALAA_ALLIANCE, uint32(bool(m_HalaaState & HALAA_A)));
|
||||
}
|
||||
|
||||
void OPvPCapturePointNA::UpdateWyvernRoostWorldState(uint32 roost)
|
||||
@@ -635,28 +635,28 @@ void OPvPCapturePointNA::UpdateWyvernRoostWorldState(uint32 roost)
|
||||
switch (roost)
|
||||
{
|
||||
case NA_ROOST_S:
|
||||
m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_SOUTH_NEU_H, uint32(bool(m_WyvernStateSouth & WYVERN_NEU_HORDE)));
|
||||
m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_SOUTH_NEU_A, uint32(bool(m_WyvernStateSouth & WYVERN_NEU_ALLIANCE)));
|
||||
m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_SOUTH_H, uint32(bool(m_WyvernStateSouth & WYVERN_HORDE)));
|
||||
m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_SOUTH_A, uint32(bool(m_WyvernStateSouth & WYVERN_ALLIANCE)));
|
||||
_pvp->SendUpdateWorldState(NA_MAP_WYVERN_SOUTH_NEU_H, uint32(bool(m_WyvernStateSouth & WYVERN_NEU_HORDE)));
|
||||
_pvp->SendUpdateWorldState(NA_MAP_WYVERN_SOUTH_NEU_A, uint32(bool(m_WyvernStateSouth & WYVERN_NEU_ALLIANCE)));
|
||||
_pvp->SendUpdateWorldState(NA_MAP_WYVERN_SOUTH_H, uint32(bool(m_WyvernStateSouth & WYVERN_HORDE)));
|
||||
_pvp->SendUpdateWorldState(NA_MAP_WYVERN_SOUTH_A, uint32(bool(m_WyvernStateSouth & WYVERN_ALLIANCE)));
|
||||
break;
|
||||
case NA_ROOST_N:
|
||||
m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_NORTH_NEU_H, uint32(bool(m_WyvernStateNorth & WYVERN_NEU_HORDE)));
|
||||
m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_NORTH_NEU_A, uint32(bool(m_WyvernStateNorth & WYVERN_NEU_ALLIANCE)));
|
||||
m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_NORTH_H, uint32(bool(m_WyvernStateNorth & WYVERN_HORDE)));
|
||||
m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_NORTH_A, uint32(bool(m_WyvernStateNorth & WYVERN_ALLIANCE)));
|
||||
_pvp->SendUpdateWorldState(NA_MAP_WYVERN_NORTH_NEU_H, uint32(bool(m_WyvernStateNorth & WYVERN_NEU_HORDE)));
|
||||
_pvp->SendUpdateWorldState(NA_MAP_WYVERN_NORTH_NEU_A, uint32(bool(m_WyvernStateNorth & WYVERN_NEU_ALLIANCE)));
|
||||
_pvp->SendUpdateWorldState(NA_MAP_WYVERN_NORTH_H, uint32(bool(m_WyvernStateNorth & WYVERN_HORDE)));
|
||||
_pvp->SendUpdateWorldState(NA_MAP_WYVERN_NORTH_A, uint32(bool(m_WyvernStateNorth & WYVERN_ALLIANCE)));
|
||||
break;
|
||||
case NA_ROOST_W:
|
||||
m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_WEST_NEU_H, uint32(bool(m_WyvernStateWest & WYVERN_NEU_HORDE)));
|
||||
m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_WEST_NEU_A, uint32(bool(m_WyvernStateWest & WYVERN_NEU_ALLIANCE)));
|
||||
m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_WEST_H, uint32(bool(m_WyvernStateWest & WYVERN_HORDE)));
|
||||
m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_WEST_A, uint32(bool(m_WyvernStateWest & WYVERN_ALLIANCE)));
|
||||
_pvp->SendUpdateWorldState(NA_MAP_WYVERN_WEST_NEU_H, uint32(bool(m_WyvernStateWest & WYVERN_NEU_HORDE)));
|
||||
_pvp->SendUpdateWorldState(NA_MAP_WYVERN_WEST_NEU_A, uint32(bool(m_WyvernStateWest & WYVERN_NEU_ALLIANCE)));
|
||||
_pvp->SendUpdateWorldState(NA_MAP_WYVERN_WEST_H, uint32(bool(m_WyvernStateWest & WYVERN_HORDE)));
|
||||
_pvp->SendUpdateWorldState(NA_MAP_WYVERN_WEST_A, uint32(bool(m_WyvernStateWest & WYVERN_ALLIANCE)));
|
||||
break;
|
||||
case NA_ROOST_E:
|
||||
m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_EAST_NEU_H, uint32(bool(m_WyvernStateEast & WYVERN_NEU_HORDE)));
|
||||
m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_EAST_NEU_A, uint32(bool(m_WyvernStateEast & WYVERN_NEU_ALLIANCE)));
|
||||
m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_EAST_H, uint32(bool(m_WyvernStateEast & WYVERN_HORDE)));
|
||||
m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_EAST_A, uint32(bool(m_WyvernStateEast & WYVERN_ALLIANCE)));
|
||||
_pvp->SendUpdateWorldState(NA_MAP_WYVERN_EAST_NEU_H, uint32(bool(m_WyvernStateEast & WYVERN_NEU_HORDE)));
|
||||
_pvp->SendUpdateWorldState(NA_MAP_WYVERN_EAST_NEU_A, uint32(bool(m_WyvernStateEast & WYVERN_NEU_ALLIANCE)));
|
||||
_pvp->SendUpdateWorldState(NA_MAP_WYVERN_EAST_H, uint32(bool(m_WyvernStateEast & WYVERN_HORDE)));
|
||||
_pvp->SendUpdateWorldState(NA_MAP_WYVERN_EAST_A, uint32(bool(m_WyvernStateEast & WYVERN_ALLIANCE)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
OutdoorPvPSI::OutdoorPvPSI()
|
||||
{
|
||||
m_TypeId = OUTDOOR_PVP_SI;
|
||||
_typeId = OUTDOOR_PVP_SI;
|
||||
m_Gathered_A = 0;
|
||||
m_Gathered_H = 0;
|
||||
m_LastController = TEAM_NEUTRAL;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
OutdoorPvPTF::OutdoorPvPTF()
|
||||
{
|
||||
m_TypeId = OUTDOOR_PVP_TF;
|
||||
_typeId = OUTDOOR_PVP_TF;
|
||||
|
||||
m_IsLocked = false;
|
||||
m_JustLocked = false;
|
||||
@@ -74,7 +74,7 @@ void OutdoorPvPTF::FillInitialWorldStates(WorldPacket& data)
|
||||
data << TF_UI_LOCKED_DISPLAY_HORDE << uint32(m_IsLocked && (m_HordeTowersControlled > m_AllianceTowersControlled));
|
||||
data << TF_UI_LOCKED_DISPLAY_ALLIANCE << uint32(m_IsLocked && (m_HordeTowersControlled < m_AllianceTowersControlled));
|
||||
|
||||
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
for (OPvPCapturePointMap::iterator itr = _capturePoints.begin(); itr != _capturePoints.end(); ++itr)
|
||||
{
|
||||
itr->second->FillInitialWorldStates(data);
|
||||
}
|
||||
@@ -136,7 +136,7 @@ void OutdoorPvPTF::ResetZoneToTeamControlled(TeamId team)
|
||||
break;
|
||||
}
|
||||
|
||||
for (auto& [guid, tower] : m_capturePoints)
|
||||
for (auto& [guid, tower] : _capturePoints)
|
||||
{
|
||||
dynamic_cast<OPvPCapturePointTF*>(tower)->ResetToTeamControlled(team);
|
||||
}
|
||||
@@ -150,32 +150,32 @@ void OPvPCapturePointTF::ResetToTeamControlled(TeamId team)
|
||||
switch (team)
|
||||
{
|
||||
case TEAM_HORDE:
|
||||
m_State = OBJECTIVESTATE_HORDE;
|
||||
m_OldState = OBJECTIVESTATE_HORDE;
|
||||
m_team = TEAM_HORDE;
|
||||
_state = OBJECTIVESTATE_HORDE;
|
||||
_oldState = OBJECTIVESTATE_HORDE;
|
||||
_team = TEAM_HORDE;
|
||||
break;
|
||||
case TEAM_ALLIANCE:
|
||||
m_State = OBJECTIVESTATE_ALLIANCE;
|
||||
m_OldState = OBJECTIVESTATE_ALLIANCE;
|
||||
m_team = TEAM_ALLIANCE;
|
||||
_state = OBJECTIVESTATE_ALLIANCE;
|
||||
_oldState = OBJECTIVESTATE_ALLIANCE;
|
||||
_team = TEAM_ALLIANCE;
|
||||
break;
|
||||
case TEAM_NEUTRAL:
|
||||
m_State = OBJECTIVESTATE_NEUTRAL;
|
||||
m_OldState = OBJECTIVESTATE_NEUTRAL;
|
||||
m_team = TEAM_NEUTRAL;
|
||||
_state = OBJECTIVESTATE_NEUTRAL;
|
||||
_oldState = OBJECTIVESTATE_NEUTRAL;
|
||||
_team = TEAM_NEUTRAL;
|
||||
break;
|
||||
}
|
||||
|
||||
m_value = 0.0f;
|
||||
_value = 0.0f;
|
||||
ChangeState();
|
||||
SendChangePhase();
|
||||
}
|
||||
|
||||
void OPvPCapturePointTF::UpdateTowerState()
|
||||
{
|
||||
m_PvP->SendUpdateWorldState(uint32(TFTowerWorldStates[m_TowerType].n), uint32(bool(m_TowerState & TF_TOWERSTATE_N)));
|
||||
m_PvP->SendUpdateWorldState(uint32(TFTowerWorldStates[m_TowerType].h), uint32(bool(m_TowerState & TF_TOWERSTATE_H)));
|
||||
m_PvP->SendUpdateWorldState(uint32(TFTowerWorldStates[m_TowerType].a), uint32(bool(m_TowerState & TF_TOWERSTATE_A)));
|
||||
_pvp->SendUpdateWorldState(uint32(TFTowerWorldStates[m_TowerType].n), uint32(bool(m_TowerState & TF_TOWERSTATE_N)));
|
||||
_pvp->SendUpdateWorldState(uint32(TFTowerWorldStates[m_TowerType].h), uint32(bool(m_TowerState & TF_TOWERSTATE_H)));
|
||||
_pvp->SendUpdateWorldState(uint32(TFTowerWorldStates[m_TowerType].a), uint32(bool(m_TowerState & TF_TOWERSTATE_A)));
|
||||
}
|
||||
|
||||
bool OPvPCapturePointTF::HandlePlayerEnter(Player* player)
|
||||
@@ -183,9 +183,9 @@ bool OPvPCapturePointTF::HandlePlayerEnter(Player* player)
|
||||
if (OPvPCapturePoint::HandlePlayerEnter(player))
|
||||
{
|
||||
player->SendUpdateWorldState(TF_UI_TOWER_SLIDER_DISPLAY, 1);
|
||||
uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f);
|
||||
uint32 phase = (uint32)ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f);
|
||||
player->SendUpdateWorldState(TF_UI_TOWER_SLIDER_POS, phase);
|
||||
player->SendUpdateWorldState(TF_UI_TOWER_SLIDER_N, m_neutralValuePct);
|
||||
player->SendUpdateWorldState(TF_UI_TOWER_SLIDER_N, _neutralValuePct);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -382,45 +382,45 @@ bool OutdoorPvPTF::SetupOutdoorPvP()
|
||||
bool OPvPCapturePointTF::Update(uint32 diff)
|
||||
{
|
||||
// can update even in locked state if gathers the controlling faction
|
||||
bool canupdate = ((((OutdoorPvPTF*)m_PvP)->GetAllianceTowersControlled() > 0) && m_activePlayers[0].size() > m_activePlayers[1].size()) ||
|
||||
((((OutdoorPvPTF*)m_PvP)->GetHordeTowersControlled() > 0) && m_activePlayers[0].size() < m_activePlayers[1].size());
|
||||
bool canupdate = ((((OutdoorPvPTF*)_pvp)->GetAllianceTowersControlled() > 0) && _activePlayers[0].size() > _activePlayers[1].size()) ||
|
||||
((((OutdoorPvPTF*)_pvp)->GetHordeTowersControlled() > 0) && _activePlayers[0].size() < _activePlayers[1].size());
|
||||
// if gathers the other faction, then only update if the pvp is unlocked
|
||||
canupdate = canupdate || !((OutdoorPvPTF*)m_PvP)->IsLocked();
|
||||
canupdate = canupdate || !((OutdoorPvPTF*)_pvp)->IsLocked();
|
||||
return canupdate && OPvPCapturePoint::Update(diff);
|
||||
}
|
||||
|
||||
void OPvPCapturePointTF::ChangeState()
|
||||
{
|
||||
// if changing from controlling alliance to horde
|
||||
if (m_OldState == OBJECTIVESTATE_ALLIANCE)
|
||||
if (_oldState == OBJECTIVESTATE_ALLIANCE)
|
||||
{
|
||||
if (uint32 alliance_towers = ((OutdoorPvPTF*)m_PvP)->GetAllianceTowersControlled())
|
||||
((OutdoorPvPTF*)m_PvP)->SetAllianceTowersControlled(--alliance_towers);
|
||||
if (uint32 alliance_towers = ((OutdoorPvPTF*)_pvp)->GetAllianceTowersControlled())
|
||||
((OutdoorPvPTF*)_pvp)->SetAllianceTowersControlled(--alliance_towers);
|
||||
sWorld->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_TF_LOSE_A));
|
||||
}
|
||||
// if changing from controlling horde to alliance
|
||||
else if (m_OldState == OBJECTIVESTATE_HORDE)
|
||||
else if (_oldState == OBJECTIVESTATE_HORDE)
|
||||
{
|
||||
if (uint32 horde_towers = ((OutdoorPvPTF*)m_PvP)->GetHordeTowersControlled())
|
||||
((OutdoorPvPTF*)m_PvP)->SetHordeTowersControlled(--horde_towers);
|
||||
if (uint32 horde_towers = ((OutdoorPvPTF*)_pvp)->GetHordeTowersControlled())
|
||||
((OutdoorPvPTF*)_pvp)->SetHordeTowersControlled(--horde_towers);
|
||||
sWorld->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_TF_LOSE_H));
|
||||
}
|
||||
|
||||
uint32 artkit = 21;
|
||||
|
||||
switch (m_State)
|
||||
switch (_state)
|
||||
{
|
||||
case OBJECTIVESTATE_ALLIANCE:
|
||||
{
|
||||
m_TowerState = TF_TOWERSTATE_A;
|
||||
artkit = 2;
|
||||
uint32 alliance_towers = ((OutdoorPvPTF*)m_PvP)->GetAllianceTowersControlled();
|
||||
uint32 alliance_towers = ((OutdoorPvPTF*)_pvp)->GetAllianceTowersControlled();
|
||||
if (alliance_towers < TF_TOWER_NUM)
|
||||
((OutdoorPvPTF*)m_PvP)->SetAllianceTowersControlled(++alliance_towers);
|
||||
((OutdoorPvPTF*)_pvp)->SetAllianceTowersControlled(++alliance_towers);
|
||||
|
||||
sWorld->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_TF_CAPTURE_A));
|
||||
|
||||
for (PlayerSet::iterator itr = m_activePlayers[0].begin(); itr != m_activePlayers[0].end(); ++itr)
|
||||
for (PlayerSet::iterator itr = _activePlayers[0].begin(); itr != _activePlayers[0].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->AreaExploredOrEventHappens(TF_ALLY_QUEST);
|
||||
break;
|
||||
@@ -429,13 +429,13 @@ void OPvPCapturePointTF::ChangeState()
|
||||
{
|
||||
m_TowerState = TF_TOWERSTATE_H;
|
||||
artkit = 1;
|
||||
uint32 horde_towers = ((OutdoorPvPTF*)m_PvP)->GetHordeTowersControlled();
|
||||
uint32 horde_towers = ((OutdoorPvPTF*)_pvp)->GetHordeTowersControlled();
|
||||
if (horde_towers < TF_TOWER_NUM)
|
||||
((OutdoorPvPTF*)m_PvP)->SetHordeTowersControlled(++horde_towers);
|
||||
((OutdoorPvPTF*)_pvp)->SetHordeTowersControlled(++horde_towers);
|
||||
|
||||
sWorld->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_TF_CAPTURE_H));
|
||||
|
||||
for (PlayerSet::iterator itr = m_activePlayers[1].begin(); itr != m_activePlayers[1].end(); ++itr)
|
||||
for (PlayerSet::iterator itr = _activePlayers[1].begin(); itr != _activePlayers[1].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->AreaExploredOrEventHappens(TF_HORDE_QUEST);
|
||||
break;
|
||||
@@ -461,10 +461,10 @@ void OPvPCapturePointTF::SendChangePhase()
|
||||
// send this too, sometimes the slider disappears, dunno why :(
|
||||
SendUpdateWorldState(TF_UI_TOWER_SLIDER_DISPLAY, 1);
|
||||
// send these updates to only the ones in this objective
|
||||
uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f);
|
||||
uint32 phase = (uint32)ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f);
|
||||
SendUpdateWorldState(TF_UI_TOWER_SLIDER_POS, phase);
|
||||
// send this too, sometimes it resets :S
|
||||
SendUpdateWorldState(TF_UI_TOWER_SLIDER_N, m_neutralValuePct);
|
||||
SendUpdateWorldState(TF_UI_TOWER_SLIDER_N, _neutralValuePct);
|
||||
}
|
||||
|
||||
class OutdoorPvP_terokkar_forest : public OutdoorPvPScript
|
||||
|
||||
@@ -44,12 +44,12 @@ void OPvPCapturePointZM_Beacon::FillInitialWorldStates(WorldPacket& data)
|
||||
|
||||
void OPvPCapturePointZM_Beacon::UpdateTowerState()
|
||||
{
|
||||
m_PvP->SendUpdateWorldState(uint32(ZMBeaconInfo[m_TowerType].ui_tower_n), uint32(bool(m_TowerState & ZM_TOWERSTATE_N)));
|
||||
m_PvP->SendUpdateWorldState(uint32(ZMBeaconInfo[m_TowerType].map_tower_n), uint32(bool(m_TowerState & ZM_TOWERSTATE_N)));
|
||||
m_PvP->SendUpdateWorldState(uint32(ZMBeaconInfo[m_TowerType].ui_tower_a), uint32(bool(m_TowerState & ZM_TOWERSTATE_A)));
|
||||
m_PvP->SendUpdateWorldState(uint32(ZMBeaconInfo[m_TowerType].map_tower_a), uint32(bool(m_TowerState & ZM_TOWERSTATE_A)));
|
||||
m_PvP->SendUpdateWorldState(uint32(ZMBeaconInfo[m_TowerType].ui_tower_h), uint32(bool(m_TowerState & ZM_TOWERSTATE_H)));
|
||||
m_PvP->SendUpdateWorldState(uint32(ZMBeaconInfo[m_TowerType].map_tower_h), uint32(bool(m_TowerState & ZM_TOWERSTATE_H)));
|
||||
_pvp->SendUpdateWorldState(uint32(ZMBeaconInfo[m_TowerType].ui_tower_n), uint32(bool(m_TowerState & ZM_TOWERSTATE_N)));
|
||||
_pvp->SendUpdateWorldState(uint32(ZMBeaconInfo[m_TowerType].map_tower_n), uint32(bool(m_TowerState & ZM_TOWERSTATE_N)));
|
||||
_pvp->SendUpdateWorldState(uint32(ZMBeaconInfo[m_TowerType].ui_tower_a), uint32(bool(m_TowerState & ZM_TOWERSTATE_A)));
|
||||
_pvp->SendUpdateWorldState(uint32(ZMBeaconInfo[m_TowerType].map_tower_a), uint32(bool(m_TowerState & ZM_TOWERSTATE_A)));
|
||||
_pvp->SendUpdateWorldState(uint32(ZMBeaconInfo[m_TowerType].ui_tower_h), uint32(bool(m_TowerState & ZM_TOWERSTATE_H)));
|
||||
_pvp->SendUpdateWorldState(uint32(ZMBeaconInfo[m_TowerType].map_tower_h), uint32(bool(m_TowerState & ZM_TOWERSTATE_H)));
|
||||
}
|
||||
|
||||
bool OPvPCapturePointZM_Beacon::HandlePlayerEnter(Player* player)
|
||||
@@ -57,9 +57,9 @@ bool OPvPCapturePointZM_Beacon::HandlePlayerEnter(Player* player)
|
||||
if (OPvPCapturePoint::HandlePlayerEnter(player))
|
||||
{
|
||||
player->SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_disp, 1);
|
||||
uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f);
|
||||
uint32 phase = (uint32)ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f);
|
||||
player->SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_pos, phase);
|
||||
player->SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_n, m_neutralValuePct);
|
||||
player->SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_n, _neutralValuePct);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -74,37 +74,37 @@ void OPvPCapturePointZM_Beacon::HandlePlayerLeave(Player* player)
|
||||
void OPvPCapturePointZM_Beacon::ChangeState()
|
||||
{
|
||||
// if changing from controlling alliance to horde
|
||||
if (m_OldState == OBJECTIVESTATE_ALLIANCE)
|
||||
if (_oldState == OBJECTIVESTATE_ALLIANCE)
|
||||
{
|
||||
if (uint32 alliance_towers = ((OutdoorPvPZM*)m_PvP)->GetAllianceTowersControlled())
|
||||
((OutdoorPvPZM*)m_PvP)->SetAllianceTowersControlled(--alliance_towers);
|
||||
if (uint32 alliance_towers = ((OutdoorPvPZM*)_pvp)->GetAllianceTowersControlled())
|
||||
((OutdoorPvPZM*)_pvp)->SetAllianceTowersControlled(--alliance_towers);
|
||||
sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(ZMBeaconLoseA[m_TowerType]));
|
||||
}
|
||||
// if changing from controlling horde to alliance
|
||||
else if (m_OldState == OBJECTIVESTATE_HORDE)
|
||||
else if (_oldState == OBJECTIVESTATE_HORDE)
|
||||
{
|
||||
if (uint32 horde_towers = ((OutdoorPvPZM*)m_PvP)->GetHordeTowersControlled())
|
||||
((OutdoorPvPZM*)m_PvP)->SetHordeTowersControlled(--horde_towers);
|
||||
if (uint32 horde_towers = ((OutdoorPvPZM*)_pvp)->GetHordeTowersControlled())
|
||||
((OutdoorPvPZM*)_pvp)->SetHordeTowersControlled(--horde_towers);
|
||||
sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(ZMBeaconLoseH[m_TowerType]));
|
||||
}
|
||||
|
||||
switch (m_State)
|
||||
switch (_state)
|
||||
{
|
||||
case OBJECTIVESTATE_ALLIANCE:
|
||||
{
|
||||
m_TowerState = ZM_TOWERSTATE_A;
|
||||
uint32 alliance_towers = ((OutdoorPvPZM*)m_PvP)->GetAllianceTowersControlled();
|
||||
uint32 alliance_towers = ((OutdoorPvPZM*)_pvp)->GetAllianceTowersControlled();
|
||||
if (alliance_towers < ZM_NUM_BEACONS)
|
||||
((OutdoorPvPZM*)m_PvP)->SetAllianceTowersControlled(++alliance_towers);
|
||||
((OutdoorPvPZM*)_pvp)->SetAllianceTowersControlled(++alliance_towers);
|
||||
sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(ZMBeaconCaptureA[m_TowerType]));
|
||||
break;
|
||||
}
|
||||
case OBJECTIVESTATE_HORDE:
|
||||
{
|
||||
m_TowerState = ZM_TOWERSTATE_H;
|
||||
uint32 horde_towers = ((OutdoorPvPZM*)m_PvP)->GetHordeTowersControlled();
|
||||
uint32 horde_towers = ((OutdoorPvPZM*)_pvp)->GetHordeTowersControlled();
|
||||
if (horde_towers < ZM_NUM_BEACONS)
|
||||
((OutdoorPvPZM*)m_PvP)->SetHordeTowersControlled(++horde_towers);
|
||||
((OutdoorPvPZM*)_pvp)->SetHordeTowersControlled(++horde_towers);
|
||||
sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(ZMBeaconCaptureH[m_TowerType]));
|
||||
break;
|
||||
}
|
||||
@@ -125,9 +125,9 @@ void OPvPCapturePointZM_Beacon::SendChangePhase()
|
||||
// send this too, sometimes the slider disappears, dunno why :(
|
||||
SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_disp, 1);
|
||||
// send these updates to only the ones in this objective
|
||||
uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f);
|
||||
uint32 phase = (uint32)ceil((_value + _maxValue) / (2 * _maxValue) * 100.0f);
|
||||
SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_pos, phase);
|
||||
SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_n, m_neutralValuePct);
|
||||
SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_n, _neutralValuePct);
|
||||
}
|
||||
|
||||
bool OutdoorPvPZM::Update(uint32 diff)
|
||||
@@ -172,7 +172,7 @@ void OutdoorPvPZM::HandlePlayerLeaveZone(Player* player, uint32 zone)
|
||||
|
||||
OutdoorPvPZM::OutdoorPvPZM()
|
||||
{
|
||||
m_TypeId = OUTDOOR_PVP_ZM;
|
||||
_typeId = OUTDOOR_PVP_ZM;
|
||||
m_GraveYard = nullptr;
|
||||
m_AllianceTowersControlled = 0;
|
||||
m_HordeTowersControlled = 0;
|
||||
@@ -210,8 +210,8 @@ void OutdoorPvPZM::HandleKillImpl(Player* player, Unit* killed)
|
||||
|
||||
bool OPvPCapturePointZM_GraveYard::Update(uint32 /*diff*/)
|
||||
{
|
||||
bool retval = m_State != m_OldState;
|
||||
m_State = m_OldState;
|
||||
bool retval = _state != _oldState;
|
||||
_state = _oldState;
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ int32 OPvPCapturePointZM_GraveYard::HandleOpenGo(Player* player, GameObject* go)
|
||||
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);
|
||||
sGraveyard->RemoveGraveyardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, TEAM_HORDE); // rem gy
|
||||
sGraveyard->AddGraveyardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, TEAM_ALLIANCE, false); // add gy
|
||||
m_PvP->TeamApplyBuff(TEAM_ALLIANCE, ZM_CAPTURE_BUFF, 0, player);
|
||||
_pvp->TeamApplyBuff(TEAM_ALLIANCE, ZM_CAPTURE_BUFF, 0, player);
|
||||
player->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_A);
|
||||
sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_ZM_CAPTURE_GY_A));
|
||||
}
|
||||
@@ -242,7 +242,7 @@ int32 OPvPCapturePointZM_GraveYard::HandleOpenGo(Player* player, GameObject* go)
|
||||
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);
|
||||
sGraveyard->RemoveGraveyardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, TEAM_ALLIANCE); // rem gy
|
||||
sGraveyard->AddGraveyardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, TEAM_HORDE, false); // add gy
|
||||
m_PvP->TeamApplyBuff(TEAM_HORDE, ZM_CAPTURE_BUFF, 0, player);
|
||||
_pvp->TeamApplyBuff(TEAM_HORDE, ZM_CAPTURE_BUFF, 0, player);
|
||||
player->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_H);
|
||||
sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_ZM_CAPTURE_GY_H));
|
||||
}
|
||||
@@ -266,14 +266,14 @@ OPvPCapturePointZM_GraveYard::OPvPCapturePointZM_GraveYard(OutdoorPvP* pvp)
|
||||
|
||||
void OPvPCapturePointZM_GraveYard::UpdateTowerState()
|
||||
{
|
||||
m_PvP->SendUpdateWorldState(ZM_MAP_GRAVEYARD_N, uint32(bool(m_GraveYardState & ZM_GRAVEYARD_N)));
|
||||
m_PvP->SendUpdateWorldState(ZM_MAP_GRAVEYARD_H, uint32(bool(m_GraveYardState & ZM_GRAVEYARD_H)));
|
||||
m_PvP->SendUpdateWorldState(ZM_MAP_GRAVEYARD_A, uint32(bool(m_GraveYardState & ZM_GRAVEYARD_A)));
|
||||
_pvp->SendUpdateWorldState(ZM_MAP_GRAVEYARD_N, uint32(bool(m_GraveYardState & ZM_GRAVEYARD_N)));
|
||||
_pvp->SendUpdateWorldState(ZM_MAP_GRAVEYARD_H, uint32(bool(m_GraveYardState & ZM_GRAVEYARD_H)));
|
||||
_pvp->SendUpdateWorldState(ZM_MAP_GRAVEYARD_A, uint32(bool(m_GraveYardState & ZM_GRAVEYARD_A)));
|
||||
|
||||
m_PvP->SendUpdateWorldState(ZM_MAP_ALLIANCE_FLAG_READY, uint32(m_BothControllingFactionId == TEAM_ALLIANCE));
|
||||
m_PvP->SendUpdateWorldState(ZM_MAP_ALLIANCE_FLAG_NOT_READY, uint32(m_BothControllingFactionId != TEAM_ALLIANCE));
|
||||
m_PvP->SendUpdateWorldState(ZM_MAP_HORDE_FLAG_READY, uint32(m_BothControllingFactionId == TEAM_HORDE));
|
||||
m_PvP->SendUpdateWorldState(ZM_MAP_HORDE_FLAG_NOT_READY, uint32(m_BothControllingFactionId != TEAM_HORDE));
|
||||
_pvp->SendUpdateWorldState(ZM_MAP_ALLIANCE_FLAG_READY, uint32(m_BothControllingFactionId == TEAM_ALLIANCE));
|
||||
_pvp->SendUpdateWorldState(ZM_MAP_ALLIANCE_FLAG_NOT_READY, uint32(m_BothControllingFactionId != TEAM_ALLIANCE));
|
||||
_pvp->SendUpdateWorldState(ZM_MAP_HORDE_FLAG_READY, uint32(m_BothControllingFactionId == TEAM_HORDE));
|
||||
_pvp->SendUpdateWorldState(ZM_MAP_HORDE_FLAG_NOT_READY, uint32(m_BothControllingFactionId != TEAM_HORDE));
|
||||
}
|
||||
|
||||
void OPvPCapturePointZM_GraveYard::FillInitialWorldStates(WorldPacket& data)
|
||||
@@ -336,8 +336,8 @@ void OPvPCapturePointZM_GraveYard::SetBeaconState(TeamId controlling_factionId)
|
||||
bool OPvPCapturePointZM_GraveYard::CanTalkTo(Player* player, Creature* c, GossipMenuItems const& /*gso*/)
|
||||
{
|
||||
ObjectGuid guid = c->GetGUID();
|
||||
std::map<ObjectGuid::LowType, uint32>::iterator itr = m_CreatureTypes.find(guid.GetCounter());
|
||||
if (itr != m_CreatureTypes.end())
|
||||
auto itr = _creatureTypes.find(guid.GetCounter());
|
||||
if (itr != _creatureTypes.end())
|
||||
{
|
||||
if (itr->second == ZM_ALLIANCE_FIELD_SCOUT && player->GetTeamId() == TEAM_ALLIANCE && m_BothControllingFactionId == TEAM_ALLIANCE && !m_FlagCarrierGUID && m_GraveYardState != ZM_GRAVEYARD_A)
|
||||
return true;
|
||||
@@ -349,8 +349,8 @@ bool OPvPCapturePointZM_GraveYard::CanTalkTo(Player* player, Creature* c, Gossip
|
||||
|
||||
bool OPvPCapturePointZM_GraveYard::HandleGossipOption(Player* player, Creature* creature, uint32 /*gossipid*/)
|
||||
{
|
||||
std::map<ObjectGuid::LowType, uint32>::iterator itr = m_CreatureTypes.find(creature->GetSpawnId());
|
||||
if (itr != m_CreatureTypes.end())
|
||||
auto itr = _creatureTypes.find(creature->GetSpawnId());
|
||||
if (itr != _creatureTypes.end())
|
||||
{
|
||||
// if the flag is already taken, then return
|
||||
if (m_FlagCarrierGUID)
|
||||
@@ -416,7 +416,7 @@ void OutdoorPvPZM::SetHordeTowersControlled(uint32 count)
|
||||
void OutdoorPvPZM::FillInitialWorldStates(WorldPacket& data)
|
||||
{
|
||||
data << ZM_WORLDSTATE_UNK_1 << uint32(1);
|
||||
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
for (OPvPCapturePointMap::iterator itr = _capturePoints.begin(); itr != _capturePoints.end(); ++itr)
|
||||
{
|
||||
itr->second->FillInitialWorldStates(data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user