From 799a9e68804633c24b47b759c75269f7106918cc Mon Sep 17 00:00:00 2001
From: andy <andynewjack@protonmail.com>
Date: Mon, 24 May 2021 20:48:25 +0000
Subject: [PATCH 1/4] pb structs

---
 src/packet/messages.rs | 33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/src/packet/messages.rs b/src/packet/messages.rs
index 062af3c..040d3e0 100644
--- a/src/packet/messages.rs
+++ b/src/packet/messages.rs
@@ -255,15 +255,19 @@ pub struct PlayerUsedMoonAtomizer {
 
 }
 
-#[pso_message(0x36)]
-pub struct PlayerPBDonation {
+#[pso_message(0x37)]
+pub struct PlayerPBUsed {
+    energy: u32,
+}
 
+#[pso_message(0x38)]
+pub struct PlayerDonatedPB {
+    recipient: u32,
 }
 
-#[pso_message(0x37)]
-pub struct PlayerInitiatedPB {
-    pb_amount: u8,
-    unknown1: u32,
+#[pso_message(0x39)]
+pub struct PlayerPBReady {
+    player: u16,
 }
 
 #[pso_message(0x3A)]
@@ -345,11 +349,9 @@ pub struct PlayerTechDone {
 }
 
 #[pso_message(0x49)]
-pub struct PlayerPBUsed {
-    pb: u8,
-    unknown1: u32,
-    amount: u8,
-    unknown2: u32,
+pub struct PlayerInitiatedPB {
+    pb: u32,
+    energy: u32,
 }
 
 #[pso_message(0x4A)]
@@ -992,7 +994,7 @@ pub enum GameMessage {
     PlayerResurrected(PlayerResurrected),
     PlayerResurrectedMedicalCenter(PlayerResurrectedMedicalCenter),
     PlayerUsedMoonAtomizer(PlayerUsedMoonAtomizer),
-    PlayerPBDonation(PlayerPBDonation),
+    // PlayerPBDonation(PlayerPBDonation),
     PlayerInitiatedPB(PlayerInitiatedPB),
     PlayerLeftArea(PlayerLeftArea),
     PlayerSpawnedIntoArea(PlayerSpawnedIntoArea),
@@ -1007,6 +1009,7 @@ pub enum GameMessage {
     PlayerTechCast(PlayerTechCast),
     PlayerTechDone(PlayerTechDone),
     PlayerPBUsed(PlayerPBUsed),
+    PlayerDonatedPB(PlayerDonatedPB),
     PlayerBlockedDamage(PlayerBlockedDamage),
     PlayerReceivedDamage(PlayerReceivedDamage),
     PlayerReceivedDamage2(PlayerReceivedDamage2),
@@ -1157,7 +1160,7 @@ impl PSOPacketData for GameMessage {
             PlayerResurrected::CMD => Ok(GameMessage::PlayerResurrected(PlayerResurrected::from_bytes(&mut cur)?)),
             PlayerResurrectedMedicalCenter::CMD => Ok(GameMessage::PlayerResurrectedMedicalCenter(PlayerResurrectedMedicalCenter::from_bytes(&mut cur)?)),
             PlayerUsedMoonAtomizer::CMD => Ok(GameMessage::PlayerUsedMoonAtomizer(PlayerUsedMoonAtomizer::from_bytes(&mut cur)?)),
-            PlayerPBDonation::CMD => Ok(GameMessage::PlayerPBDonation(PlayerPBDonation::from_bytes(&mut cur)?)),
+            // PlayerPBDonation::CMD => Ok(GameMessage::PlayerPBDonation(PlayerPBDonation::from_bytes(&mut cur)?)),
             PlayerInitiatedPB::CMD => Ok(GameMessage::PlayerInitiatedPB(PlayerInitiatedPB::from_bytes(&mut cur)?)),
             PlayerLeftArea::CMD => Ok(GameMessage::PlayerLeftArea(PlayerLeftArea::from_bytes(&mut cur)?)),
             PlayerSpawnedIntoArea::CMD => Ok(GameMessage::PlayerSpawnedIntoArea(PlayerSpawnedIntoArea::from_bytes(&mut cur)?)),
@@ -1172,6 +1175,7 @@ impl PSOPacketData for GameMessage {
             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)?)),
+            PlayerDonatedPB::CMD => Ok(GameMessage::PlayerDonatedPB(PlayerDonatedPB::from_bytes(&mut cur)?)),
             PlayerBlockedDamage::CMD => Ok(GameMessage::PlayerBlockedDamage(PlayerBlockedDamage::from_bytes(&mut cur)?)),
             PlayerReceivedDamage::CMD => Ok(GameMessage::PlayerReceivedDamage(PlayerReceivedDamage::from_bytes(&mut cur)?)),
             PlayerReceivedDamage2::CMD => Ok(GameMessage::PlayerReceivedDamage2(PlayerReceivedDamage2::from_bytes(&mut cur)?)),
@@ -1324,7 +1328,7 @@ impl PSOPacketData for GameMessage {
             GameMessage::PlayerResurrected(data) => data.as_bytes(),
             GameMessage::PlayerResurrectedMedicalCenter(data) => data.as_bytes(),
             GameMessage::PlayerUsedMoonAtomizer(data) => data.as_bytes(),
-            GameMessage::PlayerPBDonation(data) => data.as_bytes(),
+            // GameMessage::PlayerPBDonation(data) => data.as_bytes(),
             GameMessage::PlayerInitiatedPB(data) => data.as_bytes(),
             GameMessage::PlayerLeftArea(data) => data.as_bytes(),
             GameMessage::PlayerSpawnedIntoArea(data) => data.as_bytes(),
@@ -1339,6 +1343,7 @@ impl PSOPacketData for GameMessage {
             GameMessage::PlayerTechCast(data) => data.as_bytes(),
             GameMessage::PlayerTechDone(data) => data.as_bytes(),
             GameMessage::PlayerPBUsed(data) => data.as_bytes(),
+            GameMessage::PlayerDonatedPB(data) => data.as_bytes(),
             GameMessage::PlayerBlockedDamage(data) => data.as_bytes(),
             GameMessage::PlayerReceivedDamage(data) => data.as_bytes(),
             GameMessage::PlayerReceivedDamage2(data) => data.as_bytes(),

From e959fc3094e1f75206ed45f6d1f57f7284dd7631 Mon Sep 17 00:00:00 2001
From: andy <andynewjack@protonmail.com>
Date: Mon, 24 May 2021 20:48:25 +0000
Subject: [PATCH 2/4] pb structs

---
 src/packet/messages.rs | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/src/packet/messages.rs b/src/packet/messages.rs
index 65fcfc1..00635ac 100644
--- a/src/packet/messages.rs
+++ b/src/packet/messages.rs
@@ -256,9 +256,14 @@ pub struct PlayerUsedMoonAtomizer {
 
 }
 
-#[pso_message(0x36)]
-pub struct PlayerPBDonation {
+#[pso_message(0x37)]
+pub struct PlayerPBUsed {
+    energy: u32,
+}
 
+#[pso_message(0x38)]
+pub struct PlayerDonatedPB {
+    recipient: u32,
 }
 
 #[pso_message(0x37)]
@@ -266,6 +271,10 @@ pub struct PlayerInitiatedPB {
     pb_amount: u8,
     unknown1: [u8; 4],
 }
+#[pso_message(0x39)]
+pub struct PlayerPBReady {
+    player: u16,
+}
 
 #[pso_message(0x3A)]
 pub struct PlayerLeftArea {
@@ -358,11 +367,9 @@ pub struct PlayerTechDone { // this packet gets sent once the tech is actually c
 }
 
 #[pso_message(0x49)]
-pub struct PlayerPBUsed {
-    pb: u8,
-    unknown1: u32,
-    amount: u8,
-    unknown2: u32,
+pub struct PlayerInitiatedPB {
+    pb: u32,
+    energy: u32,
 }
 
 #[pso_message(0x4A)]
@@ -1015,7 +1022,7 @@ pub enum GameMessage {
     PlayerResurrected(PlayerResurrected),
     PlayerResurrectedMedicalCenter(PlayerResurrectedMedicalCenter),
     PlayerUsedMoonAtomizer(PlayerUsedMoonAtomizer),
-    PlayerPBDonation(PlayerPBDonation),
+    // PlayerPBDonation(PlayerPBDonation),
     PlayerInitiatedPB(PlayerInitiatedPB),
     PlayerLeftArea(PlayerLeftArea),
     PlayerSpawnedIntoArea(PlayerSpawnedIntoArea),
@@ -1030,6 +1037,7 @@ pub enum GameMessage {
     PlayerTechCast(PlayerTechCast),
     PlayerTechDone(PlayerTechDone),
     PlayerPBUsed(PlayerPBUsed),
+    PlayerDonatedPB(PlayerDonatedPB),
     PlayerBlockedDamage(PlayerBlockedDamage),
     PlayerReceivedDamage(PlayerReceivedDamage),
     PlayerReceivedDamage2(PlayerReceivedDamage2),
@@ -1180,7 +1188,7 @@ impl PSOPacketData for GameMessage {
             PlayerResurrected::CMD => Ok(GameMessage::PlayerResurrected(PlayerResurrected::from_bytes(&mut cur)?)),
             PlayerResurrectedMedicalCenter::CMD => Ok(GameMessage::PlayerResurrectedMedicalCenter(PlayerResurrectedMedicalCenter::from_bytes(&mut cur)?)),
             PlayerUsedMoonAtomizer::CMD => Ok(GameMessage::PlayerUsedMoonAtomizer(PlayerUsedMoonAtomizer::from_bytes(&mut cur)?)),
-            PlayerPBDonation::CMD => Ok(GameMessage::PlayerPBDonation(PlayerPBDonation::from_bytes(&mut cur)?)),
+            // PlayerPBDonation::CMD => Ok(GameMessage::PlayerPBDonation(PlayerPBDonation::from_bytes(&mut cur)?)),
             PlayerInitiatedPB::CMD => Ok(GameMessage::PlayerInitiatedPB(PlayerInitiatedPB::from_bytes(&mut cur)?)),
             PlayerLeftArea::CMD => Ok(GameMessage::PlayerLeftArea(PlayerLeftArea::from_bytes(&mut cur)?)),
             PlayerSpawnedIntoArea::CMD => Ok(GameMessage::PlayerSpawnedIntoArea(PlayerSpawnedIntoArea::from_bytes(&mut cur)?)),
@@ -1195,6 +1203,7 @@ impl PSOPacketData for GameMessage {
             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)?)),
+            PlayerDonatedPB::CMD => Ok(GameMessage::PlayerDonatedPB(PlayerDonatedPB::from_bytes(&mut cur)?)),
             PlayerBlockedDamage::CMD => Ok(GameMessage::PlayerBlockedDamage(PlayerBlockedDamage::from_bytes(&mut cur)?)),
             PlayerReceivedDamage::CMD => Ok(GameMessage::PlayerReceivedDamage(PlayerReceivedDamage::from_bytes(&mut cur)?)),
             PlayerReceivedDamage2::CMD => Ok(GameMessage::PlayerReceivedDamage2(PlayerReceivedDamage2::from_bytes(&mut cur)?)),
@@ -1347,7 +1356,7 @@ impl PSOPacketData for GameMessage {
             GameMessage::PlayerResurrected(data) => data.as_bytes(),
             GameMessage::PlayerResurrectedMedicalCenter(data) => data.as_bytes(),
             GameMessage::PlayerUsedMoonAtomizer(data) => data.as_bytes(),
-            GameMessage::PlayerPBDonation(data) => data.as_bytes(),
+            // GameMessage::PlayerPBDonation(data) => data.as_bytes(),
             GameMessage::PlayerInitiatedPB(data) => data.as_bytes(),
             GameMessage::PlayerLeftArea(data) => data.as_bytes(),
             GameMessage::PlayerSpawnedIntoArea(data) => data.as_bytes(),
@@ -1362,6 +1371,7 @@ impl PSOPacketData for GameMessage {
             GameMessage::PlayerTechCast(data) => data.as_bytes(),
             GameMessage::PlayerTechDone(data) => data.as_bytes(),
             GameMessage::PlayerPBUsed(data) => data.as_bytes(),
+            GameMessage::PlayerDonatedPB(data) => data.as_bytes(),
             GameMessage::PlayerBlockedDamage(data) => data.as_bytes(),
             GameMessage::PlayerReceivedDamage(data) => data.as_bytes(),
             GameMessage::PlayerReceivedDamage2(data) => data.as_bytes(),

From e2c54986f716a56ae9c4ac7b179a2a26aec73b5a Mon Sep 17 00:00:00 2001
From: andy <andynewjack@protonmail.com>
Date: Sun, 20 Jun 2021 02:24:01 +0000
Subject: [PATCH 3/4] rebasing still difficult in 2021

---
 src/packet/messages.rs | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/src/packet/messages.rs b/src/packet/messages.rs
index 5755c7b..e6fa6fb 100644
--- a/src/packet/messages.rs
+++ b/src/packet/messages.rs
@@ -266,14 +266,6 @@ pub struct PlayerDonatedPB {
     recipient: u32,
 }
 
-<<<<<<< HEAD
-#[pso_message(0x37)]
-pub struct PlayerInitiatedPB {
-    pb_amount: u8,
-    unknown1: [u8; 4],
-}
-=======
->>>>>>> 799a9e68804633c24b47b759c75269f7106918cc
 #[pso_message(0x39)]
 pub struct PlayerPBReady {
     player: u16,

From 505ec2188d27db9734b3c966ab247f56ca6433bc Mon Sep 17 00:00:00 2001
From: andy <andynewjack@protonmail.com>
Date: Sun, 20 Jun 2021 04:12:34 +0000
Subject: [PATCH 4/4] add to enum oops

---
 src/packet/messages.rs | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/packet/messages.rs b/src/packet/messages.rs
index e6fa6fb..c290e8c 100644
--- a/src/packet/messages.rs
+++ b/src/packet/messages.rs
@@ -1033,6 +1033,7 @@ pub enum GameMessage {
     PlayerTechDone(PlayerTechDone),
     PlayerPBUsed(PlayerPBUsed),
     PlayerDonatedPB(PlayerDonatedPB),
+    PlayerPBReady(PlayerPBReady),
     PlayerBlockedDamage(PlayerBlockedDamage),
     PlayerReceivedDamage(PlayerReceivedDamage),
     PlayerReceivedDamage2(PlayerReceivedDamage2),
@@ -1199,6 +1200,7 @@ impl PSOPacketData for GameMessage {
             PlayerTechDone::CMD => Ok(GameMessage::PlayerTechDone(PlayerTechDone::from_bytes(&mut cur)?)),
             PlayerPBUsed::CMD => Ok(GameMessage::PlayerPBUsed(PlayerPBUsed::from_bytes(&mut cur)?)),
             PlayerDonatedPB::CMD => Ok(GameMessage::PlayerDonatedPB(PlayerDonatedPB::from_bytes(&mut cur)?)),
+            PlayerPBReady::CMD => Ok(GameMessage::PlayerPBReady(PlayerPBReady::from_bytes(&mut cur)?)),
             PlayerBlockedDamage::CMD => Ok(GameMessage::PlayerBlockedDamage(PlayerBlockedDamage::from_bytes(&mut cur)?)),
             PlayerReceivedDamage::CMD => Ok(GameMessage::PlayerReceivedDamage(PlayerReceivedDamage::from_bytes(&mut cur)?)),
             PlayerReceivedDamage2::CMD => Ok(GameMessage::PlayerReceivedDamage2(PlayerReceivedDamage2::from_bytes(&mut cur)?)),
@@ -1367,6 +1369,7 @@ impl PSOPacketData for GameMessage {
             GameMessage::PlayerTechDone(data) => data.as_bytes(),
             GameMessage::PlayerPBUsed(data) => data.as_bytes(),
             GameMessage::PlayerDonatedPB(data) => data.as_bytes(),
+            GameMessage::PlayerPBReady(data) => data.as_bytes(),
             GameMessage::PlayerBlockedDamage(data) => data.as_bytes(),
             GameMessage::PlayerReceivedDamage(data) => data.as_bytes(),
             GameMessage::PlayerReceivedDamage2(data) => data.as_bytes(),