Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of RalseiSuitMod v1.0.1
BepInEx/plugins/RalseiMod/RalseiMod.dll
Decompiled 7 hours agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using ModelReplacement; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("RalseiMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RalseiMod")] [assembly: AssemblyTitle("RalseiMod")] [assembly: AssemblyVersion("1.0.0.0")] namespace RalseiMod; [BepInPlugin("com.yourname.ralseimod", "Ralsei Suit Mod", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public static AssetBundle mainBundle; private void Awake() { string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "ralsei_suit"); Debug.Log((object)("[RALSEI] Loading bundle from: " + text)); mainBundle = AssetBundle.LoadFromFile(text); if ((Object)(object)mainBundle == (Object)null) { Debug.LogError((object)"[RALSEI] FAILED TO LOAD BUNDLE. Put 'ralsei_suit' next to RalseiMod.dll"); return; } Debug.Log((object)"[RALSEI] Bundle loaded OK."); ModelReplacementAPI.RegisterSuitModelReplacement("Ralsei", typeof(RalseiReplacement)); Debug.Log((object)"[RALSEI] Registered suit replacement for suit name: Ralsei"); } } public class RalseiReplacement : BodyReplacementBase { private const float MODEL_Y_OFFSET = -2.8f; protected override GameObject LoadAssetsAndReturnModel() { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown //IL_00e2: 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_0106: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Plugin.mainBundle == (Object)null) { Debug.LogError((object)"[RALSEI] mainBundle is null."); return null; } string[] allAssetNames = Plugin.mainBundle.GetAllAssetNames(); string[] array = allAssetNames; foreach (string text in array) { if (text.EndsWith(".prefab")) { GameObject val = Plugin.mainBundle.LoadAsset<GameObject>(text); if ((Object)(object)val == (Object)null) { Debug.LogError((object)("[RALSEI] Prefab failed to load: " + text)); return null; } Debug.Log((object)("[RALSEI] Loaded prefab: " + text)); GameObject val2 = new GameObject("RalseiRuntimeRoot"); GameObject val3 = Object.Instantiate<GameObject>(val, val2.transform); ((Object)val3).name = "Ralsei2_OffsetModel"; val3.transform.localPosition = new Vector3(0f, -2.8f, 0f); val3.transform.localRotation = Quaternion.identity; val3.transform.localScale = Vector3.one; Debug.Log((object)"[RALSEI] Created runtime root."); Debug.Log((object)("[RALSEI] Child model Y offset: " + -2.8f)); Animator componentInChildren = val2.GetComponentInChildren<Animator>(true); if ((Object)(object)componentInChildren == (Object)null) { Debug.LogError((object)"[RALSEI] No Animator found anywhere in runtime model."); return val2; } Debug.Log((object)("[RALSEI] Animator found on: " + ((Object)((Component)componentInChildren).gameObject).name)); Debug.Log((object)("[RALSEI] Avatar assigned: " + ((Object)(object)componentInChildren.avatar != (Object)null))); if ((Object)(object)componentInChildren.avatar != (Object)null) { Debug.Log((object)("[RALSEI] Avatar isHuman: " + componentInChildren.avatar.isHuman)); } SkinnedMeshRenderer componentInChildren2 = val2.GetComponentInChildren<SkinnedMeshRenderer>(true); Debug.Log((object)("[RALSEI] SkinnedMeshRenderer found: " + ((Object)(object)componentInChildren2 != (Object)null))); if ((Object)(object)componentInChildren2 != (Object)null) { Debug.Log((object)("[RALSEI] Mesh object: " + ((Object)((Component)componentInChildren2).gameObject).name)); Debug.Log((object)("[RALSEI] Root bone: " + (((Object)(object)componentInChildren2.rootBone != (Object)null) ? ((Object)componentInChildren2.rootBone).name : "NULL"))); Debug.Log((object)("[RALSEI] Bone count: " + ((componentInChildren2.bones != null) ? componentInChildren2.bones.Length : 0))); } AddOffsetBuilderSafely(((Component)componentInChildren).gameObject); Debug.Log((object)"[RALSEI] Returning runtime root to ModelReplacementAPI."); return val2; } } Debug.LogError((object)"[RALSEI] No prefab found in bundle."); return null; } private void AddOffsetBuilderSafely(GameObject target) { //IL_008d: Unknown result type (might be due to invalid IL or missing references) Type type = FindTypeByName("OffsetBuilder"); if (type == null) { Debug.LogError((object)"[RALSEI] Could not find OffsetBuilder type inside loaded assemblies."); return; } Component component = target.GetComponent(type); if ((Object)(object)component != (Object)null) { Debug.Log((object)"[RALSEI] OffsetBuilder already exists."); return; } Debug.LogWarning((object)"[RALSEI] OffsetBuilder missing. Adding automatically."); Component component2 = target.AddComponent(type); SetBool(component2, "UseNoPostProcessing", value: false); SetBool(component2, "GenerateViewModel", value: false); SetBool(component2, "RemoveHelmet", value: false); SetVector3(component2, "rootScale", Vector3.one); Debug.Log((object)"[RALSEI] OffsetBuilder added."); } private Type FindTypeByName(string typeName) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { Type[] types; try { types = assembly.GetTypes(); } catch { continue; } Type[] array = types; foreach (Type type in array) { if (type.Name == typeName) { Debug.Log((object)("[RALSEI] Found type: " + type.FullName)); return type; } } } return null; } private void SetBool(Component component, string name, bool value) { Type type = ((object)component).GetType(); FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null && field.FieldType == typeof(bool)) { field.SetValue(component, value); return; } PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.PropertyType == typeof(bool) && property.CanWrite) { property.SetValue(component, value, null); } } private void SetVector3(Component component, string name, Vector3 value) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) Type type = ((object)component).GetType(); FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null && field.FieldType == typeof(Vector3)) { field.SetValue(component, value); return; } PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.PropertyType == typeof(Vector3) && property.CanWrite) { property.SetValue(component, value, null); } } }