[11470] Final cleanup uint64 guid cases

Also drop logout player update fields cleanup that in any cases not saved.
This commit is contained in:
VladimirMangos 2011-05-11 21:32:50 +04:00
parent a2b6a6fde5
commit 719e298795
26 changed files with 144 additions and 153 deletions

View file

@ -545,7 +545,7 @@ uint8 ArenaTeam::GetSlotByType(ArenaType type )
bool ArenaTeam::HaveMember(ObjectGuid guid) const
{
for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
if(itr->guid == guid.GetRawValue())
if(itr->guid == guid)
return true;
return false;

View file

@ -183,7 +183,7 @@ namespace MaNGOS
data << uint32(0); // 2.1.0
data << uint32(strlen(i_source->GetName())+1);
data << i_source->GetName();
data << uint64(0); // Unit Target - isn't important for bgs
data << ObjectGuid(); // Unit Target - isn't important for bgs
data << uint32(strlen(str)+1);
data << str;
data << uint8(0); // ChatTag - for bgs allways 0?

View file

@ -263,7 +263,6 @@ class BattleGroundEY : public BattleGround
void RespawnFlagAfterDrop();
void RemovePlayer(Player *plr, ObjectGuid guid);
void HandleBuffUse(uint64 const& buff_guid);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
void HandleKillPlayer(Player *player, Player *killer);
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);

View file

@ -239,14 +239,14 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv
++count2;
WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, (4+4+16*count1+16*count2));
data << count1; // alliance flag holders count - obsolete, now always 0
data << count1; // alliance flag holders count - obsolete, now always 0
/*for(uint8 i = 0; i < count1; ++i)
{
data << uint64(0); // guid
data << (float)0; // x
data << (float)0; // y
data << ObjectGuid(0); // guid
data << (float)0; // x
data << (float)0; // y
}*/
data << count2; // horde flag holders count - obsolete, now count of next fields
data << count2; // horde flag holders count - obsolete, now count of next fields
if (ali_plr)
{
data << ObjectGuid(ali_plr->GetObjectGuid());
@ -785,7 +785,7 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
void WorldSession::HandleReportPvPAFK( WorldPacket & recv_data )
{
uint64 playerGuid;
ObjectGuid playerGuid;
recv_data >> playerGuid;
Player *reportedPlayer = sObjectMgr.GetPlayer(playerGuid);

View file

@ -672,12 +672,12 @@ void Channel::SendToOne(WorldPacket *data, ObjectGuid who)
plr->GetSession()->SendPacket(data);
}
void Channel::Voice(uint64 /*guid1*/, uint64 /*guid2*/)
void Channel::Voice(ObjectGuid /*guid1*/, ObjectGuid /*guid2*/)
{
}
void Channel::DeVoice(uint64 /*guid1*/, uint64 /*guid2*/)
void Channel::DeVoice(ObjectGuid /*guid1*/, ObjectGuid /*guid2*/)
{
}
@ -904,10 +904,10 @@ void Channel::MakePlayerInvited(WorldPacket *data, const std::string& name)
}
// done 0x1E
void Channel::MakePlayerInviteBanned(WorldPacket *data, uint64 guid)
void Channel::MakePlayerInviteBanned(WorldPacket *data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_PLAYER_INVITE_BANNED_NOTICE);
*data << uint64(guid); // should be string!!
*data << ObjectGuid(guid); // should be string!!
}
// done 0x1F
@ -929,17 +929,17 @@ void Channel::MakeNotInLfg(WorldPacket *data)
}
// done 0x22
void Channel::MakeVoiceOn(WorldPacket *data, uint64 guid)
void Channel::MakeVoiceOn(WorldPacket *data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_VOICE_ON_NOTICE);
*data << uint64(guid);
*data << ObjectGuid(guid);
}
// done 0x23
void Channel::MakeVoiceOff(WorldPacket *data, uint64 guid)
void Channel::MakeVoiceOff(WorldPacket *data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_VOICE_OFF_NOTICE);
*data << uint64(guid);
*data << ObjectGuid(guid);
}
void Channel::JoinNotify(ObjectGuid guid)

View file

