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

Commit

Permalink
fix: add ping property.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 20, 2023
1 parent fed23fc commit e136ddc
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 17 deletions.
2 changes: 2 additions & 0 deletions RotationSolver.Basic/DataCenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ public static float DPSTaken
public static ActionID LastGCD { get; private set; } = 0;

public static ActionID LastAbility { get; private set; } = 0;
public static float Ping { get; private set; } = 0.07f;
public static void AddActionRec(Action act)
{
var id = (ActionID)act.RowId;
Expand All @@ -298,6 +299,7 @@ public static void AddActionRec(Action act)
case ActionCate.Spell:
case ActionCate.WeaponSkill:
LastAction = LastGCD = id;
Ping = WeaponElapsed;
break;
case ActionCate.Ability:
LastAction = LastAbility = id;
Expand Down
33 changes: 19 additions & 14 deletions RotationSolver/Commands/RSCommands_Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,31 @@ internal static unsafe void DoAnAction(bool isGCD)
return;
}

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

if (Service.Config.KeyBoardNoise)
PreviewUpdater.PulseActionBar(nextAction.AdjustedID);

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

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);
}
}

}
else if (Service.Config.KeyBoardNoise)
{
PreviewUpdater.PulseActionBar(nextAction.AdjustedID);
}
return;
}
Expand Down
1 change: 1 addition & 0 deletions RotationSolver/UI/RotationConfigWindow_Debug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ private unsafe void DrawStatus()
ImGui.Text("TerritoryType: " + DataCenter.TerritoryContentType.ToString());
ImGui.Text("DPSTaken: " + DataCenter.DPSTaken.ToString());
ImGui.Text("AnimationLock: " + (*(float*)((IntPtr)ActionManager.Instance() + 0x8)).ToString());
ImGui.Text("Ping: " + DataCenter.Ping.ToString());

ImGui.Text("Have pet: " + DataCenter.HasPet.ToString());
ImGui.Text("Hostile Near Count: " + DataCenter.NumberOfHostilesInRange.ToString());
Expand Down
6 changes: 3 additions & 3 deletions RotationSolver/Updaters/ActionUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ internal unsafe static void DoAction()
if (_GCDDelay.Delay(canUseGCD)) RSCommands.DoAnAction(true);
if (canUseGCD) return;

var ping = 0.06f;
var nextAction = NextAction;
if (nextAction == null) return;

Expand All @@ -218,9 +217,10 @@ internal unsafe static void DoAction()
if (DataCenter.WeaponElapsed <= DataCenter.CastingTotal) return;

//The last one.
if (timeToNext + nextAction.AnimationLockTime +ping + 0.6f > DataCenter.WeaponRemain)
var ping = 0.06f;
if (timeToNext + nextAction.AnimationLockTime + ping + 0.6f > DataCenter.WeaponRemain)
{
if (DataCenter.WeaponRemain > nextAction.AnimationLockTime + Service.Config.ActionAhead) return;
if (DataCenter.WeaponRemain > nextAction.AnimationLockTime + ping + Service.Config.ActionAhead) return;
RSCommands.DoAnAction(false);
}
else if (timeToNext < Service.Config.ActionAhead)
Expand Down

0 comments on commit e136ddc

Please sign in to comment.