From b002d846243676990503aa0fa7c220e8a8e66de2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 13 Dec 2014 15:00:41 +0300 Subject: Add chat command for move half items from inventory to storage. New command: /invtostoragehalf INDEX Alias: /invstoragehalf INDEX --- src/actions/actions.cpp | 13 +++++++++++++ src/actions/actions.h | 1 + 2 files changed, 14 insertions(+) (limited to 'src/actions') diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index c3b2faf9f..0b501bdbf 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -1408,4 +1408,17 @@ impHandler(invToStorage10) return true; } +impHandler(invToStorageHalf) +{ + Item *const item = getItemByInvIndex(event); + if (!item) + return true; + + inventoryHandler->moveItem2(Inventory::INVENTORY, + item->getInvIndex(), + item->getQuantity() / 2, + Inventory::STORAGE); + return true; +} + } // namespace Actions diff --git a/src/actions/actions.h b/src/actions/actions.h index ef74562eb..0ab312351 100644 --- a/src/actions/actions.h +++ b/src/actions/actions.h @@ -100,6 +100,7 @@ namespace Actions decHandler(useItemInv); decHandler(invToStorage); decHandler(invToStorage10); + decHandler(invToStorageHalf); } // namespace Actions #undef decHandler -- cgit v1.2.3-70-g09d2