diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-02-29 01:02:46 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-02-29 01:02:46 +0300 |
commit | 60100c4b30f779fe8f63758f9974891e98816340 (patch) | |
tree | a3a5ab8eb90c3f03937df95adcfcf68a7d3d1922 /src/gui | |
parent | 54cdcc6cded841b2c5823a74f58e4f3b06f81622 (diff) | |
download | manaplus-60100c4b30f779fe8f63758f9974891e98816340.tar.gz manaplus-60100c4b30f779fe8f63758f9974891e98816340.tar.bz2 manaplus-60100c4b30f779fe8f63758f9974891e98816340.tar.xz manaplus-60100c4b30f779fe8f63758f9974891e98816340.zip |
Add chat command /gmpartyleader. Also add it to npc context menu.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/popups/popupmenu.cpp | 20 | ||||
-rw-r--r-- | src/gui/popups/popupmenu.h | 4 |
2 files changed, 18 insertions, 6 deletions
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 76e684766..49073811d 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -1351,7 +1351,7 @@ void PopupMenu::handleLink(const std::string &link, } else if (link == "gm" && !mName.empty()) { - showGMPopup(); + showGMPopup(mName); return; } else if (link == "mute" && !mName.empty()) @@ -2730,7 +2730,7 @@ void PopupMenu::showPlayerMenu() showPopup(getX(), getY()); } -void PopupMenu::showPlayerGMCommands() +void PopupMenu::showPlayerGMCommands(const std::string &name) { const bool legacy = Net::getNetworkType() == ServerType::TMWATHENA; if (!legacy) @@ -2756,6 +2756,18 @@ void PopupMenu::showPlayerGMCommands() mBrowserBox->addRow("/alive 'NAME'", _("Revive")); if (!legacy) { + if (localPlayer && localPlayer->isInParty()) + { + const Party *const party = localPlayer->getParty(); + if (party && party->isMember(name)) + { + mBrowserBox->addRow("/gmpartyleader 'NAME'", + // TRANSLATORS: popup menu item + // TRANSLATORS: give party leader status + _("Give party leader")); + } + } + // TRANSLATORS: popup menu item // TRANSLATORS: nuke player mBrowserBox->addRow("/nuke 'NAME'", _("Nuke")); @@ -2986,7 +2998,7 @@ void PopupMenu::showItemGMCommands() mBrowserBox->addRow("/whodrops 'ITEMID'", _("Who drops")); } -void PopupMenu::showGMPopup() +void PopupMenu::showGMPopup(const std::string &name) { mBrowserBox->clearRows(); // TRANSLATORS: popup menu header @@ -2996,7 +3008,7 @@ void PopupMenu::showGMPopup() switch (mType) { case ActorType::Player: - showPlayerGMCommands(); + showPlayerGMCommands(name); break; case ActorType::Npc: showNpcGMCommands(); diff --git a/src/gui/popups/popupmenu.h b/src/gui/popups/popupmenu.h index 9a22f6d5d..58ae77a88 100644 --- a/src/gui/popups/popupmenu.h +++ b/src/gui/popups/popupmenu.h @@ -223,9 +223,9 @@ class PopupMenu final : public Popup, public LinkHandler void addChat(const Being *const being); #endif - void showGMPopup(); + void showGMPopup(const std::string &name); - void showPlayerGMCommands(); + void showPlayerGMCommands(const std::string &name); void showNpcGMCommands(); |