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 ++++++++++++++++---- src/gui/popups/popupmenu.h | 4 ++-- 2 files changed, 18 insertions(+), 6 deletions(-) (limited to 'src/gui') 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(); -- cgit v1.2.3-60-g2f50