From ca333756a61de5af5d07614dbedc6195c2e78023 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 13 Dec 2014 21:19:26 +0300 Subject: Add chat command for protect item. New chat command: /protectitem ID Alias: /itemprotect ID --- src/actions/actions.cpp | 8 ++++++++ src/actions/actions.h | 1 + src/input/inputaction.h | 1 + src/input/inputactionmap.h | 9 +++++++++ 4 files changed, 19 insertions(+) (limited to 'src') diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index 1397791d1..e4b2d9db5 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -1493,4 +1493,12 @@ impHandler(storageToInv) return true; } +impHandler(protectItem) +{ + const int id = atoi(event.args.c_str()); + if (id > 0) + PlayerInfo::protectItem(id); + return true; +} + } // namespace Actions diff --git a/src/actions/actions.h b/src/actions/actions.h index 1f0346caa..45dc96f11 100644 --- a/src/actions/actions.h +++ b/src/actions/actions.h @@ -101,6 +101,7 @@ namespace Actions decHandler(invToStorage); decHandler(tradeAdd); decHandler(storageToInv); + decHandler(protectItem); } // namespace Actions #undef decHandler diff --git a/src/input/inputaction.h b/src/input/inputaction.h index c0bc6b615..8e926b368 100644 --- a/src/input/inputaction.h +++ b/src/input/inputaction.h @@ -508,6 +508,7 @@ namespace InputAction INV_TO_STORAGE, TRADE_ADD, STORAGE_TO_INV, + ITEM_PROTECT, TOTAL }; } // namespace InputAction diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 183bb3b6e..ab2a8ea29 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -4315,6 +4315,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { InputCondition::INGAME, "storagetoinv|storageinv", true}, + {"keyProtectItem", + InputType::UNKNOWN, InputAction::NO_VALUE, + InputType::UNKNOWN, InputAction::NO_VALUE, + Input::GRP_DEFAULT, + &Actions::protectItem, + InputAction::NO_VALUE, 50, + InputCondition::INGAME, + "protectitem|itemprotect", + true}, }; #endif // INPUT_INPUTACTIONMAP_H -- cgit v1.2.3-70-g09d2