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

Commit

Permalink
Fix negative status durations
Browse files Browse the repository at this point in the history
  • Loading branch information
Taurenkey committed Aug 16, 2024
1 parent 711117f commit 1d4d446
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions XIVSlothCombo/CustomCombo/Functions/Status.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Game.ClientState.Statuses;
using FFXIVClientStructs.FFXIV.Client.Game;
using XIVSlothCombo.Data;
using XIVSlothCombo.Services;
using Status = Dalamud.Game.ClientState.Statuses.Status;

namespace XIVSlothCombo.CustomComboNS.Functions
{
Expand All @@ -18,10 +20,12 @@ public static byte GetBuffStacks(ushort effectId)
return eff?.StackCount ?? 0;
}

public static float GetBuffRemainingTime(ushort effectId)
public unsafe static float GetBuffRemainingTime(ushort effectId)
{
Status? eff = FindEffect(effectId);
return eff?.RemainingTime ?? 0;
if (eff is null) return 0;
if (eff.RemainingTime < 0) return (eff.RemainingTime * -1) + ActionManager.Instance()->AnimationLock;
return eff.RemainingTime;
}

/// <summary> Finds an effect on the player. The effect must be owned by the player or unowned. </summary>
Expand All @@ -40,10 +44,12 @@ public static float GetBuffRemainingTime(ushort effectId)
public static Status? FindTargetEffect(ushort effectID) => FindEffect(effectID, CurrentTarget, LocalPlayer?.GameObjectId);

/// <summary></summary>
public static float GetDebuffRemainingTime(ushort effectId)
public unsafe static float GetDebuffRemainingTime(ushort effectId)
{
Status? eff = FindTargetEffect(effectId);
return eff?.RemainingTime ?? 0;
if (eff is null) return 0;
if (eff.RemainingTime < 0) return (eff.RemainingTime * -1) + ActionManager.Instance()->AnimationLock;
return eff.RemainingTime;
}

/// <summary> Find if an effect on the player exists. The effect may be owned by anyone or unowned. </summary>
Expand Down

0 comments on commit 1d4d446

Please sign in to comment.