summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-12-14 13:54:08 +0300
committerAndrei Karas <akaras@inbox.ru>2014-12-14 13:54:08 +0300
commit66319a9c3647c77bd13ca8c9a46bf15ba10863fa (patch)
tree1a4b13107d153d4383fb74b55a45e5cceccee9ca /src
parentf567410dc7cdcf888dc4a5fa6e3e50cb8d659e80 (diff)
downloadplus-66319a9c3647c77bd13ca8c9a46bf15ba10863fa.tar.gz
plus-66319a9c3647c77bd13ca8c9a46bf15ba10863fa.tar.bz2
plus-66319a9c3647c77bd13ca8c9a46bf15ba10863fa.tar.xz
plus-66319a9c3647c77bd13ca8c9a46bf15ba10863fa.zip
Add chat command for kick player/mobs.
New chat command: /kick [name|:id]
Diffstat (limited to 'src')
-rw-r--r--src/actions/actions.cpp22
-rw-r--r--src/actions/actions.h1
-rw-r--r--src/input/inputaction.h1
-rw-r--r--src/input/inputactionmap.h9
4 files changed, 33 insertions, 0 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp
index e689db941..bd8431b31 100644
--- a/src/actions/actions.cpp
+++ b/src/actions/actions.cpp
@@ -66,6 +66,7 @@
#include "render/normalopenglgraphics.h"
#endif
+#include "net/adminhandler.h"
#include "net/beinghandler.h"
#include "net/buysellhandler.h"
#include "net/chathandler.h"
@@ -1509,4 +1510,25 @@ impHandler(unprotectItem)
return true;
}
+impHandler(kick)
+{
+ if (!localPlayer || !actorManager)
+ return false;
+
+ Being *target = nullptr;
+ std::string args = event.args;
+ if (!args.empty())
+ {
+ if (args[0] != ':')
+ target = actorManager->findNearestByName(args);
+ else
+ target = actorManager->findBeing(atoi(args.substr(1).c_str()));
+ }
+ if (!target)
+ target = localPlayer->getTarget();
+ if (target)
+ adminHandler->kick(target->getId());
+ return true;
+}
+
} // namespace Actions
diff --git a/src/actions/actions.h b/src/actions/actions.h
index cbd7489f3..922d32d12 100644
--- a/src/actions/actions.h
+++ b/src/actions/actions.h
@@ -103,6 +103,7 @@ namespace Actions
decHandler(storageToInv);
decHandler(protectItem);
decHandler(unprotectItem);
+ decHandler(kick);
} // namespace Actions
#undef decHandler
diff --git a/src/input/inputaction.h b/src/input/inputaction.h
index cc4488e51..d09099c84 100644
--- a/src/input/inputaction.h
+++ b/src/input/inputaction.h
@@ -512,6 +512,7 @@ namespace InputAction
ITEM_UNPROTECT,
KICK_PARTY,
ADD_TEXT,
+ KICK,
TOTAL
};
} // namespace InputAction
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index f03e81559..28def4d1b 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -4351,6 +4351,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = {
InputCondition::INGAME,
"addtext|textadd",
true},
+ {"keyKick",
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ Input::GRP_DEFAULT,
+ &Actions::kick,
+ InputAction::NO_VALUE, 50,
+ InputCondition::INGAME,
+ "kick",
+ true},
};
#endif // INPUT_INPUTACTIONMAP_H