Skip to content

Commit

Permalink
Merge pull request #1370 from MidoriKami/AddonLifecycle_Enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
goaaats authored Sep 17, 2023
2 parents 0f74c8e + 9c0ca27 commit 40a8e60
Show file tree
Hide file tree
Showing 9 changed files with 683 additions and 74 deletions.
22 changes: 22 additions & 0 deletions Dalamud/Game/AddonLifecycle/AddonArgs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Dalamud.Memory;
using FFXIVClientStructs.FFXIV.Component.GUI;

namespace Dalamud.Game.AddonLifecycle;

/// <summary>
/// Addon argument data for use in event subscribers.
/// </summary>
public unsafe class AddonArgs
{
private string? addonName;

/// <summary>
/// Gets the name of the addon this args referrers to.
/// </summary>
public string AddonName => this.Addon == nint.Zero ? "NullAddon" : this.addonName ??= MemoryHelper.ReadString((nint)((AtkUnitBase*)this.Addon)->Name, 0x20);

/// <summary>
/// Gets the pointer to the addons AtkUnitBase.
/// </summary>
required public nint Addon { get; init; }
}
62 changes: 62 additions & 0 deletions Dalamud/Game/AddonLifecycle/AddonEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
namespace Dalamud.Game.AddonLifecycle;

/// <summary>
/// Enumeration for available AddonLifecycle events.
/// </summary>
public enum AddonEvent
{
/// <summary>
/// Event that is fired before an addon begins it's setup process.
/// </summary>
PreSetup,

/// <summary>
/// Event that is fired after an addon has completed it's setup process.
/// </summary>
PostSetup,

/// <summary>
/// Event that is fired before an addon begins update.
/// </summary>
PreUpdate,

/// <summary>
/// Event that is fired after an addon has completed update.
/// </summary>
PostUpdate,

/// <summary>
/// Event that is fired before an addon begins draw.
/// </summary>
PreDraw,

/// <summary>
/// Event that is fired after an addon has completed draw.
/// </summary>
PostDraw,

/// <summary>
/// Event that is fired before an addon is finalized.
/// </summary>
PreFinalize,

/// <summary>
/// Event that is fired before an addon begins a requested update.
/// </summary>
PreRequestedUpdate,

/// <summary>
/// Event that is fired after an addon finishes a requested update.
/// </summary>
PostRequestedUpdate,

/// <summary>
/// Event that is fired before an addon begins a refresh.
/// </summary>
PreRefresh,

/// <summary>
/// Event that is fired after an addon has finished a refresh.
/// </summary>
PostRefresh,
}
Loading

0 comments on commit 40a8e60

Please sign in to comment.