Stop using windows forms, add extensive meta manipulation editing, fix a concurrency crash and a dumb crash.

This commit is contained in:
Ottermandias 2022-05-18 17:40:41 +02:00
parent e5b739fc52
commit 0c3c7ea363
25 changed files with 1266 additions and 302 deletions

View file

@ -1,43 +1,42 @@
using System.Collections.Generic;
using System.ComponentModel;
namespace Penumbra.GameData.Enums
namespace Penumbra.GameData.Enums;
public enum BodySlot : byte
{
public enum BodySlot : byte
{
Unknown,
Hair,
Face,
Tail,
Body,
Zear,
}
Unknown,
Hair,
Face,
Tail,
Body,
Zear,
}
public static class BodySlotEnumExtension
public static class BodySlotEnumExtension
{
public static string ToSuffix( this BodySlot value )
{
public static string ToSuffix( this BodySlot value )
return value switch
{
return value switch
{
BodySlot.Zear => "zear",
BodySlot.Face => "face",
BodySlot.Hair => "hair",
BodySlot.Body => "body",
BodySlot.Tail => "tail",
_ => throw new InvalidEnumArgumentException(),
};
}
}
public static partial class Names
{
public static readonly Dictionary< string, BodySlot > StringToBodySlot = new()
{
{ BodySlot.Zear.ToSuffix(), BodySlot.Zear },
{ BodySlot.Face.ToSuffix(), BodySlot.Face },
{ BodySlot.Hair.ToSuffix(), BodySlot.Hair },
{ BodySlot.Body.ToSuffix(), BodySlot.Body },
{ BodySlot.Tail.ToSuffix(), BodySlot.Tail },
BodySlot.Zear => "zear",
BodySlot.Face => "face",
BodySlot.Hair => "hair",
BodySlot.Body => "body",
BodySlot.Tail => "tail",
_ => throw new InvalidEnumArgumentException(),
};
}
}
public static partial class Names
{
public static readonly Dictionary< string, BodySlot > StringToBodySlot = new()
{
{ BodySlot.Zear.ToSuffix(), BodySlot.Zear },
{ BodySlot.Face.ToSuffix(), BodySlot.Face },
{ BodySlot.Hair.ToSuffix(), BodySlot.Hair },
{ BodySlot.Body.ToSuffix(), BodySlot.Body },
{ BodySlot.Tail.ToSuffix(), BodySlot.Tail },
};
}

View file

@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
namespace Penumbra.GameData.Enums
{
@ -30,7 +32,7 @@ namespace Penumbra.GameData.Enums
All = 22, // Not officially existing
}
public static class EquipSlotEnumExtension
public static class EquipSlotExtensions
{
public static string ToSuffix( this EquipSlot value )
{
@ -79,6 +81,36 @@ namespace Penumbra.GameData.Enums
};
}
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
@ -104,6 +136,10 @@ namespace Penumbra.GameData.Enums
_ => 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

View file

@ -1,21 +1,55 @@
namespace Penumbra.GameData.Enums
using System;
namespace Penumbra.GameData.Enums;
public enum ObjectType : byte
{
public enum ObjectType : byte
Unknown,
Vfx,
DemiHuman,
Accessory,
World,
Housing,
Monster,
Icon,
LoadingScreen,
Map,
Interface,
Equipment,
Character,
Weapon,
Font,
}
public static class ObjectTypeExtensions
{
public static string ToName( this ObjectType type )
=> type switch
{
ObjectType.Vfx => "Visual Effect",
ObjectType.DemiHuman => "Demi Human",
ObjectType.Accessory => "Accessory",
ObjectType.World => "Doodad",
ObjectType.Housing => "Housing Object",
ObjectType.Monster => "Monster",
ObjectType.Icon => "Icon",
ObjectType.LoadingScreen => "Loading Screen",
ObjectType.Map => "Map",
ObjectType.Interface => "UI Element",
ObjectType.Equipment => "Equipment",
ObjectType.Character => "Character",
ObjectType.Weapon => "Weapon",
ObjectType.Font => "Font",
_ => "Unknown",
};
public static readonly ObjectType[] ValidImcTypes =
{
Unknown,
Vfx,
DemiHuman,
Accessory,
World,
Housing,
Monster,
Icon,
LoadingScreen,
Map,
Interface,
Equipment,
Character,
Weapon,
Font,
}
ObjectType.Equipment,
ObjectType.Accessory,
ObjectType.DemiHuman,
ObjectType.Monster,
ObjectType.Weapon,
};
}