Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: add a feature for clicking the actions more intense!
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 19, 2023
1 parent ae10fa2 commit 31d09b8
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 22 deletions.
4 changes: 3 additions & 1 deletion RotationSolver.Basic/Configuration/PluginConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ public class PluginConfiguration : IPluginConfiguration
public Vector3 TargetColor = new(1f, 0.2f, 0f);
public Vector3 SubTargetColor = new(1f, 0.9f, 0f);
public bool KeyBoardNoise = true;
public bool KeyBoardNoiseBefore = true;
public int KeyBoardNoiseMin = 2;
public int KeyBoardNoiseMax = 3;
public float KeyBoardNoiseTimeMin = 0.1f;
Expand Down Expand Up @@ -134,6 +133,9 @@ public class PluginConfiguration : IPluginConfiguration
public float NotInCombatDelayMin = 1f;
public float NotInCombatDelayMax = 2;

public float ClickingDelayMin = 0.1f;
public float ClickingDelayMax = 0.15f;

public bool UseWorkTask = true;

public bool UseStopCasting = false;
Expand Down
2 changes: 2 additions & 0 deletions RotationSolver.Basic/DataCenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ public static float RatioOfMembersIn2minsBurst
public static Queue<MacroItem> Macros { get; } = new Queue<MacroItem>();

#region Action Record
public static DateTime NextActionMinTime { get; set; }

