From 19ff819670e68e96ccce2d6d90f13563dc8be9b0 Mon Sep 17 00:00:00 2001 From: LTS-FFXIV <127939494+LTS-FFXIV@users.noreply.github.com> Date: Mon, 6 Jan 2025 14:55:57 -0600 Subject: [PATCH] Refactor and update various game logic and configurations - Modified `PLD_Beta.cs` to add level checks for `BladeOfValorPvE`, `BladeOfTruthPvE`, and `BladeOfFaithPvE`, and changed the status check for `ConfiteorPvE` from `Requiescat` to `ConfiteorReady`. - Updated the submodule `ECommons` to a new commit. - Added a new property `HasShownMainMenuMessage` to the `Configs` class in `Configs.cs`. - Added new actions `SharpenedKnife`, `ChocoMeteor`, and `PomCure` to the `BlueMageRotation` class in `BlueMageRotation.cs`. - Added partial methods to modify the settings for `SharpenedKnifePvE`, `ChocoMeteorPvE`, and `PomCurePvE` in `BlueMageRotation.cs`. - In `RotationConfigWindow.cs`, added logic to show a main menu message if it hasn't been shown before and updated the logic for checking incompatible plugins to use a `foreach` loop instead of `Any()`. - Added a private field `_showText` to `RotationConfigWindow.cs` and updated the `DrawHeader` method to conditionally render text based on this field. - Refactored the logic for finding custom rotations and actions in `RotationConfigWindow.cs` to use `foreach` loops instead of LINQ methods. - Updated the logic for displaying statuses in `RotationConfigWindow.cs` to use a `foreach` loop instead of LINQ methods. --- .gitignore | 1 + BasicRotations/Tank/PLD_Beta.cs | 8 +- ECommons | 2 +- RotationSolver.Basic/Configuration/Configs.cs | 1 + .../Rotations/Basic/BlueMageRotation.cs | 33 ++++++++ RotationSolver/UI/RotationConfigWindow.cs | 76 +++++++++++++++---- 6 files changed, 101 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index 6e162095f..34f52b3a1 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ lib/ .idea/ RotationSolver/Localization/Localization.json /Resources/AutoStatusOrder.json +/RotationSolver.GameData/RotationSolver.GameData.csproj.user diff --git a/BasicRotations/Tank/PLD_Beta.cs b/BasicRotations/Tank/PLD_Beta.cs index cc1b656a4..87f598d48 100644 --- a/BasicRotations/Tank/PLD_Beta.cs +++ b/BasicRotations/Tank/PLD_Beta.cs @@ -213,10 +213,10 @@ protected override bool GeneralGCD(out IAction? act) if (PassageProtec && Player.HasStatus(true, StatusID.PassageOfArms)) return false; // Confiteor Combo - if (BladeOfValorPvE.CanUse(out act)) return true; - if (BladeOfTruthPvE.CanUse(out act)) return true; - if (BladeOfFaithPvE.CanUse(out act)) return true; - if (Player.HasStatus(true, StatusID.Requiescat) && ConfiteorPvE.CanUse(out act, usedUp: true, skipAoeCheck: true)) return true; + if (BladeOfValorPvE.EnoughLevel && BladeOfValorPvE.CanUse(out act)) return true; + if (BladeOfTruthPvE.EnoughLevel && BladeOfTruthPvE.CanUse(out act)) return true; + if (BladeOfFaithPvE.EnoughLevel && BladeOfFaithPvE.CanUse(out act)) return true; + if (Player.HasStatus(true, StatusID.ConfiteorReady) && ConfiteorPvE.CanUse(out act, usedUp: true, skipAoeCheck: true)) return true; if (GoringBladePvE.CanUse(out act)) return true; diff --git a/ECommons b/ECommons index 8ca6e80b3..1889f24e8 160000 --- a/ECommons +++ b/ECommons @@ -1 +1 @@ -Subproject commit 8ca6e80b386effa4380b9268dffacddc89b10c89 +Subproject commit 1889f24e84d8981aa06272f1a25a176ceaab7288 diff --git a/RotationSolver.Basic/Configuration/Configs.cs b/RotationSolver.Basic/Configuration/Configs.cs index 621b69b22..f7eb14c18 100644 --- a/RotationSolver.Basic/Configuration/Configs.cs +++ b/RotationSolver.Basic/Configuration/Configs.cs @@ -28,6 +28,7 @@ public const string public const int CurrentVersion = 12; public int Version { get; set; } = CurrentVersion; + public bool HasShownMainMenuMessage { get; set; } = false; public string LastSeenChangelog { get; set; } = "0.0.0.0"; public bool FirstTimeSetupDone { get; set; } = false; diff --git a/RotationSolver.Basic/Rotations/Basic/BlueMageRotation.cs b/RotationSolver.Basic/Rotations/Basic/BlueMageRotation.cs index cb38c13b3..3429f19a8 100644 --- a/RotationSolver.Basic/Rotations/Basic/BlueMageRotation.cs +++ b/RotationSolver.Basic/Rotations/Basic/BlueMageRotation.cs @@ -24,6 +24,11 @@ public enum BluDPSSpell : byte /// GoblinPunch, + /// + /// + /// + SharpenedKnife, + } /// @@ -70,6 +75,11 @@ public enum BluAOESpell : byte /// /// ThousandNeedles, + + /// + /// + /// + ChocoMeteor, } /// @@ -86,6 +96,11 @@ public enum BluHealSpell : byte /// /// AngelsSnack, + + /// + /// + /// + PomCure, } /// @@ -159,6 +174,24 @@ public enum BLUID : byte [RotationConfig(CombatType.PvE, Name = "Aetheric Mimicry Role")] public static BLUID BlueId { get; set; } = BLUID.DPS; + static partial void ModifySharpenedKnifePvE(ref ActionSetting setting) + { + + } + + static partial void ModifyChocoMeteorPvE(ref ActionSetting setting) + { + setting.CreateConfig = () => new ActionConfig() + { + AoeCount = 3, + }; + } + + static partial void ModifyPomCurePvE(ref ActionSetting setting) + { + setting.IsFriendly = true; + } + static partial void ModifySongOfTormentPvE(ref ActionSetting setting) { setting.TargetStatusProvide = [StatusID.Bleeding_1714]; diff --git a/RotationSolver/UI/RotationConfigWindow.cs b/RotationSolver/UI/RotationConfigWindow.cs index 1e68d21c1..9fc803460 100644 --- a/RotationSolver/UI/RotationConfigWindow.cs +++ b/RotationSolver/UI/RotationConfigWindow.cs @@ -50,6 +50,8 @@ public RotationConfigWindow() MaximumSize = new Vector2(5000, 5000), }; RespectCloseHotkey = true; + + _showText = !Service.Config.HasShownMainMenuMessage; // Show the message if it hasn't been shown before } public override void OnClose() @@ -145,8 +147,15 @@ private void DrawErrorZone() { var incompatiblePlugins = DownloadHelper.IncompatiblePlugins ?? Array.Empty(); - bool hasIncompatiblePlugin = incompatiblePlugins.Any(item => - (item.Name == "XIV Combo" || item.Name == "XIV Combo Expanded" || item.Name == "XIVSlothCombo" || item.Name == "Wrath Combo") && item.IsInstalled); + bool hasIncompatiblePlugin = false; + foreach (var item in incompatiblePlugins) + { + if ((item.Name == "XIV Combo" || item.Name == "XIV Combo Expanded" || item.Name == "XIVSlothCombo" || item.Name == "Wrath Combo") && item.IsInstalled) + { + hasIncompatiblePlugin = true; + break; + } + } if (hasIncompatiblePlugin) { @@ -157,22 +166,22 @@ private void DrawErrorZone() { if (plugin.Name == "XIV Combo") { - message = "Disable XIV Combo plugin"; + message = "Disable XIV Combo plugin, causes targetting issues"; break; } else if (plugin.Name == "XIV Combo Expanded") { - message = "Disable XIV Combo Expanded plugin"; + message = "Disable XIV Combo Expanded plugin, causes targetting issues"; break; } else if (plugin.Name == "XIVSlothCombo") { - message = "Disable XIVSlothCombo plugin"; + message = "Disable XIVSlothCombo plugin, causes targetting issues"; break; } else if (plugin.Name == "Wrath Combo") { - message = "Disable Wrath Combo plugin"; + message = "Disable Wrath Combo plugin, causes targetting issues"; break; } } @@ -308,7 +317,15 @@ private void DrawSideBar() if (item.GetAttribute() != null) continue; // Check if the "AutoDuty" plugin is installed - bool isAutoDutyInstalled = incompatiblePlugins.Any(plugin => plugin.IsInstalled && plugin.Name == "AutoDuty"); + bool isAutoDutyInstalled = false; + foreach (var plugin in incompatiblePlugins) + { + if (plugin.IsInstalled && plugin.Name == "AutoDuty") + { + isAutoDutyInstalled = true; + break; + } + } // Skip the "AutoDuty" tab if the plugin is not installed if (item == RotationConfigWindowTab.AutoDuty && !isAutoDutyInstalled) continue; @@ -355,12 +372,20 @@ private void DrawSideBar() } } + private bool _showText; + private void DrawHeader(float wholeWidth) { var size = MathF.Max(MathF.Min(wholeWidth, Scale * 128), Scale * MIN_COLUMN_WIDTH); if (IconSet.GetTexture((uint)0, out var overlay)) { + if (_showText) // Conditionally render the text + { + ImGui.TextWrapped("Click RSR icon for main menu"); + ImGui.Spacing(); + } + ImGuiHelper.DrawItemMiddle(() => { var cursor = ImGui.GetCursorPos(); @@ -370,6 +395,11 @@ private void DrawHeader(float wholeWidth) { _activeTab = RotationConfigWindowTab.About; _searchResults = []; + _showText = false; // Update the flag when the icon is clicked + + // Save the configuration to indicate that the message has been shown + Service.Config.HasShownMainMenuMessage = true; + Service.Config.Save(); } ImguiTooltips.HoveredTooltip(UiString.ConfigWindow_About_Punchline.GetDescription()); @@ -422,7 +452,15 @@ private void DrawHeader(float wholeWidth) return; } - var rotations = RotationUpdater.CustomRotations.FirstOrDefault(i => i.ClassJobIds.Contains((Job)(Player.Object?.ClassJob.RowId ?? 0)))?.Rotations ?? []; + Type[] rotations = Array.Empty(); + foreach (var customRotation in RotationUpdater.CustomRotations) + { + if (customRotation.ClassJobIds.Contains((Job)(Player.Object?.ClassJob.RowId ?? 0))) + { + rotations = customRotation.Rotations; + break; + } + } if (rotation != null) { @@ -1250,9 +1288,16 @@ private static void DrawRotationDescription() var attr = RotationDescAttribute.MergeToOne(a); if (attr == null) continue; - var allActions = attr.Actions.Select(i => rotation.AllBaseActions - .FirstOrDefault(a => a.ID == (uint)i)) - .Where(i => i != null); + var allActions = new List(); + foreach (var actionId in attr.Actions) + { + var action = rotation.AllBaseActions.FirstOrDefault(a => a.ID == (uint)actionId); + if (action != null) + { + allActions.Add(action); + } + } + bool hasDesc = !string.IsNullOrEmpty(attr.Description); @@ -2204,13 +2249,14 @@ private static void DrawStatusList(string name, HashSet statuses, Status[] ImguiTooltips.HoveredTooltip(UiString.ConfigWindow_List_AddStatus.GetDescription()); } - foreach (var status in statuses.Select(a => Service.GetSheet().GetRow(a)) - .Where(a => a.RowId != 0) - .OrderByDescending(s => SearchableCollection.Similarity($"{s.Name} {s.RowId}", _statusSearching))) + foreach (var statusId in statuses) { + var status = Service.GetSheet().GetRow(statusId); + if (status.RowId == 0) continue; + void Delete() => removeId = status.RowId; - var key = $"Status{status!.RowId}"; + var key = $"Status{status.RowId}"; ImGuiHelper.DrawHotKeysPopup(key, string.Empty, (UiString.ConfigWindow_List_Remove.GetDescription(), Delete, new[] { "Delete" }));