summaryrefslogtreecommitdiff
path: root/src/gui/windows/chatwindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-12-28 19:36:50 +0300
committerAndrei Karas <akaras@inbox.ru>2014-12-28 19:36:50 +0300
commita5e3d86efb85bb2a65e160972cc56e89cd764453 (patch)
treef385447603a24a3898b493ce131b4edf8abd86ab /src/gui/windows/chatwindow.cpp
parent8bfdc250ae7c5ab852653b3aa2da7f3781c7c56e (diff)
downloadplus-a5e3d86efb85bb2a65e160972cc56e89cd764453.tar.gz
plus-a5e3d86efb85bb2a65e160972cc56e89cd764453.tar.bz2
plus-a5e3d86efb85bb2a65e160972cc56e89cd764453.tar.xz
plus-a5e3d86efb85bb2a65e160972cc56e89cd764453.zip
Add chat command for stop and start pet ai.
Diffstat (limited to 'src/gui/windows/chatwindow.cpp')
-rw-r--r--src/gui/windows/chatwindow.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index 553deea70..a707ac8c4 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -1529,6 +1529,12 @@ bool ChatWindow::resortChatLog(std::string line,
localPetDirection(nick, static_cast<BeingDirection::Type>(
atoi(line.c_str())));
}
+ else if (line.find(": \302\202\302a") != std::string::npos)
+ {
+ const std::string nick = line.substr(0, idx2 - 1);
+ line = line.substr(idx2 + 6);
+ localPetAi(nick, atoi(line.c_str()) ? true : false);
+ }
// ignore other special message formats.
return false;
}
@@ -1690,6 +1696,18 @@ void ChatWindow::localPetEmote(const std::string &nick, const uint8_t emoteId)
pet->setEmote(emoteId, 0);
}
+void ChatWindow::localPetAi(const std::string &nick, const bool start)
+{
+ Being *const pet = getPetForNick(nick);
+ if (pet)
+ {
+ if (start)
+ pet->enablePetAi();
+ else
+ pet->disablePetAi();
+ }
+}
+
void ChatWindow::localPetMove(const std::string &nick,
const int x, const int y)
{