viewing paste Unknown #6002 | Text

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 84 85 86
Index: src/map/script.c
===================================================================
--- src/map/script.c    (revision 17337)
+++ src/map/script.c    (working copy)
@@ -9839,7 +9839,7 @@
    TBL_NPC * nd = map_id2nd(st->oid);
    struct block_list* bl;
    enum sc_type type;
-   int tick, val1, val2, val3, val4=0, rate, flag, isitem;
+   int tick, val1, val2, val3, val4=0, rate, flag;
    char start_type;
    const char* command = script_getfuncname(st);
 
@@ -9854,8 +9854,11 @@
    tick = script_getnum(st,3);
    val1 = script_getnum(st,4);
 
+   //solving if script from npc or item
+   flag = (nd && nd->bl.id == fake_nd->bl.id)?0:16;
+
    rate = script_hasdata(st,4+start_type)?min(script_getnum(st,4+start_type),10000):10000;
-   flag = script_hasdata(st,5+start_type)?script_getnum(st,5+start_type):2;
+   flag += script_hasdata(st,5+start_type)?script_getnum(st,5+start_type):flag?0:2;
 
    if(script_hasdata(st,(6+start_type)))
        bl = map_id2bl(script_getnum(st,(6+start_type)));
@@ -9873,25 +9876,22 @@
        val4 = 1;// Mark that this was a thrown sc_effect
    }
 
-   //solving if script from npc or item
-   isitem = (nd && nd->bl.id == fake_nd->bl.id || flag != 2)?true:false;
-
    switch(start_type) {
        case 1:
            if(bl)
-               status_change_start(isitem?bl:NULL, bl, type, rate, val1, 0, 0, val4, tick, flag);
+               status_change_start(bl, bl, type, rate, val1, 0, 0, val4, tick, flag);
            break;
        case 2:
            val2 = script_getnum(st,5);
            if(bl)
-               status_change_start(isitem?bl:NULL, bl, type, rate, val1, val2, 0, val4, tick, flag);
+               status_change_start(bl, bl, type, rate, val1, val2, 0, val4, tick, flag);
            break;
        case 4:
            val2 = script_getnum(st,5);
            val3 = script_getnum(st,6);
            val4 = script_getnum(st,7);
            if(bl)
-               status_change_start(isitem?bl:NULL, bl, type, rate, val1, val2, val3, val4, tick, flag);
+               status_change_start(bl, bl, type, rate, val1, val2, val3, val4, tick, flag);
            break;
    }
 
Index: src/map/status.c
===================================================================
--- src/map/status.c    (revision 17337)
+++ src/map/status.c    (working copy)
@@ -6259,7 +6259,7 @@
    struct map_session_data *sd;
 
    nullpo_ret(bl);
-   if(src==NULL) return tick?tick:1;//If no source, it can't be resisted (NPC given)
+   if(src==NULL) return tick?tick:1; //This should not happen in current implementation, but leave it anyway
 
    //Status that are blocked by Golden Thief Bug card or Wand of Hermod
    if (status_isimmune(bl))
@@ -6550,6 +6550,7 @@
  * &2: Tick should not be reduced (by vit, luk, lv, etc)
  * &4: sc_data loaded, no value has to be altered.
  * &8: rate should not be reduced
+ * 16: Function called by NPC (no other flag given)
  *------------------------------------------*/
 int status_change_start(struct block_list* src, struct block_list* bl,enum sc_type type,int rate,int val1,int val2,int val3,int val4,int tick,int flag)
 {
@@ -6642,8 +6643,7 @@
    sd = BL_CAST(BL_PC, bl);
 
    //Adjust tick according to status resistances
-   if( !(flag&(1|4)) )
-   {
+   if( !(flag&(1|4) && !(flag == 16)) ) {
        tick = status_get_sc_def(src, bl, type, rate, tick, flag);
        if( !tick ) return 0;
    }
Viewed 753 times, submitted by Guest.