mirror of
https://github.com/mangosfour/server.git
synced 2025-12-26 16:37:06 +00:00
[10334] Update shift-link related functions for chat command parsing.
Also * Better single | detection as non-link case (doubled by client) * Commands .pdump now allow quoted filename (usefull if filename path include whitespaces)
This commit is contained in:
parent
e36a4a5d01
commit
344dff303e
7 changed files with 1016 additions and 1044 deletions
|
|
@ -65,7 +65,7 @@ bool ChatHandler::HandleAccountDeleteCommand(char* args)
|
|||
return false;
|
||||
|
||||
std::string account_name;
|
||||
uint32 account_id = extractAccountId(args, &account_name);
|
||||
uint32 account_id = ExtractAccountId(&args, &account_name);
|
||||
if (!account_id)
|
||||
return false;
|
||||
|
||||
|
|
@ -409,44 +409,31 @@ bool ChatHandler::HandleCharacterDeletedOldCommand(char* args)
|
|||
|
||||
bool ChatHandler::HandleCharacterEraseCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
char* nameStr = ExtractLiteralArg(&args);
|
||||
if (!*nameStr)
|
||||
return false;
|
||||
|
||||
char *character_name_str = strtok(args," ");
|
||||
if(!character_name_str)
|
||||
Player* target;
|
||||
uint64 target_guid;
|
||||
std::string target_name;
|
||||
if (!ExtractPlayerTarget(&args, &target, &target_guid, &target_name))
|
||||
return false;
|
||||
|
||||
std::string character_name = character_name_str;
|
||||
if(!normalizePlayerName(character_name))
|
||||
return false;
|
||||
|
||||
uint64 character_guid;
|
||||
uint32 account_id;
|
||||
|
||||
if (Player *player = sObjectMgr.GetPlayer(character_name.c_str()))
|
||||
if (target)
|
||||
{
|
||||
character_guid = player->GetGUID();
|
||||
account_id = player->GetSession()->GetAccountId();
|
||||
player->GetSession()->KickPlayer();
|
||||
account_id = target->GetSession()->GetAccountId();
|
||||
target->GetSession()->KickPlayer();
|
||||
}
|
||||
else
|
||||
{
|
||||
character_guid = sObjectMgr.GetPlayerGUIDByName(character_name);
|
||||
if(!character_guid)
|
||||
{
|
||||
PSendSysMessage(LANG_NO_PLAYER,character_name.c_str());
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
account_id = sObjectMgr.GetPlayerAccountIdByGUID(character_guid);
|
||||
}
|
||||
account_id = sObjectMgr.GetPlayerAccountIdByGUID(target_guid);
|
||||
|
||||
std::string account_name;
|
||||
sAccountMgr.GetName (account_id,account_name);
|
||||
|
||||
Player::DeleteFromDB(character_guid, account_id, true, true);
|
||||
PSendSysMessage(LANG_CHARACTER_DELETED,character_name.c_str(),GUID_LOPART(character_guid),account_name.c_str(), account_id);
|
||||
Player::DeleteFromDB(target_guid, account_id, true, true);
|
||||
PSendSysMessage(LANG_CHARACTER_DELETED, target_name.c_str(), GUID_LOPART(target_guid), account_name.c_str(), account_id);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue