Trying to turn in a Red Onion Helm should close the supply window/disable the turn in instead of being stuck

This commit is contained in:
Liza 2024-02-17 09:58:50 +01:00
parent 0161f3df31
commit f0eab9cdbe
Signed by: liza
GPG Key ID: 7199F8D727D55F67
5 changed files with 40 additions and 16 deletions

View File

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

View File

@ -17,17 +17,17 @@ partial class DeliverooPlugin
if (CurrentStage == Stage.OpenGcSupply)
{
desiredText = _gameStrings.UndertakeSupplyAndProvisioningMission;
followUp = OpenGcSupplyFollowUp;
followUp = OpenGcSupplySelectStringFollowUp;
}
else if (CurrentStage == Stage.CloseGcSupply)
else if (CurrentStage == Stage.CloseGcSupplySelectString)
{
desiredText = _gameStrings.ClosePersonnelOfficerTalk;
followUp = CloseGcSupplyFollowUp;
followUp = CloseGcSupplySelectStringFollowUp;
}
else if (CurrentStage == Stage.CloseGcSupplyThenStop)
else if (CurrentStage == Stage.CloseGcSupplySelectStringThenStop)
{
desiredText = _gameStrings.ClosePersonnelOfficerTalk;
followUp = CloseGcSupplyThenCloseFollowUp;
followUp = CloseGcSupplySelectStringThenStopFollowUp;
}
else
return;
@ -58,13 +58,13 @@ partial class DeliverooPlugin
_pluginLog.Verbose($"Text '{desiredText}' was not found in prompt.");
}
private void OpenGcSupplyFollowUp()
private void OpenGcSupplySelectStringFollowUp()
{
ResetTurnInErrorHandling();
CurrentStage = Stage.SelectExpertDeliveryTab;
}
private void CloseGcSupplyFollowUp()
private void CloseGcSupplySelectStringFollowUp()
{
if (GetNextItemToPurchase() == null)
{
@ -79,7 +79,7 @@ partial class DeliverooPlugin
}
}
private void CloseGcSupplyThenCloseFollowUp()
private void CloseGcSupplySelectStringThenStopFollowUp()
{
if (GetNextItemToPurchase() == null)
{

View File

@ -104,7 +104,7 @@ partial class DeliverooPlugin
{
_pluginLog.Information(
$"No items to turn in ({addonGc->ListEmptyTextNode->AtkResNode.IsVisible}, {currentListSize})");
CurrentStage = Stage.CloseGcSupplyThenStop;
CurrentStage = Stage.CloseGcSupplySelectStringThenStop;
addon->FireCallbackInt(-1);
return;
}
@ -135,7 +135,7 @@ partial class DeliverooPlugin
if (items.Count == 0)
{
// probably shouldn't happen with the previous node visibility check
CurrentStage = Stage.CloseGcSupplyThenStop;
CurrentStage = Stage.CloseGcSupplySelectStringThenStop;
addon->FireCallbackInt(-1);
return;
}
@ -161,7 +161,7 @@ partial class DeliverooPlugin
// Helms from being turned in.
if (GetCurrentSealCount() + items[0].SealsWithBonus > GetSealCap())
{
CurrentStage = Stage.CloseGcSupply;
CurrentStage = Stage.CloseGcSupplySelectString;
addon->FireCallbackInt(-1);
return;
}
@ -192,6 +192,7 @@ partial class DeliverooPlugin
.Build());
addonSupplyReward->AtkUnitBase.FireCallbackInt(1);
CurrentStage = Stage.CloseGcSupplyWindowThenStop;
return;
}
@ -226,4 +227,22 @@ partial class DeliverooPlugin
return ItemFilterType.HideGearSetItems;
}
private unsafe void CloseGcSupplyWindow()
{
var agentInterface = AgentModule.Instance()->GetAgentByInternalId(AgentId.GrandCompanySupply);
if (agentInterface != null && agentInterface->IsAgentActive())
{
var addonId = agentInterface->GetAddonID();
if (addonId == 0)
return;
AtkUnitBase* addon = LAddon.GetAddonById(addonId);
if (addon == null || !LAddon.IsAddonReady(addon))
return;
CurrentStage = Stage.CloseGcSupplySelectStringThenStop;
addon->FireCallbackInt(-1);
}
}
}

View File

@ -302,14 +302,18 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
FinalizeTurnInItem();
break;
case Stage.CloseGcSupply:
case Stage.CloseGcSupplySelectString:
// see SelectStringPostSetup
break;
case Stage.CloseGcSupplyThenStop:
case Stage.CloseGcSupplySelectStringThenStop:
// see SelectStringPostSetup
break;
case Stage.CloseGcSupplyWindowThenStop:
CloseGcSupplyWindow();
break;
case Stage.TargetQuartermaster:
InteractWithQuartermaster(personnelOfficer!, quartermaster!);
break;

View File

@ -8,8 +8,9 @@ internal enum Stage
SelectItemToTurnIn,
TurnInSelected,
FinalizeTurnIn,
CloseGcSupply,
CloseGcSupplyThenStop,
CloseGcSupplySelectString,
CloseGcSupplySelectStringThenStop,
CloseGcSupplyWindowThenStop,
TargetQuartermaster,
SelectRewardTier,