forked from liza/Deliveroo
Selectyesno predicates
This commit is contained in:
parent
37adccad11
commit
5d81b293b7
@ -92,7 +92,7 @@ partial class DeliverooPlugin
|
||||
|
||||
private void ConfirmReward()
|
||||
{
|
||||
if (SelectSelectYesno(0))
|
||||
if (SelectSelectYesno(0, s => s.StartsWith("Exchange ")))
|
||||
{
|
||||
CurrentStage = Stage.CloseGcExchange;
|
||||
_continueAt = DateTime.Now.AddSeconds(0.5);
|
||||
|
@ -118,16 +118,8 @@ partial class DeliverooPlugin
|
||||
|
||||
private unsafe void TurnInSelectedItem()
|
||||
{
|
||||
if (TryGetAddonByName<AddonSelectYesno>("SelectYesno", out var addonSelectYesno) &&
|
||||
IsAddonReady(&addonSelectYesno->AtkUnitBase))
|
||||
{
|
||||
if (MemoryHelper.ReadSeString(&addonSelectYesno->PromptText->NodeText).ToString()
|
||||
.StartsWith("Do you really want to trade a high-quality item?"))
|
||||
{
|
||||
addonSelectYesno->AtkUnitBase.FireCallbackInt(0);
|
||||
if (SelectSelectYesno(0, s => s == "Do you really want to trade a high-quality item?"))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (TryGetAddonByName<AddonGrandCompanySupplyReward>("GrandCompanySupplyReward",
|
||||
out var addonSupplyReward) && IsAddonReady(&addonSupplyReward->AtkUnitBase))
|
||||
|
@ -442,10 +442,11 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
|
||||
return false;
|
||||
}
|
||||
|
||||
private unsafe bool SelectSelectYesno(int choice)
|
||||
private unsafe bool SelectSelectYesno(int choice, Predicate<string> predicate)
|
||||
{
|
||||
if (TryGetAddonByName<AddonSelectYesno>("SelectYesno", out var addonSelectYesno) &&
|
||||
IsAddonReady(&addonSelectYesno->AtkUnitBase))
|
||||
IsAddonReady(&addonSelectYesno->AtkUnitBase) &&
|
||||
predicate(MemoryHelper.ReadSeString(&addonSelectYesno->PromptText->NodeText).ToString()))
|
||||
{
|
||||
PluginLog.Information(
|
||||
$"Selecting choice={choice} for '{MemoryHelper.ReadSeString(&addonSelectYesno->PromptText->NodeText)}'");
|
||||
|
Loading…
Reference in New Issue
Block a user