summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-05-02 21:51:13 -0300
committershennetsind <ind@henn.et>2013-05-02 21:51:13 -0300
commitc6f8d9ed12d930a63f5c82370962ac94cd70b13c (patch)
treed961fff9faf1770fd30d697000a1a76b3c09b83b
parent64adafab4a56d97f547a5daf0f9feda3f9a12032 (diff)
downloadhercules-c6f8d9ed12d930a63f5c82370962ac94cd70b13c.tar.gz
hercules-c6f8d9ed12d930a63f5c82370962ac94cd70b13c.tar.bz2
hercules-c6f8d9ed12d930a63f5c82370962ac94cd70b13c.tar.xz
hercules-c6f8d9ed12d930a63f5c82370962ac94cd70b13c.zip
Fixed Bug #7210
itemskill now checks for skill conditions unless a 3rd param is present. http://hercules.ws/board/tracker/issue-7210-itemskill-command-does-not-check-for-required-items/ Signed-off-by: shennetsind <ind@henn.et>
-rw-r--r--doc/script_commands.txt9
-rw-r--r--src/map/script.c14
2 files changed, 14 insertions, 9 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index aa3112d62..768813a6f 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -4454,13 +4454,14 @@ except for those have been set with 'disable_items'.
---------------------------------------
-*itemskill <skill id>,<skill level>;
-*itemskill "<skill name>",<skill level>;
+*itemskill <skill id>,<skill level>,{flag};
+*itemskill "<skill name>",<skill level>,{flag};
This command meant for item scripts to replicate single-use skills in usable
-items. It will not work properly, if there is a visible dialog window or menu.
-If the skill is self or auto-targeting, it will be used immediately otherwise a
+items. It will not work properly if there is a visible dialog window or menu.
+If the skill is self or auto-targeting it will be used immediately otherwise a
target cursor is shown.
+Flag is a optional param and when present the command will not check for skill requirements
// When Anodyne is used, it will cast Endure (8), Level 1, as if the actual
// skill has been used from skill tree.
diff --git a/src/map/script.c b/src/map/script.c
index 3b1533f74..250ffeb93 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -8245,10 +8245,9 @@ BUILDIN(guildopenstorage)
/*==========================================
* Make player use a skill trought item usage
*------------------------------------------*/
-/// itemskill <skill id>,<level>
-/// itemskill "<skill name>",<level>
-BUILDIN(itemskill)
-{
+/// itemskill <skill id>,<level>{,flag
+/// itemskill "<skill name>",<level>{,flag
+BUILDIN(itemskill) {
int id;
int lv;
TBL_PC* sd;
@@ -8260,6 +8259,11 @@ BUILDIN(itemskill)
id = ( script_isstring(st,2) ? skill->name2id(script_getstr(st,2)) : script_getnum(st,2) );
lv = script_getnum(st,3);
+ if( !script_hasdata(st, 4) ) {
+ if( !skill->check_condition_castbegin(sd,id,lv) )
+ return true;
+ }
+
sd->skillitem=id;
sd->skillitemlv=lv;
clif->item_skill(sd,id,lv);
@@ -17155,7 +17159,7 @@ void script_parse_builtin(void) {
BUILDIN_DEF(gettimestr,"si"),
BUILDIN_DEF(openstorage,""),
BUILDIN_DEF(guildopenstorage,""),
- BUILDIN_DEF(itemskill,"vi"),
+ BUILDIN_DEF(itemskill,"vi?"),
BUILDIN_DEF(produce,"i"),
BUILDIN_DEF(cooking,"i"),
BUILDIN_DEF(monster,"siisii???"),