From 3a7bdd6d0ff502d6e369437e42612d93de918bcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E6=B0=B4?= <1123993881@qq.com> Date: Tue, 25 Jul 2023 08:38:01 +0800 Subject: [PATCH] feat: removed the white list. --- Resources/AnimationLockTime.json | 3 +- Resources/HostileCastingArea.json | 5 +- Resources/InputConfig.json | 87 ------------------- Resources/whitelist.json | 8 -- RotationSolver/Commands/RSCommands_Actions.cs | 11 --- RotationSolver/Helpers/RotationHelper.cs | 71 +++------------ RotationSolver/Localization/Strings.cs | 6 +- RotationSolver/RotationSolverPlugin.cs | 14 --- RotationSolver/UI/ImGuiHelper.cs | 8 -- .../UI/RotationConfigWindow_Rotation.cs | 4 - .../Updaters/ActionSequencerUpdater.cs | 3 +- RotationSolver/Updaters/RotationUpdater.cs | 1 - 12 files changed, 20 insertions(+), 201 deletions(-) delete mode 100644 Resources/InputConfig.json delete mode 100644 Resources/whitelist.json diff --git a/Resources/AnimationLockTime.json b/Resources/AnimationLockTime.json index 057378ed2..4d20bffae 100644 --- a/Resources/AnimationLockTime.json +++ b/Resources/AnimationLockTime.json @@ -232,7 +232,7 @@ "7510": 0.1, "7511": 0.1, "7513": 0.6, - "7514": 0.6, + "7514": 0.1, "7517": 0.6, "7518": 0.6, "7519": 0.6, @@ -444,6 +444,7 @@ "23284": 0.1, "23317": 2.1, "23915": 0.1, + "23986": 2.1, "24222": 2.1, "24235": 2.1, "24283": 0.1, diff --git a/Resources/HostileCastingArea.json b/Resources/HostileCastingArea.json index be576c5ac..a0add4af3 100644 --- a/Resources/HostileCastingArea.json +++ b/Resources/HostileCastingArea.json @@ -291,5 +291,8 @@ 20428, 21004, 21000, - 20996 + 20996, + 8150, + 8167, + 6893 ] \ No newline at end of file diff --git a/Resources/InputConfig.json b/Resources/InputConfig.json deleted file mode 100644 index 91daefda7..000000000 --- a/Resources/InputConfig.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "KeyState": {}, - "KeySpecial": { - "EsunaStanceNorth": { - "Key": 191, - "Control": false, - "Alt": false, - "Shift": false - } - }, - "KeyDoAction": null, - "ButtonState": { - "Auto": { - "Button": 128, - "L2": false, - "R2": true - }, - "Manual": { - "Button": 16, - "L2": false, - "R2": true - }, - "Cancel": { - "Button": 32, - "L2": false, - "R2": true - } - }, - "ButtonSpecial": { - "EndSpecial": { - "Button": 64, - "L2": false, - "R2": true - }, - "EsunaStanceNorth": { - "Button": 8, - "L2": false, - "R2": true - }, - "MoveForward": { - "Button": 1, - "L2": false, - "R2": true - }, - "MoveBack": { - "Button": 2, - "L2": false, - "R2": true - }, - "RaiseShirk": { - "Button": 4, - "L2": false, - "R2": true - }, - "DefenseArea": { - "Button": 16, - "L2": true, - "R2": false - }, - "DefenseSingle": { - "Button": 128, - "L2": true, - "R2": false - }, - "HealArea": { - "Button": 32, - "L2": true, - "R2": false - }, - "HealSingle": { - "Button": 64, - "L2": true, - "R2": false - }, - "Burst": { - "Button": 2, - "L2": true, - "R2": false - }, - "AntiKnockback": { - "Button": 1, - "L2": true, - "R2": false - } - }, - "ButtonDoAction": null -} \ No newline at end of file diff --git a/Resources/whitelist.json b/Resources/whitelist.json deleted file mode 100644 index 2f2271ca1..000000000 --- a/Resources/whitelist.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "RotationSolver.Default - ArchiTed", - "DefaultRotations - ArchiTed", - "RiotsRotations - RiotNOR", - "BoltsRotations - Bolt", - "IcWaRotations - IncognitoWater", - "RotationSolver.Default" -] diff --git a/RotationSolver/Commands/RSCommands_Actions.cs b/RotationSolver/Commands/RSCommands_Actions.cs index 7938063a4..51ab8e407 100644 --- a/RotationSolver/Commands/RSCommands_Actions.cs +++ b/RotationSolver/Commands/RSCommands_Actions.cs @@ -41,17 +41,6 @@ internal static unsafe bool CanDoAnAction(bool isGCD) internal static uint _lastActionID; public static void DoAction() { - //High End bye. - if (DataCenter.InHighEndDuty && !RotationUpdater.RightNowRotation.IsAllowed(out var str)) - { - if ((_loop %= 5) == 0) - { - Svc.Toasts.ShowError(string.Format(LocalizationManager.RightLang.HighEndBan, str)); - } - _loop++; - return; - } - var wrong = new Random().NextDouble() < Service.Config.MistakeRatio && ActionUpdater.WrongAction != null; var nextAction = wrong ? ActionUpdater.WrongAction : ActionUpdater.NextAction; if (nextAction == null) return; diff --git a/RotationSolver/Helpers/RotationHelper.cs b/RotationSolver/Helpers/RotationHelper.cs index ea2d8ae36..5b2413dad 100644 --- a/RotationSolver/Helpers/RotationHelper.cs +++ b/RotationSolver/Helpers/RotationHelper.cs @@ -12,26 +12,6 @@ internal static class RotationHelper public static List LoadedCustomRotations { get; } = new List(); - public static string[] AllowedAssembly { get; private set; } = Array.Empty(); - - public static async Task LoadListAsync() - { - try - { - using var client = new HttpClient(); - var response = await client.GetAsync("https://raw.githubusercontent.com/ArchiDog1998/RotationSolver/main/Resources/whitelist.json"); - response.EnsureSuccessStatusCode(); - var content = await response.Content.ReadAsStringAsync(); - AllowedAssembly = JsonConvert.DeserializeObject(content); - } - catch (Exception ex) - { - var failed = LocalizationManager.RightLang.WhiteListDownloadingFailed; - failed.ShowWarning(1, RotationSolverPlugin.DownloadLinkPayload); - PluginLog.Log(ex, failed); - } - } - public static AssemblyInfo GetInfo(this Assembly assembly) { if (_assemblyInfos.TryGetValue(assembly, out var info)) @@ -54,40 +34,18 @@ public static AssemblyInfo GetInfo(this Assembly assembly) return assemblyInfo; } - public static bool IsAllowed(this ICustomRotation rotation, out string name) - { - name = "Unknown"; - if (rotation == null) return false; - - var assembly = GetTypeAssembly(rotation); - if (assembly == null) return false; - - name = assembly.GetName().Name; - return assembly.IsAllowed(); - } - - public static bool IsAllowed(this Assembly assembly) - { - if (_assemblyInfos.TryGetValue(assembly, out var info)) - { - var assemblyName = $"{info.Name} - {info.Author}"; - return AllowedAssembly.Contains(assemblyName); - } - return false; - } - - public static Assembly GetTypeAssembly(this ICustomRotation rotation) - { - try - { - return rotation.GetType().Assembly; - } - catch (Exception ex) - { - PluginLog.LogError($"Failed to get assembly for rotation {rotation.GetType().Name}: {ex}"); - return null; - } - } + //public static Assembly GetTypeAssembly(this ICustomRotation rotation) + //{ + // try + // { + // return rotation.GetType().Assembly; + // } + // catch (Exception ex) + // { + // PluginLog.LogError($"Failed to get assembly for rotation {rotation.GetType().Name}: {ex}"); + // return null; + // } + //} public static Vector4 GetColor(this ICustomRotation rotation) { @@ -96,11 +54,6 @@ public static Vector4 GetColor(this ICustomRotation rotation) return ImGuiColors.DPSRed; } - if (!rotation.IsAllowed(out _)) - { - return ImGuiColors.DalamudViolet; - } - if (rotation.IsBeta()) { return ImGuiColors.DalamudOrange; diff --git a/RotationSolver/Localization/Strings.cs b/RotationSolver/Localization/Strings.cs index 31dcb4ab0..a26045fb2 100644 --- a/RotationSolver/Localization/Strings.cs +++ b/RotationSolver/Localization/Strings.cs @@ -74,7 +74,6 @@ internal partial class Strings public string ConfigWindow_HelpItem_EndSpecial { get; set; } = "To end this special duration before the set time."; public string ConfigWindow_Helper_SwitchRotation { get; set; } = "Click to switch authors"; - public string ConfigWindow_Helper_HighEndWarning { get; set; } = "This <{0}> rotation is not allowed to be used in High-end Duty!"; public string ConfigWindow_Helper_GameVersion { get; set; } = "Game Version"; public string ConfigWindow_Helper_OpenSource { get; set; } = "Open the source code URL"; public string ConfigWindow_Helper_RunCommand { get; set; } = "Click to execute the command"; @@ -90,7 +89,7 @@ internal partial class Strings public string ConfigWindow_Events_ShareMacro { get; set; } = "Is Shared"; public string ConfigWindow_Events_RemoveEvent { get; set; } = "Delete Event"; public string ConfigWindow_Events_DutyStart { get; set; } = "Duty Start: "; - public string ConfigWindow_Events_DutyEnd{ get; set; } = "Duty End: "; + public string ConfigWindow_Events_DutyEnd { get; set; } = "Duty End: "; public string ConfigWindow_Params_Description { get; set; } = "In this window, you can set the parameters about the using way of actions."; public string ConfigWindow_Param_UseOverlayWindow { get; set; } = "Display Top Overlay"; @@ -615,10 +614,7 @@ internal partial class Strings }; public string HighEndWarning { get; set; } = "Please separately keybind damage reduction / shield cooldowns in case RS fails at a crucial moment in {0}!"; - public string HighEndBan { get; set; } = "{0} can not be used in High-end Duty!"; public string TextToTalkWarning { get; set; } = "You didn't install TextToTalk, please install it to make Rotation Solver say something for you!"; - public string WhiteListDownloadingFailed { get; set; } = "Failed to load white List. Click to retry."; - public string ClickingMistakeMessage { get; set; } = "OOOps! RS clicked the wrong action ({0})!"; } diff --git a/RotationSolver/RotationSolverPlugin.cs b/RotationSolver/RotationSolverPlugin.cs index 35c2f1928..98c5ed888 100644 --- a/RotationSolver/RotationSolverPlugin.cs +++ b/RotationSolver/RotationSolverPlugin.cs @@ -31,7 +31,6 @@ public sealed class RotationSolverPlugin : IDalamudPlugin, IDisposable public string Name => "Rotation Solver"; public static DalamudLinkPayload OpenLinkPayload { get; private set; } - public static DalamudLinkPayload DownloadLinkPayload { get; private set; } public RotationSolverPlugin(DalamudPluginInterface pluginInterface) { ECommonsMain.Init(pluginInterface, this, Module.DalamudReflector, Module.ObjectFunctions); @@ -76,22 +75,9 @@ public RotationSolverPlugin(DalamudPluginInterface pluginInterface) #endif ChangeUITranslation(); - OpenLinkPayload = pluginInterface.AddChatLinkHandler(0, (id, str) => - { - if (id == 0) OpenConfigWindow(); - }); - DownloadLinkPayload = pluginInterface.AddChatLinkHandler(1, (id, str) => - { - if (id == 1) Task.Run(async () => - { - await RotationHelper.LoadListAsync(); - }); - }); - Task.Run(async () => { await RotationUpdater.GetAllCustomRotationsAsync(DownloadOption.Download); - await RotationHelper.LoadListAsync(); }); } diff --git a/RotationSolver/UI/ImGuiHelper.cs b/RotationSolver/UI/ImGuiHelper.cs index 5809cd13b..b54884798 100644 --- a/RotationSolver/UI/ImGuiHelper.cs +++ b/RotationSolver/UI/ImGuiHelper.cs @@ -535,14 +535,6 @@ public unsafe static void Display(this ICustomRotation rotation, ICustomRotation HoveredString(string.Format(LocalizationManager.RightLang.ConfigWindow_Rotation_InvalidRotation, rotation.GetType().Assembly.GetInfo().Author)); } - else if (!rotation.IsAllowed(out _)) - { - var showStr = string.Format(LocalizationManager.RightLang.ConfigWindow_Helper_HighEndWarning, rotation) - + string.Join("", SocialUpdater.HighEndDuties.Select(SocialUpdater.GetDutyName) - .Where(s => !string.IsNullOrEmpty(s)).Select(t => "\n - " + t)); - - HoveredString(showStr); - } else if (rotation.IsBeta()) { HoveredString(LocalizationManager.RightLang.ConfigWindow_Rotation_BetaRotation); diff --git a/RotationSolver/UI/RotationConfigWindow_Rotation.cs b/RotationSolver/UI/RotationConfigWindow_Rotation.cs index 5e49bd629..260444894 100644 --- a/RotationSolver/UI/RotationConfigWindow_Rotation.cs +++ b/RotationSolver/UI/RotationConfigWindow_Rotation.cs @@ -294,8 +294,6 @@ private static void DrawInfos() ImGui.TableNextRow(); var assembly = grp.Key; - var isAllowed = assembly.IsAllowed(); - if (!isAllowed) ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudViolet); var info = assembly.GetInfo(); ImGui.TableNextColumn(); @@ -402,8 +400,6 @@ private static void DrawInfos() } } ImGui.PopStyleColor(3); - - if (!isAllowed) ImGui.PopStyleColor(); } ImGui.EndTable(); } diff --git a/RotationSolver/Updaters/ActionSequencerUpdater.cs b/RotationSolver/Updaters/ActionSequencerUpdater.cs index 00bd5975b..076ff50f3 100644 --- a/RotationSolver/Updaters/ActionSequencerUpdater.cs +++ b/RotationSolver/Updaters/ActionSequencerUpdater.cs @@ -1,5 +1,4 @@ -using FFXIVClientStructs.FFXIV.Client.Game.InstanceContent; -using RotationSolver.ActionSequencer; +using RotationSolver.ActionSequencer; using RotationSolver.UI; using System.Diagnostics; diff --git a/RotationSolver/Updaters/RotationUpdater.cs b/RotationSolver/Updaters/RotationUpdater.cs index a7e25fd7c..160a3d078 100644 --- a/RotationSolver/Updaters/RotationUpdater.cs +++ b/RotationSolver/Updaters/RotationUpdater.cs @@ -424,7 +424,6 @@ internal static ICustomRotation GetChosenRotation(CustomRotationGroup group) 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(r => r.IsAllowed(out _)); rotation ??= group.Rotations.FirstOrDefault(); if (!has && rotation != null)