From 7472e132bfda3da3d72141be493ed5bae102a11a Mon Sep 17 00:00:00 2001 From: jake Date: Sun, 27 Sep 2020 18:12:41 -0600 Subject: [PATCH] shop actions --- src/packet/messages.rs | 59 ++++++++++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 20 deletions(-) diff --git a/src/packet/messages.rs b/src/packet/messages.rs index 248fd6e..3984e32 100644 --- a/src/packet/messages.rs +++ b/src/packet/messages.rs @@ -708,21 +708,37 @@ pub struct PhotonChairMove { unknown1: u32, } -//#[pso_message(0xB5)] -//pub struct ShopRequest { -// unknown1: u16, -// shop_type: u8, -//} +#[pso_message(0xB5)] +pub struct ShopRequest { + shop_type: u8, +} -//#[pso_message(0xB7)] -//pub struct BuyItem { -// unknown1: u16, -// item_id: u8, -// unknown2: u8, -// shop_item_index: u8, -// amount: u8, -// unknown3: u8, -//} +#[derive(PSOPacketData, Clone)] +pub struct ShopListItem { + pub item_bytes: [u8; 12], + pub unknown: u32, // 0xFFFFFFFF + pub price: u32, +} + +#[pso_message(0xB6)] +pub struct ShopList { + pub shop_type: u8, + #[length_of(items)] + pub num_items: u8, + pub unused: u16, + #[length_is(num_items)] + pub items: Vec, +} + + +#[pso_message(0xB7)] +pub struct BuyItem { + item_id: u32, + shop_type: u8, + shop_index: u8, + amount: u8, + unknown1: u8, +} #[pso_message(0xB8)] pub struct TekRequest { @@ -1054,8 +1070,9 @@ pub enum GameMessage { UnknownAE(UnknownAE), PhotonChairTurn(PhotonChairTurn), PhotonChairMove(PhotonChairMove), - //ShopRequest(ShopRequest), - //BuyItem(BuyItem), + ShopRequest(ShopRequest), + ShopList(ShopList), + BuyItem(BuyItem), TekRequest(TekRequest), TekPreview(TekPreview), //TekAccept(TekAccept), @@ -1218,8 +1235,9 @@ impl PSOPacketData for GameMessage { UnknownAE::CMD => Ok(GameMessage::UnknownAE(UnknownAE::from_bytes(&mut cur)?)), PhotonChairTurn::CMD => Ok(GameMessage::PhotonChairTurn(PhotonChairTurn::from_bytes(&mut cur)?)), PhotonChairMove::CMD => Ok(GameMessage::PhotonChairMove(PhotonChairMove::from_bytes(&mut cur)?)), - //ShopRequest::CMD => Ok(GameMessage::ShopRequest(ShopRequest::from_bytes(&mut cur)?)), - //BuyItem::CMD => Ok(GameMessage::BuyItem(BuyItem::from_bytes(&mut cur)?)), + ShopRequest::CMD => Ok(GameMessage::ShopRequest(ShopRequest::from_bytes(&mut cur)?)), + ShopList::CMD => Ok(GameMessage::ShopList(ShopList::from_bytes(&mut cur)?)), + BuyItem::CMD => Ok(GameMessage::BuyItem(BuyItem::from_bytes(&mut cur)?)), 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)?)), @@ -1384,8 +1402,9 @@ impl PSOPacketData for GameMessage { GameMessage::UnknownAE(data) => data.as_bytes(), GameMessage::PhotonChairTurn(data) => data.as_bytes(), GameMessage::PhotonChairMove(data) => data.as_bytes(), - //GameMessage::ShopRequest(data) => data.as_bytes(), - //GameMessage::BuyItem(data) => data.as_bytes(), + GameMessage::ShopRequest(data) => data.as_bytes(), + GameMessage::ShopList(data) => data.as_bytes(), + GameMessage::BuyItem(data) => data.as_bytes(), GameMessage::TekRequest(data) => data.as_bytes(), GameMessage::TekPreview(data) => data.as_bytes(), // GameMessage::TekAccept(data) => data.as_bytes(),