Dalamud/Dalamud/Plugin/Services/ISeStringEvaluator.cs
Haselnussbomber fdbfdbb2cd
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>
2025-03-24 09:00:27 -07:00

79 lines
3.8 KiB
C#

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);
}