using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("REPOJP")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("zabuMod")] [assembly: AssemblyTitle("zabuMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace RepoAllPlayerCommands { [BepInPlugin("REPOJP.AllPlayerCommands", "AllPlayerCommands", "4.0.0")] public sealed class AllPlayerCommandsPlugin : BaseUnityPlugin { [HarmonyPatch] private static class ChatManager_MessageSend_Patch { private static MethodBase TargetMethod() { MethodInfo methodInfo = AccessTools.Method(typeof(ChatManager), "MessageSend", new Type[1] { typeof(bool) }, (Type[])null); if (methodInfo != null) { return methodInfo; } return AccessTools.Method(typeof(ChatManager), "MessageSend", (Type[])null, (Type[])null); } private static bool Prefix(ChatManager __instance) { return Patch_ChatManager_MessageSend.HandleMessageSend(__instance); } } public static class Patch_ChatManager_MessageSend { private static readonly string[] CmdKillAll = new string[4] { "/ka", "/killall", "/killallplayers", "/killplayerall" }; private static readonly string[] CmdReviveAll = new string[4] { "/ra", "/reviveall", "/reviveallplayers", "/reviveplayerall" }; private static readonly string[] CmdHealFullAll = new string[4] { "/ha", "/healall", "/healallplayers", "/healplayerall" }; private static readonly string[] CmdSummonAll = new string[4] { "/sa", "/summonall", "/summonallplayers", "/summonplayerall" }; private static readonly string[] CmdTruckAll = new string[4] { "/ta", "/truckall", "/truckallplayers", "/returntotruckall" }; private static readonly string[] CmdKillMatch = new string[1] { "/kill" }; private static readonly string[] CmdKnockbackAll = new string[4] { "/kba", "/knockbackall", "/knockall", "/impulseall" }; private static readonly string[] CmdDamageAll = new string[4] { "/dga", "/damageall", "/hurtall", "/hitall" }; private static readonly string[] CmdHealAmountAll = new string[4] { "/hga", "/healamountall", "/healaddall", "/healplusall" }; private static readonly string[] CmdExpressionAll = new string[4] { "/exa", "/expressionall", "/faceall", "/emoteall" }; private static readonly string[] CmdTtsAll = new string[4] { "/ttsa", "/ttsall", "/sayall", "/speakall" }; private static readonly string[] CmdTumbleAll = new string[2] { "/tba", "/tumbleall" }; private static readonly string[] CmdHpMaxAll = new string[2] { "/hpmaxall", "/hpmaxa" }; private static readonly string[] CmdFlickerAll = new string[2] { "/flickerall", "/flickera" }; private static readonly string[] CmdAnimSpeedAll = new string[4] { "/animspeedall", "/animspeeda", "/asall", "/animall" }; private static readonly string[] CmdPupilAll = new string[3] { "/pupilall", "/pupila", "/eyesall" }; private static readonly string[] CmdFallingAll = new string[3] { "/fallingall", "/fallinga", "/fallall" }; private static readonly string[] CmdResetPushAll = new string[4] { "/resetpushall", "/resetpusha", "/rpa", "/pushresetall" }; private static readonly string[] CmdTumbleWingsAll = new string[3] { "/tumblewingsall", "/wingsall", "/wa" }; private const int DefaultKnockback = 5; private const int DefaultDamage = 10; private const int DefaultHealAmount = 10; private const int DefaultExpressionIndex = 4; private const string DefaultTtsMessage = "Hello!!!"; private const float DefaultTumbleSeconds = 3f; private const int DefaultHpMax = 200; private const float DefaultFlickerMultiplier = 2f; private const float DefaultAnimSpeedMulti = 0.5f; private const float DefaultAnimIn = 0.05f; private const float DefaultAnimOut = 0.2f; private const float DefaultAnimTime = 3f; private const float DefaultPupilMultiplier = 1.8f; private const int DefaultPupilPrio = 10; private const float DefaultPupilSpringIn = 25f; private const float DefaultPupilDampIn = 0.8f; private const float DefaultPupilSpringOut = 12f; private const float DefaultPupilDampOut = 0.8f; private const float DefaultPupilTime = 3f; internal static bool HandleMessageSend(ChatManager __instance) { string empty = string.Empty; try { empty = (((Object)(object)__instance != (Object)null) ? __instance.chatMessage : string.Empty); } catch { empty = string.Empty; } HandleMessageSendInternal(__instance); string empty2 = string.Empty; try { empty2 = (((Object)(object)__instance != (Object)null) ? __instance.chatMessage : string.Empty); } catch { empty2 = string.Empty; } if (!string.IsNullOrWhiteSpace(empty) && empty.Trim().StartsWith("/") && string.IsNullOrEmpty(empty2)) { return false; } return true; } private static void HandleMessageSendInternal(ChatManager __instance) { if (IsNullUnity(__instance)) { LogWarn("MessageSend Prefix __instance null"); } else { if (!IsMasterClientOrSingleplayer()) { return; } string chatMessage = __instance.chatMessage; if (string.IsNullOrWhiteSpace(chatMessage)) { return; } chatMessage = chatMessage.Trim(); if (!chatMessage.StartsWith("/")) { return; } SplitCommand(chatMessage, out var cmdLower, out var argRaw); if (string.IsNullOrWhiteSpace(argRaw) && TryParseChainedSimple(cmdLower, out var chain)) { StartChainedSimple(chain); __instance.chatMessage = ""; } else if (IsAnyCmd(cmdLower, CmdKillAll)) { ExecuteForAll("KillAll", delegate(PlayerAvatar p) { PlayerActions.Kill(p); }); __instance.chatMessage = ""; } else if (IsAnyCmd(cmdLower, CmdKillMatch)) { string text = ((argRaw == null) ? string.Empty : argRaw.Trim()); if (!string.IsNullOrWhiteSpace(text)) { ExecuteForMatchedPlayersBatched("KillMatch keyword=" + text, text, delegate(PlayerAvatar p) { PlayerActions.Kill(p); }); } __instance.chatMessage = ""; } else if (IsAnyCmd(cmdLower, CmdReviveAll)) { ExecuteForAll("ReviveAll", delegate(PlayerAvatar p) { PlayerActions.Revive(p); }); __instance.chatMessage = ""; } else if (IsAnyCmd(cmdLower, CmdHealFullAll)) { ExecuteForAll("HealFullAll", delegate(PlayerAvatar p) { PlayerActions.HealFull(p); }); __instance.chatMessage = ""; } else if (IsAnyCmd(cmdLower, CmdSummonAll)) { StartPrepareThenBatched("SummonAll", delegate(PlayerAvatar p) { PlayerActions.SummonToLocal(p); }); __instance.chatMessage = ""; } else if (IsAnyCmd(cmdLower, CmdTruckAll)) { StartPrepareThenBatched("TruckAll", delegate(PlayerAvatar p) { PlayerActions.ReturnToTruck(p); }); __instance.chatMessage = ""; } else if (IsAnyCmd(cmdLower, CmdKnockbackAll)) { int strength = ParseIntOrDefault(argRaw, 5); PlayerAvatar origin = PlayerAvatar.instance; ExecuteForAll("KnockbackAll strength=" + strength, delegate(PlayerAvatar p) { PlayerActions.Knockback(p, strength, origin); }); __instance.chatMessage = ""; } else if (IsAnyCmd(cmdLower, CmdDamageAll)) { int damage = ParseIntOrDefault(argRaw, 10); ExecuteForAll("DamageAll damage=" + damage, delegate(PlayerAvatar p) { PlayerActions.DamageAmount(p, damage); }); __instance.chatMessage = ""; } else if (IsAnyCmd(cmdLower, CmdHealAmountAll)) { int heal = ParseIntOrDefault(argRaw, 10); ExecuteForAll("HealAmountAll heal=" + heal, delegate(PlayerAvatar p) { PlayerActions.HealAmount(p, heal); }); __instance.chatMessage = ""; } else if (IsAnyCmd(cmdLower, CmdExpressionAll)) { int index = ParseIntOrDefault(argRaw, 4); ExecuteForAll("ExpressionAll index=" + index, delegate(PlayerAvatar p) { PlayerActions.Expression(p, index); }); __instance.chatMessage = ""; } else if (IsAnyCmd(cmdLower, CmdTtsAll)) { string msg = (string.IsNullOrWhiteSpace(argRaw) ? "Hello!!!" : argRaw); ExecuteForAll("TTSAll msg=" + msg, delegate(PlayerAvatar p) { PlayerActions.TtsSpeak(p, msg); }); __instance.chatMessage = ""; } else if (IsAnyCmd(cmdLower, CmdTumbleWingsAll)) { string text2 = (string.IsNullOrWhiteSpace(argRaw) ? "on" : argRaw.Trim().ToLowerInvariant()); if (text2 == "off" || text2 == "0" || text2 == "false") { StopPinkWingsLoop(); ExecuteForAll("TumbleWingsAll off", delegate(PlayerAvatar p) { PlayerActions.WingsVisuals(p, visualsActive: false, pink: false); }); } else if (text2 == "pink" || text2 == "p") { StartPinkWingsLoop(); } else { StopPinkWingsLoop(); ExecuteForAll("TumbleWingsAll on", delegate(PlayerAvatar p) { PlayerActions.WingsVisuals(p, visualsActive: true, pink: false); }); } __instance.chatMessage = ""; } else if (IsAnyCmd(cmdLower, CmdTumbleAll)) { string text3 = (string.IsNullOrWhiteSpace(argRaw) ? "" : argRaw.Trim().ToLowerInvariant()); if (text3 == "off" || text3 == "0" || text3 == "false") { StopTimedTumble(); ExecuteForAll("TumbleAll off", delegate(PlayerAvatar p) { PlayerActions.SetTumble(p, isTumbling: false); }); } else if (text3 == "on" || text3 == "true") { StopTimedTumble(); ExecuteForAll("TumbleAll on", delegate(PlayerAvatar p) { PlayerActions.SetTumble(p, isTumbling: true); }); } else { float num = ParseFloatOrDefault(argRaw, 3f); if (num <= 0f) { StopTimedTumble(); ExecuteForAll("TumbleAll off", delegate(PlayerAvatar p) { PlayerActions.SetTumble(p, isTumbling: false); }); } else { StartTimedTumble(num); } } __instance.chatMessage = ""; } else if (IsAnyCmd(cmdLower, CmdHpMaxAll)) { int max = ParseIntOrDefault(argRaw, 200); if (max < 1) { max = 1; } ExecuteForAll("HpMaxAll max=" + max, delegate(PlayerAvatar p) { PlayerActions.SetHpMax(p, max); }); __instance.chatMessage = ""; } else if (IsAnyCmd(cmdLower, CmdFlickerAll)) { float multi = ParseFloatOrDefault(argRaw, 2f); if (multi < 0f) { multi = 0f; } ExecuteForAll("FlickerAll multi=" + multi.ToString(CultureInfo.InvariantCulture), delegate(PlayerAvatar p) { PlayerActions.Flicker(p, multi); }); __instance.chatMessage = ""; } else if (IsAnyCmd(cmdLower, CmdAnimSpeedAll)) { string[] array = SplitTokens(argRaw); if (array.Length >= 1 && (array[0] == "off" || array[0] == "0" || array[0] == "false")) { ExecuteForAll("AnimSpeedAll off", delegate(PlayerAvatar p) { PlayerActions.OverrideAnimSpeed(p, active: false, 1f, 0.05f, 0.2f, 0.1f); }); } else { float speed = ((array.Length >= 1) ? ParseFloatOrDefault(array[0], 0.5f) : 0.5f); float tin = ((array.Length >= 2) ? ParseFloatOrDefault(array[1], 0.05f) : 0.05f); float tout = ((array.Length >= 3) ? ParseFloatOrDefault(array[2], 0.2f) : 0.2f); float time2 = ((array.Length >= 4) ? ParseFloatOrDefault(array[3], 3f) : 3f); ExecuteForAll("AnimSpeedAll on speed=" + speed.ToString(CultureInfo.InvariantCulture) + " in=" + tin.ToString(CultureInfo.InvariantCulture) + " out=" + tout.ToString(CultureInfo.InvariantCulture) + " time=" + time2.ToString(CultureInfo.InvariantCulture), delegate(PlayerAvatar p) { PlayerActions.OverrideAnimSpeed(p, active: true, speed, tin, tout, time2); }); } __instance.chatMessage = ""; } else if (IsAnyCmd(cmdLower, CmdPupilAll)) { string[] array2 = SplitTokens(argRaw); if (array2.Length >= 1 && (array2[0] == "off" || array2[0] == "0" || array2[0] == "false")) { ExecuteForAll("PupilAll off", delegate(PlayerAvatar p) { PlayerActions.OverridePupil(p, active: false, 1f, 10, 25f, 0.8f, 12f, 0.8f, 0.1f); }); } else { float mult = ((array2.Length >= 1) ? ParseFloatOrDefault(array2[0], 1.8f) : 1.8f); int prio = ((array2.Length >= 2) ? ParseIntOrDefault(array2[1], 10) : 10); float spIn = ((array2.Length >= 3) ? ParseFloatOrDefault(array2[2], 25f) : 25f); float dpIn = ((array2.Length >= 4) ? ParseFloatOrDefault(array2[3], 0.8f) : 0.8f); float spOut = ((array2.Length >= 5) ? ParseFloatOrDefault(array2[4], 12f) : 12f); float dpOut = ((array2.Length >= 6) ? ParseFloatOrDefault(array2[5], 0.8f) : 0.8f); float time = ((array2.Length >= 7) ? ParseFloatOrDefault(array2[6], 3f) : 3f); ExecuteForAll("PupilAll on mult=" + mult.ToString(CultureInfo.InvariantCulture) + " prio=" + prio + " time=" + time.ToString(CultureInfo.InvariantCulture), delegate(PlayerAvatar p) { PlayerActions.OverridePupil(p, active: true, mult, prio, spIn, dpIn, spOut, dpOut, time); }); } __instance.chatMessage = ""; } else if (IsAnyCmd(cmdLower, CmdFallingAll)) { string text4 = (string.IsNullOrWhiteSpace(argRaw) ? "on" : argRaw.Trim().ToLowerInvariant()); bool falling = !(text4 == "off") && !(text4 == "0") && !(text4 == "false"); ExecuteForAll("FallingAll falling=" + falling, delegate(PlayerAvatar p) { PlayerActions.SetFalling(p, falling); }); __instance.chatMessage = ""; } else if (IsAnyCmd(cmdLower, CmdResetPushAll)) { ExecuteForAll("ResetPhysPusherAll", delegate(PlayerAvatar p) { PlayerActions.ResetPhysPusher(p); }); __instance.chatMessage = ""; } } } private static bool TryParseChainedSimple(string cmdLower, out string[] chain) { chain = null; if (string.IsNullOrWhiteSpace(cmdLower)) { return false; } string text = cmdLower.Trim().ToLowerInvariant(); if (!text.StartsWith("/")) { return false; } text = text.Substring(1); if (text.Length < 4) { return false; } if (text.Length % 2 != 0) { return false; } int num = text.Length / 2; if (num < 2) { return false; } List list = new List(num); for (int i = 0; i < num; i++) { string text2 = text.Substring(i * 2, 2); if (!IsChainToken(text2)) { return false; } list.Add(text2); } chain = list.ToArray(); return true; } private static bool IsChainToken(string token) { int result; switch (token) { default: result = ((token == "ta") ? 1 : 0); break; case "ka": case "ra": case "ha": case "sa": result = 1; break; } return (byte)result != 0; } private static void StartChainedSimple(string[] chain) { if (chain != null && chain.Length != 0) { if ((Object)(object)Instance != (Object)null) { ((MonoBehaviour)Instance).StartCoroutine(Instance.CoExecuteChainedSimple(chain)); } else { ExecuteChainedSimpleImmediate(chain); } } } private static void ExecuteChainedSimpleImmediate(string[] chain) { for (int i = 0; i < chain.Length; i++) { ExecuteChainTokenImmediate(chain[i]); } } private static void ExecuteChainTokenImmediate(string token) { switch (token) { case "ka": ExecuteForAll("KillAll(chain)", delegate(PlayerAvatar p) { PlayerActions.Kill(p); }); break; case "ra": ExecuteForAll("ReviveAll(chain)", delegate(PlayerAvatar p) { PlayerActions.Revive(p); }); break; case "ha": ExecuteForAll("HealFullAll(chain)", delegate(PlayerAvatar p) { PlayerActions.HealFull(p); }); break; case "sa": StartPrepareThenBatched("SummonAll(chain)", delegate(PlayerAvatar p) { PlayerActions.SummonToLocal(p); }); break; case "ta": StartPrepareThenBatched("TruckAll(chain)", delegate(PlayerAvatar p) { PlayerActions.ReturnToTruck(p); }); break; } } private static void StartPinkWingsLoop() { if (!((Object)(object)Instance == (Object)null)) { Instance._pinkWingsLoopEnabled = true; if (Instance._pinkWingsLoopCo == null) { Instance._pinkWingsLoopCo = ((MonoBehaviour)Instance).StartCoroutine(Instance.CoPinkWingsLoop()); } } } private static void StopPinkWingsLoop() { if (!((Object)(object)Instance == (Object)null)) { Instance._pinkWingsLoopEnabled = false; if (Instance._pinkWingsLoopCo != null) { ((MonoBehaviour)Instance).StopCoroutine(Instance._pinkWingsLoopCo); Instance._pinkWingsLoopCo = null; } } } private static void StartTimedTumble(float seconds) { if ((Object)(object)Instance == (Object)null) { ExecuteForAll("TumbleAll timed start(sec=" + seconds.ToString(CultureInfo.InvariantCulture) + ")", delegate(PlayerAvatar p) { PlayerActions.SetTumble(p, isTumbling: true); }); } else { Instance.StopTimedTumbleInternal(); Instance._tumbleTimedCo = ((MonoBehaviour)Instance).StartCoroutine(Instance.CoTimedTumble(seconds)); } } private static void StopTimedTumble() { if (!((Object)(object)Instance == (Object)null)) { Instance.StopTimedTumbleInternal(); } } private static void SplitCommand(string raw, out string cmdLower, out string argRaw) { cmdLower = ""; argRaw = ""; string[] array = raw.Split(new char[1] { ' ' }, 2, StringSplitOptions.RemoveEmptyEntries); if (array.Length != 0) { cmdLower = array[0].Trim().ToLowerInvariant(); argRaw = ((array.Length >= 2) ? array[1].Trim() : ""); } } private static string[] SplitTokens(string argRaw) { if (string.IsNullOrWhiteSpace(argRaw)) { return Array.Empty(); } return argRaw.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries); } private static int ParseIntOrDefault(string arg, int defaultValue) { if (string.IsNullOrWhiteSpace(arg)) { return defaultValue; } string s = arg.Trim().Split(new char[1] { ' ' }, 2, StringSplitOptions.RemoveEmptyEntries)[0]; if (int.TryParse(s, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result)) { return result; } return defaultValue; } private static float ParseFloatOrDefault(string arg, float defaultValue) { if (string.IsNullOrWhiteSpace(arg)) { return defaultValue; } string s = arg.Trim().Split(new char[1] { ' ' }, 2, StringSplitOptions.RemoveEmptyEntries)[0]; if (float.TryParse(s, NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { return result; } return defaultValue; } } internal static class PlayerActions { public static void PrepareForTeleport(PlayerAvatar avatar) { if (!IsNullUnity(avatar) && !avatar.deadSet) { SetFalling(avatar, falling: false); ResetPhysPusher(avatar); SetTumble(avatar, isTumbling: false); StandUpFromTumble(avatar); } } public static void StandUpFromTumble(PlayerAvatar avatar) { if (IsNullUnity(avatar)) { return; } PlayerTumble val = null; try { val = avatar.tumble; } catch { val = null; } if (IsNullUnity(val)) { return; } try { val.TumbleRequest(false, true); } catch { } } public static void SetTumble(PlayerAvatar avatar, bool isTumbling) { if (IsNullUnity(avatar)) { return; } PlayerTumble val = null; try { val = avatar.tumble; } catch { val = null; } if (IsNullUnity(val)) { return; } try { val.TumbleSet(isTumbling, false); } catch { try { val.TumbleRequest(isTumbling, false); } catch { } } } public static void Kill(PlayerAvatar avatar) { if (IsNullUnity(avatar)) { return; } try { avatar.PlayerDeath(-1); } catch { } } public static void Revive(PlayerAvatar avatar) { if (IsNullUnity(avatar)) { return; } try { if (avatar.deadSet && !IsNullUnity(avatar.playerDeathHead)) { avatar.playerDeathHead.inExtractionPoint = true; avatar.playerDeathHead.inTruck = true; avatar.Revive(false); } } catch { } finally { try { avatar.playerDeathHead.inExtractionPoint = false; } catch { } try { avatar.playerDeathHead.inTruck = false; } catch { } } } public static void HealFull(PlayerAvatar avatar) { if (IsNullUnity(avatar)) { return; } PlayerHealth val = null; try { val = avatar.playerHealth; } catch { val = null; } if (IsNullUnity(val)) { return; } try { val.HealOther(9999, true); } catch { } } public static void HealAmount(PlayerAvatar avatar, int amount) { if (IsNullUnity(avatar) || amount <= 0) { return; } PlayerHealth val = null; try { val = avatar.playerHealth; } catch { val = null; } if (IsNullUnity(val)) { return; } try { val.HealOther(amount, true); } catch { } } public static void DamageAmount(PlayerAvatar avatar, int damage) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) if (IsNullUnity(avatar) || damage <= 0) { return; } PlayerHealth val = null; try { val = avatar.playerHealth; } catch { val = null; } if (IsNullUnity(val)) { return; } try { val.HurtOther(damage, Vector3.zero, false, -1); } catch { } } public static void Knockback(PlayerAvatar avatar, int strength, PlayerAvatar origin) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_00b6: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_0045: 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) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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) if (IsNullUnity(avatar) || strength <= 0) { return; } Vector3 forward = Vector3.forward; try { if (!IsNullUnity(origin)) { Vector3 val = ((Component)avatar).transform.position - ((Component)origin).transform.position; forward = ((((Vector3)(ref val)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val)).normalized : ((Component)origin).transform.forward); } else { forward = ((Component)avatar).transform.forward; } } catch { forward = Vector3.forward; } float num = strength; Vector3 val2 = forward * num + Vector3.up * (num * 0.2f); try { avatar.ForceImpulse(val2); } catch { } } public static void Expression(PlayerAvatar avatar, int index) { if (IsNullUnity(avatar) || index < 0) { return; } PlayerExpression val = null; try { val = avatar.playerExpression; } catch { val = null; } if (IsNullUnity(val)) { return; } int num = 0; try { num = ((val.expressions != null) ? val.expressions.Count : 0); } catch { num = 0; } if (num <= 0 || index >= num) { return; } try { avatar.PlayerExpressionSet(index, 1f); } catch { } } public static void TtsSpeak(PlayerAvatar avatar, string message) { if (IsNullUnity(avatar) || string.IsNullOrWhiteSpace(message)) { return; } string text = message.Trim(); if (text.StartsWith("/")) { text = " " + text; } try { avatar.ChatMessageSend(text); } catch { } } public static void WingsVisuals(PlayerAvatar avatar, bool visualsActive, bool pink) { if (IsNullUnity(avatar)) { return; } try { if (!IsNullUnity(avatar.upgradeTumbleWingsLogic)) { avatar.UpgradeTumbleWingsVisualsActive(visualsActive, pink); } } catch { } } public static void SetHpMax(PlayerAvatar avatar, int max) { if (IsNullUnity(avatar)) { return; } PlayerHealth val = null; try { val = avatar.playerHealth; } catch { val = null; } if (IsNullUnity(val) || IsNullUnity(val.photonView)) { return; } int value = 0; int value2 = 0; F_PlayerHealth_health.TryGetValue(val, out value); F_PlayerHealth_maxHealth.TryGetValue(val, out value2); int num = value; if (num > max) { num = max; } if (num < 1) { num = 1; } try { val.photonView.RPC("UpdateHealthRPC", (RpcTarget)0, new object[3] { num, max, true }); } catch { } } public static void Flicker(PlayerAvatar avatar, float multiplier) { if (IsNullUnity(avatar)) { return; } try { avatar.FlashlightFlicker(multiplier); } catch { } } public static void OverrideAnimSpeed(PlayerAvatar avatar, bool active, float speedMulti, float inSec, float outSec, float time) { if (IsNullUnity(avatar) || IsNullUnity(avatar.photonView)) { return; } try { avatar.photonView.RPC("OverrideAnimationSpeedActivateRPC", (RpcTarget)0, new object[5] { active, speedMulti, inSec, outSec, time }); } catch { } } public static void OverridePupil(PlayerAvatar avatar, bool active, float multiplier, int prio, float springIn, float dampIn, float springOut, float dampOut, float time) { if (IsNullUnity(avatar) || IsNullUnity(avatar.photonView)) { return; } try { avatar.photonView.RPC("OverridePupilSizeActivateRPC", (RpcTarget)0, new object[8] { active, multiplier, prio, springIn, dampIn, springOut, dampOut, time }); } catch { } } public static void SetFalling(PlayerAvatar avatar, bool falling) { if (IsNullUnity(avatar) || IsNullUnity(avatar.photonView)) { return; } try { avatar.photonView.RPC("FallingSetRPC", (RpcTarget)0, new object[1] { falling }); } catch { } } public static void ResetPhysPusher(PlayerAvatar avatar) { if (IsNullUnity(avatar) || IsNullUnity(avatar.photonView)) { return; } try { avatar.photonView.RPC("ResetPhysPusher", (RpcTarget)0, Array.Empty()); } catch { } } public static void SummonToLocal(PlayerAvatar target) { if (!IsNullUnity(target)) { PlayerAvatar instance = PlayerAvatar.instance; if (!IsNullUnity(instance)) { Teleport(target, instance); } } } public static void ReturnToTruck(PlayerAvatar avatar) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!IsNullUnity(avatar) && !IsNullUnity(TruckSafetySpawnPoint.instance)) { Vector3 position = ((Component)TruckSafetySpawnPoint.instance).transform.position; Quaternion rotation = ((Component)TruckSafetySpawnPoint.instance).transform.rotation; Teleport(avatar, position, rotation); } } private static void Teleport(PlayerAvatar from, PlayerAvatar to) { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_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_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) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) if (IsNullUnity(from) || IsNullUnity(to)) { return; } Vector3 position = ((Component)to).transform.position; Quaternion rotation = ((Component)to).transform.rotation; try { if (to.deadSet && !IsNullUnity(to.playerDeathHead) && !IsNullUnity(to.playerDeathHead.physGrabObject)) { position = ((Component)to.playerDeathHead.physGrabObject).transform.position; rotation = ((Component)to.playerDeathHead.physGrabObject).transform.rotation; } } catch { } Teleport(from, position, rotation); } private static void Teleport(PlayerAvatar from, Vector3 pos, Quaternion rot) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) if (IsNullUnity(from)) { return; } if (from.deadSet) { try { if (!IsNullUnity(from.playerDeathHead) && !IsNullUnity(from.playerDeathHead.physGrabObject)) { from.playerDeathHead.physGrabObject.Teleport(pos, rot); } return; } catch { return; } } TryMoveAvatarDirect(from, pos, rot); try { from.Spawn(pos, rot); } catch { } TryMoveAvatarDirect(from, pos, rot); } private static void TryMoveAvatarDirect(PlayerAvatar avatar, Vector3 pos, Quaternion rot) { //IL_002d: 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_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) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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) if (IsNullUnity(avatar)) { return; } try { ((Component)avatar).transform.SetPositionAndRotation(pos, rot); } catch { try { ((Component)avatar).transform.position = pos; ((Component)avatar).transform.rotation = rot; } catch { } } try { Rigidbody[] componentsInChildren = ((Component)avatar).GetComponentsInChildren(true); foreach (Rigidbody val in componentsInChildren) { if ((Object)(object)val == (Object)null) { continue; } try { if (!val.isKinematic) { val.velocity = Vector3.zero; val.angularVelocity = Vector3.zero; } if (((Component)val).transform == ((Component)avatar).transform) { val.position = pos; val.rotation = rot; } } catch { } } } catch { } } } internal sealed class FieldInfoCache { private readonly FieldInfo _fi; public FieldInfoCache(Type type, string fieldName) { _fi = AccessTools.Field(type, fieldName); } public bool TryGetValue(object instance, out T value) { value = default(T); if (_fi == null || instance == null) { return false; } try { object value2 = _fi.GetValue(instance); if (value2 is T) { value = (T)value2; return true; } } catch { } return false; } } [CompilerGenerated] private sealed class d__15 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string[] chain; public AllPlayerCommandsPlugin <>4__this; private int 5__1; private string 5__2; private List 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__15(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; 5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (chain == null || chain.Length == 0) { return false; } 5__1 = 0; goto IL_02e7; case 1: <>1__state = -1; goto IL_028c; case 2: <>1__state = -1; goto IL_028c; case 3: <>1__state = -1; goto IL_028c; case 4: <>1__state = -1; goto IL_028c; case 5: <>1__state = -1; goto IL_028c; case 6: { <>1__state = -1; goto IL_02c6; } IL_028c: if (5__1 < chain.Length - 1) { <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 6; return true; } goto IL_02c6; IL_02e7: if (5__1 < chain.Length) { 5__2 = chain[5__1]; 5__3 = GetAllPlayers(); if (5__2 == "ka") { <>2__current = <>4__this.CoExecuteForPlayersBatched("KillAll(chain)", 5__3, delegate(PlayerAvatar p) { PlayerActions.Kill(p); }); <>1__state = 1; return true; } if (5__2 == "ra") { <>2__current = <>4__this.CoExecuteForPlayersBatched("ReviveAll(chain)", 5__3, delegate(PlayerAvatar p) { PlayerActions.Revive(p); }); <>1__state = 2; return true; } if (5__2 == "ha") { <>2__current = <>4__this.CoExecuteForPlayersBatched("HealFullAll(chain)", 5__3, delegate(PlayerAvatar p) { PlayerActions.HealFull(p); }); <>1__state = 3; return true; } if (5__2 == "sa") { <>2__current = <>4__this.CoPrepareThenBatched("SummonAll(chain)", delegate(PlayerAvatar p) { PlayerActions.SummonToLocal(p); }); <>1__state = 4; return true; } if (5__2 == "ta") { <>2__current = <>4__this.CoPrepareThenBatched("TruckAll(chain)", delegate(PlayerAvatar p) { PlayerActions.ReturnToTruck(p); }); <>1__state = 5; return true; } goto IL_028c; } return false; IL_02c6: 5__2 = null; 5__3 = null; 5__1++; goto IL_02e7; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__24 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string actionName; public List players; public Action action; public AllPlayerCommandsPlugin <>4__this; private int 5__1; private int 5__2; private PlayerAvatar

5__3; private Exception 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__24(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() {

5__3 = null; 5__4 = null; <>1__state = -2; } private bool MoveNext() { int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; goto IL_014b; } <>1__state = -1; if (!IsMasterClientOrSingleplayer()) { return false; } if (players == null || action == null) { return false; } 5__1 = 0; 5__2 = 0; goto IL_0165; IL_014b:

5__3 = null; goto IL_0153; IL_0165: if (5__2 < players.Count) {

5__3 = players[5__2]; if (IsNullUnity(

5__3)) { goto IL_0153; } try { action(

5__3); } catch (Exception ex) { 5__4 = ex; LogError("Command failure " + actionName + " target=" + PlayerLabel(

5__3) + "\n" + 5__4); } 5__1++; if (5__1 >= 8) { 5__1 = 0; <>2__current = null; <>1__state = 1; return true; } goto IL_014b; } return false; IL_0153: 5__2++; goto IL_0165; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__16 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public AllPlayerCommandsPlugin <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__16(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } if (<>4__this._pinkWingsLoopEnabled) { ExecuteForAll("TumbleWingsAll pink tick", delegate(PlayerAvatar p) { PlayerActions.WingsVisuals(p, visualsActive: true, pink: true); }); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; } <>4__this._pinkWingsLoopCo = null; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__14 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string actionName; public Action action; public AllPlayerCommandsPlugin <>4__this; private List 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__14(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Expected O, but got Unknown //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = GetAllPlayers(); <>2__current = <>4__this.CoExecuteForPlayersBatched("PrepareBefore" + actionName + "_1", 5__1, delegate(PlayerAvatar p) { PlayerActions.PrepareForTeleport(p); }); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = null; <>1__state = 2; return true; case 2: <>1__state = -1; <>2__current = <>4__this.CoExecuteForPlayersBatched("PrepareBefore" + actionName + "_2", 5__1, delegate(PlayerAvatar p) { PlayerActions.PrepareForTeleport(p); }); <>1__state = 3; return true; case 3: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.05f); <>1__state = 4; return true; case 4: <>1__state = -1; <>2__current = <>4__this.CoExecuteForPlayersBatched(actionName + "_Run1", 5__1, action); <>1__state = 5; return true; case 5: <>1__state = -1; <>2__current = null; <>1__state = 6; return true; case 6: <>1__state = -1; <>2__current = <>4__this.CoExecuteForPlayersBatched("PrepareBefore" + actionName + "_3", 5__1, delegate(PlayerAvatar p) { PlayerActions.PrepareForTeleport(p); }); <>1__state = 7; return true; case 7: <>1__state = -1; <>2__current = <>4__this.CoExecuteForPlayersBatched(actionName + "_Run2", 5__1, action); <>1__state = 8; return true; case 8: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.05f); <>1__state = 9; return true; case 9: <>1__state = -1; <>2__current = <>4__this.CoExecuteForPlayersBatched(actionName + "_Run3", 5__1, action); <>1__state = 10; return true; case 10: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__17 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float seconds; public AllPlayerCommandsPlugin <>4__this; private float 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__17(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; ExecuteForAll("TumbleAll timed on", delegate(PlayerAvatar p) { PlayerActions.SetTumble(p, isTumbling: true); }); 5__1 = seconds; break; case 1: <>1__state = -1; break; } if (5__1 > 0f) { 5__1 -= Time.deltaTime; <>2__current = null; <>1__state = 1; return true; } ExecuteForAll("TumbleAll timed off", delegate(PlayerAvatar p) { PlayerActions.SetTumble(p, isTumbling: false); }); <>4__this._tumbleTimedCo = null; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } internal static AllPlayerCommandsPlugin Instance; internal static ManualLogSource LogSource; private Harmony _harmony; private Coroutine _pinkWingsLoopCo; private bool _pinkWingsLoopEnabled; private Coroutine _tumbleTimedCo; private static readonly FieldInfoCache F_PlayerHealth_health = new FieldInfoCache(typeof(PlayerHealth), "health"); private static readonly FieldInfoCache F_PlayerHealth_maxHealth = new FieldInfoCache(typeof(PlayerHealth), "maxHealth"); private void Awake() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown Instance = this; LogSource = ((BaseUnityPlugin)this).Logger; LogInfo("Loaded"); _harmony = new Harmony("REPOJP.AllPlayerCommands.harmony"); _harmony.PatchAll(); LogInfo("Harmony patched"); } private static void StartPrepareThenBatched(string actionName, Action action) { if ((Object)(object)Instance != (Object)null) { ((MonoBehaviour)Instance).StartCoroutine(Instance.CoPrepareThenBatched(actionName, action)); return; } PrepareAllPlayersForTeleport("PrepareBefore" + actionName + "_NoInstance"); ExecuteForAll(actionName + "_NoInstance_Run1", action); PrepareAllPlayersForTeleport("PrepareBefore" + actionName + "_NoInstance_Retry"); ExecuteForAll(actionName + "_NoInstance_Run2", action); } private static void PrepareAllPlayersForTeleport(string reason) { ExecuteForAllBatched("PrepareAllPlayersForTeleport " + reason, delegate(PlayerAvatar p) { PlayerActions.PrepareForTeleport(p); }); } private static void SafeInvoke(Action action, string actionName) { if (action == null) { return; } try { action(); } catch (Exception ex) { LogError("Action invoke failure " + actionName + "\n" + ex); } } [IteratorStateMachine(typeof(d__14))] private IEnumerator CoPrepareThenBatched(string actionName, Action action) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__14(0) { <>4__this = this, actionName = actionName, action = action }; } [IteratorStateMachine(typeof(d__15))] private IEnumerator CoExecuteChainedSimple(string[] chain) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__15(0) { <>4__this = this, chain = chain }; } [IteratorStateMachine(typeof(d__16))] private IEnumerator CoPinkWingsLoop() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__16(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__17))] private IEnumerator CoTimedTumble(float seconds) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__17(0) { <>4__this = this, seconds = seconds }; } private void StopTimedTumbleInternal() { if (_tumbleTimedCo != null) { ((MonoBehaviour)this).StopCoroutine(_tumbleTimedCo); _tumbleTimedCo = null; } } private static void ExecuteForAll(string actionName, Action action) { if (IsMasterClientOrSingleplayer()) { ExecuteForPlayersImmediate(actionName, GetAllPlayers(), action); } } private static void ExecuteForAllBatched(string actionName, Action action) { if (IsMasterClientOrSingleplayer()) { if ((Object)(object)Instance == (Object)null) { ExecuteForAll(actionName, action); } else { ((MonoBehaviour)Instance).StartCoroutine(Instance.CoExecuteForPlayersBatched(actionName, GetAllPlayers(), action)); } } } private static void ExecuteForMatchedPlayersBatched(string actionName, string keyword, Action action) { if (IsMasterClientOrSingleplayer()) { List playersByNamePart = GetPlayersByNamePart(keyword); if (playersByNamePart.Count <= 0) { LogWarn("No matched players. keyword=" + keyword); } else if ((Object)(object)Instance == (Object)null) { ExecuteForPlayersImmediate(actionName, playersByNamePart, action); } else { ((MonoBehaviour)Instance).StartCoroutine(Instance.CoExecuteForPlayersBatched(actionName, playersByNamePart, action)); } } } private static void ExecuteForPlayersImmediate(string actionName, List players, Action action) { if (players == null || action == null) { return; } for (int i = 0; i < players.Count; i++) { PlayerAvatar val = players[i]; if (!IsNullUnity(val)) { try { action(val); } catch (Exception ex) { LogError("Command failure " + actionName + " target=" + PlayerLabel(val) + "\n" + ex); } } } } [IteratorStateMachine(typeof(d__24))] private IEnumerator CoExecuteForPlayersBatched(string actionName, List players, Action action) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__24(0) { <>4__this = this, actionName = actionName, players = players, action = action }; } private static List GetPlayersByNamePart(string keyword) { List list = new List(); if (string.IsNullOrWhiteSpace(keyword)) { return list; } string value = keyword.Trim().ToLowerInvariant(); List allPlayers = GetAllPlayers(); for (int i = 0; i < allPlayers.Count; i++) { PlayerAvatar val = allPlayers[i]; if (!IsNullUnity(val)) { string text = PlayerLabel(val).ToLowerInvariant(); string text2 = PlayerNameOnly(val).ToLowerInvariant(); if (text.Contains(value) || text2.Contains(value)) { list.Add(val); } } } return list; } private static List GetAllPlayers() { Dictionary dictionary = new Dictionary(); Dictionary dictionary2 = new Dictionary(); AddPlayersToMaps(dictionary, dictionary2, GetPlayersFromSemiFunc()); AddPlayersToMaps(dictionary, dictionary2, GetPlayersFromResources()); if (dictionary.Count > 0) { return new List(dictionary.Values); } return new List(dictionary2.Values); } private static List GetPlayersFromSemiFunc() { try { List list = SemiFunc.PlayerGetList(); if (list != null) { return list; } } catch { } return new List(); } private static List GetPlayersFromResources() { List list = new List(); try { PlayerAvatar[] array = Resources.FindObjectsOfTypeAll(); if (array != null) { for (int i = 0; i < array.Length; i++) { if (!IsNullUnity(array[i])) { list.Add(array[i]); } } } } catch { } return list; } private static void AddPlayersToMaps(Dictionary actorMap, Dictionary instanceMap, List players) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) if (players == null) { return; } for (int i = 0; i < players.Count; i++) { PlayerAvatar val = players[i]; if (IsNullUnity(val) || IsNullUnity(((Component)val).gameObject)) { continue; } Scene scene = ((Component)val).gameObject.scene; if (!((Scene)(ref scene)).IsValid()) { continue; } int actorNumber = GetActorNumber(val); if (actorNumber > 0) { actorMap[actorNumber] = val; continue; } int instanceID; try { instanceID = ((Object)val).GetInstanceID(); } catch { continue; } instanceMap[instanceID] = val; } } private static int GetActorNumber(PlayerAvatar avatar) { if (IsNullUnity(avatar)) { return -1; } try { if (!IsNullUnity(avatar.photonView) && avatar.photonView.Owner != null) { return avatar.photonView.Owner.ActorNumber; } } catch { } try { PhotonView component = ((Component)avatar).GetComponent(); if ((Object)(object)component != (Object)null && component.Owner != null) { return component.Owner.ActorNumber; } } catch { } return -1; } private static bool IsMasterClientOrSingleplayer() { try { if (SemiFunc.IsMasterClientOrSingleplayer()) { return true; } } catch { } try { return !PhotonNetwork.InRoom || PhotonNetwork.IsMasterClient; } catch { return true; } } private static bool IsAnyCmd(string cmdLower, IEnumerable cmds) { foreach (string cmd in cmds) { if (string.Equals(cmdLower, cmd, StringComparison.OrdinalIgnoreCase)) { return true; } } return false; } private static string PlayerNameOnly(PlayerAvatar avatar) { if (IsNullUnity(avatar)) { return string.Empty; } try { return SemiFunc.PlayerGetName(avatar); } catch { try { return ((Object)avatar).name; } catch { return string.Empty; } } } private static string PlayerLabel(PlayerAvatar avatar) { if (IsNullUnity(avatar)) { return ""; } try { string text = SemiFunc.PlayerGetName(avatar); string text2 = SemiFunc.PlayerGetSteamID(avatar); return text + " (" + text2 + ")"; } catch { try { return ((Object)avatar).name; } catch { return ""; } } } private static bool IsNullUnity(object obj) { if (obj == null) { return true; } Object val = (Object)((obj is Object) ? obj : null); if (val != null) { return val == (Object)null; } return false; } internal static void LogInfo(string message) { Debug.Log((object)("[AllPlayerCommands] " + message)); if (LogSource != null) { LogSource.LogInfo((object)message); } } internal static void LogWarn(string message) { Debug.LogWarning((object)("[AllPlayerCommands] " + message)); if (LogSource != null) { LogSource.LogWarning((object)message); } } internal static void LogError(string message) { Debug.LogError((object)("[AllPlayerCommands] " + message)); if (LogSource != null) { LogSource.LogError((object)message); } } } }