Skip to content

Commit 55e0d99

Browse files
authored
Merge pull request #941 from FFXIV-CombatReborn/Rotationcleanup
Cleaned up a lot of UI code with consideration for 3rd party rotations
2 parents 60e0981 + 7a3498e commit 55e0d99

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+131
-725
lines changed

RotationSolver.Basic/Attributes/ApiAttribute.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
namespace RotationSolver.Basic.Attributes;
22

33
/// <summary>
4-
/// To tag the rotations that are in beta version.
4+
/// Tag for rotations that are 3rd party (Extra).
55
/// </summary>
66
[AttributeUsage(AttributeTargets.Class)]
7-
public class BetaRotationAttribute : Attribute
7+
public class ExtraRotationAttribute : Attribute
88
{
99
}

RotationSolver.Basic/Attributes/LinkDescriptionAttribute.cs

Lines changed: 0 additions & 45 deletions
This file was deleted.

RotationSolver.Basic/Service.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ internal class Service : IDisposable
2222
public const string ALTCOMMAND = "/rsr";
2323
public const string USERNAME = "FFXIV-CombatReborn";
2424
public const string REPO = "RotationSolverReborn";
25-
public const int ApiVersion = 6;
2625

2726
[EzHook("40 53 55 56 57 48 81 EC ?? ?? ?? ?? 0F 29 B4 24 ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 48 33 C4 48 89 84 24 ?? ?? ?? ?? 0F B6 AC 24 ?? ?? ?? ?? 0F 28 F3 49 8B F8", nameof(ActorVfxCreateDetour), true)]
2827
private readonly EzHook<ActorVfxCreateDelegate2> actorVfxCreateHook = null!;

RotationSolver/Data/UiString.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ internal enum UiString
4646
[Description("Invalid Rotation! \nPlease update to the latest version or contact {0}!")]
4747
ConfigWindow_Rotation_InvalidRotation,
4848

49-
[Description("Beta Rotation!")]
50-
ConfigWindow_Rotation_BetaRotation,
51-
5249
[Description("Click to switch rotations")]
5350
ConfigWindow_Helper_SwitchRotation,
5451

@@ -115,9 +112,6 @@ internal enum UiString
115112
[Description("Duty Configuration")]
116113
ConfigWindow_DutyRotation_Configuration,
117114

118-
[Description("Information")]
119-
ConfigWindow_Rotation_Information,
120-
121115
[Description("Status")]
122116
ConfigWindow_Rotation_Status,
123117

RotationSolver/Helpers/RotationHelper.cs

Lines changed: 13 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,11 @@ namespace RotationSolver.Helpers;
66

77
internal static class RotationHelper
88
{
9-
private static readonly Dictionary<Assembly, AssemblyInfo> _assemblyInfos = [];
10-
private static readonly Dictionary<ICustomRotation, bool> _betaInfo = [];
9+
private static readonly Dictionary<ICustomRotation, bool> _extraRotation = [];
1110
private static readonly Dictionary<ICustomRotation, RotationAttribute> _rotationAttributes = [];
1211

1312
public static List<LoadedAssembly> LoadedCustomRotations { get; } = [];
1413

15-
public static AssemblyInfo GetInfo(this Assembly assembly)
16-
{
17-
if (_assemblyInfos.TryGetValue(assembly, out AssemblyInfo? info))
18-
{
19-
return info;
20-
}
21-
22-
string? name = assembly.GetName().Name;
23-
string location = assembly.Location;
24-
string? company = assembly.GetCustomAttribute<AssemblyCompanyAttribute>()?.Company;
25-
AssemblyInfo assemblyInfo = new(name, company, location, string.Empty, company, name, DateTime.Now);
26-
27-
_assemblyInfos[assembly] = assemblyInfo;
28-
29-
return assemblyInfo;
30-
}
31-
3214
public static unsafe Vector4 GetColor(this ICustomRotation rotation)
3315
{
3416
if (!rotation.IsEnabled)
@@ -41,19 +23,24 @@ public static unsafe Vector4 GetColor(this ICustomRotation rotation)
4123
return ImGuiColors.DPSRed;
4224
}
4325

44-
return rotation.IsBeta() ? ImGuiColors.DalamudOrange : ImGuiColors.DalamudWhite;
26+
if (rotation.IsExtra())
27+
{
28+
return ImGuiColors.DalamudViolet;
29+
}
30+
31+
return ImGuiColors.DalamudWhite;
4532
}
4633

