diff options
author | Shauren <shauren.trinity@gmail.com> | 2014-09-14 16:14:12 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2014-09-14 16:14:12 +0200 |
commit | a0e50ea35fca61447bf07fc45d93c98234ba59f7 (patch) | |
tree | b4ee69a63866f42e466a3c03fc031ce0710ac762 /src/server/scripts/Commands | |
parent | ce67a097bf3c0c3241f4441a808e32639ddbaafb (diff) |
Core/Entities: Use ObjectGuid class in game project
Diffstat (limited to 'src/server/scripts/Commands')
-rw-r--r-- | src/server/scripts/Commands/cs_arena.cpp | 4 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_character.cpp | 46 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_debug.cpp | 32 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_go.cpp | 2 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_gobject.cpp | 8 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_group.cpp | 10 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_list.cpp | 16 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_misc.cpp | 46 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_npc.cpp | 2 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_pet.cpp | 2 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_reset.cpp | 12 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_send.cpp | 12 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_tele.cpp | 2 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_ticket.cpp | 4 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_wp.cpp | 8 |
15 files changed, 103 insertions, 103 deletions
diff --git a/src/server/scripts/Commands/cs_arena.cpp b/src/server/scripts/Commands/cs_arena.cpp index 5658701bd54..24a332f6a30 100644 --- a/src/server/scripts/Commands/cs_arena.cpp +++ b/src/server/scripts/Commands/cs_arena.cpp @@ -275,7 +275,7 @@ public: arena->SetCaptain(targetGuid); - CharacterNameData const* oldCaptainNameData = sWorld->GetCharacterNameData(GUID_LOPART(arena->GetCaptain())); + CharacterNameData const* oldCaptainNameData = sWorld->GetCharacterNameData(arena->GetCaptain()); if (!oldCaptainNameData) { handler->SetSentErrorMessage(true); @@ -313,7 +313,7 @@ public: handler->PSendSysMessage(LANG_ARENA_INFO_HEADER, arena->GetName().c_str(), arena->GetId(), arena->GetRating(), arena->GetType(), arena->GetType()); for (ArenaTeam::MemberList::iterator itr = arena->m_membersBegin(); itr != arena->m_membersEnd(); ++itr) - handler->PSendSysMessage(LANG_ARENA_INFO_MEMBERS, itr->Name.c_str(), GUID_LOPART(itr->Guid), itr->PersonalRating, (arena->GetCaptain() == itr->Guid ? "- Captain" : "")); + handler->PSendSysMessage(LANG_ARENA_INFO_MEMBERS, itr->Name.c_str(), itr->Guid.GetCounter(), itr->PersonalRating, (arena->GetCaptain() == itr->Guid ? "- Captain" : "")); return true; } diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp index 7722c330e5f..46409d7c852 100644 --- a/src/server/scripts/Commands/cs_character.cpp +++ b/src/server/scripts/Commands/cs_character.cpp @@ -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); diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index a1603acbfe0..4f28e8ecd94 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -558,10 +558,10 @@ public: for (uint8 j = 0; j < bag->GetBagSize(); ++j) if (Item* item2 = bag->GetItemByPos(j)) if (item2->GetState() == state) - handler->PSendSysMessage("bag: 255 slot: %d guid: %d owner: %d", item2->GetSlot(), item2->GetGUIDLow(), GUID_LOPART(item2->GetOwnerGUID())); + handler->PSendSysMessage("bag: 255 slot: %d guid: %d owner: %d", item2->GetSlot(), item2->GetGUIDLow(), item2->GetOwnerGUID().GetCounter()); } else if (item->GetState() == state) - handler->PSendSysMessage("bag: 255 slot: %d guid: %d owner: %d", item->GetSlot(), item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID())); + handler->PSendSysMessage("bag: 255 slot: %d guid: %d owner: %d", item->GetSlot(), item->GetGUIDLow(), item->GetOwnerGUID().GetCounter()); } } } @@ -623,7 +623,7 @@ public: if (item->GetOwnerGUID() != player->GetGUID()) { - handler->PSendSysMessage("The item with slot %d and itemguid %d does have non-matching owner guid (%d) and player guid (%d) !", item->GetSlot(), item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()), player->GetGUIDLow()); + handler->PSendSysMessage("The item with slot %d and itemguid %d does have non-matching owner guid (%d) and player guid (%d) !", item->GetSlot(), item->GetGUIDLow(), item->GetOwnerGUID().GetCounter(), player->GetGUIDLow()); error = true; continue; } @@ -683,7 +683,7 @@ public: if (item2->GetOwnerGUID() != player->GetGUID()) { - handler->PSendSysMessage("The item in bag %d at slot %d and with itemguid %d, the owner's guid (%d) and the player's guid (%d) don't match!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), GUID_LOPART(item2->GetOwnerGUID()), player->GetGUIDLow()); + handler->PSendSysMessage("The item in bag %d at slot %d and with itemguid %d, the owner's guid (%d) and the player's guid (%d) don't match!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), item2->GetOwnerGUID().GetCounter(), player->GetGUIDLow()); error = true; continue; } @@ -745,7 +745,7 @@ public: if (item->GetOwnerGUID() != player->GetGUID()) { - handler->PSendSysMessage("queue(%zu): For the item with guid %d, the owner's guid (%d) and the player's guid (%d) don't match!", i, item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()), player->GetGUIDLow()); + handler->PSendSysMessage("queue(%zu): For the item with guid %d, the owner's guid (%d) and the player's guid (%d) don't match!", i, item->GetGUIDLow(), item->GetOwnerGUID().GetCounter(), player->GetGUIDLow()); error = true; continue; } @@ -972,7 +972,7 @@ public: uint32 guid = (uint32)atoi(e); uint32 index = (uint32)atoi(f); - Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(MAKE_NEW_GUID(guid, 0, HIGHGUID_ITEM)); + Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, 0, guid)); if (!i) return false; @@ -1003,7 +1003,7 @@ public: uint32 index = (uint32)atoi(f); uint32 value = (uint32)atoi(g); - Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(MAKE_NEW_GUID(guid, 0, HIGHGUID_ITEM)); + Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, 0, guid)); if (!i) return false; @@ -1027,7 +1027,7 @@ public: uint32 guid = (uint32)atoi(e); - Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(MAKE_NEW_GUID(guid, 0, HIGHGUID_ITEM)); + Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, guid)); if (!i) return false; @@ -1106,12 +1106,12 @@ public: return false; } - uint64 guid = target->GetGUID(); + ObjectGuid guid = target->GetGUID(); uint32 field = (uint32)atoi(x); if (field >= target->GetValuesCount()) { - handler->PSendSysMessage(LANG_TOO_BIG_INDEX, field, GUID_LOPART(guid), target->GetValuesCount()); + handler->PSendSysMessage(LANG_TOO_BIG_INDEX, field, guid.GetCounter(), target->GetValuesCount()); return false; } @@ -1123,13 +1123,13 @@ public: { uint32 value = (uint32)atoi(y); target->SetUInt32Value(field, value); - handler->PSendSysMessage(LANG_SET_UINT_FIELD, GUID_LOPART(guid), field, value); + handler->PSendSysMessage(LANG_SET_UINT_FIELD, guid.GetCounter(), field, value); } else { float value = (float)atof(y); target->SetFloatValue(field, value); - handler->PSendSysMessage(LANG_SET_FLOAT_FIELD, GUID_LOPART(guid), field, value); + handler->PSendSysMessage(LANG_SET_FLOAT_FIELD, guid.GetCounter(), field, value); } return true; @@ -1154,12 +1154,12 @@ public: return false; } - uint64 guid = target->GetGUID(); + ObjectGuid guid = target->GetGUID(); uint32 opcode = (uint32)atoi(x); if (opcode >= target->GetValuesCount()) { - handler->PSendSysMessage(LANG_TOO_BIG_INDEX, opcode, GUID_LOPART(guid), target->GetValuesCount()); + handler->PSendSysMessage(LANG_TOO_BIG_INDEX, opcode, guid.GetCounter(), target->GetValuesCount()); return false; } @@ -1170,12 +1170,12 @@ public: if (isInt32) { uint32 value = target->GetUInt32Value(opcode); - handler->PSendSysMessage(LANG_GET_UINT_FIELD, GUID_LOPART(guid), opcode, value); + handler->PSendSysMessage(LANG_GET_UINT_FIELD, guid.GetCounter(), opcode, value); } else { float value = target->GetFloatValue(opcode); - handler->PSendSysMessage(LANG_GET_FLOAT_FIELD, GUID_LOPART(guid), opcode, value); + handler->PSendSysMessage(LANG_GET_FLOAT_FIELD, guid.GetCounter(), opcode, value); } return true; diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp index 44ebb1ea4e0..d2b97e81479 100644 --- a/src/server/scripts/Commands/cs_go.cpp +++ b/src/server/scripts/Commands/cs_go.cpp @@ -140,7 +140,7 @@ public: Transport* transport = NULL; - if (Creature* creature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(guid, id, HIGHGUID_UNIT), (Creature*)NULL)) + if (Creature* creature = ObjectAccessor::GetObjectInWorld(ObjectGuid(HIGHGUID_UNIT, id, guid), (Creature*)NULL)) { x = creature->GetPositionX(); y = creature->GetPositionY(); diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index ed5b39e476d..f3ddc6f0137 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -324,7 +324,7 @@ public: return false; } - GameObject* target = handler->GetSession()->GetPlayer()->GetMap()->GetGameObject(MAKE_NEW_GUID(guidLow, id, HIGHGUID_GAMEOBJECT)); + GameObject* target = handler->GetSession()->GetPlayer()->GetMap()->GetGameObject(ObjectGuid(HIGHGUID_GAMEOBJECT, id, guidLow)); handler->PSendSysMessage(LANG_GAMEOBJECT_DETAIL, guidLow, objectInfo->name.c_str(), guidLow, id, x, y, z, mapId, o, phase); @@ -367,13 +367,13 @@ public: return false; } - uint64 ownerGuid = object->GetOwnerGUID(); + ObjectGuid ownerGuid = object->GetOwnerGUID(); if (ownerGuid) { Unit* owner = ObjectAccessor::GetUnit(*handler->GetSession()->GetPlayer(), ownerGuid); - if (!owner || !IS_PLAYER_GUID(ownerGuid)) + if (!owner || !ownerGuid.IsPlayer()) { - handler->PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, GUID_LOPART(ownerGuid), object->GetGUIDLow()); + handler->PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, ownerGuid.GetCounter(), object->GetGUIDLow()); handler->SetSentErrorMessage(true); return false; } diff --git a/src/server/scripts/Commands/cs_group.cpp b/src/server/scripts/Commands/cs_group.cpp index 470eb27bad2..1c3559770cc 100644 --- a/src/server/scripts/Commands/cs_group.cpp +++ b/src/server/scripts/Commands/cs_group.cpp @@ -263,18 +263,18 @@ public: // Get ALL the variables! Player* playerTarget; uint32 phase = 0; - uint64 guidTarget; + ObjectGuid guidTarget; std::string nameTarget; std::string zoneName; const char* onlineState = ""; // Parse the guid to uint32... - uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER); + ObjectGuid parseGUID(HIGHGUID_PLAYER, uint32(atol((char*)args))); // ... and try to extract a player out of it. if (sObjectMgr->GetPlayerNameByGUID(parseGUID, nameTarget)) { - playerTarget = sObjectMgr->GetPlayerByLowGUID(parseGUID); + playerTarget = ObjectAccessor::FindPlayer(parseGUID); guidTarget = parseGUID; } // If not, we return false and end right away. @@ -292,7 +292,7 @@ public: if (!groupTarget) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GROUP_MEMBER); - stmt->setUInt32(0, guidTarget); + stmt->setUInt32(0, guidTarget.GetCounter()); PreparedQueryResult resultGroup = CharacterDatabase.Query(stmt); if (resultGroup) groupTarget = sGroupMgr->GetGroupByDbStoreId((*resultGroup)[0].GetUInt32()); @@ -368,7 +368,7 @@ public: // Now we can print those informations for every single member of each group! handler->PSendSysMessage(LANG_GROUP_PLAYER_NAME_GUID, slot.name.c_str(), onlineState, - zoneName.c_str(), phase, GUID_LOPART(slot.guid), flags.c_str(), + zoneName.c_str(), phase, slot.guid.GetCounter(), flags.c_str(), lfg::GetRolesString(slot.roles).c_str()); } diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp index 6a0755b82e8..0f21200c22d 100644 --- a/src/server/scripts/Commands/cs_list.cpp +++ b/src/server/scripts/Commands/cs_list.cpp @@ -447,8 +447,8 @@ public: handler->PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, aura->GetId(), (handler->GetSession() ? ss_name.str().c_str() : name), aurApp->GetEffectMask(), aura->GetCharges(), aura->GetStackAmount(), aurApp->GetSlot(), aura->GetDuration(), aura->GetMaxDuration(), (aura->IsPassive() ? passiveStr : ""), - (talent ? talentStr : ""), IS_PLAYER_GUID(aura->GetCasterGUID()) ? "player" : "creature", - GUID_LOPART(aura->GetCasterGUID())); + (talent ? talentStr : ""), aura->GetCasterGUID().IsPlayer() ? "player" : "creature", + aura->GetCasterGUID().GetCounter()); } for (uint16 i = 0; i < TOTAL_AURAS; ++i) @@ -469,25 +469,25 @@ public: static bool HandleListMailCommand(ChatHandler* handler, char const* args) { Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; std::string targetName; PreparedStatement* stmt = NULL; if (!*args) return false; - uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER); + ObjectGuid parseGUID(HIGHGUID_PLAYER, uint32(atol((char*)args))); if (sObjectMgr->GetPlayerNameByGUID(parseGUID, targetName)) { - target = sObjectMgr->GetPlayerByLowGUID(parseGUID); + target = ObjectAccessor::FindPlayer(parseGUID); targetGuid = parseGUID; } else if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) return false; stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_LIST_COUNT); - stmt->setUInt32(0, targetGuid); + stmt->setUInt32(0, targetGuid.GetCounter()); PreparedQueryResult queryResult = CharacterDatabase.Query(stmt); if (queryResult) { @@ -495,11 +495,11 @@ public: uint32 countMail = fields[0].GetUInt64(); std::string nameLink = handler->playerLink(targetName); - handler->PSendSysMessage(LANG_LIST_MAIL_HEADER, countMail, nameLink.c_str(), targetGuid); + handler->PSendSysMessage(LANG_LIST_MAIL_HEADER, countMail, nameLink.c_str(), targetGuid.GetCounter()); handler->PSendSysMessage(LANG_ACCOUNT_LIST_BAR); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_LIST_INFO); - stmt->setUInt32(0, targetGuid); + stmt->setUInt32(0, targetGuid.GetCounter()); PreparedQueryResult queryResult = CharacterDatabase.Query(stmt); if (queryResult) diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 3e7b242f3cc..31ceeaf460d 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -136,7 +136,7 @@ public: WorldObject* object = NULL; if (*args) { - uint64 guid = handler->extractGuidFromLink((char*)args); + ObjectGuid guid = handler->extractGuidFromLink((char*)args); if (guid) object = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT); @@ -266,7 +266,7 @@ public: static bool HandleAppearCommand(ChatHandler* handler, char const* args) { Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; std::string targetName; if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) return false; @@ -282,7 +282,7 @@ public: if (target) { // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; std::string chrNameLink = handler->playerLink(targetName); @@ -408,7 +408,7 @@ public: static bool HandleSummonCommand(ChatHandler* handler, char const* args) { Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; std::string targetName; if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) return false; @@ -425,7 +425,7 @@ public: { std::string nameLink = handler->playerLink(targetName); // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; if (target->IsBeingTeleported()) @@ -537,7 +537,7 @@ public: } if (Player* player = target->ToPlayer()) - if (handler->HasLowerSecurity(player, 0, false)) + if (handler->HasLowerSecurity(player, ObjectGuid::Empty, false)) return false; if (target->IsAlive()) @@ -554,7 +554,7 @@ public: static bool HandleReviveCommand(ChatHandler* handler, char const* args) { Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid)) return false; @@ -597,16 +597,16 @@ public: static bool HandleGUIDCommand(ChatHandler* handler, char const* /*args*/) { - uint64 guid = handler->GetSession()->GetPlayer()->GetTarget(); + ObjectGuid guid = handler->GetSession()->GetPlayer()->GetTarget(); - if (guid == 0) + if (guid.IsEmpty()) { handler->SendSysMessage(LANG_NO_SELECTION); handler->SetSentErrorMessage(true); return false; } - handler->PSendSysMessage(LANG_OBJECT_GUID, GUID_LOPART(guid), GUID_HIPART(guid)); + handler->PSendSysMessage(LANG_OBJECT_GUID, guid.GetCounter(), guid.GetHigh()); return true; } @@ -703,7 +703,7 @@ public: if (*args) { - uint64 guid = handler->extractGuidFromLink((char*)args); + ObjectGuid guid = handler->extractGuidFromLink((char*)args); if (guid) obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT); @@ -737,7 +737,7 @@ public: return false; // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; if (target->IsBeingTeleported()) @@ -805,7 +805,7 @@ public: } // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; std::string kickReasonStr = handler->GetTrinityString(LANG_NO_REASON); @@ -1380,17 +1380,17 @@ public: { // Define ALL the player variables! Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; std::string targetName; PreparedStatement* stmt = NULL; // To make sure we get a target, we convert our guid to an omniversal... - uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER); + ObjectGuid parseGUID(HIGHGUID_PLAYER, uint32(atol((char*)args))); // ... and make sure we get a target, somehow. if (sObjectMgr->GetPlayerNameByGUID(parseGUID, targetName)) { - target = sObjectMgr->GetPlayerByLowGUID(parseGUID); + target = ObjectAccessor::FindPlayer(parseGUID); targetGuid = parseGUID; } // if not, then return false. Which shouldn't happen, now should it ? @@ -1432,7 +1432,7 @@ public: // Account data print variables std::string userName = handler->GetTrinityString(LANG_ERROR); uint32 accId = 0; - uint32 lowguid = GUID_LOPART(targetGuid); + uint32 lowguid = targetGuid.GetCounter(); std::string eMail = handler->GetTrinityString(LANG_ERROR); std::string regMail = handler->GetTrinityString(LANG_ERROR); uint32 security = 0; @@ -1486,7 +1486,7 @@ public: if (target) { // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; accId = target->GetSession()->GetAccountId(); @@ -1796,7 +1796,7 @@ public: muteReasonStr = muteReason; Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; std::string targetName; if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName)) return false; @@ -1859,7 +1859,7 @@ public: static bool HandleUnmuteCommand(ChatHandler* handler, char const* args) { Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; std::string targetName; if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) return false; @@ -2115,7 +2115,7 @@ public: } if (Player* player = target->ToPlayer()) - if (handler->HasLowerSecurity(player, 0, false)) + if (handler->HasLowerSecurity(player, ObjectGuid::Empty, false)) return false; if (!target->IsAlive()) @@ -2205,7 +2205,7 @@ public: } // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; target->CombatStop(); @@ -2226,7 +2226,7 @@ public: return false; // check online security - if (handler->HasLowerSecurity(target, 0)) + if (handler->HasLowerSecurity(target, ObjectGuid::Empty)) return false; // Repair items diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 66988b499d2..f8845acc1ce 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -521,7 +521,7 @@ public: return false; if (CreatureData const* cr_data = sObjectMgr->GetCreatureData(lowguid)) - unit = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT)); + unit = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, cr_data->id, lowguid)); } else unit = handler->getSelectedCreature(); diff --git a/src/server/scripts/Commands/cs_pet.cpp b/src/server/scripts/Commands/cs_pet.cpp index 82f99501a58..bb5e0764f2f 100644 --- a/src/server/scripts/Commands/cs_pet.cpp +++ b/src/server/scripts/Commands/cs_pet.cpp @@ -85,7 +85,7 @@ public: creatureTarget->RemoveCorpse(); creatureTarget->SetHealth(0); // just for nice GM-mode view - pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, player->GetGUID()); + pet->SetGuidValue(UNIT_FIELD_CREATEDBY, player->GetGUID()); pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction()); if (!pet->InitStatsForLevel(creatureTarget->getLevel())) diff --git a/src/server/scripts/Commands/cs_reset.cpp b/src/server/scripts/Commands/cs_reset.cpp index 00a669609f9..484d41a47d9 100644 --- a/src/server/scripts/Commands/cs_reset.cpp +++ b/src/server/scripts/Commands/cs_reset.cpp @@ -59,14 +59,14 @@ public: static bool HandleResetAchievementsCommand(ChatHandler* handler, char const* args) { Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid)) return false; if (target) target->ResetAchievements(); else - AchievementMgr::DeleteFromDB(GUID_LOPART(targetGuid)); + AchievementMgr::DeleteFromDB(targetGuid); return true; } @@ -158,7 +158,7 @@ public: static bool HandleResetSpellsCommand(ChatHandler* handler, char const* args) { Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; std::string targetName; if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) return false; @@ -175,7 +175,7 @@ public: { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); stmt->setUInt16(0, uint16(AT_LOGIN_RESET_SPELLS)); - stmt->setUInt32(1, GUID_LOPART(targetGuid)); + stmt->setUInt32(1, targetGuid.GetCounter()); CharacterDatabase.Execute(stmt); handler->PSendSysMessage(LANG_RESET_SPELLS_OFFLINE, targetName.c_str()); @@ -205,7 +205,7 @@ public: static bool HandleResetTalentsCommand(ChatHandler* handler, char const* args) { Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; std::string targetName; if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) { @@ -249,7 +249,7 @@ public: { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); stmt->setUInt16(0, uint16(AT_LOGIN_NONE | AT_LOGIN_RESET_PET_TALENTS)); - stmt->setUInt32(1, GUID_LOPART(targetGuid)); + stmt->setUInt32(1, targetGuid.GetCounter()); CharacterDatabase.Execute(stmt); std::string nameLink = handler->playerLink(targetName); diff --git a/src/server/scripts/Commands/cs_send.cpp b/src/server/scripts/Commands/cs_send.cpp index 486645df290..e27f09278fd 100644 --- a/src/server/scripts/Commands/cs_send.cpp +++ b/src/server/scripts/Commands/cs_send.cpp @@ -51,7 +51,7 @@ public: { // format: name "subject text" "mail text" Player* target; - uint64 targetGuid; + ObjectGuid targetGuid; std::string targetName; if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) return false; @@ -82,7 +82,7 @@ public: /// @todo Fix poor design SQLTransaction trans = CharacterDatabase.BeginTransaction(); MailDraft(subject, text) - .SendMailTo(trans, MailReceiver(target, GUID_LOPART(targetGuid)), sender); + .SendMailTo(trans, MailReceiver(target, targetGuid.GetCounter()), sender); CharacterDatabase.CommitTransaction(trans); @@ -96,7 +96,7 @@ public: { // format: name "subject text" "mail text" item1[:count1] item2[:count2] ... item12[:count12] Player* receiver; - uint64 receiverGuid; + ObjectGuid receiverGuid; std::string receiverName; if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName)) return false; @@ -192,7 +192,7 @@ public: } } - draft.SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), sender); + draft.SendMailTo(trans, MailReceiver(receiver, receiverGuid.GetCounter()), sender); CharacterDatabase.CommitTransaction(trans); std::string nameLink = handler->playerLink(receiverName); @@ -205,7 +205,7 @@ public: /// format: name "subject text" "mail text" money Player* receiver; - uint64 receiverGuid; + ObjectGuid receiverGuid; std::string receiverName; if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName)) return false; @@ -242,7 +242,7 @@ public: MailDraft(subject, text) .AddMoney(money) - .SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), sender); + .SendMailTo(trans, MailReceiver(receiver, receiverGuid.GetCounter()), sender); CharacterDatabase.CommitTransaction(trans); diff --git a/src/server/scripts/Commands/cs_tele.cpp b/src/server/scripts/Commands/cs_tele.cpp index ad77464b6e1..5dbb61d890a 100644 --- a/src/server/scripts/Commands/cs_tele.cpp +++ b/src/server/scripts/Commands/cs_tele.cpp @@ -123,7 +123,7 @@ public: return false; Player* target; - uint64 target_guid; + ObjectGuid target_guid; std::string target_name; if (!handler->extractPlayerTarget(nameStr, &target, &target_guid, &target_name)) return false; diff --git a/src/server/scripts/Commands/cs_ticket.cpp b/src/server/scripts/Commands/cs_ticket.cpp index cbf0ae51a82..8307f1ffdbe 100644 --- a/src/server/scripts/Commands/cs_ticket.cpp +++ b/src/server/scripts/Commands/cs_ticket.cpp @@ -153,7 +153,7 @@ public: return true; } - sTicketMgr->CloseTicket(ticket->GetId(), player ? player->GetGUID() : -1); + sTicketMgr->CloseTicket(ticket->GetId(), player ? player->GetGUID() : ObjectGuid(uint64(-1))); sTicketMgr->UpdateLastChange(); std::string msg = ticket->FormatMessageString(*handler, player ? player->GetName().c_str() : "Console", NULL, NULL, NULL, NULL); @@ -434,7 +434,7 @@ public: return false; // Detect target's GUID - uint64 guid = 0; + ObjectGuid guid = 0; if (Player* player = sObjectAccessor->FindPlayerByName(name)) guid = player->GetGUID(); else diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp index 647d8b49c1b..bb5b6554ebc 100644 --- a/src/server/scripts/Commands/cs_wp.cpp +++ b/src/server/scripts/Commands/cs_wp.cpp @@ -628,7 +628,7 @@ public: handler->PSendSysMessage("|cff00ff00DEBUG: wp modify del, PathID: |r|cff00ffff%u|r", pathid); if (wpGuid != 0) - if (Creature* wpCreature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT))) + if (Creature* wpCreature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, VISUAL_WAYPOINT, wpGuid))) { wpCreature->CombatStop(); wpCreature->DeleteFromDB(); @@ -661,7 +661,7 @@ public: // Respawn the owner of the waypoints if (wpGuid != 0) { - if (Creature* wpCreature = map->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT))) + if (Creature* wpCreature = map->GetCreature(ObjectGuid(HIGHGUID_UNIT, VISUAL_WAYPOINT, wpGuid))) { wpCreature->CombatStop(); wpCreature->DeleteFromDB(); @@ -842,7 +842,7 @@ public: { Field* fields = result2->Fetch(); uint32 wpguid = fields[0].GetUInt32(); - Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpguid, VISUAL_WAYPOINT, HIGHGUID_UNIT)); + Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, VISUAL_WAYPOINT, wpguid)); if (!creature) { @@ -1038,7 +1038,7 @@ public: { Field* fields = result->Fetch(); uint32 guid = fields[0].GetUInt32(); - Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(guid, VISUAL_WAYPOINT, HIGHGUID_UNIT)); + Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, VISUAL_WAYPOINT, guid)); if (!creature) { handler->PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, guid); |