Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

Commit

Permalink
fix: remove unnecessary scanner
Browse files Browse the repository at this point in the history
  • Loading branch information
cecilia-sanare committed Jun 6, 2024
1 parent 1c9f95d commit 1b72eb2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 24 deletions.
1 change: 0 additions & 1 deletion Puppets/PuppetsPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
25 changes: 2 additions & 23 deletions Puppets/Utils/Emotes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<IsEmoteUnlockedDelegate>(emoteUnlockedPtr);
}
}

return Emotes.__isEmoteUnlocked;
}
}

private static List<SearchableEmote>? _emotes;
private static List<SearchableEmote> ValidEmotes
{
Expand Down Expand Up @@ -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);
}
}
}

0 comments on commit 1b72eb2

Please sign in to comment.