using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using ChaosMod.Events; using ChaosMod.UI; using HarmonyLib; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; using UnityEngine.Video; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("ChaosMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ChaosMod")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("8da1cd7b-300c-4747-ac63-98141c78df4b")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")] [assembly: AssemblyVersion("1.0.0.0")] namespace ChaosMod { [BepInPlugin("nachariah.whiteknuckle.chaosmod", "ChaosMod", "1.1.3")] public class Plugin : BaseUnityPlugin { public const string pluginGuid = "nachariah.whiteknuckle.chaosmod"; public const string pluginVersion = "1.1.3"; private void Awake() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)"[ChaosMod] Patching..."); Harmony val = new Harmony("nachariah.whiteknuckle.chaosmod"); val.PatchAll(); EventManager.LoadBundle(); EventManager.FillList(); SceneManager.sceneLoaded += OnSceneLoaded; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { if (((Scene)(ref scene)).name == "Game-Main") { CommandConsole.hasCheated = true; CL_GameManager.gamemode.allowAchievements = false; CL_GameManager.gamemode.allowCheatedScores = false; Main.GameStart(); if ((Object)(object)EntityHolder.buddy == (Object)null) { EntityHolder.SetVariables(); } } else if (((Scene)(ref scene)).name == "Main-Menu") { ChaosUI.CreateMainMenuText(); } } } public static class Main { private static bool active = false; public static bool hardMode = false; private static float timeMax = 5f; private static float timeLeft; public static void MainUpdate() { if (active) { float num = Time.deltaTime; if (ChaosSettings.easyMode) { num /= 2f; } if (hardMode) { timeLeft -= num * 3f; } else { timeLeft -= num; } if (timeLeft < 0f) { EventManager.RandomEvent(); timeLeft = timeMax; } float timer = timeLeft / timeMax; ChaosUI.instance.SetTimer(timer); } } private static void StartChaos() { EventManager.FillList(); hardMode = CL_GameManager.IsHardmode(); timeLeft = timeMax; ChaosUI.ShowUI(); active = true; } public static void GameStart() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (active) { active = false; } Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == "Game-Main") { StartChaos(); } } } public static class ChaosSettings { public static bool easyMode; public static float loggerYOffset; public static float chaosVolume = 1f; public static Dictionary eventEnabled = new Dictionary(); public static void Load() { easyMode = PlayerPrefs.GetInt("Chaos_EasyMode", 0) == 1; loggerYOffset = PlayerPrefs.GetFloat("Chaos_LoggerYOffset", 0f); chaosVolume = PlayerPrefs.GetFloat("Chaos_Volume", 1f); foreach (string item in eventEnabled.Keys.ToList()) { eventEnabled[item] = PlayerPrefs.GetInt("Chaos_Event_" + item, 1) == 1; } } public static void Save() { PlayerPrefs.SetInt("Chaos_EasyMode", easyMode ? 1 : 0); PlayerPrefs.SetFloat("Chaos_LoggerYOffset", loggerYOffset); PlayerPrefs.SetFloat("Chaos_Volume", chaosVolume); foreach (KeyValuePair item in eventEnabled) { PlayerPrefs.SetInt("Chaos_Event_" + item.Key, item.Value ? 1 : 0); } PlayerPrefs.Save(); } } } namespace ChaosMod.UI { public class ChaosUI : MonoBehaviour { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Action <>9__16_0; public static UnityAction <>9__16_3; public static UnityAction <>9__16_4; internal void b__16_0(bool v) { ChaosSettings.easyMode = v; ChaosSettings.Save(); } internal void b__16_3() { ChaosUIHelpers.SetAllToggles(value: true); ChaosSettings.Save(); } internal void b__16_4() { ChaosUIHelpers.SetAllToggles(value: false); ChaosSettings.Save(); } } public static ChaosUI instance; public TMP_FontAsset ticketingFont = null; private GameObject canvasObj; private RectTransform bgRect; private RectTransform fillRect; private RectTransform listRoot; private readonly List entries = new List(); public static List EventToggles = new List(); public static void ShowUI() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown if ((Object)(object)instance == (Object)null) { GameObject val = new GameObject("ChaosTimer"); instance = val.AddComponent(); instance.CreateUI(); } } private void CreateUI() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Expected O, but got Unknown //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Expected O, but got Unknown //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) canvasObj = new GameObject(); canvasObj.transform.parent = ((Component)this).transform; Canvas val = canvasObj.AddComponent(); val.renderMode = (RenderMode)0; val.sortingOrder = 999; canvasObj.AddComponent().uiScaleMode = (ScaleMode)1; GameObject val2 = new GameObject("Background"); val2.transform.parent = canvasObj.transform; Image val3 = val2.AddComponent(); ((Graphic)val3).color = new Color(0f, 0f, 0f, 0.3f); bgRect = ((Graphic)val3).rectTransform; bgRect.anchorMin = Vector2.zero; bgRect.anchorMax = Vector2.right; bgRect.pivot = Vector2.right / 2f; bgRect.sizeDelta = new Vector2(0f, 4f); bgRect.anchoredPosition = new Vector2(0f, 0f); GameObject val4 = new GameObject("Background"); val4.transform.parent = val2.transform; Image val5 = val4.AddComponent(); ((Graphic)val5).color = new Color(1f, 1f, 1f, 0.6f); val5.type = (Type)3; val5.fillMethod = (FillMethod)0; val5.fillOrigin = 0; val5.fillAmount = 0f; fillRect = ((Graphic)val5).rectTransform; fillRect.anchorMin = Vector2.zero; fillRect.anchorMax = Vector2.up; fillRect.pivot = Vector2.up / 2f; RectTransform obj = fillRect; Rect rect = bgRect.rect; obj.sizeDelta = new Vector2(((Rect)(ref rect)).width, 0f); fillRect.anchoredPosition = Vector2.zero; GameObject val6 = new GameObject("EventList"); val6.transform.SetParent(canvasObj.transform, false); listRoot = val6.AddComponent(); listRoot.anchorMin = new Vector2(1f, 0f); listRoot.anchorMax = new Vector2(1f, 0f); listRoot.pivot = new Vector2(1f, 0f); listRoot.sizeDelta = new Vector2(100f, 0f); listRoot.anchoredPosition = new Vector2(-4f, 25f); ticketingFont = FindTicketingFont(); } public void SetTimer(float value) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)fillRect == (Object)null) && !((Object)(object)bgRect == (Object)null)) { value = Mathf.Clamp01(value); Rect rect = bgRect.rect; float width = ((Rect)(ref rect)).width; fillRect.sizeDelta = new Vector2(width * value, 0f); } } public void AddEntry(string name, float time) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown if (!((Object)(object)listRoot == (Object)null)) { GameObject val = new GameObject(name); val.transform.SetParent((Transform)(object)listRoot, false); EventEntry eventEntry = val.AddComponent(); eventEntry.Wake(name, time, this); entries.Insert(0, eventEntry); RepositionEntries(); } } public void RemoveEntry(EventEntry entry) { if (entries.Remove(entry)) { RepositionEntries(); } } private void RepositionEntries() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) float num = ChaosSettings.loggerYOffset; for (int i = 0; i < entries.Count; i++) { entries[i].SetTargetPosition(new Vector2(0f, num)); num += entries[i].Height + 6f; } } private static TMP_FontAsset FindTicketingFont() { TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll(); foreach (TMP_FontAsset val in array) { if (((Object)val).name == "Ticketing SDF") { return val; } } Debug.LogWarning((object)"[Chaos - UI] Ticketing SDF font not found"); return null; } public static void CreateMainMenuText() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown GameObject val = new GameObject("ChaosMainMenuUI"); Canvas val2 = val.AddComponent(); val2.renderMode = (RenderMode)0; val2.sortingOrder = 999; val.AddComponent().uiScaleMode = (ScaleMode)1; val.AddComponent(); TMP_FontAsset font = FindTicketingFont(); CreateText(val.transform, "CHAOS MOD v1.1.3", font, 14f, (TextAlignmentOptions)260, new Vector2(1f, 1f), new Vector2(-5f, -30f), new Vector2(250f, 30f)); Button val3 = CreateButton(val.transform, "Chaos Options", font, new Vector2(1f, 0f), new Vector2(-120f, 10f), new Vector2(80f, 16f)); GameObject panel = CreateOptionsPanel(val.transform, font); panel.SetActive(false); ((UnityEvent)val3.onClick).AddListener((UnityAction)delegate { panel.SetActive(!panel.activeSelf); }); } private static GameObject CreateOptionsPanel(Transform parent, TMP_FontAsset font) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Expected O, but got Unknown //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Expected O, but got Unknown GameObject val = new GameObject("ChaosOptionsPanel"); val.transform.SetParent(parent, false); Image val2 = val.AddComponent(); ((Graphic)val2).color = new Color(0f, 0f, 0f, 0.75f); RectTransform rectTransform = ((Graphic)val2).rectTransform; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(1f, 0f); rectTransform.anchorMax = val3; rectTransform.anchorMin = val3; rectTransform.pivot = new Vector2(1f, 0f); rectTransform.sizeDelta = new Vector2(360f, 420f); rectTransform.anchoredPosition = new Vector2(-10f, 30f); CreateToggle(val.transform, "Easy Mode", font, new Vector2(10f, -12.5f), new Vector2(330f, 20f), ChaosSettings.easyMode, delegate(bool v) { ChaosSettings.easyMode = v; ChaosSettings.Save(); }); TMP_Text vLabel = CreateText(val.transform, $"Chaos Volume: {Mathf.RoundToInt(ChaosSettings.chaosVolume * 100f)}%", font, 11f, (TextAlignmentOptions)513, new Vector2(0f, 1f), new Vector2(10f, -35f), new Vector2(240f, 18f)); CreateSlider(val.transform, new Vector2(10f, -55f), new Vector2(330f, 8f), 0f, 1f, ChaosSettings.chaosVolume, delegate(float v) { ChaosSettings.chaosVolume = v; ChaosSettings.Save(); vLabel.text = $"Chaos Volume: {Mathf.RoundToInt(v * 100f)}%"; }); TMP_Text yLabel = CreateText(val.transform, $"Logger Vertical Offset: {ChaosSettings.loggerYOffset}px", font, 11f, (TextAlignmentOptions)513, new Vector2(0f, 1f), new Vector2(10f, -70f), new Vector2(200f, 18f)); CreateSlider(val.transform, new Vector2(10f, -90f), new Vector2(330f, 8f), 0f, 400f, ChaosSettings.loggerYOffset, delegate(float v) { ChaosSettings.loggerYOffset = v; yLabel.text = $"Logger Vertical Offset: {v}px"; ChaosSettings.Save(); }); CreateText(val.transform, "Enabled Events:", font, 11f, (TextAlignmentOptions)513, new Vector2(0f, 1f), new Vector2(10f, -110f), new Vector2(200f, 18f)); RectTransform content; ScrollRect val4 = CreateScrollRect(val.transform, new Vector2(10f, 60f), new Vector2(340f, 230f), out content); EventToggles.Clear(); CreateBlankToggle((Transform)(object)content, "", Vector2.zero, new Vector2(320f, 18f)); foreach (string key in ChaosSettings.eventEnabled.Keys) { string eventName = key; Toggle item = CreateToggle((Transform)(object)content, eventName, font, Vector2.zero, new Vector2(320f, 15f), ChaosSettings.eventEnabled[eventName], delegate(bool v) { ChaosSettings.eventEnabled[eventName] = v; ChaosSettings.Save(); }); EventToggles.Add(item); } CreateBlankToggle((Transform)(object)content, "", Vector2.zero, new Vector2(320f, 18f)); Button val5 = CreateButton(val.transform, "Enable All", font, new Vector2(0f, 0f), new Vector2(10f, 10f), new Vector2(150f, 28f)); ButtonClickedEvent onClick = val5.onClick; object obj = <>c.<>9__16_3; if (obj == null) { UnityAction val6 = delegate { ChaosUIHelpers.SetAllToggles(value: true); ChaosSettings.Save(); }; <>c.<>9__16_3 = val6; obj = (object)val6; } ((UnityEvent)onClick).AddListener((UnityAction)obj); Button val7 = CreateButton(val.transform, "Disable All", font, new Vector2(1f, 0f), new Vector2(-10f, 10f), new Vector2(150f, 28f)); ButtonClickedEvent onClick2 = val7.onClick; object obj2 = <>c.<>9__16_4; if (obj2 == null) { UnityAction val8 = delegate { ChaosUIHelpers.SetAllToggles(value: false); ChaosSettings.Save(); }; <>c.<>9__16_4 = val8; obj2 = (object)val8; } ((UnityEvent)onClick2).AddListener((UnityAction)obj2); return val; } public static TMP_Text CreateText(Transform parent, string text, TMP_FontAsset font, float size, TextAlignmentOptions alignment, Vector2 anchor, Vector2 pos, Vector2 dimensions) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Text"); val.transform.SetParent(parent, false); RectTransform val2 = val.AddComponent(); Vector2 anchorMin = (val2.anchorMax = anchor); val2.anchorMin = anchorMin; val2.pivot = anchor; val2.anchoredPosition = pos; val2.sizeDelta = dimensions; TMP_Text val4 = (TMP_Text)(object)val.AddComponent(); val4.text = text; val4.font = font; val4.fontSize = size; val4.alignment = alignment; ((Graphic)val4).color = Color.white; return val4; } private static Button CreateButton(Transform parent, string text, TMP_FontAsset font, Vector2 anchor, Vector2 pos, Vector2 size) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(text); val.transform.SetParent(parent, false); Image val2 = val.AddComponent(); ((Graphic)val2).color = new Color(1f, 1f, 1f, 0.1f); Button result = val.AddComponent