summaryrefslogtreecommitdiff
path: root/src/gui/windows/inventorywindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-01-26 21:40:24 +0300
committerAndrei Karas <akaras@inbox.ru>2016-01-27 02:22:56 +0300
commit3a19b08078d42837126cc585d2a9b6f5f61b2c2b (patch)
tree400122420df75e178cb7d52cfd2f67cd12d394a8 /src/gui/windows/inventorywindow.cpp
parent4a6e5d83cd39dfde59d273b9be79cd76c685a8e9 (diff)
downloadplus-3a19b08078d42837126cc585d2a9b6f5f61b2c2b.tar.gz
plus-3a19b08078d42837126cc585d2a9b6f5f61b2c2b.tar.bz2
plus-3a19b08078d42837126cc585d2a9b6f5f61b2c2b.tar.xz
plus-3a19b08078d42837126cc585d2a9b6f5f61b2c2b.zip
Add quick shortcuts for add selected item to each craft inventory slot.
Add craft tab with shortcuts in input tab.
Diffstat (limited to 'src/gui/windows/inventorywindow.cpp')
-rw-r--r--src/gui/windows/inventorywindow.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp
index eac1b692d..76dfef268 100644
--- a/src/gui/windows/inventorywindow.cpp
+++ b/src/gui/windows/inventorywindow.cpp
@@ -41,6 +41,7 @@
#include "gui/windows/confirmdialog.h"
#include "gui/windows/itemamountwindow.h"
+#include "gui/windows/npcdialog.h"
#include "gui/windows/setupwindow.h"
#include "gui/windows/tradewindow.h"
@@ -59,6 +60,8 @@
#include "listeners/insertcardlistener.h"
+#include "net/npchandler.h"
+
#include "resources/iteminfo.h"
#include "resources/item/item.h"
@@ -1056,4 +1059,33 @@ void InventoryWindow::combineItems(const int index1,
insertCardListener.cardIndex = item1->getInvIndex();
confirmDlg->addActionListener(&insertCardListener);
}
+
+void InventoryWindow::moveItemToCraft(const int craftSlot)
+{
+ if (!npcHandler)
+ return;
+
+ Item *const item = mItems->getSelectedItem();
+ if (!item)
+ return;
+
+ NpcDialog *const dialog = npcHandler->getCurrentNpcDialog();
+ if (dialog &&
+ dialog->getInputState() == NpcDialog::NPC_INPUT_ITEM_CRAFT)
+ {
+ if (item->getQuantity() > 1
+ && !inputManager.isActionActive(InputAction::STOP_ATTACK))
+ {
+ ItemAmountWindow::showWindow(ItemAmountWindow::CraftAdd,
+ npcHandler->getCurrentNpcDialog(),
+ item,
+ 0,
+ craftSlot);
+ }
+ else
+ {
+ dialog->addCraftItem(item, 1, craftSlot);
+ }
+ }
+}
#endif