mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[7839] Rafactoring player targeting code in chat command and related cleanups/improvments.
* New extractOptFirstArg function for easy get 2 args in case option playe name as first arg. * New extractPlayerTarget function for get player pointer/guid/name for online/offline player base at provided name or if not provided by current seelction with error cases processing. * Property apply mute/unmute in case use different character name from loggined currently for account. * .reset commands can be used from console now * .repairitems comamnd can be used from console now but only to online player.
This commit is contained in:
parent
122c9c5785
commit
1f2670facf
13 changed files with 558 additions and 1128 deletions
|
|
@ -52,104 +52,89 @@ static uint32 ReputationRankStrIndex[MAX_REPUTATION_RANK] =
|
|||
//mute player for some times
|
||||
bool ChatHandler::HandleMuteCommand(const char* args)
|
||||
{
|
||||
if (!*args)
|
||||
char* nameStr;
|
||||
char* delayStr;
|
||||
extractOptFirstArg((char*)args,&nameStr,&delayStr);
|
||||
if(!delayStr)
|
||||
return false;
|
||||
|
||||
std::string name = extractPlayerNameFromLink((char*)args);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
Player* target;
|
||||
uint64 target_guid;
|
||||
std::string target_name;
|
||||
if(!extractPlayerTarget(nameStr,&target,&target_guid,&target_name))
|
||||
return false;
|
||||
|
||||
uint32 account_id = target ? target->GetSession()->GetAccountId() : objmgr.GetPlayerAccountIdByGUID(target_guid);
|
||||
|
||||
// find only player from same account if any
|
||||
if(!target)
|
||||
{
|
||||
if(WorldSession* session = sWorld.FindSession(account_id))
|
||||
target = session->GetPlayer();
|
||||
}
|
||||
|
||||
char *timetonotspeak = strtok(NULL, " ");
|
||||
if(!timetonotspeak)
|
||||
return false;
|
||||
|
||||
uint32 notspeaktime = (uint32) atoi(timetonotspeak);
|
||||
|
||||
uint64 guid = objmgr.GetPlayerGUIDByName(name);
|
||||
if(!guid)
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
Player *chr = objmgr.GetPlayer(guid);
|
||||
uint32 notspeaktime = (uint32) atoi(delayStr);
|
||||
|
||||
// must have strong lesser security level
|
||||
if(HasLowerSecurity (chr,guid,true))
|
||||
if(HasLowerSecurity (target,target_guid,true))
|
||||
return false;
|
||||
|
||||
uint32 account_id = chr ? chr->GetSession()->GetAccountId() : objmgr.GetPlayerAccountIdByGUID(guid);
|
||||
|
||||
time_t mutetime = time(NULL) + notspeaktime*60;
|
||||
|
||||
if (chr)
|
||||
chr->GetSession()->m_muteTime = mutetime;
|
||||
if (target)
|
||||
target->GetSession()->m_muteTime = mutetime;
|
||||
|
||||
loginDatabase.PExecute("UPDATE account SET mutetime = " I64FMTD " WHERE id = '%u'",uint64(mutetime), account_id );
|
||||
|
||||
if(chr)
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notspeaktime);
|
||||
if(target)
|
||||
ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notspeaktime);
|
||||
|
||||
std::string nameLink = playerLink(name);
|
||||
std::string nameLink = playerLink(target_name);
|
||||
|
||||
PSendSysMessage(LANG_YOU_DISABLE_CHAT, nameLink.c_str(), notspeaktime);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//unmute player
|
||||
bool ChatHandler::HandleUnmuteCommand(const char* args)
|
||||
{
|
||||
if (!*args)
|
||||
Player* target;
|
||||
uint64 target_guid;
|
||||
std::string target_name;
|
||||
if(!extractPlayerTarget((char*)args,&target,&target_guid,&target_name))
|
||||
return false;
|
||||
|
||||
std::string name = extractPlayerNameFromLink((char*)args);
|
||||
if(name.empty())
|
||||
uint32 account_id = target ? target->GetSession()->GetAccountId() : objmgr.GetPlayerAccountIdByGUID(target_guid);
|
||||
|
||||
// find only player from same account if any
|
||||
if(!target)
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
if(WorldSession* session = sWorld.FindSession(account_id))
|
||||
target = session->GetPlayer();
|
||||
}
|
||||
|
||||
uint64 guid = objmgr.GetPlayerGUIDByName(name);
|
||||
if(!guid)
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
Player *chr = objmgr.GetPlayer(guid);
|
||||
|
||||
// must have strong lesser security level
|
||||
if(HasLowerSecurity (chr,guid,true))
|
||||
if(HasLowerSecurity (target,target_guid,true))
|
||||
return false;
|
||||
|
||||
uint32 account_id = chr ? chr->GetSession()->GetAccountId() : objmgr.GetPlayerAccountIdByGUID(guid);
|
||||
|
||||
if (chr)
|
||||
if (target)
|
||||
{
|
||||
if(chr->CanSpeak())
|
||||
if(target->CanSpeak())
|
||||
{
|
||||
SendSysMessage(LANG_CHAT_ALREADY_ENABLED);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
chr->GetSession()->m_muteTime = 0;
|
||||
target->GetSession()->m_muteTime = 0;
|
||||
}
|
||||
|
||||
loginDatabase.PExecute("UPDATE account SET mutetime = '0' WHERE id = '%u'", account_id );
|
||||
|
||||
if(chr)
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOUR_CHAT_ENABLED);
|
||||
if(target)
|
||||
ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_ENABLED);
|
||||
|
||||
std::string nameLink = playerLink(name);
|
||||
std::string nameLink = playerLink(target_name);
|
||||
|
||||
PSendSysMessage(LANG_YOU_ENABLE_CHAT, nameLink.c_str());
|
||||
return true;
|
||||
|
|
@ -2077,62 +2062,24 @@ bool ChatHandler::HandleModifyMorphCommand(const char* args)
|
|||
//kick player
|
||||
bool ChatHandler::HandleKickPlayerCommand(const char *args)
|
||||
{
|
||||
if (!*args)
|
||||
Player* target;
|
||||
if(!extractPlayerTarget((char*)args,&target))
|
||||
return false;
|
||||
|
||||
if (m_session && target==m_session->GetPlayer())
|
||||
{
|
||||
Player* player = getSelectedPlayer();
|
||||
|
||||
if(!player)
|
||||
{
|
||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(player==m_session->GetPlayer())
|
||||
{
|
||||
SendSysMessage(LANG_COMMAND_KICKSELF);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(player, 0))
|
||||
return false;
|
||||
|
||||
player->GetSession()->KickPlayer();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string name = extractPlayerNameFromLink((char*)args);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(m_session && name==m_session->GetPlayer()->GetName())
|
||||
{
|
||||
SendSysMessage(LANG_COMMAND_KICKSELF);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
Player* player = ObjectAccessor::Instance().FindPlayerByName(name.c_str());
|
||||
if (player && HasLowerSecurity(player, 0))
|
||||
return false;
|
||||
|
||||
std::string nameLink = playerLink(name);
|
||||
|
||||
if(sWorld.KickPlayer(name))
|
||||
{
|
||||
PSendSysMessage(LANG_COMMAND_KICKMESSAGE,nameLink.c_str());
|
||||
}
|
||||
else
|
||||
PSendSysMessage(LANG_COMMAND_KICKNOTFOUNDPLAYER,nameLink.c_str());
|
||||
SendSysMessage(LANG_COMMAND_KICKSELF);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(target, 0))
|
||||
return false;
|
||||
|
||||
// send before target pointer invalidate
|
||||
PSendSysMessage(LANG_COMMAND_KICKMESSAGE,GetNameLink(target).c_str());
|
||||
target->GetSession()->KickPlayer();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -2160,48 +2107,15 @@ bool ChatHandler::HandleModifyPhaseCommand(const char* args)
|
|||
//show info of player
|
||||
bool ChatHandler::HandlePInfoCommand(const char* args)
|
||||
{
|
||||
Player* target = NULL;
|
||||
uint64 targetGUID = 0;
|
||||
char* nameStr;
|
||||
char* subcommandStr;
|
||||
extractOptFirstArg((char*)args,&nameStr,&subcommandStr);
|
||||
|
||||
char* px = strtok((char*)args, " ");
|
||||
char* py = NULL;
|
||||
|
||||
std::string name;
|
||||
|
||||
if (px)
|
||||
{
|
||||
name = extractPlayerNameFromLink(px);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
target = objmgr.GetPlayer(name.c_str());
|
||||
if (target)
|
||||
py = strtok(NULL, " ");
|
||||
else
|
||||
{
|
||||
targetGUID = objmgr.GetPlayerGUIDByName(name);
|
||||
if(targetGUID)
|
||||
py = strtok(NULL, " ");
|
||||
else
|
||||
py = px;
|
||||
}
|
||||
}
|
||||
|
||||
if(!target && !targetGUID)
|
||||
{
|
||||
target = getSelectedPlayer();
|
||||
}
|
||||
|
||||
if(!target && !targetGUID)
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
Player* target;
|
||||
uint64 target_guid;
|
||||
std::string target_name;
|
||||
if(!extractPlayerTarget(nameStr,&target,&target_guid,&target_name))
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 accId = 0;
|
||||
uint32 money = 0;
|
||||
|
|
@ -2216,8 +2130,6 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
|
|||
if (HasLowerSecurity(target, 0))
|
||||
return false;
|
||||
|
||||
targetGUID = target->GetGUID();
|
||||
name = target->GetName(); // re-read for case getSelectedPlayer() target
|
||||
accId = target->GetSession()->GetAccountId();
|
||||
money = target->GetMoney();
|
||||
total_player_time = target->GetTotalPlayedTime();
|
||||
|
|
@ -2228,33 +2140,25 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
|
|||
else
|
||||
{
|
||||
// check offline security
|
||||
if (HasLowerSecurity(NULL, targetGUID))
|
||||
if (HasLowerSecurity(NULL, target_guid))
|
||||
return false;
|
||||
|
||||
// 0
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT totaltime FROM characters WHERE guid = '%u'", GUID_LOPART(targetGUID));
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT totaltime FROM characters WHERE guid = '%u'", GUID_LOPART(target_guid));
|
||||
if (!result)
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
Field *fields = result->Fetch();
|
||||
total_player_time = fields[0].GetUInt32();
|
||||
delete result;
|
||||
|
||||
Tokens data;
|
||||
if (!Player::LoadValuesArrayFromDB(data,targetGUID))
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
if (!Player::LoadValuesArrayFromDB(data,target_guid))
|
||||
return false;
|
||||
}
|
||||
|
||||
money = Player::GetUInt32ValueFromArray(data, PLAYER_FIELD_COINAGE);
|
||||
level = Player::GetUInt32ValueFromArray(data, UNIT_FIELD_LEVEL);
|
||||
|
||||
accId = objmgr.GetPlayerAccountIdByGUID(targetGUID);
|
||||
accId = objmgr.GetPlayerAccountIdByGUID(target_guid);
|
||||
}
|
||||
|
||||
std::string username = GetMangosString(LANG_ERROR);
|
||||
|
|
@ -2283,9 +2187,9 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
|
|||
delete result;
|
||||
}
|
||||
|
||||
std::string nameLink = playerLink(name);
|
||||
std::string nameLink = playerLink(target_name);
|
||||
|
||||
PSendSysMessage(LANG_PINFO_ACCOUNT, (target?"":GetMangosString(LANG_OFFLINE)), nameLink.c_str(), GUID_LOPART(targetGUID), username.c_str(), accId, security, last_ip.c_str(), last_login.c_str(), latency);
|
||||
PSendSysMessage(LANG_PINFO_ACCOUNT, (target?"":GetMangosString(LANG_OFFLINE)), nameLink.c_str(), GUID_LOPART(target_guid), username.c_str(), accId, security, last_ip.c_str(), last_login.c_str(), latency);
|
||||
|
||||
std::string timeStr = secsToTimeString(total_player_time,true,true);
|
||||
uint32 gold = money /GOLD;
|
||||
|
|
@ -2293,7 +2197,7 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
|
|||
uint32 copp = (money % GOLD) % SILVER;
|
||||
PSendSysMessage(LANG_PINFO_LEVEL, timeStr.c_str(), level, gold,silv,copp );
|
||||
|
||||
if ( py && strncmp(py, "rep", 3) == 0 )
|
||||
if( subcommandStr && strncmp(subcommandStr, "rep", 3) == 0 )
|
||||
{
|
||||
if(!target)
|
||||
{
|
||||
|
|
@ -2422,27 +2326,18 @@ bool ChatHandler::HandleTicketCommand(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
std::string name = extractPlayerNameFromLink(px);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
uint64 guid = objmgr.GetPlayerGUIDByName(name);
|
||||
|
||||
if(!guid)
|
||||
uint64 target_guid;
|
||||
if(!extractPlayerTarget(px,NULL,&target_guid))
|
||||
return false;
|
||||
|
||||
// ticket $char_name
|
||||
GMTicket* ticket = ticketmgr.GetGMTicket(GUID_LOPART(guid));
|
||||
GMTicket* ticket = ticketmgr.GetGMTicket(GUID_LOPART(target_guid));
|
||||
if(!ticket)
|
||||
return false;
|
||||
|
||||
std::string time = TimeToTimestampStr(ticket->GetLastUpdate());
|
||||
|
||||
ShowTicket(guid, ticket->GetText(), time.c_str());
|
||||
ShowTicket(target_guid, ticket->GetText(), time.c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2492,27 +2387,20 @@ bool ChatHandler::HandleDelTicketCommand(const char *args)
|
|||
return true;
|
||||
}
|
||||
|
||||
std::string name = extractPlayerNameFromLink(px);
|
||||
if(name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
uint64 guid = objmgr.GetPlayerGUIDByName(name);
|
||||
|
||||
if(!guid)
|
||||
Player* target;
|
||||
uint64 target_guid;
|
||||
std::string target_name;
|
||||
if(!extractPlayerTarget(px,&target,&target_guid,&target_name))
|
||||
return false;
|
||||
|
||||
// delticket $char_name
|
||||
ticketmgr.Delete(GUID_LOPART(guid));
|
||||
ticketmgr.Delete(GUID_LOPART(target_guid));
|
||||
|
||||
// notify players about ticket deleting
|
||||
if(Player* sender = objmgr.GetPlayer(guid))
|
||||
sender->GetSession()->SendGMTicketGetTicket(0x0A,0);
|
||||
if(target)
|
||||
target->GetSession()->SendGMTicketGetTicket(0x0A,0);
|
||||
|
||||
std::string nameLink = playerLink(name);
|
||||
std::string nameLink = playerLink(target_name);
|
||||
|
||||
PSendSysMessage(LANG_COMMAND_TICKETPLAYERDEL,nameLink.c_str());
|
||||
return true;
|
||||
|
|
@ -3663,39 +3551,11 @@ bool ChatHandler::HandleWpImportCommand(const char *args)
|
|||
//rename characters
|
||||
bool ChatHandler::HandleCharacterRenameCommand(const char* args)
|
||||
{
|
||||
Player* target = NULL;
|
||||
uint64 targetGUID = 0;
|
||||
std::string oldname;
|
||||
|
||||
char* px = strtok((char*)args, " ");
|
||||
|
||||
if(px)
|
||||
{
|
||||
oldname = extractPlayerNameFromLink(px);
|
||||
if(oldname.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
target = objmgr.GetPlayer(oldname.c_str());
|
||||
|
||||
if (!target)
|
||||
targetGUID = objmgr.GetPlayerGUIDByName(oldname);
|
||||
}
|
||||
|
||||
if(!target && !targetGUID)
|
||||
{
|
||||
target = getSelectedPlayer();
|
||||
}
|
||||
|
||||
if(!target && !targetGUID)
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
Player* target;
|
||||
uint64 target_guid;
|
||||
std::string target_name;
|
||||
if(!extractPlayerTarget((char*)args,&target,&target_guid,&target_name))
|
||||
return false;
|
||||
}
|
||||
|
||||
if(target)
|
||||
{
|
||||
|
|
@ -3710,13 +3570,13 @@ bool ChatHandler::HandleCharacterRenameCommand(const char* args)
|
|||
else
|
||||
{
|
||||
// check offline security
|
||||
if (HasLowerSecurity(NULL, targetGUID))
|
||||
if (HasLowerSecurity(NULL, target_guid))
|
||||
return false;
|
||||
|
||||
std::string oldNameLink = playerLink(oldname);
|
||||
std::string oldNameLink = playerLink(target_name);
|
||||
|
||||
PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGUID));
|
||||
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '1' WHERE guid = '%u'", GUID_LOPART(targetGUID));
|
||||
PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(target_guid));
|
||||
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '1' WHERE guid = '%u'", GUID_LOPART(target_guid));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -3725,39 +3585,11 @@ bool ChatHandler::HandleCharacterRenameCommand(const char* args)
|
|||
// customize characters
|
||||
bool ChatHandler::HandleCharacterCustomizeCommand(const char* args)
|
||||
{
|
||||
Player* target = NULL;
|
||||
uint64 targetGUID = 0;
|
||||
std::string oldname;
|
||||
|
||||
char* px = strtok((char*)args, " ");
|
||||
|
||||
if(px)
|
||||
{
|
||||
oldname = extractPlayerNameFromLink(px);
|
||||
if(oldname.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
target = objmgr.GetPlayer(oldname.c_str());
|
||||
|
||||
if (!target)
|
||||
targetGUID = objmgr.GetPlayerGUIDByName(oldname);
|
||||
}
|
||||
|
||||
if(!target && !targetGUID)
|
||||
{
|
||||
target = getSelectedPlayer();
|
||||
}
|
||||
|
||||
if(!target && !targetGUID)
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
Player* target;
|
||||
uint64 target_guid;
|
||||
std::string target_name;
|
||||
if(!extractPlayerTarget((char*)args,&target,&target_guid,&target_name))
|
||||
return false;
|
||||
}
|
||||
|
||||
if(target)
|
||||
{
|
||||
|
|
@ -3767,10 +3599,10 @@ bool ChatHandler::HandleCharacterCustomizeCommand(const char* args)
|
|||
}
|
||||
else
|
||||
{
|
||||
std::string oldNameLink = playerLink(oldname);
|
||||
std::string oldNameLink = playerLink(target_name);
|
||||
|
||||
PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGUID));
|
||||
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '8' WHERE guid = '%u'", GUID_LOPART(targetGUID));
|
||||
PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(target_guid));
|
||||
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '8' WHERE guid = '%u'", GUID_LOPART(target_guid));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -4054,41 +3886,16 @@ bool ChatHandler::HandleEventStopCommand(const char* args)
|
|||
|
||||
bool ChatHandler::HandleCombatStopCommand(const char* args)
|
||||
{
|
||||
Player *player;
|
||||
|
||||
if(*args)
|
||||
{
|
||||
std::string playername = extractPlayerNameFromLink((char*)args);
|
||||
if(playername.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
player = objmgr.GetPlayer(playername.c_str());
|
||||
|
||||
if(!player)
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player = getSelectedPlayer();
|
||||
|
||||
if (!player)
|
||||
player = m_session->GetPlayer();
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(player, 0))
|
||||
Player* target;
|
||||
if(!extractPlayerTarget((char*)args,&target))
|
||||
return false;
|
||||
|
||||
player->CombatStop();
|
||||
player->getHostilRefManager().deleteReferences();
|
||||
// check online security
|
||||
if (HasLowerSecurity(target, 0))
|
||||
return false;
|
||||
|
||||
target->CombatStop();
|
||||
target->getHostilRefManager().deleteReferences();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -4320,16 +4127,11 @@ bool ChatHandler::HandleServerCorpsesCommand(const char* /*args*/)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleRepairitemsCommand(const char* /*args*/)
|
||||
bool ChatHandler::HandleRepairitemsCommand(const char* args)
|
||||
{
|
||||
Player *target = getSelectedPlayer();
|
||||
|
||||
if(!target)
|
||||
{
|
||||
PSendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
SetSentErrorMessage(true);
|
||||
Player* target;
|
||||
if(!extractPlayerTarget((char*)args,&target))
|
||||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(target, 0))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue