mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 13:37:00 +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
|
|
@ -2452,31 +2452,6 @@ void World::KickAllLess(AccountTypes sec)
|
|||
itr->second->KickPlayer();
|
||||
}
|
||||
|
||||
/// Kick (and save) the designated player
|
||||
bool World::KickPlayer(const std::string& playerName)
|
||||
{
|
||||
SessionMap::const_iterator itr;
|
||||
|
||||
// session not removed at kick and will removed in next update tick
|
||||
for (itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
|
||||
{
|
||||
if(!itr->second)
|
||||
continue;
|
||||
Player *player = itr->second->GetPlayer();
|
||||
if(!player)
|
||||
continue;
|
||||
if( player->IsInWorld() )
|
||||
{
|
||||
if (playerName == player->GetName())
|
||||
{
|
||||
itr->second->KickPlayer();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Ban an account or ban an IP address, duration will be parsed using TimeStringToSecs if it is positive, otherwise permban
|
||||
BanReturn World::BanAccount(BanMode mode, std::string nameOrIP, std::string duration, std::string reason, std::string author)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue