Merge branch 'v9' into ihookprovider

This commit is contained in:
goat 2023-09-21 21:42:08 +02:00 committed by GitHub
commit a59875bb77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
164 changed files with 6033 additions and 1795 deletions

View file

@ -0,0 +1,46 @@
using Dalamud.Game.AddonEventManager;
namespace Dalamud.Plugin.Services;
/// <summary>
/// Service provider for addon event management.
/// </summary>
public interface IAddonEventManager
{
/// <summary>
/// Delegate to be called when an event is received.
/// </summary>
/// <param name="atkEventType">Event type for this event handler.</param>
/// <param name="atkUnitBase">The parent addon for this event handler.</param>
/// <param name="atkResNode">The specific node that will trigger this event handler.</param>
public delegate void AddonEventHandler(AddonEventType atkEventType, nint atkUnitBase, nint atkResNode);
/// <summary>
/// Registers an event handler for the specified addon, node, and type.
/// </summary>
/// <param name="eventId">Unique Id for this event, maximum 0x10000.</param>
/// <param name="atkUnitBase">The parent addon for this event.</param>
/// <param name="atkResNode">The node that will trigger this event.</param>
/// <param name="eventType">The event type for this event.</param>
/// <param name="eventHandler">The handler to call when event is triggered.</param>
void AddEvent(uint eventId, nint atkUnitBase, nint atkResNode, AddonEventType eventType, AddonEventHandler eventHandler);
/// <summary>
/// Unregisters an event handler with the specified event id and event type.
/// </summary>
/// <param name="eventId">The Unique Id for this event.</param>
/// <param name="atkResNode">The node for this event.</param>
/// <param name="eventType">The event type for this event.</param>
void RemoveEvent(uint eventId, nint atkResNode, AddonEventType eventType);
/// <summary>
/// Force the game cursor to be the specified cursor.
/// </summary>
/// <param name="cursor">Which cursor to use.</param>
void SetCursor(AddonCursorType cursor);
/// <summary>
/// Un-forces the game cursor.
/// </summary>
void ResetCursor();
}

View file

@ -0,0 +1,80 @@
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Dalamud.Game.AddonLifecycle;
namespace Dalamud.Plugin.Services;
/// <summary>
/// This class provides events for in-game addon lifecycles.
/// </summary>
public interface IAddonLifecycle
{
/// <summary>
/// Delegate for receiving addon lifecycle event messages.
/// </summary>
/// <param name="eventType">The event type that triggered the message.</param>
/// <param name="addonInfo">Information about what addon triggered the message.</param>
public delegate void AddonEventDelegate(AddonEvent eventType, AddonArgs addonInfo);
/// <summary>
/// Register a listener that will trigger on the specified event and any of the specified addons.
/// </summary>
/// <param name="eventType">Event type to trigger on.</param>
/// <param name="addonNames">Addon names that will trigger the handler to be invoked.</param>
/// <param name="handler">The handler to invoke.</param>
void RegisterListener(AddonEvent eventType, IEnumerable<string> addonNames, AddonEventDelegate handler);
/// <summary>
/// Register a listener that will trigger on the specified event only for the specified addon.
/// </summary>
/// <param name="eventType">Event type to trigger on.</param>
/// <param name="addonName">The addon name that will trigger the handler to be invoked.</param>
/// <param name="handler">The handler to invoke.</param>
void RegisterListener(AddonEvent eventType, string addonName, AddonEventDelegate handler);
/// <summary>
/// Register a listener that will trigger on the specified event for any addon.
/// </summary>
/// <param name="eventType">Event type to trigger on.</param>
/// <param name="handler">The handler to invoke.</param>
void RegisterListener(AddonEvent eventType, AddonEventDelegate handler);
/// <summary>
/// Unregister listener from specified event type and specified addon names.
/// </summary>
/// <remarks>
/// If a specific handler is not provided, all handlers for the event type and addon names will be unregistered.
/// </remarks>
/// <param name="eventType">Event type to deregister.</param>
/// <param name="addonNames">Addon names to deregister.</param>
/// <param name="handler">Optional specific handler to remove.</param>
void UnregisterListener(AddonEvent eventType, IEnumerable<string> addonNames, [Optional] AddonEventDelegate handler);
/// <summary>
/// Unregister all listeners for the specified event type and addon name.
/// </summary>
/// <remarks>
/// If a specific handler is not provided, all handlers for the event type and addons will be unregistered.
/// </remarks>
/// <param name="eventType">Event type to deregister.</param>
/// <param name="addonName">Addon name to deregister.</param>
/// <param name="handler">Optional specific handler to remove.</param>
void UnregisterListener(AddonEvent eventType, string addonName, [Optional] AddonEventDelegate handler);
/// <summary>
/// Unregister an event type handler.<br/>This will only remove a handler that is added via <see cref="RegisterListener(AddonEvent, AddonEventDelegate)"/>.
/// </summary>
/// <remarks>
/// If a specific handler is not provided, all handlers for the event type and addons will be unregistered.
/// </remarks>
/// <param name="eventType">Event type to deregister.</param>
/// <param name="handler">Optional specific handler to remove.</param>
void UnregisterListener(AddonEvent eventType, [Optional] AddonEventDelegate handler);
/// <summary>
/// Unregister all events that use the specified handlers.
/// </summary>
/// <param name="handlers">Handlers to remove.</param>
void UnregisterListener(params AddonEventDelegate[] handlers);
}

