viewing paste [Diff] OnPCStatCalcEvent | Diff

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 116 117 118 119
Index: map/clif.c
===================================================================
--- map/clif.c  (revision 14824)
+++ map/clif.c  (working copy)
@@ -9531,6 +9531,9 @@
            sprintf(output, "[ Kill Steal Protection Disabled. KS is allowed in this map ]");
            clif->broadcast(&sd->bl, output, strlen(output) + 1, BC_BLUE, SELF);
        }
+       
+       //mocha//
+       status_calc_pc(sd,0); // run OnPCStatCalcEvent
 
        map->iwall_get(sd); // Updates Walls Info on this Map to Client
        status_calc_pc(sd, SCO_NONE);/* some conditions are map-dependent so we must recalculate */
Index: map/npc.c
===================================================================
--- map/npc.c   (revision 14824)
+++ map/npc.c   (working copy)
@@ -4263,6 +4263,9 @@
        {"Die Event",script->config.die_event_name},
        {"Kill PC Event",script->config.kill_pc_event_name},
        {"Kill NPC Event",script->config.kill_mob_event_name},
+       
+       //mocha
+       {"Stat Calc Event",script->config.stat_calc_event_name},
    };
 
    for (i = 0; i < NPCE_MAX; i++)
Index: map/npc.h
===================================================================
--- map/npc.h   (revision 14824)
+++ map/npc.h   (working copy)
@@ -137,6 +137,7 @@
    NPCE_DIE,
    NPCE_KILLPC,
    NPCE_KILLNPC,
+   NPCE_STATCALC,
    NPCE_MAX
 };
 
Index: map/script.c
===================================================================
--- map/script.c    (revision 14824)
+++ map/script.c    (working copy)
@@ -9163,6 +9163,20 @@
 
    return true;
 }
+//mocha//
+BUILDIN(stat_recalc) {
+    TBL_PC* sd;
+    if ( script_hasdata( st, 2 ) ) {
+        if ( data_isstring( script_getdata( st, 2 ) ) )
+            sd = map->nick2sd( script_getstr( st, 2 ) );
+        else
+            sd = map->id2sd( script_getnum( st, 2 ) );
+    } else
+        sd = script_rid2sd(st);
+    if ( sd )
+        status_calc_pc( sd, 0 );
+    return true;
+}
 
 /*==========================================
  * Gain guild exp [Celest]
@@ -19215,6 +19229,7 @@
        BUILDIN_DEF(getitemslots,"i"),
        BUILDIN_DEF(makepet,"i"),
        BUILDIN_DEF(getexp,"ii"),
+       BUILDIN_DEF(stat_recalc, "?"),
        BUILDIN_DEF(getinventorylist,""),
        BUILDIN_DEF(getskilllist,""),
        BUILDIN_DEF(clearitem,""),
@@ -19511,6 +19526,7 @@
        BUILDIN_DEF(tradertype,"i"),
        BUILDIN_DEF(purchaseok,""),
        BUILDIN_DEF(shopcount, "i"),
+       
    };
    int i, len = ARRAYLENGTH(BUILDIN);
    RECREATE(script->buildin, char *, script->buildin_count + len); // Pre-alloc to speed up
@@ -19840,6 +19856,8 @@
    script->config.loadmap_event_name = "OnPCLoadMapEvent";
    script->config.baselvup_event_name = "OnPCBaseLvUpEvent";
    script->config.joblvup_event_name = "OnPCJobLvUpEvent";
+   //mocha//
+   script->config.stat_calc_event_name = "OnPCStatCalcEvent"; //stat_calc_event_name
    script->config.ontouch_name = "OnTouch_";//ontouch_name (runs on first visible char to enter area, picks another char if the first char leaves)
    script->config.ontouch2_name = "OnTouch";//ontouch2_name (run whenever a char walks into the OnTouch area)
 
Index: map/script.h
===================================================================
--- map/script.h    (revision 14824)
+++ map/script.h    (working copy)
@@ -340,6 +340,9 @@
    const char *loadmap_event_name;
    const char *baselvup_event_name;
    const char *joblvup_event_name;
+   
+   //mocha//
+   const char *stat_calc_event_name;
 
    const char* ontouch_name;
    const char* ontouch2_name;
Index: map/status.c
===================================================================
--- map/status.c    (revision 14824)
+++ map/status.c    (working copy)
@@ -2536,6 +2536,9 @@
    pc->delautobonus(sd,sd->autobonus,ARRAYLENGTH(sd->autobonus),true);
    pc->delautobonus(sd,sd->autobonus2,ARRAYLENGTH(sd->autobonus2),true);
    pc->delautobonus(sd,sd->autobonus3,ARRAYLENGTH(sd->autobonus3),true);
+   
+   //mocha//
+   npc->script_event(sd, NPCE_STATCALC);
 
    // Parse equipment.
    for(i=0;i<EQI_MAX;i++) {
 
Viewed 1490 times, submitted by Emistry.