From cfb686dd79356c083d511f58f84f29c05b77df54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E6=B0=B4?= <1123993881@qq.com> Date: Tue, 7 Nov 2023 20:22:22 +0800 Subject: [PATCH 1/3] fix: fixed status id. --- Resources/RotationSolverRecord.json | 4 +- RotationSolver.Basic/Data/StatusID.cs | 48 +++++-------------- .../Rotations/Basic/MCH_Base.cs | 2 +- .../Rotations/Basic/RPR_Base.cs | 2 +- .../Rotations/Basic/SAM_Base.cs | 2 +- 5 files changed, 16 insertions(+), 42 deletions(-) diff --git a/Resources/RotationSolverRecord.json b/Resources/RotationSolverRecord.json index eb93efaaf..ad615f56d 100644 --- a/Resources/RotationSolverRecord.json +++ b/Resources/RotationSolverRecord.json @@ -1,7 +1,5 @@ { "ClickingCount": 56909, "SayingHelloCount": 0, - "SaidUsers": [ - "Ig4lHXUohMZNIeheUtAtRg==" - ] + "SaidUsers": [] } \ No newline at end of file diff --git a/RotationSolver.Basic/Data/StatusID.cs b/RotationSolver.Basic/Data/StatusID.cs index 519ba704a..cdbaf317a 100644 --- a/RotationSolver.Basic/Data/StatusID.cs +++ b/RotationSolver.Basic/Data/StatusID.cs @@ -151,10 +151,6 @@ public enum StatusID : ushort /// /// Bind1 = 13, - /// - /// - /// - Bind2 = 1345, /// /// @@ -987,11 +983,6 @@ public enum StatusID : ushort /// Stun = 2, - /// - /// - /// - Stun2 = 1343, - /// /// /// @@ -1002,11 +993,6 @@ public enum StatusID : ushort /// Sleep2 = 926, - /// - /// - /// - Sleep3 = 1348, - /// /// /// @@ -1022,11 +1008,6 @@ public enum StatusID : ushort /// Silence = 7, - /// - /// - /// - Silence2 = 1347, - /// /// /// @@ -1047,11 +1028,6 @@ public enum StatusID : ushort /// Slow4 = 561, - /// - /// - /// - Slow5 = 1346, - /// /// /// @@ -1062,11 +1038,6 @@ public enum StatusID : ushort /// Blind2 = 564, - /// - /// - /// - Blind3 = Blind2, - /// /// /// @@ -1865,10 +1836,15 @@ public enum StatusID : ushort /// PvP_Hidden = 1316, - /// - /// - /// - PvP_Bunshin = 2010, + /// + /// + /// + PvP_FleetingRaijuReady = 3211, + + /// + /// + /// + PvP_Bunshin = 2010, /// /// @@ -2176,7 +2152,7 @@ public enum StatusID : ushort /// PvP_Cure3Ready = 3083, - #endregion WHM_PvP - - + #endregion WHM_PvP + + #endregion } diff --git a/RotationSolver.Basic/Rotations/Basic/MCH_Base.cs b/RotationSolver.Basic/Rotations/Basic/MCH_Base.cs index deb75710f..80df17410 100644 --- a/RotationSolver.Basic/Rotations/Basic/MCH_Base.cs +++ b/RotationSolver.Basic/Rotations/Basic/MCH_Base.cs @@ -334,7 +334,7 @@ protected static bool OverheatedEndAfterGCD(uint gctCount = 0, float offset = 0) /// public static IBaseAction PvP_HeatBlast { get; } = new BaseAction(ActionID.PvP_HeatBlast) { - StatusNeed = new StatusID[] { StatusID.PvP_Overheat }, + StatusNeed = new StatusID[] { StatusID.PvP_Overheated }, }; /// diff --git a/RotationSolver.Basic/Rotations/Basic/RPR_Base.cs b/RotationSolver.Basic/Rotations/Basic/RPR_Base.cs index 1e3f6306e..4b2e50f92 100644 --- a/RotationSolver.Basic/Rotations/Basic/RPR_Base.cs +++ b/RotationSolver.Basic/Rotations/Basic/RPR_Base.cs @@ -284,7 +284,7 @@ public abstract class RPR_Base : CustomRotation public static IBaseAction HellsIngress { get; } = new BaseAction(ActionID.HellsIngress) { StatusProvide = new[] { StatusID.EnhancedHarpe }, - ActionCheck = (b, m) => !Player.HasStatus(true, StatusID.Bind1, StatusID.Bind2) + ActionCheck = (b, m) => !Player.HasStatus(true, StatusID.Bind1) }; /// diff --git a/RotationSolver.Basic/Rotations/Basic/SAM_Base.cs b/RotationSolver.Basic/Rotations/Basic/SAM_Base.cs index a974243ad..7a704651c 100644 --- a/RotationSolver.Basic/Rotations/Basic/SAM_Base.cs +++ b/RotationSolver.Basic/Rotations/Basic/SAM_Base.cs @@ -272,7 +272,7 @@ public static bool IsMoonTimeLessThanFlower /// public static IBaseAction HissatsuGyoten { get; } = new BaseAction(ActionID.HissatsuGyoten) { - ActionCheck = (b, m) => Kenki >= 10 && !Player.HasStatus(true, StatusID.Bind1, StatusID.Bind2), + ActionCheck = (b, m) => Kenki >= 10 && !Player.HasStatus(true, StatusID.Bind1), ChoiceTarget = TargetFilter.FindTargetForMoving, }; From 8a5be951adc2e66665ad8cabb0e278c204129008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E6=B0=B4?= <1123993881@qq.com> Date: Tue, 7 Nov 2023 21:38:10 +0800 Subject: [PATCH 2/3] fix: changed the unit showing. --- RotationSolver/UI/ConditionDrawer.cs | 15 +++--- RotationSolver/UI/ImGuiHelper.cs | 46 +++++++--------- RotationSolver/UI/RotationConfigWindow.cs | 8 +-- .../SearchableConfigs/DragFloatRangeSearch.cs | 52 +++++++++++++------ .../UI/SearchableConfigs/DragFloatSearch.cs | 42 +++++++++++---- RotationSolver/Updaters/ActionUpdater.cs | 7 ++- 6 files changed, 107 insertions(+), 63 deletions(-) diff --git a/RotationSolver/UI/ConditionDrawer.cs b/RotationSolver/UI/ConditionDrawer.cs index 4b9ebf374..02a5e59f4 100644 --- a/RotationSolver/UI/ConditionDrawer.cs +++ b/RotationSolver/UI/ConditionDrawer.cs @@ -10,7 +10,6 @@ using RotationSolver.Basic.Configuration.Conditions; using RotationSolver.Localization; using RotationSolver.Updaters; -using System.Reflection.Emit; using Action = System.Action; namespace RotationSolver.UI; @@ -102,9 +101,11 @@ public static void DrawByteEnum(string name, ref T value, Func fun public static bool DrawDragFloat(ConfigUnitType type, string name, ref float value) { ImGui.SameLine(); - ImGui.SetNextItemWidth(Math.Max(50 * ImGuiHelpers.GlobalScale, ImGui.CalcTextSize(value.ToString()).X)); - var result = ImGui.DragFloat(name, ref value); - type.Draw(); + var show = type == ConfigUnitType.Percent ? $"{value:F1}{type.ToSymbol()}" : $"{value:F2}{type.ToSymbol()}"; + + ImGui.SetNextItemWidth(Math.Max(50 * ImGuiHelpers.GlobalScale, ImGui.CalcTextSize(show).X)); + var result = ImGui.DragFloat(name, ref value, 0.1f, 0, 0, show); + ImguiTooltips.HoveredTooltip(type.ToDesc()); return result; } @@ -248,12 +249,14 @@ private static void DrawDelay(this DelayCondition condition) const float MIN = 0, MAX = 60; ImGui.SetNextItemWidth(80 * ImGuiHelpers.GlobalScale); - if (ImGui.DragFloatRange2($"##Random Delay {condition.GetHashCode()}", ref condition.DelayMin, ref condition.DelayMax, 0.1f, MIN, MAX)) + if (ImGui.DragFloatRange2($"##Random Delay {condition.GetHashCode()}", ref condition.DelayMin, ref condition.DelayMax, 0.1f, MIN, MAX, + $"{condition.DelayMin:F1}{ConfigUnitType.Seconds.ToSymbol()}", $"{condition.DelayMax:F1}{ConfigUnitType.Seconds.ToSymbol()}")) { condition.DelayMin = Math.Max(Math.Min(condition.DelayMin, condition.DelayMax), MIN); condition.DelayMax = Math.Min(Math.Max(condition.DelayMin, condition.DelayMax), MAX); } - ImguiTooltips.HoveredTooltip(LocalizationManager.RightLang.ActionSequencer_Delay_Description); + ImguiTooltips.HoveredTooltip(LocalizationManager.RightLang.ActionSequencer_Delay_Description + + "\n" + ConfigUnitType.Seconds.ToDesc()); } private static void DrawBefore(this ICondition condition) diff --git a/RotationSolver/UI/ImGuiHelper.cs b/RotationSolver/UI/ImGuiHelper.cs index 045a42958..fd161e905 100644 --- a/RotationSolver/UI/ImGuiHelper.cs +++ b/RotationSolver/UI/ImGuiHelper.cs @@ -417,32 +417,24 @@ public static bool IsInRect(Vector2 leftTop, Vector2 size) return true; } - public static void Draw(this ConfigUnitType unit) - { - if (unit == ConfigUnitType.None) return; - - var unitName = unit switch - { - ConfigUnitType.Seconds => "(s)", - ConfigUnitType.Degree => "(°)", - ConfigUnitType.Pixels => "(p)", - ConfigUnitType.Yalms => "(y)", - ConfigUnitType.Percent => "(%%)", - _ => string.Empty, - }; - - ImGui.SameLine(); - ImGui.TextColored(ImGuiColors.DalamudViolet, unitName); - var desc = unit switch - { - ConfigUnitType.Seconds => LocalizationManager.RightLang.ConfigUnitType_Seconds, - ConfigUnitType.Degree => LocalizationManager.RightLang.ConfigUnitType_Degree, - ConfigUnitType.Pixels => LocalizationManager.RightLang.ConfigUnitType_Pixels, - ConfigUnitType.Yalms => LocalizationManager.RightLang.ConfigUnitType_Yalms, - ConfigUnitType.Percent => LocalizationManager.RightLang.ConfigUnitType_Ratio, - _ => string.Empty, - }; - ImguiTooltips.HoveredTooltip(desc); - } + public static string ToSymbol(this ConfigUnitType unit) => unit switch + { + ConfigUnitType.Seconds => " s", + ConfigUnitType.Degree => " °", + ConfigUnitType.Pixels => " p", + ConfigUnitType.Yalms => " y", + ConfigUnitType.Percent => " %%", + _ => string.Empty, + }; + + public static string ToDesc(this ConfigUnitType unit) => unit switch + { + ConfigUnitType.Seconds => LocalizationManager.RightLang.ConfigUnitType_Seconds, + ConfigUnitType.Degree => LocalizationManager.RightLang.ConfigUnitType_Degree, + ConfigUnitType.Pixels => LocalizationManager.RightLang.ConfigUnitType_Pixels, + ConfigUnitType.Yalms => LocalizationManager.RightLang.ConfigUnitType_Yalms, + ConfigUnitType.Percent => LocalizationManager.RightLang.ConfigUnitType_Ratio, + _ => string.Empty, + }; } diff --git a/RotationSolver/UI/RotationConfigWindow.cs b/RotationSolver/UI/RotationConfigWindow.cs index 6effebeea..93a53050c 100644 --- a/RotationSolver/UI/RotationConfigWindow.cs +++ b/RotationSolver/UI/RotationConfigWindow.cs @@ -1166,21 +1166,21 @@ private static void DrawRotationConfiguration() ImGui.SetNextItemWidth(Scale * Searchable.DRAG_WIDTH); if (f.UnitType == ConfigUnitType.Percent) { - var v = (int)val * 100; - if (ImGui.SliderInt(name, ref v, (int)(f.Min * 100), (int)(f.Max * 100))) + var v = val * 100; + if (ImGui.SliderFloat(name, ref v,f.Min * 100,f.Max * 100, $"{v:F1}{f.UnitType.ToSymbol()}")) { set.SetValue(config.Name, (v / 100f).ToString()); } } else { - if (ImGui.DragFloat(name, ref val, f.Speed, f.Min, f.Max)) + if (ImGui.DragFloat(name, ref val, f.Speed, f.Min, f.Max, $"{val:F2}{f.UnitType.ToSymbol()}")) { set.SetValue(config.Name, val.ToString()); } } + ImguiTooltips.HoveredTooltip(f.UnitType.ToDesc()); - f.UnitType.Draw(); ImGuiHelper.ReactPopup(key, command, Reset); } else if (config is RotationConfigString s) diff --git a/RotationSolver/UI/SearchableConfigs/DragFloatRangeSearch.cs b/RotationSolver/UI/SearchableConfigs/DragFloatRangeSearch.cs index 82e50ad89..2535caf25 100644 --- a/RotationSolver/UI/SearchableConfigs/DragFloatRangeSearch.cs +++ b/RotationSolver/UI/SearchableConfigs/DragFloatRangeSearch.cs @@ -1,5 +1,4 @@ using Dalamud.Utility; -using ECommons.Configuration; using ECommons.ExcelServices; using RotationSolver.Basic.Configuration; using RotationSolver.Localization; @@ -13,8 +12,21 @@ internal class DragFloatRangeSearchJob : DragFloatRangeSearch public override string Name => _configMin.ToName(); - public override string Description => _configMin.ToDescription(); - + public override string Description + { + get + { + var baseDesc = _configMin.ToDescription(); + if (!string.IsNullOrEmpty(baseDesc)) + { + return baseDesc + "\n" + Unit.ToDesc(); + } + else + { + return Unit.ToDesc(); + } + } + } public override LinkDescription[] Tooltips => _configMin.ToAction(); protected override bool IsJob => true; @@ -62,7 +74,21 @@ internal class DragFloatRangeSearchPlugin : DragFloatRangeSearch public override string Name => _configMin.ToName(); - public override string Description => _configMin.ToDescription(); + public override string Description + { + get + { + var baseDesc = _configMin.ToDescription(); + if (!string.IsNullOrEmpty(baseDesc)) + { + return baseDesc + "\n" + Unit.ToDesc(); + } + else + { + return Unit.ToDesc(); + } + } + } public override LinkDescription[] Tooltips => _configMin.ToAction(); @@ -130,9 +156,10 @@ protected override void DrawMain(Job job) if (Unit == ConfigUnitType.Percent) { - var vm = (int)minValue * 100; - var vM = (int)maxValue * 100; - if (ImGui.DragIntRange2($"##Config_{ID}{GetHashCode()}", ref vm, ref vM, Speed, (int)(Min * 100), (int)(Max * 100))) + var vm = minValue * 100; + var vM = maxValue * 100; + if (ImGui.DragFloatRange2($"##Config_{ID}{GetHashCode()}", ref vm, ref vM, Speed, Min * 100, Max * 100, + $"{vm:F1}{Unit.ToSymbol()}", $"{vM:F1}{Unit.ToSymbol()}")) { SetMinValue(job, Math.Min(vm / 100f, vM / 100f)); SetMaxValue(job, Math.Max(vm / 100f, vM / 100f)); @@ -140,23 +167,16 @@ protected override void DrawMain(Job job) } else { - if (ImGui.DragFloatRange2($"##Config_{ID}{GetHashCode()}", ref minValue, ref maxValue, Speed, Min, Max)) + if (ImGui.DragFloatRange2($"##Config_{ID}{GetHashCode()}", ref minValue, ref maxValue, Speed, Min, Max, + $"{minValue:F2}{Unit.ToSymbol()}", $"{maxValue:F2}{Unit.ToSymbol()}")) { SetMinValue(job, Math.Min(minValue, maxValue)); SetMaxValue(job, Math.Max(minValue, maxValue)); } } - if (ImGui.DragFloatRange2($"##Config_{ID}{GetHashCode()}", ref minValue, ref maxValue, Speed, Min, Max)) - { - SetMinValue(job, Math.Min(minValue, maxValue)); - SetMaxValue(job, Math.Max(minValue, maxValue)); - } - if (ImGui.IsItemHovered()) ShowTooltip(job); - Unit.Draw(); - if (IsJob) DrawJobIcon(); ImGui.SameLine(); if (Color != 0) ImGui.PushStyleColor(ImGuiCol.Text, Color); diff --git a/RotationSolver/UI/SearchableConfigs/DragFloatSearch.cs b/RotationSolver/UI/SearchableConfigs/DragFloatSearch.cs index cb64e58a5..3f444c0ab 100644 --- a/RotationSolver/UI/SearchableConfigs/DragFloatSearch.cs +++ b/RotationSolver/UI/SearchableConfigs/DragFloatSearch.cs @@ -14,8 +14,21 @@ internal class DragFloatSearchJob : DragFloatSearch public override string Name => _config.ToName(); - public override string Description => _config.ToDescription(); - + public override string Description + { + get + { + var baseDesc = _config.ToDescription(); + if (!string.IsNullOrEmpty(baseDesc)) + { + return baseDesc + "\n" + Unit.ToDesc(); + } + else + { + return Unit.ToDesc(); + } + } + } public override LinkDescription[] Tooltips => _config.ToAction(); public override string Command => _config.ToCommand(); @@ -53,7 +66,21 @@ internal class DragFloatSearchPlugin : DragFloatSearch public override string Name => _config.ToName(); - public override string Description => _config.ToDescription(); + public override string Description + { + get + { + var baseDesc = _config.ToDescription(); + if (!string.IsNullOrEmpty(baseDesc)) + { + return baseDesc + "\n" + Unit.ToDesc(); + } + else + { + return Unit.ToDesc(); + } + } + } public override LinkDescription[] Tooltips => _config.ToAction(); @@ -90,7 +117,6 @@ internal abstract class DragFloatSearch : Searchable public float Max { get; init; } public float Speed { get; init; } public ConfigUnitType Unit { get; init; } - public DragFloatSearch(float min, float max, float speed, ConfigUnitType unit) { Min = min; Max = max; @@ -103,17 +129,17 @@ protected override void DrawMain(Job job) { var value = GetValue(job); ImGui.SetNextItemWidth(Scale * DRAG_WIDTH); + var v = value * 100f; if (Unit == ConfigUnitType.Percent) { - var v = (int)value * 100; - if (ImGui.SliderInt($"##Config_{ID}{GetHashCode()}", ref v, (int)(Min * 100), (int)(Max * 100))) + if (ImGui.SliderFloat($"##Config_{ID}{GetHashCode()}", ref v, Min * 100, Max * 100, $"{v:F1}{Unit.ToSymbol()}")) { SetValue(job, v / 100f); } } else { - if (ImGui.DragFloat($"##Config_{ID}{GetHashCode()}", ref value, Speed, Min, Max)) + if (ImGui.DragFloat($"##Config_{ID}{GetHashCode()}", ref value, Speed, Min, Max, $"{value:F2}{Unit.ToSymbol()}")) { SetValue(job, value); } @@ -121,8 +147,6 @@ protected override void DrawMain(Job job) if (ImGui.IsItemHovered()) ShowTooltip(job); - Unit.Draw(); - if (IsJob) DrawJobIcon(); ImGui.SameLine(); diff --git a/RotationSolver/Updaters/ActionUpdater.cs b/RotationSolver/Updaters/ActionUpdater.cs index d31378514..4315072cc 100644 --- a/RotationSolver/Updaters/ActionUpdater.cs +++ b/RotationSolver/Updaters/ActionUpdater.cs @@ -51,7 +51,12 @@ internal static void UpdateNextAction() } return false; }); - WrongAction = actions.ElementAt(_wrongRandom.Next(actions.Count())); + + var count = actions.Count(); + if (count > 0) + { + WrongAction = actions.ElementAt(_wrongRandom.Next(count)); + } } NextAction = newAction; From 2b2f966593f29981d35390a1bdbc487e12dad065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E6=B0=B4?= <1123993881@qq.com> Date: Tue, 7 Nov 2023 21:42:04 +0800 Subject: [PATCH 3/3] chore: 3.4.14 released. --- Directory.Build.props | 2 +- RotationSolver.Basic/Actions/BaseAction_Target.cs | 14 ++++++++++++++ RotationSolver.Basic/Actions/IBaseAction.cs | 14 ++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index b8576cdff..4e6d55986 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -3,7 +3,7 @@ net7.0-windows enable ArchiTed - 3.4.13 + 3.4.14 x64 AnyCPU diff --git a/RotationSolver.Basic/Actions/BaseAction_Target.cs b/RotationSolver.Basic/Actions/BaseAction_Target.cs index 11ad1f2ce..3a564506f 100644 --- a/RotationSolver.Basic/Actions/BaseAction_Target.cs +++ b/RotationSolver.Basic/Actions/BaseAction_Target.cs @@ -55,6 +55,20 @@ public float TimeToKill /// public BattleChara Target { get; private set; } = Player.Object; + /// + /// Is this action's target dead? + /// + [EditorBrowsable(EditorBrowsableState.Never)] + [Obsolete("Please use Target.IsDying() instead.", true)] + public bool IsTargetDying => Target?.IsDying() ?? false; + + /// + /// Is this action's target is a boss? + /// + [EditorBrowsable(EditorBrowsableState.Never)] + [Obsolete("Please use Target.IsBossFromTTK() or Target.IsBossFromIcon instead.", true)] + public bool IsTargetBoss => Target?.IsBossFromTTK() ?? false; + /// public BattleChara[] AffectedTargets { get; private set; } = Array.Empty(); diff --git a/RotationSolver.Basic/Actions/IBaseAction.cs b/RotationSolver.Basic/Actions/IBaseAction.cs index 025c12438..fa57e5cef 100644 --- a/RotationSolver.Basic/Actions/IBaseAction.cs +++ b/RotationSolver.Basic/Actions/IBaseAction.cs @@ -184,6 +184,20 @@ public interface IBaseAction : IAction /// bool IsSingleTarget { get; } + /// + /// Is target will die immediately. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + [Obsolete("Please use Target.IsDying() instead.", true)] + bool IsTargetDying { get; } + + /// + /// Is target a boss. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + [Obsolete("Please use Target.IsBossFromTTK() or Target.IsBossFromIcon instead.", true)] + bool IsTargetBoss { get; } + /// /// How many targets are needed to use this action. ///