From 4fae76928def3b0467add2d21f525913fa3988ef Mon Sep 17 00:00:00 2001 From: Andy Newjack Date: Sun, 19 Apr 2020 23:16:44 -0300 Subject: [PATCH] add default palette and symbol chats --- src/entity/character.rs | 3 ++- src/ship/character.rs | 11 +++++++++++ src/ship/ship.rs | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/entity/character.rs b/src/entity/character.rs index fe0072e..45b8624 100644 --- a/src/entity/character.rs +++ b/src/entity/character.rs @@ -2,6 +2,7 @@ use std::convert::{From, Into, TryFrom, TryInto}; use std::collections::HashMap; use libpso::packet::ship::{UpdateConfig, WriteInfoboard}; +use libpso::character::character::{Character}; use crate::entity::item::tech::Technique; use crate::entity::account::UserAccountId; @@ -189,7 +190,7 @@ pub struct CharacterConfig { impl CharacterConfig { fn new() -> CharacterConfig { CharacterConfig { - raw_data: [0; 0xE8], + raw_data: Character::default().config, } } diff --git a/src/ship/character.rs b/src/ship/character.rs index 8be687c..8df27a8 100644 --- a/src/ship/character.rs +++ b/src/ship/character.rs @@ -82,6 +82,7 @@ pub struct FullCharacterBytesBuilder<'a> { inventory: Option<&'a ActiveInventory>, key_config: Option<&'a [u8; 0x16C]>, joystick_config: Option<&'a [u8; 0x38]>, + symbol_chat: Option<&'a [u8; 1248]>, } @@ -94,6 +95,7 @@ impl<'a> FullCharacterBytesBuilder<'a> { inventory: None, key_config: None, joystick_config: None, + symbol_chat: None, } } @@ -139,6 +141,13 @@ impl<'a> FullCharacterBytesBuilder<'a> { } } + pub fn symbol_chat(self, symbol_chat: &'a [u8; 1248]) -> FullCharacterBytesBuilder<'a> { + FullCharacterBytesBuilder { + symbol_chat: Some(symbol_chat), + ..self + } + } + pub fn build(self) -> character::FullCharacter { let character = self.character.unwrap(); @@ -147,6 +156,7 @@ impl<'a> FullCharacterBytesBuilder<'a> { let inventory = self.inventory.unwrap(); let key_config = self.key_config.unwrap(); let joystick_config = self.joystick_config.unwrap(); + let symbol_chat = self.symbol_chat.unwrap(); character::FullCharacter { character: CharacterBytesBuilder::new() @@ -165,6 +175,7 @@ impl<'a> FullCharacterBytesBuilder<'a> { ..character::KeyTeamConfig::default() }, info_board: character.info_board.as_bytes(), + symbol_chats: *symbol_chat, ..character::FullCharacter::default() } } diff --git a/src/ship/ship.rs b/src/ship/ship.rs index 3ed4285..e611d02 100644 --- a/src/ship/ship.rs +++ b/src/ship/ship.rs @@ -220,6 +220,7 @@ impl ShipServerState { .inventory(&client.inventory) .key_config(&client.settings.settings.key_config) .joystick_config(&client.settings.settings.joystick_config) + .symbol_chat(&client.settings.settings.symbol_chats) .build(); Ok(vec![