feat: add search for item

This commit is contained in:
Anna 2022-01-10 23:48:36 -05:00
parent 3d099ee4f2
commit aaa605e806
Signed by: anna
GPG Key ID: 0B391D8F06FCD9E0
2 changed files with 18 additions and 2 deletions

View File

@ -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<IntPtr, uint, void> _searchForRecipesUsingItem;
[Signature("E8 ?? ?? ?? ?? EB 45 45 33 C9")]
private readonly delegate* unmanaged<void*, uint, byte, void> _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);
}
}

View File

@ -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);
}