diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-12-13 14:49:52 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-12-13 14:49:52 +0300 |
commit | 5abccb73361a7133b0aa73fe845e8945ebf37964 (patch) | |
tree | cd95eaba3b9f0f18aca397a064e8aa7cc3607da6 /src/actions | |
parent | 85f443c2a92d1e148f3fa2b674bfcf0546642245 (diff) | |
download | plus-5abccb73361a7133b0aa73fe845e8945ebf37964.tar.gz plus-5abccb73361a7133b0aa73fe845e8945ebf37964.tar.bz2 plus-5abccb73361a7133b0aa73fe845e8945ebf37964.tar.xz plus-5abccb73361a7133b0aa73fe845e8945ebf37964.zip |
Add chat command for move 10 items from inventory to storage.
New command: /invtostorage10 INDEX
Alias: /invstorage10 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 4b527d008..c3b2faf9f 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -71,6 +71,7 @@ #include "net/chathandler.h" #include "net/download.h" #include "net/gamehandler.h" +#include "net/inventoryhandler.h" #include "net/ipc.h" #include "net/mercenaryhandler.h" #include "net/npchandler.h" @@ -1392,4 +1393,19 @@ impHandler(invToStorage) return true; } +impHandler(invToStorage10) +{ + Item *const item = getItemByInvIndex(event); + if (!item) + return true; + + int cnt = 10; + if (cnt > item->getQuantity()) + cnt = item->getQuantity(); + inventoryHandler->moveItem2(Inventory::INVENTORY, + item->getInvIndex(), cnt, + Inventory::STORAGE); + return true; +} + } // namespace Actions diff --git a/src/actions/actions.h b/src/actions/actions.h index eaf900fbe..ef74562eb 100644 --- a/src/actions/actions.h +++ b/src/actions/actions.h @@ -99,6 +99,7 @@ namespace Actions decHandler(useItem); decHandler(useItemInv); decHandler(invToStorage); + decHandler(invToStorage10); } // namespace Actions #undef decHandler |