diff --git a/Dalamud/Game/Gui/Dtr/DtrBar.cs b/Dalamud/Game/Gui/Dtr/DtrBar.cs index 54c3b2f95..b637791f0 100644 --- a/Dalamud/Game/Gui/Dtr/DtrBar.cs +++ b/Dalamud/Game/Gui/Dtr/DtrBar.cs @@ -5,6 +5,7 @@ using System.Threading; using Dalamud.Configuration.Internal; using Dalamud.Game.Addon.Events; +using Dalamud.Game.Addon.Events.EventDataTypes; using Dalamud.Game.Addon.Lifecycle; using Dalamud.Game.Addon.Lifecycle.AddonArgTypes; using Dalamud.Game.Text.SeStringHandling; @@ -628,7 +629,7 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar } } - if (dtrBarEntry is not null) + if (dtrBarEntry is { OnClick: not null }) { switch (atkEventType) { @@ -641,22 +642,7 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar break; case AddonEventType.MouseClick: - dtrBarEntry.OnClick?.Invoke(); - dtrBarEntry.OnClicked?.Invoke(eventData); - - var dataPointer = (AtkEventData*)eventData.AtkEventDataPointer; - var mouseData = dataPointer->MouseData; - - if (mouseData.ButtonId is 0) - { - dtrBarEntry.OnLeftClick?.Invoke(); - } - - if (mouseData.ButtonId is 1) - { - dtrBarEntry.OnRightClick?.Invoke(); - } - + dtrBarEntry.OnClick?.Invoke(new AddonMouseEventData(eventData)); break; } } diff --git a/Dalamud/Game/Gui/Dtr/DtrBarEntry.cs b/Dalamud/Game/Gui/Dtr/DtrBarEntry.cs index 2b9634588..54847705d 100644 --- a/Dalamud/Game/Gui/Dtr/DtrBarEntry.cs +++ b/Dalamud/Game/Gui/Dtr/DtrBarEntry.cs @@ -1,5 +1,5 @@ using Dalamud.Configuration.Internal; -using Dalamud.Game.Addon.Events; +using Dalamud.Game.Addon.Events.EventDataTypes; using Dalamud.Game.Text.SeStringHandling; using Dalamud.Plugin.Internal.Types; using Dalamud.Utility; @@ -43,13 +43,6 @@ public interface IReadOnlyDtrBarEntry /// Gets a value indicating whether the user has hidden this entry from view through the Dalamud settings. /// public bool UserHidden { get; } - - /// - /// Triggers the click action of this entry. - /// - /// True, if a click action was registered and executed. - [Api13ToDo("Remove, doesn't mesh well with new click actions")] - public bool TriggerClickAction(); } /// @@ -73,25 +66,9 @@ public interface IDtrBarEntry : IReadOnlyDtrBarEntry public new bool Shown { get; set; } /// - /// Gets or sets a action to be invoked when the user clicks on the dtr entry. + /// Gets or sets an action to be invoked when the user clicks on the dtr entry. /// - [Api13ToDo("Remove this, and rename OnClicked to OnClick")] - public Action? OnClick { get; set; } - - /// - /// Gets or sets a action to be invoked when the user left-clicks on the dtr entry. - /// - public Action? OnLeftClick { get; set; } - - /// - /// Gets or sets a action to be invoked when the user right-clicks on the dtr entry. - /// - public Action? OnRightClick { get; set; } - - /// - /// Gets or sets a action to be invoked when the user clicks on the dtr entry. - /// - public Action? OnClicked { get; set; } + public Action? OnClick { get; set; } /// /// Remove this entry from the bar. @@ -140,23 +117,11 @@ internal sealed unsafe class DtrBarEntry : IDisposable, IDtrBarEntry /// public SeString? Tooltip { get; set; } - /// - /// Gets or sets a action to be invoked when the user clicks on the dtr entry. - /// - [Api13ToDo("Remove this and rename OnClicked to OnClick")] - public Action? OnClick { get; set; } + /// + public Action? OnClick { get; set; } /// - public Action? OnLeftClick { get; set; } - - /// - public Action? OnRightClick { get; set; } - - /// - public Action? OnClicked { get; set; } - - /// - public bool HasClickAction => this.OnClick != null || this.OnLeftClick != null || this.OnRightClick != null || this.OnClicked != null; + public bool HasClickAction => this.OnClick != null; /// public bool Shown @@ -173,7 +138,7 @@ internal sealed unsafe class DtrBarEntry : IDisposable, IDtrBarEntry } /// - [Api13ToDo("Maybe make this config scoped to internalname?")] + [Api13ToDo("Maybe make this config scoped to internal name?")] public bool UserHidden => this.configuration.DtrIgnore?.Contains(this.Title) ?? false; /// @@ -206,17 +171,6 @@ internal sealed unsafe class DtrBarEntry : IDisposable, IDtrBarEntry /// internal LocalPlugin? OwnerPlugin { get; set; } - /// - [Api13ToDo("Remove, doesn't mesh well with new click actions")] - public bool TriggerClickAction() - { - if (this.OnClick == null) - return false; - - this.OnClick.Invoke(); - return true; - } - /// /// Remove this entry from the bar. /// You will need to re-acquire it from DtrBar to reuse it.