mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
[Api13] Remove obsoletes (#2323)
* Remove IFate.HasExpBonus * Remove IAddonEventManager.AddonEventHandler * Remove obsolete filesystem functions from Util * Remove more obsoletes
This commit is contained in:
parent
2aba71f8f2
commit
564c220ed2
11 changed files with 13 additions and 219 deletions
|
|
@ -152,23 +152,11 @@ internal sealed class DalamudConfiguration : IInternalDisposableService
|
|||
/// </summary>
|
||||
public float GlobalUiScale { get; set; } = 1.0f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to use AXIS fonts from the game.
|
||||
/// </summary>
|
||||
[Obsolete($"See {nameof(DefaultFontSpec)}")]
|
||||
public bool UseAxisFontsFromGame { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the default font spec.
|
||||
/// </summary>
|
||||
public IFontSpec? DefaultFontSpec { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the gamma value to apply for Dalamud fonts. Do not use.
|
||||
/// </summary>
|
||||
[Obsolete("It happens that nobody touched this setting", true)]
|
||||
public float FontGammaLevel { get; set; } = 1.4f;
|
||||
|
||||
/// <summary>Gets or sets the opacity of the IME state indicator.</summary>
|
||||
/// <value>0 will hide the state indicator. 1 will make the state indicator fully visible. Values outside the
|
||||
/// range will be clamped to [0, 1].</value>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Dalamud.Plugin.Services;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Dalamud.Utility;
|
||||
|
||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||
|
|
@ -33,17 +33,10 @@ internal unsafe class AddonEventEntry
|
|||
/// </summary>
|
||||
public required nint Node { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the handler that gets called when this event is triggered.
|
||||
/// </summary>
|
||||
[Obsolete("Use AddonEventDelegate Delegate instead")]
|
||||
public IAddonEventManager.AddonEventHandler Handler { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the delegate that gets called when this event is triggered.
|
||||
/// </summary>
|
||||
[Api13ToDo("Make this field required")]
|
||||
public IAddonEventManager.AddonEventDelegate Delegate { get; init; }
|
||||
public required IAddonEventManager.AddonEventDelegate Delegate { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the unique id for this event.
|
||||
|
|
|
|||
|
|
@ -73,29 +73,6 @@ internal unsafe class AddonEventManager : IInternalDisposableService
|
|||
this.addonLifecycle.UnregisterListener(this.finalizeEventListener);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers an event handler for the specified addon, node, and type.
|
||||
/// </summary>
|
||||
/// <param name="pluginId">Unique ID for this plugin.</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>
|
||||
/// <returns>IAddonEventHandle used to remove the event.</returns>
|
||||
internal IAddonEventHandle? AddEvent(Guid pluginId, IntPtr atkUnitBase, IntPtr atkResNode, AddonEventType eventType, IAddonEventManager.AddonEventHandler eventHandler)
|
||||
{
|
||||
if (this.pluginEventControllers.TryGetValue(pluginId, out var controller))
|
||||
{
|
||||
return controller.AddEvent(atkUnitBase, atkResNode, eventType, eventHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Verbose($"Unable to locate controller for {pluginId}. No event was added.");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers an event handler for the specified addon, node, and type.
|
||||
/// </summary>
|
||||
|
|
@ -260,10 +237,6 @@ internal class AddonEventManagerPluginScoped : IInternalDisposableService, IAddo
|
|||
}).Wait();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IAddonEventHandle? AddEvent(IntPtr atkUnitBase, IntPtr atkResNode, AddonEventType eventType, IAddonEventManager.AddonEventHandler eventHandler)
|
||||
=> this.eventManagerService.AddEvent(this.plugin.EffectiveWorkingPluginId, atkUnitBase, atkResNode, eventType, eventHandler);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IAddonEventHandle? AddEvent(nint atkUnitBase, nint atkResNode, AddonEventType eventType, IAddonEventManager.AddonEventDelegate eventDelegate)
|
||||
=> this.eventManagerService.AddEvent(this.plugin.EffectiveWorkingPluginId, atkUnitBase, atkResNode, eventType, eventDelegate);
|
||||
|
|
|
|||
|
|
@ -121,12 +121,6 @@ public enum AddonEventType : byte
|
|||
/// </summary>
|
||||
ListItemClick = 35,
|
||||
|
||||
/// <summary>
|
||||
/// AtkComponentList Toggle.
|
||||
/// </summary>
|
||||
[Obsolete("Use ListItemClick")]
|
||||
ListItemToggle = 35,
|
||||
|
||||
/// <summary>
|
||||
/// AtkComponentList Double Click.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -29,49 +29,6 @@ internal unsafe class PluginEventController : IDisposable
|
|||
|
||||
private List<AddonEventEntry> Events { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Adds a tracked event.
|
||||
/// </summary>
|
||||
/// <param name="atkUnitBase">The Parent addon for the event.</param>
|
||||
/// <param name="atkResNode">The Node for the event.</param>
|
||||
/// <param name="atkEventType">The Event Type.</param>
|
||||
/// <param name="handler">The delegate to call when invoking this event.</param>
|
||||
/// <returns>IAddonEventHandle used to remove the event.</returns>
|
||||
[Obsolete("Use AddEvent that uses AddonEventDelegate instead of AddonEventHandler")]
|
||||
public IAddonEventHandle AddEvent(nint atkUnitBase, nint atkResNode, AddonEventType atkEventType, IAddonEventManager.AddonEventHandler handler)
|
||||
{
|
||||
var node = (AtkResNode*)atkResNode;
|
||||
var addon = (AtkUnitBase*)atkUnitBase;
|
||||
var eventType = (AtkEventType)atkEventType;
|
||||
var eventId = this.GetNextParamKey();
|
||||
var eventGuid = Guid.NewGuid();
|
||||
|
||||
var eventHandle = new AddonEventHandle
|
||||
{
|
||||
AddonName = addon->NameString,
|
||||
ParamKey = eventId,
|
||||
EventType = atkEventType,
|
||||
EventGuid = eventGuid,
|
||||
};
|
||||
|
||||
var eventEntry = new AddonEventEntry
|
||||
{
|
||||
Addon = atkUnitBase,
|
||||
Handler = handler,
|
||||
Delegate = null,
|
||||
Node = atkResNode,
|
||||
EventType = atkEventType,
|
||||
ParamKey = eventId,
|
||||
Handle = eventHandle,
|
||||
};
|
||||
|
||||
Log.Verbose($"Adding Event. {eventEntry.LogString}");
|
||||
this.EventListener.RegisterEvent(addon, node, eventType, eventId);
|
||||
this.Events.Add(eventEntry);
|
||||
|
||||
return eventHandle;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a tracked event.
|
||||
/// </summary>
|
||||
|
|
@ -100,7 +57,6 @@ internal unsafe class PluginEventController : IDisposable
|
|||
{
|
||||
Addon = atkUnitBase,
|
||||
Delegate = eventDelegate,
|
||||
Handler = null,
|
||||
Node = atkResNode,
|
||||
EventType = atkEventType,
|
||||
ParamKey = eventId,
|
||||
|
|
@ -230,7 +186,6 @@ internal unsafe class PluginEventController : IDisposable
|
|||
this.EventListener.UnregisterEvent(atkResNode, eventType, eventEntry.ParamKey);
|
||||
}
|
||||
|
||||
[Api13ToDo("Remove invoke from eventInfo.Handler, and remove nullability from eventInfo.Delegate?.Invoke")]
|
||||
private void PluginEventListHandler(AtkEventListener* self, AtkEventType eventType, uint eventParam, AtkEvent* eventPtr, AtkEventData* eventDataPtr)
|
||||
{
|
||||
try
|
||||
|
|
@ -238,10 +193,7 @@ internal unsafe class PluginEventController : IDisposable
|
|||
if (eventPtr is null) return;
|
||||
if (this.Events.FirstOrDefault(handler => handler.ParamKey == eventParam) is not { } eventInfo) return;
|
||||
|
||||
// We stored the AtkUnitBase* in EventData->Node, and EventData->Target contains the node that triggered the event.
|
||||
eventInfo.Handler?.Invoke((AddonEventType)eventType, (nint)eventPtr->Node, (nint)eventPtr->Target);
|
||||
|
||||
eventInfo.Delegate?.Invoke((AddonEventType)eventType, new AddonEventData
|
||||
eventInfo.Delegate.Invoke((AddonEventType)eventType, new AddonEventData
|
||||
{
|
||||
AddonPointer = (nint)eventPtr->Node,
|
||||
NodeTargetPointer = (nint)eventPtr->Target,
|
||||
|
|
|
|||
|
|
@ -188,12 +188,6 @@ public enum ConditionFlag
|
|||
/// </summary>
|
||||
ExecutingCraftingAction = 40,
|
||||
|
||||
/// <summary>
|
||||
/// Unable to execute command while crafting.
|
||||
/// </summary>
|
||||
[Obsolete("Renamed to ExecutingCraftingAction.")]
|
||||
Crafting40 = 40,
|
||||
|
||||
/// <summary>
|
||||
/// Unable to execute command while preparing to craft.
|
||||
/// </summary>
|
||||
|
|
@ -205,12 +199,6 @@ public enum ConditionFlag
|
|||
/// <remarks> Includes fishing. </remarks>
|
||||
ExecutingGatheringAction = 42,
|
||||
|
||||
/// <summary>
|
||||
/// Unable to execute command while gathering.
|
||||
/// </summary>
|
||||
[Obsolete("Renamed to ExecutingGatheringAction.")]
|
||||
Gathering42 = 42,
|
||||
|
||||
/// <summary>
|
||||
/// Unable to execute command while fishing.
|
||||
/// </summary>
|
||||
|
|
@ -235,12 +223,6 @@ public enum ConditionFlag
|
|||
/// </summary>
|
||||
Jumping = 48,
|
||||
|
||||
/// <summary>
|
||||
/// Unable to execute command while auto-run is active.
|
||||
/// </summary>
|
||||
[Obsolete("To avoid confusion, renamed to UsingChocoboTaxi.")]
|
||||
AutorunActive = 49,
|
||||
|
||||
/// <summary>
|
||||
/// Unable to execute command while auto-run is active.
|
||||
/// </summary>
|
||||
|
|
@ -282,12 +264,6 @@ public enum ConditionFlag
|
|||
/// </summary>
|
||||
BoundByDuty56 = 56,
|
||||
|
||||
/// <summary>
|
||||
/// Unable to execute command at this time.
|
||||
/// </summary>
|
||||
[Obsolete("Renamed to MountOrOrnamentTransition.")]
|
||||
Unknown57 = 57,
|
||||
|
||||
/// <summary>
|
||||
/// Unable to execute command at this time.
|
||||
/// </summary>
|
||||
|
|
@ -461,12 +437,6 @@ public enum ConditionFlag
|
|||
/// </summary>
|
||||
RolePlaying = 90,
|
||||
|
||||
/// <summary>
|
||||
/// Unable to execute command while bound by duty.
|
||||
/// </summary>
|
||||
[Obsolete("Use InDutyQueue")]
|
||||
BoundToDuty97 = 91,
|
||||
|
||||
/// <summary>
|
||||
/// Unable to execute command while bound by duty.
|
||||
/// Specifically triggered when you are in a queue for a duty but not inside a duty.
|
||||
|
|
@ -483,12 +453,6 @@ public enum ConditionFlag
|
|||
/// </summary>
|
||||
WaitingToVisitOtherWorld = 93,
|
||||
|
||||
/// <summary>
|
||||
/// Unable to execute command while using a parasol.
|
||||
/// </summary>
|
||||
[Obsolete("Renamed to UsingFashionAccessory.")]
|
||||
UsingParasol = 94,
|
||||
|
||||
/// <summary>
|
||||
/// Unable to execute command while using a fashion accessory.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ using System.Numerics;
|
|||
using Dalamud.Data;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Memory;
|
||||
using Dalamud.Utility;
|
||||
|
||||
using Lumina.Excel;
|
||||
|
||||
|
|
@ -69,12 +68,6 @@ public interface IFate : IEquatable<IFate>
|
|||
/// </summary>
|
||||
byte Progress { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this <see cref="Fate"/> has a EXP bonus.
|
||||
/// </summary>
|
||||
[Obsolete($"Use {nameof(HasBonus)} instead")]
|
||||
bool HasExpBonus { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this <see cref="Fate"/> has a bonus.
|
||||
/// </summary>
|
||||
|
|
@ -222,10 +215,6 @@ internal unsafe partial class Fate : IFate
|
|||
/// <inheritdoc/>
|
||||
public byte Progress => this.Struct->Progress;
|
||||
|
||||
/// <inheritdoc/>
|
||||
[Api13ToDo("Remove")]
|
||||
public bool HasExpBonus => this.HasBonus;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool HasBonus => this.Struct->IsBonus;
|
||||
|
||||
|
|
|
|||
|
|
@ -610,10 +610,10 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar
|
|||
return newTextNode;
|
||||
}
|
||||
|
||||
private void DtrEventHandler(AddonEventType atkEventType, IntPtr atkUnitBase, IntPtr atkResNode)
|
||||
private void DtrEventHandler(AddonEventType atkEventType, AddonEventData data)
|
||||
{
|
||||
var addon = (AtkUnitBase*)atkUnitBase;
|
||||
var node = (AtkResNode*)atkResNode;
|
||||
var addon = (AtkUnitBase*)data.AddonPointer;
|
||||
var node = (AtkResNode*)data.NodeTargetPointer;
|
||||
|
||||
DtrBarEntry? dtrBarEntry = null;
|
||||
this.entriesLock.EnterReadLock();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Buffers;
|
||||
using System.Buffers;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
|
|
@ -120,19 +120,11 @@ internal sealed partial class FontAtlasFactory
|
|||
public IFontSpec DefaultFontSpec =>
|
||||
this.DefaultFontSpecOverride
|
||||
?? Service<DalamudConfiguration>.Get().DefaultFontSpec
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
?? (Service<DalamudConfiguration>.Get().UseAxisFontsFromGame
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
? new()
|
||||
?? new SingleFontSpec()
|
||||
{
|
||||
FontId = new GameFontAndFamilyId(GameFontFamily.Axis),
|
||||
SizePx = InterfaceManager.DefaultFontSizePx,
|
||||
}
|
||||
: new SingleFontSpec
|
||||
{
|
||||
FontId = new DalamudAssetFontAndFamilyId(DalamudAsset.NotoSansJpMedium),
|
||||
SizePx = InterfaceManager.DefaultFontSizePx + 1,
|
||||
});
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Gets the service instance of <see cref="Framework"/>.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Dalamud.Game.Addon.Events;
|
||||
using Dalamud.Game.Addon.Events;
|
||||
|
||||
namespace Dalamud.Plugin.Services;
|
||||
|
||||
|
|
@ -7,15 +7,6 @@ namespace Dalamud.Plugin.Services;
|
|||
/// </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>
|
||||
[Obsolete("Use AddonEventDelegate instead")]
|
||||
public delegate void AddonEventHandler(AddonEventType atkEventType, nint atkUnitBase, nint atkResNode);
|
||||
|
||||
/// <summary>
|
||||
/// Delegate to be called when an event is received.
|
||||
/// </summary>
|
||||
|
|
@ -23,17 +14,6 @@ public interface IAddonEventManager
|
|||
/// <param name="data">The event data object for use in handling this event.</param>
|
||||
public delegate void AddonEventDelegate(AddonEventType atkEventType, AddonEventData data);
|
||||
|
||||
/// <summary>
|
||||
/// Registers an event handler for the specified addon, node, and type.
|
||||
/// </summary>
|
||||
/// <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>
|
||||
/// <returns>IAddonEventHandle used to remove the event. Null if no event was added.</returns>
|
||||
[Obsolete("Use AddEvent with AddonEventDelegate instead of AddonEventHandler")]
|
||||
IAddonEventHandle? AddEvent(nint atkUnitBase, nint atkResNode, AddonEventType eventType, AddonEventHandler eventHandler);
|
||||
|
||||
/// <summary>
|
||||
/// Registers an event handler for the specified addon, node, and type.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -605,37 +605,6 @@ public static class Util
|
|||
NativeFunctions.FlashWindowEx(ref flashInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overwrite text in a file by first writing it to a temporary file, and then
|
||||
/// moving that file to the path specified.
|
||||
/// </summary>
|
||||
/// <param name="path">The path of the file to write to.</param>
|
||||
/// <param name="text">The text to write.</param>
|
||||
[Api13ToDo("Remove.")]
|
||||
[Obsolete("Replaced with FilesystemUtil.WriteAllTextSafe()")]
|
||||
public static void WriteAllTextSafe(string path, string text) => FilesystemUtil.WriteAllTextSafe(path, text);
|
||||
|
||||
/// <summary>
|
||||
/// Overwrite text in a file by first writing it to a temporary file, and then
|
||||
/// moving that file to the path specified.
|
||||
/// </summary>
|
||||
/// <param name="path">The path of the file to write to.</param>
|
||||
/// <param name="text">The text to write.</param>
|
||||
/// <param name="encoding">Encoding to use.</param>
|
||||
[Api13ToDo("Remove.")]
|
||||
[Obsolete("Replaced with FilesystemUtil.WriteAllTextSafe()")]
|
||||
public static void WriteAllTextSafe(string path, string text, Encoding encoding) => FilesystemUtil.WriteAllTextSafe(path, text, encoding);
|
||||
|
||||
/// <summary>
|
||||
/// Overwrite data in a file by first writing it to a temporary file, and then
|
||||
/// moving that file to the path specified.
|
||||
/// </summary>
|
||||
/// <param name="path">The path of the file to write to.</param>
|
||||
/// <param name="bytes">The data to write.</param>
|
||||
[Api13ToDo("Remove.")]
|
||||
[Obsolete("Replaced with FilesystemUtil.WriteAllBytesSafe()")]
|
||||
public static void WriteAllBytesSafe(string path, byte[] bytes) => FilesystemUtil.WriteAllBytesSafe(path, bytes);
|
||||
|
||||
/// <summary>Gets a temporary file name, for use as the sourceFileName in
|
||||
/// <see cref="File.Replace(string,string,string?)"/>.</summary>
|
||||
/// <param name="targetFile">The target file.</param>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue