From bb8167802f028027a3387c5e9f71c350a7279c43 Mon Sep 17 00:00:00 2001 From: Thomas Brooks <34015422+NostraThomas99@users.noreply.github.com> Date: Wed, 9 Oct 2024 12:22:06 -0500 Subject: [PATCH] Improvements to Feather to the Metal Always stop running when disabled Support queuing in languages other than English --- .../Features/ChocoboRacing/ChocoboRacing.UI.cs | 2 ++ .../Features/ChocoboRacing/ChocoboRacing.cs | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/RebornToolbox/Features/ChocoboRacing/ChocoboRacing.UI.cs b/RebornToolbox/Features/ChocoboRacing/ChocoboRacing.UI.cs index bbb5efe..c0fcdef 100644 --- a/RebornToolbox/Features/ChocoboRacing/ChocoboRacing.UI.cs +++ b/RebornToolbox/Features/ChocoboRacing/ChocoboRacing.UI.cs @@ -18,6 +18,8 @@ public override void Draw() if (ImGui.Checkbox("Enable", ref enabled)) { _chocoboRacing.IsRunning = enabled; + if (!enabled && _chocoboRacing.IsMoving) + _chocoboRacing.IsMoving = false; } var route = Plugin.Configuration.ChocoboRacingConfig.RaceRoute; if (ImGuiUtil.GenericEnumCombo("Race Route", 150, route, out var newRoute, r => r.ToFriendlyString())) diff --git a/RebornToolbox/Features/ChocoboRacing/ChocoboRacing.cs b/RebornToolbox/Features/ChocoboRacing/ChocoboRacing.cs index 57e56f5..78765ec 100644 --- a/RebornToolbox/Features/ChocoboRacing/ChocoboRacing.cs +++ b/RebornToolbox/Features/ChocoboRacing/ChocoboRacing.cs @@ -7,9 +7,11 @@ using ECommons.Reflection; using ECommons.Throttlers; using FFXIVClientStructs.FFXIV.Client.Game; +using FFXIVClientStructs.FFXIV.Client.Game.UI; using FFXIVClientStructs.FFXIV.Client.UI; using FFXIVClientStructs.FFXIV.Client.UI.Agent; using FFXIVClientStructs.FFXIV.Component.GUI; +using Lumina.Excel.GeneratedSheets; namespace RebornToolbox.Features.ChocoboRacing; @@ -17,8 +19,11 @@ public class ChocoboRacing { public bool IsRunning { get; set; } = false; + public IEnumerable ContentRoulettes; + public ChocoboRacing() { + ContentRoulettes = Svc.Data.GetExcelSheet(Svc.ClientState.ClientLanguage)!; Svc.Framework.Update += OnUpdate; } @@ -127,14 +132,21 @@ private unsafe void OnUpdate(IFramework framework) } var selectedDutyName = addon->AtkValues[18].GetValueAsString(); - if (selectedDutyName.Contains(Plugin.Configuration.ChocoboRacingConfig.RaceRoute.ToFriendlyString(), StringComparison.OrdinalIgnoreCase)) + if (selectedDutyName.Contains(GetSelectedDutyName(), StringComparison.InvariantCultureIgnoreCase)) { Callback.Fire((AtkUnitBase*)addon, true, 12, 0); } } } -// Credit: https://github.com/ffxivcode/AutoDuty/blob/26a61eefdba148bc5f46694f915f402315e9f128/AutoDuty/Helpers/QueueHelper.cs#L247 + private string GetSelectedDutyName() + { + var routeId = (byte)Plugin.Configuration.ChocoboRacingConfig.RaceRoute; + var row = ContentRoulettes.First(c => c.RowId == routeId); + return row.Name.ToString(); + } + + // Credit: https://github.com/ffxivcode/AutoDuty/blob/26a61eefdba148bc5f46694f915f402315e9f128/AutoDuty/Helpers/QueueHelper.cs#L247 private uint HeadersCount(uint before, List list) { uint count = 0;