diff --git a/src/character/character.rs b/src/character/character.rs index 405bb81..137f90a 100644 --- a/src/character/character.rs +++ b/src/character/character.rs @@ -348,6 +348,12 @@ pub struct Bank { pub items: [BankItem; 200], } +impl std::default::Default for Bank { + fn default() -> Bank { + Bank::from_bytes(&mut std::io::Cursor::new([0; 0x12C8].to_vec())).unwrap() + } +} + #[derive(PSOPacketData, Copy, Clone)] pub struct KeyTeamConfig { pub _unknown: [u8; 0x114], diff --git a/src/packet/messages.rs b/src/packet/messages.rs index 9b8e6ce..1d4e9e5 100644 --- a/src/packet/messages.rs +++ b/src/packet/messages.rs @@ -742,19 +742,20 @@ pub struct TekPreview { //} -//#[pso_message(0xBB)] -//pub struct BankRequest { - -//} +#[pso_message(0xBB)] +pub struct BankRequest { + unknown: u32, +} -//#[pso_message(0xBD)] -//pub struct BankInteraction { -// item_id: u16, -// amount: u8, -// action: u8, -// item_amount: u8, -// unknown2: u8, -//} + +#[pso_message(0xBD)] +pub struct BankInteraction { + item_id: u32, + meseta_amount: u32, + action: u8, + item_amount: u8, + unknown: u16, +} @@ -1055,8 +1056,8 @@ pub enum GameMessage { TekRequest(TekRequest), TekPreview(TekPreview), //TekAccept(TekAccept), - //BankRequest(BankRequest), - //BankInteraction(BankInteraction), + BankRequest(BankRequest), + BankInteraction(BankInteraction), //PlayerSoldItem(PlayerSoldItem), //TeamInvite(TeamInvite), //AcceptTeamInvite(AcceptTeamInvite), @@ -1219,8 +1220,8 @@ impl PSOPacketData for GameMessage { TekRequest::CMD => Ok(GameMessage::TekRequest(TekRequest::from_bytes(&mut cur)?)), TekPreview::CMD => Ok(GameMessage::TekPreview(TekPreview::from_bytes(&mut cur)?)), //TekAccept::CMD => Ok(GameMessage::TekAccept(TekAccept::from_bytes(&mut cur)?)), - //BankRequest::CMD => Ok(GameMessage::BankRequest(BankRequest::from_bytes(&mut cur)?)), - //BankInteraction::CMD => Ok(GameMessage::BankInteraction(BankInteraction::from_bytes(&mut cur)?)), + BankRequest::CMD => Ok(GameMessage::BankRequest(BankRequest::from_bytes(&mut cur)?)), + BankInteraction::CMD => Ok(GameMessage::BankInteraction(BankInteraction::from_bytes(&mut cur)?)), //PlayerSoldItem::CMD => Ok(GameMessage::PlayerSoldItem(PlayerSoldItem::from_bytes(&mut cur)?)), //TeamInvite::CMD => Ok(GameMessage::TeamInvite(TeamInvite::from_bytes(&mut cur)?)), //AcceptTeamInvite::CMD => Ok(GameMessage::AcceptTeamInvite(AcceptTeamInvite::from_bytes(&mut cur)?)), @@ -1385,8 +1386,8 @@ impl PSOPacketData for GameMessage { GameMessage::TekRequest(data) => data.as_bytes(), GameMessage::TekPreview(data) => data.as_bytes(), // GameMessage::TekAccept(data) => data.as_bytes(), - //GameMessage::BankRequest(data) => data.as_bytes(), - //GameMessage::BankInteraction(data) => data.as_bytes(), + GameMessage::BankRequest(data) => data.as_bytes(), + GameMessage::BankInteraction(data) => data.as_bytes(), //GameMessage::PlayerSoldItem(data) => data.as_bytes(), //GameMessage::TeamInvite(data) => data.as_bytes(), //GameMessage::AcceptTeamInvite(data) => data.as_bytes(), diff --git a/src/packet/ship.rs b/src/packet/ship.rs index 137c58b..c7fd0cd 100644 --- a/src/packet/ship.rs +++ b/src/packet/ship.rs @@ -4,6 +4,7 @@ use crate::utf8_to_utf16_array; use crate::packet::messages::GameMessage; //use character::character::FullCharacter; use crate::character::character as character; +use crate::character::character::BankItem; use crate::ConsumingBlob; use std::io::Read; @@ -176,6 +177,21 @@ impl DirectMessage { } } +// this is a bit of a weird packet, 0x6C is in the 0x60 family in terms of function +// but this is the only packet I could find that uses it +#[pso_packet(0x6C, no_flag)] +struct BankItemList { + pub aflag: u32, + pub cmd: u8, // 0xBC + pub unknown: [u8; 3], + pub size: u32, + pub checksum: u32, + pub item_count: u32, + pub meseta: u32, + pub items: Vec, +} + + #[pso_packet(0x6D, manual_flag)] struct Like62ButCooler { pub flag: u32,