From 7c1d56ae8932e80e152389c9666bc0a1c0ab5ed8 Mon Sep 17 00:00:00 2001 From: gumi Date: Thu, 13 Dec 2018 17:10:17 -0500 Subject: add support for sending player HP for protocol >= 9 --- src/map/clif.cpp | 51 ++++++++++++++++++++++++++++++++++++++++++--------- src/mmo/version.hpp | 7 +++++-- 2 files changed, 47 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/map/clif.cpp b/src/map/clif.cpp index d287f4d..95e4ef2 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -670,9 +670,20 @@ void clif_set0078_main_1d8(dumb_ptr sd, Buffer& buf, bool old_ fixed_1d8.hair_color = sd->status.hair_color; fixed_1d8.clothes_color = sd->status.clothes_color; fixed_1d8.head_dir = sd->head_dir; - fixed_1d8.guild_id = 0; - fixed_1d8.guild_emblem_id = 0; - fixed_1d8.manner = sd->status.manner; + + if (sd->client_version >= wrap(9)) + { + fixed_1d8.hp = sd->status.hp; + fixed_1d8.part_of_max_hp = static_cast(sd->status.max_hp & 0xffff); + fixed_1d8.manner_or_part_of_max_hp = static_cast(sd->status.max_hp >> 16); + } + else + { + fixed_1d8.hp = 0; // guild id + fixed_1d8.part_of_max_hp = 0; // guild emblem id + fixed_1d8.manner_or_part_of_max_hp = sd->status.manner; + } + fixed_1d8.opt3 = sd->opt3; fixed_1d8.karma = sd->status.karma; fixed_1d8.sex = sd->status.sex; @@ -725,9 +736,20 @@ void clif_set0078_alt_1d9(dumb_ptr sd, Buffer& buf, bool old_c fixed_1d8.hair_color = sd->status.hair_color; fixed_1d8.clothes_color = sd->status.clothes_color; fixed_1d8.head_dir = sd->head_dir; - fixed_1d8.guild_id = 0; - fixed_1d8.guild_emblem_id = 0; - fixed_1d8.manner = sd->status.manner; + + if (sd->client_version >= wrap(9)) + { + fixed_1d8.hp = sd->status.hp; + fixed_1d8.part_of_max_hp = static_cast(sd->status.max_hp & 0xffff); + fixed_1d8.manner_or_part_of_max_hp = static_cast(sd->status.max_hp >> 16); + } + else + { + fixed_1d8.hp = 0; // guild id + fixed_1d8.part_of_max_hp = 0; // guild emblem id + fixed_1d8.manner_or_part_of_max_hp = sd->status.manner; + } + fixed_1d8.opt3 = sd->opt3; fixed_1d8.karma = sd->status.karma; fixed_1d8.sex = sd->status.sex; @@ -781,9 +803,20 @@ void clif_set007b(dumb_ptr sd, Buffer& buf, bool old_client) fixed_1da.hair_color = sd->status.hair_color; fixed_1da.clothes_color = sd->status.clothes_color; fixed_1da.head_dir = sd->head_dir; - fixed_1da.guild_id = 0; - fixed_1da.guild_emblem_id = 0; - fixed_1da.manner = sd->status.manner; + + if (sd->client_version >= wrap(9)) + { + fixed_1da.hp = sd->status.hp; + fixed_1da.part_of_max_hp = static_cast(sd->status.max_hp & 0xffff); + fixed_1da.manner_or_part_of_max_hp = static_cast(sd->status.max_hp >> 16); + } + else + { + fixed_1da.hp = 0; // guild id + fixed_1da.part_of_max_hp = 0; // guild emblem id + fixed_1da.manner_or_part_of_max_hp = sd->status.manner; + } + fixed_1da.opt3 = sd->opt3; fixed_1da.karma = sd->status.karma; fixed_1da.sex = sd->status.sex; diff --git a/src/mmo/version.hpp b/src/mmo/version.hpp index 79d67fe..598bfd9 100644 --- a/src/mmo/version.hpp +++ b/src/mmo/version.hpp @@ -41,8 +41,11 @@ namespace tmwa // 3 = manaplus 1.5.5.23 to manaplus 1.5.8.15 // 4 = manaplus 1.5.8.15 to manaplus 1.6.3.15 // 5 = manaplus 1.6.3.15 to 1.6.4.23 (adds SMSG_SCRIPT_MESSAGE) -// 6 = manaplus 1.6.4.23 and above -#define MIN_CLIENT_VERSION 1 +// 6 = manaplus 1.6.4.23 to 1.6.5.7 (adds a filter to block remote commands) +// 7 = manaplus 1.6.5.7 to 1.8.9.1 (adds SMSG_MAP_SET_TILES_TYPE) +// 8 = manaplus 1.8.9.1 to ... (adds support for GM groups) +// 9 = manaplus ... to (adds support for player HP) +#define MIN_CLIENT_VERSION 6 // TODO now that I generate the protocol, split 'flags' out of the struct struct Version -- cgit v1.2.3-60-g2f50