View file

@ -0,0 +1,117 @@
using Dalamud.Game.Gui;
using Dalamud.Game.Text;
using Dalamud.Game.Text.SeStringHandling;
namespace Dalamud.Plugin.Services;
/// <summary>
/// This class handles interacting with the native chat UI.
/// </summary>
public interface IChatGui
{
/// <summary>
/// A delegate type used with the <see cref="ChatGui.ChatMessage"/> event.
/// </summary>
/// <param name="type">The type of chat.</param>
/// <param name="senderId">The sender ID.</param>
/// <param name="sender">The sender name.</param>
/// <param name="message">The message sent.</param>
/// <param name="isHandled">A value indicating whether the message was handled or should be propagated.</param>
public delegate void OnMessageDelegate(XivChatType type, uint senderId, ref SeString sender, ref SeString message, ref bool isHandled);
/// <summary>
/// A delegate type used with the <see cref="ChatGui.CheckMessageHandled"/> event.
/// </summary>
/// <param name="type">The type of chat.</param>
/// <param name="senderId">The sender ID.</param>
/// <param name="sender">The sender name.</param>
/// <param name="message">The message sent.</param>
/// <param name="isHandled">A value indicating whether the message was handled or should be propagated.</param>
public delegate void OnCheckMessageHandledDelegate(XivChatType type, uint senderId, ref SeString sender, ref SeString message, ref bool isHandled);
/// <summary>
/// A delegate type used with the <see cref="ChatGui.ChatMessageHandled"/> event.
/// </summary>
/// <param name="type">The type of chat.</param>
/// <param name="senderId">The sender ID.</param>
/// <param name="sender">The sender name.</param>
/// <param name="message">The message sent.</param>
public delegate void OnMessageHandledDelegate(XivChatType type, uint senderId, SeString sender, SeString message);
/// <summary>
/// A delegate type used with the <see cref="ChatGui.ChatMessageUnhandled"/> event.
/// </summary>
/// <param name="type">The type of chat.</param>
/// <param name="senderId">The sender ID.</param>
/// <param name="sender">The sender name.</param>
/// <param name="message">The message sent.</param>
public delegate void OnMessageUnhandledDelegate(XivChatType type, uint senderId, SeString sender, SeString message);
/// <summary>
/// Event that will be fired when a chat message is sent to chat by the game.
/// </summary>
public event OnMessageDelegate ChatMessage;
/// <summary>
/// Event that allows you to stop messages from appearing in chat by setting the isHandled parameter to true.
/// </summary>
public event OnCheckMessageHandledDelegate CheckMessageHandled;
/// <summary>
/// Event that will be fired when a chat message is handled by Dalamud or a Plugin.
/// </summary>
public event OnMessageHandledDelegate ChatMessageHandled;
/// <summary>
/// Event that will be fired when a chat message is not handled by Dalamud or a Plugin.
/// </summary>
public event OnMessageUnhandledDelegate ChatMessageUnhandled;
/// <summary>
/// Gets the ID of the last linked item.
/// </summary>
public int LastLinkedItemId { get; }
/// <summary>
/// Gets the flags of the last linked item.
/// </summary>
public byte LastLinkedItemFlags { get; }
/// <summary>
/// Queue a chat message. Dalamud will send queued messages on the next framework event.
/// </summary>
/// <param name="chat">A message to send.</param>
public void Print(XivChatEntry chat);
/// <summary>
/// Queue a chat message. Dalamud will send queued messages on the next framework event.
/// </summary>
/// <param name="message">A message to send.</param>
/// <param name="messageTag">String to prepend message with "[messageTag] ".</param>
/// <param name="tagColor">Color to display the message tag with.</param>
public void Print(string message, string? messageTag = null, ushort? tagColor = null);
/// <summary>
/// Queue a chat message. Dalamud will send queued messages on the next framework event.
/// </summary>
/// <param name="message">A message to send.</param>
/// <param name="messageTag">String to prepend message with "[messageTag] ".</param>
/// <param name="tagColor">Color to display the message tag with.</param>
public void Print(SeString message, string? messageTag = null, ushort? tagColor = null);
/// <summary>
/// Queue a chat message. Dalamud will send queued messages on the next framework event.
/// </summary>
/// <param name="message">A message to send.</param>
/// <param name="messageTag">String to prepend message with "[messageTag] ".</param>
/// <param name="tagColor">Color to display the message tag with.</param>
public void PrintError(string message, string? messageTag = null, ushort? tagColor = null);
/// <summary>
/// Queue a chat message. Dalamud will send queued messages on the next framework event.
/// </summary>
/// <param name="message">A message to send.</param>
/// <param name="messageTag">String to prepend message with "[messageTag] ".</param>
/// <param name="tagColor">Color to display the message tag with.</param>
public void PrintError(SeString message, string? messageTag = null, ushort? tagColor = null);
}

