This is going rather well.

This commit is contained in:
Ottermandias 2023-03-11 17:50:32 +01:00
parent 73e2793da6
commit bdaff7b781
48 changed files with 2944 additions and 2952 deletions

View file

@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
@ -29,45 +28,10 @@ using Penumbra.Mods;
using CharacterUtility = Penumbra.Interop.CharacterUtility;
using DalamudUtil = Dalamud.Utility.Util;
using ResidentResourceManager = Penumbra.Interop.ResidentResourceManager;
using Penumbra.Services;
namespace Penumbra;
public class PenumbraNew
{
public string Name
=> "Penumbra";
public static readonly Logger Log = new();
public readonly StartTimeTracker< StartTimeType > StartTimer = new();
public readonly IServiceCollection Services = new ServiceCollection();
public PenumbraNew( DalamudPluginInterface pi )
{
using var time = StartTimer.Measure( StartTimeType.Total );
// Add meta services.
Services.AddSingleton( Log );
Services.AddSingleton( StartTimer );
Services.AddSingleton< ValidityChecker >();
Services.AddSingleton< PerformanceTracker< PerformanceType > >();
// Add Dalamud services
var dalamud = new DalamudServices( pi );
dalamud.AddServices( Services );
// Add Game Data
// Add Configuration
Services.AddSingleton< Configuration >();
}
public void Dispose()
{ }
}
public class Penumbra : IDalamudPlugin
{
public string Name
@ -76,135 +40,123 @@ public class Penumbra : IDalamudPlugin
public static readonly string Version = Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? string.Empty;
public static readonly string CommitHash =
Assembly.GetExecutingAssembly().GetCustomAttribute< AssemblyInformationalVersionAttribute >()?.InformationalVersion ?? "Unknown";
Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? "Unknown";
public static Logger Log { get; private set; } = null!;
public static Logger Log { get; private set; } = null!;
public static Configuration Config { get; private set; } = null!;
public static ResidentResourceManager ResidentResources { get; private set; } = null!;
public static CharacterUtility CharacterUtility { get; private set; } = null!;
public static GameEventManager GameEvents { get; private set; } = null!;
public static MetaFileManager MetaFileManager { get; private set; } = null!;
public static Mod.Manager ModManager { get; private set; } = null!;
public static ModCollection.Manager CollectionManager { get; private set; } = null!;
public static TempModManager TempMods { get; private set; } = null!;
public static ResourceLoader ResourceLoader { get; private set; } = null!;
public static FrameworkManager Framework { get; private set; } = null!;
public static ActorManager Actors { get; private set; } = null!;
public static IObjectIdentifier Identifier { get; private set; } = null!;
public static IGamePathParser GamePathParser { get; private set; } = null!;
public static StainManager StainManager { get; private set; } = null!;
public static CharacterUtility CharacterUtility { get; private set; } = null!;
public static GameEventManager GameEvents { get; private set; } = null!;
public static MetaFileManager MetaFileManager { get; private set; } = null!;
public static Mod.Manager ModManager { get; private set; } = null!;
public static ModCollection.Manager CollectionManager { get; private set; } = null!;
public static TempCollectionManager TempCollections { get; private set; } = null!;
public static TempModManager TempMods { get; private set; } = null!;
public static ResourceLoader ResourceLoader { get; private set; } = null!;
public static FrameworkManager Framework { get; private set; } = null!;
public static ActorManager Actors { get; private set; } = null!;
public static IObjectIdentifier Identifier { get; private set; } = null!;
public static IGamePathParser GamePathParser { get; private set; } = null!;
public static StainService StainService { get; private set; } = null!;
// TODO
public static DalamudServices Dalamud { get; private set; } = null!;
public static ValidityChecker ValidityChecker { get; private set; } = null!;
public static PerformanceTracker< PerformanceType > Performance { get; private set; } = null!;
public static PerformanceTracker Performance { get; private set; } = null!;
public static readonly StartTimeTracker< StartTimeType > StartTimer = new();
public readonly PathResolver PathResolver;
public readonly ObjectReloader ObjectReloader;
public readonly ModFileSystem ModFileSystem;
public readonly PenumbraApi Api;
public readonly HttpApi HttpApi;
public readonly PenumbraIpcProviders IpcProviders;
internal ConfigWindow? ConfigWindow { get; private set; }
private LaunchButton? _launchButton;
private WindowSystem? _windowSystem;
private Changelog? _changelog;
private CommandHandler? _commandHandler;
private readonly ResourceWatcher _resourceWatcher;
private bool _disposed;
public readonly ResourceLogger ResourceLogger;
public readonly PathResolver PathResolver;
public readonly ObjectReloader ObjectReloader;
public readonly ModFileSystem ModFileSystem;
public readonly PenumbraApi Api;
public readonly HttpApi HttpApi;
public readonly PenumbraIpcProviders IpcProviders;
internal ConfigWindow? ConfigWindow { get; private set; }
private LaunchButton? _launchButton;
private WindowSystem? _windowSystem;
private Changelog? _changelog;
private CommandHandler? _commandHandler;
private readonly ResourceWatcher _resourceWatcher;
private bool _disposed;
private readonly PenumbraNew _tmp;
public static ItemData ItemData { get; private set; } = null!;
public static ItemData ItemData { get; private set; } = null!;
public Penumbra( DalamudPluginInterface pluginInterface )
public Penumbra(DalamudPluginInterface pluginInterface)
{
using var time = StartTimer.Measure( StartTimeType.Total );
Log = PenumbraNew.Log;
_tmp = new PenumbraNew(pluginInterface);
Performance = _tmp.Services.GetRequiredService<PerformanceTracker>();
ValidityChecker = _tmp.Services.GetRequiredService<ValidityChecker>();
_tmp.Services.GetRequiredService<BackupService>();
Config = _tmp.Services.GetRequiredService<Configuration>();
CharacterUtility = _tmp.Services.GetRequiredService<CharacterUtility>();
GameEvents = _tmp.Services.GetRequiredService<GameEventManager>();
MetaFileManager = _tmp.Services.GetRequiredService<MetaFileManager>();
Framework = _tmp.Services.GetRequiredService<FrameworkManager>();
Actors = _tmp.Services.GetRequiredService<ActorService>().AwaitedService;
Identifier = _tmp.Services.GetRequiredService<IdentifierService>().AwaitedService;
GamePathParser = _tmp.Services.GetRequiredService<IGamePathParser>();
StainService = _tmp.Services.GetRequiredService<StainService>();
ItemData = _tmp.Services.GetRequiredService<ItemService>().AwaitedService;
Dalamud = _tmp.Services.GetRequiredService<DalamudServices>();
TempMods = _tmp.Services.GetRequiredService<TempModManager>();
try
{
DalamudServices.Initialize( pluginInterface );
Performance = new PerformanceTracker< PerformanceType >( DalamudServices.Framework );
Log = new Logger();
ValidityChecker = new ValidityChecker( DalamudServices.PluginInterface );
GameEvents = new GameEventManager();
StartTimer.Measure( StartTimeType.Identifier, () => Identifier = GameData.GameData.GetIdentifier( DalamudServices.PluginInterface, DalamudServices.GameData ) );
StartTimer.Measure( StartTimeType.GamePathParser, () => GamePathParser = GameData.GameData.GetGamePathParser() );
StartTimer.Measure( StartTimeType.Stains, () => StainManager = new StainManager( DalamudServices.PluginInterface, DalamudServices.GameData ) );
ItemData = StartTimer.Measure( StartTimeType.Items,
() => new ItemData( DalamudServices.PluginInterface, DalamudServices.GameData, DalamudServices.GameData.Language ) );
StartTimer.Measure( StartTimeType.Actors,
() => Actors = new ActorManager( DalamudServices.PluginInterface, DalamudServices.Objects, DalamudServices.ClientState, DalamudServices.Framework,
DalamudServices.GameData, DalamudServices.GameGui,
ResolveCutscene ) );
Framework = new FrameworkManager( DalamudServices.Framework, Log );
CharacterUtility = new CharacterUtility();
StartTimer.Measure( StartTimeType.Backup, () => Backup.CreateBackup( pluginInterface.ConfigDirectory, PenumbraBackupFiles() ) );
Config = Configuration.Load();
TempMods = new TempModManager();
MetaFileManager = new MetaFileManager();
ResourceLoader = new ResourceLoader( this );
ResourceLoader = new ResourceLoader(this);
ResourceLoader.EnableHooks();
_resourceWatcher = new ResourceWatcher( ResourceLoader );
ResourceLogger = new ResourceLogger( ResourceLoader );
_resourceWatcher = new ResourceWatcher(ResourceLoader);
ResidentResources = new ResidentResourceManager();
StartTimer.Measure( StartTimeType.Mods, () =>
_tmp.Services.GetRequiredService<StartTracker>().Measure(StartTimeType.Mods, () =>
{
ModManager = new Mod.Manager( Config.ModDirectory );
ModManager = new Mod.Manager(Config.ModDirectory);
ModManager.DiscoverMods();
} );
});
StartTimer.Measure( StartTimeType.Collections, () =>
_tmp.Services.GetRequiredService<StartTracker>().Measure(StartTimeType.Collections, () =>
{
CollectionManager = new ModCollection.Manager( ModManager );
CollectionManager = new ModCollection.Manager(_tmp.Services.GetRequiredService<CommunicatorService>(), ModManager);
CollectionManager.CreateNecessaryCaches();
} );
});
TempCollections = _tmp.Services.GetRequiredService<TempCollectionManager>();
ModFileSystem = ModFileSystem.Load();
ObjectReloader = new ObjectReloader();
PathResolver = new PathResolver( ResourceLoader );
PathResolver = new PathResolver(_tmp.Services.GetRequiredService<StartTracker>(), _tmp.Services.GetRequiredService<CommunicatorService>(), _tmp.Services.GetRequiredService<GameEventManager>(), ResourceLoader);
SetupInterface();
if( Config.EnableMods )
if (Config.EnableMods)
{
ResourceLoader.EnableReplacements();
PathResolver.Enable();
}
if( Config.DebugMode )
{
if (Config.DebugMode)
ResourceLoader.EnableDebug();
}
using( var tApi = StartTimer.Measure( StartTimeType.Api ) )
using (var tApi = _tmp.Services.GetRequiredService<StartTracker>().Measure(StartTimeType.Api))
{
Api = new PenumbraApi( this );
IpcProviders = new PenumbraIpcProviders( DalamudServices.PluginInterface, Api );
HttpApi = new HttpApi( Api );
if( Config.EnableHttpApi )
{
Api = new PenumbraApi(_tmp.Services.GetRequiredService<CommunicatorService>(), this);
IpcProviders = new PenumbraIpcProviders(DalamudServices.PluginInterface, Api);
HttpApi = new HttpApi(Api);
if (Config.EnableHttpApi)
HttpApi.CreateWebServer();
}
SubscribeItemLinks();
}
ValidityChecker.LogExceptions();
Log.Information( $"Penumbra Version {Version}, Commit #{CommitHash} successfully Loaded from {pluginInterface.SourceRepository}." );
OtterTex.NativeDll.Initialize( DalamudServices.PluginInterface.AssemblyLocation.DirectoryName );
Log.Information( $"Loading native OtterTex assembly from {OtterTex.NativeDll.Directory}." );
Log.Information($"Penumbra Version {Version}, Commit #{CommitHash} successfully Loaded from {pluginInterface.SourceRepository}.");
OtterTex.NativeDll.Initialize(DalamudServices.PluginInterface.AssemblyLocation.DirectoryName);
Log.Information($"Loading native OtterTex assembly from {OtterTex.NativeDll.Directory}.");
if( CharacterUtility.Ready )
{
if (CharacterUtility.Ready)
ResidentResources.Reload();
}
}
catch
{
@ -215,21 +167,22 @@ public class Penumbra : IDalamudPlugin
private void SetupInterface()
{
Task.Run( () =>
Task.Run(() =>
{
using var tInterface = StartTimer.Measure( StartTimeType.Interface );
using var tInterface = _tmp.Services.GetRequiredService<StartTracker>().Measure(StartTimeType.Interface);
var changelog = ConfigWindow.CreateChangelog();
var cfg = new ConfigWindow( this, _resourceWatcher )
var cfg = new ConfigWindow(_tmp.Services.GetRequiredService<CommunicatorService>(), _tmp.Services.GetRequiredService<StartTracker>(), this, _resourceWatcher)
{
IsOpen = Config.DebugMode,
};
var btn = new LaunchButton( cfg );
var system = new WindowSystem( Name );
var cmd = new CommandHandler( DalamudServices.Commands, ObjectReloader, Config, this, cfg, ModManager, CollectionManager, Actors );
system.AddWindow( cfg );
system.AddWindow( cfg.ModEditPopup );
system.AddWindow( changelog );
if( !_disposed )
var btn = new LaunchButton(cfg);
var system = new WindowSystem(Name);
var cmd = new CommandHandler(DalamudServices.Commands, ObjectReloader, Config, this, cfg, ModManager, CollectionManager,
Actors);
system.AddWindow(cfg);
system.AddWindow(cfg.ModEditPopup);
system.AddWindow(changelog);
if (!_disposed)
{
_changelog = changelog;
ConfigWindow = cfg;
@ -251,100 +204,87 @@ public class Penumbra : IDalamudPlugin
private void DisposeInterface()
{
if( _windowSystem != null )
{
if (_windowSystem != null)
DalamudServices.PluginInterface.UiBuilder.Draw -= _windowSystem.Draw;
}
_launchButton?.Dispose();
if( ConfigWindow != null )
if (ConfigWindow != null)
{
DalamudServices.PluginInterface.UiBuilder.OpenConfigUi -= ConfigWindow.Toggle;
ConfigWindow.Dispose();
}
}
public event Action< bool >? EnabledChange;
public event Action<bool>? EnabledChange;
public bool SetEnabled( bool enabled )
public bool SetEnabled(bool enabled)
{
if( enabled == Config.EnableMods )
{
if (enabled == Config.EnableMods)
return false;
}
Config.EnableMods = enabled;
if( enabled )
if (enabled)
{
ResourceLoader.EnableReplacements();
PathResolver.Enable();
if( CharacterUtility.Ready )
if (CharacterUtility.Ready)
{
CollectionManager.Default.SetFiles();
ResidentResources.Reload();
ObjectReloader.RedrawAll( RedrawType.Redraw );
ObjectReloader.RedrawAll(RedrawType.Redraw);
}
}
else
{
ResourceLoader.DisableReplacements();
PathResolver.Disable();
if( CharacterUtility.Ready )
if (CharacterUtility.Ready)
{
CharacterUtility.ResetAll();
ResidentResources.Reload();
ObjectReloader.RedrawAll( RedrawType.Redraw );
ObjectReloader.RedrawAll(RedrawType.Redraw);
}
}
Config.Save();
EnabledChange?.Invoke( enabled );
EnabledChange?.Invoke(enabled);
return true;
}
public void ForceChangelogOpen()
{
if( _changelog != null )
{
if (_changelog != null)
_changelog.ForceOpen = true;
}
}
private void SubscribeItemLinks()
{
Api.ChangedItemTooltip += it =>
{
if( it is Item )
{
ImGui.TextUnformatted( "Left Click to create an item link in chat." );
}
if (it is Item)
ImGui.TextUnformatted("Left Click to create an item link in chat.");
};
Api.ChangedItemClicked += ( button, it ) =>
Api.ChangedItemClicked += (button, it) =>
{
if( button == MouseButton.Left && it is Item item )
{
ChatUtil.LinkItem( item );
}
if (button == MouseButton.Left && it is Item item)
ChatUtil.LinkItem(item);
};
}
private short ResolveCutscene( ushort index )
=> ( short )PathResolver.CutsceneActor( index );
}
public void Dispose()
{
if( _disposed )
{
if (_disposed)
return;
}
// TODO
_tmp?.Dispose();
_disposed = true;
HttpApi?.Dispose();
IpcProviders?.Dispose();
Api?.Dispose();
_commandHandler?.Dispose();
StainManager?.Dispose();
StainService?.Dispose();
ItemData?.Dispose();
Actors?.Dispose();
Identifier?.Dispose();
@ -354,99 +294,85 @@ public class Penumbra : IDalamudPlugin
ModFileSystem?.Dispose();
CollectionManager?.Dispose();
PathResolver?.Dispose();
ResourceLogger?.Dispose();
_resourceWatcher?.Dispose();
ResourceLoader?.Dispose();
GameEvents?.Dispose();
CharacterUtility?.Dispose();
Performance?.Dispose();
Performance?.Dispose();
}
// Collect all relevant files for penumbra configuration.
private static IReadOnlyList< FileInfo > PenumbraBackupFiles()
public string GatherSupportInformation()
{
var collectionDir = ModCollection.CollectionDirectory;
var list = Directory.Exists( collectionDir )
? new DirectoryInfo( collectionDir ).EnumerateFiles( "*.json" ).ToList()
: new List< FileInfo >();
list.AddRange( Mod.LocalDataDirectory.Exists ? Mod.LocalDataDirectory.EnumerateFiles( "*.json" ) : Enumerable.Empty< FileInfo >() );
list.Add( DalamudServices.PluginInterface.ConfigFile );
list.Add( new FileInfo( ModFileSystem.ModFileSystemFile ) );
list.Add( new FileInfo( ModCollection.Manager.ActiveCollectionFile ) );
return list;
}
public static string GatherSupportInformation()
{
var sb = new StringBuilder( 10240 );
var exists = Config.ModDirectory.Length > 0 && Directory.Exists( Config.ModDirectory );
var drive = exists ? new DriveInfo( new DirectoryInfo( Config.ModDirectory ).Root.FullName ) : null;
sb.AppendLine( "**Settings**" );
sb.Append( $"> **`Plugin Version: `** {Version}\n" );
sb.Append( $"> **`Commit Hash: `** {CommitHash}\n" );
sb.Append( $"> **`Enable Mods: `** {Config.EnableMods}\n" );
sb.Append( $"> **`Enable HTTP API: `** {Config.EnableHttpApi}\n" );
sb.Append( $"> **`Operating System: `** {( DalamudUtil.IsLinux() ? "Mac/Linux (Wine)" : "Windows" )}\n" );
sb.Append( $"> **`Root Directory: `** `{Config.ModDirectory}`, {( exists ? "Exists" : "Not Existing" )}\n" );
sb.Append( $"> **`Free Drive Space: `** {( drive != null ? Functions.HumanReadableSize( drive.AvailableFreeSpace ) : "Unknown" )}\n" );
sb.Append( $"> **`Auto-Deduplication: `** {Config.AutoDeduplicateOnImport}\n" );
sb.Append( $"> **`Debug Mode: `** {Config.DebugMode}\n" );
var sb = new StringBuilder(10240);
var exists = Config.ModDirectory.Length > 0 && Directory.Exists(Config.ModDirectory);
var drive = exists ? new DriveInfo(new DirectoryInfo(Config.ModDirectory).Root.FullName) : null;
sb.AppendLine("**Settings**");
sb.Append($"> **`Plugin Version: `** {Version}\n");
sb.Append($"> **`Commit Hash: `** {CommitHash}\n");
sb.Append($"> **`Enable Mods: `** {Config.EnableMods}\n");
sb.Append($"> **`Enable HTTP API: `** {Config.EnableHttpApi}\n");
sb.Append($"> **`Operating System: `** {(DalamudUtil.IsLinux() ? "Mac/Linux (Wine)" : "Windows")}\n");
sb.Append($"> **`Root Directory: `** `{Config.ModDirectory}`, {(exists ? "Exists" : "Not Existing")}\n");
sb.Append(
$"> **`Synchronous Load (Dalamud): `** {( DalamudServices.GetDalamudConfig( DalamudServices.WaitingForPluginsOption, out bool v ) ? v.ToString() : "Unknown" )}\n" );
sb.Append( $"> **`Logging: `** Log: {Config.EnableResourceLogging}, Watcher: {Config.EnableResourceWatcher} ({Config.MaxResourceWatcherRecords})\n" );
sb.Append( $"> **`Use Ownership: `** {Config.UseOwnerNameForCharacterCollection}\n" );
sb.AppendLine( "**Mods**" );
sb.Append( $"> **`Installed Mods: `** {ModManager.Count}\n" );
sb.Append( $"> **`Mods with Config: `** {ModManager.Count( m => m.HasOptions )}\n" );
sb.Append( $"> **`Mods with File Redirections: `** {ModManager.Count( m => m.TotalFileCount > 0 )}, Total: {ModManager.Sum( m => m.TotalFileCount )}\n" );
sb.Append( $"> **`Mods with FileSwaps: `** {ModManager.Count( m => m.TotalSwapCount > 0 )}, Total: {ModManager.Sum( m => m.TotalSwapCount )}\n" );
sb.Append( $"> **`Mods with Meta Manipulations:`** {ModManager.Count( m => m.TotalManipulations > 0 )}, Total {ModManager.Sum( m => m.TotalManipulations )}\n" );
sb.Append( $"> **`IMC Exceptions Thrown: `** {ValidityChecker.ImcExceptions.Count}\n" );
sb.Append( $"> **`#Temp Mods: `** {TempMods.Mods.Sum( kvp => kvp.Value.Count ) + TempMods.ModsForAllCollections.Count}\n" );
$"> **`Free Drive Space: `** {(drive != null ? Functions.HumanReadableSize(drive.AvailableFreeSpace) : "Unknown")}\n");
sb.Append($"> **`Auto-Deduplication: `** {Config.AutoDeduplicateOnImport}\n");
sb.Append($"> **`Debug Mode: `** {Config.DebugMode}\n");
sb.Append(
$"> **`Synchronous Load (Dalamud): `** {(_tmp.Services.GetRequiredService<DalamudServices>().GetDalamudConfig(DalamudServices.WaitingForPluginsOption, out bool v) ? v.ToString() : "Unknown")}\n");
sb.Append(
$"> **`Logging: `** Log: {Config.EnableResourceLogging}, Watcher: {Config.EnableResourceWatcher} ({Config.MaxResourceWatcherRecords})\n");
sb.Append($"> **`Use Ownership: `** {Config.UseOwnerNameForCharacterCollection}\n");
sb.AppendLine("**Mods**");
sb.Append($"> **`Installed Mods: `** {ModManager.Count}\n");
sb.Append($"> **`Mods with Config: `** {ModManager.Count(m => m.HasOptions)}\n");
sb.Append(
$"> **`Mods with File Redirections: `** {ModManager.Count(m => m.TotalFileCount > 0)}, Total: {ModManager.Sum(m => m.TotalFileCount)}\n");
sb.Append(
$"> **`Mods with FileSwaps: `** {ModManager.Count(m => m.TotalSwapCount > 0)}, Total: {ModManager.Sum(m => m.TotalSwapCount)}\n");
sb.Append(
$"> **`Mods with Meta Manipulations:`** {ModManager.Count(m => m.TotalManipulations > 0)}, Total {ModManager.Sum(m => m.TotalManipulations)}\n");
sb.Append($"> **`IMC Exceptions Thrown: `** {ValidityChecker.ImcExceptions.Count}\n");
sb.Append(
$"> **`#Temp Mods: `** {TempMods.Mods.Sum(kvp => kvp.Value.Count) + TempMods.ModsForAllCollections.Count}\n");
string CharacterName( ActorIdentifier id, string name )
string CharacterName(ActorIdentifier id, string name)
{
if( id.Type is IdentifierType.Player or IdentifierType.Owned )
if (id.Type is IdentifierType.Player or IdentifierType.Owned)
{
var parts = name.Split( ' ', 3 );
return string.Join( " ", parts.Length != 3 ? parts.Select( n => $"{n[ 0 ]}." ) : parts[ ..2 ].Select( n => $"{n[ 0 ]}." ).Append( parts[ 2 ] ) );
var parts = name.Split(' ', 3);
return string.Join(" ",
parts.Length != 3 ? parts.Select(n => $"{n[0]}.") : parts[..2].Select(n => $"{n[0]}.").Append(parts[2]));
}
return name + ':';
}
void PrintCollection( ModCollection c )
=> sb.Append( $"**Collection {c.AnonymizedName}**\n"
void PrintCollection(ModCollection c)
=> sb.Append($"**Collection {c.AnonymizedName}**\n"
+ $"> **`Inheritances: `** {c.Inheritance.Count}\n"
+ $"> **`Enabled Mods: `** {c.ActualSettings.Count( s => s is { Enabled: true } )}\n"
+ $"> **`Conflicts (Solved/Total): `** {c.AllConflicts.SelectMany( x => x ).Sum( x => x.HasPriority ? 0 : x.Conflicts.Count )}/{c.AllConflicts.SelectMany( x => x ).Sum( x => x.HasPriority || !x.Solved ? 0 : x.Conflicts.Count )}\n" );
+ $"> **`Enabled Mods: `** {c.ActualSettings.Count(s => s is { Enabled: true })}\n"
+ $"> **`Conflicts (Solved/Total): `** {c.AllConflicts.SelectMany(x => x).Sum(x => x.HasPriority ? 0 : x.Conflicts.Count)}/{c.AllConflicts.SelectMany(x => x).Sum(x => x.HasPriority || !x.Solved ? 0 : x.Conflicts.Count)}\n");
sb.AppendLine( "**Collections**" );
sb.Append( $"> **`#Collections: `** {CollectionManager.Count - 1}\n" );
sb.Append( $"> **`#Temp Collections: `** {TempMods.CustomCollections.Count}\n" );
sb.Append( $"> **`Active Collections: `** {CollectionManager.Count( c => c.HasCache )}\n" );
sb.Append( $"> **`Base Collection: `** {CollectionManager.Default.AnonymizedName}\n" );
sb.Append( $"> **`Interface Collection: `** {CollectionManager.Interface.AnonymizedName}\n" );
sb.Append( $"> **`Selected Collection: `** {CollectionManager.Current.AnonymizedName}\n" );
foreach( var (type, name, _) in CollectionTypeExtensions.Special )
sb.AppendLine("**Collections**");
sb.Append($"> **`#Collections: `** {CollectionManager.Count - 1}\n");
sb.Append($"> **`#Temp Collections: `** {TempCollections.Count}\n");
sb.Append($"> **`Active Collections: `** {CollectionManager.Count(c => c.HasCache)}\n");
sb.Append($"> **`Base Collection: `** {CollectionManager.Default.AnonymizedName}\n");
sb.Append($"> **`Interface Collection: `** {CollectionManager.Interface.AnonymizedName}\n");
sb.Append($"> **`Selected Collection: `** {CollectionManager.Current.AnonymizedName}\n");
foreach (var (type, name, _) in CollectionTypeExtensions.Special)
{
var collection = CollectionManager.ByType( type );
if( collection != null )
{
sb.Append( $"> **`{name,-30}`** {collection.AnonymizedName}\n" );
}
var collection = CollectionManager.ByType(type);
if (collection != null)
sb.Append($"> **`{name,-30}`** {collection.AnonymizedName}\n");
}
foreach( var (name, id, collection) in CollectionManager.Individuals.Assignments )
{
sb.Append( $"> **`{CharacterName( id[ 0 ], name ),-30}`** {collection.AnonymizedName}\n" );
}
foreach (var (name, id, collection) in CollectionManager.Individuals.Assignments)
sb.Append($"> **`{CharacterName(id[0], name),-30}`** {collection.AnonymizedName}\n");
foreach( var collection in CollectionManager.Where( c => c.HasCache ) )
{
PrintCollection( collection );
}
foreach (var collection in CollectionManager.Where(c => c.HasCache))
PrintCollection(collection);
return sb.ToString();
}
}
}