Fix a potential issue around list not refreshing/turning in ghost items

pull/3/head v2.5
Liza 2023-10-09 16:26:05 +02:00
parent 500e25b508
commit 591a0806d1
Signed by: liza
GPG Key ID: 7199F8D727D55F67
3 changed files with 16 additions and 1 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework> <TargetFramework>net7.0-windows</TargetFramework>
<Version>2.4</Version> <Version>2.5</Version>
<LangVersion>11.0</LangVersion> <LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

View File

@ -50,6 +50,7 @@ partial class DeliverooPlugin
new() { Type = 0, Int = 0 } new() { Type = 0, Int = 0 }
}; };
addon->FireCallback(3, selectExpertDeliveryTab); addon->FireCallback(3, selectExpertDeliveryTab);
_lastTurnInListLength = int.MaxValue;
CurrentStage = Stage.SelectItemToTurnIn; CurrentStage = Stage.SelectItemToTurnIn;
} }
} }
@ -102,6 +103,19 @@ partial class DeliverooPlugin
return; 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 // 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. // in the list, it is "only" the highest-value item to turn in.
// //

View File

@ -49,6 +49,7 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
private Stage _currentStageInternal = Stage.Stopped; private Stage _currentStageInternal = Stage.Stopped;
private DateTime _continueAt = DateTime.MinValue; private DateTime _continueAt = DateTime.MinValue;
private int _lastTurnInListLength = int.MaxValue;
private List<PurchaseItemRequest> _itemsToPurchaseNow = new(); private List<PurchaseItemRequest> _itemsToPurchaseNow = new();
public DeliverooPlugin(DalamudPluginInterface pluginInterface, IChatGui chatGui, IGameGui gameGui, public DeliverooPlugin(DalamudPluginInterface pluginInterface, IChatGui chatGui, IGameGui gameGui,