View file

@ -73,4 +73,9 @@ public interface IClientState
/// Gets a value indicating whether or not the user is playing PvP, excluding the Wolves' Den.
/// </summary>
public bool IsPvPExcludingDen { get; }
/// <summary>
/// Gets a value indicating whether the client is currently in Group Pose (GPose) mode.
/// </summary>
public bool IsGPosing { get; }
}

View file

@ -19,17 +19,7 @@ public interface IDataManager
/// Gets the current game client language.
/// </summary>
public ClientLanguage Language { get; }
/// <summary>
/// Gets the OpCodes sent by the server to the client.
/// </summary>
public ReadOnlyDictionary<string, ushort> ServerOpCodes { get; }
/// <summary>
/// Gets the OpCodes sent by the client to the server.
/// </summary>
public ReadOnlyDictionary<string, ushort> ClientOpCodes { get; }
/// <summary>
/// Gets a <see cref="Lumina"/> object which gives access to any excel/game data.
/// </summary>

View file

@ -19,4 +19,10 @@ public interface IDtrBar
/// <returns>The entry object used to update, hide and remove the entry.</returns>
/// <exception cref="ArgumentException">Thrown when an entry with the specified title exists.</exception>
public DtrBarEntry Get(string title, SeString? text = null);
/// <summary>
/// Removes a DTR bar entry from the system.
/// </summary>
/// <param name="title">Title of the entry to remove.</param>
public void Remove(string title);
}

View file

@ -1,6 +1,4 @@
using System;
namespace Dalamud.Plugin.Services;
namespace Dalamud.Plugin.Services;
/// <summary>
/// This class represents the state of the currently occupied duty.

View file

