summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-07-11 15:39:15 +0300
committerAndrei Karas <akaras@inbox.ru>2013-07-11 15:39:15 +0300
commitffd452cd1ee7d252355c259ca2bae1d40c0e97e9 (patch)
tree5af52c79df128cb5df9d043088565d183397fb16 /src
parent0b365e38b6813dc2083e78122d787ec62d7b65cf (diff)
downloadmanaverse-ffd452cd1ee7d252355c259ca2bae1d40c0e97e9.tar.gz
manaverse-ffd452cd1ee7d252355c259ca2bae1d40c0e97e9.tar.bz2
manaverse-ffd452cd1ee7d252355c259ca2bae1d40c0e97e9.tar.xz
manaverse-ffd452cd1ee7d252355c259ca2bae1d40c0e97e9.zip
Add some gm commands in player context menu.
GM commands moved to submenu.
Diffstat (limited to 'src')
-rw-r--r--src/gui/popupmenu.cpp79
-rw-r--r--src/gui/popupmenu.h4
2 files changed, 69 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),
diff --git a/src/gui/popupmenu.h b/src/gui/popupmenu.h
index 04104fd18..bab29fe7c 100644
--- a/src/gui/popupmenu.h
+++ b/src/gui/popupmenu.h
@@ -207,6 +207,10 @@ class PopupMenu final : public Popup, public LinkHandler
void addUseDrop(const Item *const item, const bool isProtected);
+ void addGmCommands();
+
+ void showGMPopup();
+
BrowserBox *mBrowserBox;
ScrollArea *mScrollArea;