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 WatchOutBro v2.0.0
plugins/WatchOutBro/WatchOutBro.dll
Decompiled 11 hours agousing System; using System.Collections; 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 BepInEx; using BepInEx.Logging; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.SceneManagement; [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("WatchOutBro")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+47291038329cbcb4c52cdc53e1c8fb86c290d3d2")] [assembly: AssemblyProduct("WatchOutBro")] [assembly: AssemblyTitle("WatchOutBro")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace WatchOutBro { internal static class Assets { public static Texture2D Cat = null; public static Texture2D Warning = null; public static Texture2D Bubble = null; private static readonly Dictionary<IconKind, Texture2D> _iconCache = new Dictionary<IconKind, Texture2D>(); public static void Load() { Cat = LoadEmbedded("WatchOutBro.assets.cat.png"); Warning = MakeWarningTriangle(128); Bubble = MakeWhitePixel(); _iconCache[IconKind.Cat] = Cat; _iconCache[IconKind.Exclam] = Warning; } public static Texture2D Icon(IconKind kind) { if (_iconCache.TryGetValue(kind, out var value)) { return value; } Texture2D val = (Texture2D)(kind switch { IconKind.ShushFace => MakeShushFace(256), IconKind.Skull => MakeSkull(192), IconKind.Duck => MakeDuck(192), IconKind.Boom => MakeBoom(192), IconKind.Knife => MakeKnife(192), IconKind.Eye => MakeEye(192), IconKind.Question => MakeQuestion(192), IconKind.Brain => MakeBrain(192), IconKind.WK => MakeWK(256), _ => Warning, }); _iconCache[kind] = val; return val; } private static Texture2D LoadEmbedded(string resourceName) { //IL_003d: 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) //IL_004e: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName); if (stream == null) { Plugin.Log.LogError((object)("Embedded resource not found: " + resourceName)); return MakeWhitePixel(); } using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); ImageConversion.LoadImage(val, memoryStream.ToArray()); ((Texture)val).filterMode = (FilterMode)1; return val; } private static Texture2D MakeWhitePixel() { //IL_0004: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false); val.SetPixel(0, 0, Color.white); val.Apply(); return val; } private static Texture2D Blank(int size, out Color[] px) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown Texture2D val = new Texture2D(size, size, (TextureFormat)4, false); px = (Color[])(object)new Color[size * size]; return val; } private static void Apply(Texture2D tex, Color[] px) { tex.SetPixels(px); ((Texture)tex).filterMode = (FilterMode)1; tex.Apply(); } private static bool InCircle(float fx, float fy, float cx, float cy, float r) { return (fx - cx) * (fx - cx) + (fy - cy) * (fy - cy) < r * r; } private static bool InEllipse(float fx, float fy, float cx, float cy, float rx, float ry) { float num = (fx - cx) / rx; float num2 = (fy - cy) / ry; return num * num + num2 * num2 < 1f; } private static bool InRect(float fx, float fy, float x0, float y0, float x1, float y1) { if (fx >= x0 && fx <= x1 && fy >= y0) { return fy <= y1; } return false; } private static Texture2D MakeWarningTriangle(int size) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) Color[] px; Texture2D val = Blank(size, out px); Color val2 = default(Color); ((Color)(ref val2))..ctor(1f, 0.82f, 0.04f, 1f); Color black = Color.black; Color val3 = default(Color); ((Color)(ref val3))..ctor(0f, 0f, 0f, 0f); for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num = (float)j / (float)(size - 1); float num2 = (float)i / (float)(size - 1); float num3 = 0.5f * (1f - num2); float num4 = 1f - num3; if (!(num >= num3) || !(num <= num4) || !(num2 >= 0.06f) || !(num2 <= 0.96f)) { px[i * size + j] = val3; continue; } float num5 = (num - num3) * (float)size; float num6 = (num4 - num) * (float)size; float num7 = (num2 - 0.06f) * (float)size; if (Mathf.Min(num5, Mathf.Min(num6, num7)) < 4f) { px[i * size + j] = black; continue; } bool flag = Mathf.Abs(num - 0.5f) < 0.04f && num2 > 0.3f && num2 < 0.72f; bool flag2 = (num - 0.5f) * (num - 0.5f) + (num2 - 0.2f) * (num2 - 0.2f) < 0.0035f; px[i * size + j] = ((flag || flag2) ? black : val2); } } Apply(val, px); return val; } private static Texture2D MakeShushFace(int size) { //IL_005a: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) Color[] px; Texture2D val = Blank(size, out px); Color val2 = default(Color); ((Color)(ref val2))..ctor(1f, 0.85f, 0.7f, 1f); Color val3 = default(Color); ((Color)(ref val3))..ctor(0.95f, 0.78f, 0.62f, 1f); Color val4 = default(Color); ((Color)(ref val4))..ctor(1f, 0.7f, 0.7f, 1f); Color black = Color.black; Color val5 = default(Color); ((Color)(ref val5))..ctor(0.85f, 0.3f, 0.4f, 1f); Color val6 = default(Color); ((Color)(ref val6))..ctor(0f, 0f, 0f, 0f); for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num = (float)j / (float)(size - 1); float num2 = (float)i / (float)(size - 1); Color val7 = val6; if (InCircle(num, num2, 0.5f, 0.5f, 0.46f)) { val7 = (InCircle(num, num2, 0.5f, 0.5f, 0.448f) ? val2 : black); if (Mathf.Abs(num - 0.36f) < 0.07f && Mathf.Abs(num2 - 0.62f) < 0.012f) { val7 = black; } if (Mathf.Abs(num - 0.64f) < 0.07f && Mathf.Abs(num2 - 0.62f) < 0.012f) { val7 = black; } if (Mathf.Abs(num - 0.36f) < 0.08f && Mathf.Abs(num2 - 0.7f) < 0.01f) { val7 = black; } if (Mathf.Abs(num - 0.64f) < 0.08f && Mathf.Abs(num2 - 0.7f) < 0.01f) { val7 = black; } if (InEllipse(num, num2, 0.5f, 0.32f, 0.07f, 0.025f)) { val7 = val5; } } if (((InRect(num, num2, 0.46f, 0.05f, 0.54f, 0.42f) && InCircle(num, num2, 0.5f, 0.42f, 0.06f)) || InRect(num, num2, 0.46f, 0.05f, 0.54f, 0.4f)) && (InRect(num, num2, 0.46f, 0.05f, 0.54f, 0.4f) || InCircle(num, num2, 0.5f, 0.4f, 0.04f))) { val7 = ((!(Mathf.Min(Mathf.Abs(num - 0.46f), Mathf.Abs(num - 0.54f)) * (float)size < 2f)) ? val3 : black); if (num2 < 0.1f) { val7 = val4; } } px[i * size + j] = val7; } } Apply(val, px); return val; } private static Texture2D MakeSkull(int size) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_015e: 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_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) Color[] px; Texture2D val = Blank(size, out px); Color val2 = default(Color); ((Color)(ref val2))..ctor(0.95f, 0.95f, 0.92f, 1f); Color black = Color.black; Color val3 = default(Color); ((Color)(ref val3))..ctor(0f, 0f, 0f, 0f); for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num = (float)j / (float)(size - 1); float num2 = (float)i / (float)(size - 1); Color val4 = val3; if (InEllipse(num, num2, 0.5f, 0.55f, 0.42f, 0.4f)) { val4 = val2; } if (InRect(num, num2, 0.3f, 0.18f, 0.7f, 0.4f)) { val4 = val2; } if (val4 == val2 && !InEllipse(num, num2, 0.5f, 0.55f, 0.4f, 0.38f) && !InRect(num, num2, 0.32f, 0.2f, 0.68f, 0.38f) && (InEllipse(num, num2, 0.5f, 0.55f, 0.42f, 0.4f) || InRect(num, num2, 0.3f, 0.18f, 0.7f, 0.4f))) { val4 = black; } if (InCircle(num, num2, 0.36f, 0.55f, 0.08f)) { val4 = black; } if (InCircle(num, num2, 0.64f, 0.55f, 0.08f)) { val4 = black; } if (Mathf.Abs(num - 0.5f) < 0.04f * (1f - Mathf.InverseLerp(0.32f, 0.45f, num2)) && num2 > 0.32f && num2 < 0.45f) { val4 = black; } if (num2 > 0.2f && num2 < 0.34f && (Mathf.Abs(num - 0.42f) < 0.012f || Mathf.Abs(num - 0.5f) < 0.012f || Mathf.Abs(num - 0.58f) < 0.012f)) { val4 = black; } px[i * size + j] = val4; } } Apply(val, px); return val; } private static Texture2D MakeDuck(int size) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_0139: 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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) Color[] px; Texture2D val = Blank(size, out px); Color val2 = default(Color); ((Color)(ref val2))..ctor(1f, 0.85f, 0.1f, 1f); Color val3 = default(Color); ((Color)(ref val3))..ctor(1f, 0.55f, 0.05f, 1f); Color black = Color.black; Color val4 = default(Color); ((Color)(ref val4))..ctor(0f, 0f, 0f, 0f); for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num = (float)j / (float)(size - 1); float num2 = (float)i / (float)(size - 1); Color val5 = val4; if (InEllipse(num, num2, 0.45f, 0.32f, 0.34f, 0.22f)) { val5 = val2; } if (InCircle(num, num2, 0.62f, 0.62f, 0.18f)) { val5 = val2; } if (InRect(num, num2, 0.74f, 0.56f, 0.95f, 0.66f) && num < 0.72f + 0.22999996f * (1f - Mathf.Abs(num2 - 0.61f) * 14f)) { val5 = val3; } if (InCircle(num, num2, 0.62f, 0.66f, 0.018f)) { val5 = black; } px[i * size + j] = val5; } } Apply(val, px); return val; } private static Texture2D MakeBoom(int size) { //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) Color[] px; Texture2D val = Blank(size, out px); Color val2 = default(Color); ((Color)(ref val2))..ctor(1f, 0.45f, 0.05f, 1f); Color val3 = default(Color); ((Color)(ref val3))..ctor(1f, 0.9f, 0.1f, 1f); Color val4 = default(Color); ((Color)(ref val4))..ctor(0f, 0f, 0f, 0f); for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num = (float)j / (float)(size - 1) - 0.5f; float num2 = (float)i / (float)(size - 1) - 0.5f; float num3 = Mathf.Atan2(num2, num); float num4 = Mathf.Sqrt(num * num + num2 * num2); float num5 = 0.42f + 0.08f * Mathf.Sin(num3 * 8f); Color val5 = val4; if (num4 < num5) { val5 = val2; } if (num4 < num5 * 0.65f) { val5 = val3; } px[i * size + j] = val5; } } Apply(val, px); return val; } private static Texture2D MakeKnife(int size) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) Color[] px; Texture2D val = Blank(size, out px); Color val2 = default(Color); ((Color)(ref val2))..ctor(0.85f, 0.85f, 0.9f, 1f); Color val3 = default(Color); ((Color)(ref val3))..ctor(0.45f, 0.25f, 0.1f, 1f); Color black = Color.black; Color val4 = default(Color); ((Color)(ref val4))..ctor(0f, 0f, 0f, 0f); for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num = (float)j / (float)(size - 1); float num2 = (float)i / (float)(size - 1); Color val5 = val4; float num3 = (num + num2) * 0.5f; float num4 = num2 - num; if (Mathf.Abs(num4) < 0.06f && num3 > 0.3f && num3 < 0.92f) { val5 = val2; } if (Mathf.Abs(num4) < 0.1f && num3 > 0.1f && num3 < 0.32f) { val5 = val3; } if (val5 == val2 && Mathf.Abs(num4) > 0.05f) { val5 = black; } px[i * size + j] = val5; } } Apply(val, px); return val; } private static Texture2D MakeEye(int size) { //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) //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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) Color[] px; Texture2D val = Blank(size, out px); Color white = Color.white; Color val2 = default(Color); ((Color)(ref val2))..ctor(0.15f, 0.55f, 0.85f, 1f); Color black = Color.black; Color val3 = default(Color); ((Color)(ref val3))..ctor(0f, 0f, 0f, 0f); for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float fx = (float)j / (float)(size - 1); float fy = (float)i / (float)(size - 1); Color val4 = val3; if (InEllipse(fx, fy, 0.5f, 0.5f, 0.45f, 0.22f)) { val4 = white; } if (val4 == white && !InEllipse(fx, fy, 0.5f, 0.5f, 0.43f, 0.2f)) { val4 = black; } if (InCircle(fx, fy, 0.5f, 0.5f, 0.16f)) { val4 = val2; } if (InCircle(fx, fy, 0.5f, 0.5f, 0.07f)) { val4 = black; } if (InCircle(fx, fy, 0.55f, 0.55f, 0.025f)) { val4 = white; } px[i * size + j] = val4; } } Apply(val, px); return val; } private static Texture2D MakeQuestion(int size) { //IL_0063: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) Color[] px; Texture2D val = Blank(size, out px); Color val2 = default(Color); ((Color)(ref val2))..ctor(0.15f, 0.35f, 0.85f, 1f); Color val3 = default(Color); ((Color)(ref val3))..ctor(0f, 0f, 0f, 0f); for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num = (float)j / (float)(size - 1); float num2 = (float)i / (float)(size - 1); Color val4 = val3; float num3 = Mathf.Sqrt((num - 0.5f) * (num - 0.5f) + (num2 - 0.65f) * (num2 - 0.65f)); if (num3 > 0.15f && num3 < 0.22f && num2 > 0.55f) { val4 = val2; } if (Mathf.Abs(num - 0.5f) < 0.045f && num2 > 0.3f && num2 < 0.55f) { val4 = val2; } if (InCircle(num, num2, 0.5f, 0.18f, 0.05f)) { val4 = val2; } px[i * size + j] = val4; } } Apply(val, px); return val; } private static Texture2D MakeBrain(int size) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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) //IL_00b9: 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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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) Color[] px; Texture2D val = Blank(size, out px); Color val2 = default(Color); ((Color)(ref val2))..ctor(1f, 0.6f, 0.7f, 1f); Color val3 = default(Color); ((Color)(ref val3))..ctor(0.6f, 0.3f, 0.4f, 1f); Color val4 = default(Color); ((Color)(ref val4))..ctor(0f, 0f, 0f, 0f); for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num = (float)j / (float)(size - 1); float num2 = (float)i / (float)(size - 1); Color val5 = val4; if (InCircle(num, num2, 0.38f, 0.55f, 0.28f) || InCircle(num, num2, 0.62f, 0.55f, 0.28f)) { val5 = val2; } if (val5 == val2) { float num3 = Mathf.Sin(num * 18f) * 0.02f; if (Mathf.Abs(num2 - 0.55f - num3) < 0.005f) { val5 = val3; } if (Mathf.Abs(num2 - 0.4f - num3) < 0.005f) { val5 = val3; } if (Mathf.Abs(num2 - 0.7f - num3) < 0.005f) { val5 = val3; } } px[i * size + j] = val5; } } Apply(val, px); return val; } private static Texture2D MakeWK(int size) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_0297: 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_0201: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) Color[] px; Texture2D val = Blank(size, out px); Color val2 = default(Color); ((Color)(ref val2))..ctor(0.92f, 0.3f, 0.1f, 1f); Color white = Color.white; Color val3 = default(Color); ((Color)(ref val3))..ctor(0f, 0f, 0f, 0f); for (int i = 0; i < size; i++) { for (int num = 0; num < size; num++) { float num2 = (float)num / (float)(size - 1); float num3 = (float)i / (float)(size - 1); int num4; Color val4; if (!InRect(num2, num3, 0.1f, 0.05f, 0.9f, 0.95f) && !InRect(num2, num3, 0.05f, 0.1f, 0.95f, 0.9f) && !InCircle(num2, num3, 0.1f, 0.1f, 0.05f) && !InCircle(num2, num3, 0.9f, 0.1f, 0.05f) && !InCircle(num2, num3, 0.1f, 0.9f, 0.05f)) { num4 = (InCircle(num2, num3, 0.9f, 0.9f, 0.05f) ? 1 : 0); if (num4 == 0) { val4 = val3; goto IL_011b; } } else { num4 = 1; } val4 = val2; goto IL_011b; IL_011b: Color val5 = val4; if (num4 != 0) { if (num3 > 0.3f && num3 < 0.7f) { float num5 = Mathf.InverseLerp(0.3f, 0.7f, num3); float num6 = 0.03f; if (Mathf.Abs(num2 - Mathf.Lerp(0.1f, 0.2f, num5)) < num6 || Mathf.Abs(num2 - Mathf.Lerp(0.3f, 0.2f, num5)) < num6 || Mathf.Abs(num2 - Mathf.Lerp(0.3f, 0.4f, num5)) < num6 || Mathf.Abs(num2 - Mathf.Lerp(0.5f, 0.4f, num5)) < num6) { val5 = white; } } if (num3 > 0.3f && num3 < 0.7f) { float num7 = 0.03f; if (Mathf.Abs(num2 - 0.58f) < num7) { val5 = white; } float num8 = Mathf.InverseLerp(0.5f, 0.7f, num3); if (num8 > 0f && num8 < 1f && Mathf.Abs(num2 - Mathf.Lerp(0.58f, 0.92f, num8)) < num7) { val5 = white; } float num9 = Mathf.InverseLerp(0.5f, 0.3f, num3); if (num9 > 0f && num9 < 1f && Mathf.Abs(num2 - Mathf.Lerp(0.58f, 0.92f, num9)) < num7) { val5 = white; } } } px[i * size + num] = val5; } } Apply(val, px); return val; } } public class EnemyProximityWatcher : MonoBehaviour { [CompilerGenerated] private sealed class <TickLoop>d__6 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public EnemyProximityWatcher <>4__this; private WaitForSeconds <wait>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <TickLoop>d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <wait>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown int num = <>1__state; EnemyProximityWatcher enemyProximityWatcher = <>4__this; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; } else { <>1__state = -1; <wait>5__2 = new WaitForSeconds(0.25f); } try { enemyProximityWatcher.Tick(); } catch (Exception arg) { Plugin.Log.LogError((object)$"Tick failed: {arg}"); } <>2__current = <wait>5__2; <>1__state = 1; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public const float TickSeconds = 0.25f; public const float DefaultRange = 15f; public const float ReactionHold = 1.2f; private static readonly string[] EnemyTypeNames = new string[2] { "EnemyParent", "Enemy" }; private Type[] _enemyTypes = Array.Empty<Type>(); private void Start() { _enemyTypes = ResolveTypes(EnemyTypeNames); if (_enemyTypes.Length == 0) { Plugin.Log.LogWarning((object)"No enemy types found by reflection — overlay will never trigger from enemies."); } else { Plugin.Log.LogInfo((object)("Watching enemy types: " + string.Join(", ", _enemyTypes.Select((Type t) => t.Name)))); } ((MonoBehaviour)this).StartCoroutine(TickLoop()); } [IteratorStateMachine(typeof(<TickLoop>d__6))] private IEnumerator TickLoop() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <TickLoop>d__6(0) { <>4__this = this }; } private void Tick() { //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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) Camera main = Camera.main; if ((Object)(object)main == (Object)null || _enemyTypes.Length == 0) { return; } Vector3 position = ((Component)main).transform.position; ReactionDef reactionDef = null; float num = float.MaxValue; Type[] enemyTypes = _enemyTypes; for (int i = 0; i < enemyTypes.Length; i++) { Object[] array = Object.FindObjectsOfType(enemyTypes[i]); foreach (Object obj in array) { Component val = (Component)(object)((obj is Component) ? obj : null); if (val != null && !((Object)(object)val == (Object)null)) { Vector3 val2 = val.transform.position - position; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; ReactionDef reactionDef2 = Reactions.Lookup(((Object)val.gameObject).name); float num2 = reactionDef2.TriggerRange * reactionDef2.TriggerRange; if (!(sqrMagnitude > num2) && (reactionDef == null || reactionDef2.Priority > reactionDef.Priority || (reactionDef2.Priority == reactionDef.Priority && sqrMagnitude < num))) { reactionDef = reactionDef2; num = sqrMagnitude; } } } } if (reactionDef != null) { OverlayManager.Trigger(reactionDef, 1.2f); } } private static Type[] ResolveTypes(IEnumerable<string> names) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); List<Type> list = new List<Type>(); foreach (string name in names) { Assembly[] array = assemblies; foreach (Assembly assembly in array) { Type type; try { type = assembly.GetType(name, throwOnError: false); } catch { continue; } if (type != null && typeof(Component).IsAssignableFrom(type)) { list.Add(type); break; } } } return list.ToArray(); } } public enum IconKind { Cat, ShushFace, Skull, Duck, Boom, Knife, Eye, Question, Brain, Exclam, WK } public class LevelEventTrigger : MonoBehaviour { [CompilerGenerated] private sealed class <FireAfterDelay>d__6 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FireAfterDelay>d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: { <>1__state = -1; float num = Random.Range(8f, 20f); <>2__current = (object)new WaitForSeconds(num); <>1__state = 1; return true; } case 1: <>1__state = -1; OverlayManager.Trigger(Reactions.WoltersKluwer, 6f); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public const float DelayMin = 8f; public const float DelayMax = 20f; public const float WkDuration = 6f; private void OnEnable() { SceneManager.activeSceneChanged += OnSceneChanged; } private void OnDisable() { SceneManager.activeSceneChanged -= OnSceneChanged; } private void OnSceneChanged(Scene from, Scene to) { if (IsSkippableScene(((Scene)(ref to)).name)) { Plugin.Log.LogInfo((object)("WK skip — scene '" + ((Scene)(ref to)).name + "' looks like menu/lobby.")); return; } Plugin.Log.LogInfo((object)("WK armed for scene '" + ((Scene)(ref to)).name + "'")); ((MonoBehaviour)this).StartCoroutine(FireAfterDelay()); } [IteratorStateMachine(typeof(<FireAfterDelay>d__6))] private IEnumerator FireAfterDelay() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FireAfterDelay>d__6(0); } private static bool IsSkippableScene(string name) { if (string.IsNullOrEmpty(name)) { return true; } string text = name.ToLowerInvariant(); if (text.Contains("menu")) { return true; } if (text.Contains("lobby")) { return true; } if (text.Contains("init")) { return true; } if (text.Contains("title")) { return true; } if (text.Contains("splash")) { return true; } if (text.Contains("loading")) { return true; } if (text.Contains("tutorial")) { return true; } if (text.Contains("intro")) { return true; } return false; } } public class Overlay : MonoBehaviour { private GUIStyle? _bubbleStyle; private GUIStyle? _wkTitleStyle; private GUIStyle? _wkBodyStyle; private GUIStyle? _shushStyle; private void OnGUI() { ReactionDef active = OverlayManager.Active; if (active != null) { GUI.depth = -1000; InitStyles(); switch (active.Icon) { case IconKind.WK: DrawWkModal(active); break; case IconKind.ShushFace: DrawShushFull(active); break; default: DrawCatStyle(active); break; } } } private void DrawCatStyle(ReactionDef r) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) int width = Screen.width; int height = Screen.height; Texture2D val = Assets.Icon(r.Icon); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(20f, (float)(height - 220 - 20), 220f, 220f); GUI.DrawTexture(val2, (Texture)(object)val, (ScaleMode)2); Rect val3 = default(Rect); ((Rect)(ref val3))..ctor(((Rect)(ref val2)).xMax + 16f, ((Rect)(ref val2)).y + 24f, 380f, 96f); DrawFilled(val3, Color.white); DrawBorder(val3, 4, Color.black); for (int i = 0; i < 24; i++) { DrawFilled(new Rect(((Rect)(ref val3)).x - 24f + (float)i, ((Rect)(ref val3)).y + 96f - 20f + (float)i * 0.6f, (float)(24 - i), 2f), Color.white); } GUI.Label(val3, r.Message, _bubbleStyle); GUI.DrawTexture(new Rect(12f, 12f, 96f, 96f), (Texture)(object)Assets.Warning, (ScaleMode)2); GUI.DrawTexture(new Rect((float)(width - 96 - 12), 12f, 96f, 96f), (Texture)(object)Assets.Warning, (ScaleMode)2); GUI.DrawTexture(new Rect(12f, (float)(height - 96 - 12), 96f, 96f), (Texture)(object)Assets.Warning, (ScaleMode)2); GUI.DrawTexture(new Rect((float)(width - 96 - 12), (float)(height - 96 - 12), 96f, 96f), (Texture)(object)Assets.Warning, (ScaleMode)2); } private void DrawShushFull(ReactionDef r) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) int width = Screen.width; int height = Screen.height; Texture2D val = Assets.Icon(r.Icon); int num = (int)((float)height * 0.65f); GUI.DrawTexture(new Rect((float)(width - num) * 0.5f, (float)(height - num) * 0.5f - 30f, (float)num, (float)num), (Texture)(object)val, (ScaleMode)2); int num2 = (int)((float)width * 0.6f); int num3 = 110; Rect val2 = new Rect((float)(width - num2) * 0.5f, (float)(height - num3 - 40), (float)num2, (float)num3); DrawFilled(val2, Color.white); DrawBorder(val2, 5, Color.black); GUI.Label(val2, r.Message, _shushStyle); } private void DrawWkModal(ReactionDef r) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_00cd: 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_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0190: 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_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Expected O, but got Unknown int width = Screen.width; int height = Screen.height; int num = Mathf.Min(720, (int)((float)width * 0.7f)); int num2 = 360; Rect r2 = default(Rect); ((Rect)(ref r2))..ctor((float)(width - num) * 0.5f, (float)(height - num2) * 0.5f, (float)num, (float)num2); DrawFilled(r2, Color.white); DrawBorder(r2, 3, Color.black); Rect r3 = default(Rect); ((Rect)(ref r3))..ctor(((Rect)(ref r2)).x, ((Rect)(ref r2)).y, ((Rect)(ref r2)).width, 36f); DrawFilled(r3, new Color(0.85f, 0.27f, 0.1f, 1f)); GUI.Label(new Rect(((Rect)(ref r3)).x + 12f, ((Rect)(ref r3)).y + 4f, ((Rect)(ref r3)).width - 24f, ((Rect)(ref r3)).height), "Compliance Notice — wolterskluwer.com", _wkTitleStyle); Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref r2)).x + 24f, ((Rect)(ref r2)).y + 60f, 120f, 120f); GUI.DrawTexture(val, (Texture)(object)Assets.Icon(IconKind.WK), (ScaleMode)2); GUI.Label(new Rect(((Rect)(ref val)).xMax + 20f, ((Rect)(ref r2)).y + 60f, ((Rect)(ref r2)).width - 120f - 60f, ((Rect)(ref r2)).height - 80f), r.Message, _wkBodyStyle); Rect val2 = new Rect(((Rect)(ref r2)).xMax - 160f, ((Rect)(ref r2)).yMax - 56f, 140f, 36f); DrawFilled(val2, new Color(0.85f, 0.27f, 0.1f, 1f)); DrawBorder(val2, 2, Color.black); GUIStyle val3 = new GUIStyle(_wkTitleStyle) { alignment = (TextAnchor)4 }; GUI.Label(val2, "Acknowledge", val3); } private void InitStyles() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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) //IL_0027: 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_0034: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Expected O, but got Unknown if (_bubbleStyle == null) { GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = 28, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; val.normal.textColor = Color.black; val.wordWrap = true; _bubbleStyle = val; } if (_shushStyle == null) { GUIStyle val2 = new GUIStyle(GUI.skin.label) { fontSize = 56, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; val2.normal.textColor = Color.black; val2.wordWrap = false; _shushStyle = val2; } if (_wkTitleStyle == null) { GUIStyle val3 = new GUIStyle(GUI.skin.label) { fontSize = 18, fontStyle = (FontStyle)1, alignment = (TextAnchor)3 }; val3.normal.textColor = Color.white; val3.wordWrap = false; _wkTitleStyle = val3; } if (_wkBodyStyle == null) { GUIStyle val4 = new GUIStyle(GUI.skin.label) { fontSize = 22, fontStyle = (FontStyle)1, alignment = (TextAnchor)0 }; val4.normal.textColor = Color.black; val4.wordWrap = true; _wkBodyStyle = val4; } } private static void DrawFilled(Rect r, Color c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) Color color = GUI.color; GUI.color = c; GUI.DrawTexture(r, (Texture)(object)Assets.Bubble); GUI.color = color; } private static void DrawBorder(Rect r, int thickness, Color c) { //IL_0017: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) DrawFilled(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, (float)thickness), c); DrawFilled(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).yMax - (float)thickness, ((Rect)(ref r)).width, (float)thickness), c); DrawFilled(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, (float)thickness, ((Rect)(ref r)).height), c); DrawFilled(new Rect(((Rect)(ref r)).xMax - (float)thickness, ((Rect)(ref r)).y, (float)thickness, ((Rect)(ref r)).height), c); } } public class OverlayManager : MonoBehaviour { private static ReactionDef? _current; private static float _expiresAt; public static ReactionDef? Active { get { if (!(Time.unscaledTime < _expiresAt)) { return null; } return _current; } } public static void Trigger(ReactionDef r, float duration) { bool flag = _current != null && Time.unscaledTime < _expiresAt; if (!flag || r.Priority >= _current.Priority) { bool num = !flag || _current != r; _current = r; _expiresAt = Time.unscaledTime + duration; if (num) { Sounds.Play(r.Sound); } } } } [BepInPlugin("watchoutbro.WatchOutBro", "WatchOutBro", "2.0.0")] public class Plugin : BaseUnityPlugin { public const string GUID = "watchoutbro.WatchOutBro"; public const string NAME = "WatchOutBro"; public const string VERSION = "2.0.0"; internal static ManualLogSource Log; private void Awake() { //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_0020: Expected O, but got Unknown //IL_0020: 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_003a: 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) Log = ((BaseUnityPlugin)this).Logger; Assets.Load(); GameObject val = new GameObject("WatchOutBroHost"); Object.DontDestroyOnLoad((Object)val); ((Object)val).hideFlags = (HideFlags)61; Sounds.Init(val.AddComponent<AudioSource>()); val.AddComponent<EnemyProximityWatcher>(); val.AddComponent<LevelEventTrigger>(); val.AddComponent<OverlayManager>(); val.AddComponent<Overlay>(); Log.LogInfo((object)"WatchOutBro 2.0.0 loaded"); } } public sealed class ReactionDef { public string[] NameMatches { get; } public float TriggerRange { get; } public string Message { get; } public IconKind Icon { get; } public SoundKind Sound { get; } public int Priority { get; } public ReactionDef(string[] nameMatches, float triggerRange, string message, IconKind icon, SoundKind sound, int priority) { NameMatches = nameMatches; TriggerRange = triggerRange; Message = message; Icon = icon; Sound = sound; Priority = priority; } } public static class Reactions { public static readonly List<ReactionDef> All = new List<ReactionDef> { new ReactionDef(new string[1] { "huntsman" }, 20f, "be quiet bro...", IconKind.ShushFace, SoundKind.Shush, 50), new ReactionDef(new string[2] { "bang", "banger" }, 15f, "RUN BRO", IconKind.Boom, SoundKind.Alarm, 60), new ReactionDef(new string[1] { "reaper" }, 25f, "duck bro", IconKind.Skull, SoundKind.Scream, 70), new ReactionDef(new string[2] { "headman", "head" }, 12f, "mind your head bro", IconKind.Exclam, SoundKind.None, 30), new ReactionDef(new string[1] { "mentalist" }, 18f, "stay grounded bro", IconKind.Brain, SoundKind.None, 40), new ReactionDef(new string[2] { "apex", "duck" }, 15f, "QUACK BRO", IconKind.Duck, SoundKind.Alarm, 50), new ReactionDef(new string[1] { "chef" }, 15f, "skip lunch bro", IconKind.Knife, SoundKind.None, 40), new ReactionDef(new string[1] { "hidden" }, 10f, "where bro??", IconKind.Question, SoundKind.None, 30), new ReactionDef(new string[1] { "gnome" }, 8f, "tiny bro", IconKind.Exclam, SoundKind.None, 20), new ReactionDef(new string[2] { "clown", "birthday" }, 18f, "not funny bro", IconKind.Skull, SoundKind.Scream, 50), new ReactionDef(new string[2] { "peeper", "eye" }, 15f, "look away bro", IconKind.Eye, SoundKind.None, 40), new ReactionDef(new string[1] { "shadow" }, 15f, "lights on bro", IconKind.Exclam, SoundKind.None, 30), new ReactionDef(new string[1] { "trudge" }, 18f, "walk faster bro", IconKind.Exclam, SoundKind.None, 30), new ReactionDef(new string[1] { "spewer" }, 15f, "ew bro", IconKind.Exclam, SoundKind.None, 30), new ReactionDef(new string[1] { "bowtie" }, 15f, "fancy bro", IconKind.Exclam, SoundKind.None, 30), new ReactionDef(new string[1] { "tick" }, 12f, "bug spray bro", IconKind.Exclam, SoundKind.None, 30), new ReactionDef(new string[1] { "balloon" }, 18f, "pop bro", IconKind.Exclam, SoundKind.None, 30), new ReactionDef(new string[2] { "floater", "robe" }, 18f, "ghost bro", IconKind.Skull, SoundKind.None, 40), new ReactionDef(new string[2] { "cleanup", "crew" }, 15f, "tidy up bro", IconKind.Exclam, SoundKind.None, 30), new ReactionDef(new string[4] { "loom", "elsa", "heart", "oogly" }, 15f, "weird bro", IconKind.Exclam, SoundKind.None, 30) }; public static readonly ReactionDef Fallback = new ReactionDef(new string[1] { "*" }, 15f, "watch out bro...", IconKind.Cat, SoundKind.None, 0); public static readonly ReactionDef WoltersKluwer = new ReactionDef(new string[1] { "__wk__" }, 0f, "MANDATORY COMPLIANCE TRAINING\nWolters Kluwer Inc.\nClick anywhere to acknowledge", IconKind.WK, SoundKind.Bell, 100); public static ReactionDef Lookup(string objectName) { if (string.IsNullOrEmpty(objectName)) { return Fallback; } string text = objectName.ToLowerInvariant(); ReactionDef reactionDef = null; foreach (ReactionDef item in All) { string[] nameMatches = item.NameMatches; foreach (string value in nameMatches) { if (text.Contains(value)) { if (reactionDef == null || item.Priority > reactionDef.Priority) { reactionDef = item; } break; } } } return reactionDef ?? Fallback; } } public enum SoundKind { None, Shush, Scream, Alarm, Bell } public static class Sounds { private const int Sr = 44100; private const float Volume = 0.5f; private static AudioSource? _src; private static AudioClip? _shush; private static AudioClip? _scream; private static AudioClip? _alarm; private static AudioClip? _bell; public static void Init(AudioSource src) { _src = src; _src.playOnAwake = false; _src.spatialBlend = 0f; _src.volume = 0.5f; _src.loop = false; _shush = BuildShush(0.6f); _scream = BuildScream(0.8f); _alarm = BuildAlarm(1f); _bell = BuildBell(0.7f); } public static void Play(SoundKind kind) { if (!((Object)(object)_src == (Object)null)) { AudioClip val = (AudioClip)(kind switch { SoundKind.Shush => _shush, SoundKind.Scream => _scream, SoundKind.Alarm => _alarm, SoundKind.Bell => _bell, _ => null, }); if ((Object)(object)val != (Object)null) { _src.PlayOneShot(val); } } } private static AudioClip BuildShush(float seconds) { int num = (int)(44100f * seconds); float[] array = new float[num]; Random random = new Random(1); float num2 = 0f; int num3 = 2205; int num4 = 8820; for (int i = 0; i < num; i++) { float num5 = (float)(random.NextDouble() * 2.0 - 1.0); num2 += 0.18f * (num5 - num2); float num6 = ((i < num3) ? ((float)i / (float)num3) : ((i > num - num4) ? ((float)(num - i) / (float)num4) : 1f)); array[i] = num2 * num6 * 0.8f; } AudioClip obj = AudioClip.Create("wob_shush", num, 1, 44100, false); obj.SetData(array, 0); return obj; } private static AudioClip BuildScream(float seconds) { int num = (int)(44100f * seconds); float[] array = new float[num]; double num2 = 0.0; for (int i = 0; i < num; i++) { float num3 = (float)i / (float)num; float num4 = Mathf.Lerp(800f, 200f, num3); float num5 = Mathf.Sin((float)i / 44100f * 2f * MathF.PI * 7f) * 30f; num2 += Math.PI * 2.0 * (double)(num4 + num5) / 44100.0; float num6 = Mathf.Sin(num3 * MathF.PI); array[i] = (float)Math.Sin(num2) * num6 * 0.7f; } AudioClip obj = AudioClip.Create("wob_scream", num, 1, 44100, false); obj.SetData(array, 0); return obj; } private static AudioClip BuildAlarm(float seconds) { int num = (int)(44100f * seconds); float[] array = new float[num]; int num2 = 4410; double num3 = 0.0; for (int i = 0; i < num; i++) { float num4 = ((i / num2 % 2 == 0) ? 440f : 660f); num3 += Math.PI * 2.0 * (double)num4 / 44100.0; array[i] = (float)((Math.Sin(num3) >= 0.0) ? 0.4 : (-0.4)); } AudioClip obj = AudioClip.Create("wob_alarm", num, 1, 44100, false); obj.SetData(array, 0); return obj; } private static AudioClip BuildBell(float seconds) { int num = (int)(44100f * seconds); float[] array = new float[num]; double num2 = 0.0; for (int i = 0; i < num; i++) { num2 += 0.12537875442898042; float num3 = Mathf.Exp(-3.5f * ((float)i / (float)num)); float num4 = Mathf.Sin((float)num2 * 2f) * 0.3f; array[i] = ((float)Math.Sin(num2) + num4) * num3 * 0.6f; } AudioClip obj = AudioClip.Create("wob_bell", num, 1, 44100, false); obj.SetData(array, 0); return obj; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "WatchOutBro"; public const string PLUGIN_NAME = "WatchOutBro"; public const string PLUGIN_VERSION = "1.0.0"; } }