Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Dafis Monster Health ReAwakening v1.0.1
REPOMonsterFix.dll
Decompiled 8 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Photon.Pun; 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: AssemblyVersion("0.0.0.0")] namespace REPOMonsterFix { [BepInPlugin("com.yourname.repomonsterfix", "REPO Monster Fix", "23.0.0")] public class REPOMonsterFixPlugin : BaseUnityPlugin { public class EnemyHealthState { public int LastKnownHealth; public int LastKnownMaxHealth; public float LastUpdateTime; public bool WasFixed; } public static class Patches { public static void EnemyHealthAwakePrefix(Component __instance) { try { if (assetManagerInstanceField != null && assetManagerInstanceField.GetValue(null) == null) { Object val = Object.FindObjectOfType(assetManagerType); if (val != (Object)null) { assetManagerInstanceField.SetValue(null, val); } } } catch { } } public static Exception EnemyHealthAwakeFinalizer(Component __instance, Exception __exception) { if (__exception != null) { LogSource.LogInfo((object)("[FINALIZER] Caught exception in EnemyHealth.Awake: " + __exception.Message)); FixEnemyHealth(__instance, force: true); return null; } VerifyEnemyHealth(__instance); return __exception; } public static void EnemyHealthUpdatePrefix(Component __instance) { try { int instanceID = ((Object)__instance).GetInstanceID(); if (Time.frameCount % 30 != instanceID % 30) { return; } Type type = ((object)__instance).GetType(); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; FieldInfo field = type.GetField("hurtCurve", bindingAttr); if (field != null && field.GetValue(__instance) == null) { LogSource.LogWarning((object)("[UPDATE] hurtCurve became null for " + ((Object)__instance.gameObject).name + ", fixing!")); FixEnemyHealth(__instance, force: true); return; } FieldInfo field2 = type.GetField("health", bindingAttr); FieldInfo field3 = type.GetField("healthCurrent", bindingAttr); if (!(field2 != null) || !(field3 != null)) { return; } object value = field2.GetValue(__instance); object value2 = field3.GetValue(__instance); if (value != null && value2 != null) { int num = (int)value; int num2 = (int)value2; if (num <= 0 || num > 10000 || num2 < 0 || num2 > 10000) { LogSource.LogWarning((object)$"[UPDATE] Invalid health detected for {((Object)__instance.gameObject).name} (max:{num}, cur:{num2}), fixing!"); FixEnemyHealth(__instance, force: true); } } } catch { } } public static void EnemyHealthOnSpawnPrefix(Component __instance) { LogSource.LogInfo((object)("[ONSPAWN-PRE] Enemy spawning: " + ((Object)__instance.gameObject).name)); FixEnemyHealth(__instance, force: true); } public static void EnemyHealthOnSpawnPostfix(Component __instance) { LogSource.LogInfo((object)("[ONSPAWN-POST] Enemy spawned: " + ((Object)__instance.gameObject).name)); VerifyEnemyHealth(__instance); } public static void EnemyHealthHurtPrefix(Component __instance, int _damage, Vector3 _hurtDirection) { try { Type type = ((object)__instance).GetType(); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; FieldInfo field = type.GetField("healthCurrent", bindingAttr); if (field != null) { object value = field.GetValue(__instance); if (value == null || (int)value < 0) { LogSource.LogWarning((object)"[HURT] Invalid health before hurt, fixing"); FixEnemyHealth(__instance, force: true); } } FieldInfo field2 = type.GetField("hurtCurve", bindingAttr); if (field2 != null && field2.GetValue(__instance) == null) { LogSource.LogWarning((object)"[HURT] hurtCurve null before hurt, fixing"); field2.SetValue(__instance, GetOrCreateAnimationCurve()); } } catch { } } public static void EnemyHealthHurtRPCPrefix(Component __instance) { try { Type type = ((object)__instance).GetType(); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.NonPublic; FieldInfo field = type.GetField("hurtCurve", bindingAttr); if (field != null && field.GetValue(__instance) == null) { LogSource.LogWarning((object)"[HURTRPC] hurtCurve null, fixing"); field.SetValue(__instance, GetOrCreateAnimationCurve()); } } catch { } } public static void HealthSetterPostfix(Component __instance) { LogSource.LogInfo((object)("[SETTER] Health was set for " + ((Object)__instance.gameObject).name)); VerifyEnemyHealth(__instance); } private static void VerifyEnemyHealth(Component enemyHealth) { try { Type type = ((object)enemyHealth).GetType(); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.NonPublic; bool flag = false; FieldInfo field = type.GetField("hurtCurve", bindingAttr); if (field != null && field.GetValue(enemyHealth) == null) { flag = true; } FieldInfo field2 = type.GetField("health", bindingAttr); if (field2 != null) { object value = field2.GetValue(enemyHealth); if (value == null || (int)value <= 0 || (int)value > 10000) { flag = true; } } if (flag) { LogSource.LogWarning((object)("[VERIFY] Enemy needs fixing: " + ((Object)enemyHealth.gameObject).name)); FixEnemyHealth(enemyHealth, force: true); } } catch { } } public static void AssetManagerAwakePostfix(Component __instance) { LogSource.LogInfo((object)"[ASSETMANAGER] AssetManager.Awake completed"); if (assetManagerInstanceField != null && assetManagerInstanceField.GetValue(null) == null) { assetManagerInstanceField.SetValue(null, __instance); } } } private static ManualLogSource LogSource; private static HashSet<int> monitoredEnemies = new HashSet<int>(); private static Dictionary<int, EnemyHealthState> enemyStates = new Dictionary<int, EnemyHealthState>(); private static AnimationCurve defaultCurve; private static Type enemyHealthType; private static Type assetManagerType; private static FieldInfo assetManagerInstanceField; private static FieldInfo animationCurveImpactField; private static FixerHelper helperInstance; private void Awake() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Expected O, but got Unknown //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Expected O, but got Unknown //IL_01a1: 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_01c9: Expected O, but got Unknown //IL_01c9: Expected O, but got Unknown //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Expected O, but got Unknown //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Expected O, but got Unknown //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Expected O, but got Unknown //IL_028b: Expected O, but got Unknown //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Expected O, but got Unknown //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Expected O, but got Unknown //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Expected O, but got Unknown LogSource = ((BaseUnityPlugin)this).Logger; LogSource.LogInfo((object)"=== REPO Monster Fix v23.0.0 (Active Monitor) Starting ==="); defaultCurve = new AnimationCurve(); defaultCurve.AddKey(0f, 0f); defaultCurve.AddKey(0.1f, 1f); defaultCurve.AddKey(0.5f, 0.5f); defaultCurve.AddKey(1f, 0f); try { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { if (enemyHealthType == null) { enemyHealthType = assembly.GetType("EnemyHealth"); } if (assetManagerType == null) { assetManagerType = assembly.GetType("AssetManager"); } if (enemyHealthType != null && assetManagerType != null) { break; } } if (assetManagerType != null) { assetManagerInstanceField = assetManagerType.GetField("instance", BindingFlags.Static | BindingFlags.Public); animationCurveImpactField = assetManagerType.GetField("animationCurveImpact", BindingFlags.Instance | BindingFlags.Public); } GameObject val = new GameObject("REPOMonsterFix_Helper"); Object.DontDestroyOnLoad((Object)(object)val); helperInstance = val.AddComponent<FixerHelper>(); LogSource.LogInfo((object)"Created helper object"); Harmony val2 = new Harmony("com.yourname.repomonsterfix"); if (enemyHealthType != null) { MethodInfo methodInfo = AccessTools.Method(enemyHealthType, "Awake", (Type[])null, (Type[])null); if (methodInfo != null) { val2.Patch((MethodBase)methodInfo, new HarmonyMethod(AccessTools.Method(typeof(Patches), "EnemyHealthAwakePrefix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(AccessTools.Method(typeof(Patches), "EnemyHealthAwakeFinalizer", (Type[])null, (Type[])null)), (HarmonyMethod)null); LogSource.LogInfo((object)"Patched EnemyHealth.Awake"); } MethodInfo methodInfo2 = AccessTools.Method(enemyHealthType, "Update", (Type[])null, (Type[])null); if (methodInfo2 != null) { val2.Patch((MethodBase)methodInfo2, new HarmonyMethod(AccessTools.Method(typeof(Patches), "EnemyHealthUpdatePrefix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); LogSource.LogInfo((object)"Patched EnemyHealth.Update"); } MethodInfo methodInfo3 = AccessTools.Method(enemyHealthType, "OnSpawn", (Type[])null, (Type[])null); if (methodInfo3 != null) { val2.Patch((MethodBase)methodInfo3, new HarmonyMethod(AccessTools.Method(typeof(Patches), "EnemyHealthOnSpawnPrefix", (Type[])null, (Type[])null)), new HarmonyMethod(AccessTools.Method(typeof(Patches), "EnemyHealthOnSpawnPostfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); LogSource.LogInfo((object)"Patched EnemyHealth.OnSpawn"); } MethodInfo methodInfo4 = AccessTools.Method(enemyHealthType, "Hurt", (Type[])null, (Type[])null); if (methodInfo4 != null) { val2.Patch((MethodBase)methodInfo4, new HarmonyMethod(AccessTools.Method(typeof(Patches), "EnemyHealthHurtPrefix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); LogSource.LogInfo((object)"Patched EnemyHealth.Hurt"); } MethodInfo methodInfo5 = AccessTools.Method(enemyHealthType, "HurtRPC", (Type[])null, (Type[])null); if (methodInfo5 != null) { val2.Patch((MethodBase)methodInfo5, new HarmonyMethod(AccessTools.Method(typeof(Patches), "EnemyHealthHurtRPCPrefix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); LogSource.LogInfo((object)"Patched EnemyHealth.HurtRPC"); } PropertyInfo property = enemyHealthType.GetProperty("health", BindingFlags.Instance | BindingFlags.Public); if (property != null && property.GetSetMethod() != null) { val2.Patch((MethodBase)property.GetSetMethod(), (HarmonyMethod)null, new HarmonyMethod(AccessTools.Method(typeof(Patches), "HealthSetterPostfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); LogSource.LogInfo((object)"Patched health setter"); } } if (assetManagerType != null) { MethodInfo methodInfo6 = AccessTools.Method(assetManagerType, "Awake", (Type[])null, (Type[])null); if (methodInfo6 != null) { val2.Patch((MethodBase)methodInfo6, (HarmonyMethod)null, new HarmonyMethod(AccessTools.Method(typeof(Patches), "AssetManagerAwakePostfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); LogSource.LogInfo((object)"Patched AssetManager.Awake"); } } LogSource.LogInfo((object)"=== REPO Monster Fix initialization complete ==="); } catch (Exception arg) { LogSource.LogError((object)$"Failed to initialize: {arg}"); } } public static AnimationCurve GetOrCreateAnimationCurve() { try { if (assetManagerInstanceField != null) { object obj = assetManagerInstanceField.GetValue(null); if (obj == null) { obj = Object.FindObjectOfType(assetManagerType); if (obj != null) { assetManagerInstanceField.SetValue(null, obj); } } if (obj != null && animationCurveImpactField != null) { object? value = animationCurveImpactField.GetValue(obj); AnimationCurve val = (AnimationCurve)((value is AnimationCurve) ? value : null); if (val != null) { return val; } } } } catch { } return defaultCurve; } public static void FixEnemyHealth(Component enemyHealth, bool force = false) { try { int instanceID = ((Object)enemyHealth).GetInstanceID(); if (!monitoredEnemies.Contains(instanceID)) { monitoredEnemies.Add(instanceID); enemyStates[instanceID] = new EnemyHealthState(); } Type type = ((object)enemyHealth).GetType(); BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; FieldInfo field = type.GetField("enemy", bindingFlags); if (field != null && field.GetValue(enemyHealth) == null) { Component component = enemyHealth.GetComponent("Enemy"); if ((Object)(object)component != (Object)null) { field.SetValue(enemyHealth, component); } } FieldInfo field2 = type.GetField("photonView", bindingFlags); if (field2 != null && field2.GetValue(enemyHealth) == null) { PhotonView component2 = enemyHealth.GetComponent<PhotonView>(); if ((Object)(object)component2 != (Object)null) { field2.SetValue(enemyHealth, component2); } } FieldInfo field3 = type.GetField("health", bindingFlags); FieldInfo field4 = type.GetField("healthCurrent", bindingFlags); if (field3 != null && field4 != null) { int num = 100; object value = field3.GetValue(enemyHealth); if (value != null) { num = (int)value; } if (num <= 0 || num > 10000) { num = 100; field3.SetValue(enemyHealth, num); LogSource.LogWarning((object)("[FIX] Fixed invalid max health for " + ((Object)enemyHealth.gameObject).name)); } object value2 = field4.GetValue(enemyHealth); int num2 = ((value2 != null) ? ((int)value2) : num); if (num2 < 0 || num2 > num) { num2 = num; field4.SetValue(enemyHealth, num2); LogSource.LogWarning((object)("[FIX] Fixed invalid current health for " + ((Object)enemyHealth.gameObject).name)); } if (enemyStates.ContainsKey(instanceID)) { enemyStates[instanceID].LastKnownHealth = num2; enemyStates[instanceID].LastKnownMaxHealth = num; enemyStates[instanceID].LastUpdateTime = Time.time; enemyStates[instanceID].WasFixed = true; } } FieldInfo field5 = type.GetField("hurtCurve", bindingFlags); if (field5 != null) { object value3 = field5.GetValue(enemyHealth); if (value3 == null || force) { AnimationCurve orCreateAnimationCurve = GetOrCreateAnimationCurve(); field5.SetValue(enemyHealth, orCreateAnimationCurve); } } InitializeList(enemyHealth, type, bindingFlags, "renderers", typeof(MeshRenderer)); InitializeList(enemyHealth, type, bindingFlags, "sharedMaterials", typeof(Material)); InitializeList(enemyHealth, type, bindingFlags, "instancedMaterials", typeof(Material)); FieldInfo field6 = type.GetField("meshParent", bindingFlags); if (field6 != null) { object? value4 = field6.GetValue(enemyHealth); Transform val = (Transform)((value4 is Transform) ? value4 : null); if ((Object)(object)val != (Object)null) { ProcessMaterials(enemyHealth, type, bindingFlags, val); } } int num3 = Shader.PropertyToID("_ColorOverlay"); int num4 = Shader.PropertyToID("_ColorOverlayAmount"); FieldInfo field7 = type.GetField("materialHurtColor", bindingFlags); if (field7 != null) { field7.SetValue(enemyHealth, num3); } FieldInfo field8 = type.GetField("materialHurtAmount", bindingFlags); if (field8 != null) { field8.SetValue(enemyHealth, num4); } } catch (Exception arg) { LogSource.LogError((object)$"[FIX] Error fixing enemy: {arg}"); } } private static void InitializeList(object instance, Type type, BindingFlags flags, string fieldName, Type elementType) { FieldInfo field = type.GetField(fieldName, flags); if (field != null && field.GetValue(instance) == null) { Type type2 = typeof(List<>).MakeGenericType(elementType); object value = Activator.CreateInstance(type2); field.SetValue(instance, value); } } private static void ProcessMaterials(object instance, Type type, BindingFlags flags, Transform meshParent) { //IL_01a8: Unknown result type (might be due to invalid IL or missing references) try { FieldInfo field = type.GetField("renderers", flags); FieldInfo field2 = type.GetField("sharedMaterials", flags); FieldInfo field3 = type.GetField("instancedMaterials", flags); List<MeshRenderer> list = field?.GetValue(instance) as List<MeshRenderer>; List<Material> list2 = field2?.GetValue(instance) as List<Material>; List<Material> list3 = field3?.GetValue(instance) as List<Material>; if (list == null || list2 == null || list3 == null) { return; } list.Clear(); list.AddRange(((Component)meshParent).GetComponentsInChildren<MeshRenderer>(true)); foreach (MeshRenderer item in list) { if ((Object)(object)item == (Object)null || (Object)(object)((Renderer)item).sharedMaterial == (Object)null) { continue; } Material val = null; foreach (Material item2 in list2) { if ((Object)(object)item2 != (Object)null && ((Object)((Renderer)item).sharedMaterial).name == ((Object)item2).name) { val = item2; ((Renderer)item).sharedMaterial = list3[list2.IndexOf(item2)]; } } if ((Object)(object)val == (Object)null) { val = ((Renderer)item).sharedMaterial; list2.Add(val); list3.Add(((Renderer)item).material); } } int num = Shader.PropertyToID("_ColorOverlay"); foreach (Material item3 in list3) { if ((Object)(object)item3 != (Object)null && item3.HasProperty(num)) { item3.SetColor(num, Color.red); } } } catch { } } public static void ScanAndFixEnemies() { try { GameObject[] array = Object.FindObjectsOfType<GameObject>(); int num = 0; int num2 = 0; GameObject[] array2 = array; foreach (GameObject val in array2) { if ((Object)(object)val == (Object)null || !((Object)val).name.Contains("Enemy")) { continue; } Component val2 = null; Component[] components = val.GetComponents<Component>(); foreach (Component val3 in components) { if ((Object)(object)val3 != (Object)null && ((object)val3).GetType().Name == "EnemyHealth") { val2 = val3; break; } } if (!((Object)(object)val2 != (Object)null)) { continue; } num++; Type type = ((object)val2).GetType(); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; bool flag = false; FieldInfo field = type.GetField("hurtCurve", bindingAttr); if (field != null && field.GetValue(val2) == null) { flag = true; } FieldInfo field2 = type.GetField("health", bindingAttr); FieldInfo field3 = type.GetField("healthCurrent", bindingAttr); if (field2 != null) { object value = field2.GetValue(val2); if (value == null || (int)value <= 0 || (int)value > 10000) { flag = true; } } if (field3 != null) { object value2 = field3.GetValue(val2); if (value2 == null || (int)value2 < 0 || (int)value2 > 10000) { flag = true; } } if (flag) { LogSource.LogInfo((object)("[SCAN] Fixing enemy: " + ((Object)val).name)); FixEnemyHealth(val2, force: true); num2++; } } if (num2 > 0) { LogSource.LogInfo((object)$"[SCAN] Fixed {num2}/{num} enemies"); } } catch (Exception arg) { LogSource.LogError((object)$"[SCAN] Error: {arg}"); } } } public class FixerHelper : MonoBehaviour { private float nextCheckTime; private float checkInterval = 0.5f; private bool immediateCheckRequested; private void Update() { if (immediateCheckRequested || Time.time >= nextCheckTime) { immediateCheckRequested = false; nextCheckTime = Time.time + checkInterval; REPOMonsterFixPlugin.ScanAndFixEnemies(); } } public void RequestImmediateCheck() { immediateCheckRequested = true; } } } namespace REPODiagnostic { [BepInPlugin("com.yourname.repodiagnostic", "REPO Diagnostic", "2.0.0")] public class REPODiagnosticPlugin : BaseUnityPlugin { public static class Patches { public static void SetActivePrefix(GameObject __instance, bool value) { if (!value || !((Object)(object)__instance != (Object)null)) { return; } EnemyHealth component = __instance.GetComponent<EnemyHealth>(); if (!((Object)(object)component != (Object)null)) { return; } Debug.Log((object)("[REPO Diagnostic] === ENEMY SPAWN: " + ((Object)__instance).name + " ===")); Type type = ((object)component).GetType(); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; string[] array = new string[6] { "hurtCurve", "renderers", "sharedMaterials", "instancedMaterials", "enemy", "photonView" }; string[] array2 = array; foreach (string text in array2) { FieldInfo field = type.GetField(text, bindingAttr); if (field != null) { try { object value2 = field.GetValue(component); Debug.Log((object)("[REPO Diagnostic] " + text + ": " + ((value2 == null) ? "NULL" : ("OK (" + value2.GetType().Name + ")")))); } catch (Exception ex) { Debug.Log((object)("[REPO Diagnostic] " + text + ": ERROR - " + ex.Message)); } } else { Debug.Log((object)("[REPO Diagnostic] " + text + ": FIELD NOT FOUND")); } } Debug.Log((object)"[REPO Diagnostic] === END ENEMY SPAWN CHECK ==="); } } private void Awake() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)"REPO Diagnostic v2.0.0 starting..."); Harmony val = new Harmony("com.yourname.repodiagnostic"); MethodInfo methodInfo = AccessTools.Method(typeof(GameObject), "SetActive", new Type[1] { typeof(bool) }, (Type[])null); if (methodInfo != null) { val.Patch((MethodBase)methodInfo, new HarmonyMethod(AccessTools.Method(typeof(Patches), "SetActivePrefix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Hooked GameObject.SetActive"); } DeepCheckAssetManager(); } private void DeepCheckAssetManager() { try { ((BaseUnityPlugin)this).Logger.LogInfo((object)"=== DEEP ASSETMANAGER ANALYSIS ==="); Type type = null; Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { type = assembly.GetType("AssetManager"); if (type != null) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Found AssetManager in assembly: " + assembly.GetName().Name)); break; } } if (type == null) { ((BaseUnityPlugin)this).Logger.LogError((object)"AssetManager type not found in any assembly!"); return; } ((BaseUnityPlugin)this).Logger.LogInfo((object)("AssetManager type found: " + type.FullName)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Static Fields:"); FieldInfo[] fields = type.GetFields(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { ((BaseUnityPlugin)this).Logger.LogInfo((object)$" - {fieldInfo.Name} ({fieldInfo.FieldType.Name}) - {fieldInfo.Attributes}"); if (fieldInfo.Name.ToLower().Contains("instance") || fieldInfo.FieldType == type) { object value = fieldInfo.GetValue(null); ((BaseUnityPlugin)this).Logger.LogInfo((object)(" ^ Possible instance field! Value is " + ((value == null) ? "NULL" : "NOT NULL"))); } } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Static Properties:"); PropertyInfo[] properties = type.GetProperties(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); PropertyInfo[] array2 = properties; foreach (PropertyInfo propertyInfo in array2) { ((BaseUnityPlugin)this).Logger.LogInfo((object)$" - {propertyInfo.Name} ({propertyInfo.PropertyType.Name}) - CanRead:{propertyInfo.CanRead} CanWrite:{propertyInfo.CanWrite}"); if (propertyInfo.Name.ToLower().Contains("instance") || propertyInfo.PropertyType == type) { try { object value2 = propertyInfo.GetValue(null); ((BaseUnityPlugin)this).Logger.LogInfo((object)(" ^ Possible instance property! Value is " + ((value2 == null) ? "NULL" : "NOT NULL"))); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogInfo((object)(" ^ Error reading property: " + ex.Message)); } } } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Instance Fields:"); FieldInfo[] fields2 = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo[] array3 = fields2; foreach (FieldInfo fieldInfo2 in array3) { if (fieldInfo2.Name.Contains("animationCurve") || fieldInfo2.Name.Contains("impact")) { ((BaseUnityPlugin)this).Logger.LogInfo((object)$" - {fieldInfo2.Name} ({fieldInfo2.FieldType.Name}) - {fieldInfo2.Attributes} [IMPORTANT]"); continue; } ((BaseUnityPlugin)this).Logger.LogInfo((object)(" - " + fieldInfo2.Name + " (" + fieldInfo2.FieldType.Name + ")")); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Searching for AssetManager in scene..."); Object val = Object.FindObjectOfType(type); if (val != (Object)null) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Found AssetManager component in scene on GameObject: " + ((Object)((Component)((val is Component) ? val : null)).gameObject).name)); FieldInfo field = type.GetField("animationCurveImpact", BindingFlags.Instance | BindingFlags.Public); if (field != null) { object value3 = field.GetValue(val); ((BaseUnityPlugin)this).Logger.LogInfo((object)(" animationCurveImpact is " + ((value3 == null) ? "NULL" : "NOT NULL"))); } } else { ((BaseUnityPlugin)this).Logger.LogInfo((object)"No AssetManager component found in scene"); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"=== END ASSETMANAGER ANALYSIS ==="); } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"Error in deep check: {arg}"); } } } }