From 8956bd54a93a4466955996a82889f3a29c0738e8 Mon Sep 17 00:00:00 2001 From: goat Date: Mon, 4 Nov 2024 15:01:09 +0100 Subject: [PATCH] fix some warnings --- Dalamud/Game/Addon/Lifecycle/AddonEvent.cs | 2 +- Dalamud/Game/ClientState/Fates/Fate.cs | 12 +++++++++++- Dalamud/Game/Gui/NamePlate/NamePlateUpdateContext.cs | 4 ++-- Dalamud/Game/Gui/NamePlate/NamePlateUpdateHandler.cs | 2 +- Dalamud/Interface/Internal/UiDebug.cs | 6 +++--- .../Internal/UiDebug2/Browsing/NodeTree.Image.cs | 6 +++--- Dalamud/Interface/Windowing/Window.cs | 6 +++--- Dalamud/Plugin/Ipc/ICallGateSubscriber.cs | 1 - Dalamud/Utility/StringExtensions.cs | 4 +++- 9 files changed, 27 insertions(+), 16 deletions(-) diff --git a/Dalamud/Game/Addon/Lifecycle/AddonEvent.cs b/Dalamud/Game/Addon/Lifecycle/AddonEvent.cs index 91b9dd51f..5fd0ac964 100644 --- a/Dalamud/Game/Addon/Lifecycle/AddonEvent.cs +++ b/Dalamud/Game/Addon/Lifecycle/AddonEvent.cs @@ -52,7 +52,7 @@ public enum AddonEvent PostDraw, /// - /// An event that is fired immediately before an addon is finalized via and + /// An event that is fired immediately before an addon is finalized via and /// destroyed. After this event, the addon will destruct its UI node data as well as free any allocated memory. /// This event can be used for cleanup and tracking tasks. /// diff --git a/Dalamud/Game/ClientState/Fates/Fate.cs b/Dalamud/Game/ClientState/Fates/Fate.cs index 2d32cc04c..eab4229eb 100644 --- a/Dalamud/Game/ClientState/Fates/Fate.cs +++ b/Dalamud/Game/ClientState/Fates/Fate.cs @@ -4,6 +4,7 @@ using Dalamud.Data; using Dalamud.Game.ClientState.Resolvers; using Dalamud.Game.Text.SeStringHandling; using Dalamud.Memory; +using Dalamud.Utility; namespace Dalamud.Game.ClientState.Fates; @@ -70,7 +71,13 @@ public interface IFate : IEquatable /// /// Gets a value indicating whether or not this has a EXP bonus. /// + [Api11ToDo("Remove this")] bool HasExpBonus { get; } + + /// + /// Gets a value indicating whether or not this has a EXP bonus. + /// + bool HasBonus { get; } /// /// Gets the icon id of this . @@ -215,7 +222,10 @@ internal unsafe partial class Fate : IFate public byte Progress => this.Struct->Progress; /// - public bool HasExpBonus => this.Struct->IsExpBonus; + public bool HasExpBonus => this.Struct->IsBonus; + + /// + public bool HasBonus => this.Struct->IsBonus; /// public uint IconId => this.Struct->IconId; diff --git a/Dalamud/Game/Gui/NamePlate/NamePlateUpdateContext.cs b/Dalamud/Game/Gui/NamePlate/NamePlateUpdateContext.cs index b8a4a9bd8..2d5633bcb 100644 --- a/Dalamud/Game/Gui/NamePlate/NamePlateUpdateContext.cs +++ b/Dalamud/Game/Gui/NamePlate/NamePlateUpdateContext.cs @@ -127,7 +127,7 @@ internal unsafe class NamePlateUpdateContext : INamePlateUpdateContext /// /// Gets a pointer to the NamePlate addon's number array entries as a struct. /// - internal AddonNamePlate.NamePlateIntArrayData* NumberStruct { get; private set; } + internal AddonNamePlate.AddonNamePlateNumberArray* NumberStruct { get; private set; } /// /// Gets or sets a value indicating whether any handler in the current context has instantiated a part builder. @@ -142,7 +142,7 @@ internal unsafe class NamePlateUpdateContext : INamePlateUpdateContext { this.Addon = (AddonNamePlate*)args.Addon; this.NumberData = ((NumberArrayData**)args.NumberArrayData)![NamePlateGui.NumberArrayIndex]; - this.NumberStruct = (AddonNamePlate.NamePlateIntArrayData*)this.NumberData->IntArray; + this.NumberStruct = (AddonNamePlate.AddonNamePlateNumberArray*)this.NumberData->IntArray; this.StringData = ((StringArrayData**)args.StringArrayData)![NamePlateGui.StringArrayIndex]; this.HasParts = false; diff --git a/Dalamud/Game/Gui/NamePlate/NamePlateUpdateHandler.cs b/Dalamud/Game/Gui/NamePlate/NamePlateUpdateHandler.cs index 99429d932..7b547a153 100644 --- a/Dalamud/Game/Gui/NamePlate/NamePlateUpdateHandler.cs +++ b/Dalamud/Game/Gui/NamePlate/NamePlateUpdateHandler.cs @@ -490,7 +490,7 @@ internal unsafe class NamePlateUpdateHandler : INamePlateUpdateHandler private AddonNamePlate.NamePlateObject* NamePlateObject => &this.context.Addon->NamePlateObjectArray[this.NamePlateIndex]; - private AddonNamePlate.NamePlateIntArrayData.NamePlateObjectIntArrayData* ObjectData => + private AddonNamePlate.AddonNamePlateNumberArray.NamePlateObjectIntArrayData* ObjectData => this.context.NumberStruct->ObjectData.GetPointer(this.ArrayIndex); /// diff --git a/Dalamud/Interface/Internal/UiDebug.cs b/Dalamud/Interface/Internal/UiDebug.cs index f1a025d93..88294fdee 100644 --- a/Dalamud/Interface/Internal/UiDebug.cs +++ b/Dalamud/Interface/Internal/UiDebug.cs @@ -300,7 +300,7 @@ internal unsafe class UiDebug { ImGui.Image( new IntPtr(kernelTexture->D3D11ShaderResourceView), - new Vector2(kernelTexture->Width, kernelTexture->Height)); + new Vector2(kernelTexture->ActualWidth, kernelTexture->ActualHeight)); ImGui.TreePop(); } } @@ -312,8 +312,8 @@ internal unsafe class UiDebug ImGui.Image( new IntPtr(textureInfo->AtkTexture.KernelTexture->D3D11ShaderResourceView), new Vector2( - textureInfo->AtkTexture.KernelTexture->Width, - textureInfo->AtkTexture.KernelTexture->Height)); + textureInfo->AtkTexture.KernelTexture->ActualWidth, + textureInfo->AtkTexture.KernelTexture->ActualHeight)); ImGui.TreePop(); } } diff --git a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Image.cs b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Image.cs index 678eec8cd..4929fa1d9 100644 --- a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Image.cs +++ b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Image.cs @@ -172,7 +172,7 @@ internal unsafe partial class ImageNodeTree : ResNodeTree var cursorScreenPos = ImGui.GetCursorScreenPos(); var cursorLocalPos = ImGui.GetCursorPos(); - ImGui.Image(new(this.TexData.Texture->D3D11ShaderResourceView), new(this.TexData.Texture->Width, this.TexData.Texture->Height)); + ImGui.Image(new(this.TexData.Texture->D3D11ShaderResourceView), new(this.TexData.Texture->ActualWidth, this.TexData.Texture->ActualHeight)); for (uint p = 0; p < this.TexData.PartsList->PartCount; p++) { @@ -197,8 +197,8 @@ internal unsafe partial class ImageNodeTree : ResNodeTree ImGui.TableHeadersRow(); - var tWidth = this.TexData.Texture->Width; - var tHeight = this.TexData.Texture->Height; + var tWidth = this.TexData.Texture->ActualWidth; + var tHeight = this.TexData.Texture->ActualHeight; var textureSize = new Vector2(tWidth, tHeight); for (ushort i = 0; i < this.TexData.PartCount; i++) diff --git a/Dalamud/Interface/Windowing/Window.cs b/Dalamud/Interface/Windowing/Window.cs index d2a51235d..bcceb9311 100644 --- a/Dalamud/Interface/Windowing/Window.cs +++ b/Dalamud/Interface/Windowing/Window.cs @@ -287,7 +287,7 @@ public abstract class Window this.IsFocused = false; - if (doSoundEffects && !this.DisableWindowSounds) UIModule.PlaySound(this.OnCloseSfxId, 0, 0, 0); + if (doSoundEffects && !this.DisableWindowSounds) UIGlobals.PlaySoundEffect(this.OnCloseSfxId, 0, 0, 0); } return; @@ -307,7 +307,7 @@ public abstract class Window this.internalLastIsOpen = this.internalIsOpen; this.OnOpen(); - if (doSoundEffects && !this.DisableWindowSounds) UIModule.PlaySound(this.OnOpenSfxId, 0, 0, 0); + if (doSoundEffects && !this.DisableWindowSounds) UIGlobals.PlaySoundEffect(this.OnOpenSfxId, 0, 0, 0); } this.PreDraw(); @@ -347,7 +347,7 @@ public abstract class Window } catch (Exception ex) { - Log.Error(ex, $"Error during Draw(): {this.WindowName}"); + Log.Error(ex, "Error during Draw(): {WindowName}", this.WindowName); } } diff --git a/Dalamud/Plugin/Ipc/ICallGateSubscriber.cs b/Dalamud/Plugin/Ipc/ICallGateSubscriber.cs index fd67ec7db..9bb1d0550 100644 --- a/Dalamud/Plugin/Ipc/ICallGateSubscriber.cs +++ b/Dalamud/Plugin/Ipc/ICallGateSubscriber.cs @@ -9,7 +9,6 @@ namespace Dalamud.Plugin.Ipc; /// public interface ICallGateSubscriber { - /// public bool HasAction { get; } diff --git a/Dalamud/Utility/StringExtensions.cs b/Dalamud/Utility/StringExtensions.cs index 02dfdafbf..9f097bb09 100644 --- a/Dalamud/Utility/StringExtensions.cs +++ b/Dalamud/Utility/StringExtensions.cs @@ -2,6 +2,8 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Runtime.CompilerServices; +using FFXIVClientStructs.FFXIV.Client.UI; + namespace Dalamud.Utility; /// @@ -40,7 +42,7 @@ public static class StringExtensions public static bool IsValidCharacterName(this string value, bool includeLegacy = true) { if (string.IsNullOrEmpty(value)) return false; - if (!FFXIVClientStructs.FFXIV.Client.UI.UIModule.IsPlayerCharacterName(value)) return false; + if (!UIGlobals.IsValidPlayerCharacterName(value)) return false; return includeLegacy || value.Length <= 21; } }