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"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework> <TargetFramework>net7.0-windows</TargetFramework>
<Version>3.0</Version> <Version>3.1</Version>
<LangVersion>11.0</LangVersion> <LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

View File

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

View File

@ -104,7 +104,7 @@ partial class DeliverooPlugin
{ {
_pluginLog.Information( _pluginLog.Information(
$"No items to turn in ({addonGc->ListEmptyTextNode->AtkResNode.IsVisible}, {currentListSize})"); $"No items to turn in ({addonGc->ListEmptyTextNode->AtkResNode.IsVisible}, {currentListSize})");
CurrentStage = Stage.CloseGcSupplyThenStop; CurrentStage = Stage.CloseGcSupplySelectStringThenStop;
addon->FireCallbackInt(-1); addon->FireCallbackInt(-1);
return; return;
} }
@ -135,7 +135,7 @@ partial class DeliverooPlugin
if (items.Count == 0) if (items.Count == 0)
{ {
// probably shouldn't happen with the previous node visibility check // probably shouldn't happen with the previous node visibility check
CurrentStage = Stage.CloseGcSupplyThenStop; CurrentStage = Stage.CloseGcSupplySelectStringThenStop;
addon->FireCallbackInt(-1); addon->FireCallbackInt(-1);
return; return;
} }
@ -161,7 +161,7 @@ partial class DeliverooPlugin
// Helms from being turned in. // Helms from being turned in.
if (GetCurrentSealCount() + items[0].SealsWithBonus > GetSealCap()) if (GetCurrentSealCount() + items[0].SealsWithBonus > GetSealCap())
{ {
CurrentStage = Stage.CloseGcSupply; CurrentStage = Stage.CloseGcSupplySelectString;
addon->FireCallbackInt(-1); addon->FireCallbackInt(-1);
return; return;
} }
@ -192,6 +192,7 @@ partial class DeliverooPlugin
.Build()); .Build());
addonSupplyReward->AtkUnitBase.FireCallbackInt(1); addonSupplyReward->AtkUnitBase.FireCallbackInt(1);
CurrentStage = Stage.CloseGcSupplyWindowThenStop;
return; return;
} }
@ -226,4 +227,22 @@ partial class DeliverooPlugin
return ItemFilterType.HideGearSetItems; 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(); FinalizeTurnInItem();
break; break;
case Stage.CloseGcSupply: case Stage.CloseGcSupplySelectString:
// see SelectStringPostSetup // see SelectStringPostSetup
break; break;
case Stage.CloseGcSupplyThenStop: case Stage.CloseGcSupplySelectStringThenStop:
// see SelectStringPostSetup // see SelectStringPostSetup
break; break;
case Stage.CloseGcSupplyWindowThenStop:
CloseGcSupplyWindow();
break;
case Stage.TargetQuartermaster: case Stage.TargetQuartermaster:
InteractWithQuartermaster(personnelOfficer!, quartermaster!); InteractWithQuartermaster(personnelOfficer!, quartermaster!);
break; break;

View File

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