mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-31 12:53:47 +01:00
Added object identification for equipment, weapons, action/animations and character customizations. Added mod filtering for changed items and authors. A bunch of bugfixes.
This commit is contained in:
parent
61be374b67
commit
2ff98f2338
21 changed files with 563 additions and 160 deletions
|
|
@ -1,5 +1,9 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Dalamud.Plugin;
|
||||
using Penumbra.Game;
|
||||
using Penumbra.Util;
|
||||
|
||||
namespace Penumbra.Mod
|
||||
{
|
||||
|
|
@ -12,7 +16,7 @@ namespace Penumbra.Mod
|
|||
public ModMeta Meta;
|
||||
public ModResources Resources;
|
||||
public string SortOrder;
|
||||
|
||||
public SortedList< string, object? > ChangedItems { get; } = new();
|
||||
public FileInfo MetaFile { get; set; }
|
||||
|
||||
private ModData( DirectoryInfo basePath, ModMeta meta, ModResources resources )
|
||||
|
|
@ -22,6 +26,26 @@ namespace Penumbra.Mod
|
|||
Resources = resources;
|
||||
MetaFile = MetaFileInfo( basePath );
|
||||
SortOrder = meta.Name;
|
||||
ComputeChangedItems();
|
||||
}
|
||||
|
||||
public void ComputeChangedItems()
|
||||
{
|
||||
var ident = Service< ObjectIdentification >.Get();
|
||||
|
||||
ChangedItems.Clear();
|
||||
foreach( var file in Resources.ModFiles.Select( f => new RelPath( f, BasePath ) ) )
|
||||
{
|
||||
foreach( var path in ModFunctions.GetAllFiles( file, Meta ) )
|
||||
{
|
||||
ident.Identify( ChangedItems, path );
|
||||
}
|
||||
}
|
||||
|
||||
foreach( var path in Meta.FileSwaps.Keys )
|
||||
{
|
||||
ident.Identify( ChangedItems, path );
|
||||
}
|
||||
}
|
||||
|
||||
public static FileInfo MetaFileInfo( DirectoryInfo basePath )
|
||||
|
|
|
|||
|
|
@ -39,6 +39,25 @@ namespace Penumbra.Mod
|
|||
return files;
|
||||
}
|
||||
|
||||
public static HashSet< GamePath > GetAllFiles( RelPath relPath, ModMeta meta )
|
||||
{
|
||||
var ret = new HashSet< GamePath >();
|
||||
foreach( var option in meta.Groups.Values.SelectMany( g => g.Options ) )
|
||||
{
|
||||
if( option.OptionFiles.TryGetValue( relPath, out var files ) )
|
||||
{
|
||||
ret.UnionWith( files );
|
||||
}
|
||||
}
|
||||
|
||||
if( ret.Count == 0 )
|
||||
{
|
||||
ret.Add( new GamePath( relPath, 0 ) );
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static ModSettings ConvertNamedSettings( NamedModSettings namedSettings, ModMeta meta )
|
||||
{
|
||||
ModSettings ret = new()
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ namespace Penumbra.Mod
|
|||
public string Description { get; set; } = "";
|
||||
public string Version { get; set; } = "";
|
||||
public string Website { get; set; } = "";
|
||||
public List< string > ChangedItems { get; set; } = new();
|
||||
|
||||
[JsonProperty( ItemConverterType = typeof( GamePathConverter ) )]
|
||||
public Dictionary< GamePath, GamePath > FileSwaps { get; set; } = new();
|
||||
|
|
@ -50,7 +49,6 @@ namespace Penumbra.Mod
|
|||
Description = newMeta.Description;
|
||||
Version = newMeta.Version;
|
||||
Website = newMeta.Website;
|
||||
ChangedItems = newMeta.ChangedItems;
|
||||
FileSwaps = newMeta.FileSwaps;
|
||||
Groups = newMeta.Groups;
|
||||
FileHash = newMeta.FileHash;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@ namespace Penumbra.Mod
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Update the current set of files used by the mod,
|
||||
// returns true if anything changed.
|
||||
public ResourceChange RefreshModFiles( DirectoryInfo basePath )
|
||||
|
|
@ -70,13 +69,13 @@ namespace Penumbra.Mod
|
|||
}
|
||||
|
||||
ResourceChange changes = 0;
|
||||
if( !tmpFiles.SequenceEqual( ModFiles ) )
|
||||
if( !tmpFiles.Select( f => f.FullName ).SequenceEqual( ModFiles.Select( f => f.FullName ) ) )
|
||||
{
|
||||
ModFiles = tmpFiles;
|
||||
changes |= ResourceChange.Files;
|
||||
}
|
||||
|
||||
if( !tmpMetas.SequenceEqual( MetaFiles ) )
|
||||
if( !tmpMetas.Select( f => f.FullName ).SequenceEqual( MetaFiles.Select( f => f.FullName ) ) )
|
||||
{
|
||||
MetaFiles = tmpMetas;
|
||||
changes |= ResourceChange.Meta;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue