From 15fbb6f46fb24fdc6f91786543b32f247e6525fc Mon Sep 17 00:00:00 2001 From: Shauren Date: Wed, 29 Oct 2014 21:13:21 +0100 Subject: Core/Entites: Updated GUID format --- src/server/scripts/Commands/cs_character.cpp | 6 +++--- src/server/scripts/Commands/cs_debug.cpp | 6 +++--- src/server/scripts/Commands/cs_go.cpp | 2 +- src/server/scripts/Commands/cs_gobject.cpp | 2 +- src/server/scripts/Commands/cs_group.cpp | 2 +- src/server/scripts/Commands/cs_list.cpp | 14 +++++++------- src/server/scripts/Commands/cs_lookup.cpp | 2 +- src/server/scripts/Commands/cs_misc.cpp | 2 +- src/server/scripts/Commands/cs_npc.cpp | 4 ++-- src/server/scripts/Commands/cs_wp.cpp | 6 ++++-- .../scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp | 12 ++++++------ 11 files changed, 30 insertions(+), 28 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp index 4e47d403347..cfde57f3184 100644 --- a/src/server/scripts/Commands/cs_character.cpp +++ b/src/server/scripts/Commands/cs_character.cpp @@ -133,7 +133,7 @@ public: DeletedInfo info; - info.guid = ObjectGuid(HighGuid::Player, fields[0].GetUInt64()); + info.guid = ObjectGuid::Create(fields[0].GetUInt64()); info.name = fields[1].GetString(); info.accountId = fields[2].GetUInt32(); @@ -921,7 +921,7 @@ public: return false; } - if (sObjectMgr->GetPlayerAccountIdByGUID(ObjectGuid(HighGuid::Player, guid))) + if (sObjectMgr->GetPlayerAccountIdByGUID(ObjectGuid::Create(guid))) { handler->PSendSysMessage(LANG_CHARACTER_GUID_IN_USE, guid); handler->SetSentErrorMessage(true); @@ -969,7 +969,7 @@ public: ObjectGuid guid; // character name can't start from number if (isNumeric(playerStr)) - guid = ObjectGuid(HighGuid::Player, strtoull(playerStr, nullptr, 10)); + guid = ObjectGuid::Create(strtoull(playerStr, nullptr, 10)); 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 c258adbf730..0c37b1491c3 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -990,7 +990,7 @@ public: ObjectGuid::LowType guid = strtoull(e, nullptr, 10); uint32 index = (uint32)atoi(f); - Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, guid)); + Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid::Create(guid)); if (!i) return false; @@ -1021,7 +1021,7 @@ public: uint32 index = (uint32)atoi(f); uint32 value = (uint32)atoi(g); - Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, guid)); + Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid::Create(guid)); if (!i) return false; @@ -1045,7 +1045,7 @@ public: ObjectGuid::LowType guid = strtoull(e, nullptr, 10); - Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, guid)); + Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid::Create(guid)); if (!i) return false; diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp index 478d4dafb1f..2ae2f2c3fd8 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(ObjectGuid(HighGuid::Creature, id, guid), (Creature*)NULL)) + if (Creature* creature = ObjectAccessor::GetObjectInWorld(ObjectGuid::Create(mapId, 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 3915a3bf88d..7b293efbefe 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -328,7 +328,7 @@ public: return false; } - GameObject* target = handler->GetSession()->GetPlayer()->GetMap()->GetGameObject(ObjectGuid(HighGuid::GameObject, id, guidLow)); + GameObject* target = handler->GetSession()->GetPlayer()->GetMap()->GetGameObject(ObjectGuid::Create(mapId, id, guidLow)); handler->PSendSysMessage(LANG_GAMEOBJECT_DETAIL, guidLow, objectInfo->name.c_str(), guidLow, id, x, y, z, mapId, o, phase); diff --git a/src/server/scripts/Commands/cs_group.cpp b/src/server/scripts/Commands/cs_group.cpp index 667f702e52a..99a0766f728 100644 --- a/src/server/scripts/Commands/cs_group.cpp +++ b/src/server/scripts/Commands/cs_group.cpp @@ -269,7 +269,7 @@ public: const char* onlineState = ""; // Parse the guid to uint32... - ObjectGuid parseGUID(HighGuid::Player, strtoull(args, nullptr, 10)); + ObjectGuid parseGUID = ObjectGuid::Create(strtoull(args, nullptr, 10)); // ... and try to extract a player out of it. if (sObjectMgr->GetPlayerNameByGUID(parseGUID, nameTarget)) diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp index b17a197915a..2a090aa70a8 100644 --- a/src/server/scripts/Commands/cs_list.cpp +++ b/src/server/scripts/Commands/cs_list.cpp @@ -181,10 +181,10 @@ public: do { Field* fields = result->Fetch(); - ObjectGuid itemGuid(HighGuid::Item, fields[0].GetUInt64()); + ObjectGuid itemGuid = ObjectGuid::Create(fields[0].GetUInt64()); uint32 itemBag = fields[1].GetUInt32(); uint8 itemSlot = fields[2].GetUInt8(); - ObjectGuid ownerGuid(HighGuid::Player, fields[3].GetUInt64()); + ObjectGuid ownerGuid = ObjectGuid::Create(fields[3].GetUInt64()); uint32 ownerAccountId = fields[4].GetUInt32(); std::string ownerName = fields[5].GetString(); @@ -282,8 +282,8 @@ public: do { Field* fields = result->Fetch(); - ObjectGuid itemGuid(HighGuid::Item, fields[0].GetUInt64()); - ObjectGuid owner(HighGuid::Player, fields[1].GetUInt64()); + ObjectGuid itemGuid = ObjectGuid::Create(fields[0].GetUInt64()); + ObjectGuid owner = ObjectGuid::Create(fields[1].GetUInt64()); uint32 ownerAccountId = fields[2].GetUInt32(); std::string ownerName = fields[3].GetString(); @@ -314,8 +314,8 @@ public: do { Field* fields = result->Fetch(); - ObjectGuid itemGuid(HighGuid::Item, fields[0].GetUInt64()); - ObjectGuid guildGuid(HighGuid::Guild, fields[1].GetUInt64()); + ObjectGuid itemGuid = ObjectGuid::Create(fields[0].GetUInt64()); + ObjectGuid guildGuid = ObjectGuid::Create(fields[1].GetUInt64()); std::string guildName = fields[2].GetString(); char const* itemPos = "[in guild bank]"; @@ -476,7 +476,7 @@ public: if (!*args) return false; - ObjectGuid parseGUID(HighGuid::Player, strtoull(args, nullptr, 10)); + ObjectGuid parseGUID = ObjectGuid::Create(strtoull(args, nullptr, 10)); if (sObjectMgr->GetPlayerNameByGUID(parseGUID, targetName)) { diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp index 3b7743c959f..714d1851a3e 100644 --- a/src/server/scripts/Commands/cs_lookup.cpp +++ b/src/server/scripts/Commands/cs_lookup.cpp @@ -1280,7 +1280,7 @@ public: do { Field* characterFields = result2->Fetch(); - ObjectGuid guid(HighGuid::Player, characterFields[0].GetUInt64()); + ObjectGuid guid = ObjectGuid::Create(characterFields[0].GetUInt64()); std::string name = characterFields[1].GetString(); handler->PSendSysMessage(LANG_LOOKUP_PLAYER_CHARACTER, name.c_str(), guid.ToString().c_str()); diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 0c55a93f2ad..bd7cb9175fa 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -1390,7 +1390,7 @@ public: PreparedStatement* stmt = NULL; // To make sure we get a target, we convert our guid to an omniversal... - ObjectGuid parseGUID(HighGuid::Player, strtoull(args, nullptr, 10)); + ObjectGuid parseGUID = ObjectGuid::Create(strtoull(args, nullptr, 10)); // ... and make sure we get a target, somehow. if (sObjectMgr->GetPlayerNameByGUID(parseGUID, targetName)) diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 6f566871f5e..9d64ba60bc4 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -527,7 +527,7 @@ public: return false; if (CreatureData const* cr_data = sObjectMgr->GetCreatureData(lowguid)) - unit = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HighGuid::Creature, cr_data->id, lowguid)); + unit = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid::Create(cr_data->mapid, cr_data->id, lowguid)); } else unit = handler->getSelectedCreature(); @@ -1323,7 +1323,7 @@ public: return false; } - ObjectGuid receiver_guid(HighGuid::Player, strtoull(receiver_str, nullptr, 10)); + ObjectGuid receiver_guid = ObjectGuid::Create(strtoull(receiver_str, nullptr, 10)); // check online security Player* receiver = ObjectAccessor::FindPlayer(receiver_guid); diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp index 878d5b1c758..58b86e9da74 100644 --- a/src/server/scripts/Commands/cs_wp.cpp +++ b/src/server/scripts/Commands/cs_wp.cpp @@ -846,11 +846,12 @@ public: if (result2) { bool hasError = false; + Map* map = handler->GetSession()->GetPlayer()->GetMap(); do { Field* fields = result2->Fetch(); ObjectGuid::LowType wpguid = fields[0].GetUInt64(); - Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HighGuid::Creature, VISUAL_WAYPOINT, wpguid)); + Creature* creature = map->GetCreature(ObjectGuid::Create(map->GetId(), VISUAL_WAYPOINT, wpguid)); if (!creature) { @@ -1051,11 +1052,12 @@ public: return false; } bool hasError = false; + Map* map = handler->GetSession()->GetPlayer()->GetMap(); do { Field* fields = result->Fetch(); ObjectGuid::LowType guid = fields[0].GetUInt64(); - Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HighGuid::Creature, VISUAL_WAYPOINT, guid)); + Creature* creature = map->GetCreature(ObjectGuid::Create(map->GetId(), VISUAL_WAYPOINT, guid)); if (!creature) { handler->PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, guid); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index 95f0b36bed1..8e659a746ed 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -648,7 +648,7 @@ class npc_spinestalker : public CreatureScript // Increase add count if (!me->isDead()) { - _instance->SetGuidData(DATA_SINDRAGOSA_FROSTWYRMS, ObjectGuid(HighGuid::Creature, me->GetEntry(), me->GetDBTableGUIDLow())); // this cannot be in Reset because reset also happens on evade + _instance->SetGuidData(DATA_SINDRAGOSA_FROSTWYRMS, ObjectGuid::Create(631, me->GetEntry(), me->GetDBTableGUIDLow())); // this cannot be in Reset because reset also happens on evade Reset(); } } @@ -671,7 +671,7 @@ class npc_spinestalker : public CreatureScript void JustRespawned() override { ScriptedAI::JustRespawned(); - _instance->SetGuidData(DATA_SINDRAGOSA_FROSTWYRMS, ObjectGuid(HighGuid::Creature, me->GetEntry(), me->GetDBTableGUIDLow())); // this cannot be in Reset because reset also happens on evade + _instance->SetGuidData(DATA_SINDRAGOSA_FROSTWYRMS, ObjectGuid::Create(631, me->GetEntry(), me->GetDBTableGUIDLow())); // this cannot be in Reset because reset also happens on evade } void JustDied(Unit* /*killer*/) override @@ -784,7 +784,7 @@ class npc_rimefang : public CreatureScript // Increase add count if (!me->isDead()) { - _instance->SetGuidData(DATA_SINDRAGOSA_FROSTWYRMS, ObjectGuid(HighGuid::Creature, me->GetEntry(), me->GetDBTableGUIDLow())); // this cannot be in Reset because reset also happens on evade + _instance->SetGuidData(DATA_SINDRAGOSA_FROSTWYRMS, ObjectGuid::Create(631, me->GetEntry(), me->GetDBTableGUIDLow())); // this cannot be in Reset because reset also happens on evade Reset(); } } @@ -807,7 +807,7 @@ class npc_rimefang : public CreatureScript void JustRespawned() override { ScriptedAI::JustRespawned(); - _instance->SetGuidData(DATA_SINDRAGOSA_FROSTWYRMS, ObjectGuid(HighGuid::Creature, me->GetEntry(), me->GetDBTableGUIDLow())); // this cannot be in Reset because reset also happens on evade + _instance->SetGuidData(DATA_SINDRAGOSA_FROSTWYRMS, ObjectGuid::Create(631, me->GetEntry(), me->GetDBTableGUIDLow())); // this cannot be in Reset because reset also happens on evade } void JustDied(Unit* /*killer*/) override @@ -951,7 +951,7 @@ class npc_sindragosa_trash : public CreatureScript if (!me->isDead()) { if (me->GetEntry() == NPC_FROSTWING_WHELP) - _instance->SetGuidData(_frostwyrmId, ObjectGuid(HighGuid::Creature, me->GetEntry(), me->GetDBTableGUIDLow())); // this cannot be in Reset because reset also happens on evade + _instance->SetGuidData(_frostwyrmId, ObjectGuid::Create(631, me->GetEntry(), me->GetDBTableGUIDLow())); // this cannot be in Reset because reset also happens on evade Reset(); } } @@ -974,7 +974,7 @@ class npc_sindragosa_trash : public CreatureScript // Increase add count if (me->GetEntry() == NPC_FROSTWING_WHELP) - _instance->SetGuidData(_frostwyrmId, ObjectGuid(HighGuid::Creature, me->GetEntry(), me->GetDBTableGUIDLow())); // this cannot be in Reset because reset also happens on evade + _instance->SetGuidData(_frostwyrmId, ObjectGuid::Create(631, me->GetEntry(), me->GetDBTableGUIDLow())); // this cannot be in Reset because reset also happens on evade } void SetData(uint32 type, uint32 data) override -- cgit v1.2.3