From 177fa7f32a6171967cd88080ca06adeaddeb967d Mon Sep 17 00:00:00 2001 From: cookiecrumbs Date: Tue, 7 Aug 2012 23:41:36 +0000 Subject: Fixed bugreport:6428 where the count parameter of replacestr didn't allow variable integers injected in the script command. Added script command repairall to easy repair all of the attached character's items. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16600 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/script.c | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) (limited to 'src/map') diff --git a/src/map/script.c b/src/map/script.c index 9ab5784c6..7ee0be057 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -7324,6 +7324,37 @@ BUILDIN_FUNC(repair) return 0; } +/*========================================== + * repairall + *------------------------------------------*/ +BUILDIN_FUNC(repairall) +{ + int i, repaircounter = 0; + TBL_PC *sd; + + sd = script_rid2sd(st); + if(sd == NULL) + return 0; + + for(i = 0; i < MAX_INVENTORY; i++) + { + if(sd->status.inventory[i].nameid && sd->status.inventory[i].attribute) + { + sd->status.inventory[i].attribute = 0; + clif_produceeffect(sd,0,sd->status.inventory[i].nameid); + repaircounter++; + } + } + + if(repaircounter) + { + clif_misceffect(&sd->bl, 3); + clif_equiplist(sd); + } + + return 0; +} + /*========================================== * ‘•”õƒ`ƒFƒbƒN *------------------------------------------*/ @@ -13913,9 +13944,8 @@ BUILDIN_FUNC(replacestr) } if(script_hasdata(st, 6)) { - if(script_isint(st,6)) - count = script_getnum(st, 6); - else { + count = script_getnum(st, 6); + if(!count) { ShowError("script:replacestr: Invalid count value. Expected int got string\n"); st->state = END; return 1; @@ -16947,6 +16977,7 @@ struct script_function buildin_func[] = { BUILDIN_DEF(getequipname,"i"), BUILDIN_DEF(getbrokenid,"i"), // [Valaris] BUILDIN_DEF(repair,"i"), // [Valaris] + BUILDIN_DEF(repairall,""), BUILDIN_DEF(getequipisequiped,"i"), BUILDIN_DEF(getequipisenableref,"i"), BUILDIN_DEF(getequipisidentify,"i"), -- cgit v1.2.3-70-g09d2