From 163c2b925053dadf7b431b6fc9f208d51f1dde4e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 1 Mar 2016 23:23:26 +0300 Subject: Add to context menu action for rename homunculus. --- src/actions/commands.cpp | 19 ++++++++++++++++++- src/gui/popups/popupmenu.cpp | 37 +++++++++++++++++++++++++------------ 2 files changed, 43 insertions(+), 13 deletions(-) diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index 9e70c55de..e10d31d43 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -30,12 +30,15 @@ #include "being/flooritem.h" #include "being/localplayer.h" #include "being/playerrelations.h" +#ifdef EATHENA_SUPPORT +#include "being/homunculusinfo.h" +#include "being/playerinfo.h" +#endif #include "gui/viewport.h" #ifdef EATHENA_SUPPORT #include "gui/shortcut/emoteshortcut.h" - #endif #include "gui/windows/chatwindow.h" @@ -49,6 +52,10 @@ #include "input/inputactionoperators.h" +#ifdef EATHENA_SUPPORT +#include "listeners/inputactionreplaylistener.h" +#endif + #include "net/adminhandler.h" #include "net/chathandler.h" #include "net/guildhandler.h" @@ -868,7 +875,17 @@ impHandler(setHomunculusName) #ifdef EATHENA_SUPPORT const std::string args = event.args; if (args.empty()) + { + const HomunculusInfo *const info = PlayerInfo::getHomunculus(); + if (info) + { + // TRANSLATORS: dialog header + inputActionReplayListener.openDialog(_("Rename your homun"), + info->name, + InputAction::HOMUNCULUS_SET_NAME); + } return false; + } if (homunculusHandler) { diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 37c7ee2a0..c6ed85423 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -31,6 +31,9 @@ #include "being/playerinfo.h" #include "being/playerrelation.h" #include "being/playerrelations.h" +#ifdef EATHENA_SUPPORT +#include "being/homunculusinfo.h" +#endif #include "const/spells.h" @@ -343,20 +346,30 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being) break; case ActorType::Homunculus: - // TRANSLATORS: popup menu item - // TRANSLATORS: Mercenary move to master - mBrowserBox->addRow("homunculus to master", _("Move to master")); - // TRANSLATORS: popup menu item - // TRANSLATORS: feed homunculus - mBrowserBox->addRow("homunculus feed", _("Feed")); + { + const HomunculusInfo *const info = PlayerInfo::getHomunculus(); + if (info) + { + mBrowserBox->addRow("homunculus to master", + // TRANSLATORS: popup menu item + // TRANSLATORS: Mercenary move to master + _("Move to master")); + // TRANSLATORS: popup menu item + // TRANSLATORS: feed homunculus + mBrowserBox->addRow("homunculus feed", _("Feed")); + mBrowserBox->addRow("##3---"); + // TRANSLATORS: popup menu item + // TRANSLATORS: pet rename item + mBrowserBox->addRow("/sethomunname", _("Rename")); + mBrowserBox->addRow("##3---"); + // TRANSLATORS: popup menu item + // TRANSLATORS: delete homunculus + mBrowserBox->addRow("homunculus delete", _("Kill")); + mBrowserBox->addRow("##3---"); + } addGmCommands(); - mBrowserBox->addRow("##3---"); - // TRANSLATORS: popup menu item - // TRANSLATORS: delete homunculus - mBrowserBox->addRow("homunculus delete", _("Kill")); - mBrowserBox->addRow("##3---"); break; - + } case ActorType::Pet: if (being->getOwner() == localPlayer) { -- cgit v1.2.3-70-g09d2