mirror of
https://github.com/redstrate/Kawari.git
synced 2025-06-30 11:47:45 +00:00
Equip the correct starting weapon for your selected classjob
This prevents all sorts of oopsies because the client will refuse to equip certain items, if you happen to be using a Gladiator weapon on an Archer or vice-versa. See #50
This commit is contained in:
parent
61f0ccdacd
commit
554d42a904
2 changed files with 19 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
|||
use icarus::Race::RaceSheet;
|
||||
use icarus::{ClassJob::ClassJobSheet, Race::RaceSheet};
|
||||
use physis::common::Language;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
@ -129,6 +129,22 @@ impl<'a> Iterator for InventoryIterator<'a> {
|
|||
}
|
||||
|
||||
impl Inventory {
|
||||
/// Equip the starting items for a given classjob
|
||||
pub fn equip_classjob_items(&mut self, classjob_id: u16, game_data: &mut GameData) {
|
||||
let sheet = ClassJobSheet::read_from(&mut game_data.game_data, Language::English).unwrap();
|
||||
let row = sheet.get_row(classjob_id as u32).unwrap();
|
||||
|
||||
self.equipped.main_hand =
|
||||
Item::new(1, *row.ItemStartingWeapon().into_i32().unwrap() as u32);
|
||||
|
||||
// TODO: don't hardcode
|
||||
self.equipped.ears = Item::new(1, 0x00003b1b);
|
||||
self.equipped.neck = Item::new(1, 0x00003b1a);
|
||||
self.equipped.wrists = Item::new(1, 0x00003b1c);
|
||||
self.equipped.right_ring = Item::new(1, 0x0000114a);
|
||||
self.equipped.left_ring = Item::new(1, 0x00003b1d);
|
||||
}
|
||||
|
||||
/// Equip the starting items for a given race
|
||||
pub fn equip_racial_items(&mut self, race_id: u8, gender: u8, game_data: &mut GameData) {
|
||||
let sheet = RaceSheet::read_from(&mut game_data.game_data, Language::English).unwrap();
|
||||
|
@ -145,14 +161,6 @@ impl Inventory {
|
|||
self.equipped.legs = Item::new(1, *row.RSEFLegs().into_i32().unwrap() as u32);
|
||||
self.equipped.feet = Item::new(1, *row.RSEFFeet().into_i32().unwrap() as u32);
|
||||
}
|
||||
|
||||
// TODO: don't hardcode
|
||||
self.equipped.main_hand = Item::new(1, 0x00000641);
|
||||
self.equipped.ears = Item::new(1, 0x00003b1b);
|
||||
self.equipped.neck = Item::new(1, 0x00003b1a);
|
||||
self.equipped.wrists = Item::new(1, 0x00003b1c);
|
||||
self.equipped.right_ring = Item::new(1, 0x0000114a);
|
||||
self.equipped.left_ring = Item::new(1, 0x00003b1d);
|
||||
}
|
||||
|
||||
pub fn process_action(&mut self, action: &ItemOperation) {
|
||||
|
|
|
@ -37,6 +37,8 @@ pub async fn handle_custom_ipc(connection: &mut ZoneConnection, data: &CustomIpc
|
|||
{
|
||||
let mut game_data = connection.gamedata.lock().unwrap();
|
||||
|
||||
inventory.equip_classjob_items(chara_make.classjob_id as u16, &mut game_data);
|
||||
|
||||
// fill inventory
|
||||
inventory.equip_racial_items(
|
||||
chara_make.customize.race,
|
||||
|
|
Loading…
Add table
Reference in a new issue