Skip to content
Permalink
Browse files
Added 'OnPCStatCalcEvent' trigger. (tid:77230, credits: @QQfoolsorell…
…ina, AnnieRuru)

This label triggers whenever a player's stats are recalculated.
http://rathena.org/board/topic/77230-onpcstatcalcevent/

Signed-off-by: Euphy <euphy.raliel@rathena.org>
  • Loading branch information
euphyy committed Feb 15, 2014
1 parent f3777cc commit 27a0f3f88ecdd655dadd891bd53c8829680739a0
Showing with 16 additions and 3 deletions.
  1. +10 −3 doc/script_commands.txt
  2. +1 −0 src/map/npc.c
  3. +1 −0 src/map/npc.h
  4. +1 −0 src/map/script.c
  5. +1 −0 src/map/script.h
  6. +2 −0 src/map/status.c
@@ -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.
@@ -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++)
@@ -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_);
@@ -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)
};
@@ -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;
@@ -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;i<EQI_MAX;i++) {
current_equip_item_index = index = sd->equip_index[i]; // We pass INDEX to current_equip_item_index - for EQUIP_SCRIPT (new cards solution) [Lupus]

0 comments on commit 27a0f3f

Please sign in to comment.