mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Some glamourer additions.
This commit is contained in:
parent
6902ef48d1
commit
32e817d793
3 changed files with 178 additions and 154 deletions
2
OtterGui
2
OtterGui
|
|
@ -1 +1 @@
|
|||
Subproject commit bec5e2b1b9c9fa6c32c9e1aa0aec62210261b99d
|
||||
Subproject commit fcc5031fcf14b54f090d5bb789c580567b3f0023
|
||||
|
|
@ -2,160 +2,176 @@ 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,
|
||||
Head = 3,
|
||||
Body = 4,
|
||||
Hands = 5,
|
||||
Belt = 6,
|
||||
Legs = 7,
|
||||
Feet = 8,
|
||||
Ears = 9,
|
||||
Neck = 10,
|
||||
Wrists = 11,
|
||||
RFinger = 12,
|
||||
BothHand = 13,
|
||||
LFinger = 14, // Not officially existing, means "weapon could be equipped in either hand" for the game.
|
||||
HeadBody = 15,
|
||||
BodyHandsLegsFeet = 16,
|
||||
SoulCrystal = 17,
|
||||
LegsFeet = 18,
|
||||
FullBody = 19,
|
||||
BodyHands = 20,
|
||||
BodyLegsFeet = 21,
|
||||
All = 22, // Not officially existing
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
Unknown = 0,
|
||||
MainHand = 1,
|
||||
OffHand = 2,
|
||||
Head = 3,
|
||||
Body = 4,
|
||||
Hands = 5,
|
||||
Belt = 6,
|
||||
Legs = 7,
|
||||
Feet = 8,
|
||||
Ears = 9,
|
||||
Neck = 10,
|
||||
Wrists = 11,
|
||||
RFinger = 12,
|
||||
BothHand = 13,
|
||||
LFinger = 14, // Not officially existing, means "weapon could be equipped in either hand" for the game.
|
||||
HeadBody = 15,
|
||||
BodyHandsLegsFeet = 16,
|
||||
SoulCrystal = 17,
|
||||
LegsFeet = 18,
|
||||
FullBody = 19,
|
||||
BodyHands = 20,
|
||||
BodyLegsFeet = 21,
|
||||
All = 22, // Not officially existing
|
||||
}
|
||||
|
||||
public static class EquipSlotExtensions
|
||||
{
|
||||
public static string ToSuffix( this EquipSlot value )
|
||||
return value switch
|
||||
{
|
||||
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.RFinger => "rir",
|
||||
EquipSlot.LFinger => "ril",
|
||||
EquipSlot.Wrists => "wrs",
|
||||
_ => throw new InvalidEnumArgumentException(),
|
||||
};
|
||||
}
|
||||
|
||||
public static EquipSlot ToSlot( this EquipSlot value )
|
||||
{
|
||||
return value switch
|
||||
{
|
||||
EquipSlot.MainHand => EquipSlot.MainHand,
|
||||
EquipSlot.OffHand => EquipSlot.OffHand,
|
||||
EquipSlot.Head => EquipSlot.Head,
|
||||
EquipSlot.Body => EquipSlot.Body,
|
||||
EquipSlot.Hands => EquipSlot.Hands,
|
||||
EquipSlot.Belt => EquipSlot.Belt,
|
||||
EquipSlot.Legs => EquipSlot.Legs,
|
||||
EquipSlot.Feet => EquipSlot.Feet,
|
||||
EquipSlot.Ears => EquipSlot.Ears,
|
||||
EquipSlot.Neck => EquipSlot.Neck,
|
||||
EquipSlot.Wrists => EquipSlot.Wrists,
|
||||
EquipSlot.RFinger => EquipSlot.RFinger,
|
||||
EquipSlot.BothHand => EquipSlot.MainHand,
|
||||
EquipSlot.LFinger => EquipSlot.RFinger,
|
||||
EquipSlot.HeadBody => EquipSlot.Body,
|
||||
EquipSlot.BodyHandsLegsFeet => EquipSlot.Body,
|
||||
EquipSlot.SoulCrystal => EquipSlot.SoulCrystal,
|
||||
EquipSlot.LegsFeet => EquipSlot.Legs,
|
||||
EquipSlot.FullBody => EquipSlot.Body,
|
||||
EquipSlot.BodyHands => EquipSlot.Body,
|
||||
EquipSlot.BodyLegsFeet => EquipSlot.Body,
|
||||
_ => throw new InvalidEnumArgumentException(),
|
||||
};
|
||||
}
|
||||
|
||||
public static string ToName( this EquipSlot value )
|
||||
{
|
||||
return value switch
|
||||
{
|
||||
EquipSlot.Head => "Head",
|
||||
EquipSlot.Hands => "Hands",
|
||||
EquipSlot.Legs => "Legs",
|
||||
EquipSlot.Feet => "Feet",
|
||||
EquipSlot.Body => "Body",
|
||||
EquipSlot.Ears => "Earrings",
|
||||
EquipSlot.Neck => "Necklace",
|
||||
EquipSlot.RFinger => "Right Ring",
|
||||
EquipSlot.LFinger => "Left Ring",
|
||||
EquipSlot.Wrists => "Bracelets",
|
||||
EquipSlot.MainHand => "Primary Weapon",
|
||||
EquipSlot.OffHand => "Secondary Weapon",
|
||||
EquipSlot.Belt => "Belt",
|
||||
EquipSlot.BothHand => "Primary Weapon",
|
||||
EquipSlot.HeadBody => "Head and Body",
|
||||
EquipSlot.BodyHandsLegsFeet => "Costume",
|
||||
EquipSlot.SoulCrystal => "Soul Crystal",
|
||||
EquipSlot.LegsFeet => "Bottom",
|
||||
EquipSlot.FullBody => "Costume",
|
||||
EquipSlot.BodyHands => "Top",
|
||||
EquipSlot.BodyLegsFeet => "Costume",
|
||||
EquipSlot.All => "Costume",
|
||||
_ => "Unknown",
|
||||
};
|
||||
}
|
||||
|
||||
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.RFinger => true,
|
||||
EquipSlot.LFinger => true,
|
||||
EquipSlot.Wrists => true,
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
|
||||
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 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.RFinger.ToSuffix(), EquipSlot.RFinger },
|
||||
{ EquipSlot.LFinger.ToSuffix(), EquipSlot.LFinger },
|
||||
{ EquipSlot.Wrists.ToSuffix(), EquipSlot.Wrists },
|
||||
EquipSlot.Head => "met",
|
||||
EquipSlot.Hands => "glv",
|
||||
EquipSlot.Legs => "dwn",
|
||||
EquipSlot.Feet => "sho",
|
||||
EquipSlot.Body => "top",
|
||||
EquipSlot.Ears => "ear",
|
||||
EquipSlot.Neck => "nek",
|
||||
EquipSlot.RFinger => "rir",
|
||||
EquipSlot.LFinger => "ril",
|
||||
EquipSlot.Wrists => "wrs",
|
||||
_ => throw new InvalidEnumArgumentException(),
|
||||
};
|
||||
}
|
||||
|
||||
public static EquipSlot ToSlot( this EquipSlot value )
|
||||
{
|
||||
return value switch
|
||||
{
|
||||
EquipSlot.MainHand => EquipSlot.MainHand,
|
||||
EquipSlot.OffHand => EquipSlot.OffHand,
|
||||
EquipSlot.Head => EquipSlot.Head,
|
||||
EquipSlot.Body => EquipSlot.Body,
|
||||
EquipSlot.Hands => EquipSlot.Hands,
|
||||
EquipSlot.Belt => EquipSlot.Belt,
|
||||
EquipSlot.Legs => EquipSlot.Legs,
|
||||
EquipSlot.Feet => EquipSlot.Feet,
|
||||
EquipSlot.Ears => EquipSlot.Ears,
|
||||
EquipSlot.Neck => EquipSlot.Neck,
|
||||
EquipSlot.Wrists => EquipSlot.Wrists,
|
||||
EquipSlot.RFinger => EquipSlot.RFinger,
|
||||
EquipSlot.BothHand => EquipSlot.MainHand,
|
||||
EquipSlot.LFinger => EquipSlot.RFinger,
|
||||
EquipSlot.HeadBody => EquipSlot.Body,
|
||||
EquipSlot.BodyHandsLegsFeet => EquipSlot.Body,
|
||||
EquipSlot.SoulCrystal => EquipSlot.SoulCrystal,
|
||||
EquipSlot.LegsFeet => EquipSlot.Legs,
|
||||
EquipSlot.FullBody => EquipSlot.Body,
|
||||
EquipSlot.BodyHands => EquipSlot.Body,
|
||||
EquipSlot.BodyLegsFeet => EquipSlot.Body,
|
||||
_ => throw new InvalidEnumArgumentException(),
|
||||
};
|
||||
}
|
||||
|
||||
public static string ToName( this EquipSlot value )
|
||||
{
|
||||
return value switch
|
||||
{
|
||||
EquipSlot.Head => "Head",
|
||||
EquipSlot.Hands => "Hands",
|
||||
EquipSlot.Legs => "Legs",
|
||||
EquipSlot.Feet => "Feet",
|
||||
EquipSlot.Body => "Body",
|
||||
EquipSlot.Ears => "Earrings",
|
||||
EquipSlot.Neck => "Necklace",
|
||||
EquipSlot.RFinger => "Right Ring",
|
||||
EquipSlot.LFinger => "Left Ring",
|
||||
EquipSlot.Wrists => "Bracelets",
|
||||
EquipSlot.MainHand => "Primary Weapon",
|
||||
EquipSlot.OffHand => "Secondary Weapon",
|
||||
EquipSlot.Belt => "Belt",
|
||||
EquipSlot.BothHand => "Primary Weapon",
|
||||
EquipSlot.HeadBody => "Head and Body",
|
||||
EquipSlot.BodyHandsLegsFeet => "Costume",
|
||||
EquipSlot.SoulCrystal => "Soul Crystal",
|
||||
EquipSlot.LegsFeet => "Bottom",
|
||||
EquipSlot.FullBody => "Costume",
|
||||
EquipSlot.BodyHands => "Top",
|
||||
EquipSlot.BodyLegsFeet => "Costume",
|
||||
EquipSlot.All => "Costume",
|
||||
_ => "Unknown",
|
||||
};
|
||||
}
|
||||
|
||||
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.RFinger => true,
|
||||
EquipSlot.LFinger => true,
|
||||
EquipSlot.Wrists => true,
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
|
||||
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 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.RFinger.ToSuffix(), EquipSlot.RFinger },
|
||||
{ EquipSlot.LFinger.ToSuffix(), EquipSlot.LFinger },
|
||||
{ EquipSlot.Wrists.ToSuffix(), EquipSlot.Wrists },
|
||||
};
|
||||
}
|
||||
|
|
@ -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
|
||||
{
|
||||
public readonly SetId Set;
|
||||
public readonly byte Variant;
|
||||
[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}";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue