summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-09-20 16:03:58 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-09-20 16:03:58 +0000
commit6e6ee08f7a162e128eae4e28ff983954990a2fdf (patch)
treec74931748ff989224ca109f056e9a31cf165f009 /src/map
parent95ca50c9d1ffce386c1e91de805c816e77c45c4c (diff)
downloadhercules-6e6ee08f7a162e128eae4e28ff983954990a2fdf.tar.gz
hercules-6e6ee08f7a162e128eae4e28ff983954990a2fdf.tar.bz2
hercules-6e6ee08f7a162e128eae4e28ff983954990a2fdf.tar.xz
hercules-6e6ee08f7a162e128eae4e28ff983954990a2fdf.zip
- A mob's HP is set temporarily to 0 before invoking it's on-death script, prevents said scripts being able to "rekill" the mob indefinitely (if stuff like killmonster is used within)
- Some small cleanups in chat.c git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8829 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/chat.c34
-rw-r--r--src/map/mob.c2
2 files changed, 22 insertions, 14 deletions
diff --git a/src/map/chat.c b/src/map/chat.c
index a1bb7a293..40050073d 100644
--- a/src/map/chat.c
+++ b/src/map/chat.c
@@ -120,8 +120,10 @@ int chat_leavechat(struct map_session_data *sd)
nullpo_retr(1, sd);
cd=(struct chat_data*)map_id2bl(sd->chatID);
- if(cd==NULL)
+ if(cd==NULL) {
+ sd->chatID = 0;
return 1;
+ }
for(i = 0,leavechar=-1;i < cd->users;i++){
if(cd->usersd[i] == sd){
@@ -129,8 +131,11 @@ int chat_leavechat(struct map_session_data *sd)
break;
}
}
- if(leavechar<0) // そのchatに所属していないらしい (バグ時のみ)
+ if(leavechar<0)
+ { //Not found in the chatroom?
+ sd->chatID = 0;
return -1;
+ }
if(leavechar==0 && cd->users>1 && (*cd->owner)->type==BL_PC){
// 所有者だった&他に人が居る&PCのチャット
@@ -148,18 +153,19 @@ int chat_leavechat(struct map_session_data *sd)
//Delete empty chatroom
clif_clearchat(cd,0);
map_delobject(cd->bl.id);
- } else {
- for(i=leavechar;i < cd->users;i++)
- cd->usersd[i] = cd->usersd[i+1];
- if(leavechar==0 && (*cd->owner)->type==BL_PC){
- //Adjust Chat location after owner has been changed.
- map_delblock( &cd->bl );
- cd->bl.x=cd->usersd[0]->bl.x;
- cd->bl.y=cd->usersd[0]->bl.y;
- map_addblock( &cd->bl );
- }
- clif_dispchat(cd,0);
+ return 1;
+ }
+ for(i=leavechar;i < cd->users;i++)
+ cd->usersd[i] = cd->usersd[i+1];
+
+ if(leavechar==0 && (*cd->owner)->type==BL_PC){
+ //Adjust Chat location after owner has been changed.
+ map_delblock( &cd->bl );
+ cd->bl.x=cd->usersd[0]->bl.x;
+ cd->bl.y=cd->usersd[0]->bl.y;
+ map_addblock( &cd->bl );
}
+ clif_dispchat(cd,0);
return 0;
}
@@ -194,7 +200,7 @@ int chat_changechatowner(struct map_session_data *sd,char *nextownername)
clif_clearchat(cd,0);
// userlistの順番変更 (0が所有者なので)
- if( (tmp_sd = cd->usersd[0]) == NULL )
+ if( (tmp_sd = cd->usersd[0]) == NULL ) //FIXME: How is this even possible!? Invoking character should be owner, hence, it SHOULD be on sc->usersd[0]!
return 1; //ありえるのかな?
cd->usersd[0] = cd->usersd[nextowner];
cd->usersd[nextowner] = tmp_sd;
diff --git a/src/map/mob.c b/src/map/mob.c
index 73446d349..1a0d5c38b 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -2134,12 +2134,14 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
if(md->nd)
mob_script_callback(md, src, CALLBACK_DEAD);
else if(md->npc_event[0]){
+ md->status.hp = 0; //So that npc_event invoked functions KNOW that I am dead.
if(src && src->type == BL_PET)
sd = ((struct pet_data *)src)->msd;
if(sd && battle_config.mob_npc_event_type)
npc_event(sd,md->npc_event,0);
else if(mvp_sd)
npc_event(mvp_sd,md->npc_event,0);
+ md->status.hp = 1;
} else if (mvp_sd) { //lordalfa
pc_setglobalreg(mvp_sd,"killedrid",md->class_);
if(mvp_sd->state.event_kill_mob)