Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of BossComfort v1.0.0
BossComfort.dll
Decompiled a month agousing System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("BossComfort")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BossComfort")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("c575be0d-d860-49eb-b521-92e2d44465cf")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace BossComfort; [BepInPlugin("linken.bosscomfort", "Boss Comfort", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string ModGUID = "linken.bosscomfort"; public const string ModName = "Boss Comfort"; public const string ModVersion = "1.0.0"; public static ConfigEntry<float> ComfortRadius; public static ConfigEntry<string> TrophyValues; public static ConfigEntry<float> CacheRefreshInterval; private Harmony harmony; private void Awake() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown ComfortRadius = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ComfortRadius", 15f, "Distance in meters to detect trophies on item stands"); CacheRefreshInterval = ((BaseUnityPlugin)this).Config.Bind<float>("General", "CacheRefreshInterval", 5f, "How often (in seconds) to refresh the list of nearby item stands."); TrophyValues = ((BaseUnityPlugin)this).Config.Bind<string>("Trophies", "TrophyValues", "TrophyEikthyr:1,TrophyTheElder:1,TrophyBonemass:1,TrophyDragonQueen:1,TrophyGoblinKing:1,TrophySeekerQueen:1,TrophyFader:1,TrophyBjorn:1,TrophySkeletonHildir:1,TrophySerpent:1,TrophyAbomination:1,TrophyCultist:1,TrophySGolem:1,TrophyCultist_Hildir:1,TrophyBjornUndead:1,TrophyGoblinBruteBrosShaman:1,TrophyGoblinBruteBrosBrute:1,TrophyTick:1,TrophyFallenValkyrie:1,TrophyMorgen:1", "Comma-separated list of trophy prefab names and their comfort values. Format: PrefabName:ComfortValue"); harmony = new Harmony("linken.bosscomfort"); harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Boss Comfort loaded!"); } } public static class TrophyComfortManager { public static Dictionary<string, int> ParseTrophies() { Dictionary<string, int> dictionary = new Dictionary<string, int>(); string[] array = Plugin.TrophyValues.Value.Split(new char[1] { ',' }); string[] array2 = array; foreach (string text in array2) { string[] array3 = text.Split(new char[1] { ':' }); if (array3.Length == 2) { string key = array3[0].Trim(); if (int.TryParse(array3[1].Trim(), out var result)) { dictionary[key] = result; } } } return dictionary; } } [HarmonyPatch(typeof(Player), "GetComfortLevel")] public static class ComfortPatch { private static ItemStand[] cachedStands = (ItemStand[])(object)new ItemStand[0]; private static float lastCacheTime = -999f; private static int cachedExtraComfort = 0; private static float lastComfortCalcTime = -999f; private static readonly float COMFORT_COOLDOWN = 4f; private static readonly float CACHE_COOLDOWN_DEFAULT = 5f; private static void Postfix(Player __instance, ref int __result) { if ((Object)(object)__instance == (Object)null) { return; } float realtimeSinceStartup = Time.realtimeSinceStartup; if (realtimeSinceStartup - lastComfortCalcTime < COMFORT_COOLDOWN) { __result += cachedExtraComfort; return; } float num = ((Plugin.CacheRefreshInterval != null) ? Plugin.CacheRefreshInterval.Value : CACHE_COOLDOWN_DEFAULT); if (realtimeSinceStartup - lastCacheTime > num) { cachedStands = Object.FindObjectsByType<ItemStand>((FindObjectsSortMode)0); lastCacheTime = realtimeSinceStartup; } lastComfortCalcTime = realtimeSinceStartup; cachedExtraComfort = CalculateExtraComfort(__instance); __result += cachedExtraComfort; } private static int CalculateExtraComfort(Player player) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) Dictionary<string, int> dictionary = TrophyComfortManager.ParseTrophies(); int num = 0; HashSet<string> hashSet = new HashSet<string>(); ItemStand[] array = cachedStands; foreach (ItemStand val in array) { if ((Object)(object)val == (Object)null) { continue; } float num2 = Vector3.Distance(((Component)val).transform.position, ((Component)player).transform.position); if (num2 > Plugin.ComfortRadius.Value) { continue; } ZNetView component = ((Component)val).GetComponent<ZNetView>(); if ((Object)(object)component == (Object)null || !component.IsValid()) { continue; } ZDO zDO = component.GetZDO(); if (zDO == null) { continue; } string @string = zDO.GetString("item", ""); if (string.IsNullOrEmpty(@string)) { @string = zDO.GetString("itemPrefab", ""); } if (!string.IsNullOrEmpty(@string)) { @string = @string.Replace("(Clone)", "").Trim(); if (!hashSet.Contains(@string) && dictionary.ContainsKey(@string)) { num += dictionary[@string]; hashSet.Add(@string); } } } return num; } }