summaryrefslogtreecommitdiff
path: root/src/actions/commands.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-11-23 01:00:04 +0300
committerAndrei Karas <akaras@inbox.ru>2015-11-23 01:00:04 +0300
commit26c14e5269feafec782166f80c31fe1a7c2b3d53 (patch)
tree3e3af33e53421438332a8738f273d032d7165640 /src/actions/commands.cpp
parent9a50b90628eb61e1e48db35a36e9ad5c2a9a2bd5 (diff)
downloadmanaplus-26c14e5269feafec782166f80c31fe1a7c2b3d53.tar.gz
manaplus-26c14e5269feafec782166f80c31fe1a7c2b3d53.tar.bz2
manaplus-26c14e5269feafec782166f80c31fe1a7c2b3d53.tar.xz
manaplus-26c14e5269feafec782166f80c31fe1a7c2b3d53.zip
Add chat command skill.
New chat command: /skill ID[ LEVEL[ TEXT]]
Diffstat (limited to 'src/actions/commands.cpp')
-rw-r--r--src/actions/commands.cpp39
1 files changed, 39 insertions, 0 deletions
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<int>(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