viewing paste OnPCStatCalcEvent_20151030.c | 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
 src/map/npc.c    | 1 +
 src/map/npc.h    | 1 +
 src/map/script.c | 1 +
 src/map/script.h | 1 +
 src/map/status.c | 2 ++
 5 files changed, 6 insertions(+)
 
diff --git a/src/map/npc.c b/src/map/npc.c
index 7044fef..ea48bf3 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -4311,6 +4311,7 @@ void npc_read_event_script(void)
        {"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},
+       {"Stat Calc Event",script->config.stat_calc_event_name},
    };
 
    for (i = 0; i < NPCE_MAX; i++)
diff --git a/src/map/npc.h b/src/map/npc.h
index bf3d149..12cbdc0 100644
--- a/src/map/npc.h
+++ b/src/map/npc.h
@@ -132,6 +132,7 @@ enum npce_event {
    NPCE_DIE,
    NPCE_KILLPC,
    NPCE_KILLNPC,
+   NPCE_STATCALC,
    NPCE_MAX
 };
 
diff --git a/src/map/script.c b/src/map/script.c
index 54d8d33..b24814b 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -20788,6 +20788,7 @@ void script_defaults(void) {
    script->config.loadmap_event_name = "OnPCLoadMapEvent";
    script->config.baselvup_event_name = "OnPCBaseLvUpEvent";
    script->config.joblvup_event_name = "OnPCJobLvUpEvent";
+   script->config.stat_calc_event_name = "OnPCStatCalcEvent";
    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)
    script->config.onuntouch_name = "OnUnTouch";  //onuntouch_name (run whenever a char walks from the OnTouch area)
diff --git a/src/map/script.h b/src/map/script.h
index ff660de..d7f48b2 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -342,6 +342,7 @@ struct Script_Config {
    const char *loadmap_event_name;
    const char *baselvup_event_name;
    const char *joblvup_event_name;
+   const char *stat_calc_event_name;
 
    const char* ontouch_name;
    const char* ontouch2_name;
diff --git a/src/map/status.c b/src/map/status.c
index 1a07f74..c4703ba 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -2242,6 +2242,8 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) {
    pc->delautobonus(sd,sd->autobonus2,ARRAYLENGTH(sd->autobonus2),true);
    pc->delautobonus(sd,sd->autobonus3,ARRAYLENGTH(sd->autobonus3),true);
 
+   npc->script_event(sd, NPCE_STATCALC);
+
    // Parse equipment.
    for(i=0;i<EQI_MAX;i++) {
        status->current_equip_item_index = index = sd->equip_index[i]; //We pass INDEX to status->current_equip_item_index - for EQUIP_SCRIPT (new cards solution) [Lupus]
 
Viewed 1466 times, submitted by AnnieRuru.