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.Text; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LGUCasinoSignDump")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+8c5521e37f37e3d76518a16d04e5d1051842f105")] [assembly: AssemblyProduct("LGUCasinoSignDump")] [assembly: AssemblyTitle("LGUCasinoSignDump")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LGUCasinoSignDump { [BepInPlugin("com.y4ngz.lgucasinosigndump", "LGUCasinoSignDump", "1.0.3")] public class Plugin : BaseUnityPlugin { [CompilerGenerated] private sealed class d__7 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Plugin <>4__this; 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() { int num = <>1__state; Plugin plugin = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = null; <>1__state = 2; return true; case 2: <>1__state = -1; if (plugin._patchAttempted) { return false; } plugin._patchAttempted = true; Log.LogInfo((object)"Searching for CasinoBuilding type now."); plugin.TryApplyPatch(); plugin.TryPatchMenuManagerFix(); 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(); } } public const string PLUGIN_GUID = "com.y4ngz.lgucasinosigndump"; public const string PLUGIN_NAME = "LGUCasinoSignDump"; public const string PLUGIN_VERSION = "1.0.3"; public static ManualLogSource Log; private Harmony _harmony; private bool _patchAttempted; private void Awake() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"LGUCasinoSignDump v1.0.3 loaded."); Log.LogInfo((object)"Will attempt to patch CasinoBuilding.Awake on next frame (after all plugins finish loading)."); _harmony = new Harmony("com.y4ngz.lgucasinosigndump"); ((MonoBehaviour)this).StartCoroutine(DelayedPatchAttempt()); } [IteratorStateMachine(typeof(d__7))] private IEnumerator DelayedPatchAttempt() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__7(0) { <>4__this = this }; } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void TryApplyPatch() { //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Expected O, but got Unknown try { Type type = null; string text = null; Log.LogInfo((object)"Scanning all loaded assemblies..."); int num = 0; Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { num++; Type[] array; try { array = assembly.GetTypes(); } catch (ReflectionTypeLoadException ex) { array = ex.Types.Where((Type t) => t != null).ToArray(); } catch { continue; } Type[] array2 = array; foreach (Type type2 in array2) { if (!(type2 == null) && (type2.FullName == "LethalCasino.Custom.CasinoBuilding" || type2.FullName == "LethalCasino.CasinoBuilding" || (type2.Name == "CasinoBuilding" && type2.Namespace != null && type2.Namespace.Contains("Casino")))) { type = type2; text = assembly.GetName().Name; break; } } if (type != null) { break; } } Log.LogInfo((object)$"Scanned {num} assemblies."); if (type == null) { Log.LogError((object)"CasinoBuilding type NOT found in any loaded assembly."); Log.LogError((object)"Listing assemblies that contain 'casino' in their name (case-insensitive):"); assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly2 in assemblies) { string name = assembly2.GetName().Name; if (name == null || !name.ToLowerInvariant().Contains("casino")) { continue; } Log.LogError((object)(" Found: " + assembly2.FullName)); try { foreach (string item in (from t in assembly2.GetTypes() where t != null && t.IsClass select t.FullName).Take(50)) { Log.LogError((object)(" type: " + item)); } } catch (Exception ex2) { Log.LogError((object)(" (could not list types: " + ex2.Message + ")")); } } return; } Log.LogInfo((object)("Found CasinoBuilding: " + type.FullName + " in assembly '" + text + "'")); MethodInfo method = type.GetMethod("Awake", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method == null) { Log.LogError((object)"Could not find CasinoBuilding.Awake method."); Log.LogError((object)"Available instance methods:"); MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { Log.LogError((object)(" " + methodInfo.Name)); } } else { MethodInfo method2 = typeof(SignDumpPatch).GetMethod("AwakePostfix", BindingFlags.Static | BindingFlags.Public); _harmony.Patch((MethodBase)method, (HarmonyMethod)null, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log.LogInfo((object)"Harmony patch applied. Will dump CasinoBuilding hierarchy on Awake."); } } catch (Exception arg) { Log.LogError((object)$"TryApplyPatch error: {arg}"); } } private void TryPatchMenuManagerFix() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown try { Type type = null; Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { type = assemblies[i].GetType("LethalCasino.Patches.MenuManagerPatch"); if (type != null) { break; } } if (type != null) { MethodInfo methodInfo = AccessTools.Method(type, "StartPatch", (Type[])null, (Type[])null); if (methodInfo != null) { MethodInfo method = typeof(LethalCasinoMenuFix).GetMethod("Prefix", BindingFlags.Static | BindingFlags.Public); _harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(method), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log.LogInfo((object)"Patched LethalCasino MenuManagerPatch.StartPatch — skipping broken v69 DisplayMenuNotification call."); } else { Log.LogWarning((object)"Found MenuManagerPatch type but could not find StartPatch method."); } } else { Log.LogInfo((object)"LethalCasino.Patches.MenuManagerPatch not found — skipping menu fix (LethalCasino may not be installed)."); } } catch (Exception ex) { Log.LogWarning((object)("Could not patch LethalCasino MenuManagerPatch: " + ex.Message)); } } } internal static class LethalCasinoMenuFix { public static bool Prefix() { return false; } } public static class SignDumpPatch { private static int _dumpCount; public static void AwakePostfix(object __instance) { //IL_00f3: 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_0109: Unknown result type (might be due to invalid IL or missing references) try { _dumpCount++; Component val = (Component)((__instance is Component) ? __instance : null); if ((Object)(object)val == (Object)null) { Plugin.Log.LogError((object)"CasinoBuilding instance is not a Component?"); return; } Transform transform = val.transform; string text = Path.Combine(Paths.BepInExRootPath, "Y4NGZ_Discovery"); Directory.CreateDirectory(text); string arg = DateTime.Now.ToString("yyyyMMdd_HHmmss"); string text2 = Path.Combine(text, $"casinobuilding_hierarchy_{arg}_dump{_dumpCount}.txt"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("CasinoBuilding hierarchy dump"); stringBuilder.AppendLine($"Generated: {DateTime.Now:yyyy-MM-dd HH:mm:ss}"); stringBuilder.AppendLine($"Dump #{_dumpCount} this session"); stringBuilder.AppendLine($"Root: {((Object)transform).name} (instance ID {((Object)transform).GetInstanceID()})"); stringBuilder.AppendLine($"World pos: {transform.position}, rot: {transform.eulerAngles}, scale: {transform.lossyScale}"); stringBuilder.AppendLine(new string('=', 80)); stringBuilder.AppendLine(); DumpRecursive(transform, stringBuilder, 0); File.WriteAllText(text2, stringBuilder.ToString()); Plugin.Log.LogInfo((object)("[SignDump] CasinoBuilding hierarchy written to: " + text2)); } catch (Exception arg2) { Plugin.Log.LogError((object)$"AwakePostfix error: {arg2}"); } } private static void DumpRecursive(Transform t, StringBuilder sb, int depth) { //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: 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) if ((Object)(object)t == (Object)null) { return; } string text = new string(' ', depth * 2); GameObject gameObject = ((Component)t).gameObject; Component[] components = gameObject.GetComponents(); string text2 = string.Join(", ", from c in components where (Object)(object)c != (Object)null select ((object)c).GetType().Name); sb.AppendLine(text + ((Object)gameObject).name); sb.AppendLine($"{text} active={gameObject.activeInHierarchy}, layer={LayerMask.LayerToName(gameObject.layer)}, tag={gameObject.tag}"); sb.AppendLine(text + " localPos=" + V3(t.localPosition) + " worldPos=" + V3(t.position)); sb.AppendLine(text + " localRot=" + V3(t.localEulerAngles) + " worldRot=" + V3(t.eulerAngles)); sb.AppendLine(text + " localScale=" + V3(t.localScale) + " lossyScale=" + V3(t.lossyScale)); sb.AppendLine(text + " components: [" + text2 + "]"); Renderer component = gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { string[] obj = new string[7] { text, " RENDERER: ", ((object)component).GetType().Name, " bounds.center=", null, null, null }; Bounds bounds = component.bounds; obj[4] = V3(((Bounds)(ref bounds)).center); obj[5] = " bounds.size="; bounds = component.bounds; obj[6] = V3(((Bounds)(ref bounds)).size); sb.AppendLine(string.Concat(obj)); if (component.sharedMaterials != null) { for (int i = 0; i < component.sharedMaterials.Length; i++) { Material val = component.sharedMaterials[i]; if ((Object)(object)val != (Object)null) { object[] obj2 = new object[4] { text, i, ((Object)val).name, null }; Shader shader = val.shader; obj2[3] = ((shader != null) ? ((Object)shader).name : null) ?? "null"; sb.AppendLine(string.Format("{0} MAT[{1}] name='{2}' shader='{3}'", obj2)); if (val.HasProperty("_MainTex")) { Texture texture = val.GetTexture("_MainTex"); sb.AppendLine(text + " _MainTex=" + (((Object)(object)texture != (Object)null) ? ((Object)texture).name : "null")); } if (val.HasProperty("_EmissionMap")) { Texture texture2 = val.GetTexture("_EmissionMap"); sb.AppendLine(text + " _EmissionMap=" + (((Object)(object)texture2 != (Object)null) ? ((Object)texture2).name : "null")); } } } } } MeshFilter component2 = gameObject.GetComponent(); if ((Object)(object)component2 != (Object)null && (Object)(object)component2.sharedMesh != (Object)null) { sb.AppendLine($"{text} MESH: '{((Object)component2.sharedMesh).name}' verts={component2.sharedMesh.vertexCount} submeshes={component2.sharedMesh.subMeshCount}"); } Light component3 = gameObject.GetComponent(); if ((Object)(object)component3 != (Object)null) { sb.AppendLine($"{text} LIGHT: type={component3.type} intensity={component3.intensity:F2} color={component3.color} range={component3.range:F2}"); } sb.AppendLine(); for (int j = 0; j < t.childCount; j++) { DumpRecursive(t.GetChild(j), sb, depth + 1); } } private static string V3(Vector3 v) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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) return $"({v.x:F3}, {v.y:F3}, {v.z:F3})"; } } public static class PluginInfo { public const string PLUGIN_GUID = "LGUCasinoSignDump"; public const string PLUGIN_NAME = "LGUCasinoSignDump"; public const string PLUGIN_VERSION = "1.0.0"; } }