From 7daca3077270edd7b08ad1d15b4683d2f3af50e3 Mon Sep 17 00:00:00 2001 From: mfoltz Date: Tue, 3 Dec 2024 00:09:35 -0600 Subject: [PATCH] - fixed bug with exo duration being used fully even on early exit, thank you Braia! --- Patches/ScriptSpawnServerPatch.cs | 4 ++-- Utilities/ExoFormUtilities.cs | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Patches/ScriptSpawnServerPatch.cs b/Patches/ScriptSpawnServerPatch.cs index 7dbe8a8..151807d 100644 --- a/Patches/ScriptSpawnServerPatch.cs +++ b/Patches/ScriptSpawnServerPatch.cs @@ -30,7 +30,7 @@ internal static class ScriptSpawnServerPatch static readonly PrefabGUID ExoFormBuff = new(-31099041); static readonly PrefabGUID InCombatBuff = new(581443919); - static readonly PrefabGUID MutantFromBiteBuff = new(-491525099); + static readonly PrefabGUID MutantFromBiteBloodBuff = new(-491525099); static readonly PrefabGUID FallenAngelDeathBuff = new(-1934189109); static readonly PrefabGUID FallenAngelDespawnBuff = new(1476380301); @@ -93,7 +93,7 @@ static void OnUpdatePrefix(ScriptSpawnServer __instance) if (playerClass.Equals(PlayerClass.DeathMage) && entity.GetBuffTarget().TryGetPlayer(out player)) { List perks = ConfigUtilities.ParseConfigIntegerString(ClassBuffMap[playerClass]).Select(x => new PrefabGUID(x)).ToList(); - int indexOfBuff = perks.IndexOf(MutantFromBiteBuff); + int indexOfBuff = perks.IndexOf(MutantFromBiteBloodBuff); if (indexOfBuff != -1) { diff --git a/Utilities/ExoFormUtilities.cs b/Utilities/ExoFormUtilities.cs index 7c55b64..2790f6d 100644 --- a/Utilities/ExoFormUtilities.cs +++ b/Utilities/ExoFormUtilities.cs @@ -94,6 +94,7 @@ public static IEnumerator ExoFormCountdown(Entity buffEntity, Entity playerEntit yield return new WaitForSeconds(countdownDelay); float countdown = 5f; + bool fullDuration = false; // Wait until there are 5 seconds left while (buffEntity.Exists() && countdown > 0f) @@ -115,9 +116,14 @@ public static IEnumerator ExoFormCountdown(Entity buffEntity, Entity playerEntit countdown--; yield return SecondDelay; + + if (countdown == 0f) + { + fullDuration = true; // Mark as used full duration + } } - UpdateFullExoFormChargeUsed(playerEntity.GetSteamId()); + if (fullDuration) UpdateFullExoFormChargeUsed(playerEntity.GetSteamId()); } public static void UpdateExoFormChargeStored(ulong steamId) {