viewing paste Unknown #5742 | 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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
Index: src/map/pc.c
===================================================================
--- src/map/pc.c    (revision 17294)
+++ src/map/pc.c    (working copy)
@@ -6644,14 +6644,13 @@
            sd->st->state = END;
    }
 
-   npc_script_event(sd,NPCE_DIE);
-
    /* e.g. not killed thru pc_damage */
    if( pc_issit(sd) ) {
        clif_status_load(&sd->bl,SI_SIT,0);
    }
+   
+   pc_setdead(sd);
 
-   pc_setdead(sd);
    //Reset menu skills/item skills
    if (sd->skillitem)
        sd->skillitem = sd->skillitemlv = 0;
@@ -6701,42 +6700,6 @@
    break;
    }
 
-   if (src && src->type == BL_PC)
-   {
-       struct map_session_data *ssd = (struct map_session_data *)src;
-       pc_setparam(ssd, SP_KILLEDRID, sd->bl.id);
-       npc_script_event(ssd, NPCE_KILLPC);
-
-       if (battle_config.pk_mode&2) {
-           ssd->status.manner -= 5;
-           if(ssd->status.manner < 0)
-               sc_start(&sd->bl,src,SC_NOCHAT,100,0,0);
-#if 0
-           // PK/Karma system code (not enabled yet) [celest]
-           // originally from Kade Online, so i don't know if any of these is correct ^^;
-           // note: karma is measured REVERSE, so more karma = more 'evil' / less honourable,
-           // karma going down = more 'good' / more honourable.
-           // The Karma System way...
-
-           if (sd->status.karma > ssd->status.karma) { // If player killed was more evil
-               sd->status.karma--;
-               ssd->status.karma--;
-           }
-           else if (sd->status.karma < ssd->status.karma)  // If player killed was more good
-               ssd->status.karma++;
-
-
-           // or the PK System way...
-
-           if (sd->status.karma > 0)   // player killed is dishonourable?
-               ssd->status.karma--; // honour points earned
-           sd->status.karma++; // honour points lost
-
-           // To-do: Receive exp on certain occasions
-#endif
-       }
-   }
-
    if(battle_config.bone_drop==2
        || (battle_config.bone_drop==1 && map[sd->bl.m].flag.pvp))
    {
Index: src/map/status.c
===================================================================
--- src/map/status.c    (revision 17294)
+++ src/map/status.c    (working copy)
@@ -1288,6 +1288,46 @@
        battle_config.clear_unit_ondeath&target->type)
        skill_clear_unitgroup(target);
 
+   //We do this so no possible errors can occur when warping a dead character
+   if (target->type == BL_PC) {
+       struct map_session_data *sd = (TBL_PC*)target;
+       npc_script_event(sd,NPCE_DIE);
+       if (src && src->type == BL_PC) {
+           struct map_session_data *ssd = (struct map_session_data *)src;
+           pc_setparam(ssd, SP_KILLEDRID, sd->bl.id);
+           npc_script_event(ssd,NPCE_KILLPC);
+
+           if (battle_config.pk_mode&2) {
+               ssd->status.manner -= 5;
+               if(ssd->status.manner < 0)
+                   sc_start(&sd->bl,src,SC_NOCHAT,100,0,0);
+#if 0
+               // PK/Karma system code (not enabled yet) [celest]
+               // originally from Kade Online, so i don't know if any of these is correct ^^;
+               // note: karma is measured REVERSE, so more karma = more 'evil' / less honourable,
+               // karma going down = more 'good' / more honourable.
+               // The Karma System way...
+
+               if (sd->status.karma > ssd->status.karma) { // If player killed was more evil
+                   sd->status.karma--;
+                   ssd->status.karma--;
+               }
+               else if (sd->status.karma < ssd->status.karma)  // If player killed was more good
+                   ssd->status.karma++;
+
+
+               // or the PK System way...
+
+               if (sd->status.karma > 0)   // player killed is dishonourable?
+                   ssd->status.karma--; // honour points earned
+               sd->status.karma++; // honour points lost
+
+               // To-do: Receive exp on certain occasions
+#endif
+           }
+       }
+   }
+
    if(target->type&BL_REGEN)
    {   //Reset regen ticks.
        struct regen_data *regen = status_get_regen_data(target);
Viewed 631 times, submitted by Guest.