Browse Source

PSOPacketData dervies

pull/3/head
jake 5 years ago
parent
commit
0b64cc2cac
  1. 20
      src/character/character.rs
  2. 6
      src/packet/login.rs

20
src/character/character.rs

@ -1,8 +1,11 @@
// TODO: ch_class to CharacterClass enum // TODO: ch_class to CharacterClass enum
// TODO: section_id to SectionId enum // TODO: section_id to SectionId enum
// TODO: techniques to enum?
// TODO: techniques to enum
use psopacket::PSOPacketData;
use crate::{PSOPacketData, PacketParseError};
//use crate::PSOPacketData;
#[derive(Default, Copy, Clone, PartialEq, Debug)]
#[derive(PSOPacketData, Default, Copy, Clone)]
#[repr(C)] #[repr(C)]
pub struct Character { pub struct Character {
pub atp: u16, pub atp: u16,
@ -76,7 +79,7 @@ impl Character {
} }
} }
#[derive(Copy, Clone, PartialEq, Debug)]
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(C)] #[repr(C)]
pub struct SelectScreenCharacter { pub struct SelectScreenCharacter {
pub exp: u32, pub exp: u32,
@ -153,6 +156,7 @@ impl SelectScreenCharacter {
} }
} }
#[derive(PSOPacketData, Default, Copy, Clone)]
pub struct InventoryItem { pub struct InventoryItem {
pub equipped: u16, pub equipped: u16,
pub tech: u16, pub tech: u16,
@ -162,6 +166,7 @@ pub struct InventoryItem {
pub data2: [u8; 4], pub data2: [u8; 4],
} }
#[derive(PSOPacketData, Default, Copy, Clone)]
pub struct BankItem { pub struct BankItem {
pub data1: [u8; 12], pub data1: [u8; 12],
pub item_id: u32, pub item_id: u32,
@ -170,6 +175,7 @@ pub struct BankItem {
pub flags: u16, pub flags: u16,
} }
#[derive(PSOPacketData, Copy, Clone)]
pub struct Inventory { pub struct Inventory {
pub item_count: u8, pub item_count: u8,
pub hp_mats_used: u8, pub hp_mats_used: u8,
@ -178,12 +184,14 @@ pub struct Inventory {
pub items: [InventoryItem; 30], pub items: [InventoryItem; 30],
} }
#[derive(PSOPacketData, Copy, Clone)]
pub struct Bank { pub struct Bank {
pub item_count: u32, pub item_count: u32,
pub meseta: u32, pub meseta: u32,
pub items: [BankItem; 200], pub items: [BankItem; 200],
} }
#[derive(PSOPacketData, Copy, Clone)]
pub struct KeyTeamConfig { pub struct KeyTeamConfig {
pub _unknown: [u8; 0x114], pub _unknown: [u8; 0x114],
pub key_config: [u8; 0x16C], pub key_config: [u8; 0x16C],
@ -198,6 +206,7 @@ pub struct KeyTeamConfig {
pub team_rewards: [u32; 2], pub team_rewards: [u32; 2],
} }
#[derive(PSOPacketData, Copy, Clone)]
pub struct Player { pub struct Player {
pub inventory: Inventory, pub inventory: Inventory,
pub character: Character, pub character: Character,
@ -207,7 +216,8 @@ pub struct Player {
pub autoreply: [u16; 172], pub autoreply: [u16; 172],
} }
pub struct FullChar {
#[derive(PSOPacketData, Copy, Clone)]
pub struct FullCharacter {
pub inventory: Inventory, pub inventory: Inventory,
pub character: Character, pub character: Character,
pub _unknown1: [u8; 16], pub _unknown1: [u8; 16],
@ -235,6 +245,7 @@ pub struct FullChar {
pub key_team_config: KeyTeamConfig, pub key_team_config: KeyTeamConfig,
} }
#[derive(PSOPacketData, Copy, Clone)]
pub struct DBChar { pub struct DBChar {
pub inventory: Inventory, pub inventory: Inventory,
pub character: Character, pub character: Character,
@ -248,6 +259,7 @@ pub struct DBChar {
pub quest_data2: [u8; 88], pub quest_data2: [u8; 88],
} }
#[derive(PSOPacketData, Copy, Clone)]
pub struct DBOpts { pub struct DBOpts {
pub blocked: [u32; 30], pub blocked: [u32; 30],
pub key_config: [u8; 0x16C], pub key_config: [u8; 0x16C],

6
src/packet/login.rs

@ -31,7 +31,7 @@ impl LoginWelcome {
} }
} }
#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum SessionAction { pub enum SessionAction {
None, None,
SelectCharacter, SelectCharacter,
@ -67,7 +67,7 @@ impl PSOPacketData for SessionAction {
#[derive(PSOPacketData, Debug, Clone, Copy, PartialEq)]
#[derive(PSOPacketData, Clone, Copy)]
pub struct Session { pub struct Session {
pub version: [u8; 30], pub version: [u8; 30],
pub session_id: u32, pub session_id: u32,
@ -484,7 +484,7 @@ impl Timestamp {
} }
#[derive(Debug, PSOPacketData, PartialEq, Clone)]
#[derive(PSOPacketData, Copy, Clone)]
pub struct ShipListEntry { pub struct ShipListEntry {
pub menu: u32, pub menu: u32,
pub item: u32, pub item: u32,

Loading…
Cancel
Save