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

Commit

Permalink
fix: auto off when combat over fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Aug 23, 2023
1 parent 20cbdf5 commit a432ba4
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Resources/RotationSolverRecord.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"ClickingCount": 6180
"ClickingCount": 6208
}
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Configuration/Configs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ public enum PluginConfigFloat : byte
[Default(1f, 0.1f, 10f)] HostileIconSize,

[Default(1f, 0f, 2.5f)] StateIconHeight,
[Default(1f, 0.5f, 10f)] StateIconSize,
[Default(1f, 0.7f, 10f)] StateIconSize,
}

public enum PluginConfigVector4 : byte
Expand Down
10 changes: 5 additions & 5 deletions RotationSolver/Commands/RSCommands_Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ private static void CancelState()
static float _lastCountdownTime = 0;
internal static void UpdateRotationState()
{
if(ActionUpdater._cancelTime != DateTime.MinValue &&
if(ActionUpdater.AutoCancelTime != DateTime.MinValue &&
(!DataCenter.State || DataCenter.InCombat))
{
ActionUpdater._cancelTime = DateTime.MinValue;
ActionUpdater.AutoCancelTime = DateTime.MinValue;
}

var target = DataCenter.AllHostileTargets.FirstOrDefault(t => t.TargetObjectId == Player.Object.ObjectId);
Expand Down Expand Up @@ -179,11 +179,11 @@ internal static void UpdateRotationState()
}
}
//Cancel when after combat.
else if (ActionUpdater._cancelTime != DateTime.MinValue
&& DateTime.Now > ActionUpdater._cancelTime)
else if (ActionUpdater.AutoCancelTime != DateTime.MinValue
&& DateTime.Now > ActionUpdater.AutoCancelTime)
{
CancelState();
ActionUpdater._cancelTime = DateTime.MinValue;
ActionUpdater.AutoCancelTime = DateTime.MinValue;
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion RotationSolver/Commands/RSCommands_StateSpecialCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ private static unsafe void DoStateCommandType(StateCommandType stateType) => DoO
var index = Service.Config.GetValue(Basic.Configuration.PluginConfigInt.TargetingIndex) + 1;
index %= Service.Config.GlobalConfig.TargetingTypes.Count;
Service.Config.SetValue(Basic.Configuration.PluginConfigInt.TargetingIndex, index);
ActionUpdater._cancelTime = DateTime.MinValue;
}

if (Service.Config.GetValue(Basic.Configuration.PluginConfigBool.ToggleManual)
Expand All @@ -48,11 +47,13 @@ private static unsafe void DoStateCommandType(StateCommandType stateType) => DoO
case StateCommandType.Auto:
DataCenter.IsManual = false;
DataCenter.State = true;
ActionUpdater.AutoCancelTime = DateTime.MinValue;
break;

case StateCommandType.Manual:
DataCenter.IsManual = true;
DataCenter.State = true;
ActionUpdater.AutoCancelTime = DateTime.MinValue;
break;
}

Expand Down
9 changes: 5 additions & 4 deletions RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@
"ConfigWindow_Param_SpecialDuration": "Set the duration of special windows set by commands",
"ConfigWindow_Param_AddDotGCDCount": "Set GCD advance of DOT refresh",
"ConfigWindow_Param_MaxPing": "Set the Max Ping that RS can get.",
"ConfigWindow_Param_AutoOffAfterCombat": "Auto turn off when combat is over more than several seconds.",
"ConfigWindow_Param_AutoOffAfterCombatTime": "seconds.",
"ConfigWindow_Param_AutoOffAfterCombatTime": "Auto turn off when combat is over more than several seconds.",
"ConfigWindow_Param_AutoOffBetweenArea": "Auto turn off when player is between area.",
"ConfigWindow_Param_AutoOffCutScene": "Auto turn off during cut scene.",
"ConfigWindow_Param_AutoOffWhenDead": "Auto turn off when dead.",
Expand Down Expand Up @@ -492,6 +491,8 @@
"ConfigWindow_About_ClickingTooMuch": "Well, you must be a lazy player!",
"ConfigWindow_Auto_AutoHealDeadTime": "Auto heal before combat end several seconds.",
"ConfigWindow_UI_ShowHostiles": "Show the hostile targets",
"ConfigWindow_UI_HostileIconHeight": "Icon height from position",
"ConfigWindow_UI_HostileIconSize": "Icon size"
"ConfigWindow_UI_HostileIconHeight": "Hostile Icon height from position",
"ConfigWindow_UI_HostileIconSize": "Hostile Icon size",
"ConfigWindow_UI_StateIconHeight": "State Icon height from position",
"ConfigWindow_UI_StateIconSize": "State Icon size"
}
4 changes: 2 additions & 2 deletions RotationSolver/Updaters/ActionUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace RotationSolver.Updaters;

internal static class ActionUpdater
{
internal static DateTime _cancelTime = DateTime.MinValue;
internal static DateTime AutoCancelTime { get; set; } = DateTime.MinValue;

static RandomDelay _GCDDelay = new(() =>
(Service.Config.GetValue(PluginConfigFloat.WeaponDelayMin),
Expand Down Expand Up @@ -135,7 +135,7 @@ private static void UpdateCombatTime()
{
_startCombatTime = DateTime.MinValue;

_cancelTime = DateTime.Now.AddSeconds(Service.Config.GetValue(PluginConfigFloat.AutoOffAfterCombatTime));
AutoCancelTime = DateTime.Now.AddSeconds(Service.Config.GetValue(PluginConfigFloat.AutoOffAfterCombatTime));
}

if (_startCombatTime == DateTime.MinValue)
Expand Down

0 comments on commit a432ba4

Please sign in to comment.