diff --git a/Deliveroo/DeliverooPlugin.Exchange.cs b/Deliveroo/DeliverooPlugin.Exchange.cs index 12fdbb6..f66b658 100644 --- a/Deliveroo/DeliverooPlugin.Exchange.cs +++ b/Deliveroo/DeliverooPlugin.Exchange.cs @@ -92,7 +92,7 @@ partial class DeliverooPlugin private void ConfirmReward() { - if (SelectSelectYesno(0)) + if (SelectSelectYesno(0, s => s.StartsWith("Exchange "))) { CurrentStage = Stage.CloseGcExchange; _continueAt = DateTime.Now.AddSeconds(0.5); diff --git a/Deliveroo/DeliverooPlugin.Supply.cs b/Deliveroo/DeliverooPlugin.Supply.cs index 2ab2825..d7924fc 100644 --- a/Deliveroo/DeliverooPlugin.Supply.cs +++ b/Deliveroo/DeliverooPlugin.Supply.cs @@ -118,16 +118,8 @@ partial class DeliverooPlugin private unsafe void TurnInSelectedItem() { - if (TryGetAddonByName("SelectYesno", out var addonSelectYesno) && - IsAddonReady(&addonSelectYesno->AtkUnitBase)) - { - if (MemoryHelper.ReadSeString(&addonSelectYesno->PromptText->NodeText).ToString() - .StartsWith("Do you really want to trade a high-quality item?")) - { - addonSelectYesno->AtkUnitBase.FireCallbackInt(0); - return; - } - } + if (SelectSelectYesno(0, s => s == "Do you really want to trade a high-quality item?")) + return; if (TryGetAddonByName("GrandCompanySupplyReward", out var addonSupplyReward) && IsAddonReady(&addonSupplyReward->AtkUnitBase)) diff --git a/Deliveroo/DeliverooPlugin.cs b/Deliveroo/DeliverooPlugin.cs index 9477163..05e14d1 100644 --- a/Deliveroo/DeliverooPlugin.cs +++ b/Deliveroo/DeliverooPlugin.cs @@ -442,10 +442,11 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin return false; } - private unsafe bool SelectSelectYesno(int choice) + private unsafe bool SelectSelectYesno(int choice, Predicate predicate) { if (TryGetAddonByName("SelectYesno", out var addonSelectYesno) && - IsAddonReady(&addonSelectYesno->AtkUnitBase)) + IsAddonReady(&addonSelectYesno->AtkUnitBase) && + predicate(MemoryHelper.ReadSeString(&addonSelectYesno->PromptText->NodeText).ToString())) { PluginLog.Information( $"Selecting choice={choice} for '{MemoryHelper.ReadSeString(&addonSelectYesno->PromptText->NodeText)}'");