@ -0,0 +1,55 @@
using Dalamud.Game.Gui.FlyText;
using Dalamud.Game.Text.SeStringHandling;
namespace Dalamud.Plugin.Services;
/// <summary>
/// This class facilitates interacting with and creating native in-game "fly text".
/// </summary>
public interface IFlyTextGui
{
/// <summary>
/// The delegate defining the type for the FlyText event.
/// </summary>
/// <param name="kind">The FlyTextKind. See <see cref="FlyTextKind"/>.</param>
/// <param name="val1">Value1 passed to the native flytext function.</param>
/// <param name="val2">Value2 passed to the native flytext function. Seems unused.</param>
/// <param name="text1">Text1 passed to the native flytext function.</param>
/// <param name="text2">Text2 passed to the native flytext function.</param>
/// <param name="color">Color passed to the native flytext function. Changes flytext color.</param>
/// <param name="icon">Icon ID passed to the native flytext function. Only displays with select FlyTextKind.</param>
/// <param name="damageTypeIcon">Damage Type Icon ID passed to the native flytext function. Displayed next to damage values to denote damage type.</param>
/// <param name="yOffset">The vertical offset to place the flytext at. 0 is default. Negative values result
/// in text appearing higher on the screen. This does not change where the element begins to fade.</param>
/// <param name="handled">Whether this flytext has been handled. If a subscriber sets this to true, the FlyText will not appear.</param>
public delegate void OnFlyTextCreatedDelegate(
ref FlyTextKind kind,
ref int val1,
ref int val2,
ref SeString text1,
ref SeString text2,
ref uint color,
ref uint icon,
ref uint damageTypeIcon,
ref float yOffset,
ref bool handled);
/// <summary>
/// The FlyText event that can be subscribed to.
/// </summary>
public event OnFlyTextCreatedDelegate? FlyTextCreated;
/// <summary>
/// Displays a fly text in-game on the local player.
/// </summary>
/// <param name="kind">The FlyTextKind. See <see cref="FlyTextKind"/>.</param>
/// <param name="actorIndex">The index of the actor to place flytext on. Indexing unknown. 1 places flytext on local player.</param>
/// <param name="val1">Value1 passed to the native flytext function.</param>
/// <param name="val2">Value2 passed to the native flytext function. Seems unused.</param>
/// <param name="text1">Text1 passed to the native flytext function.</param>
/// <param name="text2">Text2 passed to the native flytext function.</param>
/// <param name="color">Color passed to the native flytext function. Changes flytext color.</param>
/// <param name="icon">Icon ID passed to the native flytext function. Only displays with select FlyTextKind.</param>
/// <param name="damageTypeIcon">Damage Type Icon ID passed to the native flytext function. Displayed next to damage values to denote damage type.</param>
public void AddFlyText(FlyTextKind kind, uint actorIndex, uint val1, uint val2, SeString text1, SeString text2, uint color, uint icon, uint damageTypeIcon);
}

View file

