summaryrefslogtreecommitdiff
path: root/src/gui/windows/inventorywindow.cpp
diff options
context:
space:
mode:
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