diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-06-22 21:57:15 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-06-22 21:57:15 +0300 |
commit | 917235b0e5ffd8e8e7ec32ea65ca537f0217b954 (patch) | |
tree | 547e6c6ec98080de98919214ca04a388239baede /src | |
parent | 0f6dad4c14f1f87797f903d8b4c4b87dcbc6a907 (diff) | |
download | mv-917235b0e5ffd8e8e7ec32ea65ca537f0217b954.tar.gz mv-917235b0e5ffd8e8e7ec32ea65ca537f0217b954.tar.bz2 mv-917235b0e5ffd8e8e7ec32ea65ca537f0217b954.tar.xz mv-917235b0e5ffd8e8e7ec32ea65ca537f0217b954.zip |
Add chat command for feed pet.
Diffstat (limited to 'src')
-rw-r--r-- | src/actions/actions.cpp | 10 | ||||
-rw-r--r-- | src/actions/actions.h | 1 | ||||
-rw-r--r-- | src/dyetool/actions/actions.cpp | 1 | ||||
-rw-r--r-- | src/enums/input/inputaction.h | 1 | ||||
-rw-r--r-- | src/gui/popups/popupmenu.cpp | 6 | ||||
-rw-r--r-- | src/input/inputactionmap.h | 6 | ||||
-rw-r--r-- | src/input/pages/other.cpp | 6 |
7 files changed, 25 insertions, 6 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index afd774b79..f9ce46cd9 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -90,12 +90,13 @@ #include "net/ipc.h" #include "net/mercenaryhandler.h" #include "net/net.h" -#include "net/vendinghandler.h" #include "net/npchandler.h" #include "net/playerhandler.h" +#include "net/pethandler.h" #include "net/serverfeatures.h" #include "net/uploadcharinfo.h" #include "net/tradehandler.h" +#include "net/vendinghandler.h" #include "resources/iteminfo.h" #include "resources/memorymanager.h" @@ -1616,6 +1617,13 @@ impHandler0(homunculusFeed) return true; } +impHandler0(petFeed) +{ + if (petHandler != nullptr) + petHandler->feed(); + 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 83072680c..f7f5ea0ba 100644 --- a/src/actions/actions.h +++ b/src/actions/actions.h @@ -104,6 +104,7 @@ namespace Actions decHandler(mercenaryToMaster); decHandler(homunculusToMaster); decHandler(homunculusFeed); + decHandler(petFeed); decHandler(useItem); decHandler(useItemInv); decHandler(invToStorage); diff --git a/src/dyetool/actions/actions.cpp b/src/dyetool/actions/actions.cpp index 58353b699..a7e642a57 100644 --- a/src/dyetool/actions/actions.cpp +++ b/src/dyetool/actions/actions.cpp @@ -100,6 +100,7 @@ impHandlerVoid(mercenaryFire) impHandlerVoid(mercenaryToMaster) impHandlerVoid(homunculusToMaster) impHandlerVoid(homunculusFeed) +impHandlerVoid(petFeed) impHandlerVoid(useItem) impHandlerVoid(useItemInv) impHandlerVoid(invToStorage) diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h index 0962bf34f..035bbe3e7 100644 --- a/src/enums/input/inputaction.h +++ b/src/enums/input/inputaction.h @@ -704,6 +704,7 @@ enumStart(InputAction) MERCENARY_TO_MASTER, HOMUNCULUS_TO_MASTER, HOMUNCULUS_FEED, + PET_FEED, TOTAL } enumEnd(InputAction); diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 1281a8d2c..866b8b3bd 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -377,7 +377,7 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being) { // TRANSLATORS: popup menu item // TRANSLATORS: feed pet - mBrowserBox->addRow("pet feed", _("Feed")); + mBrowserBox->addRow("/petfeed", _("Feed")); // TRANSLATORS: popup menu item // TRANSLATORS: pet drop loot mBrowserBox->addRow("pet drop loot", _("Drop loot")); @@ -1302,10 +1302,6 @@ void PopupMenu::handleLink(const std::string &link, showCraftPopup(); return; } - else if (link == "pet feed") - { - petHandler->feed(); - } else if (link == "pet drop loot") { petHandler->dropLoot(); diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 881368195..66224664c 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -5714,6 +5714,12 @@ static const InputActionData inputActionData "homunculusfeed|homunfeed|feedhomun|feedhomunculus", UseArgs_false, Protected_false}, + {"keyPetFeed", + defaultAction(&Actions::petFeed), + InputCondition::INGAME, + "petfeed|feedpet", + UseArgs_false, + Protected_false}, }; #undef defaultAction diff --git a/src/input/pages/other.cpp b/src/input/pages/other.cpp index 3d37bd982..bcfab0806 100644 --- a/src/input/pages/other.cpp +++ b/src/input/pages/other.cpp @@ -434,6 +434,12 @@ SetupActionData setupActionDataOther[] = "", }, { + // TRANSLATORS: input action name + N_("Feed pet"), + InputAction::PET_FEED, + "", + }, + { "", InputAction::NO_VALUE, "" |