From 92eb0630eb067fbe0a18edb93a02f6fd424c3212 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 22 Jun 2017 22:15:50 +0300 Subject: Add chat command for drop pet's loot. --- src/actions/actions.cpp | 7 +++++++ src/actions/actions.h | 1 + src/dyetool/actions/actions.cpp | 1 + src/enums/input/inputaction.h | 1 + src/gui/popups/popupmenu.cpp | 6 +----- src/input/inputactionmap.h | 6 ++++++ src/input/pages/other.cpp | 6 ++++++ 7 files changed, 23 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index f9ce46cd9..96a6e48ca 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -1624,6 +1624,13 @@ impHandler0(petFeed) return true; } +impHandler0(petDropLoot) +{ + if (petHandler != nullptr) + petHandler->dropLoot(); + return true; +} + impHandler(useItem) { const int itemId = atoi(event.args.c_str()); diff --git a/src/actions/actions.h b/src/actions/actions.h index f7f5ea0ba..bbe1c4847 100644 --- a/src/actions/actions.h +++ b/src/actions/actions.h @@ -105,6 +105,7 @@ namespace Actions decHandler(homunculusToMaster); decHandler(homunculusFeed); decHandler(petFeed); + decHandler(petDropLoot); decHandler(useItem); decHandler(useItemInv); decHandler(invToStorage); diff --git a/src/dyetool/actions/actions.cpp b/src/dyetool/actions/actions.cpp index a7e642a57..a09685e03 100644 --- a/src/dyetool/actions/actions.cpp +++ b/src/dyetool/actions/actions.cpp @@ -101,6 +101,7 @@ impHandlerVoid(mercenaryToMaster) impHandlerVoid(homunculusToMaster) impHandlerVoid(homunculusFeed) impHandlerVoid(petFeed) +impHandlerVoid(petDropLoot) impHandlerVoid(useItem) impHandlerVoid(useItemInv) impHandlerVoid(invToStorage) diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h index 035bbe3e7..3099c89ea 100644 --- a/src/enums/input/inputaction.h +++ b/src/enums/input/inputaction.h @@ -705,6 +705,7 @@ enumStart(InputAction) HOMUNCULUS_TO_MASTER, HOMUNCULUS_FEED, PET_FEED, + PET_DROP_LOOT, TOTAL } enumEnd(InputAction); diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 866b8b3bd..0503e6e8f 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -380,7 +380,7 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being) mBrowserBox->addRow("/petfeed", _("Feed")); // TRANSLATORS: popup menu item // TRANSLATORS: pet drop loot - mBrowserBox->addRow("pet drop loot", _("Drop loot")); + mBrowserBox->addRow("/petdroploot", _("Drop loot")); // TRANSLATORS: popup menu item // TRANSLATORS: pet unequip item mBrowserBox->addRow("pet unequip", _("Unequip")); @@ -1302,10 +1302,6 @@ void PopupMenu::handleLink(const std::string &link, showCraftPopup(); return; } - else if (link == "pet drop loot") - { - petHandler->dropLoot(); - } else if (link == "pet to egg") { petHandler->returnToEgg(); diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 66224664c..6007a3007 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -5720,6 +5720,12 @@ static const InputActionData inputActionData "petfeed|feedpet", UseArgs_false, Protected_false}, + {"keyPetDropLoot", + defaultAction(&Actions::petDropLoot), + InputCondition::INGAME, + "petdroploot|petloot", + UseArgs_false, + Protected_true}, }; #undef defaultAction diff --git a/src/input/pages/other.cpp b/src/input/pages/other.cpp index bcfab0806..c215f2fd0 100644 --- a/src/input/pages/other.cpp +++ b/src/input/pages/other.cpp @@ -439,6 +439,12 @@ SetupActionData setupActionDataOther[] = InputAction::PET_FEED, "", }, + { + // TRANSLATORS: input action name + N_("Drop pet's loot"), + InputAction::PET_DROP_LOOT, + "", + }, { "", InputAction::NO_VALUE, -- cgit v1.2.3-60-g2f50