Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: changed saving rotation name from property to type full name.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 3, 2023
1 parent 0c89267 commit 42aa439
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,8 @@ public unsafe virtual bool CanUse(out IAction act, CanUseOption option = CanUseO
}
}

if(CastTime > 0)
{
if (DataCenter.IsMoving &&
!player.HasStatus(true, CustomRotation.Swiftcast.StatusProvide)) return false;
}
if (CastTime > 0 && DataCenter.IsMoving &&
!player.HasStatus(true, CustomRotation.Swiftcast.StatusProvide)) return false;

if (IsGeneralGCD && IsEot && IsFriendly && IActionHelper.IsLastGCD(true, this)
&& DataCenter.TimeSinceLastAction.TotalSeconds < 3) return false;
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/UI/ImGuiHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ public unsafe static void Display(this ICustomRotation rotation, ICustomRotation
ImGui.PushStyleColor(ImGuiCol.Text, r.GetColor());
if (ImGui.Selectable(r.RotationName))
{
Service.Config.RotationChoices[rotation.Job.RowId] = r.RotationName;
Service.Config.RotationChoices[rotation.Job.RowId] = r.GetType().FullName;
Service.Config.Save();
}
if (ImGui.IsItemHovered())
Expand Down
3 changes: 1 addition & 2 deletions RotationSolver/UI/RotationConfigWindow_Rotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ private static void DrawRotations(RotationUpdater.CustomRotationGroup[] rotation
if (i > 0) ImGui.Separator();

var group = rotations[i];
Service.Config.RotationChoices.TryGetValue((uint)group.jobId, out var rotationName);
var rotation = RotationUpdater.GetChooseRotation(group, rotationName);
var rotation = RotationUpdater.GetChooseRotation(group);

var canAddButton = Service.Player != null
&& rotation.JobIDs.Contains((ClassJobID)Service.Player.ClassJob.Id);
Expand Down
9 changes: 5 additions & 4 deletions RotationSolver/Updaters/RotationUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,23 +133,24 @@ public static IEnumerable<IGrouping<string, IAction>> AllGroupedActions
public static void UpdateRotation()
{
var nowJob = (ClassJobID)Service.Player.ClassJob.Id;
Service.Config.RotationChoices.TryGetValue((uint)nowJob, out var newName);

foreach (var group in _customRotations)
{
if (!group.classJobIds.Contains(nowJob)) continue;

RightNowRotation = GetChooseRotation(group, newName);
RightNowRotation = GetChooseRotation(group);
RightRotationBaseActions = RightNowRotation.AllBaseActions;
return;
}
RightNowRotation = null;
RightRotationBaseActions = new IBaseAction[0];
}

internal static ICustomRotation GetChooseRotation(CustomRotationGroup group, string name)
internal static ICustomRotation GetChooseRotation(CustomRotationGroup group)
{
var rotation = group.rotations.FirstOrDefault(r => r.RotationName == name);
Service.Config.RotationChoices.TryGetValue((uint)group.jobId, out var name);

var rotation = group.rotations.FirstOrDefault(r => r.GetType().FullName == name);
rotation ??= group.rotations.FirstOrDefault(RotationHelper.IsDefault);
rotation ??= group.rotations.FirstOrDefault(r => r.IsAllowed(out _));
rotation ??= group.rotations.FirstOrDefault();
Expand Down

0 comments on commit 42aa439

Please sign in to comment.