summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoseph Botosh <rumly111@i.ua>2012-11-12 19:12:22 +0300
committerAndrei Karas <akaras@inbox.ru>2012-11-12 19:13:40 +0300
commit97b54e33f09eb9b0417bafce18ea163af89009bb (patch)
tree6b03b0b6d5f6fca5782a4b79c9b11ff37bb4f5be /src
parent363223352ee9c4c7c1d65e49cf48b38b538abaf2 (diff)
downloadManaVerse-97b54e33f09eb9b0417bafce18ea163af89009bb.tar.gz
ManaVerse-97b54e33f09eb9b0417bafce18ea163af89009bb.tar.bz2
ManaVerse-97b54e33f09eb9b0417bafce18ea163af89009bb.tar.xz
ManaVerse-97b54e33f09eb9b0417bafce18ea163af89009bb.zip
Added /atkhuman command
Diffstat (limited to 'src')
-rw-r--r--src/commandhandler.cpp21
-rw-r--r--src/commandhandler.h4
2 files changed, 25 insertions, 0 deletions
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp
index 001c50e6b..83078f49b 100644
--- a/src/commandhandler.cpp
+++ b/src/commandhandler.cpp
@@ -152,6 +152,8 @@ void CommandHandler::handleCommand(const std::string &command,
handleMove(args, tab);
else if (type == "target")
handleTarget(args, tab);
+ else if (type == "atkhuman")
+ handleAttackHuman(args, tab);
else if (type == "outfit")
handleOutfit(args, tab);
else if (type == "emote")
@@ -709,6 +711,25 @@ void CommandHandler::handleTarget(const std::string &args,
player_node->setTarget(target);
}
+void CommandHandler::handleAttackHuman(const std::string &args,
+ ChatTab *const tab A_UNUSED)
+{
+ if (!actorSpriteManager || !player_node)
+ return;
+
+ Being *const target = actorSpriteManager->findNearestLivingBeing(
+ player_node, 10, ActorSprite::PLAYER);
+ if (target)
+ {
+ if (player_node->checAttackPermissions(target))
+ {
+ player_node->setTarget(target);
+ player_node->attack2(target, true);
+ }
+ }
+}
+
+
void CommandHandler::handleCloseAll(const std::string &args A_UNUSED,
ChatTab *const tab A_UNUSED)
{
diff --git a/src/commandhandler.h b/src/commandhandler.h
index 5a73b2335..228682783 100644
--- a/src/commandhandler.h
+++ b/src/commandhandler.h
@@ -219,6 +219,10 @@ class CommandHandler final
* Handle target command.
*/
static void handleTarget(const std::string &args, ChatTab *const tab);
+ /**
+ * Handle atkhuman command.
+ */
+ static void handleAttackHuman(const std::string &args, ChatTab *const tab);
/**
* Handle closeall command.