From 1fa706c6669db9a2d060d100cf591fd505012a9d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 10 May 2017 04:32:18 +0300 Subject: Add chat command for show player items. --- src/actions/windows.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'src/actions/windows.cpp') diff --git a/src/actions/windows.cpp b/src/actions/windows.cpp index 2e6c8d78c..bb7de28df 100644 --- a/src/actions/windows.cpp +++ b/src/actions/windows.cpp @@ -20,6 +20,8 @@ #include "actions/windows.h" +#include "actormanager.h" + #include "actions/actiondef.h" #include "being/localplayer.h" @@ -320,4 +322,40 @@ impHandler0(mailWindowShow) return true; } +impHandler(showItems) +{ + const std::string args = event.args; + if (args.empty()) + return false; + + Being *being = nullptr; + if (args[0] == ':') + { + being = actorManager->findBeing(fromInt(atoi( + args.substr(1).c_str()), BeingId)); + if (being && being->getType() == ActorType::Monster) + being = nullptr; + } + else + { + being = actorManager->findBeingByName(args, ActorType::Player); + } + if (!being) + return true; + if (being == localPlayer) + { + if (equipmentWindow && !equipmentWindow->isWindowVisible()) + equipmentWindow->setVisible(Visible_true); + } + else + { + if (beingEquipmentWindow) + { + beingEquipmentWindow->setBeing(being); + beingEquipmentWindow->setVisible(Visible_true); + } + } + return true; +} + } // namespace Actions -- cgit v1.2.3-60-g2f50