mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-17 21:37:43 +01:00
Merge branch 'master' into feature/sestring-to-texture
This commit is contained in:
commit
3fbc24904a
490 changed files with 8689 additions and 3741 deletions
|
|
@ -2,10 +2,8 @@ using System.Collections.Generic;
|
|||
|
||||
namespace Dalamud.Plugin;
|
||||
|
||||
/// <summary>
|
||||
/// Contains data about changes to the list of active plugins.
|
||||
/// </summary>
|
||||
public class ActivePluginsChangedEventArgs : EventArgs
|
||||
/// <inheritdoc cref="IActivePluginsChangedEventArgs" />
|
||||
public class ActivePluginsChangedEventArgs : EventArgs, IActivePluginsChangedEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ActivePluginsChangedEventArgs"/> class
|
||||
|
|
@ -19,13 +17,9 @@ public class ActivePluginsChangedEventArgs : EventArgs
|
|||
this.AffectedInternalNames = affectedInternalNames;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the invalidation kind that caused this event to be fired.
|
||||
/// </summary>
|
||||
/// <inheritdoc/>
|
||||
public PluginListInvalidationKind Kind { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the InternalNames of affected plugins.
|
||||
/// </summary>
|
||||
/// <inheritdoc/>
|
||||
public IEnumerable<string> AffectedInternalNames { get; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using System.Globalization;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Loader;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Dalamud.Configuration;
|
||||
|
|
@ -16,6 +17,7 @@ using Dalamud.Game.Text.Sanitizer;
|
|||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Internal;
|
||||
using Dalamud.Interface.Internal.Windows.PluginInstaller;
|
||||
using Dalamud.Interface.Internal.Windows.SelfTest;
|
||||
using Dalamud.Interface.Internal.Windows.Settings;
|
||||
using Dalamud.IoC.Internal;
|
||||
using Dalamud.Plugin.Internal;
|
||||
|
|
@ -25,6 +27,7 @@ using Dalamud.Plugin.Internal.Types.Manifest;
|
|||
using Dalamud.Plugin.Ipc;
|
||||
using Dalamud.Plugin.Ipc.Exceptions;
|
||||
using Dalamud.Plugin.Ipc.Internal;
|
||||
using Dalamud.Plugin.Services;
|
||||
|
||||
using Serilog;
|
||||
|
||||
|
|
@ -83,126 +86,73 @@ internal sealed class DalamudPluginInterface : IDalamudPluginInterface, IDisposa
|
|||
configuration.DalamudConfigurationSaved += this.OnDalamudConfigurationSaved;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event that gets fired when loc is changed
|
||||
/// </summary>
|
||||
/// <inheritdoc/>
|
||||
public event IDalamudPluginInterface.LanguageChangedDelegate? LanguageChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Event that is fired when the active list of plugins is changed.
|
||||
/// </summary>
|
||||
/// <inheritdoc/>
|
||||
public event IDalamudPluginInterface.ActivePluginsChangedDelegate? ActivePluginsChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the reason this plugin was loaded.
|
||||
/// </summary>
|
||||
/// <inheritdoc/>
|
||||
public PluginLoadReason Reason { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether auto-updates have already completed this session.
|
||||
/// </summary>
|
||||
public bool IsAutoUpdateComplete => Service<AutoUpdateManager>.Get().IsAutoUpdateComplete;
|
||||
/// <inheritdoc/>
|
||||
public bool IsAutoUpdateComplete => Service<AutoUpdateManager>.GetNullable()?.IsAutoUpdateComplete ?? false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the repository from which this plugin was installed.
|
||||
///
|
||||
/// If a plugin was installed from the official/main repository, this will return the value of
|
||||
/// <see cref="SpecialPluginSource.MainRepo"/>. Developer plugins will return the value of
|
||||
/// <see cref="SpecialPluginSource.DevPlugin"/>.
|
||||
/// </summary>
|
||||
/// <inheritdoc/>
|
||||
public string SourceRepository { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current internal plugin name.
|
||||
/// </summary>
|
||||
/// <inheritdoc/>
|
||||
public string InternalName => this.plugin.InternalName;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the plugin's manifest.
|
||||
/// </summary>
|
||||
/// <inheritdoc/>
|
||||
public IPluginManifest Manifest => this.plugin.Manifest;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this is a dev plugin.
|
||||
/// </summary>
|
||||
/// <inheritdoc/>
|
||||
public bool IsDev => this.plugin.IsDev;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this is a testing release of a plugin.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Dev plugins have undefined behavior for this value, but can be expected to return <c>false</c>.
|
||||
/// </remarks>
|
||||
/// <inheritdoc/>
|
||||
public bool IsTesting { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the time that this plugin was loaded.
|
||||
/// </summary>
|
||||
/// <inheritdoc/>
|
||||
public DateTime LoadTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the UTC time that this plugin was loaded.
|
||||
/// </summary>
|
||||
/// <inheritdoc/>
|
||||
public DateTime LoadTimeUTC { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the timespan delta from when this plugin was loaded.
|
||||
/// </summary>
|
||||
/// <inheritdoc/>
|
||||
public TimeSpan LoadTimeDelta => DateTime.Now - this.LoadTime;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the directory Dalamud assets are stored in.
|
||||
/// </summary>
|
||||
/// <inheritdoc/>
|
||||
public DirectoryInfo DalamudAssetDirectory => Service<Dalamud>.Get().AssetDirectory;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the location of your plugin assembly.
|
||||
/// </summary>
|
||||
/// <inheritdoc/>
|
||||
public FileInfo AssemblyLocation => this.plugin.DllFile;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the directory your plugin configurations are stored in.
|
||||
/// </summary>
|
||||
/// <inheritdoc/>
|
||||
public DirectoryInfo ConfigDirectory => new(this.GetPluginConfigDirectory());
|
||||
|
||||
/// <summary>
|
||||
/// Gets the config file of your plugin.
|
||||
/// </summary>
|
||||
/// <inheritdoc/>
|
||||
public FileInfo ConfigFile => this.configs.GetConfigFile(this.plugin.InternalName);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="UiBuilder"/> instance which allows you to draw UI into the game via ImGui draw calls.
|
||||
/// </summary>
|
||||
/// <inheritdoc/>
|
||||
public IUiBuilder UiBuilder { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether Dalamud is running in Debug mode or the /xldev menu is open. This can occur on release builds.
|
||||
/// </summary>
|
||||
/// <inheritdoc/>
|
||||
public bool IsDevMenuOpen => Service<DalamudInterface>.GetNullable() is { IsDevMenuOpen: true }; // Can be null during boot
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether a debugger is attached.
|
||||
/// </summary>
|
||||
/// <inheritdoc/>
|
||||
public bool IsDebugging => Debugger.IsAttached;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current UI language in two-letter iso format.
|
||||
/// </summary>
|
||||
/// <inheritdoc/>
|
||||
public string UiLanguage { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets serializer class with functions to remove special characters from strings.
|
||||
/// </summary>
|
||||
/// <inheritdoc/>
|
||||
public ISanitizer Sanitizer { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the chat type used by default for plugin messages.
|
||||
/// </summary>
|
||||
/// <inheritdoc/>
|
||||
public XivChatType GeneralChatType { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of installed plugins along with their current state.
|
||||
/// </summary>
|
||||
/// <inheritdoc/>
|
||||
public IEnumerable<IExposedPlugin> InstalledPlugins =>
|
||||
Service<PluginManager>.Get().InstalledPlugins.Select(p => new ExposedPlugin(p));
|
||||
|
||||
|
|
@ -211,12 +161,7 @@ internal sealed class DalamudPluginInterface : IDalamudPluginInterface, IDisposa
|
|||
/// </summary>
|
||||
internal UiBuilder LocalUiBuilder => this.uiBuilder;
|
||||
|
||||
/// <summary>
|
||||
/// Opens the <see cref="PluginInstallerWindow"/>, with an optional search term.
|
||||
/// </summary>
|
||||
/// <param name="openTo">The page to open the installer to. Defaults to the "All Plugins" page.</param>
|
||||
/// <param name="searchText">An optional search text to input in the search box.</param>
|
||||
/// <returns>Returns false if the DalamudInterface was null.</returns>
|
||||
/// <inheritdoc/>
|
||||
public bool OpenPluginInstallerTo(PluginInstallerOpenKind openTo = PluginInstallerOpenKind.AllPlugins, string? searchText = null)
|
||||
{
|
||||
var dalamudInterface = Service<DalamudInterface>.GetNullable(); // Can be null during boot
|
||||
|
|
@ -231,12 +176,7 @@ internal sealed class DalamudPluginInterface : IDalamudPluginInterface, IDisposa
|
|||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the <see cref="SettingsWindow"/>, with an optional search term.
|
||||
/// </summary>
|
||||
/// <param name="openTo">The tab to open the settings to. Defaults to the "General" tab.</param>
|
||||
/// <param name="searchText">An optional search text to input in the search box.</param>
|
||||
/// <returns>Returns false if the DalamudInterface was null.</returns>
|
||||
/// <inheritdoc/>
|
||||
public bool OpenDalamudSettingsTo(SettingsOpenKind openTo = SettingsOpenKind.General, string? searchText = null)
|
||||
{
|
||||
var dalamudInterface = Service<DalamudInterface>.GetNullable(); // Can be null during boot
|
||||
|
|
@ -251,10 +191,7 @@ internal sealed class DalamudPluginInterface : IDalamudPluginInterface, IDisposa
|
|||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the dev menu bar.
|
||||
/// </summary>
|
||||
/// <returns>Returns false if the DalamudInterface was null.</returns>
|
||||
/// <inheritdoc/>
|
||||
public bool OpenDeveloperMenu()
|
||||
{
|
||||
var dalamudInterface = Service<DalamudInterface>.GetNullable(); // Can be null during boot
|
||||
|
|
@ -267,104 +204,117 @@ internal sealed class DalamudPluginInterface : IDalamudPluginInterface, IDisposa
|
|||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the plugin the given assembly is part of.
|
||||
/// </summary>
|
||||
/// <param name="assembly">The assembly to check.</param>
|
||||
/// <returns>The plugin the given assembly is part of, or null if this is a shared assembly or if this information cannot be determined.</returns>
|
||||
public IExposedPlugin? GetPlugin(Assembly assembly)
|
||||
=> AssemblyLoadContext.GetLoadContext(assembly) switch
|
||||
{
|
||||
null => null,
|
||||
var context => this.GetPlugin(context),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Gets the plugin that loads in the given context.
|
||||
/// </summary>
|
||||
/// <param name="context">The context to check.</param>
|
||||
/// <returns>The plugin that loads in the given context, or null if this isn't a plugin's context or if this information cannot be determined.</returns>
|
||||
public IExposedPlugin? GetPlugin(AssemblyLoadContext context)
|
||||
=> Service<PluginManager>.Get().InstalledPlugins.FirstOrDefault(p => p.LoadsIn(context)) switch
|
||||
{
|
||||
null => null,
|
||||
var p => new ExposedPlugin(p),
|
||||
};
|
||||
|
||||
#region IPC
|
||||
|
||||
/// <inheritdoc cref="DataShare.GetOrCreateData{T}"/>
|
||||
/// <inheritdoc/>
|
||||
public T GetOrCreateData<T>(string tag, Func<T> dataGenerator) where T : class
|
||||
=> Service<DataShare>.Get().GetOrCreateData(tag, dataGenerator);
|
||||
|
||||
/// <inheritdoc cref="DataShare.RelinquishData"/>
|
||||
/// <inheritdoc/>
|
||||
public void RelinquishData(string tag)
|
||||
=> Service<DataShare>.Get().RelinquishData(tag);
|
||||
|
||||
/// <inheritdoc cref="DataShare.TryGetData{T}"/>
|
||||
/// <inheritdoc/>
|
||||
public bool TryGetData<T>(string tag, [NotNullWhen(true)] out T? data) where T : class
|
||||
=> Service<DataShare>.Get().TryGetData(tag, out data);
|
||||
|
||||
/// <inheritdoc cref="DataShare.GetData{T}"/>
|
||||
/// <inheritdoc/>
|
||||
public T? GetData<T>(string tag) where T : class
|
||||
=> Service<DataShare>.Get().GetData<T>(tag);
|
||||
|
||||
/// <summary>
|
||||
/// Gets an IPC provider.
|
||||
/// </summary>
|
||||
/// <typeparam name="TRet">The return type for funcs. Use object if this is unused.</typeparam>
|
||||
/// <param name="name">The name of the IPC registration.</param>
|
||||
/// <returns>An IPC provider.</returns>
|
||||
/// <exception cref="IpcTypeMismatchError">This is thrown when the requested types do not match the previously registered types are different.</exception>
|
||||
/// <inheritdoc/>
|
||||
public ICallGateProvider<TRet> GetIpcProvider<TRet>(string name)
|
||||
=> new CallGatePubSub<TRet>(name);
|
||||
|
||||
/// <inheritdoc cref="ICallGateProvider{TRet}"/>
|
||||
/// <inheritdoc/>
|
||||
public ICallGateProvider<T1, TRet> GetIpcProvider<T1, TRet>(string name)
|
||||
=> new CallGatePubSub<T1, TRet>(name);
|
||||
|
||||
/// <inheritdoc cref="ICallGateProvider{TRet}"/>
|
||||
/// <inheritdoc/>
|
||||
public ICallGateProvider<T1, T2, TRet> GetIpcProvider<T1, T2, TRet>(string name)
|
||||
=> new CallGatePubSub<T1, T2, TRet>(name);
|
||||
|
||||
/// <inheritdoc cref="ICallGateProvider{TRet}"/>
|
||||
/// <inheritdoc/>
|
||||
public ICallGateProvider<T1, T2, T3, TRet> GetIpcProvider<T1, T2, T3, TRet>(string name)
|
||||
=> new CallGatePubSub<T1, T2, T3, TRet>(name);
|
||||
|
||||
/// <inheritdoc cref="ICallGateProvider{TRet}"/>
|
||||
/// <inheritdoc/>
|
||||
public ICallGateProvider<T1, T2, T3, T4, TRet> GetIpcProvider<T1, T2, T3, T4, TRet>(string name)
|
||||
=> new CallGatePubSub<T1, T2, T3, T4, TRet>(name);
|
||||
|
||||
/// <inheritdoc cref="ICallGateProvider{TRet}"/>
|
||||
/// <inheritdoc/>
|
||||
public ICallGateProvider<T1, T2, T3, T4, T5, TRet> GetIpcProvider<T1, T2, T3, T4, T5, TRet>(string name)
|
||||
=> new CallGatePubSub<T1, T2, T3, T4, T5, TRet>(name);
|
||||
|
||||
/// <inheritdoc cref="ICallGateProvider{TRet}"/>
|
||||
/// <inheritdoc/>
|
||||
public ICallGateProvider<T1, T2, T3, T4, T5, T6, TRet> GetIpcProvider<T1, T2, T3, T4, T5, T6, TRet>(string name)
|
||||
=> new CallGatePubSub<T1, T2, T3, T4, T5, T6, TRet>(name);
|
||||
|
||||
/// <inheritdoc cref="ICallGateProvider{TRet}"/>
|
||||
/// <inheritdoc/>
|
||||
public ICallGateProvider<T1, T2, T3, T4, T5, T6, T7, TRet> GetIpcProvider<T1, T2, T3, T4, T5, T6, T7, TRet>(string name)
|
||||
=> new CallGatePubSub<T1, T2, T3, T4, T5, T6, T7, TRet>(name);
|
||||
|
||||
/// <inheritdoc cref="ICallGateProvider{TRet}"/>
|
||||
/// <inheritdoc/>
|
||||
public ICallGateProvider<T1, T2, T3, T4, T5, T6, T7, T8, TRet> GetIpcProvider<T1, T2, T3, T4, T5, T6, T7, T8, TRet>(string name)
|
||||
=> new CallGatePubSub<T1, T2, T3, T4, T5, T6, T7, T8, TRet>(name);
|
||||
|
||||
/// <summary>
|
||||
/// Gets an IPC subscriber.
|
||||
/// </summary>
|
||||
/// <typeparam name="TRet">The return type for funcs. Use object if this is unused.</typeparam>
|
||||
/// <param name="name">The name of the IPC registration.</param>
|
||||
/// <returns>An IPC subscriber.</returns>
|
||||
/// <inheritdoc/>
|
||||
public ICallGateSubscriber<TRet> GetIpcSubscriber<TRet>(string name)
|
||||
=> new CallGatePubSub<TRet>(name);
|
||||
|
||||
/// <inheritdoc cref="ICallGateSubscriber{TRet}"/>
|
||||
/// <inheritdoc/>
|
||||
public ICallGateSubscriber<T1, TRet> GetIpcSubscriber<T1, TRet>(string name)
|
||||
=> new CallGatePubSub<T1, TRet>(name);
|
||||
|
||||
/// <inheritdoc cref="ICallGateSubscriber{TRet}"/>
|
||||
/// <inheritdoc/>
|
||||
public ICallGateSubscriber<T1, T2, TRet> GetIpcSubscriber<T1, T2, TRet>(string name)
|
||||
=> new CallGatePubSub<T1, T2, TRet>(name);
|
||||
|
||||
/// <inheritdoc cref="ICallGateSubscriber{TRet}"/>
|
||||
/// <inheritdoc/>
|
||||
public ICallGateSubscriber<T1, T2, T3, TRet> GetIpcSubscriber<T1, T2, T3, TRet>(string name)
|
||||
=> new CallGatePubSub<T1, T2, T3, TRet>(name);
|
||||
|
||||
/// <inheritdoc cref="ICallGateSubscriber{TRet}"/>
|
||||
/// <inheritdoc/>
|
||||
public ICallGateSubscriber<T1, T2, T3, T4, TRet> GetIpcSubscriber<T1, T2, T3, T4, TRet>(string name)
|
||||
=> new CallGatePubSub<T1, T2, T3, T4, TRet>(name);
|
||||
|
||||
/// <inheritdoc cref="ICallGateSubscriber{TRet}"/>
|
||||
/// <inheritdoc/>
|
||||
public ICallGateSubscriber<T1, T2, T3, T4, T5, TRet> GetIpcSubscriber<T1, T2, T3, T4, T5, TRet>(string name)
|
||||
=> new CallGatePubSub<T1, T2, T3, T4, T5, TRet>(name);
|
||||
|
||||
/// <inheritdoc cref="ICallGateSubscriber{TRet}"/>
|
||||
/// <inheritdoc/>
|
||||
public ICallGateSubscriber<T1, T2, T3, T4, T5, T6, TRet> GetIpcSubscriber<T1, T2, T3, T4, T5, T6, TRet>(string name)
|
||||
=> new CallGatePubSub<T1, T2, T3, T4, T5, T6, TRet>(name);
|
||||
|
||||
/// <inheritdoc cref="ICallGateSubscriber{TRet}"/>
|
||||
/// <inheritdoc/>
|
||||
public ICallGateSubscriber<T1, T2, T3, T4, T5, T6, T7, TRet> GetIpcSubscriber<T1, T2, T3, T4, T5, T6, T7, TRet>(string name)
|
||||
=> new CallGatePubSub<T1, T2, T3, T4, T5, T6, T7, TRet>(name);
|
||||
|
||||
/// <inheritdoc cref="ICallGateSubscriber{TRet}"/>
|
||||
/// <inheritdoc/>
|
||||
public ICallGateSubscriber<T1, T2, T3, T4, T5, T6, T7, T8, TRet> GetIpcSubscriber<T1, T2, T3, T4, T5, T6, T7, T8, TRet>(string name)
|
||||
=> new CallGatePubSub<T1, T2, T3, T4, T5, T6, T7, T8, TRet>(name);
|
||||
|
||||
|
|
@ -372,10 +322,7 @@ internal sealed class DalamudPluginInterface : IDalamudPluginInterface, IDisposa
|
|||
|
||||
#region Configuration
|
||||
|
||||
/// <summary>
|
||||
/// Save a plugin configuration(inheriting IPluginConfiguration).
|
||||
/// </summary>
|
||||
/// <param name="currentConfig">The current configuration.</param>
|
||||
/// <inheritdoc/>
|
||||
public void SavePluginConfig(IPluginConfiguration? currentConfig)
|
||||
{
|
||||
if (currentConfig == null)
|
||||
|
|
@ -384,10 +331,7 @@ internal sealed class DalamudPluginInterface : IDalamudPluginInterface, IDisposa
|
|||
this.configs.Save(currentConfig, this.plugin.InternalName, this.plugin.EffectiveWorkingPluginId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a previously saved plugin configuration or null if none was saved before.
|
||||
/// </summary>
|
||||
/// <returns>A previously saved config or null if none was saved before.</returns>
|
||||
/// <inheritdoc/>
|
||||
public IPluginConfiguration? GetPluginConfig()
|
||||
{
|
||||
// This is done to support json deserialization of plugin configurations
|
||||
|
|
@ -411,22 +355,22 @@ internal sealed class DalamudPluginInterface : IDalamudPluginInterface, IDisposa
|
|||
return this.configs.Load(this.plugin.InternalName, this.plugin.EffectiveWorkingPluginId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the config directory.
|
||||
/// </summary>
|
||||
/// <returns>directory with path of AppData/XIVLauncher/pluginConfig/PluginInternalName.</returns>
|
||||
/// <inheritdoc/>
|
||||
public string GetPluginConfigDirectory() => this.configs.GetDirectory(this.plugin.InternalName);
|
||||
|
||||
/// <summary>
|
||||
/// Get the loc directory.
|
||||
/// </summary>
|
||||
/// <returns>directory with path of AppData/XIVLauncher/pluginConfig/PluginInternalName/loc.</returns>
|
||||
/// <inheritdoc/>
|
||||
public string GetPluginLocDirectory() => this.configs.GetDirectory(Path.Combine(this.plugin.InternalName, "loc"));
|
||||
|
||||
#endregion
|
||||
|
||||
#region Dependency Injection
|
||||
|
||||
/// <inheritdoc/>
|
||||
public object? GetService(Type serviceType)
|
||||
{
|
||||
return this.plugin.ServiceScope.GetService(serviceType);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public T? Create<T>(params object[] scopedObjects) where T : class
|
||||
{
|
||||
|
|
@ -475,8 +419,7 @@ internal sealed class DalamudPluginInterface : IDalamudPluginInterface, IDisposa
|
|||
|
||||
#endregion
|
||||
|
||||
/// <summary>Unregister the plugin and dispose all references.</summary>
|
||||
/// <remarks>Dalamud internal use only.</remarks>
|
||||
/// <inheritdoc/>
|
||||
public void Dispose()
|
||||
{
|
||||
Service<ChatGui>.Get().RemoveChatLinkHandler(this.plugin.InternalName);
|
||||
|
|
@ -489,7 +432,7 @@ internal sealed class DalamudPluginInterface : IDalamudPluginInterface, IDisposa
|
|||
/// Dispatch the active plugins changed event.
|
||||
/// </summary>
|
||||
/// <param name="args">The event arguments containing information about the change.</param>
|
||||
internal void NotifyActivePluginsChanged(ActivePluginsChangedEventArgs args)
|
||||
internal void NotifyActivePluginsChanged(IActivePluginsChangedEventArgs args)
|
||||
{
|
||||
foreach (var action in Delegate.EnumerateInvocationList(this.ActivePluginsChanged))
|
||||
{
|
||||
|
|
|
|||
19
Dalamud/Plugin/IActivePluginsChangedEventArgs.cs
Normal file
19
Dalamud/Plugin/IActivePluginsChangedEventArgs.cs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Dalamud.Plugin;
|
||||
|
||||
/// <summary>
|
||||
/// Contains data about changes to the list of active plugins.
|
||||
/// </summary>
|
||||
public interface IActivePluginsChangedEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the invalidation kind that caused this event to be fired.
|
||||
/// </summary>
|
||||
PluginListInvalidationKind Kind { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the InternalNames of affected plugins.
|
||||
/// </summary>
|
||||
IEnumerable<string> AffectedInternalNames { get; }
|
||||
}
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Loader;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Dalamud.Configuration;
|
||||
using Dalamud.Game.Text;
|
||||
using Dalamud.Game.Text.Sanitizer;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Internal.Windows.PluginInstaller;
|
||||
using Dalamud.Interface.Internal.Windows.Settings;
|
||||
|
|
@ -15,13 +15,14 @@ using Dalamud.Plugin.Internal.Types.Manifest;
|
|||
using Dalamud.Plugin.Ipc;
|
||||
using Dalamud.Plugin.Ipc.Exceptions;
|
||||
using Dalamud.Plugin.Ipc.Internal;
|
||||
using Dalamud.Plugin.Services;
|
||||
|
||||
namespace Dalamud.Plugin;
|
||||
|
||||
/// <summary>
|
||||
/// This interface acts as an interface to various objects needed to interact with Dalamud and the game.
|
||||
/// </summary>
|
||||
public interface IDalamudPluginInterface
|
||||
public interface IDalamudPluginInterface : IServiceProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Delegate for localization change with two-letter iso lang code.
|
||||
|
|
@ -33,7 +34,7 @@ public interface IDalamudPluginInterface
|
|||
/// Delegate for events that listen to changes to the list of active plugins.
|
||||
/// </summary>
|
||||
/// <param name="args">The event arguments containing information about the change.</param>
|
||||
public delegate void ActivePluginsChangedDelegate(ActivePluginsChangedEventArgs args);
|
||||
public delegate void ActivePluginsChangedDelegate(IActivePluginsChangedEventArgs args);
|
||||
|
||||
/// <summary>
|
||||
/// Event that gets fired when loc is changed
|
||||
|
|
@ -179,6 +180,20 @@ public interface IDalamudPluginInterface
|
|||
/// <returns>Returns false if the DalamudInterface was null.</returns>
|
||||
bool OpenDeveloperMenu();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the plugin the given assembly is part of.
|
||||
/// </summary>
|
||||
/// <param name="assembly">The assembly to check.</param>
|
||||
/// <returns>The plugin the given assembly is part of, or null if this is a shared assembly or if this information cannot be determined.</returns>
|
||||
IExposedPlugin? GetPlugin(Assembly assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the plugin that loads in the given context.
|
||||
/// </summary>
|
||||
/// <param name="context">The context to check.</param>
|
||||
/// <returns>The plugin that loads in the given context, or null if this isn't a plugin's context or if this information cannot be determined.</returns>
|
||||
IExposedPlugin? GetPlugin(AssemblyLoadContext context);
|
||||
|
||||
/// <inheritdoc cref="DataShare.GetOrCreateData{T}"/>
|
||||
T GetOrCreateData<T>(string tag, Func<T> dataGenerator) where T : class;
|
||||
|
||||
|
|
|
|||
|
|
@ -491,13 +491,10 @@ internal class AutoUpdateManager : IServiceType
|
|||
|
||||
private bool CanUpdateOrNag()
|
||||
{
|
||||
var condition = Service<Condition>.Get();
|
||||
var clientState = Service<ClientState>.Get();
|
||||
return this.IsPluginManagerReady() &&
|
||||
!this.dalamudInterface.IsPluginInstallerOpen &&
|
||||
condition.OnlyAny(ConditionFlag.NormalConditions,
|
||||
ConditionFlag.Jumping,
|
||||
ConditionFlag.Mounted,
|
||||
ConditionFlag.UsingFashionAccessory);
|
||||
clientState.IsClientIdle();
|
||||
}
|
||||
|
||||
private bool IsPluginManagerReady()
|
||||
|
|
|
|||
|
|
@ -278,26 +278,6 @@ internal class PluginManager : IInternalDisposableService
|
|||
return !manifest.IsHide;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if a manifest even has an available testing version.
|
||||
/// </summary>
|
||||
/// <param name="manifest">The manifest to test.</param>
|
||||
/// <returns>Whether a testing version is available.</returns>
|
||||
public static bool HasTestingVersion(IPluginManifest manifest)
|
||||
{
|
||||
var av = manifest.AssemblyVersion;
|
||||
var tv = manifest.TestingAssemblyVersion;
|
||||
var hasTv = tv != null;
|
||||
|
||||
if (hasTv)
|
||||
{
|
||||
return tv > av &&
|
||||
manifest.TestingDalamudApiLevel == DalamudApiLevel;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a disposable that will lock plugin lists while it is not disposed.
|
||||
/// You must NEVER use this in async code.
|
||||
|
|
@ -371,6 +351,23 @@ internal class PluginManager : IInternalDisposableService
|
|||
return this.configuration.PluginTestingOptIns!.Any(x => x.InternalName == manifest.InternalName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// For a given manifest, determine if the testing version can be used over the normal version.
|
||||
/// The higher of the two versions is calculated after checking other settings.
|
||||
/// </summary>
|
||||
/// <param name="manifest">Manifest to check.</param>
|
||||
/// <returns>A value indicating whether testing can be used.</returns>
|
||||
public bool CanUseTesting(IPluginManifest manifest)
|
||||
{
|
||||
if (!this.configuration.DoPluginTest)
|
||||
return false;
|
||||
|
||||
if (!manifest.TestingDalamudApiLevel.HasValue)
|
||||
return false;
|
||||
|
||||
return manifest.IsTestingExclusive || manifest.IsAvailableForTesting;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// For a given manifest, determine if the testing version should be used over the normal version.
|
||||
/// The higher of the two versions is calculated after checking other settings.
|
||||
|
|
@ -379,16 +376,7 @@ internal class PluginManager : IInternalDisposableService
|
|||
/// <returns>A value indicating whether testing should be used.</returns>
|
||||
public bool UseTesting(IPluginManifest manifest)
|
||||
{
|
||||
if (!this.configuration.DoPluginTest)
|
||||
return false;
|
||||
|
||||
if (!this.HasTestingOptIn(manifest))
|
||||
return false;
|
||||
|
||||
if (manifest.IsTestingExclusive)
|
||||
return true;
|
||||
|
||||
return HasTestingVersion(manifest);
|
||||
return this.CanUseTesting(manifest) && this.HasTestingOptIn(manifest);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
|
@ -1208,9 +1196,18 @@ internal class PluginManager : IInternalDisposableService
|
|||
return false;
|
||||
|
||||
// API level - we keep the API before this in the installer to show as "outdated"
|
||||
var effectiveApiLevel = this.UseTesting(manifest) && manifest.TestingDalamudApiLevel != null ? manifest.TestingDalamudApiLevel.Value : manifest.DalamudApiLevel;
|
||||
if (effectiveApiLevel < DalamudApiLevel - 1 && !this.LoadAllApiLevels)
|
||||
return false;
|
||||
if (!this.LoadAllApiLevels)
|
||||
{
|
||||
var effectiveDalamudApiLevel =
|
||||
this.CanUseTesting(manifest) &&
|
||||
manifest.TestingDalamudApiLevel.HasValue &&
|
||||
manifest.TestingDalamudApiLevel.Value > manifest.DalamudApiLevel
|
||||
? manifest.TestingDalamudApiLevel.Value
|
||||
: manifest.DalamudApiLevel;
|
||||
|
||||
if (effectiveDalamudApiLevel < PluginManager.DalamudApiLevel - 1)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Banned
|
||||
if (this.IsManifestBanned(manifest))
|
||||
|
|
@ -1240,7 +1237,7 @@ internal class PluginManager : IInternalDisposableService
|
|||
}
|
||||
|
||||
return this.bannedPlugins.Any(ban => (ban.Name == manifest.InternalName || ban.Name == Hash.GetStringSha256Hash(manifest.InternalName))
|
||||
&& ban.AssemblyVersion >= versionToCheck);
|
||||
&& (ban.AssemblyVersion == null || ban.AssemblyVersion >= versionToCheck));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -1299,13 +1296,16 @@ internal class PluginManager : IInternalDisposableService
|
|||
/// <param name="affectedInternalNames">The affected plugins.</param>
|
||||
public void NotifyPluginsForStateChange(PluginListInvalidationKind kind, IEnumerable<string> affectedInternalNames)
|
||||
{
|
||||
foreach (var installedPlugin in this.installedPluginsList)
|
||||
lock (this.pluginListLock)
|
||||
{
|
||||
if (!installedPlugin.IsLoaded || installedPlugin.DalamudInterface == null)
|
||||
continue;
|
||||
foreach (var installedPlugin in this.installedPluginsList)
|
||||
{
|
||||
if (!installedPlugin.IsLoaded || installedPlugin.DalamudInterface == null)
|
||||
continue;
|
||||
|
||||
installedPlugin.DalamudInterface.NotifyActivePluginsChanged(
|
||||
new ActivePluginsChangedEventArgs(kind, affectedInternalNames));
|
||||
installedPlugin.DalamudInterface.NotifyActivePluginsChanged(
|
||||
new ActivePluginsChangedEventArgs(kind, affectedInternalNames));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ internal struct BannedPlugin
|
|||
/// Gets plugin assembly version.
|
||||
/// </summary>
|
||||
[JsonProperty]
|
||||
public Version AssemblyVersion { get; private set; }
|
||||
public Version? AssemblyVersion { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets reason for the ban.
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.ExceptionServices;
|
||||
using System.Runtime.Loader;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
|
@ -301,7 +302,7 @@ internal class LocalPlugin : IAsyncDisposable
|
|||
throw new PluginPreconditionFailedException($"Unable to load {this.Name}, game is newer than applicable version {this.manifest.ApplicableVersion}");
|
||||
|
||||
// We want to allow loading dev plugins with a lower API level than the current Dalamud API level, for ease of development
|
||||
if (this.manifest.EffectiveApiLevel < PluginManager.DalamudApiLevel && !pluginManager.LoadAllApiLevels && !this.IsDev)
|
||||
if (!pluginManager.LoadAllApiLevels && !this.IsDev && this.manifest.EffectiveApiLevel < PluginManager.DalamudApiLevel)
|
||||
throw new PluginPreconditionFailedException($"Unable to load {this.Name}, incompatible API level {this.manifest.EffectiveApiLevel}");
|
||||
|
||||
// We might want to throw here?
|
||||
|
|
@ -553,6 +554,14 @@ internal class LocalPlugin : IAsyncDisposable
|
|||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether this plugin loads in the given load context.
|
||||
/// </summary>
|
||||
/// <param name="context">The load context to check.</param>
|
||||
/// <returns>Whether this plugin loads in the given load context.</returns>
|
||||
public bool LoadsIn(AssemblyLoadContext context)
|
||||
=> this.loader?.LoadContext == context;
|
||||
|
||||
/// <summary>
|
||||
/// Save this plugin manifest.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Dalamud.Plugin.Internal.Types.Manifest;
|
||||
|
||||
|
|
@ -118,4 +118,9 @@ public interface IPluginManifest
|
|||
/// Gets an URL for the plugin's icon.
|
||||
/// </summary>
|
||||
public string? IconUrl { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this plugin is eligible for testing.
|
||||
/// </summary>
|
||||
public bool IsAvailableForTesting { get; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,9 +21,4 @@ internal record RemotePluginManifest : PluginManifest
|
|||
/// Gets or sets the changelog to be shown when obtaining the testing version of the plugin.
|
||||
/// </summary>
|
||||
public string? TestingChangelog { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this plugin is eligible for testing.
|
||||
/// </summary>
|
||||
public bool IsAvailableForTesting => this.TestingAssemblyVersion != null && this.TestingAssemblyVersion > this.AssemblyVersion;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -160,4 +160,11 @@ internal record PluginManifest : IPluginManifest
|
|||
/// <inheritdoc/>
|
||||
[JsonProperty("_Dip17Channel")]
|
||||
public string? Dip17Channel { get; init; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
[JsonIgnore]
|
||||
public bool IsAvailableForTesting
|
||||
=> this.TestingAssemblyVersion != null &&
|
||||
this.TestingAssemblyVersion > this.AssemblyVersion &&
|
||||
this.TestingDalamudApiLevel == PluginManager.DalamudApiLevel;
|
||||
}
|
||||
|
|
|
|||
54
Dalamud/Plugin/SelfTest/ISelfTestRegistry.cs
Normal file
54
Dalamud/Plugin/SelfTest/ISelfTestRegistry.cs
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Dalamud.Plugin.SelfTest;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for registering and unregistering self-test steps from plugins.
|
||||
/// </summary>
|
||||
/// <example>
|
||||
/// Registering custom self-test steps for your plugin:
|
||||
/// <code>
|
||||
/// [PluginService]
|
||||
/// public ISelfTestRegistry SelfTestRegistry { get; init; }
|
||||
///
|
||||
/// // In your plugin initialization
|
||||
/// this.SelfTestRegistry.RegisterTestSteps([
|
||||
/// new MyCustomSelfTestStep(),
|
||||
/// new AnotherSelfTestStep()
|
||||
/// ]);
|
||||
/// </code>
|
||||
///
|
||||
/// Creating a custom self-test step:
|
||||
/// <code>
|
||||
/// public class MyCustomSelfTestStep : ISelfTestStep
|
||||
/// {
|
||||
/// public string Name => "My Custom Test";
|
||||
///
|
||||
/// public SelfTestStepResult RunStep()
|
||||
/// {
|
||||
/// // Your test logic here
|
||||
/// if (/* test condition passes */)
|
||||
/// return SelfTestStepResult.Pass;
|
||||
///
|
||||
/// if (/* test condition fails */)
|
||||
/// return SelfTestStepResult.Fail;
|
||||
///
|
||||
/// // Still waiting for test to complete
|
||||
/// return SelfTestStepResult.Waiting;
|
||||
/// }
|
||||
///
|
||||
/// public void CleanUp()
|
||||
/// {
|
||||
/// // Clean up any resources used by the test
|
||||
/// }
|
||||
/// }
|
||||
/// </code>
|
||||
/// </example>
|
||||
public interface ISelfTestRegistry
|
||||
{
|
||||
/// <summary>
|
||||
/// Registers the self-test steps for this plugin.
|
||||
/// </summary>
|
||||
/// <param name="steps">The test steps to register.</param>
|
||||
public void RegisterTestSteps(IEnumerable<ISelfTestStep> steps);
|
||||
}
|
||||
23
Dalamud/Plugin/SelfTest/ISelfTestStep.cs
Normal file
23
Dalamud/Plugin/SelfTest/ISelfTestStep.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
namespace Dalamud.Plugin.SelfTest;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for test implementations.
|
||||
/// </summary>
|
||||
public interface ISelfTestStep
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the name of the test.
|
||||
/// </summary>
|
||||
public string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Run the test step, once per frame it is active.
|
||||
/// </summary>
|
||||
/// <returns>The result of this frame, test is discarded once a result other than <see cref="SelfTestStepResult.Waiting"/> is returned.</returns>
|
||||
public SelfTestStepResult RunStep();
|
||||
|
||||
/// <summary>
|
||||
/// Clean up this test.
|
||||
/// </summary>
|
||||
public void CleanUp();
|
||||
}
|
||||
28
Dalamud/Plugin/SelfTest/Internal/SelfTestGroup.cs
Normal file
28
Dalamud/Plugin/SelfTest/Internal/SelfTestGroup.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
namespace Dalamud.Plugin.SelfTest.Internal;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a self-test group with its loaded/unloaded state.
|
||||
/// </summary>
|
||||
internal class SelfTestGroup
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SelfTestGroup"/> class.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the test group.</param>
|
||||
/// <param name="loaded">Whether the group is currently loaded.</param>
|
||||
public SelfTestGroup(string name, bool loaded = true)
|
||||
{
|
||||
this.Name = name;
|
||||
this.Loaded = loaded;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the test group.
|
||||
/// </summary>
|
||||
public string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this test group is currently loaded.
|
||||
/// </summary>
|
||||
public bool Loaded { get; set; }
|
||||
}
|
||||
124
Dalamud/Plugin/SelfTest/Internal/SelfTestRegistry.cs
Normal file
124
Dalamud/Plugin/SelfTest/Internal/SelfTestRegistry.cs
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using Dalamud.Logging.Internal;
|
||||
using Dalamud.Plugin.Internal.Types;
|
||||
|
||||
namespace Dalamud.Plugin.SelfTest.Internal;
|
||||
|
||||
/// <summary>
|
||||
/// Registry for self-tests that can be run in the SelfTest window.
|
||||
/// </summary>
|
||||
[ServiceManager.EarlyLoadedService]
|
||||
internal class SelfTestRegistry : IServiceType
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of the Dalamud test group.
|
||||
/// </summary>
|
||||
public const string DalamudTestGroup = "Dalamud";
|
||||
|
||||
private static readonly ModuleLog Log = new("SelfTestRegistry");
|
||||
|
||||
private List<SelfTestWithResults> dalamudSelfTests = new();
|
||||
private List<SelfTestWithResults> pluginSelfTests = new();
|
||||
private Dictionary<string, SelfTestGroup> allGroups = new();
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SelfTestRegistry"/> class.
|
||||
/// </summary>
|
||||
[ServiceManager.ServiceConstructor]
|
||||
public SelfTestRegistry()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all available self test groups.
|
||||
/// </summary>
|
||||
public IEnumerable<SelfTestGroup> SelfTestGroups
|
||||
{
|
||||
get
|
||||
{
|
||||
// Always return Dalamud group first, then plugin groups
|
||||
if (this.allGroups.TryGetValue(DalamudTestGroup, out var dalamudGroup))
|
||||
{
|
||||
yield return dalamudGroup;
|
||||
}
|
||||
|
||||
foreach (var group in this.allGroups.Values)
|
||||
{
|
||||
if (group.Name != DalamudTestGroup)
|
||||
{
|
||||
yield return group;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all self tests from all groups.
|
||||
/// </summary>
|
||||
public IEnumerable<SelfTestWithResults> SelfTests => this.dalamudSelfTests.Concat(this.pluginSelfTests);
|
||||
|
||||
/// <summary>
|
||||
/// Registers Dalamud self test steps.
|
||||
/// </summary>
|
||||
/// <param name="steps">The steps to register.</param>
|
||||
public void RegisterDalamudSelfTestSteps(IEnumerable<ISelfTestStep> steps)
|
||||
{
|
||||
// Ensure Dalamud group exists and is loaded
|
||||
if (!this.allGroups.ContainsKey(DalamudTestGroup))
|
||||
{
|
||||
this.allGroups[DalamudTestGroup] = new SelfTestGroup(DalamudTestGroup, loaded: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.allGroups[DalamudTestGroup].Loaded = true;
|
||||
}
|
||||
|
||||
this.dalamudSelfTests.AddRange(steps.Select(step => SelfTestWithResults.FromDalamudStep(step)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers plugin self test steps.
|
||||
/// </summary>
|
||||
/// <param name="plugin">The plugin registering the tests.</param>
|
||||
/// <param name="steps">The steps to register.</param>
|
||||
public void RegisterPluginSelfTestSteps(LocalPlugin plugin, IEnumerable<ISelfTestStep> steps)
|
||||
{
|
||||
// Ensure plugin group exists and is loaded
|
||||
if (!this.allGroups.ContainsKey(plugin.InternalName))
|
||||
{
|
||||
this.allGroups[plugin.InternalName] = new SelfTestGroup(plugin.InternalName, loaded: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.allGroups[plugin.InternalName].Loaded = true;
|
||||
}
|
||||
|
||||
this.pluginSelfTests.AddRange(steps.Select(step => SelfTestWithResults.FromPluginStep(plugin, step)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unregisters all self test steps for a plugin.
|
||||
/// </summary>
|
||||
/// <param name="plugin">The plugin to unregister tests for.</param>
|
||||
public void UnregisterPluginSelfTestSteps(LocalPlugin plugin)
|
||||
{
|
||||
// Clean up existing tests for this plugin
|
||||
this.pluginSelfTests.ForEach(test =>
|
||||
{
|
||||
if (test.Plugin == plugin)
|
||||
{
|
||||
test.Unload();
|
||||
}
|
||||
});
|
||||
|
||||
this.pluginSelfTests.RemoveAll(test => test.Plugin == plugin);
|
||||
|
||||
// Mark group as unloaded if it exists
|
||||
if (this.allGroups.ContainsKey(plugin.InternalName))
|
||||
{
|
||||
this.allGroups[plugin.InternalName].Loaded = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.IoC.Internal;
|
||||
using Dalamud.Plugin.Internal.Types;
|
||||
using Dalamud.Plugin.Services;
|
||||
|
||||
namespace Dalamud.Plugin.SelfTest.Internal;
|
||||
|
||||
/// <summary>
|
||||
/// Plugin-scoped version of SelfTestRegistry.
|
||||
/// </summary>
|
||||
[PluginInterface]
|
||||
[ServiceManager.ScopedService]
|
||||
[ResolveVia<ISelfTestRegistry>]
|
||||
internal class SelfTestRegistryPluginScoped : ISelfTestRegistry, IInternalDisposableService, IDalamudService
|
||||
{
|
||||
[ServiceManager.ServiceDependency]
|
||||
private readonly SelfTestRegistry selfTestRegistry = Service<SelfTestRegistry>.Get();
|
||||
|
||||
private readonly LocalPlugin plugin;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SelfTestRegistryPluginScoped"/> class.
|
||||
/// </summary>
|
||||
/// <param name="plugin">The plugin this service belongs to.</param>
|
||||
[ServiceManager.ServiceConstructor]
|
||||
public SelfTestRegistryPluginScoped(LocalPlugin plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the plugin name.
|
||||
/// </summary>
|
||||
public string PluginName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Registers test steps for this plugin.
|
||||
/// </summary>
|
||||
/// <param name="steps">The test steps to register.</param>
|
||||
public void RegisterTestSteps(IEnumerable<ISelfTestStep> steps)
|
||||
{
|
||||
this.selfTestRegistry.RegisterPluginSelfTestSteps(this.plugin, steps);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
void IInternalDisposableService.DisposeService()
|
||||
{
|
||||
this.selfTestRegistry.UnregisterPluginSelfTestSteps(this.plugin);
|
||||
}
|
||||
}
|
||||
173
Dalamud/Plugin/SelfTest/Internal/SelfTestWithResults.cs
Normal file
173
Dalamud/Plugin/SelfTest/Internal/SelfTestWithResults.cs
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
using Dalamud.Logging.Internal;
|
||||
using Dalamud.Plugin.Internal.Types;
|
||||
|
||||
namespace Dalamud.Plugin.SelfTest.Internal;
|
||||
|
||||
/// <summary>
|
||||
/// A self test step with result tracking.
|
||||
/// </summary>
|
||||
internal class SelfTestWithResults
|
||||
{
|
||||
private static readonly ModuleLog Log = new("SelfTest");
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SelfTestWithResults"/> class.
|
||||
/// </summary>
|
||||
/// <param name="plugin">The plugin providing this test.</param>
|
||||
/// <param name="group">The test group name.</param>
|
||||
/// <param name="step">The test step.</param>
|
||||
public SelfTestWithResults(LocalPlugin plugin, string group, ISelfTestStep step)
|
||||
{
|
||||
this.Plugin = plugin;
|
||||
this.Group = group;
|
||||
this.Step = step;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the test group name.
|
||||
/// </summary>
|
||||
public string Group { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the plugin that defined these tests. <c>null</c> for Dalamud tests.
|
||||
/// </summary>
|
||||
public LocalPlugin? Plugin { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the test name.
|
||||
/// </summary>
|
||||
public string Name { get => this.Step.Name; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the test has run and finished.
|
||||
/// </summary>
|
||||
public bool Finished => this.Result == SelfTestStepResult.Fail || this.Result == SelfTestStepResult.Pass;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the plugin that provided this test has been unloaded.
|
||||
/// </summary>
|
||||
public bool Unloaded => this.Step == null;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the most recent result of running this test.
|
||||
/// </summary>
|
||||
public SelfTestStepResult Result { get; private set; } = SelfTestStepResult.NotRan;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the last time this test was started.
|
||||
/// </summary>
|
||||
public DateTimeOffset? StartTime { get; private set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Gets how long it took (or is taking) for this test to execute.
|
||||
/// </summary>
|
||||
public TimeSpan? Duration { get; private set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Step that our results are for.
|
||||
///
|
||||
/// If <c>null</c> it means the Plugin that provided this test has been unloaded and we can't use this test anymore.
|
||||
/// </summary>
|
||||
private ISelfTestStep? Step { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a SelfTestWithResults from a Dalamud step.
|
||||
/// </summary>
|
||||
/// <param name="step">The step to wrap.</param>
|
||||
/// <returns>A new SelfTestWithResults instance.</returns>
|
||||
public static SelfTestWithResults FromDalamudStep(ISelfTestStep step)
|
||||
{
|
||||
return new SelfTestWithResults(plugin: null, group: "Dalamud", step: step);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a SelfTestWithResults from a plugin step.
|
||||
/// </summary>
|
||||
/// <param name="plugin">The plugin providing the step.</param>
|
||||
/// <param name="step">The step to wrap.</param>
|
||||
/// <returns>A new SelfTestWithResults instance.</returns>
|
||||
public static SelfTestWithResults FromPluginStep(LocalPlugin plugin, ISelfTestStep step)
|
||||
{
|
||||
return new SelfTestWithResults(plugin: plugin, group: plugin.InternalName, step: step);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset the test.
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
this.Result = SelfTestStepResult.NotRan;
|
||||
this.StartTime = null;
|
||||
this.Duration = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finish the currently running test and clean up any state. This preserves test run results.
|
||||
/// </summary>
|
||||
public void Finish()
|
||||
{
|
||||
if (this.Step == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.Result == SelfTestStepResult.NotRan)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.Step.CleanUp();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Steps the state of this Self Test. This should be called every frame that we care about the results of this test.
|
||||
/// </summary>
|
||||
public void DrawAndStep()
|
||||
{
|
||||
// If we've been unloaded then there's nothing to do.
|
||||
if (this.Step == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// If we have already finished then there's nothing to do
|
||||
if (this.Finished)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise, we assume that calling this functions means we are running the test.
|
||||
if (this.Result == SelfTestStepResult.NotRan)
|
||||
{
|
||||
this.StartTime = DateTimeOffset.Now;
|
||||
this.Result = SelfTestStepResult.Waiting;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
this.Result = this.Step.RunStep();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex, $"Step failed: {this.Name} ({this.Group})");
|
||||
this.Result = SelfTestStepResult.Fail;
|
||||
}
|
||||
|
||||
this.Duration = DateTimeOffset.Now - this.StartTime;
|
||||
|
||||
// If we ran and finished we need to clean up
|
||||
if (this.Finished)
|
||||
{
|
||||
this.Finish();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unloads the test and cleans up.
|
||||
/// </summary>
|
||||
public void Unload()
|
||||
{
|
||||
this.Finish();
|
||||
this.Step = null;
|
||||
}
|
||||
}
|
||||
27
Dalamud/Plugin/SelfTest/SelfTestStepResult.cs
Normal file
27
Dalamud/Plugin/SelfTest/SelfTestStepResult.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
namespace Dalamud.Plugin.SelfTest;
|
||||
|
||||
/// <summary>
|
||||
/// Enum declaring result states of tests.
|
||||
/// </summary>
|
||||
public enum SelfTestStepResult
|
||||
{
|
||||
/// <summary>
|
||||
/// Test was not ran.
|
||||
/// </summary>
|
||||
NotRan,
|
||||
|
||||
/// <summary>
|
||||
/// Test is waiting for completion.
|
||||
/// </summary>
|
||||
Waiting,
|
||||
|
||||
/// <summary>
|
||||
/// Test has failed.
|
||||
/// </summary>
|
||||
Fail,
|
||||
|
||||
/// <summary>
|
||||
/// Test has passed.
|
||||
/// </summary>
|
||||
Pass,
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using Dalamud.Game.Addon.Events;
|
||||
using Dalamud.Game.Addon.Events;
|
||||
using Dalamud.Game.Addon.Events.EventDataTypes;
|
||||
|
||||
namespace Dalamud.Plugin.Services;
|
||||
|
|
@ -6,7 +6,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// <summary>
|
||||
/// Service provider for addon event management.
|
||||
/// </summary>
|
||||
public interface IAddonEventManager
|
||||
public interface IAddonEventManager : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// Delegate to be called when an event is received.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using Dalamud.Game.Addon.Lifecycle;
|
||||
|
|
@ -9,7 +9,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// <summary>
|
||||
/// This class provides events for in-game addon lifecycles.
|
||||
/// </summary>
|
||||
public interface IAddonLifecycle
|
||||
public interface IAddonLifecycle : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// Delegate for receiving addon lifecycle event messages.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Dalamud.Game.ClientState.Aetherytes;
|
||||
|
||||
|
|
@ -7,7 +7,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// <summary>
|
||||
/// This collection represents the list of available Aetherytes in the Teleport window.
|
||||
/// </summary>
|
||||
public interface IAetheryteList : IReadOnlyCollection<IAetheryteEntry>
|
||||
public interface IAetheryteList : IDalamudService, IReadOnlyCollection<IAetheryteEntry>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the amount of Aetherytes the local player has unlocked.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Dalamud.Game.ClientState.Buddy;
|
||||
|
||||
|
|
@ -8,7 +8,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// This collection represents the buddies present in your squadron or trust party.
|
||||
/// It does not include the local player.
|
||||
/// </summary>
|
||||
public interface IBuddyList : IReadOnlyCollection<IBuddyMember>
|
||||
public interface IBuddyList : IDalamudService, IReadOnlyCollection<IBuddyMember>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the amount of battle buddies the local player has.
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// <summary>
|
||||
/// This class handles interacting with the native chat UI.
|
||||
/// </summary>
|
||||
public interface IChatGui
|
||||
public interface IChatGui : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// A delegate type used with the <see cref="ChatGui.ChatMessage"/> event.
|
||||
|
|
@ -83,20 +83,21 @@ public interface IChatGui
|
|||
/// <summary>
|
||||
/// Gets the dictionary of Dalamud Link Handlers.
|
||||
/// </summary>
|
||||
public IReadOnlyDictionary<(string PluginName, Guid CommandId), Action<Guid, SeString>> RegisteredLinkHandlers { get; }
|
||||
public IReadOnlyDictionary<(string PluginName, uint CommandId), Action<uint, SeString>> RegisteredLinkHandlers { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Register a chat link handler.
|
||||
/// </summary>
|
||||
/// <param name="commandId">The ID of the command.</param>
|
||||
/// <param name="commandAction">The action to be executed.</param>
|
||||
/// <returns>Returns an SeString payload for the link.</returns>
|
||||
public DalamudLinkPayload AddChatLinkHandler(Action<Guid, SeString> commandAction);
|
||||
public DalamudLinkPayload AddChatLinkHandler(uint commandId, Action<uint, SeString> commandAction);
|
||||
|
||||
/// <summary>
|
||||
/// Remove a chat link handler.
|
||||
/// </summary>
|
||||
/// <param name="commandId">The ID of the command.</param>
|
||||
public void RemoveChatLinkHandler(Guid commandId);
|
||||
public void RemoveChatLinkHandler(uint commandId);
|
||||
|
||||
/// <summary>
|
||||
/// Removes all chat link handlers registered by the plugin.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using Dalamud.Game;
|
||||
using Dalamud.Game.ClientState;
|
||||
using Dalamud.Game.ClientState.Conditions;
|
||||
using Dalamud.Game.ClientState.Objects.SubKinds;
|
||||
|
||||
|
|
@ -7,7 +8,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// <summary>
|
||||
/// This class represents the state of the game client at the time of access.
|
||||
/// </summary>
|
||||
public interface IClientState
|
||||
public interface IClientState : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// A delegate type used for the <see cref="ClassJobChanged"/> event.
|
||||
|
|
@ -29,11 +30,26 @@ public interface IClientState
|
|||
/// <param name="code">The success/failure code.</param>
|
||||
public delegate void LogoutDelegate(int type, int code);
|
||||
|
||||
/// <summary>
|
||||
/// Event that gets fired when the game initializes a zone.
|
||||
/// </summary>
|
||||
public event Action<ZoneInitEventArgs> ZoneInit;
|
||||
|
||||
/// <summary>
|
||||
/// Event that gets fired when the current Territory changes.
|
||||
/// </summary>
|
||||
public event Action<ushort> TerritoryChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Event that gets fired when the current Map changes.
|
||||
/// </summary>
|
||||
public event Action<uint> MapIdChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Event that gets fired when the current zone Instance changes.
|
||||
/// </summary>
|
||||
public event Action<uint> InstanceChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Event that fires when a characters ClassJob changed.
|
||||
/// </summary>
|
||||
|
|
@ -85,14 +101,21 @@ public interface IClientState
|
|||
/// </summary>
|
||||
public uint MapId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the instance number of the current zone, used when multiple copies of an area are active.
|
||||
/// </summary>
|
||||
public uint Instance { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the local player character, if one is present.
|
||||
/// </summary>
|
||||
[Obsolete($"Use {nameof(IPlayerState)} or {nameof(IObjectTable)}.{nameof(IObjectTable.LocalPlayer)} if necessary.")]
|
||||
public IPlayerCharacter? LocalPlayer { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the content ID of the local character.
|
||||
/// </summary>
|
||||
[Obsolete($"Use {nameof(IPlayerState)}.{nameof(IPlayerState.ContentId)}")]
|
||||
public ulong LocalContentId { get; }
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.ObjectModel;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
using Dalamud.Game.Command;
|
||||
|
||||
|
|
@ -7,7 +7,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// <summary>
|
||||
/// This class manages registered in-game slash commands.
|
||||
/// </summary>
|
||||
public interface ICommandManager
|
||||
public interface ICommandManager : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a read-only list of all registered commands.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Dalamud.Game.ClientState.Conditions;
|
||||
|
||||
|
|
@ -7,7 +7,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// <summary>
|
||||
/// Provides access to conditions (generally player state). You can check whether a player is in combat, mounted, etc.
|
||||
/// </summary>
|
||||
public interface ICondition
|
||||
public interface ICondition : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// A delegate type used with the <see cref="ConditionChange"/> event.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
using Dalamud.Console;
|
||||
|
||||
|
|
@ -8,7 +8,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// Provides functions to register console commands and variables.
|
||||
/// </summary>
|
||||
[Experimental("Dalamud001")]
|
||||
public interface IConsole
|
||||
public interface IConsole : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets this plugin's namespace prefix, derived off its internal name.
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// <summary>
|
||||
/// This class provides methods for interacting with the game's context menu.
|
||||
/// </summary>
|
||||
public interface IContextMenu
|
||||
public interface IContextMenu : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// A delegate type used for the <see cref="OnMenuOpened"/> event.
|
||||
|
|
|
|||
10
Dalamud/Plugin/Services/IDalamudService.cs
Normal file
10
Dalamud/Plugin/Services/IDalamudService.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
namespace Dalamud.Plugin.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Marker interface for Dalamud services.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This interface is implemented by all services provided through Dalamud's
|
||||
/// dependency injection system.
|
||||
/// </remarks>
|
||||
public interface IDalamudService;
|
||||
|
|
@ -14,7 +14,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// <summary>
|
||||
/// This class provides data for Dalamud-internal features, but can also be used by plugins if needed.
|
||||
/// </summary>
|
||||
public interface IDataManager
|
||||
public interface IDataManager : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the current game client language.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Dalamud.Game.Gui.Dtr;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
|
|
@ -8,7 +8,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// <summary>
|
||||
/// Class used to interface with the server info bar.
|
||||
/// </summary>
|
||||
public interface IDtrBar
|
||||
public interface IDtrBar : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a read-only copy of the list of all DTR bar entries.
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
namespace Dalamud.Plugin.Services;
|
||||
namespace Dalamud.Plugin.Services;
|
||||
|
||||
/// <summary>
|
||||
/// This class represents the state of the currently occupied duty.
|
||||
/// </summary>
|
||||
public interface IDutyState
|
||||
public interface IDutyState : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// Event that gets fired when the duty starts.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Dalamud.Game.ClientState.Fates;
|
||||
|
||||
|
|
@ -7,7 +7,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// <summary>
|
||||
/// This collection represents the currently available Fate events.
|
||||
/// </summary>
|
||||
public interface IFateTable : IReadOnlyCollection<IFate>
|
||||
public interface IFateTable : IDalamudService, IReadOnlyCollection<IFate>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the address of the Fate table.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Dalamud.Game.Gui.FlyText;
|
||||
using Dalamud.Game.Gui.FlyText;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
|
||||
namespace Dalamud.Plugin.Services;
|
||||
|
|
@ -6,7 +6,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// <summary>
|
||||
/// This class facilitates interacting with and creating native in-game "fly text".
|
||||
/// </summary>
|
||||
public interface IFlyTextGui
|
||||
public interface IFlyTextGui : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// The delegate defining the type for the FlyText event.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Threading;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||
|
|
@ -24,7 +24,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// <para>See <see cref="TaskSchedulerWidget"/> to see the difference in behaviors, and how would a misuse of these
|
||||
/// functions result in a deadlock.</para>
|
||||
/// </remarks>
|
||||
public interface IFramework
|
||||
public interface IFramework : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// A delegate type used with the <see cref="Update"/> event.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Diagnostics;
|
||||
using System.Diagnostics;
|
||||
|
||||
using Dalamud.Game.Config;
|
||||
using Dalamud.Plugin.Internal.Types;
|
||||
|
|
@ -17,7 +17,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// If property access from the plugin constructor is desired, do the value retrieval asynchronously via
|
||||
/// <see cref="IFramework.RunOnFrameworkThread{T}(Func{T})"/>; do not wait for the result right away.
|
||||
/// </remarks>
|
||||
public interface IGameConfig
|
||||
public interface IGameConfig : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// Event which is fired when any game config option is changed.
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// <summary>
|
||||
/// A class handling many aspects of the in-game UI.
|
||||
/// </summary>
|
||||
public unsafe interface IGameGui
|
||||
public unsafe interface IGameGui : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// Event which is fired when the game UI hiding is toggled.
|
||||
|
|
@ -26,6 +26,12 @@ public unsafe interface IGameGui
|
|||
/// </summary>
|
||||
public event EventHandler<HoveredAction> HoveredActionChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Fired when the game sets one or more <see cref="AgentUpdateFlag"/> values,
|
||||
/// used by agents to conditionally update their addons.
|
||||
/// </summary>
|
||||
event Action<AgentUpdateFlag> AgentUpdate;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the game UI is hidden.
|
||||
/// </summary>
|
||||
|
|
@ -36,7 +42,7 @@ public unsafe interface IGameGui
|
|||
/// If > 1.000.000, subtract 1.000.000 and treat it as HQ.
|
||||
/// </summary>
|
||||
public ulong HoveredItem { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the action ID that is current hovered by the player. 0 when no action is hovered.
|
||||
/// </summary>
|
||||
|
|
@ -89,6 +95,15 @@ public unsafe interface IGameGui
|
|||
/// <returns>A pointer wrapper to the addon.</returns>
|
||||
public AtkUnitBasePtr GetAddonByName(string name, int index = 1);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the pointer to the Addon with the given name and index.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of addon to find.</param>
|
||||
/// <param name="index">Index of addon to find (1-indexed).</param>
|
||||
/// <returns>A pointer wrapper to the addon.</returns>
|
||||
/// <typeparam name="T">Type of addon pointer AtkUnitBase or any derived struct.</typeparam>
|
||||
public T* GetAddonByName<T>(string name, int index = 1) where T : unmanaged;
|
||||
|
||||
/// <summary>
|
||||
/// Find the agent associated with an addon, if possible.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Diagnostics;
|
||||
using System.Diagnostics;
|
||||
|
||||
using Dalamud.Hooking;
|
||||
using Dalamud.Utility.Signatures;
|
||||
|
|
@ -8,7 +8,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// <summary>
|
||||
/// Service responsible for the creation of hooks.
|
||||
/// </summary>
|
||||
public interface IGameInteropProvider
|
||||
public interface IGameInteropProvider : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// Available hooking backends.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Dalamud.Game.Inventory;
|
||||
using Dalamud.Game.Inventory.InventoryEventArgTypes;
|
||||
|
|
@ -8,7 +8,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// <summary>
|
||||
/// This class provides events for the in-game inventory.
|
||||
/// </summary>
|
||||
public interface IGameInventory
|
||||
public interface IGameInventory : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// Delegate function to be called when inventories have been changed.
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
using System.Threading;
|
||||
using System.Threading;
|
||||
|
||||
namespace Dalamud.Plugin.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Class offering cancellation tokens for common gameplay events.
|
||||
/// </summary>
|
||||
public interface IGameLifecycle
|
||||
public interface IGameLifecycle : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a token that is cancelled when Dalamud is unloading.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Dalamud.Game.Network;
|
||||
using Dalamud.Game.Network;
|
||||
|
||||
namespace Dalamud.Plugin.Services;
|
||||
|
||||
|
|
@ -6,7 +6,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// This class handles interacting with game network events.
|
||||
/// </summary>
|
||||
[Obsolete("Will be removed in a future release. Use packet handler hooks instead.", true)]
|
||||
public interface IGameNetwork
|
||||
public interface IGameNetwork : IDalamudService
|
||||
{
|
||||
// TODO(v9): we shouldn't be passing pointers to the actual data here
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Numerics;
|
||||
using System.Numerics;
|
||||
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Game.ClientState.GamePad;
|
||||
|
|
@ -10,7 +10,7 @@ namespace Dalamud.Plugin.Services;
|
|||
///
|
||||
/// Will block game's gamepad input if <see cref="ImGuiConfigFlags.NavEnableGamepad"/> is set.
|
||||
/// </summary>
|
||||
public interface IGamepadState
|
||||
public interface IGamepadState : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the pointer to the current instance of the GamepadInput struct.
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
using Dalamud.Game.ClientState.JobGauge.Types;
|
||||
using Dalamud.Game.ClientState.JobGauge.Types;
|
||||
|
||||
namespace Dalamud.Plugin.Services;
|
||||
|
||||
/// <summary>
|
||||
/// This class converts in-memory Job gauge data to structs.
|
||||
/// </summary>
|
||||
public interface IJobGauges
|
||||
public interface IJobGauges : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the address of the JobGauge data.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Dalamud.Game.ClientState.Keys;
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// index & 2 = key up (ephemeral).
|
||||
/// index & 3 = short key press (ephemeral).
|
||||
/// </remarks>
|
||||
public interface IKeyState
|
||||
public interface IKeyState : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// Get or set the key-pressed state for a given vkCode.
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
using Dalamud.Game.Network.Structures;
|
||||
using Dalamud.Game.Network.Structures;
|
||||
|
||||
namespace Dalamud.Plugin.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Provides access to market board related events as the client receives/sends them.
|
||||
/// </summary>
|
||||
public interface IMarketBoard
|
||||
public interface IMarketBoard : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// A delegate type used with the <see cref="HistoryReceived"/> event.
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// <summary>
|
||||
/// Class used to modify the data used when rendering nameplates.
|
||||
/// </summary>
|
||||
public interface INamePlateGui
|
||||
public interface INamePlateGui : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// The delegate used for receiving nameplate update events.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ using Dalamud.Interface.ImGuiNotification;
|
|||
namespace Dalamud.Plugin.Services;
|
||||
|
||||
/// <summary>Manager for notifications provided by Dalamud using ImGui.</summary>
|
||||
public interface INotificationManager
|
||||
public interface INotificationManager : IDalamudService
|
||||
{
|
||||
/// <summary>Adds a notification.</summary>
|
||||
/// <param name="notification">The new notification.</param>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Dalamud.Game.ClientState.Objects.SubKinds;
|
||||
using Dalamud.Game.ClientState.Objects.Types;
|
||||
|
||||
namespace Dalamud.Plugin.Services;
|
||||
|
|
@ -7,7 +8,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// <summary>
|
||||
/// This collection represents the currently spawned FFXIV game objects.
|
||||
/// </summary>
|
||||
public interface IObjectTable : IEnumerable<IGameObject>
|
||||
public interface IObjectTable : IDalamudService, IEnumerable<IGameObject>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the address of the object table.
|
||||
|
|
@ -19,6 +20,11 @@ public interface IObjectTable : IEnumerable<IGameObject>
|
|||
/// </summary>
|
||||
public int Length { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the local player character, if one is present.
|
||||
/// </summary>
|
||||
public IPlayerCharacter? LocalPlayer { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets an enumerator for accessing player objects. This will only contain BattleChara objects.
|
||||
/// Does not contain any mounts, minions, or accessories.
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
using Dalamud.Game.Gui.PartyFinder.Types;
|
||||
using Dalamud.Game.Gui.PartyFinder.Types;
|
||||
|
||||
namespace Dalamud.Plugin.Services;
|
||||
|
||||
/// <summary>
|
||||
/// This class handles interacting with the native PartyFinder window.
|
||||
/// </summary>
|
||||
public interface IPartyFinderGui
|
||||
public interface IPartyFinderGui : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// Event type fired each time the game receives an individual Party Finder listing.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Dalamud.Game.ClientState.Party;
|
||||
|
||||
|
|
@ -7,7 +7,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// <summary>
|
||||
/// This collection represents the actors present in your party or alliance.
|
||||
/// </summary>
|
||||
public interface IPartyList : IReadOnlyCollection<IPartyMember>
|
||||
public interface IPartyList : IDalamudService, IReadOnlyCollection<IPartyMember>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the amount of party members the local player has.
|
||||
|
|
|
|||
243
Dalamud/Plugin/Services/IPlayerState.cs
Normal file
243
Dalamud/Plugin/Services/IPlayerState.cs
Normal file
|
|
@ -0,0 +1,243 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
using Dalamud.Game.Player;
|
||||
|
||||
using Lumina.Excel;
|
||||
using Lumina.Excel.Sheets;
|
||||
|
||||
namespace Dalamud.Plugin.Services;
|
||||
|
||||
#pragma warning disable SA1400 // Access modifier should be declared: Interface members are public by default
|
||||
|
||||
/// <summary>
|
||||
/// Interface for determining the players state.
|
||||
/// </summary>
|
||||
public interface IPlayerState : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the local players data is loaded.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// PlayerState is separate from <see cref="IObjectTable.LocalPlayer"/>,
|
||||
/// and as such the game object might not exist when it's loaded.
|
||||
/// </remarks>
|
||||
bool IsLoaded { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the local character.
|
||||
/// </summary>
|
||||
string CharacterName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the entity ID of the local character.
|
||||
/// </summary>
|
||||
uint EntityId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the content ID of the local character.
|
||||
/// </summary>
|
||||
ulong ContentId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the World row for the local character's current world.
|
||||
/// </summary>
|
||||
RowRef<World> CurrentWorld { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the World row for the local character's home world.
|
||||
/// </summary>
|
||||
RowRef<World> HomeWorld { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sex of the local character.
|
||||
/// </summary>
|
||||
Sex Sex { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Race row for the local character.
|
||||
/// </summary>
|
||||
RowRef<Race> Race { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Tribe row for the local character.
|
||||
/// </summary>
|
||||
RowRef<Tribe> Tribe { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the ClassJob row for the local character's current class/job.
|
||||
/// </summary>
|
||||
RowRef<ClassJob> ClassJob { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current class/job's level of the local character.
|
||||
/// </summary>
|
||||
short Level { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the local character's level is synced.
|
||||
/// </summary>
|
||||
bool IsLevelSynced { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the effective level of the local character, taking level sync into account.
|
||||
/// </summary>
|
||||
short EffectiveLevel { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the GuardianDeity row for the local character.
|
||||
/// </summary>
|
||||
RowRef<GuardianDeity> GuardianDeity { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the birth month of the local character.
|
||||
/// </summary>
|
||||
byte BirthMonth { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the birth day of the local character.
|
||||
/// </summary>
|
||||
byte BirthDay { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the ClassJob row for the local character's starting class.
|
||||
/// </summary>
|
||||
RowRef<ClassJob> FirstClass { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Town row for the local character's starting town.
|
||||
/// </summary>
|
||||
RowRef<Town> StartTown { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the base strength of the local character.
|
||||
/// </summary>
|
||||
int BaseStrength { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the base dexterity of the local character.
|
||||
/// </summary>
|
||||
int BaseDexterity { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the base vitality of the local character.
|
||||
/// </summary>
|
||||
int BaseVitality { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the base intelligence of the local character.
|
||||
/// </summary>
|
||||
int BaseIntelligence { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the base mind of the local character.
|
||||
/// </summary>
|
||||
int BaseMind { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the piety mind of the local character.
|
||||
/// </summary>
|
||||
int BasePiety { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the GrandCompany row for the local character's current Grand Company affiliation.
|
||||
/// </summary>
|
||||
RowRef<GrandCompany> GrandCompany { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Aetheryte row for the local player's home aetheryte.
|
||||
/// </summary>
|
||||
RowRef<Aetheryte> HomeAetheryte { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets an array of Aetheryte rows for the local player's favourite aetherytes.
|
||||
/// </summary>
|
||||
IReadOnlyList<RowRef<Aetheryte>> FavoriteAetherytes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Aetheryte row for the local player's free aetheryte.
|
||||
/// </summary>
|
||||
RowRef<Aetheryte> FreeAetheryte { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the amount of received player commendations of the local player.
|
||||
/// </summary>
|
||||
uint BaseRestedExperience { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the amount of received player commendations of the local player.
|
||||
/// </summary>
|
||||
short PlayerCommendations { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Carrier Level of Delivery Moogle Quests of the local player.
|
||||
/// </summary>
|
||||
byte DeliveryLevel { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the mentor version of the local player.
|
||||
/// </summary>
|
||||
MentorVersion MentorVersion { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the local player is any kind of Mentor (Battle or Trade Mentor).
|
||||
/// </summary>
|
||||
bool IsMentor { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the local player is a Battle Mentor.
|
||||
/// </summary>
|
||||
bool IsBattleMentor { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the local player is a Trade Mentor.
|
||||
/// </summary>
|
||||
bool IsTradeMentor { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the local player is a novice (aka. Sprout or New Adventurer).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Can be <see langword="false"/> if <c>/nastatus</c> was used to deactivate it.
|
||||
/// </remarks>
|
||||
bool IsNovice { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the local player is a returner.
|
||||
/// </summary>
|
||||
bool IsReturner { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value of an attribute of the local character.
|
||||
/// </summary>
|
||||
/// <param name="attribute">The attribute to check.</param>
|
||||
/// <returns>The value of the specific attribute.</returns>
|
||||
int GetAttribute(PlayerAttribute attribute);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Grand Company rank of the local character.
|
||||
/// </summary>
|
||||
/// <param name="grandCompany">The Grand Company to check.</param>
|
||||
/// <returns>The Grand Company rank of the local character.</returns>
|
||||
byte GetGrandCompanyRank(GrandCompany grandCompany);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the level of the local character's class/job.
|
||||
/// </summary>
|
||||
/// <param name="classJob">The ClassJob row to check.</param>
|
||||
/// <returns>The level of the requested class/job.</returns>
|
||||
short GetClassJobLevel(ClassJob classJob);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the experience of the local character's class/job.
|
||||
/// </summary>
|
||||
/// <param name="classJob">The ClassJob row to check.</param>
|
||||
/// <returns>The experience of the requested class/job.</returns>
|
||||
int GetClassJobExperience(ClassJob classJob);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the desynthesis level of the local character's crafter job.
|
||||
/// </summary>
|
||||
/// <param name="classJob">The ClassJob row to check.</param>
|
||||
/// <returns>The desynthesis level of the requested crafter job.</returns>
|
||||
float GetDesynthesisLevel(ClassJob classJob);
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using Serilog;
|
||||
using Serilog;
|
||||
using Serilog.Events;
|
||||
|
||||
#pragma warning disable CS1573 // See https://github.com/dotnet/roslyn/issues/40325
|
||||
|
|
@ -8,7 +8,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// <summary>
|
||||
/// An opinionated service to handle logging for plugins.
|
||||
/// </summary>
|
||||
public interface IPluginLog
|
||||
public interface IPluginLog : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a Serilog ILogger instance for this plugin. This is the entrypoint for plugins that wish to use more
|
||||
|
|
|
|||
168
Dalamud/Plugin/Services/IReliableFileStorage.cs
Normal file
168
Dalamud/Plugin/Services/IReliableFileStorage.cs
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Dalamud.Configuration;
|
||||
using Dalamud.Storage;
|
||||
|
||||
namespace Dalamud.Plugin.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Service to interact with the file system, as a replacement for standard C# file I/O.
|
||||
/// Writes and reads using this service are, to the best of our ability, atomic and reliable.
|
||||
///
|
||||
/// All data is synced to disk immediately and written to a database, additionally to files on disk. This means
|
||||
/// that in case of file corruption, data can likely be recovered from the database.
|
||||
///
|
||||
/// However, this also means that operations using this service duplicate data on disk, so we don't recommend
|
||||
/// performing large file operations. The service will not permit files larger than <see cref="MaxFileSizeBytes"/>
|
||||
/// (64MB) to be written.
|
||||
///
|
||||
/// Saved configuration data using the <see cref="PluginConfigurations"/> class uses this functionality implicitly.
|
||||
/// </summary>
|
||||
[Experimental("Dalamud001")]
|
||||
public interface IReliableFileStorage : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the maximum file size, in bytes, that can be written using this service.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The service enforces this limit when writing files and fails with an appropriate exception
|
||||
/// (for example <see cref="ArgumentException"/> or a custom exception) when a caller attempts to write
|
||||
/// more than this number of bytes.
|
||||
/// </remarks>
|
||||
long MaxFileSizeBytes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Check whether a file exists either on the local filesystem or in the transparent backup database.
|
||||
/// </summary>
|
||||
/// <param name="path">The file system path to check. Must not be null or empty.</param>
|
||||
/// <returns>
|
||||
/// True if the file exists on disk or a backup copy exists in the storage's internal journal/backup database;
|
||||
/// otherwise false.
|
||||
/// </returns>
|
||||
/// <exception cref="ArgumentException">Thrown when <paramref name="path"/> is null or empty.</exception>
|
||||
bool Exists(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Write the given text into a file using UTF-8 encoding. The write is performed atomically and is persisted to
|
||||
/// both the filesystem and the internal backup database used by this service.
|
||||
/// </summary>
|
||||
/// <param name="path">The file path to write to. Must not be null or empty.</param>
|
||||
/// <param name="contents">The string contents to write. May be null, in which case an empty file is written.</param>
|
||||
/// <returns>A <see cref="Task"/> that completes when the write has finished and been flushed to disk and the backup.</returns>
|
||||
/// <exception cref="ArgumentException">Thrown when <paramref name="path"/> is null or empty.</exception>
|
||||
Task WriteAllTextAsync(string path, string? contents);
|
||||
|
||||
/// <summary>
|
||||
/// Write the given text into a file using the provided <paramref name="encoding"/>. The write is performed
|
||||
/// atomically (to the extent possible) and is persisted to both the filesystem and the internal backup database
|
||||
/// used by this service.
|
||||
/// </summary>
|
||||
/// <param name="path">The file path to write to. Must not be null or empty.</param>
|
||||
/// <param name="contents">The string contents to write. May be null, in which case an empty file is written.</param>
|
||||
/// <param name="encoding">The text encoding to use when serializing the string to bytes. Must not be null.</param>
|
||||
/// <returns>A <see cref="Task"/> that completes when the write has finished and been flushed to disk and the backup.</returns>
|
||||
/// <exception cref="ArgumentException">Thrown when <paramref name="path"/> is null or empty.</exception>
|
||||
/// <exception cref="ArgumentNullException">Thrown when <paramref name="encoding"/> is null.</exception>
|
||||
Task WriteAllTextAsync(string path, string? contents, Encoding encoding);
|
||||
|
||||
/// <summary>
|
||||
/// Write the given bytes to a file. The write is persisted to both the filesystem and the service's internal
|
||||
/// backup database. Avoid writing extremely large byte arrays because this service duplicates data on disk.
|
||||
/// </summary>
|
||||
/// <param name="path">The file path to write to. Must not be null or empty.</param>
|
||||
/// <param name="bytes">The raw bytes to write. Must not be null.</param>
|
||||
/// <returns>A <see cref="Task"/> that completes when the write has finished and been flushed to disk and the backup.</returns>
|
||||
/// <exception cref="ArgumentException">Thrown when <paramref name="path"/> is null or empty.</exception>
|
||||
/// <exception cref="ArgumentNullException">Thrown when <paramref name="bytes"/> is null.</exception>
|
||||
Task WriteAllBytesAsync(string path, byte[] bytes);
|
||||
|
||||
/// <summary>
|
||||
/// Read all text from a file using UTF-8 encoding. If the file is unreadable or missing on disk, the service
|
||||
/// attempts to return a backed-up copy from its internal journal/backup database.
|
||||
/// </summary>
|
||||
/// <param name="path">The file path to read. Must not be null or empty.</param>
|
||||
/// <param name="forceBackup">
|
||||
/// When true the service prefers the internal backup database and returns backed-up contents if available. When
|
||||
/// false the service tries the filesystem first and falls back to the backup only on error or when the file is missing.
|
||||
/// </param>
|
||||
/// <returns>The textual contents of the file, decoded using UTF-8.</returns>
|
||||
/// <exception cref="ArgumentException">Thrown when <paramref name="path"/> is null or empty.</exception>
|
||||
/// <exception cref="FileNotFoundException">Thrown when the file does not exist on disk and no backup copy is available.</exception>
|
||||
Task<string> ReadAllTextAsync(string path, bool forceBackup = false);
|
||||
|
||||
/// <summary>
|
||||
/// Read all text from a file using the specified <paramref name="encoding"/>. If the file is unreadable or
|
||||
/// missing on disk, the service attempts to return a backed-up copy from its internal journal/backup database.
|
||||
/// </summary>
|
||||
/// <param name="path">The file path to read. Must not be null or empty.</param>
|
||||
/// <param name="encoding">The encoding to use when decoding the stored bytes into text. Must not be null.</param>
|
||||
/// <param name="forceBackup">
|
||||
/// When true the service prefers the internal backup database and returns backed-up contents if available. When
|
||||
/// false the service tries the filesystem first and falls back to the backup only on error or when the file is missing.
|
||||
/// </param>
|
||||
/// <returns>The textual contents of the file decoded using the provided <paramref name="encoding"/>.</returns>
|
||||
/// <exception cref="ArgumentException">Thrown when <paramref name="path"/> is null or empty.</exception>
|
||||
/// <exception cref="ArgumentNullException">Thrown when <paramref name="encoding"/> is null.</exception>
|
||||
/// <exception cref="FileNotFoundException">Thrown when the file does not exist on disk and no backup copy is available.</exception>
|
||||
Task<string> ReadAllTextAsync(string path, Encoding encoding, bool forceBackup = false);
|
||||
|
||||
/// <summary>
|
||||
/// Read all text from a file and invoke the provided <paramref name="reader"/> callback with the string
|
||||
/// contents. If the reader throws or the initial read fails, the service attempts a backup read and invokes the
|
||||
/// reader again with the backup contents. If both reads fail the service surfaces an exception to the caller.
|
||||
/// </summary>
|
||||
/// <param name="path">The file path to read. Must not be null or empty.</param>
|
||||
/// <param name="reader">
|
||||
/// A callback invoked with the file's textual contents. Must not be null.
|
||||
/// If the callback throws an exception the service treats that as a signal to retry the read using the
|
||||
/// internal backup database and will invoke the callback again with the backup contents when available.
|
||||
/// For example, the callback can throw when JSON deserialization fails to request the backup copy instead of
|
||||
/// silently accepting corrupt data.
|
||||
/// </param>
|
||||
/// <returns>A <see cref="Task"/> that completes when the read (and any attempted fallback) and callback invocation have finished.</returns>
|
||||
/// <exception cref="ArgumentException">Thrown when <paramref name="path"/> is null or empty.</exception>
|
||||
/// <exception cref="ArgumentNullException">Thrown when <paramref name="reader"/> is null.</exception>
|
||||
/// <exception cref="FileNotFoundException">Thrown when the file does not exist on disk and no backup copy is available.</exception>
|
||||
/// <exception cref="FileReadException">Thrown when both the filesystem read and the backup read fail for other reasons.</exception>
|
||||
Task ReadAllTextAsync(string path, Action<string> reader);
|
||||
|
||||
/// <summary>
|
||||
/// Read all text from a file using the specified <paramref name="encoding"/> and invoke the provided
|
||||
/// <paramref name="reader"/> callback with the decoded string contents. If the reader throws or the initial
|
||||
/// read fails, the service attempts a backup read and invokes the reader again with the backup contents. If
|
||||
/// both reads fail the service surfaces an exception to the caller.
|
||||
/// </summary>
|
||||
/// <param name="path">The file path to read. Must not be null or empty.</param>
|
||||
/// <param name="encoding">The encoding to use when decoding the stored bytes into text. Must not be null.</param>
|
||||
/// <param name="reader">
|
||||
/// A callback invoked with the file's textual contents. Must not be null.
|
||||
/// If the callback throws an exception the service treats that as a signal to retry the read using the
|
||||
/// internal backup database and will invoke the callback again with the backup contents when available.
|
||||
/// For example, the callback can throw when JSON deserialization fails to request the backup copy instead of
|
||||
/// silently accepting corrupt data.
|
||||
/// </param>
|
||||
/// <returns>A <see cref="Task"/> that completes when the read (and any attempted fallback) and callback invocation have finished.</returns>
|
||||
/// <exception cref="ArgumentException">Thrown when <paramref name="path"/> is null or empty.</exception>
|
||||
/// <exception cref="ArgumentNullException">Thrown when <paramref name="encoding"/> or <paramref name="reader"/> is null.</exception>
|
||||
/// <exception cref="FileNotFoundException">Thrown when the file does not exist on disk and no backup copy is available.</exception>
|
||||
/// <exception cref="FileReadException">Thrown when both the filesystem read and the backup read fail for other reasons.</exception>
|
||||
Task ReadAllTextAsync(string path, Encoding encoding, Action<string> reader);
|
||||
|
||||
/// <summary>
|
||||
/// Read all bytes from a file. If the file is unreadable or missing on disk, the service may try to return a
|
||||
/// backed-up copy from its internal journal/backup database.
|
||||
/// </summary>
|
||||
/// <param name="path">The file path to read. Must not be null or empty.</param>
|
||||
/// <param name="forceBackup">
|
||||
/// When true the service prefers the internal backup database and returns the backed-up contents
|
||||
/// if available. When false the service tries the filesystem first and falls back to the backup only
|
||||
/// on error or when the file is missing.
|
||||
/// </param>
|
||||
/// <returns>The raw bytes stored in the file.</returns>
|
||||
/// <exception cref="ArgumentException">Thrown when <paramref name="path"/> is null or empty.</exception>
|
||||
/// <exception cref="FileNotFoundException">Thrown when the file does not exist on disk and no backup copy is available.</exception>
|
||||
Task<byte[]> ReadAllBytesAsync(string path, bool forceBackup = false);
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// <summary>
|
||||
/// Defines a service for retrieving localized text for various in-game entities.
|
||||
/// </summary>
|
||||
public interface ISeStringEvaluator
|
||||
public interface ISeStringEvaluator : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// Evaluates macros in a <see cref="ReadOnlySeString"/>.
|
||||
|
|
@ -38,6 +38,15 @@ public interface ISeStringEvaluator
|
|||
/// <returns>An evaluated <see cref="ReadOnlySeString"/>.</returns>
|
||||
ReadOnlySeString EvaluateMacroString(string macroString, Span<SeStringParameter> localParameters = default, ClientLanguage? language = null);
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates macros in a macro string.
|
||||
/// </summary>
|
||||
/// <param name="macroString">The macro string.</param>
|
||||
/// <param name="localParameters">An optional list of local parameters.</param>
|
||||
/// <param name="language">An optional language override.</param>
|
||||
/// <returns>An evaluated <see cref="ReadOnlySeString"/>.</returns>
|
||||
ReadOnlySeString EvaluateMacroString(ReadOnlySpan<byte> macroString, Span<SeStringParameter> localParameters = default, ClientLanguage? language = null);
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates macros in text from the Addon sheet.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -2,12 +2,14 @@ using System.Collections.Generic;
|
|||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
|
||||
using Dalamud.Plugin.Services;
|
||||
|
||||
namespace Dalamud.Game;
|
||||
|
||||
/// <summary>
|
||||
/// A SigScanner facilitates searching for memory signatures in a given ProcessModule.
|
||||
/// </summary>
|
||||
public interface ISigScanner
|
||||
public interface ISigScanner : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the search on this module is performed on a copy.
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
using Dalamud.Game.ClientState.Objects.Types;
|
||||
using Dalamud.Game.ClientState.Objects.Types;
|
||||
using Dalamud.Plugin.Services;
|
||||
|
||||
namespace Dalamud.Game.ClientState.Objects;
|
||||
|
||||
/// <summary>
|
||||
/// Get and set various kinds of targets for the player.
|
||||
/// </summary>
|
||||
public interface ITargetManager
|
||||
public interface ITargetManager : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the current target.
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// <see cref="TexWidget"/>.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public interface ITextureProvider
|
||||
public interface ITextureProvider : IDalamudService
|
||||
{
|
||||
/// <summary>Creates an empty texture.</summary>
|
||||
/// <param name="specs">Texture specifications.</param>
|
||||
|
|
|
|||
|
|
@ -3,14 +3,13 @@ using System.IO;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Dalamud.Interface.Internal;
|
||||
using Dalamud.Interface.Textures;
|
||||
using Dalamud.Interface.Textures.TextureWraps;
|
||||
|
||||
namespace Dalamud.Plugin.Services;
|
||||
|
||||
/// <summary>Service that grants you to read instances of <see cref="IDalamudTextureWrap"/>.</summary>
|
||||
public interface ITextureReadbackProvider
|
||||
public interface ITextureReadbackProvider : IDalamudService
|
||||
{
|
||||
/// <summary>Gets the raw data of a texture wrap.</summary>
|
||||
/// <param name="wrap">The source texture wrap.</param>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Dalamud.Plugin.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Service that grants you the ability to replace texture data that is to be loaded by Dalamud.
|
||||
/// </summary>
|
||||
public interface ITextureSubstitutionProvider
|
||||
public interface ITextureSubstitutionProvider : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// Delegate describing a function that may be used to intercept and replace texture data.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Textures;
|
||||
|
|
@ -8,7 +8,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// <summary>
|
||||
/// Interface for class responsible for managing elements in the title screen menu.
|
||||
/// </summary>
|
||||
public interface ITitleScreenMenu
|
||||
public interface ITitleScreenMenu : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the list of read only entries in the title screen menu.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Dalamud.Game.Gui.Toast;
|
||||
using Dalamud.Game.Gui.Toast;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
|
||||
namespace Dalamud.Plugin.Services;
|
||||
|
|
@ -6,7 +6,7 @@ namespace Dalamud.Plugin.Services;
|
|||
/// <summary>
|
||||
/// This class facilitates interacting with and creating native toast windows.
|
||||
/// </summary>
|
||||
public interface IToastGui
|
||||
public interface IToastGui : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// A delegate type used when a normal toast window appears.
|
||||
|
|
|
|||
328
Dalamud/Plugin/Services/IUnlockState.cs
Normal file
328
Dalamud/Plugin/Services/IUnlockState.cs
Normal file
|
|
@ -0,0 +1,328 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
using Lumina.Excel;
|
||||
using Lumina.Excel.Sheets;
|
||||
|
||||
namespace Dalamud.Plugin.Services;
|
||||
|
||||
#pragma warning disable SA1400 // Access modifier should be declared: Interface members are public by default
|
||||
|
||||
/// <summary>
|
||||
/// Interface for determining unlock state of various content in the game.
|
||||
/// </summary>
|
||||
[Experimental("Dalamud001")]
|
||||
public interface IUnlockState : IDalamudService
|
||||
{
|
||||
/// <summary>
|
||||
/// A delegate type used for the <see cref="Unlock"/> event.
|
||||
/// </summary>
|
||||
/// <param name="rowRef">A RowRef of the unlocked thing.</param>
|
||||
delegate void UnlockDelegate(RowRef rowRef);
|
||||
|
||||
/// <summary>
|
||||
/// Event triggered when something was unlocked.
|
||||
/// </summary>
|
||||
event UnlockDelegate? Unlock;
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified Action is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The Action row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsActionUnlocked(Lumina.Excel.Sheets.Action row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified AetherCurrentCompFlgSet is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The AetherCurrentCompFlgSet row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsAetherCurrentCompFlgSetUnlocked(AetherCurrentCompFlgSet row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified AetherCurrent is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The AetherCurrent row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsAetherCurrentUnlocked(AetherCurrent row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified AozAction (Blue Mage Action) is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The AozAction row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsAozActionUnlocked(AozAction row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified BannerBg (Portrait Backgrounds) is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The BannerBg row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsBannerBgUnlocked(BannerBg row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified BannerCondition is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The BannerCondition row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsBannerConditionUnlocked(BannerCondition row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified BannerDecoration (Portrait Accents) is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The BannerDecoration row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsBannerDecorationUnlocked(BannerDecoration row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified BannerFacial (Portrait Expressions) is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The BannerFacial row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsBannerFacialUnlocked(BannerFacial row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified BannerFrame (Portrait Frames) is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The BannerFrame row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsBannerFrameUnlocked(BannerFrame row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified BannerTimeline (Portrait Poses) is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The BannerTimeline row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsBannerTimelineUnlocked(BannerTimeline row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified BuddyAction (Action of the players Chocobo Companion) is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The BuddyAction row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsBuddyActionUnlocked(BuddyAction row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified BuddyEquip (Equipment of the players Chocobo Companion) is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The BuddyEquip row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsBuddyEquipUnlocked(BuddyEquip row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified CharaMakeCustomize (Hairstyles and Face Paint patterns) is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The CharaMakeCustomize row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsCharaMakeCustomizeUnlocked(CharaMakeCustomize row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified ChocoboTaxiStand (Chocobokeeps of the Chocobo Porter service) is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The ChocoboTaxiStand row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsChocoboTaxiStandUnlocked(ChocoboTaxiStand row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified Companion (Minions) is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The Companion row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsCompanionUnlocked(Companion row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified CraftAction is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The CraftAction row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsCraftActionUnlocked(CraftAction row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified CSBonusContentType is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The CSBonusContentType row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsCSBonusContentTypeUnlocked(CSBonusContentType row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified Emote is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The Emote row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsEmoteUnlocked(Emote row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified EmjVoiceNpc (Doman Mahjong Characters) is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The EmjVoiceNpc row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsEmjVoiceNpcUnlocked(EmjVoiceNpc row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified EmjCostume (Doman Mahjong Character Costume) is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The EmjCostume row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsEmjCostumeUnlocked(EmjCostume row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified GeneralAction is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The GeneralAction row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsGeneralActionUnlocked(GeneralAction row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified Glasses is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The Glasses row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsGlassesUnlocked(Glasses row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified HowTo is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The HowTo row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsHowToUnlocked(HowTo row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified InstanceContent is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The InstanceContent row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsInstanceContentUnlocked(InstanceContent row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified Item is considered unlockable.
|
||||
/// </summary>
|
||||
/// <param name="row">The Item row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlockable; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsItemUnlockable(Item row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified Item is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The Item row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsItemUnlocked(Item row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified McGuffin is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The McGuffin row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsMcGuffinUnlocked(McGuffin row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified MJILandmark (Island Sanctuary landmark) is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The MJILandmark row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsMJILandmarkUnlocked(MJILandmark row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified MKDLore (Occult Record) is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The MKDLore row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsMKDLoreUnlocked(MKDLore row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified Mount is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The Mount row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsMountUnlocked(Mount row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified NotebookDivision (Categories in Crafting/Gathering Log) is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The NotebookDivision row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsNotebookDivisionUnlocked(NotebookDivision row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified Orchestrion roll is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The Orchestrion row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsOrchestrionUnlocked(Orchestrion row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified Ornament (Fashion Accessories) is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The Ornament row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsOrnamentUnlocked(Ornament row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified Perform (Performance Instruments) is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The Perform row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsPerformUnlocked(Perform row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified PublicContent is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The PublicContent row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsPublicContentUnlocked(PublicContent row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified Recipe is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The Recipe row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsRecipeUnlocked(Recipe row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the underlying RowRef type is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="rowRef">The RowRef to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsRowRefUnlocked(RowRef rowRef);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the underlying RowRef type is unlocked.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the Excel row.</typeparam>
|
||||
/// <param name="rowRef">The RowRef to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsRowRefUnlocked<T>(RowRef<T> rowRef) where T : struct, IExcelRow<T>;
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified SecretRecipeBook (Master Recipe Books) is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The SecretRecipeBook row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsSecretRecipeBookUnlocked(SecretRecipeBook row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified Trait is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The Trait row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsTraitUnlocked(Trait row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified TripleTriadCard is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="row">The TripleTriadCard row to check.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsTripleTriadCardUnlocked(TripleTriadCard row);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified unlock link is unlocked or quest is completed.
|
||||
/// </summary>
|
||||
/// <param name="unlockLink">The unlock link id or quest id (quest ids in this case are over 65536).</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsUnlockLinkUnlocked(uint unlockLink);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified unlock link is unlocked.
|
||||
/// </summary>
|
||||
/// <param name="unlockLink">The unlock link id.</param>
|
||||
/// <returns><see langword="true"/> if unlocked; otherwise, <see langword="false"/>.</returns>
|
||||
bool IsUnlockLinkUnlocked(ushort unlockLink);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue