From 6d13cd6553926a1aef24425c2e87aa79c0f561e8 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Wed, 1 Dec 2010 11:20:17 +0300 Subject: [PATCH] [10800] Use ObjectGuid in some battleground structures. Also fix some catches bugs in code in result. --- src/game/BattleGround.cpp | 51 ++++++++++++++++++-------------- src/game/BattleGround.h | 18 +++++------ src/game/BattleGroundAA.cpp | 4 +-- src/game/BattleGroundAA.h | 2 +- src/game/BattleGroundAB.cpp | 6 ++-- src/game/BattleGroundAB.h | 2 +- src/game/BattleGroundAV.cpp | 6 ++-- src/game/BattleGroundAV.h | 2 +- src/game/BattleGroundBE.cpp | 8 ++--- src/game/BattleGroundBE.h | 2 +- src/game/BattleGroundDS.cpp | 4 +-- src/game/BattleGroundDS.h | 2 +- src/game/BattleGroundEY.cpp | 41 +++++++++++++------------ src/game/BattleGroundEY.h | 13 ++++---- src/game/BattleGroundHandler.cpp | 6 ++-- src/game/BattleGroundIC.cpp | 6 ++-- src/game/BattleGroundIC.h | 2 +- src/game/BattleGroundMgr.cpp | 6 ++-- src/game/BattleGroundMgr.h | 2 +- src/game/BattleGroundNA.cpp | 4 +-- src/game/BattleGroundNA.h | 2 +- src/game/BattleGroundRB.cpp | 6 ++-- src/game/BattleGroundRB.h | 2 +- src/game/BattleGroundRL.cpp | 4 +-- src/game/BattleGroundRL.h | 2 +- src/game/BattleGroundRV.cpp | 4 +-- src/game/BattleGroundRV.h | 2 +- src/game/BattleGroundSA.cpp | 6 ++-- src/game/BattleGroundSA.h | 2 +- src/game/BattleGroundWS.cpp | 40 ++++++++++++------------- src/game/BattleGroundWS.h | 18 ++++++----- src/game/Player.cpp | 8 ++--- src/shared/revision_nr.h | 2 +- 33 files changed, 146 insertions(+), 139 deletions(-) diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index 22476dd56..f8cb68334 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -202,7 +202,7 @@ template void BattleGround::BroadcastWorker(Do& _do) { for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) - if (Player *plr = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first))) + if (Player *plr = ObjectAccessor::FindPlayer(itr->first)) _do(plr); } @@ -457,7 +457,7 @@ void BattleGround::Update(uint32 diff) { //TODO : add arena sound PlaySoundToAll(SOUND_ARENA_START); - for(BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) + for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) if (Player *plr = sObjectMgr.GetPlayer(itr->first)) plr->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION); @@ -468,7 +468,7 @@ void BattleGround::Update(uint32 diff) PlaySoundToAll(SOUND_BG_START); - for(BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) + for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) if (Player* plr = sObjectMgr.GetPlayer(itr->first)) plr->RemoveAurasDueToSpell(SPELL_PREPARATION); //Announce BG starting @@ -522,11 +522,11 @@ void BattleGround::SendPacketToAll(WorldPacket *packet) { if (itr->second.OfflineRemoveTime) continue; - Player *plr = sObjectMgr.GetPlayer(itr->first); - if (plr) + + if (Player *plr = sObjectMgr.GetPlayer(itr->first)) plr->GetSession()->SendPacket(packet); else - sLog.outError("BattleGround:SendPacketToAll: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); + sLog.outError("BattleGround:SendPacketToAll: %s not found!", itr->first.GetString().c_str()); } } @@ -536,10 +536,11 @@ void BattleGround::SendPacketToTeam(Team teamId, WorldPacket *packet, Player *se { if (itr->second.OfflineRemoveTime) continue; + Player *plr = sObjectMgr.GetPlayer(itr->first); if (!plr) { - sLog.outError("BattleGround:SendPacketToTeam: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); + sLog.outError("BattleGround:SendPacketToTeam: %s not found!", itr->first.GetString().c_str()); continue; } @@ -569,11 +570,11 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, Team teamId) { if (itr->second.OfflineRemoveTime) continue; - Player *plr = sObjectMgr.GetPlayer(itr->first); + Player *plr = sObjectMgr.GetPlayer(itr->first); if (!plr) { - sLog.outError("BattleGround:PlaySoundToTeam: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); + sLog.outError("BattleGround:PlaySoundToTeam: %s not found!", itr->first.GetString().c_str()); continue; } @@ -594,11 +595,12 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, Team teamId) { if (itr->second.OfflineRemoveTime) continue; + Player *plr = sObjectMgr.GetPlayer(itr->first); if (!plr) { - sLog.outError("BattleGround:CastSpellOnTeam: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); + sLog.outError("BattleGround:CastSpellOnTeam: %s not found!", itr->first.GetString().c_str()); continue; } @@ -616,11 +618,12 @@ void BattleGround::RewardHonorToTeam(uint32 Honor, Team teamId) { if (itr->second.OfflineRemoveTime) continue; + Player *plr = sObjectMgr.GetPlayer(itr->first); if (!plr) { - sLog.outError("BattleGround:RewardHonorToTeam: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); + sLog.outError("BattleGround:RewardHonorToTeam: %s not found!", itr->first.GetString().c_str()); continue; } @@ -643,11 +646,12 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation, { if (itr->second.OfflineRemoveTime) continue; + Player *plr = sObjectMgr.GetPlayer(itr->first); if (!plr) { - sLog.outError("BattleGround:RewardReputationToTeam: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); + sLog.outError("BattleGround:RewardReputationToTeam: %s not found!", itr->first.GetString().c_str()); continue; } @@ -747,10 +751,11 @@ void BattleGround::EndBattleGround(Team winner) } continue; } + Player *plr = sObjectMgr.GetPlayer(itr->first); if (!plr) { - sLog.outError("BattleGround:EndBattleGround Player (GUID: %u) not found!", GUID_LOPART(itr->first)); + sLog.outError("BattleGround:EndBattleGround %s not found!", itr->first.GetString().c_str()); continue; } @@ -993,7 +998,7 @@ void BattleGround::BlockMovement(Player *plr) plr->SetClientControl(plr, 0); // movement disabled NOTE: the effect will be automatically removed by client when the player is teleported from the battleground, so no need to send with uint8(1) in RemovePlayerAtLeave() } -void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPacket) +void BattleGround::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool SendPacket) { Team team = GetPlayerTeam(guid); bool participant = false; @@ -1183,7 +1188,7 @@ void BattleGround::AddPlayer(Player *plr) bp.PlayerTeam = team; // Add to list/maps - m_Players[guid.GetRawValue()] = bp; + m_Players[guid] = bp; UpdatePlayersCountByTeam(team, false); // +1 player @@ -1267,10 +1272,10 @@ void BattleGround::AddOrSetPlayerToCorrectBgGroup(Player *plr, ObjectGuid plr_gu } // This method should be called when player logs into running battleground -void BattleGround::EventPlayerLoggedIn(Player* player, uint64 plr_guid) +void BattleGround::EventPlayerLoggedIn(Player* player, ObjectGuid plr_guid) { // player is correct pointer - for(std::deque::iterator itr = m_OfflineQueue.begin(); itr != m_OfflineQueue.end(); ++itr) + for(OfflineQueue::iterator itr = m_OfflineQueue.begin(); itr != m_OfflineQueue.end(); ++itr) { if (*itr == plr_guid) { @@ -1288,12 +1293,12 @@ void BattleGround::EventPlayerLoggedIn(Player* player, uint64 plr_guid) void BattleGround::EventPlayerLoggedOut(Player* player) { // player is correct pointer, it is checked in WorldSession::LogoutPlayer() - m_OfflineQueue.push_back(player->GetGUID()); - m_Players[player->GetGUID()].OfflineRemoveTime = sWorld.GetGameTime() + MAX_OFFLINE_TIME; + m_OfflineQueue.push_back(player->GetObjectGuid()); + m_Players[player->GetObjectGuid()].OfflineRemoveTime = sWorld.GetGameTime() + MAX_OFFLINE_TIME; if (GetStatus() == STATUS_IN_PROGRESS) { // drop flag and handle other cleanups - RemovePlayer(player, player->GetGUID()); + RemovePlayer(player, player->GetObjectGuid()); // 1 player is logging out, if it is the last, then end arena! if (isArena()) @@ -1347,7 +1352,7 @@ bool BattleGround::HasFreeSlots() const void BattleGround::UpdatePlayerScore(Player *Source, uint32 type, uint32 value) { //this procedure is called from virtual function implemented in bg subclass - BattleGroundScoreMap::const_iterator itr = m_PlayerScores.find(Source->GetGUID()); + BattleGroundScoreMap::const_iterator itr = m_PlayerScores.find(Source->GetObjectGuid()); if(itr == m_PlayerScores.end()) // player not found... return; @@ -1751,7 +1756,7 @@ void BattleGround::HandleKillPlayer( Player *player, Player *killer ) // return the player's team based on battlegroundplayer info // used in same faction arena matches mainly -Team BattleGround::GetPlayerTeam(uint64 guid) +Team BattleGround::GetPlayerTeam(ObjectGuid guid) { BattleGroundPlayerMap::const_iterator itr = m_Players.find(guid); if (itr != m_Players.end()) @@ -1759,7 +1764,7 @@ Team BattleGround::GetPlayerTeam(uint64 guid) return TEAM_NONE; } -bool BattleGround::IsPlayerInBattleGround(uint64 guid) +bool BattleGround::IsPlayerInBattleGround(ObjectGuid guid) { BattleGroundPlayerMap::const_iterator itr = m_Players.find(guid); if (itr != m_Players.end()) diff --git a/src/game/BattleGround.h b/src/game/BattleGround.h index e4c9e1f15..dd8be8e75 100644 --- a/src/game/BattleGround.h +++ b/src/game/BattleGround.h @@ -375,11 +375,11 @@ class BattleGround bool isBattleGround() const { return !m_IsArena; } bool isRated() const { return m_IsRated; } - typedef std::map BattleGroundPlayerMap; + typedef std::map BattleGroundPlayerMap; BattleGroundPlayerMap const& GetPlayers() const { return m_Players; } uint32 GetPlayersSize() const { return m_Players.size(); } - typedef std::map BattleGroundScoreMap; + typedef std::map BattleGroundScoreMap; BattleGroundScoreMap::const_iterator GetPlayerScoresBegin() const { return m_PlayerScores.begin(); } BattleGroundScoreMap::const_iterator GetPlayerScoresEnd() const { return m_PlayerScores.end(); } uint32 GetPlayerScoresSize() const { return m_PlayerScores.size(); } @@ -475,7 +475,7 @@ class BattleGround virtual void EventPlayerDroppedFlag(Player* /*player*/) {} virtual void EventPlayerClickedOnFlag(Player* /*player*/, GameObject* /*target_obj*/) {} virtual void EventPlayerCapturedFlag(Player* /*player*/) {} - void EventPlayerLoggedIn(Player* player, uint64 plr_guid); + void EventPlayerLoggedIn(Player* player, ObjectGuid plr_guid); void EventPlayerLoggedOut(Player* player); /* Death related */ @@ -485,7 +485,7 @@ class BattleGround void AddOrSetPlayerToCorrectBgGroup(Player *plr, ObjectGuid plr_guid, Team team); - virtual void RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPacket); + virtual void RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool SendPacket); // can be extended in in BG subclass /* event related */ @@ -524,10 +524,10 @@ class BattleGround virtual bool HandlePlayerUnderMap(Player * /*plr*/) { return false; } // since arenas can be AvA or Hvh, we have to get the "temporary" team of a player - Team GetPlayerTeam(uint64 guid); + Team GetPlayerTeam(ObjectGuid guid); static Team GetOtherTeam(Team team){ return team ? ((team == ALLIANCE) ? HORDE : ALLIANCE) : TEAM_NONE; } static BattleGroundTeamIndex GetOtherTeamIndex(BattleGroundTeamIndex teamIdx){ return teamIdx == BG_TEAM_ALLIANCE ? BG_TEAM_HORDE : BG_TEAM_ALLIANCE; } - bool IsPlayerInBattleGround(uint64 guid); + bool IsPlayerInBattleGround(ObjectGuid guid); /* virtual score-array - get's used in bg-subclasses */ int32 m_TeamScores[BG_TEAMS_COUNT]; @@ -557,7 +557,7 @@ class BattleGround BattleGroundScoreMap m_PlayerScores; // Player scores // must be implemented in BG subclass - virtual void RemovePlayer(Player * /*player*/, uint64 /*guid*/) {} + virtual void RemovePlayer(Player * /*player*/, ObjectGuid /*guid*/) {} /* Player lists, those need to be accessible by inherited classes */ BattleGroundPlayerMap m_Players; @@ -592,8 +592,8 @@ class BattleGround char const *m_Name; /* Player lists */ - std::vector m_ResurrectQueue; // Player GUID - std::deque m_OfflineQueue; // Player GUID + typedef std::deque OfflineQueue; + OfflineQueue m_OfflineQueue; // Player GUID /* Invited counters are useful for player invitation to BG - do not allow, if BG is started to one faction to have 2 more players than another faction */ /* Invited counters will be changed only when removing already invited player from queue, removing player from battleground and inviting player to BG */ diff --git a/src/game/BattleGroundAA.cpp b/src/game/BattleGroundAA.cpp index 8b06b1b88..9df5aa9ae 100644 --- a/src/game/BattleGroundAA.cpp +++ b/src/game/BattleGroundAA.cpp @@ -59,10 +59,10 @@ void BattleGroundAA::AddPlayer(Player *plr) //create score and add it to map, default values are set in constructor BattleGroundAAScore* sc = new BattleGroundAAScore; - m_PlayerScores[plr->GetGUID()] = sc; + m_PlayerScores[plr->GetObjectGuid()] = sc; } -void BattleGroundAA::RemovePlayer(Player * /*plr*/, uint64 /*guid*/) +void BattleGroundAA::RemovePlayer(Player * /*plr*/, ObjectGuid /*guid*/) { } diff --git a/src/game/BattleGroundAA.h b/src/game/BattleGroundAA.h index 66fea2148..85a605951 100644 --- a/src/game/BattleGroundAA.h +++ b/src/game/BattleGroundAA.h @@ -42,7 +42,7 @@ class BattleGroundAA : public BattleGround virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); - void RemovePlayer(Player *plr, uint64 guid); + void RemovePlayer(Player *plr, ObjectGuid guid); void HandleAreaTrigger(Player *Source, uint32 Trigger); bool SetupBattleGround(); void HandleKillPlayer(Player* player, Player *killer); diff --git a/src/game/BattleGroundAB.cpp b/src/game/BattleGroundAB.cpp index a39c223db..5c124a019 100644 --- a/src/game/BattleGroundAB.cpp +++ b/src/game/BattleGroundAB.cpp @@ -182,10 +182,10 @@ void BattleGroundAB::AddPlayer(Player *plr) //create score and add it to map, default values are set in the constructor BattleGroundABScore* sc = new BattleGroundABScore; - m_PlayerScores[plr->GetGUID()] = sc; + m_PlayerScores[plr->GetObjectGuid()] = sc; } -void BattleGroundAB::RemovePlayer(Player * /*plr*/, uint64 /*guid*/) +void BattleGroundAB::RemovePlayer(Player * /*plr*/, ObjectGuid /*guid*/) { } @@ -539,7 +539,7 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player) void BattleGroundAB::UpdatePlayerScore(Player *Source, uint32 type, uint32 value) { - BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); + BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetObjectGuid()); if( itr == m_PlayerScores.end() ) // player not found... return; diff --git a/src/game/BattleGroundAB.h b/src/game/BattleGroundAB.h index debe1738d..e13f6d928 100644 --- a/src/game/BattleGroundAB.h +++ b/src/game/BattleGroundAB.h @@ -184,7 +184,7 @@ class BattleGroundAB : public BattleGround void AddPlayer(Player *plr); virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); - void RemovePlayer(Player *plr,uint64 guid); + void RemovePlayer(Player *plr, ObjectGuid guid); void HandleAreaTrigger(Player *Source, uint32 Trigger); virtual bool SetupBattleGround(); virtual void Reset(); diff --git a/src/game/BattleGroundAV.cpp b/src/game/BattleGroundAV.cpp index 43644366e..9392379c1 100644 --- a/src/game/BattleGroundAV.cpp +++ b/src/game/BattleGroundAV.cpp @@ -289,7 +289,7 @@ void BattleGroundAV::AddPlayer(Player *plr) BattleGround::AddPlayer(plr); // create score and add it to map, default values are set in constructor BattleGroundAVScore* sc = new BattleGroundAVScore; - m_PlayerScores[plr->GetGUID()] = sc; + m_PlayerScores[plr->GetObjectGuid()] = sc; } void BattleGroundAV::EndBattleGround(Team winner) @@ -349,7 +349,7 @@ void BattleGroundAV::EndBattleGround(Team winner) BattleGround::EndBattleGround(winner); } -void BattleGroundAV::RemovePlayer(Player* /*plr*/,uint64 /*guid*/) +void BattleGroundAV::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/) { } @@ -389,7 +389,7 @@ void BattleGroundAV::HandleAreaTrigger(Player *Source, uint32 Trigger) void BattleGroundAV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value) { - BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); + BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetObjectGuid()); if(itr == m_PlayerScores.end()) // player not found... return; diff --git a/src/game/BattleGroundAV.h b/src/game/BattleGroundAV.h index d0b58dd60..345ce57f7 100644 --- a/src/game/BattleGroundAV.h +++ b/src/game/BattleGroundAV.h @@ -326,7 +326,7 @@ class BattleGroundAV : public BattleGround // world states virtual void FillInitialWorldStates(WorldPacket& data, uint32& count); - void RemovePlayer(Player *plr,uint64 guid); + void RemovePlayer(Player *plr, ObjectGuid guid); void HandleAreaTrigger(Player *Source, uint32 Trigger); virtual void Reset(); diff --git a/src/game/BattleGroundBE.cpp b/src/game/BattleGroundBE.cpp index 435109960..4d4e31ac0 100644 --- a/src/game/BattleGroundBE.cpp +++ b/src/game/BattleGroundBE.cpp @@ -67,13 +67,13 @@ void BattleGroundBE::AddPlayer(Player *plr) //create score and add it to map, default values are set in constructor BattleGroundBEScore* sc = new BattleGroundBEScore; - m_PlayerScores[plr->GetGUID()] = sc; + m_PlayerScores[plr->GetObjectGuid()] = sc; UpdateWorldState(0x9f1, GetAlivePlayersCountByTeam(ALLIANCE)); UpdateWorldState(0x9f0, GetAlivePlayersCountByTeam(HORDE)); } -void BattleGroundBE::RemovePlayer(Player* /*plr*/, uint64 /*guid*/) +void BattleGroundBE::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/) { if (GetStatus() == STATUS_WAIT_LEAVE) return; @@ -156,12 +156,12 @@ bool BattleGroundBE::SetupBattleGround() void BattleGroundBE::UpdatePlayerScore(Player* Source, uint32 type, uint32 value) { - BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); + BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetObjectGuid()); if(itr == m_PlayerScores.end()) // player not found... return; //there is nothing special in this score - BattleGround::UpdatePlayerScore(Source,type,value); + BattleGround::UpdatePlayerScore(Source, type, value); } diff --git a/src/game/BattleGroundBE.h b/src/game/BattleGroundBE.h index 8b2cc33df..6fedc15f0 100644 --- a/src/game/BattleGroundBE.h +++ b/src/game/BattleGroundBE.h @@ -41,7 +41,7 @@ class BattleGroundBE : public BattleGround virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); - void RemovePlayer(Player *plr, uint64 guid); + void RemovePlayer(Player *plr, ObjectGuid guid); void HandleAreaTrigger(Player *Source, uint32 Trigger); bool SetupBattleGround(); virtual void Reset(); diff --git a/src/game/BattleGroundDS.cpp b/src/game/BattleGroundDS.cpp index e6a298d90..a2efe1688 100644 --- a/src/game/BattleGroundDS.cpp +++ b/src/game/BattleGroundDS.cpp @@ -59,10 +59,10 @@ void BattleGroundDS::AddPlayer(Player *plr) //create score and add it to map, default values are set in constructor BattleGroundDSScore* sc = new BattleGroundDSScore; - m_PlayerScores[plr->GetGUID()] = sc; + m_PlayerScores[plr->GetObjectGuid()] = sc; } -void BattleGroundDS::RemovePlayer(Player * /*plr*/, uint64 /*guid*/) +void BattleGroundDS::RemovePlayer(Player * /*plr*/, ObjectGuid /*guid*/) { } diff --git a/src/game/BattleGroundDS.h b/src/game/BattleGroundDS.h index 003422663..96a023279 100644 --- a/src/game/BattleGroundDS.h +++ b/src/game/BattleGroundDS.h @@ -42,7 +42,7 @@ class BattleGroundDS : public BattleGround virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); - void RemovePlayer(Player *plr, uint64 guid); + void RemovePlayer(Player *plr, ObjectGuid guid); void HandleAreaTrigger(Player *Source, uint32 Trigger); bool SetupBattleGround(); void HandleKillPlayer(Player* player, Player *killer); diff --git a/src/game/BattleGroundEY.cpp b/src/game/BattleGroundEY.cpp index a8be71d28..b16bdee9b 100644 --- a/src/game/BattleGroundEY.cpp +++ b/src/game/BattleGroundEY.cpp @@ -134,7 +134,7 @@ void BattleGroundEY::CheckSomeoneJoinedPoint() Player *plr = sObjectMgr.GetPlayer(m_PlayersNearPoint[BG_EY_PLAYERS_OUT_OF_POINTS][j]); if (!plr) { - sLog.outError("BattleGroundEY:CheckSomeoneJoinedPoint: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[BG_EY_PLAYERS_OUT_OF_POINTS][j])); + sLog.outError("BattleGroundEY:CheckSomeoneJoinedPoint: %s not found!", m_PlayersNearPoint[BG_EY_PLAYERS_OUT_OF_POINTS][j].GetString().c_str()); ++j; continue; } @@ -170,7 +170,7 @@ void BattleGroundEY::CheckSomeoneLeftPoint() Player *plr = sObjectMgr.GetPlayer(m_PlayersNearPoint[i][j]); if (!plr) { - sLog.outError("BattleGroundEY:CheckSomeoneLeftPoint Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[i][j])); + sLog.outError("BattleGroundEY:CheckSomeoneLeftPoint %s not found!", m_PlayersNearPoint[i][j].GetString().c_str()); //move nonexistent player to "free space" - this will cause many error showing in log, but it is a very important bug m_PlayersNearPoint[BG_EY_PLAYERS_OUT_OF_POINTS].push_back(m_PlayersNearPoint[i][j]); m_PlayersNearPoint[i].erase(m_PlayersNearPoint[i].begin() + j); @@ -222,8 +222,7 @@ void BattleGroundEY::UpdatePointStatuses() for (uint8 i = 0; i < m_PlayersNearPoint[point].size(); ++i) { - Player *plr = sObjectMgr.GetPlayer(m_PlayersNearPoint[point][i]); - if (plr) + if (Player *plr = sObjectMgr.GetPlayer(m_PlayersNearPoint[point][i])) { UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[point], plr); //if point owner changed we must evoke event! @@ -307,12 +306,12 @@ void BattleGroundEY::AddPlayer(Player *plr) //create score and add it to map BattleGroundEYScore* sc = new BattleGroundEYScore; - m_PlayersNearPoint[BG_EY_PLAYERS_OUT_OF_POINTS].push_back(plr->GetGUID()); + m_PlayersNearPoint[BG_EY_PLAYERS_OUT_OF_POINTS].push_back(plr->GetObjectGuid()); - m_PlayerScores[plr->GetGUID()] = sc; + m_PlayerScores[plr->GetObjectGuid()] = sc; } -void BattleGroundEY::RemovePlayer(Player *plr, uint64 guid) +void BattleGroundEY::RemovePlayer(Player *plr, ObjectGuid guid) { // sometimes flag aura not removed :( for (int j = BG_EY_NODES_MAX; j >= 0; --j) @@ -329,7 +328,7 @@ void BattleGroundEY::RemovePlayer(Player *plr, uint64 guid) EventPlayerDroppedFlag(plr); else { - SetFlagPicker(0); + ClearFlagPicker(); RespawnFlag(true); } } @@ -348,22 +347,22 @@ void BattleGroundEY::HandleAreaTrigger(Player *Source, uint32 Trigger) { case TR_BLOOD_ELF_POINT: if (m_PointState[BG_EY_NODE_BLOOD_ELF] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BG_EY_NODE_BLOOD_ELF] == Source->GetTeam()) - if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID()) + if (m_FlagState && GetFlagPickerGuid() == Source->GetObjectGuid()) EventPlayerCapturedFlag(Source, BG_EY_NODE_BLOOD_ELF); break; case TR_FEL_REAVER_POINT: if (m_PointState[BG_EY_NODE_FEL_REAVER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BG_EY_NODE_FEL_REAVER] == Source->GetTeam()) - if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID()) + if (m_FlagState && GetFlagPickerGuid() == Source->GetObjectGuid()) EventPlayerCapturedFlag(Source, BG_EY_NODE_FEL_REAVER); break; case TR_MAGE_TOWER_POINT: if (m_PointState[BG_EY_NODE_MAGE_TOWER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BG_EY_NODE_MAGE_TOWER] == Source->GetTeam()) - if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID()) + if (m_FlagState && GetFlagPickerGuid() == Source->GetObjectGuid()) EventPlayerCapturedFlag(Source, BG_EY_NODE_MAGE_TOWER); break; case TR_DRAENEI_RUINS_POINT: if (m_PointState[BG_EY_NODE_DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BG_EY_NODE_DRAENEI_RUINS] == Source->GetTeam()) - if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID()) + if (m_FlagState && GetFlagPickerGuid() == Source->GetObjectGuid()) EventPlayerCapturedFlag(Source, BG_EY_NODE_DRAENEI_RUINS); break; case 4512: @@ -418,7 +417,7 @@ void BattleGroundEY::Reset() m_HonorScoreTics[BG_TEAM_ALLIANCE] = 0; m_HonorScoreTics[BG_TEAM_HORDE] = 0; m_FlagState = BG_EY_FLAG_STATE_ON_BASE; - m_FlagKeeper = 0; + m_FlagKeeper.Clear(); m_DroppedFlagGUID = 0; m_PointAddingTimer = 0; m_TowerCapCheckTimer = 0; @@ -484,9 +483,9 @@ void BattleGroundEY::EventPlayerDroppedFlag(Player *Source) { // if not running, do not cast things at the dropper player, neither send unnecessary messages // just take off the aura - if (IsFlagPickedup() && GetFlagPickerGUID() == Source->GetGUID()) + if (IsFlagPickedup() && GetFlagPickerGuid() == Source->GetObjectGuid()) { - SetFlagPicker(0); + ClearFlagPicker(); Source->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL); } return; @@ -495,10 +494,10 @@ void BattleGroundEY::EventPlayerDroppedFlag(Player *Source) if (!IsFlagPickedup()) return; - if (GetFlagPickerGUID() != Source->GetGUID()) + if (GetFlagPickerGuid() != Source->GetObjectGuid()) return; - SetFlagPicker(0); + ClearFlagPicker(); Source->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL); m_FlagState = BG_EY_FLAG_STATE_ON_GROUND; m_FlagsTimer = BG_EY_FLAG_RESPAWN_TIME; @@ -537,7 +536,7 @@ void BattleGroundEY::EventPlayerClickedOnFlag(Player *Source, GameObject* target // despawn center-flag SpawnEvent(BG_EY_EVENT_CAPTURE_FLAG, BG_EY_EVENT2_FLAG_CENTER, false); - SetFlagPicker(Source->GetGUID()); + SetFlagPicker(Source->GetObjectGuid()); //get flag aura on player Source->CastSpell(Source, BG_EY_NETHERSTORM_FLAG_SPELL, true); Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); @@ -608,10 +607,10 @@ void BattleGroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point) void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, BG_EY_Nodes node) { - if (GetStatus() != STATUS_IN_PROGRESS || GetFlagPickerGUID() != Source->GetGUID()) + if (GetStatus() != STATUS_IN_PROGRESS || GetFlagPickerGuid() != Source->GetObjectGuid()) return; - SetFlagPicker(0); + ClearFlagPicker(); m_FlagState = BG_EY_FLAG_STATE_WAIT_RESPAWN; Source->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL); @@ -646,7 +645,7 @@ void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, BG_EY_Nodes node) void BattleGroundEY::UpdatePlayerScore(Player *Source, uint32 type, uint32 value) { - BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); + BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetObjectGuid()); if(itr == m_PlayerScores.end()) // player not found return; diff --git a/src/game/BattleGroundEY.h b/src/game/BattleGroundEY.h index 6f2403de2..ae53d6354 100644 --- a/src/game/BattleGroundEY.h +++ b/src/game/BattleGroundEY.h @@ -254,14 +254,15 @@ class BattleGroundEY : public BattleGround virtual void StartingEventOpenDoors(); /* BG Flags */ - uint64 GetFlagPickerGUID() const { return m_FlagKeeper; } - void SetFlagPicker(uint64 guid) { m_FlagKeeper = guid; } - bool IsFlagPickedup() const { return m_FlagKeeper != 0; } + ObjectGuid const& GetFlagPickerGuid() const { return m_FlagKeeper; } + void SetFlagPicker(ObjectGuid guid) { m_FlagKeeper = guid; } + void ClearFlagPicker() { m_FlagKeeper.Clear(); } + bool IsFlagPickedup() const { return !m_FlagKeeper.IsEmpty(); } uint8 GetFlagState() const { return m_FlagState; } void RespawnFlag(bool send_message); void RespawnFlagAfterDrop(); - void RemovePlayer(Player *plr,uint64 guid); + void RemovePlayer(Player *plr, ObjectGuid guid); void HandleBuffUse(uint64 const& buff_guid); void HandleAreaTrigger(Player *Source, uint32 Trigger); void HandleKillPlayer(Player *player, Player *killer); @@ -306,7 +307,7 @@ class BattleGroundEY : public BattleGround uint32 m_Points_Trigger[BG_EY_NODES_MAX]; - uint64 m_FlagKeeper; // keepers guid + ObjectGuid m_FlagKeeper; // keepers guid uint64 m_DroppedFlagGUID; uint8 m_FlagState; // for checking flag state int32 m_FlagsTimer; @@ -315,7 +316,7 @@ class BattleGroundEY : public BattleGround Team m_PointOwnedByTeam[BG_EY_NODES_MAX]; uint8 m_PointState[BG_EY_NODES_MAX]; int32 m_PointBarStatus[BG_EY_NODES_MAX]; - typedef std::vector PlayersNearPointType; + typedef std::vector PlayersNearPointType; PlayersNearPointType m_PlayersNearPoint[BG_EY_NODES_MAX_WITH_SPEIAL]; uint8 m_CurrentPointPlayersCount[2*BG_EY_NODES_MAX]; diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp index 77be7c0b8..3adbf3830 100644 --- a/src/game/BattleGroundHandler.cpp +++ b/src/game/BattleGroundHandler.cpp @@ -229,11 +229,11 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv uint32 count1 = 0; // always constant zero? uint32 count2 = 0; // count of next fields - Player *ali_plr = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetAllianceFlagPickerGUID()); + Player *ali_plr = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetAllianceFlagPickerGuid()); if (ali_plr) ++count2; - Player *horde_plr = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetHordeFlagPickerGUID()); + Player *horde_plr = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetHordeFlagPickerGuid()); if (horde_plr) ++count2; @@ -430,7 +430,7 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data ) // this is still needed here if battleground "jumping" shouldn't add deserter debuff // also this is required to prevent stuck at old battleground after SetBattleGroundId set to new if (BattleGround *currentBg = _player->GetBattleGround()) - currentBg->RemovePlayerAtLeave(_player->GetGUID(), false, true); + currentBg->RemovePlayerAtLeave(_player->GetObjectGuid(), false, true); // set the destination instance id _player->SetBattleGroundId(bg->GetInstanceID(), bgTypeId); diff --git a/src/game/BattleGroundIC.cpp b/src/game/BattleGroundIC.cpp index 6548ca741..4166638f3 100644 --- a/src/game/BattleGroundIC.cpp +++ b/src/game/BattleGroundIC.cpp @@ -54,10 +54,10 @@ void BattleGroundIC::AddPlayer(Player *plr) //create score and add it to map, default values are set in constructor BattleGroundICScore* sc = new BattleGroundICScore; - m_PlayerScores[plr->GetGUID()] = sc; + m_PlayerScores[plr->GetObjectGuid()] = sc; } -void BattleGroundIC::RemovePlayer(Player* /*plr*/,uint64 /*guid*/) +void BattleGroundIC::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/) { } @@ -72,7 +72,7 @@ void BattleGroundIC::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/) void BattleGroundIC::UpdatePlayerScore(Player* Source, uint32 type, uint32 value) { - std::map::iterator itr = m_PlayerScores.find(Source->GetGUID()); + BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetObjectGuid()); if(itr == m_PlayerScores.end()) // player not found... return; diff --git a/src/game/BattleGroundIC.h b/src/game/BattleGroundIC.h index 8a5238865..ab4c4513b 100644 --- a/src/game/BattleGroundIC.h +++ b/src/game/BattleGroundIC.h @@ -42,7 +42,7 @@ class BattleGroundIC : public BattleGround virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); - void RemovePlayer(Player *plr,uint64 guid); + void RemovePlayer(Player *plr, ObjectGuid guid); void HandleAreaTrigger(Player *Source, uint32 Trigger); //bool SetupBattleGround(); diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index fc1c96e39..61f4bc06c 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -1303,7 +1303,7 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg) for(BattleGround::BattleGroundScoreMap::const_iterator itr = bg->GetPlayerScoresBegin(); itr != bg->GetPlayerScoresEnd(); ++itr) { - *data << (uint64)itr->first; + *data << ObjectGuid(itr->first); *data << (int32)itr->second->KillingBlows; if (type == 0) { @@ -1388,10 +1388,10 @@ void BattleGroundMgr::BuildPlaySoundPacket(WorldPacket *data, uint32 soundid) *data << uint32(soundid); } -void BattleGroundMgr::BuildPlayerLeftBattleGroundPacket(WorldPacket *data, const uint64& guid) +void BattleGroundMgr::BuildPlayerLeftBattleGroundPacket(WorldPacket *data, ObjectGuid guid) { data->Initialize(SMSG_BATTLEGROUND_PLAYER_LEFT, 8); - *data << uint64(guid); + *data << ObjectGuid(guid); } void BattleGroundMgr::BuildPlayerJoinedBattleGroundPacket(WorldPacket *data, Player *plr) diff --git a/src/game/BattleGroundMgr.h b/src/game/BattleGroundMgr.h index d89fdf94e..e3fb18dd3 100644 --- a/src/game/BattleGroundMgr.h +++ b/src/game/BattleGroundMgr.h @@ -191,7 +191,7 @@ class BattleGroundMgr /* Packet Building */ void BuildPlayerJoinedBattleGroundPacket(WorldPacket *data, Player *plr); - void BuildPlayerLeftBattleGroundPacket(WorldPacket *data, const uint64& guid); + void BuildPlayerLeftBattleGroundPacket(WorldPacket *data, ObjectGuid guid); void BuildBattleGroundListPacket(WorldPacket *data, ObjectGuid guid, Player *plr, BattleGroundTypeId bgTypeId, uint8 fromWhere); void BuildGroupJoinedBattlegroundPacket(WorldPacket *data, GroupJoinBattlegroundResult result); void BuildUpdateWorldStatePacket(WorldPacket *data, uint32 field, uint32 value); diff --git a/src/game/BattleGroundNA.cpp b/src/game/BattleGroundNA.cpp index 336dca557..4d625460a 100644 --- a/src/game/BattleGroundNA.cpp +++ b/src/game/BattleGroundNA.cpp @@ -67,13 +67,13 @@ void BattleGroundNA::AddPlayer(Player *plr) //create score and add it to map, default values are set in constructor BattleGroundNAScore* sc = new BattleGroundNAScore; - m_PlayerScores[plr->GetGUID()] = sc; + m_PlayerScores[plr->GetObjectGuid()] = sc; UpdateWorldState(0xa0f, GetAlivePlayersCountByTeam(ALLIANCE)); UpdateWorldState(0xa10, GetAlivePlayersCountByTeam(HORDE)); } -void BattleGroundNA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/) +void BattleGroundNA::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/) { if (GetStatus() == STATUS_WAIT_LEAVE) return; diff --git a/src/game/BattleGroundNA.h b/src/game/BattleGroundNA.h index cc8cdad56..b6c49feee 100644 --- a/src/game/BattleGroundNA.h +++ b/src/game/BattleGroundNA.h @@ -42,7 +42,7 @@ class BattleGroundNA : public BattleGround virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); - void RemovePlayer(Player *plr, uint64 guid); + void RemovePlayer(Player *plr, ObjectGuid guid); void HandleAreaTrigger(Player *Source, uint32 Trigger); bool SetupBattleGround(); virtual void Reset(); diff --git a/src/game/BattleGroundRB.cpp b/src/game/BattleGroundRB.cpp index a596631fe..ff1ee64a0 100644 --- a/src/game/BattleGroundRB.cpp +++ b/src/game/BattleGroundRB.cpp @@ -54,10 +54,10 @@ void BattleGroundRB::AddPlayer(Player *plr) //create score and add it to map, default values are set in constructor BattleGroundABGScore* sc = new BattleGroundABGScore; - m_PlayerScores[plr->GetGUID()] = sc; + m_PlayerScores[plr->GetObjectGuid()] = sc; } -void BattleGroundRB::RemovePlayer(Player* /*plr*/,uint64 /*guid*/) +void BattleGroundRB::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/) { } @@ -72,7 +72,7 @@ void BattleGroundRB::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/) void BattleGroundRB::UpdatePlayerScore(Player* Source, uint32 type, uint32 value) { - std::map::iterator itr = m_PlayerScores.find(Source->GetGUID()); + BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetObjectGuid()); if(itr == m_PlayerScores.end()) // player not found... return; diff --git a/src/game/BattleGroundRB.h b/src/game/BattleGroundRB.h index b99ff9c8e..7f83944b5 100644 --- a/src/game/BattleGroundRB.h +++ b/src/game/BattleGroundRB.h @@ -42,7 +42,7 @@ class BattleGroundRB : public BattleGround virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); - void RemovePlayer(Player *plr,uint64 guid); + void RemovePlayer(Player *plr, ObjectGuid guid); void HandleAreaTrigger(Player *Source, uint32 Trigger); //bool SetupBattleGround(); diff --git a/src/game/BattleGroundRL.cpp b/src/game/BattleGroundRL.cpp index d54a1195e..ea89f819f 100644 --- a/src/game/BattleGroundRL.cpp +++ b/src/game/BattleGroundRL.cpp @@ -67,13 +67,13 @@ void BattleGroundRL::AddPlayer(Player *plr) //create score and add it to map, default values are set in constructor BattleGroundRLScore* sc = new BattleGroundRLScore; - m_PlayerScores[plr->GetGUID()] = sc; + m_PlayerScores[plr->GetObjectGuid()] = sc; UpdateWorldState(0xbb8, GetAlivePlayersCountByTeam(ALLIANCE)); UpdateWorldState(0xbb9, GetAlivePlayersCountByTeam(HORDE)); } -void BattleGroundRL::RemovePlayer(Player* /*plr*/, uint64 /*guid*/) +void BattleGroundRL::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/) { if (GetStatus() == STATUS_WAIT_LEAVE) return; diff --git a/src/game/BattleGroundRL.h b/src/game/BattleGroundRL.h index 8766a5b1e..59b911e77 100644 --- a/src/game/BattleGroundRL.h +++ b/src/game/BattleGroundRL.h @@ -44,7 +44,7 @@ class BattleGroundRL : public BattleGround virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); - void RemovePlayer(Player *plr, uint64 guid); + void RemovePlayer(Player *plr, ObjectGuid guid); void HandleAreaTrigger(Player *Source, uint32 Trigger); bool SetupBattleGround(); void HandleKillPlayer(Player* player, Player *killer); diff --git a/src/game/BattleGroundRV.cpp b/src/game/BattleGroundRV.cpp index e54e4dba4..4be6fbd22 100644 --- a/src/game/BattleGroundRV.cpp +++ b/src/game/BattleGroundRV.cpp @@ -59,10 +59,10 @@ void BattleGroundRV::AddPlayer(Player *plr) //create score and add it to map, default values are set in constructor BattleGroundRVScore* sc = new BattleGroundRVScore; - m_PlayerScores[plr->GetGUID()] = sc; + m_PlayerScores[plr->GetObjectGuid()] = sc; } -void BattleGroundRV::RemovePlayer(Player * /*plr*/, uint64 /*guid*/) +void BattleGroundRV::RemovePlayer(Player * /*plr*/, ObjectGuid /*guid*/) { } diff --git a/src/game/BattleGroundRV.h b/src/game/BattleGroundRV.h index d53dd23b8..cb96b7491 100644 --- a/src/game/BattleGroundRV.h +++ b/src/game/BattleGroundRV.h @@ -42,7 +42,7 @@ class BattleGroundRV : public BattleGround virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); - void RemovePlayer(Player *plr, uint64 guid); + void RemovePlayer(Player *plr, ObjectGuid guid); void HandleAreaTrigger(Player *Source, uint32 Trigger); bool SetupBattleGround(); void HandleKillPlayer(Player* player, Player *killer); diff --git a/src/game/BattleGroundSA.cpp b/src/game/BattleGroundSA.cpp index f0012cc79..35ec56eae 100644 --- a/src/game/BattleGroundSA.cpp +++ b/src/game/BattleGroundSA.cpp @@ -54,10 +54,10 @@ void BattleGroundSA::AddPlayer(Player *plr) //create score and add it to map, default values are set in constructor BattleGroundSAScore* sc = new BattleGroundSAScore; - m_PlayerScores[plr->GetGUID()] = sc; + m_PlayerScores[plr->GetObjectGuid()] = sc; } -void BattleGroundSA::RemovePlayer(Player* /*plr*/,uint64 /*guid*/) +void BattleGroundSA::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/) { } @@ -72,7 +72,7 @@ void BattleGroundSA::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/) void BattleGroundSA::UpdatePlayerScore(Player* Source, uint32 type, uint32 value) { - BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); + BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetObjectGuid()); if(itr == m_PlayerScores.end()) // player not found... return; diff --git a/src/game/BattleGroundSA.h b/src/game/BattleGroundSA.h index 31a3ffac0..83dbd6854 100644 --- a/src/game/BattleGroundSA.h +++ b/src/game/BattleGroundSA.h @@ -42,7 +42,7 @@ class BattleGroundSA : public BattleGround virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); - void RemovePlayer(Player *plr,uint64 guid); + void RemovePlayer(Player *plr, ObjectGuid guid); void HandleAreaTrigger(Player *Source, uint32 Trigger); //bool SetupBattleGround(); diff --git a/src/game/BattleGroundWS.cpp b/src/game/BattleGroundWS.cpp index 43ea99e7c..e161db6b8 100644 --- a/src/game/BattleGroundWS.cpp +++ b/src/game/BattleGroundWS.cpp @@ -135,7 +135,7 @@ void BattleGroundWS::AddPlayer(Player *plr) //create score and add it to map, default values are set in constructor BattleGroundWGScore* sc = new BattleGroundWGScore; - m_PlayerScores[plr->GetGUID()] = sc; + m_PlayerScores[plr->GetObjectGuid()] = sc; } void BattleGroundWS::RespawnFlag(Team team, bool captured) @@ -199,7 +199,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source) { if (!IsHordeFlagPickedup()) return; - SetHordeFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time + ClearHordeFlagPicker(); // must be before aura remove to prevent 2 events (drop+capture) at the same time // horde flag in base (but not respawned yet) m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN; // Drop Horde Flag from Player @@ -213,7 +213,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source) { if (!IsAllianceFlagPickedup()) return; - SetAllianceFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time + ClearAllianceFlagPicker(); // must be before aura remove to prevent 2 events (drop+capture) at the same time // alliance flag in base (but not respawned yet) m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN; // Drop Alliance Flag from Player @@ -269,21 +269,21 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source) // just take off the aura if (Source->GetTeam() == ALLIANCE) { - if (!this->IsHordeFlagPickedup()) + if (!IsHordeFlagPickedup()) return; - if (GetHordeFlagPickerGUID() == Source->GetGUID()) + if (GetHordeFlagPickerGuid() == Source->GetObjectGuid()) { - SetHordeFlagPicker(0); + ClearHordeFlagPicker(); Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG); } } else { - if (!this->IsAllianceFlagPickedup()) + if (!IsAllianceFlagPickedup()) return; - if (GetAllianceFlagPickerGUID() == Source->GetGUID()) + if (GetAllianceFlagPickerGuid() == Source->GetObjectGuid()) { - SetAllianceFlagPicker(0); + ClearAllianceFlagPicker(); Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG); } } @@ -296,9 +296,9 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source) { if (!IsHordeFlagPickedup()) return; - if (GetHordeFlagPickerGUID() == Source->GetGUID()) + if (GetHordeFlagPickerGuid() == Source->GetObjectGuid()) { - SetHordeFlagPicker(0); + ClearHordeFlagPicker(); Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG); m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_GROUND; Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG_DROPPED, true); @@ -309,9 +309,9 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source) { if (!IsAllianceFlagPickedup()) return; - if (GetAllianceFlagPickerGUID() == Source->GetGUID()) + if (GetAllianceFlagPickerGuid() == Source->GetObjectGuid()) { - SetAllianceFlagPicker(0); + ClearAllianceFlagPicker(); Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG); m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_GROUND; Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG_DROPPED, true); @@ -444,7 +444,7 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); } -void BattleGroundWS::RemovePlayer(Player *plr, uint64 guid) +void BattleGroundWS::RemovePlayer(Player *plr, ObjectGuid guid) { // sometimes flag aura not removed :( if (IsAllianceFlagPickedup() && m_FlagKeepers[BG_TEAM_ALLIANCE] == guid) @@ -452,7 +452,7 @@ void BattleGroundWS::RemovePlayer(Player *plr, uint64 guid) if (!plr) { sLog.outError("BattleGroundWS: Removing offline player who has the FLAG!!"); - SetAllianceFlagPicker(0); + ClearAllianceFlagPicker(); RespawnFlag(ALLIANCE, false); } else @@ -463,7 +463,7 @@ void BattleGroundWS::RemovePlayer(Player *plr, uint64 guid) if (!plr) { sLog.outError("BattleGroundWS: Removing offline player who has the FLAG!!"); - SetHordeFlagPicker(0); + ClearHordeFlagPicker(); RespawnFlag(HORDE, false); } else @@ -506,12 +506,12 @@ void BattleGroundWS::HandleAreaTrigger(Player *Source, uint32 Trigger) break; case 3646: // Alliance Flag spawn if (m_FlagState[BG_TEAM_HORDE] && !m_FlagState[BG_TEAM_ALLIANCE]) - if (GetHordeFlagPickerGUID() == Source->GetGUID()) + if (GetHordeFlagPickerGuid() == Source->GetObjectGuid()) EventPlayerCapturedFlag(Source); break; case 3647: // Horde Flag spawn if (m_FlagState[BG_TEAM_ALLIANCE] && !m_FlagState[BG_TEAM_HORDE]) - if (GetAllianceFlagPickerGUID() == Source->GetGUID()) + if (GetAllianceFlagPickerGuid() == Source->GetObjectGuid()) EventPlayerCapturedFlag(Source); break; case 3649: // unk1 @@ -544,7 +544,7 @@ void BattleGroundWS::Reset() for(uint32 i = 0; i < BG_TEAMS_COUNT; ++i) { m_DroppedFlagGUID[i] = 0; - m_FlagKeepers[i] = 0; + m_FlagKeepers[i].Clear(); m_FlagState[i] = BG_WS_FLAG_STATE_ON_BASE; m_TeamScores[i] = 0; } @@ -584,7 +584,7 @@ void BattleGroundWS::HandleKillPlayer(Player *player, Player *killer) void BattleGroundWS::UpdatePlayerScore(Player *Source, uint32 type, uint32 value) { - BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); + BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetObjectGuid()); if(itr == m_PlayerScores.end()) // player not found return; diff --git a/src/game/BattleGroundWS.h b/src/game/BattleGroundWS.h index 334d65782..b0563a06b 100644 --- a/src/game/BattleGroundWS.h +++ b/src/game/BattleGroundWS.h @@ -109,12 +109,14 @@ class BattleGroundWS : public BattleGround virtual void StartingEventOpenDoors(); /* BG Flags */ - uint64 GetAllianceFlagPickerGUID() const { return m_FlagKeepers[BG_TEAM_ALLIANCE]; } - uint64 GetHordeFlagPickerGUID() const { return m_FlagKeepers[BG_TEAM_HORDE]; } - void SetAllianceFlagPicker(uint64 guid) { m_FlagKeepers[BG_TEAM_ALLIANCE] = guid; } - void SetHordeFlagPicker(uint64 guid) { m_FlagKeepers[BG_TEAM_HORDE] = guid; } - bool IsAllianceFlagPickedup() const { return m_FlagKeepers[BG_TEAM_ALLIANCE] != 0; } - bool IsHordeFlagPickedup() const { return m_FlagKeepers[BG_TEAM_HORDE] != 0; } + ObjectGuid GetAllianceFlagPickerGuid() const{ return m_FlagKeepers[BG_TEAM_ALLIANCE]; } + ObjectGuid GetHordeFlagPickerGuid() const { return m_FlagKeepers[BG_TEAM_HORDE]; } + void SetAllianceFlagPicker(ObjectGuid guid) { m_FlagKeepers[BG_TEAM_ALLIANCE] = guid; } + void SetHordeFlagPicker(ObjectGuid guid) { m_FlagKeepers[BG_TEAM_HORDE] = guid; } + void ClearAllianceFlagPicker() { m_FlagKeepers[BG_TEAM_ALLIANCE].Clear(); } + void ClearHordeFlagPicker() { m_FlagKeepers[BG_TEAM_HORDE].Clear(); } + bool IsAllianceFlagPickedup() const { return !m_FlagKeepers[BG_TEAM_ALLIANCE].IsEmpty(); } + bool IsHordeFlagPickedup() const { return !m_FlagKeepers[BG_TEAM_HORDE].IsEmpty(); } void RespawnFlag(Team team, bool captured); void RespawnFlagAfterDrop(Team team); uint8 GetFlagState(Team team) { return m_FlagState[GetTeamIndexByTeamId(team)]; } @@ -124,7 +126,7 @@ class BattleGroundWS : public BattleGround virtual void EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj); virtual void EventPlayerCapturedFlag(Player *Source); - void RemovePlayer(Player *plr, uint64 guid); + void RemovePlayer(Player *plr, ObjectGuid guid); void HandleAreaTrigger(Player *Source, uint32 Trigger); void HandleKillPlayer(Player *player, Player *killer); bool SetupBattleGround(); @@ -146,7 +148,7 @@ class BattleGroundWS : public BattleGround void SetTeamPoint(Team team, uint32 Points = 0) { m_TeamScores[GetTeamIndexByTeamId(team)] = Points; } void RemovePoint(Team team, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(team)] -= Points; } private: - uint64 m_FlagKeepers[BG_TEAMS_COUNT]; + ObjectGuid m_FlagKeepers[BG_TEAMS_COUNT]; uint64 m_DroppedFlagGUID[BG_TEAMS_COUNT]; uint8 m_FlagState[BG_TEAMS_COUNT]; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index ff91c7e39..75503ca79 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -15249,7 +15249,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) { BattleGround *currentBg = sBattleGroundMgr.GetBattleGround(m_bgData.bgInstanceID, BATTLEGROUND_TYPE_NONE); - bool player_at_bg = currentBg && currentBg->IsPlayerInBattleGround(GetGUID()); + bool player_at_bg = currentBg && currentBg->IsPlayerInBattleGround(GetObjectGuid()); if(player_at_bg && currentBg->GetStatus() != STATUS_WAIT_LEAVE) { @@ -15259,7 +15259,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) m_bgData.bgTypeID = currentBg->GetTypeID(); //join player to battleground group - currentBg->EventPlayerLoggedIn(this, GetGUID()); + currentBg->EventPlayerLoggedIn(this, GetObjectGuid()); currentBg->AddOrSetPlayerToCorrectBgGroup(this, GetObjectGuid(), m_bgData.bgTeam); SetInviteForBattleGroundQueueType(bgQueueTypeId,currentBg->GetInstanceID()); @@ -15268,7 +15268,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) { // leave bg if (player_at_bg) - currentBg->RemovePlayerAtLeave(GetGUID(), false, true); + currentBg->RemovePlayerAtLeave(GetObjectGuid(), false, true); // move to bg enter point const WorldLocation& _loc = GetBattleGroundEntryPoint(); @@ -19300,7 +19300,7 @@ void Player::LeaveBattleground(bool teleportToEntryPoint) { if(BattleGround *bg = GetBattleGround()) { - bg->RemovePlayerAtLeave(GetGUID(), teleportToEntryPoint, true); + bg->RemovePlayerAtLeave(GetObjectGuid(), teleportToEntryPoint, true); // call after remove to be sure that player resurrected for correct cast if( bg->isBattleGround() && !isGameMaster() && sWorld.getConfig(CONFIG_BOOL_BATTLEGROUND_CAST_DESERTER) ) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 9271cbc80..04e17b3ae 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10799" + #define REVISION_NR "10800" #endif // __REVISION_NR_H__