Skip to content

Commit

Permalink
Feather to the Metal Improvements
Browse files Browse the repository at this point in the history
Added config option for movement key
Added "No Rewards" duties to selector dropdown
  • Loading branch information
NostraThomas99 committed Oct 13, 2024
1 parent e5cce4f commit 9535f2a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 8 deletions.
12 changes: 11 additions & 1 deletion RebornToolbox/Common/MainWindow.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using Dalamud.Interface.Windowing;
using Dalamud.Game.ClientState.Keys;
using Dalamud.Interface.Windowing;
using ECommons.ImGuiMethods;
using ImGuiNET;
using OtterGui;

namespace RebornToolbox.Common;

Expand Down Expand Up @@ -99,6 +101,14 @@ public override void Draw()
Plugin.Configuration.SaveConfig();
}

var moveForwardKey = Plugin.Configuration.ChocoboRacingConfig.MoveForwardKey;
if (ImGuiUtil.GenericEnumCombo("Forward Movement Key", 150, moveForwardKey, out VirtualKey forwardKey,
k => k.ToString()))
{
Plugin.Configuration.ChocoboRacingConfig.MoveForwardKey = forwardKey;
Plugin.Configuration.SaveConfig();
}

var stopAtMaxRank = Plugin.Configuration.ChocoboRacingConfig.StopAtMaxRank;
if (ImGui.Checkbox("Stop at Rank 40", ref stopAtMaxRank))
{
Expand Down
19 changes: 17 additions & 2 deletions RebornToolbox/Features/ChocoboRacing/ChocoboRacing.Config.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace RebornToolbox.Features.ChocoboRacing;
using Dalamud.Game.ClientState.Keys;

namespace RebornToolbox.Features.ChocoboRacing;

public class ChocoboRacing_Config
{
Expand All @@ -7,14 +9,19 @@ public class ChocoboRacing_Config
public bool AutoRun { get; set; } = true;
public bool StopAtMaxRank { get; set; } = false;
public RaceRoute RaceRoute { get; set; } = RaceRoute.Random;
public VirtualKey MoveForwardKey { get; set; } = VirtualKey.W;
}

public enum RaceRoute : byte
{
Random = 21,
Sagolii = 18,
Costa = 19,
Tranquil = 20
Tranquil = 20,
Random_No_Rewards = 25,
Tranquil_No_Rewards = 24,
Costa_No_Rewards = 23,
Sagolii_No_Rewards = 22,
}

public static class RaceRouteExtensions
Expand All @@ -31,6 +38,14 @@ public static string ToFriendlyString(this RaceRoute raceRoute)
return "Costa del Sol";
case RaceRoute.Tranquil:
return "Tranquil Paths";
case RaceRoute.Random_No_Rewards:
return "Random (No Rewards)";
case RaceRoute.Tranquil_No_Rewards:
return "Tranquil Paths (No Rewards)";
case RaceRoute.Sagolii_No_Rewards:
return "Sagolii Road (No Rewards)";
case RaceRoute.Costa_No_Rewards:
return "Costa del Sol (No Rewards)";
default:
return "Unknown";
}
Expand Down
2 changes: 1 addition & 1 deletion RebornToolbox/Features/ChocoboRacing/ChocoboRacing.UI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public override void Draw()
_chocoboRacing.IsMoving = false;
}
var route = Plugin.Configuration.ChocoboRacingConfig.RaceRoute;
if (ImGuiUtil.GenericEnumCombo("Race Route", 150, route, out var newRoute, r => r.ToFriendlyString()))
if (ImGuiUtil.GenericEnumCombo("Race Route", 200, route, out var newRoute, r => r.ToFriendlyString()))
{
Plugin.Configuration.ChocoboRacingConfig.RaceRoute = newRoute;
Plugin.Configuration.SaveConfig();
Expand Down
8 changes: 4 additions & 4 deletions RebornToolbox/Features/ChocoboRacing/ChocoboRacing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ private unsafe bool ContentsFinderConfirm()

public bool IsMoving
{
get { return Svc.KeyState[VirtualKey.W]; }
get { return Svc.KeyState[Plugin.Configuration.ChocoboRacingConfig.MoveForwardKey]; }
set
{
if (Svc.KeyState[VirtualKey.W] != value)
if (Svc.KeyState[Plugin.Configuration.ChocoboRacingConfig.MoveForwardKey] != value)
{
if (value) DalamudReflector.SetKeyState(VirtualKey.W, 1);
else DalamudReflector.SetKeyState(VirtualKey.W, 0);
if (value) DalamudReflector.SetKeyState(Plugin.Configuration.ChocoboRacingConfig.MoveForwardKey, 1);
else DalamudReflector.SetKeyState(Plugin.Configuration.ChocoboRacingConfig.MoveForwardKey, 0);
}
}
}
Expand Down

0 comments on commit 9535f2a

Please sign in to comment.