diff options
author | Emistry Haoyan <equinox1991@gmail.com> | 2019-07-29 22:23:19 +0800 |
---|---|---|
committer | Emistry Haoyan <equinox1991@gmail.com> | 2019-07-29 22:23:19 +0800 |
commit | 381c7d3a5a7d893810cf6ee648beeecba0294a1c (patch) | |
tree | 323c66d0cea7a0fff29728cf1c5fad0241f26d21 /src/map | |
parent | 0edf2360b185f0e1c68bb6ddbbbe3720af5651b3 (diff) | |
download | hercules-381c7d3a5a7d893810cf6ee648beeecba0294a1c.tar.gz hercules-381c7d3a5a7d893810cf6ee648beeecba0294a1c.tar.bz2 hercules-381c7d3a5a7d893810cf6ee648beeecba0294a1c.tar.xz hercules-381c7d3a5a7d893810cf6ee648beeecba0294a1c.zip |
Update *getequiprefinerycnt script command
- allow to specify more than one equipment slots.
- return the total of refine of specified equipment slots.
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/script.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/src/map/script.c b/src/map/script.c index f515d4403..51cf29816 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -9536,27 +9536,29 @@ static BUILDIN(getequipisidentify) } /*========================================== - * Get the item refined value at pos - * return (npc) - * x : refine amount - * 0 : false (not refined) + * Get the total refine amount of equip at given pos + * return total refine amount *------------------------------------------*/ static BUILDIN(getequiprefinerycnt) { - int i = -1,num; - struct map_session_data *sd; + int total_refine = 0; + struct map_session_data* sd = script->rid2sd(st); - num = script_getnum(st,2); - sd = script->rid2sd(st); - if( sd == NULL ) - return true; + if (sd != NULL) + { + int count = script_lastdata(st); + int script_equip_size = ARRAYLENGTH(script->equip); + for (int n = 2; n <= count; n++) { + int i = -1; + int num = script_getnum(st, n); + if (num > 0 && num <= script_equip_size) + i = pc->checkequip(sd, script->equip[num - 1]); - if (num > 0 && num <= ARRAYLENGTH(script->equip)) - i=pc->checkequip(sd,script->equip[num-1]); - if(i >= 0) - script_pushint(st,sd->status.inventory[i].refine); - else - script_pushint(st,0); + if (i >= 0) + total_refine += sd->status.inventory[i].refine; + } + } + script_pushint(st, total_refine); return true; } @@ -25837,7 +25839,7 @@ static void script_parse_builtin(void) BUILDIN_DEF(getequipisequiped,"i"), BUILDIN_DEF(getequipisenableref,"i"), BUILDIN_DEF(getequipisidentify,"i"), - BUILDIN_DEF(getequiprefinerycnt,"i"), + BUILDIN_DEF(getequiprefinerycnt,"i*"), BUILDIN_DEF(getequipweaponlv,"i"), BUILDIN_DEF(getequippercentrefinery,"i?"), BUILDIN_DEF(successrefitem,"i?"), |