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 PomniJester v1.0.0
PomniJester.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; 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("PomniJester")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Replaces the Jester's skin with Pomni")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("PomniJester")] [assembly: AssemblyTitle("PomniJester")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [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 PomniJester { [BepInPlugin("PomniJester", "PomniJester", "1.0.0")] public class Plugin : BaseUnityPlugin { public static Texture JesterTexture; public static GameObject JesterHat; public static AudioClip JesterClip; public static AudioClip JesterPopClip; private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin PomniJester is loaded!"); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); LoadAssets(); } private void LoadAssets() { GameObject obj = AssetBundle.LoadFromFile(Path.Join((ReadOnlySpan<char>)Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), (ReadOnlySpan<char>)"jestervisuals")).LoadAsset<GameObject>("assets/jestervisuals.prefab"); JesterTexture = ((Component)obj.transform.GetChild(0)).GetComponent<Renderer>().sharedMaterial.mainTexture; JesterHat = ((Component)obj.transform.GetChild(1)).gameObject; JesterClip = ((Component)obj.transform.GetChild(2)).GetComponent<AudioSource>().clip; JesterPopClip = ((Component)obj.transform.GetChild(3)).GetComponent<AudioSource>().clip; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "PomniJester"; public const string PLUGIN_NAME = "PomniJester"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace PomniJester.Patches { [HarmonyPatch(typeof(JesterAI))] internal class JesterPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void JesterStart(JesterAI __instance) { //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Plugin.JesterTexture == (Object)null || (Object)(object)Plugin.JesterClip == (Object)null || (Object)(object)Plugin.JesterHat == (Object)null || (Object)(object)Plugin.JesterPopClip == (Object)null) { Debug.Log((object)"Pomni Jester replacement assets null, returning"); return; } Transform val = ((Component)__instance).transform.Find("MeshContainer").Find("AnimContainer").Find("metarig") .Find("BoxContainer") .Find("spine.004") .Find("spine.005") .Find("spine.006") .Find("UpperJaw"); if ((Object)(object)val == (Object)null) { Debug.Log((object)"Could not find jester hat parent, returning"); return; } Material val2 = null; foreach (Material item in ((Component)__instance).GetComponentsInChildren<Renderer>(true).SelectMany((Renderer x) => x.sharedMaterials).ToList()) { if (((Object)item).name.StartsWith("JesterTex")) { item.mainTexture = Plugin.JesterTexture; val2 = item; } } __instance.popGoesTheWeaselTheme = Plugin.JesterClip; __instance.popUpSFX = Plugin.JesterPopClip; GameObject val3 = Object.Instantiate<GameObject>(Plugin.JesterHat); val3.transform.SetParent(val); val3.transform.localPosition = Vector3.zero; val3.transform.localRotation = Quaternion.identity; val3.transform.localScale = Vector3.one; if (!((Object)(object)val2 == (Object)null)) { Renderer[] componentsInChildren = val3.GetComponentsInChildren<Renderer>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].sharedMaterial.shader = val2.shader; } } } } }