Skip to content

Commit

Permalink
Correct offset for DemiEquip
Browse files Browse the repository at this point in the history
  • Loading branch information
chirpxiv committed Sep 27, 2023
1 parent 8ddadb4 commit 9545d49
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Ktisis/Structs/Actor/Actor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions Ktisis/Structs/Actor/ActorModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ 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() {
fixed (ActorModel* self = &this)
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
};

Expand Down

0 comments on commit 9545d49

Please sign in to comment.