diff options
| author | David Athay <ko2fan@gmail.com> | 2008-10-24 15:18:02 +0000 |
|---|---|---|
| committer | David Athay <ko2fan@gmail.com> | 2008-10-24 15:18:02 +0000 |
| commit | 20fe6419f8d9564e7ab098ead53c6ef5da1519fa (patch) | |
| tree | 5313713cd9f12ca3fc503db2ceaccaa73f12a355 /src/game-server/command.cpp | |
| parent | ef9852cddecfc5abce38438ca2138defb1a9b1bf (diff) | |
| download | manaserv-20fe6419f8d9564e7ab098ead53c6ef5da1519fa.tar.gz manaserv-20fe6419f8d9564e7ab098ead53c6ef5da1519fa.tar.xz manaserv-20fe6419f8d9564e7ab098ead53c6ef5da1519fa.zip | |
Added post callback for getting post.
Added GM command for changing player attributes. Changed GM command to
@ as '/' was already being used by client for local commands.
Diffstat (limited to 'src/game-server/command.cpp')
| -rw-r--r-- | src/game-server/command.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/game-server/command.cpp b/src/game-server/command.cpp index 4c9ae11..ad013ff 100644 --- a/src/game-server/command.cpp +++ b/src/game-server/command.cpp @@ -262,6 +262,11 @@ static void ban(Character *from, Character *ch, std::string const &duration) accountHandler->banCharacter(ch, d); } +static void attribute(Character*, Character *ch, int attr, int value) +{ + ch->setAttribute(attr, value); +} + /** * List of remote commands. */ @@ -276,6 +281,7 @@ static Command const commands[] = handle("recall", AL_GM, recall), handle("reload", AL_ADMIN, reload), handle("ban", AL_GM, ban), + handle("attribute", AL_GM, attribute), }; /** @@ -295,8 +301,10 @@ void runCommand(Character *ch, std::string const &text) Command const *c = NULL; std::string::size_type npos = std::string::npos; std::string::size_type pos = text.find(' '); - std::string s(text, 1, pos == npos ? npos : pos - 1); // Skip slash. + // remove the first letter which signifies it was a command + std::string s(text, 1, pos == npos ? npos : pos - 1); + // check for valid command for (int i = 0; i < (int)(sizeof(commands) / sizeof(commands[0])); ++i) { if (s == commands[i].name) |
