namespace Aeshnidae.AwakenedRewards; /// /// Stamina kits in the loot table. ACE's HealKitWcids.Roll picks a healing kit by /// tier; a share of those rolls hand back a stamina kit of the tier instead. Same /// slot, same frequency of kits overall - a third of them are simply for stamina. /// [HarmonyPatch] public static class StaminaKits { private const uint Lesser = 44711; // Lesser Stamina Kit, 100 a use, 50 uses private const uint Greater = 44714; // Greater Stamina Kit, 200 a use, 50 uses [HarmonyPostfix] [HarmonyPatch(typeof(ACE.Server.Factories.Tables.Wcids.HealKitWcids), nameof(ACE.Server.Factories.Tables.Wcids.HealKitWcids.Roll))] public static void PostRoll(TreasureDeath profile, ref ACE.Server.Factories.Enum.WeenieClassName __result) { try { var share = Mod.Settings.StaminaKitShare; if (!Mod.Settings.Enabled || share <= 0 || profile is null) return; if (ThreadSafeRandom.Next(0.0f, 1.0f) >= share) return; var greater = profile.Tier >= Mod.Settings.GreaterStaminaKitFromTier || ThreadSafeRandom.Next(0.0f, 1.0f) < Mod.Settings.GreaterStaminaKitChanceBelow; var kit = greater ? Greater : Lesser; __result = (ACE.Server.Factories.Enum.WeenieClassName)kit; } catch (Exception ex) { ModManager.Log($"[{Mod.Name}] stamina kit roll failed, the healing kit stands: {ex.Message}", ModManager.LogLevel.Warn); } } }