summaryrefslogtreecommitdiff
path: root/src/game-server/command.cpp
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-08-31 14:06:00 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-08-31 14:06:00 +0000
commit0c52964be1d7158bf6533011b4e08287608a6926 (patch)
treea909c5ea79ed82345baa34152ce892a400500194 /src/game-server/command.cpp
parent60f60de8aefeebd1de0bf6c940558902226d7747 (diff)
downloadmanaserv-0c52964be1d7158bf6533011b4e08287608a6926.tar.gz
manaserv-0c52964be1d7158bf6533011b4e08287608a6926.tar.bz2
manaserv-0c52964be1d7158bf6533011b4e08287608a6926.tar.xz
manaserv-0c52964be1d7158bf6533011b4e08287608a6926.zip
Implemented "ban" remote command.
Diffstat (limited to 'src/game-server/command.cpp')
-rw-r--r--src/game-server/command.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/game-server/command.cpp b/src/game-server/command.cpp
index dfb218fe..57751621 100644
--- a/src/game-server/command.cpp
+++ b/src/game-server/command.cpp
@@ -24,6 +24,7 @@
#include <cstddef>
#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),
};
/**