From 26261ab2b18b8c2046bade9b153f132bad1a1adc Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 26 Dec 2019 19:00:51 -0400 Subject: [PATCH 1/4] chat packet struct for issue_038 in elseware. --- src/packet/ship.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/packet/ship.rs b/src/packet/ship.rs index f89bc66..885d007 100644 --- a/src/packet/ship.rs +++ b/src/packet/ship.rs @@ -248,3 +248,20 @@ pub struct AddToRoom { pub padding: u32, pub playerinfo: PlayerInfo, } + +#[pso_packet(0x06)] +pub struct PlayerChat { + pub padding: u32, + pub guildcard: u32, + pub message: String, +} + +impl PlayerChat { + pub fn new(padding: u32, guildcard: u32, message: String) -> PlayerChat { + PlayerChat { + padding: padding, + guildcard: guildcard, + message: message, + } + } +} \ No newline at end of file From afe1de0536f9b4fcf83e73c38c477fe111923ca2 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 31 Dec 2019 00:01:49 -0400 Subject: [PATCH 2/4] move padding logic from elseware into here --- src/packet/ship.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/packet/ship.rs b/src/packet/ship.rs index 885d007..c1f6a31 100644 --- a/src/packet/ship.rs +++ b/src/packet/ship.rs @@ -257,7 +257,12 @@ pub struct PlayerChat { } impl PlayerChat { - pub fn new(padding: u32, guildcard: u32, message: String) -> PlayerChat { + pub fn new(padding: u32, guildcard: u32, mut message: String) -> PlayerChat { + let mut mlen = (message.len() * 2) + 0x12; + while mlen & 0x07 != 0 { + message.push('\0'); + mlen += 1; + } PlayerChat { padding: padding, guildcard: guildcard, From f07845807d1e5faf0e57272e7870721d91174f94 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 31 Dec 2019 00:18:16 -0400 Subject: [PATCH 3/4] rename padding to unknown and hardcode it for now --- src/packet/ship.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/packet/ship.rs b/src/packet/ship.rs index c1f6a31..628099b 100644 --- a/src/packet/ship.rs +++ b/src/packet/ship.rs @@ -251,20 +251,20 @@ pub struct AddToRoom { #[pso_packet(0x06)] pub struct PlayerChat { - pub padding: u32, + pub unknown: u32, pub guildcard: u32, pub message: String, } impl PlayerChat { - pub fn new(padding: u32, guildcard: u32, mut message: String) -> PlayerChat { + pub fn new(guildcard: u32, mut message: String) -> PlayerChat { let mut mlen = (message.len() * 2) + 0x12; while mlen & 0x07 != 0 { message.push('\0'); mlen += 1; } PlayerChat { - padding: padding, + unknown: 0x00010000, guildcard: guildcard, message: message, } From c8b5781443279d919bab007521e1e4a129645cc3 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 31 Dec 2019 01:28:50 -0400 Subject: [PATCH 4/4] remove manual padding --- src/packet/ship.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/packet/ship.rs b/src/packet/ship.rs index 628099b..7f73916 100644 --- a/src/packet/ship.rs +++ b/src/packet/ship.rs @@ -257,12 +257,7 @@ pub struct PlayerChat { } impl PlayerChat { - pub fn new(guildcard: u32, mut message: String) -> PlayerChat { - let mut mlen = (message.len() * 2) + 0x12; - while mlen & 0x07 != 0 { - message.push('\0'); - mlen += 1; - } + pub fn new(guildcard: u32, message: String) -> PlayerChat { PlayerChat { unknown: 0x00010000, guildcard: guildcard,