From 26c14e5269feafec782166f80c31fe1a7c2b3d53 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 23 Nov 2015 01:00:04 +0300 Subject: Add chat command skill. New chat command: /skill ID[ LEVEL[ TEXT]] --- src/actions/commands.cpp | 39 +++++++++++++++++++++++++++++++++++++++ src/actions/commands.h | 1 + 2 files changed, 40 insertions(+) (limited to 'src/actions') diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index 5dcbc3d93..cea0bdc67 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -1076,4 +1076,43 @@ impHandler(selectSkillLevel) return false; } +impHandler(skill) +{ + if (!skillDialog) + return false; + + StringVect vect; + splitToStringVector(vect, event.args, ' '); + const int sz = static_cast(vect.size()); + if (sz < 1) + return true; + const int skillId = atoi(vect[0].c_str()); + int level = 0; + std::string text; + if (sz > 1) + { + level = atoi(vect[1].c_str()); + if (sz > 2) + text = vect[2]; + } + if (text.empty()) + { + skillDialog->useSkill(skillId, + AutoTarget_true, + level, + false, + ""); + } + else + { + logger->log("text: " + text); + skillDialog->useSkill(skillId, + AutoTarget_true, + level, + true, + text); + } + return true; +} + } // namespace Actions diff --git a/src/actions/commands.h b/src/actions/commands.h index 0e71f409c..67b53be0c 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -91,6 +91,7 @@ namespace Actions decHandler(serverConfGet); decHandler(slide); decHandler(selectSkillLevel); + decHandler(skill); } // namespace Actions #undef decHandler -- cgit v1.2.3-60-g2f50