From 4fafbe739092631508968d29246494c2a2b63696 Mon Sep 17 00:00:00 2001 From: Anna Date: Mon, 10 Jan 2022 23:48:36 -0500 Subject: [PATCH] feat: add search for item --- ChatTwo/GameFunctions.cs | 16 ++++++++++++++-- ChatTwo/PayloadHandler.cs | 4 ++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ChatTwo/GameFunctions.cs b/ChatTwo/GameFunctions.cs index ebb3404..40a0c51 100755 --- a/ChatTwo/GameFunctions.cs +++ b/ChatTwo/GameFunctions.cs @@ -32,7 +32,7 @@ internal unsafe class GameFunctions : IDisposable { private delegate IntPtr AgentContextYesNoDelegate(AgentInterface* context, uint a2, byte* playerName, ushort playerWorld, uint a5, byte a6); internal delegate void ChatActivatedEventDelegate(string? input); - + #region Functions [Signature("E8 ?? ?? ?? ?? 0F B7 44 37 ??")] @@ -65,8 +65,11 @@ internal unsafe class GameFunctions : IDisposable { [Signature("E8 ?? ?? ?? ?? E9 ?? ?? ?? ?? 41 B4 01")] private readonly delegate* unmanaged _searchForRecipesUsingItem; + [Signature("E8 ?? ?? ?? ?? EB 45 45 33 C9")] + private readonly delegate* unmanaged _searchForItem; + #endregion - + internal const int HqItemOffset = 1_000_000; private Plugin Plugin { get; } @@ -416,4 +419,13 @@ internal unsafe class GameFunctions : IDisposable { var a1 = vf35(uiModule); this._searchForRecipesUsingItem(a1, itemId); } + + internal void SearchForItem(uint itemId) { + if (this._searchForItem == null) { + return; + } + + var itemFinder = Framework.Instance()->GetUiModule()->GetItemFinderModule(); + this._searchForItem(itemFinder, itemId, 1); + } } diff --git a/ChatTwo/PayloadHandler.cs b/ChatTwo/PayloadHandler.cs index d162559..3143652 100755 --- a/ChatTwo/PayloadHandler.cs +++ b/ChatTwo/PayloadHandler.cs @@ -247,6 +247,10 @@ internal sealed class PayloadHandler { } } + if (ImGui.Selectable("Search for Item")) { + this.Ui.Plugin.Functions.SearchForItem(realItemId); + } + if (ImGui.Selectable("Link")) { this.Ui.Plugin.Functions.LinkItem(realItemId); }