diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-12-13 12:59:13 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-12-13 12:59:13 +0300 |
commit | be1dd6434f993fba9e944cda9e83e0fae32e8c14 (patch) | |
tree | f715ca182a8339a775994cbdaa293e24d5e88e63 /src/actions | |
parent | 41eff7ceed25a056ea5d9bec0ae11194132a6d08 (diff) | |
download | mv-be1dd6434f993fba9e944cda9e83e0fae32e8c14.tar.gz mv-be1dd6434f993fba9e944cda9e83e0fae32e8c14.tar.bz2 mv-be1dd6434f993fba9e944cda9e83e0fae32e8c14.tar.xz mv-be1dd6434f993fba9e944cda9e83e0fae32e8c14.zip |
Add chat command for drop item by inventory index.
New chat command: /dropinv INDEX
Diffstat (limited to 'src/actions')
-rw-r--r-- | src/actions/actions.cpp | 16 | ||||
-rw-r--r-- | src/actions/actions.h | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index 8cd2600b4..da62c6549 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -380,6 +380,22 @@ impHandler(dropItemId) return true; } +impHandler(dropItemInv) +{ + const Inventory *const inv = PlayerInfo::getInventory(); + if (!inv) + return false; + + Item *const item = inv->getItem(atoi(event.args.c_str())); + + if (item && !PlayerInfo::isItemProtected(item->getId())) + { + ItemAmountWindow::showWindow(ItemAmountWindow::ItemDrop, + inventoryWindow, item); + } + return true; +} + impHandler(dropItemIdAll) { const Inventory *const inv = PlayerInfo::getInventory(); diff --git a/src/actions/actions.h b/src/actions/actions.h index 11a3bcdcf..ab7f5b980 100644 --- a/src/actions/actions.h +++ b/src/actions/actions.h @@ -39,6 +39,7 @@ namespace Actions decHandler(dropItem0); decHandler(dropItem); decHandler(dropItemId); + decHandler(dropItemInv); decHandler(dropItemIdAll); decHandler(heal); decHandler(itenplz); |