From 0c52964be1d7158bf6533011b4e08287608a6926 Mon Sep 17 00:00:00 2001 From: Guillaume Melquiond Date: Fri, 31 Aug 2007 14:06:00 +0000 Subject: Implemented "ban" remote command. --- src/game-server/command.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/game-server/command.cpp') diff --git a/src/game-server/command.cpp b/src/game-server/command.cpp index dfb218f..5775162 100644 --- a/src/game-server/command.cpp +++ b/src/game-server/command.cpp @@ -24,6 +24,7 @@ #include #include "defines.h" +#include "game-server/accountconnection.hpp" #include "game-server/character.hpp" #include "game-server/gamehandler.hpp" #include "game-server/inventory.hpp" @@ -245,6 +246,23 @@ static void reload(Character *from, std::string const &db) } } +static void ban(Character *from, Character *ch, std::string const &duration) +{ + if (from->getAccountLevel() <= ch->getAccountLevel()) + { + // Special case: Only ban strictly less priviledged accounts. + return; + } + + int d = atoi(duration.c_str()); + switch (duration[duration.length() - 1]) + { + case 'd': d = d * 24; // nobreak + case 'h': d = d * 60; + } + accountHandler->banCharacter(ch, d); +} + /** * List of remote commands. */ @@ -258,6 +276,7 @@ static Command const commands[] = handle("goto", AL_GM, goto_), handle("recall", AL_GM, recall), handle("reload", AL_ADMIN, reload), + handle("ban", AL_GM, ban), }; /** -- cgit