From 226331a5e5399ef447bf4eb161d79dfc69a01c5c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 20 Mar 2016 00:24:57 +0300 Subject: Add chat command /adoptchild. --- src/actions/commands.cpp | 16 ++++++++++++++++ src/actions/commands.h | 1 + src/dyetool/actions/commands.cpp | 1 + src/enums/input/inputaction.h | 1 + src/input/inputactionmap.h | 6 ++++++ 5 files changed, 25 insertions(+) (limited to 'src') diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index a91e6f244..1c57bd677 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -62,6 +62,7 @@ #include "net/chathandler.h" #include "net/guildhandler.h" #ifdef EATHENA_SUPPORT +#include "net/familyhandler.h" #include "net/homunculushandler.h" #include "net/mailhandler.h" #include "net/net.h" @@ -1576,4 +1577,19 @@ impHandler(mailTo) #endif } +impHandler(adoptChild) +{ +#ifdef EATHENA_SUPPORT + const std::string nick = getNick(event); + Being *const being = actorManager->findBeingByName( + nick, ActorType::Player); + if (!being) + return true; + familyHandler->askForChild(being); + return true; +#else + return false; +#endif +} + } // namespace Actions diff --git a/src/actions/commands.h b/src/actions/commands.h index 76dc683e9..d2b6e5eeb 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -139,6 +139,7 @@ namespace Actions decHandler(commandBreakGuild); decHandler(commandGuildRecall); decHandler(mailTo); + decHandler(adoptChild); } // namespace Actions #undef decHandler diff --git a/src/dyetool/actions/commands.cpp b/src/dyetool/actions/commands.cpp index bc61b1a3d..5fa4c2c4b 100644 --- a/src/dyetool/actions/commands.cpp +++ b/src/dyetool/actions/commands.cpp @@ -139,5 +139,6 @@ impHandlerVoid(commandPartyRecall) impHandlerVoid(commandBreakGuild) impHandlerVoid(commandGuildRecall) impHandlerVoid(mailTo) +impHandlerVoid(adoptChild) } // namespace Actions diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h index f7663ae7f..1996602da 100644 --- a/src/enums/input/inputaction.h +++ b/src/enums/input/inputaction.h @@ -668,6 +668,7 @@ enumStart(InputAction) COMMAND_BREAK_GUILD, COMMAND_GUILD_RECALL, MAIL_TO, + ADOPT_CHILD, TOTAL } enumEnd(InputAction); diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 16869cbd0..426eb3ae7 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -5497,6 +5497,12 @@ static const InputActionData inputActionData "mailto", UseArgs_true, Protected_false}, + {"keyAdoptChild", + defaultAction(&Actions::adoptChild), + InputCondition::INGAME, + "adoptchild|childadopt|askforchild", + UseArgs_true, + Protected_true}, }; #undef defaultAction -- cgit v1.2.3-70-g09d2