@ -180,8 +180,8 @@ class Channel
void Moderate(ObjectGuid p);
void Say(ObjectGuid p, const char *what, uint32 lang);
void Invite(ObjectGuid p, const char *newp);
void Voice(uint64 guid1, uint64 guid2);
void DeVoice(uint64 guid1, uint64 guid2);
void Voice(ObjectGuid guid1, ObjectGuid guid2);
void DeVoice(ObjectGuid guid1, ObjectGuid guid2);
void JoinNotify(ObjectGuid guid); // invisible notify
void LeaveNotify(ObjectGuid guid); // invisible notify
@ -219,12 +219,12 @@ class Channel
void MakeInvalidName(WorldPacket *data); //? 0x1B
void MakeNotModerated(WorldPacket *data); //? 0x1C
void MakePlayerInvited(WorldPacket *data, const std::string& name); //+ 0x1D
void MakePlayerInviteBanned(WorldPacket *data, uint64 guid); //? 0x1E
void MakePlayerInviteBanned(WorldPacket *data, ObjectGuid guid); //? 0x1E
void MakeThrottled(WorldPacket *data); //? 0x1F
void MakeNotInArea(WorldPacket *data); //? 0x20
void MakeNotInLfg(WorldPacket *data); //? 0x21
void MakeVoiceOn(WorldPacket *data, uint64 guid); //+ 0x22
void MakeVoiceOff(WorldPacket *data, uint64 guid); //+ 0x23
void MakeVoiceOn(WorldPacket *data, ObjectGuid guid); //+ 0x22
void MakeVoiceOff(WorldPacket *data, ObjectGuid guid); //+ 0x23
void SendToAll(WorldPacket *data, ObjectGuid p = ObjectGuid());
void SendToOne(WorldPacket *data, ObjectGuid who);

View file

@ -286,7 +286,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
return;
}
if (sObjectMgr.GetPlayerGUIDByName(name))
if (!sObjectMgr.GetPlayerGuidByName(name).IsEmpty())
{
data << (uint8)CHAR_CREATE_NAME_IN_USE;
SendPacket( &data );
@ -1182,7 +1182,7 @@ void WorldSession::HandleCharCustomizeOpcode(WorldPacket& recv_data)
}
// character with this name already exist
ObjectGuid newguid = sObjectMgr.GetPlayerGUIDByName(newname);
ObjectGuid newguid = sObjectMgr.GetPlayerGuidByName(newname);
if (!newguid.IsEmpty() && newguid != guid)
{
WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1);

View file

