viewing paste Unknown #1489 | C

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
# 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;
+}
 
 /*==========================================
  *------------------------------------------*/
Viewed 461 times, submitted by lighta.