const int QUEUECAPACITY = 32;
private static Queue<ActionRec> _actions = new Queue<ActionRec>(QUEUECAPACITY);
private static Queue<DamageRec> _damages = new Queue<DamageRec>(QUEUECAPACITY);
Expand Down
32 changes: 15 additions & 17 deletions RotationSolver/Commands/RSCommands_Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace RotationSolver.Commands
{
public static partial class RSCommands
{
static DateTime _fastClickStopwatch = DateTime.Now;
static DateTime _fastClickStopwatch = DateTime.MinValue;
static byte _loop = 0;
static StateCommandType _lastState;

Expand All @@ -25,7 +25,8 @@ internal static unsafe void DoAnAction(bool isGCD)
if (localPlayer == null) return;

//Do not click the button in random time.
if (DateTime.Now - _fastClickStopwatch < TimeSpan.FromSeconds(new Random().Next(100, 250))) return;
if (DateTime.Now - _fastClickStopwatch < TimeSpan.FromMilliseconds(new Random().Next(
(int)(Service.Config.ClickingDelayMin * 1000), (int)(Service.Config.ClickingDelayMax * 1000)))) return;
_fastClickStopwatch = DateTime.Now;

//Do Action
Expand All @@ -34,7 +35,7 @@ internal static unsafe void DoAnAction(bool isGCD)

#if DEBUG
//if (nextAction is BaseAction acti)
// Service.ChatGui.Print($"Will Do {acti} {ActionUpdater.WeaponElapsed}");
// Service.ChatGui.Print($"Will Do {acti}");
#endif
if (DataCenter.InHighEndDuty && !RotationUpdater.RightNowRotation.IsAllowed(out var str))
{
Expand All @@ -48,26 +49,23 @@ internal static unsafe void DoAnAction(bool isGCD)

if (!isGCD && nextAction is BaseAction act1 && act1.IsRealGCD) return;

if (Service.Config.KeyBoardNoise && Service.Config.KeyBoardNoiseBefore)
Task.Run(() => PulseSimulation(nextAction.AdjustedID));
if (Service.Config.KeyBoardNoise)
PreviewUpdater.PulseActionBar(nextAction.AdjustedID);

if (nextAction.Use())
if (nextAction.Use() && nextAction is BaseAction act)
{
if (Service.Config.KeyBoardNoise && !Service.Config.KeyBoardNoiseBefore)
if (Service.Config.KeyBoardNoise)
Task.Run(() => PulseSimulation(nextAction.AdjustedID));

if (nextAction is BaseAction act)
{
if (act.ShouldEndSpecial) ResetSpecial();
if (act.ShouldEndSpecial) ResetSpecial();
#if DEBUG
//Service.ChatGui.Print($"{act}, {act.Target.Name}, {ActionUpdater.AbilityRemainCount}, {ActionUpdater.WeaponElapsed}");
//Service.ChatGui.Print($"{act}, {act.Target.Name}, {ActionUpdater.AbilityRemainCount}, {ActionUpdater.WeaponElapsed}");
#endif
//Change Target
if ((Service.TargetManager.Target?.IsNPCEnemy() ?? true)
&& (act.Target?.IsNPCEnemy() ?? false))
{
Service.TargetManager.SetTarget(act.Target);
}
//Change Target
if ((Service.TargetManager.Target?.IsNPCEnemy() ?? true)
&& (act.Target?.IsNPCEnemy() ?? false))
{
Service.TargetManager.SetTarget(act.Target);
}
}
return;
Expand Down
1 change: 1 addition & 0 deletions RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"ConfigWindow_Param_WeakenDelay": "Set the range of random delay for esuna weakens in second.",
"ConfigWindow_Param_HealDelay": "Set the range of random delay for healing people in second.",
"ConfigWindow_Param_NotInCombatDelay": "Set the range of random delay for Not In Combat in second.",
"ConfigWindow_Param_ClickingDelay": "Set the range of random delay for the interval of clicking actions.",
"ConfigWindow_Param_StopCastingDelay": "Set the range of random delay for stopping casting when target is no need to cast in second.",
"ConfigWindow_Param_Display": "Display",
"ConfigWindow_Param_Advanced": "Advanced",
Expand Down
2 changes: 2 additions & 0 deletions RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ internal partial class Strings
public string ConfigWindow_Param_HealDelay { get; set; } = "Set the range of random delay for healing people in second.";

public string ConfigWindow_Param_NotInCombatDelay { get; set; } = "Set the range of random delay for Not In Combat in second.";

public string ConfigWindow_Param_ClickingDelay { get; set; } = "Set the range of random delay for the interval of clicking actions.";
public string ConfigWindow_Param_StopCastingDelay { get; set; } = "Set the range of random delay for stopping casting when target is no need to cast in second.";
public string ConfigWindow_Param_Display { get; set; } = "Display";
public string ConfigWindow_Param_Advanced { get; set; } = "Advanced";
Expand Down
10 changes: 6 additions & 4 deletions RotationSolver/UI/RotationConfigWindow_Param.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private void DrawParamBasic()
min: 0.5f, max: 0.7f);

DrawFloatNumber(LocalizationManager.RightLang.ConfigWindow_Param_ActionAhead,
ref Service.Config.ActionAhead, Service.Default.ActionAhead, max: 0.1f);
ref Service.Config.ActionAhead, Service.Default.ActionAhead, max: 1f);

DrawFloatNumber(LocalizationManager.RightLang.ConfigWindow_Param_CountDownAhead,
ref Service.Config.CountDownAhead, Service.Default.CountDownAhead, min: 0.5f, max: 0.7f);
Expand Down Expand Up @@ -114,6 +114,11 @@ private void DrawParamDelay()
ref Service.Config.NotInCombatDelayMin, ref Service.Config.NotInCombatDelayMax,
Service.Default.NotInCombatDelayMin, Service.Default.NotInCombatDelayMax);

DrawRangedFloat(LocalizationManager.RightLang.ConfigWindow_Param_ClickingDelay,
ref Service.Config.ClickingDelayMin, ref Service.Config.ClickingDelayMax,
Service.Default.ClickingDelayMin, Service.Default.ClickingDelayMax
,min : 0.05f, max: 0.25f);

if (Service.Config.UseStopCasting)
{
DrawRangedFloat(LocalizationManager.RightLang.ConfigWindow_Param_StopCastingDelay,
Expand Down Expand Up @@ -229,9 +234,6 @@ private void DrawParamDisplay()
{
ImGui.Indent();

DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Param_KeyBoardNoiseBefore,
ref Service.Config.KeyBoardNoiseBefore, Service.Default.KeyBoardNoiseBefore);

DrawRangedInt(LocalizationManager.RightLang.ConfigWindow_Param_KeyBoardNoiseTimes,
ref Service.Config.KeyBoardNoiseMin, ref Service.Config.KeyBoardNoiseMax,
Service.Default.KeyBoardNoiseMin, Service.Default.KeyBoardNoiseMax);
Expand Down
1 change: 1 addition & 0 deletions RotationSolver/Watcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ private static void ActionFromSelf(uint sourceId, ActionEffectSet set)

//Record
DataCenter.AddActionRec(set.Action);
DataCenter.NextActionMinTime = DateTime.Now.AddSeconds(set.AnimationLock);
ShowStrSelf = set.ToString();

//Macro
Expand Down

0 comments on commit 31d09b8

Please sign in to comment.