@ -0,0 +1,121 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Dalamud.Game;
namespace Dalamud.Plugin.Services;
/// <summary>
/// This class represents the Framework of the native game client and grants access to various subsystems.
/// </summary>
public interface IFramework
{
/// <summary>
/// A delegate type used with the <see cref="Update"/> event.
/// </summary>
/// <param name="framework">The Framework instance.</param>
public delegate void OnUpdateDelegate(IFramework framework);
/// <summary>
/// Event that gets fired every time the game framework updates.
/// </summary>
public event OnUpdateDelegate Update;
/// <summary>
/// Gets the last time that the Framework Update event was triggered.
/// </summary>
public DateTime LastUpdate { get; }
/// <summary>
/// Gets the last time in UTC that the Framework Update event was triggered.
/// </summary>
public DateTime LastUpdateUTC { get; }
/// <summary>
/// Gets the delta between the last Framework Update and the currently executing one.
/// </summary>
public TimeSpan UpdateDelta { get; }
/// <summary>
/// Gets a value indicating whether currently executing code is running in the game's framework update thread.
/// </summary>
public bool IsInFrameworkUpdateThread { get; }
/// <summary>
/// Gets a value indicating whether game Framework is unloading.
/// </summary>
public bool IsFrameworkUnloading { get; }
/// <summary>
/// Run given function right away if this function has been called from game's Framework.Update thread, or otherwise run on next Framework.Update call.
/// </summary>
/// <typeparam name="T">Return type.</typeparam>
/// <param name="func">Function to call.</param>
/// <returns>Task representing the pending or already completed function.</returns>
public Task<T> RunOnFrameworkThread<T>(Func<T> func);
/// <summary>
/// Run given function right away if this function has been called from game's Framework.Update thread, or otherwise run on next Framework.Update call.
/// </summary>
/// <param name="action">Function to call.</param>
/// <returns>Task representing the pending or already completed function.</returns>
public Task RunOnFrameworkThread(Action action);
/// <summary>
/// Run given function right away if this function has been called from game's Framework.Update thread, or otherwise run on next Framework.Update call.
/// </summary>
/// <typeparam name="T">Return type.</typeparam>
/// <param name="func">Function to call.</param>
/// <returns>Task representing the pending or already completed function.</returns>
public Task<T> RunOnFrameworkThread<T>(Func<Task<T>> func);
/// <summary>
/// Run given function right away if this function has been called from game's Framework.Update thread, or otherwise run on next Framework.Update call.
/// </summary>
/// <param name="func">Function to call.</param>
/// <returns>Task representing the pending or already completed function.</returns>
public Task RunOnFrameworkThread(Func<Task> func);
/// <summary>
/// Run given function in upcoming Framework.Tick call.
/// </summary>
/// <typeparam name="T">Return type.</typeparam>
/// <param name="func">Function to call.</param>
/// <param name="delay">Wait for given timespan before calling this function.</param>
/// <param name="delayTicks">Count given number of Framework.Tick calls before calling this function. This takes precedence over delay parameter.</param>
/// <param name="cancellationToken">Cancellation token which will prevent the execution of this function if wait conditions are not met.</param>
/// <returns>Task representing the pending function.</returns>
public Task<T> RunOnTick<T>(Func<T> func, TimeSpan delay = default, int delayTicks = default, CancellationToken cancellationToken = default);
/// <summary>
/// Run given function in upcoming Framework.Tick call.
/// </summary>
/// <param name="action">Function to call.</param>
/// <param name="delay">Wait for given timespan before calling this function.</param>
/// <param name="delayTicks">Count given number of Framework.Tick calls before calling this function. This takes precedence over delay parameter.</param>
/// <param name="cancellationToken">Cancellation token which will prevent the execution of this function if wait conditions are not met.</param>
/// <returns>Task representing the pending function.</returns>
public Task RunOnTick(Action action, TimeSpan delay = default, int delayTicks = default, CancellationToken cancellationToken = default);
/// <summary>
/// Run given function in upcoming Framework.Tick call.
/// </summary>
/// <typeparam name="T">Return type.</typeparam>
/// <param name="func">Function to call.</param>
/// <param name="delay">Wait for given timespan before calling this function.</param>
/// <param name="delayTicks">Count given number of Framework.Tick calls before calling this function. This takes precedence over delay parameter.</param>
/// <param name="cancellationToken">Cancellation token which will prevent the execution of this function if wait conditions are not met.</param>
/// <returns>Task representing the pending function.</returns>
public Task<T> RunOnTick<T>(Func<Task<T>> func, TimeSpan delay = default, int delayTicks = default, CancellationToken cancellationToken = default);
/// <summary>
/// Run given function in upcoming Framework.Tick call.
/// </summary>
/// <param name="func">Function to call.</param>
/// <param name="delay">Wait for given timespan before calling this function.</param>
/// <param name="delayTicks">Count given number of Framework.Tick calls before calling this function. This takes precedence over delay parameter.</param>
/// <param name="cancellationToken">Cancellation token which will prevent the execution of this function if wait conditions are not met.</param>
/// <returns>Task representing the pending function.</returns>
public Task RunOnTick(Func<Task> func, TimeSpan delay = default, int delayTicks = default, CancellationToken cancellationToken = default);
}

View file

@ -0,0 +1,23 @@
using Dalamud.Game.Gui.PartyFinder.Types;
namespace Dalamud.Plugin.Services;
/// <summary>
/// This class handles interacting with the native PartyFinder window.
/// </summary>
public interface IPartyFinderGui
{
/// <summary>
/// Event type fired each time the game receives an individual Party Finder listing.
/// Cannot modify listings but can hide them.
/// </summary>
/// <param name="listing">The listings received.</param>
/// <param name="args">Additional arguments passed by the game.</param>
public delegate void PartyFinderListingEventDelegate(PartyFinderListing listing, PartyFinderListingEventArgs args);
/// <summary>
/// Event fired each time the game receives an individual Party Finder listing.
/// Cannot modify listings but can hide them.
/// </summary>
public event PartyFinderListingEventDelegate ReceiveListing;
}

