diff --git a/Glamourer/Interop/Structs/Actor.cs b/Glamourer/Interop/Structs/Actor.cs index 54d0a36..644d904 100644 --- a/Glamourer/Interop/Structs/Actor.cs +++ b/Glamourer/Interop/Structs/Actor.cs @@ -104,10 +104,10 @@ public readonly unsafe struct Actor : IEquatable => ((CharacterArmor*)&AsCharacter->DrawData.Head)[slot.ToIndex()]; public CharacterWeapon GetMainhand() - => *(CharacterWeapon*)&AsCharacter->DrawData.MainHandModel; + => new(AsCharacter->DrawData.Weapon(DrawDataContainer.WeaponSlot.MainHand).ModelId.Value); public CharacterWeapon GetOffhand() - => *(CharacterWeapon*)&AsCharacter->DrawData.OffHandModel; + => new(AsCharacter->DrawData.Weapon(DrawDataContainer.WeaponSlot.OffHand).ModelId.Value); public Customize GetCustomize() => *(Customize*)&AsCharacter->DrawData.CustomizeData; diff --git a/Glamourer/Interop/Structs/Model.cs b/Glamourer/Interop/Structs/Model.cs index 4da70ec..77bf24e 100644 --- a/Glamourer/Interop/Structs/Model.cs +++ b/Glamourer/Interop/Structs/Model.cs @@ -1,4 +1,5 @@ using System; +using FFXIVClientStructs.FFXIV.Client.Game.Character; using FFXIVClientStructs.FFXIV.Client.Graphics.Scene; using Glamourer.Customization; using Penumbra.GameData.Enums; @@ -143,14 +144,14 @@ public readonly unsafe struct Model : IEquatable if (!Valid || !actor.IsCharacter || actor.Model.Address != Address) return (Null, Null, CharacterWeapon.Empty, CharacterWeapon.Empty); - Model main = *((nint*)&actor.AsCharacter->DrawData.MainHand + 1); + Model main = actor.AsCharacter->DrawData.Weapon(DrawDataContainer.WeaponSlot.MainHand).DrawObject; var mainData = CharacterWeapon.Empty; if (main.IsWeapon) mainData = new CharacterWeapon(main.AsWeapon->ModelSetId, main.AsWeapon->SecondaryId, (Variant)main.AsWeapon->Variant, (StainId)main.AsWeapon->ModelUnknown); else main = Null; - Model off = *((nint*)&actor.AsCharacter->DrawData.OffHand + 1); + Model off = actor.AsCharacter->DrawData.Weapon(DrawDataContainer.WeaponSlot.OffHand).DrawObject; var offData = CharacterWeapon.Empty; if (off.IsWeapon) offData = new CharacterWeapon(off.AsWeapon->ModelSetId, off.AsWeapon->SecondaryId, (Variant)off.AsWeapon->Variant,