mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-15 05:04:16 +01:00
Add interop for Actor and Model.
This commit is contained in:
parent
6f4a7661d7
commit
512d0a1a5f
6 changed files with 98 additions and 27 deletions
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.InstanceContent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Penumbra.GameData.Enums;
|
||||
|
||||
namespace Glamourer.Structs;
|
||||
|
|
@ -15,23 +16,37 @@ public enum CrestFlag : ushort
|
|||
Feet = 0x0010,
|
||||
Ears = 0x0020,
|
||||
Neck = 0x0040,
|
||||
Wrist = 0x0080,
|
||||
Wrists = 0x0080,
|
||||
RFinger = 0x0100,
|
||||
LFinger = 0x0200,
|
||||
Mainhand = 0x0400,
|
||||
Offhand = 0x0800,
|
||||
MainHand = 0x0400,
|
||||
OffHand = 0x0800,
|
||||
}
|
||||
|
||||
public static class CrestExtensions
|
||||
{
|
||||
public const CrestFlag All = (CrestFlag)(((ulong)EquipFlag.Offhand << 1) - 1);
|
||||
public const CrestFlag AllRelevant = CrestFlag.Body;
|
||||
public const CrestFlag AllRelevant = CrestFlag.Head | CrestFlag.Body | CrestFlag.OffHand;
|
||||
|
||||
public static readonly IReadOnlyList<CrestFlag> AllRelevantSet = Enum.GetValues<CrestFlag>().Where(f => f.ToRelevantIndex() >= 0).ToArray();
|
||||
|
||||
public static int ToIndex(this CrestFlag flag)
|
||||
=> BitOperations.TrailingZeroCount((uint)flag);
|
||||
|
||||
public static int ToRelevantIndex(this CrestFlag flag)
|
||||
=> flag switch
|
||||
{
|
||||
CrestFlag.Head => 0,
|
||||
CrestFlag.Body => 1,
|
||||
CrestFlag.OffHand => 2,
|
||||
_ => -1,
|
||||
};
|
||||
|
||||
public static CrestFlag ToCrestFlag(this EquipSlot slot)
|
||||
=> slot switch
|
||||
{
|
||||
EquipSlot.MainHand => CrestFlag.Mainhand,
|
||||
EquipSlot.OffHand => CrestFlag.Offhand,
|
||||
EquipSlot.MainHand => CrestFlag.MainHand,
|
||||
EquipSlot.OffHand => CrestFlag.OffHand,
|
||||
EquipSlot.Head => CrestFlag.Head,
|
||||
EquipSlot.Body => CrestFlag.Body,
|
||||
EquipSlot.Hands => CrestFlag.Hands,
|
||||
|
|
@ -39,12 +54,27 @@ public static class CrestExtensions
|
|||
EquipSlot.Feet => CrestFlag.Feet,
|
||||
EquipSlot.Ears => CrestFlag.Ears,
|
||||
EquipSlot.Neck => CrestFlag.Neck,
|
||||
EquipSlot.Wrists => CrestFlag.Wrist,
|
||||
EquipSlot.Wrists => CrestFlag.Wrists,
|
||||
EquipSlot.RFinger => CrestFlag.RFinger,
|
||||
EquipSlot.LFinger => CrestFlag.LFinger,
|
||||
_ => 0,
|
||||
};
|
||||
|
||||
public static bool Valid(this CrestFlag crest)
|
||||
=> AllRelevant.HasFlag(crest);
|
||||
public static EquipSlot ToSlot(this CrestFlag flag)
|
||||
=> flag switch
|
||||
{
|
||||
CrestFlag.MainHand => EquipSlot.MainHand,
|
||||
CrestFlag.OffHand => EquipSlot.OffHand,
|
||||
CrestFlag.Head => EquipSlot.Head,
|
||||
CrestFlag.Body => EquipSlot.Body,
|
||||
CrestFlag.Hands => EquipSlot.Hands,
|
||||
CrestFlag.Legs => EquipSlot.Legs,
|
||||
CrestFlag.Feet => EquipSlot.Feet,
|
||||
CrestFlag.Ears => EquipSlot.Ears,
|
||||
CrestFlag.Neck => EquipSlot.Neck,
|
||||
CrestFlag.Wrists => EquipSlot.Wrists,
|
||||
CrestFlag.RFinger => EquipSlot.RFinger,
|
||||
CrestFlag.LFinger => EquipSlot.LFinger,
|
||||
_ => 0,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue