summaryrefslogtreecommitdiff
path: root/src/actions
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
parent9a50b90628eb61e1e48db35a36e9ad5c2a9a2bd5 (diff)
downloadplus-26c14e5269feafec782166f80c31fe1a7c2b3d53.tar.gz
plus-26c14e5269feafec782166f80c31fe1a7c2b3d53.tar.bz2
plus-26c14e5269feafec782166f80c31fe1a7c2b3d53.tar.xz
plus-26c14e5269feafec782166f80c31fe1a7c2b3d53.zip
Add chat command skill.
New chat command: /skill ID[ LEVEL[ TEXT]]
Diffstat (limited to 'src/actions')
-rw-r--r--src/actions/commands.cpp39
-rw-r--r--src/actions/commands.h1
2 files changed, 40 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
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