Skip to content

Commit

Permalink
Merge pull request #76 from FFXIV-CombatReborn/action-timings-gut
Browse files Browse the repository at this point in the history
Removed all action timings
  • Loading branch information
NostraThomas99 authored Apr 7, 2024
2 parents 2063ef3 + da802ff commit ea28cec
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 113 deletions.
20 changes: 1 addition & 19 deletions RotationSolver.Basic/Configuration/Configs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,6 @@ public const string
Filter = TimelineFilter)]
private static readonly bool _enableTimelineMovement = false;

[UI("The max ping that RSR can get to before skipping to the next action.", Description = "(If you set too low, RSR will skip oGCDs)",
Filter = BasicTimer)]
[Range(0.01f, 0.5f, ConfigUnitType.Seconds, 0.002f)]
public float MaxPing { get; set; } = 0.5f;

[UI("Use additional conditions", Filter = BasicParams)]
public bool UseAdditionalConditions { get; set; } = false;
Expand Down Expand Up @@ -460,11 +456,6 @@ public const string
[Range(0, 5, ConfigUnitType.Yalms, 0.02f)]
public float MeleeRangeOffset { get; set; } = 1;

[UI("The minimum time ahead that the last oGCD ability can be used before the next GCD ability becomes available to use.", Description = "(Adjust to prevent clipping and allow weaving)",
Filter = BasicTimer)]
[Range(0, 0.4f, ConfigUnitType.Seconds, 0.002f)]
public float MinLastAbilityAdvanced { get; set; } = 0.06f;

[UI("When their minimum HP is lower than this.", Parent = nameof(HealWhenNothingTodo))]
[Range(0, 1, ConfigUnitType.Percent, 0.002f)]
public float HealWhenNothingTodoBelow { get; set; } = 0.8f;
Expand Down Expand Up @@ -496,16 +487,11 @@ public const string
[Range(1, 20, ConfigUnitType.Seconds, 1f)]
public float SpecialDuration { get; set; } = 3;

[UI("The amount of time before an oGCD is available to actually use for RSR to decide which to use.",
Filter = BasicTimer)]
[Range(0, 0.5f, ConfigUnitType.Seconds, 0.002f)]
public float ActionAheadForLast0GCD { get; set; } = 0.01f;

[UI("Range of time before locking onto aggro'd or new target to attack", Description = "(Do not set too low, can rip newly aggro'd dungeon mobs off tanks).", Filter =TargetConfig)]
[Range(0, 3, ConfigUnitType.Seconds)]
public Vector2 TargetDelay { get; set; } = new(1, 2);

[UI("GCD Action Execution Delay.\n(RSR will not take actions during window).",
[UI("Action Execution Delay.\n(RSR will not take actions during window).",
Filter = BasicTimer)]
[Range(0, 1, ConfigUnitType.Seconds, 0.002f)]
public Vector2 WeaponDelay { get; set; } = new(0, 0);
Expand Down Expand Up @@ -722,10 +708,6 @@ public const string
PvEFilter = JobFilterType.Tank)]
private readonly float _healthForAutoDefense = 1;

[JobConfig, Range(0, 0.5f, ConfigUnitType.Seconds)]
[UI("Action Ahead (How far ahead of a oGCD/GCD use does RSR decide which oGCD/GCD to use)", Filter = BasicTimer)]
private readonly float _actionAhead = 0.08f;

[JobConfig, UI("Engage settings", Filter = TargetConfig, PvPFilter = JobFilterType.NoJob)]
private readonly TargetHostileType _hostileType = TargetHostileType.AllTargetsWhenSolo;

Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/DataCenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,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 => Math.Min(Math.Min(RTT, FetchTime), Service.Config.MaxPing);
public static float Ping => Math.Max(RTT, FetchTime);

