diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-12-27 19:21:37 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-12-27 19:21:37 +0300 |
commit | 7b2fbfb1f4384cb0e86d4c7cca81a526444d54b8 (patch) | |
tree | 40cf0cab5c0549506555f53422d67ff4f2b868ee /src/gui | |
parent | 7112c6d75657791aab52a5e1e2f7aec9a0b2519d (diff) | |
download | plus-7b2fbfb1f4384cb0e86d4c7cca81a526444d54b8.tar.gz plus-7b2fbfb1f4384cb0e86d4c7cca81a526444d54b8.tar.bz2 plus-7b2fbfb1f4384cb0e86d4c7cca81a526444d54b8.tar.xz plus-7b2fbfb1f4384cb0e86d4c7cca81a526444d54b8.zip |
add pet emote command.
New chat command: /emotepet emote
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/windows/chatwindow.cpp | 22 | ||||
-rw-r--r-- | src/gui/windows/chatwindow.h | 2 |
2 files changed, 23 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() 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 |