From 144a9d0843dfe47e0b58c8857762f58ae70543c8 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Fri, 5 Jul 2013 23:06:28 -0300 Subject: Fixed Bug #7307 http://hercules.ws/board/tracker/issue-7307-status-weapon-switch/ Special Thanks to kyeme, Beret. Signed-off-by: shennetsind --- src/map/battle.c | 8 +++++++- src/map/clif.c | 2 +- src/map/pc.c | 3 ++- src/map/pc.h | 2 ++ 4 files changed, 12 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/map/battle.c b/src/map/battle.c index 3268128ac..cf952a3b9 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -226,7 +226,7 @@ int battle_delay_damage_sub(int tid, unsigned int tick, int id, intptr_t data) { } src = iMap->id2bl(dat->src_id); - + if( src && target->m == src->m && (target->type != BL_PC || ((TBL_PC*)target)->invincible_timer == INVALID_TIMER) && check_distance_bl(src, target, dat->distance) ) //Check to see if you haven't teleported. [Skotlex] @@ -246,6 +246,9 @@ int battle_delay_damage_sub(int tid, unsigned int tick, int id, intptr_t data) { status_fix_damage(target, target, dat->damage, dat->delay); iMap->freeblock_unlock(); } + + if( src && src->type == BL_PC ) + ((TBL_PC*)src)->delayed_damage--; } ers_free(delay_damage_ers, dat); return 0; @@ -287,6 +290,9 @@ int battle_delay_damage (unsigned int tick, int amotion, struct block_list *src, if (src->type != BL_PC && amotion > 1000) amotion = 1000; //Aegis places a damage-delay cap of 1 sec to non player attacks. [Skotlex] + if( src->type == BL_PC ) + ((TBL_PC*)src)->delayed_damage++; + iTimer->add_timer(tick+amotion, battle->delay_damage_sub, 0, (intptr_t)dat); return 0; diff --git a/src/map/clif.c b/src/map/clif.c index c802929b4..b2461d8d5 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -10664,7 +10664,7 @@ void clif_parse_EquipItem(int fd,struct map_session_data *sd) else if ( pc_cant_act2(sd) || sd->state.prerefining ) return; - if(!sd->status.inventory[index].identify) { + if(!sd->status.inventory[index].identify || sd->delayed_damage != 0) { clif->equipitemack(sd,index,0,0); // fail return; } diff --git a/src/map/pc.c b/src/map/pc.c index e5a224e48..b14a02ed4 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -1048,6 +1048,8 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim sd->state.dialog = 0; + sd->delayed_damage = 0; + // Event Timers for( i = 0; i < MAX_EVENTTIMER; i++ ) sd->eventtimer[i] = INVALID_TIMER; @@ -4839,7 +4841,6 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y if( hChSys.local && map[sd->bl.m].channel && idb_exists(map[sd->bl.m].channel->users, sd->status.char_id) ) { clif->chsys_left(map[sd->bl.m].channel,sd); } - } if( m < 0 ) { diff --git a/src/map/pc.h b/src/map/pc.h index 7eedf813c..9f96486c9 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -502,6 +502,8 @@ struct map_session_data { /* Made Possible Thanks to Yommy~! */ unsigned int cryptKey; + unsigned char delayed_damage;//ref. counter bugreport:7307 [Ind/Hercules] + // temporary debugging of bug #3504 const char* delunit_prevfile; int delunit_prevline; -- cgit v1.2.3-70-g09d2