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 25, 2023
1 parent b4e4033 commit 701bfc7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 28 deletions.
34 changes: 9 additions & 25 deletions RotationSolver.Basic/DataCenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,26 +129,10 @@ public static unsafe ushort FateId

public static float WeaponElapsed { get; set; }

static float _lastRemain = 0;
/// <summary>
/// Time to the next action
/// </summary>
public static unsafe float ActionRemain
{
get
{
var remain = *(float*)((IntPtr)ActionManager.Instance() + 0x8);

var mayPing = _lastRemain - remain;
if (mayPing > 0.04f)
{
RealPing = mayPing;
}
_lastRemain = remain;

return remain;
}
}
public static unsafe float ActionRemain => *(float*)((IntPtr)ActionManager.Instance() + 0x8);

public static float AbilityRemain
{
Expand Down Expand Up @@ -340,18 +324,18 @@ public static unsafe void AddActionRec(Action act)
case ActionCate.Spell:
case ActionCate.WeaponSkill:
LastAction = LastGCD = id;
//if (ActionManager.GetAdjustedCastTime(ActionType.Spell, (uint)id) == 0)
//{
// RealPing = WeaponElapsed / 2;
//}
if (ActionManager.GetAdjustedCastTime(ActionType.Spell, (uint)id) == 0)
{
RealPing = WeaponElapsed;
}
break;
case ActionCate.Ability:
LastAction = LastAbility = id;

//if (!act.IsRealGCD() && ActionManager.GetMaxCharges((uint)id, Service.Player.Level) < 2)
//{
// RealPing = ActionManager.Instance()->GetRecastGroupDetail(act.CooldownGroup - 1)->Elapsed / 2;
//}
if (!act.IsRealGCD() && ActionManager.GetMaxCharges((uint)id, Service.Player.Level) < 2)
{
RealPing = ActionManager.Instance()->GetRecastGroupDetail(act.CooldownGroup - 1)->Elapsed;
}
break;
default:
return;
Expand Down
9 changes: 8 additions & 1 deletion RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"ConfigWindow_Header": "Rotation Solver Settings v",
"ConfigWindow_RotationItem": "Rotation",
"ConfigWindow_ParamItem": "Param",
"ConfigWindow_ListItem": "List",
"ConfigWindow_EventItem": "Event",
"ConfigWindow_ActionItem": "Action",
"ConfigWindow_ControlItem": "Control",
Expand Down Expand Up @@ -51,7 +52,9 @@
"ConfigWindow_Param_UseOverlayWindow": "Display Top Overlay",
"ConfigWindow_Param_UseOverlayWindowDesc": "This top window is used to display some extra information on your game window, such as target's positional, target and sub-target, etc.",
"ConfigWindow_Param_Basic": "Basic",
"ConfigWindow_Param_MaxPing": "Set your max Ping. If it is too low, may clip.",
"ConfigWindow_Param_ActionAhead": "Set the time advance of using actions",
"ConfigWindow_Param_MinLastAbilityAdvanced": "Set min the time advance of using the last 0gcd.",
"ConfigWindow_Param_CountDownAhead": "Set the time advance of using casting actions on counting down.",
"ConfigWindow_Param_SpecialDuration": "Set the duration of special windows set by commands",
"ConfigWindow_Param_AddDotGCDCount": "Set GCD advance of DOT refresh",
Expand Down Expand Up @@ -99,6 +102,7 @@
"ConfigWindow_Param_DrawPositional": "Draw Positional on the screen",
"ConfigWindow_Param_DrawMeleeRange": "Draw the range of melee on the screen",
"ConfigWindow_Param_DrawMeleeOffset": "Draw the offset of melee on the screen",
"ConfigWindow_Param_AlphaInFill": "The alpha value in fill.",
"ConfigWindow_Param_ShowMoveTarget": "Show the target of the move action",
"ConfigWindow_Param_ShowTarget": "Show Target",
"ConfigWindow_Param_PositionalFeedbackDesc": "Attention: Positional anticipation is experimental, just for reference only.",
Expand Down Expand Up @@ -168,7 +172,6 @@
"ConfigWindow_Param_RaiseBrinkOfDeath": "Raise player even has Brink of Death",
"ConfigWindow_Param_MoveAreaActionFarthest": "Moving Area Ability to farthest",
"ConfigWindow_Param_MoveAreaActionFarthestDesc": "Move to the furthest position from character's face direction.",
"ConfigWindow_Param_Hostile": "Hostile",
"ConfigWindow_Param_HostileDesc": "You can set the logic of hostile target selection to allow flexibility in switching the logic of selecting hostile in battle.",
"ConfigWindow_Param_AddHostileCondition": "Add selection condition",
"ConfigWindow_Param_HostileCondition": "Hostile target selection condition",
Expand Down Expand Up @@ -205,6 +208,10 @@
"ConfigWindow_Rotation_AutoUpdateRotations": "Auto Update Rotations.",
"ConfigWindow_Rotation_InvalidRotation": "Invalid Rotation! \nPlease update to the latest version or contact to the {0}!",
"ConfigWindow_Rotation_ResetToDefault": "Click to reset the rotation configuration to default!",
"ConfigWindow_List_Description": "In this window, you can set the parameters about some list things.",
"ConfigWindow_List_Hostile": "Hostile",
"ConfigWindow_List_Invinsibility": "Invincibility",
"ConfigWindow_List_DangerousStatus": "Dangerous Status",
"ActionSequencer_DragdropDescription": "Drag&drop to move,Ctrl+Alt+RightClick to delete.",
"ActionSequencer_SearchBar": "Search Bar",
"ActionSequencer_MustUse": "MustUse",
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/UI/RotationConfigWindow_Debug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private unsafe void DrawStatus()
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("Real Ping: " + DataCenter.RealPing.ToString());

ImGui.Text("Have pet: " + DataCenter.HasPet.ToString());
ImGui.Text("Hostile Near Count: " + DataCenter.NumberOfHostilesInRange.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 @@ -175,7 +175,7 @@ internal unsafe static void DoAction()
&& ActionManager.Instance()->QueuedActionId != NextAction.AdjustedID
|| Service.Player.CurrentHp == 0) return;

var maxAhead = Math.Max(DataCenter.MinAnimationLock - DataCenter.Ping - 0.03f, 0.08f);
var maxAhead = Math.Max(DataCenter.MinAnimationLock - DataCenter.RealPing - 0.03f, 0.08f);
var ahead = Math.Min(maxAhead, Service.Config.ActionAhead);

//GCD
Expand Down

0 comments on commit 701bfc7

Please sign in to comment.