summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-12-12 23:08:49 +0300
committerAndrei Karas <akaras@inbox.ru>2014-12-12 23:08:49 +0300
commit23a89c57cbd36922fbcb92affa9546955591e9db (patch)
tree95fca90f3de9ea039ae179445bb93b661a732420
parentb6fa84983bfe0a9fcfd915f6f170c7bfdde1510b (diff)
downloadmv-23a89c57cbd36922fbcb92affa9546955591e9db.tar.gz
mv-23a89c57cbd36922fbcb92affa9546955591e9db.tar.bz2
mv-23a89c57cbd36922fbcb92affa9546955591e9db.tar.xz
mv-23a89c57cbd36922fbcb92affa9546955591e9db.zip
Add chat command for drop item by id and amount dialog.
New chat command: /dropitem ID
-rw-r--r--src/actions/actions.cpp19
-rw-r--r--src/actions/actions.h1
-rw-r--r--src/input/inputaction.h1
-rw-r--r--src/input/inputactionmap.h9
4 files changed, 30 insertions, 0 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp
index 69c711e18..605a3ff06 100644
--- a/src/actions/actions.cpp
+++ b/src/actions/actions.cpp
@@ -50,6 +50,8 @@
#include "gui/windows/buyselldialog.h"
#include "gui/windows/chatwindow.h"
#include "gui/windows/helpwindow.h"
+#include "gui/windows/inventorywindow.h"
+#include "gui/windows/itemamountwindow.h"
#include "gui/windows/npcdialog.h"
#include "gui/windows/outfitwindow.h"
#include "gui/windows/setupwindow.h"
@@ -361,6 +363,23 @@ impHandler0(dropItem)
return false;
}
+impHandler(dropItemId)
+{
+ const Inventory *const inv = PlayerInfo::getInventory();
+ if (!inv)
+ return false;
+
+ // +++ ignoring item color for now
+ Item *const item = inv->findItem(atoi(event.args.c_str()), 1);
+
+ if (item && !PlayerInfo::isItemProtected(item->getId()))
+ {
+ ItemAmountWindow::showWindow(ItemAmountWindow::ItemDrop,
+ inventoryWindow, item);
+ }
+ return true;
+}
+
impHandler(heal)
{
if (actorManager && localPlayer)
diff --git a/src/actions/actions.h b/src/actions/actions.h
index 642026d76..956183346 100644
--- a/src/actions/actions.h
+++ b/src/actions/actions.h
@@ -38,6 +38,7 @@ namespace Actions
decHandler(quit);
decHandler(dropItem0);
decHandler(dropItem);
+ decHandler(dropItemId);
decHandler(heal);
decHandler(itenplz);
decHandler(setHome);
diff --git a/src/input/inputaction.h b/src/input/inputaction.h
index fb5db9913..e46935ea2 100644
--- a/src/input/inputaction.h
+++ b/src/input/inputaction.h
@@ -500,6 +500,7 @@ namespace InputAction
WHISPER_TEXT,
NAVIGATE_TO,
CAMERA_MOVE,
+ DROP_ITEM,
TOTAL
};
} // namespace InputAction
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index 4b9d61047..8515dad5b 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -4243,6 +4243,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = {
InputCondition::INGAME,
"movecamera|cameramove",
true},
+ {"keyDropItem",
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ Input::GRP_DEFAULT,
+ &Actions::dropItemId,
+ InputAction::NO_VALUE, 50,
+ InputCondition::INGAME,
+ "dropitem",
+ true},
};
#endif // INPUT_INPUTACTIONMAP_H