From 1b72eb2b6424c93a7af8387045a2a7e99be6e464 Mon Sep 17 00:00:00 2001 From: Cecilia Sanare Date: Wed, 5 Jun 2024 21:17:15 -0500 Subject: [PATCH] fix: remove unnecessary scanner --- Puppets/PuppetsPlugin.cs | 1 - Puppets/Utils/Emotes.cs | 25 ++----------------------- 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/Puppets/PuppetsPlugin.cs b/Puppets/PuppetsPlugin.cs index 4762512..845af4e 100644 --- a/Puppets/PuppetsPlugin.cs +++ b/Puppets/PuppetsPlugin.cs @@ -36,7 +36,6 @@ public sealed class PuppetsPlugin : IDalamudPlugin [PluginService] public static DalamudPluginInterface PluginInterface { get; private set; } [PluginService] public static ICommandManager CommandManager { get; private set; } [PluginService] public static IChatGui ChatGui { get; private set; } - [PluginService] public static SigScanner TargetScanner { get; private set; } [PluginService] public static IPluginLog PluginLog { get; private set; } [PluginService] public static INotificationManager NotificationManager { get; private set; } #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. diff --git a/Puppets/Utils/Emotes.cs b/Puppets/Utils/Emotes.cs index d5965b8..a1016f6 100644 --- a/Puppets/Utils/Emotes.cs +++ b/Puppets/Utils/Emotes.cs @@ -10,27 +10,6 @@ namespace Puppets.Utils { public static unsafe class Emotes { - // E8 ?? ?? ?? ?? 84 C0 74 A4 - private delegate byte IsEmoteUnlockedDelegate(UIState* uiState, uint emoteId, byte unk); - - private static IsEmoteUnlockedDelegate? __isEmoteUnlocked; - private static IsEmoteUnlockedDelegate? _isEmoteUnlocked - { - get - { - if (Emotes.__isEmoteUnlocked == null) - { - if (PuppetsPlugin.TargetScanner.TryScanText("E8 ?? ?? ?? ?? 84 C0 74 A4", out var emoteUnlockedPtr)) - { - PuppetsPlugin.PluginLog.Information($"emoteUnlockedPtr: {emoteUnlockedPtr:X}"); - Emotes.__isEmoteUnlocked = Marshal.GetDelegateForFunctionPointer(emoteUnlockedPtr); - } - } - - return Emotes.__isEmoteUnlocked; - } - } - private static List? _emotes; private static List ValidEmotes { @@ -81,8 +60,8 @@ public static bool isNotUnlockedEmote(string emote) private static bool isEmoteUnlocked(SearchableEmote emote) { - PluginLog.Information($"requested emote: {emote.Command}"); - return emote.UnlockLink == 0 || Emotes._isEmoteUnlocked != null && Emotes._isEmoteUnlocked(UIState.Instance(), emote.UnlockLink, 1) > 0; + PuppetsPlugin.PluginLog.Information($"requested emote: {emote.Command}"); + return emote.UnlockLink == 0 || UIState.Instance() -> IsUnlockLinkUnlockedOrQuestCompleted(emote.UnlockLink); } } }