diff --git a/Deliveroo/Deliveroo.csproj b/Deliveroo/Deliveroo.csproj index b7bc4c0..61e6956 100644 --- a/Deliveroo/Deliveroo.csproj +++ b/Deliveroo/Deliveroo.csproj @@ -1,7 +1,7 @@ net7.0-windows - 2.4 + 2.5 11.0 enable true diff --git a/Deliveroo/DeliverooPlugin.Supply.cs b/Deliveroo/DeliverooPlugin.Supply.cs index f21786f..ff57d44 100644 --- a/Deliveroo/DeliverooPlugin.Supply.cs +++ b/Deliveroo/DeliverooPlugin.Supply.cs @@ -50,6 +50,7 @@ partial class DeliverooPlugin new() { Type = 0, Int = 0 } }; addon->FireCallback(3, selectExpertDeliveryTab); + _lastTurnInListLength = int.MaxValue; CurrentStage = Stage.SelectItemToTurnIn; } } @@ -102,6 +103,19 @@ partial class DeliverooPlugin return; } + // Fallback: Two successive calls to SelectItemToTurnIn should *not* have lists of the same length, or + // something is wrong. + if (items.Count >= _lastTurnInListLength) + { + _pluginLog.Warning("Closing GC supply window, possible invalid loop detected"); + + CurrentStage = Stage.CloseGcSupply; + addon->FireCallbackInt(-1); + return; + } + + _lastTurnInListLength = items.Count; + // TODO The way the items are handled above, we don't actually know if items[0] is the first visible item // in the list, it is "only" the highest-value item to turn in. // diff --git a/Deliveroo/DeliverooPlugin.cs b/Deliveroo/DeliverooPlugin.cs index 0cb2b85..979109f 100644 --- a/Deliveroo/DeliverooPlugin.cs +++ b/Deliveroo/DeliverooPlugin.cs @@ -49,6 +49,7 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin private Stage _currentStageInternal = Stage.Stopped; private DateTime _continueAt = DateTime.MinValue; + private int _lastTurnInListLength = int.MaxValue; private List _itemsToPurchaseNow = new(); public DeliverooPlugin(DalamudPluginInterface pluginInterface, IChatGui chatGui, IGameGui gameGui,