From f895945c5bbfe61fe42a4d838b30b4fae1f5b21d Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Fri, 6 Oct 2023 13:07:41 +0200 Subject: [PATCH] Fix a potential issue around list not refreshing/turning in ghost items --- Deliveroo/Deliveroo.csproj | 2 +- Deliveroo/DeliverooPlugin.Supply.cs | 30 +++++++++++++++++++++++++++-- Deliveroo/DeliverooPlugin.cs | 12 ++++++++++-- Deliveroo/Stage.cs | 4 +++- 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/Deliveroo/Deliveroo.csproj b/Deliveroo/Deliveroo.csproj index 538dc8a..36dddca 100644 --- a/Deliveroo/Deliveroo.csproj +++ b/Deliveroo/Deliveroo.csproj @@ -1,7 +1,7 @@ net7.0-windows - 2.0 + 2.1 11.0 enable true diff --git a/Deliveroo/DeliverooPlugin.Supply.cs b/Deliveroo/DeliverooPlugin.Supply.cs index b42cd0b..f4d40d6 100644 --- a/Deliveroo/DeliverooPlugin.Supply.cs +++ b/Deliveroo/DeliverooPlugin.Supply.cs @@ -155,11 +155,37 @@ partial class DeliverooPlugin { addonSupplyReward->AtkUnitBase.FireCallbackInt(0); _continueAt = DateTime.Now.AddSeconds(0.58); - CurrentStage = Stage.FinalizeTurnIn; + CurrentStage = Stage.FinalizeTurnIn1; } } - private unsafe void FinalizeTurnInItem() + private unsafe void FinalizeTurnInItem1() + { + if (TryGetAddonByName("GrandCompanySupplyList", + out var addonSupplyList) && IsAddonReady(&addonSupplyList->AtkUnitBase)) + { + addonSupplyList->AtkUnitBase.FireCallbackInt(2); + CurrentStage = Stage.FinalizeTurnIn2; + } + } + + private unsafe void FinalizeTurnInItem2() + { + if (TryGetAddonByName("GrandCompanySupplyList", + out var addonSupplyList) && IsAddonReady(&addonSupplyList->AtkUnitBase)) + { + var updateUnknown = stackalloc AtkValue[] + { + new() { Type = ValueType.Int, Int = 4 }, + new() { Type = ValueType.Int, Int = 0 }, + new() { Type = 0, Int = 0 } + }; + addonSupplyList->AtkUnitBase.FireCallback(3, updateUnknown); + CurrentStage = Stage.FinalizeTurnIn3; + } + } + + private unsafe void FinalizeTurnInItem3() { if (TryGetAddonByName("GrandCompanySupplyList", out var addonSupplyList) && IsAddonReady(&addonSupplyList->AtkUnitBase)) diff --git a/Deliveroo/DeliverooPlugin.cs b/Deliveroo/DeliverooPlugin.cs index 0d98f2e..59e412d 100644 --- a/Deliveroo/DeliverooPlugin.cs +++ b/Deliveroo/DeliverooPlugin.cs @@ -234,8 +234,16 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin TurnInSelectedItem(); break; - case Stage.FinalizeTurnIn: - FinalizeTurnInItem(); + case Stage.FinalizeTurnIn1: + FinalizeTurnInItem1(); + break; + + case Stage.FinalizeTurnIn2: + FinalizeTurnInItem2(); + break; + + case Stage.FinalizeTurnIn3: + FinalizeTurnInItem3(); break; case Stage.CloseGcSupply: diff --git a/Deliveroo/Stage.cs b/Deliveroo/Stage.cs index 5fbe112..79d63ac 100644 --- a/Deliveroo/Stage.cs +++ b/Deliveroo/Stage.cs @@ -7,7 +7,9 @@ internal enum Stage SelectExpertDeliveryTab, SelectItemToTurnIn, TurnInSelected, - FinalizeTurnIn, + FinalizeTurnIn1, + FinalizeTurnIn2, + FinalizeTurnIn3, CloseGcSupply, CloseGcSupplyThenStop,