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 BoyneMod v3.0.0
BoyneMod.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using 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 DunGen; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using On; using On.DunGen; using TMPro; using UnityEngine; using UnityEngine.Networking; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("BoyneMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BoyneMod")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("bb87abac-a7a5-447b-a305-fd55427fd4fd")] [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 BoyneMod; [BepInPlugin("dedfishy.boynemod", "BoyneMod", "3.0.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class BoyneMod : BaseUnityPlugin { public static AssetBundle Rocktopus; public static AssetBundle Cocaine; public static EnemyType rocktopus; public const string modGUID = "dedfishy.boynemod"; public const string modName = "BoyneMod"; public const string modVersion = "3.0.0.0"; private readonly Harmony harmony = new Harmony("dedfishy.boynemod"); private void Awake() { //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Expected O, but got Unknown //IL_01ce: Unknown result type (might be due to invalid IL or missing references) ManualLogSource val = Logger.CreateLogSource("BoyneMod Startup Sequence"); val.LogMessage((object)"\r\n ____ __ __ _ \r\n | _ \\ | \\/ | | |\r\n | |_) | ___ _ _ _ __ ___| \\ / | ___ __| |\r\n | _ < / _ \\| | | | '_ \\ / _ \\ |\\/| |/ _ \\ / _` |\r\n | |_) | (_) | |_| | | | | __/ | | | (_) | (_| |\r\n |____/ \\___/ \\__, |_| |_|\\___|_| |_|\\___/ \\__,_|\r\n __/ | \r\n |___/ \r\nIt may be bad, but at least it's not the thick woman mod!\r\n"); List<Type> list = new List<Type>(); list.Add(typeof(menuModifications)); list.Add(typeof(playerModifications)); List<Type> list2 = list; val.LogMessage((object)"Registering Harmony patches..."); for (int i = 0; i < list2.Count; i++) { val.LogMessage((object)("Installing patch for " + list2[i].Name + "... [" + (i + 1) + "/" + list2.Count + "]")); harmony.PatchAll(list2[i]); } val.LogMessage((object)"Registering MonoMod patches..."); DungeonGenerator.Generate += new hook_Generate(DungeonGenerator_Generate); EnemyAI.Update += new hook_Update(EnemyAI_Update); val.LogMessage((object)"Installing MoreCompany cosmetics..."); string text = assetMurderer.getMoreCompanyCosmeticsPath() + "boyne.cosmetics"; if (!File.Exists(text)) { File.Copy(assetMurderer.getAssetPath("boyne.cosmetics"), text); } val.LogMessage((object)"Loading asset bundles..."); Rocktopus = AssetBundle.LoadFromFile(assetMurderer.getAssetPath("rocktopus")); rocktopus = Rocktopus.LoadAsset<EnemyType>("assets/exampleenemy/rocktopus.asset"); TerminalNode val2 = Rocktopus.LoadAsset<TerminalNode>("assets/exampleenemy/bestiary/exampleenemytn.asset"); TerminalKeyword val3 = Rocktopus.LoadAsset<TerminalKeyword>("assets/exampleenemy/bestiary/exampleenemytk.asset"); rocktopus.enemyPrefab.transform.localScale = new Vector3(0.01f, 0.01f, 0.01f); rocktopus.enemyPrefab.AddComponent<RocktopusAI>(); Rocktopus.LoadAllAssets(); Debug.Log((object)rocktopus.enemyPrefab.GetComponent<RocktopusAI>()); rocktopus.enemyPrefab.GetComponentInChildren<EnemyAICollisionDetect>().mainScript = (EnemyAI)(object)rocktopus.enemyPrefab.GetComponent<RocktopusAI>(); val.LogMessage((object)"Registering enemies..."); NetworkPrefabs.RegisterNetworkPrefab(rocktopus.enemyPrefab); Enemies.RegisterEnemy(rocktopus, 1000, (LevelTypes)(-1), (SpawnType)0, val2, val3); val.LogMessage((object)"Registering items..."); Cocaine = AssetBundle.LoadFromFile(assetMurderer.getAssetPath("cocaine")); int num = 100; Item val4 = Cocaine.LoadAsset<Item>("assets/stupiditem/new item.asset"); NetworkPrefabs.RegisterNetworkPrefab(val4.spawnPrefab); Items.RegisterScrap(val4, num, (LevelTypes)(-1)); int num2 = 10; TerminalNode val5 = Cocaine.LoadAsset<TerminalNode>("assets/stupiditem/cocterminalnode.asset"); Items.RegisterShopItem(val4, (TerminalNode)null, (TerminalNode)null, val5, num2); val.LogMessage((object)"BoyneMod startup complete!"); } public static void DungeonGenerator_Generate(orig_Generate orig, DungeonGenerator self) { orig.Invoke(self); assetMurderer.setGameObjectMeshTexture(assetMurderer.findGameObject("EclipseObject"), "sunTexture.png"); RenderSettings.skybox = assetMurderer.TextureToBaseMaterial(assetMurderer.CreateTextureFromPath("skybox.png")); DynamicGI.UpdateEnvironment(); } public static void EnemyAI_Update(orig_Update orig, EnemyAI self) { if ((Object)(object)self.enemyType == (Object)null) { self.enemyType = rocktopus; } try { orig.Invoke(self); } catch (NullReferenceException ex) { Debug.Log((object)ex.Data); } } } public class RocktopusAI : EnemyAI { private enum State { WANDERING, CHASING } private PlayerControllerB target; public override void Start() { ((EnemyAI)this).Start(); base.currentBehaviourStateIndex = 0; base.syncMovementSpeed = 1f; } public void GetNextTarget() { target = ((EnemyAI)this).GetClosestPlayer(false, true, false); if ((Object)(object)target != (Object)null) { ((EnemyAI)this).SwitchToBehaviourClientRpc(1); } else { ((EnemyAI)this).SwitchToBehaviourClientRpc(0); } } public override void DoAIInterval() { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"Doing base AI interval"); ((EnemyAI)this).DoAIInterval(); Debug.Log((object)"Finding next target"); GetNextTarget(); Debug.Log((object)"Entering switch statement for behavior"); switch ((State)base.currentBehaviourStateIndex) { case State.WANDERING: Debug.Log((object)"Wandering; do nothing"); break; case State.CHASING: Debug.Log((object)"Chasing; determining if target is null"); if ((Object)(object)target != (Object)null) { Debug.Log((object)"Target was not null; moving to target"); base.targetPlayer = target; ((EnemyAI)this).SetDestinationToPosition(((Component)target).transform.position, false); if (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < 10f) { base.targetPlayer.DamagePlayerClientRpc(10, base.targetPlayer.health - 10); } } break; } } } public class assetMurderer { private static ManualLogSource BepInExLogSource = Logger.CreateLogSource("BoyneMod Asset Murderer"); public static Material TextureToBaseMaterial(Texture texture) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown Material val = new Material(Shader.Find("Standard")); val.mainTexture = texture; return val; } public static string getAssetWebPath(string path) { return "file://" + Paths.PluginPath + "/DedFishy-BoyneMod/" + path; } public static string getAssetPath(string path) { return Paths.PluginPath + "/DedFishy-BoyneMod/" + path; } public static string getMoreCompanyCosmeticsPath() { string text = Paths.PluginPath + "/MoreCompanyCosmetics/"; Directory.CreateDirectory(text); return text; } public static void UpdateAudioClip(string assetPath, ref AudioClip audioClip) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 UnityWebRequest audioClip2 = UnityWebRequestMultimedia.GetAudioClip(getAssetWebPath(assetPath), (AudioType)13); try { audioClip2.SendWebRequest(); while (!audioClip2.isDone) { } if ((int)audioClip2.result == 2) { BepInExLogSource.LogError((object)("Failed to retrieve audio asset: " + assetPath)); } else { audioClip = DownloadHandlerAudioClip.GetContent(audioClip2); } } finally { ((IDisposable)audioClip2)?.Dispose(); } } public static void PlayAudioClip(string assetPath, AudioSource source) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip(getAssetWebPath(assetPath), (AudioType)13); try { audioClip.SendWebRequest(); while (!audioClip.isDone) { } if ((int)audioClip.result == 2) { BepInExLogSource.LogError((object)("Failed to retrieve audio asset: " + assetPath)); } else { source.PlayOneShot(DownloadHandlerAudioClip.GetContent(audioClip)); } } finally { ((IDisposable)audioClip)?.Dispose(); } } public static void UpdateTextureImage(string assetPath, Texture2D oldTexture) { if ((Object)(object)oldTexture == (Object)null) { BepInExLogSource.LogWarning((object)"Texture was null! Assuming this is okay..."); } else { ImageConversion.LoadImage(oldTexture, File.ReadAllBytes(getAssetPath(assetPath))); } } public static GameObject getChildGameObject(GameObject parent, string name) { Transform[] componentsInChildren = ((Component)parent.transform).GetComponentsInChildren<Transform>(true); Transform[] array = componentsInChildren; foreach (Transform val in array) { if (((Object)((Component)val).gameObject).name == name) { return ((Component)val).gameObject; } } return null; } public static GameObject getRootGameObject(string name) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects(); foreach (GameObject val in rootGameObjects) { if (((Object)val).name == name) { return val; } } return null; } public static Texture CreateTextureFromPath(string path) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown Texture2D val = new Texture2D(0, 0); UpdateTextureImage(path, val); return (Texture)(object)val; } public static void setGameObjectMeshTexture(GameObject gameObject, string path) { MeshRenderer component = gameObject.GetComponent<MeshRenderer>(); ((Renderer)component).material.mainTexture = CreateTextureFromPath(path); } public static GameObject findGameObject(string name) { return GameObject.Find(name); } public static string reverseString(string str) { char[] array = str.ToCharArray(); Array.Reverse((Array)array); return new string(array); } } [HarmonyPatch(typeof(PlayerControllerB))] [HarmonyPatch("Update")] internal class playerModifications { private static bool hasDoneInitialSetup; [HarmonyPostfix] private static void Postfix(ref PlayerControllerB __instance) { __instance.sprintMeter = 1f; if (!hasDoneInitialSetup) { hasDoneInitialSetup = true; assetMurderer.setGameObjectMeshTexture(assetMurderer.findGameObject("Plane.001"), "posters.png"); Debug.Log((object)"Playing speaker audio"); assetMurderer.PlayAudioClip("badadundadadun.mp3", GameObject.Find("SpeakerAudio").GetComponent<AudioSource>()); } } } [HarmonyPatch(typeof(MenuManager))] [HarmonyPatch("Awake")] internal class menuModifications { private static ManualLogSource BepInExLogSource = Logger.CreateLogSource("BoyneMod Menu Modifications"); [HarmonyPostfix] private static void Postfix(ref MenuManager __instance) { assetMurderer.UpdateAudioClip("menuMusic.mp3", ref __instance.menuMusic); GameObject childGameObject = assetMurderer.getChildGameObject(__instance.menuButtons, "HeaderImage"); if ((Object)(object)childGameObject != (Object)null) { assetMurderer.UpdateTextureImage("headerImage.png", childGameObject.GetComponent<Image>().sprite.texture); ((Object)childGameObject).name = "boynestolethisheaderimage"; } TextMeshProUGUI[] componentsInChildren = assetMurderer.getRootGameObject("Canvas").GetComponentsInChildren<TextMeshProUGUI>(); foreach (TextMeshProUGUI val in componentsInChildren) { ((TMP_Text)val).text = assetMurderer.reverseString(((TMP_Text)val).text); } } }