summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorcookiecrumbs <cookiecrumbs@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-08-07 23:41:36 +0000
committercookiecrumbs <cookiecrumbs@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-08-07 23:41:36 +0000
commit177fa7f32a6171967cd88080ca06adeaddeb967d (patch)
treeb98ee69faa67c0920a5c98348dbd6521458751e1 /src/map/script.c
parentd7e6eb4fd35b03865c6f38907d922d74b23156ac (diff)
downloadhercules-177fa7f32a6171967cd88080ca06adeaddeb967d.tar.gz
hercules-177fa7f32a6171967cd88080ca06adeaddeb967d.tar.bz2
hercules-177fa7f32a6171967cd88080ca06adeaddeb967d.tar.xz
hercules-177fa7f32a6171967cd88080ca06adeaddeb967d.zip
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
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c37
1 files changed, 34 insertions, 3 deletions
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
@@ -7325,6 +7325,37 @@ BUILDIN_FUNC(repair)
}
/*==========================================
+ * 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
*------------------------------------------*/
BUILDIN_FUNC(getequipisequiped)
@@ -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"),