From 0888773fc1de5cc2aa1d92564e8d05231189e6f9 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 26 Aug 2014 21:43:19 +0300 Subject: Move chat command /addattack into actions. --- src/actions/commands.cpp | 13 +++++++++++++ src/actions/commands.h | 1 + src/commands.cpp | 13 ------------- src/commands.h | 5 +---- src/input/inputaction.h | 1 + src/input/inputactionmap.h | 9 +++++++++ 6 files changed, 25 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index ab45786e1..78a2fc0e5 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -483,4 +483,17 @@ impHandler(addPriorityAttack) return true; } +impHandler(addAttack) +{ + if (!actorManager || actorManager->isInAttackList(event.args)) + return false; + + actorManager->removeAttackMob(event.args); + actorManager->addAttackMob(event.args); + + if (socialWindow) + socialWindow->updateAttackFilter(); + return true; +} + } // namespace Actions diff --git a/src/actions/commands.h b/src/actions/commands.h index 2008f865b..a1e7b86f9 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -52,6 +52,7 @@ namespace Actions decHandler(info); decHandler(wait); decHandler(addPriorityAttack); + decHandler(addAttack); } // namespace Actions #undef decHandler diff --git a/src/commands.cpp b/src/commands.cpp index edccdec54..46d2f17ea 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -157,19 +157,6 @@ impHandler(hack) return true; } -impHandler(addAttack) -{ - if (!actorManager || actorManager->isInAttackList(event.args)) - return false; - - actorManager->removeAttackMob(event.args); - actorManager->addAttackMob(event.args); - - if (socialWindow) - socialWindow->updateAttackFilter(); - return true; -} - impHandler(removeAttack) { if (!actorManager || event.args.empty() diff --git a/src/commands.h b/src/commands.h index 147b1fb31..b8d6ab829 100644 --- a/src/commands.h +++ b/src/commands.h @@ -52,7 +52,6 @@ struct CommandInfo final namespace Commands { decHandler(hack); - decHandler(addAttack); decHandler(removeAttack); decHandler(addIgnoreAttack); decHandler(serverIgnoreAll); @@ -91,8 +90,7 @@ namespace Commands enum { - COMMAND_ADDATTACK = 0, - COMMAND_REMOVEATTACK, + COMMAND_REMOVEATTACK = 0, COMMAND_REMOVEIGNOREATTACK, COMMAND_ADDIGNOREATTACK, COMMAND_DUMP, @@ -131,7 +129,6 @@ enum static const CommandInfo commands[] = { - {"addattack", &Commands::addAttack, -1, true}, {"removeattack", Commands::removeAttack, -1, true}, {"removeignoreattack", &Commands::removeAttack, -1, true}, {"addignoreattack", &Commands::addIgnoreAttack, -1, true}, diff --git a/src/input/inputaction.h b/src/input/inputaction.h index b9e412e3f..dfdab0777 100644 --- a/src/input/inputaction.h +++ b/src/input/inputaction.h @@ -390,6 +390,7 @@ namespace InputAction WAIT, UPTIME, ADD_PRIORITY_ATTACK, + ADD_ATTACK, TOTAL }; } // namespace InputAction diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index f7f8fde27..b7f59361d 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -3279,6 +3279,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { InputAction::NO_VALUE, 50, InputCondition::INGAME, "addpriorityattack", + true}, + {"keyAddAttack", + InputType::UNKNOWN, InputAction::NO_VALUE, + InputType::UNKNOWN, InputAction::NO_VALUE, + Input::GRP_DEFAULT, + &Actions::addAttack, + InputAction::NO_VALUE, 50, + InputCondition::INGAME, + "addattack", true} }; -- cgit v1.2.3-60-g2f50