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

Commit

Permalink
fix: fixed the ActionRemain.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 20, 2023
1 parent ae84281 commit fc77c0c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
16 changes: 15 additions & 1 deletion Resources/AnimationLockTime.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
"87": 0.6,
"95": 0.8,
"96": 0.8,
"2874": 0.6,
"2876": 0.6,
"2878": 0.6,
"2890": 0.6,
"3546": 0.6,
"3547": 0.6,
"3549": 0.6,
Expand Down Expand Up @@ -47,6 +51,11 @@
"7398": 0.6,
"7399": 0.6,
"7400": 0.6,
"7410": 0.6,
"7411": 0.6,
"7412": 0.6,
"7413": 0.6,
"7414": 0.6,
"7546": 0.6,
"7548": 0.6,
"9826": 0.1,
Expand All @@ -57,11 +66,16 @@
"16478": 0.8,
"16479": 0.6,
"16480": 1.5,
"16498": 0.6,
"16500": 0.6,
"16501": 0.6,
"17209": 0.6,
"25753": 1.15,
"25755": 0.6,
"25756": 0.6,
"25757": 0.6,
"25771": 0.6,
"25772": 0.6,
"25773": 0.6
"25773": 0.6,
"25788": 0.6
}
3 changes: 1 addition & 2 deletions RotationSolver.Basic/Actions/BaseItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ public unsafe bool CanUse(out IAction item)

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

if (CooldownHelper.RecastAfter((float)(DataCenter.NextActionTime - DateTime.Now).TotalSeconds,
remain, false)) return false;
if (CooldownHelper.RecastAfter(DataCenter.ActionRemain, remain, false)) return false;

if (OtherCheck != null && !OtherCheck()) return false;

Expand Down
9 changes: 3 additions & 6 deletions RotationSolver.Basic/DataCenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,19 +132,18 @@ public static unsafe ushort FateId
/// <summary>
/// Time to the next action
/// </summary>
public static float ActionRemain => (float)(NextActionTime - DateTime.Now).TotalSeconds;
public static unsafe float ActionRemain => (*(float*)((IntPtr)ActionManager.Instance() + 0x8));

public static float AbilityRemain
{
get
{
var gcdRemain = WeaponRemain;
var remain = (float)(NextActionTime - DateTime.Now).TotalSeconds;
if ((gcdRemain - 0.6f - Ping).IsLessThan(remain))
if ((gcdRemain - 0.6f - Ping).IsLessThan(ActionRemain))
{
return gcdRemain + 0.6f + Ping;
}
return remain;
return ActionRemain;
}
}

Expand Down Expand Up @@ -274,8 +273,6 @@ public static float RatioOfMembersIn2minsBurst
public static Queue<MacroItem> Macros { get; } = new Queue<MacroItem>();

#region Action Record
public static DateTime NextActionTime { get; set; }

const int QUEUECAPACITY = 32;
private static Queue<ActionRec> _actions = new Queue<ActionRec>(QUEUECAPACITY);
private static Queue<DamageRec> _damages = new Queue<DamageRec>(QUEUECAPACITY);
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Updaters/ActionUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ internal unsafe static void DoAction()
var nextAction = NextAction;
if (nextAction == null) return;

var timeToNext = (DataCenter.NextActionTime - DateTime.Now).TotalSeconds;
var timeToNext = DataCenter.ActionRemain;

//No time to use 0gcd
if (timeToNext + nextAction.AnimationLockTime
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Watcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private static void ActionFromSelf(uint sourceId, ActionEffectSet set, uint id)
if (set.Type != ActionType.Spell && set.Type != ActionType.Item) return;
if ((ActionCate)set.Action?.ActionCategory.Value.RowId == ActionCate.AutoAttack) return;

DataCenter.NextActionTime = DateTime.Now.AddSeconds(IActionHelper.AnimationLockTime[id] = set.AnimationLock);
DateTime.Now.AddSeconds(IActionHelper.AnimationLockTime[id] = set.AnimationLock);

if (!set.TargetEffects.Any()) return;
var flag = set.TargetEffects.FirstOrDefault()[0].Param2;
Expand Down

0 comments on commit fc77c0c

Please sign in to comment.