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 Its A Very Lethal Christmas v1.1.0
BepInEx/plugins/ItsAVeryLethalChristmas.dll
Decompiled a day agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using Microsoft.CodeAnalysis; using ModelReplacement; 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("ItsAVeryLethalChristmas")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ItsAVeryLethalChristmas")] [assembly: AssemblyTitle("ItsAVeryLethalChristmas")] [assembly: AssemblyVersion("1.0.0.0")] [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 LethalChristmas { [BepInPlugin("jerm.itsaverylethalchristmas", "Its A Very Lethal Christmas", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private void Awake() { if (!Outfits.Load()) { ((BaseUnityPlugin)this).Logger.LogError((object)"Could not load the outfit bundle 'lethalchristmas3d' next to the plugin DLL."); return; } ModelReplacementAPI.RegisterSuitModelReplacement("Lethal Santa", typeof(SantaOutfit)); ModelReplacementAPI.RegisterSuitModelReplacement("Lethal Reindeer", typeof(ReindeerOutfit)); ModelReplacementAPI.RegisterSuitModelReplacement("Lethal Snowman", typeof(SnowmanOutfit)); ModelReplacementAPI.RegisterSuitModelReplacement("Lethal Gingerbread", typeof(GingerbreadOutfit)); ModelReplacementAPI.RegisterSuitModelReplacement("Lethal Candy Cane", typeof(CandyCaneOutfit)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Its A Very Lethal Christmas: 3D outfits registered for 5 suits"); } } internal static class Outfits { public static AssetBundle Bundle; public static bool Load() { if ((Object)(object)Bundle != (Object)null) { return true; } string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lethalchristmas3d"); if (File.Exists(text)) { Bundle = AssetBundle.LoadFromFile(text); } return (Object)(object)Bundle != (Object)null; } public static GameObject Get(string name) { return Bundle.LoadAsset<GameObject>(name); } } public class SantaOutfit : BodyReplacementBase { protected override GameObject LoadAssetsAndReturnModel() { return Outfits.Get("Santa3D"); } } public class ReindeerOutfit : BodyReplacementBase { protected override GameObject LoadAssetsAndReturnModel() { return Outfits.Get("Reindeer3D"); } } public class SnowmanOutfit : BodyReplacementBase { protected override GameObject LoadAssetsAndReturnModel() { return Outfits.Get("Snowman3D"); } } public class GingerbreadOutfit : BodyReplacementBase { protected override GameObject LoadAssetsAndReturnModel() { return Outfits.Get("Gingerbread3D"); } } public class CandyCaneOutfit : BodyReplacementBase { protected override GameObject LoadAssetsAndReturnModel() { return Outfits.Get("CandyCane3D"); } } }
BepInEx/plugins/ChristmasMonsters/ChristmasMonsters.dll
Decompiled a day 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.Text; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; [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("ChristmasMonsters")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ChristmasMonsters")] [assembly: AssemblyTitle("ChristmasMonsters")] [assembly: AssemblyVersion("1.0.0.0")] [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 ChristmasMonsters { internal class XPart { public string Name; public string Target; public int Kind; public Color Base; public Color Emis; public float Metallic; public float Smooth; public float EmisStr; public Vector3[] V; public Vector3[] N; public string[] Bones; public int[] BoneSlots; public float[] Weights; public int[] Idx; } internal class XRecolor { public string Target; public string Texture; public int Submesh; public Color Color; public bool Hide; } internal class XLight { public string Target; public string Bone; public Vector3 Local; public Color Color; public float Lumen; public float Range; } internal class XData { public string Key; public List<XPart> Parts = new List<XPart>(); public List<XRecolor> Recolors = new List<XRecolor>(); public List<XLight> Lights = new List<XLight>(); public readonly Dictionary<int, Mesh> Meshes = new Dictionary<int, Mesh>(); public readonly Dictionary<int, Material> Mats = new Dictionary<int, Material>(); public readonly Dictionary<string, Texture2D> Textures = new Dictionary<string, Texture2D>(); } internal class Dressed : MonoBehaviour { public string Summary; } internal static class Dresser { private const float EmissionScale = 1.6f; private static readonly Dictionary<string, XData> cache = new Dictionary<string, XData>(); private static Material invisible; internal static string KeyOf(EnemyAI e) { foreach (KeyValuePair<string, Type> item in Monsters.Map) { if ((Object)(object)((Component)e).GetComponentInChildren(item.Value, true) != (Object)null) { return item.Key; } } return null; } internal static string Describe(EnemyAI e) { Dressed component = ((Component)e).GetComponent<Dressed>(); if (!((Object)(object)component != (Object)null)) { return KeyOf(e) + ": not dressed"; } return component.Summary; } internal static void Dress(EnemyAI e) { //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_04ae: Unknown result type (might be due to invalid IL or missing references) //IL_04b3: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04ce: Unknown result type (might be due to invalid IL or missing references) //IL_04de: Expected O, but got Unknown //IL_050b: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)e == (Object)null || (Object)(object)((Component)e).GetComponent<Dressed>() != (Object)null) { return; } string text = KeyOf(e); if (text == null || (Plugin.Enabled.TryGetValue(text, out var value) && !value)) { return; } XData xData = Load(text); if (xData == null) { return; } StringBuilder stringBuilder = new StringBuilder(text + ":"); int num = 0; int num2 = 0; SkinnedMeshRenderer[] componentsInChildren = ((Component)e).GetComponentsInChildren<SkinnedMeshRenderer>(true); MeshFilter[] componentsInChildren2 = ((Component)e).GetComponentsInChildren<MeshFilter>(true); for (int i = 0; i < xData.Parts.Count; i++) { XPart p = xData.Parts[i]; if (p.Kind == 0) { SkinnedMeshRenderer val = ((IEnumerable<SkinnedMeshRenderer>)componentsInChildren).FirstOrDefault((Func<SkinnedMeshRenderer, bool>)((SkinnedMeshRenderer s) => (Object)(object)s.sharedMesh != (Object)null && ((Object)s.sharedMesh).name == p.Target)); if ((Object)(object)val == (Object)null) { num2++; continue; } GameObject val2 = new GameObject("Xmas " + p.Name) { layer = ((Component)val).gameObject.layer }; val2.transform.SetParent(((Component)val).transform.parent, false); val2.transform.localPosition = ((Component)val).transform.localPosition; val2.transform.localRotation = ((Component)val).transform.localRotation; val2.transform.localScale = ((Component)val).transform.localScale; SkinnedMeshRenderer obj = val2.AddComponent<SkinnedMeshRenderer>(); obj.sharedMesh = SkinnedMesh(xData, i, val); obj.bones = val.bones; obj.rootBone = val.rootBone; ((Renderer)obj).sharedMaterial = Mat(xData, i); obj.updateWhenOffscreen = true; Match((Renderer)(object)obj, (Renderer)(object)val); num++; continue; } MeshFilter val3 = ((IEnumerable<MeshFilter>)componentsInChildren2).FirstOrDefault((Func<MeshFilter, bool>)((MeshFilter m) => (Object)(object)m.sharedMesh != (Object)null && ((Object)m.sharedMesh).name == p.Target)); if ((Object)(object)val3 == (Object)null) { num2++; continue; } GameObject val4 = new GameObject("Xmas " + p.Name) { layer = ((Component)val3).gameObject.layer }; val4.transform.SetParent(((Component)val3).transform, false); val4.AddComponent<MeshFilter>().sharedMesh = PlainMesh(xData, i); MeshRenderer val5 = val4.AddComponent<MeshRenderer>(); ((Renderer)val5).sharedMaterial = Mat(xData, i); Renderer component = ((Component)val3).GetComponent<Renderer>(); if ((Object)(object)component != (Object)null) { Match((Renderer)(object)val5, component); } num++; } int num3 = 0; foreach (XRecolor rc in xData.Recolors) { List<Renderer> list = (from s in ((Component)e).GetComponentsInChildren<SkinnedMeshRenderer>(true) where (Object)(object)s.sharedMesh != (Object)null && ((Object)s.sharedMesh).name == rc.Target select s).Cast<Renderer>().ToList(); if (list.Count == 0) { list = ((Component)e).GetComponentsInChildren<MeshRenderer>(true).Where(delegate(MeshRenderer r) { MeshFilter component2 = ((Component)r).GetComponent<MeshFilter>(); return component2 != null && (Object)(object)component2.sharedMesh != (Object)null && ((Object)component2.sharedMesh).name == rc.Target; }).Cast<Renderer>() .ToList(); } foreach (Renderer item in list) { Material[] materials = item.materials; for (int num4 = 0; num4 < materials.Length; num4++) { if (rc.Submesh >= 0 && num4 != rc.Submesh) { continue; } if (rc.Hide) { materials[num4] = Invisible(); continue; } if (!string.IsNullOrEmpty(rc.Texture)) { materials[num4].SetTexture("_BaseColorMap", (Texture)(object)Tex(xData, rc.Texture)); } if (rc.Color.r >= 0f) { materials[num4].SetColor("_BaseColor", rc.Color); materials[num4].SetColor("_Color", rc.Color); } } item.materials = materials; num3++; } } int num5 = 0; foreach (XLight l in xData.Lights) { SkinnedMeshRenderer val6 = ((IEnumerable<SkinnedMeshRenderer>)componentsInChildren).FirstOrDefault((Func<SkinnedMeshRenderer, bool>)((SkinnedMeshRenderer s) => (Object)(object)s.sharedMesh != (Object)null && ((Object)s.sharedMesh).name == l.Target)); Transform val7 = (((Object)(object)val6 != (Object)null) ? ((IEnumerable<Transform>)val6.bones).FirstOrDefault((Func<Transform, bool>)((Transform b) => (Object)(object)b != (Object)null && ((Object)b).name == l.Bone)) : null); if (!((Object)(object)val7 == (Object)null)) { GameObject val8 = new GameObject("Xmas Glow"); val8.transform.SetParent(val7, false); val8.transform.localPosition = l.Local; HDAdditionalLightData obj2 = GameObjectExtension.AddHDLight(val8, (HDLightTypeAndShape)0); obj2.SetIntensity(l.Lumen, (LightUnit)0); obj2.range = l.Range; obj2.color = l.Color; obj2.EnableShadows(false); obj2.lightlayersMask = (LightLayerEnum)255; num5++; } } stringBuilder.Append($" {num} pieces attached, {num2} missing a target, {num3} renderers recoloured, {num5} glow lights"); ((Component)e).gameObject.AddComponent<Dressed>().Summary = stringBuilder.ToString(); Plugin.Log.LogInfo((object)("Dressed " + stringBuilder)); } private static void Match(Renderer r, Renderer src) { //IL_000e: 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) //IL_0032: Unknown result type (might be due to invalid IL or missing references) r.renderingLayerMask = src.renderingLayerMask; r.shadowCastingMode = src.shadowCastingMode; r.receiveShadows = src.receiveShadows; r.lightProbeUsage = src.lightProbeUsage; r.reflectionProbeUsage = src.reflectionProbeUsage; } private static XData Load(string key) { //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) if (cache.TryGetValue(key, out var value)) { return value; } string text = Path.Combine(Plugin.Dir, key + ".xacc"); if (!File.Exists(text)) { cache[key] = null; return null; } value = new XData(); using (BinaryReader binaryReader = new BinaryReader(File.OpenRead(text))) { string text2 = new string(binaryReader.ReadChars(4)); if (text2 != "XAC1" && text2 != "XAC2") { Plugin.Log.LogError((object)(text + ": bad header")); cache[key] = null; return null; } value.Key = Str(binaryReader); int num = binaryReader.ReadInt32(); for (int i = 0; i < num; i++) { XPart xPart = new XPart { Name = Str(binaryReader), Target = Str(binaryReader), Kind = binaryReader.ReadInt32() }; xPart.Base = new Color(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()); xPart.Metallic = binaryReader.ReadSingle(); xPart.Smooth = binaryReader.ReadSingle(); xPart.Emis = new Color(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()); xPart.EmisStr = binaryReader.ReadSingle(); int num2 = binaryReader.ReadInt32(); xPart.V = Vecs(binaryReader, num2); xPart.N = Vecs(binaryReader, num2); if (xPart.Kind == 0) { int num3 = binaryReader.ReadInt32(); xPart.Bones = new string[num3]; for (int j = 0; j < num3; j++) { xPart.Bones[j] = Str(binaryReader); } xPart.BoneSlots = new int[num2 * 4]; for (int k = 0; k < num2 * 4; k++) { xPart.BoneSlots[k] = binaryReader.ReadInt32(); } xPart.Weights = new float[num2 * 4]; for (int l = 0; l < num2 * 4; l++) { xPart.Weights[l] = binaryReader.ReadSingle(); } } int num4 = binaryReader.ReadInt32(); xPart.Idx = new int[num4]; for (int m = 0; m < num4; m++) { xPart.Idx[m] = binaryReader.ReadInt32(); } value.Parts.Add(xPart); } int num5 = binaryReader.ReadInt32(); for (int n = 0; n < num5; n++) { value.Recolors.Add(new XRecolor { Target = Str(binaryReader), Submesh = binaryReader.ReadInt32(), Texture = Str(binaryReader), Color = new Color(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()), Hide = (binaryReader.ReadInt32() != 0) }); } if (text2 == "XAC2") { int num6 = binaryReader.ReadInt32(); for (int num7 = 0; num7 < num6; num7++) { value.Lights.Add(new XLight { Target = Str(binaryReader), Bone = Str(binaryReader), Local = new Vector3(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()), Color = new Color(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()), Lumen = binaryReader.ReadSingle(), Range = binaryReader.ReadSingle() }); } } } Plugin.Log.LogInfo((object)$"Loaded {key}: {value.Parts.Count} pieces, {value.Recolors.Count} recolours, {value.Lights.Count} lights"); cache[key] = value; return value; } private static string Str(BinaryReader r) { return Encoding.UTF8.GetString(r.ReadBytes(r.ReadInt32())); } private static Vector3[] Vecs(BinaryReader r, int n) { //IL_001f: 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) Vector3[] array = (Vector3[])(object)new Vector3[n]; for (int i = 0; i < n; i++) { array[i] = new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle()); } return array; } private static Mesh PlainMesh(XData d, int i) { //IL_001f: 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) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown if (d.Meshes.TryGetValue(i, out var value)) { return value; } XPart xPart = d.Parts[i]; value = new Mesh { name = "Xmas " + xPart.Name, indexFormat = (IndexFormat)(xPart.V.Length > 65000) }; value.vertices = xPart.V; value.normals = xPart.N; value.triangles = xPart.Idx; value.RecalculateBounds(); return d.Meshes[i] = value; } private static Mesh SkinnedMesh(XData d, int i, SkinnedMeshRenderer smr) { //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) if (d.Meshes.TryGetValue(i, out var value)) { return value; } XPart xPart = d.Parts[i]; value = PlainMesh(d, i); d.Meshes.Remove(i); List<string> names = smr.bones.Select((Transform b) => (!Object.op_Implicit((Object)(object)b)) ? "" : ((Object)b).name).ToList(); int[] array = xPart.Bones.Select((string n) => names.IndexOf(n)).ToArray(); BoneWeight[] array2 = (BoneWeight[])(object)new BoneWeight[xPart.V.Length]; for (int num = 0; num < xPart.V.Length; num++) { int[] array3 = new int[4]; float[] array4 = new float[4]; for (int num2 = 0; num2 < 4; num2++) { int num3 = array[xPart.BoneSlots[num * 4 + num2]]; array3[num2] = ((num3 >= 0) ? num3 : 0); array4[num2] = ((num3 < 0) ? 0f : xPart.Weights[num * 4 + num2]); } float num4 = array4.Sum(); if (num4 <= 0f) { array4[0] = 1f; num4 = 1f; } int num5 = num; BoneWeight val = default(BoneWeight); ((BoneWeight)(ref val)).boneIndex0 = array3[0]; ((BoneWeight)(ref val)).weight0 = array4[0] / num4; ((BoneWeight)(ref val)).boneIndex1 = array3[1]; ((BoneWeight)(ref val)).weight1 = array4[1] / num4; ((BoneWeight)(ref val)).boneIndex2 = array3[2]; ((BoneWeight)(ref val)).weight2 = array4[2] / num4; ((BoneWeight)(ref val)).boneIndex3 = array3[3]; ((BoneWeight)(ref val)).weight3 = array4[3] / num4; array2[num5] = val; } value.boneWeights = array2; value.bindposes = smr.sharedMesh.bindposes; return d.Meshes[i] = value; } private static Material Mat(XData d, int i) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) if (d.Mats.TryGetValue(i, out var value)) { return value; } XPart xPart = d.Parts[i]; value = new Material(Shader.Find("HDRP/Lit")) { name = "Xmas " + xPart.Name }; value.SetColor("_BaseColor", xPart.Base); value.SetFloat("_Metallic", xPart.Metallic); value.SetFloat("_Smoothness", Mathf.Clamp01(xPart.Smooth)); if (xPart.EmisStr > 0f) { value.SetColor("_EmissiveColor", xPart.Emis * (xPart.EmisStr * 1.6f)); value.SetFloat("_EmissiveExposureWeight", 0f); } HDMaterial.ValidateMaterial(value); return d.Mats[i] = value; } private static Texture2D Tex(XData d, string file) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown if (d.Textures.TryGetValue(file, out var value)) { return value; } value = new Texture2D(2, 2, (TextureFormat)4, true) { name = file }; ImageConversion.LoadImage(value, File.ReadAllBytes(Path.Combine(Plugin.Dir, file))); value.Apply(true, true); return d.Textures[file] = value; } private static Material Invisible() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)invisible != (Object)null) { return invisible; } Material val = ((IEnumerable<Material>)Resources.FindObjectsOfTypeAll<Material>()).FirstOrDefault((Func<Material, bool>)((Material m) => ((Object)m).name == "FlowermanLeaves")); invisible = (((Object)(object)val != (Object)null) ? new Material(val) : new Material(Shader.Find("HDRP/Lit"))); ((Object)invisible).name = "Xmas Invisible"; invisible.SetColor("_BaseColor", new Color(0f, 0f, 0f, 0f)); invisible.SetColor("_Color", new Color(0f, 0f, 0f, 0f)); invisible.SetFloat("_AlphaCutoffEnable", 1f); invisible.SetFloat("_AlphaCutoff", 0.99f); invisible.EnableKeyword("_ALPHATEST_ON"); return invisible; } } internal static class Monsters { internal static readonly Dictionary<string, Type> Map = new Dictionary<string, Type> { { "bracken", typeof(FlowermanAI) }, { "coilhead", typeof(SpringManAI) }, { "hoarder", typeof(HoarderBugAI) }, { "jester", typeof(JesterAI) }, { "thumper", typeof(CrawlerAI) }, { "flea", typeof(CentipedeAI) } }; internal static readonly Dictionary<string, string> Names = new Dictionary<string, string> { { "bracken", "Poinsettia Bracken" }, { "coilhead", "Candy-Cane Coil-Head" }, { "hoarder", "Present Hoarder (Hoarding Bug)" }, { "jester", "Gift-Box Jester" }, { "thumper", "Reindeer Thumper" }, { "flea", "Garland Snare Flea" } }; internal static EnemyType FindType(Type ai) { return ((IEnumerable<EnemyType>)Resources.FindObjectsOfTypeAll<EnemyType>()).FirstOrDefault((Func<EnemyType, bool>)((EnemyType t) => (Object)(object)t != (Object)null && (Object)(object)t.enemyPrefab != (Object)null && (Object)(object)t.enemyPrefab.GetComponentInChildren(ai, true) != (Object)null)); } } [BepInPlugin("lethalmodzz.lethalchristmas.monsters", "Its A Very Lethal Christmas - Monsters", "1.1.0")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Log; internal static string Dir; internal static readonly Dictionary<string, bool> Enabled = new Dictionary<string, bool>(); private void Awake() { //IL_0097: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; Dir = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); foreach (KeyValuePair<string, string> name in Monsters.Names) { Enabled[name.Key] = ((BaseUnityPlugin)this).Config.Bind<bool>("Christmas monsters", name.Value, true, "Dress the " + name.Value + " for Christmas.").Value; } new Harmony("lethalmodzz.lethalchristmas.monsters").PatchAll(typeof(Patches)); Log.LogInfo((object)("Christmas Monsters loaded from " + Dir)); } } internal static class Patches { [HarmonyPatch(typeof(EnemyAI), "Start")] [HarmonyPostfix] private static void AfterStart(EnemyAI __instance) { try { Dresser.Dress(__instance); } catch (Exception arg) { Plugin.Log.LogError((object)$"Dressing {((__instance != null) ? ((Object)__instance).name : null)} failed: {arg}"); } } } }