feat: added a way to remove status for gameFunctions.

Also updated the Action a bit, that way SGE doesn't get stuck when using diagnosis.
This commit is contained in:
kaiser 2024-09-15 10:23:43 +10:00
parent 2a2e3cafb9
commit b1572f5832
2 changed files with 21 additions and 4 deletions

View File

@ -1,9 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Dalamud.Game.ClientState.Conditions;
using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Game.ClientState.Objects.Types;
using FFXIVClientStructs.FFXIV.Client.Game;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Questionable.Controller.Steps.Common; using Questionable.Controller.Steps.Common;
using Questionable.Functions; using Questionable.Functions;
@ -60,6 +57,21 @@ internal static class Action
if (gameObject.IsTargetable) if (gameObject.IsTargetable)
{ {
if (action == EAction.Diagnosis)
{
uint eukrasiaAura = 2606;
// If SGE have Eukrasia status, we need to remove it.
if (gameFunctions.HasStatus(eukrasiaAura))
{
if (GameFunctions.RemoveStatus(eukrasiaAura))
{
// Introduce a delay of 2 seconds before using the next action (otherwise it will try and use Eukrasia Diagnosis)
_continueAt = DateTime.Now.AddSeconds(2);
return true;
}
}
}
_usedAction = gameFunctions.UseAction(gameObject, action); _usedAction = gameFunctions.UseAction(gameObject, action);
_continueAt = DateTime.Now.AddSeconds(0.5); _continueAt = DateTime.Now.AddSeconds(0.5);
return true; return true;

View File

@ -309,6 +309,11 @@ internal sealed unsafe class GameFunctions
return statusManager->HasStatus(statusId); return statusManager->HasStatus(statusId);
} }
public static bool RemoveStatus(uint statusId)
{
return StatusManager.ExecuteStatusOff(statusId);
}
public bool Mount() public bool Mount()
{ {
if (_condition[ConditionFlag.Mounted]) if (_condition[ConditionFlag.Mounted])