mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-31 21:03:43 +01:00
Merge branch 'api12'
This commit is contained in:
commit
f94f03e114
137 changed files with 6870 additions and 944 deletions
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
|
@ -216,7 +216,12 @@ internal class PluginManagementCommandHandler : IInternalDisposableService
|
|||
|
||||
this.chat.Print(onSuccess);
|
||||
}
|
||||
|
||||
|
||||
if (operation == PluginCommandOperation.Toggle)
|
||||
{
|
||||
operation = plugin.State == PluginState.Loaded ? PluginCommandOperation.Disable : PluginCommandOperation.Enable;
|
||||
}
|
||||
|
||||
switch (operation)
|
||||
{
|
||||
case PluginCommandOperation.Enable:
|
||||
|
|
@ -235,14 +240,6 @@ internal class PluginManagementCommandHandler : IInternalDisposableService
|
|||
Loc.Localize("PluginCommandsDisableFailed", "Failed to disable plugin \"{0}\". Please check the console for errors.").Format(plugin.Name)))
|
||||
.ConfigureAwait(false);
|
||||
break;
|
||||
case PluginCommandOperation.Toggle:
|
||||
this.chat.Print(Loc.Localize("PluginCommandsToggling", "Toggling plugin \"{0}\"...").Format(plugin.Name));
|
||||
Task.Run(() => plugin.State == PluginState.Loaded ? plugin.UnloadAsync() : plugin.LoadAsync(PluginLoadReason.Installer))
|
||||
.ContinueWith(t => Continuation(t,
|
||||
Loc.Localize("PluginCommandsToggleSuccess", "Plugin \"{0}\" toggled.").Format(plugin.Name),
|
||||
Loc.Localize("PluginCommandsToggleFailed", "Failed to toggle plugin \"{0}\". Please check the console for errors.").Format(plugin.Name)))
|
||||
.ConfigureAwait(false);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(operation), operation, null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,32 +3,31 @@ namespace Dalamud.Plugin;
|
|||
/// <summary>
|
||||
/// This enum reflects reasons for loading a plugin.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum PluginLoadReason
|
||||
{
|
||||
/// <summary>
|
||||
/// We don't know why this plugin was loaded.
|
||||
/// </summary>
|
||||
Unknown,
|
||||
Unknown = 1 << 0,
|
||||
|
||||
/// <summary>
|
||||
/// This plugin was loaded because it was installed with the plugin installer.
|
||||
/// </summary>
|
||||
Installer,
|
||||
Installer = 1 << 1,
|
||||
|
||||
/// <summary>
|
||||
/// This plugin was loaded because it was just updated.
|
||||
/// </summary>
|
||||
Update,
|
||||
Update = 1 << 2,
|
||||
|
||||
/// <summary>
|
||||
/// This plugin was loaded because it was told to reload.
|
||||
/// </summary>
|
||||
Reload,
|
||||
Reload = 1 << 3,
|
||||
|
||||
/// <summary>
|
||||
/// This plugin was loaded because the game was started or Dalamud was reinjected.
|
||||
/// </summary>
|
||||
Boot,
|
||||
Boot = 1 << 4,
|
||||
}
|
||||
|
||||
// TODO(api9): This should be a mask, so that we can combine Installer | ProfileLoaded
|
||||
|
|
|
|||
79
Dalamud/Plugin/Services/ISeStringEvaluator.cs
Normal file
79
Dalamud/Plugin/Services/ISeStringEvaluator.cs
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
using Dalamud.Game;
|
||||
using Dalamud.Game.ClientState.Objects.Enums;
|
||||
using Dalamud.Game.Text.Evaluator;
|
||||
|
||||
using Lumina.Text.ReadOnly;
|
||||
|
||||
namespace Dalamud.Plugin.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Defines a service for retrieving localized text for various in-game entities.
|
||||
/// </summary>
|
||||
[Experimental("SeStringEvaluator")]
|
||||
public interface ISeStringEvaluator
|
||||
{
|
||||
/// <summary>
|
||||
/// Evaluates macros in a <see cref="ReadOnlySeString"/>.
|
||||
/// </summary>
|
||||
/// <param name="str">The string containing macros.</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 Evaluate(ReadOnlySeString str, Span<SeStringParameter> localParameters = default, ClientLanguage? language = null);
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates macros in a <see cref="ReadOnlySeStringSpan"/>.
|
||||
/// </summary>
|
||||
/// <param name="str">The string containing macros.</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 Evaluate(ReadOnlySeStringSpan str, Span<SeStringParameter> localParameters = default, ClientLanguage? language = null);
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates macros in text from the Addon sheet.
|
||||
/// </summary>
|
||||
/// <param name="addonId">The row id of the Addon sheet.</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 EvaluateFromAddon(uint addonId, Span<SeStringParameter> localParameters = default, ClientLanguage? language = null);
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates macros in text from the Lobby sheet.
|
||||
/// </summary>
|
||||
/// <param name="lobbyId">The row id of the Lobby sheet.</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 EvaluateFromLobby(uint lobbyId, Span<SeStringParameter> localParameters = default, ClientLanguage? language = null);
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates macros in text from the LogMessage sheet.
|
||||
/// </summary>
|
||||
/// <param name="logMessageId">The row id of the LogMessage sheet.</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 EvaluateFromLogMessage(uint logMessageId, Span<SeStringParameter> localParameters = default, ClientLanguage? language = null);
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates ActStr from the given ActionKind and id.
|
||||
/// </summary>
|
||||
/// <param name="actionKind">The ActionKind.</param>
|
||||
/// <param name="id">The action id.</param>
|
||||
/// <param name="language">An optional language override.</param>
|
||||
/// <returns>The name of the action.</returns>
|
||||
string EvaluateActStr(ActionKind actionKind, uint id, ClientLanguage? language = null);
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates ObjStr from the given ObjectKind and id.
|
||||
/// </summary>
|
||||
/// <param name="objectKind">The ObjectKind.</param>
|
||||
/// <param name="id">The object id.</param>
|
||||
/// <param name="language">An optional language override.</param>
|
||||
/// <returns>The singular name of the object.</returns>
|
||||
string EvaluateObjStr(ObjectKind objectKind, uint id, ClientLanguage? language = null);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue