[10363] More wide use ObjectGuid in way remove MAKE_NEW_GUID uses.

Also
* Fixed some amount wrong uses low guids as full player guids.
* Add private without body ObjectGuid(uint32 const&) for catch wrong assigns low guids to ObjectGuid.
  In some cases need assign "0" guid, then use ObjectGuid() instead.
* Fixed .pdump commands work.
This commit is contained in:
VladimirMangos 2010-08-17 02:16:15 +04:00
parent db7db6382a
commit 5f44c4da21
41 changed files with 369 additions and 323 deletions

View file

@ -5694,7 +5694,7 @@ bool ChatHandler::HandlePDumpLoadCommand(char *args)
char* name_str = ExtractLiteralArg(&args);
uint32 guid = 0;
uint32 lowguid = 0;
std::string name;
if (name_str)
@ -5717,26 +5717,28 @@ bool ChatHandler::HandlePDumpLoadCommand(char *args)
if (*args)
{
if (!ExtractUInt32(&args, guid))
if (!ExtractUInt32(&args, lowguid))
return false;
if (!guid)
if (!lowguid)
{
PSendSysMessage(LANG_INVALID_CHARACTER_GUID);
SetSentErrorMessage(true);
return false;
}
ObjectGuid guid = ObjectGuid(HIGHGUID_PLAYER, lowguid);
if (sObjectMgr.GetPlayerAccountIdByGUID(guid))
{
PSendSysMessage(LANG_CHARACTER_GUID_IN_USE,guid);
PSendSysMessage(LANG_CHARACTER_GUID_IN_USE, lowguid);
SetSentErrorMessage(true);
return false;
}
}
}
switch(PlayerDumpReader().LoadDump(file, account_id, name, guid))
switch(PlayerDumpReader().LoadDump(file, account_id, name, lowguid))
{
case DUMP_SUCCESS:
PSendSysMessage(LANG_COMMAND_IMPORT_SUCCESS);
@ -5768,34 +5770,45 @@ bool ChatHandler::HandlePDumpWriteCommand(char *args)
return false;
char* file = ExtractQuotedOrLiteralArg(&args);
if(!file)
if (!file)
return false;
char* p2 = ExtractLiteralArg(&args);
uint32 guid;
uint32 lowguid;
ObjectGuid guid;
// character name can't start from number
if (!ExtractUInt32(&args, guid))
if (!ExtractUInt32(&p2, lowguid))
{
std::string name = ExtractPlayerNameFromLink(&p2);
if(name.empty())
if (name.empty())
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
return false;
}
guid = GUID_LOPART(sObjectMgr.GetPlayerGUIDByName(name));
}
guid = sObjectMgr.GetPlayerGUIDByName(name);
if (guid.IsEmpty())
{
PSendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
return false;
}
if(!sObjectMgr.GetPlayerAccountIdByGUID(guid))
lowguid = guid.GetCounter();
}
else
guid = ObjectGuid(HIGHGUID_PLAYER, lowguid);
if (!sObjectMgr.GetPlayerAccountIdByGUID(guid))
{
PSendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
return false;
}
switch(PlayerDumpWriter().WriteDump(file, guid))
switch(PlayerDumpWriter().WriteDump(file, lowguid))
{
case DUMP_SUCCESS:
PSendSysMessage(LANG_COMMAND_EXPORT_SUCCESS);