Browse Source

add character/guildcard structs

pull/3/head
Jake Probst 5 years ago
parent
commit
419db62ad5
  1. 104
      src/character/character.rs
  2. 114
      src/character/guildcard.rs

104
src/character/character.rs

@ -0,0 +1,104 @@
// TODO: ch_class to CharacterClass enum
// TODO: section_id to SectionId enum
// TODO: techniques to enum?
#[derive(Default)]
pub struct Character {
pub atp: u16,
pub mst: u16,
pub evp: u16,
pub hp: u16,
pub dfp: u16,
pub ata: u16,
pub lck: u16,
pub _unknown1: u16,
pub _unknown2: [u32; 2],
pub level: u32,
pub exp: u32,
pub meseta: u32,
pub guildcard: [u8; 16],
pub _unknown3: [u32; 2],
pub name_color: u32,
pub model: u8,
pub _unused: [u8; 11],
pub play_time: u32,
pub name_color_checksum: u32,
pub section_id: u8,
pub ch_class: u8,
pub v2flags: u8,
pub version: u8,
pub v1flags: u8,
pub costume: u16,
pub skin: u16,
pub face: u16,
pub head: u16,
pub hair: u16,
pub hair_r: u16,
pub hair_g: u16,
pub hair_b: u16,
pub prop_x: f32,
pub prop_y: f32,
pub name: [u16; 16],
//pub config: [u8; 0xE8],
pub techniques: [u8; 0x14],
}
impl Character {
pub fn as_select_screen(self) -> SelectScreenCharacter {
SelectScreenCharacter {
exp: self.exp,
level: self.level,
guildcard: self.guildcard,
_unknown: self._unknown3,
name_color: self.name_color,
model: self.model,
_unused: [0; 15],
name_color_checksum: self.name_color_checksum,
section_id: self.section_id,
ch_class: self.ch_class,
v2flags: self.v2flags,
version: self.version,
v1flags: self.v1flags,
costume: self.costume,
skin: self.skin,
face: self.face,
head: self.head,
hair: self.hair,
hair_r: self.hair_r,
hair_g: self.hair_g,
hair_b: self.hair_b,
prop_x: self.prop_x,
prop_y: self.prop_y,
name: self.name,
play_time: self.play_time,
}
}
}
pub struct SelectScreenCharacter {
pub exp: u32,
pub level: u32,
pub guildcard: [u8; 16],
pub _unknown: [u32; 2],
pub name_color: u32,
pub model: u8,
pub _unused: [u8; 15],
pub name_color_checksum: u32,
pub section_id: u8,
pub ch_class: u8,
pub v2flags: u8,
pub version: u8,
pub v1flags: u8,
pub costume: u16,
pub skin: u16,
pub face: u16,
pub head: u16,
pub hair: u16,
pub hair_r: u16,
pub hair_g: u16,
pub hair_b: u16,
pub prop_x: f32,
pub prop_y: f32,
pub name: [u16; 16],
pub play_time: u32,
}

114
src/character/guildcard.rs

@ -0,0 +1,114 @@
/*
typedef struct bb_guildcard_data {
uint8_t unk1[0x0114];
struct {
uint32_t guildcard;
uint16_t name[0x18];
uint16_t team[0x10];
uint16_t desc[0x58];
uint8_t reserved1;
uint8_t language;
uint8_t section;
uint8_t ch_class;
} blocked[29];
uint8_t unk2[0x78];
struct {
uint32_t guildcard;
uint16_t name[0x18];
uint16_t team[0x10];
uint16_t desc[0x58];
uint8_t reserved1;
uint8_t language;
uint8_t section;
uint8_t ch_class;
uint32_t padding;
uint16_t comment[0x58];
} entries[104];
uint8_t unk3[0x01BC];
} bb_gc_data_t;
*/
#[derive(Copy, Clone)]
pub struct BlockedGuildCard {
pub guildcard: u32,
pub name: [u16; 0x18],
pub team: [u16; 0x10],
pub desc: [u16; 0x58],
pub reserved1: u8,
pub language: u8,
pub section_id: u8,
pub class: u8,
}
impl Default for BlockedGuildCard {
fn default() -> BlockedGuildCard {
BlockedGuildCard {
guildcard: 0,
name: [0; 0x18],
team: [0; 0x10],
desc: [0; 0x58],
reserved1: 0,
language: 0,
section_id: 0,
class: 0,
}
}
}
#[derive(Copy, Clone)]
pub struct GuildCard {
pub guildcard: u32,
pub name: [u16; 0x18],
pub team: [u16; 0x10],
pub desc: [u16; 0x58],
pub reserved1: u8,
pub language: u8,
pub section_id: u8,
pub class: u8,
pub paddding: u32,
pub comment: [u16; 0x58],
}
impl Default for GuildCard {
fn default() -> GuildCard {
GuildCard {
guildcard: 0,
name: [0; 0x18],
team: [0; 0x10],
desc: [0; 0x58],
reserved1: 0,
language: 0,
section_id: 0,
class: 0,
paddding: 0,
comment: [0; 0x58],
}
}
}
#[derive(Copy, Clone)]
pub struct GuildCardData {
pub _unknown1: [u8; 0x114],
pub blocked: [BlockedGuildCard; 29],
pub _unknown2: [u8; 0x78],
pub friends: [GuildCard; 104],
pub _unknown3: [u8; 0x1BC],
}
impl Default for GuildCardData {
fn default() -> GuildCardData {
GuildCardData {
_unknown1: [0; 0x114],
blocked: [BlockedGuildCard::default(); 29],
_unknown2: [0; 0x78],
friends: [GuildCard::default(); 104],
_unknown3: [0; 0x1BC],
}
}
}
Loading…
Cancel
Save