# This patch file was generated by NetBeans IDE # It uses platform neutral UTF-8 encoding and \n newlines. --- Base (BASE) +++ Locally Modified (Based On LOCAL) @@ -6717,46 +6717,44 @@ } /*========================================== + * -1 : fail no sd + * 0 : fail no equip + * val... *------------------------------------------*/ BUILDIN_FUNC(getequipisidentify) { - int i = -1, num; - TBL_PC *sd; - - num = script_getnum(st, 2); - sd = script_rid2sd(st); - if (sd == NULL) + short ret = getiteminfo(1); + script_pushint(st, ret); return 0; - - if (num > 0 && num <= ARRAYLENGTH(equip)) - i = pc_checkequip(sd, equip[num - 1]); - if (i >= 0) - script_pushint(st, sd->status.inventory[i].identify); - else - script_pushint(st, 0); - - return 0; } /*========================================== *------------------------------------------*/ BUILDIN_FUNC(getequiprefinerycnt) { + short ret = getiteminfo(0); + script_pushint(st, ret); + return 0; +} + +static int getiteminfo(short flag){ int i = -1, num; + int ret=0; TBL_PC *sd; num = script_getnum(st, 2); sd = script_rid2sd(st); if (sd == NULL) - return 0; + return -1; if (num > 0 && num <= ARRAYLENGTH(equip)) i = pc_checkequip(sd, equip[num - 1]); - if (i >= 0) - script_pushint(st, sd->status.inventory[i].refine); - else - script_pushint(st, 0); - - return 0; + if (i >= 0){ + switch(flag){ + case 0: ret = sd->status.inventory[i].refine; + case 1: ret = sd->status.inventory[i].identify; } + } + return ret; +} /*========================================== *------------------------------------------*/