diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-07-11 15:39:15 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-07-11 15:39:15 +0300 |
commit | ffd452cd1ee7d252355c259ca2bae1d40c0e97e9 (patch) | |
tree | 5af52c79df128cb5df9d043088565d183397fb16 /src/gui/popupmenu.cpp | |
parent | 0b365e38b6813dc2083e78122d787ec62d7b65cf (diff) | |
download | manaplus-ffd452cd1ee7d252355c259ca2bae1d40c0e97e9.tar.gz manaplus-ffd452cd1ee7d252355c259ca2bae1d40c0e97e9.tar.bz2 manaplus-ffd452cd1ee7d252355c259ca2bae1d40c0e97e9.tar.xz manaplus-ffd452cd1ee7d252355c259ca2bae1d40c0e97e9.zip |
Add some gm commands in player context menu.
GM commands moved to submenu.
Diffstat (limited to 'src/gui/popupmenu.cpp')
-rw-r--r-- | src/gui/popupmenu.cpp | 79 |
1 files changed, 65 insertions, 14 deletions
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index d43771881..d2a3568b1 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -146,7 +146,7 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being) mBrowserBox->addRow("attack", _("Attack")); // TRANSLATORS: popup menu item mBrowserBox->addRow("whisper", _("Whisper")); - + addGmCommands(); mBrowserBox->addRow("##3---"); // TRANSLATORS: popup menu item @@ -203,12 +203,6 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being) } } - if (player_node->isGM()) - { - mBrowserBox->addRow("##3---"); - // TRANSLATORS: popup menu item - mBrowserBox->addRow("admin-kick", _("Kick player")); - } // TRANSLATORS: popup menu item mBrowserBox->addRow("nuke", _("Nuke")); // TRANSLATORS: popup menu item @@ -240,13 +234,6 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being) // TRANSLATORS: popup menu item mBrowserBox->addRow("attack", _("Attack")); - if (player_node->isGM()) - { - mBrowserBox->addRow("##3---"); - // TRANSLATORS: popup menu item - mBrowserBox->addRow("admin-kick", _("Kick")); - } - if (config.getBoolValue("enableAttackFilter")) { mBrowserBox->addRow("##3---"); @@ -345,6 +332,7 @@ void PopupMenu::showPlayerPopup(const int x, const int y, // TRANSLATORS: popup menu item mBrowserBox->addRow("whisper", _("Whisper")); + addGmCommands(); mBrowserBox->addRow("##3---"); addPlayerRelation(name); @@ -1675,6 +1663,31 @@ void PopupMenu::handleLink(const std::string &link, { sendBuffer(mNick); } + else if (link == "goto" && !mNick.empty()) + { + if (chatWindow) + chatWindow->localChatInput("@goto " + mNick); + } + else if (link == "recall" && !mNick.empty()) + { + if (chatWindow) + chatWindow->localChatInput("@recall " + mNick); + } + else if (link == "revive" && !mNick.empty()) + { + if (chatWindow) + chatWindow->localChatInput("@revive " + mNick); + } + else if (link == "ipcheck" && !mNick.empty()) + { + if (chatWindow) + chatWindow->localChatInput("@ipcheck " + mNick); + } + else if (link == "gm" && !mNick.empty()) + { + showGMPopup(); + return; + } else if (!link.compare(0, 10, "guild-pos-")) { if (player_node) @@ -2615,6 +2628,44 @@ void PopupMenu::addUseDrop(const Item *const item, const bool isProtected) } } +void PopupMenu::addGmCommands() +{ + if (player_node->isGM()) + { + // TRANSLATORS: popup menu item + mBrowserBox->addRow("gm", _("GM...")); + } +} + +void PopupMenu::showGMPopup() +{ + mBrowserBox->clearRows(); + // TRANSLATORS: popup menu header + mBrowserBox->addRow(_("GM commands")); + if (player_node->isGM()) + { + // TRANSLATORS: popup menu item + mBrowserBox->addRow("ipcheck", _("Check ip")); + // TRANSLATORS: popup menu item + mBrowserBox->addRow("goto", _("Goto")); + // TRANSLATORS: popup menu item + mBrowserBox->addRow("recall", _("Recall")); + // TRANSLATORS: popup menu item + mBrowserBox->addRow("revive", _("Revive")); + if (mBeingId) + { + // TRANSLATORS: popup menu item + mBrowserBox->addRow("admin-kick", _("Kick")); + } + } + + mBrowserBox->addRow("##3---"); + // TRANSLATORS: popup menu item + mBrowserBox->addRow("cancel", _("Cancel")); + + showPopup(getX(), getY()); +} + RenameListener::RenameListener() : gcn::ActionListener(), mMapItem(nullptr), |