Skip to content

Commit

Permalink
[Always Yes] Add Blunderville exit dialog (#659)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aireil authored Nov 5, 2023
1 parent 436fcb3 commit bf45ca6
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion Tweaks/UiAdjustment/AlwaysYes.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using Dalamud.Game.Addon.Lifecycle.AddonArgTypes;
using Dalamud.Interface;
Expand Down Expand Up @@ -30,6 +30,7 @@ public class Configs : TweakConfig {
public bool Desynthesis = true;
public bool Lobby = true;
public bool ItemExchangeConfirmations = true;
public bool BlundervilleExitDialog = true;
public List<string> ExceptionsYesNo = new();
}

Expand Down Expand Up @@ -93,6 +94,7 @@ public class Configs : TweakConfig {
hasChanged |= ImGui.Checkbox("Desynthesis", ref Config.Desynthesis);
hasChanged |= ImGui.Checkbox("Character selection dialogs", ref Config.Lobby);
hasChanged |= ImGui.Checkbox("Item exchange confirmations", ref Config.ItemExchangeConfirmations);
hasChanged |= ImGui.Checkbox("Blunderville exit dialog", ref Config.BlundervilleExitDialog);

ImGui.Unindent();

Expand Down Expand Up @@ -158,6 +160,9 @@ private void OnAddonSetup(AddonSetupArgs args) {
case "ShopExchangeItemDialog":
if (Config.ItemExchangeConfirmations) SetFocusYes(args.Addon, 18);
return;
case "FGSExitDialog":
if (Config.BlundervilleExitDialog) SetSpecialFocus(args.Addon, 10, 6);
return;
}
}
private void SetFocusYes(nint unitBaseAddress, uint yesButtonId, uint? yesHoldButtonId = null, uint? checkBoxId = null) {
Expand Down Expand Up @@ -192,6 +197,21 @@ private void SetFocusYes(nint unitBaseAddress, uint yesButtonId, uint? yesHoldBu
unitBase->SetFocusNode(yesCollision);
unitBase->CursorTarget = yesCollision;
}

private static void SetSpecialFocus(nint unitBaseAddress, uint buttonId, uint collisionId)
{
var unitBase = (AtkUnitBase*)unitBaseAddress;
if (unitBase == null) return;

var button = unitBase->UldManager.SearchNodeById(buttonId);
if (button == null) return;

var collision = ((AtkComponentNode *)button)->Component->UldManager.SearchNodeById(collisionId);
if (collision == null) return;

unitBase->SetFocusNode(collision);
unitBase->CursorTarget = collision;
}

private bool IsYesnoAnException(nint unitBaseAddress) {
var unitBase = (AtkUnitBase*)unitBaseAddress;
Expand Down

0 comments on commit bf45ca6

Please sign in to comment.