1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-04-19 22:36:49 +00:00

Show the currently equipped weapon on your character

Oops, I was turning u64 model ids into u16 and then changing it to
either a u32/u16. That's stupid, but now it's fixed and we can display
weapons!
This commit is contained in:
Joshua Goins 2025-04-18 13:20:25 -04:00
parent 510d07e3e4
commit e5672e91f2
2 changed files with 8 additions and 3 deletions

View file

@ -107,7 +107,7 @@ impl GameData {
} }
/// Gets the primary model ID for a given item ID /// Gets the primary model ID for a given item ID
pub fn get_primary_model_id(&mut self, item_id: u32) -> Option<u16> { pub fn get_primary_model_id(&mut self, item_id: u32) -> Option<u64> {
for page in &self.item_pages { for page in &self.item_pages {
if let Some(row) = page.read_row(&self.item_exh, item_id) { if let Some(row) = page.read_row(&self.item_exh, item_id) {
let item_row = &row[0]; let item_row = &row[0];
@ -116,7 +116,7 @@ impl GameData {
panic!("Unexpected type!"); panic!("Unexpected type!");
}; };
return Some(*id as u16); return Some(*id);
} }
} }

View file

@ -621,7 +621,9 @@ impl ZoneConnection {
op_code: ServerZoneIpcType::Equip, op_code: ServerZoneIpcType::Equip,
timestamp: timestamp_secs(), timestamp: timestamp_secs(),
data: ServerZoneIpcData::Equip(Equip { data: ServerZoneIpcData::Equip(Equip {
main_weapon_id: 0, main_weapon_id: game_data
.get_primary_model_id(equipped.main_hand.id)
.unwrap_or(0),
sub_weapon_id: 0, sub_weapon_id: 0,
crest_enable: 0, crest_enable: 0,
pattern_invalid: 0, pattern_invalid: 0,
@ -797,6 +799,9 @@ impl ZoneConnection {
object_kind: ObjectKind::Player(PlayerSubKind::Player), object_kind: ObjectKind::Player(PlayerSubKind::Player),
look: chara_details.chara_make.customize, look: chara_details.chara_make.customize,
display_flags: DisplayFlag::UNK, display_flags: DisplayFlag::UNK,
main_weapon_model: game_data
.get_primary_model_id(equipped.main_hand.id)
.unwrap_or(0),
models: [ models: [
game_data game_data
.get_primary_model_id(equipped.head.id) .get_primary_model_id(equipped.head.id)