viewing paste Charms r15289 | 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 72 73 74 75 76 77 78 79 80 81 82 83
Index: src/common/mmo.h
===================================================================
--- src/common/mmo.h    2011-12-27 22:09:51.727946899 +0500
+++ src/common/mmo.h    2011-12-28 15:29:55.193120002 +0500
@@ -178,6 +178,7 @@
    IT_UNKNOWN2,//9
    IT_AMMO,    //10
    IT_DELAYCONSUME,//11
+   IT_CHARM,//12
    IT_THROWWEAPON= 17,//17
    IT_CASH = 18,
    IT_MAX 
Index: src/map/clif.c
===================================================================
--- src/map/clif.c  2011-12-28 10:44:28.209120003 +0500
+++ src/map/clif.c  2011-12-28 15:39:13.405120002 +0500
@@ -60,7 +60,7 @@
 //Converts item type in case of pet eggs.
 static inline int itemtype(int type)
 {
-   return ( type == IT_PETEGG ) ? IT_WEAPON : type;
+   return ( type == IT_PETEGG ) ? IT_WEAPON : ( type == IT_CHARM ) ? IT_ETC : type;
 }
Index: src/map/pc.c
===================================================================
--- src/map/pc.c    2011-12-26 10:23:31.255420000 +0500
+++ src/map/pc.c    2011-12-28 15:29:55.221120002 +0500
@@ -3457,6 +3457,7 @@
    clif_updatestatus(sd,SP_WEIGHT);
    //Auto-equip
    if(data->flag.autoequip) pc_equipitem(sd, i, data->equip);
+   if(sd->inventory_data[i]->type == IT_CHARM) status_calc_pc(sd,0);
    return 0;
 }
 
@@ -3465,6 +3466,7 @@
  *------------------------------------------*/
 int pc_delitem(struct map_session_data *sd,int n,int amount,int type, short reason)
 {
+   int mem=0;
    nullpo_retr(1, sd);
 
    if(sd->status.inventory[n].nameid==0 || amount <= 0 || sd->status.inventory[n].amount<amount || sd->inventory_data[n] == NULL)
@@ -3475,6 +3477,7 @@
    if(sd->status.inventory[n].amount<=0){
        if(sd->status.inventory[n].equip)
            pc_unequipitem(sd,n,3);
+       mem = sd->inventory_data[n]->type;
        memset(&sd->status.inventory[n],0,sizeof(sd->status.inventory[0]));
        sd->inventory_data[n] = NULL;
    }
@@ -3483,6 +3486,8 @@
    if(!(type&2))
        clif_updatestatus(sd,SP_WEIGHT);
 
+   if(mem == IT_CHARM) status_calc_pc(sd,0);
+
    return 0;
 }
 
Index: src/map/status.c
===================================================================
--- src/map/status.c    2011-12-26 10:23:31.247420000 +0500
+++ src/map/status.c    2011-12-28 15:29:55.225120002 +0500
@@ -2176,6 +2176,18 @@
    pc_delautobonus(sd,sd->autobonus3,ARRAYLENGTH(sd->autobonus3),true);
 
    // Parse equipment.
+   for(i=0;i<MAX_INVENTORY;i++){
+            if(!sd->inventory_data[i])
+                continue;
+        if(sd->inventory_data[i]->type == IT_CHARM){
+                if(sd->inventory_data[i]->script && sd->inventory_data[i]->elv <=sd->status.base_level) {
+                if((!((1<<(sd->class_&MAPID_BASEMASK)) &(sd->inventory_data[i]->class_base[sd->class_&JOBL_2_1?1:(sd->class_&JOBL_2_2?2:0)])))
+                || (!((1<<(sd->class_&JOBL_UPPER?1:(sd->class_&JOBL_BABY?2:0))) &sd->inventory_data[i]->class_upper))) continue;            
+                    run_script(sd->inventory_data[i]->script,0,sd->bl.id,0);
+                if (!calculating) //Abort, run_script retriggered this. [Skotlex]
+                    return 1;
+                }}}
+
    for(i=0;i<EQI_MAX-1;i++) {
        current_equip_item_index = index = sd->equip_index[i]; //We pass INDEX to current_equip_item_index - for EQUIP_SCRIPT (new cards solution) [Lupus]
        if(index < 0)
Viewed 729 times, submitted by Guest.