mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 10:17:22 +01:00
Create external project for GameData and move GamePath to it
This commit is contained in:
parent
3c560268fc
commit
c7a17d0180
30 changed files with 137 additions and 152 deletions
53
Penumbra.GameData/Penumbra.GameData.csproj
Normal file
53
Penumbra.GameData/Penumbra.GameData.csproj
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net472</TargetFramework>
|
||||||
|
<LangVersion>preview</LangVersion>
|
||||||
|
<AssemblyTitle>Penumbra.GameData</AssemblyTitle>
|
||||||
|
<Company>absolute gangstas</Company>
|
||||||
|
<Product>Penumbra</Product>
|
||||||
|
<Copyright>Copyright © 2020</Copyright>
|
||||||
|
<FileVersion>1.0.0.0</FileVersion>
|
||||||
|
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
||||||
|
<OutputPath>bin\$(Configuration)\</OutputPath>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<MSBuildWarningsAsMessages>$(MSBuildWarningsAsMessages);MSB3277</MSBuildWarningsAsMessages>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Dalamud">
|
||||||
|
<HintPath>$(DALAMUD_ROOT)\Dalamud.dll</HintPath>
|
||||||
|
<HintPath>..\libs\Dalamud.dll</HintPath>
|
||||||
|
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Dalamud.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Lumina">
|
||||||
|
<HintPath>$(DALAMUD_ROOT)\Lumina.dll</HintPath>
|
||||||
|
<HintPath>..\libs\Lumina.dll</HintPath>
|
||||||
|
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Lumina.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Lumina.Excel">
|
||||||
|
<HintPath>$(DALAMUD_ROOT)\Lumina.Excel.dll</HintPath>
|
||||||
|
<HintPath>..\libs\Lumina.Excel.dll</HintPath>
|
||||||
|
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Lumina.Excel.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
|
|
@ -69,9 +69,9 @@ namespace Penumbra.GameData.Util
|
||||||
{
|
{
|
||||||
return rhs switch
|
return rhs switch
|
||||||
{
|
{
|
||||||
string path => string.Compare( _path, path, StringComparison.InvariantCulture ),
|
string path => string.Compare( _path, path, StringComparison.InvariantCulture ),
|
||||||
GamePath path => string.Compare( _path, path._path, StringComparison.InvariantCulture ),
|
GamePath path => string.Compare( _path, path._path, StringComparison.InvariantCulture ),
|
||||||
_ => -1,
|
_ => -1,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -87,7 +87,7 @@ namespace Penumbra.GameData.Util
|
||||||
public override object ReadJson( JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer )
|
public override object ReadJson( JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer )
|
||||||
{
|
{
|
||||||
var token = JToken.Load( reader );
|
var token = JToken.Load( reader );
|
||||||
return token.ToObject< GamePath >();
|
return token.ToObject<GamePath>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CanWrite
|
public override bool CanWrite
|
||||||
|
|
|
||||||
66
Penumbra.sln
66
Penumbra.sln
|
|
@ -1,30 +1,36 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 16
|
# Visual Studio Version 16
|
||||||
VisualStudioVersion = 16.0.29709.97
|
VisualStudioVersion = 16.0.29709.97
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Penumbra", "Penumbra\Penumbra.csproj", "{13C812E9-0D42-4B95-8646-40EEBF30636F}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Penumbra", "Penumbra\Penumbra.csproj", "{13C812E9-0D42-4B95-8646-40EEBF30636F}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F89C9EAE-25C8-43BE-8108-5921E5A93502}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F89C9EAE-25C8-43BE-8108-5921E5A93502}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
.editorconfig = .editorconfig
|
.editorconfig = .editorconfig
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Penumbra.GameData", "Penumbra.GameData\Penumbra.GameData.csproj", "{EE551E87-FDB3-4612-B500-DC870C07C605}"
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
EndProject
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Global
|
||||||
Release|Any CPU = Release|Any CPU
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
EndGlobalSection
|
Debug|Any CPU = Debug|Any CPU
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
Release|Any CPU = Release|Any CPU
|
||||||
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
EndGlobalSection
|
||||||
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Release|Any CPU.Build.0 = Release|Any CPU
|
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
EndGlobalSection
|
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
HideSolutionNode = FALSE
|
{EE551E87-FDB3-4612-B500-DC870C07C605}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
EndGlobalSection
|
{EE551E87-FDB3-4612-B500-DC870C07C605}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
{EE551E87-FDB3-4612-B500-DC870C07C605}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
SolutionGuid = {B17E85B1-5F60-4440-9F9A-3DDE877E8CDF}
|
{EE551E87-FDB3-4612-B500-DC870C07C605}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {B17E85B1-5F60-4440-9F9A-3DDE877E8CDF}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ namespace Penumbra.Game
|
||||||
|
|
||||||
public GenderRace GenderRace
|
public GenderRace GenderRace
|
||||||
{
|
{
|
||||||
get => GameData.GenderRaceFromByte( _genderRaceByte );
|
get => Penumbra.Game.Enums.GameData.GenderRaceFromByte( _genderRaceByte );
|
||||||
set => _genderRaceByte = value.ToByte();
|
set => _genderRaceByte = value.ToByte();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
using Penumbra.Game.Enums;
|
using Penumbra.Game.Enums;
|
||||||
|
using Penumbra.GameData.Util;
|
||||||
using Penumbra.Util;
|
using Penumbra.Util;
|
||||||
|
|
||||||
namespace Penumbra.Game
|
namespace Penumbra.Game
|
||||||
|
|
@ -121,7 +122,7 @@ namespace Penumbra.Game
|
||||||
|
|
||||||
private static (FileType, ObjectType, Match?) ParseGamePath( GamePath path )
|
private static (FileType, ObjectType, Match?) ParseGamePath( GamePath path )
|
||||||
{
|
{
|
||||||
if( !GameData.ExtensionToFileType.TryGetValue( Extension( path ), out var fileType ) )
|
if( !Penumbra.Game.Enums.GameData.ExtensionToFileType.TryGetValue( Extension( path ), out var fileType ) )
|
||||||
{
|
{
|
||||||
fileType = FileType.Unknown;
|
fileType = FileType.Unknown;
|
||||||
}
|
}
|
||||||
|
|
@ -164,8 +165,8 @@ namespace Penumbra.Game
|
||||||
return GameObjectInfo.Equipment( fileType, setId );
|
return GameObjectInfo.Equipment( fileType, setId );
|
||||||
}
|
}
|
||||||
|
|
||||||
var gr = GameData.GenderRaceFromCode( groups[ "race" ].Value );
|
var gr = Penumbra.Game.Enums.GameData.GenderRaceFromCode( groups[ "race" ].Value );
|
||||||
var slot = GameData.SuffixToEquipSlot[ groups[ "slot" ].Value ];
|
var slot = Penumbra.Game.Enums.GameData.SuffixToEquipSlot[ groups[ "slot" ].Value ];
|
||||||
if( fileType == FileType.Model )
|
if( fileType == FileType.Model )
|
||||||
{
|
{
|
||||||
return GameObjectInfo.Equipment( fileType, setId, gr, slot );
|
return GameObjectInfo.Equipment( fileType, setId, gr, slot );
|
||||||
|
|
@ -210,7 +211,7 @@ namespace Penumbra.Game
|
||||||
return GameObjectInfo.DemiHuman( fileType, demiHumanId, equipId );
|
return GameObjectInfo.DemiHuman( fileType, demiHumanId, equipId );
|
||||||
}
|
}
|
||||||
|
|
||||||
var slot = GameData.SuffixToEquipSlot[ groups[ "slot" ].Value ];
|
var slot = Penumbra.Game.Enums.GameData.SuffixToEquipSlot[ groups[ "slot" ].Value ];
|
||||||
if( fileType == FileType.Model )
|
if( fileType == FileType.Model )
|
||||||
{
|
{
|
||||||
return GameObjectInfo.DemiHuman( fileType, demiHumanId, equipId, slot );
|
return GameObjectInfo.DemiHuman( fileType, demiHumanId, equipId, slot );
|
||||||
|
|
@ -235,9 +236,9 @@ namespace Penumbra.Game
|
||||||
return GameObjectInfo.Customization( fileType, tmpType, id );
|
return GameObjectInfo.Customization( fileType, tmpType, id );
|
||||||
}
|
}
|
||||||
|
|
||||||
var gr = GameData.GenderRaceFromCode( groups[ "race" ].Value );
|
var gr = Penumbra.Game.Enums.GameData.GenderRaceFromCode( groups[ "race" ].Value );
|
||||||
var bodySlot = GameData.StringToBodySlot[ groups[ "type" ].Value ];
|
var bodySlot = Penumbra.Game.Enums.GameData.StringToBodySlot[ groups[ "type" ].Value ];
|
||||||
var type = groups[ "slot" ].Success ? GameData.SuffixToCustomizationType[ groups[ "slot" ].Value ] : CustomizationType.Skin;
|
var type = groups[ "slot" ].Success ? Penumbra.Game.Enums.GameData.SuffixToCustomizationType[ groups[ "slot" ].Value ] : CustomizationType.Skin;
|
||||||
if( fileType == FileType.Material )
|
if( fileType == FileType.Material )
|
||||||
{
|
{
|
||||||
var variant = byte.Parse( groups[ "variant" ].Value );
|
var variant = byte.Parse( groups[ "variant" ].Value );
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ using System.Linq;
|
||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
using Lumina.Excel.GeneratedSheets;
|
using Lumina.Excel.GeneratedSheets;
|
||||||
using Penumbra.Game.Enums;
|
using Penumbra.Game.Enums;
|
||||||
|
using Penumbra.GameData.Util;
|
||||||
using Penumbra.Util;
|
using Penumbra.Util;
|
||||||
using Action = Lumina.Excel.GeneratedSheets.Action;
|
using Action = Lumina.Excel.GeneratedSheets.Action;
|
||||||
using Race = Penumbra.Game.Enums.Race;
|
using Race = Penumbra.Game.Enums.Race;
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ using System.Text;
|
||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
using ICSharpCode.SharpZipLib.Zip;
|
using ICSharpCode.SharpZipLib.Zip;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Penumbra.GameData.Util;
|
||||||
using Penumbra.Importer.Models;
|
using Penumbra.Importer.Models;
|
||||||
using Penumbra.Mod;
|
using Penumbra.Mod;
|
||||||
using Penumbra.Structs;
|
using Penumbra.Structs;
|
||||||
|
|
@ -194,11 +195,12 @@ namespace Penumbra.Importer
|
||||||
|
|
||||||
public static DirectoryInfo CreateModFolder( DirectoryInfo outDirectory, string modListName )
|
public static DirectoryInfo CreateModFolder( DirectoryInfo outDirectory, string modListName )
|
||||||
{
|
{
|
||||||
var name = Path.GetFileName( modListName );
|
var name = Path.GetFileName( modListName );
|
||||||
if( !name.Any() )
|
if( !name.Any() )
|
||||||
{
|
{
|
||||||
name = "_";
|
name = "_";
|
||||||
}
|
}
|
||||||
|
|
||||||
var newModFolderBase = NewOptionDirectory( outDirectory, name );
|
var newModFolderBase = NewOptionDirectory( outDirectory, name );
|
||||||
var newModFolder = newModFolderBase;
|
var newModFolder = newModFolderBase;
|
||||||
var i = 2;
|
var i = 2;
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,11 @@ using Dalamud.Plugin;
|
||||||
using Lumina.Data.Files;
|
using Lumina.Data.Files;
|
||||||
using Penumbra.Game;
|
using Penumbra.Game;
|
||||||
using Penumbra.Game.Enums;
|
using Penumbra.Game.Enums;
|
||||||
|
using Penumbra.GameData.Util;
|
||||||
using Penumbra.Meta;
|
using Penumbra.Meta;
|
||||||
using Penumbra.Meta.Files;
|
using Penumbra.Meta.Files;
|
||||||
using Penumbra.Util;
|
using Penumbra.Util;
|
||||||
|
using static Penumbra.Game.Enums.GameData;
|
||||||
using GameData = Penumbra.Game.Enums.GameData;
|
using GameData = Penumbra.Game.Enums.GameData;
|
||||||
|
|
||||||
namespace Penumbra.Importer
|
namespace Penumbra.Importer
|
||||||
|
|
@ -112,14 +114,14 @@ namespace Penumbra.Importer
|
||||||
{
|
{
|
||||||
case ObjectType.Equipment:
|
case ObjectType.Equipment:
|
||||||
case ObjectType.Accessory:
|
case ObjectType.Accessory:
|
||||||
if( GameData.SuffixToEquipSlot.TryGetValue( match.Groups[ "Slot" ].Value, out var tmpSlot ) )
|
if( Penumbra.Game.Enums.GameData.SuffixToEquipSlot.TryGetValue( match.Groups[ "Slot" ].Value, out var tmpSlot ) )
|
||||||
{
|
{
|
||||||
EquipSlot = tmpSlot;
|
EquipSlot = tmpSlot;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ObjectType.Character:
|
case ObjectType.Character:
|
||||||
if( GameData.SuffixToCustomizationType.TryGetValue( match.Groups[ "Slot" ].Value, out var tmpCustom ) )
|
if( Penumbra.Game.Enums.GameData.SuffixToCustomizationType.TryGetValue( match.Groups[ "Slot" ].Value, out var tmpCustom ) )
|
||||||
{
|
{
|
||||||
CustomizationType = tmpCustom;
|
CustomizationType = tmpCustom;
|
||||||
}
|
}
|
||||||
|
|
@ -129,7 +131,7 @@ namespace Penumbra.Importer
|
||||||
}
|
}
|
||||||
|
|
||||||
if( match.Groups[ "SecondaryType" ].Success
|
if( match.Groups[ "SecondaryType" ].Success
|
||||||
&& GameData.StringToBodySlot.TryGetValue( match.Groups[ "SecondaryType" ].Value, out SecondaryType ) )
|
&& Penumbra.Game.Enums.GameData.StringToBodySlot.TryGetValue( match.Groups[ "SecondaryType" ].Value, out SecondaryType ) )
|
||||||
{
|
{
|
||||||
SecondaryId = ushort.Parse( match.Groups[ "SecondaryId" ].Value );
|
SecondaryId = ushort.Parse( match.Groups[ "SecondaryId" ].Value );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
|
using Penumbra.GameData.Util;
|
||||||
using Penumbra.Mods;
|
using Penumbra.Mods;
|
||||||
using Penumbra.Structs;
|
using Penumbra.Structs;
|
||||||
using Penumbra.Util;
|
using Penumbra.Util;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ using Lumina.Data;
|
||||||
using Lumina.Data.Files;
|
using Lumina.Data.Files;
|
||||||
using Penumbra.Game;
|
using Penumbra.Game;
|
||||||
using Penumbra.Game.Enums;
|
using Penumbra.Game.Enums;
|
||||||
|
using Penumbra.GameData.Util;
|
||||||
using Penumbra.Util;
|
using Penumbra.Util;
|
||||||
|
|
||||||
namespace Penumbra.Meta.Files
|
namespace Penumbra.Meta.Files
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using Penumbra.Game.Enums;
|
using Penumbra.Game.Enums;
|
||||||
|
using Penumbra.GameData.Util;
|
||||||
using Penumbra.Util;
|
using Penumbra.Util;
|
||||||
|
|
||||||
namespace Penumbra.Meta.Files
|
namespace Penumbra.Meta.Files
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
using Lumina.Data.Files;
|
using Lumina.Data.Files;
|
||||||
|
using Penumbra.GameData.Util;
|
||||||
using Penumbra.Interop;
|
using Penumbra.Interop;
|
||||||
using Penumbra.Meta.Files;
|
using Penumbra.Meta.Files;
|
||||||
using Penumbra.Util;
|
using Penumbra.Util;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ using System.Runtime.InteropServices;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Penumbra.Game;
|
using Penumbra.Game;
|
||||||
using Penumbra.Game.Enums;
|
using Penumbra.Game.Enums;
|
||||||
|
using Penumbra.GameData.Util;
|
||||||
using Penumbra.Meta.Files;
|
using Penumbra.Meta.Files;
|
||||||
using Penumbra.Util;
|
using Penumbra.Util;
|
||||||
using Swan;
|
using Swan;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using Penumbra.GameData.Util;
|
||||||
using Penumbra.Util;
|
using Penumbra.Util;
|
||||||
|
|
||||||
namespace Penumbra.Mod
|
namespace Penumbra.Mod
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Penumbra.GameData.Util;
|
||||||
using Penumbra.Meta;
|
using Penumbra.Meta;
|
||||||
using Penumbra.Util;
|
using Penumbra.Util;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
|
using Penumbra.GameData.Util;
|
||||||
using Penumbra.Structs;
|
using Penumbra.Structs;
|
||||||
using Penumbra.Util;
|
using Penumbra.Util;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Penumbra.GameData.Util;
|
||||||
using Penumbra.Structs;
|
using Penumbra.Structs;
|
||||||
using Penumbra.Util;
|
using Penumbra.Util;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Penumbra.GameData.Util;
|
||||||
using Penumbra.Structs;
|
using Penumbra.Structs;
|
||||||
using Penumbra.Util;
|
using Penumbra.Util;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Penumbra.GameData.Util;
|
||||||
using Penumbra.Interop;
|
using Penumbra.Interop;
|
||||||
using Penumbra.Mod;
|
using Penumbra.Mod;
|
||||||
using Penumbra.Util;
|
using Penumbra.Util;
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Penumbra.GameData.Util;
|
||||||
using Penumbra.Meta;
|
using Penumbra.Meta;
|
||||||
using Penumbra.Mod;
|
using Penumbra.Mod;
|
||||||
using Penumbra.Util;
|
using Penumbra.Util;
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
|
using Penumbra.GameData.Util;
|
||||||
using Penumbra.Meta;
|
using Penumbra.Meta;
|
||||||
using Penumbra.Mod;
|
using Penumbra.Mod;
|
||||||
using Penumbra.Util;
|
using Penumbra.Util;
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,10 @@
|
||||||
<PackageReference Include="SharpZipLib" Version="1.3.1" />
|
<PackageReference Include="SharpZipLib" Version="1.3.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Penumbra.GameData\Penumbra.GameData.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="Penumbra.json">
|
<None Update="Penumbra.json">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Penumbra.GameData.Util;
|
||||||
using Penumbra.Util;
|
using Penumbra.Util;
|
||||||
|
|
||||||
namespace Penumbra.Structs
|
namespace Penumbra.Structs
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ using Dalamud.Game.ClientState.Actors.Types;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
using Penumbra.Game;
|
using Penumbra.Game;
|
||||||
using Penumbra.Game.Enums;
|
using Penumbra.Game.Enums;
|
||||||
|
using Penumbra.GameData.Util;
|
||||||
using Penumbra.Interop;
|
using Penumbra.Interop;
|
||||||
using Penumbra.Meta;
|
using Penumbra.Meta;
|
||||||
using Penumbra.Mods;
|
using Penumbra.Mods;
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Dalamud.Interface;
|
using Dalamud.Interface;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
|
using Penumbra.GameData.Util;
|
||||||
using Penumbra.Meta;
|
using Penumbra.Meta;
|
||||||
using Penumbra.Mods;
|
using Penumbra.Mods;
|
||||||
using Penumbra.Util;
|
using Penumbra.Util;
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ using Dalamud.Interface;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
using Lumina.Excel.GeneratedSheets;
|
using Lumina.Excel.GeneratedSheets;
|
||||||
using Penumbra.Game.Enums;
|
using Penumbra.Game.Enums;
|
||||||
|
using Penumbra.GameData.Util;
|
||||||
using Penumbra.Meta;
|
using Penumbra.Meta;
|
||||||
using Penumbra.Mod;
|
using Penumbra.Mod;
|
||||||
using Penumbra.Mods;
|
using Penumbra.Mods;
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using Dalamud.Interface;
|
using Dalamud.Interface;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
|
using Penumbra.GameData.Util;
|
||||||
using Penumbra.Mods;
|
using Penumbra.Mods;
|
||||||
using Penumbra.Structs;
|
using Penumbra.Structs;
|
||||||
using Penumbra.Util;
|
using Penumbra.Util;
|
||||||
|
|
|
||||||
|
|
@ -742,7 +742,7 @@ namespace Penumbra.UI
|
||||||
CustomCombo( "Equipment Slot", EqdpEquipSlots, out var equipSlot, ref _newManipEquipSlot );
|
CustomCombo( "Equipment Slot", EqdpEquipSlots, out var equipSlot, ref _newManipEquipSlot );
|
||||||
CustomCombo( "Race", Races, out var race, ref _newManipRace );
|
CustomCombo( "Race", Races, out var race, ref _newManipRace );
|
||||||
CustomCombo( "Gender", Genders, out var gender, ref _newManipGender );
|
CustomCombo( "Gender", Genders, out var gender, ref _newManipGender );
|
||||||
newManip = MetaManipulation.Eqdp( equipSlot, GameData.CombinedRace( gender, race ), ( ushort )_newManipSetId,
|
newManip = MetaManipulation.Eqdp( equipSlot, Penumbra.Game.Enums.GameData.CombinedRace( gender, race ), ( ushort )_newManipSetId,
|
||||||
new EqdpEntry() );
|
new EqdpEntry() );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -771,7 +771,7 @@ namespace Penumbra.UI
|
||||||
|
|
||||||
CustomCombo( "Race", Races, out var race, ref _newManipRace );
|
CustomCombo( "Race", Races, out var race, ref _newManipRace );
|
||||||
CustomCombo( "Gender", Genders, out var gender, ref _newManipGender );
|
CustomCombo( "Gender", Genders, out var gender, ref _newManipGender );
|
||||||
newManip = MetaManipulation.Est( objectType, equipSlot, GameData.CombinedRace( gender, race ), bodySlot,
|
newManip = MetaManipulation.Est( objectType, equipSlot, Penumbra.Game.Enums.GameData.CombinedRace( gender, race ), bodySlot,
|
||||||
( ushort )_newManipSetId, 0 );
|
( ushort )_newManipSetId, 0 );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,105 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
|
|
||||||
namespace Penumbra.Util
|
|
||||||
{
|
|
||||||
public readonly struct GamePath : IComparable
|
|
||||||
{
|
|
||||||
public const int MaxGamePathLength = 256;
|
|
||||||
|
|
||||||
private readonly string _path;
|
|
||||||
|
|
||||||
private GamePath( string path, bool _ )
|
|
||||||
=> _path = path;
|
|
||||||
|
|
||||||
public GamePath( string? path )
|
|
||||||
{
|
|
||||||
if( path != null && path.Length < MaxGamePathLength )
|
|
||||||
{
|
|
||||||
_path = Lower( Trim( ReplaceSlash( path ) ) );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_path = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public GamePath( FileInfo file, DirectoryInfo baseDir )
|
|
||||||
=> _path = CheckPre( file, baseDir ) ? Lower( Trim( ReplaceSlash( Substring( file, baseDir ) ) ) ) : "";
|
|
||||||
|
|
||||||
private static bool CheckPre( FileInfo file, DirectoryInfo baseDir )
|
|
||||||
=> file.FullName.StartsWith( baseDir.FullName ) && file.FullName.Length < MaxGamePathLength;
|
|
||||||
|
|
||||||
private static string Substring( FileInfo file, DirectoryInfo baseDir )
|
|
||||||
=> file.FullName.Substring( baseDir.FullName.Length );
|
|
||||||
|
|
||||||
private static string ReplaceSlash( string path )
|
|
||||||
=> path.Replace( '\\', '/' );
|
|
||||||
|
|
||||||
private static string Trim( string path )
|
|
||||||
=> path.TrimStart( '/' );
|
|
||||||
|
|
||||||
private static string Lower( string path )
|
|
||||||
=> path.ToLowerInvariant();
|
|
||||||
|
|
||||||
public static GamePath GenerateUnchecked( string path )
|
|
||||||
=> new( path, true );
|
|
||||||
|
|
||||||
public static GamePath GenerateUncheckedLower( string path )
|
|
||||||
=> new( Lower( path ), true );
|
|
||||||
|
|
||||||
public static implicit operator string( GamePath gamePath )
|
|
||||||
=> gamePath._path;
|
|
||||||
|
|
||||||
public static explicit operator GamePath( string gamePath )
|
|
||||||
=> new( gamePath );
|
|
||||||
|
|
||||||
public bool Empty
|
|
||||||
=> _path.Length == 0;
|
|
||||||
|
|
||||||
public string Filename()
|
|
||||||
{
|
|
||||||
var idx = _path.LastIndexOf( "/", StringComparison.Ordinal );
|
|
||||||
return idx == -1 ? _path : idx == _path.Length - 1 ? "" : _path.Substring( idx + 1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
public int CompareTo( object rhs )
|
|
||||||
{
|
|
||||||
return rhs switch
|
|
||||||
{
|
|
||||||
string path => string.Compare( _path, path, StringComparison.InvariantCulture ),
|
|
||||||
GamePath path => string.Compare( _path, path._path, StringComparison.InvariantCulture ),
|
|
||||||
_ => -1,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
=> _path;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class GamePathConverter : JsonConverter
|
|
||||||
{
|
|
||||||
public override bool CanConvert( Type objectType )
|
|
||||||
=> objectType == typeof( GamePath );
|
|
||||||
|
|
||||||
public override object ReadJson( JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer )
|
|
||||||
{
|
|
||||||
var token = JToken.Load( reader );
|
|
||||||
return token.ToObject< GamePath >();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool CanWrite
|
|
||||||
=> true;
|
|
||||||
|
|
||||||
public override void WriteJson( JsonWriter writer, object? value, JsonSerializer serializer )
|
|
||||||
{
|
|
||||||
if( value != null )
|
|
||||||
{
|
|
||||||
var v = ( GamePath )value;
|
|
||||||
serializer.Serialize( writer, v.ToString() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using Penumbra.GameData.Util;
|
||||||
|
|
||||||
namespace Penumbra.Util
|
namespace Penumbra.Util
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue