diff --git a/doc/script_commands.txt b/doc/script_commands.txt index b0bf8e30320..3e7e5b0e028 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -3,7 +3,7 @@ //===== By: ================================================== //= rAthena Dev Team //===== Last Updated: ======================================== -//= 20140211 +//= 20140215 //===== Description: ========================================= //= A reference manual for the rAthena scripting language. //= Commands are sorted depending on their functionality. @@ -945,12 +945,19 @@ This special label triggers when a player kills a monster. The variable OnPCLoadMapEvent: -This special label will trigger once a player steps in a map marked with the -'loadevent' mapflag and attach its RID. The fact that this label requires a +This special label triggers when a player steps in a map marked with the +'loadevent' mapflag and attaches its RID. The fact that this label requires a mapflag for it to work is because, otherwise, it'd be server-wide and trigger every time a player would change maps. Imagine the server load with 1,000 players (oh the pain...) +OnPCStatCalcEvent: + +This special label triggers when a player's stats are recalculated, such as when +changing stats, equipment, or maps, as well as when logging in, leveling up, and +mounting a job mount. This can be used to grant additional item bonuses to certain +player groups, for instance. + Only the special labels which are not associated with any script command are listed here. There are other kinds of labels which may be triggered in a similar manner, but they are described with their associated commands. diff --git a/src/map/npc.c b/src/map/npc.c index 66a36da7ee4..34edf9849af 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -3946,6 +3946,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 1b9335a99d8..82245dac740 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -112,6 +112,7 @@ enum npce_event { NPCE_DIE, NPCE_KILLPC, NPCE_KILLNPC, + NPCE_STATCALC, NPCE_MAX }; struct view_data* npc_get_viewdata(int class_); diff --git a/src/map/script.c b/src/map/script.c index 44c9cccadad..18940e8cc4e 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -256,6 +256,7 @@ struct Script_Config script_config = { "OnPCLoadMapEvent", //loadmap_event_name "OnPCBaseLvUpEvent", //baselvup_event_name "OnPCJobLvUpEvent", //joblvup_event_name + "OnPCStatCalcEvent", //stat_calc_event_name "OnTouch_", //ontouch_name (runs on first visible char to enter area, picks another char if the first char leaves) "OnTouch", //ontouch2_name (run whenever a char walks into the OnTouch area) }; diff --git a/src/map/script.h b/src/map/script.h index 1547a663626..2f9235dfd34 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -28,6 +28,7 @@ extern 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 4b2988aaacb..5933167687e 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -2852,6 +2852,8 @@ int status_calc_pc_(struct map_session_data* sd, bool first) 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;iequip_index[i]; // We pass INDEX to current_equip_item_index - for EQUIP_SCRIPT (new cards solution) [Lupus]