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

Commit

Permalink
feat: add a auto cancel for casting, Maybe.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Feb 1, 2023
1 parent 67e3273 commit d40f88e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions RotationSolver/Updaters/PreviewUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,31 @@ private static void UpdateEntry()
}

static bool _canMove;
static bool _isTarDead;
internal static void UpdateCastBarState()
{
_isTarDead = Service.ObjectTable.SearchById(Service.ClientState.LocalPlayer.CastTargetObjectId)
is BattleChara b && b.CurrentHp == 0;

bool canMove = !Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.OccupiedInEvent]
&& !Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.Casting];

var isTarDead = Service.ObjectTable.SearchById(Service.ClientState.LocalPlayer.CastTargetObjectId)
is BattleChara b && b.CurrentHp == 0;

//For lock
var specialStatus = Service.ClientState.LocalPlayer.HasStatus(true, StatusID.PhantomFlurry, StatusID.TenChiJin);

MovingUpdater.IsMoving = _canMove = specialStatus ? false : (canMove || isTarDead);
MovingUpdater.IsMoving = _canMove = specialStatus ? false : canMove;
}

static bool _showCanMove;
static readonly ByteColor _redColor = new ByteColor() { A = 255, R = 120, G = 0, B = 60 };
static readonly ByteColor _greenColor = new ByteColor() { A = 255, R = 60, G = 120, B = 30 };
private static unsafe void UpdateCastBar()
{
if (_isTarDead)
{
RSCommands.SubmitToChat("/acan");
}

var nowMove = _canMove && Service.Configuration.CastingDisplay;
if (nowMove == _showCanMove) return;
_showCanMove = nowMove;
Expand Down

0 comments on commit d40f88e

Please sign in to comment.