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

Commit

Permalink
fix: add an advanced of ability clicking.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 25, 2023
1 parent b5eddf8 commit b4e4033
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 13 deletions.
1 change: 1 addition & 0 deletions RotationSolver.Basic/Configuration/PluginConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public class PluginConfiguration : IPluginConfiguration
public bool TargetFriendly = false;
public float AlphaInFill = 0.15f;
public int MaxPing = 200;
public float MinLastAbilityAdvanced = 0.1f;

public SortedSet<uint> DangerousStatus { get; set; } = new SortedSet<uint>()
{
Expand Down
38 changes: 27 additions & 11 deletions RotationSolver.Basic/DataCenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,35 @@ 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 => (*(float*)((IntPtr)ActionManager.Instance() + 0x8));
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 float AbilityRemain
{
get
{
var gcdRemain = WeaponRemain;
if ((gcdRemain - 0.6f - Ping).IsLessThan(ActionRemain))
if ((gcdRemain - MinAnimationLock - Ping).IsLessThan(ActionRemain))
{
return gcdRemain + 0.6f + Ping;
return gcdRemain + MinAnimationLock + Ping;
}
return ActionRemain;
}
Expand Down Expand Up @@ -324,18 +340,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;
}
//if (ActionManager.GetAdjustedCastTime(ActionType.Spell, (uint)id) == 0)
//{
// RealPing = WeaponElapsed / 2;
//}
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;
}
//if (!act.IsRealGCD() && ActionManager.GetMaxCharges((uint)id, Service.Player.Level) < 2)
//{
// RealPing = ActionManager.Instance()->GetRecastGroupDetail(act.CooldownGroup - 1)->Elapsed / 2;
//}
break;
default:
return;
Expand Down
2 changes: 2 additions & 0 deletions RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ internal partial class Strings
public string ConfigWindow_Param_MaxPing { get; set; } = "Set your max Ping. If it is too low, may clip.";

public string ConfigWindow_Param_ActionAhead { get; set; } = "Set the time advance of using actions";
public string ConfigWindow_Param_MinLastAbilityAdvanced { get; set; } = "Set min the time advance of using the last 0gcd.";

public string ConfigWindow_Param_CountDownAhead { get; set; } = "Set the time advance of using casting actions on counting down.";
public string ConfigWindow_Param_SpecialDuration { get; set; } = "Set the duration of special windows set by commands";
public string ConfigWindow_Param_AddDotGCDCount { get; set; } = "Set GCD advance of DOT refresh";
Expand Down
5 changes: 4 additions & 1 deletion RotationSolver/UI/RotationConfigWindow_Param.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ private void DrawParamBasic()
ImGui.Text(" Your Ping: " + DataCenter.RealPing.ToString("F3"));

DrawFloatNumber(LocalizationManager.RightLang.ConfigWindow_Param_ActionAhead,
ref Service.Config.ActionAhead, Service.Default.ActionAhead, max: 0.4f);
ref Service.Config.ActionAhead, Service.Default.ActionAhead, max: 0.5f);

DrawFloatNumber(LocalizationManager.RightLang.ConfigWindow_Param_MinLastAbilityAdvanced,
ref Service.Config.MinLastAbilityAdvanced, Service.Default.MinLastAbilityAdvanced, max: 0.4f);

DrawFloatNumber(LocalizationManager.RightLang.ConfigWindow_Param_CountDownAhead,
ref Service.Config.CountDownAhead, Service.Default.CountDownAhead, min: 0.5f, max: 0.7f);
Expand Down
4 changes: 3 additions & 1 deletion RotationSolver/Updaters/ActionUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ internal unsafe static void DoAction()
//The last one.
if (timeToNext + nextAction.AnimationLockTime + DataCenter.Ping + DataCenter.MinAnimationLock > DataCenter.WeaponRemain)
{
if (DataCenter.WeaponRemain > nextAction.AnimationLockTime + DataCenter.Ping + ahead) return;
if (DataCenter.WeaponRemain > nextAction.AnimationLockTime + ahead +
Math.Max(DataCenter.Ping, Service.Config.MinLastAbilityAdvanced)) return;

RSCommands.DoAnAction(false);
}
else if (timeToNext < ahead)
Expand Down

0 comments on commit b4e4033

Please sign in to comment.