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 WheatleyCrab v1.0.2
Wheatley Crab.dll
Decompiled 5 months agousing System; using System.Collections.Generic; 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 BepInEx.Bootstrap; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.WwiseUtils; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Wheatley Crab")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+07cc3ec149b908f12d6c1daf5ad7e27e822737ee")] [assembly: AssemblyProduct("Wheatley Crab")] [assembly: AssemblyTitle("Wheatley Crab")] [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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 Wheatley_Crab { [HarmonyPatch] [BepInPlugin("brutalyoshi.wheatleycrab", "Wheatley Crab", "1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class WheatleyCrabPlugin : BaseUnityPlugin { private AssetBundle bundle; public static ConfigEntry<float> amplitude; public static ConfigEntry<float> speed; public static ConfigEntry<float> lower; public static ConfigEntry<float> upper; public static ConfigEntry<float> crabVolume; private static bool soundBankQueued; private static string pluginPath; public static CharacterBody worker; public static bool IsEnabledROO => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); public void Awake() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown pluginPath = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location) ?? throw new InvalidOperationException("Failed to find path of plugin."); string text = Path.Join((ReadOnlySpan<char>)pluginPath, (ReadOnlySpan<char>)"wheatleycrap"); ((AsyncOperation)AssetBundle.LoadFromFileAsync(text)).completed += delegate(AsyncOperation operation) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) bundle = ((AssetBundleCreateRequest)operation).assetBundle; }; Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); val.PatchAll(); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(Loaded)); amplitude = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Wobble Distance", 0.32f, "Maximum sway for Wheatley"); speed = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Wobble Speed", 12f, "Wobble Speed"); lower = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Huh Min time", 1f, "Minimum time in seconds for Wheatley to say \"huh\""); upper = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Huh Max time", 2f, "Maximum time in seconds for Wheatley to say \"huh\""); crabVolume = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Crab Volume", 50f, "Loudness of Crab."); crabVolume.SettingChanged += delegate { //IL_000f: Unknown result type (might be due to invalid IL or missing references) AkSoundEngine.SetRTPCValue("Crab_Volume", crabVolume.Value); }; if (IsEnabledROO) { InitRoo(); } } public void InitRoo() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0067: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new SliderOption(amplitude, new SliderConfig { min = 0.1f, max = 2f, formatString = "{0:F2}" })); ModSettingsManager.AddOption((BaseOption)new SliderOption(speed, new SliderConfig { min = 0.1f, max = 20f, formatString = "{0:F2}" })); ModSettingsManager.AddOption((BaseOption)new SliderOption(lower, new SliderConfig { min = 0.1f, max = 5f, formatString = "{0:F2}" })); ModSettingsManager.AddOption((BaseOption)new SliderOption(upper, new SliderConfig { min = 0.1f, max = 5f, formatString = "{0:F2}" })); ModSettingsManager.AddOption((BaseOption)new SliderOption(crabVolume, new SliderConfig { min = 0f, max = 100f, formatString = "{0:F2}" })); } private void Loaded() { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) Language.english.SetStringByToken("WHEATLEY_CRAB_NAME", "WHEATLEY Crab"); Language.english.SetStringByToken("WHEATLEY_CRAB_SUBTITLE", "heh"); worker = BodyPrefabs.WorkerUnitBody; Transform val = ((Component)worker).gameObject.transform.Find("ModelBase/mdlWorkerUnit"); Object.DestroyImmediate((Object)(object)((Component)val.Find("meshWorkerUnit")).gameObject); GameObject val2 = bundle.LoadAsset<GameObject>("WheatleyCrabheh"); val2.transform.SetParent(val); val2.transform.localScale = new Vector3(80f, 80f, 80f); val2.transform.localPosition = Vector3.zero; ((Component)val).gameObject.AddComponent<CrabMovement>(); ((Component)worker).gameObject.AddComponent<CrabNoises>(); worker.baseNameToken = "WHEATLEY_CRAB_NAME"; worker.subtitleNameToken = "WHEATLEY_CRAB_SUBTITLE"; worker.portraitIcon = (Texture)(object)bundle.LoadAsset<Sprite>("texWorkerUnitIcon").texture; AkSoundEngine.SetRTPCValue("Crab_Volume", crabVolume.Value); } [HarmonyPrefix] [HarmonyPatch(typeof(SoundbankLoader), "Start")] public static void AddSoundbankToLoader(SoundbankLoader __instance) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (!soundBankQueued) { AkSoundEngine.AddBasePath(pluginPath); __instance.soundbankStrings = CollectionExtensions.AddItem<string>((IEnumerable<string>)__instance.soundbankStrings, "Wheat.bnk").ToArray(); soundBankQueued = true; } } } public class CrabMovement : MonoBehaviour { private Transform crab; public void Awake() { crab = ((Component)this).transform.Find("WheatleyCrabheh"); } public void Update() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) crab.localPosition = new Vector3(Mathf.Sin(Time.time * WheatleyCrabPlugin.speed.Value) * WheatleyCrabPlugin.amplitude.Value, 0f, 0f); } } public class CrabNoises : MonoBehaviour { public float nextHuh; public void Awake() { ((Component)this).GetComponent<SfxLocator>().deathSound = "crabsound"; } public void FixedUpdate() { if (nextHuh > 0f) { nextHuh -= Time.fixedDeltaTime; return; } nextHuh = Random.Range(WheatleyCrabPlugin.lower.Value, WheatleyCrabPlugin.upper.Value); Util.PlaySound("Crabrandom", ((Component)this).gameObject); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }