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 FierceDeity3DModel v0.1.0
FierceDeityOne.dll
Decompiled a day 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.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; 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: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("FierceDeityOne")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("FierceDeityOne")] [assembly: AssemblyTitle("FierceDeityOne")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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; } } } namespace ModelReplacement { internal static class FierceSettings { internal static readonly ManualLogSource Log; private static readonly ConfigEntry<bool> enableDeathSound; private static readonly ConfigEntry<float> deathVolume; private static readonly ConfigEntry<bool> enableActionSounds; private static readonly ConfigEntry<float> actionVolume; internal static bool DeathSoundEnabled => enableDeathSound.Value; internal static float DeathVolume => deathVolume.Value; internal static bool ActionSoundsEnabled => enableActionSounds.Value; internal static float ActionVolume => actionVolume.Value; static FierceSettings() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown Log = Logger.CreateLogSource("FierceDeity"); ConfigFile val = new ConfigFile(Path.Combine(Paths.ConfigPath, "FierceDeity.Settings.cfg"), true); enableDeathSound = val.Bind<bool>("Fierce Deity", "Enable death sound", true, "Turns the death scream on/off."); deathVolume = val.Bind<float>("Fierce Deity", "Death sound volume", 1f, new ConfigDescription("Volume of the death scream (0 to 1).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); enableActionSounds = val.Bind<bool>("Fierce Deity", "Enable action sounds", true, "Turns the sounds for picking up an item, dropping an item and getting hit on/off."); actionVolume = val.Bind<float>("Fierce Deity", "Action sounds volume", 1f, new ConfigDescription("Volume of the pickup/drop/hit sounds (0 to 1).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); } } public class MRFIERCEDEITY : BodyReplacementBase { protected override GameObject LoadAssetsAndReturnModel() { string text = "FierceDeity"; GameObject val = Assets.MainAssetBundle.LoadAsset<GameObject>(text); if ((Object)(object)val != (Object)null && (FierceSettings.DeathSoundEnabled || FierceSettings.ActionSoundsEnabled) && (Object)(object)val.GetComponent<FierceVoiceController>() == (Object)null) { val.AddComponent<FierceVoiceController>(); } FierceVoiceController fierceVoiceController = (((Object)(object)val != (Object)null) ? val.GetComponent<FierceVoiceController>() : null); PlayerControllerB component = ((Component)this).GetComponent<PlayerControllerB>(); if ((Object)(object)fierceVoiceController != (Object)null && (Object)(object)component != (Object)null) { fierceVoiceController.OwnerIndex = (int)component.playerClientId; } return val; } protected override void OnEmoteStart(int emoteId) { GetController(base.replacementModel); } protected override void OnEmoteEnd() { GetController(base.replacementModel); } protected override void OnDeath() { if (!((Object)(object)base.replacementDeadBody == (Object)null)) { FierceVoiceController fierceVoiceController = GetController(base.replacementDeadBody); if ((Object)(object)fierceVoiceController == (Object)null) { fierceVoiceController = base.replacementDeadBody.AddComponent<FierceVoiceController>(); } fierceVoiceController.SetDead(); } } private FierceVoiceController GetController(GameObject obj) { if ((Object)(object)obj == (Object)null) { return null; } FierceVoiceController componentInChildren = obj.GetComponentInChildren<FierceVoiceController>(true); if ((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren.Player == (Object)null) { componentInChildren.Player = ((Component)this).GetComponent<PlayerControllerB>(); } return componentInChildren; } } public class FierceVoiceController : MonoBehaviour { private const string DeathClipName = "FD_Link_Death"; private const string PickupClipName = "FD_Link_Pickup"; private const string DropClipName = "FD_Link_Drop"; private const string HitClipName = "FD_Link_Hit"; public PlayerControllerB Player; public int OwnerIndex = -1; private float nextResolveTime; private bool playerWarned; private AudioSource actionSource; private bool isDead; private bool deathSoundPlayed; private int lastHealth = -1; private int lastItemCount = -1; private float lastHitTime; private static readonly Dictionary<string, AudioClip> clipCache = new Dictionary<string, AudioClip>(); private void Start() { ResolvePlayer(); } private void Update() { if (!isDead) { if ((Object)(object)Player == (Object)null && Time.time >= nextResolveTime) { nextResolveTime = Time.time + 1f; ResolvePlayer(); } if (!((Object)(object)Player == (Object)null)) { PollActions(); } } } public void SetDead() { isDead = true; PlayDeathSound(); } private void ResolvePlayer() { if ((Object)(object)Player != (Object)null) { return; } Player = ((Component)this).GetComponentInParent<PlayerControllerB>(true); if ((Object)(object)Player == (Object)null && OwnerIndex >= 0) { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance != (Object)null && instance.allPlayerScripts != null && OwnerIndex < instance.allPlayerScripts.Length) { Player = instance.allPlayerScripts[OwnerIndex]; } } if ((Object)(object)Player != (Object)null) { FierceSettings.Log.LogInfo((object)("Owner player found (index " + Player.playerClientId + ").")); } else if (!playerWarned) { playerWarned = true; FierceSettings.Log.LogWarning((object)"Could not find the owner player yet; will keep trying."); } } private void PlayDeathSound() { if (!deathSoundPlayed && FierceSettings.DeathSoundEnabled) { deathSoundPlayed = true; AudioClip clip = GetClip("FD_Link_Death", warn: true); if (!((Object)(object)clip == (Object)null)) { AudioSource val = ((Component)this).gameObject.AddComponent<AudioSource>(); val.clip = clip; val.volume = FierceSettings.DeathVolume; val.spatialBlend = 1f; val.rolloffMode = (AudioRolloffMode)1; val.minDistance = 4f; val.maxDistance = 45f; val.playOnAwake = false; val.Play(); Object.Destroy((Object)(object)val, clip.length + 0.5f); } } } private static AudioClip GetClip(string name, bool warn) { if (clipCache.TryGetValue(name, out AudioClip value)) { return value; } AudioClip val = Assets.MainAssetBundle.LoadAsset<AudioClip>(name); if ((Object)(object)val == (Object)null && warn) { FierceSettings.Log.LogWarning((object)("AudioClip '" + name + "' was not found in the AssetBundle.")); } clipCache[name] = val; return val; } private void PlayAction(string baseName, int expected = 1) { AudioClip[] array = (AudioClip[])(object)new AudioClip[3]; int num = 0; AudioClip clip = GetClip(baseName, warn: true); if ((Object)(object)clip != (Object)null) { array[num++] = clip; } clip = GetClip(baseName + "2", expected >= 2); if ((Object)(object)clip != (Object)null) { array[num++] = clip; } clip = GetClip(baseName + "3", expected >= 3); if ((Object)(object)clip != (Object)null) { array[num++] = clip; } if (num != 0) { if ((Object)(object)actionSource == (Object)null) { actionSource = ((Component)this).gameObject.AddComponent<AudioSource>(); actionSource.playOnAwake = false; actionSource.spatialBlend = 1f; actionSource.rolloffMode = (AudioRolloffMode)1; actionSource.minDistance = 4f; actionSource.maxDistance = 45f; } actionSource.PlayOneShot(array[Random.Range(0, num)], FierceSettings.ActionVolume); } } private void PollActions() { if (!FierceSettings.ActionSoundsEnabled || Player.isPlayerDead) { return; } int health = Player.health; if (lastHealth >= 0 && health < lastHealth && health > 0 && Time.time - lastHitTime > 0.4f) { lastHitTime = Time.time; PlayAction("FD_Link_Hit", 3); } lastHealth = health; int num = CountItems(); if (lastItemCount >= 0) { if (num > lastItemCount) { PlayAction("FD_Link_Pickup"); } else if (num < lastItemCount) { PlayAction("FD_Link_Drop"); } } lastItemCount = num; } private int CountItems() { GrabbableObject[] itemSlots = Player.ItemSlots; if (itemSlots == null) { return 0; } int num = 0; for (int i = 0; i < itemSlots.Length; i++) { if ((Object)(object)itemSlots[i] != (Object)null) { num++; } } return num; } } [BepInPlugin("FierceD", "FierceDeity3DModel", "0.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public static ConfigFile config; public static ConfigEntry<bool> enableModelForAllSuits { get; private set; } public static ConfigEntry<bool> enableModelAsDefault { get; private set; } public static ConfigEntry<string> suitNamesToEnableModel { get; private set; } private static void InitConfig() { enableModelForAllSuits = config.Bind<bool>("Suits to Replace Settings", "Enable Model for all Suits", false, "Enable to model replace every suit. Set to false to specify suits"); enableModelAsDefault = config.Bind<bool>("Suits to Replace Settings", "Enable Model as default", false, "Enable to model replace every suit that hasn't been otherwise registered."); suitNamesToEnableModel = config.Bind<string>("Suits to Replace Settings", "Suits to enable Model for", "FierceD", "Enter a comma separated list of suit names.(Additionally, [Green suit,Pajama suit,Hazard suit])"); } private void Awake() { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown config = ((BaseUnityPlugin)this).Config; InitConfig(); Assets.PopulateAssets(); if (enableModelForAllSuits.Value) { ModelReplacementAPI.RegisterModelReplacementOverride(typeof(MRFIERCEDEITY)); } if (enableModelAsDefault.Value) { ModelReplacementAPI.RegisterModelReplacementDefault(typeof(MRFIERCEDEITY)); } string[] array = suitNamesToEnableModel.Value.Split(','); string[] array2 = array; foreach (string text in array2) { ModelReplacementAPI.RegisterSuitModelReplacement("FierceDeity", typeof(MRFIERCEDEITY)); } Harmony val = new Harmony("FierceD"); val.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin FierceD is loaded!"); } } public static class Assets { public static string mainAssetBundleName = "fiercetransformbundle"; public static AssetBundle MainAssetBundle = null; private static string GetAssemblyName() { return Assembly.GetExecutingAssembly().GetName().Name.Replace(" ", "_"); } public static void PopulateAssets() { if ((Object)(object)MainAssetBundle == (Object)null) { Console.WriteLine(GetAssemblyName() + "." + mainAssetBundleName); using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetAssemblyName() + "." + mainAssetBundleName); MainAssetBundle = AssetBundle.LoadFromStream(stream); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }