using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using PracticeCheckBox; using Rng; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; using UnstableLogic; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("better.rng")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("2.1.0.0")] [assembly: AssemblyInformationalVersion("2.1.0")] [assembly: AssemblyProduct("better.rng")] [assembly: AssemblyTitle("better.rng")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace UnstableLogic { internal static class UnstableRNG { private static List ListOfUnstablePerksOrder = new List(); private static Dictionary ListOfUnstablePerksSeen = new Dictionary(); private static HashSet UnstableItems = new HashSet { "Perk_U_T1_FriendsUpstairs", "Perk_U_T1_HangTight", "Perk_U_T2_BadParent", "Perk_U_T3_Bulletproof", "Perk_U_T2_DiskJockey", "Perk_U_T2_AdoptionDay", "Perk_U_T2_PhysicsGraduate", "Perk_U_TX_TeleporterMalfunction" }; private static readonly FieldInfo cardsField = AccessTools.Field(typeof(App_PerkPage), "cards"); public static void EverythingElse(App_PerkPage __instance) { List list = (List)cardsField.GetValue(__instance); List perkAssets = CL_AssetManager.GetFullCombinedAssetDatabase().perkAssets; if (CheckboxUIHelper.modeIndex > 0) { Debug.Log((object)"User has chosen non-default behavior"); CommandConsole.cheatsEnabled = true; CommandConsole.hasCheated = true; } List list2 = perkAssets.Where((Perk P) => (int)P.perkType == 3).ToList(); foreach (Perk item in list2) { Debug.Log((object)(item.id ?? "")); } if (ListOfUnstablePerksOrder.Count == 0) { for (int num = list2.Count - 1; num > 0; num--) { int num2 = Random.Range(0, num + 1); List list3 = list2; int index = num; int index2 = num2; Perk value = list2[num2]; Perk value2 = list2[num]; list3[index] = value; list2[index2] = value2; } foreach (Perk item2 in list2) { ListOfUnstablePerksOrder.Add(item2); if (!ListOfUnstablePerksSeen.ContainsKey(item2)) { ListOfUnstablePerksSeen[item2] = 0; } } } Perk first = null; Perk perk = null; int num3 = 0; int num4 = ListOfUnstablePerksSeen.Values.Max(); foreach (KeyValuePair item3 in ListOfUnstablePerksSeen) { num3 += num4 - item3.Value + 1; } int num5 = Random.Range(0, num3); bool flag = false; if (CheckboxUIHelper.modeIndex == 2) { first = ((IEnumerable)ListOfUnstablePerksOrder).FirstOrDefault((Func)((Perk p) => !UnstableItems.Contains(p.id))); } else if (CheckboxUIHelper.modeIndex == 1) { first = ListOfUnstablePerksOrder[0]; } else { foreach (KeyValuePair item4 in ListOfUnstablePerksSeen) { num5 -= num4 - item4.Value + 1; if (num5 < 0) { first = item4.Key; break; } } } if ((Object)(object)first == (Object)null) { flag = true; } if (flag) { Debug.Log((object)"Tried to force spawn a non-item unstable but none where in the order."); ListOfUnstablePerksOrder.Clear(); for (int num6 = list2.Count - 1; num6 > 0; num6--) { int num7 = Random.Range(0, num6 + 1); List list3 = list2; int index2 = num6; int index = num7; Perk value2 = list2[num7]; Perk value = list2[num6]; list3[index2] = value2; list2[index] = value; } foreach (Perk item5 in list2) { ListOfUnstablePerksOrder.Add(item5); } first = ListOfUnstablePerksOrder[0]; } ListOfUnstablePerksOrder.Remove(first); CardReplacement.ReplaceCards(__instance, 0, first, null); if (CheckboxUIHelper.modeIndex == 2) { perk = ListOfUnstablePerksOrder.First((Perk p) => !UnstableItems.Contains(p.id)); } else if (CheckboxUIHelper.modeIndex == 1) { perk = ListOfUnstablePerksOrder[0]; } else { List> list4 = ListOfUnstablePerksSeen.Where((KeyValuePair kv) => (Object)(object)kv.Key != (Object)(object)first).ToList(); int num8 = list4.Max((KeyValuePair kv) => kv.Value); int num9 = 0; foreach (KeyValuePair item6 in list4) { num9 += num8 - item6.Value + 1; } int num10 = Random.Range(0, num9); foreach (KeyValuePair item7 in list4) { num10 -= num8 - item7.Value + 1; if (num10 < 0) { perk = item7.Key; break; } } } CardReplacement.ReplaceCards(__instance, 1, perk, null); ListOfUnstablePerksSeen[list[0].perk] = ListOfUnstablePerksSeen.GetValueOrDefault(list[0].perk) + 1; ListOfUnstablePerksSeen[list[1].perk] = ListOfUnstablePerksSeen.GetValueOrDefault(list[1].perk) + 1; } } } namespace PracticeCheckBox { internal static class CheckboxUIHelper { public static bool created; public static string foundCanvas; public static int starter; public static int modeIndex; public static void EnsureCreated() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Expected O, but got Unknown //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: 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_0223: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Expected O, but got Unknown if (created) { return; } Canvas val = Object.FindObjectOfType(); if (starter == 0) { foundCanvas = ((Object)val).name; starter++; } if ((Object)(object)val == (Object)null) { Debug.LogError((object)"[PracticeCheckBox] No Canvas found, can't create toggle."); return; } GameObject val2 = new GameObject("PracticeCheckbox_Toggle"); val2.transform.SetParent(((Component)val).transform, false); RectTransform val3 = val2.AddComponent(); val3.anchorMin = new Vector2(1f, 0f); val3.anchorMax = new Vector2(1f, 0f); val3.pivot = new Vector2(1f, 0f); val3.anchoredPosition = new Vector2(-50f, 50f); val3.sizeDelta = new Vector2(300f, 60f); Image val4 = val2.AddComponent(); ((Graphic)val4).color = new Color(0f, 0f, 0f, 0.4f); Button val5 = val2.AddComponent