summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-05 23:22:16 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-05 23:22:16 +0000
commit3fefab81425004d67c61fb911a417ddfdd089693 (patch)
treec7e4062a46ca24a5681950abb9a16bb5e2c56f29 /src/map/mob.c
parent1db41fdf364af26b0600a43a167d15f2d2ef8244 (diff)
downloadhercules-3fefab81425004d67c61fb911a417ddfdd089693.tar.gz
hercules-3fefab81425004d67c61fb911a417ddfdd089693.tar.bz2
hercules-3fefab81425004d67c61fb911a417ddfdd089693.tar.xz
hercules-3fefab81425004d67c61fb911a417ddfdd089693.zip
- Added a npc-script-event cache to avoid looking up event-scripts every time they need to be executed. Events cached are all those defined in script_config.
- Since the cache holds direct pointers to the npcs/events, do NOT unload the related NPCs or you'll get dangling pointers. However, @reloadscript will work fine. - Set the etc_log to on to see a summary of npcs/events loaded for script execution on startup. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6494 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index 5e6c5765a..cc9b95083 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -2119,21 +2119,10 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
else if(mvp_sd)
npc_event(mvp_sd,md->npc_event,0);
- } else if (mvp_sd) {
- //lordalfa
+ } else if (mvp_sd) { //lordalfa
pc_setglobalreg(mvp_sd,"killedrid",(md->class_));
- if(mvp_sd->state.event_kill_mob){
- if (script_config.event_script_type == 0) {
- struct npc_data *npc;
- if ((npc = npc_name2id(script_config.kill_mob_event_name))) {
- run_script(npc->u.scr.script,0,mvp_sd->bl.id,npc->bl.id); // PCKillNPC [Lance]
- ShowStatus("Event '"CL_WHITE"%s"CL_RESET"' executed.\n",script_config.kill_mob_event_name);
- }
- } else {
- ShowStatus("%d '"CL_WHITE"%s"CL_RESET"' events executed.\n",
- npc_event_doall_id(script_config.kill_mob_event_name, mvp_sd->bl.id), script_config.kill_mob_event_name);
- }
- }
+ if(mvp_sd->state.event_kill_mob)
+ npc_script_event(mvp_sd, NPCE_KILLNPC); // PCKillNPC [Lance]
}
if(md->level) md->level=0;
map_freeblock_unlock();