Final fixes for GameData.

This commit is contained in:
Ottermandias 2021-07-25 02:45:48 +02:00
parent 702f8e3967
commit ea40d5bc9c
20 changed files with 133 additions and 153 deletions

View file

@ -79,7 +79,7 @@ namespace Penumbra.Importer
public Info( GamePath fileName )
{
PrimaryType = GamePathParser.PathToObjectType( fileName );
PrimaryType = GameData.GameData.GetGamePathParser().PathToObjectType( fileName );
PrimaryId = 0;
SecondaryType = BodySlot.Unknown;
SecondaryId = 0;
@ -113,14 +113,14 @@ namespace Penumbra.Importer
{
case ObjectType.Equipment:
case ObjectType.Accessory:
if( GameData.Enums.GameData.SuffixToEquipSlot.TryGetValue( match.Groups[ "Slot" ].Value, out var tmpSlot ) )
if( GameData.Enums.Names.SuffixToEquipSlot.TryGetValue( match.Groups[ "Slot" ].Value, out var tmpSlot ) )
{
EquipSlot = tmpSlot;
}
break;
case ObjectType.Character:
if( GameData.Enums.GameData.SuffixToCustomizationType.TryGetValue( match.Groups[ "Slot" ].Value, out var tmpCustom ) )
if( GameData.Enums.Names.SuffixToCustomizationType.TryGetValue( match.Groups[ "Slot" ].Value, out var tmpCustom ) )
{
CustomizationType = tmpCustom;
}
@ -130,7 +130,7 @@ namespace Penumbra.Importer
}
if( match.Groups[ "SecondaryType" ].Success
&& GameData.Enums.GameData.StringToBodySlot.TryGetValue( match.Groups[ "SecondaryType" ].Value, out SecondaryType ) )
&& GameData.Enums.Names.StringToBodySlot.TryGetValue( match.Groups[ "SecondaryType" ].Value, out SecondaryType ) )
{
SecondaryId = ushort.Parse( match.Groups[ "SecondaryId" ].Value );
}

View file

