Remove some warnings.

This commit is contained in:
Ottermandias 2024-08-04 12:38:38 +02:00
parent 34caf29b32
commit f69915dcb3
3 changed files with 14 additions and 9 deletions

View file

@ -70,6 +70,9 @@ public sealed class DesignQuickBar : Window, IDisposable
IsOpen = _config.Ephemeral.ShowDesignQuickBar && _config.QdbButtons != 0; IsOpen = _config.Ephemeral.ShowDesignQuickBar && _config.QdbButtons != 0;
} }
public override bool DrawConditions()
=> _objects.Player.Valid;
public override void PreDraw() public override void PreDraw()
{ {
Flags = GetFlags; Flags = GetFlags;
@ -112,7 +115,7 @@ public sealed class DesignQuickBar : Window, IDisposable
ImGui.SameLine(); ImGui.SameLine();
DrawApplyButton(buttonSize); DrawApplyButton(buttonSize);
} }
DrawRevertButton(buttonSize); DrawRevertButton(buttonSize);
DrawRevertEquipButton(buttonSize); DrawRevertEquipButton(buttonSize);
DrawRevertCustomizeButton(buttonSize); DrawRevertCustomizeButton(buttonSize);

View file

@ -40,7 +40,7 @@ public class ObjectManager(
return false; return false;
_identifierUpdate = LastUpdate; _identifierUpdate = LastUpdate;
World = (ushort)(this[0].Valid ? this[0].HomeWorld : 0); World = (ushort)(Player.Valid ? Player.HomeWorld : 0);
_identifiers.Clear(); _identifiers.Clear();
_allWorldIdentifiers.Clear(); _allWorldIdentifiers.Clear();
_nonOwnedIdentifiers.Clear(); _nonOwnedIdentifiers.Clear();

View file

@ -6,6 +6,7 @@ using Dalamud.Utility.Signatures;
using FFXIVClientStructs.FFXIV.Client.Game.UI; using FFXIVClientStructs.FFXIV.Client.Game.UI;
using Glamourer.GameData; using Glamourer.GameData;
using Glamourer.Events; using Glamourer.Events;
using Glamourer.Interop;
using Glamourer.Services; using Glamourer.Services;
using Lumina.Excel.GeneratedSheets; using Lumina.Excel.GeneratedSheets;
using Penumbra.GameData; using Penumbra.GameData;
@ -15,10 +16,10 @@ namespace Glamourer.Unlocks;
public class CustomizeUnlockManager : IDisposable, ISavable public class CustomizeUnlockManager : IDisposable, ISavable
{ {
private readonly SaveService _saveService; private readonly SaveService _saveService;
private readonly IClientState _clientState; private readonly IClientState _clientState;
private readonly ObjectUnlocked _event; private readonly ObjectUnlocked _event;
private readonly ObjectManager _objects;
private readonly Dictionary<uint, long> _unlocked = new(); private readonly Dictionary<uint, long> _unlocked = new();
public readonly IReadOnlyDictionary<CustomizeData, (uint Data, string Name)> Unlockable; public readonly IReadOnlyDictionary<CustomizeData, (uint Data, string Name)> Unlockable;
@ -27,12 +28,13 @@ public class CustomizeUnlockManager : IDisposable, ISavable
=> _unlocked; => _unlocked;
public CustomizeUnlockManager(SaveService saveService, CustomizeService customizations, IDataManager gameData, public CustomizeUnlockManager(SaveService saveService, CustomizeService customizations, IDataManager gameData,
IClientState clientState, ObjectUnlocked @event, IGameInteropProvider interop) IClientState clientState, ObjectUnlocked @event, IGameInteropProvider interop, ObjectManager objects)
{ {
interop.InitializeFromAttributes(this); interop.InitializeFromAttributes(this);
_saveService = saveService; _saveService = saveService;
_clientState = clientState; _clientState = clientState;
_event = @event; _event = @event;
_objects = objects;
Unlockable = CreateUnlockableCustomizations(customizations, gameData); Unlockable = CreateUnlockableCustomizations(customizations, gameData);
Load(); Load();
_setUnlockLinkValueHook.Enable(); _setUnlockLinkValueHook.Enable();
@ -94,7 +96,7 @@ public class CustomizeUnlockManager : IDisposable, ISavable
/// <summary> Scan and update all unlockable customizations for their current game state. </summary> /// <summary> Scan and update all unlockable customizations for their current game state. </summary>
public unsafe void Scan() public unsafe void Scan()
{ {
if (_clientState.LocalPlayer == null) if (!_objects.Player.Valid)
return; return;
Glamourer.Log.Debug("[UnlockManager] Scanning for new unlocked customizations."); Glamourer.Log.Debug("[UnlockManager] Scanning for new unlocked customizations.");
@ -128,7 +130,7 @@ public class CustomizeUnlockManager : IDisposable, ISavable
} }
private delegate void SetUnlockLinkValueDelegate(nint uiState, uint data, byte value); private delegate void SetUnlockLinkValueDelegate(nint uiState, uint data, byte value);
[Signature(Sigs.SetUnlockLinkValue, DetourName = nameof(SetUnlockLinkValueDetour))] [Signature(Sigs.SetUnlockLinkValue, DetourName = nameof(SetUnlockLinkValueDetour))]
private readonly Hook<SetUnlockLinkValueDelegate> _setUnlockLinkValueHook = null!; private readonly Hook<SetUnlockLinkValueDelegate> _setUnlockLinkValueHook = null!;