Enums and support for parsing and interpreting game paths.

This commit is contained in:
Ottermandias 2021-03-04 17:48:37 +01:00
parent b97d0ddc37
commit 88ba14e595
8 changed files with 1074 additions and 0 deletions

View file

@ -0,0 +1,96 @@
using System.Collections.Generic;
using System.ComponentModel;
namespace Penumbra.Game
{
public enum EquipSlot : byte
{
Unknown = 0,
MainHand = 1,
Offhand = 2,
Head = 3,
Body = 4,
Hands = 5,
Belt = 6,
Legs = 7,
Feet = 8,
Ears = 9,
Neck = 10,
RingR = 12,
RingL = 14,
Wrists = 11,
BothHand = 13,
HeadBody = 15,
BodyHandsLegsFeet = 16,
SoulCrystal = 17,
LegsFeet = 18,
FullBody = 19,
BodyHands = 20,
BodyLegsFeet = 21,
All = 22
}
public static class EquipSlotEnumExtension
{
public static string ToSuffix( this EquipSlot value )
{
return value switch
{
EquipSlot.Head => "met",
EquipSlot.Hands => "glv",
EquipSlot.Legs => "dwn",
EquipSlot.Feet => "sho",
EquipSlot.Body => "top",
EquipSlot.Ears => "ear",
EquipSlot.Neck => "nek",
EquipSlot.RingR => "rir",
EquipSlot.RingL => "ril",
EquipSlot.Wrists => "wrs",
_ => throw new InvalidEnumArgumentException()
};
}
public static bool IsEquipment( this EquipSlot value )
{
return value switch
{
EquipSlot.Head => true,
EquipSlot.Hands => true,
EquipSlot.Legs => true,
EquipSlot.Feet => true,
EquipSlot.Body => true,
_ => false
};
}
public static bool IsAccessory( this EquipSlot value )
{
return value switch
{
EquipSlot.Ears => true,
EquipSlot.Neck => true,
EquipSlot.RingR => true,
EquipSlot.RingL => true,
EquipSlot.Wrists => true,
_ => false
};
}
}
public static partial class GameData
{
public static readonly Dictionary< string, EquipSlot > SuffixToEquipSlot = new()
{
{ EquipSlot.Head.ToSuffix(), EquipSlot.Head },
{ EquipSlot.Hands.ToSuffix(), EquipSlot.Hands },
{ EquipSlot.Legs.ToSuffix(), EquipSlot.Legs },
{ EquipSlot.Feet.ToSuffix(), EquipSlot.Feet },
{ EquipSlot.Body.ToSuffix(), EquipSlot.Body },
{ EquipSlot.Ears.ToSuffix(), EquipSlot.Ears },
{ EquipSlot.Neck.ToSuffix(), EquipSlot.Neck },
{ EquipSlot.RingR.ToSuffix(), EquipSlot.RingR },
{ EquipSlot.RingL.ToSuffix(), EquipSlot.RingL },
{ EquipSlot.Wrists.ToSuffix(), EquipSlot.Wrists }
};
}
}