View file

@ -0,0 +1,128 @@
using Serilog;
using Serilog.Events;
#pragma warning disable CS1573 // See https://github.com/dotnet/roslyn/issues/40325
namespace Dalamud.Plugin.Services;
/// <summary>
/// An opinionated service to handle logging for plugins.
/// </summary>
public interface IPluginLog
{
/// <summary>
/// Gets or sets the minimum log level that will be recorded from this plugin to Dalamud's logs. This may be set
/// by either the plugin or by Dalamud itself.
/// </summary>
/// <remarks>
/// Defaults to <see cref="LogEventLevel.Debug"/> for downloaded plugins, and <see cref="LogEventLevel.Verbose"/>
/// for dev plugins.
/// </remarks>
LogEventLevel MinimumLogLevel { get; set; }
/// <summary>
/// Gets an instance of the Serilog <see cref="ILogger"/> for advanced use cases. The provided logger will handle
/// tagging all log messages with the appropriate context variables and properties.
/// </summary>
/// <remarks>
/// Not currently part of public API - will be added after some formatter work has been completed.
/// </remarks>
internal ILogger Logger { get; }
/// <summary>
/// Log a <see cref="LogEventLevel.Fatal" /> message to the Dalamud log for this plugin. This log level should be
/// used primarily for unrecoverable errors or critical faults in a plugin.
/// </summary>
/// <param name="messageTemplate">Message template describing the event.</param>
/// <param name="values">Objects positionally formatted into the message template.</param>
void Fatal(string messageTemplate, params object[] values);
/// <inheritdoc cref="Fatal(string,object[])"/>
/// <param name="exception">An (optional) exception that should be recorded alongside this event.</param>
void Fatal(Exception? exception, string messageTemplate, params object[] values);
/// <summary>
/// Log a <see cref="LogEventLevel.Error" /> message to the Dalamud log for this plugin. This log level should be
/// used for recoverable errors or faults that impact plugin functionality.
/// </summary>
/// <param name="messageTemplate">Message template describing the event.</param>
/// <param name="values">Objects positionally formatted into the message template.</param>
void Error(string messageTemplate, params object[] values);
/// <inheritdoc cref="Error(string,object[])"/>
/// <param name="exception">An (optional) exception that should be recorded alongside this event.</param>
void Error(Exception? exception, string messageTemplate, params object[] values);
/// <summary>
/// Log a <see cref="LogEventLevel.Warning" /> message to the Dalamud log for this plugin. This log level should be
/// used for user error, potential problems, or high-importance messages that should be logged.
/// </summary>
/// <param name="messageTemplate">Message template describing the event.</param>
/// <param name="values">Objects positionally formatted into the message template.</param>
void Warning(string messageTemplate, params object[] values);
/// <inheritdoc cref="Warning(string,object[])"/>
/// <param name="exception">An (optional) exception that should be recorded alongside this event.</param>
void Warning(Exception? exception, string messageTemplate, params object[] values);
/// <summary>
/// Log an <see cref="LogEventLevel.Information" /> message to the Dalamud log for this plugin. This log level
/// should be used for general plugin operations and other relevant information to track a plugin's behavior.
/// </summary>
/// <param name="messageTemplate">Message template describing the event.</param>
/// <param name="values">Objects positionally formatted into the message template.</param>
void Information(string messageTemplate, params object[] values);
/// <inheritdoc cref="Information(string,object[])"/>
/// <param name="exception">An (optional) exception that should be recorded alongside this event.</param>
void Information(Exception? exception, string messageTemplate, params object[] values);
/// <summary>
/// Log a <see cref="LogEventLevel.Debug" /> message to the Dalamud log for this plugin. This log level should be
/// used for messages or information that aid with debugging or tracing a plugin's operations, but should not be
/// recorded unless requested.
/// </summary>
/// <remarks>
/// By default, this log level is below the default log level of Dalamud. Messages logged at this level will not be
/// recorded unless the global log level is specifically set to Debug or lower. If information should be generally
/// or easily accessible for support purposes without the user taking additional action, consider using the
/// Information level instead. Developers should <em>not</em> use this log level where it can be triggered on a
/// per-frame basis.
/// </remarks>
/// <param name="messageTemplate">Message template describing the event.</param>
/// <param name="values">Objects positionally formatted into the message template.</param>
void Debug(string messageTemplate, params object[] values);
/// <inheritdoc cref="Debug(string,object[])"/>
/// <param name="exception">An (optional) exception that should be recorded alongside this event.</param>
void Debug(Exception? exception, string messageTemplate, params object[] values);
/// <summary>
/// Log a <see cref="LogEventLevel.Verbose" /> message to the Dalamud log for this plugin. This log level is
/// intended almost primarily for development purposes and detailed tracing of a plugin's operations. Verbose logs
/// should not be used to expose information useful for support purposes.
/// </summary>
/// <remarks>
/// By default, this log level is below the default log level of Dalamud. Messages logged at this level will not be
/// recorded unless the global log level is specifically set to Verbose. Release plugins must also set the
/// <see cref="MinimumLogLevel"/> to <see cref="LogEventLevel.Verbose"/> to use this level, and should only do so
/// upon specific user request (e.g. a "Enable Troubleshooting Logs" button).
/// </remarks>
/// <param name="messageTemplate">Message template describing the event.</param>
/// <param name="values">Objects positionally formatted into the message template.</param>
void Verbose(string messageTemplate, params object[] values);
/// <inheritdoc cref="Verbose(string,object[])"/>
/// <param name="exception">An (optional) exception that should be recorded alongside this event.</param>
void Verbose(Exception? exception, string messageTemplate, params object[] values);
/// <summary>
/// Write a raw log event to the plugin's log. Used for interoperability with other log systems, as well as
/// advanced use cases.
/// </summary>
/// <param name="level">The log level for this event.</param>
/// <param name="exception">An (optional) exception that should be recorded alongside this event.</param>
/// <param name="messageTemplate">Message template describing the event.</param>
/// <param name="values">Objects positionally formatted into the message template.</param>
void Write(LogEventLevel level, Exception? exception, string messageTemplate, params object[] values);
}

