From c8c6e7b34cb983054ddc5ed73f5239d6b728af11 Mon Sep 17 00:00:00 2001 From: Fate Date: Tue, 16 Jun 2009 15:46:00 +0000 Subject: Removed unnecessary am-healing flag, incorporated healing packets with regular opt status flags. This, together with the clientdata update, should fix the stuck healing state. --- src/map/clif.c | 10 ---------- src/map/map.h | 1 - src/map/pc.c | 17 +++-------------- src/map/skill.c | 25 +++++++++++++++++++++++++ src/map/skill.h | 2 ++ 5 files changed, 30 insertions(+), 25 deletions(-) diff --git a/src/map/clif.c b/src/map/clif.c index 8461139..ec7e586 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -6413,16 +6413,6 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) { } } WFIFOSET(fd,packet_len_table[0x95]); - if (ssd->special_state.heal_effect) - { - nullpo_retv(bl); - - WFIFOW(fd,0)=0x0196; - WFIFOW(fd,2)=SC_HEALING; - WFIFOL(fd,4)=account_id; - WFIFOB(fd,8)=1; - WFIFOSET(fd,packet_len_table[0x196]); - } } break; case BL_NPC: diff --git a/src/map/map.h b/src/map/map.h index 94155d2..c678501 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -182,7 +182,6 @@ struct map_session_data { unsigned unbreakable_weapon : 1; unsigned unbreakable_armor : 1; unsigned infinite_autospell : 1; - unsigned heal_effect : 1; } special_state; int char_id, login_id1, login_id2, sex; unsigned char tmw_version; // tmw client version diff --git a/src/map/pc.c b/src/map/pc.c index d7f469d..d03b247 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -5000,16 +5000,11 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage) // Character is dead! - // [Kage] Make sure the healing effect doesn't play - if (sd->special_state.heal_effect) { - sd->special_state.heal_effect = 0; - clif_status_change(&sd->bl, SC_HEALING, 0); - } - sd->status.hp = 0; // [Fate] Stop quickregen sd->quick_regeneration_hp.amount = 0; sd->quick_regeneration_sp.amount = 0; + skill_update_heal_animation(sd); pc_setdead(sd); @@ -5480,10 +5475,6 @@ int pc_itemheal(struct map_session_data *sd,int hp,int sp) pc_heal_quick_accumulate(hp, &sd->quick_regeneration_hp, sd->status.max_hp - sd->status.hp); - if (!sd->special_state.heal_effect) { - sd->special_state.heal_effect = 1; - clif_status_change(&sd->bl, SC_HEALING, 1); - } hp = 0; } if (sp > 0) { @@ -7110,10 +7101,8 @@ static int pc_natural_heal_sub(struct map_session_data *sd,va_list ap) { int sp_bonus = pc_quickregenerate_effect(&sd->quick_regeneration_sp, sd->nhealsp); pc_itemheal_effect(sd, hp_bonus, sp_bonus); - } else if (!sd->quick_regeneration_hp.amount && sd->special_state.heal_effect) { - sd->special_state.heal_effect = 0; - clif_status_change(&sd->bl, SC_HEALING, 0); - } + } + skill_update_heal_animation(sd); // if needed. // -- moonsoul (if conditions below altered to disallow natural healing if under berserk status) if ((sd->sc_data[SC_FLYING_BACKPACK].timer != -1 diff --git a/src/map/skill.c b/src/map/skill.c index ea7beb3..3a1dbf6 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -7790,6 +7790,31 @@ int skill_status_change_end(struct block_list* bl, int type, int tid) return 0; } + + +int +skill_update_heal_animation(struct map_session_data *sd) +{ + const int mask = 0x100; + int was_active; + int is_active; + + nullpo_retr (0, sd); + was_active = sd->opt2 & mask; + is_active = sd->quick_regeneration_hp.amount > 0; + + if ((was_active && is_active) + || (!was_active && !is_active)) + return 0; // no update + + if (is_active) + sd->opt2 |= mask; + else + sd->opt2 &= ~mask; + + return clif_changeoption(&sd->bl); +} + /*========================================== * ステータス異常終了タイマー *------------------------------------------ diff --git a/src/map/skill.h b/src/map/skill.h index ea204e0..fdbe799 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -143,6 +143,8 @@ int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skil int skill_attack( int attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl,int skillid,int skilllv,unsigned int tick,int flag ); +int skill_update_heal_animation(struct map_session_data *sd); // [Fate] Check whether the healing flag must be updated, do so if needed + void skill_reload(void); enum { -- cgit v1.2.3-60-g2f50