47-
public static bool IsBeta(this ICustomRotation rotation)
34+
public static bool IsExtra(this ICustomRotation rotation)
4835
{
49-
if (_betaInfo.TryGetValue(rotation, out bool isBeta))
36+
if (_extraRotation.TryGetValue(rotation, out bool isExtra))
5037
{
51-
return isBeta;
38+
return isExtra;
5239
}
5340

54-
BetaRotationAttribute? betaAttribute = rotation.GetType().GetCustomAttribute<BetaRotationAttribute>();
55-
_betaInfo[rotation] = betaAttribute != null;
56-
return _betaInfo[rotation];
41+
ExtraRotationAttribute? extraRotationAttribute = rotation.GetType().GetCustomAttribute<ExtraRotationAttribute>();
42+
_extraRotation[rotation] = extraRotationAttribute != null;
43+
return _extraRotation[rotation];
5744
}
5845

5946
public static RotationAttribute? GetAttributes(this ICustomRotation rotation)
@@ -71,55 +58,6 @@ public static bool IsBeta(this ICustomRotation rotation)
7158
return attributes;
7259
}
7360

74-
public static Assembly LoadCustomRotationAssembly(string filePath)
75-
{
76-
DirectoryInfo? directoryInfo = new FileInfo(filePath).Directory;
77-
RotationLoadContext loadContext = new(directoryInfo);
78-
Assembly assembly = loadContext.LoadFromFile(filePath);
79-
80-
string? assemblyName = assembly.GetName().Name;
81-
string author = GetAuthor(filePath, assemblyName);
82-
83-
AssemblyLinkAttribute? link = assembly.GetCustomAttribute<AssemblyLinkAttribute>();
84-
AssemblyInfo assemblyInfo = new(
85-
assemblyName,
86-
author,
87-
filePath,
88-
link?.Donate,
89-
link?.UserName,
90-
link?.Repository,
91-
DateTime.Now);
92-
93-
Assembly? existingAssembly = GetAssemblyFromPath(filePath);
94-
if (existingAssembly != null)
95-
{
96-
_ = _assemblyInfos.Remove(existingAssembly);
97-
}
98-
99-
_assemblyInfos[assembly] = assemblyInfo;
100-
101-
LoadedAssembly loadedAssembly = new(
102-
filePath,
103-
File.GetLastWriteTimeUtc(filePath).ToString());
104-
105-
_ = LoadedCustomRotations.RemoveAll(item => item.FilePath == loadedAssembly.FilePath);
106-
LoadedCustomRotations.Add(loadedAssembly);
107-
108-
return assembly;
109-
}
110-
111-
private static Assembly? GetAssemblyFromPath(string filePath)
112-
{
113-
foreach (KeyValuePair<Assembly, AssemblyInfo> asm in _assemblyInfos)
114-
{
115-
if (asm.Value.FilePath == filePath)
116-
{
117-
return asm.Key;
118-
}
119-
}
120-
return null;
121-
}
122-
12361
private static string GetAuthor(string filePath, string? assemblyName)
12462
{
12563
FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(filePath);

RotationSolver/Helpers/RotationLoadContext.cs

Lines changed: 0 additions & 78 deletions
This file was deleted.

RotationSolver/RebornRotations/Healer/AST_Reborn.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace RotationSolver.RebornRotations.Healer;
44

55
[Rotation("Reborn", CombatType.PvE, GameVersion = "7.3")]
66
[SourceCode(Path = "main/RebornRotations/Healer/AST_Reborn.cs")]
7-
[Api(6)]
7+
88
public sealed class AST_Reborn : AstrologianRotation
99
{
1010
#region Config Options

RotationSolver/RebornRotations/Healer/SCH_Reborn.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace RotationSolver.RebornRotations.Healer;
44

55
[Rotation("Reborn", CombatType.PvE, GameVersion = "7.3")]
66
[SourceCode(Path = "main/RebornRotations/Healer/SCH_Reborn.cs")]
7-
[Api(6)]
7+
88
public sealed class SCH_Reborn : ScholarRotation
99
{
1010
#region Config Options

RotationSolver/RebornRotations/Healer/SGE_Reborn.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ namespace RotationSolver.RebornRotations.Healer;
22

33
[Rotation("Reborn", CombatType.PvE, GameVersion = "7.3")]
44
[SourceCode(Path = "main/RebornRotations/Healer/SGE_Reborn.cs")]
5-
[Api(6)]
5+
66
public sealed class SGE_Reborn : SageRotation
77
{
88
#region Config Options

0 commit comments

Comments
 (0)