From cb7e5cfdc0cf92d28661f37bbfa91b39ddb92028 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 8 Dec 2014 20:52:34 +0300 Subject: Allow send whisper to npc from context menu if server have this feature. --- src/gui/popups/popupmenu.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src/gui') diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 2670b5384..f6a2959bd 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -245,11 +245,15 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being) } case ActorType::Npc: - // NPCs can be talked to (single option, candidate for removal - // unless more options would be added) // TRANSLATORS: popup menu item // TRANSLATORS: talk with npc mBrowserBox->addRow("talk", _("Talk")); + if (serverFeatures->haveNpcWhispers()) + { + // TRANSLATORS: popup menu item + // TRANSLATORS: whisper to npc + mBrowserBox->addRow("npc whisper", _("Whisper")); + } // TRANSLATORS: popup menu item // TRANSLATORS: buy from npc mBrowserBox->addRow("buy", _("Buy")); @@ -1183,6 +1187,21 @@ void PopupMenu::handleLink(const std::string &link, } } } + else if (link == "npc whisper" && !mNick.empty()) + { + if (chatWindow) + { + if (config.getBoolValue("whispertab")) + { + chatWindow->localChatInput("/q NPC:" + mNick); + } + else + { + chatWindow->addInputText(std::string("/w \"NPC:").append( + mNick).append("\" ")); + } + } + } else if (link == "move" && !mNick.empty()) { if (localPlayer) -- cgit v1.2.3-70-g09d2