Some glamourer additions.

This commit is contained in:
Ottermandias 2022-07-03 23:01:38 +02:00
parent 6902ef48d1
commit 32e817d793
3 changed files with 178 additions and 154 deletions

@ -1 +1 @@
Subproject commit bec5e2b1b9c9fa6c32c9e1aa0aec62210261b99d
Subproject commit fcc5031fcf14b54f090d5bb789c580567b3f0023

View file

@ -2,11 +2,12 @@ using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection.Metadata.Ecma335;
namespace Penumbra.GameData.Enums
namespace Penumbra.GameData.Enums;
public enum EquipSlot : byte
{
public enum EquipSlot : byte
{
Unknown = 0,
MainHand = 1,
OffHand = 2,
@ -30,10 +31,26 @@ namespace Penumbra.GameData.Enums
BodyHands = 20,
BodyLegsFeet = 21,
All = 22, // Not officially existing
}
}
public static class EquipSlotExtensions
public static class EquipSlotExtensions
{
public static EquipSlot ToEquipSlot( this uint value )
=> value switch
{
0 => EquipSlot.Head,
1 => EquipSlot.Body,
2 => EquipSlot.Hands,
3 => EquipSlot.Legs,
4 => EquipSlot.Feet,
5 => EquipSlot.Ears,
6 => EquipSlot.Neck,
7 => EquipSlot.Wrists,
8 => EquipSlot.RFinger,
9 => EquipSlot.LFinger,
_ => EquipSlot.Unknown,
};
public static string ToSuffix( this EquipSlot value )
{
return value switch
@ -140,10 +157,10 @@ namespace Penumbra.GameData.Enums
public static readonly EquipSlot[] EquipmentSlots = Enum.GetValues< EquipSlot >().Where( e => e.IsEquipment() ).ToArray();
public static readonly EquipSlot[] AccessorySlots = Enum.GetValues< EquipSlot >().Where( e => e.IsAccessory() ).ToArray();
public static readonly EquipSlot[] EqdpSlots = EquipmentSlots.Concat( AccessorySlots ).ToArray();
}
}
public static partial class Names
{
public static partial class Names
{
public static readonly Dictionary< string, EquipSlot > SuffixToEquipSlot = new()
{
{ EquipSlot.Head.ToSuffix(), EquipSlot.Head },
@ -157,5 +174,4 @@ namespace Penumbra.GameData.Enums
{ EquipSlot.LFinger.ToSuffix(), EquipSlot.LFinger },
{ EquipSlot.Wrists.ToSuffix(), EquipSlot.Wrists },
};
}
}

View file

@ -2,13 +2,21 @@ using System.Runtime.InteropServices;
namespace Penumbra.GameData.Structs;
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
[StructLayout( LayoutKind.Explicit, Pack = 1 )]
public readonly struct CharacterArmor
{
[FieldOffset( 0 )]
public readonly SetId Set;
[FieldOffset( 2 )]
public readonly byte Variant;
[FieldOffset( 3 )]
public readonly StainId Stain;
[FieldOffset( 0 )]
public readonly uint Value;
public override string ToString()
=> $"{Set},{Variant},{Stain}";
}