diff options
Diffstat (limited to 'src/gui/windows/npcdialog.cpp')
-rw-r--r-- | src/gui/windows/npcdialog.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index 66cdc4bb3..2fcb53468 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -1370,3 +1370,24 @@ std::string NpcDialog::complexItemToStr(const ComplexItem *const item) } return str; } + +void NpcDialog::addCraftItem(Item *const item, + const int amount, + const int slot) +{ + if (mInputState != NPC_INPUT_ITEM_CRAFT) + return; + + Inventory *const inventory = PlayerInfo::getInventory(); + + if (!inventory) + return; + + if (mComplexInventory->addVirtualItem( + item, + slot, + amount)) + { + inventory->virtualRemove(item, amount); + } +} |