summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-03-17 16:47:21 +0000
committerLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-03-17 16:47:21 +0000
commitec70ae22a2125ec3b71c2318a92746c0214efeb4 (patch)
tree95da958eff529b00b9972e693872cd6010c31f18 /src/map
parent0985a47e31a4979020a87e8cb1768f6b99cf6cbf (diff)
downloadhercules-ec70ae22a2125ec3b71c2318a92746c0214efeb4.tar.gz
hercules-ec70ae22a2125ec3b71c2318a92746c0214efeb4.tar.bz2
hercules-ec70ae22a2125ec3b71c2318a92746c0214efeb4.tar.xz
hercules-ec70ae22a2125ec3b71c2318a92746c0214efeb4.zip
* Fixed misleading and inaccurately documented events and added a missing flag.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5649 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/map.h3
-rw-r--r--src/map/mob.c20
-rw-r--r--src/map/pc.c25
-rw-r--r--src/map/script.c13
-rw-r--r--src/map/script.h3
5 files changed, 39 insertions, 25 deletions
diff --git a/src/map/map.h b/src/map/map.h
index cfedf527b..77044ee8c 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -431,8 +431,9 @@ struct map_session_data {
unsigned snovice_flag : 4;
// originally by Qamera, adapted by celest
unsigned event_death : 1;
- unsigned event_kill : 1;
+ unsigned event_kill_pc : 1;
unsigned event_disconnect : 1;
+ unsigned event_kill_mob : 1;
// Abracadabra bugfix by Aru
unsigned abra_flag : 1;
unsigned autotrade : 1; //By Fantik
diff --git a/src/map/mob.c b/src/map/mob.c
index b54edaab7..24806b374 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -2848,16 +2848,18 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
} else if (mvp_sd) {
//lordalfa
- pc_setglobalreg(mvp_sd,"killedrid",(md->class_));
- if (script_config.event_script_type == 0) {
- struct npc_data *npc;
- if ((npc = npc_name2id("NPCKillEvent"))) {
- run_script(npc->u.scr.script,0,mvp_sd->bl.id,npc->bl.id); // NPCKillNPC
- ShowStatus("Event '"CL_WHITE"NPCKillEvent"CL_RESET"' executed.\n");
- }
+ pc_setglobalreg(mvp_sd,"killedrid",(md->class_));
+ if(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("NPCKillEvent", mvp_sd->bl.id), "NPCKillEvent");
+ 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);
+ }
}
}
//[lordalfa]
diff --git a/src/map/pc.c b/src/map/pc.c
index 5673e91dc..2a47ab2ae 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -803,8 +803,9 @@ int pc_authok(struct map_session_data *sd, int login_id2, time_t connect_until_t
sd->die_counter=-1;
//Until the reg values arrive, set them to not require trigger...
sd->state.event_death = 1;
- sd->state.event_kill = 1;
+ sd->state.event_kill_pc = 1;
sd->state.event_disconnect = 1;
+ sd->state.event_kill_mob = 1;
if (night_flag) {
char tmpstr[1024];
@@ -927,13 +928,15 @@ int pc_reg_received(struct map_session_data *sd)
// Automated script events
if (script_config.event_requires_trigger) {
sd->state.event_death = pc_readglobalreg(sd, script_config.die_event_name);
- sd->state.event_kill = pc_readglobalreg(sd, script_config.kill_event_name);
+ sd->state.event_kill_pc = pc_readglobalreg(sd, script_config.kill_pc_event_name);
+ sd->state.event_kill_mob = pc_readglobalreg(sd, script_config.kill_mob_event_name);
sd->state.event_disconnect = pc_readglobalreg(sd, script_config.logout_event_name);
// if script triggers are not required
} else {
sd->state.event_death = 1;
- sd->state.event_kill = 1;
+ sd->state.event_kill_pc = 1;
sd->state.event_disconnect = 1;
+ sd->state.event_kill_mob = 1;
}
if (script_config.event_script_type == 0) {
@@ -5328,16 +5331,16 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage)
if (ssd) {
if (sd->state.event_death)
pc_setglobalreg(sd,"killerrid",(ssd->status.account_id));
- if (ssd->state.event_kill) {
+ if (ssd->state.event_kill_pc) {
if (script_config.event_script_type == 0) {
struct npc_data *npc;
- if ((npc = npc_name2id(script_config.kill_event_name))) {
- run_script(npc->u.scr.script,0,sd->bl.id,npc->bl.id); // PCKillNPC
- ShowStatus("Event '"CL_WHITE"%s"CL_RESET"' executed.\n", script_config.kill_event_name);
+ if ((npc = npc_name2id(script_config.kill_pc_event_name))) {
+ run_script(npc->u.scr.script,0,sd->bl.id,npc->bl.id); // PCKillPC [Lance]
+ ShowStatus("Event '"CL_WHITE"%s"CL_RESET"' executed.\n", script_config.kill_pc_event_name);
}
} else {
ShowStatus("%d '"CL_WHITE"%s"CL_RESET"' events executed.\n",
- npc_event_doall_id(script_config.kill_event_name, sd->bl.id), script_config.kill_event_name);
+ npc_event_doall_id(script_config.kill_pc_event_name, sd->bl.id), script_config.kill_pc_event_name);
}
}
if (battle_config.pk_mode && ssd->status.manner >= 0 && battle_config.manner_system) {
@@ -6541,8 +6544,10 @@ int pc_setregistry(struct map_session_data *sd,char *reg,int val,int type) {
// status_calc_pc(sd,0); //I doubt this is needed....
} else if(strcmp(reg,script_config.die_event_name) == 0){
sd->state.event_death = val;
- } else if(strcmp(reg,script_config.kill_event_name) == 0){
- sd->state.event_kill = val;
+ } else if(strcmp(reg,script_config.kill_pc_event_name) == 0){
+ sd->state.event_kill_pc = val;
+ } else if(strcmp(reg,script_config.kill_mob_event_name) == 0){
+ sd->state.event_kill_mob = val;
} else if(strcmp(reg,script_config.logout_event_name) == 0){
sd->state.event_disconnect = val;
}
diff --git a/src/map/script.c b/src/map/script.c
index e38e55c85..b39eba0fa 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -11140,10 +11140,15 @@ int script_config_read_sub(char *cfgName)
if (strlen(script_config.die_event_name) != strlen(w2))
ShowWarning("script_config_read: Event label truncated (max length is 23 chars): %d\n", script_config.die_event_name);
}
- else if(strcmpi(w1,"kill_event_name")==0) {
- strncpy(script_config.kill_event_name, w2, NAME_LENGTH-1);
- if (strlen(script_config.kill_event_name) != strlen(w2))
- ShowWarning("script_config_read: Event label truncated (max length is 23 chars): %d\n", script_config.kill_event_name);
+ else if(strcmpi(w1,"kill_pc_event_name")==0) {
+ strncpy(script_config.kill_pc_event_name, w2, NAME_LENGTH-1);
+ if (strlen(script_config.kill_pc_event_name) != strlen(w2))
+ ShowWarning("script_config_read: Event label truncated (max length is 23 chars): %d\n", script_config.kill_pc_event_name);
+ }
+ else if(strcmpi(w1,"kill_mob_event_name")==0) {
+ strncpy(script_config.kill_mob_event_name, w2, NAME_LENGTH-1);
+ if (strlen(script_config.kill_mob_event_name) != strlen(w2))
+ ShowWarning("script_config_read: Event label truncated (max length is 23 chars): %d\n", script_config.kill_mob_event_name);
}
else if(strcmpi(w1,"login_event_name")==0) {
strncpy(script_config.login_event_name, w2, NAME_LENGTH-1);
diff --git a/src/map/script.h b/src/map/script.h
index ecd326de9..9baff784e 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -20,7 +20,8 @@ extern struct Script_Config {
unsigned event_script_type : 1;
unsigned event_requires_trigger : 1;
char die_event_name[NAME_LENGTH];
- char kill_event_name[NAME_LENGTH];
+ char kill_pc_event_name[NAME_LENGTH];
+ char kill_mob_event_name[NAME_LENGTH];
char login_event_name[NAME_LENGTH];
char logout_event_name[NAME_LENGTH];
char loadmap_event_name[NAME_LENGTH];