using System; using System.Collections.Generic; 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 LootClicker; using LootClicker.Entities.Skills; using LootClicker.Items; using LootClicker.Services; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("CharacterSlots")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CharacterSlots")] [assembly: AssemblyTitle("CharacterSlots")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.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 CharacterSlots { [BepInPlugin("com.corga.characterslots", "CharacterSlots", "1.0.0")] public class CharacterSlotsPlugin : BaseUnityPlugin { public const string PluginGUID = "com.corga.characterslots"; public const string PluginName = "CharacterSlots"; public const string PluginVersion = "1.0.0"; internal static ManualLogSource Log; internal static Harmony HarmonyInstance; private void Awake() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; HarmonyInstance = new Harmony("com.corga.characterslots"); HarmonyInstance.PatchAll(); Log.LogInfo((object)"CharacterSlots v1.0.0 loaded!"); } } [HarmonyPatch(typeof(SkillStore), "SetupSkillStore")] public static class DeferredPatchHook { [HarmonyPostfix] private static void Postfix() { CharacterSlotPatches.ApplyIfNeeded(CharacterSlotsPlugin.HarmonyInstance); } } public static class CharacterSlotPatches { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static CallBack <>9__6_1; internal void b__6_1() { } } public const int NewMaxCharacterSlots = 30; private static bool _applied; private static bool _costExtended; public static void ApplyIfNeeded(Harmony harmony) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown if (!_applied) { _applied = true; harmony.Patch((MethodBase)AccessTools.Method(typeof(CharacterSelectPanelController), "UpdateBuyCharacterSlotPanel", (Type[])null, (Type[])null), new HarmonyMethod(typeof(CharacterSlotPatches), "UpdateBuyPanel_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(CharacterSelectPanelController), "BuyCharacterSlotPanel_Click", (Type[])null, (Type[])null), new HarmonyMethod(typeof(CharacterSlotPatches), "BuyClick_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(SelectCharacterPanelController), "SetupSelectionPanel", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(CharacterSlotPatches), "SelectPanel_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); CharacterSlotsPlugin.Log.LogInfo((object)"[CharacterSlots] Patches applied (deferred)."); } } public static void EnsureCostListExtended() { if (_costExtended) { return; } _costExtended = true; while (Upgrades.CharacterSlotCost.Count < 30) { int count = Upgrades.CharacterSlotCost.Count; int num = (count - 10) / 2; if (count % 2 == 0) { Upgrades.CharacterSlotCost.Add((20000 * (1 << num), (Currency)2)); } else { Upgrades.CharacterSlotCost.Add((2000 * (1 << num), (Currency)3)); } } CharacterSlotsPlugin.Log.LogInfo((object)$"[CharacterSlots] Extended costs to {Upgrades.CharacterSlotCost.Count} entries."); } private static bool UpdateBuyPanel_Prefix(CharacterSelectPanelController __instance) { EnsureCostListExtended(); if (Upgrades.CharacterSlotsPurchased < 30 && Upgrades.CharacterSlotsPurchased == GameData.Characters.Count) { __instance.BuyCharacterSlotPanel.SetActive(true); } else { __instance.BuyCharacterSlotPanel.SetActive(false); } return false; } private static bool BuyClick_Prefix(CharacterSelectPanelController __instance) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_00c8: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown EnsureCostListExtended(); if (Upgrades.CharacterSlotsPurchased >= 30) { GameData.GameController.DialogBox.ShowSimpleMenu(Locale.GetText("menu_noCharacterSlots"), Locale.GetText("ok")); __instance.BuyCharacterSlotPanel.SetActive(false); return false; } (int Cost, Currency Currency) cost = Upgrades.CharacterSlotCost[Upgrades.CharacterSlotsPurchased]; string currencyText = TextHelper.GetCurrencyText((double)cost.Cost, cost.Currency); string currencyType = TextHelper.GetCurrencyStringWithColor(cost.Currency); GameData.GameController.DialogBox.ClearMenu(); GameData.GameController.DialogBox.AddConfirmAction(TextHelper.Yes, (CallBack)delegate { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (GameData.CheckCurrency((double)cost.Cost, cost.Currency)) { GameData.UpdateCurrency((double)(-cost.Cost), cost.Currency); Upgrades.CharacterSlotsPurchased += 1; __instance.UpdateBuyCharacterSlotPanel(); __instance.UpdateCreateCharacterPanel(); __instance.BeginCharacterCreation(); } else { GameData.GameController.DialogBox.ShowSimpleMenu(string.Format(Locale.GetText("currencyWarning"), currencyType), Locale.GetText("ok")); } }); DialogBoxController dialogBox = GameData.GameController.DialogBox; string no = TextHelper.No; object obj = <>c.<>9__6_1; if (obj == null) { CallBack val = delegate { }; <>c.<>9__6_1 = val; obj = (object)val; } dialogBox.AddExitAction(no, (CallBack)obj); GameData.GameController.DialogBox.ShowMenu(string.Format(Locale.GetText("menu_purchaseCharacter_confirmation"), currencyText)); return false; } private static void SelectPanel_Postfix(SelectCharacterPanelController __instance, PrepareMissionController prepareMissionController) { int num = 30; List value = Traverse.Create((object)__instance).Property("CharacterPreviews", (object[])null).GetValue>(); if (value != null && value.Count < num) { int num2 = num - value.Count; for (int i = 0; i < num2; i++) { GameObject obj = Object.Instantiate(__instance.CharacterPreviewPrefab); TransformExtensions.SetParentScaled(obj.transform, __instance.SelectCharacterGrid.transform, false); CharacterPreviewController component = obj.GetComponent(); component.Setup(prepareMissionController, -1); value.Add(component); } CharacterSlotsPlugin.Log.LogInfo((object)$"[CharacterSlots] Extended select panel to {value.Count} slots."); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }