Decompiled source of CrowdControl ContentWarning v1.0.6
BepInEx/plugins/CrowdControl.dll
Decompiled 2 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Net; using System.Net.Sockets; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using System.Threading; using BepInEx; using BepInEx.Logging; using DefaultNamespace; using ExitGames.Client.Photon; using HarmonyLib; using MyBox; using Newtonsoft.Json; using Photon.Pun; using Photon.Realtime; using Unity.Mathematics; using UnityEngine; using UnityEngine.SceneManagement; using Zorro.Core; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("LethalCompanyTestMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LethalCompanyTestMod")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("d4f6b961-e8ae-4e4b-950c-37644e42d4ca")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace BepinControl; public enum TimedType { PLAYER_ULTRA_SLOW, PLAYER_SLOW, PLAYER_FAST, PLAYER_ULTRA_FAST, PLAYER_FREEZE, JUMP_LOW, JUMP_HIGH, JUMP_ULTRA, WIDE_CAMERA, NARROW_CAMERA, FLIP_CAMERA, INF_STAM, NO_STAM, INVUL, OHKO } public class Timed { public TimedType type; private float oldjump; private float oldmove; public static List<(TimedType, string)> msgs = new List<(TimedType, string)>(); public static int msgcool = 0; private static int frames = 0; public static void msgtick() { if (msgcool > 0) { msgcool--; } else if (msgs.Count > 0) { (TimedType, string) tuple = msgs[0]; msgs.RemoveAt(0); Singleton<HelmetText>.Instance.SetHelmetText(tuple.Item2 ?? "", 1.9f); msgcool = 180; } } public Timed(TimedType t) { type = t; } public void addEffect() { switch (type) { case TimedType.INF_STAM: msgs.Add((type, "INFINITE STAMINA")); break; case TimedType.NO_STAM: msgs.Add((type, "NO STAMINA")); break; case TimedType.INVUL: msgs.Add((type, "INVULNERABLE")); break; case TimedType.OHKO: msgs.Add((type, "ONE HIT KO")); break; case TimedType.PLAYER_ULTRA_SLOW: case TimedType.PLAYER_SLOW: case TimedType.PLAYER_FAST: case TimedType.PLAYER_ULTRA_FAST: case TimedType.PLAYER_FREEZE: TestMod.ActionQueue.Enqueue(delegate { oldmove = Player.localPlayer.refs.controller.movementForce; }); break; case TimedType.JUMP_LOW: TestMod.ActionQueue.Enqueue(delegate { msgs.Add((type, "LOW JUMP")); oldjump = Player.localPlayer.refs.controller.jumpImpulse; Player.localPlayer.refs.controller.jumpImpulse = oldjump / 3f; }); break; case TimedType.JUMP_HIGH: TestMod.ActionQueue.Enqueue(delegate { msgs.Add((type, "HIGH JUMP")); oldjump = Player.localPlayer.refs.controller.jumpImpulse; Player.localPlayer.refs.controller.jumpImpulse = oldjump * 4f; }); break; case TimedType.JUMP_ULTRA: TestMod.ActionQueue.Enqueue(delegate { msgs.Add((type, "HIGH JUMP")); oldjump = Player.localPlayer.refs.controller.jumpImpulse; Player.localPlayer.refs.controller.jumpImpulse = oldjump * 8f; }); break; case TimedType.FLIP_CAMERA: TestMod.ActionQueue.Enqueue(delegate { //IL_000f: Unknown result type (might be due to invalid IL or missing references) ((Component)(Camera)CrowdDelegates.getProperty(MainCamera.instance, "cam")).transform.Rotate(0f, 0f, 180f); }); break; case TimedType.WIDE_CAMERA: case TimedType.NARROW_CAMERA: break; } } public void removeEffect() { switch (type) { case TimedType.OHKO: TestMod.ActionQueue.Enqueue(delegate { Player.localPlayer.CallHeal(PlayerData.maxHealth - 0.01f); }); break; case TimedType.FLIP_CAMERA: TestMod.ActionQueue.Enqueue(delegate { //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_001a: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) Camera val = (Camera)CrowdDelegates.getProperty(MainCamera.instance, "cam"); Vector3 position = ((Component)val).transform.position; Quaternion val2 = Quaternion.Euler(0f, 0f, 0f); ((Component)val).transform.SetPositionAndRotation(position, val2); }); break; case TimedType.WIDE_CAMERA: case TimedType.NARROW_CAMERA: TestMod.ActionQueue.Enqueue(delegate { CrowdDelegates.setProperty(MainCamera.instance, "baseFOV", 70f); }); break; case TimedType.PLAYER_ULTRA_SLOW: case TimedType.PLAYER_SLOW: case TimedType.PLAYER_FAST: case TimedType.PLAYER_ULTRA_FAST: case TimedType.PLAYER_FREEZE: TestMod.ActionQueue.Enqueue(delegate { Player.localPlayer.refs.controller.movementForce = oldmove; }); break; case TimedType.JUMP_LOW: case TimedType.JUMP_HIGH: case TimedType.JUMP_ULTRA: TestMod.ActionQueue.Enqueue(delegate { Player.localPlayer.refs.controller.jumpImpulse = oldjump; }); break; case TimedType.INF_STAM: case TimedType.NO_STAM: case TimedType.INVUL: break; } } public void tick() { frames++; switch (type) { case TimedType.INVUL: TestMod.ActionQueue.Enqueue(delegate { if (Player.localPlayer.data.health < PlayerData.maxHealth) { CrowdDelegates.callFunc(Player.localPlayer, "Heal", new object[1] { PlayerData.maxHealth }); } }); break; case TimedType.OHKO: TestMod.ActionQueue.Enqueue(delegate { //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (Player.localPlayer.data.health > 1f) { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(0f, 0f, 0f); CrowdDelegates.callFunc(Player.localPlayer, "CallTakeDamageAndAddForceAndFall", new object[3] { Player.localPlayer.data.health - 1f, val, 0 }); } }); break; case TimedType.INF_STAM: TestMod.ActionQueue.Enqueue(delegate { Player.localPlayer.data.currentStamina = 10f; }); break; case TimedType.NO_STAM: TestMod.ActionQueue.Enqueue(delegate { Player.localPlayer.data.currentStamina = 0f; }); break; case TimedType.WIDE_CAMERA: TestMod.ActionQueue.Enqueue(delegate { CrowdDelegates.setProperty(MainCamera.instance, "baseFOV", 100f); }); break; case TimedType.NARROW_CAMERA: TestMod.ActionQueue.Enqueue(delegate { CrowdDelegates.setProperty(MainCamera.instance, "baseFOV", 40f); }); break; case TimedType.PLAYER_ULTRA_SLOW: TestMod.ActionQueue.Enqueue(delegate { Player.localPlayer.refs.controller.movementForce = 2.5f; }); break; case TimedType.PLAYER_FREEZE: TestMod.ActionQueue.Enqueue(delegate { Player.localPlayer.refs.controller.movementForce = 0f; }); break; case TimedType.PLAYER_SLOW: TestMod.ActionQueue.Enqueue(delegate { Player.localPlayer.refs.controller.movementForce = 5f; }); break; case TimedType.PLAYER_FAST: TestMod.ActionQueue.Enqueue(delegate { Player.localPlayer.refs.controller.movementForce = 20f; }); break; case TimedType.PLAYER_ULTRA_FAST: TestMod.ActionQueue.Enqueue(delegate { Player.localPlayer.refs.controller.movementForce = 40f; }); break; case TimedType.JUMP_LOW: case TimedType.JUMP_HIGH: case TimedType.JUMP_ULTRA: case TimedType.FLIP_CAMERA: break; } } } public class TimedThread { public static List<TimedThread> threads = new List<TimedThread>(); public readonly Timed effect; public int duration; public int remain; public int id; public bool paused; public static bool isRunning(TimedType t) { foreach (TimedThread thread in threads) { if (thread.effect.type == t) { return true; } } return false; } public static void tick() { foreach (TimedThread thread in threads) { if (!thread.paused) { thread.effect.tick(); } } } public static void addTime(int duration) { try { lock (threads) { foreach (TimedThread thread in threads) { Interlocked.Add(ref thread.duration, duration + 5); if (!thread.paused) { int dur = Volatile.Read(ref thread.remain); new TimedResponse(thread.id, dur, CrowdResponse.Status.STATUS_PAUSE).Send(ControlClient.Socket); thread.paused = true; } } } } catch (Exception ex) { TestMod.mls.LogInfo((object)ex.ToString()); } } public static void tickTime(int duration) { try { lock (threads) { foreach (TimedThread thread in threads) { int num = Volatile.Read(ref thread.remain); num -= duration; if (num < 0) { num = 0; } Volatile.Write(ref thread.remain, num); } } } catch (Exception ex) { TestMod.mls.LogInfo((object)ex.ToString()); } } public static void unPause() { try { lock (threads) { foreach (TimedThread thread in threads) { if (thread.paused) { int dur = Volatile.Read(ref thread.remain); new TimedResponse(thread.id, dur, CrowdResponse.Status.STATUS_RESUME).Send(ControlClient.Socket); thread.paused = false; } } } } catch (Exception ex) { TestMod.mls.LogInfo((object)ex.ToString()); } } public TimedThread(int id, TimedType type, int duration) { effect = new Timed(type); this.duration = duration; remain = duration; this.id = id; paused = false; try { lock (threads) { threads.Add(this); } } catch (Exception ex) { TestMod.mls.LogInfo((object)ex.ToString()); } } public void Run() { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; effect.addEffect(); try { for (int num = Volatile.Read(ref duration); num > 0; num = Volatile.Read(ref duration)) { Interlocked.Add(ref duration, -num); Thread.Sleep(num); } effect.removeEffect(); lock (threads) { threads.Remove(this); } new TimedResponse(id, 0, CrowdResponse.Status.STATUS_STOP).Send(ControlClient.Socket); } catch (Exception ex) { TestMod.mls.LogInfo((object)ex.ToString()); } } } [BepInPlugin("WarpWorld.CrowdControl", "Crowd Control", "1.0.1.0")] public class TestMod : BaseUnityPlugin, IOnEventCallback { private const string modGUID = "WarpWorld.CrowdControl"; private const string modName = "Crowd Control"; private const string modVersion = "1.0.1.0"; private readonly Harmony harmony = new Harmony("WarpWorld.CrowdControl"); public static ManualLogSource mls; internal static TestMod Instance = null; private ControlClient client; public static RoundSpawner spawner = null; public static List<IBudgetCost> spawns = new List<IBudgetCost>(); public static Random rnd = new Random(); public static List<string> comments = new List<string>(); private const int MSG_CC = 33; public static Queue<Action> ActionQueue = new Queue<Action>(); private void Awake() { Instance = this; mls = Logger.CreateLogSource("Crowd Control"); mls.LogInfo((object)"Loaded WarpWorld.CrowdControl. Patching."); harmony.PatchAll(typeof(TestMod)); mls.LogInfo((object)"Initializing Crowd Control"); try { client = new ControlClient(); new Thread(client.NetworkLoop).Start(); new Thread(client.RequestLoop).Start(); } catch (Exception ex) { mls.LogInfo((object)("CC Init Error: " + ex.ToString())); } mls.LogInfo((object)"Crowd Control Initialized"); mls = ((BaseUnityPlugin)this).Logger; } private void Update() { if (ActionQueue.Count > 0) { ActionQueue.Dequeue()(); } lock (TimedThread.threads) { Timed.msgtick(); foreach (TimedThread thread in TimedThread.threads) { if (!thread.paused) { thread.effect.tick(); } } } } public static void SendPlayerStats(Player player) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)1 }; PhotonNetwork.RaiseEvent((byte)33, (object)new object[4] { "stats", Player.localPlayer.refs.view.ViewID, Player.localPlayer.data.remainingOxygen, Player.localPlayer.data.health }, val, SendOptions.SendReliable); } public static void SendRoundStats() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)1 }; PhotonNetwork.RaiseEvent((byte)33, (object)new object[3] { "round", SurfaceNetworkHandler.RoomStats.CurrentQuota, SurfaceNetworkHandler.RoomStats.Money }, val, SendOptions.SendReliable); } public static void SendGiveItem(Player player, byte item) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)1 }; PhotonNetwork.RaiseEvent((byte)33, (object)new object[3] { "item", player.refs.view.ViewID, item }, val, SendOptions.SendReliable); } public static void SendSpawn(Player player, string code) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)1 }; PhotonNetwork.RaiseEvent((byte)33, (object)new object[3] { "spawn", player.refs.view.ViewID, code }, val, SendOptions.SendReliable); } public static void SendKill(Player player) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)1 }; PhotonNetwork.RaiseEvent((byte)33, (object)new object[2] { "kill", player.refs.view.ViewID }, val, SendOptions.SendReliable); } public static void SendTele(Player from, Player to) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)1 }; PhotonNetwork.RaiseEvent((byte)33, (object)new object[3] { "tele", from.refs.view.ViewID, to.refs.view.ViewID }, val, SendOptions.SendReliable); } public static void SendTeleBell(Player from) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)1 }; PhotonNetwork.RaiseEvent((byte)33, (object)new object[2] { "telebell", from.refs.view.ViewID }, val, SendOptions.SendReliable); } public void OnEvent(EventData photonEvent) { //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Expected O, but got Unknown //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_04cf: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: Expected O, but got Unknown //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_0516: Unknown result type (might be due to invalid IL or missing references) //IL_0520: Unknown result type (might be due to invalid IL or missing references) //IL_0546: Unknown result type (might be due to invalid IL or missing references) //IL_0558: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) try { if (photonEvent.Code != 33) { return; } object[] array = (object[])photonEvent.CustomData; string text = (string)array[0]; if (text == null) { return; } switch (text.Length) { case 5: switch (text[1]) { case 'p': if (text == "spawn" && Player.localPlayer.refs.view.ViewID == (int)array[1]) { float num = 15f; RaycastHit val9 = HelperFunctions.LineCheck(((Component)MainCamera.instance).transform.position, ((Component)MainCamera.instance).transform.position + ((Component)MainCamera.instance).transform.forward * num, (LayerType)1, 0f); Vector3 val10 = ((Component)MainCamera.instance).transform.position + ((Component)MainCamera.instance).transform.forward * num; if ((Object)(object)((RaycastHit)(ref val9)).collider != (Object)null) { val10 = ((RaycastHit)(ref val9)).point; } val10 = HelperFunctions.GetGroundPos(val10 + Vector3.up * 1f, (LayerType)1, 0f); PhotonNetwork.Instantiate((string)array[2], val10, quaternion.op_Implicit(quaternion.identity), (byte)0, (object[])null); } break; case 't': { if (!(text == "stats")) { break; } for (int k = 0; k < PlayerHandler.instance.players.Count; k++) { Player val2 = PlayerHandler.instance.players[k]; if (val2.refs.view.ViewID == (int)array[1]) { val2.data.remainingOxygen = (float)array[2]; val2.data.health = (float)array[3]; break; } } break; } case 'o': if (text == "round") { CrowdDelegates.setProperty(SurfaceNetworkHandler.RoomStats, "currentQuoutaInternal", (int)array[1]); SurfaceNetworkHandler.RoomStats.AddMoney((int)array[2] - SurfaceNetworkHandler.RoomStats.Money); } break; } break; case 4: switch (text[0]) { case 't': { if (!(text == "tele") || Player.localPlayer.refs.view.ViewID != (int)array[1]) { break; } for (int j = 0; j < PlayerHandler.instance.players.Count; j++) { Player val2 = PlayerHandler.instance.players[j]; if (val2.refs.view.ViewID == (int)array[2]) { CrowdDelegates.callFunc(Player.localPlayer.refs.ragdoll, "MoveAllRigsInDirection", val2.data.groundPos - Player.localPlayer.data.groundPos); break; } } break; } case 'k': if (text == "kill" && Player.localPlayer.refs.view.ViewID == (int)array[1]) { CrowdDelegates.callFunc(Player.localPlayer, "CallDie", null); } break; case 'i': { if (!(text == "item") || !PhotonNetwork.IsMasterClient) { break; } byte b = (byte)array[2]; Player val2 = null; for (int i = 0; i < PlayerHandler.instance.players.Count; i++) { if (PlayerHandler.instance.players[i].refs.view.ViewID == (int)array[1]) { val2 = PlayerHandler.instance.players[i]; break; } } if (!Object.op_Implicit((Object)(object)val2)) { break; } ItemInstanceData val3 = new ItemInstanceData(Guid.NewGuid()); Vector3 position = ((Component)val2).transform.position; PlayerInventory val4 = default(PlayerInventory); if (!val2.TryGetInventory(ref val4)) { break; } Pickup val5 = PickupHandler.CreatePickup(b, val3, position, Random.rotation, (Vector3.up + Random.onUnitSphere) * 2f, Random.onUnitSphere * 5f); Item val6 = default(Item); if (ItemDatabase.TryGetItemFromID(b, ref val6)) { ItemInstanceData val7 = ((ItemInstanceData)CrowdDelegates.getProperty(val5, "instanceData")).Copy(); InventorySlot val8 = default(InventorySlot); if (val4.TryAddItem(new ItemDescriptor(val6, val7), ref val8)) { val2.refs.view.RPC("RPC_SelectSlot", val2.refs.view.Owner, new object[1] { val8.SlotID }); val5.m_photonView.RPC("RPC_Remove", (RpcTarget)2, Array.Empty<object>()); val4.SyncInventoryToOthers(); } } break; } } break; case 8: if (text == "telebell" && Player.localPlayer.refs.view.ViewID == (int)array[1]) { Transform val = (Transform)CrowdDelegates.callAndReturnFunc(SpawnHandler.Instance, "GetSpawnPoint", (object)(Spawns)3); CrowdDelegates.callFunc(Player.localPlayer.refs.ragdoll, "MoveAllRigsInDirection", val.position - Player.localPlayer.data.groundPos); } break; case 6: case 7: break; } } catch (Exception) { } } private void OnEnable() { PhotonNetwork.AddCallbackTarget((object)this); } private void OnDisable() { PhotonNetwork.RemoveCallbackTarget((object)this); } [HarmonyPatch(typeof(Player), "FixedUpdate")] [HarmonyPrefix] private static void RunEffects() { } [HarmonyPatch(typeof(RoundSpawner), "SpawnRound")] [HarmonyPrefix] private static void Spawning(RoundSpawner __instance) { spawner = __instance; } [HarmonyPatch(typeof(ContentBuffer), "GenerateComments")] [HarmonyPostfix] private static void Comments(List<Comment> __result) { string[] array = new string[9] { "<playername> are you using Crowd Control?", "Wait? Is this Crowd Control enabled?", "Crowd Control?", "How do I use Crowd Control?", "<playername> is using Crowd Control!!!", "I didn't know this had Crowd Control!", "What is Crowd Control?", "Why does everyone keep saying Crowd Control?", "The Crowd Control team is awesome!" }; foreach (Comment item in __result) { if (comments.Count() > 1) { if (rnd.Next(4) == 1) { int index = rnd.Next(comments.Count()); item.Text = comments[index]; Player val = PlayerHandler.instance.players[rnd.Next(PlayerHandler.instance.players.Count())]; item.Text = item.Text.Replace("<playername>", ((Object)val).name); comments.RemoveAt(index); } } else if (rnd.Next(8) == 1) { item.Text = array[rnd.Next(array.Count())]; Player val2 = PlayerHandler.instance.players[rnd.Next(PlayerHandler.instance.players.Count())]; item.Text = item.Text.Replace("<playername>", ((Object)val2).name); } } comments.Clear(); } } public class ControlClient { public static readonly string CV_HOST = "127.0.0.1"; public static readonly int CV_PORT = 51337; private bool paused; public bool inGame = true; private Dictionary<string, CrowdDelegate> Delegate { get; set; } private IPEndPoint Endpoint { get; set; } private Queue<CrowdRequest> Requests { get; set; } private bool Running { get; set; } public static Socket Socket { get; set; } public ControlClient() { Endpoint = new IPEndPoint(IPAddress.Parse(CV_HOST), CV_PORT); Requests = new Queue<CrowdRequest>(); Running = true; Socket = null; Delegate = new Dictionary<string, CrowdDelegate> { { "money100", CrowdDelegates.Money100 }, { "sound", CrowdDelegates.MakeSound }, { "kill", CrowdDelegates.Kill }, { "damage", CrowdDelegates.Damage10 }, { "damageb", CrowdDelegates.Damage30 }, { "heal", CrowdDelegates.Heal10 }, { "healb", CrowdDelegates.Heal30 }, { "healf", CrowdDelegates.HealFull }, { "launch", CrowdDelegates.Launch }, { "megalaunch", CrowdDelegates.MegaLaunch }, { "forward", CrowdDelegates.ShoveForward }, { "backward", CrowdDelegates.YankBackwards }, { "ragdoll", CrowdDelegates.Ragdoll }, { "giveo210", CrowdDelegates.GiveOxygen10 }, { "giveo230", CrowdDelegates.GiveOxygen30 }, { "giveo2100", CrowdDelegates.GiveOxygen100 }, { "takeo210", CrowdDelegates.TakeOxygen10 }, { "takeo230", CrowdDelegates.TakeOxygen30 }, { "takeo2100", CrowdDelegates.TakeOxygen100 }, { "fillstam", CrowdDelegates.FillStamina }, { "emptystam", CrowdDelegates.EmptyStamina }, { "infstam", CrowdDelegates.InfStam }, { "nostam", CrowdDelegates.NoStam }, { "invul", CrowdDelegates.Invul }, { "ohko", CrowdDelegates.OHKO }, { "ultraslow", CrowdDelegates.UltraSlow }, { "slow", CrowdDelegates.Slow }, { "fast", CrowdDelegates.Fast }, { "ultrafast", CrowdDelegates.UltraFast }, { "freeze", CrowdDelegates.Freeze }, { "lowjump", CrowdDelegates.LowJump }, { "highjump", CrowdDelegates.HighJump }, { "ultrajump", CrowdDelegates.UltraJump }, { "jump", CrowdDelegates.Jump }, { "giveitem_mic", CrowdDelegates.GiveItem }, { "giveitem_camera", CrowdDelegates.GiveItem }, { "giveitem_clapper", CrowdDelegates.GiveItem }, { "giveitem_defib", CrowdDelegates.GiveItem }, { "giveitem_flare", CrowdDelegates.GiveItem }, { "giveitem_gooball", CrowdDelegates.GiveItem }, { "giveitem_hugger", CrowdDelegates.GiveItem }, { "giveitem_light", CrowdDelegates.GiveItem }, { "giveitem_party", CrowdDelegates.GiveItem }, { "giveitem_shock", CrowdDelegates.GiveItem }, { "giveitem_sound", CrowdDelegates.GiveItem }, { "giveitem_chorby", CrowdDelegates.GiveItem }, { "giveitem_brain", CrowdDelegates.GiveItem }, { "giveitem_radio", CrowdDelegates.GiveItem }, { "giveitem_skull", CrowdDelegates.GiveItem }, { "cgiveitem_mic", CrowdDelegates.GiveCrewItem }, { "cgiveitem_camera", CrowdDelegates.GiveCrewItem }, { "cgiveitem_clapper", CrowdDelegates.GiveCrewItem }, { "cgiveitem_defib", CrowdDelegates.GiveCrewItem }, { "cgiveitem_flare", CrowdDelegates.GiveCrewItem }, { "cgiveitem_gooball", CrowdDelegates.GiveCrewItem }, { "cgiveitem_hugger", CrowdDelegates.GiveCrewItem }, { "cgiveitem_light", CrowdDelegates.GiveCrewItem }, { "cgiveitem_party", CrowdDelegates.GiveCrewItem }, { "cgiveitem_shock", CrowdDelegates.GiveCrewItem }, { "cgiveitem_sound", CrowdDelegates.GiveCrewItem }, { "cgiveitem_chorby", CrowdDelegates.GiveCrewItem }, { "cgiveitem_brain", CrowdDelegates.GiveCrewItem }, { "cgiveitem_radio", CrowdDelegates.GiveCrewItem }, { "cgiveitem_skull", CrowdDelegates.GiveCrewItem }, { "dropitem", CrowdDelegates.DropItem }, { "takeitem", CrowdDelegates.TakeItem }, { "spawn_Jello", CrowdDelegates.SpawnMonster }, { "spawn_Zombe", CrowdDelegates.SpawnMonster }, { "spawn_Spider", CrowdDelegates.SpawnMonster }, { "spawn_Snatcho", CrowdDelegates.SpawnMonster }, { "spawn_Bombs", CrowdDelegates.SpawnMonster }, { "spawn_BarnacleBall", CrowdDelegates.SpawnMonster }, { "spawn_Dog", CrowdDelegates.SpawnMonster }, { "spawn_Ear", CrowdDelegates.SpawnMonster }, { "spawn_BigSlap", CrowdDelegates.SpawnMonster }, { "spawn_EyeGuy", CrowdDelegates.SpawnMonster }, { "spawn_Flicker", CrowdDelegates.SpawnMonster }, { "spawn_Harpoon", CrowdDelegates.SpawnMonster }, { "spawn_Mouthe", CrowdDelegates.SpawnMonster }, { "spawn_Whisk", CrowdDelegates.SpawnMonster }, { "spawn_Weeping", CrowdDelegates.SpawnMonster }, { "cspawn_Jello", CrowdDelegates.SpawnMonsterCrew }, { "cspawn_Zombe", CrowdDelegates.SpawnMonsterCrew }, { "cspawn_Spider", CrowdDelegates.SpawnMonsterCrew }, { "cspawn_Snatcho", CrowdDelegates.SpawnMonsterCrew }, { "cspawn_Bombs", CrowdDelegates.SpawnMonsterCrew }, { "cspawn_BarnacleBall", CrowdDelegates.SpawnMonsterCrew }, { "cspawn_Dog", CrowdDelegates.SpawnMonsterCrew }, { "cspawn_Ear", CrowdDelegates.SpawnMonsterCrew }, { "cspawn_BigSlap", CrowdDelegates.SpawnMonsterCrew }, { "cspawn_EyeGuy", CrowdDelegates.SpawnMonsterCrew }, { "cspawn_Flicker", CrowdDelegates.SpawnMonsterCrew }, { "cspawn_Harpoon", CrowdDelegates.SpawnMonsterCrew }, { "cspawn_Mouthe", CrowdDelegates.SpawnMonsterCrew }, { "cspawn_Whisk", CrowdDelegates.SpawnMonsterCrew }, { "cspawn_Weeping", CrowdDelegates.SpawnMonsterCrew }, { "shake", CrowdDelegates.ShakeScreen }, { "shakebig", CrowdDelegates.ShakeScreenBig }, { "widecam", CrowdDelegates.WideCamera }, { "narrowcam", CrowdDelegates.NarrowCamera }, { "flipcam", CrowdDelegates.FlipCamera }, { "money_10", CrowdDelegates.GiveMoney }, { "money_100", CrowdDelegates.GiveMoney }, { "money_1000", CrowdDelegates.GiveMoney }, { "money_-10", CrowdDelegates.GiveMoney }, { "money_-100", CrowdDelegates.GiveMoney }, { "money_-1000", CrowdDelegates.GiveMoney }, { "views_10", CrowdDelegates.GiveViews }, { "views_30", CrowdDelegates.GiveViews }, { "views_100", CrowdDelegates.GiveViews }, { "views_-10", CrowdDelegates.GiveViews }, { "views_-30", CrowdDelegates.GiveViews }, { "views_-100", CrowdDelegates.GiveViews }, { "face_0", CrowdDelegates.SetColor }, { "face_1", CrowdDelegates.SetColor }, { "face_2", CrowdDelegates.SetColor }, { "face_3", CrowdDelegates.SetColor }, { "face_4", CrowdDelegates.SetColor }, { "face_5", CrowdDelegates.SetColor }, { "face_6", CrowdDelegates.SetColor }, { "face_7", CrowdDelegates.SetColor }, { "opendoor", CrowdDelegates.OpenDoor }, { "closedoor", CrowdDelegates.CloseDoor }, { "teleto", CrowdDelegates.TeleToCrew }, { "telecrew", CrowdDelegates.TeleCrew }, { "teletobell", CrowdDelegates.TeleToBell }, { "telecrewbell", CrowdDelegates.TeleCrewBell }, { "killcrew", CrowdDelegates.KillCrew } }; } public bool isReady() { try { if ((Object)(object)Player.localPlayer == (Object)null) { return false; } } catch (Exception ex) { TestMod.mls.LogError((object)ex.ToString()); return false; } return true; } public static void HideEffect(string code) { CrowdResponse crowdResponse = new CrowdResponse(0, CrowdResponse.Status.STATUS_NOTVISIBLE); crowdResponse.type = 1; crowdResponse.code = code; crowdResponse.Send(Socket); } public static void ShowEffect(string code) { CrowdResponse crowdResponse = new CrowdResponse(0, CrowdResponse.Status.STATUS_VISIBLE); crowdResponse.type = 1; crowdResponse.code = code; crowdResponse.Send(Socket); } public static void DisableEffect(string code) { CrowdResponse crowdResponse = new CrowdResponse(0, CrowdResponse.Status.STATUS_NOTSELECTABLE); crowdResponse.type = 1; crowdResponse.code = code; crowdResponse.Send(Socket); } public static void EnableEffect(string code) { CrowdResponse crowdResponse = new CrowdResponse(0, CrowdResponse.Status.STATUS_SELECTABLE); crowdResponse.type = 1; crowdResponse.code = code; crowdResponse.Send(Socket); } private void ClientLoop() { TestMod.mls.LogInfo((object)"Connected to Crowd Control"); new Timer(timeUpdate, null, 0, 200); try { while (Running) { CrowdRequest crowdRequest = CrowdRequest.Recieve(this, Socket); if (crowdRequest != null && !crowdRequest.IsKeepAlive()) { lock (Requests) { Requests.Enqueue(crowdRequest); } } } } catch (Exception) { TestMod.mls.LogInfo((object)"Disconnected from Crowd Control"); Socket.Close(); } } public void timeUpdate(object state) { inGame = true; if (!isReady()) { inGame = false; } if (!inGame) { TimedThread.addTime(200); paused = true; } else if (paused) { paused = false; TimedThread.unPause(); TimedThread.tickTime(200); } else { TimedThread.tickTime(200); } } public bool IsRunning() { return Running; } public void NetworkLoop() { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; while (Running) { TestMod.mls.LogInfo((object)"Attempting to connect to Crowd Control"); try { Socket = new Socket(Endpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); Socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, optionValue: true); if (Socket.BeginConnect(Endpoint, null, null).AsyncWaitHandle.WaitOne(10000, exitContext: true) && Socket.Connected) { ClientLoop(); } else { TestMod.mls.LogInfo((object)"Failed to connect to Crowd Control"); } Socket.Close(); } catch (Exception ex) { TestMod.mls.LogInfo((object)ex.GetType().Name); TestMod.mls.LogInfo((object)"Failed to connect to Crowd Control"); } Thread.Sleep(10000); } } public void RequestLoop() { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; while (Running) { try { CrowdRequest crowdRequest = null; lock (Requests) { if (Requests.Count == 0) { continue; } crowdRequest = Requests.Dequeue(); goto IL_0052; } IL_0052: string reqCode = crowdRequest.GetReqCode(); try { CrowdResponse crowdResponse = (isReady() ? Delegate[reqCode](this, crowdRequest) : new CrowdResponse(crowdRequest.GetReqID(), CrowdResponse.Status.STATUS_RETRY)); if (crowdResponse == null) { new CrowdResponse(crowdRequest.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Request error for '" + reqCode + "'").Send(Socket); } crowdResponse.Send(Socket); } catch (KeyNotFoundException) { new CrowdResponse(crowdRequest.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Request error for '" + reqCode + "'").Send(Socket); } } catch (Exception) { TestMod.mls.LogInfo((object)"Disconnected from Crowd Control"); Socket.Close(); } } } public void Stop() { Running = false; } } public delegate CrowdResponse CrowdDelegate(ControlClient client, CrowdRequest req); public class CrowdDelegates { public static Random rnd = new Random(); private static readonly Dictionary<string, byte> items = new Dictionary<string, byte> { { "mic", 0 }, { "camera", 1 }, { "clapper", 3 }, { "defib", 4 }, { "flare", 7 }, { "gooball", 8 }, { "hugger", 10 }, { "light", 12 }, { "party", 17 }, { "shock", 20 }, { "sound", 21 }, { "chorby", 32 }, { "brain", 31 }, { "radio", 35 }, { "skull", 39 } }; public static CrowdResponse Money100(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; try { TestMod.ActionQueue.Enqueue(delegate { //IL_000f: Unknown result type (might be due to invalid IL or missing references) ((PerlinShake)getProperty(GamefeelHandler.instance, "perlin")).AddShake(15f, 0.2f, 15f); }); } catch (Exception ex) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse GiveMoney(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; string code = req.code; code = code.Split(new char[1] { '_' })[1]; int num = int.Parse(code); if (num < 0 && SurfaceNetworkHandler.RoomStats.Money + num < 0) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } try { TestMod.ActionQueue.Enqueue(delegate { SurfaceNetworkHandler.RoomStats.AddMoney(num); if (num > 0) { Singleton<UserInterface>.Instance.moneyAddedUI.Show("Crowd Control", "$" + num, (MoneyCellType)1); } else { Singleton<UserInterface>.Instance.moneyAddedUI.Show("Crowd Control", "$" + num, (MoneyCellType)0); } TestMod.SendRoundStats(); if (num > 0) { TestMod.comments.Add("Yo, free money! Thanks Crowd Control!"); } }); } catch (Exception ex) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse SetColor(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; string code = req.code; code = code.Split(new char[1] { '_' })[1]; int num = int.Parse(code); PlayerCustomizer playerCustomizer = Object.FindObjectOfType<PlayerCustomizer>(); if ((Object)(object)playerCustomizer == (Object)null) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } try { TestMod.ActionQueue.Enqueue(delegate { playerCustomizer.RPCA_PickColor(num); playerCustomizer.RPCA_PlayerLeftTerminal(true); }); } catch (Exception ex) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse GiveViews(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; string code = req.code; code = code.Split(new char[1] { '_' })[1]; int num = int.Parse(code); if (num == -100) { num = -SurfaceNetworkHandler.RoomStats.CurrentQuota; if (num == 0) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } } else { num = SurfaceNetworkHandler.RoomStats.QuotaToReach * num / 100; } if (num < 0 && SurfaceNetworkHandler.RoomStats.CurrentQuota + num < 0) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } try { TestMod.ActionQueue.Enqueue(delegate { setProperty(SurfaceNetworkHandler.RoomStats, "currentQuoutaInternal", SurfaceNetworkHandler.RoomStats.CurrentQuota + num); callFunc(SurfaceNetworkHandler.RoomStats, "OnStatsUpdated", null); if (num > 0) { Singleton<UserInterface>.Instance.moneyAddedUI.Show("Crowd Control", num + "0 Views", (MoneyCellType)1); } else { Singleton<UserInterface>.Instance.moneyAddedUI.Show("Crowd Control", num + "0 Views", (MoneyCellType)0); } TestMod.SendRoundStats(); if (num > 0) { TestMod.comments.Add("I watched this before it was even uploaded! #CrowdControl"); } }); } catch (Exception ex) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse ShakeScreen(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; if (Player.localPlayer.data.isInDiveBell) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } try { TestMod.ActionQueue.Enqueue(delegate { //IL_000f: Unknown result type (might be due to invalid IL or missing references) ((PerlinShake)getProperty(GamefeelHandler.instance, "perlin")).AddShake(15f, 0.2f, 15f); }); } catch (Exception ex) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse TeleToCrew(ControlClient client, CrowdRequest req) { //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) CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == "SurfaceScene") { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is not in the old world."); } if (Player.localPlayer.data.isInDiveBell) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } Player player = null; List<Player> list = new List<Player>(); foreach (Player item in PlayerHandler.instance.playersAlive) { if ((Object)(object)item != (Object)(object)Player.localPlayer) { list.Add(item); } } if (list.Count == 0) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } int index = rnd.Next(list.Count); player = list[index]; try { TestMod.ActionQueue.Enqueue(delegate { //IL_001f: 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_0033: Unknown result type (might be due to invalid IL or missing references) try { callFunc(Player.localPlayer.refs.ragdoll, "MoveAllRigsInDirection", player.data.groundPos - Player.localPlayer.data.groundPos); } catch (Exception ex2) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex2.ToString())); } }); } catch (Exception ex) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse TeleToBell(ControlClient client, CrowdRequest req) { //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) CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == "SurfaceScene") { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is not in the old world."); } try { TestMod.ActionQueue.Enqueue(delegate { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0030: 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) //IL_0044: Unknown result type (might be due to invalid IL or missing references) try { Transform val = (Transform)callAndReturnFunc(SpawnHandler.Instance, "GetSpawnPoint", (object)(Spawns)3); callFunc(Player.localPlayer.refs.ragdoll, "MoveAllRigsInDirection", val.position - Player.localPlayer.data.groundPos); } catch (Exception ex2) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex2.ToString())); } }); } catch (Exception ex) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse TeleCrew(ControlClient client, CrowdRequest req) { //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) CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == "SurfaceScene") { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is not in the old world."); } List<Player> list = new List<Player>(); foreach (Player item in PlayerHandler.instance.playersAlive) { if ((Object)(object)item != (Object)(object)Player.localPlayer) { list.Add(item); } } if (list.Count == 0) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } int index = rnd.Next(list.Count); TestMod.SendTele(list[index], Player.localPlayer); return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse TeleCrewBell(ControlClient client, CrowdRequest req) { //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) CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == "SurfaceScene") { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is not in the old world."); } List<Player> list = new List<Player>(); foreach (Player item in PlayerHandler.instance.playersAlive) { if ((Object)(object)item != (Object)(object)Player.localPlayer) { list.Add(item); } } if (list.Count == 0) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } int index = rnd.Next(list.Count); TestMod.SendTeleBell(list[index]); return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse KillCrew(ControlClient client, CrowdRequest req) { //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) CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == "SurfaceScene") { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is not in the old world."); } Player val = null; List<Player> list = new List<Player>(); foreach (Player item in PlayerHandler.instance.playersAlive) { if ((Object)(object)item != (Object)(object)Player.localPlayer) { list.Add(item); } } if (list.Count == 0) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } int index = rnd.Next(list.Count); val = list[index]; TestMod.SendKill(val); TestMod.comments.Add("Was " + val.refs.view.Owner.NickName + " killed by Crowd Control?"); return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse GiveCrewItem(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; string code = req.code; code = code.Split(new char[1] { '_' })[1]; byte b = 0; b = ((DatabaseAsset<ItemDatabase, Item>)(object)SingletonAsset<ItemDatabase>.Instance).Objects.ToList().Find((Item x) => ((Object)x).name.ToLower().Contains(code)).id; Player val = null; List<Player> list = new List<Player>(); PlayerInventory val2 = default(PlayerInventory); InventorySlot val3 = default(InventorySlot); foreach (Player item in PlayerHandler.instance.playersAlive) { if ((Object)(object)item != (Object)(object)Player.localPlayer && item.TryGetInventory(ref val2) && val2.TryGetFeeSlot(ref val3) && (!((Object)(object)item.data.currentItem != (Object)null) || item.data.selectedItemSlot != -1)) { list.Add(item); } } if (list.Count == 0) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } int index = rnd.Next(list.Count); val = list[index]; TestMod.SendGiveItem(val, b); TestMod.comments.Add("I gave " + val.refs.view.Owner.NickName + " a item!"); return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse OpenDoor(ControlClient client, CrowdRequest req) { //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) CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == "SurfaceScene") { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is not in the old world."); } DivingBell bell = Object.FindObjectOfType<DivingBell>(); if ((Object)(object)bell == (Object)null) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if ((bool)getProperty(bell, "m_isMovingDoor") || bell.opened) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } try { TestMod.ActionQueue.Enqueue(delegate { bell.AttemptSetOpen(true); TestMod.comments.Add("Someone is controlling the door with Crowd Control!"); }); } catch (Exception ex) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse CloseDoor(ControlClient client, CrowdRequest req) { //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) CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == "SurfaceScene") { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is not in the old world."); } DivingBell bell = Object.FindObjectOfType<DivingBell>(); if ((Object)(object)bell == (Object)null) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if ((bool)getProperty(bell, "m_isMovingDoor") || !bell.opened) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } try { TestMod.ActionQueue.Enqueue(delegate { TestMod.comments.Add("Someone is controlling the door with Crowd Control!"); bell.AttemptSetOpen(false); }); } catch (Exception ex) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse ShakeScreenBig(ControlClient client, CrowdRequest req) { //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) CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == "SurfaceScene") { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is not in the old world."); } if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.isInDiveBell) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } try { TestMod.ActionQueue.Enqueue(delegate { //IL_000f: Unknown result type (might be due to invalid IL or missing references) ((PerlinShake)getProperty(GamefeelHandler.instance, "perlin")).AddShake(25f, 3.5f, 25f); }); } catch (Exception ex) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse SpawnMonster(ControlClient client, CrowdRequest req) { //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) CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == "SurfaceScene") { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is not in the old world."); } if (Player.localPlayer.data.isInDiveBell) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } string code = req.code; code = code.Split(new char[1] { '_' })[1]; if (code == "Whisk") { code = "Toolkit_Wisk"; } try { TestMod.ActionQueue.Enqueue(delegate { //IL_0010: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) try { float num = 15f; RaycastHit val = HelperFunctions.LineCheck(((Component)MainCamera.instance).transform.position, ((Component)MainCamera.instance).transform.position + ((Component)MainCamera.instance).transform.forward * num, (LayerType)1, 0f); Vector3 val2 = ((Component)MainCamera.instance).transform.position + ((Component)MainCamera.instance).transform.forward * num; if ((Object)(object)((RaycastHit)(ref val)).collider != (Object)null) { val2 = ((RaycastHit)(ref val)).point; } val2 = HelperFunctions.GetGroundPos(val2 + Vector3.up * 1f, (LayerType)1, 0f); PhotonNetwork.Instantiate(code, val2, quaternion.op_Implicit(quaternion.identity), (byte)0, (object[])null); TestMod.comments.Add("Where did that monster come from? Is that Crowd Control?"); } catch (Exception ex2) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex2.ToString())); } }); } catch (Exception ex) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse SpawnMonsterCrew(ControlClient client, CrowdRequest req) { //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) CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == "SurfaceScene") { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is not in the old world."); } string code = req.code; code = code.Split(new char[1] { '_' })[1]; if (code == "Whisk") { code = "Toolkit_Wisk"; } Player val = null; List<Player> list = new List<Player>(); foreach (Player item in PlayerHandler.instance.playersAlive) { if ((Object)(object)item != (Object)(object)Player.localPlayer && !item.data.dead && !item.data.isInDiveBell) { list.Add(item); } } if (list.Count == 0) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } int index = rnd.Next(list.Count); val = list[index]; try { TestMod.SendSpawn(val, code); TestMod.comments.Add("Where did that monster come from? Is that Crowd Control?"); } catch (Exception ex) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse GiveItem(ControlClient client, CrowdRequest req) { //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Expected O, but got Unknown //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if ((Object)(object)Player.localPlayer.data.currentItem != (Object)null && Player.localPlayer.data.selectedItemSlot == -1) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } string code = req.code; code = code.Split(new char[1] { '_' })[1]; byte b = 0; b = ((DatabaseAsset<ItemDatabase, Item>)(object)SingletonAsset<ItemDatabase>.Instance).Objects.ToList().Find((Item x) => ((Object)x).name.ToLower().Contains(code)).id; try { PlayerInventory playerInventory = default(PlayerInventory); if (!Player.localPlayer.TryGetInventory(ref playerInventory)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } InventorySlot val = default(InventorySlot); if (!playerInventory.TryGetFeeSlot(ref val)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (!PhotonNetwork.IsMasterClient) { TestMod.SendGiveItem(Player.localPlayer, b); return new CrowdResponse(req.GetReqID(), status, message); } byte itemid = b; ItemInstanceData pickupdata = new ItemInstanceData(Guid.NewGuid()); Vector3 pos = ((Component)Player.localPlayer).transform.position; Item item = default(Item); TestMod.ActionQueue.Enqueue(delegate { //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_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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) try { Pickup val2 = PickupHandler.CreatePickup(itemid, pickupdata, pos, Random.rotation, (Vector3.up + Random.onUnitSphere) * 2f, Random.onUnitSphere * 5f); if (ItemDatabase.TryGetItemFromID(itemid, ref item)) { ItemInstanceData val3 = ((ItemInstanceData)getProperty(val2, "instanceData")).Copy(); InventorySlot val4 = default(InventorySlot); if (playerInventory.TryAddItem(new ItemDescriptor(item, val3), ref val4)) { Player.localPlayer.refs.view.RPC("RPC_SelectSlot", Player.localPlayer.refs.view.Owner, new object[1] { val4.SlotID }); val2.m_photonView.RPC("RPC_Remove", (RpcTarget)2, Array.Empty<object>()); playerInventory.SyncInventoryToOthers(); TestMod.comments.Add("You're welcome for the item " + Player.localPlayer.refs.view.Owner.NickName + "!"); } } } catch (Exception ex2) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex2.ToString())); } }); } catch (Exception ex) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse DropItem(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.isInDiveBell) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if ((Object)(object)Player.localPlayer.data.currentItem == (Object)null) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (Player.localPlayer.data.selectedItemSlot == -1) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } try { TestMod.ActionQueue.Enqueue(delegate { try { Player.localPlayer.refs.items.DropItem(Player.localPlayer.data.selectedItemSlot, false); } catch (Exception ex2) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex2.ToString())); } }); } catch (Exception ex) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse TakeItem(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.isInDiveBell) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is safe in Diving Bell"); } if ((Object)(object)Player.localPlayer.data.currentItem == (Object)null) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (Player.localPlayer.data.selectedItemSlot == -1) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } PlayerInventory playerInventory = default(PlayerInventory); if (!Player.localPlayer.TryGetInventory(ref playerInventory)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } try { TestMod.ActionQueue.Enqueue(delegate { try { ItemDescriptor val = default(ItemDescriptor); playerInventory.TryRemoveItemFromSlot(Player.localPlayer.data.selectedItemSlot, ref val); TestMod.comments.Add("Someone took the item away with Crowd Control!"); } catch (Exception ex2) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex2.ToString())); } }); } catch (Exception ex) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse InfStam(ControlClient client, CrowdRequest req) { if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } int num = 30; if (req.duration > 0) { num = req.duration / 1000; } if (TimedThread.isRunning(TimedType.INF_STAM)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.NO_STAM)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } new Thread(new TimedThread(req.GetReqID(), TimedType.INF_STAM, num * 1000).Run).Start(); return new TimedResponse(req.GetReqID(), num * 1000); } public static CrowdResponse Invul(ControlClient client, CrowdRequest req) { if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } int num = 30; if (req.duration > 0) { num = req.duration / 1000; } if (TimedThread.isRunning(TimedType.INVUL)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.OHKO)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } new Thread(new TimedThread(req.GetReqID(), TimedType.INVUL, num * 1000).Run).Start(); return new TimedResponse(req.GetReqID(), num * 1000); } public static CrowdResponse OHKO(ControlClient client, CrowdRequest req) { if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } int num = 30; if (req.duration > 0) { num = req.duration / 1000; } if (TimedThread.isRunning(TimedType.INF_STAM)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.OHKO)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } new Thread(new TimedThread(req.GetReqID(), TimedType.OHKO, num * 1000).Run).Start(); return new TimedResponse(req.GetReqID(), num * 1000); } public static CrowdResponse NoStam(ControlClient client, CrowdRequest req) { if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } int num = 30; if (req.duration > 0) { num = req.duration / 1000; } if (TimedThread.isRunning(TimedType.INF_STAM)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.NO_STAM)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } new Thread(new TimedThread(req.GetReqID(), TimedType.NO_STAM, num * 1000).Run).Start(); return new TimedResponse(req.GetReqID(), num * 1000); } public static CrowdResponse FlipCamera(ControlClient client, CrowdRequest req) { if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.isInDiveBell) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is safe in Diving Bell."); } int num = 30; if (req.duration > 0) { num = req.duration / 1000; } if (TimedThread.isRunning(TimedType.FLIP_CAMERA)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } TestMod.comments.Add("Oh god, the camera!"); new Thread(new TimedThread(req.GetReqID(), TimedType.FLIP_CAMERA, num * 1000).Run).Start(); return new TimedResponse(req.GetReqID(), num * 1000); } public static CrowdResponse WideCamera(ControlClient client, CrowdRequest req) { if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.isInDiveBell) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is safe in Diving Bell."); } int num = 30; if (req.duration > 0) { num = req.duration / 1000; } if (TimedThread.isRunning(TimedType.WIDE_CAMERA)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.NARROW_CAMERA)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } new Thread(new TimedThread(req.GetReqID(), TimedType.WIDE_CAMERA, num * 1000).Run).Start(); return new TimedResponse(req.GetReqID(), num * 1000); } public static CrowdResponse NarrowCamera(ControlClient client, CrowdRequest req) { if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.isInDiveBell) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is safe in Diving Bell."); } int num = 30; if (req.duration > 0) { num = req.duration / 1000; } if (TimedThread.isRunning(TimedType.WIDE_CAMERA)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.NARROW_CAMERA)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } new Thread(new TimedThread(req.GetReqID(), TimedType.NARROW_CAMERA, num * 1000).Run).Start(); return new TimedResponse(req.GetReqID(), num * 1000); } public static CrowdResponse UltraSlow(ControlClient client, CrowdRequest req) { if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.isInDiveBell) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } int num = 30; if (req.duration > 0) { num = req.duration / 1000; } if (TimedThread.isRunning(TimedType.PLAYER_ULTRA_SLOW)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.PLAYER_SLOW)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.PLAYER_FAST)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.PLAYER_ULTRA_FAST)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.PLAYER_FREEZE)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } new Thread(new TimedThread(req.GetReqID(), TimedType.PLAYER_ULTRA_SLOW, num * 1000).Run).Start(); return new TimedResponse(req.GetReqID(), num * 1000); } public static CrowdResponse Slow(ControlClient client, CrowdRequest req) { if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.isInDiveBell) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } int num = 30; if (req.duration > 0) { num = req.duration / 1000; } if (TimedThread.isRunning(TimedType.PLAYER_ULTRA_SLOW)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.PLAYER_SLOW)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.PLAYER_FAST)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.PLAYER_ULTRA_FAST)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.PLAYER_FREEZE)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } new Thread(new TimedThread(req.GetReqID(), TimedType.PLAYER_SLOW, num * 1000).Run).Start(); return new TimedResponse(req.GetReqID(), num * 1000); } public static CrowdResponse Fast(ControlClient client, CrowdRequest req) { if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.isInDiveBell) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } int num = 30; if (req.duration > 0) { num = req.duration / 1000; } if (TimedThread.isRunning(TimedType.PLAYER_ULTRA_SLOW)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.PLAYER_SLOW)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.PLAYER_FAST)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.PLAYER_ULTRA_FAST)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.PLAYER_FREEZE)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } new Thread(new TimedThread(req.GetReqID(), TimedType.PLAYER_FAST, num * 1000).Run).Start(); return new TimedResponse(req.GetReqID(), num * 1000); } public static CrowdResponse UltraFast(ControlClient client, CrowdRequest req) { if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.isInDiveBell) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } int num = 30; if (req.duration > 0) { num = req.duration / 1000; } if (TimedThread.isRunning(TimedType.PLAYER_ULTRA_SLOW)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.PLAYER_SLOW)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.PLAYER_FAST)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.PLAYER_ULTRA_FAST)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.PLAYER_FREEZE)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } TestMod.comments.Add("woah! " + Player.localPlayer.refs.view.Owner.NickName + " is so fast! #CrowdControl"); new Thread(new TimedThread(req.GetReqID(), TimedType.PLAYER_ULTRA_FAST, num * 1000).Run).Start(); return new TimedResponse(req.GetReqID(), num * 1000); } public static CrowdResponse Freeze(ControlClient client, CrowdRequest req) { if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.isInDiveBell) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } int num = 30; if (req.duration > 0) { num = req.duration / 1000; } if (TimedThread.isRunning(TimedType.PLAYER_ULTRA_SLOW)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.PLAYER_SLOW)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.PLAYER_FAST)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.PLAYER_ULTRA_FAST)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.PLAYER_FREEZE)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } TestMod.comments.Add("I froze " + Player.localPlayer.refs.view.Owner.NickName + " with Crowd Control! hahahaha"); new Thread(new TimedThread(req.GetReqID(), TimedType.PLAYER_FREEZE, num * 1000).Run).Start(); return new TimedResponse(req.GetReqID(), num * 1000); } public static CrowdResponse LowJump(ControlClient client, CrowdRequest req) { if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.isInDiveBell) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } int num = 30; if (req.duration > 0) { num = req.duration / 1000; } if (TimedThread.isRunning(TimedType.JUMP_LOW)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.JUMP_HIGH)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.JUMP_ULTRA)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } new Thread(new TimedThread(req.GetReqID(), TimedType.JUMP_LOW, num * 1000).Run).Start(); return new TimedResponse(req.GetReqID(), num * 1000); } public static CrowdResponse HighJump(ControlClient client, CrowdRequest req) { if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.isInDiveBell) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } int num = 30; if (req.duration > 0) { num = req.duration / 1000; } if (TimedThread.isRunning(TimedType.JUMP_LOW)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.JUMP_HIGH)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.JUMP_ULTRA)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } new Thread(new TimedThread(req.GetReqID(), TimedType.JUMP_HIGH, num * 1000).Run).Start(); return new TimedResponse(req.GetReqID(), num * 1000); } public static CrowdResponse UltraJump(ControlClient client, CrowdRequest req) { if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.isInDiveBell) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } int num = 30; if (req.duration > 0) { num = req.duration / 1000; } if (TimedThread.isRunning(TimedType.JUMP_LOW)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.JUMP_HIGH)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (TimedThread.isRunning(TimedType.JUMP_ULTRA)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } new Thread(new TimedThread(req.GetReqID(), TimedType.JUMP_ULTRA, num * 1000).Run).Start(); return new TimedResponse(req.GetReqID(), num * 1000); } public static CrowdResponse TakeOxygen10(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.isInDiveBell) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (Player.localPlayer.data.remainingOxygen <= 50f) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY, message); } try { TestMod.ActionQueue.Enqueue(delegate { try { TakeDamagePost.instance.TakeDamageFeedback(); UI_Feedback.instance.TakeDamage(false); PlayerData data = Player.localPlayer.data; data.remainingOxygen -= 50f; TestMod.SendPlayerStats(Player.localPlayer); } catch (Exception ex2) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex2.ToString())); } }); } catch (Exception ex) { status = CrowdResponse.Status.STATUS_RETRY; TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse Jump(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.isInDiveBell) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (!(Player.localPlayer.data.sinceGrounded < 0.5f) || !(Player.localPlayer.data.sinceJump > 0.6f)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY, message); } try { TestMod.ActionQueue.Enqueue(delegate { try { Player.localPlayer.refs.controller.TryJump(); } catch (Exception ex2) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex2.ToString())); } }); } catch (Exception ex) { status = CrowdResponse.Status.STATUS_RETRY; TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse TakeOxygen30(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.isInDiveBell) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (Player.localPlayer.data.remainingOxygen <= 150f) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY, message); } try { TestMod.ActionQueue.Enqueue(delegate { try { TakeDamagePost.instance.TakeDamageFeedback(); UI_Feedback.instance.TakeDamage(false); PlayerData data = Player.localPlayer.data; data.remainingOxygen -= 150f; TestMod.SendPlayerStats(Player.localPlayer); } catch (Exception ex2) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex2.ToString())); } }); } catch (Exception ex) { status = CrowdResponse.Status.STATUS_RETRY; TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse TakeOxygen100(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.isInDiveBell) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (Player.localPlayer.data.remainingOxygen <= 50f) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY, message); } try { TestMod.ActionQueue.Enqueue(delegate { try { TakeDamagePost.instance.TakeDamageFeedback(); UI_Feedback.instance.TakeDamage(false); Player.localPlayer.data.remainingOxygen = 0f; TestMod.SendPlayerStats(Player.localPlayer); } catch (Exception ex2) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex2.ToString())); } }); } catch (Exception ex) { status = CrowdResponse.Status.STATUS_RETRY; TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse GiveOxygen10(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.remainingOxygen >= Player.localPlayer.data.maxOxygen) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY, message); } try { TestMod.ActionQueue.Enqueue(delegate { try { UI_Feedback.instance.HealFeedback(); PlayerData data = Player.localPlayer.data; data.remainingOxygen += 50f; if (Player.localPlayer.data.remainingOxygen > Player.localPlayer.data.maxOxygen) { Player.localPlayer.data.remainingOxygen = Player.localPlayer.data.maxOxygen; } TestMod.SendPlayerStats(Player.localPlayer); } catch (Exception ex2) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex2.ToString())); } }); } catch (Exception ex) { status = CrowdResponse.Status.STATUS_RETRY; TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse GiveOxygen30(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.remainingOxygen >= Player.localPlayer.data.maxOxygen) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY, message); } try { TestMod.ActionQueue.Enqueue(delegate { try { UI_Feedback.instance.HealFeedback(); PlayerData data = Player.localPlayer.data; data.remainingOxygen += 150f; if (Player.localPlayer.data.remainingOxygen > Player.localPlayer.data.maxOxygen) { Player.localPlayer.data.remainingOxygen = Player.localPlayer.data.maxOxygen; } TestMod.SendPlayerStats(Player.localPlayer); } catch (Exception ex2) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex2.ToString())); } }); } catch (Exception ex) { status = CrowdResponse.Status.STATUS_RETRY; TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse GiveOxygen100(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.remainingOxygen >= Player.localPlayer.data.maxOxygen) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY, message); } try { TestMod.ActionQueue.Enqueue(delegate { try { UI_Feedback.instance.HealFeedback(); Player.localPlayer.data.remainingOxygen = Player.localPlayer.data.maxOxygen; TestMod.SendPlayerStats(Player.localPlayer); } catch (Exception ex2) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex2.ToString())); } }); } catch (Exception ex) { status = CrowdResponse.Status.STATUS_RETRY; TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse FillStamina(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.currentStamina >= 10f) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY, message); } try { TestMod.ActionQueue.Enqueue(delegate { try { UI_Feedback.instance.HealFeedback(); Player.localPlayer.data.currentStamina = 10f; } catch (Exception ex2) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex2.ToString())); } }); } catch (Exception ex) { status = CrowdResponse.Status.STATUS_RETRY; TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse EmptyStamina(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.isInDiveBell) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (Player.localPlayer.data.currentStamina <= 0f) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY, message); } try { TestMod.ActionQueue.Enqueue(delegate { try { TakeDamagePost.instance.TakeDamageFeedback(); UI_Feedback.instance.TakeDamage(false); Player.localPlayer.data.currentStamina = 0f; } catch (Exception ex2) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex2.ToString())); } }); } catch (Exception ex) { status = CrowdResponse.Status.STATUS_RETRY; TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse ShoveForward(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.isInDiveBell) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } try { TestMod.ActionQueue.Enqueue(delegate { //IL_000a: 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_0019: 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) try { Vector3 val = ((Component)MainCamera.instance).transform.forward * 50f; callFunc(Player.localPlayer, "CallTakeDamageAndAddForceAndFall", new object[3] { 0, val, 0 }); } catch (Exception ex2) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex2.ToString())); } }); } catch (Exception ex) { status = CrowdResponse.Status.STATUS_RETRY; TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse YankBackwards(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.isInDiveBell) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } try { TestMod.ActionQueue.Enqueue(delegate { //IL_000a: 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_0019: 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) try { Vector3 val = ((Component)MainCamera.instance).transform.forward * -50f; callFunc(Player.localPlayer, "CallTakeDamageAndAddForceAndFall", new object[3] { 0, val, 0 }); } catch (Exception ex2) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex2.ToString())); } }); } catch (Exception ex) { status = CrowdResponse.Status.STATUS_RETRY; TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse MegaLaunch(ControlClient client, CrowdRequest req) { //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) CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == "SurfaceScene") { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is not in the old world."); } if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.isInDiveBell) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } try { TestMod.ActionQueue.Enqueue(delegate { //IL_0031: Unknown result type (might be due to invalid IL or missing references) try { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(0f, 250f, 0f); callFunc(Player.localPlayer, "CallTakeDamageAndAddForceAndFall", new object[3] { 0, val, 0 }); TestMod.comments.Add("They just flew up into the air!"); } catch (Exception ex2) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex2.ToString())); } }); } catch (Exception ex) { status = CrowdResponse.Status.STATUS_RETRY; TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse Ragdoll(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.isInDiveBell) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } try { TestMod.ActionQueue.Enqueue(delegate { //IL_0031: Unknown result type (might be due to invalid IL or missing references) try { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(0f, 0f, 0f); callFunc(Player.localPlayer, "CallTakeDamageAndAddForceAndFall", new object[3] { 0, val, 4f }); } catch (Exception ex2) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex2.ToString())); } }); } catch (Exception ex) { status = CrowdResponse.Status.STATUS_RETRY; TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse Launch(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.isInDiveBell) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } try { TestMod.ActionQueue.Enqueue(delegate { //IL_0031: Unknown result type (might be due to invalid IL or missing references) try { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(0f, 100f, 0f); callFunc(Player.localPlayer, "CallTakeDamageAndAddForceAndFall", new object[3] { 0, val, 0 }); TestMod.comments.Add("They just flew up into the air!"); } catch (Exception ex2) { TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex2.ToString())); } }); } catch (Exception ex) { status = CrowdResponse.Status.STATUS_RETRY; TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse Damage10(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; if (Player.localPlayer.data.dead) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Player is dead."); } if (Player.localPlayer.data.isInDiveBell) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (Player.lo
BepInEx/plugins/MyBox.dll
Decompiled 2 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Text; using System.Text.RegularExpressions; using JetBrains.Annotations; using MyBox; using MyBox.Internal; using UnityEngine; using UnityEngine.AI; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] public class FPSCounter : MonoBehaviour { private enum Anchor { LeftTop, LeftBottom, RightTop, RightBottom } public bool EditorOnly; [Separator] [SerializeField] private float _updateInterval = 1f; [SerializeField] private int _targetFrameRate = 30; [Separator] [SerializeField] private Anchor _anchor; [SerializeField] private int _xOffset; [SerializeField] private int _yOffset; private float _idleTime = 2f; private float _elapsed; private int _frames; private int _quantity; private float _fps; private float _averageFps; private Color _goodColor; private Color _okColor; private Color _badColor; private float _okFps; private float _badFps; private Rect _rect1; private Rect _rect2; private void Awake() { //IL_0020: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) if (!EditorOnly || Application.isEditor) { _goodColor = new Color(0.4f, 0.6f, 0.4f); _okColor = new Color(0.8f, 0.8f, 0.2f, 0.6f); _badColor = new Color(0.8f, 0.6f, 0.6f); int num = _targetFrameRate / 100; int num2 = num * 10; int num3 = num * 40; _okFps = _targetFrameRate - num2; _badFps = _targetFrameRate - num3; int num4 = 0; int num5 = 0; int num6 = 40; int num7 = 90; if (_anchor == Anchor.LeftBottom || _anchor == Anchor.RightBottom) { num5 = Screen.height - num6; } if (_anchor == Anchor.RightTop || _anchor == Anchor.RightBottom) { num4 = Screen.width - num7; } num4 += _xOffset; num5 += _yOffset; int num8 = num5 + 18; _rect1 = new Rect((float)num4, (float)num5, (float)num7, (float)num6); _rect2 = new Rect((float)num4, (float)num8, (float)num7, (float)num6); _elapsed = _updateInterval; } } private void Update() { if (EditorOnly && !Application.isEditor) { return; } if (_idleTime > 0f) { _idleTime -= Time.deltaTime; return; } _elapsed += Time.deltaTime; _frames++; if (_elapsed >= _updateInterval) { _fps = (float)_frames / _elapsed; _elapsed = 0f; _frames = 0; } _quantity++; _averageFps += (_fps - _averageFps) / (float)_quantity; } private void OnGUI() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) if (!EditorOnly || Application.isEditor) { Color color = GUI.color; Color color2 = _goodColor; if (_fps <= _okFps || _averageFps <= _okFps) { color2 = _okColor; } if (_fps <= _badFps || _averageFps <= _badFps) { color2 = _badColor; } GUI.color = color2; GUI.Label(_rect1, "FPS: " + (int)_fps); GUI.color = color; } } } namespace MyBox { [AttributeUsage(AttributeTargets.Field)] public class AutoPropertyAttribute : PropertyAttribute { public readonly AutoPropertyMode Mode; public readonly string PredicateMethodName; public readonly Type PredicateMethodTarget; public readonly bool AllowEmpty; public AutoPropertyAttribute(AutoPropertyMode mode = AutoPropertyMode.Children, string predicateMethodName = null, Type predicateMethodTarget = null, bool allowEmpty = false) { Mode = mode; PredicateMethodTarget = predicateMethodTarget; PredicateMethodName = predicateMethodName; AllowEmpty = allowEmpty; } } public enum AutoPropertyMode { Children, Parent, Scene, Asset, Any } [AttributeUsage(AttributeTargets.Method)] public class ButtonMethodAttribute : PropertyAttribute { public readonly ButtonMethodDrawOrder DrawOrder; public readonly ConditionalData Condition; public ButtonMethodAttribute(ButtonMethodDrawOrder drawOrder = ButtonMethodDrawOrder.AfterInspector) { DrawOrder = drawOrder; } public ButtonMethodAttribute(ButtonMethodDrawOrder drawOrder, string fieldToCheck, bool inverse = false, params object[] compareValues) { ConditionalData condition = new ConditionalData(fieldToCheck, inverse, compareValues); DrawOrder = drawOrder; Condition = condition; } public ButtonMethodAttribute(ButtonMethodDrawOrder drawOrder, string[] fieldToCheck, bool[] inverse = null, params object[] compare) { ConditionalData condition = new ConditionalData(fieldToCheck, inverse, compare); DrawOrder = drawOrder; Condition = condition; } public ButtonMethodAttribute(ButtonMethodDrawOrder drawOrder, params string[] fieldToCheck) { ConditionalData condition = new ConditionalData(fieldToCheck); DrawOrder = drawOrder; Condition = condition; } public ButtonMethodAttribute(ButtonMethodDrawOrder drawOrder, bool useMethod, string method, bool inverse = false) { ConditionalData condition = new ConditionalData(useMethod, method, inverse); DrawOrder = drawOrder; Condition = condition; } } public enum ButtonMethodDrawOrder { BeforeInspector, AfterInspector } public class CharactersRangeAttribute : PropertyAttribute { public readonly string Characters; public readonly CharacterRangeMode Mode; public readonly bool IgnoreCase; public CharactersRangeAttribute(string characters, CharacterRangeMode mode = CharacterRangeMode.Allow, bool ignoreCase = true) { Characters = characters; Mode = mode; IgnoreCase = ignoreCase; } } public enum CharacterRangeMode { Allow, Disallow, WarningIfAny, WarningIfNotMatch } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] public class ConditionalFieldAttribute : PropertyAttribute { public readonly ConditionalData Data; public bool IsSet { get { if (Data != null) { return Data.IsSet; } return false; } } public ConditionalFieldAttribute(string fieldToCheck, bool inverse = false, params object[] compareValues) { Data = new ConditionalData(fieldToCheck, inverse, compareValues); } public ConditionalFieldAttribute(string[] fieldToCheck, bool[] inverse = null, params object[] compare) { Data = new ConditionalData(fieldToCheck, inverse, compare); } public ConditionalFieldAttribute(params string[] fieldToCheck) { Data = new ConditionalData(fieldToCheck); } public ConditionalFieldAttribute(bool useMethod, string method, bool inverse = false) { Data = new ConditionalData(useMethod, method, inverse); } } public class ConstantsSelectionAttribute : PropertyAttribute { public readonly Type SelectFromType; public ConstantsSelectionAttribute(Type type) { SelectFromType = type; } } public class DefinedValuesAttribute : PropertyAttribute { public readonly object[] ValuesArray; public readonly string[] LabelsArray; public readonly string UseMethod; public DefinedValuesAttribute(params object[] definedValues) { ValuesArray = definedValues; } public DefinedValuesAttribute(bool withLabels, params object[] definedValues) { int num = definedValues.Length / 2; ValuesArray = new object[num]; LabelsArray = new string[num]; int num2 = 0; int num3; for (num3 = 0; num3 < definedValues.Length; num3++) { ValuesArray[num2] = definedValues[num3]; LabelsArray[num2] = definedValues[++num3].ToString(); num2++; } } public DefinedValuesAttribute(string method) { UseMethod = method; } } public class DisplayInspectorAttribute : PropertyAttribute { public readonly bool DisplayScript; public DisplayInspectorAttribute(bool displayScriptField = true) { DisplayScript = displayScriptField; } } public class FoldoutAttribute : PropertyAttribute { public readonly string Name; public readonly bool FoldEverything; public FoldoutAttribute(string name, bool foldEverything = false) { FoldEverything = foldEverything; Name = name; } } public class InitializationFieldAttribute : PropertyAttribute { } public class LayerAttribute : PropertyAttribute { } public class MaxValueAttribute : AttributeBase { private readonly float _x; private readonly float _y; private readonly float _z; private readonly bool _vectorValuesSet; public MaxValueAttribute(float value) { _x = value; } public MaxValueAttribute(float x, float y, float z) { _x = x; _y = y; _z = z; _vectorValuesSet = true; } } public class MinMaxRangeAttribute : PropertyAttribute { public readonly float Min; public readonly float Max; public MinMaxRangeAttribute(float min, float max) { Min = min; Max = max; } } [Serializable] public struct RangedFloat { public float Min; public float Max; public RangedFloat(float min, float max) { Min = min; Max = max; } } [Serializable] public struct RangedInt { public int Min; public int Max; public RangedInt(int min, int max) { Min = min; Max = max; } } public static class RangedExtensions { public static float LerpFromRange(this RangedFloat ranged, float t) { return Mathf.Lerp(ranged.Min, ranged.Max, t); } public static float LerpFromRangeUnclamped(this RangedFloat ranged, float t) { return Mathf.LerpUnclamped(ranged.Min, ranged.Max, t); } public static float LerpFromRange(this RangedInt ranged, float t) { return Mathf.Lerp((float)ranged.Min, (float)ranged.Max, t); } public static float LerpFromRangeUnclamped(this RangedInt ranged, float t) { return Mathf.LerpUnclamped((float)ranged.Min, (float)ranged.Max, t); } } public class MinValueAttribute : AttributeBase { private readonly float _x; private readonly float _y; private readonly float _z; private readonly bool _vectorValuesSet; public MinValueAttribute(float value) { _x = value; } public MinValueAttribute(float x, float y, float z) { _x = x; _y = y; _z = z; _vectorValuesSet = true; } } [AttributeUsage(AttributeTargets.Field)] public class MustBeAssignedAttribute : PropertyAttribute { } public class OverrideLabelAttribute : PropertyAttribute { public readonly string NewLabel; public OverrideLabelAttribute(string newLabel) { NewLabel = newLabel; } } public class PositiveValueOnlyAttribute : PropertyAttribute { } [AttributeUsage(AttributeTargets.Field)] public sealed class RangeVectorAttribute : PropertyAttribute { public readonly Vector3 min = Vector3.zero; public readonly Vector3 max = Vector3.zero; public bool Valid { get; } = true; public RangeVectorAttribute(float[] min, float[] max) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (min.Length > 3 || max.Length > 3) { Valid = false; return; } switch (min.Length) { case 3: this.min.x = min[0]; this.min.y = min[1]; this.min.z = min[2]; break; case 2: this.min.x = min[0]; this.min.y = min[1]; break; case 1: this.min.x = min[0]; break; } switch (max.Length) { case 3: this.max.x = max[0]; this.max.y = max[1]; this.max.z = max[2]; break; case 2: this.max.x = max[0]; this.max.y = max[1]; break; case 1: this.max.x = max[0]; break; } } } public class ReadOnlyAttribute : ConditionalFieldAttribute { public ReadOnlyAttribute(string fieldToCheck, bool inverse = false, params object[] compareValues) : base(fieldToCheck, inverse, compareValues) { } public ReadOnlyAttribute(string[] fieldToCheck, bool[] inverse = null, params object[] compare) : base(fieldToCheck, inverse, compare) { } public ReadOnlyAttribute(params string[] fieldToCheck) : base(fieldToCheck) { } public ReadOnlyAttribute(bool useMethod, string method, bool inverse = false) : base(useMethod, method, inverse) { } } public class RegexStringAttribute : PropertyAttribute { public readonly Regex Regex; public readonly RegexStringMode AttributeMode; public RegexStringAttribute(string regex, RegexStringMode mode = RegexStringMode.Match, RegexOptions options = RegexOptions.None) { Regex = new Regex(regex, options); AttributeMode = mode; } } public enum RegexStringMode { Match, Replace, WarningIfMatch, WarningIfNotMatch } [AttributeUsage(AttributeTargets.Class)] public class RequireLayerAttribute : Attribute { public readonly string LayerName; public readonly int LayerIndex = -1; public RequireLayerAttribute(string layer) { LayerName = layer; } public RequireLayerAttribute(int layer) { LayerIndex = layer; } } [AttributeUsage(AttributeTargets.Class)] public class RequireTagAttribute : Attribute { public string Tag; public RequireTagAttribute(string tag) { Tag = tag; } } [AttributeUsage(AttributeTargets.Field)] public class SceneAttribute : PropertyAttribute { } public class SearchableEnumAttribute : PropertyAttribute { } public class SeparatorAttribute : PropertyAttribute { public readonly string Title; public readonly bool WithOffset; public SeparatorAttribute() { Title = ""; } public SeparatorAttribute(string title, bool withOffset = false) { Title = title; WithOffset = withOffset; } } public class SpriteLayerAttribute : PropertyAttribute { } public class TagAttribute : PropertyAttribute { } [PublicAPI] public static class MyAlgorithms { public static T Cast<T>(this IConvertible source) { return (T)Convert.ChangeType(source, typeof(T)); } public static bool Is<T>(this object source) { return source is T; } public static T As<T>(this object source) where T : class { return source as T; } public static T Pipe<T>(this T argument, Action<T> action) { action(argument); return argument; } public static TResult Pipe<T, TResult>(this T argument, Func<T, TResult> function) { return function(argument); } public static T PipeKeep<T, TResult>(this T argument, Func<T, TResult> function) { function(argument); return argument; } } [PublicAPI] public static class MyCollections { public static T[] InsertAt<T>(this T[] array, int index) { if (index < 0) { Debug.LogError((object)"Index is less than zero. Array is not modified"); return array; } if (index > array.Length) { Debug.LogError((object)"Index exceeds array length. Array is not modified"); return array; } T[] array2 = new T[array.Length + 1]; int num = 0; for (int i = 0; i < array2.Length; i++) { if (i != index) { array2[i] = array[num]; num++; } } return array2; } public static T[] RemoveAt<T>(this T[] array, int index) { if (index < 0) { Debug.LogError((object)"Index is less than zero. Array is not modified"); return array; } if (index >= array.Length) { Debug.LogError((object)"Index exceeds array length. Array is not modified"); return array; } T[] array2 = new T[array.Length - 1]; int num = 0; for (int i = 0; i < array.Length; i++) { if (i != index) { array2[num] = array[i]; num++; } } return array2; } public static T GetRandom<T>(this T[] collection) { return collection[Random.Range(0, collection.Length)]; } public static T GetRandom<T>(this IList<T> collection) { return collection[Random.Range(0, collection.Count)]; } public static T GetRandom<T>(this IEnumerable<T> collection) { return collection.ElementAt(Random.Range(0, collection.Count())); } public static bool IsNullOrEmpty<T>(this T[] collection) { if (collection != null) { return collection.Length == 0; } return true; } public static bool IsNullOrEmpty<T>(this IList<T> collection) { if (collection != null) { return collection.Count == 0; } return true; } public static bool IsNullOrEmpty<T>(this IEnumerable<T> collection) { if (collection != null) { return !collection.Any(); } return true; } public static bool NotNullOrEmpty<T>(this T[] collection) { return !collection.IsNullOrEmpty(); } public static bool NotNullOrEmpty<T>(this IList<T> collection) { return !collection.IsNullOrEmpty(); } public static bool NotNullOrEmpty<T>(this IEnumerable<T> collection) { return !collection.IsNullOrEmpty(); } public static int NextIndexInCircle<T>(this T[] array, int desiredPosition) { if (array.IsNullOrEmpty()) { Debug.LogError((object)"NextIndexInCircle Caused: source array is null or empty"); return -1; } int num = array.Length; if (num == 1) { return 0; } return (desiredPosition % num + num) % num; } public static int IndexOfItem<T>(this IEnumerable<T> collection, T item) { if (collection == null) { Debug.LogError((object)"IndexOfItem Caused: source collection is null"); return -1; } int num = 0; foreach (T item2 in collection) { if (object.Equals(item2, item)) { return num; } num++; } return -1; } public static bool ContentsMatch<T>(this IEnumerable<T> first, IEnumerable<T> second) { if (first.IsNullOrEmpty() && second.IsNullOrEmpty()) { return true; } if (first.IsNullOrEmpty() || second.IsNullOrEmpty()) { return false; } int num = first.Count(); int num2 = second.Count(); if (num != num2) { return false; } foreach (T item in first) { if (!second.Contains(item)) { return false; } } return true; } public static bool ContentsMatchKeys<T1, T2>(this IDictionary<T1, T2> source, IEnumerable<T1> check) { if (source.IsNullOrEmpty() && check.IsNullOrEmpty()) { return true; } if (source.IsNullOrEmpty() || check.IsNullOrEmpty()) { return false; } return source.Keys.ContentsMatch(check); } public static bool ContentsMatchValues<T1, T2>(this IDictionary<T1, T2> source, IEnumerable<T2> check) { if (source.IsNullOrEmpty() && check.IsNullOrEmpty()) { return true; } if (source.IsNullOrEmpty() || check.IsNullOrEmpty()) { return false; } return source.Values.ContentsMatch(check); } public static TValue GetOrAddDefault<TKey, TValue>(this IDictionary<TKey, TValue> source, TKey key) where TValue : new() { if (!source.ContainsKey(key)) { source[key] = new TValue(); } return source[key]; } public static TValue GetOrAdd<TKey, TValue>(this IDictionary<TKey, TValue> source, TKey key, TValue value) { if (!source.ContainsKey(key)) { source[key] = value; } return source[key]; } public static TValue GetOrAdd<TKey, TValue>(this IDictionary<TKey, TValue> source, TKey key, Func<TValue> valueFactory) { if (!source.ContainsKey(key)) { source[key] = valueFactory(); } return source[key]; } public static TValue GetOrAdd<TKey, TValue>(this IDictionary<TKey, TValue> source, TKey key, Func<TKey, TValue> valueFactory) { if (!source.ContainsKey(key)) { source[key] = valueFactory(key); } return source[key]; } public static TValue GetOrAdd<TKey, TValue, TArg>(this IDictionary<TKey, TValue> source, TKey key, Func<TKey, TArg, TValue> valueFactory, TArg factoryArgument) { if (!source.ContainsKey(key)) { source[key] = valueFactory(key, factoryArgument); } return source[key]; } public static IEnumerable<T> ForEach<T>(this IEnumerable<T> source, Action<T> action) { foreach (T item in source) { action(item); } return source; } public static IEnumerable<T> ForEach<T, R>(this IEnumerable<T> source, Func<T, R> func) { foreach (T item in source) { func(item); } return source; } public static IEnumerable<T> ForEach<T>(this IEnumerable<T> source, Action<T, int> action) { int num = 0; foreach (T item in source) { action(item, num); num++; } return source; } public static IEnumerable<T> ForEach<T, R>(this IEnumerable<T> source, Func<T, int, R> func) { int num = 0; foreach (T item in source) { func(item, num); num++; } return source; } public static T MaxBy<T, S>(this IEnumerable<T> source, Func<T, S> selector) where S : IComparable<S> { if (source.IsNullOrEmpty()) { Debug.LogError((object)"MaxBy Caused: source collection is null or empty"); return default(T); } return source.Aggregate((T e, T n) => (selector(e).CompareTo(selector(n)) <= 0) ? n : e); } public static T MinBy<T, S>(this IEnumerable<T> source, Func<T, S> selector) where S : IComparable<S> { if (source.IsNullOrEmpty()) { Debug.LogError((object)"MinBy Caused: source collection is null or empty"); return default(T); } return source.Aggregate((T e, T n) => (selector(e).CompareTo(selector(n)) >= 0) ? n : e); } public static IEnumerable<T> SingleToEnumerable<T>(this T source) { return Enumerable.Empty<T>().Append(source); } public static int FirstIndex<T>(this IList<T> source, Predicate<T> predicate) { for (int i = 0; i < source.Count; i++) { if (predicate(source[i])) { return i; } } return -1; } public static int FirstIndex<T>(this IEnumerable<T> source, Predicate<T> predicate) { int num = 0; foreach (T item in source) { if (predicate(item)) { return num; } num++; } return -1; } public static int LastIndex<T>(this IList<T> source, Predicate<T> predicate) { for (int num = source.Count - 1; num >= 0; num--) { if (predicate(source[num])) { return num; } } return -1; } public static int GetWeightedRandomIndex<T>(this IEnumerable<T> source, Func<T, double> weightSelector) { IEnumerable<double> weights = from w in source.Select(weightSelector) select (!(w < 0.0)) ? w : 0.0; IEnumerable<double> source2 = weights.Select((double w, int i) => weights.Take(i + 1).Sum()); double roll = MyCommonConstants.SystemRandom.NextDouble() * weights.Sum(); return source2.FirstIndex((double ws) => ws > roll); } public static T GetWeightedRandom<T>(this IList<T> source, Func<T, double> weightSelector) { return source[source.GetWeightedRandomIndex(weightSelector)]; } public static T GetWeightedRandom<T>(this IEnumerable<T> source, Func<T, double> weightSelector) { return source.ElementAt(source.GetWeightedRandomIndex(weightSelector)); } public static IList<T> FillBy<T>(this IList<T> source, Func<int, T> valueFactory) { for (int i = 0; i < source.Count; i++) { source[i] = valueFactory(i); } return source; } public static T[] FillBy<T>(this T[] source, Func<int, T> valueFactory) { for (int i = 0; i < source.Length; i++) { source[i] = valueFactory(i); } return source; } public static T[] ExclusiveSample<T>(this IList<T> source, int sampleNumber) { if (sampleNumber > source.Count) { throw new ArgumentOutOfRangeException("Cannot sample more elements than what the source collection contains"); } T[] array = new T[sampleNumber]; int num = 0; for (int i = 0; i < source.Count; i++) { if (num >= sampleNumber) { break; } double num2 = (double)(sampleNumber - num) / (double)(source.Count - i); if (MyCommonConstants.SystemRandom.NextDouble() < num2) { array[num] = source[i]; num++; } } return array; } public static IList<T> SwapInPlace<T>(this IList<T> source, int index1, int index2) { T val = source[index2]; T val2 = source[index1]; T val4 = (source[index1] = val); val4 = (source[index2] = val2); return source; } public static IList<T> Shuffle<T>(this IList<T> source) { for (int i = 0; i < source.Count - 1; i++) { int index = Random.Range(i, source.Count); source.SwapInPlace(i, index); } return source; } } public static class MyColor { private const float LightOffset = 0.0625f; public static Color RandomBright => new Color(Random.Range(0.4f, 1f), Random.Range(0.4f, 1f), Random.Range(0.4f, 1f)); public static Color RandomDim => new Color(Random.Range(0.4f, 0.6f), Random.Range(0.4f, 0.8f), Random.Range(0.4f, 0.8f)); public static Color RandomColor => new Color(Random.Range(0.1f, 0.9f), Random.Range(0.1f, 0.9f), Random.Range(0.1f, 0.9f)); public static Color WithAlphaSetTo(this Color color, float a) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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) return new Color(color.r, color.g, color.b, a); } public static void SetAlpha(this Graphic graphic, float a) { //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) graphic.color = graphic.color.WithAlphaSetTo(a); } public static void SetAlpha(this SpriteRenderer renderer, float a) { //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) renderer.color = renderer.color.WithAlphaSetTo(a); } public static string ToHex(this Color color) { //IL_0005: 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_0029: Unknown result type (might be due to invalid IL or missing references) return $"#{(int)(color.r * 255f):X2}{(int)(color.g * 255f):X2}{(int)(color.b * 255f):X2}"; } public static Color Lighter(this Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return color.BrightnessOffset(0.0625f); } public static Color Darker(this Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return color.BrightnessOffset(-0.0625f); } public static Color BrightnessOffset(this Color color, float offset) { //IL_0000: 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_0010: 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_001e: Unknown result type (might be due to invalid IL or missing references) return new Color(color.r + offset, color.g + offset, color.b + offset, color.a); } public static Color ToUnityColor(this string source) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) Color result = default(Color); ColorUtility.TryParseHtmlString(source, ref result); return result; } } public class MyCommonConstants { public static readonly Random SystemRandom = new Random(); } public static class MyCoroutines { private static CoroutineOwner _coroutineOwner; private static CoroutineOwner CoroutineOwner { get { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_coroutineOwner != (Object)null) { return _coroutineOwner; } GameObject val = new GameObject("Static Coroutine Owner"); Object.DontDestroyOnLoad((Object)val); ((Object)val).hideFlags = (HideFlags)61; _coroutineOwner = val.AddComponent<CoroutineOwner>(); return _coroutineOwner; } } public static Coroutine StartCoroutine(this IEnumerator coroutine) { return ((MonoBehaviour)CoroutineOwner).StartCoroutine(coroutine); } public static Coroutine StartNext(this Coroutine coroutine, IEnumerator nextCoroutine) { return StartNextCoroutine(coroutine, nextCoroutine).StartCoroutine(); } public static Coroutine OnComplete(this Coroutine coroutine, Action onComplete) { return OnCompleteCoroutine(coroutine, onComplete).StartCoroutine(); } public static void StopCoroutine(Coroutine coroutine) { ((MonoBehaviour)CoroutineOwner).StopCoroutine(coroutine); } public static void StopAllCoroutines() { ((MonoBehaviour)CoroutineOwner).StopAllCoroutines(); } public static CoroutineGroup CreateGroup(MonoBehaviour owner = null) { return new CoroutineGroup((MonoBehaviour)(object)(((Object)(object)owner != (Object)null) ? ((CoroutineOwner)(object)owner) : CoroutineOwner)); } private static IEnumerator StartNextCoroutine(Coroutine coroutine, IEnumerator nextCoroutine) { yield return coroutine; yield return nextCoroutine.StartCoroutine(); } private static IEnumerator OnCompleteCoroutine(Coroutine coroutine, Action onComplete) { yield return coroutine; onComplete?.Invoke(); } } public static class MyDebug { private static StringBuilder _stringBuilder; private static void PrepareStringBuilder() { if (_stringBuilder == null) { _stringBuilder = new StringBuilder(); } else { _stringBuilder.Clear(); } } public static void LogArray<T>(T[] toLog) { PrepareStringBuilder(); _stringBuilder.Append("Log Array: ").Append(typeof(T).Name).Append(" (") .Append(toLog.Length) .Append(")\n"); for (int i = 0; i < toLog.Length; i++) { _stringBuilder.Append("\n\t").Append(i.ToString().Colored(Colors.brown)).Append(": ") .Append(toLog[i]); } Debug.Log((object)_stringBuilder.ToString()); } public static void LogArray<T>(IList<T> toLog) { PrepareStringBuilder(); int count = toLog.Count; _stringBuilder.Append("Log Array: ").Append(typeof(T).Name).Append(" (") .Append(count) .Append(")\n"); for (int i = 0; i < count; i++) { _stringBuilder.Append("\n\t" + i.ToString().Colored(Colors.brown) + ": " + toLog[i]); } Debug.Log((object)_stringBuilder.ToString()); } public static void LogColor(Color color) { //IL_0005: 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_0011: Unknown result type (might be due to invalid IL or missing references) string text = ColorUtility.ToHtmlStringRGB(color); Color val = color; Debug.Log((object)("<color=#" + text + ">████████████</color> = " + ((object)(Color)(ref val)).ToString())); } public static void DrawDebugBounds(MeshFilter mesh, Color color) { } public static void DrawDebugBounds(MeshRenderer renderer, Color color) { } public static void DrawDebugBounds(Bounds bounds, Color color) { } public static void DrawString(string text, Vector3 worldPos, Color? colour = null) { } public static void DrawArrowRay(Vector3 position, Vector3 direction, float headLength = 0.25f, float headAngle = 20f) { } public static void DrawDimensionalCross(Vector3 position, float size) { } } public static class MyDelayedActions { public static Coroutine DelayedAction(float waitSeconds, Action action, bool unscaled = false) { return DelayedActionCoroutine(waitSeconds, action, unscaled).StartCoroutine(); } public static void DelayedAction(Action action) { Coroutine().StartCoroutine(); IEnumerator Coroutine() { yield return null; action?.Invoke(); } } public static Coroutine DelayedAction(this MonoBehaviour invoker, float waitSeconds, Action action, bool unscaled = false) { return invoker.StartCoroutine(DelayedActionCoroutine(waitSeconds, action, unscaled)); } public static Coroutine DelayedAction(this MonoBehaviour invoker, Action action) { return invoker.StartCoroutine(Coroutine()); IEnumerator Coroutine() { yield return null; action?.Invoke(); } } public static IEnumerator DelayedUiSelection(GameObject objectToSelect) { yield return null; EventSystem.current.SetSelectedGameObject((GameObject)null); EventSystem.current.SetSelectedGameObject(objectToSelect); } public static Coroutine DelayedUiSelection(this MonoBehaviour invoker, GameObject objectToSelect) { return invoker.StartCoroutine(DelayedUiSelection(objectToSelect)); } private static IEnumerator DelayedActionCoroutine(float waitSeconds, Action action, bool unscaled = false) { if (unscaled) { yield return (object)new WaitForSecondsRealtime(waitSeconds); } else { yield return (object)new WaitForSeconds(waitSeconds); } action?.Invoke(); } } public static class MyExtensions { public struct ComponentOfInterface<T> { public readonly Component Component; public readonly T Interface; public ComponentOfInterface(Component component, T @interface) { Component = component; Interface = @interface; } } public static void Swap<T>(this T[] array, int a, int b) { T val = array[b]; T val2 = array[a]; array[a] = val; array[b] = val2; } public static bool IsWorldPointInViewport(this Camera camera, Vector3 point) { //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_0008: 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) Vector3 val = camera.WorldToViewportPoint(point); if (val.x > 0f) { return val.y > 0f; } return false; } public static Vector3 WorldPointOffsetByDepth(this Camera camera, Vector3 source, float distanceFromCamera, MonoOrStereoscopicEye eye = 2) { //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_0003: 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_000a: 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_0011: 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) Vector3 vector = camera.WorldToScreenPoint(source, eye); return camera.ScreenToWorldPoint(vector.SetZ(distanceFromCamera), eye); } public static void ResetPosition(this Transform transform) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) transform.position = Vector3.zero; } public static Transform SetLossyScale(this Transform source, Vector3 targetLossyScale) { //IL_0002: 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_0011: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) source.localScale = source.lossyScale.Pow(-1f).ScaleBy(targetLossyScale).ScaleBy(source.localScale); return source; } public static T SetLayerRecursively<T>(this T source, string layerName) where T : Component { ((Component)source).gameObject.SetLayerRecursively(LayerMask.NameToLayer(layerName)); return source; } public static T SetLayerRecursively<T>(this T source, int layer) where T : Component { ((Component)source).gameObject.SetLayerRecursively(layer); return source; } public static GameObject SetLayerRecursively(this GameObject source, string layerName) { source.SetLayerRecursively(LayerMask.NameToLayer(layerName)); return source; } public static GameObject SetLayerRecursively(this GameObject source, int layer) { Transform[] componentsInChildren = source.GetComponentsInChildren<Transform>(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Component)componentsInChildren[i]).gameObject.layer = layer; } return source; } public static T GetOrAddComponent<T>(this GameObject gameObject) where T : Component { T component = gameObject.GetComponent<T>(); if ((Object)(object)component != (Object)null) { return component; } return gameObject.AddComponent<T>(); } public static T GetOrAddComponent<T>(this Component component) where T : Component { return component.gameObject.GetOrAddComponent<T>(); } public static bool HasComponent<T>(this GameObject gameObject) { return gameObject.GetComponent<T>() != null; } public static bool HasComponent<T>(this Component component) { return component.GetComponent<T>() != null; } public static List<Transform> GetChildsWhere(this Transform transform, Predicate<Transform> match) { List<Transform> list = new List<Transform>(); RecursiveCheck(transform); return list; void RecursiveCheck(Transform parent) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown foreach (Transform item in parent) { Transform val = item; RecursiveCheck(val); if (match(val)) { list.Add(val); } } } } public static List<Transform> GetObjectsOfLayerInChilds(this GameObject gameObject, int layer) { return gameObject.transform.GetChildsWhere((Transform t) => ((Component)t).gameObject.layer == layer); } public static List<Transform> GetObjectsOfLayerInChilds(this GameObject gameObject, string layer) { return gameObject.GetObjectsOfLayerInChilds(LayerMask.NameToLayer(layer)); } public static List<Transform> GetObjectsOfLayerInChilds(this Component component, string layer) { return component.GetObjectsOfLayerInChilds(LayerMask.NameToLayer(layer)); } public static List<Transform> GetObjectsOfLayerInChilds(this Component component, int layer) { return component.gameObject.GetObjectsOfLayerInChilds(layer); } public static void SetBodyState(this Rigidbody body, bool state) { body.isKinematic = !state; body.detectCollisions = state; } public static T[] FindObjectsOfInterface<T>() where T : class { return (from behaviour in Object.FindObjectsOfType<Transform>() select ((Component)behaviour).GetComponent(typeof(T))).OfType<T>().ToArray(); } public static ComponentOfInterface<T>[] FindObjectsOfInterfaceAsComponents<T>() where T : class { return (from c in Object.FindObjectsOfType<Component>() where c is T select new ComponentOfInterface<T>(c, c as T)).ToArray(); } public static T[] OnePerInstance<T>(this T[] components) where T : Component { if (components == null || components.Length == 0) { return null; } return (from h in components group h by ((Object)((Component)h).transform).GetInstanceID() into g select g.First()).ToArray(); } public static RaycastHit2D[] OneHitPerInstance(this RaycastHit2D[] hits) { if (hits == null || hits.Length == 0) { return null; } return (from h in hits group h by ((Object)((RaycastHit2D)(ref h)).transform).GetInstanceID() into g select g.First()).ToArray(); } public static Collider2D[] OneHitPerInstance(this Collider2D[] hits) { if (hits == null || hits.Length == 0) { return null; } return (from h in hits group h by ((Object)((Component)h).transform).GetInstanceID() into g select g.First()).ToArray(); } public static List<Collider2D> OneHitPerInstanceList(this Collider2D[] hits) { if (hits == null || hits.Length == 0) { return null; } return (from h in hits group h by ((Object)((Component)h).transform).GetInstanceID() into g select g.First()).ToList(); } } public static class MyGizmos { public static void DrawArrow(Vector3 from, Vector3 direction, float headLength = 0.25f, float headAngle = 20f) { } } public static class MyInput { public static bool GetNumberDown(int num) { switch (num) { case 0: if (Input.GetKeyDown((KeyCode)48) || Input.GetKeyDown((KeyCode)256)) { return true; } break; case 1: if (Input.GetKeyDown((KeyCode)49) || Input.GetKeyDown((KeyCode)257)) { return true; } break; case 2: if (Input.GetKeyDown((KeyCode)50) || Input.GetKeyDown((KeyCode)258)) { return true; } break; case 3: if (Input.GetKeyDown((KeyCode)51) || Input.GetKeyDown((KeyCode)259)) { return true; } break; case 4: if (Input.GetKeyDown((KeyCode)52) || Input.GetKeyDown((KeyCode)260)) { return true; } break; case 5: if (Input.GetKeyDown((KeyCode)53) || Input.GetKeyDown((KeyCode)261)) { return true; } break; case 6: if (Input.GetKeyDown((KeyCode)54) || Input.GetKeyDown((KeyCode)262)) { return true; } break; case 7: if (Input.GetKeyDown((KeyCode)55) || Input.GetKeyDown((KeyCode)263)) { return true; } break; case 8: if (Input.GetKeyDown((KeyCode)56) || Input.GetKeyDown((KeyCode)264)) { return true; } break; case 9: if (Input.GetKeyDown((KeyCode)57) || Input.GetKeyDown((KeyCode)265)) { return true; } break; } return false; } public static int GetNumberDown(KeyCode key) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Invalid comparison between Unknown and I4 //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between Unknown and I4 //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Invalid comparison between Unknown and I4 //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Invalid comparison between Unknown and I4 //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Invalid comparison between Unknown and I4 //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Invalid comparison between Unknown and I4 //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Invalid comparison between Unknown and I4 //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Invalid comparison between Unknown and I4 //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Invalid comparison between Unknown and I4 //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Invalid comparison between Unknown and I4 if ((int)key == 48 || (int)key == 256) { return 0; } if ((int)key == 49 || (int)key == 257) { return 1; } if ((int)key == 50 || (int)key == 258) { return 2; } if ((int)key == 51 || (int)key == 259) { return 3; } if ((int)key == 52 || (int)key == 260) { return 4; } if ((int)key == 53 || (int)key == 261) { return 5; } if ((int)key == 54 || (int)key == 262) { return 6; } if ((int)key == 55 || (int)key == 263) { return 7; } if ((int)key == 56 || (int)key == 264) { return 8; } if ((int)key == 57 || (int)key == 265) { return 9; } return -1; } public static int GetNumberDown() { if (Input.GetKeyDown((KeyCode)48) || Input.GetKeyDown((KeyCode)256)) { return 0; } if (Input.GetKeyDown((KeyCode)49) || Input.GetKeyDown((KeyCode)257)) { return 1; } if (Input.GetKeyDown((KeyCode)50) || Input.GetKeyDown((KeyCode)258)) { return 2; } if (Input.GetKeyDown((KeyCode)51) || Input.GetKeyDown((KeyCode)259)) { return 3; } if (Input.GetKeyDown((KeyCode)52) || Input.GetKeyDown((KeyCode)260)) { return 4; } if (Input.GetKeyDown((KeyCode)53) || Input.GetKeyDown((KeyCode)261)) { return 5; } if (Input.GetKeyDown((KeyCode)54) || Input.GetKeyDown((KeyCode)262)) { return 6; } if (Input.GetKeyDown((KeyCode)55) || Input.GetKeyDown((KeyCode)263)) { return 7; } if (Input.GetKeyDown((KeyCode)56) || Input.GetKeyDown((KeyCode)264)) { return 8; } if (Input.GetKeyDown((KeyCode)57) || Input.GetKeyDown((KeyCode)265)) { return 9; } return -1; } public static string ToReadableString(this KeyCode key, bool full = false) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected I4, but got Unknown switch (key - 323) { case 0: if (!full) { return "LMB"; } return "Left Mouse Button"; case 1: if (!full) { return "RMB"; } return "Right Mouse Button"; case 2: if (!full) { return "MMB"; } return "Middle Mouse Button"; default: return Regex.Replace(((object)(KeyCode)(ref key)).ToString(), "(\\B[A-Z])", " $1"); } } public static bool AnyKeyDown(KeyCode key1, KeyCode key2) { //IL_0000: 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) if (!Input.GetKeyDown(key1)) { return Input.GetKeyDown(key2); } return true; } public static bool AnyKeyDown(KeyCode key1, KeyCode key2, KeyCode key3) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (!AnyKeyDown(key1, key2)) { return Input.GetKeyDown(key3); } return true; } public static bool IsLeft() { return AnyKeyDown((KeyCode)97, (KeyCode)276, (KeyCode)260); } public static bool IsRight() { return AnyKeyDown((KeyCode)100, (KeyCode)275, (KeyCode)262); } public static bool IsUp() { return AnyKeyDown((KeyCode)119, (KeyCode)273, (KeyCode)264); } public static bool IsDown() { return AnyKeyDown((KeyCode)115, (KeyCode)274, (KeyCode)258); } public static int KeypadDirection() { if (IsLeft()) { return 4; } if (IsRight()) { return 6; } if (IsUp()) { return 8; } if (IsDown()) { return 2; } if (Input.GetKeyDown((KeyCode)257)) { return 1; } if (Input.GetKeyDown((KeyCode)259)) { return 3; } if (Input.GetKeyDown((KeyCode)263)) { return 7; } if (Input.GetKeyDown((KeyCode)265)) { return 9; } return 0; } public static int KeypadX() { if (IsLeft()) { return -1; } if (IsRight()) { return 1; } if (Input.GetKeyDown((KeyCode)257)) { return -1; } if (Input.GetKeyDown((KeyCode)263)) { return -1; } if (Input.GetKeyDown((KeyCode)259)) { return 1; } if (Input.GetKeyDown((KeyCode)265)) { return 1; } return 0; } public static int KeypadY() { if (IsUp()) { return 1; } if (IsDown()) { return -1; } if (Input.GetKeyDown((KeyCode)257)) { return -1; } if (Input.GetKeyDown((KeyCode)259)) { return -1; } if (Input.GetKeyDown((KeyCode)263)) { return 1; } if (Input.GetKeyDown((KeyCode)265)) { return 1; } return 0; } } public static class MyLayers { public static LayerMask ToLayerMask(int layer) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return LayerMask.op_Implicit(1 << layer); } public static bool LayerInMask(this LayerMask mask, int layer) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return ((1 << layer) & LayerMask.op_Implicit(mask)) != 0; } } public static class MyMath { public static void Swap<T>(ref T a, ref T b) { T val = b; T val2 = a; a = val; b = val2; } public static float Clamp(this float value, float min, float max) { return Mathf.Clamp(value, min, max); } public static int Clamp(this int value, int min, int max) { return Mathf.Clamp(value, min, max); } public static float Snap(this float val, float round) { return round * Mathf.Round(val / round); } public static float Round(this float val) { return Mathf.Round(val); } public static int RoundToInt(this float val) { return Mathf.RoundToInt(val); } public static int Sign(IComparable x) { return x.CompareTo(0); } public static bool Approximately(this float value, float compare) { return Mathf.Approximately(value, compare); } public static bool InRange01(this float value) { return value.InRange(0f, 1f); } public static bool InRange<T>(this T value, T closedLeft, T openRight) where T : IComparable { if (value.CompareTo(closedLeft) >= 0) { return value.CompareTo(openRight) < 0; } return false; } public static bool InRange(this float value, RangedFloat range) { return value.InRange(range.Min, range.Max); } public static bool InRange(this int value, RangedInt range) { return value.InRange(range.Min, range.Max); } public static bool InRangeInclusive<T>(this T value, T closedLeft, T closedRight) where T : IComparable { if (value.CompareTo(closedLeft) >= 0) { return value.CompareTo(closedRight) <= 0; } return false; } public static bool InRangeInclusive(this float value, RangedFloat range) { return value.InRangeInclusive(range.Min, range.Max); } public static bool InRangeInclusive(this int value, RangedInt range) { return value.InRangeInclusive(range.Min, range.Max); } public static float NotInRange(this float num, float min, float max) { if (min > max) { float num2 = max; float num3 = min; min = num2; max = num3; } if (num < min || num > max) { return num; } float num4 = (max - min) / 2f; if (num > min) { if (!(num + num4 < max)) { return max; } return min; } if (!(num - num4 > min)) { return min; } return max; } public static int NotInRange(this int num, int min, int max) { return (int)((float)num).NotInRange((float)min, (float)max); } public static float ClosestPoint(this float num, float pointA, float pointB) { if (pointA > pointB) { float num2 = pointB; float num3 = pointA; pointA = num2; pointB = num3; } float num4 = (pointB - pointA) / 2f; if (!(num.NotInRange(pointA, pointB) + num4 >= pointB)) { return pointA; } return pointB; } public static bool ClosestPointIsA(this float num, float pointA, float pointB) { return Mathf.Approximately(num.ClosestPoint(pointA, pointB), pointA); } } public static class MyNavMesh { public static float GetLength(this NavMeshPath path) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) Vector3[] corners = path.corners; float num = 0f; for (int i = 1; i < corners.Length; i++) { num += Vector3.Distance(corners[i - 1], corners[i]); } return num; } public static float GetTimeToPass(this NavMeshPath path, float speed) { return path.GetLength() / speed + (float)(path.corners.Length - 1) * 0.5f; } public static Vector3 GetPointOnPath(this NavMeshPath path, float rate) { //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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0062: Unknown result type (might be due to invalid IL or missing references) rate = Mathf.Clamp01(rate); float length = path.GetLength(); float num = 0f; for (int i = 1; i < path.corners.Length; i++) { Vector3 val = path.corners[i - 1]; Vector3 val2 = path.corners[i]; float num2 = Vector3.Distance(val, val2) / length; num += num2; if (rate <= num) { float num3 = num - rate; float num4 = 1f - num3 / num2; return Vector3.Lerp(val, val2, num4); } } return path.corners[path.corners.Length - 1]; } public static IEnumerable<Vector3> GetPointsOnPath(this NavMeshPath path, float distance = 1f) { float pieceTraversedDistance = 0f; for (int i = 1; i < path.corners.Length; i++) { Vector3 from = path.corners[i - 1]; Vector3 to = path.corners[i]; float pieceLength; for (pieceLength = Vector3.Distance(from, to); pieceTraversedDistance < pieceLength + distance; pieceTraversedDistance += distance) { float num = pieceTraversedDistance / pieceLength; yield return Vector3.Lerp(from, to, num); } pieceTraversedDistance -= pieceLength; } } } public static class MyObsoleteExtensions { [Obsolete("1.6.3: Use MyCollections.GetOrAdd instead")] public static TValue GetOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> source, TKey key, TValue customDefault = default(TValue)) { return source.GetOrAdd(key, customDefault); } [Obsolete("1.6.3: Use MyCollections.GetOrAdd instead")] public static TValue GetOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> source, TKey key, Func<TValue> customDefaultGenerator) { return source.GetOrAdd(key, customDefaultGenerator()); } } public static class MyPhysics { public static Rigidbody ToggleConstraints(this Rigidbody source, RigidbodyConstraints constraints, bool state) { //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_0009: Unknown result type (might be due to invalid IL or missing references) source.constraints = source.constraints.BitwiseToggle(constraints, state); return source; } public static Rigidbody2D ToggleConstraints(this Rigidbody2D source, RigidbodyConstraints2D constraints, bool state) { //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_0009: Unknown result type (might be due to invalid IL or missing references) source.constraints = source.constraints.BitwiseToggle(constraints, state); return source; } } public static class MyPhysicsExtensions { public static RigidbodyConstraints BitwiseToggle(this RigidbodyConstraints source, RigidbodyConstraints bitMask, bool state) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) if (!state) { return (RigidbodyConstraints)(source & ~bitMask); } return (RigidbodyConstraints)(source | bitMask); } public static RigidbodyConstraints2D BitwiseToggle(this RigidbodyConstraints2D source, RigidbodyConstraints2D bitMask, bool state) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) if (!state) { return (RigidbodyConstraints2D)(source & ~bitMask); } return (RigidbodyConstraints2D)(source | bitMask); } } public static class MyReflection { public static bool HasMethod(this object target, string methodName) { return target.GetType().GetMethod(methodName) != null; } public static bool HasField(this object target, string fieldName) { return target.GetType().GetField(fieldName) != null; } public static bool HasProperty(this object target, string propertyName) { return target.GetType().GetProperty(propertyName) != null; } } public static class MyRegex { public const string WholeNumber = "^-?\\d+$"; public const string FloatingNumber = "^-?\\d*(\\.\\d+)?$"; public const string AlphanumericWithoutSpace = "^[a-zA-Z0-9]*$"; public const string AlphanumericWithSpace = "^[a-zA-Z0-9 ]*$"; public const string Email = "^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,6})*$"; public const string URL = "(https?:\\/\\/)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)"; public static string KeepMatching(this Regex regex, string input) { return regex.Matches(input).Cast<Match>().Aggregate(string.Empty, (string a, Match m) => a + m.Value); } } public static class MyString { public static bool IsNullOrEmpty(this string str) { return string.IsNullOrEmpty(str); } public static bool NotNullOrEmpty(this string str) { return !string.IsNullOrEmpty(str); } public static string RemoveStart(this string str, string remove) { int num = str.IndexOf(remove, StringComparison.Ordinal); if (num >= 0) { return str.Remove(num, remove.Length); } return str; } public static string RemoveEnd(this string str, string remove) { if (!str.EndsWith(remove)) { return str; } return str.Remove(str.LastIndexOf(remove, StringComparison.Ordinal)); } public static string ToCamelCase(this string message) { message = message.Replace("-", " ").Replace("_", " "); message = CultureInfo.InvariantCulture.TextInfo.ToTitleCase(message); message = message.Replace(" ", ""); return message; } public static string SplitCamelCase(this string camelCaseString) { if (string.IsNullOrEmpty(camelCaseString)) { return camelCaseString; } string text = Regex.Replace(Regex.Replace(camelCaseString, "(\\P{Ll})(\\P{Ll}\\p{Ll})", "$1 $2"), "(\\p{Ll})(\\P{Ll})", "$1 $2"); string text2 = text.Substring(0, 1).ToUpper(); if (camelCaseString.Length > 1) { string text3 = text.Substring(1); return text2 + text3; } return text2; } public static T AsEnum<T>(this string source, bool ignoreCase = true) where T : Enum { return (T)Enum.Parse(typeof(T), source, ignoreCase); } public static string ToRoman(this int i) { if (i > 999) { return "M" + (i - 1000).ToRoman(); } if (i > 899) { return "CM" + (i - 900).ToRoman(); } if (i > 499) { return "D" + (i - 500).ToRoman(); } if (i > 399) { return "CD" + (i - 400).ToRoman(); } if (i > 99) { return "C" + (i - 100).ToRoman(); } if (i > 89) { return "XC" + (i - 90).ToRoman(); } if (i > 49) { return "L" + (i - 50).ToRoman(); } if (i > 39) { return "XL" + (i - 40).ToRoman(); } if (i > 9) { return "X" + (i - 10).ToRoman(); } if (i > 8) { return "IX" + (i - 9).ToRoman(); } if (i > 4) { return "V" + (i - 5).ToRoman(); } if (i > 3) { return "IV" + (i - 4).ToRoman(); } if (i > 0) { return "I" + (i - 1).ToRoman(); } return ""; } public static string SurroundedWith(this string message, string surround) { return surround + message + surround; } public static string SurroundedWith(this string message, string start, string end) { return start + message + end; } public static string Colored(this string message, Colors color) { return $"<color={color}>{message}</color>"; } public static string Colored(this string message, Color color) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) return "<color=" + color.ToHex() + ">" + message + "</color>"; } public static string Colored(this string message, string colorCode) { return "<color=" + colorCode + ">" + message + "</color>"; } public static string Sized(this string message, int size) { return $"<size={size}>{message}</size>"; } public static string Underlined(this string message) { return "<u>" + message + "</u>"; } public static string Bold(this string message) { return "<b>" + message + "</b>"; } public static string Italics(this string message) { return "<i>" + message + "</i>"; } } public enum Colors { aqua, black, blue, brown, cyan, darkblue, fuchsia, green, grey, lightblue, lime, magenta, maroon, navy, olive, purple, red, silver, teal, white, yellow } public static class MyTexture { public static Sprite AsSprite(this Texture2D texture) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) Rect val = default(Rect); ((Rect)(ref val))..ctor(0f, 0f, (float)((Texture)texture).width, (float)((Texture)texture).height); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0.5f, 0.5f); return Sprite.Create(texture, val, val2); } public static Texture2D Resample(this Texture2D source, int targetWidth, int targetHeight) { //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Expected O, but got Unknown //IL_00aa: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) int width = ((Texture)source).width; int height = ((Texture)source).height; float num = (float)width / (float)height; float num2 = (float)targetWidth / (float)targetHeight; int num3 = 0; int num4 = 0; float num5; if (num > num2) { num5 = (float)targetHeight / (float)height; num3 = (int)(((float)width - (float)height * num2) * 0.5f); } else { num5 = (float)targetWidth / (float)width; num4 = (int)(((float)height - (float)width / num2) * 0.5f); } Color32[] pixels = source.GetPixels32(); Color32[] array = (Color32[])(object)new Color32[targetWidth * targetHeight]; Vector2 val = default(Vector2); for (int i = 0; i < targetHeight; i++) { for (int j = 0; j < targetWidth; j++) { ((Vector2)(ref val))..ctor(Mathf.Clamp((float)num3 + (float)j / num5, 0f, (float)(width - 1)), Mathf.Clamp((float)num4 + (float)i / num5, 0f, (float)(height - 1))); Color32 val2 = pixels[Mathf.FloorToInt(val.x) + width * Mathf.FloorToInt(val.y)]; Color32 val3 = pixels[Mathf.FloorToInt(val.x) + width * Mathf.CeilToInt(val.y)]; Color32 val4 = pixels[Mathf.CeilToInt(val.x) + width * Mathf.FloorToInt(val.y)]; Color32 val5 = pixels[Mathf.CeilToInt(val.x) + width * Mathf.CeilToInt(val.y)]; array[j + i * targetWidth] = Color32.op_Implicit(Color.Lerp(Color.Lerp(Color32.op_Implicit(val2), Color32.op_Implicit(val3), val.y), Color.Lerp(Color32.op_Implicit(val4), Color32.op_Implicit(val5), val.y), val.x)); } } Texture2D val6 = new Texture2D(targetWidth, targetHeight); val6.SetPixels32(array); val6.Apply(true); return val6; } public static Texture2D Crop(this Texture2D original, int left, int right, int top, int down, float brightnessOffset = 0f) { //IL_0066: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) int num = left + right; int num2 = top + down; int num3 = ((Texture)original).width - num; int num4 = ((Texture)original).height - num2; Color[] pixels = original.GetPixels(left, down, num3, num4); if (!Mathf.Approximately(brightnessOffset, 0f)) { for (int i = 0; i < pixels.Length; i++) { pixels[i] = pixels[i].BrightnessOffset(brightnessOffset); } } Texture2D val = new Texture2D(num3, num4, (TextureFormat)3, false); val.SetPixels(pixels); val.Apply(); return val; } public static Texture2D WithSolidColor(this Texture2D original, Color color) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001d: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(((Texture)original).width, ((Texture)original).height); for (int i = 0; i < ((Texture)val).width; i++) { for (int j = 0; j < ((Texture)val).height; j++) { val.SetPixel(i, j, color); } } val.Apply(); return val; } } public static class MyUI { public static void SetCanvasState(CanvasGroup canvas, bool setOn) { canvas.alpha = (setOn ? 1 : 0); canvas.interactable = setOn; canvas.blocksRaycasts = setOn; } public static void SetState(this CanvasGroup canvas, bool isOn) { SetCanvasState(canvas, isOn); } public static void SetWidth(this RectTransform transform, float width) { //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) transform.sizeDelta = transform.sizeDelta.SetX(width); } public static void SetHeight(this RectTransform transform, float height) { //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) transform.sizeDelta = transform.sizeDelta.SetY(height); } public static void SetPositionX(this RectTransform transform, float x) { //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) transform.anchoredPosition = transform.anchoredPosition.SetX(x); } public static void SetPositionY(this RectTransform transform, float y) { //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) transform.anchoredPosition = transform.anchoredPosition.SetY(y); } public static void OffsetPositionX(this RectTransform transform, float x) { //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) transform.anchoredPosition = transform.anchoredPosition.OffsetX(x); } public static void OffsetPositionY(this RectTransform transform, float y) { //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) transform.anchoredPosition = transform.anchoredPosition.OffsetY(y); } public static Entry OnEventSubscribe(this EventTrigger trigger, EventTriggerType eventType, Action<BaseEventData> callback) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0007: 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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown Entry val = new Entry(); val.eventID = eventType; val.callback = new TriggerEvent(); ((UnityEvent<BaseEventData>)(object)val.callback).AddListener((UnityAction<BaseEventData>)callback.Invoke); trigger.triggers.Add(val); return val; } public static void OnEventUnsubscribe(this EventTrigger trigger, Entry entry) { trigger.triggers.Add(entry); } public static RectTransform ShiftAnchor(this RectTransform source, Vector2 delta) { //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_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_0019: 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) source.anchorMin += delta; source.anchorMax += delta; return source; } public static RectTransform ShiftAnchor(this RectTransform source, float x, float y) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return source.ShiftAnchor(new Vector2(x, y)); } public static Vector2 GetAnchorCenter(this RectTransform source) { //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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) return (source.anchorMin + source.anchorMax) / 2f; } public static Vector2 GetAnchorDelta(this RectTransform source) { //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_000c: Unknown result type (might be due to invalid IL or missing references) return source.anchorMax - source.anchorMin; } } [PublicAPI] public static class MyUnityEventExtensions { public static UnityEvent Once(this UnityEvent source, UnityAction action) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown source.AddListener(new UnityAction(WrapperAction)); return source; void WrapperAction() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown source.RemoveListener(new UnityAction(WrapperAction)); action.Invoke(); } } public static UnityEvent<T> Once<T>(this UnityEvent<T> source, UnityAction<T> action) { source.AddListener((UnityAction<T>)WrapperAction); return source; void WrapperAction(T p) { source.RemoveListener((UnityAction<T>)WrapperAction); action.Invoke(p); } } public static UnityEvent<T0, T1> Once<T0, T1>(this UnityEvent<T0, T1> source, UnityAction<T0, T1> action) { source.AddListener((UnityAction<T0, T1>)WrapperAction); return source; void WrapperAction(T0 p0, T1 p1) { source.RemoveListener((UnityAction<T0, T1>)WrapperAction); action.Invoke(p0, p1); } } public static UnityEvent<T0, T1, T2> Once<T0, T1, T2>(this UnityEvent<T0, T1, T2> source, UnityAction<T0, T1, T2> action) { source.AddListener((UnityAction<T0, T1, T2>)WrapperAction); return source; void WrapperAction(T0 p0, T1 p1, T2 p2) { source.RemoveListener((UnityAction<T0, T1, T2>)WrapperAction); action.Invoke(p0, p1, p2); } } public static UnityEvent<T0, T1, T2, T3> Once<T0, T1, T2, T3>(this UnityEvent<T0, T1, T2, T3> source, UnityAction<T0, T1, T2, T3> action) { source.AddListener((UnityAction<T0, T1, T2, T3>)WrapperAction); return source; void WrapperAction(T0 p0, T1 p1, T2 p2, T3 p3) { source.RemoveListener((UnityAction<T0, T1, T2, T3>)WrapperAction); action.Invoke(p0, p1, p2, p3); } } } public static class MyVectors { public static Vector3 SetX(this Vector3 vector, float x) { //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) return new Vector3(x, vector.y, vector.z); } public static Vector2 SetX(this Vector2 vector, float x) { //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) return new Vector2(x, vector.y); } public static void SetX(this Transform transform, float x) { //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) transform.position = transform.position.SetX(x); } public static Vector3 SetY(this Vector3 vector, float y) { //IL_0000: 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) return new Vector3(vector.x, y, vector.z); } public static Vector2 SetY(this Vector2 vector, float y) { //IL_0000: 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) return new Vector2(vector.x, y); } public static void SetY(this Transform transform, float y) { //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) transform.position = transform.position.SetY(y); } public static Vector3 SetZ(this Vector3 vector, float z) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) return new Vector3(vector.x, vector.y, z); } public static void SetZ(this Transform transform, float z) { //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) transform.position = transform.position.SetZ(z); } public static Vector3 SetXY(this Vector3 vector, float x, float y) { //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) return new Vector3(x, y, vector.z); } public static void SetXY(this Transform transform, float x, float y) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) transform.position = transform.position.SetXY(x, y); } public static Vector3 SetXZ(this Vector3 vector, float x, float z) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return new Vector3(x, vector.y, z); } public static void SetXZ(this Transform transform, float x, float z) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) transform.position = transform.position.SetXZ(x, z); } public static Vector3 SetYZ(this Vector3 vector, float y, float z) { //IL_0000: 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) return new Vector3(vector.x, y, z); } public static void SetYZ(this Transform transform, float y, float z) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) transform.position = transform.position.SetYZ(y, z); } public static Vector3 Offset(this Vector3 vector, Vector2 offset) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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) return vector.OffsetXY(offset); } public static Vector3 OffsetX(this Vector3 vector, float x) { //IL_0000: 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_000e: 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) return new Vector3(vector.x + x, vector.y, vector.z); } public static Vector2 OffsetX(this Vector2 vector, float x) { //IL_0000: 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_000e: Unknown result type (might be due to invalid IL or missing references) return new Vector2(vector.x + x, vector.y); } public static void OffsetX(this Transform transform, float x) { //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) transform.position = transform.position.OffsetX(x); } public static Vector3 OffsetY(this Vector3 vector, float y) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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) return new Vector3(vector.x, vector.y + y, vector.z); } public static Vector2 OffsetY(this Vector2 vector, float y) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) return new Vector2(vector.x, vector.y + y); } public static void OffsetY(this Transform transform, float y) { //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) transform.position = transform.position.OffsetY(y); } public static Vector3 OffsetZ(this Vector3 vector, float z) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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) return new Vector3(vector.x, vector.y, vector.z + z); } public static void OffsetZ(this Transform transform, float z) { //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) transform.position = transform.position.OffsetZ(z); } public static Vector3 OffsetXY(this Vector3 vector, float x, float y) { //IL_0000: 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_0010: 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 new Vector3(vector.x + x, vector.y + y, vector.z); } public static Vector3 OffsetXY(this Vector3 vector, Vector2 offset) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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) return vector.OffsetXY(offset.x, offset.y); } public static Vector2 OffsetXY(this Vector2 vector, float x, float y) { //IL_0000: 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_0010: Unknown result type (might be due to invalid IL or missing references) return new Vector2(vector.x + x, vector.y + y); } public static void OffsetXY(this Transform transform, float x, float y) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) transform.position = transform.position.OffsetXY(x, y); } public static void OffsetXY(this Transform transform, Vector2 offset) { //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_0008: Unknown result type (might be due to invalid IL or missing references) transform.position = transform.position.OffsetXY(offset); } public static Vector3 OffsetXZ(this Vector3 vector, float x, float z) { //IL_0000: 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_000e: 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 new Vector3(vector.x + x, vector.y, vector.z + z); } public static Vector3 OffsetXZ(this Vector3 vector, Vector2 offset) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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) return vector.OffsetXZ(offset.x, offset.y); } public static void OffsetXZ(this Transform transform, float x, float z) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) transform.position = transform.position.OffsetXZ(x, z); } public static void OffsetXZ(this Transform transform, Vector2 offset) { //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_0008: Unknown result type (might be due to invalid IL or missing references) transform.position = transform.position.OffsetXZ(offset); } public static Vector3 OffsetYZ(this Vector3 vector, float y, float z) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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 new Vector3(vector.x, vector.y + y, vector.z + z); } public static Vector3 OffsetYZ(this Vector3 vector, Vector2 offset) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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) return vector.OffsetYZ(offset.x, offset.y); } public static void OffsetYZ(this Transform transform, float y, float z) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) transform.position = transform.position.OffsetYZ(y, z); } public static void OffsetYZ(this Transform transform, Vector2 offset) { //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_0008: Unknown result type (might be due to invalid IL or missing references) transform.position = transform.position.OffsetYZ(offset); } public static Vector3 ClampX(this Vector3 vector, float min, float max) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: 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) return vector.SetX(Mathf.Clamp(vector.x, min, max)); } public static Vector2 ClampX(this Vector2 vector, float min, float max) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: 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) return vector.SetX(Mathf.Clamp(vector.x, min, max)); } public static void ClampX(this Transform transform, float min, float max) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) transform.SetX(Mathf.Clamp(transform.position.x, min, max)); } public static Vector3 ClampY(this Vector3 vector, float min, float max) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: 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) return vector.SetY(Mathf.Clamp(vector.y, min, max)); } public static Vector2 ClampY(this Vector2 vector, float min, float max) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: 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) return vector.SetY(Mathf.Clamp(vector.y, min, max)); } public static void ClampY(this Transform transform, float min, float max) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) transform.SetY(Mathf.Clamp(transform.position.y, min, max)); } public static Vector3 ClampZ(this Vector3 vector, float min, float max) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: 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) return vector.SetZ(Mathf.Clamp(vector.z, min, max)); } public static void ClampZ(this Transform transform, float min, float max) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) transform.SetZ(Mathf.Clamp(transform.position.z, min, max)); } public static Vector3 InvertX(this Vector3 vector) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return vector.SetX(0f - vector.x); } public static Vector2 InvertX(this Vector2 vector) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return vector.SetX(0f - vector.x); } public static void InvertX(this Transform transform) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) transform.SetX(0f - transform.position.x); } public static Vector3 InvertY(this Vector3 vector) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return vector.SetY(0f - vector.y); } public static Vector2 InvertY(this Vector2 vector) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return vector.SetY(0f - vector.y); } public static void InvertY(this Transform transform) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) transform.SetY(0f - transform.position.y); } public static Vector3 InvertZ(this Vector3 vector) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return vector.SetZ(0f - vector.z); } public static void InvertZ(this Transform transform) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) transform.SetZ(0f - transform.position.z); } public static Vector2 ToVector2(this Vector3 vector) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) return new Vector2(vector.x, vector.y); } public static Vector3 ToVector3(this Vector2 vector) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) return new Vector3(vector.x, vector.y); } public static Vector2 ToVector2(this Vector2Int vector) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) return new Vector2((float)((Vector2Int)(ref vector)).x, (float)((Vector2Int)(ref vector)).y); } public static Vector3 ToVector3(this Vector3Int vector) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) return new Vector3((float)((Vector3Int)(ref vector)).x, (float)((Vector3Int)(ref vector)).y, (float)((Vector3Int)(ref vector)).z); } public static Vector2Int ToVector2Int(this Vector2 vector) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) return new Vector2Int(vector.x.RoundToInt(), vector.y.RoundToInt()); } public static Vector3Int ToVector3Int(this Vector3 vector) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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 Vector3Int(vector.x.RoundToInt(), vector.y.RoundToInt(), vector.z.RoundToInt()); } public static Vector3 SnapValue(this Vector3 val, float snapValue) { //IL_0000: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) return new Vector3(val.x.Snap(snapValue), val.y.Snap(snapValue), val.z.Snap(snapValue)); } public static Vector2 SnapValue(this Vector2 val, float snapValue) { //IL_0000: 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_0018: Unknown result type (might be due to invalid IL or missing references) return new Vector2(val.x.Snap(snapValue), val.y.Snap(snapValue)); } public static void SnapPosition(this Transform transform, float snapValue) { //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) transform.position = transform.position.SnapValue(snapValue); } public static Vector2 SnapToOne(this Vector2 vector) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) return new Vector2(vector.x.Round(), vector.y.Round()); } public static Vector3 SnapToOne(this Vector3 vector) { //IL_0000: Unknown result type (might be due to inv