summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormekolat <mekolat@users.noreply.github.com>2015-05-19 18:27:46 -0400
committermekolat <mekolat@users.noreply.github.com>2015-05-19 18:52:48 -0400
commitc6c3671dbe28c596ef06b4670979c5923c8821b6 (patch)
tree7e1964f2afbe41e517d085c4a9cba1330e5a7858
parent3474fe93eef3cde085b6a9ee8c7efd4a5e2cddea (diff)
downloadtmwa-c6c3671dbe28c596ef06b4670979c5923c8821b6.tar.gz
tmwa-c6c3671dbe28c596ef06b4670979c5923c8821b6.tar.bz2
tmwa-c6c3671dbe28c596ef06b4670979c5923c8821b6.tar.xz
tmwa-c6c3671dbe28c596ef06b4670979c5923c8821b6.zip
fix mob hp, add mob range, unfuck packets
-rw-r--r--src/map/clif.cpp25
-rw-r--r--src/map/map.hpp1
-rwxr-xr-xtools/protocol.py80
3 files changed, 62 insertions, 44 deletions
diff --git a/src/map/clif.cpp b/src/map/clif.cpp
index 5297084..bae0bf1 100644
--- a/src/map/clif.cpp
+++ b/src/map/clif.cpp
@@ -772,6 +772,8 @@ static
void clif_mob0078(dumb_ptr<mob_data> md, Buffer& buf)
{
nullpo_retv(md);
+ int max_hp = md->stats[mob_stat::MAX_HP];
+ int hp = md->hp;
Packet_Fixed<0x0078> fixed_78;
fixed_78.block_id = md->bl_id;
@@ -785,6 +787,12 @@ void clif_mob0078(dumb_ptr<mob_data> md, Buffer& buf)
fixed_78.pos.y = md->bl_y;
fixed_78.pos.dir = md->dir;
+ fixed_78.gloves_or_part_of_hp = static_cast<short>(hp >> 16);
+ fixed_78.part_of_guild_id_or_part_of_hp = static_cast<short>(hp & 0xffff);
+ fixed_78.part_of_guild_id_or_part_of_max_hp = static_cast<short>(max_hp >> 16);
+ fixed_78.guild_emblem_or_part_of_max_hp = static_cast<short>(max_hp & 0xffff);
+ fixed_78.karma_or_attack_range = battle_get_range(md);
+
buf = create_fpacket<0x0078, 54>(fixed_78);
}
@@ -796,6 +804,8 @@ static
void clif_mob007b(dumb_ptr<mob_data> md, Buffer& buf)
{
nullpo_retv(md);
+ int max_hp = md->stats[mob_stat::MAX_HP];
+ int hp = md->hp;
Packet_Fixed<0x007b> fixed_7b;
fixed_7b.block_id = md->bl_id;
@@ -805,18 +815,18 @@ void clif_mob007b(dumb_ptr<mob_data> md, Buffer& buf)
fixed_7b.option = md->option;
fixed_7b.mob_class = md->mob_class;
// snip: stuff for monsters disguised as PCs
- fixed_7b.tick_and_maybe_part_of_guild_emblem = gettick();
- fixed_7b.max_hp = md->stats[mob_stat::MAX_HP];
- fixed_7b.hp = md->hp;
+ fixed_7b.tick = gettick();
fixed_7b.pos2.x0 = md->bl_x;
fixed_7b.pos2.y0 = md->bl_y;
fixed_7b.pos2.x1 = md->to_x;
fixed_7b.pos2.y1 = md->to_y;
- fixed_7b.five1 = 5;
- fixed_7b.five2 = 5;
- int level = battle_get_lv(md);
- fixed_7b.level = (level > battle_config.max_lv) ? battle_config.max_lv : level;
+
+ fixed_7b.gloves_or_part_of_hp = static_cast<short>(hp >> 16);
+ fixed_7b.part_of_guild_id_or_part_of_hp = static_cast<short>(hp & 0xffff);
+ fixed_7b.part_of_guild_id_or_part_of_max_hp = static_cast<short>(max_hp >> 16);
+ fixed_7b.guild_emblem_or_part_of_max_hp = static_cast<short>(max_hp & 0xffff);
+ fixed_7b.karma_or_attack_range = battle_get_range(md);
buf = create_fpacket<0x007b, 60>(fixed_7b);
}
@@ -883,6 +893,7 @@ void clif_npc0078(dumb_ptr<npc_data> nd, Buffer& buf)
fixed_78.pos.x = nd->bl_x;
fixed_78.pos.y = nd->bl_y;
fixed_78.pos.dir = nd->dir;
+ fixed_78.sex = nd->sex;
buf = create_fpacket<0x0078, 54>(fixed_78);
}
diff --git a/src/map/map.hpp b/src/map/map.hpp
index b5f8566..aac646b 100644
--- a/src/map/map.hpp
+++ b/src/map/map.hpp
@@ -324,6 +324,7 @@ struct npc_data : block_list
short n;
Species npc_class;
DIR dir;
+ SEX sex;
DamageType sit;
interval_t speed;
NpcName name;
diff --git a/tools/protocol.py b/tools/protocol.py
index e15d5f0..003f511 100755
--- a/tools/protocol.py
+++ b/tools/protocol.py
@@ -2249,29 +2249,30 @@ def build_context():
at(10, opt2, 'opt2'),
at(12, option, 'option'),
at(14, species, 'species'),
- at(16, u8, 'unused hair style'),
- at(17, u8, 'unused look'),
- at(18, u16, 'unused weapon'),
- at(20, u16, 'unused head bottom'),
- at(22, u16, 'unused shield'),
- at(24, u16, 'unused head top'),
- at(26, u16, 'unused head mid'),
- at(28, u8, 'unused hair color'),
- at(29, u8, 'unused'),
- at(30, u16, 'unused clothes color'),
- at(32, u16, 'unused gloves'),
- at(34, u32, 'unused guild id'),
- at(38, u16, 'unused guild emblem id'),
- at(40, u16, 'unused manner'),
- at(42, u16, 'unused opt3'),
- at(44, u8, 'unused karma or atk range'),
- at(45, u8, 'unused sex'),
+ at(16, u8, 'hair style'),
+ at(17, u8, 'look'),
+ at(18, u16, 'weapon'),
+ at(20, u16, 'head bottom'),
+ at(22, u16, 'shield'),
+ at(24, u16, 'head top'),
+ at(26, u16, 'head mid'),
+ at(28, u8, 'hair color'),
+ at(29, u8, 'unused 1'),
+ at(30, u16, 'shoes or clothes color'),
+ at(32, u16, 'gloves or part of hp'),
+ at(34, u16, 'part of guild id or part of hp'),
+ at(36, u16, 'part of guild id or part of max hp'),
+ at(38, u16, 'guild emblem or part of max hp'),
+ at(40, u16, 'manner'),
+ at(42, u16, 'opt3'),
+ at(44, u8, 'karma or attack range'),
+ at(45, sex, 'sex'),
at(46, pos1, 'pos'),
- at(49, u8, 'unused2'),
- at(50, u8, 'unused3'),
- at(51, u8, 'unused4'),
- at(52, u8, 'unused5'),
- at(53, u8, 'unused6'),
+ at(49, u8, 'unused 2'),
+ at(50, u8, 'unused 3'),
+ at(51, u8, 'unused 4'),
+ at(52, u8, 'unused 5'),
+ at(53, u8, 'unused 6'),
],
fixed_size=54,
pre=[BOOT, FINISH, GM, MAGIC, SCRIPT, TIMER, 0x007d, 0x0085, 0x0089, 0x008c, 0x009f, 0x00b8, 0x00b9, 0x00e6, 0x00f7, 0x0143, 0x0146, 0x01d5],
@@ -2290,26 +2291,31 @@ def build_context():
at(10, opt2, 'opt2'),
at(12, option, 'option'),
at(14, species, 'mob class'),
- at(16, u16, 'unused hair style'),
+ at(16, u8, 'hair style'),
+ at(17, u8, 'look'),
at(18, u16, 'unused weapon'),
at(20, u16, 'unused head bottom'),
- at(22, tick32, 'tick and maybe part of guild emblem'),
- at(26, u16, 'unused shield or maybe part of guild emblem'),
- at(28, u16, 'unused head top or maybe part of guild id'),
- at(30, u16, 'unused head mid or maybe part of guild id'),
- at(32, u16, 'unused hair color'),
+ at(22, tick32, 'tick'),
+ at(26, u16, 'unused shield'),
+ at(28, u16, 'unused head top'),
+ at(30, u16, 'unused head mid'),
+ at(32, u8, 'unused hair color'),
+ at(33, u8, 'unused 1'),
at(34, u16, 'unused clothes color'),
- at(36, i32, 'max_hp'),
- at(40, i32, 'hp'),
- at(44, u16, 'unused 5'),
- at(46, u16, 'unused zero 1'),
- at(48, u8, 'unused zero 2'),
+ at(36, u16, 'gloves or part of hp'),
+ at(38, u16, 'part of guild id or part of hp'),
+ at(40, u16, 'part of guild id or part of max hp'),
+ at(42, u16, 'guild emblem or part of max hp'),
+ at(44, u16, 'manner'),
+ at(46, u16, 'opt3'),
+ at(48, u8, 'karma or attack range'),
at(49, u8, 'unused sex'),
at(50, pos2, 'pos2'),
- at(55, u8, 'zero'),
- at(56, u8, 'five1'),
- at(57, u8, 'five2'),
- at(58, u16, 'level'),
+ at(55, u8, 'unused 2'),
+ at(56, u8, 'unused 3'),
+ at(57, u8, 'unused 4'),
+ at(58, u8, 'unused 5'),
+ at(59, u8, 'unused 6'),
],
fixed_size=60,
pre=[FINISH, GM, MAGIC, SCRIPT, TIMER, 0x007d, 0x0085, 0x0089, 0x008c, 0x009f],