mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-02 05:43:40 +01:00
Merge branch 'v9' into ihookprovider
This commit is contained in:
commit
a59875bb77
164 changed files with 6033 additions and 1795 deletions
|
|
@ -56,7 +56,7 @@ public sealed class DalamudPluginInterface : IDisposable
|
|||
|
||||
this.configs = Service<PluginManager>.Get().PluginConfigs;
|
||||
this.Reason = reason;
|
||||
this.SourceRepository = this.IsDev ? LocalPluginManifest.FlagDevPlugin : plugin.Manifest.InstalledFromUrl;
|
||||
this.SourceRepository = this.IsDev ? SpecialPluginSource.DevPlugin : plugin.Manifest.InstalledFromUrl;
|
||||
this.IsTesting = plugin.IsTesting;
|
||||
|
||||
this.LoadTime = DateTime.Now;
|
||||
|
|
@ -118,8 +118,8 @@ public sealed class DalamudPluginInterface : IDisposable
|
|||
/// 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="LocalPluginManifest.FlagMainRepo"/>. Developer plugins will return the value of
|
||||
/// <see cref="LocalPluginManifest.FlagDevPlugin"/>.
|
||||
/// <see cref="SpecialPluginSource.MainRepo"/>. Developer plugins will return the value of
|
||||
/// <see cref="SpecialPluginSource.DevPlugin"/>.
|
||||
/// </summary>
|
||||
public string SourceRepository { get; }
|
||||
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ internal partial class PluginManager : IDisposable, IServiceType
|
|||
|
||||
if (updateMetadata is { Count: > 0 })
|
||||
{
|
||||
chatGui.PrintChat(new XivChatEntry
|
||||
chatGui.Print(new XivChatEntry
|
||||
{
|
||||
Message = new SeString(new List<Payload>()
|
||||
{
|
||||
|
|
@ -308,7 +308,7 @@ internal partial class PluginManager : IDisposable, IServiceType
|
|||
}
|
||||
else
|
||||
{
|
||||
chatGui.PrintChat(new XivChatEntry
|
||||
chatGui.Print(new XivChatEntry
|
||||
{
|
||||
Message = Locs.DalamudPluginUpdateFailed(metadata.Name, metadata.Version),
|
||||
Type = XivChatType.Urgent,
|
||||
|
|
@ -862,7 +862,7 @@ internal partial class PluginManager : IDisposable, IServiceType
|
|||
}
|
||||
|
||||
// Document the url the plugin was installed from
|
||||
manifest.InstalledFromUrl = repoManifest.SourceRepo.IsThirdParty ? repoManifest.SourceRepo.PluginMasterUrl : LocalPluginManifest.FlagMainRepo;
|
||||
manifest.InstalledFromUrl = repoManifest.SourceRepo.IsThirdParty ? repoManifest.SourceRepo.PluginMasterUrl : SpecialPluginSource.MainRepo;
|
||||
|
||||
manifest.Save(manifestFile, "installation");
|
||||
|
||||
|
|
|
|||
|
|
@ -232,4 +232,7 @@ internal class Profile
|
|||
if (apply)
|
||||
await this.manager.ApplyAllWantStatesAsync();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string ToString() => $"{this.Guid} ({this.Name})";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
|
@ -7,6 +6,7 @@ using CheapLoc;
|
|||
using Dalamud.Game;
|
||||
using Dalamud.Game.Command;
|
||||
using Dalamud.Game.Gui;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Dalamud.Utility;
|
||||
using Serilog;
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ internal class ProfileCommandHandler : IServiceType, IDisposable
|
|||
this.framework.Update += this.FrameworkOnUpdate;
|
||||
}
|
||||
|
||||
private void FrameworkOnUpdate(Framework framework1)
|
||||
private void FrameworkOnUpdate(IFramework framework1)
|
||||
{
|
||||
if (this.profileManager.IsBusy)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -40,6 +41,22 @@ internal class LocalDevPlugin : LocalPlugin, IDisposable
|
|||
configuration.DevPluginSettings[dllFile.FullName] = this.devSettings = new DevPluginSettings();
|
||||
configuration.QueueSave();
|
||||
}
|
||||
|
||||
// Legacy dev plugins might not have this!
|
||||
if (this.devSettings.WorkingPluginId == Guid.Empty)
|
||||
{
|
||||
this.devSettings.WorkingPluginId = Guid.NewGuid();
|
||||
Log.Verbose("{InternalName} was assigned new devPlugin GUID {Guid}", this.InternalName, this.devSettings.WorkingPluginId);
|
||||
configuration.QueueSave();
|
||||
}
|
||||
|
||||
// If the ID in the manifest is wrong, force the good one
|
||||
if (this.DevImposedWorkingPluginId != this.manifest.WorkingPluginId)
|
||||
{
|
||||
Debug.Assert(this.DevImposedWorkingPluginId != Guid.Empty, "Empty guid for devPlugin");
|
||||
this.manifest.WorkingPluginId = this.DevImposedWorkingPluginId;
|
||||
this.SaveManifest("dev imposed working plugin id");
|
||||
}
|
||||
|
||||
if (this.AutomaticReload)
|
||||
{
|
||||
|
|
@ -76,6 +93,11 @@ internal class LocalDevPlugin : LocalPlugin, IDisposable
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an ID uniquely identifying this specific instance of a devPlugin.
|
||||
/// </summary>
|
||||
public Guid DevImposedWorkingPluginId => this.devSettings.WorkingPluginId;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public new void Dispose()
|
||||
|
|
|
|||
|
|
@ -26,6 +26,13 @@ namespace Dalamud.Plugin.Internal.Types;
|
|||
/// </summary>
|
||||
internal class LocalPlugin : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// The underlying manifest for this plugin.
|
||||
/// </summary>
|
||||
#pragma warning disable SA1401
|
||||
protected LocalPluginManifest manifest;
|
||||
#pragma warning restore SA1401
|
||||
|
||||
private static readonly ModuleLog Log = new("LOCALPLUGIN");
|
||||
|
||||
private readonly FileInfo manifestFile;
|
||||
|
|
@ -39,8 +46,6 @@ internal class LocalPlugin : IDisposable
|
|||
private Type? pluginType;
|
||||
private IDalamudPlugin? instance;
|
||||
|
||||
private LocalPluginManifest manifest;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LocalPlugin"/> class.
|
||||
/// </summary>
|
||||
|
|
@ -659,9 +664,11 @@ internal class LocalPlugin : IDisposable
|
|||
var manifestPath = LocalPluginManifest.GetManifestFile(this.DllFile);
|
||||
if (manifestPath.Exists)
|
||||
{
|
||||
// var isDisabled = this.IsDisabled; // saving the internal state because it could have been deleted
|
||||
// Save some state that we do actually want to carry over
|
||||
var guid = this.manifest.WorkingPluginId;
|
||||
|
||||
this.manifest = LocalPluginManifest.Load(manifestPath) ?? throw new Exception("Could not reload manifest.");
|
||||
// this.manifest.Disabled = isDisabled;
|
||||
this.manifest.WorkingPluginId = guid;
|
||||
|
||||
this.SaveManifest("dev reload");
|
||||
}
|
||||
|
|
@ -686,6 +693,12 @@ internal class LocalPlugin : IDisposable
|
|||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Save this plugin manifest.
|
||||
/// </summary>
|
||||
/// <param name="reason">Why it should be saved.</param>
|
||||
protected void SaveManifest(string reason) => this.manifest.Save(this.manifestFile, reason);
|
||||
|
||||
private static void SetupLoaderConfig(LoaderConfig config)
|
||||
{
|
||||
config.IsUnloadable = true;
|
||||
|
|
@ -694,6 +707,4 @@ internal class LocalPlugin : IDisposable
|
|||
config.SharedAssemblies.Add(typeof(Lumina.GameData).Assembly.GetName());
|
||||
config.SharedAssemblies.Add(typeof(Lumina.Excel.ExcelSheetImpl).Assembly.GetName());
|
||||
}
|
||||
|
||||
private void SaveManifest(string reason) => this.manifest.Save(this.manifestFile, reason);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,18 +13,6 @@ namespace Dalamud.Plugin.Internal.Types.Manifest;
|
|||
/// </summary>
|
||||
internal record LocalPluginManifest : PluginManifest, ILocalPluginManifest
|
||||
{
|
||||
/// <summary>
|
||||
/// Flag indicating that a plugin was installed from the official repo.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public const string FlagMainRepo = "OFFICIAL";
|
||||
|
||||
/// <summary>
|
||||
/// Flag indicating that a plugin is a dev plugin..
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public const string FlagDevPlugin = "DEVPLUGIN";
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the plugin is disabled and should not be loaded.
|
||||
/// This value supersedes the ".disabled" file functionality and should not be included in the plugin master.
|
||||
|
|
@ -51,7 +39,7 @@ internal record LocalPluginManifest : PluginManifest, ILocalPluginManifest
|
|||
/// Gets a value indicating whether this manifest is associated with a plugin that was installed from a third party
|
||||
/// repo. Unless the manifest has been manually modified, this is determined by the InstalledFromUrl being null.
|
||||
/// </summary>
|
||||
public bool IsThirdParty => !this.InstalledFromUrl.IsNullOrEmpty() && this.InstalledFromUrl != FlagMainRepo;
|
||||
public bool IsThirdParty => !this.InstalledFromUrl.IsNullOrEmpty() && this.InstalledFromUrl != SpecialPluginSource.MainRepo;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the effective version of this plugin.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
namespace Dalamud.Plugin.Internal.Types.Manifest;
|
||||
|
||||
/// <summary>
|
||||
/// A fake enum representing "special" sources for plugins.
|
||||
/// </summary>
|
||||
public static class SpecialPluginSource
|
||||
{
|
||||
/// <summary>
|
||||
/// Indication that this plugin came from the official Dalamud repository.
|
||||
/// </summary>
|
||||
public const string MainRepo = "OFFICIAL";
|
||||
|
||||
/// <summary>
|
||||
/// Indication that this plugin is loaded as a dev plugin. See also <see cref="DalamudPluginInterface.IsDev"/>.
|
||||
/// </summary>
|
||||
public const string DevPlugin = "DEVPLUGIN";
|
||||
}
|
||||
46
Dalamud/Plugin/Services/IAddonEventManager.cs
Normal file
46
Dalamud/Plugin/Services/IAddonEventManager.cs
Normal 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();
|
||||
}
|
||||
80
Dalamud/Plugin/Services/IAddonLifecycle.cs
Normal file
80
Dalamud/Plugin/Services/IAddonLifecycle.cs
Normal 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);
|
||||
}
|
||||
117
Dalamud/Plugin/Services/IChatGui.cs
Normal file
117
Dalamud/Plugin/Services/IChatGui.cs
Normal 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);
|
||||
}
|
||||
|
|
@ -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; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
55
Dalamud/Plugin/Services/IFlyTextGui.cs
Normal file
55
Dalamud/Plugin/Services/IFlyTextGui.cs
Normal 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);
|
||||
}
|
||||
121
Dalamud/Plugin/Services/IFramework.cs
Normal file
121
Dalamud/Plugin/Services/IFramework.cs
Normal 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);
|
||||
}
|
||||
23
Dalamud/Plugin/Services/IPartyFinderGui.cs
Normal file
23
Dalamud/Plugin/Services/IPartyFinderGui.cs
Normal 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;
|
||||
}
|
||||
128
Dalamud/Plugin/Services/IPluginLog.cs
Normal file
128
Dalamud/Plugin/Services/IPluginLog.cs
Normal 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);
|
||||
}
|
||||
|
|
@ -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; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
44
Dalamud/Plugin/Services/ITitleScreenMenu.cs
Normal file
44
Dalamud/Plugin/Services/ITitleScreenMenu.cs
Normal 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);
|
||||
}
|
||||
88
Dalamud/Plugin/Services/IToastGui.cs
Normal file
88
Dalamud/Plugin/Services/IToastGui.cs
Normal 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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue