feat(Core/Misc): implement ObjectGuid class (port from TC) (#4885)
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
#include "WorldPacket.h"
|
||||
|
||||
OPvPCapturePoint::OPvPCapturePoint(OutdoorPvP* pvp):
|
||||
m_capturePointGUID(0), m_capturePoint(nullptr), m_maxValue(0.0f), m_minValue(0.0f), m_maxSpeed(0),
|
||||
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)
|
||||
{ }
|
||||
@@ -53,7 +53,7 @@ void OPvPCapturePoint::SendChangePhase()
|
||||
SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct);
|
||||
}
|
||||
|
||||
void OPvPCapturePoint::AddGO(uint32 type, uint32 guid, uint32 entry)
|
||||
void OPvPCapturePoint::AddGO(uint32 type, ObjectGuid::LowType guid, uint32 entry)
|
||||
{
|
||||
if (!entry)
|
||||
{
|
||||
@@ -62,11 +62,11 @@ void OPvPCapturePoint::AddGO(uint32 type, uint32 guid, uint32 entry)
|
||||
return;
|
||||
entry = data->id;
|
||||
}
|
||||
m_Objects[type] = MAKE_NEW_GUID(guid, entry, HIGHGUID_GAMEOBJECT);
|
||||
m_Objects[type] = guid;
|
||||
m_ObjectTypes[m_Objects[type]] = type;
|
||||
}
|
||||
|
||||
void OPvPCapturePoint::AddCre(uint32 type, uint32 guid, uint32 entry)
|
||||
void OPvPCapturePoint::AddCre(uint32 type, ObjectGuid::LowType guid, uint32 entry)
|
||||
{
|
||||
if (!entry)
|
||||
{
|
||||
@@ -75,13 +75,13 @@ void OPvPCapturePoint::AddCre(uint32 type, uint32 guid, uint32 entry)
|
||||
return;
|
||||
entry = data->id;
|
||||
}
|
||||
m_Creatures[type] = MAKE_NEW_GUID(guid, entry, HIGHGUID_UNIT);
|
||||
m_Creatures[type] = guid;
|
||||
m_CreatureTypes[m_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)
|
||||
{
|
||||
if (uint32 guid = sObjectMgr->AddGOData(entry, map, x, y, z, o, 0, rotation0, rotation1, rotation2, rotation3))
|
||||
if (ObjectGuid::LowType guid = sObjectMgr->AddGOData(entry, map, x, y, z, o, 0, rotation0, rotation1, rotation2, rotation3))
|
||||
{
|
||||
AddGO(type, guid, entry);
|
||||
return true;
|
||||
@@ -92,7 +92,7 @@ bool OPvPCapturePoint::AddObject(uint32 type, uint32 entry, uint32 map, float x,
|
||||
|
||||
bool OPvPCapturePoint::AddCreature(uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay)
|
||||
{
|
||||
if (uint32 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;
|
||||
@@ -115,10 +115,9 @@ bool OPvPCapturePoint::SetCapturePointData(uint32 entry, uint32 map, float x, fl
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 lowguid = sObjectMgr->AddGOData(entry, map, x, y, z, o, 0, rotation0, rotation1, rotation2, rotation3);
|
||||
if (!lowguid)
|
||||
m_capturePointSpawnId = sObjectMgr->AddGOData(entry, map, x, y, z, o, 0, rotation0, rotation1, rotation2, rotation3);
|
||||
if (!m_capturePointSpawnId)
|
||||
return false;
|
||||
m_capturePointGUID = MAKE_NEW_GUID(lowguid, entry, HIGHGUID_GAMEOBJECT);
|
||||
|
||||
// get the needed values from goinfo
|
||||
m_maxValue = (float)goinfo->capturePoint.maxTime;
|
||||
@@ -130,7 +129,8 @@ bool OPvPCapturePoint::SetCapturePointData(uint32 entry, uint32 map, float x, fl
|
||||
|
||||
bool OPvPCapturePoint::DelCreature(uint32 type)
|
||||
{
|
||||
if (!m_Creatures[type])
|
||||
ObjectGuid::LowType spawnId = m_Creatures[type];
|
||||
if (!spawnId)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("outdoorpvp", "opvp creature type %u was already deleted", type);
|
||||
@@ -138,20 +138,20 @@ bool OPvPCapturePoint::DelCreature(uint32 type)
|
||||
return false;
|
||||
}
|
||||
|
||||
Creature* cr = HashMapHolder<Creature>::Find(m_Creatures[type]);
|
||||
if (!cr)
|
||||
auto bounds = m_PvP->GetMap()->GetCreatureBySpawnIdStore().equal_range(spawnId);
|
||||
for (auto itr = bounds.first; itr != bounds.second;)
|
||||
{
|
||||
// can happen when closing the core
|
||||
m_Creatures[type] = 0;
|
||||
return false;
|
||||
Creature* c = itr->second;
|
||||
++itr;
|
||||
// Don't save respawn time
|
||||
c->SetRespawnTime(0);
|
||||
c->RemoveCorpse();
|
||||
c->AddObjectToRemoveList();
|
||||
}
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("outdoorpvp", "deleting opvp creature type %u", type);
|
||||
#endif
|
||||
uint32 guid = cr->GetDBTableGUIDLow();
|
||||
// Don't save respawn time
|
||||
cr->SetRespawnTime(0);
|
||||
cr->RemoveCorpse();
|
||||
// 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
|
||||
@@ -159,13 +159,12 @@ bool OPvPCapturePoint::DelCreature(uint32 type)
|
||||
// map->Remove(cr, false);
|
||||
// delete respawn time for this creature
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CREATURE_RESPAWN);
|
||||
stmt->setUInt32(0, guid);
|
||||
stmt->setUInt16(1, cr->GetMapId());
|
||||
stmt->setUInt32(0, spawnId);
|
||||
stmt->setUInt16(1, m_PvP->GetMap()->GetId());
|
||||
stmt->setUInt32(2, 0); // instance id, always 0 for world maps
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
cr->AddObjectToRemoveList();
|
||||
sObjectMgr->DeleteCreatureData(guid);
|
||||
sObjectMgr->DeleteCreatureData(spawnId);
|
||||
m_CreatureTypes[m_Creatures[type]] = 0;
|
||||
m_Creatures[type] = 0;
|
||||
return true;
|
||||
@@ -173,19 +172,21 @@ bool OPvPCapturePoint::DelCreature(uint32 type)
|
||||
|
||||
bool OPvPCapturePoint::DelObject(uint32 type)
|
||||
{
|
||||
if (!m_Objects[type])
|
||||
ObjectGuid::LowType spawnId = m_Objects[type];
|
||||
if (!spawnId)
|
||||
return false;
|
||||
|
||||
GameObject* obj = HashMapHolder<GameObject>::Find(m_Objects[type]);
|
||||
if (!obj)
|
||||
auto bounds = m_PvP->GetMap()->GetGameObjectBySpawnIdStore().equal_range(spawnId);
|
||||
for (auto itr = bounds.first; itr != bounds.second;)
|
||||
{
|
||||
m_Objects[type] = 0;
|
||||
return false;
|
||||
GameObject* go = itr->second;
|
||||
++itr;
|
||||
// Don't save respawn time
|
||||
go->SetRespawnTime(0);
|
||||
go->Delete();
|
||||
}
|
||||
uint32 guid = obj->GetDBTableGUIDLow();
|
||||
obj->SetRespawnTime(0); // not save respawn time
|
||||
obj->Delete();
|
||||
sObjectMgr->DeleteGOData(guid);
|
||||
|
||||
sObjectMgr->DeleteGOData(spawnId);
|
||||
m_ObjectTypes[m_Objects[type]] = 0;
|
||||
m_Objects[type] = 0;
|
||||
return true;
|
||||
@@ -193,8 +194,8 @@ bool OPvPCapturePoint::DelObject(uint32 type)
|
||||
|
||||
bool OPvPCapturePoint::DelCapturePoint()
|
||||
{
|
||||
sObjectMgr->DeleteGOData(GUID_LOPART(m_capturePointGUID));
|
||||
m_capturePointGUID = 0;
|
||||
sObjectMgr->DeleteGOData(m_capturePointSpawnId);
|
||||
m_capturePointSpawnId = 0;
|
||||
|
||||
if (m_capturePoint)
|
||||
{
|
||||
@@ -207,15 +208,30 @@ bool OPvPCapturePoint::DelCapturePoint()
|
||||
|
||||
void OPvPCapturePoint::DeleteSpawns()
|
||||
{
|
||||
for (std::map<uint32, uint64>::iterator i = m_Objects.begin(); i != m_Objects.end(); ++i)
|
||||
for (std::map<uint32, ObjectGuid::LowType>::iterator i = m_Objects.begin(); i != m_Objects.end(); ++i)
|
||||
DelObject(i->first);
|
||||
for (std::map<uint32, uint64>::iterator i = m_Creatures.begin(); i != m_Creatures.end(); ++i)
|
||||
for (std::map<uint32, ObjectGuid::LowType>::iterator i = m_Creatures.begin(); i != m_Creatures.end(); ++i)
|
||||
DelCreature(i->first);
|
||||
DelCapturePoint();
|
||||
}
|
||||
|
||||
void OutdoorPvP::DeleteSpawns()
|
||||
{
|
||||
// Remove script from any registered gameobjects/creatures
|
||||
for (auto itr = m_GoScriptStore.begin(); itr != m_GoScriptStore.end(); ++itr)
|
||||
{
|
||||
if (GameObject* go = itr->second)
|
||||
go->ClearZoneScript();
|
||||
}
|
||||
m_GoScriptStore.clear();
|
||||
|
||||
for (auto itr = m_CreatureScriptStore.begin(); itr != m_CreatureScriptStore.end(); ++itr)
|
||||
{
|
||||
if (Creature* creature = itr->second)
|
||||
creature->ClearZoneScript();
|
||||
}
|
||||
m_CreatureScriptStore.clear();
|
||||
|
||||
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
{
|
||||
itr->second->DeleteSpawns();
|
||||
@@ -224,7 +240,7 @@ void OutdoorPvP::DeleteSpawns()
|
||||
m_capturePoints.clear();
|
||||
}
|
||||
|
||||
OutdoorPvP::OutdoorPvP() : m_TypeId(0), m_sendUpdate(true) { }
|
||||
OutdoorPvP::OutdoorPvP() : m_TypeId(0), m_sendUpdate(true), m_map(nullptr) { }
|
||||
|
||||
OutdoorPvP::~OutdoorPvP()
|
||||
{
|
||||
@@ -276,7 +292,7 @@ bool OPvPCapturePoint::Update(uint32 diff)
|
||||
{
|
||||
for (PlayerSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end();)
|
||||
{
|
||||
uint64 playerGuid = *itr;
|
||||
ObjectGuid playerGuid = *itr;
|
||||
++itr;
|
||||
|
||||
if (Player* player = ObjectAccessor::FindPlayer(playerGuid))
|
||||
@@ -407,7 +423,7 @@ void OPvPCapturePoint::SendUpdateWorldState(uint32 field, uint32 value)
|
||||
}
|
||||
}
|
||||
|
||||
void OPvPCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid)
|
||||
void OPvPCapturePoint::SendObjectiveComplete(uint32 id, ObjectGuid guid)
|
||||
{
|
||||
uint32 team;
|
||||
switch (m_State)
|
||||
@@ -492,19 +508,19 @@ bool OPvPCapturePoint::HandleCustomSpell(Player* player, uint32 /*spellId*/, Gam
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OutdoorPvP::HandleOpenGo(Player* player, uint64 guid)
|
||||
bool OutdoorPvP::HandleOpenGo(Player* player, GameObject* go)
|
||||
{
|
||||
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
if (itr->second->HandleOpenGo(player, guid) >= 0)
|
||||
if (itr->second->HandleOpenGo(player, go) >= 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OutdoorPvP::HandleGossipOption(Player* player, uint64 guid, uint32 id)
|
||||
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, guid, id))
|
||||
if (itr->second->HandleGossipOption(player, creature, id))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -528,7 +544,7 @@ bool OutdoorPvP::HandleDropFlag(Player* player, uint32 id)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OPvPCapturePoint::HandleGossipOption(Player* /*player*/, uint64 /*guid*/, uint32 /*id*/)
|
||||
bool OPvPCapturePoint::HandleGossipOption(Player* /*player*/, Creature* /*creature*/, uint32 /*id*/)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -543,9 +559,9 @@ bool OPvPCapturePoint::HandleDropFlag(Player* /*player*/, uint32 /*id*/)
|
||||
return false;
|
||||
}
|
||||
|
||||
int32 OPvPCapturePoint::HandleOpenGo(Player* /*player*/, uint64 guid)
|
||||
int32 OPvPCapturePoint::HandleOpenGo(Player* /*player*/, GameObject* go)
|
||||
{
|
||||
std::map<uint64, uint32>::iterator itr = m_ObjectTypes.find(guid);
|
||||
std::map<ObjectGuid::LowType, uint32>::iterator itr = m_ObjectTypes.find(go->GetSpawnId());
|
||||
if (itr != m_ObjectTypes.end())
|
||||
{
|
||||
return itr->second;
|
||||
@@ -604,18 +620,43 @@ void OutdoorPvP::TeamApplyBuff(TeamId teamId, uint32 spellId, uint32 spellId2, P
|
||||
|
||||
void OutdoorPvP::OnGameObjectCreate(GameObject* go)
|
||||
{
|
||||
GoScriptPair sp(go->GetGUID().GetCounter(), go);
|
||||
m_GoScriptStore.insert(sp);
|
||||
|
||||
if (go->GetGoType() != GAMEOBJECT_TYPE_CAPTURE_POINT)
|
||||
return;
|
||||
|
||||
if (OPvPCapturePoint* cp = GetCapturePoint(go->GetDBTableGUIDLow()))
|
||||
if (OPvPCapturePoint* cp = GetCapturePoint(go->GetSpawnId()))
|
||||
cp->m_capturePoint = go;
|
||||
}
|
||||
|
||||
void OutdoorPvP::OnGameObjectRemove(GameObject* go)
|
||||
{
|
||||
m_GoScriptStore.erase(go->GetGUID().GetCounter());
|
||||
|
||||
if (go->GetGoType() != GAMEOBJECT_TYPE_CAPTURE_POINT)
|
||||
return;
|
||||
|
||||
if (OPvPCapturePoint* cp = GetCapturePoint(go->GetDBTableGUIDLow()))
|
||||
if (OPvPCapturePoint* cp = GetCapturePoint(go->GetSpawnId()))
|
||||
cp->m_capturePoint = nullptr;
|
||||
}
|
||||
|
||||
void OutdoorPvP::OnCreatureCreate(Creature* creature)
|
||||
{
|
||||
CreatureScriptPair sp(creature->GetGUID().GetCounter(), creature);
|
||||
m_CreatureScriptStore.insert(sp);
|
||||
}
|
||||
|
||||
void OutdoorPvP::OnCreatureRemove(Creature* creature)
|
||||
{
|
||||
m_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;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ class Unit;
|
||||
struct GossipMenuItems;
|
||||
class OutdoorPvP;
|
||||
|
||||
typedef std::set<uint64> PlayerSet;
|
||||
typedef GuidSet PlayerSet;
|
||||
|
||||
class OPvPCapturePoint
|
||||
{
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
void SendUpdateWorldState(uint32 field, uint32 value);
|
||||
|
||||
// send kill notify to players in the controlling faction
|
||||
void SendObjectiveComplete(uint32 id, uint64 guid);
|
||||
void SendObjectiveComplete(uint32 id, ObjectGuid guid = ObjectGuid::Empty);
|
||||
|
||||
// used when player is activated/inactivated in the area
|
||||
virtual bool HandlePlayerEnter(Player* player);
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
|
||||
virtual bool HandleCustomSpell(Player* player, uint32 spellId, GameObject* go);
|
||||
|
||||
virtual int32 HandleOpenGo(Player* player, uint64 guid);
|
||||
virtual int32 HandleOpenGo(Player* player, GameObject* go);
|
||||
|
||||
// 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);
|
||||
@@ -109,7 +109,7 @@ public:
|
||||
|
||||
virtual void SendChangePhase();
|
||||
|
||||
virtual bool HandleGossipOption(Player* player, uint64 guid, uint32 gossipid);
|
||||
virtual bool HandleGossipOption(Player* player, Creature* creature, uint32 gossipid);
|
||||
|
||||
virtual bool CanTalkTo(Player* player, Creature* c, GossipMenuItems const& gso);
|
||||
|
||||
@@ -117,12 +117,12 @@ public:
|
||||
|
||||
virtual void DeleteSpawns();
|
||||
|
||||
uint64 m_capturePointGUID;
|
||||
ObjectGuid::LowType m_capturePointSpawnId;
|
||||
|
||||
GameObject* m_capturePoint;
|
||||
|
||||
void AddGO(uint32 type, uint32 guid, uint32 entry = 0);
|
||||
void AddCre(uint32 type, uint32 guid, uint32 entry = 0);
|
||||
void AddGO(uint32 type, ObjectGuid::LowType guid, uint32 entry = 0);
|
||||
void AddCre(uint32 type, ObjectGuid::LowType guid, uint32 entry = 0);
|
||||
|
||||
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);
|
||||
@@ -165,10 +165,10 @@ protected:
|
||||
|
||||
// map to store the various gameobjects and creatures spawned by the objective
|
||||
// type, guid
|
||||
std::map<uint32, uint64> m_Objects;
|
||||
std::map<uint32, uint64> m_Creatures;
|
||||
std::map<uint64, uint32> m_ObjectTypes;
|
||||
std::map<uint64, uint32> m_CreatureTypes;
|
||||
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;
|
||||
};
|
||||
|
||||
// base class for specific outdoor pvp handlers
|
||||
@@ -186,7 +186,9 @@ public:
|
||||
// deletes all gos/creatures spawned by the pvp
|
||||
void DeleteSpawns();
|
||||
|
||||
typedef std::map<uint32/*lowguid*/, OPvPCapturePoint*> OPvPCapturePointMap;
|
||||
typedef std::map<ObjectGuid::LowType/*lowguid*/, OPvPCapturePoint*> OPvPCapturePointMap;
|
||||
typedef std::pair<ObjectGuid::LowType, GameObject*> GoScriptPair;
|
||||
typedef std::pair<ObjectGuid::LowType, Creature*> CreatureScriptPair;
|
||||
|
||||
virtual void FillInitialWorldStates(WorldPacket& /*data*/) {}
|
||||
|
||||
@@ -197,14 +199,15 @@ public:
|
||||
virtual bool HandleCustomSpell(Player* player, uint32 spellId, GameObject* go);
|
||||
|
||||
// called on go use
|
||||
virtual bool HandleOpenGo(Player* player, uint64 guid);
|
||||
virtual bool HandleOpenGo(Player* player, GameObject* go);
|
||||
|
||||
// setup stuff
|
||||
virtual bool SetupOutdoorPvP() {return true;}
|
||||
|
||||
void OnGameObjectCreate(GameObject* go) override;
|
||||
void OnGameObjectRemove(GameObject* go) override;
|
||||
void OnCreatureCreate(Creature*) override {}
|
||||
void OnCreatureCreate(Creature* creature) override;
|
||||
void OnCreatureRemove(Creature* creature) override;
|
||||
|
||||
// send world state update to all players present
|
||||
void SendUpdateWorldState(uint32 field, uint32 value);
|
||||
@@ -226,12 +229,14 @@ public:
|
||||
|
||||
virtual bool HandleDropFlag(Player* player, uint32 spellId);
|
||||
|
||||
virtual bool HandleGossipOption(Player* player, uint64 guid, 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; }
|
||||
|
||||
protected:
|
||||
// the map of the objectives belonging to this outdoorpvp
|
||||
OPvPCapturePointMap m_capturePoints;
|
||||
@@ -254,12 +259,12 @@ protected:
|
||||
|
||||
void AddCapturePoint(OPvPCapturePoint* cp)
|
||||
{
|
||||
m_capturePoints[GUID_LOPART(cp->m_capturePointGUID)] = cp;
|
||||
m_capturePoints[cp->m_capturePointSpawnId] = cp;
|
||||
}
|
||||
|
||||
OPvPCapturePoint* GetCapturePoint(uint32 lowguid) const
|
||||
OPvPCapturePoint* GetCapturePoint(ObjectGuid::LowType spawnId) const
|
||||
{
|
||||
OutdoorPvP::OPvPCapturePointMap::const_iterator itr = m_capturePoints.find(lowguid);
|
||||
OutdoorPvP::OPvPCapturePointMap::const_iterator itr = m_capturePoints.find(spawnId);
|
||||
if (itr != m_capturePoints.end())
|
||||
return itr->second;
|
||||
return nullptr;
|
||||
@@ -270,6 +275,13 @@ protected:
|
||||
bool HasPlayer(Player const* player) const;
|
||||
|
||||
void TeamCastSpell(TeamId team, int32 spellId, Player* sameMapPlr = nullptr);
|
||||
|
||||
// Hack to store map because this code is just shit
|
||||
void SetMapFromZone(uint32 zone);
|
||||
std::map<ObjectGuid::LowType, GameObject*> m_GoScriptStore;
|
||||
std::map<ObjectGuid::LowType, Creature*> m_CreatureScriptStore;
|
||||
|
||||
Map* m_map;
|
||||
};
|
||||
|
||||
#endif /*OUTDOOR_PVP_H_*/
|
||||
|
||||
@@ -122,7 +122,7 @@ void OutdoorPvPMgr::HandlePlayerEnterZone(Player* player, uint32 zoneid)
|
||||
|
||||
itr->second->HandlePlayerEnterZone(player, zoneid);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("outdoorpvp", "Player %u entered outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId());
|
||||
LOG_DEBUG("outdoorpvp", "Player %s entered outdoorpvp id %u", player->GetGUID().ToString().c_str(), itr->second->GetTypeId());
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ void OutdoorPvPMgr::HandlePlayerLeaveZone(Player* player, uint32 zoneid)
|
||||
|
||||
itr->second->HandlePlayerLeaveZone(player, zoneid);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("outdoorpvp", "Player %u left outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId());
|
||||
LOG_DEBUG("outdoorpvp", "Player %s left outdoorpvp id %u", player->GetGUID().ToString().c_str(), itr->second->GetTypeId());
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -186,23 +186,23 @@ ZoneScript* OutdoorPvPMgr::GetZoneScript(uint32 zoneId)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool OutdoorPvPMgr::HandleOpenGo(Player* player, uint64 guid)
|
||||
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)
|
||||
{
|
||||
if ((*itr)->HandleOpenGo(player, guid))
|
||||
if ((*itr)->HandleOpenGo(player, go))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void OutdoorPvPMgr::HandleGossipOption(Player* player, uint64 guid, uint32 gossipid)
|
||||
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)
|
||||
{
|
||||
if ((*itr)->HandleGossipOption(player, guid, gossipid))
|
||||
if ((*itr)->HandleGossipOption(player, creature, gossipid))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
bool HandleCustomSpell(Player* player, uint32 spellId, GameObject* go);
|
||||
|
||||
// handle custom go if registered
|
||||
bool HandleOpenGo(Player* player, uint64 guid);
|
||||
bool HandleOpenGo(Player* player, GameObject* go);
|
||||
|
||||
ZoneScript* GetZoneScript(uint32 zoneId);
|
||||
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
|
||||
void Update(uint32 diff);
|
||||
|
||||
void HandleGossipOption(Player* player, uint64 guid, uint32 gossipid);
|
||||
void HandleGossipOption(Player* player, Creature* creatured, uint32 gossipid);
|
||||
|
||||
bool CanTalkTo(Player* player, Creature* creature, GossipMenuItems const& gso);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user