From 856226821232f10dece5edb733a0ad2580cf0633 Mon Sep 17 00:00:00 2001 From: beanZ9 <248049379+beanZ9@users.noreply.github.com> Date: Mon, 27 Jul 2026 01:37:32 +0200 Subject: [PATCH 1/2] feat: add recoverAmount and mods to FlaskInfo; fix: CanBeUsed and ChargesUsed on some uniques --- State/FlaskInfo.cs | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/State/FlaskInfo.cs b/State/FlaskInfo.cs index 49d320d..85d6905 100644 --- a/State/FlaskInfo.cs +++ b/State/FlaskInfo.cs @@ -1,10 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using ExileCore; +using ExileCore; using ExileCore.PoEMemory.Components; using ExileCore.PoEMemory.MemoryObjects; using ExileCore.Shared.Enums; +using ExileCore.Shared.Helpers; +using System; +using System.Collections.Generic; +using System.Linq; namespace ReAgent.State; @@ -15,10 +16,12 @@ public record FlaskInfo( [property: Api] int Charges, [property: Api] int MaxCharges, [property: Api] int ChargesPerUse, + [property: Api] int RecoverAmount, [property: Api] string ClassName, [property: Api] string BaseName, [property: Api] string UniqueName, - [property: Api] float CanBeUsedIn) + [property: Api] float CanBeUsedIn, + [property: Api] List Mods) { [Api] public string Name => !string.IsNullOrEmpty(UniqueName) ? UniqueName : BaseName; @@ -32,12 +35,13 @@ public static FlaskInfo From( { if (flaskItem?.Address is 0 or null || flaskItem.Item?.Address is null or 0) { - return new FlaskInfo(false, false, 0, 1, 1, "", "", "", 100); + return new FlaskInfo(false, false, 0, 1, 1, 0, "", "", "", 100, new List()); } var active = false; var canBeUsedIn = 0f; bool canbeUsed = false; + int chargesUsed = 0; var chargeComponent = flaskItem.Item.GetComponent(); if (state.Player.TryGetComponent(out var playerBuffs)) { @@ -45,7 +49,12 @@ public static FlaskInfo From( { var buffNames = GetFlaskBuffNames(flask); active = playerBuffs.BuffsList.Any(b => buffNames.Contains(b.Name) && b.FlaskSlot == index); - canbeUsed = (chargeComponent?.NumCharges ?? 0) >= (chargeComponent?.ChargesPerUse ?? 1); + chargesUsed = chargeComponent?.ChargesPerUse ?? 1; + var flaskStatsC = flaskItem.Item?.GetComponent(); + if (flaskStatsC?.StatDictionary != null && flaskStatsC.StatDictionary.TryGetValue(GameStat.LocalChargesUsedPct, out var chargesUsedPct)) { + chargesUsed = (int) Math.Floor((double)(chargesUsed * (100 + chargesUsedPct) / 100)); + } + canbeUsed = (chargeComponent?.NumCharges ?? 0) >= chargesUsed; } if (flaskItem.Item.TryGetComponent(out var tincture)) @@ -92,12 +101,22 @@ public static FlaskInfo From( } var uniqueName = ""; - if (flaskItem.Item.TryGetComponent(out var mods)) + var modsList = new List(); + if (flaskItem.Item.TryGetComponent(out var modsC)) + { + uniqueName = modsC.UniqueName; + modsList = modsC.ExplicitMods; + } + + var recoveryAmount = 0; + if (flaskItem.Item.TryGetComponent(out var FlaskC)) { - uniqueName = mods.UniqueName; + if (FlaskC.LifeRecover > 0) recoveryAmount = FlaskC.LifeRecover; + if (FlaskC.ManaRecover > 0) recoveryAmount = FlaskC.ManaRecover; } - return new FlaskInfo(active, canbeUsed, chargeComponent?.NumCharges ?? 0, chargeComponent?.ChargesMax ?? 1, chargeComponent?.ChargesPerUse ?? 1, className, baseName, uniqueName, canBeUsedIn); + return new FlaskInfo(active, canbeUsed, chargeComponent?.NumCharges ?? 0, chargeComponent?.ChargesMax ?? 1, + chargesUsed, recoveryAmount, className, baseName, uniqueName, canBeUsedIn, modsList); } private static float CalculateTinctureCanBeUsedIn(GameController state, List flaskItems, RuleInternalState internalState) From 5cec0e28fd386514550579fe9db94343714babb5 Mon Sep 17 00:00:00 2001 From: beanZ9 <248049379+beanZ9@users.noreply.github.com> Date: Mon, 27 Jul 2026 21:54:31 +0200 Subject: [PATCH 2/2] feat: split recover amount in life and mana --- State/FlaskInfo.cs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/State/FlaskInfo.cs b/State/FlaskInfo.cs index 85d6905..1a0323d 100644 --- a/State/FlaskInfo.cs +++ b/State/FlaskInfo.cs @@ -16,7 +16,8 @@ public record FlaskInfo( [property: Api] int Charges, [property: Api] int MaxCharges, [property: Api] int ChargesPerUse, - [property: Api] int RecoverAmount, + [property: Api] int LifeRecover, + [property: Api] int ManaRecover, [property: Api] string ClassName, [property: Api] string BaseName, [property: Api] string UniqueName, @@ -35,13 +36,15 @@ public static FlaskInfo From( { if (flaskItem?.Address is 0 or null || flaskItem.Item?.Address is null or 0) { - return new FlaskInfo(false, false, 0, 1, 1, 0, "", "", "", 100, new List()); + return new FlaskInfo(false, false, 0, 1, 1, 0, 0, "", "", "", 100, new List()); } var active = false; var canBeUsedIn = 0f; bool canbeUsed = false; int chargesUsed = 0; + int lifeRecover = 0; + int manaRecover = 0; var chargeComponent = flaskItem.Item.GetComponent(); if (state.Player.TryGetComponent(out var playerBuffs)) { @@ -52,9 +55,11 @@ public static FlaskInfo From( chargesUsed = chargeComponent?.ChargesPerUse ?? 1; var flaskStatsC = flaskItem.Item?.GetComponent(); if (flaskStatsC?.StatDictionary != null && flaskStatsC.StatDictionary.TryGetValue(GameStat.LocalChargesUsedPct, out var chargesUsedPct)) { - chargesUsed = (int) Math.Floor((double)(chargesUsed * (100 + chargesUsedPct) / 100)); + chargesUsed = chargesUsed * (100 + chargesUsedPct) / 100; } canbeUsed = (chargeComponent?.NumCharges ?? 0) >= chargesUsed; + lifeRecover = flask?.LifeRecover ?? 0; + manaRecover = flask?.ManaRecover ?? 0; } if (flaskItem.Item.TryGetComponent(out var tincture)) @@ -108,15 +113,8 @@ public static FlaskInfo From( modsList = modsC.ExplicitMods; } - var recoveryAmount = 0; - if (flaskItem.Item.TryGetComponent(out var FlaskC)) - { - if (FlaskC.LifeRecover > 0) recoveryAmount = FlaskC.LifeRecover; - if (FlaskC.ManaRecover > 0) recoveryAmount = FlaskC.ManaRecover; - } - return new FlaskInfo(active, canbeUsed, chargeComponent?.NumCharges ?? 0, chargeComponent?.ChargesMax ?? 1, - chargesUsed, recoveryAmount, className, baseName, uniqueName, canBeUsedIn, modsList); + chargesUsed, lifeRecover, manaRecover, className, baseName, uniqueName, canBeUsedIn, modsList); } private static float CalculateTinctureCanBeUsedIn(GameController state, List flaskItems, RuleInternalState internalState)