using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Dawn; using Dawn.Utils; using Dissonance; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Snowlance.SnowyLib.NetcodePatcher; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Animations.Rigging; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("DunGen")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.ASPP")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.UnityNav")] [assembly: IgnoresAccessChecksTo("EasyTextEffects")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.XR.CoreUtils")] [assembly: IgnoresAccessChecksTo("Unity.XR.Management")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.ConformanceAutomation")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MetaQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MockRuntime")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.OculusQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.RuntimeDebugger")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SpatialTracking")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("UnityEngine.XR.LegacyInputHelpers")] [assembly: AssemblyCompany("Snowlance.SnowyLib")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.11.0.0")] [assembly: AssemblyInformationalVersion("1.11.0+5de28e93ebfc700a4d292e217db5748c7f9855a4")] [assembly: AssemblyProduct("SnowyLib")] [assembly: AssemblyTitle("Snowlance.SnowyLib")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.11.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [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 SnowyLib { [AttributeUsage(AttributeTargets.Method)] public sealed class InitConfigAttribute : Attribute { } internal static class InitConfigManager { public static void Initialize() { Assembly assembly = typeof(InitConfigAttribute).Assembly; string snowyLibName = assembly.GetName().Name; Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly2 in assemblies) { if (assembly2 == assembly) { ScanAssembly(assembly2); } else if (assembly2.GetReferencedAssemblies().Any((AssemblyName a) => a.Name == snowyLibName)) { ScanAssembly(assembly2); } } } private static void ScanAssembly(Assembly assembly) { foreach (Type loadableType in GetLoadableTypes(assembly)) { MethodInfo[] methods = loadableType.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.IsDefined(typeof(InitConfigAttribute), inherit: false)) { if (methodInfo.ReturnType != typeof(void)) { throw new Exception(methodInfo.DeclaringType.FullName + "." + methodInfo.Name + " must return void."); } if (methodInfo.GetParameters().Length != 0) { throw new Exception(methodInfo.DeclaringType.FullName + "." + methodInfo.Name + " cannot have parameters."); } methodInfo.Invoke(null, null); } } } } private static IEnumerable GetLoadableTypes(Assembly assembly) { try { return assembly.GetTypes(); } catch (ReflectionTypeLoadException ex) { return ex.Types.Where((Type t) => t != null); } } } [AttributeUsage(AttributeTargets.Method)] public sealed class StaticUpdateAttribute : Attribute { } internal static class StaticUpdateManager { private static readonly List updates = new List(); public static void Initialize() { updates.Clear(); Assembly assembly = typeof(StaticUpdateManager).Assembly; string snowyLibName = assembly.GetName().Name; Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly2 in assemblies) { if (assembly2 == assembly) { ScanAssembly(assembly2); } else if (assembly2.GetReferencedAssemblies().Any((AssemblyName a) => a.Name == snowyLibName)) { ScanAssembly(assembly2); } } } private static void ScanAssembly(Assembly assembly) { foreach (Type loadableType in GetLoadableTypes(assembly)) { MethodInfo[] methods = loadableType.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.IsDefined(typeof(StaticUpdateAttribute), inherit: false)) { if (methodInfo.ReturnType != typeof(void)) { throw new Exception(methodInfo.DeclaringType.FullName + "." + methodInfo.Name + " must return void."); } if (methodInfo.GetParameters().Length != 0) { throw new Exception(methodInfo.DeclaringType.FullName + "." + methodInfo.Name + " cannot have parameters."); } updates.Add((Action)Delegate.CreateDelegate(typeof(Action), methodInfo)); } } } } private static IEnumerable GetLoadableTypes(Assembly assembly) { try { return assembly.GetTypes(); } catch (ReflectionTypeLoadException ex) { return ex.Types.Where((Type t) => t != null); } } public static void Update() { foreach (Action update in updates) { update(); } } } public class AutoDictionary : Dictionary where TValue : new() { private readonly Func _factory; public new TValue this[TKey key] { get { if (!TryGetValue(key, out var value)) { value = (base[key] = _factory(key)); } return value; } set { base[key] = value; } } public AutoDictionary(Func factory) { _factory = factory; } } public static class ComponentExtensions { public static bool TryGetComponentInChildren(this Component comp, out T? component) where T : Component { component = comp.GetComponentInChildren(); return (Object)(object)component != (Object)null; } } public static class EnemyAIExtensions { public static StatusEffectController StatusEffectController(this EnemyAI enemy) { StatusEffectController statusEffectController = default(StatusEffectController); return ((Component)enemy).gameObject.TryGetComponent(ref statusEffectController) ? statusEffectController : ((Component)enemy).gameObject.AddComponent(); } public static bool TargetClosestEnemy(this EnemyAI thisEnemy, out EnemyAI? targetEnemy, EnemyAI? previousTargetEnemy, Func enemyIsTargetable, float bufferDistance = 1.5f, bool requireLineOfSight = false, float viewWidth = 70f, bool doGroundCast = false, bool requirePath = false, bool checkForMineshaftStartTile = true) { //IL_0057: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) targetEnemy = previousTargetEnemy; thisEnemy.mostOptimalDistance = 2000f; EnemyAI val = targetEnemy; targetEnemy = null; foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies) { if (!enemyIsTargetable(spawnedEnemy)) { continue; } if (doGroundCast) { if (!Physics.Raycast(((Component)spawnedEnemy).transform.position, Vector3.down, ref thisEnemy.raycastHit, 5f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) || (requirePath && thisEnemy.PathIsIntersectedByLineOfSight(((RaycastHit)(ref thisEnemy.raycastHit)).point, false, false, false))) { continue; } } else if (requirePath && thisEnemy.PathIsIntersectedByLineOfSight(((Component)spawnedEnemy).transform.position, false, false, false)) { continue; } if (!requireLineOfSight || thisEnemy.CheckLineOfSightForPosition(((Component)spawnedEnemy.eye).transform.position, viewWidth, 40, -1f, (Transform)null)) { thisEnemy.tempDist = Vector3.Distance(((Component)thisEnemy).transform.position, ((Component)spawnedEnemy).transform.position); if (thisEnemy.tempDist < thisEnemy.mostOptimalDistance) { thisEnemy.mostOptimalDistance = thisEnemy.tempDist; targetEnemy = spawnedEnemy; } } } if ((Object)(object)targetEnemy != (Object)null && bufferDistance > 0f && (Object)(object)val != (Object)null && Mathf.Abs(thisEnemy.mostOptimalDistance - Vector3.Distance(((Component)thisEnemy).transform.position, ((Component)val).transform.position)) < bufferDistance) { targetEnemy = val; } return (Object)(object)targetEnemy != (Object)null; } public static EnemyAI? CheckLineOfSightForClosestEnemy(this EnemyAI thisEnemy, out EnemyAI? targetEnemy, EnemyAI? previousTargetEnemy, float width = 45f, int range = 60, int proximityAwareness = -1, float bufferDistance = 0f) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between Unknown and I4 //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_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) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: 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) //IL_016a: Unknown result type (might be due to invalid IL or missing references) targetEnemy = previousTargetEnemy; if (thisEnemy.isOutside && !thisEnemy.enemyType.canSeeThroughFog && (int)TimeOfDay.Instance.currentLevelWeather == 3) { range = Mathf.Clamp(range, 0, 30); } float num = 1000f; float num2 = 1000f; EnemyAI val = null; foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies) { num = 1000f; Vector3 position = ((Component)spawnedEnemy.eye).transform.position; Vector3 val2 = position - thisEnemy.eye.position; bool flag = false; if (Vector3.Angle(thisEnemy.eye.forward, val2) < width) { flag = true; } else { num = Vector3.Distance(thisEnemy.eye.position, position); if (proximityAwareness != -1 && num < (float)proximityAwareness) { flag = true; } } if (flag && !Physics.Linecast(thisEnemy.eye.position, position, ref thisEnemy.raycastHit, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) && !Physics.Linecast(position, thisEnemy.eye.position, ref thisEnemy.raycastHit, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { if (num == 1000f) { num = Vector3.Distance(thisEnemy.eye.position, position); } if (num < num2) { num2 = num; val = spawnedEnemy; } } } if ((Object)(object)targetEnemy != (Object)null && (Object)(object)val != (Object)null && (Object)(object)targetEnemy != (Object)(object)val && bufferDistance > 0f && Mathf.Abs(num2 - Vector3.Distance(((Component)thisEnemy).transform.position, ((Component)targetEnemy).transform.position)) < bufferDistance) { return null; } if ((Object)(object)val == (Object)null) { return null; } thisEnemy.mostOptimalDistance = num2; return val; } } public static class GameObjectExtensions { public static StatusEffectController StatusEffectController(this GameObject gameObject) { StatusEffectController statusEffectController = default(StatusEffectController); return gameObject.TryGetComponent(ref statusEffectController) ? statusEffectController : gameObject.AddComponent(); } public static bool TryGetComponentInChildren(this GameObject go, out T? component) where T : Component { component = go.GetComponentInChildren(); return (Object)(object)component != (Object)null; } } public static class IEnumerableExtensions { public static T? GetRandom(this IEnumerable source, Random random) where T : class { if (source is IList list) { if (list.Count == 0) { return null; } return list[random.Next(list.Count)]; } T[] array = (source as T[]) ?? source.ToArray(); if (array.Length == 0) { return null; } return array[random.Next(array.Length)]; } public static T? GetRandom(this IEnumerable source) where T : class { if (source is IList list) { if (list.Count == 0) { return null; } return list[Random.Range(0, list.Count)]; } T[] array = (source as T[]) ?? source.ToArray(); if (array.Length == 0) { return null; } return array[Random.Range(0, array.Length)]; } public static T? GetClosestToPosition(this IEnumerable list, Vector3 position, Func positionSelector, out float closestDistance, bool fastDistanceCheck = false, IEnumerable? excluded = null) where T : class { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) T result = null; closestDistance = float.PositiveInfinity; if (excluded == null) { excluded = Array.Empty(); } foreach (T item in list) { if (item != null && !excluded.Contains(item)) { float num = Utils.SmartDistance(position, positionSelector(item), fastDistanceCheck); if (!(num >= closestDistance)) { result = item; closestDistance = num; } } } return result; } public static T? GetClosestToPosition(this IEnumerable list, Vector3 position, Func positionSelector, bool fastDistanceCheck = false, IEnumerable? excluded = null) where T : class { //IL_0047: 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) T result = null; float num = float.PositiveInfinity; if (excluded == null) { excluded = Array.Empty(); } foreach (T item in list) { if (item != null && !excluded.Contains(item)) { float num2 = Utils.SmartDistance(position, positionSelector(item), fastDistanceCheck); if (!(num2 >= num)) { result = item; num = num2; } } } return result; } public static T? GetFarthestFromPosition(this IEnumerable list, Vector3 position, Func positionSelector, out float farthestDistance, bool fastDistanceCheck = false, IEnumerable? excluded = null) where T : class { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) T result = null; farthestDistance = 0f; if (excluded == null) { excluded = Array.Empty(); } foreach (T item in list) { if (item != null && !excluded.Contains(item)) { float num = Utils.SmartDistance(position, positionSelector(item), fastDistanceCheck); if (!(num <= farthestDistance)) { result = item; farthestDistance = num; } } } return result; } public static T? GetFarthestFromPosition(this IEnumerable list, Vector3 position, Func positionSelector, bool fastDistanceCheck = false, IEnumerable? excluded = null) where T : class { //IL_0047: 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) T result = null; float num = 0f; if (excluded == null) { excluded = Array.Empty(); } foreach (T item in list) { if (item != null && !excluded.Contains(item)) { float num2 = Utils.SmartDistance(position, positionSelector(item), fastDistanceCheck); if (!(num2 <= num)) { result = item; num = num2; } } } return result; } public static IEnumerable GetInRange(this IEnumerable list, Vector3 position, Func positionSelector, float range, IEnumerable? excluded = null) where T : class { //IL_003d: 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) List list2 = new List(); if (excluded == null) { excluded = Array.Empty(); } foreach (T item in list) { if (item != null && !excluded.Contains(item) && Vector3.Distance(position, positionSelector(item)) < range) { list2.Add(item); } } return list2; } } public static class PlayerControllerBExtensions { public static StatusEffectController StatusEffectController(this PlayerControllerB player) { StatusEffectController statusEffectController = default(StatusEffectController); return ((Component)player).gameObject.TryGetComponent(ref statusEffectController) ? statusEffectController : ((Component)player).gameObject.AddComponent(); } public static bool GrabGrabbableObject(this PlayerControllerB player, GrabbableObject grabbableObject) { //IL_0235: Unknown result type (might be due to invalid IL or missing references) if (player.twoHanded || player.sinkingValue > 0.73f) { return false; } player.currentlyGrabbingObject = grabbableObject; if (!GameNetworkManager.Instance.gameHasStarted && !player.currentlyGrabbingObject.itemProperties.canBeGrabbedBeforeGameStart && (Object)(object)StartOfRound.Instance.testRoom == (Object)null) { return false; } player.grabInvalidated = false; if ((Object)(object)player.currentlyGrabbingObject == (Object)null || player.inSpecialInteractAnimation || player.currentlyGrabbingObject.isHeld || player.currentlyGrabbingObject.isPocketed) { return false; } NetworkObject networkObject = ((NetworkBehaviour)player.currentlyGrabbingObject).NetworkObject; if ((Object)(object)networkObject == (Object)null || !networkObject.IsSpawned) { return false; } player.currentlyGrabbingObject.InteractItem(); if (!player.currentlyGrabbingObject.grabbable || player.FirstEmptyItemSlot(player.currentlyGrabbingObject) == -1) { return false; } player.playerBodyAnimator.SetBool("GrabInvalidated", false); player.playerBodyAnimator.SetBool("GrabValidated", false); player.playerBodyAnimator.SetBool("cancelHolding", false); player.playerBodyAnimator.ResetTrigger("Throw"); player.SetSpecialGrabAnimationBool(true, (GrabbableObject)null); player.isGrabbingObjectAnimation = true; ((Behaviour)player.cursorIcon).enabled = false; ((TMP_Text)player.cursorTip).text = ""; player.twoHanded = player.currentlyGrabbingObject.itemProperties.twoHanded; player.carryWeight = Mathf.Clamp(player.carryWeight + (player.currentlyGrabbingObject.itemProperties.weight - 1f), 1f, 10f); StartOfRound.Instance.SendChangedWeightEvent(); if (player.currentlyGrabbingObject.itemProperties.grabAnimationTime > 0f) { player.grabObjectAnimationTime = player.currentlyGrabbingObject.itemProperties.grabAnimationTime; } else { player.grabObjectAnimationTime = 0.4f; } if (!player.isTestingPlayer) { player.GrabObjectServerRpc(NetworkObjectReference.op_Implicit(networkObject)); } if (player.grabObjectCoroutine != null) { ((MonoBehaviour)player).StopCoroutine(player.grabObjectCoroutine); } player.grabObjectCoroutine = ((MonoBehaviour)player).StartCoroutine(player.GrabObject()); return true; } public static void FreezePlayer(this PlayerControllerB player, bool value) { Utils.localPlayerFrozen = value; player.disableInteract = value; player.disableLookInput = value; player.disableMoveInput = value; } public static void MakePlayerInvisible(this PlayerControllerB player, bool value) { GameObject gameObject = ((Component)((Component)player).gameObject.transform.Find("ScavengerModel")).gameObject; if ((Object)(object)gameObject == (Object)null) { Plugin.logger.LogError((object)"ScavengerModel not found"); return; } ((Component)gameObject.transform.Find("LOD1")).gameObject.SetActive(!value); ((Component)gameObject.transform.Find("LOD2")).gameObject.SetActive(!value); ((Component)gameObject.transform.Find("LOD3")).gameObject.SetActive(!value); ((Component)gameObject.transform.Find("metarig/spine/spine.001/spine.002/spine.003/LevelSticker")).gameObject.SetActive(!value); ((Component)gameObject.transform.Find("metarig/spine/spine.001/spine.002/spine.003/BetaBadge")).gameObject.SetActive(!value); ((Component)player.playerBadgeMesh).gameObject.SetActive(!value); } public static void RebuildRig(this PlayerControllerB player) { if ((Object)(object)player != (Object)null && (Object)(object)player.playerBodyAnimator != (Object)null) { player.playerBodyAnimator.WriteDefaultValues(); RigBuilder component = ((Component)player.playerBodyAnimator).GetComponent(); if (component != null) { component.Build(); } } } public static void MufflePlayer(this PlayerControllerB player, bool muffle) { if ((Object)(object)player.currentVoiceChatAudioSource == (Object)null) { StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects(); } if ((Object)(object)player.currentVoiceChatAudioSource != (Object)null) { ((Component)player.currentVoiceChatAudioSource).GetComponent().lowpassResonanceQ = (muffle ? 5f : 1f); OccludeAudio component = ((Component)player.currentVoiceChatAudioSource).GetComponent(); component.overridingLowPass = muffle; component.lowPassOverride = (muffle ? 500f : 20000f); player.voiceMuffledByEnemy = muffle; } } public static bool IsPlayerSpeaking(this PlayerControllerB player, float amplitudeThreshold = 0.005f, bool useRelativeAmplitude = true) { VoicePlayerState voicePlayerState = player.GetVoicePlayerState(); if (voicePlayerState == null) { return false; } return voicePlayerState.IsSpeaking && player.GetPlayerVoiceAmplitude(useRelativeAmplitude) > amplitudeThreshold; } public static bool IsPlayerMuted(this PlayerControllerB player) { VoicePlayerState voicePlayerState = player.GetVoicePlayerState(); return voicePlayerState == null || !voicePlayerState.IsConnected; } public static float GetPlayerVoiceAmplitude(this PlayerControllerB player, bool getRelativeAmplitude = false) { VoicePlayerState voicePlayerState = player.GetVoicePlayerState(); if (voicePlayerState == null || !voicePlayerState.IsConnected) { return 0f; } return getRelativeAmplitude ? (voicePlayerState.Amplitude / Mathf.Clamp(StartOfRound.Instance.averageVoiceAmplitude, 0.008f, 0.5f)) : voicePlayerState.Amplitude; } public static VoicePlayerState? GetVoicePlayerState(this PlayerControllerB player) { VoicePlayerState val = player.voicePlayerState; if (PlayerControllerBExtensions.IsLocalPlayer(player) && !string.IsNullOrEmpty(StartOfRound.Instance.voiceChatModule.LocalPlayerName)) { val = StartOfRound.Instance.voiceChatModule.FindPlayer(StartOfRound.Instance.voiceChatModule.LocalPlayerName); } if (val == null) { StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects(); } if (val == null) { val = player.voicePlayerState; } return val; } public static void DiscardItemInSlot(this PlayerControllerB player, int slot, bool placeObject = false, NetworkObject? parentObjectTo = null, Vector3 placePosition = default(Vector3), bool matchRotationOfParent = true, bool setInShip = false, bool setInElevator = false, Vector3 syncedPlayerPosition = default(Vector3), Vector3 syncedHeldObjectPosition = default(Vector3), Vector3 syncedHeldObjectRotation = default(Vector3), Vector3 syncedPlayerCamPosition = default(Vector3), Vector3 syncedPlayerCamRotation = default(Vector3)) { //IL_0012: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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 (player.currentItemSlot == slot) { player.DiscardHeldObject(placeObject, parentObjectTo, placePosition, matchRotationOfParent); return; } GrabbableObject val = player.ItemSlots[slot]; if (!((Object)(object)val == (Object)null)) { player.DropHeldItem(val, true, false, syncedPlayerPosition, syncedHeldObjectPosition, syncedHeldObjectRotation, syncedPlayerCamPosition, syncedPlayerCamRotation, setInShip, setInElevator); if (((NetworkBehaviour)player).IsOwner) { ((Behaviour)HUDManager.Instance.itemSlotIcons[slot]).enabled = false; } } } public static bool IsPlayerWithinShipBounds(this PlayerControllerB player) { //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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) int sceneCount = SceneManager.sceneCount; Scene[] array = (Scene[])(object)new Scene[sceneCount]; int num = 0; for (int i = 0; i < sceneCount; i++) { array[i] = SceneManager.GetSceneAt(i); if (((Scene)(ref array[i])).name == "CompanyBuilding") { num++; } } if (num == 1) { return true; } if (GameNetworkManager.Instance.localPlayerController.isPlayerDead) { return false; } Bounds bounds = StartOfRound.Instance.shipBounds.bounds; return ((Bounds)(ref bounds)).Contains(((Component)player).transform.position); } } public static class SmartAgentNavigatorExtensions { public static bool SmartCanPathToPoint(this SmartAgentNavigator nav, Vector3 pos) { //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) return Utils.SmartCanPathToPoint(((Component)nav.agent).transform.position, pos, nav.IsAgentOutside()); } public static bool SmartCanPathToPoint(this SmartAgentNavigator nav, Vector3 startPos, Vector3 endPos) { //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 Utils.SmartCanPathToPoint(startPos, endPos, nav.IsAgentOutside()); } public static bool CanPathToPoint(this SmartAgentNavigator nav, Vector3 pos) { //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) return nav.CanPathToPoint(((Component)nav.agent).transform.position, pos) > 0f; } } public static class Vector3Extensions { public static Vector3 GetFloorPosition(this Vector3 position, float verticalOffset = 0f) { //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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0049: 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) //IL_0055: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (Physics.Raycast(position, -Vector3.up, ref val, 80f, 268437761, (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref val)).point + Vector3.up * 0.04f + verticalOffset * Vector3.up; } return position; } public static T? GetClosestGameObjectOfType(this Vector3 position) where T : Component { //IL_0028: 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) T[] array = Object.FindObjectsOfType(); T result = default(T); float num = float.PositiveInfinity; T[] array2 = array; foreach (T val in array2) { float num2 = Vector3.Distance(position, ((Component)val).transform.position); if (num2 < num) { num = num2; result = val; } } return result; } public static PlayerControllerB[] GetNearbyPlayers(this Vector3 position, float distance = 10f, List? ignoredPlayers = null) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) List list = new List(); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!((Object)(object)val == (Object)null) && val.isPlayerControlled && (ignoredPlayers == null || !ignoredPlayers.Contains(val)) && !(Vector3.Distance(position, ((Component)val).transform.position) > distance)) { list.Add(val); } } return list.ToArray(); } public static bool IsOutside(this Vector3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return position.y > -80f; } } public interface ISingletonItem { } [HarmonyPatch] internal static class ISingletonItemPatch { private static HashSet spawned = new HashSet(); private static GrabbableObject? despawningDuplicate; [HarmonyPostfix] [HarmonyPatch(typeof(GrabbableObject), "Start")] private static void GrabbableObject_Start_Postfix(GrabbableObject __instance) { //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0157: 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) try { if (!((NetworkBehaviour)__instance).IsServer || !(__instance is ISingletonItem)) { return; } Type type = ((object)__instance).GetType(); if (spawned.Contains(type)) { List list = RoundManager.Instance.currentLevel.spawnableScrap.Where((SpawnableItemWithRarity x) => (Object)(object)x.spawnableItem != (Object)(object)__instance.itemProperties).ToList(); List list2 = list.Select((SpawnableItemWithRarity x) => x.rarity).ToList(); int randomWeightedIndexList = RoundManager.Instance.GetRandomWeightedIndexList(list2, (Random)null); Item spawnableItem = list[randomWeightedIndexList].spawnableItem; int num = (int)((float)Random.Range(spawnableItem.minValue, spawnableItem.maxValue) * RoundManager.Instance.scrapValueMultiplier); Plugin.logger.LogDebug((object)$"Only one {((Object)__instance.itemProperties).name} instance can be spawned, replacing duplicate with {((Object)spawnableItem).name} with a scrap value of {num}"); Vector3 position = ((Component)__instance).transform.position + Vector3.up * 0.25f; GrabbableObject grabbableObject = Utils.SpawnItem(((DawnBaseInfo)(object)ItemExtensions.GetDawnInfo(spawnableItem)).TypedKey, position); ((MonoBehaviour)NetworkHandler.Instance).StartCoroutine(NetworkHandler.Instance.SetScrapSpawnOnNetworkSpawn(grabbableObject, num)); despawningDuplicate = __instance; ((NetworkBehaviour)__instance).NetworkObject.Despawn(true); } else { spawned.Add(type); } } catch (Exception ex) { Plugin.logger.LogError((object)ex); } } [HarmonyPrefix] [HarmonyPatch(typeof(GrabbableObject), "OnDestroy")] private static void GrabbableObject_OnDestroy_Prefix(GrabbableObject __instance) { try { if (((NetworkBehaviour)__instance).IsServer && __instance is ISingletonItem) { if ((Object)(object)despawningDuplicate != (Object)null && (Object)(object)despawningDuplicate == (Object)(object)__instance) { despawningDuplicate = null; } else { spawned.Remove(((object)__instance).GetType()); } } } catch { } } } public class NetworkHandler : NetworkBehaviour { public static NetworkHandler Instance { get; private set; } public override void OnNetworkSpawn() { if (((NetworkBehaviour)this).IsServer && (Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { ((Component)Instance).GetComponent().Despawn(true); } ((Object)this).hideFlags = (HideFlags)61; Instance = this; Plugin.logger.LogDebug((object)"NetworkHandler spawned"); ((NetworkBehaviour)this).OnNetworkSpawn(); } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } public void Start() { InitConfigManager.Initialize(); StaticUpdateManager.Initialize(); } public void Update() { StaticUpdateManager.Update(); } [Rpc(/*Could not decode attribute arguments.*/)] public void ShakeCameraRpc(ScreenShakeType screenShakeType, RpcParams rpcParams) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1805725168u, rpcParams, val, (SendTo)8, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref screenShakeType, default(ForEnums)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 1805725168u, rpcParams, val, (SendTo)8, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; HUDManager.Instance.ShakeCamera(screenShakeType); } } } [Rpc(/*Could not decode attribute arguments.*/)] public void ChangePlayerSizeRpc(ulong clientId, float size) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(944480672u, val3, val, (SendTo)6, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientId); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref size, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 944480672u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB val4 = Plugin.PlayerFromId(clientId); if (!((Object)(object)val4 == (Object)null)) { val4.thisPlayerBody.localScale = new Vector3(size, size, size); } } } [Rpc(/*Could not decode attribute arguments.*/)] public void MufflePlayerRpc(ulong clientId, bool value) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3841467943u, val3, val, (SendTo)6, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientId); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref value, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 3841467943u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB val4 = Plugin.PlayerFromId(clientId); if (!((Object)(object)val4 == (Object)null)) { val4.MufflePlayer(value); } } } [Rpc(/*Could not decode attribute arguments.*/)] public void KillPlayerRpc(ulong clientId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(544173340u, val3, val, (SendTo)6, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientId); ((NetworkBehaviour)this).__endSendRpc(ref val2, 544173340u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; if (Plugin.localPlayer.actualClientId == clientId) { Plugin.localPlayer.KillPlayer(Vector3.zero, true, (CauseOfDeath)0, 0, default(Vector3), false); } } } internal IEnumerator SetScrapSpawnOnNetworkSpawn(GrabbableObject grabbableObject, int value) { yield return null; yield return (object)new WaitUntil((Func)(() => (Object)(object)((NetworkBehaviour)grabbableObject).NetworkObject != (Object)null && ((NetworkBehaviour)grabbableObject).NetworkObject.IsSpawned)); Instance.SetScrapValueRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)grabbableObject).NetworkObject), value); } [Rpc(/*Could not decode attribute arguments.*/)] public void SetScrapValueRpc(NetworkObjectReference netRef, int value) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_0083: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3930017063u, val3, val, (SendTo)6, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref netRef, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, value); ((NetworkBehaviour)this).__endSendRpc(ref val2, 3930017063u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val4 = default(NetworkObject); GrabbableObject val5 = default(GrabbableObject); if (((NetworkObjectReference)(ref netRef)).TryGet(ref val4, (NetworkManager)null) && ((Component)val4).TryGetComponent(ref val5)) { Plugin.logger.LogDebug((object)$"Setting scrap value of {((Object)val5).name} to {value}"); val5.SetScrapValue(value); } } } [Rpc(/*Could not decode attribute arguments.*/)] public void SpawnEnemyRpc(NamespacedKey key, Vector3 position, Quaternion rotation = default(Quaternion), bool destroyWithScene = true) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1349571230u, val3, val, (SendTo)2, (RpcDelivery)0); bool flag = key != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe>(ref key, default(ForNetworkSerializable)); } ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref rotation); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref destroyWithScene, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 1349571230u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkBehaviour)this).IsServer) { GameObject val4 = Object.Instantiate(((Registry)(object)LethalContent.Enemies)[key].EnemyType.enemyPrefab, position, rotation); EnemyAI component = val4.GetComponent(); ((NetworkBehaviour)component).NetworkObject.Spawn(destroyWithScene); RoundManager.Instance.SpawnedEnemies.Add(component); } } } [Rpc(/*Could not decode attribute arguments.*/)] public void SpawnItemRpc(NamespacedKey key, Vector3 position, Quaternion rotation = default(Quaternion), float fallTime = 0f, bool destroyWithScene = false) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010e: 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_00a3: 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_016b: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1523590376u, val3, val, (SendTo)2, (RpcDelivery)0); bool flag = key != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe>(ref key, default(ForNetworkSerializable)); } ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref rotation); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref fallTime, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref destroyWithScene, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 1523590376u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkBehaviour)this).IsServer) { GameObject val4 = Object.Instantiate(((Registry)(object)LethalContent.Items)[key].Item.spawnPrefab, position, rotation); GrabbableObject component = val4.GetComponent(); component.fallTime = fallTime; ((NetworkBehaviour)component).NetworkObject.Spawn(destroyWithScene); } } } [Rpc(/*Could not decode attribute arguments.*/)] public void SpawnMapObjectRpc(NamespacedKey key, Vector3 position, Quaternion rotation = default(Quaternion), bool destroyWithScene = true) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_014b: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(4047400807u, val3, val, (SendTo)2, (RpcDelivery)0); bool flag = key != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe>(ref key, default(ForNetworkSerializable)); } ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref rotation); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref destroyWithScene, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 4047400807u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkBehaviour)this).IsServer) { GameObject val4 = Object.Instantiate(((Registry)(object)LethalContent.MapObjects)[key].GetMapObjectPrefab(), position, rotation); SpawnableMapObject component = val4.GetComponent(); val4.GetComponent().Spawn(destroyWithScene); } } } [Rpc(/*Could not decode attribute arguments.*/)] public void SpawnExplosionRpc(Vector3 explosionPosition, bool spawnExplosionEffect = false, float killRange = 1f, float damageRange = 1f, int nonLethalDamage = 50, float physicsForce = 0f, bool goThroughCar = false) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(4254446207u, val3, val, (SendTo)6, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref explosionPosition); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref spawnExplosionEffect, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref killRange, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref damageRange, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, nonLethalDamage); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref physicsForce, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref goThroughCar, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 4254446207u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; Landmine.SpawnExplosion(explosionPosition, spawnExplosionEffect, killRange, damageRange, nonLethalDamage, physicsForce, (GameObject)null, goThroughCar); } } } [Rpc(/*Could not decode attribute arguments.*/)] public void SetEarsRingingRpc(float time, RpcParams rpcParams) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1872345569u, rpcParams, val, (SendTo)8, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref time, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 1872345569u, rpcParams, val, (SendTo)8, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; SoundManager.Instance.earsRingingTimer = time; } } } [Rpc(/*Could not decode attribute arguments.*/)] public void DisplayStatusEffectRpc(string statusEffectString, RpcParams rpcParams) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2432440999u, rpcParams, val, (SendTo)8, (RpcDelivery)0); bool flag = statusEffectString != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(statusEffectString, false); } ((NetworkBehaviour)this).__endSendRpc(ref val2, 2432440999u, rpcParams, val, (SendTo)8, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; Utils.DisplayStatusEffect(statusEffectString); } } [Rpc(/*Could not decode attribute arguments.*/)] public void SetShipLeaveEarlyServerRpc(float timeToLeaveEarly, string message, string speakerText = "SAFETY COMPUTER", float waitTime = 4f) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_0157: 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_0163: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3796664176u, val3, val, (SendTo)6, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref timeToLeaveEarly, default(ForPrimitives)); bool flag = message != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(message, false); } bool flag2 = speakerText != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe(speakerText, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe(ref waitTime, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 3796664176u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; DialogueSegment val4 = new DialogueSegment(); val4.speakerText = speakerText; val4.bodyText = message; val4.waitTime = waitTime; TimeOfDay.Instance.shipLeaveAutomaticallyTime = timeToLeaveEarly; TimeOfDay.Instance.shipLeavingAlertCalled = true; HUDManager.Instance.ReadDialogue((DialogueSegment[])(object)new DialogueSegment[1] { val4 }); ((Behaviour)HUDManager.Instance.shipLeavingEarlyIcon).enabled = true; } } [Rpc(/*Could not decode attribute arguments.*/)] public void DisplayAdRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1546914772u, val3, val, (SendTo)2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendRpc(ref val2, 1546914772u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; HUDManager.Instance.ChooseAdItem(); } } } [Rpc(/*Could not decode attribute arguments.*/)] public void RevivePlayerRpc(ulong clientId, Vector3 position = default(Vector3)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(888768384u, val3, val, (SendTo)6, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientId); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((NetworkBehaviour)this).__endSendRpc(ref val2, 888768384u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB val4 = Plugin.PlayerFromId(clientId); if ((Object)(object)val4 == (Object)null) { return; } if (position == default(Vector3)) { position = StartOfRound.Instance.GetPlayerSpawnPosition(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, val4), false); } val4.isInsideFactory = false; val4.isInElevator = true; val4.isInHangarShipRoom = true; val4.ResetPlayerBloodObjects(val4.isPlayerDead); val4.health = 5; val4.isClimbingLadder = false; val4.clampLooking = false; val4.inVehicleAnimation = false; val4.disableMoveInput = false; val4.disableLookInput = false; val4.disableInteract = false; val4.ResetZAndXRotation(); ((Collider)val4.thisController).enabled = true; if (val4.isPlayerDead) { ((Collider)val4.thisController).enabled = true; val4.isPlayerDead = false; val4.isPlayerControlled = true; val4.health = 5; val4.hasBeenCriticallyInjured = false; val4.criticallyInjured = false; val4.playerBodyAnimator.SetBool("Limp", false); val4.TeleportPlayer(position, false, 0f, false, true); val4.parentedToElevatorLastFrame = false; val4.overrideGameOverSpectatePivot = null; StartOfRound.Instance.SetPlayerObjectExtrapolate(false); val4.setPositionOfDeadPlayer = false; val4.DisablePlayerModel(((Component)val4).gameObject, true, true); ((Behaviour)val4.helmetLight).enabled = false; val4.Crouch(false); Animator playerBodyAnimator = val4.playerBodyAnimator; if ((Object)(object)playerBodyAnimator != (Object)null) { playerBodyAnimator.SetBool("Limp", false); } val4.bleedingHeavily = false; if ((Object)(object)val4.deadBody != (Object)null) { ((Behaviour)val4.deadBody).enabled = false; ((Component)val4.deadBody).gameObject.SetActive(false); } val4.bleedingHeavily = true; val4.deadBody = null; val4.activatingItem = false; val4.twoHanded = false; val4.inShockingMinigame = false; val4.inSpecialInteractAnimation = false; val4.freeRotationInInteractAnimation = false; val4.disableSyncInAnimation = false; val4.inAnimationWithEnemy = null; val4.holdingWalkieTalkie = false; val4.speakingToWalkieTalkie = false; val4.isSinking = false; val4.isUnderwater = false; val4.sinkingValue = 0f; val4.statusEffectAudio.Stop(); val4.DisableJetpackControlsLocally(); val4.mapRadarDotAnimator.SetBool("dead", false); val4.hasBegunSpectating = false; val4.externalForceAutoFade = Vector3.zero; val4.hinderedMultiplier = 1f; val4.isMovementHindered = 0; val4.sourcesCausingSinking = 0; val4.reverbPreset = StartOfRound.Instance.shipReverb; SoundManager.Instance.earsRingingTimer = 0f; val4.voiceMuffledByEnemy = false; SoundManager.Instance.playerVoicePitchTargets[Array.IndexOf(StartOfRound.Instance.allPlayerScripts, val4)] = 1f; SoundManager.Instance.SetPlayerPitch(1f, Array.IndexOf(StartOfRound.Instance.allPlayerScripts, val4)); if ((Object)(object)val4.currentVoiceChatIngameSettings == (Object)null) { StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects(); } if ((Object)(object)val4.currentVoiceChatIngameSettings != (Object)null) { if ((Object)(object)val4.currentVoiceChatIngameSettings.voiceAudio == (Object)null) { val4.currentVoiceChatIngameSettings.InitializeComponents(); } if ((Object)(object)val4.currentVoiceChatIngameSettings.voiceAudio == (Object)null) { return; } ((Component)val4.currentVoiceChatIngameSettings.voiceAudio).GetComponent().overridingLowPass = false; } HUDManager.Instance.UpdateBoxesSpectateUI(); HUDManager.Instance.UpdateSpectateBoxSpeakerIcons(); } if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)val4) { val4.bleedingHeavily = false; val4.criticallyInjured = false; val4.health = 5; HUDManager.Instance.UpdateHealthUI(5, true); Animator playerBodyAnimator2 = val4.playerBodyAnimator; if ((Object)(object)playerBodyAnimator2 != (Object)null) { playerBodyAnimator2.SetBool("Limp", false); } val4.spectatedPlayerScript = null; StartOfRound.Instance.SetSpectateCameraToGameOverMode(false, val4); StartOfRound.Instance.SetPlayerObjectExtrapolate(false); ((Behaviour)HUDManager.Instance.audioListenerLowPass).enabled = false; HUDManager.Instance.gasHelmetAnimator.SetBool("gasEmitting", false); HUDManager.Instance.RemoveSpectateUI(); HUDManager.Instance.gameOverAnimator.SetTrigger("revive"); } StartOfRound.Instance.allPlayersDead = false; StartOfRound instance = StartOfRound.Instance; instance.livingPlayers++; StartOfRound.Instance.UpdatePlayerVoiceEffects(); } [Rpc(/*Could not decode attribute arguments.*/)] public void DropHeldItemRpc(ulong clientId, int dropItemSlot, bool itemsFall, bool disconnecting, Vector3 syncedPlayerPosition = default(Vector3), Vector3 syncedHeldObjectPosition = default(Vector3), Vector3 syncedHeldObjectRotation = default(Vector3), Vector3 syncedPlayerCamPosition = default(Vector3), Vector3 syncedPlayerCamRotation = default(Vector3), bool setInShip = false, bool setInElevator = false) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(4022529626u, val3, val, (SendTo)6, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientId); BytePacker.WriteValueBitPacked(val2, dropItemSlot); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref itemsFall, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref disconnecting, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref syncedPlayerPosition); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref syncedHeldObjectPosition); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref syncedHeldObjectRotation); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref syncedPlayerCamPosition); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref syncedPlayerCamRotation); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref setInShip, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref setInElevator, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 4022529626u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB val4 = Plugin.PlayerFromId(clientId); if (!((Object)(object)val4 == (Object)null)) { GrabbableObject val5 = val4.ItemSlots[dropItemSlot]; if (!((Object)(object)val5 == (Object)null)) { val4.DropHeldItem(val5, itemsFall, disconnecting, syncedPlayerPosition, syncedHeldObjectPosition, syncedHeldObjectRotation, syncedPlayerCamPosition, syncedPlayerCamRotation, setInShip, setInElevator); } } } [Rpc(/*Could not decode attribute arguments.*/)] public void DiscardItemInSlotRpc(ulong clientId, int slot, NetworkObjectReference parentObjectTo, bool placeObject = false, Vector3 placePosition = default(Vector3), bool matchRotationOfParent = true, bool setInShip = false, bool setInElevator = false, Vector3 syncedPlayerPosition = default(Vector3), Vector3 syncedHeldObjectPosition = default(Vector3), Vector3 syncedHeldObjectRotation = default(Vector3), Vector3 syncedPlayerCamPosition = default(Vector3), Vector3 syncedPlayerCamRotation = default(Vector3)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_0107: 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_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: 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_01c9: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(400129170u, val3, val, (SendTo)6, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientId); BytePacker.WriteValueBitPacked(val2, slot); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref parentObjectTo, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref placeObject, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref placePosition); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref matchRotationOfParent, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref setInShip, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref setInElevator, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref syncedPlayerPosition); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref syncedHeldObjectPosition); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref syncedHeldObjectRotation); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref syncedPlayerCamPosition); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref syncedPlayerCamRotation); ((NetworkBehaviour)this).__endSendRpc(ref val2, 400129170u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB val4 = Plugin.PlayerFromId(clientId); if (!((Object)(object)val4 == (Object)null)) { val4.DiscardItemInSlot(slot, placeObject, NetworkObjectReference.op_Implicit(parentObjectTo), placePosition, matchRotationOfParent, setInShip, setInElevator, syncedPlayerPosition, syncedHeldObjectPosition, syncedHeldObjectRotation, syncedPlayerCamPosition, syncedPlayerCamRotation); } } } [Rpc(/*Could not decode attribute arguments.*/)] public void DiscardItemInSlotRpc(ulong clientId, int slot, bool placeObject = false, Vector3 placePosition = default(Vector3), bool matchRotationOfParent = true, bool setInShip = false, bool setInElevator = false, Vector3 syncedPlayerPosition = default(Vector3), Vector3 syncedHeldObjectPosition = default(Vector3), Vector3 syncedHeldObjectRotation = default(Vector3), Vector3 syncedPlayerCamPosition = default(Vector3), Vector3 syncedPlayerCamRotation = default(Vector3)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0179: 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_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(4241653702u, val3, val, (SendTo)6, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientId); BytePacker.WriteValueBitPacked(val2, slot); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref placeObject, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref placePosition); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref matchRotationOfParent, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref setInShip, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref setInElevator, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref syncedPlayerPosition); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref syncedHeldObjectPosition); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref syncedHeldObjectRotation); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref syncedPlayerCamPosition); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref syncedPlayerCamRotation); ((NetworkBehaviour)this).__endSendRpc(ref val2, 4241653702u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB val4 = Plugin.PlayerFromId(clientId); if (!((Object)(object)val4 == (Object)null)) { val4.DiscardItemInSlot(slot, placeObject, null, placePosition, matchRotationOfParent, setInShip, setInElevator, syncedPlayerPosition, syncedHeldObjectPosition, syncedHeldObjectRotation, syncedPlayerCamPosition, syncedPlayerCamRotation); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Expected O, but got Unknown //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Expected O, but got Unknown //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Expected O, but got Unknown //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Expected O, but got Unknown //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(1805725168u, new RpcReceiveHandler(__rpc_handler_1805725168), "ShakeCameraRpc"); ((NetworkBehaviour)this).__registerRpc(944480672u, new RpcReceiveHandler(__rpc_handler_944480672), "ChangePlayerSizeRpc"); ((NetworkBehaviour)this).__registerRpc(3841467943u, new RpcReceiveHandler(__rpc_handler_3841467943), "MufflePlayerRpc"); ((NetworkBehaviour)this).__registerRpc(544173340u, new RpcReceiveHandler(__rpc_handler_544173340), "KillPlayerRpc"); ((NetworkBehaviour)this).__registerRpc(3930017063u, new RpcReceiveHandler(__rpc_handler_3930017063), "SetScrapValueRpc"); ((NetworkBehaviour)this).__registerRpc(1349571230u, new RpcReceiveHandler(__rpc_handler_1349571230), "SpawnEnemyRpc"); ((NetworkBehaviour)this).__registerRpc(1523590376u, new RpcReceiveHandler(__rpc_handler_1523590376), "SpawnItemRpc"); ((NetworkBehaviour)this).__registerRpc(4047400807u, new RpcReceiveHandler(__rpc_handler_4047400807), "SpawnMapObjectRpc"); ((NetworkBehaviour)this).__registerRpc(4254446207u, new RpcReceiveHandler(__rpc_handler_4254446207), "SpawnExplosionRpc"); ((NetworkBehaviour)this).__registerRpc(1872345569u, new RpcReceiveHandler(__rpc_handler_1872345569), "SetEarsRingingRpc"); ((NetworkBehaviour)this).__registerRpc(2432440999u, new RpcReceiveHandler(__rpc_handler_2432440999), "DisplayStatusEffectRpc"); ((NetworkBehaviour)this).__registerRpc(3796664176u, new RpcReceiveHandler(__rpc_handler_3796664176), "SetShipLeaveEarlyServerRpc"); ((NetworkBehaviour)this).__registerRpc(1546914772u, new RpcReceiveHandler(__rpc_handler_1546914772), "DisplayAdRpc"); ((NetworkBehaviour)this).__registerRpc(888768384u, new RpcReceiveHandler(__rpc_handler_888768384), "RevivePlayerRpc"); ((NetworkBehaviour)this).__registerRpc(4022529626u, new RpcReceiveHandler(__rpc_handler_4022529626), "DropHeldItemRpc"); ((NetworkBehaviour)this).__registerRpc(400129170u, new RpcReceiveHandler(__rpc_handler_400129170), "DiscardItemInSlotRpc"); ((NetworkBehaviour)this).__registerRpc(4241653702u, new RpcReceiveHandler(__rpc_handler_4241653702), "DiscardItemInSlotRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_1805725168(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_004e: 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_005d: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ScreenShakeType screenShakeType = default(ScreenShakeType); ((FastBufferReader)(ref reader)).ReadValueSafe(ref screenShakeType, default(ForEnums)); RpcParams ext = rpcParams.Ext; target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandler)(object)target).ShakeCameraRpc(screenShakeType, ext); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_944480672(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong clientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); float size = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref size, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandler)(object)target).ChangePlayerSizeRpc(clientId, size); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3841467943(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong clientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); bool value = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref value, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandler)(object)target).MufflePlayerRpc(clientId, value); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_544173340(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong clientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandler)(object)target).KillPlayerRpc(clientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3930017063(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference netRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref netRef, default(ForNetworkSerializable)); int value = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref value); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandler)(object)target).SetScrapValueRpc(netRef, value); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1349571230(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); NamespacedKey key = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe>(ref key, default(ForNetworkSerializable)); } Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); Quaternion rotation = default(Quaternion); ((FastBufferReader)(ref reader)).ReadValueSafe(ref rotation); bool destroyWithScene = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref destroyWithScene, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandler)(object)target).SpawnEnemyRpc(key, position, rotation, destroyWithScene); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1523590376(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); NamespacedKey key = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe>(ref key, default(ForNetworkSerializable)); } Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); Quaternion rotation = default(Quaternion); ((FastBufferReader)(ref reader)).ReadValueSafe(ref rotation); float fallTime = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref fallTime, default(ForPrimitives)); bool destroyWithScene = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref destroyWithScene, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandler)(object)target).SpawnItemRpc(key, position, rotation, fallTime, destroyWithScene); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4047400807(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); NamespacedKey key = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe>(ref key, default(ForNetworkSerializable)); } Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); Quaternion rotation = default(Quaternion); ((FastBufferReader)(ref reader)).ReadValueSafe(ref rotation); bool destroyWithScene = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref destroyWithScene, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandler)(object)target).SpawnMapObjectRpc(key, position, rotation, destroyWithScene); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4254446207(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 explosionPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref explosionPosition); bool spawnExplosionEffect = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref spawnExplosionEffect, default(ForPrimitives)); float killRange = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref killRange, default(ForPrimitives)); float damageRange = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref damageRange, default(ForPrimitives)); int nonLethalDamage = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref nonLethalDamage); float physicsForce = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref physicsForce, default(ForPrimitives)); bool goThroughCar = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref goThroughCar, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandler)(object)target).SpawnExplosionRpc(explosionPosition, spawnExplosionEffect, killRange, damageRange, nonLethalDamage, physicsForce, goThroughCar); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1872345569(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_004e: 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_006c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float time = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref time, default(ForPrimitives)); RpcParams ext = rpcParams.Ext; target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandler)(object)target).SetEarsRingingRpc(time, ext); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2432440999(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_006b: 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_0089: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string statusEffectString = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref statusEffectString, false); } RpcParams ext = rpcParams.Ext; target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandler)(object)target).DisplayStatusEffectRpc(statusEffectString, ext); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3796664176(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float timeToLeaveEarly = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref timeToLeaveEarly, default(ForPrimitives)); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string message = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref message, false); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag2, default(ForPrimitives)); string speakerText = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref speakerText, false); } float waitTime = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref waitTime, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandler)(object)target).SetShipLeaveEarlyServerRpc(timeToLeaveEarly, message, speakerText, waitTime); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1546914772(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandler)(object)target).DisplayAdRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_888768384(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong clientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandler)(object)target).RevivePlayerRpc(clientId, position); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4022529626(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0049: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong clientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); int dropItemSlot = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref dropItemSlot); bool itemsFall = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref itemsFall, default(ForPrimitives)); bool disconnecting = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref disconnecting, default(ForPrimitives)); Vector3 syncedPlayerPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref syncedPlayerPosition); Vector3 syncedHeldObjectPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref syncedHeldObjectPosition); Vector3 syncedHeldObjectRotation = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref syncedHeldObjectRotation); Vector3 syncedPlayerCamPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref syncedPlayerCamPosition); Vector3 syncedPlayerCamRotation = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref syncedPlayerCamRotation); bool setInShip = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref setInShip, default(ForPrimitives)); bool setInElevator = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref setInElevator, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandler)(object)target).DropHeldItemRpc(clientId, dropItemSlot, itemsFall, disconnecting, syncedPlayerPosition, syncedHeldObjectPosition, syncedHeldObjectRotation, syncedPlayerCamPosition, syncedPlayerCamRotation, setInShip, setInElevator); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_400129170(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0049: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014b: 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_0153: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong clientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); int slot = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref slot); NetworkObjectReference parentObjectTo = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref parentObjectTo, default(ForNetworkSerializable)); bool placeObject = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref placeObject, default(ForPrimitives)); Vector3 placePosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref placePosition); bool matchRotationOfParent = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref matchRotationOfParent, default(ForPrimitives)); bool setInShip = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref setInShip, default(ForPrimitives)); bool setInElevator = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref setInElevator, default(ForPrimitives)); Vector3 syncedPlayerPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref syncedPlayerPosition); Vector3 syncedHeldObjectPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref syncedHeldObjectPosition); Vector3 syncedHeldObjectRotation = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref syncedHeldObjectRotation); Vector3 syncedPlayerCamPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref syncedPlayerCamPosition); Vector3 syncedPlayerCamRotation = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref syncedPlayerCamRotation); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandler)(object)target).DiscardItemInSlotRpc(clientId, slot, parentObjectTo, placeObject, placePosition, matchRotationOfParent, setInShip, setInElevator, syncedPlayerPosition, syncedHeldObjectPosition, syncedHeldObjectRotation, syncedPlayerCamPosition, syncedPlayerCamRotation); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4241653702(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0049: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0134: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong clientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); int slot = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref slot); bool placeObject = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref placeObject, default(ForPrimitives)); Vector3 placePosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref placePosition); bool matchRotationOfParent = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref matchRotationOfParent, default(ForPrimitives)); bool setInShip = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref setInShip, default(ForPrimitives)); bool setInElevator = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref setInElevator, default(ForPrimitives)); Vector3 syncedPlayerPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref syncedPlayerPosition); Vector3 syncedHeldObjectPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref syncedHeldObjectPosition); Vector3 syncedHeldObjectRotation = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref syncedHeldObjectRotation); Vector3 syncedPlayerCamPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref syncedPlayerCamPosition); Vector3 syncedPlayerCamRotation = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref syncedPlayerCamRotation); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandler)(object)target).DiscardItemInSlotRpc(clientId, slot, placeObject, placePosition, matchRotationOfParent, setInShip, setInElevator, syncedPlayerPosition, syncedHeldObjectPosition, syncedHeldObjectRotation, syncedPlayerCamPosition, syncedPlayerCamRotation); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "NetworkHandler"; } } [HarmonyPatch] public static class NetworkHandlerPatches { public static GameObject? networkPrefab; [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "Start")] public static void GameNetworkManager_Start_Postfix() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown if (!((Object)(object)networkPrefab != (Object)null)) { if ((Object)(object)Plugin.ModAssets == (Object)null) { Plugin.logger.LogError((object)"Couldnt get ModAssets to create network handler"); return; } networkPrefab = (GameObject)Plugin.ModAssets.LoadAsset("Assets/ModAssets/NetworkHandler.prefab"); NetworkManager.Singleton.AddNetworkPrefab(networkPrefab); } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Awake")] private static void StartOfRound_Awake_Postfix() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (Plugin.IsServerOrHost) { GameObject val = Object.Instantiate(networkPrefab, Vector3.zero, Quaternion.identity); val.GetComponent().Spawn(false); } } } [BepInPlugin("Snowlance.SnowyLib", "SnowyLib", "1.11.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] internal class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("Snowlance.SnowyLib"); public static AssetBundle ModAssets; public static ConfigEntry cfgTesting; public static Plugin Instance { get; private set; } public static ManualLogSource logger { get; private set; } public static PlayerControllerB localPlayer => StartOfRound.Instance.localPlayerController; public static bool IsServerOrHost => NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost; public static PlayerControllerB? PlayerFromId(ulong id) { return StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB x) => x.actualClientId == id).FirstOrDefault(); } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } cfgTesting = ((BaseUnityPlugin)this).Config.Bind("Debugging", "Testing", false, "For debugging purposes"); logger = ((BaseUnityPlugin)Instance).Logger; harmony.PatchAll(); ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "snowylib_assets")); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Snowlance.SnowyLib v1.11.0 has loaded!"); } } [CreateAssetMenu(fileName = "AudioLibrary", menuName = "SnowyLib/AudioLibrary", order = 0)] public class AudioLibrary : ScriptableObject { public AudioClipGroup[] Groups = Array.Empty(); public AudioClip[] Clips = Array.Empty(); public AudioClip? GetClip(string clipName) { return Clips.Where((AudioClip x) => ((Object)x).name.ToLower() == clipName.ToLower()).FirstOrDefault(); } public AudioClip[]? GetClips(string groupId) { return Groups.Where((AudioClipGroup x) => x.Id.ToLower() == groupId.ToLower()).FirstOrDefault()?.Clips; } } [Serializable] public class AudioClipGroup { public string Id = ""; public AudioClip[] Clips = Array.Empty(); } public class StatusEffectController : MonoBehaviour { public enum ConflictResult { Allow, Replace, Deny } public List effects { get; private set; } = new List(); public PlayerControllerB? player => ((Component)this).gameObject.GetComponent(); public EnemyAI? enemy => ((Component)this).gameObject.GetComponent(); private void OnDestroy() { foreach (StatusEffect effect in effects) { effect.OnRemove(); } } private void Update() { foreach (StatusEffect item in effects.ToList()) { item.Tick(); if (item.timeExpired || ((Object)(object)player != (Object)null && player.isPlayerDead && item.removeOnDeath) || ((Object)(object)enemy != (Object)null && enemy.isEnemyDead && item.removeOnDeath)) { item.OnRemove(); effects.Remove(item); } } } public void ApplyEffect(StatusEffect newEffect) { StatusEffect statusEffect = ((!string.IsNullOrEmpty(newEffect.id)) ? effects.FirstOrDefault((StatusEffect e) => e.id == newEffect.id) : null); if (statusEffect != null) { switch (newEffect.onConflict(statusEffect, newEffect)) { default: return; case ConflictResult.Replace: statusEffect.OnRemove(); effects.Remove(statusEffect); break; case ConflictResult.Deny: return; case ConflictResult.Allow: break; } } newEffect.controller = this; newEffect.OnApply(); effects.Add(newEffect); } public void RemoveEffect() where T : StatusEffect { effects.RemoveAll(delegate(StatusEffect e) { if (e is T val) { val.OnRemove(); return true; } return false; }); } public void RemoveEffect(StatusEffect effect) { effect.OnRemove(); effects.Remove(effect); } public void RemoveEffect(Func predicate) { effects.RemoveAll(delegate(StatusEffect e) { if (predicate(e)) { e.OnRemove(); return true; } return false; }); } public bool HasEffect() where T : StatusEffect { return effects.Any((StatusEffect e) => e is T); } public void ClearAll() { foreach (StatusEffect effect in effects) { effect.OnRemove(); } effects.Clear(); } } public abstract class StatusEffect { public StatusEffectController? controller; public string source; public string id; public float duration; public Func onConflict; public Action? onRemove; public bool removeOnDeath; public bool pauseInOrbit; public bool curable; protected float elapsedTime; public bool timeExpired => duration > 0f && elapsedTime >= duration; public float timeLeft => (duration > 0f) ? (duration - elapsedTime) : float.PositiveInfinity; protected StatusEffect(string source, string id, float duration, Func? onConflict = null, Action? onRemove = null, bool removeOnDeath = true, bool pauseInOrbit = true, bool curable = true) { this.source = source; this.id = id; this.duration = duration; this.onConflict = onConflict ?? ((Func)((StatusEffect existing, StatusEffect incoming) => StatusEffectController.ConflictResult.Deny)); this.onRemove = onRemove; this.removeOnDeath = removeOnDeath; this.pauseInOrbit = pauseInOrbit; this.curable = curable; base..ctor(); } public void Tick() { OnTick(); if (duration > 0f && (!pauseInOrbit || !StartOfRound.Instance.inShipPhase || Utils.inTestRoom)) { elapsedTime += Time.deltaTime; } } public virtual void OnApply() { } public virtual void OnTick() { } public void Remove() { controller?.RemoveEffect(this); } public virtual void OnRemove() { onRemove?.Invoke(this); } } public class RandomIntervalActionEffect : StatusEffect { private BoundedRange randomInterval; private Action action; private float timeSinceLastInterval; private float nextInterval; public RandomIntervalActionEffect(BoundedRange randomInterval, Action action, string source, string id = "", float duration = 0f, Func? onConflict = null, Action? onRemove = null, bool removeOnDeath = true, bool pauseInOrbit = true, bool curable = true) { this.randomInterval = randomInterval; this.action = action; base..ctor(source, id, duration, onConflict, onRemove, removeOnDeath, pauseInOrbit, curable); } public override void OnApply() { nextInterval = randomInterval.GetRandomInRange(Utils.randomLocal); } public override void OnTick() { timeSinceLastInterval += Time.deltaTime; if (timeSinceLastInterval > nextInterval) { timeSinceLastInterval = 0f; nextInterval = randomInterval.GetRandomInRange(Utils.randomLocal); action(); } } } public class IntervalActionEffect : StatusEffect { private float interval; private Action action; private float timeSinceLastInterval; public IntervalActionEffect(float interval, Action action, string source, string id = "", float duration = 0f, Func? onConflict = null, Action? onRemove = null, bool removeOnDeath = true, bool pauseInOrbit = true, bool curable = true) { this.interval = interval; this.action = action; base..ctor(source, id, duration, onConflict, onRemove, removeOnDeath, pauseInOrbit, curable); } public override void OnTick() { timeSinceLastInterval += Time.deltaTime; if (timeSinceLastInterval > interval) { timeSinceLastInterval = 0f; action(); } } } public class OnRemoveActionEffect : StatusEffect { private Action action; public OnRemoveActionEffect(Action action, string source, string id = "", float duration = 0f, Func? onConflict = null, bool removeOnDeath = true, bool pauseInOrbit = true, bool curable = true) { this.action = action; base..ctor(source, id, duration, onConflict, null, removeOnDeath, pauseInOrbit, curable); } public override void OnRemove() { action(this); } } public class TickActionEffect : StatusEffect { private Action action; public TickActionEffect(Action action, string source, string id = "", float duration = 0f, Func? onConflict = null, Action? onRemove = null, bool removeOnDeath = true, bool pauseInOrbit = true, bool curable = true) { this.action = action; base..ctor(source, id, duration, onConflict, onRemove, removeOnDeath, pauseInOrbit, curable); } public override void OnTick() { action(); } } public class ChanceTickActionEffect : StatusEffect { private float chance; private Action action; public ChanceTickActionEffect(float chancePerSecond, Action action, string source, string id = "", float duration = 0f, Func? onConflict = null, Action? onRemove = null, bool removeOnDeath = true, bool pauseInOrbit = true, bool curable = true) { chance = chancePerSecond; this.action = action; base..ctor(source, id, duration, onConflict, onRemove, removeOnDeath, pauseInOrbit, curable); } public override void OnTick() { if (RandomExtensions.NextFloat(Utils.randomLocal, 0f, 1f) < Mathf.Clamp01(chance) * Time.deltaTime) { action(); } } } public class ConditionalActionEffect : StatusEffect { private Func condition; private Action action; private bool removeOnTrigger; private float cooldown; private int maxTriggerCount; private float timeSinceLastTrigger; private int triggerCount; public ConditionalActionEffect(Func condition, Action action, bool removeOnTrigger, string source, float cooldown = 0f, int maxTriggerCount = 0, string id = "", float duration = 0f, Func? onConflict = null, Action? onRemove = null, bool removeOnDeath = true, bool pauseInOrbit = true, bool curable = true) { this.condition = condition; this.action = action; this.removeOnTrigger = removeOnTrigger; this.cooldown = cooldown; this.maxTriggerCount = maxTriggerCount; base..ctor(source, id, duration, onConflict, onRemove, removeOnDeath, pauseInOrbit, curable); } public override void OnTick() { timeSinceLastTrigger += Time.deltaTime; if (condition() && timeSinceLastTrigger > cooldown) { timeSinceLastTrigger = 0f; triggerCount++; action(); if (removeOnTrigger || (maxTriggerCount > 0 && triggerCount >= maxTriggerCount)) { Remove(); } } } } public class LerpValueEffect : StatusEffect { private Action setter; private float startValue; private float endValue; public LerpValueEffect(Action setter, float startValue, float endValue, float duration, string source, string id = "", Func? onConflict = null, Action? onRemove = null, bool removeOnDeath = true, bool pauseInOrbit = true, bool curable = true) { this.setter = setter; this.startValue = startValue; this.endValue = endValue; base..ctor(source, id, duration, onConflict, onRemove, removeOnDeath, pauseInOrbit, curable); } public override void OnApply() { setter(startValue); } public override void OnTick() { elapsedTime += Time.deltaTime; float num = Mathf.Clamp01(elapsedTime / duration); float obj = Mathf.Lerp(startValue, endValue, num); setter(obj); } public override void OnRemove() { setter(endValue); base.OnRemove(); } } public class RandomIntervalPhaseActionEffect : StatusEffect { private BoundedRange randomInterval; private BoundedRange randomPhaseDuration; private Action onStartAction; private Action tickAction; private Action onEndAction; private float timeSinceLastInterval; private float nextInterval; private float phaseTimer; public RandomIntervalPhaseActionEffect(BoundedRange randomInterval, BoundedRange randomPhaseDuration, Action onStartAction, Action tickAction, Action onEndAction, string source, string id = "", float duration = 0f, Func? onConflict = null, Action? onRemove = null, bool removeOnDeath = true, bool pauseInOrbit = true, bool curable = true) { this.randomInterval = randomInterval; this.randomPhaseDuration = randomPhaseDuration; this.onStartAction = onStartAction; this.tickAction = tickAction; this.onEndAction = onEndAction; base..ctor(source, id, duration, onConflict, onRemove, removeOnDeath, pauseInOrbit, curable); } public override void OnApply() { nextInterval = randomInterval.GetRandomInRange(Utils.randomLocal); } public override void OnTick() { if (phaseTimer <= 0f) { timeSinceLastInterval += Time.deltaTime; } if (timeSinceLastInterval > nextInterval) { timeSinceLastInterval = 0f; nextInterval = randomInterval.GetRandomInRange(Utils.randomLocal); phaseTimer = randomPhaseDuration.GetRandomInRange(Utils.randomLocal); onStartAction(phaseTimer); } if (phaseTimer > 0f) { phaseTimer -= Time.deltaTime; if (phaseTimer <= 0f) { onEndAction(); } else { tickAction(phaseTimer); } } } } public class CurveValueEffect : StatusEffect { private Action setter; private AnimationCurve curve; public CurveValueEffect(Action setter, AnimationCurve curve, float duration, string source, string id = "", Func? onConflict = null, Action? onRemove = null, bool removeOnDeath = true, bool pauseInOrbit = true, bool curable = true) { this.setter = setter; this.curve = curve; base..ctor(source, id, duration, onConflict, onRemove, removeOnDeath, pauseInOrbit, curable); } public override void OnApply() { setter(curve.Evaluate(0f)); } public override void OnTick() { if (!(duration <= 0f)) { elapsedTime += Time.deltaTime; float num = Mathf.Clamp01(elapsedTime / duration); float obj = curve.Evaluate(num); setter(obj); } } public override void OnRemove() { setter(curve.Evaluate(1f)); base.OnRemove(); } } public class DistributedActionEffect : StatusEffect { private int totalActions; private Action action; private List triggerTimes; private int currentIndex; public DistributedActionEffect(Action action, int totalActions, string source, string id = "", float duration = 0f, Func? onConflict = null, Action? onRemove = null, bool removeOnDeath = true, bool pauseInOrbit = true, bool curable = true) { this.totalActions = totalActions; this.action = action; triggerTimes = new List(); base..ctor(source, id, duration, onConflict, onRemove, removeOnDeath, pauseInOrbit, curable); } public override void OnApply() { triggerTimes.Clear(); float num = duration / (float)totalActions; for (int i = 0; i < totalActions; i++) { float num2 = (float)i * num; float num3 = num2 + num; float item = RandomExtensions.NextFloat(Utils.randomLocal, num2, num3); triggerTimes.Add(item); } triggerTimes.Sort(); currentIndex = 0; } public override void OnTick() { while (currentIndex < triggerTimes.Count && elapsedTime >= triggerTimes[currentIndex]) { action(); currentIndex++; } } } internal class TestingHUDOverlay : MonoBehaviour { private static TestingHUDOverlay? _instance; [SerializeField] private Transform canvasTransform = null; [SerializeField] private GameObject textElementPrefab = null; private static Dictionary entries = new Dictionary(); private static TestingHUDOverlay Instance { get { if ((Object)(object)_instance == (Object)null) { _instance = Init(); } return _instance; } } private static TestingHUDOverlay Init() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown Plugin.logger.LogDebug((object)"Initiating TestingHUDOverlay"); GameObject val = (GameObject)Plugin.ModAssets.LoadAsset("Assets/ModAssets/TestingHUDOverlay.prefab"); return Object.Instantiate(val, ((Component)Plugin.localPlayer).transform).GetComponent(); } private void Update() { foreach (KeyValuePair item in entries.ToList()) { if (Time.unscaledTime >= item.Value.ExpireTime) { Object.Destroy((Object)(object)((Component)item.Value.Text).gameObject); entries.Remove(item.Key); } } } public static void SetValue(string key, string value, float expireTime = 5f) { _ = Instance; if (!entries.TryGetValue(key, out TestingHUDEntry value2)) { value2 = CreateEntry(); entries.Add(key, value2); } value2.Text.text = key + ": " + value; value2.ExpireTime = Time.unscaledTime + expireTime; } private static TestingHUDEntry CreateEntry() { TestingHUDEntry testingHUDEntry = new TestingHUDEntry(); testingHUDEntry.Text = Object.Instantiate(Instance.textElementPrefab, Instance.canvasTransform).GetComponent(); return testingHUDEntry; } } internal class TestingHUDEntry { public TMP_Text Text = null; public float ExpireTime; } public static class Utils { public enum ContentType { Item, Enemy, MapObject } public static bool DEBUG_disableSpawning = false; public static bool DEBUG_disableTime = false; public static bool localPlayerFrozen = false; public static BoundedRange randomPercentage = new BoundedRange(0f, 1f); public const ulong RodrigoSteamID = 76561198164429786uL; public const ulong LizzieSteamID = 76561199094139351uL; public const ulong GlitchSteamID = 76561198984467725uL; public const ulong RatSteamID = 76561199182474292uL; public const ulong XuSteamID = 76561198399127090uL; public const ulong SlayerSteamID = 76561198077184650uL; public const ulong SnowySteamID = 76561198253760639uL; public const ulong FunoSteamID = 76561198993437314uL; public static bool testing => Plugin.cfgTesting.Value; public static bool inTestRoom => (Object)(object)StartOfRound.Instance?.testRoom != (Object)null; public static GameObject[] allAINodes => insideAINodes.Concat(outsideAINodes).ToArray(); public static GameObject[] insideAINodes { get { if (RoundManager.Instance.insideAINodes != null && RoundManager.Instance.insideAINodes.Length != 0) { return RoundManager.Instance.insideAINodes; } return GameObject.FindGameObjectsWithTag("AINode"); } } public static GameObject[] outsideAINodes { get { if (RoundManager.Instance.outsideAINodes != null && RoundManager.Instance.outsideAINodes.Length != 0) { return RoundManager.Instance.outsideAINodes; } return GameObject.FindGameObjectsWithTag("OutsideAINode"); } } public static List spawnedItems { get; internal set; } = new List(); public static List entrances { get; internal set; } = new List(); public static MineshaftElevatorController? elevator { get; internal set; } public static Terminal? terminal { get; internal set; } public static Random randomLocal { get; internal set; } = new Random(); public static Random randomGlobal { get; internal set; } = new Random(); public static UnityEvent OnFinishGeneratingLevel { get; internal set; } = new UnityEvent(); public static UnityEvent OnShipLanded { get; internal set; } = new UnityEvent(); internal static void SetRandoms() { randomLocal = new Random(StartOfRound.Instance.randomMapSeed); randomGlobal = new Random(StartOfRound.Instance.randomMapSeed); } internal static void ChatCommand(string[] args) { if (!testing) { return; } switch (args[0]) { case "/spawning": DEBUG_disableSpawning = !DEBUG_disableSpawning; HUDManager.Instance.DisplayTip("Disable Spawning", DEBUG_disableSpawning.ToString(), false, false, "LC_Tip1"); break; case "/time": DEBUG_disableTime = !DEBUG_disableTime; StartOfRound.Instance.currentLevel.planetHasTime = !DEBUG_disableTime; HUDManager.Instance.DisplayTip("Snowylib", "disableTime: " + DEBUG_disableTime, false, false, "LC_Tip1"); break; case "/log": if (args.Length == 1) { Plugin.logger.LogDebug((object)"- rarities"); Plugin.logger.LogDebug((object)"- archetypes"); Plugin.logger.LogDebug((object)"- dungeons"); Plugin.logger.LogDebug((object)"- enemies"); Plugin.logger.LogDebug((object)"- items"); Plugin.logger.LogDebug((object)"- mapobjects"); Plugin.logger.LogDebug((object)"- moons"); Plugin.logger.LogDebug((object)"- storylogs"); Plugin.logger.LogDebug((object)"- surfaces"); Plugin.logger.LogDebug((object)"- terminalcommands"); Plugin.logger.LogDebug((object)"- tilesets"); Plugin.logger.LogDebug((object)"- unlockables"); Plugin.logger.LogDebug((object)"- weathers"); Plugin.logger.LogDebug((object)"- animations"); Plugin.logger.LogDebug((object)"- canvas"); break; } switch (args[1]) { case "rarities": if (args.Length != 2) { switch (args[2]) { case "item": LogRarities(ContentType.Item); break; case "enemy": LogRarities(ContentType.Enemy); break; case "mapobject": LogRarities(ContentType.MapObject); break; } } break; case "archetypes": { foreach (DawnArchetypeInfo value in LethalContent.Archetypes.Values) { Plugin.logger.LogDebug((object)((object)((DawnBaseInfo)(object)value).TypedKey).ToString()); } break; } case "dungeons": { foreach (DawnDungeonInfo value2 in ((Registry)(object)LethalContent.Dungeons).Values) { Plugin.logger.LogDebug((object)((object)((DawnBaseInfo)(object)value2).TypedKey).ToString()); } break; } case "enemies": { foreach (DawnEnemyInfo value3 in ((Registry)(object)LethalContent.Enemies).Values) { Plugin.logger.LogDebug((object)((object)((DawnBaseInfo)(object)value3).TypedKey).ToString()); } break; } case "items": { foreach (DawnItemInfo value4 in ((Registry)(object)LethalContent.Items).Values) { Plugin.logger.LogDebug((object)((object)((DawnBaseInfo)(object)value4).TypedKey).ToString()); } break; } case "mapobjects": { foreach (DawnMapObjectInfo value5 in ((Registry)(object)LethalContent.MapObjects).Values) { Plugin.logger.LogDebug((object)((object)((DawnBaseInfo)(object)value5).TypedKey).ToString()); } break; } case "moons": { foreach (DawnMoonInfo value6 in ((Registry)(object)LethalContent.Moons).Values) { Plugin.logger.LogDebug((object)((object)((DawnBaseInfo)(object)value6).TypedKey).ToString()); } break; } case "storylogs": { foreach (DawnStoryLogInfo value7 in LethalContent.StoryLogs.Values) { Plugin.logger.LogDebug((object)((object)((DawnBaseInfo)(object)value7).TypedKey).ToString()); } break; } case "surfaces": { foreach (DawnSurfaceInfo value8 in LethalContent.Surfaces.Values) { Plugin.logger.LogDebug((object)((object)((DawnBaseInfo)(object)value8).TypedKey).ToString()); } break; } case "terminalcommands": { foreach (DawnTerminalCommandInfo value9 in LethalContent.TerminalCommands.Values) { Plugin.logger.LogDebug((object)((object)((DawnBaseInfo)(object)value9).TypedKey).ToString()); } break; } case "tilesets": { foreach (DawnTileSetInfo value10 in LethalContent.TileSets.Values) { Plugin.logger.LogDebug((object)((object)((DawnBaseInfo)(object)value10).TypedKey).ToString()); } break; } case "unlockables": { foreach (DawnUnlockableItemInfo value11 in ((Registry)(object)LethalContent.Unlockables).Values) { Plugin.logger.LogDebug((object)((object)((DawnBaseInfo)(object)value11).TypedKey).ToString()); } break; } case "weathers": { foreach (DawnWeatherEffectInfo value12 in ((Registry)(object)LethalContent.Weathers).Values) { Plugin.logger.LogDebug((object)((object)((DawnBaseInfo)(object)value12).TypedKey).ToString()); } break; } case "animations": LogAnimatorParameters(Plugin.localPlayer.playerBodyAnimator); break; case "canvas": { Canvas[] array = Object.FindObjectsOfType(); foreach (Canvas val in array) { Plugin.logger.LogDebug((object)string.Format("{0}{1} | Sorting Order: {2} | Render Order: {3}", ((Object)(object)((Component)val).transform.parent != (Object)null) ? (((Object)((Component)val).transform.parent).name + "/") : "", ((Object)val).name, val.sortingOrder, val.renderOrder)); } break; } } break; case "/refresh": RoundManager.Instance.RefreshEnemiesList(); HoarderBugAI.RefreshGrabbableObjectsInMapList(); break; case "/dungeon": { DawnDungeonInfo dawnInfo = DungeonFlowExtensions.GetDawnInfo(RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow); Plugin.logger.LogDebug((object)(((object)((DawnBaseInfo)(object)dawnInfo).TypedKey).ToString() + " | " + ((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name)); break; } case "/vignette": { float result5; if (args.Length > 2) { if (float.TryParse(args[1], out var result3) && float.TryParse(args[2], out var result4)) { VignetteOverlay.SetIntensity(result3, result4); HUDManager.Instance.DisplayTip("SnowyLib", $"Vignette intensity set to {result3} and insanity decrease per second is set to {result4}", false, false, "LC_Tip1"); } } else if (float.TryParse(args[1], out result5)) { VignetteOverlay.SetIntensity(result5); HUDManager.Instance.DisplayTip("SnowyLib", $"Vignette intensity set to {result5}", false, false, "LC_Tip1"); } break; } case "/spawnanim": Plugin.localPlayer.SpawnPlayerAnimation(); break; case "/playanim": { if (args.Length > 3 && float.TryParse(args[3], out var result2)) { PlayPlayerAnimation(args[1], args[2], result2); } else if (args.Length > 2) { PlayPlayerAnimation(args[1], args[2], 3f); } else if (args.Length > 1) { PlayPlayerAnimation(args[1]); } break; } case "/drunkness": { if (args.Length != 1 && float.TryParse(args[1], out var result)) { Plugin.localPlayer.drunkness = result; } break; } } } public static bool SmartCanPathToPoint(Vector3 startPos, Vector3 endPos, bool isOutside) { //IL_0006: 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_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_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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: 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_020f: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: 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_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0138: 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_016c: Unknown result type (might be due to invalid IL or missing references) //IL_016d: 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_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) bool flag = !isOutside; if (CanPathToPoint(startPos, endPos)) { return true; } if (entrances.Count <= 0 && (Object)(object)elevator == (Object)null) { return false; } Vector3 val = Vector3.zero; Vector3 val2 = Vector3.zero; Vector3 val3 = Vector3.zero; if ((Object)(object)elevator != (Object)null) { val = elevator.elevatorTopPoint.position; val2 = elevator.elevatorBottomPoint.position; val3 = elevator.elevatorInsidePoint.position; } if (entrances != null) { foreach (EntranceTeleport entrance in entrances) { if ((flag ? (!entrance.isEntranceToBuilding) : entrance.isEntranceToBuilding) && (!((Object)(object)entrance.exitScript == (Object)null) || entrance.FindExitPoint())) { Vector3 position = entrance.entrancePoint.position; Vector3 position2 = entrance.exitScript.entrancePoint.position; if (CanPathToPoint(startPos, position) && CanPathToPoint(position2, endPos)) { return true; } if ((Object)(object)elevator != (Object)null && CanPathToPoint(startPos, val2) && CanPathToPoint(val, position) && CanPathToPoint(position2, endPos)) { return true; } } } } if ((Object)(object)elevator != (Object)null) { if (flag && Vector3.Distance(startPos, val3) < 1f) { if (CanPathToPoint(val, endPos) || CanPathToPoint(val2, endPos)) { return true; } } else { if (CanPathToPoint(startPos, val2) && CanPathToPoint(val, endPos)) { return true; } if (flag && CanPathToPoint(startPos, val) && CanPathToPoint(val2, endPos)) { return true; } } } return false; } public static bool CanPathToPoint(Vector3 startPos, Vector3 endPos) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 //IL_0050: 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) NavMeshPath val = new NavMeshPath(); if (!NavMesh.CalculatePath(startPos, endPos, -1, val) || (int)val.status > 0) { return false; } float num = 0f; if (val.corners.Length > 1) { for (int i = 1; i < val.corners.Length; i++) { num += Vector3.Distance(val.corners[i - 1], val.corners[i]); } } return num > 0f; } internal static void LogRarities(ContentType contentType) { SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { Plugin.logger.LogDebug((object)("- " + ((Object)val).name + ":")); switch (contentType) { case ContentType.Item: foreach (SpawnableItemWithRarity item in val.spawnableScrap) { Plugin.logger.LogDebug((object)$"-- {item.spawnableItem.itemName}: {item.rarity}"); } break; case ContentType.Enemy: foreach (SpawnableEnemyWithRarity enemy in val.Enemies) { Plugin.logger.LogDebug((object)$"-- {((Object)enemy.enemyType).name}: {enemy.rarity}"); } break; case ContentType.MapObject: { SpawnableMapObject[] spawnableMapObjects = val.spawnableMapObjects; foreach (SpawnableMapObject val2 in spawnableMapObjects) { Plugin.logger.LogDebug((object)("-- " + ((Object)val2.prefabToSpawn).name + ":")); Debug.Log((object)string.Join("\n", val2.numberToSpawn.keys.Select((Keyframe k) => $"--- ({((Keyframe)(ref k)).time}, {((Keyframe)(ref k)).value})"))); } break; } } } } public static void PlayPlayerAnimation(string animName, string animValue = "", float time = 1f) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_004c: 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_0065: Expected I4, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Invalid comparison between Unknown and I4 AnimatorControllerParameter val = Plugin.localPlayer.playerBodyAnimator.parameters.Where((AnimatorControllerParameter x) => x.name == animName).FirstOrDefault(); Plugin.localPlayer.PlayQuickSpecialAnimation(time); AnimatorControllerParameterType type = val.type; AnimatorControllerParameterType val2 = type; switch (val2 - 1) { default: if ((int)val2 == 9) { Plugin.localPlayer.playerBodyAnimator.SetTrigger(animName); } break; case 0: { if (float.TryParse(animValue, out var result2)) { Plugin.localPlayer.playerBodyAnimator.SetFloat(animName, result2); } break; } case 2: { if (int.TryParse(animValue, out var result3)) { Plugin.localPlayer.playerBodyAnimator.SetInteger(animName, result3); } break; } case 3: { if (bool.TryParse(animValue, out var result)) { Plugin.localPlayer.playerBodyAnimator.SetBool(animName, result); } break; } case 1: break; } } internal static void LogAnimatorParameters(Animator animator) { //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_001d: 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_0020: 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_0038: Expected I4, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 AnimatorControllerParameter[] parameters = animator.parameters; foreach (AnimatorControllerParameter val in parameters) { AnimatorControllerParameterType type = val.type; AnimatorControllerParameterType val2 = type; switch (val2 - 1) { case 3: Plugin.logger.LogDebug((object)$"{val.name} (Bool) = {animator.GetBool(val.name)}"); continue; case 0: Plugin.logger.LogDebug((object)$"{val.name} (Float) = {animator.GetFloat(val.name)}"); continue; case 2: Plugin.logger.LogDebug((object)$"{val.name} (Int) = {animator.GetInteger(val.name)}"); continue; case 1: continue; } if ((int)val2 == 9) { Plugin.logger.LogDebug((object)(val.name + " (Trigger)")); } } } public static Vector3 GetBestThrowDirection(Vector3 origin, Vector3 forward, int rayCount, float maxDistance, LayerMask layerMask) { //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_0028: 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_0039: 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) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) Vector3 result = forward; float num = 0f; RaycastHit val2 = default(RaycastHit); for (int i = 0; i < rayCount; i++) { float num2 = (float)i * (360f / (float)rayCount); Vector3 val = Quaternion.Euler(0f, num2, 0f) * ((Vector3)(ref forward)).normalized; if (Physics.Raycast(origin + Vector3.up * 0.5f, val, ref val2, maxDistance, LayerMask.op_Implicit(layerMask))) { if (((RaycastHit)(ref val2)).distance > num) { result = val; num = ((RaycastHit)(ref val2)).distance; } continue; } return val; } return result; } public static Vector3 GetRandomNavMeshPositionInAnnulus(Vector3 center, float minRadius, float maxRadius, int sampleCount = 10) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) float y = center.y; if (minRadius >= maxRadius) { Plugin.logger.LogWarning((object)"minRadius should be less than maxRadius. Returning original position."); return center; } NavMeshHit val2 = default(NavMeshHit); for (int i = 0; i < sampleCount; i++) { Vector3 insideUnitSphere = Random.insideUnitSphere; insideUnitSphere.y = 0f; ((Vector3)(ref insideUnitSphere)).Normalize(); float num = Random.Range(minRadius, maxRadius); Vector3 val = center + insideUnitSphere * num; val.y = y; if (NavMesh.SamplePosition(val, ref val2, 2f, -1)) { return ((NavMeshHit)(ref val2)).position; } } Plugin.logger.LogWarning((object)"Unable to find valid NavMesh position in annulus. Returning original position."); return center; } public static List GetEvenlySpacedNavMeshPositions(Vector3 center, int count, float minRadius, float maxRadius) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) List list = new List(); if (count <= 0 || minRadius > maxRadius) { Plugin.logger.LogWarning((object)"Invalid parameters for turret spawn positions."); return list; } float y = center.y; float num = 360f / (float)count; Vector3 val = default(Vector3); NavMeshHit val2 = default(NavMeshHit); for (int i = 0; i < count; i++) { float num2 = (float)i * num; float num3 = num2 * (MathF.PI / 180f); float num4 = Random.Range(minRadius, maxRadius); float num5 = Mathf.Cos(num3) * num4; float num6 = Mathf.Sin(num3) * num4; ((Vector3)(ref val))..ctor(center.x + num5, y, center.z + num6); if (NavMesh.SamplePosition(val, ref val2, 2f, -1)) { list.Add(((NavMeshHit)(ref val2)).position); } else { Plugin.logger.LogWarning((object)$"Could not find valid NavMesh position for turret {i}. Skipping."); } } return list; } public static EnemyAI? SpawnEnemy(NamespacedKey key, Vector3 position, Quaternion rotation = default(Quaternion), Transform? parentTo = null, bool destroyWithScene = true) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.IsServerOrHost) { return null; } GameObject val = Object.Instantiate(((Registry)(object)LethalContent.Enemies)[key].EnemyType.enemyPrefab, position, rotation, parentTo); EnemyAI component = val.GetComponent(); ((NetworkBehaviour)component).NetworkObject.Spawn(destroyWithScene); RoundManager.Instance.SpawnedEnemies.Add(component); return component; } public static GrabbableObject? SpawnItem(NamespacedKey key, Vector3 position, Quaternion rotation = default(Quaternion), Transform? parentTo = null, float fallTime = 0f, bool destroyWithScene = false) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.IsServerOrHost) { return null; } GameObject val = Object.Instantiate(((Registry)(object)LethalContent.Items)[key].Item.spawnPrefab, position, rotation, parentTo); GrabbableObject component = val.GetComponent(); component.fallTime = fallTime; ((NetworkBehaviour)component).NetworkObject.Spawn(destroyWithScene); return component; } public static SpawnableMapObject? SpawnMapObject(NamespacedKey key, Vector3 position, Quaternion rotation = default(Quaternion), Transform? parentTo = null, bool destroyWithScene = true) { //IL_004e: 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) if (!Plugin.IsServerOrHost) { return null; } GameObject mapObjectPrefab = ((Registry)(object)LethalContent.MapObjects)[key].GetMapObjectPrefab(); if ((Object)(object)mapObjectPrefab == (Object)null) { Plugin.logger.LogError((object)$"Couldnt find prefab for {key}"); return null; } GameObject val = Object.Instantiate(mapObjectPrefab, position, rotation, parentTo); SpawnableMapObject component = val.GetComponent(); val.GetComponent().Spawn(destroyWithScene); return component; } public static void PlaySoundAtPosition(Transform pos, AudioClip clip, float volume = 1f, bool randomizePitch = true, bool spatial3D = true, float min3DDistance = 1f, float max3DDistance = 10f, float cutoffFrequency = 22000f, int audibleNoiseID = 0) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate(new GameObject("TempSoundEffectObj"), pos); AudioSource val2 = val.AddComponent(); OccludeAudio val3 = val.AddComponent(); val3.lowPassOverride = 20000f; AudioLowPassFilter val4 = val.AddComponent(); val4.cutoffFrequency = cutoffFrequency; val2.rolloffMode = (AudioRolloffMode)1; if (randomizePitch) { val2.pitch = Random.Range(0.94f, 1.06f); } val2.clip = clip; val2.volume = volume; val2.spatialBlend = (spatial3D ? 1 : 0); val2.minDistance = min3DDistance; val2.maxDistance = max3DDistance; val2.Play(); Object.Destroy((Object)(object)val, val2.clip.length); WalkieTalkie.TransmitOneShotAudio(val2, clip, 0.85f); if (spatial3D && audibleNoiseID >= 0) { RoundManager.Instance.PlayAudibleNoise(((Component)val2).transform.position, 4f * volume, volume / 2f, 0, true, audibleNoiseID); } } public static void PlaySoundAtPosition(Vector3 pos, AudioClip clip, float volume = 1f, bool randomizePitch = true, bool spatial3D = true, float min3DDistance = 1f, float max3DDistance = 10f, float cutoffFrequency = 22000f, int audibleNoiseID = 0) { //IL_0006: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate(new GameObject("TempSoundEffectObj"), pos, Quaternion.identity); AudioSource val2 = val.AddComponent(); OccludeAudio val3 = val.AddComponent(); val3.lowPassOverride = 20000f; AudioLowPassFilter val4 = val.AddComponent(); val4.cutoffFrequency = cutoffFrequency; val2.rolloffMode = (AudioRolloffMode)1; if (randomizePitch) { val2.pitch = Random.Range(0.94f, 1.06f); } val2.clip = clip; val2.volume = volume; val2.spatialBlend = (spatial3D ? 1 : 0); val2.minDistance = min3DDistance; val2.maxDistance = max3DDistance; val2.Play(); Object.Destroy((Object)(object)val, val2.clip.length); WalkieTalkie.TransmitOneShotAudio(val2, clip, 0.85f); if (spatial3D && audibleNoiseID >= 0) { RoundManager.Instance.PlayAudibleNoise(((Component)val2).transform.position, 4f * volume, volume / 2f, 0, true, audibleNoiseID); } } public static void PlaySoundAtPosition(Transform pos, AudioClip[] clips, float volume = 1f, bool randomizePitch = true, bool spatial3D = true, float min3DDistance = 1f, float max3DDistance = 10f, float cutoffFrequency = 22000f, int audibleNoiseID = 0) { int num = Random.Range(0, clips.Length); PlaySoundAtPosition(pos, clips[num], volume, randomizePitch, spatial3D, min3DDistance, max3DDistance, cutoffFrequency, audibleNoiseID); } public static void PlaySoundAtPosition(Vector3 pos, AudioClip[] clips, float volume = 1f, bool randomizePitch = true, bool spatial3D = true, float min3DDistance = 1f, float max3DDistance = 10f, float cutoffFrequency = 22000f, int audibleNoiseID = 0) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) int num = Random.Range(0, clips.Length); PlaySoundAtPosition(pos, clips[num], volume, randomizePitch, spatial3D, min3DDistance, max3DDistance, cutoffFrequency, audibleNoiseID); } public static PlayerControllerB GetRandomPlayer(Random random) { PlayerControllerB[] array = StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB p) => (Object)(object)p != (Object)null && p.isPlayerControlled).ToArray(); return (array.Length == 0) ? StartOfRound.Instance.allPlayerScripts[random.Next(StartOfRound.Instance.allPlayerScripts.Length)] : array[random.Next(array.Length)]; } public static PlayerControllerB GetRandomPlayer() { PlayerControllerB[] array = StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB p) => (Object)(object)p != (Object)null && p.isPlayerControlled).ToArray(); return (array.Length == 0) ? StartOfRound.Instance.allPlayerScripts[Random.Range(0, StartOfRound.Instance.allPlayerScripts.Length)] : array[Random.Range(0, array.Length)]; } public static void LogChat(string msg, string nameOfUserWhoTyped = "Server") { HUDManager.Instance.AddChatMessage(msg, nameOfUserWhoTyped, -1, false); } public static float SmartDistance(Vector3 position1, Vector3 position2, bool fastDistanceCheck = false) { //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_0013: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) if (position1.IsOutside() == position2.IsOutside()) { return Vector3.Distance(position1, position2); } float num = float.PositiveInfinity; EntranceTeleport val = null; foreach (EntranceTeleport entrance in entrances) { if ((Object)(object)entrance == (Object)null || entrance.isEntranceToBuilding != position1.IsOutside() || ((Object)(object)entrance.exitScript == (Object)null && (entrance.exitPointDoesntExist || !entrance.FindExitPoint())) || (Object)(object)entrance.exitScript == (Object)null) { continue; } if (fastDistanceCheck) { Vector3 val2 = position1 - ((Component)entrance).transform.position; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; val2 = ((Component)entrance.exitScript).transform.position - position2; float num2 = sqrMagnitude + ((Vector3)(ref val2)).sqrMagnitude; if (num2 < num) { num = num2; val = entrance; } } else { float num3 = Vector3.Distance(position1, ((Component)entrance).transform.position) + Vector3.Distance(((Component)entrance.exitScript).transform.position, position2); num = Mathf.Min(num, num3); } } if (!fastDistanceCheck) { return num; } if ((Object)(object)val == (Object)null) { return -1f; } return Vector3.Distance(position1, ((Component)val).transform.position) + Vector3.Distance(((Component)val.exitScript).transform.position, position2); } public static LayerMask CreateMask(params string[] layerNames) { //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_0049: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) LayerMask val = LayerMask.op_Implicit(0); foreach (string text in layerNames) { int num = LayerMask.NameToLayer(text); if (num >= 0) { val = LayerMask.op_Implicit(LayerMask.op_Implicit(val) | (1 << num)); } } return val; } public static Collider? GetLargestCollider(Collider[] colliders) { //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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_007f: 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_00c6: Unknown result type (might be due to invalid IL or missing references) if (colliders.Length == 0) { return null; } Collider val = colliders[0]; Bounds bounds = val.bounds; float x = ((Bounds)(ref bounds)).size.x; bounds = val.bounds; float num = x * ((Bounds)(ref bounds)).size.y; bounds = val.bounds; float num2 = num * ((Bounds)(ref bounds)).size.z; foreach (Collider val2 in colliders) { Bounds bounds2 = val2.bounds; float num3 = ((Bounds)(ref bounds2)).size.x * ((Bounds)(ref bounds2)).size.y * ((Bounds)(ref bounds2)).size.z; Plugin.logger.LogDebug((object)$"{((Object)val2).name} | Enabled: {val2.enabled} | Size: {((Bounds)(ref bounds2)).size} | Volume: {num3}"); if (num3 > num2) { num2 = num3; val = val2; } } return val; } public static GameObject Ping(Vector3 position, string headerText = "Ping", string subText = "", int nodeType = 0, bool requiresLineOfSight = false, int minRange = 1, int maxRange = 2000, float destroyTime = 10f) { //IL_0006: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown GameObject val = Object.Instantiate(new GameObject("Ping"), position, Quaternion.identity); val.tag = "DoNotSet"; val.layer = LayerMask.NameToLayer("ScanNode"); val.AddComponent(); ScanNodeProperties val2 = val.AddComponent(); val2.maxRange = maxRange; val2.minRange = minRange; val2.headerText = headerText; val2.subText = subText; val2.nodeType = nodeType; val2.requiresLineOfSight = requiresLineOfSight; if (destroyTime > 0f) { Object.Destroy((Object)(object)val, destroyTime); } HUDManager instance = HUDManager.Instance; if (!instance.nodesOnScreen.Contains(val2)) { instance.nodesOnScreen.Add(val2); } if (instance.scanNodes.ContainsValue(val2)) { return val; } for (int i = 0; i < instance.scanElements.Length && !instance.scanNodes.TryAdd(instance.scanElements[i], val2); i++) { } return val; } public static void SetShipLeaveEarly(float timeToLeaveEarly, DialogueSegment[] shipLeavingEarlyDialogue) { TimeOfDay.Instance.shipLeaveAutomaticallyTime = timeToLeaveEarly; TimeOfDay.Instance.shipLeavingAlertCalled = true; HUDManager.Instance.ReadDialogue(shipLeavingEarlyDialogue); ((Behaviour)HUDManager.Instance.shipLeavingEarlyIcon).enabled = true; } public static void DisplayStatusEffect(string message) { HUDManager.Instance.DisplayStatusEffect(message); } public static void DisplayDialogue(DialogueSegment[] dialogues) { HUDManager.Instance.ReadDialogue(dialogues); } public static void DisplaySignalTranslatorMessage(string message) { HUDManager.Instance.UseSignalTranslatorServerRpc(message); } public static void DisplayAd() { HUDManager.Instance.ChooseAdItem(); } public static void DisplayAd(Item item, string top, string bottom) { if ((Object)(object)item == (Object)null) { Plugin.logger.LogWarning((object)"Display Item Ad: Item is Null"); return; } if ((Object)(object)item.spawnPrefab == (Object)null) { Plugin.logger.LogWarning((object)"Display Item Ad: Item spawn prefab is null"); return; } HUDManager.Instance.CreateToolAdModel(-100, item); DoAdStuff(top, bottom); } public static void DisplayAd(UnlockableItem unlockable, string top, string bottom) { if (unlockable == null) { Plugin.logger.LogWarning((object)"Display Unlockable Ad: Unlockable is Null"); return; } if ((Object)(object)unlockable.prefabObject == (Object)null) { Plugin.logger.LogWarning((object)"Display Unlockable Ad: Unlockable prefabObject is Null"); return; } HUDManager.Instance.CreateFurnitureAdModel(unlockable); DoAdStuff(top, bottom); } private static void DoAdStuff(string top, string bottom) { Plugin.logger.LogDebug((object)("Do Ad Stuff: " + top + " " + bottom)); HUDManager instance = HUDManager.Instance; ((TMP_Text)instance.advertTopText).text = top; ((TMP_Text)instance.advertBottomText).text = bottom; if (instance.displayAdCoroutine != null) { ((MonoBehaviour)instance).StopCoroutine(instance.displayAdCoroutine); } instance.displayAdCoroutine = ((MonoBehaviour)instance).StartCoroutine(instance.displayAd()); } public static Vector3 GetTopOfObjectRender(GameObject obj, bool includeDisabled = false) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_007e: 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) Renderer[] componentsInChildren = obj.GetComponentsInChildren(); Bounds bounds = componentsInChildren[0].bounds; Renderer[] array = componentsInChildren; foreach (Renderer val in array) { if (val.enabled || includeDisabled) { ((Bounds)(ref bounds)).Encapsulate(val.bounds); } } return new Vector3(((Bounds)(ref bounds)).center.x, ((Bounds)(ref bounds)).max.y, ((Bounds)(ref bounds)).center.z); } } [HarmonyPatch] public class UtilsPatches { [HarmonyPrefix] [HarmonyPatch(typeof(RoundManager), "SpawnInsideEnemiesFromVentsIfReady")] public static bool RoundManager_SpawnInsideEnemiesFromVentsIfReady_Prefix() { try { if (Utils.testing && Utils.DEBUG_disableSpawning) { return false; } return true; } catch { return true; } } [HarmonyPrefix] [HarmonyPatch(typeof(RoundManager), "SpawnDaytimeEnemiesOutside")] public static bool RoundManager_SpawnDaytimeEnemiesOutside_Prefix() { try { if (Utils.testing && Utils.DEBUG_disableSpawning) { return false; } return true; } catch { return true; } } [HarmonyPrefix] [HarmonyPatch(typeof(RoundManager), "SpawnEnemiesOutside")] public static bool RoundManager_SpawnEnemiesOutside_Prefix() { try { if (Utils.testing && Utils.DEBUG_disableSpawning) { return false; } return true; } catch { return true; } } [HarmonyPostfix] [HarmonyPatch(typeof(RoundManager), "FinishGeneratingLevel")] public static void RoundManager_FinishGeneratingLevel_Postfix() { try { Utils.elevator = null; Utils.entrances.Clear(); Utils.entrances = Object.FindObjectsOfType().ToList(); Utils.elevator = Object.FindObjectOfType(); Utils.SetRandoms(); Utils.OnFinishGeneratingLevel.Invoke(); } catch { } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "OnShipLandedMiscEvents")] public static void StartOfRound_OnShipLandedMiscEvents_Postfix() { try { Utils.OnShipLanded.Invoke(); } catch { } } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] public static void PlayerControllerB_ConnectClientToPlayerObject_Postfix(PlayerControllerB __instance) { try { Utils.terminal = Object.FindObjectOfType(); } catch { } } [HarmonyPrefix] [HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")] public static void HUDManager_SubmitChat_performed_Prefix(HUDManager __instance) { try { if (Utils.testing) { string text = __instance.chatTextField.text; string[] args = text.Split(" "); Utils.ChatCommand(args); } } catch (Exception ex) { Plugin.logger.LogError((object)ex); } } [HarmonyPostfix] [HarmonyPatch(typeof(GrabbableObject), "Start")] public static void GrabbableObject_Start_Postfix(GrabbableObject __instance) { try { Utils.spawnedItems.Add(__instance); } catch (Exception ex) { Plugin.logger.LogError((object)ex); } } [HarmonyPostfix] [HarmonyPatch(typeof(GrabbableObject), "OnDestroy")] public static void GrabbableObject_OnDestroy_Postfix(GrabbableObject __instance) { try { Utils.spawnedItems.Remove(__instance); } catch (Exception ex) { Plugin.logger.LogError((object)ex); } } } public class VignetteOverlay : MonoBehaviour { [SerializeField] private Image image = null; private Material material = null; private static readonly int InsetId = Shader.PropertyToID("_Inset"); public static VignetteOverlay? Instance { get; private set; } public static float currentIntensityDecreasePerSecond { get; private set; } = 0.01f; public static float currentIntensity { get; private set; } private void Awake() { material = ((Graphic)image).material; ((Graphic)image).canvas.overrideSorting = true; ((Graphic)image).canvas.sortingOrder = -1; } private void Update() { if (!(currentIntensity <= 0f)) { currentIntensity = Mathf.Max(0f, currentIntensity - currentIntensityDecreasePerSecond * Time.deltaTime); material.SetFloat(InsetId, currentIntensity); } } public static void SetIntensity(float intensity, float intensityDecreasePerSecond = 0.01f) { currentIntensityDecreasePerSecond = intensityDecreasePerSecond; currentIntensity = Mathf.Clamp01(intensity); VignetteOverlay? instance = Instance; if (instance != null) { instance.material.SetFloat(InsetId, currentIntensity); } } internal static void Init(PlayerControllerB player) { GameObject val = Plugin.ModAssets.LoadAsset("Assets/ModAssets/VignetteOverlay.prefab"); Instance = Object.Instantiate(val).GetComponent(); } } [HarmonyPatch] internal static class VignetteOverlayPatches { [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] public static void ConnectClientToPlayerObjectPostfix(PlayerControllerB __instance) { try { VignetteOverlay.Init(__instance); } catch { } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Snowlance.SnowyLib"; public const string PLUGIN_NAME = "SnowyLib"; public const string PLUGIN_VERSION = "1.11.0"; } } namespace SnowyLib.BehaviorTrees.Main { public class BehaviorTree { private Node root; public BehaviorTree(Node root) { this.root = root; } public void Tick() { root.Tick(); } } public abstract class CompositeNode : Node { protected List children = new List(); public CompositeNode(params Node[] children) { this.children.AddRange(children); } } public abstract class Node { public enum NodeResult { Success, Failure, Running } public abstract NodeResult Tick(); } public class Selector : CompositeNode { private int currentChild; public Selector(params Node[] children) : base(children) { } public override NodeResult Tick() { while (currentChild < children.Count) { switch (children[currentChild].Tick()) { case NodeResult.Success: currentChild = 0; return NodeResult.Success; case NodeResult.Running: return NodeResult.Running; } currentChild++; } currentChild = 0; return NodeResult.Failure; } } public class Sequence : CompositeNode { private int currentChild; public Sequence(params Node[] children) : base(children) { } public override NodeResult Tick() { while (currentChild < children.Count) { switch (children[currentChild].Tick()) { case NodeResult.Failure: currentChild = 0; return NodeResult.Failure; case NodeResult.Running: return NodeResult.Running; } currentChild++; } currentChild = 0; return NodeResult.Success; } } } namespace SnowyLib.BehaviorTrees.Advanced { public class Node { public enum Status { Success, Failure, Running } public readonly string name; public readonly int priority; public readonly List children = new List(); protected int currentChild; public Node(string name = "Node", int priority = 0) { this.name = name; this.priority = priority; } public void AddChild(Node child) { children.Add(child); } public virtual Status Tick() { return children[currentChild].Tick(); } public virtual void Reset() { currentChild = 0; foreach (Node child in children) { child.Reset(); } } } public class UntilFail : Node { public UntilFail(string name) : base(name) { } public override Status Tick() { if (children[0].Tick() == Status.Failure) { Reset(); return Status.Failure; } return Status.Running; } } public class Inverter : Node { public Inverter(string name) : base(name) { } public override Status Tick() { return children[0].Tick() switch { Status.Running => Status.Running, Status.Failure => Status.Success, _ => Status.Failure, }; } } public class RandomSelector : PrioritySelector { protected override List SortChildren() { return IListExtensions.Shuffle((IList)children).ToList(); } public RandomSelector(string name, int priority = 0) : base(name, priority) { } } public class PrioritySelector : Selector { private List sortedChildren; private List SortedChildren => sortedChildren ?? (sortedChildren = SortChildren()); protected virtual List SortChildren() { return children.OrderByDescending((Node child) => child.priority).ToList(); } public PrioritySelector(string name, int priority = 0) : base(name, priority) { } public override void Reset() { base.Reset(); sortedChildren = null; } public override Status Tick() { foreach (Node sortedChild in SortedChildren) { switch (sortedChild.Tick()) { case Status.Running: return Status.Running; case Status.Success: Reset(); return Status.Success; } } Reset(); return Status.Failure; } } public class Selector : Node { public Selector(string name, int priority = 0) : base(name, priority) { } public override Status Tick() { if (currentChild < children.Count) { switch (children[currentChild].Tick()) { case Status.Running: return Status.Running; case Status.Success: Reset(); return Status.Success; default: currentChild++; return Status.Running; } } Reset(); return Status.Failure; } } public class Sequence : Node { public Sequence(string name, int priority = 0) : base(name, priority) { } public override Status Tick() { if (currentChild < children.Count) { switch (children[currentChild].Tick()) { case Status.Running: return Status.Running; case Status.Failure: currentChild = 0; return Status.Failure; default: currentChild++; return (currentChild != children.Count) ? Status.Running : Status.Success; } } Reset(); return Status.Success; } } public class Leaf : Node { private readonly IStrategy strategy; public Leaf(string name, IStrategy strategy, int priority = 0) : base(name, priority) { this.strategy = strategy; } public override Status Tick() { return strategy.Tick(); } public override void Reset() { strategy.Reset(); } } public interface IPolicy { bool ShouldReturn(Node.Status status); } public static class Policies { private class RunForeverPolicy : IPolicy { public bool ShouldReturn(Node.Status status) { return false; } } private class RunUntilSuccessPolicy : IPolicy { public bool ShouldReturn(Node.Status status) { return status == Node.Status.Success; } } private class RunUntilFailurePolicy : IPolicy { public bool ShouldReturn(Node.Status status) { return status == Node.Status.Failure; } } public static readonly IPolicy RunForever = new RunForeverPolicy(); public static readonly IPolicy RunUntilSuccess = new RunUntilSuccessPolicy(); public static readonly IPolicy RunUntilFailure = new RunUntilFailurePolicy(); } public class BehaviourTree : Node { private readonly IPolicy policy; public BehaviourTree(string name, IPolicy policy = null) : base(name) { this.policy = policy ?? Policies.RunForever; } public override Status Tick() { Status status = children[currentChild].Tick(); if (policy.ShouldReturn(status)) { return status; } currentChild = (currentChild + 1) % children.Count; return Status.Running; } public void PrintTree() { StringBuilder stringBuilder = new StringBuilder(); PrintNode(this, 0, stringBuilder); Debug.Log((object)stringBuilder.ToString()); } private static void PrintNode(Node node, int indentLevel, StringBuilder sb) { sb.Append(' ', indentLevel * 2).AppendLine(node.name); foreach (Node child in node.children) { PrintNode(child, indentLevel + 1, sb); } } } public interface IStrategy { Node.Status Tick(); void Reset() { } } public class ActionStrategy : IStrategy { private readonly Action doSomething; public ActionStrategy(Action doSomething) { this.doSomething = doSomething; } public Node.Status Tick() { doSomething(); return Node.Status.Success; } } public class Condition : IStrategy { private readonly Func predicate; public Condition(Func predicate) { this.predicate = predicate; } public Node.Status Tick() { return (!predicate()) ? Node.Status.Failure : Node.Status.Success; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace Snowlance.SnowyLib.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }