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 FloweryBracken v1.0.0
FloweryBracken.dll
Decompiled 12 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; 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("FloweryBracken")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A mod for Lethal Company")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("FloweryBracken")] [assembly: AssemblyTitle("FloweryBracken")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 FloweryBracken { internal class Assets { public static AssetBundle AssetBundle { get; private set; } private static Dictionary<string, Object> AssetList { get; set; } private static string AssemblyName => Assembly.GetExecutingAssembly().FullName.Split(new char[1] { ',' })[0]; public static void PopulateAssets() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown if ((Object)AssetBundle != (Object)null) { Plugin.Logger.LogWarning((object)"Attempted to load the asset bundle but the bundle was not null!"); return; } AssetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Plugin.PluginDirectory), "flowery.bundle")); if ((Object)AssetBundle == (Object)null) { Plugin.Logger.LogError((object)("Asset bundle at " + AssemblyName + " failed to load!")); } AssetList = new Dictionary<string, Object>(); Object[] array = AssetBundle.LoadAllAssets(); foreach (Object val in array) { Plugin.Logger.LogInfo((object)("Loaded asset " + val.name)); AssetList.Add(val.name, val); } } public static T GetAsset<T>(string name) where T : Object { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown if (!AssetList.TryGetValue(name, out var value)) { Plugin.Logger.LogError((object)("Attempted to load asset of name " + name + " but no asset of that name exists!")); return default(T); } T val = (T)(object)((value is T) ? value : null); if ((Object)val == (Object)null) { Plugin.Logger.LogError((object)("Attempted to load an asset of type " + typeof(T).Name + " but asset of name " + name + " does not match this type!")); return default(T); } return val; } } public class FloweryController : MonoBehaviour { private FlowermanAI FlowermanAI { get; set; } private GameObject BaseFloweryObject { get; set; } private bool IsDead { get; set; } private void Start() { FlowermanAI = ((Component)this).GetComponent<FlowermanAI>(); int groupid = new Random(StartOfRound.Instance.randomMapSeed).Next(1, 3); HideFlowermanModel(); CreateFloweryModels(); ReplaceFlowermanSFX(groupid); } private void Update() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) Quaternion rotation = ((Component)StartOfRound.Instance.localPlayerController).transform.rotation; _ = ((Quaternion)(ref rotation)).eulerAngles; if (((EnemyAI)FlowermanAI).isEnemyDead && !IsDead) { KillFlowery(); } } private void HideFlowermanModel() { Renderer[] componentsInChildren = ((Component)((Component)FlowermanAI).transform.Find("FlowermanModel")).GetComponentsInChildren<Renderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = false; } } private void CreateFloweryModels() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) GameObject asset = Assets.GetAsset<GameObject>("flowery_-_deltarune"); BaseFloweryObject = Object.Instantiate<GameObject>(asset, ((Component)this).gameObject.transform); ((Object)BaseFloweryObject).name = "Base Flowery"; BaseFloweryObject.transform.localScale = new Vector3(1.8f, 1.8f, 1.8f); } private void ReplaceFlowermanSFX(int groupid) { FlowermanAI.creatureAngerVoice.clip = Assets.GetAsset<AudioClip>($"Angered{groupid}"); FlowermanAI.crackNeckSFX = Assets.GetAsset<AudioClip>($"Neck{groupid}"); FlowermanAI.crackNeckAudio.clip = Assets.GetAsset<AudioClip>($"Neck{groupid}"); ((EnemyAI)FlowermanAI).dieSFX = Assets.GetAsset<AudioClip>($"Death{groupid}"); ((EnemyAI)FlowermanAI).enemyType.stunSFX = Assets.GetAsset<AudioClip>($"Stunned{groupid}"); ((EnemyAI)FlowermanAI).enemyBehaviourStates[1].VoiceClip = Assets.GetAsset<AudioClip>($"Spotted{groupid}"); } private void KillFlowery() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) BaseFloweryObject.SetActive(true); Transform transform = BaseFloweryObject.transform; Quaternion rotation = BaseFloweryObject.transform.rotation; float y = ((Quaternion)(ref rotation)).eulerAngles.y; rotation = BaseFloweryObject.transform.rotation; transform.rotation = Quaternion.Euler(-90f, y, ((Quaternion)(ref rotation)).eulerAngles.z); IsDead = true; } } [BepInPlugin("FloweryBracken", "FloweryBracken", "1.0.0")] public class Plugin : BaseUnityPlugin { public static string PluginDirectory; public static AssetBundle Bundle; public static GameObject FloweryModel; private Harmony _harmony = new Harmony("FloweryBracken"); public static ManualLogSource Logger; private void Awake() { Logger = Logger.CreateLogSource("FloweryBracken"); Logger.LogInfo((object)"Plugin FloweryBracken is loading."); PluginDirectory = ((BaseUnityPlugin)this).Info.Location; Assets.PopulateAssets(); Logger.LogInfo((object)"Loaded FloweryBracken. Patching."); _harmony.PatchAll(typeof(Plugin)); _harmony.PatchAll(typeof(FloweryController)); } private void LoadAssets() { try { Bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(PluginDirectory), "flowery.bundle")); } catch (Exception ex) { Logger.LogError((object)("Couldn't load asset bundle: " + ex.Message)); return; } try { FloweryModel = Bundle.LoadAsset<GameObject>("flowery"); Logger.LogInfo((object)"Successfully loaded assets."); } catch (Exception ex2) { Logger.LogError((object)("Couldn't load assets: " + ex2.Message)); } } [HarmonyPatch(typeof(FlowermanAI), "Start")] [HarmonyPostfix] public static void OverrideModel(FlowermanAI __instance) { ((Component)__instance).gameObject.AddComponent<FloweryController>(); } } public static class PluginInfo { public const string PLUGIN_GUID = "FloweryBracken"; public const string PLUGIN_NAME = "FloweryBracken"; public const string PLUGIN_VERSION = "1.0.0"; } }