Browse Source

make quick tech menu not all foie

pbs
Andy Newjack 5 years ago
committed by jake
parent
commit
37b19ef3ad
  1. 24
      src/entity/character.rs
  2. 1
      src/entity/gateway/inmemory.rs
  3. 11
      src/ship/character.rs
  4. 1
      src/ship/ship.rs

24
src/entity/character.rs

@ -2,7 +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 libpso::character::character::{Character, FullCharacter};
use crate::entity::item::tech::Technique;
use crate::entity::account::UserAccountId;
@ -229,6 +229,23 @@ pub struct CharacterGuildCard {
pub description: String,
}
#[derive(Clone)]
pub struct CharacterTechMenu {
pub tech_menu: [u8; 40],
}
impl CharacterTechMenu {
fn new() -> CharacterTechMenu {
CharacterTechMenu {
tech_menu: FullCharacter::default().tech_menu,
}
}
pub fn as_bytes(&self) -> [u8; 40] {
self.tech_menu
}
}
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct CharacterEntityId(pub u32);
@ -249,6 +266,8 @@ pub struct NewCharacterEntity {
pub config: CharacterConfig,
pub info_board: CharacterInfoboard,
pub guildcard: CharacterGuildCard,
pub tech_menu: CharacterTechMenu,
}
impl NewCharacterEntity {
@ -265,6 +284,7 @@ impl NewCharacterEntity {
config: CharacterConfig::new(),
info_board: CharacterInfoboard::new(),
guildcard: CharacterGuildCard::default(),
tech_menu: CharacterTechMenu::new(),
}
}
}
@ -286,4 +306,6 @@ pub struct CharacterEntity {
pub config: CharacterConfig,
pub info_board: CharacterInfoboard,
pub guildcard: CharacterGuildCard,
pub tech_menu: CharacterTechMenu,
}

1
src/entity/gateway/inmemory.rs

@ -123,6 +123,7 @@ impl EntityGateway for InMemoryGateway {
config: character.config,
info_board: character.info_board,
guildcard: character.guildcard,
tech_menu: character.tech_menu,
};
characters.insert(new_character.id, new_character.clone());
Some(new_character)

11
src/ship/character.rs

@ -83,6 +83,7 @@ pub struct FullCharacterBytesBuilder<'a> {
key_config: Option<&'a [u8; 0x16C]>,
joystick_config: Option<&'a [u8; 0x38]>,
symbol_chat: Option<&'a [u8; 1248]>,
tech_menu: Option<&'a [u8; 40]>,
}
@ -96,6 +97,7 @@ impl<'a> FullCharacterBytesBuilder<'a> {
key_config: None,
joystick_config: None,
symbol_chat: None,
tech_menu: None,
}
}
@ -148,6 +150,13 @@ impl<'a> FullCharacterBytesBuilder<'a> {
}
}
pub fn tech_menu(self, tech_menu: &'a [u8; 40]) -> FullCharacterBytesBuilder<'a> {
FullCharacterBytesBuilder {
tech_menu: Some(tech_menu),
..self
}
}
pub fn build(self) -> character::FullCharacter {
let character = self.character.unwrap();
@ -157,6 +166,7 @@ impl<'a> FullCharacterBytesBuilder<'a> {
let key_config = self.key_config.unwrap();
let joystick_config = self.joystick_config.unwrap();
let symbol_chat = self.symbol_chat.unwrap();
let tech_menu = self.tech_menu.unwrap();
character::FullCharacter {
character: CharacterBytesBuilder::new()
@ -176,6 +186,7 @@ impl<'a> FullCharacterBytesBuilder<'a> {
},
info_board: character.info_board.as_bytes(),
symbol_chats: *symbol_chat,
tech_menu: *tech_menu,
..character::FullCharacter::default()
}
}

1
src/ship/ship.rs

@ -221,6 +221,7 @@ impl<EG: EntityGateway> ShipServerState<EG> {
.key_config(&client.settings.settings.key_config)
.joystick_config(&client.settings.settings.joystick_config)
.symbol_chat(&client.settings.settings.symbol_chats)
.tech_menu(&client.character.tech_menu.as_bytes())
.build();
Ok(vec![

Loading…
Cancel
Save