@ -2896,10 +2896,7 @@ ObjectGuid ChatHandler::ExtractGuidFromLink(char** text)
if (Player* player = sObjectMgr.GetPlayer(name.c_str()))
return player->GetObjectGuid();
if (uint64 guid = sObjectMgr.GetPlayerGUIDByName(name))
return ObjectGuid(guid);
return ObjectGuid();
return sObjectMgr.GetPlayerGuidByName(name);
}
case GUID_LINK_CREATURE:
{
@ -2992,7 +2989,7 @@ bool ChatHandler::ExtractLocationFromLink(char** text, uint32& mapid, float& x,
return true;
}
ObjectGuid guid = sObjectMgr.GetPlayerGUIDByName(name);
ObjectGuid guid = sObjectMgr.GetPlayerGuidByName(name);
if (!guid.IsEmpty())
{
// to point where player stay (if loaded)
@ -3218,7 +3215,7 @@ bool ChatHandler::ExtractPlayerTarget(char** args, Player** player /*= NULL*/, O
*player = pl;
// if need guid value from DB (in name case for check player existence)
ObjectGuid guid = !pl && (player_guid || player_name) ? sObjectMgr.GetPlayerGUIDByName(name) : uint64(0);
ObjectGuid guid = !pl && (player_guid || player_name) ? sObjectMgr.GetPlayerGuidByName(name) : ObjectGuid();
// if allowed player guid (if no then only online players allowed)
if(player_guid)

View file

@ -597,7 +597,7 @@ void WorldSession::HandleTextEmoteOpcode( WorldPacket & recv_data )
void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recv_data )
{
uint64 iguid;
ObjectGuid iguid;
uint8 unk;
//DEBUG_LOG("WORLD: Received CMSG_CHAT_IGNORED");

View file

@ -544,8 +544,12 @@ void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data )
// everything is fine, do it
if (Player* player = sObjectMgr.GetPlayer(name.c_str()))
group->ChangeMembersGroup(player, groupNr);
else if (uint64 guid = sObjectMgr.GetPlayerGUIDByName(name.c_str()))
group->ChangeMembersGroup(guid, groupNr);
else
{
ObjectGuid guid = sObjectMgr.GetPlayerGuidByName(name.c_str());
if (!guid.IsEmpty())
group->ChangeMembersGroup(guid, groupNr);
}
}
void WorldSession::HandleGroupAssistantLeaderOpcode( WorldPacket & recv_data )

View file

@ -805,11 +805,11 @@ void WorldSession::HandleGuildBankerActivate( WorldPacket & recv_data )
{
DEBUG_LOG("WORLD: Received (CMSG_GUILD_BANKER_ACTIVATE)");
uint64 GoGuid;
ObjectGuid goGuid;
uint8 unk;
recv_data >> GoGuid >> unk;
recv_data >> goGuid >> unk;
if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
if (!GetPlayer()->GetGameObjectIfCanInteractWith(goGuid, GAMEOBJECT_TYPE_GUILD_BANK))
return;
if (uint32 GuildId = GetPlayer()->GetGuildId())
@ -829,11 +829,11 @@ void WorldSession::HandleGuildBankQueryTab( WorldPacket & recv_data )
{
DEBUG_LOG("WORLD: Received (CMSG_GUILD_BANK_QUERY_TAB)");
uint64 GoGuid;
ObjectGuid goGuid;
uint8 TabId, unk1;
recv_data >> GoGuid >> TabId >> unk1;
recv_data >> goGuid >> TabId >> unk1;
if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
if (!GetPlayer()->GetGameObjectIfCanInteractWith(goGuid, GAMEOBJECT_TYPE_GUILD_BANK))
return;
uint32 GuildId = GetPlayer()->GetGuildId();
@ -857,14 +857,14 @@ void WorldSession::HandleGuildBankDepositMoney( WorldPacket & recv_data )
{
DEBUG_LOG("WORLD: Received (CMSG_GUILD_BANK_DEPOSIT_MONEY)");
uint64 GoGuid;
ObjectGuid goGuid;
uint32 money;
recv_data >> GoGuid >> money;
recv_data >> goGuid >> money;
if (!money)
return;
if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
if (!GetPlayer()->GetGameObjectIfCanInteractWith(goGuid, GAMEOBJECT_TYPE_GUILD_BANK))
return;
if (GetPlayer()->GetMoney() < money)
@ -908,14 +908,14 @@ void WorldSession::HandleGuildBankWithdrawMoney( WorldPacket & recv_data )
{
DEBUG_LOG("WORLD: Received (CMSG_GUILD_BANK_WITHDRAW_MONEY)");
uint64 GoGuid;
ObjectGuid goGuid;
uint32 money;
recv_data >> GoGuid >> money;
recv_data >> goGuid >> money;
if (!money)
return;
if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
if (!GetPlayer()->GetGameObjectIfCanInteractWith(goGuid, GAMEOBJECT_TYPE_GUILD_BANK))
return;
uint32 GuildId = GetPlayer()->GetGuildId();
@ -961,7 +961,7 @@ void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data )
{
DEBUG_LOG("WORLD: Received (CMSG_GUILD_BANK_SWAP_ITEMS)");
uint64 GoGuid;
ObjectGuid goGuid;
uint8 BankToBank;
uint8 BankTab, BankTabSlot, AutoStore;
@ -973,7 +973,7 @@ void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data )
uint32 AutoStoreCount = 0;
uint32 SplitedAmount = 0;
recv_data >> GoGuid >> BankToBank;
recv_data >> goGuid >> BankToBank;
uint32 GuildId = GetPlayer()->GetGuildId();
if (!GuildId)
@ -1037,7 +1037,7 @@ void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data )
}
}
if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
if (!GetPlayer()->GetGameObjectIfCanInteractWith(goGuid, GAMEOBJECT_TYPE_GUILD_BANK))
return;
// Bank <-> Bank
@ -1067,13 +1067,13 @@ void WorldSession::HandleGuildBankBuyTab( WorldPacket & recv_data )
{
DEBUG_LOG("WORLD: Received (CMSG_GUILD_BANK_BUY_TAB)");
uint64 GoGuid;
ObjectGuid goGuid;
uint8 TabId;
recv_data >> GoGuid;
recv_data >> goGuid;
recv_data >> TabId;
if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
if (!GetPlayer()->GetGameObjectIfCanInteractWith(goGuid, GAMEOBJECT_TYPE_GUILD_BANK))
return;
uint32 GuildId = GetPlayer()->GetGuildId();
@ -1107,23 +1107,23 @@ void WorldSession::HandleGuildBankUpdateTab( WorldPacket & recv_data )
{
DEBUG_LOG("WORLD: Received (CMSG_GUILD_BANK_UPDATE_TAB)");
uint64 GoGuid;
ObjectGuid goGuid;
uint8 TabId;
std::string Name;
std::string IconIndex;
recv_data >> GoGuid;
recv_data >> goGuid;
recv_data >> TabId;
recv_data >> Name;
recv_data >> IconIndex;
if(Name.empty())
if (Name.empty())
return;
if(IconIndex.empty())
if (IconIndex.empty())
return;
if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
if (!GetPlayer()->GetGameObjectIfCanInteractWith(goGuid, GAMEOBJECT_TYPE_GUILD_BANK))
return;
uint32 GuildId = GetPlayer()->GetGuildId();

View file

@ -5862,7 +5862,7 @@ bool ChatHandler::HandlePDumpWriteCommand(char *args)
return false;
}
guid = sObjectMgr.GetPlayerGUIDByName(name);
guid = sObjectMgr.GetPlayerGuidByName(name);
if (guid.IsEmpty())
{
PSendSysMessage(LANG_PLAYER_NOT_FOUND);

View file

@ -60,11 +60,12 @@
*/
void WorldSession::HandleSendMail(WorldPacket & recv_data )
{
uint64 mailbox, unk3;
ObjectGuid mailboxGuid;
uint64 unk3;
std::string receiver, subject, body;
uint32 unk1, unk2, money, COD;
uint8 unk4;
recv_data >> mailbox;
recv_data >> mailboxGuid;
recv_data >> receiver;
recv_data >> subject;
@ -84,12 +85,12 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
return;
}
uint64 itemGUIDs[MAX_MAIL_ITEMS];
ObjectGuid itemGuids[MAX_MAIL_ITEMS];
for(uint8 i = 0; i < items_count; ++i)
{
recv_data.read_skip<uint8>(); // item slot in mail, not used
recv_data >> itemGUIDs[i];
recv_data >> itemGuids[i];
}
recv_data >> money >> COD; // money and cod
@ -98,7 +99,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
// packet read complete, now do check
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailboxGuid, GAMEOBJECT_TYPE_MAILBOX))
return;
if (receiver.empty())
@ -108,7 +109,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
ObjectGuid rc;
if (normalizePlayerName(receiver))
rc = sObjectMgr.GetPlayerGUIDByName(receiver);
rc = sObjectMgr.GetPlayerGuidByName(receiver);
if (rc.IsEmpty())
{
@ -180,13 +181,13 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
for(uint8 i = 0; i < items_count; ++i)
{
if (!itemGUIDs[i])
if (!itemGuids[i].IsItem())
{
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_MAIL_ATTACHMENT_INVALID);
return;
}
Item* item = pl->GetItemByGuid(itemGUIDs[i]);
Item* item = pl->GetItemByGuid(itemGuids[i]);
// prevent sending bag with items (cheat: can be placed in bag after adding equipped empty bag to mail)
if(!item)
@ -293,12 +294,12 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
*/
void WorldSession::HandleMailMarkAsRead(WorldPacket & recv_data )
{
uint64 mailbox;
ObjectGuid mailboxGuid;
uint32 mailId;
recv_data >> mailbox;
recv_data >> mailboxGuid;
recv_data >> mailId;
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailboxGuid, GAMEOBJECT_TYPE_MAILBOX))
return;
Player *pl = _player;
@ -323,13 +324,13 @@ void WorldSession::HandleMailMarkAsRead(WorldPacket & recv_data )
*/
void WorldSession::HandleMailDelete(WorldPacket & recv_data )
{
uint64 mailbox;
ObjectGuid mailboxGuid;
uint32 mailId;
recv_data >> mailbox;
recv_data >> mailboxGuid;
recv_data >> mailId;
recv_data.read_skip<uint32>(); // mailTemplateId
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailboxGuid, GAMEOBJECT_TYPE_MAILBOX))
return;
Player* pl = _player;
@ -359,13 +360,13 @@ void WorldSession::HandleMailDelete(WorldPacket & recv_data )
*/
void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data )
{
uint64 mailbox;
ObjectGuid mailboxGuid;
uint32 mailId;
recv_data >> mailbox;
recv_data >> mailboxGuid;
recv_data >> mailId;
recv_data.read_skip<uint64>(); // original sender GUID for return to, not used
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailboxGuid, GAMEOBJECT_TYPE_MAILBOX))
return;
Player *pl = _player;
@ -417,14 +418,14 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data )
*/
void WorldSession::HandleMailTakeItem(WorldPacket & recv_data )
{
uint64 mailbox;
ObjectGuid mailboxGuid;
uint32 mailId;
uint32 itemId;
recv_data >> mailbox;
recv_data >> mailboxGuid;
recv_data >> mailId;
recv_data >> itemId; // item guid low
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailboxGuid, GAMEOBJECT_TYPE_MAILBOX))
return;
Player* pl = _player;
@ -514,12 +515,12 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data )
*/
void WorldSession::HandleMailTakeMoney(WorldPacket & recv_data )
{
uint64 mailbox;
ObjectGuid mailboxGuid;
uint32 mailId;
recv_data >> mailbox;
recv_data >> mailboxGuid;
recv_data >> mailId;
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailboxGuid, GAMEOBJECT_TYPE_MAILBOX))
return;
Player *pl = _player;
@ -551,10 +552,10 @@ void WorldSession::HandleMailTakeMoney(WorldPacket & recv_data )
*/
void WorldSession::HandleGetMailList(WorldPacket & recv_data )
{
uint64 mailbox;
recv_data >> mailbox;
ObjectGuid mailboxGuid;
recv_data >> mailboxGuid;
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailboxGuid, GAMEOBJECT_TYPE_MAILBOX))
return;
// client can't work with packets > max int16 value
@ -677,13 +678,13 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data )
*/
void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data )
{
uint64 mailbox;
ObjectGuid mailboxGuid;
uint32 mailId;
recv_data >> mailbox;
recv_data >> mailboxGuid;
recv_data >> mailId;
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailboxGuid, GAMEOBJECT_TYPE_MAILBOX))
return;
Player *pl = _player;

