mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-29 11:59:21 +01:00
Add SeStringEvaluator service (#2188)
* Add SeStringEvaluator service * Move DrawCopyableText into WidgetUtil * Use Icon2RemapTable in SeStringRenderer * Beautify some code * Make sure to use the correct language * Add SeString Creator widget * Fix getting local parameters * Update expressionNames * misc changes * Use InvariantCulture in TryResolveSheet * Add SeStringEvaluatorAgingStep * Fix item id comparisons * Add SheetRedirectResolverAgingStep * Add NounProcessorAgingStep * Update SeString.CreateItemLink This also adds the internal ItemUtil class. * Fix name of SeStringCreator widget * Add Global Parameters tab to SeStringCreatorWidget * Load widgets on demand * Update SeStringCreatorWidget * Resizable SeStringCreatorWidget panels * Update GamepadStateAgingStep * Experimental status was removed in #2144 * Update SheetRedirectResolver, rewrite Noun params * Fixes for 4 am code * Remove incorrect column offset I have no idea how that happened. * Draw names of linked things --------- Co-authored-by: Soreepeong <3614868+Soreepeong@users.noreply.github.com> Co-authored-by: KazWolfe <KazWolfe@users.noreply.github.com>
This commit is contained in:
parent
7cac19ce81
commit
fdbfdbb2cd
36 changed files with 5831 additions and 196 deletions
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