Core/Entities: Use ObjectGuid class in game project

This commit is contained in:
Shauren
2014-09-14 16:14:12 +02:00
parent ce67a097bf
commit a0e50ea35f
256 changed files with 3334 additions and 3833 deletions
+23 -23
View File
@@ -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