From 44fc4f9933ca276e2f8b6fcc4fc1048a0be4b26f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E6=B0=B4?= <1123993881@qq.com> Date: Tue, 29 Aug 2023 12:52:57 +0800 Subject: [PATCH] fix: fixed action sequencer delay. --- Resources/RotationSolverRecord.json | 2 +- RotationSolver.Basic/Data/RandomDelay.cs | 10 +++++++++- RotationSolver/ActionSequencer/BaseCondition.cs | 7 +++++-- RotationSolver/ActionSequencer/ConditionSet.cs | 1 - RotationSolver/Localization/Localization.json | 4 +++- RotationSolver/Updaters/TargetUpdater.cs | 1 - 6 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Resources/RotationSolverRecord.json b/Resources/RotationSolverRecord.json index fcd9e14a1..5af06796b 100644 --- a/Resources/RotationSolverRecord.json +++ b/Resources/RotationSolverRecord.json @@ -1,3 +1,3 @@ { - "ClickingCount": 10923 + "ClickingCount": 10946 } \ No newline at end of file diff --git a/RotationSolver.Basic/Data/RandomDelay.cs b/RotationSolver.Basic/Data/RandomDelay.cs index aef1a2f5a..b6050863c 100644 --- a/RotationSolver.Basic/Data/RandomDelay.cs +++ b/RotationSolver.Basic/Data/RandomDelay.cs @@ -3,7 +3,7 @@ /// /// Random delay the bool. /// -public struct RandomDelay +public class RandomDelay { DateTime _startDelayTime = DateTime.Now; float _delayTime = -1; @@ -25,6 +25,14 @@ public RandomDelay(Func<(float min, float max)> getRange) GetRange = getRange; } + /// + /// + /// + public RandomDelay() + { + + } + /// /// Delay the bool. /// diff --git a/RotationSolver/ActionSequencer/BaseCondition.cs b/RotationSolver/ActionSequencer/BaseCondition.cs index 1dbe5f913..2b5e994f0 100644 --- a/RotationSolver/ActionSequencer/BaseCondition.cs +++ b/RotationSolver/ActionSequencer/BaseCondition.cs @@ -8,14 +8,17 @@ internal abstract class BaseCondition : ICondition public float DelayMin = 0; public float DelayMax = 0; - private RandomDelay _delay = new RandomDelay(); + RandomDelay _delay = new RandomDelay(); [JsonIgnore] private const float MIN = 0, MAX = 60; public bool IsTrue(ICustomRotation rotation) { - _delay.GetRange = () => (DelayMin, DelayMax); + if(_delay.GetRange == null) + { + _delay.GetRange = () => (DelayMin, DelayMax); + } return _delay.Delay(IsTrueInside(rotation)); } diff --git a/RotationSolver/ActionSequencer/ConditionSet.cs b/RotationSolver/ActionSequencer/ConditionSet.cs index 26f5c61f8..ff669901e 100644 --- a/RotationSolver/ActionSequencer/ConditionSet.cs +++ b/RotationSolver/ActionSequencer/ConditionSet.cs @@ -33,7 +33,6 @@ public override void BeforeDraw() public override void DrawInside(ICustomRotation rotation) { - AddButton(); ImGui.SameLine(); diff --git a/RotationSolver/Localization/Localization.json b/RotationSolver/Localization/Localization.json index 59eaf6d3a..ab6f46ce0 100644 --- a/RotationSolver/Localization/Localization.json +++ b/RotationSolver/Localization/Localization.json @@ -129,7 +129,9 @@ "ConfigWindow_Param_HealthHealerRatio": "Heal healer first if its HP%% is lower than this.", "ConfigWindow_Param_HealthTankRatio": "Heal tank first if its HP%% is lower than this.", "ConfigWindow_Param_DistanceForMoving": "Use gapcloser as a damage ability if the distance to your target is less then this.", - "ConfigWindow_Param_HealWhenNothingTodoBelow": "Healing the members with GCD if there is nothing to do in combat and their min HP%% is lower than this.", + "ConfigWindow_Param_HealWhenNothingTodo": "Healing the members with GCD if there is nothing to do in combat.", + "ConfigWindow_Param_HealWhenNothingTodoBelow": "When their min HP%% is lower than this.", + "ConfigWindow_Param_HealWhenNothingTodoDelay": "The delay of this type of healing.", "ConfigWindow_Param_HealthForDyingTank": "Set the HP%% for tank to use invulnerability", "ConfigWindow_Param_MeleeRangeOffset": "Melee Range action using offset", "ConfigWindow_Param_RightNowTargetToHostileType": "Engage settings", diff --git a/RotationSolver/Updaters/TargetUpdater.cs b/RotationSolver/Updaters/TargetUpdater.cs index c611d1d3e..be246638a 100644 --- a/RotationSolver/Updaters/TargetUpdater.cs +++ b/RotationSolver/Updaters/TargetUpdater.cs @@ -7,7 +7,6 @@ using FFXIVClientStructs.FFXIV.Client.UI; using Lumina.Excel.GeneratedSheets; using RotationSolver.Basic.Configuration; -using System.Configuration; using System.Text.RegularExpressions; using Action = Lumina.Excel.GeneratedSheets.Action;