Decompiled source of UltraTelephone2 v1.0.0
plugins/UT2/CultOfJakito.UltraTelephone2.dll
Decompiled 7 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using Configgy; using CultOfJakito.UltraTelephone2.Assets; using CultOfJakito.UltraTelephone2.Chaos; using CultOfJakito.UltraTelephone2.Chaos.Effects; using CultOfJakito.UltraTelephone2.Data; using CultOfJakito.UltraTelephone2.DependencyInjection; using CultOfJakito.UltraTelephone2.Events; using CultOfJakito.UltraTelephone2.Fun; using CultOfJakito.UltraTelephone2.Fun.Captcha; using CultOfJakito.UltraTelephone2.Fun.Coin; using CultOfJakito.UltraTelephone2.Fun.EA; using CultOfJakito.UltraTelephone2.Fun.FakePBank; using CultOfJakito.UltraTelephone2.Fun.Glungus; using CultOfJakito.UltraTelephone2.Fun.Herobrine; using CultOfJakito.UltraTelephone2.LevelInjection; using CultOfJakito.UltraTelephone2.Patches; using CultOfJakito.UltraTelephone2.Properties; using CultOfJakito.UltraTelephone2.UI; using CultOfJakito.UltraTelephone2.Util; using HarmonyLib; using Microsoft.CodeAnalysis; using Microsoft.Extensions.DependencyInjection; using Newtonsoft.Json; using Steamworks; using TMPro; using ULTRAKILL.Cheats; using UnityEngine; using UnityEngine.AI; using UnityEngine.AddressableAssets; using UnityEngine.Audio; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("CultOfJakito.UltraTelephone2")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f2b58712c2f670f8825858c4459b38fee0550e3e")] [assembly: AssemblyProduct("CultOfJakito.UltraTelephone2")] [assembly: AssemblyTitle("CultOfJakito.UltraTelephone2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class IsReadOnlyAttribute : Attribute { } [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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public enum AnchorPresets { TopLeft, TopCenter, TopRight, MiddleLeft, MiddleCenter, MiddleRight, BottomLeft, BottonCenter, BottomRight, BottomStretch, VertStretchLeft, VertStretchRight, VertStretchCenter, HorStretchTop, HorStretchMiddle, HorStretchBottom, StretchAll } public enum PivotPresets { TopLeft, TopCenter, TopRight, MiddleLeft, MiddleCenter, MiddleRight, BottomLeft, BottomCenter, BottomRight } public struct Rect4 { public float top; public float bottom; public float left; public float right; public Rect4(float top, float bottom, float left, float right) { this.top = top; this.bottom = bottom; this.left = left; this.right = right; } } public static class RectTransformExtensions { public static void SetAnchor(this RectTransform source, AnchorPresets allign, int offsetX = 0, int offsetY = 0) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0090: 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_00c2: 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_00f4: 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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: 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_01d8: 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_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0284: 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_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) source.anchoredPosition = Vector2.op_Implicit(new Vector3((float)offsetX, (float)offsetY, 0f)); switch (allign) { case AnchorPresets.TopLeft: source.anchorMin = new Vector2(0f, 1f); source.anchorMax = new Vector2(0f, 1f); break; case AnchorPresets.TopCenter: source.anchorMin = new Vector2(0.5f, 1f); source.anchorMax = new Vector2(0.5f, 1f); break; case AnchorPresets.TopRight: source.anchorMin = new Vector2(1f, 1f); source.anchorMax = new Vector2(1f, 1f); break; case AnchorPresets.MiddleLeft: source.anchorMin = new Vector2(0f, 0.5f); source.anchorMax = new Vector2(0f, 0.5f); break; case AnchorPresets.MiddleCenter: source.anchorMin = new Vector2(0.5f, 0.5f); source.anchorMax = new Vector2(0.5f, 0.5f); break; case AnchorPresets.MiddleRight: source.anchorMin = new Vector2(1f, 0.5f); source.anchorMax = new Vector2(1f, 0.5f); break; case AnchorPresets.BottomLeft: source.anchorMin = new Vector2(0f, 0f); source.anchorMax = new Vector2(0f, 0f); break; case AnchorPresets.BottonCenter: source.anchorMin = new Vector2(0.5f, 0f); source.anchorMax = new Vector2(0.5f, 0f); break; case AnchorPresets.BottomRight: source.anchorMin = new Vector2(1f, 0f); source.anchorMax = new Vector2(1f, 0f); break; case AnchorPresets.HorStretchTop: source.anchorMin = new Vector2(0f, 1f); source.anchorMax = new Vector2(1f, 1f); break; case AnchorPresets.HorStretchMiddle: source.anchorMin = new Vector2(0f, 0.5f); source.anchorMax = new Vector2(1f, 0.5f); break; case AnchorPresets.HorStretchBottom: source.anchorMin = new Vector2(0f, 0f); source.anchorMax = new Vector2(1f, 0f); break; case AnchorPresets.VertStretchLeft: source.anchorMin = new Vector2(0f, 0f); source.anchorMax = new Vector2(0f, 1f); break; case AnchorPresets.VertStretchCenter: source.anchorMin = new Vector2(0.5f, 0f); source.anchorMax = new Vector2(0.5f, 1f); break; case AnchorPresets.VertStretchRight: source.anchorMin = new Vector2(1f, 0f); source.anchorMax = new Vector2(1f, 1f); break; case AnchorPresets.StretchAll: source.anchorMin = new Vector2(0f, 0f); source.anchorMax = new Vector2(1f, 1f); break; case AnchorPresets.BottomStretch: break; } } public static void SetPivot(this RectTransform source, PivotPresets preset) { //IL_0040: 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_0078: 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_00ad: 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_00df: 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_0111: Unknown result type (might be due to invalid IL or missing references) switch (preset) { case PivotPresets.TopLeft: source.pivot = new Vector2(0f, 1f); break; case PivotPresets.TopCenter: source.pivot = new Vector2(0.5f, 1f); break; case PivotPresets.TopRight: source.pivot = new Vector2(1f, 1f); break; case PivotPresets.MiddleLeft: source.pivot = new Vector2(0f, 0.5f); break; case PivotPresets.MiddleCenter: source.pivot = new Vector2(0.5f, 0.5f); break; case PivotPresets.MiddleRight: source.pivot = new Vector2(1f, 0.5f); break; case PivotPresets.BottomLeft: source.pivot = new Vector2(0f, 0f); break; case PivotPresets.BottomCenter: source.pivot = new Vector2(0.5f, 0f); break; case PivotPresets.BottomRight: source.pivot = new Vector2(1f, 0f); break; } } public static void SetRect(this RectTransform source, Rect4 rect) { //IL_000e: 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) source.offsetMin = new Vector2(rect.left, rect.bottom); source.offsetMax = new Vector2(0f - rect.right, 0f - rect.top); } } public class UniRandom : Random { private static UniRandom globalSessionRandomizer; private static UniRandom instance; public readonly int Seed; public static UniRandom Global { get { if (instance == null) { throw new Exception("UniRandom global is not initialized. Please initialize it with InitializeGlobal"); } return instance; } } public static int GlobalSeed => instance.Seed; public static void InitializeGlobal() { if (instance == null) { instance = CreateFullRandom(); Debug.Log((object)$"UniRandom initialized with global seed {instance.Seed}"); } } public static void InitializeGlobal(int seed) { if (instance == null) { instance = new UniRandom(seed); Debug.Log((object)$"UniRandom initialized with global seed {instance.Seed}"); } } public static void InitializeGlobal(string seed) { if (instance == null) { instance = new UniRandom(seed); Debug.Log((object)$"UniRandom initialized with global seed {instance.Seed}"); } } public static UniRandom GlobalRandom() { return new UniRandom(GlobalSeed); } public static UniRandom GlobalAdditive(int seed) { return new UniRandom(GlobalSeed ^ seed); } public static UniRandom SessionNext() { if (globalSessionRandomizer == null) { globalSessionRandomizer = new UniRandom(GlobalSeed); } return new UniRandom(globalSessionRandomizer.Next()); } public static void SessionGlobal(Action<UniRandom> rand) { rand(GlobalRandom()); } public static void DoRandom(Action<UniRandom> rand) { rand(CreateFullRandom()); } public static UniRandom CreateFullRandom() { return new UniRandom(Guid.NewGuid().GetHashCode()); } public static void SetGloalSeed(int seed) { instance = new UniRandom(seed); } public static void SetGloalSeed(string seed) { instance = new UniRandom(seed); } public static int StringToSeed(string seed) { int num = 0; foreach (char c in seed) { num ^= c; } return num; } public UniRandom(int seed) : base(seed) { Seed = seed; } public UniRandom(string seed) : base(StringToSeed(seed)) { Seed = StringToSeed(seed); } public UniRandom(UniRandom copySeedFrom) : base(copySeedFrom.Seed) { Seed = copySeedFrom.Seed; } public float Range(float min, float max) { return (float)NextDouble() * (max - min) + min; } public int Range(int minInclusive, int maxExclusive) { return Next(minInclusive, maxExclusive); } public T RandomEnum<T>() where T : Enum { Array values = Enum.GetValues(typeof(T)); return (T)values.GetValue(Next(0, values.Length)); } public float Float() { return (float)NextDouble(); } public Quaternion Rotation() { //IL_0031: 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_0039: Unknown result type (might be due to invalid IL or missing references) return Quaternion.Euler(Range(0f, 360f), Range(0f, 360f), Range(0f, 360f)); } public Vector3 InsideUnitSphere() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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) return UnitSphere() * Float(); } public Vector3 UnitSphere() { //IL_0031: 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_0039: 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_0041: Unknown result type (might be due to invalid IL or missing references) Vector3 val = new Vector3(Range(-1f, 1f), Range(-1f, 1f), Range(-1f, 1f)); return ((Vector3)(ref val)).normalized; } public Vector3 PointInShell(float minRadius, float maxRadius) { //IL_0002: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) return UnitSphere() * Range(minRadius, maxRadius); } public Vector3 PointOnShell(float radius) { //IL_0002: 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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) return UnitSphere() * radius; } public Quaternion RandomRotationAxis(Vector3 axis) { //IL_000d: 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_0013: 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) return Quaternion.AngleAxis(Float() * 360f, axis); } public Vector3 PointInCone(Vector3 direction, float angle) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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) //IL_0018: Unknown result type (might be due to invalid IL or missing references) return Vector3.Slerp(direction, UnitSphere(), Float() * angle); } public Vector3 PointOnLine(Vector3 pointA, Vector3 pointB) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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) //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_0021: 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) float num = Float(); return pointA * (1f - num) + pointB * num; } public Vector3 UnitDisc(Vector3 normal) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_0035: 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) //IL_003c: 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_006b: 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_0076: 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) //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) //IL_008d: 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_0022: 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_002c: 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) Vector3 val = Vector3.Cross(normal, Vector3.up); if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.Cross(normal, Vector3.right); } ((Vector3)(ref val)).Normalize(); Vector3 val2 = Vector3.Cross(normal, val); ((Vector3)(ref val2)).Normalize(); float num = Float() * MathF.PI * 2f; float num2 = Mathf.Sqrt(Float()); return val * Mathf.Cos(num) * num2 + val2 * Mathf.Sin(num) * num2; } public Vector2 InsideUnitCircle() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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) return UnitCircle() * Float(); } public Vector2 UnitCircle() { //IL_0021: 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_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_0031: Unknown result type (might be due to invalid IL or missing references) Vector2 val = new Vector2(Range(-1f, 1f), Range(-1f, 1f)); return ((Vector2)(ref val)).normalized; } public T SelectRandom<T>(ICollection<T> values) { if (values.Count == 0) { return default(T); } int num = Next(0, values.Count); int num2 = 0; foreach (T value in values) { if (num2 == num) { return value; } num2++; } return default(T); } public T SelectRandomFromSet<T>(params T[] values) { if (values.Length == 0) { return default(T); } return values[Next(0, values.Length)]; } public T SelectRandomWeighted<T>(IEnumerable<T> values, Func<T, int> weightSelector) { int num = 0; foreach (T value in values) { num += weightSelector(value); } int num2 = Next(0, num); foreach (T value2 in values) { int num3 = weightSelector(value2); if (num2 < num3) { return value2; } num2 -= num3; } return default(T); } public bool Chance(float chance) { if (chance == 0f) { return false; } if (chance == 1f) { return true; } return NextDouble() < (double)chance; } public bool Bool() { return Next(0, 2) == 1; } public string AlphabeticalString(int length) { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < length; i++) { stringBuilder.Append((char)Next(97, 123)); } return stringBuilder.ToString(); } public string AlphanumericString(int length) { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < length; i++) { if (Bool()) { stringBuilder.Append((char)Next(97, 123)); } else { stringBuilder.Append(Next(0, 10)); } } return stringBuilder.ToString(); } public IEnumerable<T> Shuffle<T>(IEnumerable<T> source) { List<T> list = new List<T>(source); int num = list.Count; while (num > 1) { num--; int index = Next(num + 1); T value = list[index]; list[index] = list[num]; list[num] = value; } return list; } public IEnumerable<T> TakeRandom<T>(IEnumerable<T> source, int count) { return Shuffle(source).Take(count); } public ulong ULong() { byte[] array = new byte[8]; NextBytes(array); return BitConverter.ToUInt64(array, 0); } public long Long() { byte[] array = new byte[8]; NextBytes(array); return BitConverter.ToInt64(array, 0); } public long Range(long minInclusive, long maxExclusive) { return (long)(ULong() % (ulong)(maxExclusive - minInclusive)) + minInclusive; } public ulong URange(ulong minInclusive, ulong maxExclusive) { return ULong() % (maxExclusive - minInclusive) + minInclusive; } public byte[] Bytes(int length) { byte[] array = new byte[length]; NextBytes(array); return array; } public Color Color() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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) return new Color(Float(), Float(), Float(), Float()); } public Color Color(float alpha) { //IL_0014: 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_001c: Unknown result type (might be due to invalid IL or missing references) return new Color(Float(), Float(), Float(), alpha); } public Color Color(float brightness, float saturation, float alpha = 1f) { //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_0017: 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_001b: Unknown result type (might be due to invalid IL or missing references) Color result = Color.HSVToRGB(Float(), saturation, brightness); result.a = alpha; return result; } public float Gaussian(float mean, float standardDeviation) { float num = 1f - Float(); float num2 = 1f - Float(); float num3 = Mathf.Sqrt(-2f * Mathf.Log(num)) * Mathf.Sin(MathF.PI * 2f * num2); return mean + standardDeviation * num3; } public Vector3 InBounds(Bounds bounds) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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) return new Vector3(Range(((Bounds)(ref bounds)).min.x, ((Bounds)(ref bounds)).max.x), Range(((Bounds)(ref bounds)).min.y, ((Bounds)(ref bounds)).max.y), Range(((Bounds)(ref bounds)).min.z, ((Bounds)(ref bounds)).max.z)); } public Vector3 InBox(Vector3 min, Vector3 max) { //IL_0002: 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_0014: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) return new Vector3(Range(min.x, max.x), Range(min.y, max.y), Range(min.z, max.z)); } public Vector2 InBox(Vector2 min, Vector2 max) { //IL_0002: 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_0014: 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_0025: 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_002d: Unknown result type (might be due to invalid IL or missing references) return new Vector2(Range(min.x, max.x), Range(min.y, max.y)); } } public class Sneeze : ChaosEffect { private static ConfigToggle s_enabled = new ConfigToggle(true); private AudioClip cartoonSneeze = null; private UltrakillEvent sneezeEvent = null; public override void BeginEffect(UniRandom random) { } public override bool CanBeginEffect(ChaosSessionContext ctx) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown if (!((ConfigValueElement<bool>)(object)s_enabled).Value) { return false; } if (sneezeEvent == null) { sneezeEvent = new UltrakillEvent(); sneezeEvent.onActivate.AddListener(new UnityAction(EndSneeze)); } return base.CanBeginEffect(ctx); } private IEnumerator Countdown(float time) { yield return (object)new WaitForSeconds(time); DoSneeze(); } private void DoSneeze() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown GameObject val = new GameObject("Sneeze"); val.AddComponent<AudioSource>().clip = cartoonSneeze; val.GetComponent<AudioSource>().Play(); val.AddComponent<ActivateOnSoundEnd>(); Traverse.Create((object)val.GetComponent<ActivateOnSoundEnd>()).Field("events").SetValue((object)sneezeEvent); } private void EndSneeze() { } protected override void OnDestroy() { } public override int GetEffectCost() { return 1; } } public class ZedPlush : MonoBehaviour { [SerializeField] private Texture2D[] _faces; [SerializeField] private Material _screenMaterial; public void ChangeFace() { _screenMaterial.mainTexture = (Texture)(object)_faces[Random.Range(0, _faces.Length)]; } } namespace CultOfJakito.UltraTelephone2 { [HarmonyPatch] public static class PlayerTrackingPatch { public class PlayerHurtState { public int Health; public bool Dead; } private static bool s_diedToRespawn; [HarmonyPatch(typeof(NewMovement), "GetHurt")] [HarmonyPrefix] public static void PreGetHurt(NewMovement __instance, out PlayerHurtState __state) { __state = new PlayerHurtState { Health = __instance.hp, Dead = __instance.dead }; } [HarmonyPatch(typeof(NewMovement), "GetHurt")] [HarmonyPostfix] public static void PostGetHurt(NewMovement __instance, PlayerHurtState __state) { int hp = __instance.hp; int num = __state.Health - hp; if (num > 0) { GameEvents.OnPlayerHurt?.Invoke(new PlayerHurtEvent(__instance, num)); } if (!__state.Dead && __instance.dead) { GameEvents.OnPlayerDeath?.Invoke(); } } [HarmonyPatch(typeof(NewMovement), "GetHealth")] [HarmonyPrefix] public static void PreGetHealth(NewMovement __instance, out int __state) { __state = __instance.hp; } [HarmonyPatch(typeof(NewMovement), "GetHealth")] [HarmonyPostfix] public static void PostGetHealth(NewMovement __instance, bool silent, int __state) { if (!silent) { int hp = __instance.hp; int num = hp - __state; if (num > 0) { GameEvents.OnPlayerHeal?.Invoke(new PlayerHealEvent(__instance, num)); } } } [HarmonyPatch(typeof(NewMovement), "ForceAntiHP")] [HarmonyPrefix] public static void PreForceAntiHP(NewMovement __instance, out float __state) { __state = __instance.antiHp; } [HarmonyPatch(typeof(NewMovement), "ForceAntiHP")] [HarmonyPostfix] public static void PostForceAntiHP(NewMovement __instance, float __state) { float antiHp = __instance.antiHp; float num = antiHp - __state; if (num > 0f) { GameEvents.OnPlayerAntiHeal?.Invoke(new PlayerAntiHealEvent(__instance, (int)num)); } } [HarmonyPatch(typeof(Punch), "Parry")] [HarmonyPostfix] public static void PostTryParryProjecilte(Punch __instance) { GameEvents.OnParry?.Invoke(); } [HarmonyPatch(typeof(StatsManager), "Restart")] [HarmonyPostfix] public static void Postfix() { GameEvents.OnPlayerRespawn?.Invoke(new PlayerRespawnEvent(MonoSingleton<NewMovement>.Instance, !s_diedToRespawn)); s_diedToRespawn = false; } [HarmonyPatch(typeof(StatsManager), "Restart")] [HarmonyPrefix] public static void Prefix() { s_diedToRespawn = MonoSingleton<NewMovement>.Instance.hp <= 0; } [HarmonyPatch(typeof(PlayerActivator), "OnTriggerEnter")] [HarmonyPrefix] private static void OnPreActivated(PlayerActivator __instance, Collider other, out bool __state) { __state = false; if (((Component)other).CompareTag("Player") && !__instance.activated) { __state = true; } } [HarmonyPatch(typeof(PlayerActivator), "OnTriggerEnter")] [HarmonyPostfix] private static void OnPostActivated(PlayerActivator __instance, Collider other, bool __state) { if (__state) { GameEvents.OnPlayerActivated?.Invoke(new PlayerActivatedEvent(SceneHelper.CurrentScene, MonoSingleton<NewMovement>.instance)); } } } public static class GeneralSettings { [Configgable("", "Copyrighted Music", 0, "If copyrighted music should be enabled or disabled.")] public static ConfigToggle EnableCopyrightedMusic = new ConfigToggle(true); [Configgable("", "Personalization", 0, "(Restart Required) How personalized of an experience do you want?")] public static ConfigDropdown<PersonalizationLevel> Personalization = new ConfigDropdown<PersonalizationLevel>((PersonalizationLevel[])Enum.GetValues(typeof(PersonalizationLevel)), (string[])null, 2); [Configgable("Extras", "Dangerous Effects", 0, "Ill advised to enable. Enables dangerous, harmful, or horny chaos effects. These may cause permenant damage to your computer or phsyce")] public static ConfigToggle DangerousEffectsEnabled = new ConfigToggle(false); } [HarmonyPatch] public static class InstanceUIPatch { [HarmonyPatch(typeof(CanvasController), "Awake")] [HarmonyPostfix] public static void OnAwake(CanvasController __instance) { RectTransform component = ((Component)__instance).GetComponent<RectTransform>(); MakeTitleImageUT2(component); InstanceMoneyCounter(component); InstanceCaptcha(component); } private static void MakeTitleImageUT2(RectTransform canvasRect) { if (!(SceneHelper.CurrentScene != "Main Menu")) { GamepadObjectSelector val = (from x in ((Component)canvasRect).GetComponentsInChildren<GamepadObjectSelector>() where ((Object)x).name == "Main Menu (1)" select x).FirstOrDefault(); if (!((Object)(object)val == (Object)null)) { Image componentInChildren = ((Component)val).GetComponentInChildren<Image>(); componentInChildren.sprite = HydraAssets.UT2Banner; } } } private static void InstanceMoneyCounter(RectTransform canvasRect) { if (!(SceneHelper.CurrentScene == "Main Menu")) { GameObject val = Object.Instantiate<GameObject>(HydraAssets.MoneyHUD, (Transform)(object)canvasRect); } } private static void InstanceCaptcha(RectTransform canvasRect) { GameObject val = Object.Instantiate<GameObject>(HydraAssets.CaptchaManager, (Transform)(object)canvasRect); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("CultOfJakito.UltraTelephone2", "UltraTelephone2", "1.0.0")] public class UltraTelephoneTwo : BaseUnityPlugin { public const string VERSION = "1.0.0"; public const string MOD_NAME = "UltraTelephone2"; public const string MOD_GUID = "CultOfJakito.UltraTelephone2"; private ConfigBuilder _config; private const int MAX_LOG_LINES = 100; public static List<string> LogBuffer; public ChaosManager ChaosManager { get; private set; } public UniRandom Random { get; private set; } public static UltraTelephoneTwo Instance { get; private set; } private void Awake() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) Instance = this; LogBuffer = new List<string>(); Application.logMessageReceived += new LogCallback(Application_logMessageReceived); _config = new ConfigBuilder("UltraTelephone2", "Ultra Telephone 2"); _config.Build(); InGameCheck.Init(); new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID).PatchAll(Assembly.GetExecutingAssembly()); int seed = PersonalizationLevelToSeed(((ConfigValueElement<PersonalizationLevel>)(object)GeneralSettings.Personalization).Value); if (DateTime.Now.Month == 4 && DateTime.Now.Day == 1) { Debug.LogWarning((object)"Happy April Fools! UT2 Seed is 69^YOU for the day!!"); seed = 0x45 ^ UniRandom.StringToSeed(Environment.UserName); } Random = new UniRandom(seed); UniRandom.InitializeGlobal(seed); BackupSaveData.EnsureBackupExists(); UT2Paths.EnsureFolders(); AddressableManager.LoadCatalog(); UT2SaveData.Load(); Jumpscare.ValidateFiles(); TextureHelper.LoadTextures(UT2Paths.TextureFolder); InitializeObjects(); InGameCheck.OnLevelChanged += OnSceneLoaded; AutoSaveUpdate(); } private void Application_logMessageReceived(string condition, string stackTrace, LogType type) { LogBuffer.Insert(0, condition); if (LogBuffer.Count > 100) { LogBuffer.RemoveAt(LogBuffer.Count - 1); } } private void InitializeObjects() { LoadBearingCoconut.EnsureStability(); ((Component)this).gameObject.AddComponent<LevelInjectionManager>(); AlterFriendAvatars.Load(); MinecraftBookPatch.Init(); UT2TextFiles.ReloadFiles(); HerobrineManager.Init(); BuyablesManager.Load(); GameEvents.OnEnemyDeath = (Action<EnemyDeathEvent>)Delegate.Combine(GameEvents.OnEnemyDeath, new Action<EnemyDeathEvent>(CoinCollectable.OnEnemyDeath)); GameEvents.OnEnemyDeath = (Action<EnemyDeathEvent>)Delegate.Combine(GameEvents.OnEnemyDeath, (Action<EnemyDeathEvent>)delegate { if (Random.Chance(0.05f)) { AnnoyingPopUp.OkDialogue("Nice Job!", "Good job killing that enemy!"); } }); } private void OnSceneLoaded(string name) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown if (((ConfigValueElement<PersonalizationLevel>)(object)GeneralSettings.Personalization).Value == PersonalizationLevel.ULTRAPERSONALIZED) { Random = UniRandom.CreateFullRandom(); } if (InGameCheck.InLevel()) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Starting new service scope"); GameObject val = new GameObject("UT2 Chaos Manager"); ChaosManager = val.AddComponent<ChaosManager>(); ChaosManager.BeginEffects(); GameObject val2 = new GameObject("UT2 Glungus Manager"); val2.AddComponent<GlungusManager>(); } } private void Update() { if (Input.GetKey((KeyCode)304) && Input.GetKeyDown((KeyCode)55)) { AddressableManager.LoadSceneUnsanitzed("Assets/Telephone 2/Scenes/CASINO.unity"); } } private void AutoSaveUpdate() { if (UT2SaveData.IsDirty) { UT2SaveData.Save(); } ((MonoBehaviour)this).Invoke("AutoSaveUpdate", 5f); } private void OnApplicationQuit() { UT2SaveData.Save(); } private static int PersonalizationLevelToSeed(PersonalizationLevel level) { return level switch { PersonalizationLevel.Personalized => UniRandom.StringToSeed(Environment.UserName), PersonalizationLevel.NotMuch => (int)DateTime.Now.DayOfWeek, PersonalizationLevel.Some => DateTime.Now.Day, PersonalizationLevel.More => DateTime.Now.Hour ^ (DateTime.Now.Minute % 20), PersonalizationLevel.ULTRAPERSONALIZED => (int)DateTime.Now.Ticks ^ UniRandom.StringToSeed(Environment.UserName), _ => 0, }; } } public enum PersonalizationLevel { None, Personalized, NotMuch, Some, More, ULTRAPERSONALIZED } public static class InGameCheck { public enum UkLevelType { Bootstrap, Tutorial, Intro, MainMenu, Level, Endless, Sandbox, Credits, Custom, Intermission, Secret, PrimeSanctum, Unknown } private static bool s_initialized; public static UkLevelType CurrentLevelType = UkLevelType.Intro; public static string CurrentSceneName = ""; [Configgable("Extras/Advanced", "Force InGame Check True", 0, null)] private static ConfigToggle s_cfgForceInLevelCheckTrue = new ConfigToggle(false); public static event Action<UkLevelType> OnLevelTypeChanged; public static event Action<string> OnLevelChanged; public static void Init() { if (!s_initialized) { s_initialized = true; SceneManager.sceneLoaded += OnSceneLoad; } } private static void OnSceneLoad(Scene scene, LoadSceneMode loadSceneMode) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) if (!(scene != SceneManager.GetActiveScene())) { string currentScene = SceneHelper.CurrentScene; UkLevelType ukLevelType = GetUkLevelType(currentScene); if (ukLevelType != CurrentLevelType) { CurrentLevelType = ukLevelType; CurrentSceneName = currentScene; InGameCheck.OnLevelTypeChanged?.Invoke(ukLevelType); } InGameCheck.OnLevelChanged?.Invoke(currentScene); } } public static UkLevelType GetUkLevelType(string sceneName) { sceneName = (sceneName.Contains("P-") ? "Sanctum" : sceneName); sceneName = (sceneName.Contains("-S") ? "Secret" : sceneName); sceneName = (sceneName.Contains("Level") ? "Level" : sceneName); sceneName = (sceneName.Contains("Intermission") ? "Intermission" : sceneName); return sceneName switch { "Bootstrap" => UkLevelType.Bootstrap, "Main Menu" => UkLevelType.MainMenu, "Custom Content" => UkLevelType.Custom, "Intro" => UkLevelType.Intro, "Endless" => UkLevelType.Endless, "uk_construct" => UkLevelType.Sandbox, "Intermission" => UkLevelType.Intermission, "Level" => UkLevelType.Level, "Secret" => UkLevelType.Secret, "Sanctum" => UkLevelType.PrimeSanctum, "CreditsMuseum2" => UkLevelType.Credits, "Tutorial" => UkLevelType.Tutorial, _ => UkLevelType.Unknown, }; } public static bool InLevel() { if (((ConfigValueElement<bool>)(object)s_cfgForceInLevelCheckTrue).Value) { return true; } UkLevelType currentLevelType = CurrentLevelType; UkLevelType ukLevelType = currentLevelType; if ((uint)ukLevelType <= 3u || (uint)(ukLevelType - 9) <= 1u) { return false; } return true; } public static bool PlayingLevel() { if (!InLevel()) { return false; } if ((Object)(object)MonoSingleton<StatsManager>.Instance == (Object)null) { return false; } if (MonoSingleton<StatsManager>.Instance.infoSent) { return false; } return MonoSingleton<StatsManager>.Instance.seconds > 0f; } } public static class MathUtils { public static float InverseLerpVector3(Vector3 min, Vector3 max, Vector3 point) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_003d: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.InverseLerp(min.x, max.x, point.x); float num2 = Mathf.InverseLerp(min.y, max.y, point.y); float num3 = Mathf.InverseLerp(min.z, max.z, point.z); return (num + num2 + num3) / 3f; } } internal static class Utility { public static void ForEach<T>(this IEnumerable<T> col, Action<T> action) { foreach (T item in col) { action(item); } } private static double Remap(double s, double a1, double a2, double b1, double b2) { return b1 + (s - a1) * (b2 - b1) / (a2 - a1); } public static IEnumerable<T> ShuffleIEnumerable<T>(this IEnumerable<T> source, Random rng) { T[] elements = source.ToArray(); for (int i = elements.Length - 1; i >= 0; i--) { int swapIndex = rng.Next(i + 1); yield return elements[swapIndex]; elements[swapIndex] = elements[i]; } } public static bool FastStartsWith(this string str, string value) { if (value.Length > str.Length) { return false; } for (int i = 0; i < value.Length; i++) { if (str[i] != value[i]) { return false; } } return true; } public static AudioSource PlaySound(this AudioClip clip, Vector3? position = null, Transform? parent = null, float volume = 1f, bool keepSource = false, bool loop = false) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0031: 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) GameObject val = new GameObject("Audio: " + ((Object)clip).name); val.transform.position = (Vector3)(((??)position) ?? Vector3.zero); if ((Object)(object)parent != (Object)null) { val.transform.parent = parent; } AudioSource val2 = val.AddComponent<AudioSource>(); val2.clip = clip; val2.volume = volume; val2.loop = loop; if (position.HasValue) { val2.spatialBlend = 1f; } val2.outputAudioMixerGroup = UkPrefabs.MainMixer; val2.rolloffMode = (AudioRolloffMode)1; val2.minDistance = 15f; val2.maxDistance = 65f; val2.Play(); if (!keepSource) { Object.Destroy((Object)(object)val, clip.length); } return val2; } public static void ConfigureForUltrakill(this AudioSource source) { source.spatialBlend = 1f; source.outputAudioMixerGroup = UkPrefabs.MainMixer; source.rolloffMode = (AudioRolloffMode)1; source.minDistance = 15f; source.maxDistance = 65f; } public static bool UserIsDeveloper() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (!SteamClient.IsValid || !SteamClient.IsLoggedOn) { return false; } ulong value = SteamClient.SteamId.Value; for (int i = 0; i < SteamController.BuiltInVerifiedSteamIds.Length; i++) { if (value == SteamController.BuiltInVerifiedSteamIds[i]) { return true; } } return false; } } } namespace CultOfJakito.UltraTelephone2.Util { public static class AudioHelper { private static Dictionary<string, AudioClip> loadedClips = new Dictionary<string, AudioClip>(); private static Dictionary<string, AudioClip> loadedClipsByPath = new Dictionary<string, AudioClip>(); private static CoroutineRunner coroutineRunner; private static CoroutineRunner GetCoroutineRunner() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)coroutineRunner == (Object)null) { coroutineRunner = new GameObject("AudioHelper").AddComponent<CoroutineRunner>(); Object.DontDestroyOnLoad((Object)(object)((Component)coroutineRunner).gameObject); } return coroutineRunner; } public static void LoadClips(string folderPath) { DirectoryInfo directoryInfo = new DirectoryInfo(folderPath); FileInfo[] files = directoryInfo.GetFiles("*.wav", SearchOption.TopDirectoryOnly); foreach (FileInfo fileInfo in files) { ((MonoBehaviour)GetCoroutineRunner()).StartCoroutine(LoadClipAsync(fileInfo.FullName, (AudioType)20)); } FileInfo[] files2 = directoryInfo.GetFiles("*.mp3", SearchOption.TopDirectoryOnly); foreach (FileInfo fileInfo2 in files2) { ((MonoBehaviour)GetCoroutineRunner()).StartCoroutine(LoadClipAsync(fileInfo2.FullName, (AudioType)13)); } FileInfo[] files3 = directoryInfo.GetFiles("*.ogg", SearchOption.TopDirectoryOnly); foreach (FileInfo fileInfo3 in files3) { ((MonoBehaviour)GetCoroutineRunner()).StartCoroutine(LoadClipAsync(fileInfo3.FullName, (AudioType)14)); } } public static void LoadClipAtPath(string filePath, Action<bool, AudioClip> onComplete) { if (loadedClipsByPath.ContainsKey(filePath)) { onComplete?.Invoke(arg1: true, loadedClipsByPath[filePath]); } else { ((MonoBehaviour)GetCoroutineRunner()).StartCoroutine(LoadClipAtPathAsync(filePath, onComplete)); } } private static IEnumerator LoadClipAtPathAsync(string filePath, Action<bool, AudioClip> onComplete) { string extension = Path.GetExtension(filePath); AudioType audioType; switch (extension) { case ".wav": audioType = (AudioType)20; break; case ".mp3": audioType = (AudioType)13; break; case ".ogg": audioType = (AudioType)14; break; default: Debug.LogError((object)("Unsupported audio file type: " + extension)); onComplete?.Invoke(arg1: false, null); yield break; } yield return LoadClipAsync(filePath, audioType); if (loadedClipsByPath.ContainsKey(filePath)) { onComplete?.Invoke(arg1: true, loadedClipsByPath[filePath]); } else { onComplete?.Invoke(arg1: false, null); } } public static void ClearClipCache() { foreach (AudioClip value in loadedClips.Values) { Object.Destroy((Object)(object)value); } loadedClips.Clear(); } private static IEnumerator LoadClipAsync(string filePath, AudioType audioType) { //IL_000e: 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) UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(filePath, audioType); try { yield return www.SendWebRequest(); if (www.isNetworkError) { Debug.Log((object)$"Failed to load {audioType} file at path {filePath}"); Debug.Log((object)www.error); yield break; } AudioClip newAudioClip = DownloadHandlerAudioClip.GetContent(www); if ((Object)(object)newAudioClip != (Object)null) { if (!loadedClips.ContainsKey(((Object)newAudioClip).name)) { loadedClips.Add(((Object)newAudioClip).name, newAudioClip); } loadedClipsByPath[filePath] = newAudioClip; } } finally { ((IDisposable)www)?.Dispose(); } } public static IEnumerable<AudioClip> GetLoadedClips() { return loadedClipsByPath.Values; } public static bool TryGetAudioClipByName(string name, out AudioClip clip) { clip = null; if (!loadedClips.ContainsKey(name)) { return false; } clip = loadedClips[name]; return true; } } public static class BackupSaveData { private static string saveGameFolder => GameProgressSaver.BaseSavePath; private static string backupFolder => Path.Combine(UT2Paths.ModFolder, "SAVES_BACKUP"); public static void EnsureBackupExists() { if (Directory.Exists(backupFolder)) { return; } Debug.Log((object)"UT2: No backup data found... backing up player data."); Directory.CreateDirectory(backupFolder); string[] files = Directory.GetFiles(saveGameFolder, "*", SearchOption.AllDirectories); foreach (string text in files) { string path = text.Substring(saveGameFolder.Length + 1, text.Length - (saveGameFolder.Length + 1)); string text2 = Path.Combine(backupFolder, path); if (!Directory.Exists(Path.GetDirectoryName(text2))) { Directory.CreateDirectory(Path.GetDirectoryName(text2)); } File.Copy(text, text2); } Debug.Log((object)"UT2: Backup save data created."); } } public class CoroutineRunner : MonoBehaviour { } public static class DoOverTime { public static void DoAfterTime(this MonoBehaviour behaviour, float length, Action action) { behaviour.StartCoroutine(DoAfterTimeCoroutine(length, action)); } public static void DoAfterTimeUnscaled(this MonoBehaviour behaviour, float length, Action action) { behaviour.StartCoroutine(DoAfterTimeUnscaledCoroutine(length, action)); } public static void DoAfterTimeFixedUpdate(this MonoBehaviour behaviour, float length, Action action) { behaviour.StartCoroutine(DoAfterTimeFixedUpdateCoroutine(length, action)); } public static void Lerp(this MonoBehaviour behaviour, float length, Action<float> t) { behaviour.StartCoroutine(LerpCoroutine(length, t)); } public static void LerpUnscaled(this MonoBehaviour behaviour, float length, Action<float> t) { behaviour.StartCoroutine(LerpUnscaledCoroutine(length, t)); } public static void LerpFixedUpdate(this MonoBehaviour behaviour, float length, Action<float> t) { behaviour.StartCoroutine(LerpFixedUpdateCoroutine(length, t)); } private static IEnumerator LerpCoroutine(float length, Action<float> t) { float timer = length; t?.Invoke(0f); while (timer > 0f) { t?.Invoke(1f - timer / length); yield return (object)new WaitForEndOfFrame(); timer = Mathf.Max(0f, timer - Time.deltaTime); } t?.Invoke(1f); } private static IEnumerator LerpUnscaledCoroutine(float length, Action<float> t) { float timer = length; t?.Invoke(0f); while (timer > 0f) { t?.Invoke(1f - timer / length); yield return (object)new WaitForEndOfFrame(); timer = Mathf.Max(0f, timer - Time.unscaledDeltaTime); } t?.Invoke(1f); } private static IEnumerator LerpFixedUpdateCoroutine(float length, Action<float> t) { float timer = length; t?.Invoke(0f); while (timer > 0f) { t?.Invoke(1f - timer / length); yield return (object)new WaitForFixedUpdate(); timer = Mathf.Max(0f, timer - Time.fixedDeltaTime); } t?.Invoke(1f); } private static IEnumerator DoAfterTimeCoroutine(float length, Action action) { for (float timer = length; timer > 0f; timer = Mathf.Max(0f, timer - Time.deltaTime)) { yield return (object)new WaitForEndOfFrame(); } action?.Invoke(); } private static IEnumerator DoAfterTimeUnscaledCoroutine(float length, Action action) { for (float timer = length; timer > 0f; timer = Mathf.Max(0f, timer - Time.unscaledDeltaTime)) { yield return (object)new WaitForEndOfFrame(); } action?.Invoke(); } private static IEnumerator DoAfterTimeFixedUpdateCoroutine(float length, Action action) { for (float timer = length; timer > 0f; timer = Mathf.Max(0f, timer - Time.fixedDeltaTime)) { yield return (object)new WaitForFixedUpdate(); } action?.Invoke(); } } public static class Locator { public static T LocateComponent<T>(string path) where T : Component { return LocateComponentsOfType<T>().FirstOrDefault((T x) => ((Component)x).transform.HasParentalPath(path)); } public static T[] LocateComponentsOfType<T>() where T : Component { return (from x in Resources.FindObjectsOfTypeAll<T>() where (int)((Object)(object)x).hideFlags != 8 && (int)((Object)(object)x).hideFlags != 61 select x).ToArray(); } public static bool HasParentalPath(this Transform tf, string[] parentNames) { Transform val = tf; for (int num = parentNames.Length - 1; num >= 0; num--) { if ((Object)(object)val == (Object)null || ((Object)val).name != parentNames[num]) { return false; } val = val.parent; } return true; } public static bool HasParentalPath(this Transform tf, string path) { return tf.HasParentalPath(path.Split(new char[1] { '/' })); } public static T LocateComponentInChildren<T>(this Transform tf, string name) where T : Component { return ((Component)tf).GetComponentsInChildren<T>(true).FirstOrDefault((T x) => ((Object)(object)x).name == name); } } public class SeedBuilder { private List<int> seedModifiers; public SeedBuilder() { seedModifiers = new List<int>(); } public SeedBuilder Reverse() { seedModifiers.Reverse(); return this; } public SeedBuilder WithSeed(int seedModifier) { seedModifiers.Add(seedModifier); return this; } public SeedBuilder WithSeed(string seedModifier) { seedModifiers.Add(UniRandom.StringToSeed(seedModifier)); return this; } public SeedBuilder WithSeed(Vector3 position) { //IL_0007: 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_0041: Unknown result type (might be due to invalid IL or missing references) seedModifiers.Add(Mathf.RoundToInt(position.x * 10f)); seedModifiers.Add(Mathf.RoundToInt(position.y * 10f)); seedModifiers.Add(Mathf.RoundToInt(position.z * 10f)); return this; } public SeedBuilder WithObjectHash(object seedModifier) { seedModifiers.Add(seedModifier.GetHashCode()); return this; } public SeedBuilder WithSceneName() { seedModifiers.Add(UniRandom.StringToSeed(SceneHelper.CurrentScene)); return this; } public SeedBuilder WithGlobalSeed() { seedModifiers.Add(UltraTelephoneTwo.Instance.Random.Seed); return this; } public SeedBuilder WithFullRandom() { seedModifiers.Add(UniRandom.CreateFullRandom().Next()); return this; } public int GetSeed() { int num = ((seedModifiers.Count > 0) ? seedModifiers[0] : 0); for (int i = 1; i < seedModifiers.Count; i++) { num ^= seedModifiers[i]; } return num; } public override int GetHashCode() { return GetSeed(); } public static implicit operator int(SeedBuilder seedBuilder) { return seedBuilder.GetSeed(); } } public static class TextureHelper { private static Texture2D[] cachedTextures = (Texture2D[])(object)new Texture2D[0]; private static Dictionary<string, Texture2D> cachedTextureMap = new Dictionary<string, Texture2D>(); private static bool initialized = false; public static void LoadTextures(string folderPath) { cachedTextures = FindTextures(folderPath); } public static bool TryLoadTexture(string path, out Texture2D tex) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown tex = null; if (cachedTextureMap.ContainsKey(path)) { tex = cachedTextureMap[path]; return true; } if (!File.Exists(path)) { Debug.LogError((object)("UT2: Invalid texture path: " + path)); return false; } byte[] array = null; try { array = File.ReadAllBytes(path); } catch (Exception ex) { Debug.LogError((object)("UT2: Error reading texture file: " + ex.Message)); Debug.LogException(ex); return false; } tex = new Texture2D(16, 16); if (!ImageConversion.LoadImage(tex, array)) { Debug.LogError((object)("UT2: Error loading texture image: " + path)); return false; } cachedTextureMap[path] = tex; return true; } public static Texture2D RandomTextureFromCache(UniRandom random) { if (cachedTextures.Length != 0) { return random.SelectRandomFromSet(cachedTextures); } return null; } private static void ClearTextureCache() { if (cachedTextures == null) { return; } int num = cachedTextures.Length; for (int i = 0; i < num; i++) { if (!((Object)(object)cachedTextures[i] == (Object)null)) { Object.Destroy((Object)(object)cachedTextures[i]); } } cachedTextures = null; } public static Texture2D[] FindTextures(string folderPath) { if (!Directory.Exists(folderPath)) { Debug.LogError((object)("UT2: Invalid folder path: " + folderPath)); return Array.Empty<Texture2D>(); } List<Texture2D> list = new List<Texture2D>(); string[] files = Directory.GetFiles(folderPath, "*.png", SearchOption.AllDirectories); string[] files2 = Directory.GetFiles(folderPath, "*.jpg", SearchOption.AllDirectories); for (int i = 0; i < files.Length; i++) { if (TryLoadTexture(files[i], out var tex)) { list.Add(tex); } } for (int j = 0; j < files2.Length; j++) { if (TryLoadTexture(files2[j], out var tex2)) { list.Add(tex2); } } return list.ToArray(); } } public static class TriggerUtil { public static void MakeTrigger(Action onEnter, Vector3 pos, Vector3 size, Quaternion? rot = null) { //IL_000d: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) ObjectActivator val = NewTrigger(); ((Component)val).transform.position = pos; ((Component)val).transform.localScale = size; if (rot.HasValue) { ((Component)val).transform.rotation = rot.Value; } val.oneTime = true; val.events.onActivate.AddListener(new UnityAction(onEnter.Invoke)); } public static ObjectActivator NewTrigger() { GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); ((Renderer)val.GetComponent<MeshRenderer>()).enabled = false; ((Collider)val.GetComponent<BoxCollider>()).isTrigger = true; val.layer = LayerMask.NameToLayer("Invisible"); return val.AddComponent<ObjectActivator>(); } } public static class UT2Paths { public static string ModFolder => Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); public static string DataFolder => Path.Combine(ModFolder, "UltraTelephone2_Data"); public static string TextureFolder => Path.Combine(DataFolder, "textures"); public static string TextFolder => Path.Combine(DataFolder, "text"); public static string InternalAssetsFolder => Path.Combine(DataFolder, "internal_assets"); public static void EnsureFolders() { if (!Directory.Exists(InternalAssetsFolder)) { Directory.CreateDirectory(InternalAssetsFolder); } if (!Directory.Exists(DataFolder)) { Directory.CreateDirectory(DataFolder); } if (!Directory.Exists(InternalAssetsFolder)) { Directory.CreateDirectory(InternalAssetsFolder); } if (!Directory.Exists(TextureFolder)) { Directory.CreateDirectory(TextureFolder); } if (!Directory.Exists(TextFolder)) { Directory.CreateDirectory(TextFolder); } } } } namespace CultOfJakito.UltraTelephone2.UI { public class BumpyUI : MonoBehaviour { public float maxBumpScale = 1.4f; private float bumpTime = 0f; private float lastBumpTime = 0f; private Vector3 originalScale; protected void Awake() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) originalScale = ((Component)this).transform.localScale; } public void Bump(float length) { bumpTime = Mathf.Max(0f, length); lastBumpTime = bumpTime; } private void Update() { //IL_004b: 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_0069: 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_0093: Unknown result type (might be due to invalid IL or missing references) if (!(bumpTime <= 0f)) { bumpTime = Mathf.Max(0f, bumpTime - Time.deltaTime); float num = 1f - bumpTime / lastBumpTime; Vector3 localScale = originalScale * (1f + (1f - num * maxBumpScale)); ((Component)this).transform.localScale = localScale; if (bumpTime <= 0f) { ((Component)this).transform.localScale = originalScale; } } } } public class ClimbingText : MonoBehaviour { private TextMeshProUGUI textObj; public float climbSpeed = 0.35f; public AudioSource tickSource; private float lastSetTime = 0f; private long lastCurrentValue; private long targetValue; private long currentValue; public Func<long, string> toString; public TextMeshProUGUI TextObj { get { if ((Object)(object)textObj == (Object)null) { textObj = ((Component)this).GetComponent<TextMeshProUGUI>(); } return textObj; } } private void Update() { if (currentValue != targetValue) { long num = currentValue; float num2 = lastCurrentValue; float num3 = targetValue; float num4 = Time.time - lastSetTime; float num5 = Mathf.Clamp01(num4 / climbSpeed); num5 = Mathf.SmoothStep(0f, 1f, num5); float num6 = Mathf.Lerp(num2, num3, num5); currentValue = Mathf.CeilToInt(num6); if (currentValue - num > 0 && Object.op_Implicit((Object)(object)tickSource)) { tickSource.Play(); } UpdateText(); } } public void UpdateText() { string text = ((toString == null) ? currentValue.ToString("000") : toString(currentValue)); ((TMP_Text)TextObj).text = text; } public void SetTargetValue(long value) { targetValue = value; lastCurrentValue = currentValue; lastSetTime = Time.time; } public void SetValue(long value) { lastSetTime = Time.time; lastCurrentValue = currentValue; targetValue = value; currentValue = value; ((TMP_Text)TextObj).text = ((toString == null) ? currentValue.ToString("000") : toString(currentValue)); } private void OnEnable() { lastSetTime = Time.time; } } public class MoneyCounter : MonoBehaviour { public ClimbingText climbingText; private void Start() { long currentMoney = FakeBank.GetCurrentMoney(); climbingText.toString = FakeBank.PString; climbingText.SetValue(currentMoney); FakeBank.OnMoneyChanged += FakeBank_OnMoneyChanged; } private void FakeBank_OnMoneyChanged(long obj) { climbingText.SetTargetValue(FakeBank.GetCurrentMoney()); } private void OnDestroy() { FakeBank.OnMoneyChanged -= FakeBank_OnMoneyChanged; } } public class ShakeyUI : MonoBehaviour { public float maxShakeRange = 0.5f; private float shakeTime = 0f; private float shakeAmount = 0f; private float lastShakeTime = 0f; private Vector3 originalPos; private bool manualShake = false; protected void Awake() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) originalPos = ((Component)this).transform.position; } public void Shake(float time, float amount) { shakeTime = Mathf.Max(0f, time); lastShakeTime = Mathf.Max(0f, time); shakeAmount = Mathf.Max(0f, amount); } public void SetShaking(bool shaking, float amount) { manualShake = shaking; shakeAmount = Mathf.Clamp01(amount); } private void Update() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) if (!(shakeTime <= 0f) || manualShake) { float num = shakeTime / lastShakeTime; num = ((!manualShake) ? (num * shakeAmount) : shakeAmount); Vector3 val = Random.insideUnitSphere * num * maxShakeRange; val.z = 0f; ((Component)this).transform.position = originalPos + val; if (!manualShake) { shakeTime = Mathf.Max(0f, shakeTime - Time.deltaTime); } if (shakeTime <= 0f) { ((Component)this).transform.position = originalPos; } } } } } namespace CultOfJakito.UltraTelephone2.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("CultOfJakito.UltraTelephone2.Properties.Resources", typeof(Resources).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static byte[] _20230331_153754 { get { object @object = ResourceManager.GetObject("_20230331_153754", resourceCulture); return (byte[])@object; } } internal static byte[] _20230420_163631 { get { object @object = ResourceManager.GetObject("_20230420_163631", resourceCulture); return (byte[])@object; } } internal static byte[] absoluteterror { get { object @object = ResourceManager.GetObject("absoluteterror", resourceCulture); return (byte[])@object; } } internal static byte[] aetsesye { get { object @object = ResourceManager.GetObject("aetsesye", resourceCulture); return (byte[])@object; } } internal static byte[] afarft { get { object @object = ResourceManager.GetObject("afarft", resourceCulture); return (byte[])@object; } } internal static byte[] artworks_dgGS7o4DGuYHt1xX_IjeBqw_t500x500 { get { object @object = ResourceManager.GetObject("artworks_dgGS7o4DGuYHt1xX_IjeBqw_t500x500", resourceCulture); return (byte[])@object; } } internal static byte[] artworks_VZ1hrrVnmieDgPfw_09eQow_t500x500 { get { object @object = ResourceManager.GetObject("artworks_VZ1hrrVnmieDgPfw_09eQow_t500x500", resourceCulture); return (byte[])@object; } } internal static byte[] awdjao { get { object @object = ResourceManager.GetObject("awdjao", resourceCulture); return (byte[])@object; } } internal static byte[] aweaegasgere { get { object @object = ResourceManager.GetObject("aweaegasgere", resourceCulture); return (byte[])@object; } } internal static byte[] awra35as4et5 { get { object @object = ResourceManager.GetObject("awra35as4et5", resourceCulture); return (byte[])@object; } } internal static byte[] badmove { get { object @object = ResourceManager.GetObject("badmove", resourceCulture); return (byte[])@object; } } internal static byte[] baffled { get { object @object = ResourceManager.GetObject("baffled", resourceCulture); return (byte[])@object; } } internal static byte[] bear5 { get { object @object = ResourceManager.GetObject("bear5", resourceCulture); return (byte[])@object; } } internal static byte[] bigassgloopy { get { object @object = ResourceManager.GetObject("bigassgloopy", resourceCulture); return (byte[])@object; } } internal static byte[] Block_Creator_Glass { get { object @object = ResourceManager.GetObject("Block_Creator_Glass", resourceCulture); return (byte[])@object; } } internal static byte[] boi { get { object @object = ResourceManager.GetObject("boi", resourceCulture); return (byte[])@object; } } internal static byte[] bone { get { object @object = ResourceManager.GetObject("bone", resourceCulture); return (byte[])@object; } } internal static string bossBar_prefixes => ResourceManager.GetString("bossBar_prefixes", resourceCulture); internal static string bossBar_suffixes => ResourceManager.GetString("bossBar_suffixes", resourceCulture); internal static byte[] bro { get { object @object = ResourceManager.GetObject("bro", resourceCulture); return (byte[])@object; } } internal static string cantReadWords => ResourceManager.GetString("cantReadWords", resourceCulture); internal static byte[] catalog_wbp { get { object @object = ResourceManager.GetObject("catalog_wbp", resourceCulture); return (byte[])@object; } } internal static byte[] catalog_wbp1 { get { object @object = ResourceManager.GetObject("catalog_wbp1", resourceCulture); return (byte[])@object; } } internal static byte[] CatExperiencee { get { object @object = ResourceManager.GetObject("CatExperiencee", resourceCulture); return (byte[])@object; } } internal static byte[] chartreused { get { object @object = ResourceManager.GetObject("chartreused", resourceCulture); return (byte[])@object; } } internal static byte[] chees1 { get { object @object = ResourceManager.GetObject("chees1", resourceCulture); return (byte[])@object; } } internal static byte[] coconut { get { object @object = ResourceManager.GetObject("coconut", resourceCulture); return (byte[])@object; } } internal static byte[] ComeHere { get { object @object = ResourceManager.GetObject("ComeHere", resourceCulture); return (byte[])@object; } } internal static byte[] cover2__4_ { get { object @object = ResourceManager.GetObject("cover2__4_", resourceCulture); return (byte[])@object; } } internal static byte[] crydeath { get { object @object = ResourceManager.GetObject("crydeath", resourceCulture); return (byte[])@object; } } internal static byte[] DeathImage { get { object @object = ResourceManager.GetObject("DeathImage", resourceCulture); return (byte[])@object; } } internal static byte[] dfgdth { get { object @object = ResourceManager.GetObject("dfgdth", resourceCulture); return (byte[])@object; } } internal static byte[] dog_stare_zoom { get { object @object = ResourceManager.GetObject("dog_stare_zoom", resourceCulture); return (byte[])@object; } } internal static byte[] dogstare0 { get { object @object = ResourceManager.GetObject("dogstare0", resourceCulture); return (byte[])@object; } } internal static byte[] dogstare1 { get { object @object = ResourceManager.GetObject("dogstare1", resourceCulture); return (byte[])@object; } } internal static byte[] drgd { get { object @object = ResourceManager.GetObject("drgd", resourceCulture); return (byte[])@object; } } internal static byte[] drghdtfhftgiu { get { object @object = ResourceManager.GetObject("drghdtfhftgiu", resourceCulture); return (byte[])@object; } } internal static byte[] dug { get { object @object = ResourceManager.GetObject("dug", resourceCulture); return (byte[])@object; } } internal static byte[] dyftuftyuure { get { object @object = ResourceManager.GetObject("dyftuftyuure", resourceCulture); return (byte[])@object; } } internal static byte[] earinfection { get { object @object = ResourceManager.GetObject("earinfection", resourceCulture); return (byte[])@object; } } internal static string enemyNames => ResourceManager.GetString("enemyNames", resourceCulture); internal static byte[] ermcat { get { object @object = ResourceManager.GetObject("ermcat", resourceCulture); return (byte[])@object; } } internal static byte[] F5GRMlEWUAAAiym { get { object @object = ResourceManager.GetObject("F5GRMlEWUAAAiym", resourceCulture); return (byte[])@object; } } internal static byte[] FbyFm47UcAEI1Cq { get { object @object = ResourceManager.GetObject("FbyFm47UcAEI1Cq", resourceCulture); return (byte[])@object; } } internal static byte[] FhOuLBjWIAwab1v { get { object @object = ResourceManager.GetObject("FhOuLBjWIAwab1v", resourceCulture); return (byte[])@object; } } internal static byte[] Fuel { get { object @object = ResourceManager.GetObject("Fuel", resourceCulture); return (byte[])@object; } } internal static byte[] FwM5Y36XoAEO7r8 { get { object @object = ResourceManager.GetObject("FwM5Y36XoAEO7r8", resourceCulture); return (byte[])@object; } } internal static byte[] Fx_3ZYsWcAIDlzG { get { object @object = ResourceManager.GetObject("Fx_3ZYsWcAIDlzG", resourceCulture); return (byte[])@object; } } internal static byte[] gobrae { get { object @object = ResourceManager.GetObject("gobrae", resourceCulture); return (byte[])@object; } } internal static byte[] gorp { get { object @object = ResourceManager.GetObject("gorp", resourceCulture); return (byte[])@object; } } internal static byte[] hakitalightning { get { object @object = ResourceManager.GetObject("hakitalightning", resourceCulture); return (byte[])@object; } } internal static byte[] herobrine { get { object @object = ResourceManager.GetObject("herobrine", resourceCulture); return (byte[])@object; } } internal static byte[] jnjhk { get { object @object = ResourceManager.GetObject("jnjhk", resourceCulture); return (byte[])@object; } } internal static byte[] kettamean { get { object @object = ResourceManager.GetObject("kettamean", resourceCulture); return (byte[])@object; } } internal static byte[] maxresdefault__44_ { get { object @object = ResourceManager.GetObject("maxresdefault__44_", resourceCulture); return (byte[])@object; } } internal static byte[] monkscream { get { object @object = ResourceManager.GetObject("monkscream", resourceCulture); return (byte[])@object; } } internal static byte[] ohdatsJudment { get { object @object = ResourceManager.GetObject("ohdatsJudment", resourceCulture); return (byte[])@object; } } internal static byte[] padrick { get { object @object = ResourceManager.GetObject("padrick", resourceCulture); return (byte[])@object; } } internal static byte[] plink { get { object @object = ResourceManager.GetObject("plink", resourceCulture); return (byte[])@object; } } internal static string ponder => ResourceManager.GetString("ponder", resourceCulture); internal static byte[] pronounssoy { get { object @object = ResourceManager.GetObject("pronounssoy", resourceCulture); return (byte[])@object; } } internal static byte[] r { get { object @object = ResourceManager.GetObject("r", resourceCulture); return (byte[])@object; } } internal static byte[] roachcarving { get { object @object = ResourceManager.GetObject("roachcarving", resourceCulture); return (byte[])@object; } } internal static byte[] scientistshavediscovered { get { object @object = ResourceManager.GetObject("scientistshavediscovered", resourceCulture); return (byte[])@object; } } internal static byte[] sergsrhds { get { object @object = ResourceManager.GetObject("sergsrhds", resourceCulture); return (byte[])@object; } } internal static byte[] shader_unitybuiltinshaders { get { object @object = ResourceManager.GetObject("shader_unitybuiltinshaders", resourceCulture); return (byte[])@object; } } internal static string shiteTips => ResourceManager.GetString("shiteTips", resourceCulture); internal static byte[] skol { get { object @object = ResourceManager.GetObject("skol", resourceCulture); return (byte[])@object; } } internal static byte[] SmartSelect_20211116_174331 { get { object @object = ResourceManager.GetObject("SmartSelect_20211116_174331", resourceCulture); return (byte[])@object; } } internal static byte[] SmartSelect_20211125_164814 { get { object @object = ResourceManager.GetObject("SmartSelect_20211125_164814", resourceCulture); return (byte[])@object; } } internal static byte[] SmartSelect_s20210321_152814 { get { object @object = ResourceManager.GetObject("SmartSelect_s20210321_152814", resourceCulture); return (byte[])@object; } } internal static byte[] soypoint { get { object @object = ResourceManager.GetObject("soypoint", resourceCulture); return (byte[])@object; } } internal static string splashes => ResourceManager.GetString("splashes", resourceCulture); internal static byte[] spongecry { get { object @object = ResourceManager.GetObject("spongecry", resourceCulture); return (byte[])@object; } } internal static byte[] stare { get { object @object = ResourceManager.GetObject("stare", resourceCulture); return (byte[])@object; } } internal static byte[] steamhappy { get { object @object = ResourceManager.GetObject("steamhappy", resourceCulture); return (byte[])@object; } } internal static byte[] steamhappy1 { get { object @object = ResourceManager.GetObject("steamhappy1", resourceCulture); return (byte[])@object; } } internal static byte[] Stinker { get { object @object = ResourceManager.GetObject("Stinker", resourceCulture); return (byte[])@object; } } internal static byte[] t56f7yit657yf7t6fyiuk { get { object @object = ResourceManager.GetObject("t56f7yit657yf7t6fyiuk", resourceCulture); return (byte[])@object; } } internal static byte[] tarwaee { get { object @object = ResourceManager.GetObject("tarwaee", resourceCulture); return (byte[])@object; } } internal static byte[] telephone2_assets_all { get { object @object = ResourceManager.GetObject("telephone2_assets_all", resourceCulture); return (byte[])@object; } } internal static byte[] telephone2_scenes_all { get { object @object = ResourceManager.GetObject("telephone2_scenes_all", resourceCulture); return (byte[])@object; } } internal static byte[] twodabloons { get { object @object = ResourceManager.GetObject("twodabloons", resourceCulture); return (byte[])@object; } } internal static byte[] ultratelephone2_monoscripts { get { object @object = ResourceManager.GetObject("ultratelephone2_monoscripts", resourceCulture); return (byte[])@object; } } internal static byte[] unnamed__4_ { get { object @object = ResourceManager.GetObject("unnamed__4_", resourceCulture); return (byte[])@object; } } internal static byte[] vgvhure { get { object @object = ResourceManager.GetObject("vgvhure", resourceCulture); return (byte[])@object; } } internal static string wordlist_10000 => ResourceManager.GetString("wordlist.10000", resourceCulture); internal static byte[] yeahlmao { get { object @object = ResourceManager.GetObject("yeahlmao", resourceCulture); return (byte[])@object; } } internal Resources() { } } } namespace CultOfJakito.UltraTelephone2.Patches { [HarmonyPatch] public static class AlterFriendAvatars { private static Texture2D[] s_profileImages; [Configgable("Patches", "Alter Leaderboard Avatars", 0, null)] private static ConfigToggle s_enabled = new ConfigToggle(true); private static string s_profilePicsPath => Path.Combine(UT2Paths.TextureFolder, "ProfilePictures"); public static void Load() { if (!Directory.Exists(s_profilePicsPath)) { Directory.CreateDirectory(s_profilePicsPath); ValidateBuiltInImage(Path.Combine(s_profilePicsPath, "boi.jpg"), Resources.boi); ValidateBuiltInImage(Path.Combine(s_profilePicsPath, "awdjao.png"), Resources.awdjao); ValidateBuiltInImage(Path.Combine(s_profilePicsPath, "padrick.jpg"), Resources.padrick); ValidateBuiltInImage(Path.Combine(s_profilePicsPath, "spongecry.png"), Resources.spongecry); ValidateBuiltInImage(Path.Combine(s_profilePicsPath, "scientistshavediscovered.png"), Resources.scientistshavediscovered); ValidateBuiltInImage(Path.Combine(s_profilePicsPath, "roachcarving.png"), Resources.roachcarving); ValidateBuiltInImage(Path.Combine(s_profilePicsPath, "pronounssoy.png"), Resources.pronounssoy); ValidateBuiltInImage(Path.Combine(s_profilePicsPath, "plink.png"), Resources.plink); ValidateBuiltInImage(Path.Combine(s_profilePicsPath, "steamhappy.png"), Resources.steamhappy); ValidateBuiltInImage(Path.Combine(s_profilePicsPath, "twodabloons.png"), Resources.twodabloons); ValidateBuiltInImage(Path.Combine(s_profilePicsPath, "monkscream.jpg"), Resources.monkscream); ValidateBuiltInImage(Path.Combine(s_profilePicsPath, "ermcat.png"), Resources.ermcat); ValidateBuiltInImage(Path.Combine(s_profilePicsPath, "dogstare1.jpeg"), Resources.dogstare1); ValidateBuiltInImage(Path.Combine(s_profilePicsPath, "dogstare0.png"), Resources.dogstare0); ValidateBuiltInImage(Path.Combine(s_profilePicsPath, "bigassgloopy.png"), Resources.bigassgloopy); ValidateBuiltInImage(Path.Combine(s_profilePicsPath, "hakitalightning.png"), Resources.hakitalightning); } s_profileImages = TextureHelper.FindTextures(s_profilePicsPath); } private static void ValidateBuiltInImage(string filePath, byte[] data) { if (!File.Exists(filePath)) { File.WriteAllBytes(filePath, data); } } [HarmonyPatch(typeof(SteamController), "FetchAvatar")] [HarmonyPrefix] public static bool OnAvatarFetch(SteamController __instance, RawImage target, Friend user) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) if (!((ConfigValueElement<bool>)(object)s_enabled).Value || s_profileImages == null || s_profileImages.Length == 0) { return true; } string name = ((Friend)(ref user)).Name; UniRandom uniRandom = new UniRandom(new SeedBuilder().WithGlobalSeed().WithSeed(name).GetSeed()); target.texture = (Texture)(object)uniRandom.SelectRandom(s_profileImages); ((Transform)((Graphic)target).rectTransform).localScale = new Vector3(1f, 1f, 1f); return false; } } [HarmonyPatch] public static class AltMarksmanFoghorn { [Configgable("Patches", "Alt Marksman Foghorn", 0, null)] private static ConfigToggle s_enabled = new ConfigToggle(true); [HarmonyPatch(typeof(Revolver), "OnEnable")] [HarmonyPostfix] public static void OnStart(Revolver __instance) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) if (((ConfigValueElement<bool>)(object)s_enabled).Value && __instance.altVersion && __instance.gunVariation == 1) { AudioSource val = ((Component)__instance).transform.LocateComponentInChildren<AudioSource>("FOGHORN"); if ((Object)(object)val == (Object)null) { GameObject val2 = new GameObject("FOGHORN"); val2.transform.SetParent(((Component)__instance).transform); val2.transform.localPosition = Vector3.zero; val = val2.AddComponent<AudioSource>(); val.ConfigureForUltrakill(); val.clip = HydraAssets.FogHorn; val.loop = false; val.volume = 1f; val.spatialBlend = 1f; } val.Play(); } } } [HarmonyPatch] public static class CaptchaOnPlayAttempt { [Configgable("Patches", "Captcha Play Button", 0, null)] private static ConfigToggle s_enabled = new ConfigToggle(true); [HarmonyPatch(typeof(CanvasController), "Awake")] [HarmonyPostfix] private static void OnCanvasAwake(CanvasController __instance) { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown if (!((ConfigValueElement<bool>)(object)s_enabled).Value || SceneHelper.CurrentScene != "Main Menu") { return; } Button playButton = ((IEnumerable<Button>)((Component)((Component)__instance).transform).GetComponentsInChildren<Button>()).FirstOrDefault((Func<Button, bool>)((Button x) => ((Object)x).name == "Continue" && ((Component)x).transform.HasParentalPath("Main Menu (1)/Continue"))); if ((Object)(object)playButton == (Object)null) { return; } ButtonClickedEvent bce = playButton.onClick; playButton.m_OnClick = new ButtonClickedEvent(); ((UnityEvent)playButton.onClick).AddListener((UnityAction)delegate { CaptchaManager.ShowCaptcha(delegate(bool r) { if (r) { ((UnityEvent)bce).Invoke(); playButton.m_OnClick = bce; } else { CaptchaManager.ShowCaptcha(); } }); }); } } [HarmonyPatch(typeof(Clock))] public static class ClockIncorrectTime { [Configgable("Patches", "Broken Clock", 0, null)] private static ConfigToggle s_enabled = new ConfigToggle(true); private static int? s_offset = null; [HarmonyPatch(typeof(Clock), "Update")] [HarmonyPrefix] public static bool OnUpdate(Clock __instance) { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) if (!((ConfigValueElement<bool>)(object)s_enabled).Value) { return true; } if (!s_offset.HasValue) { s_offset = UltraTelephoneTwo.Instance.Random.Range(-720, 720); } DateTime dateTime = DateTime.Now.AddMinutes(s_offset.Value); float num = dateTime.Hour; float num2 = dateTime.Minute; float num3 = dateTime.Second; __instance.hour.localRotation = Quaternion.Euler(0f, (num % 12f / 12f + num2 / 1440f) * 360f, 0f); __instance.minute.localRotation = Quaternion.Euler(0f, (num2 / 60f + num3 / 3600f) * 360f, 0f); return false; } } [HarmonyPatch] public static class DeleteLevelsFromExistence { [Configgable("Patches", "Disable Some Levels", 0, null)] private static ConfigToggle s_enabled = new ConfigToggle(true); [HarmonyPatch(typeof(LayerSelect), "Awake")] [HarmonyPostfix] public static void OnAwake(LayerSelect __instance) { if (!((ConfigValueElement<bool>)(object)s_enabled).Value) { return; } int layerNumber = __instance.layerNumber; int globalSeed = UniRandom.GlobalSeed; UniRandom uniRandom = new UniRandom(globalSeed ^ layerNumber); if (!uniRandom.Chance(0.7f)) { LevelSelectPanel[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<LevelSelectPanel>(true); int num = uniRandom.Next(0, componentsInChildren.Length); for (int i = 0; i < componentsInChildren.Length; i++) { ((Component)componentsInChildren[i]).gameObject.SetActive(i != num); } } } } [HarmonyPatch] public static class EnemySquishSound { [Configgable("Patches", "Maurice Splat Noise", 0, null)] private static ConfigToggle s_enabled = new ConfigToggle(true); [HarmonyPatch(typeof(EnemyIdentifier), "FallOnEnemy")] [HarmonyPrefix] public static void PreSplat(EnemyIdentifier eid, out bool __state) { __state = false; if (((ConfigValueElement<bool>)(object)s_enabled).Value && !((Object)(object)eid == (Object)null)) { __state = eid.dead; } } [HarmonyPatch(typeof(EnemyIdentifier), "FallOnEnemy")] [HarmonyPostfix] public static void PostSplat(EnemyIdentifier eid, bool __state) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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) if (((ConfigValueElement<bool>)(object)s_enabled).Value && !((Object)(object)eid == (Object)null) && !__state && eid.dead) { Vector3 position = ((Component)eid).transform.position; AudioClip splatSound = HydraAssets.SplatSound; if (!((Object)(object)splatSound == (Object)null)) { splatSound.PlaySound(position); } } } } [HarmonyPatch] public static class EnterCasinoPatch { public const string CASINO_SCENE_NAME = "Assets/Telephone 2/Scenes/CASINO.unity"; [Configgable("Fun", "Casino", 0, null)] private static ConfigToggle s_enabled = new ConfigToggle(true); [HarmonyPatch(typeof(FinalRank), "LevelChange")] [HarmonyPrefix] private static bool OnFinalPit(FinalRank __instance) { UniRandom uniRandom = new UniRandom(new SeedBuilder().WithGlobalSeed().WithSeed(MonoSingleton<StatsManager>.Instance.kills)); float chance = 0.33f; if (!UT2SaveData.SaveData.BeenToCasino) { chance = 0.8f; } if (!uniRandom.Chance(chance)) { return true; } UT2SaveData.SaveData.BeenToCasino = true; UT2SaveData.MarkDirty(); AddressableManager.LoadSceneUnsanitzed("Assets/Telephone 2/Scenes/CASINO.unity"); return false; } } [HarmonyPatch] public static class FishRocket { [Configgable("Patches", "Fish Rocket", 0, null)] private static ConfigToggle s_enabled = new ConfigToggle(true); [HarmonyPatch(typeof(Grenade), "Start")] [HarmonyPostfix] private static void OnStart(Grenade __instance) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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 (!((ConfigValueElement<bool>)(object)s_enabled).Value || !__instance.rocket) { return; } MeshRenderer val = ((Component)__instance).transform.LocateComponentInChildren<MeshRenderer>("Model"); if (!((Object)(object)val == (Object)null)) { ((Renderer)val).enabled = false; GameObject val2 = Object.Instantiate<GameObject>(HydraAssets.RocketFishModel, ((Component)__instance).transform); val2.transform.localPosition = new Vector3(0f, 0f, 3.18f); val2.transform.localRotation = Quaternion.Euler(-89.98f, 0f, 0f); val2.transform.localScale = Vector3.one * 155.0367f; OutdoorsChecker componentInChildren = ((Component)__instance).GetComponentInChildren<OutdoorsChecker>(); if ((Object)(object)componentInChildren != (Object)null) { GameObject[] targets = componentInChildren.targets; GameObject[] array = (GameObject[])(object)new GameObject[targets.Length + 1]; Array.Copy(targets, array, targets.Length); array[targets.Length] = val2; componentInChildren.targets = array; } } } } public static class HideousKojima { private static ConfigToggle s_enabled = new ConfigToggle(true); public static void CreateTheBeast(Mass __instance) { if (((ConfigValueElement<bool>)(object)s_enabled).Value) { } } } [HarmonyPatch] public static class HoneyBunGrenades { [Configgable("Patches", "Honey Bun Grenades", 0, null)] private static ConfigToggle s_enabled = new ConfigToggle(true); [HarmonyPatch(typeof(Grenade), "Start")] [HarmonyPostfix] private static void OnStart(Grenade __instance) { //IL_0067: 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_0089: 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) if (((ConfigValueElement<bool>)(object)s_enabled).Value && !__instance.rocket) { MeshRenderer component = ((Component)__instance).GetComponent<MeshRenderer>(); if (!((Object)(object)component == (Object)null)) { ((Renderer)component).enabled = false; GameObject val = Object.Instantiate<GameObject>(HydraAssets.HoneyBunModel, ((Component)__instance).transform); val.transform.localPosition = new Vector3(0f, 0f, 0.332f); val.transform.localRotation = Quaternion.identity; val.transform.localScale = Vector3.one * 1.72f; } } } } [HarmonyPatch] public static class HoneyDrones { [Configgable("Patches", "Bee Drones", 0, null)] private static ConfigToggle s_enabled = new ConfigToggle(true); [HarmonyPatch(typeof(Drone), "Start")] [HarmonyPostfix] public static void OnStart(Drone __instance) { if (((ConfigValueElement<bool>)(object)s_enabled).Value) { MakeDroneBee(__instance); } } private static void MakeDroneBee(Drone __instance) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 EnemyIdentifier val = default(EnemyIdentifier); if (((Component)__instance).TryGetComponent<EnemyIdentifier>(ref val) && (int)val.enemyType == 1) { AudioSource val2 = ((Component)__instance).gameObject.AddComponent<AudioSource>(); val2.clip = HydraAssets.BeeAudioLoop; val2.loop = true; val2.volume = 1f; val2.spatialBlend = 1f; val2.minDistance = 10f; val2.maxDistance = 50f; val2.outputAudioMixerGroup = MonoSingleton<AudioMixerController>.Instance.allSound.outputAudioMixerGroup; val2.Play(); } } } [HarmonyPatch] public static class IncomeTaxPatch { [Configgable("Patches", "Taxes", 0, null)] private static ConfigToggle s_enabled = new ConfigToggle(true); private static int s_taxesTakenBuffer = 0; [HarmonyPatch(typeof(FinalRank), "AddPoints")] [HarmonyPrefix] public static void TaxDeduct(FinalRank __instance, ref int points) { if (((ConfigValueElement<bool>)(object)s_enabled).Value) { float num = (Utility.UserIsDeveloper() ? 0.15f : 0.3f); float num2 = (float)points * num; int num3 = Mathf.CeilToInt(num2); s_taxesTakenBuffer += num3; points = Mathf.Max(0, points - num3); } } [HarmonyPatch(typeof(FinalRank), "Appear")] [HarmonyPostfix] public static void TaxAppear(FinalRank __instance) { if (((ConfigValueElement<bool>)(object)s_enabled).Value && s_taxesTakenBuffer > 0) { int taxes = s_taxesTakenBuffer; s_taxesTakenBuffer = 0; TMP_Text extraInfo = __instance.extraInfo; extraInfo.text += GetTaxInfoString(taxes); } } private static string GetTaxInfoString(int taxes) { string value = (Utility.UserIsDeveloper() ? "15%" : "30%"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("<color=red>- "); stringBuilder.Append(FakeBank.FormatMoney(taxes)); stringBuilder.Append(" TAXES ["); stringBuilder.Append(value); stringBuilder.Append("]</color>\n"); return stringBuilder.ToString(); } } [HarmonyPatch] public static class InstantLandmine { [Configgable("Patches", "Realistic Landmines", 0, null)] private static ConfigToggle s_enabled = new ConfigToggle(true); [HarmonyPatch(typeof(Landmine), "Activate")] [HarmonyPostfix] public static void OnActivate(Landmine __instance) { if (((ConfigValueElement<bool>)(object)s_enabled).Value) { __instance.Explode(); } } } [HarmonyPatch] public static class MannequinKrabs { [Configgable("Patches", "Mannequins Steppies", 0, null)] private static ConfigToggle s_enabled = new ConfigToggle(true); [HarmonyPatch(typeof(Mannequin), "Start")] [HarmonyPostfix] private static void OnStart(Mannequin __instance) { if (((ConfigValueElement<bool>)(object)s_enabled).Value) { __instance.skitterSound.clip = HydraAssets.MannequinSkitterNoise; __instance.skitterSound.dopplerLevel = 0f; } } } [HarmonyPatch] public static class MindflayerGlitch { [Configgable("Patches", "Mindflayer Glitch", 0, null)] private static ConfigToggle s_enabled = new ConfigToggle(true); [HarmonyPatch(typeof(Mindflayer), "Start")] [HarmonyPostfix] public static void OnStart(Mindflayer __instance) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_0085: 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_00a7: 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_00bd: Expected O, but got Unknown //IL_00e4: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) if (((ConfigValueElement<bool>)(object)s_enabled).Value) { Transform val = ((Component)__instance).transform.LocateComponentInChildren<Transform>("s