fix(pf): register listing event correctly

This commit is contained in:
Anna 2021-05-29 01:22:31 -04:00
parent 85e7383f0d
commit 4ee1057591
Signed by: anna
GPG Key ID: 0B391D8F06FCD9E0

View File

@ -5,7 +5,6 @@ using Dalamud.Game;
using Dalamud.Game.Internal.Gui;
using Dalamud.Game.Internal.Gui.Structs;
using Dalamud.Hooking;
using Dalamud.Plugin;
namespace XivCommon.Functions {
/// <summary>
@ -66,6 +65,10 @@ namespace XivCommon.Functions {
this.ListingsEnabled = hooks.HasFlag(Hooks.PartyFinderListings);
this.JoinsEnabled = hooks.HasFlag(Hooks.PartyFinderJoins);
if (this.ListingsEnabled || this.JoinsEnabled) {
this.PartyFinderGui.ReceiveListing += this.ReceiveListing;
}
if (scanner.TryScanText(Signatures.RequestListings, out var requestPfPtr, "Party Finder listings")) {
this.RequestPartyFinderListings = Marshal.GetDelegateForFunctionPointer<RequestPartyFinderListingsDelegate>(requestPfPtr);
@ -78,8 +81,6 @@ namespace XivCommon.Functions {
if (this.JoinsEnabled && scanner.TryScanText(Signatures.JoinCrossParty, out var joinPtr, "Party Finder joins")) {
this.JoinPfHook = new Hook<JoinPfDelegate>(joinPtr, new JoinPfDelegate(this.JoinPfDetour));
this.JoinPfHook.Enable();
this.PartyFinderGui.ReceiveListing += this.ReceiveListing;
}
}