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 HandsomeMasked v1.0.0
HandsomeMasked/HandsomeMasked.dll
Decompiled an hour 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 BepInEx.Logging; using HarmonyLib; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; 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: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("HandsomeMasked")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("BANDIT")] [assembly: AssemblyFileVersion("0.0.1.0")] [assembly: AssemblyInformationalVersion("0.0.1+99d7cce525cfaf85884f647c9c55a9a383ee0c0e")] [assembly: AssemblyProduct("HandsomeMasked")] [assembly: AssemblyTitle("HandsomeMasked")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.1.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 HandsomeMasked { internal static class DebugLog { private static ManualLogSource _logger; internal static void Init(ManualLogSource logger) { _logger = logger; } internal static void Log(object data) { _logger.LogInfo(data); } } [BepInPlugin("RigsInRags.HandsomeMasked", "HandsomeMasked", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class HandsomeMasked : BaseUnityPlugin { public const string P_GUID = "RigsInRags.HandsomeMasked"; public const string P_Author = "RigsInRags"; public const string P_Name = "HandsomeMasked"; public const string P_Version = "1.0.0"; public static AssetBundle MainAssets; private static List<AudioClip> roamVoicelines = new List<AudioClip>(); private static List<AudioClip> followVoicelines = new List<AudioClip>(); private static List<AudioClip> chaseVoicelines = new List<AudioClip>(); private static List<AudioClip> executeVoicelines = new List<AudioClip>(); private static AudioClip silence; private static FieldInfo _isRunning; private static FieldInfo _isInKillAnimation; public static ConfigEntry<bool> randomiseAllVoicelines { get; set; } public static ConfigEntry<bool> enableMaskScrapAudio { get; set; } public static ConfigEntry<bool> enableMaskedEntityAudio { get; set; } public static ConfigEntry<bool> enableMaskScrapAudioInShip { get; set; } public static ConfigEntry<bool> enableMaskedEntities { get; set; } public static ConfigEntry<bool> enableMaskScrap { get; set; } public void Awake() { //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Expected O, but got Unknown //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Expected O, but got Unknown //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Expected O, but got Unknown DebugLog.Init(((BaseUnityPlugin)this).Logger); using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("HandsomeMasked.HandsomeAssets")) { MainAssets = AssetBundle.LoadFromStream(stream); } randomiseAllVoicelines = ((BaseUnityPlugin)this).Config.Bind<bool>("Handsome Masked Config", "randomiseAllVoicelines", false, "Set to false to make voicelines play depending on the Masked entity's current AI state. Set to true to allow any voiceline to play at any time, for more randomised but less contextualised voicelines."); enableMaskedEntities = ((BaseUnityPlugin)this).Config.Bind<bool>("Handsome Masked Config", "enableMaskedEntities", true, "Set to false to disable masked entities from being made Handsome."); enableMaskScrap = ((BaseUnityPlugin)this).Config.Bind<bool>("Handsome Masked Config", "enableMaskScrap", true, "Set to false to disable mask scrap items from being made Handsome."); enableMaskedEntityAudio = ((BaseUnityPlugin)this).Config.Bind<bool>("Handsome Masked Config", "enableMaskedEntityAudio", true, "Set to false to disable custom audio from masked entities."); enableMaskScrapAudio = ((BaseUnityPlugin)this).Config.Bind<bool>("Handsome Masked Config", "enableMaskScrapAudio", true, "Set to false to disable custom audio from mask scrap."); enableMaskScrapAudioInShip = ((BaseUnityPlugin)this).Config.Bind<bool>("Handsome Masked Config", "enableMaskScrapAudioInShip", true, "Set to false to disable mask scrap audio from playing while it is in the ship, if the sounds get too annoying."); if (LethalConfig.enabled) { LethalConfig.SetupLethalConfigOptions(); } Harmony val = new Harmony("RigsInRags.HandsomeMasked"); MethodInfo methodInfo = AccessTools.Method(typeof(StartOfRound), "Start", (Type[])null, (Type[])null); MethodInfo method = typeof(HandsomeMasked).GetMethod("OnStartOfRoundStart", BindingFlags.Static | BindingFlags.Public); val.Patch((MethodBase)methodInfo, new HarmonyMethod(method), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); methodInfo = AccessTools.Method(typeof(RandomPeriodicAudioPlayer), "PlayAudio", (Type[])null, (Type[])null); method = typeof(HandsomeMasked).GetMethod("OnAudioPlayerPlayAudio", BindingFlags.Static | BindingFlags.Public); val.Patch((MethodBase)methodInfo, new HarmonyMethod(method), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); methodInfo = AccessTools.Method(typeof(MaskedPlayerEnemy), "KillPlayerAnimationClientRpc", (Type[])null, (Type[])null); method = typeof(HandsomeMasked).GetMethod("OnMaskedKillPlayerAnimationStart", BindingFlags.Static | BindingFlags.Public); val.Patch((MethodBase)methodInfo, new HarmonyMethod(method), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); methodInfo = AccessTools.Method(typeof(HauntedMaskItem), "AttachToPlayerOnLocalClient", (Type[])null, (Type[])null); method = typeof(HandsomeMasked).GetMethod("OnMaskScrapKillPlayerAnimationStart", BindingFlags.Static | BindingFlags.Public); val.Patch((MethodBase)methodInfo, new HarmonyMethod(method), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); _isRunning = AccessTools.Field(typeof(MaskedPlayerEnemy), "running"); _isInKillAnimation = AccessTools.Field(typeof(MaskedPlayerEnemy), "inKillAnimation"); foreach (string item in from asset in MainAssets.GetAllAssetNames() where asset.EndsWith(".wav") select asset) { string text = item; if (text != null) { if (text.Contains("standard")) { followVoicelines.Add(MainAssets.LoadAsset<AudioClip>(item)); } else if (text.Contains("laugh")) { roamVoicelines.Add(MainAssets.LoadAsset<AudioClip>(item)); } else if (text.Contains("funny")) { chaseVoicelines.Add(MainAssets.LoadAsset<AudioClip>(item)); followVoicelines.Add(MainAssets.LoadAsset<AudioClip>(item)); } else if (text.Contains("insult")) { chaseVoicelines.Add(MainAssets.LoadAsset<AudioClip>(item)); } else if (text.Contains("executegloat")) { executeVoicelines.Add(MainAssets.LoadAsset<AudioClip>(item)); } } } silence = AudioClip.Create("SilentJack", 1, 1, 10000, false); silence.SetData(new float[1], 0); } public static void OnStartOfRoundStart(StartOfRound __instance) { Item[] array = (Item[])(object)new Item[0]; if (enableMaskScrap.Value) { array = __instance.allItemsList.itemsList.Where((Item i) => i.itemName == "Comedy" || i.itemName == "Tragedy").ToArray(); } Item[] array2 = array; foreach (Item obj in array2) { Transform child = obj.spawnPrefab.transform.GetChild(1); ((Component)child).GetComponent<MeshFilter>().sharedMesh = MainAssets.LoadAsset<Mesh>("JackMesh.fbx"); ((Renderer)((Component)child).GetComponent<MeshRenderer>()).sharedMaterial = MainAssets.LoadAsset<Material>("JackyMat.mat"); Transform child2 = child.GetChild(0); ((Component)child2).GetComponent<MeshFilter>().sharedMesh = MainAssets.LoadAsset<Mesh>("JackMesh.fbx"); ((Renderer)((Component)child2).GetComponent<MeshRenderer>()).sharedMaterial = MainAssets.LoadAsset<Material>("JackyMat.mat"); ((Component)child.GetChild(1)).GetComponent<MeshFilter>().sharedMesh = MainAssets.LoadAsset<Mesh>("JackEyes.fbx"); Transform transform = obj.spawnPrefab.GetComponent<HauntedMaskItem>().headMaskPrefab.transform; child = ((Component)transform).transform.GetChild(2); ((Component)child).GetComponent<MeshFilter>().sharedMesh = MainAssets.LoadAsset<Mesh>("JackMesh.fbx"); ((Renderer)((Component)child).GetComponent<MeshRenderer>()).sharedMaterial = MainAssets.LoadAsset<Material>("JackyMat.mat"); Transform child3 = ((Component)transform).transform.GetChild(0); ((Component)child3).GetComponent<MeshFilter>().sharedMesh = MainAssets.LoadAsset<Mesh>("JackMesh.fbx"); ((Renderer)((Component)child3).GetComponent<MeshRenderer>()).sharedMaterial = MainAssets.LoadAsset<Material>("JackyMat.mat"); Transform child4 = child.GetChild(0); ((Component)child4).GetComponent<MeshFilter>().sharedMesh = MainAssets.LoadAsset<Mesh>("JackEyes.fbx"); ((Renderer)((Component)child4).GetComponent<MeshRenderer>()).materials[0].SetInt("_CullMode", 0); obj.itemName = "Handsome Jack's Mask"; ((Component)obj.spawnPrefab.transform.GetChild(0)).GetComponent<ScanNodeProperties>().headerText = "Handsome Jack's Mask"; } if (enableMaskScrap.Value) { DebugLog.Log("The masks have been Handsome Jacked. See you soon, kiddo!"); } if (!enableMaskedEntities.Value) { return; } SelectableLevel[] levels = __instance.levels; foreach (SelectableLevel val in levels) { if (val == null) { continue; } foreach (SpawnableEnemyWithRarity enemy in val.Enemies) { if (enemy != null && enemy.enemyType.enemyName == "Masked") { GameObject[] maskTypes = enemy.enemyType.enemyPrefab.GetComponent<MaskedPlayerEnemy>().maskTypes; foreach (GameObject obj2 in maskTypes) { Transform child5 = obj2.transform.GetChild(2); ((Component)child5).GetComponent<MeshFilter>().sharedMesh = MainAssets.LoadAsset<Mesh>("JackMesh.fbx"); ((Renderer)((Component)child5).GetComponent<MeshRenderer>()).sharedMaterial = MainAssets.LoadAsset<Material>("JackyMat.mat"); Transform child6 = obj2.transform.GetChild(0); ((Component)child6).GetComponent<MeshFilter>().sharedMesh = MainAssets.LoadAsset<Mesh>("JackMesh.fbx"); ((Renderer)((Component)child6).GetComponent<MeshRenderer>()).sharedMaterial = MainAssets.LoadAsset<Material>("JackyMat.mat"); ((Component)child5.GetChild(0)).GetComponent<MeshFilter>().sharedMesh = MainAssets.LoadAsset<Mesh>("JackEyes.fbx"); } DebugLog.Log("The masked have been made Handsome!"); return; } } } } public static void OnAudioPlayerPlayAudio(RandomPeriodicAudioPlayer __instance, int clipIndex) { MaskedPlayerEnemy componentInParent = ((Component)__instance).GetComponentInParent<MaskedPlayerEnemy>(); if (componentInParent != null) { PlayEntityAudio(__instance, clipIndex, componentInParent); return; } HauntedMaskItem component = ((Component)__instance).GetComponent<HauntedMaskItem>(); if (component != null) { PlayScrapAudio(__instance, clipIndex, component); } } private static void PlayEntityAudio(RandomPeriodicAudioPlayer __instance, int clipIndex, MaskedPlayerEnemy masked) { if (!enableMaskedEntityAudio.Value) { return; } if (((EnemyAI)masked).isEnemyDead || randomiseAllVoicelines.Value) { __instance.randomClips[clipIndex] = PickRandomAudioClip(roamVoicelines, chaseVoicelines, followVoicelines); return; } switch (((EnemyAI)masked).currentBehaviourStateIndex) { case 0: __instance.randomClips[clipIndex] = roamVoicelines[Random.Range(0, roamVoicelines.Count)]; break; case 1: if ((bool)_isRunning.GetValue(masked)) { __instance.randomClips[clipIndex] = chaseVoicelines[Random.Range(0, chaseVoicelines.Count)]; } else { __instance.randomClips[clipIndex] = followVoicelines[Random.Range(0, followVoicelines.Count)]; } break; } } private static void PlayScrapAudio(RandomPeriodicAudioPlayer __instance, int clipIndex, HauntedMaskItem item) { if (!enableMaskScrapAudioInShip.Value && ((GrabbableObject)item).isInShipRoom) { __instance.randomClips[clipIndex] = silence; } else if (enableMaskScrapAudio.Value) { __instance.randomClips[clipIndex] = PickRandomAudioClip(roamVoicelines, chaseVoicelines, followVoicelines); } } public static void OnMaskScrapKillPlayerAnimationStart(HauntedMaskItem __instance) { if (enableMaskScrapAudio.Value) { __instance.maskAttachAudio = executeVoicelines[Random.Range(0, executeVoicelines.Count)]; __instance.maskAttachAudioLocal = executeVoicelines[Random.Range(0, executeVoicelines.Count)]; } } public static void OnMaskedKillPlayerAnimationStart(MaskedPlayerEnemy __instance, int playerObjectId) { if (enableMaskedEntityAudio.Value) { ((EnemyAI)__instance).enemyType.audioClips[0] = executeVoicelines[Random.Range(0, executeVoicelines.Count)]; } } private static AudioClip PickRandomAudioClip(List<AudioClip> first, List<AudioClip> second, List<AudioClip> third) { int num = Random.Range(0, first.Count + second.Count + third.Count); if (num < first.Count) { return first[num]; } num -= first.Count; if (num < second.Count) { return second[num]; } num -= second.Count; return third[num]; } } internal class LethalConfig { public static bool enabled => Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig"); public static void SetupLethalConfigOptions() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown LethalConfigManager.SetModIcon(HandsomeMasked.MainAssets.LoadAsset<Sprite>("logo.png")); LethalConfigManager.SetModDescription("Turns the Masked (entities and scrap) into Handsome Jack!"); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(HandsomeMasked.randomiseAllVoicelines, new BoolCheckBoxOptions { Section = "Audio Toggles", Name = "Randomise Voice Lines", RequiresRestart = false })); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(HandsomeMasked.enableMaskedEntities, new BoolCheckBoxOptions { Section = "Visual Toggles", Name = "Mask Swap for Masked Entities", RequiresRestart = true })); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(HandsomeMasked.enableMaskScrap, new BoolCheckBoxOptions { Section = "Visual Toggles", Name = "Mask Swap for Mask Scrap", RequiresRestart = true })); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(HandsomeMasked.enableMaskedEntityAudio, new BoolCheckBoxOptions { Section = "Audio Toggles", Name = "Custom Audio for Masked Entities", RequiresRestart = true })); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(HandsomeMasked.enableMaskScrapAudio, new BoolCheckBoxOptions { Section = "Audio Toggles", Name = "Custom Audio for Mask Scrap", RequiresRestart = true })); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(HandsomeMasked.enableMaskScrapAudioInShip, new BoolCheckBoxOptions { Section = "Audio Toggles", Name = "Mask Scrap Audio While in Ship", RequiresRestart = true })); } } public static class PluginInfo { public const string PLUGIN_GUID = "HandsomeMasked"; public const string PLUGIN_NAME = "HandsomeMasked"; public const string PLUGIN_VERSION = "0.0.1"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }