From b1572f583298f56fa5b109efef1dfdd70138bc61 Mon Sep 17 00:00:00 2001 From: kaiser Date: Sun, 15 Sep 2024 10:23:43 +1000 Subject: [PATCH] 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. --- .../Controller/Steps/Interactions/Action.cs | 20 +++++++++++++++---- Questionable/Functions/GameFunctions.cs | 5 +++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Questionable/Controller/Steps/Interactions/Action.cs b/Questionable/Controller/Steps/Interactions/Action.cs index 6d4da2206..a39bded4c 100644 --- a/Questionable/Controller/Steps/Interactions/Action.cs +++ b/Questionable/Controller/Steps/Interactions/Action.cs @@ -1,9 +1,6 @@ using System; using System.Collections.Generic; -using Dalamud.Game.ClientState.Conditions; using Dalamud.Game.ClientState.Objects.Types; -using FFXIVClientStructs.FFXIV.Client.Game; -using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Questionable.Controller.Steps.Common; using Questionable.Functions; @@ -60,6 +57,21 @@ internal static class Action 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); _continueAt = DateTime.Now.AddSeconds(0.5); return true; @@ -105,4 +117,4 @@ internal static class Action public override string ToString() => $"Action({action})"; } -} +} \ No newline at end of file diff --git a/Questionable/Functions/GameFunctions.cs b/Questionable/Functions/GameFunctions.cs index 07fb8c370..2cc2e1226 100644 --- a/Questionable/Functions/GameFunctions.cs +++ b/Questionable/Functions/GameFunctions.cs @@ -308,6 +308,11 @@ internal sealed unsafe class GameFunctions StatusManager* statusManager = battleChara->GetStatusManager(); return statusManager->HasStatus(statusId); } + + public static bool RemoveStatus(uint statusId) + { + return StatusManager.ExecuteStatusOff(statusId); + } public bool Mount() {