From b97afbb756202e148b980b3311e2c4cc3dd1cbaf Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 10 May 2016 02:03:33 +0300 Subject: Add ability to switch emotes shortcurs bar between player, pets, homunculuses and mercenaries. --- src/gui/shortcut/emoteshortcut.cpp | 44 ++++++++++++++++++++++++++++++++++++-- src/gui/shortcut/emoteshortcut.h | 2 ++ 2 files changed, 44 insertions(+), 2 deletions(-) (limited to 'src/gui/shortcut') 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. -- cgit v1.2.3-60-g2f50