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 JollyLethal v1.2.2
mishelin.JollyLethal.dll
Decompiled 2 days agousing System; using System.Collections; 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.Logging; using HarmonyLib; using JollyLethal.HatActions; using JollyLethal.HatConfigs; using JollyLethal.Helper; using LobbyCompatibility.Attributes; 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("mishelin.JollyLethal")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.2.2.0")] [assembly: AssemblyInformationalVersion("1.2.2+37702a3150ee1bb81c38efe2259fb1893dc0db2c")] [assembly: AssemblyProduct("JollyLethal")] [assembly: AssemblyTitle("mishelin.JollyLethal")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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; } } [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 JollyLethal { [BepInPlugin("mishelin.JollyLethal", "JollyLethal", "1.2.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] [LobbyCompatibility(/*Could not decode attribute arguments.*/)] public class JollyLethal : BaseUnityPlugin { internal static AssetBundle? myCustomAssets; internal static GameObject mySantaHat; internal const string myJollyHatSpawnedObjName = "mishelin.JollyLethal.JollyHatParent"; public static JollyLethal Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Harmony? Harmony { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Instance = this; LoadAssets(); Patch(); Logger.LogInfo((object)"mishelin.JollyLethal v1.2.2 has loaded!"); } internal void LoadAssets() { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); myCustomAssets = AssetLoader.AssetsAwake(directoryName); if (myCustomAssets != null) { mySantaHat = AssetLoader.LoadSantaHat(myCustomAssets); } } internal static void Patch() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("mishelin.JollyLethal"); } Logger.LogDebug((object)"Patching..."); Harmony.PatchAll(); Logger.LogDebug((object)"Finished patching!"); } internal static void Unpatch() { Logger.LogDebug((object)"Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } Logger.LogDebug((object)"Finished unpatching!"); } internal static void PluginLogInfoWithPrefix(string content) { Logger.LogInfo((object)("[EVIL] " + content)); } internal static void PluginLogErrorWithPrefix(string content) { Logger.LogError((object)("[EVIL] " + content)); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "mishelin.JollyLethal"; public const string PLUGIN_NAME = "JollyLethal"; public const string PLUGIN_VERSION = "1.2.2"; } } namespace JollyLethal.Helper { internal static class AssetLoader { private const string ASSET_BUNDLE_NAME = "lethal-mod-asset"; public static AssetBundle? AssetsAwake(string assemblyPath) { if (string.IsNullOrEmpty(assemblyPath)) { JollyLethal.PluginLogErrorWithPrefix("Invalid assebmly path!!!"); return null; } AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(assemblyPath, "lethal-mod-asset")); if (val == null) { JollyLethal.PluginLogErrorWithPrefix("Failed to load custom assets !!!"); return null; } JollyLethal.PluginLogInfoWithPrefix("Successfully loaded custom assets."); return val; } public static GameObject LoadSantaHat(AssetBundle customAssets) { GameObject result = customAssets.LoadAsset<GameObject>("assets/hatparent.prefab"); JollyLethal.PluginLogInfoWithPrefix("Successfully loaded in santa hat"); return result; } } } namespace JollyLethal.HatFixes { [HarmonyPatch(typeof(EnemyAI))] internal class FixHatPositionOnEnemyStateChange { [HarmonyPatch("SwitchToBehaviourStateOnLocalClient")] [HarmonyPostfix] private static void FixEnemyHatPosition(EnemyAI __instance, int stateIndex) { Transform val = RecursiveFindChild(((Component)__instance).transform, "mishelin.JollyLethal.JollyHatParent"); if (val == null) { return; } string enemyName = __instance.enemyType.enemyName; if (!(enemyName == "Jester")) { if (enemyName == "Maneater") { ((MonoBehaviour)__instance).StartCoroutine(HandleManeaterStateChange(((Component)__instance).transform, val, stateIndex)); } } else { HandleJesterStateChange(((Component)__instance).transform, val, stateIndex); } } private static void HandleJesterStateChange(Transform enemy, Transform hat, int state) { //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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0038: 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_005f: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) JollyLethal.PluginLogInfoWithPrefix("Handling Jesters change of state"); switch (state) { case 0: case 1: { JollyLethal.PluginLogInfoWithPrefix("Changing hat position due to change of jester state to winding/chilling"); (string?, Vector3, Vector3, float) jesterSantaHatConfig = EnemyHatConfigs.GetJesterSantaHatConfig(); Vector3 item = jesterSantaHatConfig.Item2; Vector3 item2 = jesterSantaHatConfig.Item3; float item3 = jesterSantaHatConfig.Item4; JollyHatActions.ApplyOffsetsToHat(hat, item, item2, item3); break; } case 2: JollyLethal.PluginLogInfoWithPrefix("Changing hat position due to change of jester state to popped"); var (pathToNewObj, pos, rot, scale) = EnemyHatConfigs.GetJesterPoppedSantaHatConfig(); JollyHatActions.HatChangeParent(enemy, hat, pathToNewObj); JollyHatActions.ApplyOffsetsToHat(hat, pos, rot, scale); break; } } private static IEnumerator HandleManeaterStateChange(Transform enemy, Transform hat, int state) { yield return (object)new WaitForSeconds(2.5f); JollyLethal.PluginLogInfoWithPrefix("Handling Maneaters change of state"); if (state != 2 && IsManeaterInBabyState(enemy)) { JollyLethal.PluginLogInfoWithPrefix("Changing hat position due to change of maneater appearance to smol"); var (pathToNewObj, pos, rot, scale) = EnemyHatConfigs.GetManeaterSantaHatConfig(); JollyHatActions.HatChangeParent(enemy, hat, pathToNewObj); JollyHatActions.ApplyOffsetsToHat(hat, pos, rot, scale); } else { JollyLethal.PluginLogInfoWithPrefix("Changing hat position due to change of maneater appearance to big"); var (pathToNewObj2, pos2, rot2, scale2) = EnemyHatConfigs.GetManeaterBigSantaHatConfig(); JollyHatActions.HatChangeParent(enemy, hat, pathToNewObj2); JollyHatActions.ApplyOffsetsToHat(hat, pos2, rot2, scale2); } } internal static bool IsManeaterInBabyState(Transform maneater) { if (((Component)maneater.Find("BabyMeshContainer")).gameObject.activeSelf) { return !((Component)maneater.Find("MeshContainer")).gameObject.activeSelf; } return false; } internal static Transform? RecursiveFindChild(Transform parent, string childName) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown foreach (Transform item in parent) { Transform val = item; if (((Object)val).name == childName) { return val; } Transform val2 = RecursiveFindChild(val, childName); if (val2 != null) { return val2; } } return null; } } [HarmonyPatch(typeof(RoundManager))] internal class PutHatOnDormantOldBird { [HarmonyPatch("SpawnNestObjectForOutsideEnemy")] [HarmonyPostfix] private static void AddHatToDormantOldBird(RoundManager __instance) { foreach (EnemyAINestSpawnObject enemyNestSpawnObject in __instance.enemyNestSpawnObjects) { string enemyName = enemyNestSpawnObject.enemyType.enemyName; JollyLethal.PluginLogInfoWithPrefix("NestSpawn: " + enemyName); if (enemyName == "RadMech") { PlaceHatOnDormantOldBird(enemyNestSpawnObject); } } } private static void PlaceHatOnDormantOldBird(EnemyAINestSpawnObject enemy) { JollyLethal.PluginLogInfoWithPrefix("Dormant birdo"); PlaceHatsOnEnemiesPatch.PlaceHatOnEnemyTransform(((Component)enemy).transform, enemy.enemyType); } } } namespace JollyLethal.HatConfigs { internal class EnemyHatConfigs { internal static (string?, Vector3, Vector3, float) GetBrackenSantaHatConfig() { //IL_0014: 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) return ("FlowermanModel/AnimContainer/metarig/Torso1/Torso2/Torso3/Neck1/Neck2/Head1/Head2", new Vector3(0f, 0f, 0f), new Vector3(0f, 115f, 0f), 2f); } internal static (string?, Vector3, Vector3, float) GetHoardingBugSantaHatConfig() { //IL_0014: 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) return ("HoarderBugModel/AnimContainer/Armature/Abdomen/Chest/Head", new Vector3(0.25f, 2.2f, 0.1f), new Vector3(15f, 20f, 330f), 3f); } internal static (string?, Vector3, Vector3, float) GetSnareFleaSantaHatConfig() { //IL_0014: 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) return ("CentipedeModel/AnimContainer/Armature/Head", new Vector3(0f, 0.4f, 0.25f), new Vector3(0f, 90f, 90f), 1.5f); } internal static (string?, Vector3, Vector3, float) GetThumperSantaHatConfig() { //IL_0014: 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) return ("CrawlerModel/AnimContainer/metarig/spine/spine.003/spine.004", new Vector3(0f, 0.2635f, -0.02f), new Vector3(64f, 168f, 341f), 0.3f); } internal static (string?, Vector3, Vector3, float) GetBunkerSpiderSantaHatConfig() { //IL_0014: 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) return ("MeshContainer/AnimContainer/Armature/Head", new Vector3(0f, 0.9101f, 0.5545f), new Vector3(19f, 274f, 252f), 1.7525f); } internal static (string?, Vector3, Vector3, float) GetJesterSantaHatConfig() { //IL_0014: 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) return ("MeshContainer/AnimContainer/metarig/BoxContainer/spine.004/spine.005", new Vector3(-2.32f, -8.6f, 2.75f), new Vector3(344f, 292f, 181f), 18f); } internal static (string?, Vector3, Vector3, float) GetJesterPoppedSantaHatConfig() { //IL_0014: 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) return ("MeshContainer/AnimContainer/metarig/BoxContainer/spine.004/spine.005/spine.006/UpperJaw", new Vector3(0f, 0.1f, 1.2f), new Vector3(0f, 115f, 0f), 3f); } internal static (string?, Vector3, Vector3, float) GetNutcrackerSantaHatConfig() { //IL_0014: 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) return ("MeshContainer/AnimContainer/metarig/spinecontainer/spine/spine.001/head", new Vector3(0f, 0.5f, 0f), new Vector3(0f, 115f, 0f), 0.668f); } internal static (string?, Vector3, Vector3, float) GetSpringSantaHatConfig() { //IL_0014: 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) return ("SpringManModel/AnimContainer/metarig/spine/spine.001/spine.002/spine.003/springBone/springBone.001/springBone.002", new Vector3(0f, 0.3f, 0f), new Vector3(0f, 115f, 0f), 0.25f); } internal static (string?, Vector3, Vector3, float) GetMaskedSantaHatConfig() { //IL_0014: 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) return ("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/spine.004", new Vector3(0f, 0.27f, 0.05f), new Vector3(0f, 115f, 0f), 0.55f); } internal static (string?, Vector3, Vector3, float) GetButlerSantaHatConfig() { //IL_0014: 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) return ("MeshContainer/metarig/spine/spine.001/NeckContainer/spine.004/face", new Vector3(0f, 0.3f, 0f), new Vector3(0f, 115f, 0f), 0.8f); } internal static (string?, Vector3, Vector3, float) GetManeaterSantaHatConfig() { //IL_0014: 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) return ("BabyMeshContainer/BabyAnimContainer/Spine1/Spine3", new Vector3(-0.0067f, 0.4368f, 0.0076f), new Vector3(302f, 358f, 1f), 2f); } internal static (string?, Vector3, Vector3, float) GetManeaterBigSantaHatConfig() { //IL_0014: 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) return ("MeshContainer/AnimContainer/Spine/Spine1/Spine2/Bone.003", new Vector3(0f, 0f, -0.5f), new Vector3(280f, 180f, 180f), 3f); } internal static (string?, Vector3, Vector3, float) GetSporeLizardSantaHatConfig() { //IL_0014: 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) return ("PufferModel/AnimContainer/Armature/Base/Chest/Neck", new Vector3(0.5f, 0.5f, 0f), new Vector3(30f, 10f, 290f), 1f); } internal static (string?, Vector3, Vector3, float) GetMouthDogSantaHatConfig() { //IL_0014: 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) return ("MouthDogModel/AnimContainer/Armature/Neck1Container/Neck1/Neck2/JawUpper/", new Vector3(0f, 0.233f, -0.5545f), new Vector3(20f, 80f, 240f), 2.5f); } internal static (string?, Vector3, Vector3, float) GetBaboonHawkSantaHatConfig() { //IL_0014: 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) return ("BaboonBirdModel/AnimContainer/metarig/spine/spine.001/spine.003/spine.004/HeadBoneContainer", new Vector3(0f, 0.3f, 0.25f), new Vector3(0f, 90f, 0f), 0.7f); } internal static (string?, Vector3, Vector3, float) GetForestGiantSantaHatConfig() { //IL_0014: 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) return ("FGiantModelContainer/AnimContainer/metarig/spine/spine.003", new Vector3(0f, 0.5f, 0.05f), new Vector3(0f, 115f, 0f), 0.6f); } internal static (string?, Vector3, Vector3, float) GetOldBirdSantaHatConfig() { //IL_0014: 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) return ("MeshContainer/AnimContainer/metarig/TorsoContainer/Torso", new Vector3(0f, 4.4f, 0f), new Vector3(0f, 25f, 0f), 2.5f); } internal static (string?, Vector3, Vector3, float) GetTulipSnakeSantaHatConfig() { //IL_0014: 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) return ("FlowerLizardModel/AnimContainer/Armature/Belly/LowerChest/Chest/Chest.001/JawUpper/", new Vector3(0f, 0.6f, 0.4f), new Vector3(48f, 270f, 270f), 2f); } internal static (string?, Vector3, Vector3, float) GetGirlSantaHatConfig() { //IL_0014: 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) return ("DressGirlModel/AnimContainer/metarig/spine/spine.002/spine.003/spine.004", new Vector3(0f, 0.27f, -0.035f), new Vector3(10f, 115f, 340f), 0.4f); } internal static (string?, Vector3, Vector3, float) GetBlobSantaHatConfig() { //IL_0014: 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) return ("Armature/Center", new Vector3(0f, 1.6f, 0f), new Vector3(0f, 170f, 0f), 3f); } internal static (string?, Vector3, Vector3, float) GetKidnapperFoxSantaHatConfig() { return GetIncompatibleSantaHatConfig(); } internal static (string?, Vector3, Vector3, float) GetBarberSantaHatConfig() { return GetIncompatibleSantaHatConfig(); } internal static (string?, Vector3, Vector3, float) GetIncompatibleSantaHatConfig() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return (null, Vector3.zero, Vector3.zero, 0f); } internal static (string?, Vector3, Vector3, float) GetDefaultSantaHatConfig() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return (null, Vector3.zero, Vector3.zero, 0f); } } internal class ObjectHatConfigs { internal const string CatBonePath = "Cat_Simple_anim_IP/Arm_Cat/root_bone/Spine_base/spine_02/spine_03/spine_04/spine_05/neck/head"; internal const string TeethBonePath = "AnimContainer/MeshContainer/JawUpper"; internal static (bool, Vector3, Vector3, float) GetRubberDuckySantaHatConfig() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) return (true, new Vector3(0f, -0.2f, 2f), new Vector3(0f, 0f, 180f), 1f); } internal static (bool, Vector3, Vector3, float) GetGiftSantaHatConfig() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) return (true, new Vector3(0.7f, 1.5f, 2.2f), new Vector3(0f, 0f, 200f), 1f); } internal static (bool, Vector3, Vector3, float) GetTeethSantaHatConfig() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) return (true, new Vector3(0.7f, 1.5f, 2.2f), new Vector3(10f, 120f, 0f), 6f); } internal static (bool, Vector3, Vector3, float) GetCatSantaHatConfig() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) return (true, new Vector3(0f, 0.035f, 0.06f), new Vector3(80f, 0f, 0f), 0.11f); } internal static (bool, Vector3, Vector3, float) GetBeeHiveSantaHatConfig() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) return (true, new Vector3(0f, 1f, 0.2f), new Vector3(0f, 225f, 0f), 1.75f); } internal static (bool, Vector3, Vector3, float) GetFancyLampSantaHatConfig() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) return (true, new Vector3(0f, 0f, 2.25f), new Vector3(270f, 180f, 0f), 1f); } internal static (bool, Vector3, Vector3, float) GetPlasticCupSantaHatConfig() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) return (true, new Vector3(0f, 0f, 0.4f), new Vector3(270f, 180f, 0f), 0.9f); } internal static (bool, Vector3, Vector3, float) GetPicklesSantaHatConfig() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) return (true, new Vector3(0f, 0f, 2f), new Vector3(90f, 0f, 0f), 3f); } internal static (bool, Vector3, Vector3, float) GetToyRobotSantaHatConfig() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) return (true, new Vector3(0f, 0f, 2.35f), new Vector3(90f, 0f, 0f), 1.25f); } internal static (bool, Vector3, Vector3, float) GetOldPhoneSantaHatConfig() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) return (true, new Vector3(0f, 0.85f, 0f), new Vector3(0f, 115f, 0f), 1f); } internal static (bool, Vector3, Vector3, float) GetPlasticFishSantaHatConfig() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) return (true, new Vector3(0f, -0.7f, 1.3f), new Vector3(270f, 180f, 0f), 1f); } internal static (bool, Vector3, Vector3, float) GetDefaultSantaHatConfig() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return (true, Vector3.zero, Vector3.zero, 1f); } internal static (bool, Vector3, Vector3, float) GetIncompatibleSantaHatConfig() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return (false, Vector3.zero, Vector3.zero, 0f); } } } namespace JollyLethal.HatActions { internal class JollyHatActions { internal static bool DoesTransformAlreadyContainJollyHat(Transform parent, string pathToObject) { return parent.Find(pathToObject + "/mishelin.JollyLethal.JollyHatParent") != null; } internal static bool DoesTransformRootAlreadyContainJollyHat(Transform parent) { return parent.Find("mishelin.JollyLethal.JollyHatParent") != null; } internal static void HatChangeParent(Transform objParent, Transform hatParent, string pathToNewObj) { Transform val = objParent.Find(pathToNewObj); if (val != null) { hatParent.SetParent(val, false); } } internal static void FixHatParentChildPosScale(Transform parent) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) Transform child = parent.GetChild(0); ApplyOffsetsToHat(child, Vector3.zero, Vector3.zero, 1f); } internal static void FixHatsScaleBasedOnSquishedParent(Transform objParent, Transform hatParent, float targetScale = 1f) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) Vector3 localScale = objParent.localScale; hatParent.localScale = new Vector3(targetScale / localScale.x, targetScale / localScale.y, targetScale / localScale.z); } internal static void ApplyOffsetsToHat(Transform obj, Vector3 pos, Vector3 rot, float scale) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) obj.localPosition = pos; obj.localEulerAngles = rot; obj.localScale = Vector3.one * scale; } internal static void ChangeRotOfHatParentChild(Transform hatParent, Vector3 newRot) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) Transform child = hatParent.GetChild(0); child.localEulerAngles = newRot; } internal static Transform PlaceHatOnTransform(Transform targetBone, Vector3 posOffset, Vector3 rotOffset, float scale) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(JollyLethal.mySantaHat, targetBone); ((Object)val).name = "mishelin.JollyLethal.JollyHatParent"; Transform transform = val.transform; FixHatParentChildPosScale(transform); ApplyOffsetsToHat(transform, posOffset, rotOffset, scale); return transform; } } [HarmonyPatch(typeof(MaskedPlayerEnemy))] internal class PlaceHatOnMaskedPatch { private const float myWaitForSeconds = 1.5f; [HarmonyPatch("Start")] [HarmonyPostfix] private static void GiveHatToMasked(MaskedPlayerEnemy __instance) { ((MonoBehaviour)__instance).StartCoroutine(GiveHatToMaskedCoroutine(__instance)); } private static IEnumerator GiveHatToMaskedCoroutine(MaskedPlayerEnemy enemy) { yield return (object)new WaitForSeconds(1.5f); JollyLethal.PluginLogInfoWithPrefix("Placing santa hat on masked"); PlaceHatsOnEnemiesPatch.PlaceHatOnEnemyTransform(((Component)enemy).transform, ((EnemyAI)enemy).enemyType); } } [HarmonyPatch(typeof(GrabbableObject))] internal class PlaceHatsOnItemsPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void GiveEnemySantaHat(GrabbableObject __instance) { if (JollyLethal.myCustomAssets == null) { JollyLethal.PluginLogErrorWithPrefix("AssetBundle not loaded!!!"); } else { PlaceHatOnObjectTransform(((Component)__instance).transform, __instance.itemProperties); } } private static void FixAdditionalChildrenPositions(string itemName, Transform objParent, Transform hatParent) { //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_017a: 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_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) if (itemName == null) { return; } switch (itemName.Length) { case 12: switch (itemName[0]) { case 'P': if (itemName == "Plastic fish") { JollyHatActions.FixHatsScaleBasedOnSquishedParent(objParent, hatParent, 0.2f); JollyHatActions.ChangeRotOfHatParentChild(hatParent, new Vector3(0f, 290f, 0f)); } break; case 'R': if (itemName == "Rubber Ducky") { JollyHatActions.FixHatsScaleBasedOnSquishedParent(objParent, hatParent, 0.15f); JollyHatActions.ChangeRotOfHatParentChild(hatParent, new Vector3(90f, 0f, 0f)); } break; } break; case 10: if (itemName == "Fancy lamp") { JollyHatActions.ChangeRotOfHatParentChild(hatParent, new Vector3(0f, 25f, 0f)); } break; case 11: if (itemName == "Plastic cup") { JollyHatActions.ChangeRotOfHatParentChild(hatParent, new Vector3(0f, 25f, 0f)); } break; case 14: if (itemName == "Jar of pickles") { JollyHatActions.ChangeRotOfHatParentChild(hatParent, new Vector3(0f, 225f, 0f)); } break; case 9: if (itemName == "Toy robot") { JollyHatActions.ChangeRotOfHatParentChild(hatParent, new Vector3(0f, 25f, 0f)); } break; case 3: if (itemName == "Cat") { JollyHatActions.HatChangeParent(objParent, hatParent, "Cat_Simple_anim_IP/Arm_Cat/root_bone/Spine_base/spine_02/spine_03/spine_04/spine_05/neck/head"); JollyHatActions.ChangeRotOfHatParentChild(hatParent, new Vector3(0f, 250f, 0f)); } break; case 5: if (itemName == "Teeth") { JollyHatActions.HatChangeParent(objParent, hatParent, "AnimContainer/MeshContainer/JawUpper"); } break; case 4: if (itemName == "Gift") { JollyHatActions.FixHatsScaleBasedOnSquishedParent(objParent, hatParent, 0.5f); JollyHatActions.ChangeRotOfHatParentChild(hatParent, new Vector3(90f, 0f, 0f)); } break; case 6: case 7: case 8: case 13: break; } } internal static void PlaceHatOnObjectTransform(Transform itemTransform, Item itemProp) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_0036: 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) string itemName = itemProp.itemName; var (flag, posOffset, rotOffset, scale) = GetItemHatConfig(itemName); if (flag && !JollyHatActions.DoesTransformRootAlreadyContainJollyHat(itemTransform)) { Transform hatParent = JollyHatActions.PlaceHatOnTransform(itemTransform, posOffset, rotOffset, scale); FixAdditionalChildrenPositions(itemName, itemTransform, hatParent); } } internal static (bool, Vector3, Vector3, float) GetItemHatConfig(string itemName) { return itemName switch { "Fancy lamp" => ObjectHatConfigs.GetFancyLampSantaHatConfig(), "Plastic cup" => ObjectHatConfigs.GetPlasticCupSantaHatConfig(), "Jar of pickles" => ObjectHatConfigs.GetPicklesSantaHatConfig(), "Toy robot" => ObjectHatConfigs.GetToyRobotSantaHatConfig(), "Old phone" => ObjectHatConfigs.GetOldPhoneSantaHatConfig(), "Plastic fish" => ObjectHatConfigs.GetPlasticFishSantaHatConfig(), "Hive" => ObjectHatConfigs.GetBeeHiveSantaHatConfig(), "Rubber Ducky" => ObjectHatConfigs.GetRubberDuckySantaHatConfig(), "Cat" => ObjectHatConfigs.GetCatSantaHatConfig(), "Teeth" => ObjectHatConfigs.GetTeethSantaHatConfig(), "Gift" => ObjectHatConfigs.GetGiftSantaHatConfig(), _ => ObjectHatConfigs.GetIncompatibleSantaHatConfig(), }; } } [HarmonyPatch(typeof(EnemyAI))] internal class PlaceHatsOnEnemiesPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void GiveEnemySantaHat(EnemyAI __instance) { if (JollyLethal.myCustomAssets == null) { JollyLethal.PluginLogErrorWithPrefix("AssetBundle not loaded!!!"); } else { PlaceHatOnEnemyTransform(((Component)__instance).transform, __instance.enemyType); } } internal static void PlaceHatOnEnemyTransform(Transform enemyTransform, EnemyType enemyType) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) string enemyName = enemyType.enemyName; var (text, posOffset, rotOffset, scale) = GetEnemyHatConfig(enemyName); if (text != null && !JollyHatActions.DoesTransformAlreadyContainJollyHat(enemyTransform, text)) { Transform hatPlaceTransform = GetHatPlaceTransform(enemyTransform, text); Transform hatParent = JollyHatActions.PlaceHatOnTransform(hatPlaceTransform, posOffset, rotOffset, scale); FixAdditionalChildrenPositions(enemyName, hatParent); } } private static void FixAdditionalChildrenPositions(string enemyName, Transform hatParent) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) if (!(enemyName == "Crawler")) { if (enemyName == "Maneater") { JollyHatActions.ChangeRotOfHatParentChild(hatParent, new Vector3(0f, 115f, 0f)); } } else { JollyHatActions.ChangeRotOfHatParentChild(hatParent, new Vector3(0f, 285f, 0f)); } } internal static Transform GetHatPlaceTransform(Transform enemyTransform, string? bonePath) { Transform val = ((Component)enemyTransform).transform.Find(bonePath); if (val != null) { return val; } return ((Component)enemyTransform).transform; } internal static (string?, Vector3, Vector3, float) GetEnemyHatConfig(string enemyName) { JollyLethal.PluginLogInfoWithPrefix("Placing hat on: " + enemyName); switch (enemyName) { case "Flowerman": return EnemyHatConfigs.GetBrackenSantaHatConfig(); case "Hoarding bug": return EnemyHatConfigs.GetHoardingBugSantaHatConfig(); case "Centipede": return EnemyHatConfigs.GetSnareFleaSantaHatConfig(); case "Crawler": return EnemyHatConfigs.GetThumperSantaHatConfig(); case "Bunker Spider": return EnemyHatConfigs.GetBunkerSpiderSantaHatConfig(); case "Jester": return EnemyHatConfigs.GetJesterSantaHatConfig(); case "Nutcracker": return EnemyHatConfigs.GetNutcrackerSantaHatConfig(); case "Spring": return EnemyHatConfigs.GetSpringSantaHatConfig(); case "Masked": return EnemyHatConfigs.GetMaskedSantaHatConfig(); case "Butler": return EnemyHatConfigs.GetButlerSantaHatConfig(); case "Maneater": return EnemyHatConfigs.GetManeaterSantaHatConfig(); case "Puffer": return EnemyHatConfigs.GetSporeLizardSantaHatConfig(); case "Blob": return EnemyHatConfigs.GetBlobSantaHatConfig(); case "Girl": return EnemyHatConfigs.GetGirlSantaHatConfig(); case "MouthDog": return EnemyHatConfigs.GetMouthDogSantaHatConfig(); case "Baboon hawk": return EnemyHatConfigs.GetBaboonHawkSantaHatConfig(); case "ForestGiant": return EnemyHatConfigs.GetForestGiantSantaHatConfig(); case "RadMech": return EnemyHatConfigs.GetOldBirdSantaHatConfig(); case "Tulip Snake": return EnemyHatConfigs.GetTulipSnakeSantaHatConfig(); case "Bush Wolf": return EnemyHatConfigs.GetKidnapperFoxSantaHatConfig(); case "Clay Surgeon": JollyLethal.PluginLogInfoWithPrefix("Skipping hat for incompatible enemy: " + enemyName); return EnemyHatConfigs.GetBarberSantaHatConfig(); case "Manticoil": case "GiantKiwi": case "Red pill": case "Butler Bees": case "Earth Leviathan": case "Red Locust Bees": case "Docile Locust Bees": case "Lasso": JollyLethal.PluginLogInfoWithPrefix("Skipping hat for incompatible enemy: " + enemyName); return EnemyHatConfigs.GetIncompatibleSantaHatConfig(); default: JollyLethal.PluginLogErrorWithPrefix("Enemy '" + enemyName + "' not in config. Defaulting to 'Head'."); return EnemyHatConfigs.GetDefaultSantaHatConfig(); } } } } namespace JollyLethal.DebugScripts { [HarmonyPatch(typeof(RoundManager))] internal class EnemyDumper { [HarmonyPatch("Start")] [HarmonyPostfix] private static void DumpEveryEnemy() { JollyLethal.PluginLogInfoWithPrefix("=== STARTING ENEMY NAME DUMP ==="); EnemyType[] source = Resources.FindObjectsOfTypeAll<EnemyType>(); IOrderedEnumerable<string> orderedEnumerable = from n in source.Select((EnemyType e) => e.enemyName).Distinct() orderby n select n; foreach (string item in orderedEnumerable) { JollyLethal.PluginLogInfoWithPrefix("Found Enemy Name: \"" + item + "\""); } JollyLethal.PluginLogInfoWithPrefix("=== DUMP FINISHED ==="); } } [HarmonyPatch(typeof(GrabbableObject))] internal class GetItemName { [HarmonyPatch("Start")] [HarmonyPostfix] private static void PrintItemName(GrabbableObject __instance) { JollyLethal.PluginLogInfoWithPrefix("Item name " + __instance.itemProperties.itemName); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }