Browse Source

PSOPacketData dervies

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

22
src/character/character.rs

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

6
src/packet/login.rs

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

Loading…
Cancel
Save