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 Capybara MouthDog v1.2.0
BepInEx/plugins/Capydog/CapydogMod.dll
Decompiled 2 years agousing System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; 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("CapydogMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CapydogMod")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("ee756f41-a283-45b4-8eeb-02e26ee5f44f")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace CapydogMod { [BepInPlugin("LoddMods.Capydog", "Capydog", "1.2.0.0")] public class ModBase : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("LoddMods.Capydog"); public static ModBase instance; public static ManualLogSource mls; public static AssetBundle capydogBundle; public static GameObject capyObj; private void Awake() { if ((Object)(object)instance == (Object)null) { instance = this; } mls = Logger.CreateLogSource("LoddMods.Capydog"); mls.LogWarning((object)"Capydog successfully loaded."); capydogBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "capydog")); capyObj = capydogBundle.LoadAsset<GameObject>("Assets/CustomModels/Capybara.prefab"); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); } } public static class PluginInfo { public const string modGUID = "LoddMods.Capydog"; public const string modName = "Capydog"; public const string modVers = "1.2.0.0"; } } namespace CapydogMod.Patches { [HarmonyPatch(typeof(MouthDogAI), "Start")] public class MouthdogPatch { [HarmonyPostfix] public static void CapydogSwap(MouthDogAI __instance) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0374: 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_03e0: 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_041a: Unknown result type (might be due to invalid IL or missing references) //IL_045a: 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_0494: Unknown result type (might be due to invalid IL or missing references) ModBase.mls.LogInfo((object)"Swapping Mouthdog -> Capydog!"); if ((Object)ModBase.capyObj == (Object)null) { ModBase.mls.LogError((object)"Could not find Capydog model!!!"); return; } Transform val = ((Component)__instance).transform.Find("MouthDogModel"); SkinnedMeshRenderer val2 = null; SkinnedMeshRenderer val3 = null; Transform val4 = null; if ((Object)(object)val != (Object)null) { Transform val5 = val.Find("ToothDogBody"); Transform val6 = val.Find("ToothDogBodyLOD1"); Transform val7 = val.Find("AnimContainer"); val2 = (((Object)(object)val5 != (Object)null) ? ((Component)val5).GetComponent<SkinnedMeshRenderer>() : null); val3 = (((Object)(object)val6 != (Object)null) ? ((Component)val6).GetComponent<SkinnedMeshRenderer>() : null); val4 = (((Object)(object)val7 != (Object)null) ? val7.Find("Armature") : null); } if ((Object)val2 == (Object)null || !((Renderer)val2).enabled || (Object)val3 == (Object)null || !((Renderer)val3).enabled) { return; } ((Renderer)val2).enabled = false; ((Renderer)val3).enabled = false; Renderer[] componentsInChildren = ((Component)val4).gameObject.GetComponentsInChildren<Renderer>(); Renderer[] array = componentsInChildren; foreach (Renderer val8 in array) { val8.enabled = false; } GameObject val9 = Object.Instantiate<GameObject>(ModBase.capyObj); val9.transform.SetParent(val); val9.transform.localPosition = Vector3.zero; val9.transform.localRotation = Quaternion.identity; val9.transform.localScale = Vector3.one; Transform val10 = val9.transform.Find("Capybara"); Transform val11 = val9.transform.Find("Armature"); val11.SetParent(val4.parent); ((Component)val11).transform.localPosition = val4.localPosition + Vector3.up * 2f; ((Component)val11).transform.localRotation = val4.localRotation; SkinnedMeshRenderer component = ((Component)val10).GetComponent<SkinnedMeshRenderer>(); string[] array2 = new string[6] { "Torso1", "Torso1/Butt/ThighBackLeft", "Torso1/Butt/ThighBackRight", "Neck1Container/Neck1/Neck2", "Torso1/ShoulderFrontLeft", "Torso1/ShoulderFrontRight" }; string[] array3 = new string[6] { "Torso1", "Torso1/Butt/ThighBackLeft", "Torso1/Butt/ThighBackRight", "Torso1/Neck1/Neck2", "Torso1/ShoulderFrontLeft", "Torso1/ShoulderFrontRight" }; int num = ((array2.Length == array3.Length) ? array2.Length : 0); int num2 = num; while (num2-- > 0) { Transform val12 = val4.Find(array2[num2]); Transform val13 = val11.Find(array3[num2]); ModBase.mls.LogWarning((object)$"{num2}) DogBone \"{array2[num2]}\" -> CapyBone \"{array3[num2]}\""); val13.SetParent(val12); ((Component)val13).transform.localPosition = ((Component)val12).transform.localPosition; ((Component)val13).transform.localRotation = ((Component)val12).transform.localRotation; if (array3[num2].EndsWith("Torso1")) { component.rootBone = val13; ((Component)val13).transform.localPosition = new Vector3(0f, 2.5f, -1f); ((Component)val13).transform.localRotation = Quaternion.Euler(0f, 0f, 180f); } else if (array3[num2].EndsWith("ShoulderFrontLeft")) { ((Component)val13).transform.localRotation = Quaternion.Euler(0f, 180f, 0f); } else if (array3[num2].EndsWith("ShoulderFrontRight")) { Transform transform = ((Component)val13).transform; transform.localPosition += new Vector3(0.5f, 0f, -1f); ((Component)val13).transform.localRotation = Quaternion.Euler(-30f, 0f, 0f); } else if (array3[num2].EndsWith("ThighBackLeft") || array3[num2].EndsWith("ThighBackRight")) { Transform transform2 = ((Component)val13).transform; transform2.localPosition += new Vector3(0f, 0f, -1f); ((Component)val13).transform.localRotation = Quaternion.Euler(-30f, 180f, 0f); } } } } }