diff --git a/Resources/defaultList.json b/Resources/defaultList.json deleted file mode 100644 index 7b96eb22a..000000000 --- a/Resources/defaultList.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "RotationSolver.Default" -] \ No newline at end of file diff --git a/Resources/whitelist.json b/Resources/whitelist.json index 9b3e45964..aa2698d71 100644 --- a/Resources/whitelist.json +++ b/Resources/whitelist.json @@ -1,4 +1,4 @@ [ - "Some Dll", + "RotationSolver.Default", "Another Dll" ] \ No newline at end of file diff --git a/RotationSolver.sln b/RotationSolver.sln index 580eacced..ad6974605 100644 --- a/RotationSolver.sln +++ b/RotationSolver.sln @@ -6,7 +6,6 @@ MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8948C02A-914E-4A51-B1FE-2C608492EBF5}" ProjectSection(SolutionItems) = preProject .gitignore = .gitignore - Resources\defaultList.json = Resources\defaultList.json Directory.Build.props = Directory.Build.props Resources\downloadList.json = Resources\downloadList.json manifest.json = manifest.json diff --git a/RotationSolver/RotationHelper.cs b/RotationSolver/RotationHelper.cs index 5eace9ad1..6c1d616e8 100644 --- a/RotationSolver/RotationHelper.cs +++ b/RotationSolver/RotationHelper.cs @@ -8,10 +8,6 @@ namespace RotationSolver; internal static class RotationHelper { public static string[] AllowedAssembly { get; private set; } = new string[0]; - public static string[] DefaultAssembly { get; private set; } = new string[] - { - "RotationSolver.Default", - }; public static async void LoadList() { @@ -26,25 +22,8 @@ public static async void LoadList() { PluginLog.Log(ex, "Failed to load white List."); } - - try - { - var bts = await client.GetByteArrayAsync("https://raw.githubusercontent.com/ArchiDog1998/RotationSolver/main/Resources/defaultList.json"); - DefaultAssembly = JsonConvert.DeserializeObject(Encoding.Default.GetString(bts)); - } - catch (Exception ex) - { - PluginLog.Log(ex, "Failed to load default List."); - } } } - - public static bool IsDefault(this ICustomRotation rotation) - { - var type = rotation.GetType(); - if (!DefaultAssembly.Contains(type.Assembly.GetName().Name)) return false; - return type.Name.Contains("Default", StringComparison.OrdinalIgnoreCase); - } public static bool IsAllowed(this ICustomRotation rotation, out string name) { @@ -55,7 +34,7 @@ public static bool IsAllowed(this ICustomRotation rotation, out string name) } name = rotation.GetType().Assembly.GetName().Name; - return DefaultAssembly.Contains(name) || AllowedAssembly.Contains(name); + return AllowedAssembly.Contains(name); } public static Vector4 GetColor(this ICustomRotation rotation) diff --git a/RotationSolver/RotationSolverPlugin.cs b/RotationSolver/RotationSolverPlugin.cs index 98b3d8454..ae4c67cfe 100644 --- a/RotationSolver/RotationSolverPlugin.cs +++ b/RotationSolver/RotationSolverPlugin.cs @@ -135,8 +135,6 @@ internal static void UpdateDisplayWindow() && !Service.Conditions[ConditionFlag.WaitingForDuty] && !Service.Conditions[ConditionFlag.OccupiedInQuestEvent]); - isValid = true; - _controlWindow.IsOpen = isValid && Service.Config.ShowControlWindow; _nextActionWindow.IsOpen = isValid && Service.Config.ShowNextActionWindow; _cooldownWindow.IsOpen = isValid && Service.Config.ShowCooldownWindow; diff --git a/RotationSolver/Updaters/RotationUpdater.cs b/RotationSolver/Updaters/RotationUpdater.cs index a50995778..07b2e7519 100644 --- a/RotationSolver/Updaters/RotationUpdater.cs +++ b/RotationSolver/Updaters/RotationUpdater.cs @@ -195,12 +195,16 @@ public static void UpdateRotation() internal static ICustomRotation GetChooseRotation(CustomRotationGroup group) { - Service.Config.RotationChoices.TryGetValue((uint)group.jobId, out var name); + var has = 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(); + + if (!has && rotation != null) + { + Service.Config.RotationChoices[(uint)group.jobId] = rotation.GetType().FullName; + } return rotation; } } diff --git a/RotationSolver/Updaters/TimeLineUpdater.cs b/RotationSolver/Updaters/TimeLineUpdater.cs index a5c9f9a5a..00943526b 100644 --- a/RotationSolver/Updaters/TimeLineUpdater.cs +++ b/RotationSolver/Updaters/TimeLineUpdater.cs @@ -111,7 +111,7 @@ public static void DrawHeader() if (hasSet) { - if (ImGuiHelper.IconButton(Dalamud.Interface.FontAwesomeIcon.Ban, "##DeleteTimelineConditionSet")) + if (ImGuiHelper.IconButton(FontAwesomeIcon.Ban, "##DeleteTimelineConditionSet")) { Delete(set.Name); } @@ -119,13 +119,13 @@ public static void DrawHeader() ImGui.SameLine(); } - if (ImGuiHelper.IconButton(Dalamud.Interface.FontAwesomeIcon.Plus, "##AddNewTimelineConditionSet")) + if (ImGuiHelper.IconButton(FontAwesomeIcon.Plus, "##AddNewTimelineConditionSet")) { AddNew(); } ImGui.SameLine(); - if (ImGuiHelper.IconButton(Dalamud.Interface.FontAwesomeIcon.Folder, "##OpenDefinationFolder")) + if (ImGuiHelper.IconButton(FontAwesomeIcon.Folder, "##OpenDefinationFolder")) { Process.Start("explorer.exe", _timelineFolder); }