From 4455f3a3dd5fa28ef7fc1d1cf6d2bff723c90b47 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 27 Aug 2014 16:13:27 +0300 Subject: Move chat command /talkpet into actions. --- src/actions/commands.cpp | 11 +++++++++++ src/actions/commands.h | 1 + src/commands.cpp | 10 ---------- src/commands.h | 5 +---- src/input/inputaction.h | 1 + src/input/inputactionmap.h | 9 +++++++++ 6 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index e0514f902..ee04acc65 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -36,6 +36,7 @@ #include "being/playerinfo.h" #include "being/playerrelations.h" +#include "gui/chatconsts.h" #include "gui/dialogsmanager.h" #include "gui/gui.h" #include "gui/popupmanager.h" @@ -663,4 +664,14 @@ impHandler(talkRaw) return true; } +impHandler(talkPet) +{ + // in future probably need add channel detection + if (!localPlayer->getPets().empty()) + Net::getChatHandler()->talkPet(event.args, GENERAL_CHANNEL); + else + Net::getChatHandler()->talk(event.args, GENERAL_CHANNEL); + return true; +} + } // namespace Actions diff --git a/src/actions/commands.h b/src/actions/commands.h index db0c6eb5e..eb9ab4575 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -67,6 +67,7 @@ namespace Actions decHandler(enableAway); decHandler(testParticle); decHandler(talkRaw); + decHandler(talkPet); } // namespace Actions #undef decHandler diff --git a/src/commands.cpp b/src/commands.cpp index 2a067fb90..e33a78fb6 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -106,16 +106,6 @@ impHandler(hack) return true; } -impHandler(talkPet) -{ - // in future probably need add channel detection - if (!localPlayer->getPets().empty()) - Net::getChatHandler()->talkPet(event.args, GENERAL_CHANNEL); - else - Net::getChatHandler()->talk(event.args, GENERAL_CHANNEL); - return true; -} - impHandler(gm) { Net::getChatHandler()->talk("@wgm " + event.args, GENERAL_CHANNEL); diff --git a/src/commands.h b/src/commands.h index be9000623..907ed82d3 100644 --- a/src/commands.h +++ b/src/commands.h @@ -52,7 +52,6 @@ struct CommandInfo final namespace Commands { decHandler(hack); - decHandler(talkPet); decHandler(uploadConfig); decHandler(uploadServerConfig); decHandler(uploadLog); @@ -64,8 +63,7 @@ namespace Commands enum { - COMMAND_TALKPET = 0, - COMMAND_UPLOADCONFIG, + COMMAND_UPLOADCONFIG = 0, COMMAND_UPLOADSERVERCONFIG, COMMAND_UPLOADLOG, COMMAND_GM, @@ -76,7 +74,6 @@ enum static const CommandInfo commands[] = { - {"talkpet", &Commands::talkPet, -1, true}, {"uploadconfig", &Commands::uploadConfig, -1, false}, {"uploadserverconfig", &Commands::uploadServerConfig, -1, false}, {"uploadlog", &Commands::uploadLog, -1, false}, diff --git a/src/input/inputaction.h b/src/input/inputaction.h index 65663cd57..c7296258d 100644 --- a/src/input/inputaction.h +++ b/src/input/inputaction.h @@ -417,6 +417,7 @@ namespace InputAction TEST_PARTICLE, CREATE_ITEMS, TALK_RAW, + TALK_PET, TOTAL }; } // namespace InputAction diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index baaee04d1..33d1a3826 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -3530,6 +3530,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { InputAction::NO_VALUE, 50, InputCondition::INGAME, "talkraw", + false}, + {"keyTalkPet", + InputType::UNKNOWN, InputAction::NO_VALUE, + InputType::UNKNOWN, InputAction::NO_VALUE, + Input::GRP_DEFAULT, + &Actions::talkPet, + InputAction::NO_VALUE, 50, + InputCondition::INGAME, + "talkpet", false} }; -- cgit v1.2.3-70-g09d2