From b85914c54c71af0f7da4a1b2126436886807d5d0 Mon Sep 17 00:00:00 2001 From: Kaz Wolfe Date: Sat, 20 Apr 2024 11:04:53 -0700 Subject: [PATCH] chore: Clean up a couple more todos - Remove AddNotification from UiBuilder - Change MateriaGrade to just Bytes now. --- Dalamud/Game/Inventory/GameInventoryItem.cs | 9 ++--- Dalamud/Interface/UiBuilder.cs | 40 --------------------- 2 files changed, 2 insertions(+), 47 deletions(-) diff --git a/Dalamud/Game/Inventory/GameInventoryItem.cs b/Dalamud/Game/Inventory/GameInventoryItem.cs index d37e1081f..877fd26c6 100644 --- a/Dalamud/Game/Inventory/GameInventoryItem.cs +++ b/Dalamud/Game/Inventory/GameInventoryItem.cs @@ -106,10 +106,8 @@ public unsafe struct GameInventoryItem : IEquatable /// /// Gets the array of materia grades. /// - // TODO: Replace with MateriaGradeBytes - [Api10ToDo(Api10ToDoAttribute.DeleteCompatBehavior)] - public ReadOnlySpan MateriaGrade => - this.MateriaGradeBytes.ToArray().Select(g => (ushort)g).ToArray().AsSpan(); + public ReadOnlySpan MateriaGrade => + new(Unsafe.AsPointer(ref Unsafe.AsRef(in this.InternalItem.MateriaGrade[0])), 5); /// /// Gets the address of native inventory item in the game.
@@ -151,9 +149,6 @@ public unsafe struct GameInventoryItem : IEquatable ///
internal ulong CrafterContentId => this.InternalItem.CrafterContentID; - private ReadOnlySpan MateriaGradeBytes => - new(Unsafe.AsPointer(ref Unsafe.AsRef(in this.InternalItem.MateriaGrade[0])), 5); - public static bool operator ==(in GameInventoryItem l, in GameInventoryItem r) => l.Equals(r); public static bool operator !=(in GameInventoryItem l, in GameInventoryItem r) => !l.Equals(r); diff --git a/Dalamud/Interface/UiBuilder.cs b/Dalamud/Interface/UiBuilder.cs index 9440b89e6..c7b77c0c7 100644 --- a/Dalamud/Interface/UiBuilder.cs +++ b/Dalamud/Interface/UiBuilder.cs @@ -586,52 +586,12 @@ public sealed class UiBuilder : IDisposable autoRebuildMode, isGlobalScaled)); - /// - /// Add a notification to the notification queue. - /// - /// The content of the notification. - /// The title of the notification. - /// The type of the notification. - /// The time the notification should be displayed for. - [Obsolete($"Use {nameof(INotificationManager)}.", false)] - [Api10ToDo(Api10ToDoAttribute.DeleteCompatBehavior)] - public async void AddNotification( - string content, - string? title = null, - NotificationType type = NotificationType.None, - uint msDelay = 3000) - { - var nm = await Service.GetAsync(); - var an = nm.AddNotification( - new() - { - Content = content, - Title = title, - Type = type, - InitialDuration = TimeSpan.FromMilliseconds(msDelay), - }, - this.localPlugin); - _ = this.notifications.TryAdd(an, 0); - an.Dismiss += a => this.notifications.TryRemove(a.Notification, out _); - } - /// /// Unregister the UiBuilder. Do not call this in plugin code. /// void IDisposable.Dispose() { this.scopedFinalizer.Dispose(); - - // Taken from NotificationManagerPluginScoped. - // TODO: remove on API 10. - while (!this.notifications.IsEmpty) - { - foreach (var n in this.notifications.Keys) - { - this.notifications.TryRemove(n, out _); - ((ActiveNotification)n).RemoveNonDalamudInvocations(); - } - } } /// Clean up resources allocated by this instance of .