diff options
author | gumi <git@gumi.ca> | 2018-12-18 13:57:40 -0500 |
---|---|---|
committer | gumi <git@gumi.ca> | 2018-12-18 13:58:40 -0500 |
commit | abf1b2697df06e95291014f7637cc0df6f5a10b1 (patch) | |
tree | 20fc26f51d491766691c27f6f22669f3c89166ef /src | |
parent | 07ae3cf97e9f1e86ac792cc1140e0cae051625fc (diff) | |
download | tmwa-abf1b2697df06e95291014f7637cc0df6f5a10b1.tar.gz tmwa-abf1b2697df06e95291014f7637cc0df6f5a10b1.tar.bz2 tmwa-abf1b2697df06e95291014f7637cc0df6f5a10b1.tar.xz tmwa-abf1b2697df06e95291014f7637cc0df6f5a10b1.zip |
add player heal packetsv18.12.18
Diffstat (limited to 'src')
-rw-r--r-- | src/map/clif.cpp | 25 | ||||
-rw-r--r-- | src/map/clif.hpp | 2 | ||||
-rw-r--r-- | src/map/pc.cpp | 29 | ||||
-rw-r--r-- | src/map/pc.hpp | 1 |
4 files changed, 54 insertions, 3 deletions
diff --git a/src/map/clif.cpp b/src/map/clif.cpp index 95e4ef2..f2667ac 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -4121,6 +4121,31 @@ void clif_send_mask(dumb_ptr<map_session_data> sd, int map_mask) clif_send(buf, sd, SendWho::SELF, wrap<ClientVersion>(2)); } +void clif_send_hp_partial(dumb_ptr<map_session_data> sd) +{ + nullpo_retv(sd); + + Packet_Fixed<0x0232> fixed_232; + fixed_232.account_id = sd->status_key.account_id; + fixed_232.hp = sd->status.hp; + + Buffer buf = create_fpacket<0x0232, 10>(fixed_232); + clif_send(buf, sd, SendWho::AREA_WOS, wrap<ClientVersion>(9)); +} + +void clif_send_hp_full(dumb_ptr<map_session_data> sd) +{ + nullpo_retv(sd); + + Packet_Fixed<0x0233> fixed_233; + fixed_233.account_id = sd->status_key.account_id; + fixed_233.hp = sd->status.hp; + fixed_233.max_hp = sd->status.max_hp; + + Buffer buf = create_fpacket<0x0233, 14>(fixed_233); + clif_send(buf, sd, SendWho::AREA_WOS, wrap<ClientVersion>(9)); +} + /*========================================== * *------------------------------------------ diff --git a/src/map/clif.hpp b/src/map/clif.hpp index 1d6365d..1abcfe3 100644 --- a/src/map/clif.hpp +++ b/src/map/clif.hpp @@ -111,6 +111,8 @@ void clif_update_collision(dumb_ptr<map_session_data>, short, short, short, shor void clif_change_music(dumb_ptr<map_session_data> sd, XString music); void clif_npc_action(dumb_ptr<map_session_data>, BlockId, short, int, short, short); void clif_send_mask(dumb_ptr<map_session_data>, int); +void clif_send_hp_partial(dumb_ptr<map_session_data>); +void clif_send_hp_full(dumb_ptr<map_session_data>); // trade void clif_traderequest(dumb_ptr<map_session_data> sd, CharName name); diff --git a/src/map/pc.cpp b/src/map/pc.cpp index e4c3907..3986113 100644 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -2802,7 +2802,7 @@ int pc_checkbaselevelup(dumb_ptr<map_session_data> sd) clif_updatestatus(sd, SP::BASELEVEL); clif_updatestatus(sd, SP::NEXTBASEEXP); pc_calcstatus(sd, 0); - pc_heal(sd, sd->status.max_hp, sd->status.max_sp); + pc_heal(sd, sd->status.max_hp, sd->status.max_sp, true); clif_misceffect(sd, 0); //レベルアップしたのでパーティー情報を更新する @@ -3618,7 +3618,7 @@ int pc_setparam(dumb_ptr<block_list> bl, SP type, int val) clif_updatestatus(sd, SP::STATUSPOINT); clif_updatestatus(sd, SP::BASEEXP); pc_calcstatus(sd, 0); - pc_heal(sd, sd->status.max_hp, sd->status.max_sp); + pc_heal(sd, sd->status.max_hp, sd->status.max_sp, true); break; case SP::JOBLEVEL: nullpo_retz(sd); @@ -3825,7 +3825,7 @@ int pc_setparam(dumb_ptr<block_list> bl, SP type, int val) * HP/SP回復 *------------------------------------------ */ -int pc_heal(dumb_ptr<map_session_data> sd, int hp, int sp) +int pc_heal(dumb_ptr<map_session_data> sd, int hp, int sp, bool levelup) { nullpo_retz(sd); @@ -3855,7 +3855,16 @@ int pc_heal(dumb_ptr<map_session_data> sd, int hp, int sp) if (sd->status.sp <= 0) sd->status.sp = 0; if (hp) + { clif_updatestatus(sd, SP::HP); + + if (hp > 0 && levelup) { + clif_send_hp_full(sd); + } else if (hp > 0) { + clif_send_hp_partial(sd); + } + } + if (sp) clif_updatestatus(sd, SP::SP); @@ -3871,6 +3880,10 @@ int pc_heal(dumb_ptr<map_session_data> sd, int hp, int sp) return hp + sp; } +int pc_heal(dumb_ptr<map_session_data> sd, int hp, int sp) +{ + return pc_heal(sd, hp, sp, false); +} /*========================================== * HP/SP回復 @@ -3986,7 +3999,14 @@ int pc_itemheal_effect(dumb_ptr<map_session_data> sd, int hp, int sp) if (sd->status.sp <= 0) sd->status.sp = 0; if (hp) + { clif_updatestatus(sd, SP::HP); + + if (hp > 0) { + clif_send_hp_partial(sd); + } + } + if (sp) clif_updatestatus(sd, SP::SP); @@ -4959,7 +4979,10 @@ int pc_natural_heal_hp(dumb_ptr<map_session_data> sd) } } if (bhp != sd->status.hp) + { clif_updatestatus(sd, SP::HP); + clif_send_hp_partial(sd); + } sd->inchealhptick = interval_t::zero(); diff --git a/src/map/pc.hpp b/src/map/pc.hpp index 2e63c26..4019617 100644 --- a/src/map/pc.hpp +++ b/src/map/pc.hpp @@ -139,6 +139,7 @@ int pc_useitem(dumb_ptr<map_session_data>, IOff0); int pc_damage(dumb_ptr<block_list>, dumb_ptr<map_session_data>, int); int pc_heal(dumb_ptr<map_session_data>, int, int); +int pc_heal(dumb_ptr<map_session_data>, int, int, bool); int pc_itemheal(dumb_ptr<map_session_data> sd, int hp, int sp); int pc_changelook(dumb_ptr<map_session_data>, LOOK, int); |