From c6f8d9ed12d930a63f5c82370962ac94cd70b13c Mon Sep 17 00:00:00 2001 From: shennetsind Date: Thu, 2 May 2013 21:51:13 -0300 Subject: 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 --- doc/script_commands.txt | 9 +++++---- src/map/script.c | 14 +++++++++----- 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 ,; -*itemskill "",; +*itemskill ,,{flag}; +*itemskill "",,{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 , -/// itemskill "", -BUILDIN(itemskill) -{ +/// itemskill ,{,flag +/// itemskill "",{,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???"), -- cgit v1.2.3-70-g09d2