mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 04:37:00 +00:00
[10811] Use ObjectGuids in chat commands.
Still exist 15 GUID_LOPART uses in code.
This commit is contained in:
parent
c6d3c5e0d6
commit
b305f203b9
15 changed files with 151 additions and 146 deletions
|
|
@ -807,14 +807,14 @@ std::string ChatHandler::GetNameLink() const
|
|||
return GetNameLink(m_session->GetPlayer());
|
||||
}
|
||||
|
||||
bool ChatHandler::HasLowerSecurity(Player* target, uint64 guid, bool strong)
|
||||
bool ChatHandler::HasLowerSecurity(Player* target, ObjectGuid guid, bool strong)
|
||||
{
|
||||
WorldSession* target_session = NULL;
|
||||
uint32 target_account = 0;
|
||||
|
||||
if (target)
|
||||
target_session = target->GetSession();
|
||||
else if (guid)
|
||||
else if (!guid.IsEmpty())
|
||||
target_account = sObjectMgr.GetPlayerAccountIdByGUID(guid);
|
||||
|
||||
if(!target_session && !target_account)
|
||||
|
|
@ -2936,12 +2936,13 @@ bool ChatHandler::ExtractLocationFromLink(char** text, uint32& mapid, float& x,
|
|||
return true;
|
||||
}
|
||||
|
||||
if (uint64 guid = sObjectMgr.GetPlayerGUIDByName(name))
|
||||
ObjectGuid guid = sObjectMgr.GetPlayerGUIDByName(name);
|
||||
if (!guid.IsEmpty())
|
||||
{
|
||||
// to point where player stay (if loaded)
|
||||
float o;
|
||||
bool in_flight;
|
||||
return Player::LoadPositionFromDB(mapid, x, y, z, o, in_flight, guid);
|
||||
return Player::LoadPositionFromDB(guid, mapid, x, y, z, o, in_flight);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
@ -3142,7 +3143,7 @@ std::string ChatHandler::ExtractPlayerNameFromLink(char** text)
|
|||
*
|
||||
* @return true if extraction successful
|
||||
*/
|
||||
bool ChatHandler::ExtractPlayerTarget(char** args, Player** player /*= NULL*/, uint64* player_guid /*= NULL*/,std::string* player_name /*= NULL*/)
|
||||
bool ChatHandler::ExtractPlayerTarget(char** args, Player** player /*= NULL*/, ObjectGuid* player_guid /*= NULL*/,std::string* player_name /*= NULL*/)
|
||||
{
|
||||
if (*args && **args)
|
||||
{
|
||||
|
|
@ -3161,14 +3162,14 @@ bool ChatHandler::ExtractPlayerTarget(char** args, Player** player /*= NULL*/, u
|
|||
*player = pl;
|
||||
|
||||
// if need guid value from DB (in name case for check player existence)
|
||||
uint64 guid = !pl && (player_guid || player_name) ? sObjectMgr.GetPlayerGUIDByName(name) : 0;
|
||||
ObjectGuid guid = !pl && (player_guid || player_name) ? sObjectMgr.GetPlayerGUIDByName(name) : uint64(0);
|
||||
|
||||
// if allowed player guid (if no then only online players allowed)
|
||||
if(player_guid)
|
||||
*player_guid = pl ? pl->GetGUID() : guid;
|
||||
*player_guid = pl ? pl->GetObjectGuid() : guid;
|
||||
|
||||
if(player_name)
|
||||
*player_name = pl || guid ? name : "";
|
||||
*player_name = pl || !guid.IsEmpty() ? name : "";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -3178,14 +3179,14 @@ bool ChatHandler::ExtractPlayerTarget(char** args, Player** player /*= NULL*/, u
|
|||
*player = pl;
|
||||
// if allowed player guid (if no then only online players allowed)
|
||||
if(player_guid)
|
||||
*player_guid = pl ? pl->GetGUID() : 0;
|
||||
*player_guid = pl ? pl->GetObjectGuid() : ObjectGuid();
|
||||
|
||||
if(player_name)
|
||||
*player_name = pl ? pl->GetName() : "";
|
||||
}
|
||||
|
||||
// some from req. data must be provided (note: name is empty if player not exist)
|
||||
if((!player || !*player) && (!player_guid || !*player_guid) && (!player_name || player_name->empty()))
|
||||
if((!player || !*player) && (!player_guid || player_guid->IsEmpty()) && (!player_name || player_name->empty()))
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue