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