Core/Entites: Updated GUID format

This commit is contained in:
Shauren
2014-10-29 21:13:21 +01:00
parent 13281fef3c
commit 15fbb6f46f
60 changed files with 360 additions and 254 deletions

View File

@@ -133,7 +133,7 @@ public:
DeletedInfo info;
info.guid = ObjectGuid(HighGuid::Player, fields[0].GetUInt64());
info.guid = ObjectGuid::Create<HighGuid::Player>(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<HighGuid::Player>(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<HighGuid::Player>(strtoull(playerStr, nullptr, 10));
else
{
std::string name = handler->extractPlayerNameFromLink(playerStr);

View File

@@ -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<HighGuid::Item>(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<HighGuid::Item>(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<HighGuid::Item>(guid));
if (!i)
return false;

View File

@@ -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<HighGuid::Creature>(mapId, id, guid), (Creature*)NULL))
{
x = creature->GetPositionX();
y = creature->GetPositionY();

View File

@@ -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<HighGuid::GameObject>(mapId, id, guidLow));
handler->PSendSysMessage(LANG_GAMEOBJECT_DETAIL, guidLow, objectInfo->name.c_str(), guidLow, id, x, y, z, mapId, o, phase);

View File

@@ -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<HighGuid::Player>(strtoull(args, nullptr, 10));
// ... and try to extract a player out of it.
if (sObjectMgr->GetPlayerNameByGUID(parseGUID, nameTarget))

View File

@@ -181,10 +181,10 @@ public:
do
{
Field* fields = result->Fetch();
ObjectGuid itemGuid(HighGuid::Item, fields[0].GetUInt64());
ObjectGuid itemGuid = ObjectGuid::Create<HighGuid::Item>(fields[0].GetUInt64());
uint32 itemBag = fields[1].GetUInt32();
uint8 itemSlot = fields[2].GetUInt8();
ObjectGuid ownerGuid(HighGuid::Player, fields[3].GetUInt64());
ObjectGuid ownerGuid = ObjectGuid::Create<HighGuid::Player>(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<HighGuid::Item>(fields[0].GetUInt64());
ObjectGuid owner = ObjectGuid::Create<HighGuid::Player>(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<HighGuid::Item>(fields[0].GetUInt64());
ObjectGuid guildGuid = ObjectGuid::Create<HighGuid::Guild>(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<HighGuid::Player>(strtoull(args, nullptr, 10));
if (sObjectMgr->GetPlayerNameByGUID(parseGUID, targetName))
{

View File

@@ -1280,7 +1280,7 @@ public:
do
{
Field* characterFields = result2->Fetch();
ObjectGuid guid(HighGuid::Player, characterFields[0].GetUInt64());
ObjectGuid guid = ObjectGuid::Create<HighGuid::Player>(characterFields[0].GetUInt64());
std::string name = characterFields[1].GetString();
handler->PSendSysMessage(LANG_LOOKUP_PLAYER_CHARACTER, name.c_str(), guid.ToString().c_str());

View File

@@ -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<HighGuid::Player>(strtoull(args, nullptr, 10));
// ... and make sure we get a target, somehow.
if (sObjectMgr->GetPlayerNameByGUID(parseGUID, targetName))

View File

@@ -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<HighGuid::Creature>(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<HighGuid::Player>(strtoull(receiver_str, nullptr, 10));
// check online security
Player* receiver = ObjectAccessor::FindPlayer(receiver_guid);

View File

@@ -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<HighGuid::Creature>(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<HighGuid::Creature>(map->GetId(), VISUAL_WAYPOINT, guid));
if (!creature)
{
handler->PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, guid);

View File

@@ -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<HighGuid::Creature>(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<HighGuid::Creature>(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<HighGuid::Creature>(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<HighGuid::Creature>(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<HighGuid::Creature>(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<HighGuid::Creature>(631, me->GetEntry(), me->GetDBTableGUIDLow())); // this cannot be in Reset because reset also happens on evade
}
void SetData(uint32 type, uint32 data) override