summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-06-22 22:15:50 +0300
committerAndrei Karas <akaras@inbox.ru>2017-06-22 22:15:50 +0300
commit92eb0630eb067fbe0a18edb93a02f6fd424c3212 (patch)
tree8dc535f94f3fbf26979905f583af92ecb95f166f
parent917235b0e5ffd8e8e7ec32ea65ca537f0217b954 (diff)
downloadmv-92eb0630eb067fbe0a18edb93a02f6fd424c3212.tar.gz
mv-92eb0630eb067fbe0a18edb93a02f6fd424c3212.tar.bz2
mv-92eb0630eb067fbe0a18edb93a02f6fd424c3212.tar.xz
mv-92eb0630eb067fbe0a18edb93a02f6fd424c3212.zip
Add chat command for drop pet's loot.
-rw-r--r--src/actions/actions.cpp7
-rw-r--r--src/actions/actions.h1
-rw-r--r--src/dyetool/actions/actions.cpp1
-rw-r--r--src/enums/input/inputaction.h1
-rw-r--r--src/gui/popups/popupmenu.cpp6
-rw-r--r--src/input/inputactionmap.h6
-rw-r--r--src/input/pages/other.cpp6
7 files changed, 23 insertions, 5 deletions
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
@@ -440,6 +440,12 @@ SetupActionData setupActionDataOther[] =
"",
},
{
+ // TRANSLATORS: input action name
+ N_("Drop pet's loot"),
+ InputAction::PET_DROP_LOOT,
+ "",
+ },
+ {
"",
InputAction::NO_VALUE,
""