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

Commit

Permalink
fix: fix for raising casting stop.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Feb 14, 2023
1 parent afcf023 commit 2fd647a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion RotationSolver/Localization/Strings_Major.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ 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_StopCastingDelay { get; set; } = "Set the range of random delay for stoping casting when target is dead in second.";
public string Configwindow_Param_StopCastingDelay { get; set; } = "Set the range of random delay for stoping casting when target is no need to cast in second.";
public string Configwindow_Param_WorkTaskDelay { get; set; } = "Set the work task delay in millisecond. Smaller, more precise, more resource-intensive";

public string Configwindow_Param_Display { get; set; } = "Display";
Expand Down
16 changes: 9 additions & 7 deletions RotationSolver/Updaters/PreviewUpdater.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Game.ClientState.Objects.SubKinds;
using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Game.Gui.Dtr;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Game.Text.SeStringHandling.Payloads;
Expand Down Expand Up @@ -59,14 +60,15 @@ private static void UpdateEntry()
}

static bool _canMove;
static bool _isTarDead;
static RandomDelay _tarDeadDelay = new RandomDelay(() =>
static bool _isTarNoNeedCast;
static RandomDelay _tarStopCastDelay = new RandomDelay(() =>
(Service.Configuration.StopCastingDelayMin, Service.Configuration.StopCastingDelayMax));
internal static void UpdateCastBarState()
{
var tardead = Service.Configuration.UseStopCasting ? Service.ObjectTable.SearchById(Service.ClientState.LocalPlayer.CastTargetObjectId)
is BattleChara b && b.CurrentHp == 0 : false;
_isTarDead = _tarDeadDelay.Delay(tardead);
var tardead = Service.Configuration.UseStopCasting ?
Service.ObjectTable.SearchById(Service.ClientState.LocalPlayer.CastTargetObjectId) is BattleChara b
&& (b is PlayerCharacter ? b.HasStatus(false, StatusID.Raise) : b.CurrentHp == 0 ): false;
_isTarNoNeedCast = _tarStopCastDelay.Delay(tardead);

bool canMove = !Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.OccupiedInEvent]
&& !Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.Casting];
Expand All @@ -82,7 +84,7 @@ internal static void UpdateCastBarState()
static readonly ByteColor _greenColor = new ByteColor() { A = 255, R = 60, G = 120, B = 30 };
private static unsafe void UpdateCastBar()
{
if (_isTarDead)
if (_isTarNoNeedCast)
{
UIState.Instance()->Hotbar.CancelCast();
}
Expand Down

0 comments on commit 2fd647a

Please sign in to comment.