using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using Photon.Pun; using REPO_Cart_Decorations.Patches; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("REPO Cart Decorations")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("REPO Cart Decorations")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("c2c4132e-3771-472d-a673-2d97a3bd837d")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace REPO_Cart_Decorations { public class CartDecorationManager : MonoBehaviour { public static CartDecorationManager instance; [Tooltip("List of all decoration prefabs to cycle through.")] public List decorations; [Tooltip("TextMeshPro to display the name of the current decoration.")] public TextMeshProUGUI label; [Tooltip("Reference to the cart the decorations will be attached to.")] public GameObject cart; public int currentIndex = 0; public GameObject currentDecoration; public void Awake() { instance = this; cart = GameObject.Find("Item Cart Medium(Clone)"); } public void Start() { Debug.Log((object)"CartManager - Start"); if (decorations == null || decorations.Count == 0) { Debug.LogError((object)"[CartDecorationManager] No decorations assigned."); return; } currentIndex = 0; if (currentIndex == -1) { currentIndex = 0; } ApplyDecorationToCart(); UpdateLabel(); } [PunRPC] public void Previous() { Debug.Log((object)"Previous called"); Cycle(-1); } [PunRPC] public void Next() { Debug.Log((object)"Next called"); Cycle(1); } [PunRPC] public void Update() { if (Input.GetKeyDown((KeyCode)44)) { Previous(); } if (Input.GetKeyDown((KeyCode)46)) { Next(); } } [PunRPC] public string GetCurrentDecorationName() { return ((Object)decorations[currentIndex].gameObject).name; } [PunRPC] public void Cycle(int direction) { Debug.Log((object)"Changing decoration!"); if (decorations.Count != 0) { currentIndex = (currentIndex + direction + decorations.Count) % decorations.Count; ApplyDecorationToCart(); UpdateLabel(); } } [PunRPC] public void ApplyDecorationToCart() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)currentDecoration != (Object)null) { Object.Destroy((Object)(object)currentDecoration); } currentDecoration = Object.Instantiate(decorations[currentIndex], cart.transform); currentDecoration.transform.localPosition = new Vector3(0f, 0f, 0f); currentDecoration.transform.localRotation = Quaternion.identity; } [PunRPC] public void UpdateLabel() { Debug.Log((object)"Updating decoration label!"); if ((Object)(object)label != (Object)null) { ((TMP_Text)label).text = ((Object)decorations[currentIndex]).name; } } } public class CartDecorationSelector : MonoBehaviour { private void Update() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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) if (Input.GetMouseButtonDown(0)) { Ray val = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, ref val2) && (Object)(object)((Component)((RaycastHit)(ref val2)).collider).gameObject == (Object)(object)((Component)this).gameObject) { Debug.Log((object)"button was pressed. YES!!"); } } } } public class CartXMasLightController : MonoBehaviour { [CompilerGenerated] private sealed class d__7 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public int index; public CartXMasLightController <>4__this; private float 5__1; private bool 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } 5__1 = Random.Range(<>4__this.minBlinkTime, <>4__this.maxBlinkTime); 5__2 = Random.value > 0.5f; if ((Object)(object)<>4__this.materials[index] != (Object)null) { if (5__2) { <>4__this.materials[index].EnableKeyword("_EMISSION"); } else { <>4__this.materials[index].DisableKeyword("_EMISSION"); } } <>2__current = (object)new WaitForSeconds(5__1); <>1__state = 1; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public List lights = new List(); public float minBlinkTime = 0.3f; public float maxBlinkTime = 1.5f; private Material[] materials; public bool hasTriggered = false; public void Start() { if (hasTriggered) { return; } materials = (Material[])(object)new Material[lights.Count]; for (int i = 0; i < lights.Count; i++) { Renderer component = lights[i].GetComponent(); if ((Object)(object)component != (Object)null) { materials[i] = component.material; } ((MonoBehaviour)this).StartCoroutine(BlinkLight(i)); hasTriggered = true; } } public void OnEnabled() { Start(); } [IteratorStateMachine(typeof(d__7))] private IEnumerator BlinkLight(int index) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__7(0) { <>4__this = this, index = index }; } } public class CoroutineRunner : MonoBehaviour { [CompilerGenerated] private sealed class d__3 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public GameObject obj; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; obj.SetActive(true); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static CoroutineRunner _instance; public static CoroutineRunner Instance { get { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown if ((Object)(object)_instance == (Object)null) { GameObject val = new GameObject("CoroutineRunner"); _instance = val.AddComponent(); Object.DontDestroyOnLoad((Object)(object)val); } return _instance; } } [IteratorStateMachine(typeof(d__3))] public static IEnumerator EnableNextFrame(GameObject obj) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__3(0) { obj = obj }; } } [BepInPlugin("REPOCartDecos.Core", "REPO Cart Decos", "1.0.0")] public class REPOCartDecorations : BaseUnityPlugin { private const string modGUID = "REPOCartDecos.Core"; private const string modName = "REPO Cart Decos"; private const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("REPOCartDecos.Core"); private static REPOCartDecorations instance; private void Awake() { if ((Object)(object)instance == (Object)null) { instance = this; } ((BaseUnityPlugin)this).Logger.LogInfo((object)"REPO Cart Decos was awaken"); try { harmony.PatchAll(typeof(REPOCartDecorations)); harmony.PatchAll(typeof(PhysGrabCartBPatch)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patching successful!"); } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"Harmony patching failed: {arg}"); } } public void Update() { } } } namespace REPO_Cart_Decorations.Patches { [HarmonyPatch(typeof(PhysGrabCart), "Start")] internal class PhysGrabCartBPatch { public static bool foundCart = false; public static bool spawnedDecoController = false; public static bool spawnedDeco = false; public static int decoIndex = 1; public static GameObject decoRoot; public static List decoList = new List(); public static AssetBundle bundle; public static bool bundleLoaded = false; [HarmonyPatch("Update")] [HarmonyPostfix] public static void Update() { if (Input.GetKeyDown((KeyCode)46)) { Debug.Log((object)"Next deco would be loaded here"); SwitchDeco(); } } [HarmonyPatch("Start")] [HarmonyPostfix] public static void PatchCart() { //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Expected O, but got Unknown //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: 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_023b: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) if ((foundCart && spawnedDeco) || spawnedDecoController) { return; } string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text = Path.Combine(directoryName, "repocartdecorations"); Debug.Log((object)("[REPOCartDecoLogger] Looking for AssetBundle at: " + text)); if (!File.Exists(text)) { Debug.LogError((object)("[REPOCartDecoLogger] AssetBundle NOT FOUND at path: " + text)); return; } if (!bundleLoaded) { bundle = AssetBundle.LoadFromFile(text); if ((Object)(object)bundle == (Object)null) { Debug.LogError((object)"[REPOCartDecoLogger] Failed to load AssetBundle!"); return; } bundleLoaded = true; Debug.Log((object)"REPO Cart Decos bundle loaded!"); } GameObject val = bundle.LoadAsset("Winter Holiday"); GameObject val2 = bundle.LoadAsset("Cart Deco Castle"); GameObject val3 = bundle.LoadAsset("Cart Deco - Truck"); GameObject val4 = bundle.LoadAsset("Semitary"); Debug.Log((object)"[REPOCartDecoLogger] Cart prefab successfully loaded!"); GameObject val5 = GameObject.Find("Item Cart Medium(Clone)"); if ((Object)(object)val5 == (Object)null) { Debug.LogError((object)"[REPOCartDecoLogger] GameObject 'Item Cart Medium(Clone)' NOT found in scene!"); return; } GameObject val6 = new GameObject(); decoRoot = val6; decoRoot.transform.SetParent(val5.transform, false); decoRoot.transform.localPosition = new Vector3(0f, 0f, 0f); decoRoot.transform.localRotation = Quaternion.identity; if ((Object)(object)val5 != (Object)null) { Debug.Log((object)"Cart Found!"); } if ((Object)(object)decoRoot == (Object)null) { Debug.LogError((object)"Deco Root was not created!"); } if ((Object)(object)decoRoot != (Object)null) { Debug.Log((object)"Now attempting to instantiate the prefabs!"); GameObject val7 = Object.Instantiate(val); val7.transform.SetParent(decoRoot.transform, false); val7.transform.localPosition = new Vector3(0f, 0f, 0f); val7.transform.localRotation = Quaternion.identity; ((MonoBehaviour)CoroutineRunner.Instance).StartCoroutine(CoroutineRunner.EnableNextFrame(val7)); GameObject val8 = Object.Instantiate(val2); val8.transform.SetParent(decoRoot.transform, false); val8.transform.localPosition = new Vector3(0f, 0f, 0f); val8.transform.localRotation = Quaternion.identity; val8.SetActive(false); GameObject val9 = Object.Instantiate(val3); val9.transform.SetParent(decoRoot.transform, false); val9.transform.localPosition = new Vector3(0f, 0f, 0f); val9.transform.localRotation = Quaternion.identity; val9.SetActive(false); GameObject val10 = Object.Instantiate(val4); val10.transform.SetParent(decoRoot.transform, false); val10.transform.localPosition = new Vector3(0f, 0.033f, 0f); val10.transform.localRotation = Quaternion.identity; val10.SetActive(false); decoList.Add(val7); decoList.Add(val8); decoList.Add(val9); decoList.Add(val10); } } public static void TestMethod() { Debug.Log((object)"hello world"); Debug.Log((object)decoList); } public static void SwitchDeco() { for (int i = 0; i < decoRoot.transform.childCount; i++) { ((Component)decoRoot.transform.GetChild(i)).gameObject.SetActive(false); } if ((Object)(object)((Component)decoRoot.transform.GetChild(decoIndex)).gameObject == (Object)null) { Debug.Log((object)"No child at this index!"); return; } ((Component)decoRoot.transform.GetChild(decoIndex)).gameObject.SetActive(true); Debug.Log((object)("Cart Deco is now: " + ((Object)((Component)decoRoot.transform.GetChild(decoIndex)).gameObject).name)); if ((Object)(object)((Component)decoRoot.transform.GetChild(decoIndex)).gameObject.GetComponentInChildren() != (Object)null) { Debug.Log((object)"Found Light Controller"); CartXMasLightController componentInChildren = ((Component)decoRoot.transform.GetChild(decoIndex)).gameObject.GetComponentInChildren(); componentInChildren.hasTriggered = false; componentInChildren.Start(); } decoIndex++; if (decoIndex == decoRoot.transform.childCount) { decoIndex = 0; } } } }