From 192b8db5c67860ec9a67d19d9529b01794ae1c83 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 25 Feb 2015 22:06:39 +0300 Subject: Add command and action for show homunculus/mercenary emotes. New chat command: /homunemote emote /mercemote emote --- src/actions/commands.cpp | 30 +++ src/actions/commands.h | 2 + src/game.cpp | 1 + src/input/inputaction.h | 50 +++++ src/input/inputactiondata.h | 3 +- src/input/inputactionmap.h | 442 ++++++++++++++++++++++++++++++++++++++++++++ src/input/pages/emotes.cpp | 6 + 7 files changed, 533 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index c879916a1..25be294a0 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -22,6 +22,7 @@ #include "actormanager.h" #include "configuration.h" +#include "emoteshortcut.h" #include "game.h" #include "inventory.h" #include "item.h" @@ -817,4 +818,33 @@ impHandler(homunTalk) return true; } +impHandler(homunEmote) +{ + if (!serverFeatures->haveTalkPet()) + return false; + + if (event.action >= InputAction::HOMUN_EMOTE_1 + && event.action <= InputAction::HOMUN_EMOTE_48) + { + const int emotion = event.action - InputAction::HOMUN_EMOTE_1; + if (emoteShortcut) + homunculusHandler->emote(emoteShortcut->getEmote(emotion)); + if (Game::instance()) + Game::instance()->setValidSpeed(); + return true; + } + + return false; +} + +impHandler(commandHomunEmote) +{ + if (!serverFeatures->haveTalkPet()) + return false; + + homunculusHandler->emote(static_cast( + atoi(event.args.c_str()))); + return true; +} + } // namespace Actions diff --git a/src/actions/commands.h b/src/actions/commands.h index de09f2633..6417dd32e 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -80,6 +80,8 @@ namespace Actions decHandler(leaveParty); decHandler(warp); decHandler(homunTalk); + decHandler(homunEmote); + decHandler(commandHomunEmote); } // namespace Actions #undef decHandler diff --git a/src/game.cpp b/src/game.cpp index cce123b79..204732a15 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -895,6 +895,7 @@ void Game::handleMove() if ((!inputManager.isActionActive(InputAction::EMOTE) && !inputManager.isActionActive(InputAction::PET_EMOTE) + && !inputManager.isActionActive(InputAction::HOMUN_EMOTE) && !inputManager.isActionActive(InputAction::STOP_ATTACK)) || direction == 0) { diff --git a/src/input/inputaction.h b/src/input/inputaction.h index 281022755..7b7a5e4cc 100644 --- a/src/input/inputaction.h +++ b/src/input/inputaction.h @@ -539,6 +539,56 @@ namespace InputAction HEAL_MOST_DAMAGED, PET_MOVE, HOMUN_TALK, + HOMUN_SMILE, + HOMUN_EMOTE, + HOMUN_EMOTE_1, + HOMUN_EMOTE_2, + HOMUN_EMOTE_3, + HOMUN_EMOTE_4, + HOMUN_EMOTE_5, + HOMUN_EMOTE_6, + HOMUN_EMOTE_7, + HOMUN_EMOTE_8, + HOMUN_EMOTE_9, + HOMUN_EMOTE_10, + HOMUN_EMOTE_11, + HOMUN_EMOTE_12, + HOMUN_EMOTE_13, + HOMUN_EMOTE_14, + HOMUN_EMOTE_15, + HOMUN_EMOTE_16, + HOMUN_EMOTE_17, + HOMUN_EMOTE_18, + HOMUN_EMOTE_19, + HOMUN_EMOTE_20, + HOMUN_EMOTE_21, + HOMUN_EMOTE_22, + HOMUN_EMOTE_23, + HOMUN_EMOTE_24, + HOMUN_EMOTE_25, + HOMUN_EMOTE_26, + HOMUN_EMOTE_27, + HOMUN_EMOTE_28, + HOMUN_EMOTE_29, + HOMUN_EMOTE_30, + HOMUN_EMOTE_31, + HOMUN_EMOTE_32, + HOMUN_EMOTE_33, + HOMUN_EMOTE_34, + HOMUN_EMOTE_35, + HOMUN_EMOTE_36, + HOMUN_EMOTE_37, + HOMUN_EMOTE_38, + HOMUN_EMOTE_39, + HOMUN_EMOTE_40, + HOMUN_EMOTE_41, + HOMUN_EMOTE_42, + HOMUN_EMOTE_43, + HOMUN_EMOTE_44, + HOMUN_EMOTE_45, + HOMUN_EMOTE_46, + HOMUN_EMOTE_47, + HOMUN_EMOTE_48, TOTAL }; } // namespace InputAction diff --git a/src/input/inputactiondata.h b/src/input/inputactiondata.h index 0c3c2c2e1..a0f4c6279 100644 --- a/src/input/inputactiondata.h +++ b/src/input/inputactiondata.h @@ -55,7 +55,8 @@ namespace Input GRP_MOVETOPOINT = 32, // move to point key GRP_GUICHAN = 64, // for guichan based controls GRP_REPEAT = 128, // repeat emulation keys - GRP_PET_EMOTION = 256 // pet emotions key + GRP_PET_EMOTION = 256, // pet emotions key + GRP_HOMUN_EMOTION = 512 // homunculus/mercenary emotetions key }; } // namespace Input diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 7e8465781..33cfc942f 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -3989,6 +3989,448 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { InputCondition::INGAME, "homuntalk|merctalk", true}, + {"keyHomunEmote", + defaultAction(&Actions::commandHomunEmote), + InputCondition::INGAME, + "homunemote|mercemote", + true}, + {"keyHomunSmilie", + defaultAction(nullptr), + InputCondition::DEFAULT | InputCondition::INGAME, + "", + false}, + {"keyHomunEmoteShortcut1", + addKey(SDLK_1), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut2", + addKey(SDLK_2), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut3", + addKey(SDLK_3), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut4", + addKey(SDLK_4), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut5", + addKey(SDLK_5), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut6", + addKey(SDLK_6), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut7", + addKey(SDLK_7), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut8", + addKey(SDLK_8), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut9", + addKey(SDLK_9), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut10", + addKey(SDLK_0), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut11", + addKey(SDLK_MINUS), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut12", + addKey(SDLK_EQUALS), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut13", + addKey(SDLK_BACKSPACE), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut14", + addKey(SDLK_INSERT), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut15", + addKey(SDLK_HOME), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut16", + addKey(SDLK_q), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut17", + addKey(SDLK_w), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut18", + addKey(SDLK_e), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut19", + addKey(SDLK_r), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut20", + addKey(SDLK_t), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut21", + addKey(SDLK_y), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut22", + addKey(SDLK_u), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut23", + addKey(SDLK_i), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut24", + addKey(SDLK_o), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut25", + addKey(SDLK_p), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut26", + addKey(SDLK_LEFTBRACKET), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut27", + addKey(SDLK_RIGHTBRACKET), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut28", + addKey(SDLK_BACKSLASH), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut29", + addKey(SDLK_a), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut30", + addKey(SDLK_s), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut31", + addKey(SDLK_d), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut32", + addKey(SDLK_f), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut33", + addKey(SDLK_g), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut34", + addKey(SDLK_h), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut35", + addKey(SDLK_j), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut36", + addKey(SDLK_k), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut37", + addKey(SDLK_l), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut38", + addKey(SDLK_SEMICOLON), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut39", + addKey(SDLK_QUOTE), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut40", + addKey(SDLK_z), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut41", + addKey(SDLK_x), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut42", + addKey(SDLK_c), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut43", + addKey(SDLK_v), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut44", + addKey(SDLK_b), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut45", + addKey(SDLK_n), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut46", + addKey(SDLK_m), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut47", + addKey(SDLK_COMMA), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, + {"keyHomunEmoteShortcut48", + addKey(SDLK_PERIOD), + emptyKey, + Input::GRP_HOMUN_EMOTION, + &Actions::homunEmote, + InputAction::HOMUN_EMOTE, 100, + InputCondition::GAME, + "", + false}, }; #undef defaultAction diff --git a/src/input/pages/emotes.cpp b/src/input/pages/emotes.cpp index c5b648ce6..194a4ed44 100644 --- a/src/input/pages/emotes.cpp +++ b/src/input/pages/emotes.cpp @@ -50,6 +50,12 @@ SetupActionData setupActionDataEmotes[] = InputAction::PET_EMOTE, "", }, + { + // TRANSLATORS: input action name + N_("Homunculus / mercenary emote modifier key"), + InputAction::HOMUN_EMOTE, + "", + }, { // TRANSLATORS: input action name N_("Emote shortcuts"), -- cgit v1.2.3-70-g09d2