From 60100c4b30f779fe8f63758f9974891e98816340 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 29 Feb 2016 01:02:46 +0300 Subject: Add chat command /gmpartyleader. Also add it to npc context menu. --- src/gui/popups/popupmenu.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src/gui/popups/popupmenu.cpp') 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(); -- cgit v1.2.3-70-g09d2