mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
add GetPlayerMetaManipulations
This commit is contained in:
parent
78bb869e67
commit
b9ae348529
3 changed files with 42 additions and 18 deletions
|
|
@ -137,6 +137,10 @@ public interface IPenumbraApi : IPenumbraApiBase
|
|||
// Note that success does only imply a successful call, not a successful mod load.
|
||||
public PenumbraApiEc AddMod( string modDirectory );
|
||||
|
||||
// Obtain a base64 encoded, zipped json-string with a prepended version-byte of the current manipulations
|
||||
// for the collection currently associated with the player.
|
||||
public string GetPlayerMetaManipulations();
|
||||
|
||||
// Obtain a base64 encoded, zipped json-string with a prepended version-byte of the current manipulations
|
||||
// for the given collection associated with the character name, or the default collection.
|
||||
public string GetMetaManipulations( string characterName );
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ namespace Penumbra.Api;
|
|||
public class PenumbraApi : IDisposable, IPenumbraApi
|
||||
{
|
||||
public (int, int) ApiVersion
|
||||
=> ( 4, 10 );
|
||||
=> ( 4, 11 );
|
||||
|
||||
private Penumbra? _penumbra;
|
||||
private Lumina.GameData? _lumina;
|
||||
|
|
@ -54,8 +54,8 @@ public class PenumbraApi : IDisposable, IPenumbraApi
|
|||
{
|
||||
_penumbra = penumbra;
|
||||
_lumina = ( Lumina.GameData? )Dalamud.GameData.GetType()
|
||||
.GetField( "gameData", BindingFlags.Instance | BindingFlags.NonPublic )
|
||||
?.GetValue( Dalamud.GameData );
|
||||
.GetField( "gameData", BindingFlags.Instance | BindingFlags.NonPublic )
|
||||
?.GetValue( Dalamud.GameData );
|
||||
foreach( var collection in Penumbra.CollectionManager )
|
||||
{
|
||||
SubscribeToCollection( collection );
|
||||
|
|
@ -429,7 +429,7 @@ public class PenumbraApi : IDisposable, IPenumbraApi
|
|||
}
|
||||
|
||||
if( !forceOverwriteCharacter && Penumbra.CollectionManager.Characters.ContainsKey( character )
|
||||
|| Penumbra.TempMods.Collections.ContainsKey( character ) )
|
||||
|| Penumbra.TempMods.Collections.ContainsKey( character ) )
|
||||
{
|
||||
return ( PenumbraApiEc.CharacterCollectionExists, string.Empty );
|
||||
}
|
||||
|
|
@ -475,7 +475,7 @@ public class PenumbraApi : IDisposable, IPenumbraApi
|
|||
{
|
||||
CheckInitialized();
|
||||
if( !Penumbra.TempMods.Collections.Values.FindFirst( c => c.Name == collectionName, out var collection )
|
||||
&& !Penumbra.CollectionManager.ByName( collectionName, out collection ) )
|
||||
&& !Penumbra.CollectionManager.ByName( collectionName, out collection ) )
|
||||
{
|
||||
return PenumbraApiEc.CollectionMissing;
|
||||
}
|
||||
|
|
@ -512,7 +512,7 @@ public class PenumbraApi : IDisposable, IPenumbraApi
|
|||
{
|
||||
CheckInitialized();
|
||||
if( !Penumbra.TempMods.Collections.Values.FindFirst( c => c.Name == collectionName, out var collection )
|
||||
&& !Penumbra.CollectionManager.ByName( collectionName, out collection ) )
|
||||
&& !Penumbra.CollectionManager.ByName( collectionName, out collection ) )
|
||||
{
|
||||
return PenumbraApiEc.CollectionMissing;
|
||||
}
|
||||
|
|
@ -525,6 +525,14 @@ public class PenumbraApi : IDisposable, IPenumbraApi
|
|||
};
|
||||
}
|
||||
|
||||
public string GetPlayerMetaManipulations()
|
||||
{
|
||||
CheckInitialized();
|
||||
var collection = PathResolver.PlayerCollection();
|
||||
var set = collection.MetaCache?.Manipulations.ToArray() ?? Array.Empty< MetaManipulation >();
|
||||
return Functions.ToCompressedBase64( set, MetaManipulation.CurrentVersion );
|
||||
}
|
||||
|
||||
public string GetMetaManipulations( string characterName )
|
||||
{
|
||||
CheckInitialized();
|
||||
|
|
|
|||
|
|
@ -428,18 +428,20 @@ public partial class PenumbraIpc
|
|||
|
||||
public partial class PenumbraIpc
|
||||
{
|
||||
public const string LabelProviderGetMods = "Penumbra.GetMods";
|
||||
public const string LabelProviderGetCollections = "Penumbra.GetCollections";
|
||||
public const string LabelProviderCurrentCollectionName = "Penumbra.GetCurrentCollectionName";
|
||||
public const string LabelProviderDefaultCollectionName = "Penumbra.GetDefaultCollectionName";
|
||||
public const string LabelProviderCharacterCollectionName = "Penumbra.GetCharacterCollectionName";
|
||||
public const string LabelProviderGetMetaManipulations = "Penumbra.GetMetaManipulations";
|
||||
public const string LabelProviderGetMods = "Penumbra.GetMods";
|
||||
public const string LabelProviderGetCollections = "Penumbra.GetCollections";
|
||||
public const string LabelProviderCurrentCollectionName = "Penumbra.GetCurrentCollectionName";
|
||||
public const string LabelProviderDefaultCollectionName = "Penumbra.GetDefaultCollectionName";
|
||||
public const string LabelProviderCharacterCollectionName = "Penumbra.GetCharacterCollectionName";
|
||||
public const string LabelProviderGetPlayerMetaManipulations = "Penumbra.GetPlayerMetaManipulations";
|
||||
public const string LabelProviderGetMetaManipulations = "Penumbra.GetMetaManipulations";
|
||||
|
||||
internal ICallGateProvider< IList< (string, string) > >? ProviderGetMods;
|
||||
internal ICallGateProvider< IList< string > >? ProviderGetCollections;
|
||||
internal ICallGateProvider< string >? ProviderCurrentCollectionName;
|
||||
internal ICallGateProvider< string >? ProviderDefaultCollectionName;
|
||||
internal ICallGateProvider< string, (string, bool) >? ProviderCharacterCollectionName;
|
||||
internal ICallGateProvider< string >? ProviderGetPlayerMetaManipulations;
|
||||
internal ICallGateProvider< string, string >? ProviderGetMetaManipulations;
|
||||
|
||||
private void InitializeDataProviders( DalamudPluginInterface pi )
|
||||
|
|
@ -451,7 +453,7 @@ public partial class PenumbraIpc
|
|||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
PluginLog.Error( $"Error registering IPC provider for {LabelProviderChangedItemClick}:\n{e}" );
|
||||
PluginLog.Error( $"Error registering IPC provider for {LabelProviderGetMods}:\n{e}" );
|
||||
}
|
||||
|
||||
try
|
||||
|
|
@ -461,7 +463,7 @@ public partial class PenumbraIpc
|
|||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
PluginLog.Error( $"Error registering IPC provider for {LabelProviderChangedItemClick}:\n{e}" );
|
||||
PluginLog.Error( $"Error registering IPC provider for {LabelProviderGetCollections}:\n{e}" );
|
||||
}
|
||||
|
||||
try
|
||||
|
|
@ -471,7 +473,7 @@ public partial class PenumbraIpc
|
|||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
PluginLog.Error( $"Error registering IPC provider for {LabelProviderChangedItemClick}:\n{e}" );
|
||||
PluginLog.Error( $"Error registering IPC provider for {LabelProviderCurrentCollectionName}:\n{e}" );
|
||||
}
|
||||
|
||||
try
|
||||
|
|
@ -481,7 +483,7 @@ public partial class PenumbraIpc
|
|||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
PluginLog.Error( $"Error registering IPC provider for {LabelProviderChangedItemClick}:\n{e}" );
|
||||
PluginLog.Error( $"Error registering IPC provider for {LabelProviderDefaultCollectionName}:\n{e}" );
|
||||
}
|
||||
|
||||
try
|
||||
|
|
@ -491,7 +493,17 @@ public partial class PenumbraIpc
|
|||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
PluginLog.Error( $"Error registering IPC provider for {LabelProviderChangedItemClick}:\n{e}" );
|
||||
PluginLog.Error( $"Error registering IPC provider for {LabelProviderCharacterCollectionName}:\n{e}" );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
ProviderGetPlayerMetaManipulations = pi.GetIpcProvider< string >( LabelProviderGetPlayerMetaManipulations );
|
||||
ProviderGetPlayerMetaManipulations.RegisterFunc( Api.GetPlayerMetaManipulations );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
PluginLog.Error( $"Error registering IPC provider for {LabelProviderGetPlayerMetaManipulations}:\n{e}" );
|
||||
}
|
||||
|
||||
try
|
||||
|
|
@ -501,7 +513,7 @@ public partial class PenumbraIpc
|
|||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
PluginLog.Error( $"Error registering IPC provider for {LabelProviderChangedItemClick}:\n{e}" );
|
||||
PluginLog.Error( $"Error registering IPC provider for {LabelProviderGetMetaManipulations}:\n{e}" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue