diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-11 12:36:18 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-11 12:36:18 +0300 |
commit | 71d50c2de2cfe8c9d5b1653596eae90761c8a9d6 (patch) | |
tree | 88234658b6397123e6c3176d119d1a45df672ed4 | |
parent | 660d3b585ab50038e5b2ea3fb9cf4049a7e697d1 (diff) | |
download | mv-71d50c2de2cfe8c9d5b1653596eae90761c8a9d6.tar.gz mv-71d50c2de2cfe8c9d5b1653596eae90761c8a9d6.tar.bz2 mv-71d50c2de2cfe8c9d5b1653596eae90761c8a9d6.tar.xz mv-71d50c2de2cfe8c9d5b1653596eae90761c8a9d6.zip |
Add action and chat command for "catch pet".
New chat command: /catchpet - Try catch selected monster
-rw-r--r-- | src/actions/actions.cpp | 17 | ||||
-rw-r--r-- | src/actions/actions.h | 1 | ||||
-rw-r--r-- | src/input/inputaction.h | 1 | ||||
-rw-r--r-- | src/input/inputactionmap.h | 11 | ||||
-rw-r--r-- | src/input/pages/basic.cpp | 6 |
5 files changed, 35 insertions, 1 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index 250e43227..e3ad3a11a 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -1157,4 +1157,21 @@ impHandler(uploadLog) return true; } +impHandler(catchPet) +{ + if (!localPlayer || !actorManager) + return false; + + Being *target = nullptr; + if (!event.args.empty()) + target = actorManager->findNearestByName(event.args); + if (!target) + target = localPlayer->getTarget(); + else + localPlayer->setTarget(target); + if (target) + Net::getPetHandler()->catchPet(target); + return true; +} + } // namespace Actions diff --git a/src/actions/actions.h b/src/actions/actions.h index 04535700a..d03c8b8ac 100644 --- a/src/actions/actions.h +++ b/src/actions/actions.h @@ -88,6 +88,7 @@ namespace Actions decHandler(uploadConfig); decHandler(uploadServerConfig); decHandler(uploadLog); + decHandler(catchPet); } // namespace Actions #undef decHandler diff --git a/src/input/inputaction.h b/src/input/inputaction.h index 3146e290b..e272cefd4 100644 --- a/src/input/inputaction.h +++ b/src/input/inputaction.h @@ -477,6 +477,7 @@ namespace InputAction PET_EMOTE_46, PET_EMOTE_47, PET_EMOTE_48, + CATCH_PET, TOTAL }; } // namespace InputAction diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index eb95e8fc3..a355c33ba 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -4034,7 +4034,16 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { InputAction::PET_EMOTE, 100, InputCondition::GAME, "", - false} + false}, + {"keyCatchPet", + InputType::UNKNOWN, InputAction::NO_VALUE, + InputType::UNKNOWN, InputAction::NO_VALUE, + Input::GRP_DEFAULT, + &Actions::catchPet, + InputAction::NO_VALUE, 50, + InputCondition::INGAME, + "catchpet|catch", + true}, }; #endif // INPUT_INPUTACTIONMAP_H diff --git a/src/input/pages/basic.cpp b/src/input/pages/basic.cpp index 9d158f0be..8975c23a4 100644 --- a/src/input/pages/basic.cpp +++ b/src/input/pages/basic.cpp @@ -129,6 +129,12 @@ SetupActionData setupActionDataBasic[] = }, { // TRANSLATORS: input action name + N_("Catch pet"), + InputAction::CATCH_PET, + "", + }, + { + // TRANSLATORS: input action name N_("Other Keys"), InputAction::NO_VALUE, "", |