Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of Schedule Maintenance v2.0.9
Mods/MixingStationMkIII.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.Json; using System.Text.Json.Nodes; using System.Text.RegularExpressions; using HarmonyLib; using Il2CppFishNet; using Il2CppFishNet.Connection; using Il2CppFishNet.Object; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppNewtonsoft.Json; using Il2CppScheduleOne; using Il2CppScheduleOne.Audio; using Il2CppScheduleOne.Avatar; using Il2CppScheduleOne.AvatarFramework; using Il2CppScheduleOne.AvatarFramework.Equipping; using Il2CppScheduleOne.Building; using Il2CppScheduleOne.Core; using Il2CppScheduleOne.Core.Avatar; using Il2CppScheduleOne.Core.Avatar.Properties; using Il2CppScheduleOne.Core.Items.Framework; using Il2CppScheduleOne.DevUtilities; using Il2CppScheduleOne.Dialogue; using Il2CppScheduleOne.Doors; using Il2CppScheduleOne.Economy; using Il2CppScheduleOne.Effects; using Il2CppScheduleOne.Employees; using Il2CppScheduleOne.EntityFramework; using Il2CppScheduleOne.Equipping; using Il2CppScheduleOne.Experimental; using Il2CppScheduleOne.GameTime; using Il2CppScheduleOne.Growing; using Il2CppScheduleOne.Instancing; using Il2CppScheduleOne.Interaction; using Il2CppScheduleOne.ItemFramework; using Il2CppScheduleOne.Levelling; using Il2CppScheduleOne.Lighting; using Il2CppScheduleOne.Management; using Il2CppScheduleOne.Map; using Il2CppScheduleOne.Messaging; using Il2CppScheduleOne.Misc; using Il2CppScheduleOne.Money; using Il2CppScheduleOne.NPCs; using Il2CppScheduleOne.NPCs.Behaviour; using Il2CppScheduleOne.NPCs.Framework; using Il2CppScheduleOne.NPCs.Relation; using Il2CppScheduleOne.NPCs.Schedules; using Il2CppScheduleOne.ObjectScripts; using Il2CppScheduleOne.ObjectScripts.Soil; using Il2CppScheduleOne.ObjectScripts.WateringCan; using Il2CppScheduleOne.Packaging; using Il2CppScheduleOne.Persistence; using Il2CppScheduleOne.Persistence.Datas; using Il2CppScheduleOne.Persistence.Loaders; using Il2CppScheduleOne.PlayerScripts; using Il2CppScheduleOne.PlayerTasks; using Il2CppScheduleOne.Product; using Il2CppScheduleOne.Product.Packaging; using Il2CppScheduleOne.Property; using Il2CppScheduleOne.Quests; using Il2CppScheduleOne.Skating; using Il2CppScheduleOne.StationFramework; using Il2CppScheduleOne.Storage; using Il2CppScheduleOne.Tiles; using Il2CppScheduleOne.Tools; using Il2CppScheduleOne.Trash; using Il2CppScheduleOne.UI; using Il2CppScheduleOne.UI.Items; using Il2CppScheduleOne.UI.Phone.Delivery; using Il2CppScheduleOne.UI.Phone.Messages; using Il2CppScheduleOne.UI.Shop; using Il2CppScheduleOne.UI.Stations; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Il2CppSystem.Reflection; using Il2CppTMPro; using Il2CppVLB; using MelonLoader; using MelonLoader.Preferences; using MelonLoader.Utils; using Microsoft.CodeAnalysis; using MixingStationMkIII; using MixingStationMkIII.Model; using MixingStationMkIII.UI; using S1API.Economy; using S1API.Entities; using S1API.Entities.Appearances.CustomizationFields; using S1API.Entities.Dealer; using S1API.Entities.Relation; using S1API.Entities.Schedule; using S1API.Interaction; using S1API.Internal.Abstraction; using S1API.Map; using S1API.Quests; using S1API.Quests.Constants; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(Mod), "Schedule Maintenance", "2.0.9", "beagl", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: HarmonyDontPatchAll] [assembly: AssemblyCompany("MixingStationMkIII")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MixingStationMkIII")] [assembly: AssemblyTitle("MixingStationMkIII")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [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 MixingStationMkIII { public sealed class ACertainCookQuest : Quest { public readonly QuestEntry Find; public readonly QuestEntry Recruit; public static ACertainCookQuest Instance { get; private set; } protected override string Title => "A Certain Cook"; protected override string Description => "Heisenberg says a guy calling himself Cap'n Cook can move product. He lives out of an RV."; protected override bool AutoBegin => false; public QuestState State => ((Quest)this).QuestState; public ACertainCookQuest() { //IL_0013: 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) Instance = this; Find = ((Quest)this).AddEntry("Find Cap'n Cook's RV", (Vector3?)CapnCook.Door); Recruit = ((Quest)this).AddEntry("Pay Cap'n Cook $8,000 to move your product", (Vector3?)CapnCook.Door); } } internal sealed class BinSpec { public string Id; public string Name; public string Description; public string Icon; public string Key; public ERank FallbackRank; public int Tiles; public ModelFile Model; public float CenterX; public float CenterZ; public float HalfX; public float HalfZ; public float FloorY; public float TopY; public float Height; public (Vector3 center, Vector3 size)[] Colliders; public Vector3 BagSpawn; public BuildableItemDefinition Def; public int Price => Math.Max(0, ModConfig.Int(Key + "Price")); public int Capacity => Math.Max(1, (int)Math.Round(20f * Math.Clamp(ModConfig.Float(Key + "Capacity"), 0.1f, 100f))); } [HarmonyPatch(typeof(MixingStation), "SendMixingOperation")] internal static class BlockVanillaMixPatch { private static bool Prefix(MixingStation __instance) { if (!Machine.SendingOwnMix) { return Machines.Get(__instance) == null; } return true; } } internal static class BoostBoard { private sealed class Ride { public Skateboard Board; public float BaseTop; public float BasePush; public float BaseTurn; public float BaseGrip; public Transform[] Nozzles = (Transform[])(object)new Transform[0]; public TrailRenderer[] Trails = (TrailRenderer[])(object)new TrailRenderer[0]; public Light Glow; public ParticleSystem Embers; public float Boost; public float EmberAcc; public Transform Holder; public bool Checked; } public const string Id = "boostboard"; private const string Marker = "SM Boost Board"; private static readonly ModelFile Model = new ModelFile("boostboard.bin", "Boost Board"); private static StorableItemDefinition _def; private static GameObject _holder; private static Material _flameMat; private static Material _emberMat; private static readonly Dictionary<IntPtr, Ride> Rides = new Dictionary<IntPtr, Ride>(); private static bool _ridFlip; private static bool Alive(Ride r) { if ((Object)(object)r.Board != (Object)null && !((Il2CppObjectBase)r.Board).WasCollected && (Object)(object)r.Holder != (Object)null && !((Il2CppObjectBase)r.Holder).WasCollected) { return r.Nozzles.All((Transform n) => (Object)(object)n != (Object)null && !((Il2CppObjectBase)n).WasCollected); } return false; } private static Vector3 Exhaust(Ride r) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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) if (!((Object)(object)r.Holder != (Object)null)) { return -((Component)r.Board).transform.forward; } return r.Holder.forward; } public static void EnsureRegistered() { //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Expected O, but got Unknown Registry instance = Singleton<Registry>.Instance; if ((Object)(object)instance == (Object)null) { return; } try { if (Registry.ItemExists("boostboard")) { if (_def == null) { ItemDefinition item = Registry.GetItem("boostboard"); _def = ((item != null) ? ((Il2CppObjectBase)item).TryCast<StorableItemDefinition>() : null); } return; } List<ItemDefinition> allItems = instance.GetAllItems(); StorableItemDefinition val = null; for (int i = 0; i < allItems.Count; i++) { if (!((Object)(object)val == (Object)null)) { break; } ItemDefinition obj = allItems[i]; StorableItemDefinition val2 = ((obj != null) ? ((Il2CppObjectBase)obj).TryCast<StorableItemDefinition>() : null); object obj2; if (val2 == null) { obj2 = null; } else { Equippable equippable = ((ItemDefinition)val2).Equippable; obj2 = ((equippable != null) ? ((Il2CppObjectBase)equippable).TryCast<Skateboard_Equippable>() : null); } Skateboard_Equippable val3 = (Skateboard_Equippable)obj2; if ((Object)(object)((val3 != null) ? val3.SkateboardPrefab : null) != (Object)null && ((BaseItemDefinition)val2).ID != "boostboard" && ((BaseItemDefinition)val2).ID != "goldenoffroadskateboard" && ((Object)((Component)val3.SkateboardPrefab).gameObject).name.ToLowerInvariant().Contains("offroad")) { val = val2; } } if ((Object)(object)val == (Object)null) { Mod.Log.Warning("Off-road skateboard not found; Boost Board not registered."); return; } StorableItemDefinition val4 = Object.Instantiate<StorableItemDefinition>(val); ((Object)val4).name = "BoostBoard"; ((Object)val4).hideFlags = (HideFlags)32; ((BaseItemDefinition)val4).ID = "boostboard"; ((BaseItemDefinition)val4).Name = "Boost Board"; ((BaseItemDefinition)val4).Description = "A reinforced off-road board fitted with twin rocket boosters for bursts of crazzyyy speed."; val4.BasePurchasePrice = ModConfig.BoostBoardPrice; Sprite val5 = ModIcons.Load("boostboard_icon.png", "Boost Board Icon"); if ((Object)(object)val5 != (Object)null) { ((BaseItemDefinition)val4).Icon = val5; } if ((Object)(object)_holder == (Object)null || ((Il2CppObjectBase)_holder).WasCollected) { _holder = new GameObject("Schedule Maintenance boost board prefabs"); _holder.SetActive(false); Object.DontDestroyOnLoad((Object)(object)_holder); } if ((Object)(object)((ItemDefinition)val).Equippable != (Object)null) { GameObject val6 = Object.Instantiate<GameObject>(((Component)((ItemDefinition)val).Equippable).gameObject, _holder.transform); ((Object)val6).name = "SM Boost Board (equipped)"; Dress(val6); ((ItemDefinition)val4).Equippable = val6.GetComponent<Equippable>(); } if ((Object)(object)val.StoredItem != (Object)null) { GameObject val7 = Object.Instantiate<GameObject>(((Component)val.StoredItem).gameObject, _holder.transform); ((Object)val7).name = "SM Boost Board (stored)"; Dress(val7); val4.StoredItem = val7.GetComponent<StoredItem>(); } instance.AddToRegistry((ItemDefinition)(object)val4); _def = val4; Mod.Log.Msg($"Registered '{"boostboard"}' (cloned from '{((BaseItemDefinition)val).ID}'), ${ModConfig.BoostBoardPrice}."); } catch (Exception value) { Mod.Log.Error($"Failed to register the Boost Board: {value}"); } } public static Option Option() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0053: Expected O, but got Unknown EnsureRegistered(); if ((Object)(object)_def == (Object)null) { return null; } return new Option { Name = ((BaseItemDefinition)_def).Name, Price = ModConfig.BoostBoardPrice, IsAvailable = true, NotAvailableReason = "", Item = (ItemDefinition)(object)_def }; } public static List<Transform> Dress(GameObject root) { List<Transform> list = new List<Transform>(); foreach (MeshRenderer componentsInChild in root.GetComponentsInChildren<MeshRenderer>(true)) { if (((Object)((Component)componentsInChild).gameObject).name != "Plane") { continue; } bool flag = false; foreach (Material item in (Il2CppArrayBase<Material>)(object)((Renderer)componentsInChild).sharedMaterials) { if ((Object)(object)item != (Object)null && ((Object)item).name.StartsWith("offroad skateboard mat")) { flag = true; } } if (!flag) { continue; } ((Renderer)componentsInChild).enabled = false; Transform parent = ((Component)componentsInChild).transform.parent; if (!((Object)(object)parent == (Object)null)) { Model.Build(parent); Transform val = parent.Find("SM Model"); if (!((Object)(object)val == (Object)null)) { list.Add(val); } } } return list; } private static Material FlameMat() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_flameMat != (Object)null && !((Il2CppObjectBase)_flameMat).WasCollected) { return _flameMat; } _flameMat = PrismEffects.Additive("SM Boost Flame", (Texture)(object)HeliosEffects.Streak()); if ((Object)(object)_flameMat != (Object)null && _flameMat.HasProperty("_TintColor")) { _flameMat.SetColor("_TintColor", new Color(0.9f, 0.9f, 0.9f, 0.9f)); } return _flameMat; } private static Material EmberMat() { if ((Object)(object)_emberMat != (Object)null && !((Il2CppObjectBase)_emberMat).WasCollected) { return _emberMat; } _emberMat = PrismEffects.Additive("SM Boost Ember", (Texture)(object)HeliosEffects.Dot()); return _emberMat; } private static void Setup(Ride ride) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Expected O, but got Unknown //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: 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_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Expected O, but got Unknown //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Expected O, but got Unknown Skateboard board = ride.Board; List<Transform> list = Dress(((Component)board).gameObject); Transform val = (ride.Holder = list.FirstOrDefault()); if (_ridFlip) { foreach (Transform item in list) { item.localRotation = Quaternion.Euler(0f, 180f, 0f); } } ride.BaseTop = board.TopSpeed_Kmh; ride.BasePush = board.PushForceMultiplier; ride.BaseTurn = board.TurnForce; ride.BaseGrip = board.LateralFrictionForceMultiplier; if ((Object)(object)val == (Object)null) { return; } List<Transform> list2 = new List<Transform>(); List<TrailRenderer> list3 = new List<TrailRenderer>(); string[] array = new string[2] { "NozzleL", "NozzleR" }; foreach (string text in array) { if (Model.TryAnchor(text, out var pos, out var _)) { GameObject val2 = new GameObject("Boost " + text); val2.transform.SetParent(val, false); val2.transform.localPosition = pos; list2.Add(val2.transform); TrailRenderer val3 = val2.AddComponent<TrailRenderer>(); ((Renderer)val3).sharedMaterial = FlameMat(); val3.time = 0.32f; val3.minVertexDistance = 0.03f; val3.startWidth = 0.075f; val3.endWidth = 0f; val3.startColor = new Color(1f, 0.85f, 0.4f, 1f); val3.endColor = new Color(1f, 0.2f, 0.02f, 0f); val3.numCapVertices = 3; val3.emitting = false; ((Renderer)val3).shadowCastingMode = (ShadowCastingMode)0; list3.Add(val3); } } ride.Nozzles = list2.ToArray(); ride.Trails = list3.ToArray(); if (list2.Count <= 0) { return; } GameObject val4 = new GameObject("Boost Light"); val4.transform.SetParent(val, false); val4.transform.localPosition = (list2[0].localPosition + list2[list2.Count - 1].localPosition) * 0.5f + new Vector3(0f, 0f, 0.08f); ride.Glow = val4.AddComponent<Light>(); ride.Glow.type = (LightType)2; ride.Glow.color = new Color(1f, 0.5f, 0.15f); ride.Glow.range = 3f; ride.Glow.intensity = 0f; ride.Glow.shadows = (LightShadows)0; try { GameObject val5 = new GameObject("Boost Embers"); val5.transform.SetParent(val, false); ParticleSystem val6 = val5.AddComponent<ParticleSystem>(); try { val6.emission.rateOverTime = new MinMaxCurve(0f); } catch { val6.Stop(true, (ParticleSystemStopBehavior)1); } ParticleSystemRenderer component = val5.GetComponent<ParticleSystemRenderer>(); ((Renderer)component).sharedMaterial = EmberMat(); ((Renderer)component).shadowCastingMode = (ShadowCastingMode)0; val6.Play(); ride.Embers = val6; } catch (Exception ex) { Mod.Log.Warning("Boost Board embers unavailable: " + ex.Message); } } public static void OnEquippableUpdate(Skateboard_Equippable eq) { if ((Object)(object)eq == (Object)null || !((Object)((Component)eq).gameObject).name.StartsWith("SM Boost Board")) { return; } HoverBoards.HideHeld(eq); Skateboard activeSkateboard = eq.ActiveSkateboard; if ((Object)(object)activeSkateboard == (Object)null || ((Il2CppObjectBase)activeSkateboard).WasCollected || (Rides.TryGetValue(((Il2CppObjectBase)activeSkateboard).Pointer, out var value) && Alive(value))) { return; } value = new Ride { Board = activeSkateboard }; Rides[((Il2CppObjectBase)activeSkateboard).Pointer] = value; try { Setup(value); } catch (Exception ex) { Mod.Log.Warning("Boost Board setup: " + ex.Message); } } public static void Update(float dt) { if (Rides.Count == 0) { return; } foreach (IntPtr item in Rides.Keys.ToList()) { Ride ride = Rides[item]; if ((Object)(object)ride.Board == (Object)null || ((Il2CppObjectBase)ride.Board).WasCollected) { Rides.Remove(item); continue; } try { Tick(ride, dt); } catch (Exception ex) { Mod.Log.Warning("Boost Board: " + ex.Message); } } } private static void Tick(Ride ride, float dt) { //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: 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_01af: 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_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: 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_03b9: 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_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0408: 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_041c: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_0480: Unknown result type (might be due to invalid IL or missing references) //IL_048a: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_0494: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04a8: Unknown result type (might be due to invalid IL or missing references) //IL_04ad: Unknown result type (might be due to invalid IL or missing references) //IL_04b9: Unknown result type (might be due to invalid IL or missing references) //IL_04be: Unknown result type (might be due to invalid IL or missing references) //IL_04c5: Unknown result type (might be due to invalid IL or missing references) //IL_04ca: Unknown result type (might be due to invalid IL or missing references) //IL_04cf: Unknown result type (might be due to invalid IL or missing references) //IL_04d4: Unknown result type (might be due to invalid IL or missing references) //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_0510: Unknown result type (might be due to invalid IL or missing references) //IL_0523: Unknown result type (might be due to invalid IL or missing references) Skateboard board = ride.Board; bool flag = false; try { flag = (Object)(object)board.Rider != (Object)null && board.Rider.IsLocalPlayer; } catch { } bool flag2 = flag && Input.KeyHeld(ModConfig.BoostBoardKey); ride.Boost = Mathf.MoveTowards(ride.Boost, flag2 ? 1f : 0f, dt * (flag2 ? 4f : 2.5f)); float num = ModConfig.BoostBoardSpeed * Mathf.Lerp(1f, ModConfig.BoostBoardBoost, ride.Boost); float turnForce = ride.BaseTurn * (1f + (ModConfig.BoostBoardHandling - 1f) * ride.Boost); float lateralFrictionForceMultiplier = ride.BaseGrip * (1f + (ModConfig.BoostBoardHandling - 1f) * 1.5f * ride.Boost); if (ride.BaseTurn > 0f) { board.TurnForce = turnForce; } if (ride.BaseGrip > 0f) { board.LateralFrictionForceMultiplier = lateralFrictionForceMultiplier; } if (ride.BaseTop > 0f) { board.TopSpeed_Kmh = ride.BaseTop * num; } if (ride.BasePush > 0f) { board.PushForceMultiplier = ride.BasePush * num; } try { SkateboardSettings curentSettings = board.CurentSettings; if (curentSettings != null && ride.BaseTop > 0f) { curentSettings.TopSpeed_Kmh = ride.BaseTop * num; curentSettings.PushForceMultiplier = ride.BasePush * num; if (ride.BaseTurn > 0f) { curentSettings.TurnForce = turnForce; } if (ride.BaseGrip > 0f) { curentSettings.LateralFrictionForceMultiplier = lateralFrictionForceMultiplier; } } } catch { } Vector3 val = Vector3.ProjectOnPlane(((Component)board).transform.forward, Vector3.up); Vector3 normalized = ((Vector3)(ref val)).normalized; if ((Object)(object)ride.Holder != (Object)null && Vector3.Dot(ride.Holder.forward, ((Component)board).transform.forward) > 0f) { ride.Holder.localRotation = ride.Holder.localRotation * Quaternion.Euler(0f, 180f, 0f); } if (flag2 && (Object)(object)board.Rb != (Object)null && board.isGrounded) { float num2 = ride.BaseTop * num / 3.6f; if (Vector3.Dot(board.Rb.velocity, normalized) < num2) { board.Rb.AddForce(normalized * ModConfig.BoostBoardThrust, (ForceMode)5); } } TrailRenderer[] trails = ride.Trails; foreach (TrailRenderer val2 in trails) { if ((Object)(object)val2 != (Object)null) { val2.emitting = ride.Boost > 0.15f; val2.widthMultiplier = 0.6f + 0.6f * ride.Boost + 0.15f * Mathf.PerlinNoise(Time.time * 18f, (float)((Object)val2).GetHashCode() * 0.01f); } } if ((Object)(object)ride.Glow != (Object)null) { ride.Glow.intensity = ride.Boost * (2.2f + 0.8f * Mathf.PerlinNoise(Time.time * 25f, 3.1f)); } if ((Object)(object)ride.Embers != (Object)null && ride.Boost > 0.2f && ride.Nozzles.Length != 0) { ride.EmberAcc += dt * 70f * ride.Boost; int num3 = (int)ride.EmberAcc; ride.EmberAcc -= num3; Vector3 val3 = -normalized; Vector3 val4 = (((Object)(object)board.Rb != (Object)null) ? board.Rb.velocity : Vector3.zero); for (int j = 0; j < num3; j++) { Transform val5 = ride.Nozzles[j % ride.Nozzles.Length]; _ = val4 * 0.6f + val3 * Random.Range(1.5f, 3.5f) + Random.insideUnitSphere * 0.6f + Vector3.up * 0.3f; Color val6 = Color.Lerp(new Color(1f, 0.3f, 0.03f), new Color(1f, 0.85f, 0.4f), Random.value); Transform transform = ((Component)ride.Embers).transform; Vector3 val7 = transform.InverseTransformDirection(val3 * Random.Range(1.2f, 2.6f) + Random.insideUnitSphere * 0.35f + Vector3.up * 0.15f); ride.Embers.Emit(transform.InverseTransformPoint(val5.position + val3 * 0.02f), val7, Random.Range(0.02f, 0.05f), Random.Range(0.12f, 0.3f), new Color32((byte)(val6.r * 255f), (byte)(val6.g * 255f), (byte)(val6.b * 255f), byte.MaxValue)); } } } public static void Clear() { Rides.Clear(); } } [HarmonyPatch(typeof(AddSoilToGrowContainerBehaviour), "GetRequiredItemSuitableIDs")] internal static class BotanistSoilsPatch { private static void Prefix(GrowContainer growContainer) { CustomSoils.AllowIn(growContainer); } } [HarmonyPatch(typeof(BrickPressCanvas), "BeginButtonPressed")] internal static class BrickPressBeginPatch { private static bool Prefix(BrickPressCanvas __instance) { return !BrickPressMk2.IsMk2((__instance != null) ? __instance.Press : null); } } [HarmonyPatch(typeof(BrickPressCanvas), "Close")] internal static class BrickPressCanvasClosePatch { private static void Postfix(BrickPressCanvas __instance) { BrickPressMk2.RestoreCanvas(__instance); } } [HarmonyPatch(typeof(BrickPressCanvas), "Open")] internal static class BrickPressCanvasOpenPatch { private static void Postfix(BrickPressCanvas __instance) { BrickPressMk2.RestoreCanvas(__instance); BrickPressMk2.ExtraSlotUis(__instance); BrickPressMk2.DecorateCanvas(__instance); } } [HarmonyPatch(typeof(BrickPressCanvas), "UpdateUI")] internal static class BrickPressCanvasUiPatch { private static void Postfix(BrickPressCanvas __instance) { BrickPressMk2.DecorateCanvas(__instance); } } [HarmonyPatch(typeof(BrickPressCanvas), "Update")] internal static class BrickPressCanvasUpdatePatch { private static void Postfix(BrickPressCanvas __instance) { BrickPressMk2.DecorateCanvas(__instance); } } [HarmonyPatch(typeof(BrickPress), "InitializeGridItem")] internal static class BrickPressInitPatch { private static void Postfix(BrickPress __instance, ItemInstance instance) { if (((instance != null) ? ((BaseItemInstance)instance).ID : null) == "brickpressmk2") { BrickPressMk2.Attach(__instance); } } } internal static class BrickPressMk2 { private sealed class Placed { public BrickPress Press; public Transform Ram; public Vector3 RamRest; public MeshRenderer LampRun; public MeshRenderer LampIdle; public float T = -1f; public bool Pressed; public float NextCheck; public string Status = "Idle"; } private const float Down = 0.42f; private const float Slam = 0.5f; private const float Up = 0.82f; private const float RamTravel = 0.13f; private static readonly Dictionary<IntPtr, Placed> ByPress = new Dictionary<IntPtr, Placed>(); private static readonly List<GameObject> _extraUis = new List<GameObject>(); private static readonly List<(RectTransform rt, Vector2 pos)> _movedCaptions = new List<(RectTransform, Vector2)>(); public static bool IsMk2(BrickPress press) { if ((Object)(object)press != (Object)null) { return ByPress.ContainsKey(((Il2CppObjectBase)press).Pointer); } return false; } public static void Attach(BrickPress press) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) try { if (!ByPress.ContainsKey(((Il2CppObjectBase)press).Pointer)) { Dictionary<string, MeshRenderer> dictionary = StationItems.BuildVisual(((Component)press).transform, StationItems.BrickPress); Placed placed = new Placed { Press = press }; if (dictionary.TryGetValue("Ram", out var value)) { placed.Ram = ((Component)value).transform; placed.RamRest = ((Component)value).transform.localPosition; } dictionary.TryGetValue("LampRun", out placed.LampRun); dictionary.TryGetValue("LampIdle", out placed.LampIdle); Transform val = ((Component)press).transform.Find("Output"); if ((Object)(object)val != (Object)null && StationItems.BrickPress.Model.TryAnchor("Output", out var pos, out var _)) { val.localPosition = pos; val.localRotation = Quaternion.identity; WidenOutput(press); } AddProductSlots(press); ByPress[((Il2CppObjectBase)press).Pointer] = placed; Mod.Log.Msg("Brick Press MkII ready."); } } catch (Exception value2) { Mod.Log.Error($"Brick Press MkII setup failed: {value2}"); } } private static void AddProductSlots(BrickPress press) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown int num = Math.Max(2, ModConfig.BrickPressProductSlots); Il2CppReferenceArray<ItemSlot> productSlots = press.ProductSlots; if (productSlots == null || ((Il2CppArrayBase<ItemSlot>)(object)productSlots).Length >= num) { return; } IItemSlotOwner slotOwner = ((Il2CppObjectBase)press).Cast<IItemSlotOwner>(); Il2CppReferenceArray<ItemSlot> val = new Il2CppReferenceArray<ItemSlot>((long)num); for (int i = 0; i < ((Il2CppArrayBase<ItemSlot>)(object)productSlots).Length; i++) { ((Il2CppArrayBase<ItemSlot>)(object)val)[i] = ((Il2CppArrayBase<ItemSlot>)(object)productSlots)[i]; } for (int j = ((Il2CppArrayBase<ItemSlot>)(object)productSlots).Length; j < num; j++) { ItemSlot val2 = new ItemSlot(); val2.SetSlotOwner(slotOwner); List<ItemFilter> hardFilters = ((Il2CppArrayBase<ItemSlot>)(object)productSlots)[0].HardFilters; int num2 = 0; while (hardFilters != null && num2 < hardFilters.Count) { val2.AddFilter(hardFilters[num2]); num2++; } press.InputSlots?.Add(val2); ((Il2CppArrayBase<ItemSlot>)(object)val)[j] = val2; } press.ProductSlots = val; } public static void ExtraSlotUis(BrickPressCanvas canvas) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: 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_046e: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Unknown result type (might be due to invalid IL or missing references) //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_048a: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) RestoreCanvas(null); BrickPress val = ((canvas != null) ? canvas.Press : null); Il2CppReferenceArray<ItemSlotUI> val2 = ((canvas != null) ? canvas.ProductSlotUIs : null); if ((Object)(object)val == (Object)null || !IsMk2(val) || val2 == null || ((Il2CppArrayBase<ItemSlotUI>)(object)val2).Length < 2) { return; } Il2CppReferenceArray<ItemSlot> productSlots = val.ProductSlots; RectTransform component = ((Component)((Il2CppArrayBase<ItemSlotUI>)(object)val2)[0]).GetComponent<RectTransform>(); RectTransform component2 = ((Component)((Il2CppArrayBase<ItemSlotUI>)(object)val2)[1]).GetComponent<RectTransform>(); Il2CppStructArray<Vector3> val3 = new Il2CppStructArray<Vector3>(4L); component.GetWorldCorners(val3); float num = ((Il2CppArrayBase<Vector3>)(object)val3)[1].y - ((Il2CppArrayBase<Vector3>)(object)val3)[0].y; float num2 = Mathf.Abs(((Transform)component2).position.x - ((Transform)component).position.x) - (((Il2CppArrayBase<Vector3>)(object)val3)[2].x - ((Il2CppArrayBase<Vector3>)(object)val3)[1].x); float num3 = num + Mathf.Max(num * 0.12f, num2); float y = ((Transform)component).position.y; float num4 = y; float num5 = y - num3; if ((Object)(object)canvas.OutputSlotUI != (Object)null) { RectTransform component3 = ((Component)canvas.OutputSlotUI).GetComponent<RectTransform>(); _movedCaptions.Add((component3, component3.anchoredPosition)); ((Transform)component3).position = ((Transform)component3).position - new Vector3(0f, num3 * 0.5f, 0f); foreach (TextMeshProUGUI componentsInChild in ((Component)canvas).GetComponentsInChildren<TextMeshProUGUI>(true)) { if ((Object)(object)componentsInChild != (Object)null && ((TMP_Text)componentsInChild).text != null && ((TMP_Text)componentsInChild).text.Trim() == "Output" && !((TMP_Text)componentsInChild).transform.IsChildOf((Transform)(object)component3)) { RectTransform component4 = ((Component)componentsInChild).GetComponent<RectTransform>(); _movedCaptions.Add((component4, component4.anchoredPosition)); ((Transform)component4).position = ((Transform)component4).position - new Vector3(0f, num3 * 0.5f, 0f); } } } List<(RectTransform, Vector3)> list = new List<(RectTransform, Vector3)>(); foreach (TextMeshProUGUI componentsInChild2 in ((Component)canvas).GetComponentsInChildren<TextMeshProUGUI>(true)) { if ((Object)(object)componentsInChild2 != (Object)null && ((TMP_Text)componentsInChild2).text != null && ((TMP_Text)componentsInChild2).text.Trim() == "Product") { RectTransform component5 = ((Component)componentsInChild2).GetComponent<RectTransform>(); list.Add((component5, ((Transform)component5).position)); _movedCaptions.Add((component5, component5.anchoredPosition)); } } for (int i = 0; i < ((Il2CppArrayBase<ItemSlotUI>)(object)val2).Length; i++) { RectTransform component6 = ((Component)((Il2CppArrayBase<ItemSlotUI>)(object)val2)[i]).GetComponent<RectTransform>(); _movedCaptions.Add((component6, component6.anchoredPosition)); ((Transform)component6).position = new Vector3(((Transform)component6).position.x, num4, ((Transform)component6).position.z); } for (int j = ((Il2CppArrayBase<ItemSlotUI>)(object)val2).Length; j < ((Il2CppArrayBase<ItemSlot>)(object)productSlots).Length; j++) { ItemSlotUI val4 = ((Il2CppArrayBase<ItemSlotUI>)(object)val2)[j % ((Il2CppArrayBase<ItemSlotUI>)(object)val2).Length]; GameObject val5 = Object.Instantiate<GameObject>(((Component)val4).gameObject, ((Component)val4).transform.parent); ((Object)val5).name = "SM Product Slot " + j; ItemSlotUI component7 = val5.GetComponent<ItemSlotUI>(); if ((Object)(object)component7.ItemContainer != (Object)null) { for (int num6 = ((Transform)component7.ItemContainer).childCount - 1; num6 >= 0; num6--) { Object.Destroy((Object)(object)((Component)((Transform)component7.ItemContainer).GetChild(num6)).gameObject); } } foreach (TextMeshProUGUI componentsInChild3 in val5.GetComponentsInChildren<TextMeshProUGUI>(true)) { ((Component)componentsInChild3).gameObject.SetActive(false); } RectTransform component8 = val5.GetComponent<RectTransform>(); RectTransform component9 = ((Component)val4).GetComponent<RectTransform>(); ((Transform)component8).position = new Vector3(((Transform)component9).position.x, num5 - (float)(j / ((Il2CppArrayBase<ItemSlotUI>)(object)val2).Length - 1) * num3, ((Transform)component9).position.z); component7.AssignSlot(((Il2CppArrayBase<ItemSlot>)(object)productSlots)[j]); _extraUis.Add(val5); } float num7 = num5 - y; foreach (var (val6, val7) in list) { ((Transform)val6).position = val7 + new Vector3(0f, num7, 0f); } } private static void WidenOutput(BrickPress press) { //IL_00a6: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) StorageVisualizer outputVisuals = press.OutputVisuals; Il2CppReferenceArray<StorageGrid> val = ((outputVisuals != null) ? outputVisuals.StorageGrids : null); if (val == null || ((Il2CppArrayBase<StorageGrid>)(object)val).Length == 0) { return; } List<StorageGrid> list = new List<StorageGrid>(); for (int i = 0; i < ((Il2CppArrayBase<StorageGrid>)(object)val).Length; i++) { StorageGrid val2 = ((Il2CppArrayBase<StorageGrid>)(object)val)[i]; if (!((Object)(object)val2 == (Object)null)) { list.Add(val2); for (int j = 1; j < 4; j++) { GameObject val3 = Object.Instantiate<GameObject>(((Component)val2).gameObject, ((Component)val2).transform.parent); ((Object)val3).name = ((Object)((Component)val2).gameObject).name + " (SM col " + j + ")"; val3.transform.localPosition = ((Component)val2).transform.localPosition + new Vector3((float)j * 0.13f, 0f, 0f); val3.transform.localRotation = ((Component)val2).transform.localRotation; list.Add(val3.GetComponent<StorageGrid>()); } } } Il2CppReferenceArray<StorageGrid> val4 = new Il2CppReferenceArray<StorageGrid>((long)list.Count); int num = 0; for (int k = 0; k < list.Count; k++) { ((Il2CppArrayBase<StorageGrid>)(object)val4)[k] = list[k]; try { num += list[k].GetTotalFootprintSize(); } catch { } } outputVisuals.StorageGrids = val4; if (num > 0) { outputVisuals.totalFootprintCapacity = num; } try { outputVisuals.QueueRefresh(); } catch { } } public static void DestroySlotUi(GameObject go) { if ((Object)(object)go == (Object)null || ((Il2CppObjectBase)go).WasCollected) { return; } try { ItemSlotUI component = go.GetComponent<ItemSlotUI>(); if (component != null) { component.ClearSlot(); } } catch { } Object.Destroy((Object)(object)go); } private static bool InUse(BrickPress press) { if (!((Object)(object)press.PlayerUserObject != (Object)null)) { return (Object)(object)press.NPCUserObject != (Object)null; } return true; } private static string Describe(EState s) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected I4, but got Unknown return (int)s switch { 0 => "Ready", 2 => "Waiting for product (20 of one kind per brick)", 1 => "Waiting for product", 3 => "Output full - take the bricks out", 4 => "Output holds a different brick", _ => "Idle", }; } public static void Update(float dt) { if (ByPress.Count == 0) { return; } float time = Time.time; foreach (IntPtr item in ByPress.Keys.ToList()) { Placed placed = ByPress[item]; if ((Object)(object)placed.Press == (Object)null || ((Il2CppObjectBase)placed.Press).WasCollected) { ByPress.Remove(item); continue; } try { Tick(placed, dt, time); } catch (Exception ex) { Mod.Log.Warning("Brick Press MkII: " + ex.Message); placed.T = -1f; } } } private static void Tick(Placed p, float dt, float now) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_021e: 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_0061: Unknown result type (might be due to invalid IL or missing references) BrickPress press = p.Press; float num = Math.Max(1.5f, ModConfig.BrickPressSeconds); if (p.T < 0f) { if (now >= p.NextCheck) { p.NextCheck = now + 0.5f; EState state = press.GetState(); p.Status = (InUse(press) ? "In use" : Describe(state)); if ((int)state == 0 && !InUse(press)) { p.T = 0f; p.Pressed = false; } } } else { p.T += dt / num; if (!p.Pressed && p.T >= 0.5f) { p.Pressed = true; PressOne(press); } if (p.T >= 1f) { p.T = -1f; p.NextCheck = 0f; } else { p.Status = $"Pressing... {Mathf.RoundToInt(Mathf.Clamp01(p.T) * 100f)}%"; } } float num2 = 0f; if (p.T >= 0f) { if (p.T < 0.42f) { float num3 = p.T / 0.42f; num2 = num3 * num3 * 0.85f; } else if (p.T < 0.5f) { num2 = 0.85f + 0.15f * Mathf.SmoothStep(0f, 1f, (p.T - 0.42f) / 0.08000001f); } else if (p.T < 0.56f) { num2 = 1f; } else if (p.T < 0.82f) { num2 = 1f - Mathf.SmoothStep(0f, 1f, (p.T - 0.5f - 0.06f) / 0.26f); } } if ((Object)(object)p.Ram != (Object)null) { p.Ram.localPosition = p.RamRest + Vector3.down * (0.13f * num2); } bool flag = p.T >= 0f; if ((Object)(object)p.LampRun != (Object)null) { ((Renderer)p.LampRun).enabled = flag && Mathf.Repeat(now * 3f, 1f) < 0.6f; } if ((Object)(object)p.LampIdle != (Object)null) { ((Renderer)p.LampIdle).enabled = !flag; } } private static bool PressOne(BrickPress press) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (!InstanceFinder.IsServer) { return false; } ProductItemInstance val = null; if (!press.HasSufficientProduct(ref val) || val == null) { return false; } if ((int)press.GetState() != 0) { return false; } try { press.CompletePress(val); } catch (Exception ex) { Mod.Log.Warning("Brick Press MkII: press failed (" + ex.Message + ")."); return false; } try { AudioSourceController slamSound = press.SlamSound; if (slamSound != null) { slamSound.Play(); } } catch { } return true; } public static void OnTimeSkip(int minutes) { float num = Math.Max(1.5f, ModConfig.BrickPressSeconds); int num2 = (int)((float)minutes / num); if (num2 <= 0) { return; } foreach (Placed item in ByPress.Values.ToList()) { if ((Object)(object)item.Press == (Object)null || ((Il2CppObjectBase)item.Press).WasCollected) { continue; } int i; for (i = 0; i < num2; i++) { if (!PressOne(item.Press)) { break; } } if (i > 0) { Mod.Log.Msg($"Brick Press MkII: pressed {i} brick(s) during the time skip."); } } } public static string StatusOf(BrickPress press) { if (!((Object)(object)press != (Object)null) || !ByPress.TryGetValue(((Il2CppObjectBase)press).Pointer, out var value)) { return null; } return value.Status; } public static void DecorateCanvas(BrickPressCanvas canvas) { BrickPress val = ((canvas != null) ? canvas.Press : null); if (!((Object)(object)val == (Object)null) && IsMk2(val)) { if ((Object)(object)canvas.BeginButton != (Object)null) { ((Component)canvas.BeginButton).gameObject.SetActive(false); } if ((Object)(object)canvas.InstructionLabel != (Object)null) { ((Component)canvas.InstructionLabel).gameObject.SetActive(true); ((Behaviour)canvas.InstructionLabel).enabled = true; ((TMP_Text)canvas.InstructionLabel).text = "<b>Brick Press MkII</b> (automated): " + StatusOf(val); } } } public static void RestoreCanvas(BrickPressCanvas canvas) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((canvas != null) ? canvas.BeginButton : null) != (Object)null) { ((Component)canvas.BeginButton).gameObject.SetActive(true); } foreach (GameObject extraUi in _extraUis) { DestroySlotUi(extraUi); } _extraUis.Clear(); foreach (var (val, anchoredPosition) in _movedCaptions) { if ((Object)(object)val != (Object)null && !((Il2CppObjectBase)val).WasCollected) { val.anchoredPosition = anchoredPosition; } } _movedCaptions.Clear(); } public static void Clear() { ByPress.Clear(); } } internal static class BudSites { public static void Expand(Plant plant) { //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020e: 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_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0222: 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_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0268: 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_0272: Unknown result type (might be due to invalid IL or missing references) int budSiteMultiplier = ModConfig.BudSiteMultiplier; if (budSiteMultiplier <= 1 || (Object)(object)plant == (Object)null) { return; } try { Il2CppReferenceArray<PlantGrowthStage> growthStages = plant.GrowthStages; if (growthStages == null || ((Il2CppArrayBase<PlantGrowthStage>)(object)growthStages).Length == 0) { return; } PlantGrowthStage val = ((Il2CppArrayBase<PlantGrowthStage>)(object)growthStages)[((Il2CppArrayBase<PlantGrowthStage>)(object)growthStages).Length - 1]; Il2CppReferenceArray<Transform> sites = ((val != null) ? val.GrowthSites : null); if (sites == null || ((Il2CppArrayBase<Transform>)(object)sites).Length < 2) { return; } int length = ((Il2CppArrayBase<Transform>)(object)sites).Length; List<Transform> list = new List<Transform>(length * budSiteMultiplier); for (int i = 0; i < length; i++) { list.Add(((Il2CppArrayBase<Transform>)(object)sites)[i]); } int[][] array = new int[length][]; for (int j = 0; j < length; j++) { Vector3 pi = ((Il2CppArrayBase<Transform>)(object)sites)[j].position; array[j] = (from index in Enumerable.Range(0, length) where index != j select index).OrderBy(delegate(int index) { //IL_0011: 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_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) Vector3 val8 = ((Il2CppArrayBase<Transform>)(object)sites)[index].position - pi; return ((Vector3)(ref val8)).sqrMagnitude; }).ThenBy((int result) => result).ToArray(); } for (int num = 1; num < budSiteMultiplier; num++) { for (int num2 = 0; num2 < length; num2++) { Transform val2 = ((Il2CppArrayBase<Transform>)(object)sites)[num2]; if (!((Object)(object)val2 == (Object)null)) { Transform val3 = ((Il2CppArrayBase<Transform>)(object)sites)[array[num2][(num - 1) % array[num2].Length]]; float num3 = 0.5f / (1f + (float)(num - 1) * 0.35f); Vector3 val4 = Vector3.Lerp(val2.position, val3.position, num3); Vector3 up = ((Component)plant).transform.up; Vector3 val5 = Vector3.ProjectOnPlane(val4 - ((Component)plant).transform.position, up); if (((Vector3)(ref val5)).sqrMagnitude > 1E-06f) { val4 += ((Vector3)(ref val5)).normalized * 0.012f * (float)num; } GameObject val6 = Object.Instantiate<GameObject>(((Component)val2).gameObject, val2.parent); ((Object)val6).name = ((Object)val2).name + " (SM " + num + ")"; val6.transform.position = val4; val6.transform.rotation = Quaternion.Slerp(val2.rotation, val3.rotation, 0.5f) * Quaternion.Euler(0f, 37f * (float)num + (float)num2 * 11f, 0f); val6.transform.localScale = val2.localScale; list.Add(val6.transform); } } } Il2CppReferenceArray<Transform> val7 = new Il2CppReferenceArray<Transform>((long)list.Count); for (int num4 = 0; num4 < list.Count; num4++) { ((Il2CppArrayBase<Transform>)(object)val7)[num4] = list[num4]; } val.GrowthSites = val7; } catch (Exception ex) { Mod.Log.Warning("Couldn't add bud sites to " + ((plant != null) ? ((Object)plant).name : null) + ": " + ex.Message); } } } [HarmonyPatch(typeof(DeliveryShop), "Initialize")] internal static class BulkDeliveryPatch { private static void Prefix(DeliveryShop __instance) { BulkItems.BeforeDeliveryShopInit(__instance); } private static void Postfix(DeliveryShop __instance) { BulkItems.HideLocked(__instance); } } [HarmonyPatch(typeof(DeliveryShop), "Open")] internal static class BulkDeliveryRankPatch { private static void Postfix(DeliveryShop __instance) { BulkItems.HideLocked(__instance); } } internal static class BulkItems { public static readonly BulkSpec CukeCase = new BulkSpec { Id = "cukecase", Name = "Cuke Case", BaseId = "cuke", Key = "CukeCase", Icon = "cukecase_icon.png", Texture = "cukecase.png", Description = "A case of twenty Cukes. Counts as 20 Cukes.", DefaultPrice = 55, Model = new ModelFile("cukecase.bin", "Cuke Case") }; public static readonly BulkSpec AddyPharmacyCase = new BulkSpec { Id = "addypharmacycase", Name = "Addy Pharmacy Case", BaseId = "addy", Key = "AddyCase", Icon = "addypharmacycase_icon.png", Texture = "addypharmacycase.png", Description = "A pharmacy case of twenty Addy. Counts as 20 Addy.", Model = new ModelFile("addypharmacycase.bin", "Addy Pharmacy Case") }; public static readonly BulkSpec EnergyDrinkCrate = new BulkSpec { Id = "energydrinkcrate", Name = "Energy Drink Crate", BaseId = "energydrink", Key = "EnergyDrinkCrate", Icon = "energydrinkcrate_icon.png", Texture = "energydrinkcrate.png", Description = "A crate of twenty energy drinks. Counts as 20 Energy Drinks.", Model = new ModelFile("energydrinkcrate.bin", "Energy Drink Crate") }; public static readonly BulkSpec FluMedicineCase = new BulkSpec { Id = "flumedicinecase", Name = "Flu Medicine Case", BaseId = "flumedicine", Key = "FluMedicineCase", Icon = "flumedicinecase_icon.png", Texture = "flumedicinecase.png", Description = "A case of twenty bottles of flu medicine. Counts as 20 Flu Medicine bottles.", Model = new ModelFile("flumedicinecase.bin", "Flu Medicine Case") }; public static readonly BulkSpec IodineSupplyCase = new BulkSpec { Id = "iodinesupplycase", Name = "Iodine Supply Case", BaseId = "iodine", Key = "IodineCase", Icon = "iodinesupplycase_icon.png", Texture = "iodinesupplycase.png", Description = "A supply case of twenty bottles of iodine. Counts as 20 Iodine.", Model = new ModelFile("iodinesupplycase.bin", "Iodine Supply Case") }; public static readonly BulkSpec ViagraPharmacyCase = new BulkSpec { AlsoSoldAt = "Gas-Mart", Id = "viagrapharmacycase", Name = "Viagra Pharmacy Case", BaseId = "viagra", Key = "ViagraCase", Icon = "viagrapharmacycase_icon.png", Texture = "viagrapharmacycase.png", Description = "A pharmacy case of twenty packs of Viagra. Counts as 20 Viagor.", Model = new ModelFile("viagrapharmacycase.bin", "Viagra Pharmacy Case") }; public static readonly BulkSpec BananaProduceCrate = new BulkSpec { Id = "bananaproducecrate", Name = "Banana Produce Crate", BaseId = "banana", Key = "BananaCrate", Icon = "bananaproducecrate_icon.png", Texture = "bananaproducecrate.png", Description = "A produce crate of twenty bananas. Counts as 20 Bananas.", Model = new ModelFile("bananaproducecrate.bin", "Banana Produce Crate"), ShelfX = 2, ShelfY = 2 }; public static readonly BulkSpec ChiliProduceCrate = new BulkSpec { Id = "chiliproducecrate", Name = "Chili Produce Crate", BaseId = "chili", Key = "ChiliCrate", Icon = "chiliproducecrate_icon.png", Texture = "chiliproducecrate.png", Description = "A produce crate of twenty chili peppers. Counts as 20 Chili Peppers.", Model = new ModelFile("chiliproducecrate.bin", "Chili Produce Crate"), ShelfX = 2, ShelfY = 2 }; public static readonly BulkSpec DonutPartyBox = new BulkSpec { Id = "donutpartybox", Name = "Donut Party Box", BaseId = "donut", Key = "DonutBox", Icon = "donutpartybox_icon.png", Texture = "donutpartybox.png", Description = "A party box of twenty donuts. Counts as 20 Donuts.", Model = new ModelFile("donutpartybox.bin", "Donut Party Box"), ShelfX = 2, ShelfY = 2 }; public static readonly BulkSpec IndustrialBatteryPack = new BulkSpec { Id = "industrialbatterypack", Name = "Industrial Battery Pack", BaseId = "battery", Key = "BatteryPack", Icon = "industrialbatterypack_icon.png", Texture = "industrialbatterypack.png", Description = "An industrial pack of twenty batteries. Counts as 20 Batteries.", Model = new ModelFile("industrialbatterypack.bin", "Industrial Battery Pack"), ShelfX = 2, ShelfY = 1, HeldYaw = 180f }; public static readonly BulkSpec ParacetamolCase = new BulkSpec { Id = "paracetamolcase", Name = "Paracetamol Case", BaseId = "paracetamol", Key = "ParacetamolCase", Icon = "paracetamolcase_icon.png", Texture = "paracetamolcase.png", Description = "A pharmacy case of twenty packs of paracetamol. Counts as 20 Paracetamol.", Model = new ModelFile("paracetamolcase.bin", "Paracetamol Case"), ShelfX = 2, ShelfY = 1 }; public static readonly BulkSpec MotorOilCase = new BulkSpec { Id = "motoroilcase", Name = "Motor Oil Case", BaseId = "motoroil", Key = "MotorOilCase", Icon = "motoroilcase_icon.png", Texture = "motoroilcase.png", Description = "A shrink-wrapped tray of twenty cans of motor oil. Counts as 20 cans of Motor Oil.", Model = new ModelFile("motoroilcase.bin", "Motor Oil Case"), ShelfX = 3, ShelfY = 2 }; public static readonly BulkSpec MouthWashCase = new BulkSpec { Id = "mouthwashcase", Name = "Mouth Wash Case", BaseId = "mouthwash", Key = "MouthWashCase", Icon = "mouthwashcase_icon.png", Texture = "mouthwashcase.png", Description = "A shrink-wrapped tray of twenty bottles of mouth wash. Counts as 20 Mouthwash bottles.", Model = new ModelFile("mouthwashcase.bin", "Mouth Wash Case"), ShelfX = 3, ShelfY = 2 }; public static readonly BulkSpec MegaBeanSack = new BulkSpec { Id = "megabeansack", Name = "Mega Bean Sack", BaseId = "megabean", Key = "MegaBeanSack", Icon = "megabeansack_icon.png", Texture = "megabeansack.png", Description = "A canvas sack of twenty Mega Beans. Counts as 20 Mega Beans.", Model = new ModelFile("megabeansack.bin", "Mega Bean Sack"), ShelfX = 2, ShelfY = 2 }; public static readonly BulkSpec GasolineDrum = new BulkSpec { Id = "gasolinedrum", Name = "Gasoline Drum", BaseId = "gasoline", Key = "GasolineDrum", Icon = "gasolinedrum_icon.png", Texture = "gasolinedrum.png", Description = "A steel drum holding twenty cans' worth of gasoline. Counts as 20 cans of Gasoline.", Model = new ModelFile("gasolinedrum.bin", "Gasoline Drum"), ShelfX = 3, ShelfY = 2, LieOnSide = true }; public static readonly BulkSpec BreedingSampleCooler = new BulkSpec { Id = "breedingsamplecooler", Name = "Breeding Sample Cooler", BaseId = "horsesemen", Key = "BreedingCooler", Icon = "breedingsamplecooler_icon.png", Texture = "breedingsamplecooler.png", Description = "A refrigerated cooler of twenty breeding samples. Counts as 20 jugs of Horse Semen.", Model = new ModelFile("breedingsamplecooler.bin", "Breeding Sample Cooler"), ShelfX = 2, ShelfY = 2 }; public static readonly BulkSpec[] All = new BulkSpec[16] { CukeCase, BananaProduceCrate, ChiliProduceCrate, DonutPartyBox, IndustrialBatteryPack, ParacetamolCase, MotorOilCase, MouthWashCase, MegaBeanSack, GasolineDrum, BreedingSampleCooler, AddyPharmacyCase, EnergyDrinkCrate, FluMedicineCase, IodineSupplyCase, ViagraPharmacyCase }; private static GameObject _holder; private static readonly HashSet<IntPtr> Mk2MixerSlots = new HashSet<IntPtr>(); public static FullRank UnlockRank => ModItems.Rank(ModConfig.Str("BulkUnlockRank"), Math.Max(1, ModConfig.Int("BulkUnlockRankTier")), (ERank)3); private static bool RequiresRank { get { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) if ((int)UnlockRank.Rank == 0) { return UnlockRank.Tier > 1; } return true; } } public static BulkSpec Get(string id) { if (id != null) { return All.FirstOrDefault((BulkSpec s) => s.Id == id); } return null; } public static string BaseOf(string id) { return Get(id)?.BaseId ?? id; } public static int Units(string id) { return Get(id)?.Units ?? 1; } public static bool IsBulk(string id) { return Get(id) != null; } public static string[] IdsFor(string baseId) { return new string[1] { baseId }.Concat(from s in All where s.BaseId == baseId select s.Id).ToArray(); } public static int Consumes(string id, int quantity) { if (!IsBulk(id)) { return quantity; } return 1; } public static bool Unlocked() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_002e: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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) if (!RequiresRank) { return true; } LevelManager instance = NetworkSingleton<LevelManager>.Instance; if ((Object)(object)instance == (Object)null) { return false; } FullRank fullRank = instance.GetFullRank(); FullRank unlockRank = UnlockRank; if (fullRank.Rank <= unlockRank.Rank) { if (fullRank.Rank == unlockRank.Rank) { return fullRank.Tier >= unlockRank.Tier; } return false; } return true; } public static void HideLocked(DeliveryShop ds) { try { List<ListingEntry> val = ((ds != null) ? ds.listingEntries : null); if (val == null) { return; } bool flag = Unlocked(); for (int i = 0; i < val.Count; i++) { ListingEntry val2 = val[i]; if ((Object)(object)val2 == (Object)null) { continue; } ShopListing matchingListing = val2.MatchingListing; object id; if (matchingListing == null) { id = null; } else { StorableItemDefinition item = matchingListing.Item; id = ((item != null) ? ((BaseItemDefinition)item).ID : null); } if (IsBulk((string)id)) { if (!flag && val2.SelectedQuantity > 0) { val2.SetQuantity(0, true); } if (((Component)val2).gameObject.activeSelf != flag) { ((Component)val2).gameObject.SetActive(flag); } } } } catch (Exception ex) { Mod.Log.Warning("Bulk delivery rank check: " + ex.Message); } } public static void EnsureRegistered() { //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Expected O, but got Unknown Registry instance = Singleton<Registry>.Instance; if ((Object)(object)instance == (Object)null) { return; } BulkSpec[] all = All; foreach (BulkSpec bulkSpec in all) { try { if (Registry.ItemExists(bulkSpec.Id)) { BulkSpec bulkSpec2 = bulkSpec; if (bulkSpec2.Def == null) { ItemDefinition item = Registry.GetItem(bulkSpec.Id); bulkSpec2.Def = ((item != null) ? ((Il2CppObjectBase)item).TryCast<StorableItemDefinition>() : null); } continue; } ItemDefinition item2 = Registry.GetItem(bulkSpec.BaseId); StorableItemDefinition val = ((item2 != null) ? ((Il2CppObjectBase)item2).TryCast<StorableItemDefinition>() : null); if ((Object)(object)val == (Object)null) { Mod.Log.Warning(bulkSpec.Name + ": '" + bulkSpec.BaseId + "' not found; not registered."); continue; } StorableItemDefinition val2 = Object.Instantiate<StorableItemDefinition>(val); ((Object)val2).name = bulkSpec.Name.Replace(" ", ""); ((Object)val2).hideFlags = (HideFlags)32; ((BaseItemDefinition)val2).ID = bulkSpec.Id; ((BaseItemDefinition)val2).Name = bulkSpec.Name; ((BaseItemDefinition)val2).Description = bulkSpec.Description; ((BaseItemDefinition)val2).StackLimit = bulkSpec.StackLimit; val2.BasePurchasePrice = bulkSpec.Price; val2.RequiresLevelToPurchase = RequiresRank; val2.RequiredRank = UnlockRank; Sprite val3 = ModIcons.Load(bulkSpec.Icon, bulkSpec.Name + " Icon"); if ((Object)(object)val3 != (Object)null) { ((BaseItemDefinition)val2).Icon = val3; } if ((Object)(object)_holder == (Object)null || ((Il2CppObjectBase)_holder).WasCollected) { _holder = new GameObject("Schedule Maintenance bulk prefabs"); _holder.SetActive(false); Object.DontDestroyOnLoad((Object)(object)_holder); } StoredItem val4 = ShelfSource(bulkSpec) ?? val.StoredItem; if ((Object)(object)val4 != (Object)null) { GameObject val5 = Object.Instantiate<GameObject>(((Component)val4).gameObject, _holder.transform); ((Object)val5).name = "SM " + bulkSpec.Id + " (stored)"; if (val5.GetComponent<StoredItem>().SizeX < bulkSpec.ShelfX) { Footprint.StretchStored(val5, bulkSpec.ShelfX, bulkSpec.Name); } Fit(val5.transform, bulkSpec, onFloor: true); val2.StoredItem = val5.GetComponent<StoredItem>(); } Equippable val6 = NeutralEquippable(); if ((Object)(object)val6 != (Object)null) { GameObject val7 = Object.Instantiate<GameObject>(((Component)val6).gameObject, _holder.transform); ((Object)val7).name = "SM " + bulkSpec.Id + " (equipped)"; Fit(val7.transform, bulkSpec, onFloor: false); ((ItemDefinition)val2).Equippable = val7.GetComponent<Equippable>(); } instance.AddToRegistry((ItemDefinition)(object)val2); bulkSpec.Def = val2; Mod.Log.Msg($"Registered '{bulkSpec.Id}' ({bulkSpec.Units}x {bulkSpec.BaseId}), ${bulkSpec.Price}, stack {bulkSpec.StackLimit}, held model from '{((val6 != null) ? ((Object)val6).name : null)}'."); } catch (Exception value) { Mod.Log.Error($"Failed to register {bulkSpec.Name}: {value}"); } } } private static StoredItem ShelfSource(BulkSpec spec) { if (spec.ShelfY <= 1) { ItemDefinition item = Registry.GetItem("soil"); if (item == null) { return null; } StorableItemDefinition obj = ((Il2CppObjectBase)item).TryCast<StorableItemDefinition>(); if (obj == null) { return null; } return obj.StoredItem; } string[] array = new string[4] { "coffeetable", "toilet", "jukebox", "plastictable" }; for (int i = 0; i < array.Length; i++) { ItemDefinition item2 = Registry.GetItem(array[i]); object obj2; if (item2 == null) { obj2 = null; } else { StorableItemDefinition obj3 = ((Il2CppObjectBase)item2).TryCast<StorableItemDefinition>(); obj2 = ((obj3 != null) ? obj3.StoredItem : null); } StoredItem val = (StoredItem)obj2; if ((Object)(object)val != (Object)null && val.SizeX == 2 && val.SizeY == 2) { return val; } } return null; } private static Equippable NeutralEquippable() { string[] array = new string[7] { "gasoline", "iodine", "addy", "flumedicine", "mouthwash", "motoroil", "battery" }; for (int i = 0; i < array.Length; i++) { ItemDefinition item = Registry.GetItem(array[i]); object obj; if (item == null) { obj = null; } else { StorableItemDefinition obj2 = ((Il2CppObjectBase)item).TryCast<StorableItemDefinition>(); obj = ((obj2 != null) ? ((ItemDefinition)obj2).Equippable : null); } Equippable val = (Equippable)obj; if ((Object)(object)val != (Object)null && ((MemberInfo)((Object)val).GetIl2CppType()).Name == "Equippable_Viewmodel") { return val; } } List<ItemDefinition> allItems = Singleton<Registry>.Instance.GetAllItems(); for (int j = 0; j < allItems.Count; j++) { ItemDefinition obj3 = allItems[j]; object obj4; if (obj3 == null) { obj4 = null; } else { StorableItemDefinition obj5 = ((Il2CppObjectBase)obj3).TryCast<StorableItemDefinition>(); obj4 = ((obj5 != null) ? ((ItemDefinition)obj5).Equippable : null); } Equippable val2 = (Equippable)obj4; if ((Object)(object)val2 != (Object)null && ((MemberInfo)((Object)val2).GetIl2CppType()).Name == "Equippable_Viewmodel") { return val2; } } return null; } private static void Fit(Transform root, BulkSpec spec, bool onFloor) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_046d: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011d: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_04c8: Unknown result type (might be due to invalid IL or missing references) //IL_04df: Unknown result type (might be due to invalid IL or missing references) //IL_04e4: Unknown result type (might be due to invalid IL or missing references) //IL_04bf: Unknown result type (might be due to invalid IL or missing references) //IL_050b: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_0448: 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_0427: Unknown result type (might be due to invalid IL or missing references) //IL_051c: Unknown result type (might be due to invalid IL or missing references) //IL_0523: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0553: Unknown result type (might be due to invalid IL or missing references) //IL_056e: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_06e2: Unknown result type (might be due to invalid IL or missing references) //IL_06e7: Unknown result type (might be due to invalid IL or missing references) //IL_06f0: Unknown result type (might be due to invalid IL or missing references) //IL_06fb: Unknown result type (might be due to invalid IL or missing references) //IL_0704: Unknown result type (might be due to invalid IL or missing references) //IL_070f: Unknown result type (might be due to invalid IL or missing references) //IL_0718: Unknown result type (might be due to invalid IL or missing references) //IL_0723: Unknown result type (might be due to invalid IL or missing references) //IL_0728: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_05b7: Unknown result type (might be due to invalid IL or missing references) //IL_05bc: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_063f: Unknown result type (might be due to invalid IL or missing references) //IL_0646: Unknown result type (might be due to invalid IL or missing references) //IL_0651: Unknown result type (might be due to invalid IL or missing references) //IL_0656: Unknown result type (might be due to invalid IL or missing references) //IL_065b: Unknown result type (might be due to invalid IL or missing references) //IL_0660: Unknown result type (might be due to invalid IL or missing references) //IL_0665: Unknown result type (might be due to invalid IL or missing references) //IL_066a: Unknown result type (might be due to invalid IL or missing references) //IL_0685: Unknown result type (might be due to invalid IL or missing references) //IL_0670: Unknown result type (might be due to invalid IL or missing references) //IL_0672: Unknown result type (might be due to invalid IL or missing references) //IL_0677: Unknown result type (might be due to invalid IL or missing references) //IL_067c: Unknown result type (might be due to invalid IL or missing references) Il2CppArrayBase<Renderer> componentsInChildren = ((Component)root).GetComponentsInChildren<Renderer>(true); Bounds val = default(Bounds); bool flag = false; foreach (Renderer item in componentsInChildren) { MeshFilter component = ((Component)item).GetComponent<MeshFilter>(); if ((Object)(object)((component != null) ? component.sharedMesh : null) == (Object)null) { continue; } Bounds bounds = component.sharedMesh.bounds; float[] array = new float[2] { -1f, 1f }; foreach (float num in array) { float[] array2 = new float[2] { -1f, 1f }; foreach (float num2 in array2) { float[] array3 = new float[2] { -1f, 1f }; foreach (float num3 in array3) { Vector3 val2 = root.InverseTransformPoint(((Component)item).transform.TransformPoint(((Bounds)(ref bounds)).center + Vector3.Scale(((Bounds)(ref bounds)).extents, new Vector3(num, num2, num3)))); if (!flag) { val = new Bounds(val2, Vector3.zero); flag = true; } else { ((Bounds)(ref val)).Encapsulate(val2); } } } } } foreach (Renderer item2 in componentsInChildren) { item2.enabled = false; item2.forceRenderingOff = true; } GameObject val3 = new GameObject("SM Case") { layer = ((componentsInChildren.Length > 0) ? ((Component)componentsInChildren[0]).gameObject.layer : 0) }; val3.transform.SetParent(root, false); float num4 = 1f; Vector3? val4 = null; if (onFloor) { Il2CppArrayBase<FootprintTile> componentsInChildren2 = ((Component)root).GetComponentsInChildren<FootprintTile>(true); if (componentsInChildren2.Length > 0) { List<Vector3> source = ((IEnumerable<FootprintTile>)componentsInChildren2).Select((FootprintTile t) => root.InverseTransformPoint(((Component)t).transform.position)).ToList(); float num5 = source.Max((Vector3 p) => p.x) - source.Min((Vector3 p) => p.x); float num6 = source.Max((Vector3 p) => p.z) - source.Min((Vector3 p) => p.z); Vector3 val5 = default(Vector3); ((Vector3)(ref val5))..ctor(source.Average((Vector3 p) => p.x), flag ? ((Bounds)(ref val)).min.y : source.Average((Vector3 p) => p.y), source.Average((Vector3 p) => p.z)); Quaternion val6 = ((num5 > num6 + 0.01f) ? Quaternion.Euler(0f, 90f, 0f) : Quaternion.identity); val3.transform.localRotation = (spec.LieOnSide ? (val6 * Quaternion.Euler(90f, 0f, 0f)) : val6); val3.transform.localPosition = val5; val4 = val5; } else { val3.transform.localRotation = ((((Bounds)(ref val)).size.x > ((Bounds)(ref val)).size.z) ? Quaternion.Euler(0f, 90f, 0f) : Quaternion.identity); val3.transform.localPosition = (Vector3)(flag ? new Vector3(((Bounds)(ref val)).center.x, ((Bounds)(ref val)).min.y, ((Bounds)(ref val)).center.z) : Vector3.zero); } } else { float num7 = (flag ? Math.Max(((Bounds)(ref val)).size.x, Math.Max(((Bounds)(ref val)).size.y, ((Bounds)(ref val)).size.z)) : 0.3f); num4 = Math.Max(0.05f, num7 / 0.44f) * 2f; val3.transform.localPosition = (flag ? (((Bounds)(ref val)).center - new Vector3(0f, 0.095f * num4, 0f)) : Vector3.zero); val3.transform.localRotation = Quaternion.Euler(0f, -90f + spec.HeldYaw, 0f); } val3.transform.localScale = Vector3.one * num4; spec.Model.Build(val3.transform); if (val4.HasValue) { Vector3 valueOrDefault = val4.GetValueOrDefault(); Il2CppArrayBase<MeshRenderer> componentsInChildren3 = val3.GetComponentsInChildren<MeshRenderer>(true); if (componentsInChildren3.Length > 0) { Bounds val7 = default(Bounds); bool flag2 = true; foreach (MeshRenderer item3 in componentsInChildren3) { MeshFilter component2 = ((Component)item3).GetComponent<MeshFilter>(); if ((Object)(object)((component2 != null) ? component2.sharedMesh : null) == (Object)null) { continue; } Bounds bounds2 = component2.sharedMesh.bounds; float[] array = new float[2] { -1f, 1f }; foreach (float num8 in array) { float[] array2 = new float[2] { -1f, 1f }; foreach (float num9 in array2) { float[] array3 = new float[2] { -1f, 1f }; foreach (float num10 in array3) { Vector3 val8 = root.InverseTransformPoint(((Component)item3).transform.TransformPoint(((Bounds)(ref bounds2)).center + Vector3.Scale(((Bounds)(ref bounds2)).extents, new Vector3(num8, num9, num10)))); if (flag2) { val7 = new Bounds(val8, Vector3.zero); flag2 = false; } else { ((Bounds)(ref val7)).Encapsulate(val8); } } } } } if (!flag2) { Transform transform = val3.transform; transform.localPosition += new Vector3(valueOrDefault.x - ((Bounds)(ref val7)).center.x, valueOrDefault.y - ((Bounds)(ref val7)).min.y, valueOrDefault.z - ((Bounds)(ref val7)).center.z); } } } foreach (Transform componentsInChild in val3.GetComponentsInChildren<Transform>(true)) { ((Component)componentsInChild).gameObject.layer = val3.layer; } } public static void AddDeliveryListings(ShopInterface shop) { //IL_00d7: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown if (((shop != null) ? shop.Listings : null) == null) { return; } EnsureRegistered(); BulkSpec[] all = All; foreach (BulkSpec bulkSpec in all) { try { if ((Object)(object)bulkSpec.Def == (Object)null) { continue; } bool flag = false; bool flag2 = false; for (int j = 0; j < shop.Listings.Count; j++) { ShopListing obj = shop.Listings[j]; object obj2; if (obj == null) { obj2 = null; } else { StorableItemDefinition item = obj.Item; obj2 = ((item != null) ? ((BaseItemDefinition)item).ID : null); } if ((string?)obj2 == bulkSpec.BaseId) { flag = true; } if ((string?)obj2 == bulkSpec.Id) { flag2 = true; } } if (!flag && bulkSpec.AlsoSoldAt != null && (shop.ShopName ?? "").StartsWith(bulkSpec.AlsoSoldAt)) { flag = true; } if (!(!flag || flag2)) { shop.Listings.Add(new ShopListing { name = bulkSpec.Name, Item = bulkSpec.Def, OverridePrice = true, OverriddenPrice = bulkSpec.Price, LimitedStock = false, CanBeDelivered = true, UseIconTint = false, EnforceMinimumGameCreationVersion = false }); Mod.Log.Msg($"Added {bulkSpec.Name} (${bulkSpec.Price}) to the delivery list of '{shop.ShopName}'."); } } catch (Exception value) { Mod.Log.Error($"Failed to list {bulkSpec.Name}: {value}"); } } } public static void BeforeDeliveryShopInit(DeliveryShop ds) { try { foreach (ShopInterface item in Object.FindObjectsOfType<ShopInterface>(true)) { if (item.ShopName == ds.MatchingShopInterfaceName) { AddDeliveryListings(item); } } } catch (Exception ex) { Mod.Log.Warning("Bulk delivery listing: " + ex.Message); } } public static void BlockInVanillaStation(MixingStation station) { //IL_0064: 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_0075: Expected O, but got Unknown try { ItemSlot val = ((station != null) ? station.MixerSlot : null); if (val == null) { return; } if ((Object)(object)((Il2CppObjectBase)station).TryCast<MixingStationMk2>() != (Object)null) { Mk2MixerSlots.Add(((Il2CppObjectBase)val).Pointer); return; } List<string> val2 = new List<string>(); BulkSpec[] all = All; foreach (BulkSpec bulkSpec in all) { val2.Add(bulkSpec.Id); } val.AddFilter((ItemFilter)new ItemFilter_ID(val2) { IsWhitelist = false }); } catch (Exception ex) { Mod.Log.Warning("Bulk filter on a mixing station: " + ex.Message); } } private static bool BulkInMixer(MixingStation station, out int units) { units = 0; object obj; if (station == null) { obj = null; } else { ItemSlot mixerSlot = station.MixerSlot; if (mixerSlot == null) { obj = null; } else { ItemInstance itemInstance = mixerSlot.ItemInstance; obj = ((itemInstance != null) ? ((BaseItemInstance)itemInstance).ID : null); } } string id = (string)obj; if (!IsBulk(id)) { return false; } units = Units(id); return true; } public static void VanillaMixQuantity(MixingStation station, ref int result) { if (BulkInMixer(station, out var units)) { ItemSlot productSlot = station.ProductSlot; result = ((((productSlot != null) ? productSlot.Quantity : 0) >= units) ? units : 0); } } public static void VanillaCanStartMix(MixingStation station, ref bool result) { if (result && BulkInMixer(station, out var units)) { ItemSlot productSlot = station.ProductSlot; if (((productSlot != null) ? productSlot.Quantity : 0) < units) { result = false; } } } public static void AdjustMixerTake(ItemSlot slot, ref int change) { if (change < 0 && Mk2MixerSlots.Count != 0 && Mk2MixerSlots.Contains(((Il2CppObjectBase)slot).Pointer)) { ItemInstance itemInstance = slot.ItemInstance; string id = ((itemInstance != null) ? ((BaseItemInstance)itemInstance).ID : null); if (IsBulk(id) && -change == Units(id)) { change = -1; } } } public static void NormaliseOperation(MixOperation op) { if (op != null && IsBulk(op.IngredientID)) { op.IngredientID = BaseOf(op.IngredientID); } } } [HarmonyPatch(typeof(ItemFilter_MixingIngredient), "DoesItemMatchFilter")] internal static class BulkMixerFilterPatch { private static void Postfix(ItemInstance instance, ref bool __result) { if (!__result && instance != null && BulkItems.IsBulk(((BaseItemInstance)instance).ID)) { __result = true; } } } [HarmonyPatch(typeof(ItemSlot), "ChangeQuantity")] internal static class BulkMixerTakePatch { private static void Prefix(ItemSlot __instance, ref int change) { BulkItems.AdjustMixerTake(__instance, ref change); } } [HarmonyPatch(typeof(MixingStation), "SendMixingOperation")] internal static class BulkMixOperationPatch { private static void Prefix(MixOperation operation) { BulkItems.NormaliseOperation(operation); } } internal sealed class BulkSpec { public string Id; public string Name; public string BaseId; public string Description; public string Icon; public string Texture; public string Key; public string AlsoSoldAt; public int Units = 20; public int StackLimit = 10; public int DefaultPrice; public int ShelfX = 2; public int ShelfY = 1; public float HeldYaw; public bool LieOnSide; public ModelFile Model; public StorableItemDefinition Def; public int Price { get { int num = ModConfig.Int(Key + "Price"); if (num > 0) { return num; } ItemDefinition item = Registry.GetItem(BaseId); float? obj; if (item == null) { obj = null; } else { StorableItemDefinition obj2 = ((Il2CppObjectBase)item).TryCast<StorableItemDefinition>(); obj = ((obj2 != null) ? new float?(obj2.BasePurchasePrice) : ((float?)null)); } float? num2 = obj; float valueOrDefault = num2.GetValueOrDefault(); return Math.Max(5, (int)Math.Ceiling(valueOrDefault * (float)Units * 1.35f / 5f) * 5); } } } internal sealed class Bunk { public PlaceableStorageEntity Bed; public EmployeeHome Lower; public EmployeeHome Upper; public StorageEntity LowerStorage; public StorageEntity UpperStorage; public GameObject UpperCase; public string Guid; } internal static class BunkBed { public struct AssignState { public Bunk Bunk; public Employee LowerPrev; public Employee UpperPrev; } public const string Id = "bunkbed"; public const string DisplayName = "Bunk Bed"; private const string Description = "A compact steel bunk bed with space for two."; private static BuildableItemDefinition _def; private static string _sourceId; private static readonly ModelFile Model = new ModelFile("bunkbed.bin", "Bunk Bed"); private static readonly Dictionary<IntPtr, Bunk> ByBed = new Dictionary<IntPtr, Bunk>(); private static readonly Dictionary<IntPtr, Bunk> ByHome = new Dictionary<IntPtr, Bunk>(); private static readonly HashSet<IntPtr> LocalStorages = new HashSet<IntPtr>(); private static readonly Dictionary<string, Material> FabricMats = new Dictionary<string, Material>(); private static Dictionary<string, Material> _gameMats; private static Transform _viewHolder; private static Dictionary<string, string> _mapping; private static float _prune; private static Transform ViewHolder { get { //IL_001e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_viewHolder == (Object)null || ((Il2CppObjectBase)_viewHolder).WasCollected) { _viewHolder = new GameObject("Schedule Maintenance locker views").transform; } return _viewHolder; } } private static Dictionary<string, string> Mapping => _mapping ?? (_mapping = LoadMapping()); private static string MapFile => Path.Combine(MelonEnvironment.UserDataDirectory, "ScheduleMaintenance", "bunks.json"); public static bool IsBunk(ItemInstance item) { if (item != null) { return ((BaseItemInstance)item).ID == "bunkbed"; } return false; } public static bool IsLocalStorage(StorageEntity s) { if ((Object)(object)s != (Object)null) { return LocalStorages.Contains(((Il2CppObjectBase)s).Pointer); } return false; } public static void EnsureRegistered() { //IL_013a: Unknown result type (might be due to invalid IL or missing references) try { Registry instance = Singleton<Registry>.Instance; if ((Object)(object)instance == (Object)null) { return; } if (Registry.ItemExists("bunkbed")) { if (_def == null) { ItemDefinition item = Registry.GetItem("bunkbed"); _def = ((item != null) ? ((Il2CppObjectBase)item).TryCast<BuildableItemDefinition>() : null); } return; } List<ItemDefinition> allItems = instance.GetAllItems(); BuildableItemDefinition val = null; for (int i = 0; i < allItems.Count; i++) { if (!((Object)(object)val == (Object)null)) { break; } ItemDefinition obj = allItems[i]; BuildableItemDefinition val2 = ((obj != null) ? ((Il2CppObjectBase)obj).TryCast<BuildableItemDefinition>() : null); if (!((Object)(object)((val2 != null) ? val2.BuiltItem : null) == (Object)null) && !(((BaseItemDefinition)val2).ID == "bunkbed") && (Object)(object)((Component)val2.BuiltItem).GetComponent<Bed>() != (Object)null && (Object)(object)((Component)val2.BuiltItem).GetComponent<EmployeeHome>() != (Object)null && (Object)(object)((Component)val2.BuiltItem).GetComponent<PlaceableStorageEntity>() != (Object)null) { val = val2; } } if ((Object)(object)val == (Object)null) { Mod.Log.Warning("Vanilla bed definition not found; Bunk Bed not registered."); return; } _sourceId = ((BaseItemDefinition)val).ID; _def = ModItems.Register(val, "bunkbed", "Bunk Bed", "A compact steel bunk bed with space for two.", "bunkbed.png", ModConfig.BunkPrice, ModItems.Rank(ModConfig.BunkRank, ModConfig.BunkRankTier, (ERank)3)); } catch (Exception value) { Mod.Log.Error($"Failed to register the Bunk Bed: {value}"); } } public static void AddShopListing(ShopInterface shop) { try { EnsureRegistered(); ModItems.AddListing(shop, (StorableItemDefinition)(object)_def, _sourceId, ModConfig.BunkPrice); } catch (Exception value) { Mod.Log.Error($"Failed to add the Bunk Bed listing: {value}"); } } public static Bunk Get(BuildableItem item) { if (!((Object)(object)item != (Object)null) || !ByBed.TryGetValue(((Il2CppObjectBase)item).Pointer, out var value)) { return null; } return value; } public static Bunk GetByHome(EmployeeHome home) { if (!((Object)(object)home != (Object)null) || !ByHome.TryGetValue(((Il2CppObjectBase)home).Pointer, out var value)) { return null; } return value; } public static void Setup(PlaceableStorageEntity bed) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Expected O, but got Unknown //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Expected O, but got Unknown //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) try { if (ByBed.ContainsKey(((Il2CppObjectBase)bed).Pointer)) { return; } Transform transform = ((Component)bed).transform; StorageEntity storageEntity = bed.StorageEntity; EmployeeHome component = ((Component)transform).GetComponent<EmployeeHome>(); if ((Object)(object)storageEntity == (Object)null || (Object)(object)component == (Object)null) { Mod.Log.Warning("Bunk Bed: bed storage or home missing."); return; } Dictionary<string, MeshRenderer> dictionary = BuildVisual(transform); ApplyGameMaterials(transform, dictionary, component); int count = storageEntity.ItemSlots.Count; for (int i = 0; i < count; i++) { new ItemSlot().SetSlotOwner(((Il2CppObjectBase)storageEntity).Cast<IItemSlotOwner>()); } storageEntity.SlotCount = storageEntity.ItemSlots.Count; StorageEntity val = LocalView(transform, "Lower Locker", storageEntity, 0, count); StorageEntity val2 = LocalView(transform, "Upper Locker", storageEntity, count, count); GameObject val3 = new GameObject("Upper Bunk Home"); val3.SetActive(false); val3.transform.SetParent(transform, false); EmployeeHome val4 = val3.AddComponent<EmployeeHome>(); val4.HomeType = component.HomeType; val4.Storage = val2; val4.SpecificMat_Default = component.SpecificMat_Default; val4.SpecificMat_Botanist = component.SpecificMat_Botanist; val4.SpecificMat_Chemist = component.SpecificMat_Chemist; val4.SpecificMat_Packager = component.SpecificMat_Packager; val4.SpecificMat_Cleaner = component.SpecificMat_Cleaner; val4.onAssignedEmployeeChanged = new UnityEvent(); component.Storage = val; if (dictionary.TryGetValue("BlanketLower", out var value)) { component.EmployeeSpecificMeshes = new Il2CppReferenceArray<MeshRenderer>((MeshRenderer[])(object)new MeshRenderer[1] { value }); } if (dictionary.TryGetValue("BlanketUpper", out var value2)) { val4.EmployeeSpecificMeshes = new Il2CppReferenceArray<MeshRenderer>((MeshRenderer[])(object)new MeshRenderer[1] { value2 }); } Transform val5 = transform.Find("EmployeeStuff/Clipboard"); if ((Object)(object)val5 != (Object)null) { Place(val5, transform, "LowerClipboard"); GameObject val6 = Object.Instantiate<GameObject>(((Component)val5).gameObject, val5.parent); ((Object)val6).name = "Clipboard (upper)"; Place(val6.transform, transform, "UpperClipboard"); val6.SetActive(false)