View file

@ -505,7 +505,7 @@ void WorldSession::HandleAddFriendOpcodeCallBack(QueryResult *result, uint32 acc
void WorldSession::HandleDelFriendOpcode( WorldPacket & recv_data )
{
uint64 friendGuid;
ObjectGuid friendGuid;
DEBUG_LOG( "WORLD: Received CMSG_DEL_FRIEND" );
@ -575,7 +575,7 @@ void WorldSession::HandleAddIgnoreOpcodeCallBack(QueryResult *result, uint32 acc
void WorldSession::HandleDelIgnoreOpcode( WorldPacket & recv_data )
{
uint64 ignoreGuid;
ObjectGuid ignoreGuid;
DEBUG_LOG( "WORLD: Received CMSG_DEL_IGNORE" );

View file

@ -500,12 +500,12 @@ void WorldSession::HandleMoveWaterWalkAck(WorldPacket& recv_data)
void WorldSession::HandleSummonResponseOpcode(WorldPacket& recv_data)
{
if(!_player->isAlive() || _player->isInCombat() )
if (!_player->isAlive() || _player->isInCombat())
return;
uint64 summoner_guid;
ObjectGuid summonerGuid;
bool agree;
recv_data >> summoner_guid;
recv_data >> summonerGuid;
recv_data >> agree;
_player->SummonIfPossible(agree);

View file

@ -138,7 +138,7 @@ class MANGOS_DLL_SPEC Object
}
ObjectGuid const& GetObjectGuid() const { return GetGuidValue(OBJECT_FIELD_GUID); }
const uint64& GetGUID() const { return GetUInt64Value(OBJECT_FIELD_GUID); } // DEPRICATED, not use, will removed soon
const uint64& GetGUID() const { return GetUInt64Value(OBJECT_FIELD_GUID); } // DEPRECATED, not use, will removed soon
uint32 GetGUIDLow() const { return GetObjectGuid().GetCounter(); }
PackedGuid const& GetPackGUID() const { return m_PackGUID; }
std::string GetGuidStr() const { return GetObjectGuid().GetString(); }

View file

@ -1583,17 +1583,17 @@ void ObjectMgr::RemoveGameobjectFromGrid(uint32 guid, GameObjectData const* data
}
// name must be checked to correctness (if received) before call this function
uint64 ObjectMgr::GetPlayerGUIDByName(std::string name) const
ObjectGuid ObjectMgr::GetPlayerGuidByName(std::string name) const
{
uint64 guid = 0;
ObjectGuid guid;
CharacterDatabase.escape_string(name);
// Player name safe to sending to DB (checked at login) and this function using
QueryResult *result = CharacterDatabase.PQuery("SELECT guid FROM characters WHERE name = '%s'", name.c_str());
if(result)
if (result)
{
guid = ObjectGuid(HIGHGUID_PLAYER, (*result)[0].GetUInt32()).GetRawValue();
guid = ObjectGuid(HIGHGUID_PLAYER, (*result)[0].GetUInt32());
delete result;
}

View file

@ -522,7 +522,7 @@ class ObjectMgr
}
void GetPlayerLevelInfo(uint32 race, uint32 class_,uint32 level, PlayerLevelInfo* info) const;
uint64 GetPlayerGUIDByName(std::string name) const;
ObjectGuid GetPlayerGuidByName(std::string name) const;
bool GetPlayerNameByGUID(ObjectGuid guid, std::string &name) const;
Team GetPlayerTeamByGUID(ObjectGuid guid) const;
uint32 GetPlayerAccountIdByGUID(ObjectGuid guid) const;

View file

@ -302,7 +302,7 @@ void WorldSession::HandlePetNameQueryOpcode(WorldPacket& recv_data)
DETAIL_LOG("HandlePetNameQuery. CMSG_PET_NAME_QUERY");
uint32 petnumber;
uint64 petguid;
ObjectGuid petguid;
recv_data >> petnumber;
recv_data >> petguid;
@ -310,7 +310,7 @@ void WorldSession::HandlePetNameQueryOpcode(WorldPacket& recv_data)
SendPetNameQuery(petguid, petnumber);
}
void WorldSession::SendPetNameQuery(uint64 petguid, uint32 petnumber)
void WorldSession::SendPetNameQuery(ObjectGuid petguid, uint32 petnumber)
{
Creature* pet = _player->GetMap()->GetAnyTypeCreature(petguid);
if (!pet || !pet->GetCharmInfo() || pet->GetCharmInfo()->GetPetNumber() != petnumber)
@ -347,12 +347,12 @@ void WorldSession::HandlePetSetAction(WorldPacket& recv_data)
{
DETAIL_LOG("HandlePetSetAction. CMSG_PET_SET_ACTION");
uint64 petguid;
ObjectGuid petGuid;
uint8 count;
recv_data >> petguid;
recv_data >> petGuid;
Creature* pet = _player->GetMap()->GetAnyTypeCreature(petguid);
Creature* pet = _player->GetMap()->GetAnyTypeCreature(petGuid);
if (!pet || (pet != _player->GetPet() && pet != _player->GetCharm()))
{
@ -460,17 +460,17 @@ void WorldSession::HandlePetRename(WorldPacket& recv_data)
{
DETAIL_LOG("HandlePetRename. CMSG_PET_RENAME");
uint64 petguid;
ObjectGuid petGuid;
uint8 isdeclined;
std::string name;
DeclinedName declinedname;
recv_data >> petguid;
recv_data >> petGuid;
recv_data >> name;
recv_data >> isdeclined;
Pet* pet = _player->GetMap()->GetPet(petguid);
Pet* pet = _player->GetMap()->GetPet(petGuid);
// check it!
if (!pet || pet->getPetType() != HUNTER_PET ||
!pet->HasByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED) ||

View file

@ -11394,7 +11394,7 @@ void Player::RemoveItem( uint8 bag, uint8 slot, bool update )
UpdateKnownCurrencies(pItem->GetEntry(), false);
m_items[slot] = NULL;
SetUInt64Value(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), 0);
SetGuidValue(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), ObjectGuid());
if ( slot < EQUIPMENT_SLOT_END )
{
@ -11486,7 +11486,7 @@ void Player::DestroyItem( uint8 bag, uint8 slot, bool update )
if( bag == INVENTORY_SLOT_BAG_0 )
{
SetUInt64Value(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), 0);
SetGuidValue(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), ObjectGuid());
// equipment and equipped bags can have applied bonuses
if ( slot < INVENTORY_SLOT_BAG_END )
@ -12231,9 +12231,9 @@ void Player::RemoveItemFromBuyBackSlot( uint32 slot, bool del )
m_items[slot] = NULL;
uint32 eslot = slot - BUYBACK_SLOT_START;
SetUInt64Value( PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), 0 );
SetUInt32Value( PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, 0 );
SetUInt32Value( PLAYER_FIELD_BUYBACK_TIMESTAMP_1 + eslot, 0 );
SetGuidValue(PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), ObjectGuid());
SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, 0);
SetUInt32Value(PLAYER_FIELD_BUYBACK_TIMESTAMP_1 + eslot, 0);
// if current backslot is filled set to now free slot
if (m_items[m_currentBuybackSlot])
@ -15372,7 +15372,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder )
// cleanup inventory related item value fields (its will be filled correctly in _LoadInventory)
for(uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot)
{
SetUInt64Value( PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), 0 );
SetGuidValue(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), ObjectGuid());
SetVisibleItemSlot(slot, NULL);
if (m_items[slot])
@ -15960,7 +15960,7 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff)
do
{
Field *fields = result->Fetch();
ObjectGuid caster_guid = fields[0].GetUInt64();
ObjectGuid caster_guid = ObjectGuid(fields[0].GetUInt64());
uint32 item_lowguid = fields[1].GetUInt32();
uint32 spellid = fields[2].GetUInt32();
uint32 stackcount = fields[3].GetUInt32();
@ -16112,7 +16112,7 @@ void Player::LoadCorpse()
void Player::_LoadInventory(QueryResult *result, uint32 timediff)
{
//QueryResult *result = CharacterDatabase.PQuery("SELECT data,text,bag,slot,item,item_template FROM character_inventory JOIN item_instance ON character_inventory.item = item_instance.guid WHERE character_inventory.guid = '%u' ORDER BY bag,slot", GetGUIDLow());
std::map<uint64, Bag*> bagMap; // fast guid lookup for bags
std::map<uint32, Bag*> bagMap; // fast guid lookup for bags
//NOTE: the "order by `bag`" is important because it makes sure
//the bagMap is filled before items in the bags are loaded
//NOTE2: the "order by `slot`" is needed because mainhand weapons are (wrongly?)
@ -16131,34 +16131,34 @@ void Player::_LoadInventory(QueryResult *result, uint32 timediff)
Field *fields = result->Fetch();
uint32 bag_guid = fields[2].GetUInt32();
uint8 slot = fields[3].GetUInt8();
uint32 item_guid = fields[4].GetUInt32();
uint32 item_lowguid = fields[4].GetUInt32();
uint32 item_id = fields[5].GetUInt32();
ItemPrototype const * proto = ObjectMgr::GetItemPrototype(item_id);
if(!proto)
if (!proto)
{
CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item = '%u'", item_guid);
CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid = '%u'", item_guid);
CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item = '%u'", item_lowguid);
CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid = '%u'", item_lowguid);
sLog.outError( "Player::_LoadInventory: Player %s has an unknown item (id: #%u) in inventory, deleted.", GetName(),item_id );
continue;
}
Item *item = NewItemOrBag(proto);
if(!item->LoadFromDB(item_guid, fields, GetObjectGuid()))
if (!item->LoadFromDB(item_lowguid, fields, GetObjectGuid()))
{
sLog.outError( "Player::_LoadInventory: Player %s has broken item (id: #%u) in inventory, deleted.", GetName(),item_id );
CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item = '%u'", item_guid);
CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item = '%u'", item_lowguid);
item->FSetState(ITEM_REMOVED);
item->SaveToDB(); // it also deletes item object !
continue;
}
// not allow have in alive state item limited to another map/zone
if(isAlive() && item->IsLimitedToAnotherMapOrZone(GetMapId(),zone) )
if (isAlive() && item->IsLimitedToAnotherMapOrZone(GetMapId(),zone))
{
CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item = '%u'", item_guid);
CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item = '%u'", item_lowguid);
item->FSetState(ITEM_REMOVED);
item->SaveToDB(); // it also deletes item object !
continue;
@ -16167,7 +16167,7 @@ void Player::_LoadInventory(QueryResult *result, uint32 timediff)
// "Conjured items disappear if you are logged out for more than 15 minutes"
if (timediff > 15*MINUTE && (item->GetProto()->Flags & ITEM_FLAG_CONJURED))
{
CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item = '%u'", item_guid);
CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item = '%u'", item_lowguid);
item->FSetState(ITEM_REMOVED);
item->SaveToDB(); // it also deletes item object !
continue;
@ -16181,36 +16181,36 @@ void Player::_LoadInventory(QueryResult *result, uint32 timediff)
item->SetContainer( NULL );
item->SetSlot(slot);
if( IsInventoryPos( INVENTORY_SLOT_BAG_0, slot ) )
if (IsInventoryPos( INVENTORY_SLOT_BAG_0, slot))
{
ItemPosCountVec dest;
if( CanStoreItem( INVENTORY_SLOT_BAG_0, slot, dest, item, false ) == EQUIP_ERR_OK )
if (CanStoreItem( INVENTORY_SLOT_BAG_0, slot, dest, item, false) == EQUIP_ERR_OK)
item = StoreItem(dest, item, true);
else
success = false;
}
else if( IsEquipmentPos( INVENTORY_SLOT_BAG_0, slot ) )
else if (IsEquipmentPos( INVENTORY_SLOT_BAG_0, slot))
{
uint16 dest;
if( CanEquipItem( slot, dest, item, false, false ) == EQUIP_ERR_OK )
if (CanEquipItem( slot, dest, item, false, false ) == EQUIP_ERR_OK)
QuickEquipItem(dest, item);
else
success = false;
}
else if( IsBankPos( INVENTORY_SLOT_BAG_0, slot ) )
else if (IsBankPos( INVENTORY_SLOT_BAG_0, slot))
{
ItemPosCountVec dest;
if( CanBankItem( INVENTORY_SLOT_BAG_0, slot, dest, item, false, false ) == EQUIP_ERR_OK )
if (CanBankItem( INVENTORY_SLOT_BAG_0, slot, dest, item, false, false ) == EQUIP_ERR_OK)
item = BankItem(dest, item, true);
else
success = false;
}
if(success)
if (success)
{
// store bags that may contain items in them
if(item->IsBag() && IsBagPos(item->GetPos()))
bagMap[item_guid] = (Bag*)item;
if (item->IsBag() && IsBagPos(item->GetPos()))
bagMap[item_lowguid] = (Bag*)item;
}
}
// the item/bag in a bag
@ -16218,11 +16218,11 @@ void Player::_LoadInventory(QueryResult *result, uint32 timediff)
{
item->SetSlot(NULL_SLOT);
// the item is in a bag, find the bag
std::map<uint64, Bag*>::const_iterator itr = bagMap.find(bag_guid);
if(itr != bagMap.end() && slot < itr->second->GetBagSize())
std::map<uint32, Bag*>::const_iterator itr = bagMap.find(bag_guid);
if (itr != bagMap.end() && slot < itr->second->GetBagSize())
{
ItemPosCountVec dest;
if( CanStoreItem( itr->second->GetSlot(), slot, dest, item, false ) == EQUIP_ERR_OK )
if (CanStoreItem(itr->second->GetSlot(), slot, dest, item, false) == EQUIP_ERR_OK)
item = StoreItem(dest, item, true);
else
success = false;
@ -16246,8 +16246,8 @@ void Player::_LoadInventory(QueryResult *result, uint32 timediff)
}
else
{
sLog.outError("Player::_LoadInventory: Player %s has item (GUID: %u Entry: %u) can't be loaded to inventory (Bag GUID: %u Slot: %u) by some reason, will send by mail.", GetName(),item_guid, item_id, bag_guid, slot);
CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item = '%u'", item_guid);
sLog.outError("Player::_LoadInventory: Player %s has item (GUID: %u Entry: %u) can't be loaded to inventory (Bag GUID: %u Slot: %u) by some reason, will send by mail.", GetName(),item_lowguid, item_id, bag_guid, slot);
CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item = '%u'", item_lowguid);
problematicItems.push_back(item);
}
} while (result->NextRow());

View file

@ -529,8 +529,8 @@ void WorldSession::HandleCancelTradeOpcode(WorldPacket& /*recvPacket*/)
void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
{
uint64 ID;
recvPacket >> ID;
ObjectGuid otherGuid;
recvPacket >> otherGuid;
if (GetPlayer()->m_trade)
return;
@ -559,7 +559,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
return;
}
Player* pOther = ObjectAccessor::FindPlayer( ID );
Player* pOther = ObjectAccessor::FindPlayer( otherGuid );
if (!pOther)
{

View file

@ -390,7 +390,7 @@ void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, SplineTy
break;
}
case SPLINETYPE_FACINGTARGET:
data << uint64(va_arg(vargs,uint64));
data << uint64(va_arg(vargs,uint64)); // ObjectGuid in fact
break;
case SPLINETYPE_FACINGANGLE:
data << float(va_arg(vargs,double)); // facing angle

View file

@ -445,17 +445,7 @@ void WorldSession::LogoutPlayer(bool Save)
///- empty buyback items and save the player in the database
// some save parts only correctly work in case player present in map/player_lists (pets, etc)
if(Save)
{
uint32 eslot;
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->SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, 0);
_player->SetUInt32Value(PLAYER_FIELD_BUYBACK_TIMESTAMP_1 + eslot, 0);
}
_player->SaveToDB();
}
///- Leave all channels before player delete...
_player->CleanupChannels();

View file

@ -317,7 +317,7 @@ class MANGOS_DLL_SPEC WorldSession
void SendPetitionQueryOpcode(ObjectGuid petitionguid);
//pet
void SendPetNameQuery(uint64 guid, uint32 petnumber);
void SendPetNameQuery(ObjectGuid guid, uint32 petnumber);
void SendStablePet(ObjectGuid guid);
void SendStableResult(uint8 res);
bool CheckStableMaster(ObjectGuid guid);

View file

@ -269,7 +269,7 @@ void ChatHandler::HandleCharacterDeletedRestoreHelper(DeletedInfo const& delInfo
return;
}
if (sObjectMgr.GetPlayerGUIDByName(delInfo.name))
if (!sObjectMgr.GetPlayerGuidByName(delInfo.name).IsEmpty())
{
PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_NAME, delInfo.name.c_str(), delInfo.lowguid, delInfo.accountId);
return;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11469"
#define REVISION_NR "11470"
#endif // __REVISION_NR_H__