From 5abccb73361a7133b0aa73fe845e8945ebf37964 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 13 Dec 2014 14:49:52 +0300 Subject: Add chat command for move 10 items from inventory to storage. New command: /invtostorage10 INDEX Alias: /invstorage10 INDEX --- src/actions/actions.cpp | 16 ++++++++++++++++ src/actions/actions.h | 1 + src/input/inputaction.h | 1 + src/input/inputactionmap.h | 9 +++++++++ 4 files changed, 27 insertions(+) (limited to 'src') 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 diff --git a/src/input/inputaction.h b/src/input/inputaction.h index dc63508d3..774053226 100644 --- a/src/input/inputaction.h +++ b/src/input/inputaction.h @@ -506,6 +506,7 @@ namespace InputAction DROP_INV_ALL, USE_INV, INV_TO_STORAGE, + INV_TO_STORAGE_10, TOTAL }; } // namespace InputAction diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index b23032728..794fcb97d 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -4297,6 +4297,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { InputCondition::INGAME, "invtostorage|invstorage", true}, + {"keyInvToStorage10", + InputType::UNKNOWN, InputAction::NO_VALUE, + InputType::UNKNOWN, InputAction::NO_VALUE, + Input::GRP_DEFAULT, + &Actions::invToStorage10, + InputAction::NO_VALUE, 50, + InputCondition::INGAME, + "invtostorage10|invstorage10", + true}, }; #endif // INPUT_INPUTACTIONMAP_H -- cgit v1.2.3-70-g09d2