View file

@ -41,4 +41,16 @@ public interface ITargetManager
/// Set to null to clear the target.
/// </summary>
public GameObject? SoftTarget { get; set; }
/// <summary>
/// Gets or sets the gpose target.
/// Set to null to clear the target.
/// </summary>
public GameObject? GPoseTarget { get; set; }
/// <summary>
/// Gets or sets the mouseover nameplate target.
/// Set to null to clear the target.
/// </summary>
public GameObject? MouseOverNameplateTarget { get; set; }
}

View file

@ -1,4 +1,6 @@
namespace Dalamud.Plugin.Services;
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.
@ -17,4 +19,19 @@ public interface ITextureSubstitutionProvider
/// Event that will be called once Dalamud wants to load texture data.
/// </summary>
public event TextureDataInterceptorDelegate? InterceptTexDataLoad;
/// <summary>
/// Get a path that may be substituted by a subscriber to ITextureSubstitutionProvider.
/// </summary>
/// <param name="originalPath">The original path to substitute.</param>
/// <returns>The original path, if no subscriber is registered or there is no substitution, or the substituted path.</returns>
public string GetSubstitutedPath(string originalPath);
/// <summary>
/// Notify Dalamud about substitution status for files at the specified VFS paths changing.
/// You should call this with all paths that were either previously substituted and are no longer,
/// and paths that are newly substituted.
/// </summary>
/// <param name="paths">The paths with a changed substitution status.</param>
public void InvalidatePaths(IEnumerable<string> paths);
}

View file

