summaryrefslogtreecommitdiff
path: root/src/gui/popups/popupmenu.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-01-27 16:07:28 +0300
committerAndrei Karas <akaras@inbox.ru>2016-01-27 16:07:28 +0300
commitab608a29a138cd5db47fad949f1f3993d21af153 (patch)
treece0cd37ef79c8c87068c83d0b509bff52186badd /src/gui/popups/popupmenu.cpp
parent57ae5040b2f2fcaed6b80f5a10573a0abaccdf5f (diff)
downloadmanaplus-ab608a29a138cd5db47fad949f1f3993d21af153.tar.gz
manaplus-ab608a29a138cd5db47fad949f1f3993d21af153.tar.bz2
manaplus-ab608a29a138cd5db47fad949f1f3993d21af153.tar.xz
manaplus-ab608a29a138cd5db47fad949f1f3993d21af153.zip
Add context menu for moving items to craft.
Diffstat (limited to 'src/gui/popups/popupmenu.cpp')
-rw-r--r--src/gui/popups/popupmenu.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index b1b33155c..d1e23b558 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -72,6 +72,7 @@
#ifdef EATHENA_SUPPORT
#include "net/homunculushandler.h"
#include "net/mercenaryhandler.h"
+#include "net/npchandler.h"
#endif
#include "net/pethandler.h"
#include "net/serverfeatures.h"
@@ -1473,6 +1474,11 @@ void PopupMenu::handleLink(const std::string &link,
{
homunculusHandler->fire();
}
+ else if (link == "craftmenu")
+ {
+ showCraftPopup();
+ return;
+ }
#endif
else if (link == "pet feed")
{
@@ -1733,6 +1739,20 @@ void PopupMenu::showPopup(Window *const parent,
}
mBrowserBox->addRow("##3---");
}
+#ifdef EATHENA_SUPPORT
+ if (npcHandler)
+ {
+ NpcDialog *const dialog = npcHandler->getCurrentNpcDialog();
+ if (dialog &&
+ dialog->getInputState() == NpcDialog::NPC_INPUT_ITEM_CRAFT)
+ {
+ mBrowserBox->addRow("craftmenu",
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: sub menu for craft
+ _("Move to craft..."));
+ }
+ }
+#endif
addUseDrop(item, isProtected);
break;
@@ -2787,6 +2807,28 @@ void PopupMenu::showGMPopup()
showPopup(getX(), getY());
}
+#ifdef EATHENA_SUPPORT
+void PopupMenu::showCraftPopup()
+{
+ mBrowserBox->clearRows();
+
+ for (int f = 0; f < 9; f ++)
+ {
+ const std::string cmd = strprintf("/craft %d", f);
+ mBrowserBox->addRow(cmd,
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: move current item to craft slot
+ strprintf(_("Move to craft %d"), f + 1).c_str());
+ }
+
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: close menu
+ mBrowserBox->addRow("cancel", _("Cancel"));
+
+ showPopup(mX, mY);
+}
+#endif
+
void PopupMenu::moveUp()
{
mBrowserBox->moveSelectionUp();