Skip to content

Commit

Permalink
Improvements to Feather to the Metal
Browse files Browse the repository at this point in the history
Always stop running when disabled
Support queuing in languages other than English
  • Loading branch information
NostraThomas99 committed Oct 9, 2024
1 parent 7fa68f1 commit bb81678
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 2 additions & 0 deletions RebornToolbox/Features/ChocoboRacing/ChocoboRacing.UI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down
16 changes: 14 additions & 2 deletions RebornToolbox/Features/ChocoboRacing/ChocoboRacing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,23 @@
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;

public class ChocoboRacing
{
public bool IsRunning { get; set; } = false;

public IEnumerable<ContentRoulette> ContentRoulettes;

public ChocoboRacing()
{
ContentRoulettes = Svc.Data.GetExcelSheet<ContentRoulette>(Svc.ClientState.ClientLanguage)!;
Svc.Framework.Update += OnUpdate;
}

Expand Down Expand Up @@ -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<AtkComponentTreeListItem> list)
{
uint count = 0;
Expand Down

0 comments on commit bb81678

Please sign in to comment.