diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-01-26 21:40:24 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-01-27 02:22:56 +0300 |
commit | 3a19b08078d42837126cc585d2a9b6f5f61b2c2b (patch) | |
tree | 400122420df75e178cb7d52cfd2f67cd12d394a8 /src/gui/windows | |
parent | 4a6e5d83cd39dfde59d273b9be79cd76c685a8e9 (diff) | |
download | plus-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')
-rw-r--r-- | src/gui/windows/inventorywindow.cpp | 32 | ||||
-rw-r--r-- | src/gui/windows/inventorywindow.h | 4 | ||||
-rw-r--r-- | src/gui/windows/npcdialog.h | 40 |
3 files changed, 58 insertions, 18 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 diff --git a/src/gui/windows/inventorywindow.h b/src/gui/windows/inventorywindow.h index 6c02e4304..930ce9e72 100644 --- a/src/gui/windows/inventorywindow.h +++ b/src/gui/windows/inventorywindow.h @@ -156,9 +156,13 @@ class InventoryWindow final : public Window, const int oldVal, const int newVal) override final; +#ifdef EATHENA_SUPPORT void combineItems(const int index1, const int index2); + void moveItemToCraft(const int craftSlot); +#endif + static bool isAnyInputFocused(); static InventoryWindow *getFirstVisible(); diff --git a/src/gui/windows/npcdialog.h b/src/gui/windows/npcdialog.h index 29f728c91..524ae7bd8 100644 --- a/src/gui/windows/npcdialog.h +++ b/src/gui/windows/npcdialog.h @@ -77,6 +77,25 @@ class NpcDialog final : public Window, void postInit() override final; + enum NpcInputState + { + NPC_INPUT_NONE = 0, + NPC_INPUT_LIST, + NPC_INPUT_STRING, + NPC_INPUT_INTEGER, + NPC_INPUT_ITEM, + NPC_INPUT_ITEM_INDEX, + NPC_INPUT_ITEM_CRAFT + }; + + enum NpcActionState + { + NPC_ACTION_WAIT = 0, + NPC_ACTION_NEXT, + NPC_ACTION_INPUT, + NPC_ACTION_CLOSE + }; + /** * Called when receiving actions from the widgets. */ @@ -228,6 +247,9 @@ class NpcDialog final : public Window, const int amount, const int slot); + NpcInputState getInputState() + { return mInputState; } + static void copyToClipboard(const BeingId npcId, const int x, const int y); @@ -303,24 +325,6 @@ class NpcDialog final : public Window, ItemContainer *mItemContainer A_NONNULLPOINTER; ScrollArea *mItemScrollArea A_NONNULLPOINTER; - enum NpcInputState - { - NPC_INPUT_NONE = 0, - NPC_INPUT_LIST, - NPC_INPUT_STRING, - NPC_INPUT_INTEGER, - NPC_INPUT_ITEM, - NPC_INPUT_ITEM_INDEX, - NPC_INPUT_ITEM_CRAFT - }; - - enum NpcActionState - { - NPC_ACTION_WAIT = 0, - NPC_ACTION_NEXT, - NPC_ACTION_INPUT, - NPC_ACTION_CLOSE - }; NpcInputState mInputState; NpcActionState mActionState; |