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 GokuBracken v1.4.0
GokuBracken.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.Configuration; using GokuBracken.AssetManagement; using GokuBracken.Patches; using GokuBracken.Scripts; using HarmonyLib; using UnityEngine; using UnityEngine.Video; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("GokuBracken")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("GokuBracken")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("50feedfa-5dd6-4358-936e-87945c1a8cae")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace GokuBracken { [BepInPlugin("Vulf.GokuBracken", "Goku Bracken", "1.4.0")] public class GokuBrackenBase : BaseUnityPlugin { private static GokuBrackenBase _instance; private readonly Harmony Harmony = new Harmony("Vulf.GokuBracken"); internal static GokuBrackenBase Instance { get { return _instance; } set { if ((Object)(object)_instance == (Object)null) { _instance = value; } else { Object.Destroy((Object)(object)value); } } } public static ConfigEntry<bool> UseVoicelines { get; private set; } public static ConfigEntry<bool> UseMusic { get; private set; } public static ConfigEntry<bool> UseDeathSound { get; private set; } private void Awake() { Instance = this; UseVoicelines = ((BaseUnityPlugin)this).Config.Bind<bool>("Sound", "Use Goku Voicelines", true, "Controls whether or not to replace the bracken's kill sound with Goku voicelines"); UseMusic = ((BaseUnityPlugin)this).Config.Bind<bool>("Sound", "Use UI Music", true, "Controls whether or not to replace the bracken's agressive sound with the Ultra Instinct theme"); UseDeathSound = ((BaseUnityPlugin)this).Config.Bind<bool>("Sound", "Use Death Sound", true, "Controls whether or not to play a sound on the bracken's death"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading asset bundle..."); Assets.PopulateAssets(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Hey it's me! Goku!"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Your files look pretty strong! I'm gonna patch them!"); Harmony.PatchAll(typeof(GokuBrackenBase)); Harmony.PatchAll(typeof(EnemyPatches)); Harmony.PatchAll(typeof(TerminalPatches)); Harmony.PatchAll(typeof(RoundManagementPatches)); } internal static void LogInfo(object message) { ((BaseUnityPlugin)Instance).Logger.LogInfo(message); } internal static void LogWarning(object message) { ((BaseUnityPlugin)Instance).Logger.LogWarning(message); } internal static void LogError(object message) { ((BaseUnityPlugin)Instance).Logger.LogError(message); } } public static class PluginInfo { public const string GUID = "Vulf.GokuBracken"; public const string NAME = "Goku Bracken"; public const string VERSION = "1.4.0"; public const string ASSET_BUNDLE_NAME = "gokubracken"; } } namespace GokuBracken.Scripts { public class PowerLevelController : MonoBehaviour { private const int POWER_LEVEL_MIN = 5000; private const int POWER_LEVEL_MAX = 9001; private const int POWER_LEVEL_VARIANCE = 5; private const float UPDATE_RATE = 0.2f; private const int MAX_RATE_OF_CHANGE = 2000; private float powerLevel; private int targetPowerLevel; private float updateTimer; public FlowermanAI FlowermanAI { get; set; } public ScanNodeProperties ScanNode { get; set; } public int PowerLevel => (int)powerLevel; private void Start() { powerLevel = 5000f; } private void Update() { if (updateTimer > 0.2f) { int num = Random.Range(-5, 6); targetPowerLevel = (((EnemyAI)FlowermanAI).movingTowardsTargetPlayer ? 9001 : 5000) + num; ScanNode.subText = $"Power Level: {PowerLevel}"; updateTimer = 0f; } int num2 = 1; if (powerLevel > (float)targetPowerLevel) { num2 *= -1; } powerLevel += (float)(Random.Range(0, 2000) * num2) * Time.deltaTime; powerLevel = Mathf.Clamp(powerLevel, 4950f, 9051f); updateTimer += Time.deltaTime; } } } namespace GokuBracken.Patches { [HarmonyPatch] internal class EnemyPatches { [HarmonyPatch(typeof(FlowermanAI), "Start")] [HarmonyPostfix] public static void CreateGokuModel(FlowermanAI __instance) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = ((Component)((Component)__instance).transform.Find("FlowermanModel")).GetComponentsInChildren<Renderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = false; } ((Object)Object.Instantiate<GameObject>(Assets.GokuPrefab, ((Component)__instance).gameObject.transform)).name = "GokuModel"; GameObject obj = Object.Instantiate<GameObject>(Assets.GokuEyesPrefab, ((Component)__instance).gameObject.transform); obj.transform.localPosition = new Vector3(0f, 2.7f, 0f); ((Object)obj).name = "GokuEyes"; if (GokuBrackenBase.UseMusic.Value) { __instance.creatureAngerVoice.clip = Assets.UltraInstinctTheme; } if (GokuBrackenBase.UseVoicelines.Value) { __instance.crackNeckSFX = Assets.GokuVoiceline; __instance.crackNeckAudio.clip = Assets.GokuVoiceline; } Transform obj2 = ((Component)__instance).transform.Find("ScanNode"); ScanNodeProperties component = ((Component)obj2).GetComponent<ScanNodeProperties>(); component.headerText = "Son Goku"; PowerLevelController powerLevelController = ((Component)obj2).gameObject.AddComponent<PowerLevelController>(); powerLevelController.FlowermanAI = __instance; powerLevelController.ScanNode = component; } [HarmonyPatch(typeof(FlowermanAI), "KillEnemy")] [HarmonyPostfix] public static void CleanUpGoku(FlowermanAI __instance) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) Object.Destroy((Object)(object)((Component)((Component)__instance).transform.Find("GokuEyes")).gameObject); Transform val = ((Component)__instance).transform.Find("GokuModel"); Quaternion rotation = val.rotation; float y = ((Quaternion)(ref rotation)).eulerAngles.y; rotation = val.rotation; val.rotation = Quaternion.Euler(-90f, y, ((Quaternion)(ref rotation)).eulerAngles.z); if (GokuBrackenBase.UseDeathSound.Value) { Object.Destroy((Object)(object)Object.Instantiate<GameObject>(Assets.SoundContainer, val), 40f); } } } [HarmonyPatch] internal class RoundManagementPatches { private static Transform CardObject { get; set; } [HarmonyPatch(typeof(RoundManager), "GenerateNewLevelClientRpc")] [HarmonyPostfix] public static void GameStart(RoundManager __instance, int randomSeed, int levelID) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) if (levelID == 0) { if ((Object)(object)CardObject == (Object)null) { CardObject = Object.Instantiate<GameObject>(Assets.CardsPrefab).transform; } CardObject.position = new Vector3(-37f, 0.94f, -40.84f); CardObject.rotation = Quaternion.Euler(new Vector3(0f, 196f, 0f)); CardObject.localScale = new Vector3(0.15f, 0.15f, 0.15f); } } [HarmonyPatch(typeof(StartOfRound), "EndOfGame")] [HarmonyPostfix] public static void GameEnd(StartOfRound __instance) { if ((Object)(object)CardObject != (Object)null) { Object.Destroy((Object)(object)((Component)CardObject).gameObject); } } } [HarmonyPatch] internal class TerminalPatches { [HarmonyPatch(typeof(Terminal), "Awake")] [HarmonyPostfix] public static void EditTerminal(Terminal __instance) { __instance.enemyFiles[1].creatureName = "Son Goku"; __instance.enemyFiles[1].displayText = "Hey, you!\nI think it's about time I got a chance to fight.\n"; __instance.enemyFiles[1].displayVideo = Assets.GokuLog; __instance.terminalNodes.allKeywords[36].word = "son goku"; } } } namespace GokuBracken.AssetManagement { public static class Assets { public static AssetBundle AssetBundle { get; private set; } public static GameObject GokuPrefab { get; private set; } public static GameObject GokuEyesPrefab { get; private set; } public static GameObject SoundContainer { get; private set; } public static AudioClip GokuVoiceline { get; private set; } public static AudioClip UltraInstinctTheme { get; private set; } public static VideoClip GokuLog { get; private set; } public static GameObject CardsPrefab { get; private set; } private static string GetAssemblyName() { return Assembly.GetExecutingAssembly().FullName.Split(new char[1] { ',' })[0]; } public static void PopulateAssets() { if ((Object)(object)AssetBundle != (Object)null) { GokuBrackenBase.LogWarning("Attempted to load the asset bundle but the bundle was not null!"); return; } string name = GetAssemblyName() + ".AssetManagement.gokubracken"; using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name)) { AssetBundle = AssetBundle.LoadFromStream(stream); } GokuPrefab = AssetBundle.LoadAsset<GameObject>("Assets/Prefabs/goku.prefab"); GokuEyesPrefab = AssetBundle.LoadAsset<GameObject>("Assets/Prefabs/gokuEyes.prefab"); SoundContainer = AssetBundle.LoadAsset<GameObject>("Assets/Prefabs/soundContainer.prefab"); GokuVoiceline = AssetBundle.LoadAsset<AudioClip>("Assets/SFX/heyitsme.mp3"); UltraInstinctTheme = AssetBundle.LoadAsset<AudioClip>("Assets/SFX/UI.mp3"); GokuLog = AssetBundle.LoadAsset<VideoClip>("Assets/Videos/gokuLog.mp4"); CardsPrefab = AssetBundle.LoadAsset<GameObject>("Assets/Prefabs/cards.prefab"); } } }