Core/Entities: Use ObjectGuid class in game project

This commit is contained in:
Shauren committed 2014-09-14 16:14:12 +02:00
1 parent ce67a097bf
commit a0e50ea35f
256 files changed
+3334 -3833

No files matched your search

+23 -23
View File
@@ -226,10 +226,10 @@ public:
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME_DATA);
stmt->setUInt32(0, delInfo.lowGuid);
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
sWorld->AddCharacterNameData(delInfo.lowGuid, delInfo.name, (*result)[2].GetUInt8(), (*result)[0].GetUInt8(), (*result)[1].GetUInt8(), (*result)[3].GetUInt8());
sWorld->AddCharacterNameData(ObjectGuid(HIGHGUID_PLAYER, delInfo.lowGuid), delInfo.name, (*result)[2].GetUInt8(), (*result)[0].GetUInt8(), (*result)[1].GetUInt8(), (*result)[3].GetUInt8());
}
static void HandleCharacterLevel(Player* player, uint64 playerGuid, uint32 oldLevel, uint32 newLevel, ChatHandler* handler)
static void HandleCharacterLevel(Player* player, ObjectGuid playerGuid, uint32 oldLevel, uint32 newLevel, ChatHandler* handler)
{
if (player)
{
@@ -252,7 +252,7 @@ public:
// Update level and reset XP, everything else will be updated at login
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_LEVEL);
stmt->setUInt8(0, uint8(newLevel));
stmt->setUInt32(1, GUID_LOPART(playerGuid));
stmt->setUInt32(1, playerGuid.GetCounter());
CharacterDatabase.Execute(stmt);
}
}
@@ -303,7 +303,7 @@ public:
static bool HandleCharacterRenameCommand(ChatHandler* handler, char const* args)
{
Player* target;
uint64 targetGuid;
ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
return false;
@@ -382,7 +382,7 @@ public:
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_NAME_BY_GUID);
stmt->setString(0, newName);
stmt->setUInt32(1, GUID_LOPART(targetGuid));
stmt->setUInt32(1, targetGuid.GetCounter());
CharacterDatabase.Execute(stmt);
}
@@ -396,7 +396,7 @@ public:
sLog->outCommand(session->GetAccountId(), "GM %s (Account: %u) forced rename %s to player %s (Account: %u)", player->GetName().c_str(), session->GetAccountId(), newName.c_str(), playerOldName.c_str(), sObjectMgr->GetPlayerAccountIdByGUID(targetGuid));
}
else
sLog->outCommand(0, "CONSOLE forced rename '%s' to '%s' (GUID: %u)", playerOldName.c_str(), newName.c_str(), GUID_LOPART(targetGuid));
sLog->outCommand(0, "CONSOLE forced rename '%s' to '%s' (%s)", playerOldName.c_str(), newName.c_str(), targetGuid.ToString().c_str());
}
else
{
@@ -416,11 +416,11 @@ public:
return false;
std::string oldNameLink = handler->playerLink(targetName);
handler->PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid));
handler->PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), targetGuid.GetCounter());
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
stmt->setUInt16(0, uint16(AT_LOGIN_RENAME));
stmt->setUInt32(1, GUID_LOPART(targetGuid));
stmt->setUInt32(1, targetGuid.GetCounter());
CharacterDatabase.Execute(stmt);
}
}
@@ -444,7 +444,7 @@ public:
}
Player* target;
uint64 targetGuid;
ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName))
return false;
@@ -472,7 +472,7 @@ public:
static bool HandleCharacterCustomizeCommand(ChatHandler* handler, char const* args)
{
Player* target;
uint64 targetGuid;
ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
return false;
@@ -488,8 +488,8 @@ public:
else
{
std::string oldNameLink = handler->playerLink(targetName);
stmt->setUInt32(1, GUID_LOPART(targetGuid));
handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid));
stmt->setUInt32(1, targetGuid.GetCounter());
handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), targetGuid.GetCounter());
}
CharacterDatabase.Execute(stmt);
@@ -499,7 +499,7 @@ public:
static bool HandleCharacterChangeFactionCommand(ChatHandler* handler, char const* args)
{
Player* target;
uint64 targetGuid;
ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
@@ -516,8 +516,8 @@ public:
else
{
std::string oldNameLink = handler->playerLink(targetName);
handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid));
stmt->setUInt32(1, GUID_LOPART(targetGuid));
handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), targetGuid.GetCounter());
stmt->setUInt32(1, targetGuid.GetCounter());
}
CharacterDatabase.Execute(stmt);
@@ -527,7 +527,7 @@ public:
static bool HandleCharacterChangeRaceCommand(ChatHandler* handler, char const* args)
{
Player* target;
uint64 targetGuid;
ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
return false;
@@ -545,8 +545,8 @@ public:
{
std::string oldNameLink = handler->playerLink(targetName);
/// @todo add text into database
handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid));
stmt->setUInt32(1, GUID_LOPART(targetGuid));
handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), targetGuid.GetCounter());
stmt->setUInt32(1, targetGuid.GetCounter());
}
CharacterDatabase.Execute(stmt);
@@ -773,7 +773,7 @@ public:
if (!normalizePlayerName(characterName))
return false;
uint64 characterGuid;
ObjectGuid characterGuid;
uint32 accountId;
Player* player = sObjectAccessor->FindPlayerByName(characterName);
@@ -799,7 +799,7 @@ public:
AccountMgr::GetName(accountId, accountName);
Player::DeleteFromDB(characterGuid, accountId, true, true);
handler->PSendSysMessage(LANG_CHARACTER_DELETED, characterName.c_str(), GUID_LOPART(characterGuid), accountName.c_str(), accountId);
handler->PSendSysMessage(LANG_CHARACTER_DELETED, characterName.c_str(), characterGuid.GetCounter(), accountName.c_str(), accountId);
return true;
}
@@ -818,7 +818,7 @@ public:
}
Player* target;
uint64 targetGuid;
ObjectGuid targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName))
return false;
@@ -966,10 +966,10 @@ public:
if (!fileStr || !playerStr)
return false;
uint64 guid;
ObjectGuid guid;
// character name can't start from number
if (isNumeric(playerStr))
guid = MAKE_NEW_GUID(atoi(playerStr), 0, HIGHGUID_PLAYER);
guid = ObjectGuid(HIGHGUID_PLAYER, uint32(atoi(playerStr)));
else
{
std::string name = handler->extractPlayerNameFromLink(playerStr);