summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-05-10 02:03:33 +0300
committerAndrei Karas <akaras@inbox.ru>2016-05-10 02:03:33 +0300
commitb97afbb756202e148b980b3311e2c4cc3dd1cbaf (patch)
tree15c45e87fe175155a219fa9e50bc6ff74b2cc1e4 /src/gui
parentd94f088b0f81fb114980830d8fb53a5ee911b6e6 (diff)
downloadmv-b97afbb756202e148b980b3311e2c4cc3dd1cbaf.tar.gz
mv-b97afbb756202e148b980b3311e2c4cc3dd1cbaf.tar.bz2
mv-b97afbb756202e148b980b3311e2c4cc3dd1cbaf.tar.xz
mv-b97afbb756202e148b980b3311e2c4cc3dd1cbaf.zip
Add ability to switch emotes shortcurs bar between player, pets, homunculuses and mercenaries.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/popups/popupmenu.cpp37
-rw-r--r--src/gui/popups/popupmenu.h2
-rw-r--r--src/gui/shortcut/emoteshortcut.cpp44
-rw-r--r--src/gui/shortcut/emoteshortcut.h2
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.cpp12
5 files changed, 95 insertions, 2 deletions
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index 18f034e67..9a3f7f753 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -1097,6 +1097,43 @@ void PopupMenu::addWindowMenu(const Window *const window)
}
}
+void PopupMenu::showEmoteType()
+{
+ setMousePos();
+
+ mBrowserBox->clearRows();
+ // TRANSLATORS: popup menu header
+ mBrowserBox->addRow(_("Show emotes for:"));
+
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: show emotes for player
+ mBrowserBox->addRow("/setemotetype player", _("Player"));
+
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: show emotes for pet
+ mBrowserBox->addRow("/setemotetype pet", _("Pet"));
+
+#ifdef EATHENA_SUPPORT
+ if (serverFeatures->haveServerPets())
+ {
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: show emotes for homuncules
+ mBrowserBox->addRow("/setemotetype homun", _("Homunculus"));
+
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: show emotes for mercenary
+ mBrowserBox->addRow("/setemotetype merc", _("Mercenary"));
+ }
+#endif
+ mBrowserBox->addRow("##3---");
+
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: close menu
+ mBrowserBox->addRow("cancel", _("Cancel"));
+
+ showPopup(mX, mY);
+}
+
void PopupMenu::handleLink(const std::string &link,
MouseEvent *event A_UNUSED)
{
diff --git a/src/gui/popups/popupmenu.h b/src/gui/popups/popupmenu.h
index b69a0f588..dc53312f4 100644
--- a/src/gui/popups/popupmenu.h
+++ b/src/gui/popups/popupmenu.h
@@ -167,6 +167,8 @@ class PopupMenu final : public Popup, public LinkHandler
void showCraftPopup();
#endif
+ void showEmoteType();
+
/**
* Handles link action.
*/
diff --git a/src/gui/shortcut/emoteshortcut.cpp b/src/gui/shortcut/emoteshortcut.cpp
index b5a2428af..05a7b64c1 100644
--- a/src/gui/shortcut/emoteshortcut.cpp
+++ b/src/gui/shortcut/emoteshortcut.cpp
@@ -22,9 +22,16 @@
#include "gui/shortcut/emoteshortcut.h"
#include "configuration.h"
+#include "settings.h"
#include "being/localplayer.h"
+#ifdef EATHENA_SUPPORT
+#include "net/homunculushandler.h"
+#include "net/mercenaryhandler.h"
+#endif
+#include "net/pethandler.h"
+
#include "resources/db/emotedb.h"
#include "debug.h"
@@ -70,6 +77,19 @@ void EmoteShortcut::save() const
}
}
+void EmoteShortcut::useEmotePlayer(const int index) const
+{
+ if (!localPlayer)
+ return;
+
+ if (index > 0 &&
+ index <= SHORTCUT_EMOTES)
+ {
+ if (mEmotes[index - 1] > 0)
+ localPlayer->emote(mEmotes[index - 1]);
+ }
+}
+
void EmoteShortcut::useEmote(const int index) const
{
if (!localPlayer)
@@ -78,7 +98,27 @@ void EmoteShortcut::useEmote(const int index) const
if (index > 0 &&
index <= SHORTCUT_EMOTES)
{
- if (mEmotes[index - 1] > 0)
- localPlayer->emote(mEmotes[index - 1]);
+ if (mEmotes[index - 1] > 0)
+ {
+ const uint8_t emote = mEmotes[index - 1];
+ switch (settings.emoteType)
+ {
+ case EmoteType::Player:
+ default:
+ localPlayer->emote(emote);
+ break;
+ case EmoteType::Pet:
+ petHandler->emote(emote, 0);
+ break;
+#ifdef EATHENA_SUPPORT
+ case EmoteType::Homunculus:
+ homunculusHandler->emote(emote);
+ break;
+ case EmoteType::Mercenary:
+ mercenaryHandler->emote(emote);
+ break;
+#endif
+ }
+ }
}
}
diff --git a/src/gui/shortcut/emoteshortcut.h b/src/gui/shortcut/emoteshortcut.h
index 40044d16d..6951ac9b3 100644
--- a/src/gui/shortcut/emoteshortcut.h
+++ b/src/gui/shortcut/emoteshortcut.h
@@ -113,6 +113,8 @@ class EmoteShortcut final
*/
void useEmote(const int index) const;
+ void useEmotePlayer(const int index) const;
+
private:
/**
* Save the configuration information.
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp
index 7d15ba4a2..0b004cdad 100644
--- a/src/gui/widgets/emoteshortcutcontainer.cpp
+++ b/src/gui/widgets/emoteshortcutcontainer.cpp
@@ -31,6 +31,7 @@
#include "gui/shortcut/emoteshortcut.h"
+#include "gui/popups/popupmenu.h"
#include "gui/popups/textpopup.h"
#include "input/inputactionoperators.h"
@@ -192,6 +193,9 @@ void EmoteShortcutContainer::mouseDragged(MouseEvent &restrict event A_UNUSED)
void EmoteShortcutContainer::mousePressed(MouseEvent &restrict event) restrict2
{
+ if (event.isConsumed())
+ return;
+
if (event.getButton() == MouseButton::LEFT)
{
if (!emoteShortcut)
@@ -214,6 +218,14 @@ void EmoteShortcutContainer::mousePressed(MouseEvent &restrict event) restrict2
mEmoteClicked = true;
}
}
+ else if (event.getButton() == MouseButton::RIGHT)
+ {
+ if (popupMenu)
+ {
+ event.consume();
+ popupMenu->showEmoteType();
+ }
+ }
}
void EmoteShortcutContainer::mouseReleased(MouseEvent &restrict event)