diff options
author | Haru <haru@dotalux.com> | 2019-08-26 00:54:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-26 00:54:12 +0200 |
commit | 9f4065570cff47b23eba3c862e994869520a6f8a (patch) | |
tree | dbc82b219880a6b0a9ba36ef42c1ade4e7551a3c /src | |
parent | 81e5138adab92c18c7b95f4ca55850be20dde462 (diff) | |
parent | 381c7d3a5a7d893810cf6ee648beeecba0294a1c (diff) | |
download | hercules-9f4065570cff47b23eba3c862e994869520a6f8a.tar.gz hercules-9f4065570cff47b23eba3c862e994869520a6f8a.tar.bz2 hercules-9f4065570cff47b23eba3c862e994869520a6f8a.tar.xz hercules-9f4065570cff47b23eba3c862e994869520a6f8a.zip |
Merge pull request #2512 from Emistry/scriptcommand_getequiprefinerycnt
Update *getequiprefinerycnt script command
Diffstat (limited to 'src')
-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?"), |