aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Server
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2014-09-14 16:14:12 +0200
committerShauren <shauren.trinity@gmail.com>2014-09-14 16:14:12 +0200
commita0e50ea35fca61447bf07fc45d93c98234ba59f7 (patch)
treeb4ee69a63866f42e466a3c03fc031ce0710ac762 /src/server/game/Server
parentce67a097bf3c0c3241f4441a808e32639ddbaafb (diff)
Core/Entities: Use ObjectGuid class in game project
Diffstat (limited to 'src/server/game/Server')
-rw-r--r--src/server/game/Server/WorldSession.cpp19
-rw-r--r--src/server/game/Server/WorldSession.h61
2 files changed, 38 insertions, 42 deletions
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index 321bc707879..cc5fdcc8ca8 100644
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
@@ -124,7 +124,7 @@ WorldSession::WorldSession(uint32 id, std::shared_ptr<WorldSocket> sock, Account
_RBACData(NULL),
expireTime(60000), // 1 min after socket loss, session is deleted
forceExit(false),
- m_currentBankerGUID(0)
+ m_currentBankerGUID()
{
memset(m_Tutorials, 0, sizeof(m_Tutorials));
@@ -173,7 +173,7 @@ std::string WorldSession::GetPlayerInfo() const
std::ostringstream ss;
ss << "[Player: " << GetPlayerName()
- << " (Guid: " << (_player != NULL ? _player->GetGUID() : 0)
+ << " (Guid: " << (_player != NULL ? _player->GetGUID().ToString() : "")
<< ", Account: " << GetAccountId() << ")]";
return ss.str();
@@ -445,7 +445,7 @@ void WorldSession::LogoutPlayer(bool save)
if (_player)
{
- if (uint64 lguid = _player->GetLootGUID())
+ if (ObjectGuid lguid = _player->GetLootGUID())
DoLootRelease(lguid);
///- If the player just died before logging out, make him appear as a ghost
@@ -512,7 +512,7 @@ void WorldSession::LogoutPlayer(bool save)
for (int j = BUYBACK_SLOT_START; j < BUYBACK_SLOT_END; ++j)
{
eslot = j - BUYBACK_SLOT_START;
- _player->SetUInt64Value(PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), 0);
+ _player->SetGuidValue(PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), ObjectGuid::Empty);
_player->SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, 0);
_player->SetUInt32Value(PLAYER_FIELD_BUYBACK_TIMESTAMP_1 + eslot, 0);
}
@@ -796,8 +796,7 @@ void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo* mi)
if (mi->HasMovementFlag(MOVEMENTFLAG_ONTRANSPORT))
{
- data.readPackGUID(mi->transport.guid);
-
+ data >> mi->transport.guid.ReadAsPacked();
data >> mi->transport.pos.PositionXYZOStream();
data >> mi->transport.time;
data >> mi->transport.seat;
@@ -904,8 +903,7 @@ void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo* mi)
void WorldSession::WriteMovementInfo(WorldPacket* data, MovementInfo* mi)
{
- data->appendPackGUID(mi->guid);
-
+ *data << mi->guid.WriteAsPacked();
*data << mi->flags;
*data << mi->flags2;
*data << mi->time;
@@ -913,8 +911,7 @@ void WorldSession::WriteMovementInfo(WorldPacket* data, MovementInfo* mi)
if (mi->HasMovementFlag(MOVEMENTFLAG_ONTRANSPORT))
{
- data->appendPackGUID(mi->transport.guid);
-
+ *data << mi->transport.guid.WriteAsPacked();
*data << mi->transport.pos.PositionXYZOStream();
*data << mi->transport.time;
*data << mi->transport.seat;
@@ -1148,7 +1145,7 @@ void WorldSession::ProcessQueryCallbacks()
//- SendStabledPet
if (_sendStabledPetCallback.IsReady())
{
- uint64 param = _sendStabledPetCallback.GetParam();
+ ObjectGuid param = _sendStabledPetCallback.GetParam();
_sendStabledPetCallback.GetResult(result);
SendStablePetCallback(result, param);
_sendStabledPetCallback.FreeResult();
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index 2e6a699fc7c..e46a58d5098 100644
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -281,38 +281,37 @@ class WorldSession
/// Handle the authentication waiting queue (to be completed)
void SendAuthWaitQue(uint32 position);
- //void SendTestCreatureQueryOpcode(uint32 entry, uint64 guid, uint32 testvalue);
- void SendNameQueryOpcode(uint64 guid);
-
- void SendTrainerList(uint64 guid);
- void SendTrainerList(uint64 guid, std::string const& strTitle);
- void SendListInventory(uint64 guid);
- void SendShowBank(uint64 guid);
- bool CanOpenMailBox(uint64 guid);
- void SendShowMailBox(uint64 guid);
- void SendTabardVendorActivate(uint64 guid);
+ void SendNameQueryOpcode(ObjectGuid guid);
+
+ void SendTrainerList(ObjectGuid guid);
+ void SendTrainerList(ObjectGuid guid, std::string const& strTitle);
+ void SendListInventory(ObjectGuid guid);
+ void SendShowBank(ObjectGuid guid);
+ bool CanOpenMailBox(ObjectGuid guid);
+ void SendShowMailBox(ObjectGuid guid);
+ void SendTabardVendorActivate(ObjectGuid guid);
void SendSpiritResurrect();
void SendBindPoint(Creature* npc);
void SendAttackStop(Unit const* enemy);
- void SendBattleGroundList(uint64 guid, BattlegroundTypeId bgTypeId = BATTLEGROUND_RB);
+ void SendBattleGroundList(ObjectGuid guid, BattlegroundTypeId bgTypeId = BATTLEGROUND_RB);
void SendTradeStatus(TradeStatusInfo const& status);
void SendUpdateTrade(bool trader_data = true);
void SendCancelTrade();
- void SendPetitionQueryOpcode(uint64 petitionguid);
+ void SendPetitionQueryOpcode(ObjectGuid petitionguid);
// Spell
- void HandleClientCastFlags(WorldPacket& recvPacket, uint8 castFlags, SpellCastTargets & targets);
+ void HandleClientCastFlags(WorldPacket& recvPacket, uint8 castFlags, SpellCastTargets& targets);
// Pet
- void SendPetNameQuery(uint64 guid, uint32 petnumber);
- void SendStablePet(uint64 guid);
- void SendStablePetCallback(PreparedQueryResult result, uint64 guid);
+ void SendPetNameQuery(ObjectGuid guid, uint32 petnumber);
+ void SendStablePet(ObjectGuid guid);
+ void SendStablePetCallback(PreparedQueryResult result, ObjectGuid guid);
void SendStableResult(uint8 guid);
- bool CheckStableMaster(uint64 guid);
+ bool CheckStableMaster(ObjectGuid guid);
// Account Data
AccountData* GetAccountData(AccountDataType type) { return &m_accountData[type]; }
@@ -336,17 +335,17 @@ class WorldSession
//used with item_page table
bool SendItemInfo(uint32 itemid, WorldPacket data);
//auction
- void SendAuctionHello(uint64 guid, Creature* unit);
+ void SendAuctionHello(ObjectGuid guid, Creature* unit);
void SendAuctionCommandResult(uint32 auctionId, uint32 Action, uint32 ErrorCode, uint32 bidError = 0);
- void SendAuctionBidderNotification(uint32 location, uint32 auctionId, uint64 bidder, uint32 bidSum, uint32 diff, uint32 item_template);
+ void SendAuctionBidderNotification(uint32 location, uint32 auctionId, ObjectGuid bidder, uint32 bidSum, uint32 diff, uint32 item_template);
void SendAuctionOwnerNotification(AuctionEntry* auction);
//Item Enchantment
- void SendEnchantmentLog(uint64 target, uint64 caster, uint32 itemId, uint32 enchantId);
- void SendItemEnchantTimeUpdate(uint64 Playerguid, uint64 Itemguid, uint32 slot, uint32 Duration);
+ void SendEnchantmentLog(ObjectGuid target, ObjectGuid caster, uint32 itemId, uint32 enchantId);
+ void SendItemEnchantTimeUpdate(ObjectGuid Playerguid, ObjectGuid Itemguid, uint32 slot, uint32 Duration);
//Taxi
- void SendTaxiStatus(uint64 guid);
+ void SendTaxiStatus(ObjectGuid guid);
void SendTaxiMenu(Creature* unit);
void SendDoFlight(uint32 mountDisplayId, uint32 path, uint32 pathNode = 0);
bool SendLearnNewTaxiNode(Creature* unit);
@@ -355,11 +354,11 @@ class WorldSession
// Guild/Arena Team
void SendArenaTeamCommandResult(uint32 team_action, std::string const& team, std::string const& player, uint32 error_id = 0);
void SendNotInArenaTeamPacket(uint8 type);
- void SendPetitionShowList(uint64 guid);
+ void SendPetitionShowList(ObjectGuid guid);
void BuildPartyMemberStatsChangedPacket(Player* player, WorldPacket* data);
- void DoLootRelease(uint64 lguid);
+ void DoLootRelease(ObjectGuid lguid);
// Account mute time
time_t m_muteTime;
@@ -738,7 +737,7 @@ class WorldSession
//Pet
void HandlePetAction(WorldPacket& recvData);
void HandlePetStopAttack(WorldPacket& recvData);
- void HandlePetActionHelper(Unit* pet, uint64 guid1, uint32 spellid, uint16 flag, uint64 guid2);
+ void HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spellid, uint16 flag, ObjectGuid guid2);
void HandlePetNameQuery(WorldPacket& recvData);
void HandlePetSetAction(WorldPacket& recvData);
void HandlePetAbandon(WorldPacket& recvData);
@@ -811,7 +810,7 @@ class WorldSession
void SendLfgUpdatePlayer(lfg::LfgUpdateData const& updateData);
void SendLfgUpdateParty(lfg::LfgUpdateData const& updateData);
- void SendLfgRoleChosen(uint64 guid, uint8 roles);
+ void SendLfgRoleChosen(ObjectGuid guid, uint8 roles);
void SendLfgRoleCheckUpdate(lfg::LfgRoleCheck const& pRoleCheck);
void SendLfgLfrList(bool update);
void SendLfgJoinResult(lfg::LfgJoinResultData const& joinData);
@@ -925,7 +924,7 @@ class WorldSession
QueryCallback<PreparedQueryResult, std::string> _addFriendCallback;
QueryCallback<PreparedQueryResult, uint32> _unstablePetCallback;
QueryCallback<PreparedQueryResult, uint32> _stableSwapCallback;
- QueryCallback<PreparedQueryResult, uint64> _sendStabledPetCallback;
+ QueryCallback<PreparedQueryResult, ObjectGuid> _sendStabledPetCallback;
QueryCallback<PreparedQueryResult, CharacterCreateInfo*, true> _charCreateCallback;
QueryResultHolderFuture _charLoginCallback;
@@ -963,21 +962,21 @@ class WorldSession
// private trade methods
void moveItems(Item* myItems[], Item* hisItems[]);
- bool CanUseBank(uint64 bankerGUID = 0) const;
+ bool CanUseBank(ObjectGuid bankerGUID = ObjectGuid::Empty) const;
// logging helper
void LogUnexpectedOpcode(WorldPacket* packet, const char* status, const char *reason);
void LogUnprocessedTail(WorldPacket* packet);
// EnumData helpers
- bool IsLegitCharacterForAccount(uint32 lowGUID)
+ bool IsLegitCharacterForAccount(ObjectGuid lowGUID)
{
return _legitCharacters.find(lowGUID) != _legitCharacters.end();
}
// this stores the GUIDs of the characters who can login
// characters who failed on Player::BuildEnumData shouldn't login
- std::set<uint32> _legitCharacters;
+ GuidSet _legitCharacters;
uint32 m_GUIDLow; // set logined or recently logout player (while m_playerRecentlyLogout set)
Player* _player;
@@ -1014,7 +1013,7 @@ class WorldSession
rbac::RBACData* _RBACData;
uint32 expireTime;
bool forceExit;
- uint64 m_currentBankerGUID;
+ ObjectGuid m_currentBankerGUID;
WorldSession(WorldSession const& right) = delete;
WorldSession& operator=(WorldSession const& right) = delete;