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 CLLC Difficulty Mod v1.0.0
CLLC_Difficulty_Mod.dll
Decompiled 5 days agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; 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: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("CLLC_Difficulty_Mod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CLLC_Difficulty_Mod")] [assembly: AssemblyTitle("CLLC_Difficulty_Mod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace CLLC_Difficulty_Mod; [BepInPlugin("com.yourname.cllcdifficultymod", "CLLC Difficulty Mod", "1.0.8")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInProcess("valheim.exe")] public class DifficultyModPlugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("com.yourname.cllcdifficultymod"); public static ManualLogSource Log; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; harmony.PatchAll(); Log.LogInfo((object)"CLLC Difficulty Mod (Explicit Range Sync) Loaded Cleanly!"); } } [HarmonyPatch(typeof(Character), "Awake")] public static class CharacterSpawnEnforcementPatch { [HarmonyPostfix] public static void Postfix(Character __instance) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Invalid comparison between Unknown and I4 //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Invalid comparison between Unknown and I4 //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Invalid comparison between Unknown and I4 //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Invalid comparison between Unknown and I4 //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Invalid comparison between Unknown and I4 //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Invalid comparison between Unknown and I4 //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Invalid comparison between Unknown and I4 if ((Object)(object)__instance == (Object)null || __instance.IsPlayer() || __instance.IsTamed()) { return; } float num = Vector3.Distance(((Component)__instance).transform.position, Vector3.zero); int num2 = 0; if (num >= 3000f && num < 10500f) { Biome val = Heightmap.FindBiome(((Component)__instance).transform.position); float num3 = Random.Range(0f, 100f); float num4 = 15f; float num5 = 7f; float num6 = 3f; if ((int)val == 2) { num4 = 12f; num5 = 5f; num6 = 1.5f; } else if ((int)val == 4) { num4 = 10f; num5 = 4f; num6 = 1.2f; } else if ((int)val == 16) { num4 = 8f; num5 = 3f; num6 = 1f; } else if ((int)val == 512) { num4 = 6f; num5 = 2.5f; num6 = 0.8f; } else if ((int)val == 32) { num4 = 3f; num5 = 2f; num6 = 0.5f; } else if ((int)val == 64) { num4 = 1.5f; num5 = 1f; num6 = 0.1f; } else if ((int)val == 256) { num4 = 6f; num5 = 2.5f; num6 = 0.8f; } float num7 = num6; float num8 = num7 + num5; float num9 = num8 + num4; num2 = ((num3 <= num7) ? 3 : ((num3 > num7 && num3 <= num8) ? 2 : ((num3 > num8 && num3 <= num9) ? 1 : 0))); DifficultyModPlugin.Log.LogInfo((object)$"[DIAGNOSTIC] Level 2 Ring Spawn! Name: {((Object)__instance).name} Biome: {val} at {num:F0}m. Dice rolled: {num3:F1}. Enforcing -> {num2} Stars."); ForceSetCLLCLevel(__instance, num2); } else if (num >= 10500f) { DifficultyModPlugin.Log.LogInfo((object)$"[DIAGNOSTIC] Level 3+ Ring Out of Bounds! Name: {((Object)__instance).name} at {num:F0}m. Forcing 0 Stars."); ForceSetCLLCLevel(__instance, 0); } } private static void ForceSetCLLCLevel(Character character, int extraStars) { if ((Object)(object)character == (Object)null) { return; } try { int num = extraStars + 1; FieldInfo field = typeof(Character).GetField("m_level", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { field.SetValue(character, num); } ZNetView component = ((Component)character).GetComponent<ZNetView>(); if ((Object)(object)component != (Object)null && component.GetZDO() != null) { component.GetZDO().Set(ZDOVars.s_level, num, false); } } catch (Exception ex) { DifficultyModPlugin.Log.LogError((object)("Failed to synchronize character level: " + ex.Message)); } } }