@ -46,7 +46,7 @@ namespace Penumbra.Meta
public static class GmpEntryExtension
{
public static GmpEntry Apply( this GmpEntry entry, MetaManipulation manipulation )
public static GmpEntry Apply( this ref GmpEntry entry, MetaManipulation manipulation )
{
if( manipulation.Type != MetaType.Gmp )
{

View file

@ -161,7 +161,7 @@ namespace Penumbra.Mod
var duplicates = FindOrCreateDuplicates( _mod );
if( !inOption1 )
{
duplicates.AddFile( relName2, relName2.ToGamePath() );
duplicates.AddFile( relName1, relName2.ToGamePath() );
}
if( !inOption2 )

View file

@ -31,18 +31,19 @@ namespace Penumbra.Mod
public void ComputeChangedItems()
{
var identifier = GameData.GameData.GetIdentifier();
ChangedItems.Clear();
foreach( var file in Resources.ModFiles.Select( f => new RelPath( f, BasePath ) ) )
{
foreach( var path in ModFunctions.GetAllFiles( file, Meta ) )
{
ObjectIdentifier.Identify( ChangedItems, path );
identifier.Identify( ChangedItems, path );
}
}
foreach( var path in Meta.FileSwaps.Keys )
{
ObjectIdentifier.Identify( ChangedItems, path );
identifier.Identify( ChangedItems, path );
}
}

View file

@ -53,7 +53,7 @@ namespace Penumbra.Mod
if( ret.Count == 0 )
{
ret.Add( relPath.ToGamePath( ) );
ret.Add( relPath.ToGamePath() );
}
return ret;

View file

@ -1,12 +1,9 @@
using System;
using Dalamud.Game.Command;
using Dalamud.Plugin;
using EmbedIO;
using EmbedIO.WebApi;
using Penumbra.API;
using Penumbra.GameData;
using Penumbra.Interop;
using Penumbra.Meta;
using Penumbra.Meta.Files;
using Penumbra.Mods;
using Penumbra.UI;
@ -41,7 +38,7 @@ namespace Penumbra
{
PluginInterface = pluginInterface;
Service< DalamudPluginInterface >.Set( PluginInterface );
ObjectIdentifier.Initialize( PluginInterface );
GameData.GameData.GetIdentifier( PluginInterface );
Configuration = Configuration.Load( PluginInterface );
@ -72,7 +69,7 @@ namespace Penumbra
SettingsInterface = new SettingsInterface( this );
PluginInterface.UiBuilder.DisableGposeUiHide = true;
PluginInterface.UiBuilder.OnBuildUi += SettingsInterface.Draw;
PluginInterface.UiBuilder.OnBuildUi += SettingsInterface.Draw;
if( Configuration.EnableHttpApi )
{

View file

@ -39,6 +39,8 @@ namespace Penumbra.UI
if( ImGui.BeginTable( "##ActorTable", 13, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.ScrollX,
new Vector2( -1, ImGui.GetTextLineHeightWithSpacing() * 4 * actors.Count ) ) )
{
var identifier = GameData.GameData.GetIdentifier( _plugin.PluginInterface );
foreach( var actor in actors )
{
// @formatter:off
@ -65,17 +67,17 @@ namespace Penumbra.UI
ImGui.Text( "(not set)" );
}
ImGui.TableNextColumn();
ImGui.Text( ObjectIdentifier.Identify( actor.Value.Mainhand.Set, actor.Value.Mainhand.Type, actor.Value.Mainhand.Variant, EquipSlot.MainHand )?.Name.ToString() ?? "Unknown" );
ImGui.Text( identifier.Identify( actor.Value.Mainhand.Set, actor.Value.Mainhand.Type, actor.Value.Mainhand.Variant, EquipSlot.MainHand )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( ObjectIdentifier.Identify( actor.Value.Head.Set, actor.Value.Head.Variant, 0, EquipSlot.Head )?.Name.ToString() ?? "Unknown" );
ImGui.Text( identifier.Identify( actor.Value.Head.Set, actor.Value.Head.Variant, 0, EquipSlot.Head )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( ObjectIdentifier.Identify( actor.Value.Body.Set, actor.Value.Body.Variant, 0, EquipSlot.Body )?.Name.ToString() ?? "Unknown" );
ImGui.Text( identifier.Identify( actor.Value.Body.Set, actor.Value.Body.Variant, 0, EquipSlot.Body )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( ObjectIdentifier.Identify( actor.Value.Hands.Set, actor.Value.Hands.Variant, 0, EquipSlot.Hands )?.Name.ToString() ?? "Unknown" );
ImGui.Text( identifier.Identify( actor.Value.Hands.Set, actor.Value.Hands.Variant, 0, EquipSlot.Hands )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( ObjectIdentifier.Identify( actor.Value.Legs.Set, actor.Value.Legs.Variant, 0, EquipSlot.Legs )?.Name.ToString() ?? "Unknown" );
ImGui.Text( identifier.Identify( actor.Value.Legs.Set, actor.Value.Legs.Variant, 0, EquipSlot.Legs )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( ObjectIdentifier.Identify( actor.Value.Feet.Set, actor.Value.Feet.Variant, 0, EquipSlot.Feet )?.Name.ToString() ?? "Unknown" );
ImGui.Text( identifier.Identify( actor.Value.Feet.Set, actor.Value.Feet.Variant, 0, EquipSlot.Feet )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextRow();
ImGui.TableNextColumn();
@ -95,17 +97,17 @@ namespace Penumbra.UI
ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGui.TableNextColumn();
ImGui.Text( ObjectIdentifier.Identify( actor.Value.Offhand.Set, actor.Value.Offhand.Type, actor.Value.Offhand.Variant, EquipSlot.Offhand )?.Name.ToString() ?? "Unknown" );
ImGui.Text( identifier.Identify( actor.Value.Offhand.Set, actor.Value.Offhand.Type, actor.Value.Offhand.Variant, EquipSlot.Offhand )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( ObjectIdentifier.Identify( actor.Value.Ear.Set, actor.Value.Ear.Variant, 0, EquipSlot.Ears )?.Name.ToString() ?? "Unknown" );
ImGui.Text( identifier.Identify( actor.Value.Ear.Set, actor.Value.Ear.Variant, 0, EquipSlot.Ears )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( ObjectIdentifier.Identify( actor.Value.Neck.Set, actor.Value.Neck.Variant, 0, EquipSlot.Neck )?.Name.ToString() ?? "Unknown" );
ImGui.Text( identifier.Identify( actor.Value.Neck.Set, actor.Value.Neck.Variant, 0, EquipSlot.Neck )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( ObjectIdentifier.Identify( actor.Value.Wrist.Set, actor.Value.Wrist.Variant, 0, EquipSlot.Wrists )?.Name.ToString() ?? "Unknown" );
ImGui.Text( identifier.Identify( actor.Value.Wrist.Set, actor.Value.Wrist.Variant, 0, EquipSlot.Wrists )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( ObjectIdentifier.Identify( actor.Value.LFinger.Set, actor.Value.LFinger.Variant, 0, EquipSlot.RingL )?.Name.ToString() ?? "Unknown" );
ImGui.Text( identifier.Identify( actor.Value.LFinger.Set, actor.Value.LFinger.Variant, 0, EquipSlot.RingL )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( ObjectIdentifier.Identify( actor.Value.RFinger.Set, actor.Value.RFinger.Variant, 0, EquipSlot.RingL )?.Name.ToString() ?? "Unknown" );
ImGui.Text( identifier.Identify( actor.Value.RFinger.Set, actor.Value.RFinger.Variant, 0, EquipSlot.RingL )?.Name.ToString() ?? "Unknown" );
// @formatter:on
}

View file

@ -13,22 +13,6 @@ using Penumbra.Util;
namespace Penumbra.UI
{
internal static class ListRemoveExtension
{
// Remove the entry at idx from the list if the new string is empty, otherwise replace it.
public static void RemoveOrChange( this List< string > list, string newString, int idx )
{
if( newString.Length == 0 )
{
list.RemoveAt( idx );
}
else
{
list[ idx ] = newString;
}
}
}
public partial class SettingsInterface
{
private partial class PluginDetails

View file

@ -742,7 +742,7 @@ namespace Penumbra.UI
CustomCombo( "Equipment Slot", EqdpEquipSlots, out var equipSlot, ref _newManipEquipSlot );
CustomCombo( "Race", Races, out var race, ref _newManipRace );
CustomCombo( "Gender", Genders, out var gender, ref _newManipGender );
newManip = MetaManipulation.Eqdp( equipSlot, GameData.Enums.GameData.CombinedRace( gender, race ), ( ushort )_newManipSetId,
newManip = MetaManipulation.Eqdp( equipSlot, GameData.Enums.Names.CombinedRace( gender, race ), ( ushort )_newManipSetId,
new EqdpEntry() );
break;
}
@ -771,7 +771,7 @@ namespace Penumbra.UI
CustomCombo( "Race", Races, out var race, ref _newManipRace );
CustomCombo( "Gender", Genders, out var gender, ref _newManipGender );
newManip = MetaManipulation.Est( objectType, equipSlot, GameData.Enums.GameData.CombinedRace( gender, race ), bodySlot,
newManip = MetaManipulation.Est( objectType, equipSlot, GameData.Enums.Names.CombinedRace( gender, race ), bodySlot,
( ushort )_newManipSetId, 0 );
break;
}