summaryrefslogtreecommitdiff
path: root/src/gui/windows/chatwindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-12-27 19:21:37 +0300
committerAndrei Karas <akaras@inbox.ru>2013-12-27 19:21:37 +0300
commit7b2fbfb1f4384cb0e86d4c7cca81a526444d54b8 (patch)
tree40cf0cab5c0549506555f53422d67ff4f2b868ee /src/gui/windows/chatwindow.cpp
parent7112c6d75657791aab52a5e1e2f7aec9a0b2519d (diff)
downloadmv-7b2fbfb1f4384cb0e86d4c7cca81a526444d54b8.tar.gz
mv-7b2fbfb1f4384cb0e86d4c7cca81a526444d54b8.tar.bz2
mv-7b2fbfb1f4384cb0e86d4c7cca81a526444d54b8.tar.xz
mv-7b2fbfb1f4384cb0e86d4c7cca81a526444d54b8.zip
add pet emote command.
New chat command: /emotepet emote
Diffstat (limited to 'src/gui/windows/chatwindow.cpp')
-rw-r--r--src/gui/windows/chatwindow.cpp22
1 files changed, 21 insertions, 1 deletions
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()