mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-15 08:16:08 +00:00
feat(Core/Misc): implement ObjectGuid class (port from TC) (#4885)
This commit is contained in:
@@ -30,6 +30,7 @@ Battlefield::Battlefield()
|
||||
m_TypeId = 0;
|
||||
m_BattleId = 0;
|
||||
m_ZoneId = 0;
|
||||
m_Map = nullptr;
|
||||
m_MapId = 0;
|
||||
m_MaxPlayer = 0;
|
||||
m_MinPlayer = 0;
|
||||
@@ -45,13 +46,12 @@ Battlefield::Battlefield()
|
||||
m_LastResurectTimer = RESURRECTION_INTERVAL;
|
||||
m_StartGroupingTimer = 0;
|
||||
m_StartGrouping = false;
|
||||
StalkerGuid = 0;
|
||||
}
|
||||
|
||||
Battlefield::~Battlefield()
|
||||
{
|
||||
for (BfCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
delete itr->second;
|
||||
for (BfCapturePointVector::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
delete *itr;
|
||||
|
||||
for (GraveyardVect::const_iterator itr = m_GraveyardList.begin(); itr != m_GraveyardList.end(); ++itr)
|
||||
delete *itr;
|
||||
@@ -110,8 +110,8 @@ void Battlefield::HandlePlayerLeaveZone(Player* player, uint32 /*zone*/)
|
||||
}
|
||||
}
|
||||
|
||||
for (BfCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
itr->second->HandlePlayerLeave(player);
|
||||
for (BfCapturePointVector::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
(*itr)->HandlePlayerLeave(player);
|
||||
|
||||
m_InvitedPlayers[player->GetTeamId()].erase(player->GetGUID());
|
||||
m_PlayersWillBeKick[player->GetTeamId()].erase(player->GetGUID());
|
||||
@@ -182,8 +182,8 @@ bool Battlefield::Update(uint32 diff)
|
||||
else
|
||||
m_uiKickDontAcceptTimer -= diff;
|
||||
|
||||
for (BfCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
if (itr->second->Update(diff))
|
||||
for (BfCapturePointVector::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
if ((*itr)->Update(diff))
|
||||
objective_changed = true;
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ bool Battlefield::Update(uint32 diff)
|
||||
void Battlefield::InvitePlayersInZoneToQueue()
|
||||
{
|
||||
for (uint8 team = 0; team < 2; ++team)
|
||||
for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
InvitePlayerToQueue(player);
|
||||
}
|
||||
@@ -221,8 +221,8 @@ void Battlefield::InvitePlayersInQueueToWar()
|
||||
{
|
||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
{
|
||||
GuidSet copy(m_PlayersInQueue[team]);
|
||||
for (GuidSet::const_iterator itr = copy.begin(); itr != copy.end(); ++itr)
|
||||
GuidUnorderedSet copy(m_PlayersInQueue[team]);
|
||||
for (GuidUnorderedSet::const_iterator itr = copy.begin(); itr != copy.end(); ++itr)
|
||||
{
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
{
|
||||
@@ -241,7 +241,7 @@ void Battlefield::InvitePlayersInQueueToWar()
|
||||
void Battlefield::InvitePlayersInZoneToWar()
|
||||
{
|
||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
{
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
{
|
||||
@@ -299,13 +299,13 @@ void Battlefield::KickAfkPlayers()
|
||||
{
|
||||
// xinef: optimization, dont lookup player twice
|
||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
if (player->isAFK() && player->GetZoneId() == GetZoneId() && !player->IsGameMaster())
|
||||
player->TeleportTo(KickPosition);
|
||||
}
|
||||
|
||||
void Battlefield::KickPlayerFromBattlefield(uint64 guid)
|
||||
void Battlefield::KickPlayerFromBattlefield(ObjectGuid guid)
|
||||
{
|
||||
if (Player* player = ObjectAccessor::FindPlayer(guid))
|
||||
{
|
||||
@@ -367,7 +367,7 @@ void Battlefield::DoPlaySoundToAll(uint32 SoundID)
|
||||
data << uint32(SoundID);
|
||||
|
||||
for (int team = 0; team < BG_TEAMS_COUNT; team++)
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->GetSession()->SendPacket(&data);
|
||||
}
|
||||
@@ -423,13 +423,13 @@ void Battlefield::TeamCastSpell(TeamId team, int32 spellId)
|
||||
{
|
||||
if (spellId > 0)
|
||||
{
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->CastSpell(player, uint32(spellId), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->RemoveAuraFromStack(uint32(-spellId));
|
||||
}
|
||||
@@ -438,7 +438,7 @@ void Battlefield::TeamCastSpell(TeamId team, int32 spellId)
|
||||
void Battlefield::BroadcastPacketToZone(WorldPacket& data) const
|
||||
{
|
||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->GetSession()->SendPacket(&data);
|
||||
}
|
||||
@@ -446,7 +446,7 @@ void Battlefield::BroadcastPacketToZone(WorldPacket& data) const
|
||||
void Battlefield::BroadcastPacketToQueue(WorldPacket& data) const
|
||||
{
|
||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
for (GuidSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->GetSession()->SendPacket(&data);
|
||||
}
|
||||
@@ -454,22 +454,23 @@ void Battlefield::BroadcastPacketToQueue(WorldPacket& data) const
|
||||
void Battlefield::BroadcastPacketToWar(WorldPacket& data) const
|
||||
{
|
||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void Battlefield::SendWarningToAllInZone(uint32 entry)
|
||||
{
|
||||
if (Unit* unit = ObjectAccessor::FindUnit(StalkerGuid))
|
||||
if (Creature* stalker = unit->ToCreature())
|
||||
sCreatureTextMgr->SendChat(stalker, (uint8)entry, nullptr, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_ZONE);
|
||||
if (Map* map = sMapMgr->CreateBaseMap(m_MapId))
|
||||
if (Unit* unit = map->GetCreature(StalkerGuid))
|
||||
if (Creature* stalker = unit->ToCreature())
|
||||
sCreatureTextMgr->SendChat(stalker, (uint8)entry, nullptr, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_ZONE);
|
||||
}
|
||||
|
||||
void Battlefield::SendWarningToPlayer(Player* player, uint32 entry)
|
||||
{
|
||||
if (player)
|
||||
if (Unit* unit = ObjectAccessor::FindUnit(StalkerGuid))
|
||||
if (Unit* unit = ObjectAccessor::GetCreature(*player, StalkerGuid))
|
||||
if (Creature* stalker = unit->ToCreature())
|
||||
sCreatureTextMgr->SendChat(stalker, (uint8)entry, player);
|
||||
}
|
||||
@@ -477,7 +478,7 @@ void Battlefield::SendWarningToPlayer(Player* player, uint32 entry)
|
||||
void Battlefield::SendUpdateWorldState(uint32 field, uint32 value)
|
||||
{
|
||||
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
|
||||
for (GuidSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
|
||||
for (GuidUnorderedSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->SendUpdateWorldState(field, value);
|
||||
}
|
||||
@@ -518,18 +519,18 @@ void Battlefield::ShowNpc(Creature* creature, bool aggressive)
|
||||
// ****************************************************
|
||||
Group* Battlefield::GetFreeBfRaid(TeamId TeamId)
|
||||
{
|
||||
for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
|
||||
if (Group* group = sGroupMgr->GetGroupByGUID(*itr))
|
||||
for (GuidUnorderedSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
|
||||
if (Group* group = sGroupMgr->GetGroupByGUID(itr->GetCounter()))
|
||||
if (!group->IsFull())
|
||||
return group;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Group* Battlefield::GetGroupPlayer(uint64 guid, TeamId TeamId)
|
||||
Group* Battlefield::GetGroupPlayer(ObjectGuid guid, TeamId TeamId)
|
||||
{
|
||||
for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
|
||||
if (Group* group = sGroupMgr->GetGroupByGUID(*itr))
|
||||
for (GuidUnorderedSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
|
||||
if (Group* group = sGroupMgr->GetGroupByGUID(itr->GetCounter()))
|
||||
if (group->IsMember(guid))
|
||||
return group;
|
||||
|
||||
@@ -617,7 +618,7 @@ GraveyardStruct const* Battlefield::GetClosestGraveyard(Player* player)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Battlefield::AddPlayerToResurrectQueue(uint64 npcGuid, uint64 playerGuid)
|
||||
void Battlefield::AddPlayerToResurrectQueue(ObjectGuid npcGuid, ObjectGuid playerGuid)
|
||||
{
|
||||
for (uint8 i = 0; i < m_GraveyardList.size(); i++)
|
||||
{
|
||||
@@ -632,7 +633,7 @@ void Battlefield::AddPlayerToResurrectQueue(uint64 npcGuid, uint64 playerGuid)
|
||||
}
|
||||
}
|
||||
|
||||
void Battlefield::RemovePlayerFromResurrectQueue(uint64 playerGuid)
|
||||
void Battlefield::RemovePlayerFromResurrectQueue(ObjectGuid playerGuid)
|
||||
{
|
||||
for (uint8 i = 0; i < m_GraveyardList.size(); i++)
|
||||
{
|
||||
@@ -647,7 +648,7 @@ void Battlefield::RemovePlayerFromResurrectQueue(uint64 playerGuid)
|
||||
}
|
||||
}
|
||||
|
||||
void Battlefield::SendAreaSpiritHealerQueryOpcode(Player* player, const uint64& guid)
|
||||
void Battlefield::SendAreaSpiritHealerQueryOpcode(Player* player, const ObjectGuid& guid)
|
||||
{
|
||||
WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12);
|
||||
uint32 time = m_LastResurectTimer; // resurrect every 30 seconds
|
||||
@@ -665,8 +666,6 @@ BfGraveyard::BfGraveyard(Battlefield* battlefield)
|
||||
m_Bf = battlefield;
|
||||
m_GraveyardId = 0;
|
||||
m_ControlTeam = TEAM_NEUTRAL;
|
||||
m_SpiritGuide[0] = 0;
|
||||
m_SpiritGuide[1] = 0;
|
||||
m_ResurrectQueue.clear();
|
||||
}
|
||||
|
||||
@@ -694,7 +693,7 @@ float BfGraveyard::GetDistance(Player* player)
|
||||
return player->GetDistance2d(safeLoc->x, safeLoc->y);
|
||||
}
|
||||
|
||||
void BfGraveyard::AddPlayer(uint64 playerGuid)
|
||||
void BfGraveyard::AddPlayer(ObjectGuid playerGuid)
|
||||
{
|
||||
if (!m_ResurrectQueue.count(playerGuid))
|
||||
{
|
||||
@@ -705,7 +704,7 @@ void BfGraveyard::AddPlayer(uint64 playerGuid)
|
||||
}
|
||||
}
|
||||
|
||||
void BfGraveyard::RemovePlayer(uint64 playerGuid)
|
||||
void BfGraveyard::RemovePlayer(ObjectGuid playerGuid)
|
||||
{
|
||||
m_ResurrectQueue.erase(m_ResurrectQueue.find(playerGuid));
|
||||
|
||||
@@ -718,7 +717,7 @@ void BfGraveyard::Resurrect()
|
||||
if (m_ResurrectQueue.empty())
|
||||
return;
|
||||
|
||||
for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
|
||||
{
|
||||
// Get player object from his guid
|
||||
Player* player = ObjectAccessor::FindPlayer(*itr);
|
||||
@@ -727,7 +726,7 @@ void BfGraveyard::Resurrect()
|
||||
|
||||
// Check if the player is in world and on the good graveyard
|
||||
if (player->IsInWorld())
|
||||
if (Unit* spirit = ObjectAccessor::FindUnit(m_SpiritGuide[m_ControlTeam]))
|
||||
if (Unit* spirit = ObjectAccessor::GetCreature(*player, m_SpiritGuide[m_ControlTeam]))
|
||||
spirit->CastSpell(spirit, SPELL_SPIRIT_HEAL, true);
|
||||
|
||||
// Resurect player
|
||||
@@ -736,7 +735,7 @@ void BfGraveyard::Resurrect()
|
||||
player->CastSpell(player, 6962, true);
|
||||
player->CastSpell(player, SPELL_SPIRIT_HEAL_MANA, true);
|
||||
|
||||
sObjectAccessor->ConvertCorpseForPlayer(player->GetGUID());
|
||||
player->SpawnCorpseBones(false);
|
||||
}
|
||||
|
||||
m_ResurrectQueue.clear();
|
||||
@@ -753,7 +752,7 @@ void BfGraveyard::GiveControlTo(TeamId team)
|
||||
void BfGraveyard::RelocateDeadPlayers()
|
||||
{
|
||||
GraveyardStruct const* closestGrave = nullptr;
|
||||
for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
|
||||
{
|
||||
Player* player = ObjectAccessor::FindPlayer(*itr);
|
||||
if (!player)
|
||||
@@ -792,7 +791,7 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl
|
||||
}
|
||||
|
||||
Creature* creature = new Creature(true);
|
||||
if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, x, y, z, o))
|
||||
if (!creature->Create(map->GenerateLowGuid<HighGuid::Unit>(), map, PHASEMASK_NORMAL, entry, 0, x, y, z, o))
|
||||
{
|
||||
LOG_ERROR("server", "Battlefield::SpawnCreature: Can't create creature entry: %u", entry);
|
||||
delete creature;
|
||||
@@ -828,7 +827,7 @@ GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z
|
||||
|
||||
// Create gameobject
|
||||
GameObject* go = sObjectMgr->IsGameObjectStaticTransport(entry) ? new StaticTransport() : new GameObject();
|
||||
if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, PHASEMASK_NORMAL, x, y, z, o, G3D::Quat(), 100, GO_STATE_READY))
|
||||
if (!go->Create(map->GenerateLowGuid<HighGuid::GameObject>(), entry, map, PHASEMASK_NORMAL, x, y, z, o, G3D::Quat(), 100, GO_STATE_READY))
|
||||
{
|
||||
LOG_ERROR("sql.sql", "Battlefield::SpawnGameObject: Gameobject template %u not found in database! Battlefield not created!", entry);
|
||||
LOG_ERROR("server", "Battlefield::SpawnGameObject: Cannot create gameobject template %u! Battlefield not created!", entry);
|
||||
@@ -843,11 +842,27 @@ GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z
|
||||
return go;
|
||||
}
|
||||
|
||||
Creature* Battlefield::GetCreature(ObjectGuid const guid)
|
||||
{
|
||||
if (!m_Map)
|
||||
return nullptr;
|
||||
|
||||
return m_Map->GetCreature(guid);
|
||||
}
|
||||
|
||||
GameObject* Battlefield::GetGameObject(ObjectGuid const guid)
|
||||
{
|
||||
if (!m_Map)
|
||||
return nullptr;
|
||||
|
||||
return m_Map->GetGameObject(guid);
|
||||
}
|
||||
|
||||
// *******************************************************
|
||||
// ******************* CapturePoint **********************
|
||||
// *******************************************************
|
||||
|
||||
BfCapturePoint::BfCapturePoint(Battlefield* battlefield) : m_Bf(battlefield), m_capturePoint(0)
|
||||
BfCapturePoint::BfCapturePoint(Battlefield* battlefield) : m_Bf(battlefield)
|
||||
{
|
||||
m_team = TEAM_NEUTRAL;
|
||||
m_value = 0;
|
||||
@@ -871,12 +886,12 @@ bool BfCapturePoint::HandlePlayerEnter(Player* player)
|
||||
return m_activePlayers[player->GetTeamId()].insert(player->GetGUID()).second;
|
||||
}
|
||||
|
||||
GuidSet::iterator BfCapturePoint::HandlePlayerLeave(Player* player)
|
||||
GuidUnorderedSet::iterator BfCapturePoint::HandlePlayerLeave(Player* player)
|
||||
{
|
||||
if (GameObject* go = GetCapturePointGo(player))
|
||||
player->SendUpdateWorldState(go->GetGOInfo()->capturePoint.worldState1, 0);
|
||||
|
||||
GuidSet::iterator current = m_activePlayers[player->GetTeamId()].find(player->GetGUID());
|
||||
GuidUnorderedSet::iterator current = m_activePlayers[player->GetTeamId()].find(player->GetGUID());
|
||||
|
||||
if (current == m_activePlayers[player->GetTeamId()].end())
|
||||
return current; // return end()
|
||||
@@ -892,7 +907,7 @@ void BfCapturePoint::SendChangePhase()
|
||||
return;
|
||||
|
||||
for (uint8 team = 0; team < 2; ++team)
|
||||
for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) // send to all players present in the area
|
||||
for (GuidUnorderedSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) // send to all players present in the area
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
{
|
||||
// send this too, sometimes the slider disappears, dunno why :(
|
||||
@@ -948,12 +963,22 @@ bool BfCapturePoint::DelCapturePoint()
|
||||
{
|
||||
capturePoint->SetRespawnTime(0); // not save respawn time
|
||||
capturePoint->Delete();
|
||||
m_capturePoint = 0;
|
||||
m_capturePoint.Clear();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
GameObject* BfCapturePoint::GetCapturePointGo()
|
||||
{
|
||||
return m_Bf->GetGameObject(m_capturePoint);
|
||||
}
|
||||
|
||||
GameObject* BfCapturePoint::GetCapturePointGo(WorldObject* obj)
|
||||
{
|
||||
return ObjectAccessor::GetGameObject(*obj, m_capturePoint);
|
||||
}
|
||||
|
||||
bool BfCapturePoint::Update(uint32 diff)
|
||||
{
|
||||
GameObject* capturePoint = GetCapturePointGo();
|
||||
@@ -964,7 +989,7 @@ bool BfCapturePoint::Update(uint32 diff)
|
||||
|
||||
for (uint8 team = 0; team < 2; ++team)
|
||||
{
|
||||
for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end();)
|
||||
for (GuidUnorderedSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end();)
|
||||
{
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
if (!capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive())
|
||||
@@ -1076,12 +1101,12 @@ bool BfCapturePoint::Update(uint32 diff)
|
||||
void BfCapturePoint::SendUpdateWorldState(uint32 field, uint32 value)
|
||||
{
|
||||
for (uint8 team = 0; team < 2; ++team)
|
||||
for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) // send to all players present in the area
|
||||
for (GuidUnorderedSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) // send to all players present in the area
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->SendUpdateWorldState(field, value);
|
||||
}
|
||||
|
||||
void BfCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid)
|
||||
void BfCapturePoint::SendObjectiveComplete(uint32 id, ObjectGuid guid)
|
||||
{
|
||||
uint8 team;
|
||||
switch (m_State)
|
||||
@@ -1097,7 +1122,7 @@ void BfCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid)
|
||||
}
|
||||
|
||||
// send to all players present in the area
|
||||
for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr)
|
||||
for (GuidUnorderedSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->KilledMonsterCredit(id, guid);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user