summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/commands.cpp6
-rw-r--r--src/commands.h3
-rw-r--r--src/gui/windows/chatwindow.cpp22
-rw-r--r--src/gui/windows/chatwindow.h2
-rw-r--r--src/net/pethandler.h2
-rw-r--r--src/net/tmwa/pethandler.cpp9
-rw-r--r--src/net/tmwa/pethandler.h2
7 files changed, 45 insertions, 1 deletions
diff --git a/src/commands.cpp b/src/commands.cpp
index 8b25984b5..b79ba8b9f 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -62,6 +62,7 @@
#include "net/guildhandler.h"
#include "net/net.h"
#include "net/partyhandler.h"
+#include "net/pethandler.h"
#include "net/tradehandler.h"
#ifdef DEBUG_DUMP_LEAKS1
@@ -723,6 +724,11 @@ impHandler1(emote)
player_node->emote(static_cast<uint8_t>(atoi(args.c_str())));
}
+impHandler1(emotePet)
+{
+ Net::getPetHandler()->emote(static_cast<uint8_t>(atoi(args.c_str())));
+}
+
impHandler1(away)
{
if (player_node)
diff --git a/src/commands.h b/src/commands.h
index dca935226..711e4e87e 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -81,6 +81,7 @@ namespace Commands
decHandler(ignoreAll);
decHandler(outfit);
decHandler(emote);
+ decHandler(emotePet);
decHandler(away);
decHandler(pseudoAway);
decHandler(follow);
@@ -170,6 +171,7 @@ enum
COMMAND_ATKHUMAN,
COMMAND_OUTFIT,
COMMAND_EMOTE,
+ COMMAND_EMOTEPET,
COMMAND_AWAY,
COMMAND_PSEUDOAWAY,
COMMAND_FOLLOW,
@@ -265,6 +267,7 @@ static const CommandInfo commands[] =
{"atkhuman", &Commands::attackHuman, -1, true},
{"outfit", &Commands::outfit, -1, true},
{"emote", &Commands::emote, -1, true},
+ {"emotepet", &Commands::emotePet, -1, true},
{"away", &Commands::away, -1, true},
{"pseudoaway", &Commands::pseudoAway, -1, true},
{"follow", &Commands::follow, -1, true},
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index d6bca3781..992932084 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -1479,9 +1479,17 @@ bool ChatWindow::resortChatLog(std::string line, Own own,
const size_t idx = line.find(": \302\202");
if (idx == idx2)
{
- // ignore special message formats.
if (line.find(": \302\202\302") != std::string::npos)
+ {
+ if (line.find(": \302\202\302e") != std::string::npos)
+ {
+ const std::string nick = line.substr(0, idx2 - 1);
+ line = line.substr(idx2 + 6);
+ localPetEmote(nick, atoi(line.c_str()));
+ }
+ // ignore other special message formats.
return false;
+ }
// pet talk message detected
if (line.find(": \302\202\303 ") != std::string::npos)
@@ -1587,6 +1595,18 @@ void ChatWindow::localPetSay(const std::string &nick, const std::string &text)
}
}
+void ChatWindow::localPetEmote(const std::string &nick, const uint8_t emoteId)
+{
+ Being *const being = actorManager->findBeingByName(
+ nick, ActorSprite::PLAYER);
+ if (being)
+ {
+ Being *const pet = being->getPet();
+ if (pet)
+ pet->setEmote(emoteId, 0);
+ }
+}
+
void ChatWindow::initTradeFilter()
{
const std::string tradeListName = client->getServerConfigDirectory()
diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h
index 8cda0fa84..64db4d1df 100644
--- a/src/gui/windows/chatwindow.h
+++ b/src/gui/windows/chatwindow.h
@@ -294,6 +294,8 @@ class ChatWindow final : public Window,
void localPetSay(const std::string &nick, const std::string &text);
+ void localPetEmote(const std::string &nick, const uint8_t emoteId);
+
#ifdef USE_PROFILER
void logicChildren();
#endif
diff --git a/src/net/pethandler.h b/src/net/pethandler.h
index 15805ba22..a3a5f25f5 100644
--- a/src/net/pethandler.h
+++ b/src/net/pethandler.h
@@ -38,6 +38,8 @@ class PetHandler
virtual void spawn(const Being *const being,
const int x, const int y) const = 0;
+
+ virtual void emote(const uint8_t emoteId) const = 0;
};
} // namespace Net
diff --git a/src/net/tmwa/pethandler.cpp b/src/net/tmwa/pethandler.cpp
index e71420f15..d260cea3a 100644
--- a/src/net/tmwa/pethandler.cpp
+++ b/src/net/tmwa/pethandler.cpp
@@ -20,8 +20,11 @@
#include "net/tmwa/pethandler.h"
+#include "gui/widgets/tabs/chattab.h"
+
#include "net/net.h"
+#include "net/tmwa/chathandler.h"
#include "net/tmwa/protocol.h"
#include "debug.h"
@@ -59,4 +62,10 @@ void PetHandler::spawn(const Being *const being A_UNUSED,
{
}
+void PetHandler::emote(const uint8_t emoteId) const
+{
+ Net::getChatHandler()->talk("\302\202\302e" + toString(
+ static_cast<int>(emoteId)), GENERAL_CHANNEL);
+}
+
} // namespace TmwAthena
diff --git a/src/net/tmwa/pethandler.h b/src/net/tmwa/pethandler.h
index 207e0add9..2d04d5c29 100644
--- a/src/net/tmwa/pethandler.h
+++ b/src/net/tmwa/pethandler.h
@@ -43,6 +43,8 @@ class PetHandler final : public MessageHandler, public Net::PetHandler
void spawn(const Being *const being,
const int x, const int y) const override final;
+
+ void emote(const uint8_t emoteId) const override final;
};
} // namespace TmwAthena