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 LethalJacky v1.0.4
LethalJacky.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("LethalJacky")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LethalJacky")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("1d1a78e0-0f27-4a72-a970-5b69e3b843e5")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace LethalJacky; [BepInPlugin("Letena.LethalJacky", "Lethal Jacky", "1.0.0.0")] public class LethalJacky : BaseUnityPlugin { private const string modGUID = "Letena.LethalJacky"; private const string modName = "Lethal Jacky"; private const string modVersion = "1.0.0.0"; private void Awake() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) new Harmony("Letena.LethalJacky").PatchAll(); ((BaseUnityPlugin)this).Logger.LogMessage((object)"Lethal Jacky has loaded successfully."); } } [HarmonyPatch(typeof(AssetBundle), "LoadAsset", new Type[] { typeof(string) })] public class MeshReplacePatch { private static AssetBundle myAssetBundle; private static void Postfix(ref Object __result, string name) { if (name == "JackInTheBoxBody") { ReplaceMesh(ref __result, "JackInTheBoxBody.fbx"); } if (name == "StickyNoteTex" || name == "StopSignTex") { ReplaceTexture(ref __result, name); } } private static void ReplaceMesh(ref Object original, string newMeshName) { InitializeAssetBundle(); GameObject val = myAssetBundle.LoadAsset<GameObject>(newMeshName); if ((Object)(object)val != (Object)null) { MeshFilter component = val.GetComponent<MeshFilter>(); if ((Object)(object)component != (Object)null) { Mesh sharedMesh = component.sharedMesh; if ((Object)(object)sharedMesh != (Object)null) { original = (Object)(object)sharedMesh; Debug.Log((object)("Replaced mesh '" + newMeshName + "' in the asset loading process.")); } } } else { Debug.LogError((object)("Failed to load mesh '" + newMeshName + "' from Asset Bundle.")); } } private static void ReplaceTexture(ref Object original, string textureName) { InitializeAssetBundle(); Texture2D val = myAssetBundle.LoadAsset<Texture2D>(textureName); if ((Object)(object)val != (Object)null) { original = (Object)(object)val; Debug.Log((object)("Replaced texture '" + textureName + "' in the asset loading process.")); } else { Debug.LogError((object)("Failed to load texture '" + textureName + "' from Asset Bundle.")); } } private static void InitializeAssetBundle() { if ((Object)(object)myAssetBundle != (Object)null) { return; } string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "wolftekst"); if (File.Exists(text)) { myAssetBundle = AssetBundle.LoadFromFile(text); if ((Object)(object)myAssetBundle == (Object)null) { Debug.LogError((object)"Failed to load Asset Bundle!"); } } else { Debug.LogError((object)"Asset Bundle file not found!"); } } }