Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions src/game/WorldHandlers/Chat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3526,15 +3526,42 @@ bool ChatHandler::ExtractPlayerTarget(char** args, Player** player /*= NULL*/, O
{
*player = pl;
}

ObjectGuid guid = pl ? pl->GetObjectGuid() : ObjectGuid();

// Console with a selected player that is now offline: fall back to stored GUID
if (!pl && !m_session)
{
uint32 accountId = GetAccountId();
auto itr = m_consoleSelectedPlayers.find(accountId);
if (itr != m_consoleSelectedPlayers.end())
guid = itr->second;
}

// if allowed player guid (if no then only online players allowed)
if (player_guid)
{
*player_guid = pl ? pl->GetObjectGuid() : ObjectGuid();
*player_guid = guid;
}

if (player_name)
{
*player_name = pl ? pl->GetName() : "";
if (pl)
*player_name = pl->GetName();
else if (guid)
{
std::string name;
if (!sObjectMgr.GetPlayerNameByGUID(guid, name) || name.empty())
{
if (player_guid)
*player_guid = ObjectGuid();
*player_name = "";
}
else
*player_name = name;
}
else
*player_name = "";
}
}

Expand Down