@ -0,0 +1,44 @@
using System.Collections.Generic;
using Dalamud.Interface;
using ImGuiScene;
namespace Dalamud.Plugin.Services;
/// <summary>
/// Interface for class responsible for managing elements in the title screen menu.
/// </summary>
public interface ITitleScreenMenu
{
/// <summary>
/// Gets the list of entries in the title screen menu.
/// </summary>
public IReadOnlyList<TitleScreenMenuEntry> Entries { get; }
/// <summary>
/// Adds a new entry to the title screen menu.
/// </summary>
/// <param name="text">The text to show.</param>
/// <param name="texture">The texture to show.</param>
/// <param name="onTriggered">The action to execute when the option is selected.</param>
/// <returns>A <see cref="TitleScreenMenu"/> object that can be used to manage the entry.</returns>
/// <exception cref="ArgumentException">Thrown when the texture provided does not match the required resolution(64x64).</exception>
public TitleScreenMenuEntry AddEntry(string text, TextureWrap texture, Action onTriggered);
/// <summary>
/// Adds a new entry to the title screen menu.
/// </summary>
/// <param name="priority">Priority of the entry.</param>
/// <param name="text">The text to show.</param>
/// <param name="texture">The texture to show.</param>
/// <param name="onTriggered">The action to execute when the option is selected.</param>
/// <returns>A <see cref="TitleScreenMenu"/> object that can be used to manage the entry.</returns>
/// <exception cref="ArgumentException">Thrown when the texture provided does not match the required resolution(64x64).</exception>
public TitleScreenMenuEntry AddEntry(ulong priority, string text, TextureWrap texture, Action onTriggered);
/// <summary>
/// Remove an entry from the title screen menu.
/// </summary>
/// <param name="entry">The entry to remove.</param>
public void RemoveEntry(TitleScreenMenuEntry entry);
}

View file

@ -0,0 +1,88 @@
using Dalamud.Game.Gui.Toast;
using Dalamud.Game.Text.SeStringHandling;
namespace Dalamud.Plugin.Services;
/// <summary>
/// This class facilitates interacting with and creating native toast windows.
/// </summary>
public interface IToastGui
{
/// <summary>
/// A delegate type used when a normal toast window appears.
/// </summary>
/// <param name="message">The message displayed.</param>
/// <param name="options">Assorted toast options.</param>
/// <param name="isHandled">Whether the toast has been handled or should be propagated.</param>
public delegate void OnNormalToastDelegate(ref SeString message, ref ToastOptions options, ref bool isHandled);
/// <summary>
/// A delegate type used when a quest toast window appears.
/// </summary>
/// <param name="message">The message displayed.</param>
/// <param name="options">Assorted toast options.</param>
/// <param name="isHandled">Whether the toast has been handled or should be propagated.</param>
public delegate void OnQuestToastDelegate(ref SeString message, ref QuestToastOptions options, ref bool isHandled);
/// <summary>
/// A delegate type used when an error toast window appears.
/// </summary>
/// <param name="message">The message displayed.</param>
/// <param name="isHandled">Whether the toast has been handled or should be propagated.</param>
public delegate void OnErrorToastDelegate(ref SeString message, ref bool isHandled);
/// <summary>
/// Event that will be fired when a toast is sent by the game or a plugin.
/// </summary>
public event OnNormalToastDelegate Toast;
/// <summary>
/// Event that will be fired when a quest toast is sent by the game or a plugin.
/// </summary>
public event OnQuestToastDelegate QuestToast;
/// <summary>
/// Event that will be fired when an error toast is sent by the game or a plugin.
/// </summary>
public event OnErrorToastDelegate ErrorToast;
/// <summary>
/// Show a toast message with the given content.
/// </summary>
/// <param name="message">The message to be shown.</param>
/// <param name="options">Options for the toast.</param>
public void ShowNormal(string message, ToastOptions? options = null);
/// <summary>
/// Show a toast message with the given content.
/// </summary>
/// <param name="message">The message to be shown.</param>
/// <param name="options">Options for the toast.</param>
public void ShowNormal(SeString message, ToastOptions? options = null);
/// <summary>
/// Show a quest toast message with the given content.
/// </summary>
/// <param name="message">The message to be shown.</param>
/// <param name="options">Options for the toast.</param>
public void ShowQuest(string message, QuestToastOptions? options = null);
/// <summary>
/// Show a quest toast message with the given content.
/// </summary>
/// <param name="message">The message to be shown.</param>
/// <param name="options">Options for the toast.</param>
public void ShowQuest(SeString message, QuestToastOptions? options = null);
/// <summary>
/// Show an error toast message with the given content.
/// </summary>
/// <param name="message">The message to be shown.</param>
public void ShowError(string message);
/// <summary>
/// Show an error toast message with the given content.
/// </summary>
/// <param name="message">The message to be shown.</param>
public void ShowError(SeString message);
}