From 9545d49681f32173af8be4d383b2b049544d1b34 Mon Sep 17 00:00:00 2001 From: chirp <72366111+chirpxiv@users.noreply.github.com> Date: Wed, 27 Sep 2023 13:00:54 +0100 Subject: [PATCH] Correct offset for `DemiEquip` --- Ktisis/Structs/Actor/Actor.cs | 2 +- Ktisis/Structs/Actor/ActorModel.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Ktisis/Structs/Actor/Actor.cs b/Ktisis/Structs/Actor/Actor.cs index 33b393b3f..d179afd4d 100644 --- a/Ktisis/Structs/Actor/Actor.cs +++ b/Ktisis/Structs/Actor/Actor.cs @@ -57,7 +57,7 @@ public unsafe void LookAt(Gaze* tar, GazeControl bodyPart) { // Change equipment - no redraw method public unsafe ItemEquip GetEquip(EquipIndex index) - => this.Model != null ? this.Model->GetEquipSlot(index) : new(); + => this.Model != null ? this.Model->GetEquipSlot((int)index) : new(); public WeaponEquip GetWeaponEquip(EquipSlot slot) => slot == EquipSlot.MainHand ? this.DrawData.MainHand.GetEquip() : this.DrawData.OffHand.GetEquip(); diff --git a/Ktisis/Structs/Actor/ActorModel.cs b/Ktisis/Structs/Actor/ActorModel.cs index 9b23a88e6..a35a7f45e 100644 --- a/Ktisis/Structs/Actor/ActorModel.cs +++ b/Ktisis/Structs/Actor/ActorModel.cs @@ -30,7 +30,7 @@ public struct ActorModel { [FieldOffset(0x370)] public nint Sklb; - [FieldOffset(0x8F0)] public unsafe fixed uint DemiEquip[5]; + [FieldOffset(0x8F4)] public unsafe fixed uint DemiEquip[5]; [FieldOffset(0x910)] public unsafe fixed uint HumanEquip[10]; private unsafe CharacterBase* AsCharacter() { @@ -38,9 +38,9 @@ public struct ActorModel { return (CharacterBase*)self; } - public unsafe ItemEquip GetEquipSlot(EquipIndex slot) => AsCharacter()->GetModelType() switch { - ModelType.Human => (ItemEquip)this.HumanEquip[(int)slot], - ModelType.DemiHuman => (ItemEquip)this.DemiEquip[(int)slot], + public unsafe ItemEquip GetEquipSlot(int slot) => AsCharacter()->GetModelType() switch { + ModelType.Human => (ItemEquip)this.HumanEquip[slot], + ModelType.DemiHuman => slot < 5 ? (ItemEquip)this.DemiEquip[slot] : default, _ => default };