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

Commit

Permalink
fix: fixed with ping.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 22, 2023
1 parent b8cadd5 commit dcd4578
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 10 deletions.
20 changes: 19 additions & 1 deletion Resources/AnimationLockTime.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@
"127": 0.1,
"132": 0.6,
"136": 0.6,
"141": 0.1,
"149": 0.6,
"152": 0.6,
"152": 0.1,
"153": 0.6,
"154": 0.1,
"156": 0.6,
Expand Down Expand Up @@ -85,8 +86,17 @@
"3582": 0.6,
"3587": 0.6,
"3590": 0.6,
"3593": 0.6,
"3595": 0.6,
"3596": 0.1,
"3600": 0.6,
"3601": 0.6,
"3606": 0.6,
"3608": 0.6,
"3610": 0.1,
"3612": 0.6,
"3614": 0.6,
"3615": 0.1,
"3617": 0.6,
"3621": 0.6,
"3623": 0.6,
Expand All @@ -98,6 +108,12 @@
"3640": 0.6,
"3643": 0.6,
"4262": 0.6,
"4401": 0.6,
"4402": 0.6,
"4403": 0.6,
"4404": 0.6,
"4405": 0.6,
"4406": 0.6,
"4574": 0.6,
"4639": 0.6,
"7383": 0.6,
Expand Down Expand Up @@ -151,6 +167,7 @@
"7557": 0.6,
"7561": 0.6,
"7562": 0.6,
"7568": 0.1,
"9826": 0.1,
"15989": 0.6,
"15990": 0.6,
Expand Down Expand Up @@ -263,6 +280,7 @@
"25839": 0.6,
"25840": 0.6,
"25865": 0.1,
"25870": 0.6,
"25876": 0.6,
"25885": 0.6
}
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Actions/BaseAction_ActionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public unsafe virtual bool CanUse(out IAction act, CanUseOption option = CanUseO
{
if (option.HasFlag(CanUseOption.OnLastAbility))
{
if (DataCenter.NextAbilityToNextGCD > AnimationLockTime + DataCenter.Ping + DataCenter.MinPing) return false;
if (DataCenter.NextAbilityToNextGCD > AnimationLockTime + DataCenter.Ping + DataCenter.MinAnimationLock) return false;
}
else if (!option.HasFlag(CanUseOption.IgnoreClippingCheck))
{
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Actions/BaseItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public unsafe bool CanUse(out IAction item)

var remain = RecastTimeOneCharge - RecastTimeElapsed;

if (DataCenter.NextAbilityToNextGCD > AnimationLockTime + DataCenter.Ping + DataCenter.MinPing) return false;
if (DataCenter.NextAbilityToNextGCD > AnimationLockTime + DataCenter.Ping + DataCenter.MinAnimationLock) return false;

if (CooldownHelper.RecastAfter(DataCenter.ActionRemain, remain, false)) return false;

Expand Down
14 changes: 11 additions & 3 deletions RotationSolver.Basic/DataCenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@ public static float DPSTaken
public static ActionID LastAbility { get; private set; } = 0;
public static float Ping { get; private set; } = 0.07f;

public const float MinPing = 0.6f;
public static void AddActionRec(Action act)
public const float MinAnimationLock = 0.6f;
public static unsafe void AddActionRec(Action act)
{
var id = (ActionID)act.RowId;

Expand All @@ -315,10 +315,18 @@ public static void AddActionRec(Action act)
case ActionCate.Spell:
case ActionCate.WeaponSkill:
LastAction = LastGCD = id;
Ping = WeaponElapsed;
if (ActionManager.GetAdjustedCastTime(ActionType.Spell, (uint)id) == 0)
{
Ping = WeaponElapsed;
}
break;
case ActionCate.Ability:
LastAction = LastAbility = id;

if (!act.IsRealGCD() && ActionManager.GetMaxCharges((uint)id, Service.Player.Level) < 2)
{
Ping = ActionManager.Instance()->GetRecastGroupDetail(act.CooldownGroup - 1)->Elapsed;
}
break;
default:
return;
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Rotations/CustomRotation_GCD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private bool RaiseSpell(SpecialCommandType specialType, out IAction act, bool mu
}
}
else if (Service.Config.GetValue(SettingsCommand.RaisePlayerBySwift) && !Swiftcast.IsCoolingDown
&& DataCenter.NextAbilityToNextGCD > DataCenter.MinPing + DataCenter.Ping)
&& DataCenter.NextAbilityToNextGCD > DataCenter.MinAnimationLock + DataCenter.Ping)
{
return DataCenter.SetAutoStatus(AutoStatus.Raise, true);
}
Expand Down
3 changes: 2 additions & 1 deletion RotationSolver.Basic/Rotations/CustomRotation_Invoke.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ private IAction Invoke(out IAction gcdAction)

if (gcdAction != null)
{
if (DataCenter.NextAbilityToNextGCD < DataCenter.MinPing + DataCenter.Ping || DataCenter.WeaponTotal < DataCenter.CastingTotal) return gcdAction;
if (DataCenter.NextAbilityToNextGCD < DataCenter.MinAnimationLock + DataCenter.Ping
|| DataCenter.WeaponTotal < DataCenter.CastingTotal) return gcdAction;

if (Ability(gcdAction, out IAction ability, helpDefenseAOE, helpDefenseSingle)) return ability;

Expand Down
4 changes: 3 additions & 1 deletion RotationSolver/UI/RotationConfigWindow_Debug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ 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("TimeToNext: " + DataCenter.NextAbilityToNextGCD.ToString());
ImGui.Text("WeaponElapsed: " + DataCenter.WeaponElapsed.ToString());
ImGui.Text("AnimationLock: " + DataCenter.ActionRemain.ToString());
ImGui.Text("Ping: " + DataCenter.Ping.ToString());

ImGui.Text("Have pet: " + DataCenter.HasPet.ToString());
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Updaters/ActionUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ internal unsafe static void DoAction()
if (DataCenter.WeaponElapsed <= DataCenter.CastingTotal) return;

//The last one.
if (timeToNext + nextAction.AnimationLockTime + DataCenter.Ping + DataCenter.MinPing > DataCenter.WeaponRemain)
if (timeToNext + nextAction.AnimationLockTime + DataCenter.Ping + DataCenter.MinAnimationLock > DataCenter.WeaponRemain)
{
if (DataCenter.WeaponRemain > nextAction.AnimationLockTime + DataCenter.Ping + Service.Config.ActionAhead) return;
RSCommands.DoAnAction(false);
Expand Down

0 comments on commit dcd4578

Please sign in to comment.