From 62d0365986f1a273c276cacac7b3eada9cbf2ae3 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 23 Feb 2016 21:51:33 +0300 Subject: Add into gm context menu for monsters command info. --- src/gui/popups/popupmenu.cpp | 17 ++++++++++++++++- src/gui/popups/popupmenu.h | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index d2eaeab21..14305f485 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -121,6 +121,7 @@ PopupMenu::PopupMenu() : mNick(), mTextField(nullptr), mType(ActorType::Unknown), + mSubType(BeingTypeId_zero), mX(0), mY(0) { @@ -149,6 +150,7 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being) mBeingId = being->getId(); mNick = being->getName(); mType = being->getType(); + mSubType = being->getSubType(); mBrowserBox->clearRows(); mX = x; mY = y; @@ -475,6 +477,7 @@ void PopupMenu::showPlayerPopup(const std::string &nick) mNick = nick; mBeingId = BeingId_zero; mType = ActorType::Player; + mSubType = BeingTypeId_zero; mBrowserBox->clearRows(); const std::string &name = mNick; @@ -578,6 +581,7 @@ void PopupMenu::showPopup(const int x, const int y, mY = y; mFloorItemId = floorItem->getId(); mType = ActorType::FloorItem; + mSubType = BeingTypeId_zero; for (int f = 0; f < maxCards; f ++) mItemCards[f] = floorItem->getCard(f); mBrowserBox->clearRows(); @@ -831,6 +835,7 @@ void PopupMenu::showChatPopup(const int x, const int y, ChatTab *const tab) mBeingId = being->getId(); mNick = being->getName(); mType = being->getType(); + mSubType = being->getSubType(); // TRANSLATORS: popup menu item // TRANSLATORS: trade with player @@ -900,6 +905,7 @@ void PopupMenu::showChatPopup(const int x, const int y, ChatTab *const tab) mBeingId = BeingId_zero; mNick = name; mType = ActorType::Player; + mSubType = BeingTypeId_zero; addPlayerRelation(name); mBrowserBox->addRow("##3---"); addFollow(); @@ -971,6 +977,7 @@ void PopupMenu::showChangePos(const int x, const int y) mMapItem = nullptr; mNick.clear(); mType = ActorType::Unknown; + mSubType = BeingTypeId_zero; mX = 0; mY = 0; setVisible(Visible_false); @@ -1502,6 +1509,7 @@ void PopupMenu::handleLink(const std::string &link, replaceAll(cmd, "'ITEMID'", toString(mItemId)); replaceAll(cmd, "'ITEMCOLOR'", toString(toInt(mItemColor, int))); replaceAll(cmd, "'BEINGTYPEID'", toString(CAST_S32(mType))); + replaceAll(cmd, "'BEINGSUBTYPEID'", toString(CAST_S32(mSubType))); replaceAll(cmd, "'PLAYER'", localPlayer->getName()); if (mItemIndex >= 0) replaceAll(cmd, "'INVINDEX'", toString(mItemIndex)); @@ -1559,6 +1567,7 @@ void PopupMenu::handleLink(const std::string &link, mNick.clear(); mTextField = nullptr; mType = ActorType::Unknown; + mSubType = BeingTypeId_zero; mX = 0; mY = 0; } @@ -1983,6 +1992,7 @@ void PopupMenu::showAttackMonsterPopup(const int x, const int y, mNick = name; mType = ActorType::Monster; + mSubType = BeingTypeId_zero; mX = x; mY = y; @@ -2061,6 +2071,7 @@ void PopupMenu::showPickupItemPopup(const int x, const int y, mNick = name; mType = ActorType::FloorItem; + mSubType = BeingTypeId_zero; mX = x; mY = y; @@ -2720,9 +2731,13 @@ void PopupMenu::showMonsterGMCommands() if (mBeingId != BeingId_zero) { // TRANSLATORS: popup menu item - // TRANSLATORS: kick player + // TRANSLATORS: kick monster mBrowserBox->addRow("/kick :'BEINGID'", _("Kick")); mBrowserBox->addRow("##3---"); + + // TRANSLATORS: popup menu item + // TRANSLATORS: show monster information + mBrowserBox->addRow("/monsterinfo 'BEINGSUBTYPEID'", _("Info")); } } diff --git a/src/gui/popups/popupmenu.h b/src/gui/popups/popupmenu.h index 7041afb5b..c8ab6e6a0 100644 --- a/src/gui/popups/popupmenu.h +++ b/src/gui/popups/popupmenu.h @@ -30,6 +30,7 @@ #include "enums/inventorytype.h" #include "enums/simpletypes/beingid.h" +#include "enums/simpletypes/beingtypeid.h" #include "enums/simpletypes/itemcolor.h" #include "gui/widgets/linkhandler.h" @@ -244,6 +245,7 @@ class PopupMenu final : public Popup, public LinkHandler std::string mNick; TextField *mTextField; ActorTypeT mType; + BeingTypeId mSubType; int mX; int mY; -- cgit v1.2.3-70-g09d2