From e2dddbdd9599b9b1f6a9825ee06d4d3616d9d1dd Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 26 Aug 2014 00:53:29 +0300 Subject: Move chat command /follow into actions. --- src/actions/commands.cpp | 26 ++++++++++++++++++++++++++ src/actions/commands.h | 1 + 2 files changed, 27 insertions(+) (limited to 'src/actions') diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index e32aee7a3..5038d9f57 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -21,6 +21,7 @@ #include "actions/commands.h" #include "actormanager.h" +#include "configuration.h" #include "dropshortcut.h" #include "emoteshortcut.h" #include "game.h" @@ -368,4 +369,29 @@ impHandler(pseudoAway) return false; } +impHandler(follow) +{ + if (!localPlayer) + return false; + + if (!features.getBoolValue("allowFollow")) + return false; + + if (!event.args.empty()) + { + localPlayer->setFollow(event.args); + } + else if (event.tab && event.tab->getType() == ChatTabType::WHISPER) + { + localPlayer->setFollow(static_cast(event.tab)->getNick()); + } + else + { + const Being *const being = localPlayer->getTarget(); + if (being != nullptr) + localPlayer->setFollow(being->getName()); + } + return true; +} + } // namespace Actions diff --git a/src/actions/commands.h b/src/actions/commands.h index 8f6813210..7034d0638 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -45,6 +45,7 @@ namespace Actions decHandler(commandEmotePet); decHandler(awayMessage); decHandler(pseudoAway); + decHandler(follow); } // namespace Actions #undef decHandler -- cgit v1.2.3-70-g09d2