summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgumi <git@gumi.ca>2018-12-13 17:10:17 -0500
committergumi <git@gumi.ca>2018-12-13 17:10:17 -0500
commit7c1d56ae8932e80e152389c9666bc0a1c0ab5ed8 (patch)
treeea1c4f7413f6797730ec2604dd49ba803a9c5a19
parentc1dd287b999c9cfcdc02ee01cede7619c173d656 (diff)
downloadtmwa-7c1d56ae8932e80e152389c9666bc0a1c0ab5ed8.tar.gz
tmwa-7c1d56ae8932e80e152389c9666bc0a1c0ab5ed8.tar.bz2
tmwa-7c1d56ae8932e80e152389c9666bc0a1c0ab5ed8.tar.xz
tmwa-7c1d56ae8932e80e152389c9666bc0a1c0ab5ed8.zip
add support for sending player HP for protocol >= 9
-rw-r--r--src/map/clif.cpp51
-rw-r--r--src/mmo/version.hpp7
-rwxr-xr-xtools/protocol.py18
3 files changed, 56 insertions, 20 deletions
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<map_session_data> 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<ClientVersion>(9))
+ {
+ fixed_1d8.hp = sd->status.hp;
+ fixed_1d8.part_of_max_hp = static_cast<short>(sd->status.max_hp & 0xffff);
+ fixed_1d8.manner_or_part_of_max_hp = static_cast<short>(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<map_session_data> 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<ClientVersion>(9))
+ {
+ fixed_1d8.hp = sd->status.hp;
+ fixed_1d8.part_of_max_hp = static_cast<short>(sd->status.max_hp & 0xffff);
+ fixed_1d8.manner_or_part_of_max_hp = static_cast<short>(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<map_session_data> 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<ClientVersion>(9))
+ {
+ fixed_1da.hp = sd->status.hp;
+ fixed_1da.part_of_max_hp = static_cast<short>(sd->status.max_hp & 0xffff);
+ fixed_1da.manner_or_part_of_max_hp = static_cast<short>(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
diff --git a/tools/protocol.py b/tools/protocol.py
index 9820056..3a0e25e 100755
--- a/tools/protocol.py
+++ b/tools/protocol.py
@@ -4438,9 +4438,9 @@ def build_context():
at(30, u16, 'clothes color'),
at(32, dir, 'head dir'),
at(33, u8, 'unused2'),
- at(34, u32, 'guild id'),
- at(38, u16, 'guild emblem id'),
- at(40, u16, 'manner'),
+ at(34, u32, 'hp'),
+ at(38, u16, 'part of max hp'),
+ at(40, u16, 'manner or part of max hp'),
at(42, opt3, 'opt3'),
at(44, u8, 'karma'),
at(45, sex, 'sex'),
@@ -4480,9 +4480,9 @@ def build_context():
at(30, u16, 'clothes color'),
at(32, dir, 'head dir'),
at(33, u8, 'unused2'),
- at(34, u32, 'guild id'),
- at(38, u16, 'guild emblem id'),
- at(40, u16, 'manner'),
+ at(34, u32, 'hp'),
+ at(38, u16, 'part of max hp'),
+ at(40, u16, 'manner or part of max hp'),
at(42, opt3, 'opt3'),
at(44, u8, 'karma'),
at(45, sex, 'sex'),
@@ -4522,9 +4522,9 @@ def build_context():
at(34, u16, 'clothes color'),
at(36, dir, 'head dir'),
at(37, u8, 'unused2'),
- at(38, u32, 'guild id'),
- at(42, u16, 'guild emblem id'),
- at(44, u16, 'manner'),
+ at(38, u32, 'hp'),
+ at(42, u16, 'part of max hp'),
+ at(44, u16, 'manner or part of max hp'),
at(46, opt3, 'opt3'),
at(48, u8, 'karma'),
at(49, sex, 'sex'),