public static float RTT { get; internal set; } = 0.05f;
public static float FetchTime { get; private set; } = 0.05f;
Expand Down
88 changes: 0 additions & 88 deletions RotationSolver/UI/RotationConfigWindow_Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,94 +100,6 @@ private static void AddPingLockTime(ImDrawListPtr drawList, Vector2 lineStart, f
}
private static void DrawBasicTimer()
{
var gcdTime = DataCenter.WeaponTotal;
if (gcdTime == 0) gcdTime = 2.5f;
var wholeWidth = ImGui.GetWindowWidth();
var ping = DataCenter.Ping;

ImGui.PushFont(DrawingExtensions.GetFont(14));
ImGui.PushStyleColor(ImGuiCol.Text, ImGui.ColorConvertFloat4ToU32(ImGuiColors.DalamudYellow));
var infoText = $"GCD: {gcdTime:F2}s Ping: {ping:F2}s";
var infoSize = ImGui.CalcTextSize(infoText);

ImGuiHelper.DrawItemMiddle(() =>
{
ImGui.Text(infoText);
}, wholeWidth, infoSize.X);
ImGui.PopStyleColor();
ImGui.PopFont();

var actionAhead = Service.Config.ActionAhead;
var minAbilityAhead = Service.Config.MinLastAbilityAdvanced;
var animationLockTime = DataCenter.MinAnimationLock;
var weaponDelay = (Service.Config.WeaponDelay.X == 0 ? 0.05f : Service.Config.WeaponDelay.X + Service.Config.WeaponDelay.Y == 0 ? 0.05f : Service.Config.WeaponDelay.Y) / 2;
var clickingDelay = (Service.Config.ClickingDelay.X == 0 ? 0.05f : Service.Config.ClickingDelay.X + Service.Config.ClickingDelay.Y == 0 ? 0.05f : Service.Config.ClickingDelay.Y) / 2;

var drawList = ImGui.GetWindowDrawList();
ImGui.Spacing();
var startCursorPt = ImGui.GetCursorPos();
var windowsPos = ImGui.GetWindowPos();

var sizePerTime = (wholeWidth - gcdSize) / (gcdTime + weaponDelay + actionAhead);

var lineStart = windowsPos + startCursorPt + new Vector2(sizePerTime * actionAhead, gcdSize + spacingHeight);
ImGuiHelper.DrawActionOverlay(startCursorPt + new Vector2(sizePerTime * actionAhead, 0), gcdSize, 0);
ImGuiHelper.DrawActionOverlay(startCursorPt + new Vector2(wholeWidth - gcdSize, 0), gcdSize, 0);

AddPingLockTime(drawList, lineStart, sizePerTime, ping, animationLockTime, actionAhead, ADVANCE_TIME_COLOR, clickingDelay);
var start = lineStart + new Vector2(gcdTime * sizePerTime, 0);
var rectSize = new Vector2(weaponDelay * sizePerTime, pingHeight);
drawList.AddRectFilled(start, start + rectSize, WEAPON_DELAY_COLOR);
drawList.AddRect(start, start + rectSize, uint.MaxValue, 0, ImDrawFlags.Closed, 2);
if (ImGuiHelper.IsInRect(start, rectSize))
{
ImguiTooltips.ShowTooltip(typeof(Configs).GetProperty(nameof(Configs.WeaponDelay))!.Local());
}
drawList.AddLine(lineStart + new Vector2((gcdTime + weaponDelay) * sizePerTime, -spacingHeight), lineStart + new Vector2((gcdTime + weaponDelay) * sizePerTime,
pingHeight * 2 + spacingHeight), IDEAL_CLICK_TIME_COLOR, 2);

ImGui.PushFont(DrawingExtensions.GetFont(20));
const string gcdText = "GCD";
var size = ImGui.CalcTextSize(gcdText);
ImGui.SetCursorPos(startCursorPt + new Vector2(sizePerTime * actionAhead + (gcdSize - size.X) / 2, (gcdSize - size.Y) / 2));
ImGui.Text(gcdText);
ImGui.SetCursorPos(startCursorPt + new Vector2(wholeWidth - gcdSize + (gcdSize - size.X) / 2, (gcdSize - size.Y) / 2));
ImGui.Text(gcdText);
ImGui.PopFont();

ImGui.PushFont(DrawingExtensions.GetFont(14));
const string ogcdText = "Off-\nGCD";
size = ImGui.CalcTextSize(ogcdText);
ImGui.PopFont();

var timeStep = ping + animationLockTime;
var time = timeStep;
while (time < gcdTime - timeStep)
{
var isLast = time + 2 * timeStep > gcdTime;
if (isLast)
{
time = gcdTime - timeStep;
}

ImGuiHelper.DrawActionOverlay(startCursorPt + new Vector2(sizePerTime * (actionAhead + time), 0), ogcdSize, 0);
ImGui.SetCursorPos(startCursorPt + new Vector2(sizePerTime * (actionAhead + time) + (ogcdSize - size.X) / 2, (ogcdSize - size.Y) / 2));

ImGui.PushFont(DrawingExtensions.GetFont(14));
ImGui.Text(ogcdText);
ImGui.PopFont();

var ogcdStart = lineStart + new Vector2(time * sizePerTime, 0);
AddPingLockTime(drawList, ogcdStart, sizePerTime, ping, animationLockTime,
isLast ? MathF.Max(minAbilityAhead, actionAhead) : actionAhead, isLast ? ADVANCE_ABILITY_TIME_COLOR : ADVANCE_TIME_COLOR, clickingDelay);

time += timeStep;
}

ImGui.SetCursorPosY(startCursorPt.Y + gcdSize + pingHeight * 2 + 2 * spacingHeight + ImGui.GetStyle().ItemSpacing.Y);

ImGui.Spacing();

_allSearchable.DrawItems(Configs.BasicTimer);
}

Expand Down
9 changes: 4 additions & 5 deletions RotationSolver/Updaters/ActionUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,10 @@ internal unsafe static bool CanDoAction()
&& ActionManager.Instance()->QueuedActionId != NextAction.AdjustedID
|| Player.Object.CurrentHp == 0) return false;

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

//GCD
var canUseGCD = DataCenter.WeaponRemain <= ahead;
var canUseGCD = DataCenter.WeaponRemain <= maxAhead;
if (_GCDDelay.Delay(canUseGCD))
{
return RSCommands.CanDoAnAction(true);
Expand All @@ -306,11 +305,11 @@ internal unsafe static bool CanDoAction()
if (timeToNext + nextAction.AnimationLockTime + DataCenter.Ping + DataCenter.MinAnimationLock > DataCenter.WeaponRemain)
{
if (DataCenter.WeaponRemain > nextAction.AnimationLockTime + DataCenter.Ping +
Math.Max(ahead, Service.Config.MinLastAbilityAdvanced)) return false;
maxAhead) return false;

return RSCommands.CanDoAnAction(false);
}
else if (timeToNext < ahead)
else if (timeToNext < maxAhead)
{
return RSCommands.CanDoAnAction(false);
}
Expand Down

0 comments on commit ea28cec

Please sign in to comment.