Allow starting Deliveroo from SelectString window
This commit is contained in:
parent
45423c0cc3
commit
734b1e8c61
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<Version>4.8</Version>
|
||||
<Version>4.9</Version>
|
||||
<LangVersion>12</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
|
@ -9,31 +9,36 @@ namespace Deliveroo;
|
||||
partial class DeliverooPlugin
|
||||
{
|
||||
private unsafe void SelectStringPostSetup(AddonEvent type, AddonArgs args)
|
||||
{
|
||||
AddonSelectString* addonSelectString = (AddonSelectString*)args.Addon;
|
||||
SelectStringPostSetup(addonSelectString, CurrentStage);
|
||||
}
|
||||
|
||||
private unsafe bool SelectStringPostSetup(AddonSelectString* addonSelectString, Stage stage)
|
||||
{
|
||||
_pluginLog.Verbose("SelectString post-setup");
|
||||
|
||||
string desiredText;
|
||||
Action followUp;
|
||||
if (CurrentStage == Stage.OpenGcSupply)
|
||||
if (stage == Stage.OpenGcSupply)
|
||||
{
|
||||
desiredText = _gameStrings.UndertakeSupplyAndProvisioningMission;
|
||||
followUp = OpenGcSupplySelectStringFollowUp;
|
||||
}
|
||||
else if (CurrentStage == Stage.CloseGcSupplySelectString)
|
||||
else if (stage == Stage.CloseGcSupplySelectString)
|
||||
{
|
||||
desiredText = _gameStrings.ClosePersonnelOfficerTalk;
|
||||
followUp = CloseGcSupplySelectStringFollowUp;
|
||||
}
|
||||
else if (CurrentStage == Stage.CloseGcSupplySelectStringThenStop)
|
||||
else if (stage == Stage.CloseGcSupplySelectStringThenStop)
|
||||
{
|
||||
desiredText = _gameStrings.ClosePersonnelOfficerTalk;
|
||||
followUp = CloseGcSupplySelectStringThenStopFollowUp;
|
||||
}
|
||||
else
|
||||
return;
|
||||
return false;
|
||||
|
||||
_pluginLog.Verbose($"Looking for '{desiredText}' in prompt");
|
||||
AddonSelectString* addonSelectString = (AddonSelectString*)args.Addon;
|
||||
int entries = addonSelectString->PopupMenu.PopupMenu.EntryCount;
|
||||
|
||||
for (int i = 0; i < entries; ++i)
|
||||
@ -50,11 +55,12 @@ partial class DeliverooPlugin
|
||||
addonSelectString->AtkUnitBase.FireCallbackInt(i);
|
||||
|
||||
followUp();
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
_pluginLog.Verbose($"Text '{desiredText}' was not found in prompt.");
|
||||
return false;
|
||||
}
|
||||
|
||||
private void OpenGcSupplySelectStringFollowUp()
|
||||
|
@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Dalamud.Game.Addon.Lifecycle;
|
||||
using Dalamud.Game.ClientState.Conditions;
|
||||
using Dalamud.Game.ClientState.Objects;
|
||||
@ -281,6 +279,13 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
|
||||
if (_gameGui.TryGetAddonByName<AtkUnitBase>("GrandCompanyExchange", out var gcExchange) &&
|
||||
LAddon.IsAddonReady(gcExchange))
|
||||
CurrentStage = Stage.SelectRewardTier;
|
||||
|
||||
if (_gameGui.TryGetAddonByName<AddonSelectString>("SelectString", out var addonSelectString) &&
|
||||
LAddon.IsAddonReady(&addonSelectString->AtkUnitBase))
|
||||
{
|
||||
if (SelectStringPostSetup(addonSelectString, Stage.OpenGcSupply))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (CurrentStage != Stage.Stopped && CurrentStage != Stage.RequestStop && !_externalPluginHandler.Saved)
|
||||
|
Loading…
Reference in New Issue
Block a user