diff --git a/src/lib.rs b/src/lib.rs index 1ff7c69..853d636 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -551,7 +551,7 @@ mod test { #[pso_message(0x23)] struct Test { b: [u32; 100], - }; + } let test = Test { client: 1, diff --git a/src/packet/messages.rs b/src/packet/messages.rs index c6f2f8a..65fcfc1 100644 --- a/src/packet/messages.rs +++ b/src/packet/messages.rs @@ -135,7 +135,8 @@ pub struct TellOtherPlayerMyLocation { x: f32, y: f32, z: f32, - unknown2: u32, + rotation: u16, + unknown2: u16, } #[pso_message(0x21)] @@ -263,7 +264,7 @@ pub struct PlayerPBDonation { #[pso_message(0x37)] pub struct PlayerInitiatedPB { pb_amount: u8, - unknown1: u32, + unknown1: [u8; 4], } #[pso_message(0x3A)] @@ -278,7 +279,8 @@ pub struct PlayerSpawnedIntoArea { #[pso_message(0x3E)] pub struct PlayerStopped { - unknown1: u32, + unknown1: [u8; 2], + rotation: u16, area: u16, room: u16, x: f32, @@ -288,8 +290,10 @@ pub struct PlayerStopped { #[pso_message(0x3F)] pub struct PlayerLoadedIn { - unknown1: u32, - unknown2: u32, + unknown1: [u8; 2], + rotation: u16, + area: u16, + room: u16, x: f32, y: f32, z: f32, @@ -299,7 +303,7 @@ pub struct PlayerLoadedIn { pub struct PlayerWalking { x: f32, z: f32, - unknown: f32, + stance: u32, } #[pso_message(0x42)] @@ -310,37 +314,46 @@ pub struct PlayerRunning { #[pso_message(0x43)] pub struct ComboStep1 { - data: [u8; 4], + rotation: u16, + attack: u16, } #[pso_message(0x44)] pub struct ComboStep2 { - data: [u8; 4], + rotation: u16, + attack: u16, } #[pso_message(0x45)] pub struct ComboStep3 { - data: [u8; 4], + rotation: u16, + attack: u16, } #[pso_message(0x46)] -pub struct ComboStepDone { - data: [u8; 4], +pub struct TargetsHit { + num_of_targets: [u8; 4], // thats a lot of targets? + client2: u8, // TODO: what even is this? + target2: u8, // TODO: what even is this? + unknown2: [u8; 2], } #[pso_message(0x47)] -pub struct PlayerTechCast { +pub struct PlayerTechCast { // this packet and packet 0x8D (PlayerTechStart) are both sent at the same time as soon as the player presses a tech button, regardless if the tech is ACTUALLY casted (it not cancelled due to player blocking) or not. technique: u8, unknown1: u8, - unknown2: u8, + tech_level: u8, + #[length_of(targets)] num_of_targets: u8, + #[length_is(num_of_targets)] + targets: Vec, } #[pso_message(0x48)] -pub struct PlayerTechDone { +pub struct PlayerTechDone { // this packet gets sent once the tech is actually casted (ie: barta actually shoots out from your feet) technique: u8, unknown1: u8, - level: u8, + tech_level: u8, // level - 1 unknown2: u8, } @@ -504,7 +517,15 @@ pub struct SpawningMonsters { #[pso_message(0x68)] pub struct PlayerTelepipe { - + caster: u16, // room client # + area: u16, + room: u16, + unknown1: u16, + x: f32, + y: f32, + z: f32, + rotation: u16, + unknown2: [u8; 2], } #[pso_message(0x69)] @@ -561,6 +582,11 @@ pub struct KillMonster { //} +//#[pso_message(0x80)] +//pub struct PlayerTrapActivate { + +//} + #[pso_message(0x83)] pub struct PlayerTrapSet { trap_type: u16, @@ -572,11 +598,6 @@ pub struct PlayerTrapSet { //} -//#[pso_message(0x80)] -//pub struct PlayerTrapActivate { - -//} - //#[pso_message(0x87)] //pub struct PlayerShrink { @@ -597,10 +618,10 @@ pub struct PlayerKilledByMonster { //} -//#[pso_message(0x8D)] -//pub struct PlayerTechStart { - -//} +#[pso_message(0x8D)] +pub struct PlayerTechStart { // this packet and packet 0x47 (PlayerTechCast) are both sent at the same time (PlayerTechStart then PlayerTechCast) as soon as the player presses a tech button, regardless if the tech is ACTUALLY casted (it not cancelled due to player blocking) or not. + data: [u8; 4], // always 0'd? +} #[pso_message(0x94)] pub struct PlayerWarped2 { @@ -1005,7 +1026,7 @@ pub enum GameMessage { ComboStep1(ComboStep1), ComboStep2(ComboStep2), ComboStep3(ComboStep3), - ComboStepDone(ComboStepDone), + TargetsHit(TargetsHit), PlayerTechCast(PlayerTechCast), PlayerTechDone(PlayerTechDone), PlayerPBUsed(PlayerPBUsed), @@ -1049,7 +1070,7 @@ pub enum GameMessage { //PlayerUnshrink(PlayerUnshrink), PlayerKilledByMonster(PlayerKilledByMonster), //CmodeStatistics(CmodeStatistics), - //PlayerTechStart(PlayerTechStart), + PlayerTechStart(PlayerTechStart), PlayerWarped2(PlayerWarped2), //CmodeTryAgain(CmodeTryAgain), ModifyPlayerStats(ModifyPlayerStats), @@ -1170,7 +1191,7 @@ impl PSOPacketData for GameMessage { ComboStep1::CMD => Ok(GameMessage::ComboStep1(ComboStep1::from_bytes(&mut cur)?)), ComboStep2::CMD => Ok(GameMessage::ComboStep2(ComboStep2::from_bytes(&mut cur)?)), ComboStep3::CMD => Ok(GameMessage::ComboStep3(ComboStep3::from_bytes(&mut cur)?)), - ComboStepDone::CMD => Ok(GameMessage::ComboStepDone(ComboStepDone::from_bytes(&mut cur)?)), + TargetsHit::CMD => Ok(GameMessage::TargetsHit(TargetsHit::from_bytes(&mut cur)?)), PlayerTechCast::CMD => Ok(GameMessage::PlayerTechCast(PlayerTechCast::from_bytes(&mut cur)?)), PlayerTechDone::CMD => Ok(GameMessage::PlayerTechDone(PlayerTechDone::from_bytes(&mut cur)?)), PlayerPBUsed::CMD => Ok(GameMessage::PlayerPBUsed(PlayerPBUsed::from_bytes(&mut cur)?)), @@ -1214,7 +1235,7 @@ impl PSOPacketData for GameMessage { //PlayerUnshrink::CMD => Ok(GameMessage::PlayerUnshrink(PlayerUnshrink::from_bytes(&mut cur)?)), PlayerKilledByMonster::CMD => Ok(GameMessage::PlayerKilledByMonster(PlayerKilledByMonster::from_bytes(&mut cur)?)), //CmodeStatistics::CMD => Ok(GameMessage::CmodeStatistics(CmodeStatistics::from_bytes(&mut cur)?)), - //PlayerTechStart::CMD => Ok(GameMessage::PlayerTechStart(PlayerTechStart::from_bytes(&mut cur)?)), + PlayerTechStart::CMD => Ok(GameMessage::PlayerTechStart(PlayerTechStart::from_bytes(&mut cur)?)), PlayerWarped2::CMD => Ok(GameMessage::PlayerWarped2(PlayerWarped2::from_bytes(&mut cur)?)), //CmodeTryAgain::CMD => Ok(GameMessage::CmodeTryAgain(CmodeTryAgain::from_bytes(&mut cur)?)), ModifyPlayerStats::CMD => Ok(GameMessage::ModifyPlayerStats(ModifyPlayerStats::from_bytes(&mut cur)?)), @@ -1337,7 +1358,7 @@ impl PSOPacketData for GameMessage { GameMessage::ComboStep1(data) => data.as_bytes(), GameMessage::ComboStep2(data) => data.as_bytes(), GameMessage::ComboStep3(data) => data.as_bytes(), - GameMessage::ComboStepDone(data) => data.as_bytes(), + GameMessage::TargetsHit(data) => data.as_bytes(), GameMessage::PlayerTechCast(data) => data.as_bytes(), GameMessage::PlayerTechDone(data) => data.as_bytes(), GameMessage::PlayerPBUsed(data) => data.as_bytes(), @@ -1381,7 +1402,7 @@ impl PSOPacketData for GameMessage { //GameMessage::PlayerUnshrink(data) => data.as_bytes(), GameMessage::PlayerKilledByMonster(data) => data.as_bytes(), //GameMessage::CmodeStatistics(data) => data.as_bytes(), - //GameMessage::PlayerTechStart(data) => data.as_bytes(), + GameMessage::PlayerTechStart(data) => data.as_bytes(), GameMessage::PlayerWarped2(data) => data.as_bytes(), //GameMessage::CmodeTryAgain(data) => data.as_bytes(), GameMessage::ModifyPlayerStats(data) => data.as_bytes(),