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 BulkBrew v1.0.0
BulkBrew.dll
Decompiled 3 days agousing System; using System.Collections.Generic; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using EntityStates; using EntityStates.MealPrep; using GameImprovement.Ui; using HarmonyLib; using RoR2; using RoR2.UI; using TMPro; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace BulkBrew { [BepInPlugin("com.proigryfedorov.bulkbrew", "BulkBrew", "1.0.0")] public class BulkBrewPlugin : BaseUnityPlugin { public const string PluginGuid = "com.proigryfedorov.bulkbrew"; public const string PluginName = "BulkBrew"; public const string PluginVersion = "1.0.0"; private const short MsgBrew = 18830; private const short MsgCookAmount = 18831; internal static BulkBrewPlugin Instance; internal static ConfigEntry<bool> CauldronMenu; internal static ConfigEntry<bool> CookInBulk; internal static ConfigEntry<int> CookAmount; internal static ConfigEntry<float> CookSpeed; private static MethodInfo itemVaultGive; private static bool itemVaultChecked; private static readonly Dictionary<NetworkUser, int> cookAmounts = new Dictionary<NetworkUser, int>(); private static readonly Dictionary<Type, float> originalDurations = new Dictionary<Type, float>(); private static NetworkClient Client { get { NetworkClient val = (((Object)(object)NetworkManager.singleton != (Object)null) ? NetworkManager.singleton.client : null); if (val == null || !val.isConnected) { return null; } return val; } } private void Awake() { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Expected O, but got Unknown //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Expected O, but got Unknown Instance = this; CauldronMenu = ((BaseUnityPlugin)this).Config.Bind<bool>("Cauldron", "Menu", true, "Котёл: при использовании открывать меню выбора предметов и количества варок."); CookInBulk = ((BaseUnityPlugin)this).Config.Bind<bool>("Chef", "CookInBulk", true, "Повар: Shift / Ctrl / Shift+Ctrl при подтверждении рецепта — готовить ×10 / ×100 / ×1000 (сколько хватит ингредиентов)."); CookAmount = ((BaseUnityPlugin)this).Config.Bind<int>("Chef", "CookAmount", 10, "Повар: сколько раз готовить выбранный рецепт по кнопке «Подтвердить» (если ингредиентов меньше — сколько хватит). Shift / Ctrl / Shift+Ctrl вместо этого дают ×10 / ×100 / ×1000."); CookSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Chef", "CookSpeed", 4f, "Во сколько раз быстрее анимация готовки у повара (1 — как в игре)."); Run.onRunStartGlobal += delegate { RegisterHandlers(); cookAmounts.Clear(); }; Stage.onStageStartGlobal += delegate { RegisterHandlers(); }; Harmony val = new Harmony("com.proigryfedorov.bulkbrew"); val.Patch((MethodBase)AccessTools.Method(typeof(Interactor), "AttemptInteraction", (Type[])null, (Type[])null), new HarmonyMethod(typeof(BulkBrewPlugin), "AttemptInteractionPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.Method(typeof(CraftingController), "ConfirmSelection", (Type[])null, (Type[])null), new HarmonyMethod(typeof(BulkBrewPlugin), "ConfirmSelectionPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.Method(typeof(MealPrepController), "BeginCookingServer", (Type[])null, (Type[])null), new HarmonyMethod(typeof(BulkBrewPlugin), "BeginCookingPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Type[] array = new Type[3] { typeof(WaitToBeginCooking), typeof(Cooking), typeof(CookingToIdle) }; foreach (Type type in array) { val.Patch((MethodBase)AccessTools.Method(type, "OnEnter", (Type[])null, (Type[])null), new HarmonyMethod(typeof(BulkBrewPlugin), "CookStateEnterPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"BulkBrew 1.0.0 loaded"); } private void RegisterHandlers() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown if (NetworkServer.active) { NetworkServer.RegisterHandler((short)18830, new NetworkMessageDelegate(OnServerBrew)); NetworkServer.RegisterHandler((short)18831, new NetworkMessageDelegate(OnServerCookAmount)); } } private static NetworkUser UserFromConnection(NetworkConnection conn) { foreach (NetworkUser readOnlyInstances in NetworkUser.readOnlyInstancesList) { if ((Object)(object)readOnlyInstances != (Object)null && ((NetworkBehaviour)readOnlyInstances).connectionToClient == conn) { return readOnlyInstances; } } return null; } internal static CharacterMaster LocalMaster() { LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); if (firstLocalUser == null) { return null; } return firstLocalUser.cachedMaster; } internal static ItemTier? TierFor(CostTypeIndex cost) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected I4, but got Unknown return (cost - 4) switch { 0 => (ItemTier)0, 1 => (ItemTier)1, 2 => (ItemTier)2, 6 => (ItemTier)4, _ => null, }; } internal static bool IsCauldron(GameObject go, out PurchaseInteraction purchase, out ShopTerminalBehavior shop) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) purchase = (((Object)(object)go != (Object)null) ? go.GetComponent<PurchaseInteraction>() : null); shop = (((Object)(object)go != (Object)null) ? go.GetComponent<ShopTerminalBehavior>() : null); if ((Object)(object)purchase != (Object)null && (Object)(object)shop != (Object)null && ((Object)go).name.IndexOf("Cauldron", StringComparison.OrdinalIgnoreCase) >= 0) { return TierFor(purchase.costType).HasValue; } return false; } internal static bool CanGive(ItemDef item, ItemTier tier) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)item != (Object)null && item.tier == tier && !item.hidden) { return item.canRemove; } return false; } private static bool AttemptInteractionPrefix(Interactor __instance, GameObject interactableObject) { if (!CauldronMenu.Value || (Object)(object)interactableObject == (Object)null) { return true; } CharacterMaster val = LocalMaster(); if ((Object)(object)val == (Object)null || (Object)(object)val.GetBodyObject() != (Object)(object)((Component)__instance).gameObject) { return true; } if (!IsCauldron(interactableObject, out var purchase, out var shop) || !purchase.available) { return true; } try { BrewMenu.Open(interactableObject, purchase, shop); return false; } catch (Exception ex) { ((BaseUnityPlugin)Instance).Logger.LogError((object)("Не удалось открыть меню котла: " + ex)); return true; } } internal static void SendBrew(GameObject cauldron, int times, Dictionary<ItemIndex, int> give) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected I4, but got Unknown BrewMessage brewMessage = new BrewMessage(); brewMessage.cauldron = cauldron; brewMessage.times = times; foreach (KeyValuePair<ItemIndex, int> item in give) { if (item.Value > 0) { brewMessage.items.Add((int)item.Key); brewMessage.counts.Add(item.Value); } } NetworkClient client = Client; if (client != null) { client.Send((short)18830, (MessageBase)(object)brewMessage); } } private void OnServerBrew(NetworkMessage netMsg) { BrewMessage msg = netMsg.ReadMessage<BrewMessage>(); NetworkUser val = UserFromConnection(netMsg.conn); if (!((Object)(object)val == (Object)null) && !((Object)(object)val.master == (Object)null) && !((Object)(object)val.master.inventory == (Object)null)) { string text = Brew(val.master, msg); if (text != null) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Котёл: " + text)); } } } private static string Brew(CharacterMaster master, BrewMessage msg) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Invalid comparison between Unknown and I4 //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) if (!IsCauldron(msg.cauldron, out var purchase, out var shop) || !purchase.available) { return "это не котёл"; } ItemTier value = TierFor(purchase.costType).Value; int num = Math.Max(1, Math.Min(msg.times, 10000)); int num2 = purchase.cost * num; Inventory inventory = master.inventory; int num3 = 0; for (int i = 0; i < msg.items.Count; i++) { ItemDef itemDef = ItemCatalog.GetItemDef((ItemIndex)msg.items[i]); int num4 = msg.counts[i]; if (!CanGive(itemDef, value) || num4 <= 0 || inventory.GetItemCountPermanent(itemDef.itemIndex) < num4) { return "неверный выбор предметов"; } num3 += num4; } if (num3 != num2) { return "выбрано " + num3 + " вместо " + num2; } PickupDef pickupDef = PickupCatalog.GetPickupDef(shop.CurrentPickupIndex()); if (pickupDef == null || (int)pickupDef.itemIndex == -1) { return "в котле нет предмета"; } for (int j = 0; j < msg.items.Count; j++) { inventory.RemoveItemPermanent((ItemIndex)msg.items[j], msg.counts[j]); } NetworkUser user = (((Object)(object)master.playerCharacterMasterController != (Object)null) ? master.playerCharacterMasterController.networkUser : null); if (!GiveToItemVault(user, pickupDef.pickupIndex, num)) { DropResults(shop, pickupDef.pickupIndex, num); } Util.PlaySound("Play_UI_item_land_tier2", msg.cauldron); return null; } private static bool GiveToItemVault(NetworkUser user, PickupIndex pickup, int count) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) if (!itemVaultChecked) { itemVaultChecked = true; Type type = Type.GetType("ItemVault.ItemVaultPlugin, ItemVault", throwOnError: false); if (type != null) { itemVaultGive = AccessTools.Method(type, "GiveToVault", new Type[3] { typeof(NetworkUser), typeof(PickupIndex), typeof(int) }, (Type[])null); } } if (itemVaultGive == null || (Object)(object)user == (Object)null) { return false; } try { return (bool)itemVaultGive.Invoke(null, new object[3] { user, pickup, count }); } catch (Exception ex) { ((BaseUnityPlugin)Instance).Logger.LogWarning((object)("ItemVault не принял результат варки: " + ex.Message)); return false; } } private static void DropResults(ShopTerminalBehavior shop, PickupIndex pickup, int count) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_005f: 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_0066: Unknown result type (might be due to invalid IL or missing references) Transform val = (((Object)(object)shop.dropTransform != (Object)null) ? shop.dropTransform : ((Component)shop).transform); Vector3 val2 = ((Component)shop).transform.TransformVector(shop.dropVelocity); UniquePickup val3 = default(UniquePickup); ((UniquePickup)(ref val3))..ctor(pickup); for (int i = 0; i < count; i++) { Vector3 val4 = ((count > 1) ? (Quaternion.AngleAxis(360f * (float)i / (float)count, Vector3.up) * val2) : val2); PickupDropletController.CreatePickupDroplet(val3, val.position, val4, false); } } internal static int ClickAmount() { bool flag = Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303); bool flag2 = Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305); if (flag && flag2) { return 1000; } if (flag2) { return 100; } if (flag) { return 10; } return 1; } private static void ConfirmSelectionPrefix() { if (!CookInBulk.Value) { return; } int num = ClickAmount(); if (num == 1) { num = Math.Max(1, CookAmount.Value); } if (NetworkServer.active) { LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); if (firstLocalUser != null && (Object)(object)firstLocalUser.currentNetworkUser != (Object)null) { cookAmounts[firstLocalUser.currentNetworkUser] = num; } return; } NetworkClient client = Client; if (client != null) { CookAmountMessage cookAmountMessage = new CookAmountMessage(); cookAmountMessage.amount = num; client.Send((short)18831, (MessageBase)(object)cookAmountMessage); } } private void OnServerCookAmount(NetworkMessage netMsg) { CookAmountMessage cookAmountMessage = netMsg.ReadMessage<CookAmountMessage>(); NetworkUser val = UserFromConnection(netMsg.conn); if ((Object)(object)val != (Object)null) { cookAmounts[val] = Math.Max(1, Math.Min(cookAmountMessage.amount, 10000)); } } private static bool BeginCookingPrefix(MealPrepController __instance, Interactor activator, PickupIndex[] itemsToTake, PickupIndex reward, int count) { //IL_00b0: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Invalid comparison between Unknown and I4 //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Expected O, but got Unknown //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) if (!CookInBulk.Value || (Object)(object)activator == (Object)null || itemsToTake == null) { return true; } CharacterBody component = ((Component)activator).GetComponent<CharacterBody>(); NetworkUser val = (((Object)(object)component != (Object)null && (Object)(object)component.master != (Object)null && (Object)(object)component.master.playerCharacterMasterController != (Object)null) ? component.master.playerCharacterMasterController.networkUser : null); if ((Object)(object)val == (Object)null || !cookAmounts.TryGetValue(val, out var value)) { return true; } cookAmounts.Remove(val); if (value <= 1 || (Object)(object)component.inventory == (Object)null) { return true; } Dictionary<ItemIndex, int> dictionary = new Dictionary<ItemIndex, int>(); foreach (PickupIndex val2 in itemsToTake) { PickupDef pickupDef = PickupCatalog.GetPickupDef(val2); if (pickupDef == null || (int)pickupDef.itemIndex == -1) { return true; } dictionary.TryGetValue(pickupDef.itemIndex, out var value2); dictionary[pickupDef.itemIndex] = value2 + 1; } int num = value; foreach (KeyValuePair<ItemIndex, int> item in dictionary) { num = Math.Min(num, component.inventory.GetItemCountPermanent(item.Key) / item.Value); } if (num <= 1) { return true; } foreach (KeyValuePair<ItemIndex, int> item2 in dictionary) { component.inventory.RemoveItemPermanent(item2.Key, item2.Value * num); __instance.CreateItemTakenOrb(((Component)activator).transform.position, ((Component)__instance).gameObject, PickupCatalog.FindPickupIndex(item2.Key)); } PickupDef pickupDef2 = PickupCatalog.GetPickupDef(reward); if (pickupDef2 != null && (int)pickupDef2.itemIndex != -1) { component.inventory.GiveItemPermanent(pickupDef2.itemIndex, count * (num - 1)); } if ((Object)(object)__instance.esm != (Object)null) { WaitToBeginCooking val3 = new WaitToBeginCooking(); ((MealPrepBaseState)val3).pickupsToTake = new List<PickupIndex>(itemsToTake); ((MealPrepBaseState)val3).pickupToDrop = reward; ((MealPrepBaseState)val3).amountToDrop = count; __instance.esm.SetNextState((EntityState)(object)val3); } Chat.AddMessage("<color=#f2c46b>Повар: приготовлено ×" + num + "</color>"); return false; } private static void CookStateEnterPrefix(object __instance) { Type type = __instance.GetType(); FieldInfo fieldInfo = AccessTools.Field(type, "duration"); if (!(fieldInfo == null) && fieldInfo.IsStatic) { if (!originalDurations.TryGetValue(type, out var value)) { value = (float)fieldInfo.GetValue(null); originalDurations[type] = value; } fieldInfo.SetValue(null, value / Math.Max(0.1f, CookSpeed.Value)); } } } internal class BrewMessage : MessageBase { public GameObject cauldron; public int times; public List<int> items = new List<int>(); public List<int> counts = new List<int>(); public override void Serialize(NetworkWriter writer) { writer.Write(cauldron); writer.Write(times); writer.Write(items.Count); for (int i = 0; i < items.Count; i++) { writer.Write(items[i]); writer.Write(counts[i]); } } public override void Deserialize(NetworkReader reader) { cauldron = reader.ReadGameObject(); times = reader.ReadInt32(); int num = Math.Min(reader.ReadInt32(), 1000); items = new List<int>(num); counts = new List<int>(num); for (int i = 0; i < num; i++) { items.Add(reader.ReadInt32()); counts.Add(reader.ReadInt32()); } } } internal class CookAmountMessage : MessageBase { public int amount; public override void Serialize(NetworkWriter writer) { writer.Write(amount); } public override void Deserialize(NetworkReader reader) { amount = reader.ReadInt32(); } } internal class BrewMenu : MonoBehaviour { private Submenu menu; private PauseScreenController pause; private GameObject cauldron; private PurchaseInteraction purchase; private ShopTerminalBehavior shop; private ItemTier tier; private int times = 1; private readonly Dictionary<ItemIndex, int> give = new Dictionary<ItemIndex, int>(); private TextMeshProUGUI timesText; private TextMeshProUGUI status; private RectTransform grid; private GameObject brewButton; private static readonly Dictionary<ItemIndex, Sprite> icons = new Dictionary<ItemIndex, Sprite>(); private Inventory LocalInventory { get { CharacterMaster val = BulkBrewPlugin.LocalMaster(); if (!((Object)(object)val != (Object)null)) { return null; } return val.inventory; } } private int Needed => purchase.cost * times; public static void Open(GameObject cauldron, PurchaseInteraction purchase, ShopTerminalBehavior shop) { //IL_003f: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) GameObject val = PauseScreenController.InstantiatePauseScreen(true); PauseScreenController val2 = (((Object)(object)val != (Object)null) ? val.GetComponentInChildren<PauseScreenController>(true) : null); if ((Object)(object)val2 == (Object)null) { throw new InvalidOperationException("pause screen not found"); } Submenu submenu = RoR2Ui.OpenSubmenu(val2, "BulkBrewMenu", new Vector2(0.18f, 0.1f), new Vector2(0.82f, 0.9f)); BrewMenu brewMenu = submenu.root.AddComponent<BrewMenu>(); brewMenu.menu = submenu; brewMenu.pause = val2; brewMenu.cauldron = cauldron; brewMenu.purchase = purchase; brewMenu.shop = shop; brewMenu.tier = BulkBrewPlugin.TierFor(purchase.costType).Value; brewMenu.Build(); } private void Build() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Expected O, but got Unknown //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: 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_0203: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Expected O, but got Unknown //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Expected O, but got Unknown //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Expected O, but got Unknown //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Expected O, but got Unknown //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Expected O, but got Unknown menu.Title("Котёл"); PickupDef pickupDef = PickupCatalog.GetPickupDef(shop.CurrentPickupIndex()); string text = ((pickupDef != null) ? ("<color=#" + ColorUtility.ToHtmlStringRGB(pickupDef.baseColor) + ">" + Language.GetString(pickupDef.nameToken) + "</color>") : "?"); menu.Text((Transform)(object)menu.box, purchase.cost + " предм. за варку → 1 " + text, 22f, (TextAlignmentOptions)514, Color.white); RectTransform val = menu.Row((Transform)(object)menu.box, 46f); timesText = menu.Text((Transform)(object)val, "", 24f, (TextAlignmentOptions)4097, RoR2Ui.HeaderText); RoR2Ui.Size(((Component)timesText).gameObject, -1f, 220f); AddTimesButton((Transform)(object)val, "−10", -10); AddTimesButton((Transform)(object)val, "−1", -1); AddTimesButton((Transform)(object)val, "+1", 1); AddTimesButton((Transform)(object)val, "+10", 10); menu.Button((Transform)(object)val, "Макс", (UnityAction)delegate { times = Math.Max(1, MaxTimes()); Refresh(); }); status = menu.Text((Transform)(object)menu.box, "", 18f, (TextAlignmentOptions)514, RoR2Ui.MutedText); RectTransform parent = menu.ScrollList((Transform)(object)menu.box); grid = RoR2Ui.NewRect("Grid", (Transform)(object)parent); GridLayoutGroup val2 = ((Component)grid).gameObject.AddComponent<GridLayoutGroup>(); val2.cellSize = new Vector2(84f, 84f); val2.spacing = new Vector2(8f, 8f); ((LayoutGroup)val2).padding = new RectOffset(8, 8, 8, 8); RectTransform parent2 = menu.Row((Transform)(object)menu.box, 46f); menu.Button((Transform)(object)parent2, "Авто", (UnityAction)delegate { AutoFill(); Refresh(); }); menu.Button((Transform)(object)parent2, "Сбросить", (UnityAction)delegate { give.Clear(); Refresh(); }); brewButton = menu.Button((Transform)(object)parent2, "Сварить", new UnityAction(Brew)); menu.Button((Transform)(object)parent2, "Назад", new UnityAction(Close)); Refresh(); } private void AddTimesButton(Transform row, string label, int delta) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown GameObject go = menu.Button(row, label, (UnityAction)delegate { times = Math.Max(1, times + delta); Refresh(); }); RoR2Ui.Size(go, 46f, 90f); } private int Have(ItemIndex index) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) Inventory localInventory = LocalInventory; if (!((Object)(object)localInventory != (Object)null)) { return 0; } return localInventory.GetItemCountPermanent(index); } private List<ItemDef> Candidates() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) List<ItemDef> list = new List<ItemDef>(); for (int i = 0; i < ItemCatalog.itemCount; i++) { ItemDef itemDef = ItemCatalog.GetItemDef((ItemIndex)i); if (BulkBrewPlugin.CanGive(itemDef, tier) && Have(itemDef.itemIndex) > 0) { list.Add(itemDef); } } list.Sort((ItemDef a, ItemDef b) => Have(b.itemIndex).CompareTo(Have(a.itemIndex))); return list; } private int MaxTimes() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) int num = 0; foreach (ItemDef item in Candidates()) { num += Have(item.itemIndex); } if (purchase.cost <= 0) { return 0; } return num / purchase.cost; } private int Selected() { int num = 0; foreach (int value in give.Values) { num += value; } return num; } private int GiveOf(ItemIndex index) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) if (!give.TryGetValue(index, out var value)) { return 0; } return value; } private void Change(ItemIndex index, int delta) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) int num = GiveOf(index); int val = Needed - Selected(); if (delta > 0) { delta = Math.Min(delta, Math.Min(val, Have(index) - num)); } int num2 = Math.Max(0, num + delta); if (num2 == 0) { give.Remove(index); } else { give[index] = num2; } } private void AutoFill() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) times = Math.Max(1, Math.Min(times, MaxTimes())); foreach (ItemDef item in Candidates()) { int num = Needed - Selected(); if (num > 0) { Change(item.itemIndex, num); continue; } break; } } private void Refresh() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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) while (Selected() > Needed) { foreach (ItemIndex item in new List<ItemIndex>(give.Keys)) { if (Selected() > Needed) { Change(item, -(Selected() - Needed)); continue; } break; } } ((TMP_Text)timesText).text = "Варок: " + times; int num = Selected(); ((TMP_Text)status).text = "Нужно отдать: " + Needed + " · выбрано: " + ((num == Needed) ? "<color=#77d14a>" : "<color=#f2c46b>") + num + "</color> · можно сварить максимум " + MaxTimes() + "\nЛКМ +1, Shift ×10, Ctrl ×100, ПКМ — убрать"; brewButton.SetActive(num == Needed && Needed > 0); Submenu.Clear((Transform)(object)grid); foreach (ItemDef item2 in Candidates()) { AddCell(item2); } } private void AddCell(ItemDef item) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_011c: Expected O, but got Unknown //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Expected O, but got Unknown //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) ItemIndex index = item.itemIndex; PickupDef pickupDef = PickupCatalog.GetPickupDef(PickupCatalog.FindPickupIndex(index)); Color val = pickupDef?.baseColor ?? Color.white; RectTransform val2 = RoR2Ui.NewRect("Cell", (Transform)(object)grid); Image val3 = ((Component)val2).gameObject.AddComponent<Image>(); ((Graphic)val3).color = new Color(val.r * 0.35f, val.g * 0.35f, val.b * 0.35f, 0.95f); Outline val4 = ((Component)val2).gameObject.AddComponent<Outline>(); ((Shadow)val4).effectColor = ((GiveOf(index) > 0) ? RoR2Ui.HeaderText : val); ((Shadow)val4).effectDistance = new Vector2(2f, -2f); Button val5 = ((Component)val2).gameObject.AddComponent<Button>(); ((Selectable)val5).targetGraphic = (Graphic)(object)val3; Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)val5).navigation = navigation; ((UnityEvent)val5.onClick).AddListener((UnityAction)delegate { //IL_0007: Unknown result type (might be due to invalid IL or missing references) Change(index, BulkBrewPlugin.ClickAmount()); Refresh(); }); ((Component)val2).gameObject.AddComponent<RightClick>().action = (UnityAction)delegate { //IL_0007: Unknown result type (might be due to invalid IL or missing references) Change(index, -BulkBrewPlugin.ClickAmount()); Refresh(); }; TooltipProvider val6 = ((Component)val2).gameObject.AddComponent<TooltipProvider>(); val6.titleToken = item.nameToken; val6.titleColor = pickupDef?.darkColor ?? Color.gray; val6.bodyToken = item.pickupToken; Sprite val7 = Icon(item); if ((Object)(object)val7 != (Object)null) { RectTransform val8 = RoR2Ui.NewRect("Icon", (Transform)(object)val2); RoR2Ui.Stretch(val8, Vector2.zero, Vector2.one); val8.offsetMin = new Vector2(6f, 6f); val8.offsetMax = new Vector2(-6f, -6f); Image val9 = ((Component)val8).gameObject.AddComponent<Image>(); val9.sprite = val7; val9.preserveAspect = true; ((Graphic)val9).raycastTarget = false; } TextMeshProUGUI val10 = menu.Text((Transform)(object)val2, "x" + Have(index), 18f, (TextAlignmentOptions)1028, Color.white); RoR2Ui.Stretch(((TMP_Text)val10).rectTransform, Vector2.zero, Vector2.one); ((TMP_Text)val10).rectTransform.offsetMax = new Vector2(-5f, -2f); ((TMP_Text)val10).fontStyle = (FontStyles)1; ((TMP_Text)val10).outlineWidth = 0.25f; if (GiveOf(index) > 0) { TextMeshProUGUI val11 = menu.Text((Transform)(object)val2, "→" + GiveOf(index), 20f, (TextAlignmentOptions)257, RoR2Ui.HeaderText); RoR2Ui.Stretch(((TMP_Text)val11).rectTransform, Vector2.zero, Vector2.one); ((TMP_Text)val11).rectTransform.offsetMin = new Vector2(5f, 0f); ((TMP_Text)val11).fontStyle = (FontStyles)1; ((TMP_Text)val11).outlineWidth = 0.25f; } } private void Brew() { if (Selected() == Needed && !((Object)(object)cauldron == (Object)null)) { BulkBrewPlugin.SendBrew(cauldron, times, give); Close(); } } private void Close() { if ((Object)(object)pause != (Object)null) { pause.DestroyPauseScreen(true); } else { menu.Close(); } } private static Sprite Icon(ItemDef item) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_0054: Unknown result type (might be due to invalid IL or missing references) if (icons.TryGetValue(item.itemIndex, out var value) && (Object)(object)value != (Object)null) { return value; } value = item.pickupIconSprite; if ((Object)(object)value == (Object)null && item.pickupIconSpriteReference != null && ((AssetReference)item.pickupIconSpriteReference).RuntimeKeyIsValid()) { try { value = Addressables.LoadAssetAsync<Sprite>(((AssetReference)item.pickupIconSpriteReference).RuntimeKey).WaitForCompletion(); } catch (Exception) { value = null; } } icons[item.itemIndex] = value; return value; } } internal class RightClick : MonoBehaviour, IPointerClickHandler, IEventSystemHandler { public UnityAction action; public void OnPointerClick(PointerEventData eventData) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)eventData.button == 1 && action != null) { action.Invoke(); } } } } namespace GameImprovement.Ui { internal static class RoR2Ui { public static readonly Color BoxColor = new Color(0.09f, 0.1f, 0.12f, 0.96f); public static readonly Color MutedText = new Color(0.72f, 0.75f, 0.8f); public static readonly Color HeaderText = new Color(0.95f, 0.8f, 0.45f); private static readonly FieldInfo SubmenuField = AccessTools.Field(typeof(PauseScreenController), "submenuObject"); public static GameObject AddPauseButton(PauseScreenController pause, string name, string label, UnityAction onClick) { GameObject exitGameButton = pause.exitGameButton; if ((Object)(object)exitGameButton == (Object)null) { return null; } GameObject val = CloneButton(exitGameButton, exitGameButton.transform.parent, label, onClick); ((Object)val).name = name; val.transform.SetSiblingIndex(exitGameButton.transform.GetSiblingIndex()); return val; } public static Submenu OpenSubmenu(PauseScreenController pause, string name, Vector2 anchorMin, Vector2 anchorMax) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Expected O, but got Unknown GameObject val = ((!(SubmenuField != null)) ? ((GameObject)null) : ((GameObject)SubmenuField.GetValue(pause))); if (Object.op_Implicit((Object)(object)val)) { Object.Destroy((Object)(object)val); } GameObject val2 = new GameObject(name, new Type[1] { typeof(RectTransform) }); RectTransform val3 = (RectTransform)val2.transform; ((Transform)val3).SetParent((Transform)(object)pause.rootPanel, false); Stretch(val3, Vector2.zero, Vector2.one); Image val4 = val2.AddComponent<Image>(); ((Graphic)val4).color = new Color(0f, 0f, 0f, 0.6f); RectTransform val5 = NewRect("Box", (Transform)(object)val3); Stretch(val5, anchorMin, anchorMax); ((Graphic)((Component)val5).gameObject.AddComponent<Image>()).color = BoxColor; Outline val6 = ((Component)val5).gameObject.AddComponent<Outline>(); ((Shadow)val6).effectColor = new Color(0.55f, 0.6f, 0.65f, 0.6f); ((Shadow)val6).effectDistance = new Vector2(2f, -2f); VerticalLayoutGroup val7 = ((Component)val5).gameObject.AddComponent<VerticalLayoutGroup>(); ((LayoutGroup)val7).padding = new RectOffset(24, 24, 18, 18); ((HorizontalOrVerticalLayoutGroup)val7).spacing = 10f; ((HorizontalOrVerticalLayoutGroup)val7).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)val7).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)val7).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)val7).childForceExpandHeight = false; if (SubmenuField != null) { SubmenuField.SetValue(pause, val2); } ((Component)pause.pausePanel).gameObject.SetActive(false); ((Component)pause.gameMenuPanel).gameObject.SetActive(true); ((Component)pause.mainPanel).gameObject.SetActive(false); Submenu submenu = new Submenu(); submenu.root = val2; submenu.box = val5; submenu.buttonTemplate = pause.exitGameButton; TextMeshProUGUI val8 = (((Object)(object)pause.exitGameButton != (Object)null) ? pause.exitGameButton.GetComponentInChildren<TextMeshProUGUI>(true) : null); submenu.font = (((Object)(object)val8 != (Object)null) ? ((TMP_Text)val8).font : null); return submenu; } public static GameObject CloneButton(GameObject template, Transform parent, string label, UnityAction onClick) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown GameObject val = Object.Instantiate<GameObject>(template, parent); LanguageTextMeshController[] componentsInChildren = val.GetComponentsInChildren<LanguageTextMeshController>(true); foreach (LanguageTextMeshController val2 in componentsInChildren) { Object.DestroyImmediate((Object)(object)val2); } SetButtonText(val, label); Button component = val.GetComponent<Button>(); if ((Object)(object)component != (Object)null) { component.onClick = new ButtonClickedEvent(); if (onClick != null) { ((UnityEvent)component.onClick).AddListener(onClick); } } val.SetActive(true); return val; } public static void SetButtonText(GameObject button, string label) { TextMeshProUGUI[] componentsInChildren = button.GetComponentsInChildren<TextMeshProUGUI>(true); foreach (TextMeshProUGUI val in componentsInChildren) { ((TMP_Text)val).text = label; } } public static RectTransform NewRect(string name, Transform parent) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); RectTransform val2 = (RectTransform)val.transform; ((Transform)val2).SetParent(parent, false); return val2; } public static void Stretch(RectTransform rt, Vector2 min, Vector2 max) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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) rt.anchorMin = min; rt.anchorMax = max; rt.offsetMin = Vector2.zero; rt.offsetMax = Vector2.zero; ((Transform)rt).localScale = Vector3.one; } public static LayoutElement Size(GameObject go, float height, float width) { LayoutElement val = go.GetComponent<LayoutElement>(); if ((Object)(object)val == (Object)null) { val = go.AddComponent<LayoutElement>(); } if (height >= 0f) { val.minHeight = height; val.preferredHeight = height; val.flexibleHeight = 0f; } if (width >= 0f) { val.minWidth = width; val.preferredWidth = width; val.flexibleWidth = 0f; } return val; } } internal class Submenu { public const float ButtonHeight = 46f; public GameObject root; public RectTransform box; public GameObject buttonTemplate; public TMP_FontAsset font; public void Close() { if ((Object)(object)root != (Object)null) { Object.Destroy((Object)(object)root); } } public TextMeshProUGUI Text(Transform parent, string text, float size, TextAlignmentOptions align, Color color) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) RectTransform val = RoR2Ui.NewRect("Text", parent); TextMeshProUGUI val2 = ((Component)val).gameObject.AddComponent<TextMeshProUGUI>(); if ((Object)(object)font != (Object)null) { ((TMP_Text)val2).font = font; } ((TMP_Text)val2).text = text; ((TMP_Text)val2).fontSize = size; ((TMP_Text)val2).alignment = align; ((Graphic)val2).color = color; ((Graphic)val2).raycastTarget = false; ((TMP_Text)val2).enableWordWrapping = true; return val2; } public TextMeshProUGUI Title(string text) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI val = Text((Transform)(object)box, text, 38f, (TextAlignmentOptions)514, Color.white); RoR2Ui.Size(((Component)val).gameObject, 48f, -1f); return val; } public GameObject Button(Transform parent, string label, UnityAction onClick) { GameObject val = RoR2Ui.CloneButton(buttonTemplate, parent, label, onClick); LayoutElement val2 = RoR2Ui.Size(val, 46f, -1f); val2.minWidth = 0f; val2.preferredWidth = 0f; val2.flexibleWidth = 1f; TextMeshProUGUI[] componentsInChildren = val.GetComponentsInChildren<TextMeshProUGUI>(true); foreach (TextMeshProUGUI val3 in componentsInChildren) { ((TMP_Text)val3).enableAutoSizing = true; ((TMP_Text)val3).fontSizeMin = 12f; ((TMP_Text)val3).fontSizeMax = 20f; ((TMP_Text)val3).enableWordWrapping = false; } return val; } public RectTransform Row(Transform parent, float height) { RectTransform val = RoR2Ui.NewRect("Row", parent); RoR2Ui.Size(((Component)val).gameObject, height, -1f); HorizontalLayoutGroup val2 = ((Component)val).gameObject.AddComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)val2).spacing = 10f; ((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)val2).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)val2).childForceExpandHeight = true; ((LayoutGroup)val2).childAlignment = (TextAnchor)3; return val; } public TMP_InputField Input(Transform parent, string value, float width, UnityAction<string> onEndEdit) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) RectTransform val = RoR2Ui.NewRect("Input", parent); Image val2 = ((Component)val).gameObject.AddComponent<Image>(); ((Graphic)val2).color = new Color(0.02f, 0.03f, 0.04f, 0.9f); Outline val3 = ((Component)val).gameObject.AddComponent<Outline>(); ((Shadow)val3).effectColor = new Color(0.45f, 0.5f, 0.55f, 0.7f); LayoutElement val4 = RoR2Ui.Size(((Component)val).gameObject, 40f, width); if (width < 0f) { val4.flexibleWidth = 1f; } RectTransform val5 = RoR2Ui.NewRect("Text Area", (Transform)(object)val); RoR2Ui.Stretch(val5, Vector2.zero, Vector2.one); val5.offsetMin = new Vector2(10f, 4f); val5.offsetMax = new Vector2(-10f, -4f); ((Component)val5).gameObject.AddComponent<RectMask2D>(); TextMeshProUGUI val6 = Text((Transform)(object)val5, "", 20f, (TextAlignmentOptions)4097, Color.white); ((TMP_Text)val6).enableWordWrapping = false; RoR2Ui.Stretch(((TMP_Text)val6).rectTransform, Vector2.zero, Vector2.one); TMP_InputField val7 = ((Component)val).gameObject.AddComponent<TMP_InputField>(); val7.textViewport = val5; val7.textComponent = (TMP_Text)(object)val6; if ((Object)(object)font != (Object)null) { val7.fontAsset = font; } val7.pointSize = 20f; ((Selectable)val7).targetGraphic = (Graphic)(object)val2; val7.text = value ?? ""; if (onEndEdit != null) { ((UnityEvent<string>)(object)val7.onEndEdit).AddListener(onEndEdit); } return val7; } public RectTransform ScrollList(Transform parent) { //IL_004d: 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) //IL_00b4: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown RectTransform val = RoR2Ui.NewRect("Scroll", parent); LayoutElement val2 = ((Component)val).gameObject.AddComponent<LayoutElement>(); val2.flexibleHeight = 1f; val2.minHeight = 120f; ((Graphic)((Component)val).gameObject.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.35f); ((Component)val).gameObject.AddComponent<RectMask2D>(); ScrollRect val3 = ((Component)val).gameObject.AddComponent<ScrollRect>(); val3.horizontal = false; val3.movementType = (MovementType)2; val3.scrollSensitivity = 40f; RectTransform val4 = RoR2Ui.NewRect("Content", (Transform)(object)val); val4.anchorMin = new Vector2(0f, 1f); val4.anchorMax = new Vector2(1f, 1f); val4.pivot = new Vector2(0.5f, 1f); val4.offsetMin = Vector2.zero; val4.offsetMax = Vector2.zero; VerticalLayoutGroup val5 = ((Component)val4).gameObject.AddComponent<VerticalLayoutGroup>(); ((LayoutGroup)val5).padding = new RectOffset(16, 16, 10, 14); ((HorizontalOrVerticalLayoutGroup)val5).spacing = 4f; ((HorizontalOrVerticalLayoutGroup)val5).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)val5).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)val5).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)val5).childForceExpandHeight = false; ContentSizeFitter val6 = ((Component)val4).gameObject.AddComponent<ContentSizeFitter>(); val6.verticalFit = (FitMode)2; val3.content = val4; val3.viewport = val; return val4; } public static void Clear(Transform parent) { for (int num = parent.childCount - 1; num >= 0; num--) { Object.Destroy((Object)(object)((Component)parent.GetChild(num)).gameObject); } } } }