Skip to content

Commit

Permalink
Merge branch 'main' into fuck-you-manual-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
NostraThomas99 committed Apr 14, 2024
2 parents 9c70e19 + 63b2ec7 commit 62950d6
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
19 changes: 19 additions & 0 deletions RotationSolver.Basic/Attributes/ApiAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RotationSolver.Basic.Attributes
{
/// <summary>
/// Attribute to specify the version of the API that this rotation targets.
/// </summary>
public class ApiAttribute(int apiVersion) : Attribute
{
/// <summary>
/// The version of the API that this rotation targets.
/// </summary>
public int ApiVersion => apiVersion;
}
}
1 change: 1 addition & 0 deletions RotationSolver.Basic/Service.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace RotationSolver.Basic;
internal class Service : IDisposable
{
public const string COMMAND = "/rotation", USERNAME = "FFXIV-CombatReborn", REPO = "RotationSolverReborn";
public const int ApiVersion = 1;

// From https://GitHub.com/PunishXIV/Orbwalker/blame/master/Orbwalker/Memory.cs#L85-L87
[Signature("F3 0F 10 05 ?? ?? ?? ?? 0F 2E C6 0F 8A", ScanType = ScanType.StaticAddress, Fallibility = Fallibility.Infallible)]
Expand Down
9 changes: 8 additions & 1 deletion RotationSolver/UI/RotationConfigWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,14 @@ private void DrawHeader(float wholeWidth)
}

var rotation = DataCenter.RightNowRotation;
if (rotation == null) return;
if (rotation == null)
{
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudOrange);
ImGui.TextWrapped("No rotations loaded! Was there recently a big update?");
ImGui.PopStyleColor();
ImguiTooltips.HoveredTooltip("Please update your rotations!");
return;
}

var rotations = RotationUpdater.CustomRotations.FirstOrDefault(i => i.ClassJobIds.Contains((Job)(Player.Object?.ClassJob.Id ?? 0)))?.Rotations ?? [];

Expand Down
2 changes: 2 additions & 0 deletions RotationSolver/Updaters/RotationUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ private static CustomRotationGroup[] LoadCustomRotationGroup(List<Assembly> asse
{
if (type.GetInterfaces().Contains(typeof(ICustomRotation))
&& !type.IsAbstract && !type.IsInterface && type.GetConstructor([]) != null)
//&& type.GetCustomAttribute<ApiAttribute>()?.ApiVersion == Service.ApiVersion) //TODO: Check for API version
{
rotationList.Add(type);
}
Expand Down Expand Up @@ -539,6 +540,7 @@ private static void UpdateCustomRotation()
{
var rot = r.GetCustomAttribute<RotationAttribute>();
if (rot == null) return false;

var type = rot.Type;

return isPvP ? type.HasFlag(CombatType.PvP) : type.HasFlag(CombatType.PvE);
Expand Down

0 comments on commit 62950d6

Please sign in to comment.