using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using ScalerCore.AprilFools; using ScalerCore.Handlers; using ScalerCore.Handlers.EnemyVisuals; using ScalerCore.Utilities; using UnityEngine; using UnityEngine.AI; using UnityEngine.Audio; using UnityEngine.Rendering.PostProcessing; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("Vippy")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.6.1.0")] [assembly: AssemblyInformationalVersion("0.6.1+223b9d80a99008c29435f191fa7555e9bb025ff5")] [assembly: AssemblyProduct("ScalerCore")] [assembly: AssemblyTitle("ScalerCore")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.6.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ScalerCore { internal static class BuildInfo { public const string Version = "0.6.1"; } [HarmonyPatch(typeof(PhysGrabObject), "Start")] internal static class AttachToValuablePatch { private static void Postfix(PhysGrabObject __instance) { if (!((Object)(object)((Component)__instance).GetComponent() != (Object)null)) { bool num = (Object)(object)((Component)__instance).GetComponent() != (Object)null; bool flag = (Object)(object)((Component)__instance).GetComponent() != (Object)null; bool flag2 = (Object)(object)((Component)__instance).GetComponent() != (Object)null; if (num || flag || flag2) { ((Component)__instance).gameObject.AddComponent(); } } } } [HarmonyPatch(typeof(EnemyRigidbody), "Awake")] internal static class AttachToEnemyPatch { private static void Postfix(EnemyRigidbody __instance) { if (!((Object)(object)((Component)__instance).GetComponent() != (Object)null)) { ((Component)__instance).gameObject.AddComponent(); } } } [HarmonyPatch(typeof(PlayerAvatar), "Start")] internal static class AttachToPlayerPatch { private static void Postfix(PlayerAvatar __instance) { if (!((Object)(object)((Component)__instance).GetComponent() != (Object)null)) { ((Component)__instance).gameObject.AddComponent(); PhotonView component = ((Component)__instance).GetComponent(); if (component != null) { component.RefreshRpcMonoBehaviourCache(); } } } } [HarmonyPatch(typeof(PhysGrabHinge), "Awake")] internal static class AttachToDoorPatch { private static void Postfix(PhysGrabHinge __instance) { if (!((Object)(object)((Component)__instance).GetComponent() != (Object)null)) { ((Component)__instance).gameObject.AddComponent(); } } } [HarmonyPatch(typeof(RunManager), "ChangeLevel")] internal static class LevelChangePatch { private static void Postfix() { ScaleManager.CleanupAll(); MapCollapse.OnLevelChange(); } } [HarmonyPatch(typeof(RunManagerPUN), "UpdateLevelRPC")] internal static class LevelChangeNonHostPatch { private static void Postfix() { if (!SemiFunc.IsMasterClientOrSingleplayer()) { ScaleManager.CleanupAll(); MapCollapse.OnLevelChange(); } } } [HarmonyPatch(typeof(PlayerTumble), "SetupDone")] internal static class PlayerTumbleLinkPatch { private static void Postfix(PlayerTumble __instance) { PlayerAvatar playerAvatar = __instance.playerAvatar; ScaleController scaleController = ((playerAvatar != null) ? ((Component)playerAvatar).GetComponent() : null); if (!((Object)(object)scaleController == (Object)null)) { AttachLink(((Component)__instance).gameObject, scaleController); Collider[] componentsInChildren = ((Component)__instance).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { AttachLink(((Component)componentsInChildren[i]).gameObject, scaleController); } Plugin.Log.LogDebug((object)("[SC] PlayerShrinkLink (tumble) attached → " + ((Object)((Component)__instance).gameObject).name + " avatar=" + ((Object)((Component)scaleController).gameObject).name)); } } private static void AttachLink(GameObject go, ScaleController ctrl) { (go.GetComponent() ?? go.AddComponent()).Controller = ctrl; } } [HarmonyPatch(typeof(PlayerAvatar), "PlayerDeathRPC")] internal static class PlayerDeathExpandPatch { private static void Postfix(PlayerAvatar __instance) { if (SemiFunc.IsMasterClientOrSingleplayer()) { ScaleController component = ((Component)__instance).GetComponent(); if (!((Object)(object)component == (Object)null) && component.IsScaled && !component._invertedActive) { component.DispatchExpand(); } } } } [HarmonyPatch(typeof(PlayerHealth), "Hurt")] internal static class PlayerBonkPatch { private static void Prefix(PlayerHealth __instance, out int __state) { __state = __instance.health; } private static void Postfix(PlayerHealth __instance, int __state) { if (__instance.health >= __state) { return; } ScaleController scaleController = ((Component)__instance).GetComponentInParent() ?? ((Component)__instance).GetComponentInChildren(); if ((Object)(object)scaleController == (Object)null) { return; } if (scaleController.IsScaled) { if (!scaleController._invertedActive) { scaleController.RequestBonkExpand(); } } else if (scaleController._invertedActive) { scaleController.RequestInvertedReshrink(); } } } [HarmonyPatch(typeof(ItemEquippable), "RequestEquip")] internal static class ShrunkEquipBlockPatch { private static bool Prefix(ItemEquippable __instance) { ScaleController component = ((Component)__instance).GetComponent(); if ((Object)(object)component == (Object)null) { return true; } bool flag = false; if (component.HandlerState is CartHandler.State state) { flag = state.AddedEquippable; } else if (component.HandlerState is ItemHandler.State state2) { flag = state2.AddedEquippable; } else if (component.HandlerState is VehicleHandler.State state3) { flag = state3.AddedEquippable; } if (!flag) { return true; } PlayerAvatar instance = PlayerAvatar.instance; if ((Object)(object)instance == (Object)null) { return true; } ScaleController component2 = ((Component)instance).GetComponent(); if ((Object)(object)component2 != (Object)null && component2.IsScaled) { return false; } return true; } } [HarmonyPatch(typeof(PlayerCollisionGrounded), "Update")] internal static class GroundedWallJumpFix { private static void Postfix(PlayerCollisionGrounded __instance) { //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_0056: Unknown result type (might be due to invalid IL or missing references) if (!__instance.Grounded) { return; } PlayerAvatar instance = PlayerAvatar.instance; if ((Object)(object)instance == (Object)null) { return; } ScaleController component = ((Component)instance).GetComponent(); if (!((Object)(object)component == (Object)null) && component.IsScaled) { float num = __instance.Collider.radius * 1.5f; if (!Physics.Raycast(((Component)__instance).transform.position, Vector3.down, num, LayerMask.op_Implicit(__instance.LayerMask), (QueryTriggerInteraction)1)) { __instance.Grounded = false; __instance.GroundedTimer = 0f; __instance.CollisionController.Grounded = false; } } } } [HarmonyPatch(typeof(PhysGrabber), "OverrideGrabDistance")] internal static class GrabDistanceScalePatch { private static void Prefix(ref float dist) { if (!((Object)(object)PhysGrabber.instance?.playerAvatar == (Object)null)) { ScaleController component = ((Component)PhysGrabber.instance.playerAvatar).GetComponent(); if (!((Object)(object)component == (Object)null) && component.IsScaled) { dist *= 0.7f; } } } } [HarmonyPatch(typeof(PhysGrabObject), "OverrideGrabVerticalPosition")] internal static class GrabVerticalPositionScalePatch { private static void Prefix(ref float pos) { PhysGrabber instance = PhysGrabber.instance; object obj; if (instance == null) { obj = null; } else { PlayerAvatar playerAvatar = instance.playerAvatar; obj = ((playerAvatar != null) ? ((Component)playerAvatar).GetComponent() : null); } ScaleController scaleController = (ScaleController)obj; if (!((Object)(object)scaleController == (Object)null) && scaleController.IsScaled) { pos = 0f; } } } [HarmonyPatch(typeof(PhysGrabber), "StartGrabbingPhysObject")] internal static class ForceGrabPointVerticalScalePatch { private static void Postfix(PhysGrabber __instance, PhysGrabObject ___grabbedPhysGrabObject) { //IL_0089: 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_009e: 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_00a5: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar playerAvatar = __instance.playerAvatar; if ((Object)(object)playerAvatar == (Object)null) { return; } ScaleController component = ((Component)playerAvatar).GetComponent(); if ((Object)(object)component == (Object)null || !component.IsScaled || (Object)(object)___grabbedPhysGrabObject == (Object)null) { return; } Transform forceGrabPoint = ___grabbedPhysGrabObject.forceGrabPoint; if (!((Object)(object)forceGrabPoint == (Object)null) && ((Component)forceGrabPoint).gameObject.activeSelf) { PlayerLocalCamera localCamera = playerAvatar.localCamera; Transform val = ((localCamera != null) ? localCamera.GetOverrideTransform() : null); if (!((Object)(object)val == (Object)null)) { float num = 0.3f * (1f - component._options.Factor); Vector3 val2 = val.up * num; Transform physGrabPointPuller = __instance.physGrabPointPuller; physGrabPointPuller.position += val2; Transform physGrabPointPlane = __instance.physGrabPointPlane; physGrabPointPlane.position += val2; } } } } [HarmonyPatch(typeof(PhysGrabCart), "CartSteer")] internal static class CartHandledDistancePatch { [CompilerGenerated] private sealed class d__1 : IEnumerable, IEnumerable, IEnumerator, IEnumerator, IDisposable { private int <>1__state; private CodeInstruction <>2__current; private int <>l__initialThreadId; private MethodBase originalMethod; public MethodBase <>3__originalMethod; private IEnumerable instructions; public IEnumerable <>3__instructions; private MethodInfo 5__2; private MethodInfo 5__3; private int 5__4; private IEnumerator <>7__wrap4; private CodeInstruction 5__6; CodeInstruction IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__1(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { switch (<>1__state) { case -3: case 1: try { } finally { <>m__Finally1(); } break; case -4: case 2: case 3: case 4: case 5: try { } finally { <>m__Finally2(); } break; } 5__2 = null; 5__3 = null; <>7__wrap4 = null; 5__6 = null; <>1__state = -2; } private bool MoveNext() { //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Expected O, but got Unknown //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Expected O, but got Unknown //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Expected O, but got Unknown try { switch (<>1__state) { default: return false; case 0: { <>1__state = -1; 5__2 = AccessTools.Method(typeof(Mathf), "Lerp", new Type[3] { typeof(float), typeof(float), typeof(float) }, (Type[])null); 5__3 = AccessTools.Method(typeof(CartHandledDistancePatch), "ScalePullDist", (Type[])null, (Type[])null); IList localVariables = originalMethod.GetMethodBody().LocalVariables; 5__4 = -1; int num = 0; foreach (LocalVariableInfo item in localVariables) { if (item.LocalType == typeof(PhysGrabber)) { num++; if (num == 2) { 5__4 = item.LocalIndex; break; } } } if (5__4 == -1) { Plugin.Log.LogWarning((object)"[SC] CartSteer transpiler: Physgrabber local not found"); <>7__wrap4 = instructions.GetEnumerator(); <>1__state = -3; goto IL_0161; } <>7__wrap4 = instructions.GetEnumerator(); <>1__state = -4; break; } case 1: <>1__state = -3; goto IL_0161; case 2: <>1__state = -4; if (5__6.opcode == OpCodes.Call && (MethodInfo)5__6.operand == 5__2) { <>2__current = new CodeInstruction(OpCodes.Ldarg_0, (object)null); <>1__state = 3; return true; } goto IL_0288; case 3: <>1__state = -4; <>2__current = new CodeInstruction(OpCodes.Ldloc, (object)5__4); <>1__state = 4; return true; case 4: <>1__state = -4; <>2__current = new CodeInstruction(OpCodes.Call, (object)5__3); <>1__state = 5; return true; case 5: { <>1__state = -4; goto IL_0288; } IL_0161: if (<>7__wrap4.MoveNext()) { CodeInstruction current = <>7__wrap4.Current; <>2__current = current; <>1__state = 1; return true; } <>m__Finally1(); <>7__wrap4 = null; return false; IL_0288: 5__6 = null; break; } if (<>7__wrap4.MoveNext()) { 5__6 = <>7__wrap4.Current; <>2__current = 5__6; <>1__state = 2; return true; } <>m__Finally2(); <>7__wrap4 = null; return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>7__wrap4 != null) { <>7__wrap4.Dispose(); } } private void <>m__Finally2() { <>1__state = -1; if (<>7__wrap4 != null) { <>7__wrap4.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__1 d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; d__ = this; } else { d__ = new d__1(0); } d__.instructions = <>3__instructions; d__.originalMethod = <>3__originalMethod; return d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } private static float ScalePullDist(float d, PhysGrabCart cart, PhysGrabber grabber) { ScaleController component = ((Component)cart).GetComponent(); if ((Object)(object)component != (Object)null && component.IsScaled) { return d * Mathf.Lerp(component._options.Factor, 1f, 0.15f); } if ((Object)(object)grabber == (Object)null) { return d; } ScaleController component2 = ((Component)grabber.playerAvatar).GetComponent(); if ((Object)(object)component2 != (Object)null && component2.IsScaled) { return d * Mathf.Lerp(1f, component2._options.Factor, 0.15f); } return d; } [IteratorStateMachine(typeof(d__1))] private static IEnumerable Transpiler(IEnumerable instructions, MethodBase originalMethod) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__1(-2) { <>3__instructions = instructions, <>3__originalMethod = originalMethod }; } } [HarmonyPatch(typeof(CameraGlitch), "Update")] internal static class CameraGlitchScalePatch { private static void Postfix(CameraGlitch __instance) { //IL_002a: 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_0053: 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_007d: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar instance = PlayerAvatar.instance; if ((Object)(object)instance == (Object)null) { return; } ScaleController component = ((Component)instance).GetComponent(); if (!((Object)(object)component == (Object)null) && component.IsScaled) { float num = ((component.OriginalScale.x > 0f) ? (component._t.localScale.x / component.OriginalScale.x) : 1f); if (!(num >= 1f) && !(num <= 0f)) { Transform transform = ((Component)__instance).transform; transform.localScale /= num; } } } } [HarmonyPatch(typeof(PlayerAvatar), "Footstep")] internal static class FootstepPitchPatch { private static void Prefix(PlayerAvatar __instance) { ScaleController component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null && component.IsScaled) { ScaleController.FootstepPitchMult = component._options.FootstepPitchMultiplier; } } private static void Postfix() { ScaleController.FootstepPitchMult = 1f; } } [HarmonyPatch(typeof(Sound), "Play", new Type[] { typeof(Vector3), typeof(float), typeof(float), typeof(float), typeof(float) })] internal static class SoundPlayPitchPatch { private static void Postfix(AudioSource __result) { if (ScaleController.FootstepPitchMult != 1f && (Object)(object)__result != (Object)null) { __result.pitch *= ScaleController.FootstepPitchMult; } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] internal static class DriverFullyMountedScalePatch { private static void Postfix(ItemVehicle __instance, ref bool __result) { if (!__result && __instance.seats != null && __instance.seats.Length != 0 && !((Object)(object)__instance.seats[0].seatedPlayer == (Object)null)) { ScaleController component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null && component.IsScaled) { __result = true; } } } } public class PlayerShrinkLink : MonoBehaviour { public ScaleController Controller; } [BepInPlugin("Vippy.ScalerCore", "ScalerCore", "0.6.1")] public class Plugin : BaseUnityPlugin { private static Harmony? _harmony; internal static ManualLogSource Log; private void Awake() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; _harmony = new Harmony("Vippy.ScalerCore"); _harmony.PatchAll(); ((Component)this).gameObject.AddComponent(); } } public class ScaleController : MonoBehaviourPunCallbacks { [CompilerGenerated] private sealed class d__62 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ScaleController <>4__this; private PlayerHandler.State 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__62(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { int num = <>1__state; ScaleController scaleController = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; goto IL_0042; case 1: <>1__state = -1; goto IL_0042; case 2: { <>1__state = -1; goto IL_008c; } IL_0042: if ((Object)(object)LevelGenerator.Instance == (Object)null || !LevelGenerator.Instance.Generated) { <>2__current = null; <>1__state = 1; return true; } if (!SemiFunc.IsMultiplayer()) { break; } 5__2 = scaleController.HandlerState as PlayerHandler.State; goto IL_008c; IL_008c: if ((Object)(object)5__2?.PlayerAvatar.voiceChat == (Object)null) { <>2__current = null; <>1__state = 2; return true; } 5__2 = null; break; } if (!scaleController.IsScaled && SemiFunc.IsMasterClientOrSingleplayer()) { ScaleOptions @default = ScaleOptions.Default; @default.InvertedMode = true; @default.Duration = 0f; scaleController.DispatchShrink(@default); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__63 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private int 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__63(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__2 = 0; break; case 1: <>1__state = -1; 5__2++; break; } if (5__2 < 10) { <>2__current = null; <>1__state = 1; return true; } PlayerVoiceChat[] array = Object.FindObjectsOfType(); foreach (PlayerVoiceChat val in array) { if (ChallengeMode) { val.OverridePitch(1.3f, 0.2f, 0.5f, 9999f, 0f, 0f); } else { val.OverridePitchCancel(); } } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__61 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ScaleController <>4__this; public Vector3 from; public Vector3 to; private float 5__2; private float 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__61(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_00a9: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; ScaleController scaleController = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; 5__2 = 0.4f; 5__3 = 0f; break; case 1: <>1__state = -1; break; } if (5__3 < 5__2) { 5__3 += Time.deltaTime; float num2 = BackOutEase(Mathf.Clamp01(5__3 / 5__2)); scaleController._t.localScale = Vector3.LerpUnclamped(from, to, num2); <>2__current = null; <>1__state = 1; return true; } scaleController._t.localScale = to; scaleController._transitioning = false; scaleController._playerBounceAnim = null; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static readonly HashSet Scaled = new HashSet(); internal static float FootstepPitchMult = 1f; public static bool AllowManualScale = true; public Transform? ScaleTarget; internal IScaleHandler? Handler; internal object? HandlerState; internal bool HandlerOwnsScale; internal PhysGrabObject? _physGrabObject; internal Transform _t; internal Rigidbody? _rb; internal float _originalMass; private RoomVolumeCheck? _roomVolumeCheck; private Vector3 _originalRoomVolumeSize; private bool _isItem; internal ItemEquippable? _itemEquippable; internal List? _scaledItemFields; internal bool _invertedActive; internal Vector3 _target; internal Vector3 _animScale; internal bool _transitioning; internal float _currentAnimSpeed = ScaleOptions.Default.Speed; private Coroutine? _playerBounceAnim; private float _shrinkTimer; internal ScaleOptions _options; internal float _bonkImmuneTimer; internal string _displayName = ""; internal PhotonView? _networkPV; internal AudioPitchHelper _audioPitch = new AudioPitchHelper(); public static bool ChallengeMode { get; set; } public Vector3 OriginalScale { get; internal set; } public bool IsScaled { get; private set; } public ScaleOptions CurrentOptions => _options; public ScaleTargets TargetType { get { if (!(Handler is PlayerHandler)) { if (!(Handler is EnemyHandler)) { if (!(Handler is ItemHandler)) { if (!(Handler is VehicleHandler)) { return ScaleTargets.Valuables; } return ScaleTargets.Items; } return ScaleTargets.Items; } return ScaleTargets.Enemies; } return ScaleTargets.Players; } } private void Awake() { //IL_0013: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) _t = ((Component)this).transform; OriginalScale = ((Component)this).transform.localScale; _target = OriginalScale; _animScale = OriginalScale; } private void Start() { //IL_0044: 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_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_00cc: 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_0229: Unknown result type (might be due to invalid IL or missing references) Handler = ScaleHandlerRegistry.Resolve(((Component)this).gameObject); Handler?.Setup(this); if ((Object)(object)ScaleTarget != (Object)null) { _t = ScaleTarget; OriginalScale = _t.localScale; _target = OriginalScale; _animScale = OriginalScale; } _rb = ((Component)this).GetComponent(); if ((Object)(object)_rb != (Object)null) { _originalMass = _rb.mass; } if ((Object)(object)_physGrabObject == (Object)null) { _physGrabObject = ((Component)this).GetComponent(); } _roomVolumeCheck = ((Component)this).GetComponent(); if ((Object)(object)_roomVolumeCheck != (Object)null) { _originalRoomVolumeSize = _roomVolumeCheck.currentSize; } EnemyParent componentInParent = ((Component)this).GetComponentInParent(); _displayName = (((Object)(object)componentInParent != (Object)null) ? ((Object)((Component)componentInParent).gameObject).name : ((Object)((Component)this).gameObject).name); _isItem = (Object)(object)((Component)this).GetComponent() != (Object)null; _itemEquippable = ((Component)this).GetComponent(); string text = ((Handler != null) ? Handler.GetType().Name.Replace("Handler", "").ToLower() : "base"); EnemyParent componentInParent2 = ((Component)this).GetComponentInParent(); if ((Object)(object)componentInParent2 != (Object)null) { int num = 0; ScaleController[] componentsInChildren = ((Component)componentInParent2).GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { if ((Object)(object)componentsInChildren[i] != (Object)(object)this) { num++; } } if (num > 0) { Plugin.Log.LogWarning((object)$"[SC] *** DUPLICATE: {_displayName} already has {num} other ScaleController(s) under same EnemyParent ***"); } } _networkPV = ((MonoBehaviourPun)this).photonView ?? ((Component)this).GetComponentInParent(); PhotonView? networkPV = _networkPV; if (networkPV != null) { networkPV.RefreshRpcMonoBehaviourCache(); } EnemyHandler.State state = HandlerState as EnemyHandler.State; Plugin.Log.LogDebug((object)("[SC] Registered " + _displayName + " (" + text + ")" + $" scale={OriginalScale}" + " mass=" + (((Object)(object)_rb != (Object)null) ? _rb.mass.ToString("F2") : "none") + " animTarget=" + (((Object)(object)state?.AnimTarget != (Object)null) ? ((Object)((Component)state.AnimTarget).gameObject).name : "NONE") + " navAgent=" + (((Object)(object)state?.NavAgent != (Object)null) ? "yes" : "no"))); if (Handler is PlayerHandler && SemiFunc.RunIsLobbyMenu()) { ((MonoBehaviour)this).StartCoroutine(LobbyPitchDeferred()); } if (ChallengeMode && Handler is PlayerHandler && !SemiFunc.RunIsLobbyMenu()) { ((MonoBehaviour)this).StartCoroutine(ChallengeModeDeferred()); } } private void Update() { bool num = SemiFunc.IsMasterClientOrSingleplayer(); if (num) { if (IsScaled && _shrinkTimer > 0f) { _shrinkTimer -= Time.deltaTime; if (_shrinkTimer <= 0f) { DispatchExpand(); } } if (_bonkImmuneTimer > 0f) { _bonkImmuneTimer -= Time.deltaTime; } if (IsScaled && Handler != null) { Handler.OnUpdate(this); } } if (!num && IsScaled && Handler is PlayerHandler) { Handler.OnUpdate(this); } } private bool IsItemInInventory() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Invalid comparison between Unknown and I4 if ((Object)(object)_itemEquippable == (Object)null) { return false; } if (_itemEquippable.IsEquipped()) { return true; } return (int)_itemEquippable.currentState > 0; } private void LateUpdate() { //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_0045: 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_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_007b: 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_0070: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_013d: 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_0122: Unknown result type (might be due to invalid IL or missing references) bool flag = IsItemInInventory(); bool flag2 = Handler is PlayerHandler; if (_transitioning && !flag2 && !flag) { float currentAnimSpeed = _currentAnimSpeed; Vector3 originalScale = OriginalScale; float num = currentAnimSpeed * ((Vector3)(ref originalScale)).magnitude; _animScale = Vector3.MoveTowards(_animScale, _target, num * Time.deltaTime); if (!HandlerOwnsScale) { _t.localScale = _animScale; } if (_animScale == _target) { _transitioning = false; Plugin.Log.LogDebug((object)$"[SC] LATE_ANIM DONE {_displayName} finalScale={_animScale}"); } } Handler?.OnLateUpdate(this); if (!flag2 && !HandlerOwnsScale && IsScaled && !_transitioning && !flag) { if (_t.localScale != _target) { Plugin.Log.LogDebug((object)$"[SC] LATE_FORCE {_displayName} was={_t.localScale} forcing={_target}"); } _t.localScale = _target; } } public override void OnDisable() { //IL_0042: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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) ((MonoBehaviourPunCallbacks)this).OnDisable(); if (IsScaled && Handler is EnemyHandler) { Plugin.Log.LogDebug((object)("[SC] DISABLE (despawn) " + _displayName + " restoring scale")); _t.localScale = OriginalScale; _animScale = OriginalScale; _target = OriginalScale; _transitioning = false; IsScaled = false; _invertedActive = false; _shrinkTimer = 0f; Scaled.Remove(this); if ((Object)(object)_rb != (Object)null) { _rb.mass = _originalMass; } if ((Object)(object)_roomVolumeCheck != (Object)null) { _roomVolumeCheck.currentSize = _originalRoomVolumeSize; } Handler?.OnRestore(this, isBonk: false); _audioPitch.RestorePitch(); ItemHandler.OnRestoreFields(_scaledItemFields); _scaledItemFields = null; } } private void OnDestroy() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (IsScaled) { _t.localScale = OriginalScale; PlayerHandler.State obj = HandlerState as PlayerHandler.State; if (obj != null) { PlayerVoiceChat voiceChat = obj.PlayerAvatar.voiceChat; if (voiceChat != null) { voiceChat.OverridePitchCancel(); } } Handler?.OnDestroy(this); } Scaled.Remove(this); } public void DispatchShrink(ScaleOptions options) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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_012a: 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_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: 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_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } Plugin.Log.LogDebug((object)$"[SC] DispatchShrink ENTER {_displayName} instanceID={((Object)this).GetInstanceID()} IsScaled={IsScaled} currentScale={_t.localScale} GO={((Object)((Component)this).gameObject).name}"); if (IsScaled) { if (Mathf.Approximately(options.Factor, _options.Factor)) { DispatchExpand(); if (_invertedActive) { _bonkImmuneTimer = _options.BonkImmuneDuration; } return; } Plugin.Log.LogDebug((object)$"[SC] RESCALE {_displayName} {_options.Factor} → {options.Factor}"); _options = options; _shrinkTimer = _options.Duration; if (_shrinkTimer < 0f) { _shrinkTimer = 0f; } float factor = _options.Factor; Vector3 val = OriginalScale * factor; _bonkImmuneTimer = _options.BonkImmuneDuration; _currentAnimSpeed = _options.Speed; ApplyScale(val); if ((Object)(object)_roomVolumeCheck != (Object)null) { _roomVolumeCheck.currentSize = _originalRoomVolumeSize * factor; } if ((Object)(object)_rb != (Object)null && !_isItem && !_options.PreserveMass) { _rb.mass = Mathf.Clamp(_originalMass * factor, 0.5f, _options.MassCap); } if ((Object)(object)_networkPV != (Object)null && PhotonNetwork.InRoom) { _networkPV.RPC("RPC_Shrink", (RpcTarget)1, new object[3] { val, PackOpts(), PackBools() }); } return; } if (options.Factor <= 0f) { options.Factor = ScaleOptions.Default.Factor; } if (options.Speed <= 0f) { options.Speed = ScaleOptions.Default.Speed; } _options = options; _invertedActive = _options.InvertedMode; IsScaled = true; _shrinkTimer = _options.Duration; if (_shrinkTimer < 0f) { _shrinkTimer = 0f; } _currentAnimSpeed = _options.Speed; Scaled.Add(this); float factor2 = _options.Factor; Vector3 val2 = OriginalScale * factor2; Vector3 val3 = OriginalScale - val2; float magnitude = ((Vector3)(ref val3)).magnitude; float speed = _options.Speed; val3 = OriginalScale; float num = speed * ((Vector3)(ref val3)).magnitude; float num2 = ((num > 0f) ? (magnitude / num * 1.1f) : 0.75f); _bonkImmuneTimer = Mathf.Max(num2, _options.BonkImmuneDuration); ApplyScale(val2); if (factor2 < 1f) { SetForceGrabPoint(active: false); } if ((Object)(object)_roomVolumeCheck != (Object)null) { _roomVolumeCheck.currentSize = _originalRoomVolumeSize * factor2; } if ((Object)(object)_networkPV != (Object)null && PhotonNetwork.InRoom) { Plugin.Log.LogDebug((object)$"[SC] RPC_Shrink SEND {_displayName} viewID={_networkPV.ViewID} isMine={_networkPV.IsMine} target={val2}"); _networkPV.RPC("RPC_Shrink", (RpcTarget)1, new object[3] { val2, PackOpts(), PackBools() }); } else { Plugin.Log.LogDebug((object)string.Format("[SC] RPC_Shrink SKIP {0} networkPV={1} inRoom={2}", _displayName, ((Object)(object)_networkPV == (Object)null) ? "null" : "set", PhotonNetwork.InRoom)); } PlayImpactEffect(); Plugin.Log.LogDebug((object)("[SC] SHRINK " + _displayName + $" factor={_options.Factor}" + $" scale {OriginalScale} → {val2}" + $" animTime={magnitude / ((num > 0f) ? num : 1f):F2}s" + $" bonkImmune={_bonkImmuneTimer:F2}s" + " shrinkDuration=" + ((_shrinkTimer > 0f) ? (_shrinkTimer.ToString("F0") + "s") : "infinite"))); if ((Object)(object)_rb != (Object)null) { if (!_isItem && !_options.PreserveMass) { _rb.mass = Mathf.Clamp(_originalMass * factor2, 0.5f, _options.MassCap); } Plugin.Log.LogDebug((object)$"[SC] mass {_originalMass:F3} → {_rb.mass:F3} (cap={_options.MassCap:F2} originalMass locked at {_originalMass:F3})"); } Handler?.OnScale(this); if (factor2 < 1f && (Object)(object)_physGrabObject != (Object)null && Handler is ValuableHandler) { _physGrabObject.OverrideIndestructible(0.5f); } if (!_options.SuppressVoicePitch) { EnemyParent componentInParent = ((Component)this).GetComponentInParent(); _audioPitch.ApplyPitch((Component)(object)(((Object)(object)componentInParent != (Object)null) ? ((ScaleController)(object)componentInParent) : this), _options.Factor); } _scaledItemFields = ItemHandler.OnShrinkFields(this, _options.Factor); ScaleMapIcon(factor2); } public void DispatchExpand() { //IL_0025: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMasterClientOrSingleplayer() && IsScaled) { IsScaled = false; Scaled.Remove(this); float num = ((OriginalScale.x > 0f) ? (_t.localScale.x / OriginalScale.x) : 0f); Plugin.Log.LogDebug((object)("[SC] EXPAND (timer/shot) " + _displayName + $" currentSize={num * 100f:F0}%" + string.Format(" mass {0} → {1:F3}", ((Object)(object)_rb != (Object)null) ? _rb.mass.ToString("F3") : "N/A", _originalMass))); _currentAnimSpeed = ResolveExpandSpeed(); ApplyScale(OriginalScale); SetForceGrabPoint(active: true); if ((Object)(object)_networkPV != (Object)null && PhotonNetwork.InRoom) { _networkPV.RPC("RPC_Expand", (RpcTarget)1, Array.Empty()); } PlayImpactEffect(); PlayCameraShake(); if ((Object)(object)_rb != (Object)null) { _rb.mass = _originalMass; } if ((Object)(object)_roomVolumeCheck != (Object)null) { _roomVolumeCheck.currentSize = _originalRoomVolumeSize; } Handler?.OnRestore(this, isBonk: false); if (!_options.SuppressVoicePitch) { _audioPitch.RestorePitch(); } ItemHandler.OnRestoreFields(_scaledItemFields); _scaledItemFields = null; ScaleMapIcon(1f); } } public void DispatchExpandNow() { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_01a2: 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) if (!SemiFunc.IsMasterClientOrSingleplayer() || !IsScaled || _options.IgnoreBonkExpand) { return; } if (_bonkImmuneTimer > 0f) { Plugin.Log.LogDebug((object)$"[SC] BONK BLOCKED {_displayName} immune={_bonkImmuneTimer:F2}s remaining"); return; } IsScaled = false; _shrinkTimer = 0f; Scaled.Remove(this); float num = ((OriginalScale.x > 0f) ? (_t.localScale.x / OriginalScale.x) : 0f); Plugin.Log.LogDebug((object)("[SC] EXPAND (bonk/instant) " + _displayName + $" currentSize={num * 100f:F0}%" + string.Format(" mass {0} → {1:F3}", ((Object)(object)_rb != (Object)null) ? _rb.mass.ToString("F3") : "N/A", _originalMass))); _currentAnimSpeed = ResolveExpandSpeed(); ApplyScale(OriginalScale); SetForceGrabPoint(active: true); if ((Object)(object)_networkPV != (Object)null && PhotonNetwork.InRoom) { _networkPV.RPC("RPC_Expand", (RpcTarget)1, Array.Empty()); } PlayImpactEffect(); PlayCameraShake(); if ((Object)(object)_rb != (Object)null) { _rb.mass = _originalMass; } if ((Object)(object)_roomVolumeCheck != (Object)null) { _roomVolumeCheck.currentSize = _originalRoomVolumeSize; } Handler?.OnRestore(this, isBonk: true); if (!_options.SuppressVoicePitch) { _audioPitch.RestorePitch(); } ItemHandler.OnRestoreFields(_scaledItemFields); _scaledItemFields = null; ScaleMapIcon(1f); } private void ApplyScale(Vector3 target) { //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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_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) _target = target; _animScale = _t.localScale; _transitioning = true; if (Handler is PlayerHandler) { if (_playerBounceAnim != null) { ((MonoBehaviour)this).StopCoroutine(_playerBounceAnim); } _playerBounceAnim = ((MonoBehaviour)this).StartCoroutine(PlayerBounceAnim(_t.localScale, target)); } } private void PlayImpactEffect() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (!_options.SuppressImpactFlash) { AssetManager instance = AssetManager.instance; if (instance != null) { instance.PhysImpactEffect(_t.position); } } } private void PlayCameraShake() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (!_options.SuppressCameraShake) { SemiFunc.CameraShakeImpactDistance(_t.position, 2f, 0.1f, 1f, 8f); } } private float ResolveExpandSpeed() { if (!(_options.RestoreSpeed > 0f)) { return _options.Speed; } return _options.RestoreSpeed; } private void ScaleMapIcon(float factor) { //IL_0036: 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) MapCustom val = ((Component)this).GetComponent(); if ((Object)(object)val == (Object)null) { val = ((Component)this).GetComponentInParent(); } if ((Object)(object)val?.mapCustomEntity != (Object)null) { ((Component)val.mapCustomEntity).transform.localScale = Vector3.one * Mathf.Max(factor, 0.3f); } } private void SetForceGrabPoint(bool active) { if ((Object)(object)_physGrabObject != (Object)null && (Object)(object)_physGrabObject.forceGrabPoint != (Object)null) { ((Component)_physGrabObject.forceGrabPoint).gameObject.SetActive(active); } } private static float BackOutEase(float t) { return 1f + 2.70158f * Mathf.Pow(t - 1f, 3f) + 1.70158f * Mathf.Pow(t - 1f, 2f); } [IteratorStateMachine(typeof(d__61))] private IEnumerator PlayerBounceAnim(Vector3 from, Vector3 to) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__61(0) { <>4__this = this, from = from, to = to }; } [IteratorStateMachine(typeof(d__62))] private IEnumerator ChallengeModeDeferred() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__62(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__63))] private IEnumerator LobbyPitchDeferred() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__63(0); } private float[] PackOpts() { return new float[8] { _options.Factor, _options.Speed, _options.MassCap, _options.SpeedFactor, _options.AnimSpeedMultiplier, _options.FootstepPitchMultiplier, _options.BonkImmuneDuration, _options.RestoreSpeed }; } private bool[] PackBools() { return new bool[7] { _options.PreserveMass, _options.InvertedMode, _options.SuppressImpactFlash, _options.SuppressVoicePitch, _options.IgnoreBonkExpand, _options.RejectExternalApply, _options.SuppressCameraShake }; } [PunRPC] private void RPC_Shrink(Vector3 target, float[] opts, bool[] flags) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) Plugin.Log.LogDebug((object)string.Format("[SC] RPC_Shrink RECV {0} target={1} factor={2} speed={3} handler={4}", _displayName, target, opts[0], opts[1], Handler?.GetType().Name ?? "null")); _options.Factor = opts[0]; _options.Speed = opts[1]; _options.MassCap = opts[2]; _options.SpeedFactor = opts[3]; _options.AnimSpeedMultiplier = opts[4]; _options.FootstepPitchMultiplier = opts[5]; _options.BonkImmuneDuration = opts[6]; _options.RestoreSpeed = ((opts.Length > 7) ? opts[7] : 0f); _options.PreserveMass = flags[0]; _options.InvertedMode = flags[1]; _options.SuppressImpactFlash = flags.Length > 2 && flags[2]; _options.SuppressVoicePitch = flags.Length > 3 && flags[3]; _options.IgnoreBonkExpand = flags.Length > 4 && flags[4]; _options.RejectExternalApply = flags.Length > 5 && flags[5]; _options.SuppressCameraShake = flags.Length > 6 && flags[6]; _invertedActive = flags[1]; float factor = _options.Factor; IsScaled = true; _currentAnimSpeed = _options.Speed; Scaled.Add(this); if ((Object)(object)_rb != (Object)null && !_isItem && !_options.PreserveMass) { _rb.mass = Mathf.Clamp(_originalMass * factor, 0.5f, _options.MassCap); } if ((Object)(object)_roomVolumeCheck != (Object)null) { _roomVolumeCheck.currentSize = _originalRoomVolumeSize * factor; } ApplyScale(target); if (factor < 1f) { SetForceGrabPoint(active: false); } PlayImpactEffect(); if (!_options.SuppressVoicePitch) { EnemyParent componentInParent = ((Component)this).GetComponentInParent(); _audioPitch.ApplyPitch((Component)(object)(((Object)(object)componentInParent != (Object)null) ? ((ScaleController)(object)componentInParent) : this), factor); } _scaledItemFields = ItemHandler.OnShrinkFields(this, factor); Handler?.OnScale(this); if (factor < 1f && (Object)(object)_physGrabObject != (Object)null && Handler is ValuableHandler) { _physGrabObject.OverrideIndestructible(0.5f); } ScaleMapIcon(factor); } [PunRPC] private void RPC_Expand() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) IsScaled = false; Scaled.Remove(this); if ((Object)(object)_rb != (Object)null) { _rb.mass = _originalMass; } if ((Object)(object)_roomVolumeCheck != (Object)null) { _roomVolumeCheck.currentSize = _originalRoomVolumeSize; } _currentAnimSpeed = ResolveExpandSpeed(); ApplyScale(OriginalScale); SetForceGrabPoint(active: true); PlayImpactEffect(); PlayCameraShake(); if (!_options.SuppressVoicePitch) { _audioPitch.RestorePitch(); } ItemHandler.OnRestoreFields(_scaledItemFields); _scaledItemFields = null; Handler?.OnRestore(this, isBonk: false); ScaleMapIcon(1f); } [PunRPC] private void RPC_PlayerPitchCancel() { PlayerHandler.State obj = HandlerState as PlayerHandler.State; if (obj != null) { PlayerVoiceChat voiceChat = obj.PlayerAvatar.voiceChat; if (voiceChat != null) { voiceChat.OverridePitchCancel(); } } } public void RequestBonkExpand() { if (IsScaled) { if (SemiFunc.IsMasterClientOrSingleplayer()) { DispatchExpandNow(); } else if ((Object)(object)_networkPV != (Object)null && _networkPV.IsMine && PhotonNetwork.InRoom) { _networkPV.RPC("RPC_RequestExpand", (RpcTarget)2, new object[1] { true }); } } } public void RequestInvertedReshrink() { if (!IsScaled && _invertedActive && !(_bonkImmuneTimer > 0f)) { if (SemiFunc.IsMasterClientOrSingleplayer()) { DispatchShrink(_options); } else if ((Object)(object)_networkPV != (Object)null && _networkPV.IsMine && PhotonNetwork.InRoom) { _networkPV.RPC("RPC_RequestInvertedReshrink", (RpcTarget)2, Array.Empty()); } } } [PunRPC] private void RPC_RequestInvertedReshrink() { if (SemiFunc.IsMasterClientOrSingleplayer() && !IsScaled && _invertedActive) { ScaleOptions @default = ScaleOptions.Default; @default.InvertedMode = true; @default.Duration = 0f; DispatchShrink(@default); } } public void RequestManualShrink() { if (IsScaled) { return; } if (SemiFunc.IsMasterClientOrSingleplayer()) { if (AllowManualScale) { DispatchShrink(ScaleOptions.Default); } } else if ((Object)(object)_networkPV != (Object)null && _networkPV.IsMine && PhotonNetwork.InRoom) { _networkPV.RPC("RPC_RequestShrink", (RpcTarget)2, Array.Empty()); } } [PunRPC] private void RPC_RequestShrink() { if (SemiFunc.IsMasterClientOrSingleplayer() && AllowManualScale && !IsScaled) { DispatchShrink(ScaleOptions.Default); } } public void RequestManualExpand() { if (!IsScaled) { return; } if (SemiFunc.IsMasterClientOrSingleplayer()) { if (AllowManualScale) { DispatchExpand(); } } else if ((Object)(object)_networkPV != (Object)null && _networkPV.IsMine && PhotonNetwork.InRoom) { _networkPV.RPC("RPC_RequestExpand", (RpcTarget)2, new object[1] { false }); } } [PunRPC] private void RPC_RequestExpand(bool checkImmunity) { if (SemiFunc.IsMasterClientOrSingleplayer() && IsScaled) { if (checkImmunity) { DispatchExpandNow(); } else if (AllowManualScale) { DispatchExpand(); } } } public static void CleanupAll() { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00ae: Unknown result type (might be due to invalid IL or missing references) foreach (ScaleController item in Scaled) { if ((Object)(object)item == (Object)null) { continue; } item._audioPitch.RestorePitch(); ItemHandler.OnRestoreFields(item._scaledItemFields); item._scaledItemFields = null; PlayerHandler.State obj = item.HandlerState as PlayerHandler.State; if (obj != null) { PlayerVoiceChat voiceChat = obj.PlayerAvatar.voiceChat; if (voiceChat != null) { voiceChat.OverridePitchCancel(); } } item.Handler?.OnRestore(item, isBonk: false); item.IsScaled = false; item._invertedActive = false; item._transitioning = false; item._target = item.OriginalScale; item._animScale = item.OriginalScale; item._t.localScale = item.OriginalScale; } Scaled.Clear(); } public override void OnJoinedRoom() { PhotonView? networkPV = _networkPV; if (networkPV != null) { networkPV.RefreshRpcMonoBehaviourCache(); } } public override void OnPlayerEnteredRoom(Player newPlayer) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMasterClientOrSingleplayer()) { if (ChallengeMode && Handler is PlayerHandler) { ((MonoBehaviour)this).StartCoroutine(LobbyPitchDeferred()); } if (IsScaled && !((Object)(object)_networkPV == (Object)null)) { _networkPV.RPC("RPC_Shrink", newPlayer, new object[3] { _target, PackOpts(), PackBools() }); } } } } public static class ScaleManager { public static void Apply(GameObject target) { Apply(target, ScaleOptions.Default); } public static void Apply(GameObject target, ScaleOptions options) { ScaleController controller = GetController(target); if (!((Object)(object)controller == (Object)null) && !IsLockedFromExternal(controller) && IsTargetAllowed(controller, options.AllowedTargets)) { controller.DispatchShrink(options); } } public static bool ApplyIfNotScaled(GameObject target) { return ApplyIfNotScaled(target, ScaleOptions.Default); } public static bool ApplyIfNotScaled(GameObject target, ScaleOptions options) { ScaleController controller = GetController(target); if ((Object)(object)controller == (Object)null || controller.IsScaled) { return false; } if (IsLockedFromExternal(controller)) { return false; } if (!IsTargetAllowed(controller, options.AllowedTargets)) { return false; } controller.DispatchShrink(options); return true; } public static void ForceApply(GameObject target, ScaleOptions options) { ScaleController controller = GetController(target); if (!((Object)(object)controller == (Object)null) && IsTargetAllowed(controller, options.AllowedTargets)) { controller.DispatchShrink(options); } } public static ScaleController? GetController(GameObject target) { ScaleController scaleController = target.GetComponent(); if (scaleController == null) { PlayerShrinkLink component = target.GetComponent(); if (component == null) { return null; } scaleController = component.Controller; } return scaleController; } public static void Restore(GameObject target) { ScaleController controller = GetController(target); if (!((Object)(object)controller == (Object)null) && !IsLockedFromExternal(controller)) { controller.DispatchExpand(); } } public static void RestoreImmediate(GameObject target) { ScaleController controller = GetController(target); if (!((Object)(object)controller == (Object)null) && !IsLockedFromExternal(controller)) { controller.DispatchExpandNow(); } } public static void ForceRestore(GameObject target) { ScaleController controller = GetController(target); if (!((Object)(object)controller == (Object)null)) { controller.DispatchExpand(); } } public static bool UpdateOptions(GameObject target, ScaleOptions options) { ScaleController controller = GetController(target); if ((Object)(object)controller == (Object)null || !controller.IsScaled) { return false; } if (IsLockedFromExternal(controller)) { return false; } controller._options = options; return true; } public static bool ForceUpdateOptions(GameObject target, ScaleOptions options) { ScaleController controller = GetController(target); if ((Object)(object)controller == (Object)null || !controller.IsScaled) { return false; } controller._options = options; return true; } public static bool IsScaled(GameObject target) { ScaleController controller = GetController(target); if ((Object)(object)controller != (Object)null) { return controller.IsScaled; } return false; } public static void CleanupAll() { ScaleController.CleanupAll(); } private static bool IsTargetAllowed(ScaleController ctrl, ScaleTargets allowed) { IScaleHandler handler = ctrl.Handler; if (!(handler is PlayerHandler)) { if (!(handler is EnemyHandler)) { if (handler is ItemHandler || handler is VehicleHandler) { return (allowed & ScaleTargets.Items) != 0; } return (allowed & ScaleTargets.Valuables) != 0; } return (allowed & ScaleTargets.Enemies) != 0; } return (allowed & ScaleTargets.Players) != 0; } private static bool IsLockedFromExternal(ScaleController ctrl) { if (ctrl.IsScaled) { return ctrl._options.RejectExternalApply; } return false; } } [Flags] public enum ScaleTargets { None = 0, Players = 1, Enemies = 2, Items = 4, Valuables = 8, All = 0xF } public struct ScaleOptions { public float Factor; public float Duration; public float Speed; public float RestoreSpeed; public float BonkImmuneDuration; public float MassCap; public float SpeedFactor; public float AnimSpeedMultiplier; public float FootstepPitchMultiplier; public ScaleTargets AllowedTargets; public bool InvertedMode; public bool SuppressValueDropExpand; public bool PreserveMass; public bool SuppressImpactFlash; public bool SuppressCameraShake; public bool SuppressVoicePitch; public bool IgnoreBonkExpand; public bool RejectExternalApply; public static ScaleOptions Default { get { ScaleOptions result = default(ScaleOptions); result.Factor = 0.4f; result.Duration = 0f; result.Speed = 2f; result.RestoreSpeed = 0f; result.BonkImmuneDuration = 5f; result.MassCap = 50f; result.SpeedFactor = 0.75f; result.AnimSpeedMultiplier = 1.5f; result.FootstepPitchMultiplier = 1.5f; result.AllowedTargets = ScaleTargets.All; result.InvertedMode = false; result.SuppressValueDropExpand = false; result.PreserveMass = false; result.SuppressImpactFlash = false; result.SuppressCameraShake = false; result.SuppressVoicePitch = false; result.IgnoreBonkExpand = false; result.RejectExternalApply = false; return result; } } } } namespace ScalerCore.Utilities { internal class AudioPitchHelper { private Sound[]? _pitchedSounds; private float[]? _soundOriginalPitch; private float[]? _soundOriginalLoopPitch; private static Sound[] GatherSounds(Component root) { List list = new List(); MonoBehaviour[] componentsInChildren = root.GetComponentsInChildren(true); foreach (MonoBehaviour val in componentsInChildren) { if ((Object)(object)val == (Object)null) { continue; } foreach (FieldInfo item in from f in ((object)val).GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) where f.FieldType == typeof(Sound) select f) { object? value = item.GetValue(val); Sound val2 = (Sound)((value is Sound) ? value : null); if (val2 != null && !list.Contains(val2)) { list.Add(val2); } } } return list.ToArray(); } internal void ApplyPitch(Component searchRoot, float factor) { float num = 1f + (1f - factor) * 0.5f; _pitchedSounds = GatherSounds(searchRoot); _soundOriginalPitch = _pitchedSounds.Select((Sound s) => s.Pitch).ToArray(); _soundOriginalLoopPitch = _pitchedSounds.Select((Sound s) => s.LoopPitch).ToArray(); for (int i = 0; i < _pitchedSounds.Length; i++) { Sound val = _pitchedSounds[i]; val.Pitch = _soundOriginalPitch[i] * num; float num2 = _soundOriginalLoopPitch[i]; val.LoopPitch = num2 * num; if ((Object)(object)val.Source != (Object)null && val.Source.isPlaying) { AudioSource source = val.Source; source.pitch *= num; } } Plugin.Log.LogDebug((object)$"[SC] sound pitch x{num:F2} on {_pitchedSounds.Length} Sound objects under {((Object)searchRoot.gameObject).name}"); } internal void RestorePitch() { if (_pitchedSounds == null) { return; } for (int i = 0; i < _pitchedSounds.Length; i++) { Sound val = _pitchedSounds[i]; if (val != null) { val.Pitch = _soundOriginalPitch[i]; val.LoopPitch = _soundOriginalLoopPitch[i]; if ((Object)(object)val.Source != (Object)null && val.Source.isPlaying) { val.Source.pitch = _soundOriginalLoopPitch[i]; } } } _pitchedSounds = null; _soundOriginalPitch = null; _soundOriginalLoopPitch = null; } } } namespace ScalerCore.Patches { internal static class EnemyPatchHelpers { internal static bool TryGetScaled(EnemyNavMeshAgent agent, out ScaleController? ctrl) { EnemyParent componentInParent = ((Component)agent).GetComponentInParent(); ctrl = ((componentInParent != null) ? ((Component)componentInParent).GetComponentInChildren() : null); if ((Object)(object)ctrl != (Object)null) { return ctrl.IsScaled; } return false; } } [HarmonyPatch(typeof(EnemyNavMeshAgent), "OverrideAgent")] internal static class NavOverrideSpeedPatch { private static void Prefix(EnemyNavMeshAgent __instance, ref float speed) { if (EnemyPatchHelpers.TryGetScaled(__instance, out ScaleController ctrl)) { speed *= ctrl._options.SpeedFactor; } } } [HarmonyPatch(typeof(EnemyNavMeshAgent), "UpdateAgent")] internal static class NavUpdateSpeedPatch { private static void Prefix(EnemyNavMeshAgent __instance, ref float speed) { if (EnemyPatchHelpers.TryGetScaled(__instance, out ScaleController ctrl)) { speed *= ctrl._options.SpeedFactor; } } } [HarmonyPatch(typeof(EnemyFloater), "UpdateState")] internal static class FloaterChargeMoveInPatch { private static void Postfix(EnemyFloater __instance) { //IL_0047: 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_0086: Unknown result type (might be due to invalid IL or missing references) Enemy enemy = __instance.enemy; object obj; if (enemy == null) { obj = null; } else { EnemyRigidbody rigidbody = enemy.Rigidbody; obj = ((rigidbody != null) ? ((Component)rigidbody).GetComponent() : null); } ScaleController scaleController = (ScaleController)obj; if ((Object)(object)scaleController == (Object)null || !scaleController.IsScaled) { return; } PlayerAvatar targetPlayer = __instance.targetPlayer; if (Object.op_Implicit((Object)(object)targetPlayer) && !(Vector3.Distance(__instance.feetTransform.position, ((Component)targetPlayer).transform.position) <= scaleController._options.Factor * 4f)) { Enemy enemy2 = __instance.enemy; if (enemy2 != null) { enemy2.NavMeshAgent.SetDestination(((Component)targetPlayer).transform.position); } } } } [HarmonyPatch(typeof(HurtCollider), "PlayerHurt")] internal static class KnockbackPatch { private static void Prefix(HurtCollider __instance, out (bool playerKill, int playerDamage, int tumbleDamage, float force, float torque) __state) { __state = (__instance.playerKill, __instance.playerDamage, __instance.playerTumbleImpactHurtDamage, __instance.playerTumbleForce, __instance.playerTumbleTorque); ScaleController scaleController = null; if ((Object)(object)__instance.enemyHost != (Object)null) { EnemyRigidbody rigidbody = __instance.enemyHost.Rigidbody; scaleController = ((rigidbody != null) ? ((Component)rigidbody).GetComponent() : null); } else { EnemyParent componentInParent = ((Component)__instance).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { scaleController = ((Component)componentInParent).GetComponentInChildren(); } } if (!((Object)(object)scaleController == (Object)null) && scaleController.IsScaled) { if (scaleController._options.Factor < 1f) { __instance.playerKill = false; } __instance.playerDamage = Mathf.RoundToInt((float)__instance.playerDamage * scaleController._options.Factor); __instance.playerTumbleImpactHurtDamage = Mathf.RoundToInt((float)__instance.playerTumbleImpactHurtDamage * scaleController._options.Factor); __instance.playerTumbleForce *= scaleController._options.Factor; __instance.playerTumbleTorque *= scaleController._options.Factor; } } private static void Postfix(HurtCollider __instance, (bool playerKill, int playerDamage, int tumbleDamage, float force, float torque) __state) { (__instance.playerKill, __instance.playerDamage, __instance.playerTumbleImpactHurtDamage, __instance.playerTumbleForce, __instance.playerTumbleTorque) = __state; } } [HarmonyPatch(typeof(EnemyHeartHuggerGasGuider), "Update")] internal static class HeartHuggerGasPullPatch { private static void Postfix(EnemyHeartHuggerGasGuider __instance) { //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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__instance.enemyHeartHugger == (Object)null)) { Enemy enemy = __instance.enemyHeartHugger.enemy; object obj; if (enemy == null) { obj = null; } else { EnemyRigidbody rigidbody = enemy.Rigidbody; obj = ((rigidbody != null) ? ((Component)rigidbody).GetComponent() : null); } ScaleController scaleController = (ScaleController)obj; if (!((Object)(object)scaleController == (Object)null) && scaleController.IsScaled) { Vector3 position = __instance.enemyHeartHugger.headCenterTransform.position; Vector3 val = ((Component)__instance).transform.position - position; ((Component)__instance).transform.position = position + val * scaleController._options.Factor; } } } } [HarmonyPatch(typeof(EnemyHealth), "Hurt")] internal static class EnemyBonkPatch { private static void Postfix(EnemyHealth __instance) { if (SemiFunc.IsMasterClientOrSingleplayer()) { Enemy enemy = __instance.enemy; object obj; if (enemy == null) { obj = null; } else { EnemyRigidbody rigidbody = enemy.Rigidbody; obj = ((rigidbody != null) ? ((Component)rigidbody).GetComponent() : null); } ScaleController scaleController = (ScaleController)obj; if (!((Object)(object)scaleController == (Object)null) && scaleController.IsScaled && !(scaleController._options.Factor >= 1f)) { scaleController.DispatchExpandNow(); } } } } [HarmonyPatch] internal static class EnemyVisionShrunkCrouchPatch { [CompilerGenerated] private sealed class d__1 : IEnumerable, IEnumerable, IEnumerator, IEnumerator, IDisposable { private int <>1__state; private CodeInstruction <>2__current; private int <>l__initialThreadId; private IEnumerable instructions; public IEnumerable <>3__instructions; private FieldInfo 5__2; private MethodInfo 5__3; private IEnumerator <>7__wrap3; CodeInstruction IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__1(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 1) <= 1u) { try { } finally { <>m__Finally1(); } } 5__2 = null; 5__3 = null; <>7__wrap3 = null; <>1__state = -2; } private bool MoveNext() { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__2 = AccessTools.Field(typeof(PlayerAvatar), "isCrouching"); 5__3 = AccessTools.Method(typeof(EnemyVisionShrunkCrouchPatch), "IsEffectivelyCrouching", (Type[])null, (Type[])null); <>7__wrap3 = instructions.GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -3; break; case 2: <>1__state = -3; break; } if (<>7__wrap3.MoveNext()) { CodeInstruction current = <>7__wrap3.Current; if (current.opcode == OpCodes.Ldfld && current.operand is FieldInfo fieldInfo && fieldInfo == 5__2) { <>2__current = new CodeInstruction(OpCodes.Call, (object)5__3); <>1__state = 1; return true; } <>2__current = current; <>1__state = 2; return true; } <>m__Finally1(); <>7__wrap3 = null; return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>7__wrap3 != null) { <>7__wrap3.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__1 d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; d__ = this; } else { d__ = new d__1(0); } d__.instructions = <>3__instructions; return d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } private static MethodBase TargetMethod() { Type type = typeof(EnemyVision).GetNestedTypes(BindingFlags.NonPublic).FirstOrDefault((Type t) => t.Name.StartsWith("")); if (type == null) { Plugin.Log.LogWarning((object)"[SC] EnemyVisionShrunkCrouchPatch: could not find Vision coroutine state machine"); return null; } return AccessTools.Method(type, "MoveNext", (Type[])null, (Type[])null); } [IteratorStateMachine(typeof(d__1))] private static IEnumerable Transpiler(IEnumerable instructions) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__1(-2) { <>3__instructions = instructions }; } internal static bool IsEffectivelyCrouching(PlayerAvatar pa) { if (pa.isCrouching) { return true; } ScaleController component = ((Component)pa).GetComponent(); if ((Object)(object)component != (Object)null && component.IsScaled) { return component._options.Factor < 1f; } return false; } } } namespace ScalerCore.Handlers { internal class CartHandler : IScaleHandler { internal sealed class State { internal PhysGrabCart Cart; internal bool AddedEquippable; } public void Setup(ScaleController ctrl) { PhysGrabCart component = ((Component)ctrl).GetComponent(); if (!((Object)(object)component == (Object)null)) { ctrl.HandlerState = new State { Cart = component }; } } public void OnScale(ScaleController ctrl) { State state = (State)ctrl.HandlerState; if (state != null) { state.AddedEquippable = PocketHelper.InjectEquippable(ctrl); } } public void OnRestore(ScaleController ctrl, bool isBonk) { State state = (State)ctrl.HandlerState; if (state != null && state.AddedEquippable) { PocketHelper.RemoveEquippable(ctrl); state.AddedEquippable = false; } } public void OnUpdate(ScaleController ctrl) { } public void OnLateUpdate(ScaleController ctrl) { } public void OnDestroy(ScaleController ctrl) { } } internal class CosmeticHandler : IScaleHandler { internal sealed class State { internal NotValuableObject NotValuable; internal int LastKnownHealth = -1; } public void Setup(ScaleController ctrl) { NotValuableObject component = ((Component)ctrl).GetComponent(); if (!((Object)(object)component == (Object)null)) { ctrl.HandlerState = new State { NotValuable = component }; } } public void OnScale(ScaleController ctrl) { State state = (State)ctrl.HandlerState; if (state != null) { state.LastKnownHealth = state.NotValuable.healthCurrent; } } public void OnRestore(ScaleController ctrl, bool isBonk) { State state = (State)ctrl.HandlerState; if (state != null) { state.LastKnownHealth = -1; } } public void OnUpdate(ScaleController ctrl) { State state = (State)ctrl.HandlerState; if (state != null && !ctrl._options.SuppressValueDropExpand) { int healthCurrent = state.NotValuable.healthCurrent; if (ctrl._bonkImmuneTimer > 0f) { state.LastKnownHealth = healthCurrent; } else if (state.LastKnownHealth >= 0 && healthCurrent < state.LastKnownHealth) { Plugin.Log.LogDebug((object)$"[SC] HEALTH DROP {ctrl._displayName} {state.LastKnownHealth} -> {healthCurrent} -> bonk expand"); state.LastKnownHealth = -1; ctrl.DispatchExpandNow(); } else { state.LastKnownHealth = healthCurrent; } } } public void OnLateUpdate(ScaleController ctrl) { } public void OnDestroy(ScaleController ctrl) { } } internal class DoorHandler : IScaleHandler { internal sealed class State { internal PhysGrabHinge Hinge; internal bool ShouldBreakOnShrink; } private const float AnchorDistanceThreshold = 1f; public void Setup(ScaleController ctrl) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) PhysGrabHinge component = ((Component)ctrl).GetComponent(); if (!((Object)(object)component == (Object)null)) { State state = new State { Hinge = component }; if ((Object)(object)component.hingePoint != (Object)null) { Vector3 localPosition = component.hingePoint.localPosition; float magnitude = ((Vector3)(ref localPosition)).magnitude; bool flag = component.wallTagObjects != null && component.wallTagObjects.Length != 0; state.ShouldBreakOnShrink = magnitude > 1f && flag; ManualLogSource log = Plugin.Log; string text = $"[SC] Door: hingeAnchorDist={magnitude:F3}"; GameObject[] wallTagObjects = component.wallTagObjects; log.LogDebug((object)(text + $" wallTags={((wallTagObjects != null) ? wallTagObjects.Length : 0)}" + $" willBreak={state.ShouldBreakOnShrink}" + $" broken={component.broken} dead={component.dead}")); } ctrl.HandlerState = state; } } public void OnScale(ScaleController ctrl) { State state = (State)ctrl.HandlerState; if (state != null && state.ShouldBreakOnShrink && !state.Hinge.broken && !state.Hinge.dead) { Plugin.Log.LogDebug((object)("[SC] Door: breaking hinge on " + ctrl._displayName + " (anchor too far from origin)")); state.Hinge.HingeBreakImpulse(); if ((Object)(object)state.Hinge.joint != (Object)null) { Object.Destroy((Object)(object)state.Hinge.joint); state.Hinge.joint = null; } } } public void OnRestore(ScaleController ctrl, bool isBonk) { } public void OnUpdate(ScaleController ctrl) { } public void OnLateUpdate(ScaleController ctrl) { } public void OnDestroy(ScaleController ctrl) { } } internal class EnemyHandler : IScaleHandler { internal sealed class State { internal EnemyRigidbody EnemyRb; internal EnemyNavMeshAgent? NavAgent; internal Transform? AnimTarget; internal Vector3 AnimOriginalScale; internal Vector3 AnimOriginalLocalPos; internal EnemyBombThrowerHead? BtHead; internal Vector3 BtHeadOriginalScale; internal Vector3 RbOriginalLocalPos; internal float OriginalDefaultSpeed; internal float OriginalAgentRadius; internal float OriginalSpeedChase; internal float OriginalSpeedIdle; internal float OriginalRotSpeedChase; internal float OriginalRotSpeedIdle; internal GrabForce? OriginalGrabForce; internal GrabForce? MiniGrabForce; internal bool OriginalsCaptured; internal IEnemyVisualHandler? VisualHandler; internal object? VisualState; } public void Setup(ScaleController ctrl) { //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: 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_01bb: Expected O, but got Unknown //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown EnemyParent componentInParent = ((Component)ctrl).GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null) { return; } State state = new State(); Transform bestVisual = null; int bestRenderers = 0; Animator[] componentsInChildren = ((Component)componentInParent).GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { CheckVisualGO(((Component)componentsInChildren[i]).gameObject); } BotSystemSpringPoseAnimator[] componentsInChildren2 = ((Component)componentInParent).GetComponentsInChildren(); for (int i = 0; i < componentsInChildren2.Length; i++) { CheckVisualGO(((Component)componentsInChildren2[i]).gameObject); } while ((Object)(object)bestVisual != (Object)null && (Object)(object)bestVisual.parent != (Object)null && (Object)(object)bestVisual.parent != (Object)(object)((Component)componentInParent).transform) { int num = ((Component)bestVisual).GetComponentsInChildren().Length; if (((Component)bestVisual.parent).GetComponentsInChildren().Length <= num) { break; } bool flag = false; foreach (Transform item in bestVisual.parent) { Transform val = item; if (!((Object)(object)val == (Object)(object)bestVisual)) { Animator component = ((Component)val).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component.runtimeAnimatorController != (Object)null) { flag = true; break; } if ((Object)(object)((Component)val).GetComponent() != (Object)null) { flag = true; break; } } } if (flag) { break; } bestVisual = bestVisual.parent; } if ((Object)(object)bestVisual == (Object)null) { foreach (Transform item2 in ((Component)componentInParent).transform) { Transform val2 = item2; if (!((Object)(object)val2 == (Object)(object)ctrl._t) && !((Object)(object)((Component)val2).GetComponent() != (Object)null) && !((Object)(object)((Component)val2).GetComponent() != (Object)null)) { int num2 = ((Component)val2).GetComponentsInChildren().Length; if (num2 > bestRenderers) { bestRenderers = num2; bestVisual = val2; } } } } if ((Object)(object)bestVisual != (Object)null) { state.AnimTarget = bestVisual; state.AnimOriginalScale = state.AnimTarget.localScale; state.AnimOriginalLocalPos = state.AnimTarget.localPosition; } state.NavAgent = ((Component)componentInParent).GetComponentInChildren(); state.EnemyRb = ((Component)ctrl).GetComponent(); EnemyBombThrowerHead componentInChildren = ((Component)componentInParent).GetComponentInChildren(true); if ((Object)(object)componentInChildren != (Object)null) { state.BtHead = componentInChildren; state.BtHeadOriginalScale = ((Component)componentInChildren).transform.localScale; } ctrl._physGrabObject = ((Component)ctrl).GetComponent(); state.RbOriginalLocalPos = ctrl._t.localPosition; string text = EnemyVisualRegistry.ExtractEnemyName(componentInParent); state.VisualHandler = EnemyVisualRegistry.Resolve(text); state.VisualState = state.VisualHandler.Setup(ctrl, state, componentInParent); Plugin.Log.LogDebug((object)("[SC] visualHandler=" + state.VisualHandler.GetType().Name + " for '" + text + "'")); ctrl.HandlerState = state; void CheckVisualGO(GameObject go) { if (!((Object)(object)go.GetComponent() != (Object)null) && !((Object)(object)go.GetComponentInChildren() == (Object)null)) { Animator component2 = go.GetComponent(); if (!((Object)(object)component2 != (Object)null) || !((Object)(object)component2.runtimeAnimatorController == (Object)null)) { int num3 = go.GetComponentsInChildren().Length; if (num3 > bestRenderers) { bestRenderers = num3; bestVisual = go.transform; } } } } } public void OnScale(ScaleController ctrl) { State state = (State)ctrl.HandlerState; if (state == null) { return; } if ((Object)(object)state.NavAgent != (Object)null) { state.OriginalDefaultSpeed = state.NavAgent.DefaultSpeed; state.NavAgent.DefaultSpeed = state.OriginalDefaultSpeed * ctrl._options.SpeedFactor; NavMeshAgent agent = state.NavAgent.Agent; if ((Object)(object)agent != (Object)null) { agent.speed *= ctrl._options.SpeedFactor; state.OriginalAgentRadius = agent.radius; agent.radius *= ctrl._options.Factor; Plugin.Log.LogDebug((object)$"[SC] navSpeed {state.OriginalDefaultSpeed:F2} → {state.NavAgent.DefaultSpeed:F2} radius {state.OriginalAgentRadius:F2} → {agent.radius:F2}"); } } if ((Object)(object)state.EnemyRb != (Object)null) { state.OriginalGrabForce = state.EnemyRb.grabForceNeeded; state.MiniGrabForce = ScriptableObject.CreateInstance(); float num = (((Object)(object)state.OriginalGrabForce != (Object)null) ? state.OriginalGrabForce.amount : 0f); state.MiniGrabForce.amount = num * ctrl._options.Factor; state.EnemyRb.grabForceNeeded = state.MiniGrabForce; state.OriginalSpeedChase = state.EnemyRb.positionSpeedChase; state.OriginalSpeedIdle = state.EnemyRb.positionSpeedIdle; state.OriginalRotSpeedChase = state.EnemyRb.rotationSpeedChase; state.OriginalRotSpeedIdle = state.EnemyRb.rotationSpeedIdle; float num2 = ctrl._options.Factor * ctrl._options.Factor; state.EnemyRb.positionSpeedChase = state.OriginalSpeedChase * num2; state.EnemyRb.positionSpeedIdle = state.OriginalSpeedIdle * num2; state.EnemyRb.rotationSpeedChase = state.OriginalRotSpeedChase * num2; state.EnemyRb.rotationSpeedIdle = state.OriginalRotSpeedIdle * num2; Plugin.Log.LogDebug((object)$"[SC] grabForce {num:F2} → {state.MiniGrabForce.amount:F2}"); Plugin.Log.LogDebug((object)$"[SC] posSpeedChase {state.OriginalSpeedChase:F2} → {state.EnemyRb.positionSpeedChase:F2} posSpeedIdle {state.OriginalSpeedIdle:F2} → {state.EnemyRb.positionSpeedIdle:F2}"); } state.OriginalsCaptured = true; } public void OnRestore(ScaleController ctrl, bool isBonk) { //IL_010c: Unknown result type (might be due to invalid IL or missing references) State state = (State)ctrl.HandlerState; if (state == null) { return; } if ((Object)(object)state.NavAgent != (Object)null) { NavMeshAgent agent = state.NavAgent.Agent; Plugin.Log.LogDebug((object)string.Format("[SC] EXPAND{0} navSpeed {1} → {2:F2} radius {3} → {4:F2}", isBonk ? "(bonk)" : "", ((Object)(object)agent != (Object)null) ? agent.speed.ToString("F2") : "N/A", state.OriginalDefaultSpeed, ((Object)(object)agent != (Object)null) ? agent.radius.ToString("F2") : "N/A", state.OriginalAgentRadius)); state.NavAgent.DefaultSpeed = state.OriginalDefaultSpeed; NavMeshAgent agent2 = state.NavAgent.Agent; if ((Object)(object)agent2 != (Object)null) { agent2.speed = state.OriginalDefaultSpeed; agent2.radius = state.OriginalAgentRadius; if (isBonk && agent2.isOnNavMesh) { agent2.Warp(agent2.nextPosition); } } } if ((Object)(object)state.EnemyRb != (Object)null) { Plugin.Log.LogDebug((object)string.Format("[SC] EXPAND{0} posSpeedChase {1:F2} → {2:F2} posSpeedIdle {3:F2} → {4:F2}", isBonk ? "(bonk)" : "", state.EnemyRb.positionSpeedChase, state.OriginalSpeedChase, state.EnemyRb.positionSpeedIdle, state.OriginalSpeedIdle)); if ((Object)(object)state.OriginalGrabForce != (Object)null) { state.EnemyRb.grabForceNeeded = state.OriginalGrabForce; } if ((Object)(object)state.MiniGrabForce != (Object)null) { Object.Destroy((Object)(object)state.MiniGrabForce); state.MiniGrabForce = null; } state.EnemyRb.positionSpeedChase = state.OriginalSpeedChase; state.EnemyRb.positionSpeedIdle = state.OriginalSpeedIdle; state.EnemyRb.rotationSpeedChase = state.OriginalRotSpeedChase; state.EnemyRb.rotationSpeedIdle = state.OriginalRotSpeedIdle; } if (isBonk || !ctrl._transitioning) { state.VisualHandler?.OnRestore(ctrl, state, state.VisualState); } } public void OnUpdate(ScaleController ctrl) { if ((Object)(object)ctrl._rb != (Object)null && !ctrl._options.PreserveMass) { float num = Mathf.Clamp(ctrl._originalMass * ctrl._options.Factor, 0.5f, ctrl._options.MassCap); if (Mathf.Abs(ctrl._rb.mass - num) > 0.001f) { ctrl._rb.mass = num; } } if (ctrl._options.Factor < 1f && (Object)(object)ctrl._physGrabObject != (Object)null && ctrl._physGrabObject.playerGrabbing.Count > 0) { ctrl._physGrabObject.OverrideMinGrabStrength(5f, 0.1f); } } public void OnLateUpdate(ScaleController ctrl) { //IL_0011: 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) State state = (State)ctrl.HandlerState; if (state != null && ctrl.OriginalScale.x != 0f && (ctrl.IsScaled || ctrl._transitioning)) { float ratio = ctrl._animScale.x / ctrl.OriginalScale.x; if (state.VisualHandler != null) { state.VisualHandler.OnLateUpdate(ctrl, state, state.VisualState, ratio); } } } public void OnDestroy(ScaleController ctrl) { State state = (State)ctrl.HandlerState; if (state != null && state.VisualHandler != null) { state.VisualHandler.OnRestore(ctrl, state, state.VisualState); } } } internal interface IEnemyVisualHandler { object? Setup(ScaleController ctrl, EnemyHandler.State state, EnemyParent ep); void OnLateUpdate(ScaleController ctrl, EnemyHandler.State state, object? visualState, float ratio); void OnRestore(ScaleController ctrl, EnemyHandler.State state, object? visualState); } internal static class EnemyVisualRegistry { private static readonly Dictionary _overrides = new Dictionary(); private static readonly IEnemyVisualHandler _default = new DefaultVisualHandler(); private static bool _registered; internal static string ExtractEnemyName(EnemyParent ep) { string text = ((Object)((Component)ep).gameObject).name; int num = text.IndexOf("(Clone)"); if (num >= 0) { text = text.Substring(0, num); } if (text.StartsWith("Enemy - ")) { text = text.Substring("Enemy - ".Length); } return text.Trim(); } internal static IEnemyVisualHandler Resolve(string enemyName) { EnsureRegistered(); if (!_overrides.TryGetValue(enemyName, out IEnemyVisualHandler value)) { return _default; } return value; } private static void EnsureRegistered() { if (!_registered) { _registered = true; SinkerVisualHandler value = new SinkerVisualHandler(); HeartHuggerVisualHandler value2 = new HeartHuggerVisualHandler(); LoomVisualHandler value3 = new LoomVisualHandler(); TricycleVisualHandler value4 = new TricycleVisualHandler(); BirthdayBoyVisualHandler value5 = new BirthdayBoyVisualHandler(); _overrides["Tumbler"] = value; _overrides["Floater"] = value; _overrides["Runner"] = value; _overrides["Slow Walker"] = value; _overrides["Elsa"] = value; _overrides["Heart Hugger"] = value2; _overrides["Shadow"] = value3; _overrides["Tricycle"] = value4; _overrides["Birthday boy"] = value5; } } } public interface IScaleHandler { void Setup(ScaleController ctrl); void OnScale(ScaleController ctrl); void OnRestore(ScaleController ctrl, bool isBonk); void OnUpdate(ScaleController ctrl); void OnLateUpdate(ScaleController ctrl); void OnDestroy(ScaleController ctrl); } internal class ItemHandler : IScaleHandler { internal struct ScaledField { public object comp; public FieldInfo field; public float original; } internal sealed class State { internal ItemOrb? ItemOrb; internal bool AddedEquippable; } private static readonly string[] _floatFieldsToScale = new string[9] { "explosionSize", "explosionForceMultiplier", "orbRadiusMultiplier", "maxSpeedKmh", "softMaxSpeedKmh", "maxForwardSpeed", "maxReverseSpeed", "hyperMaxSpeed", "bikeForwardSpeed" }; private static readonly string[] _intFieldsToScale = new string[2] { "explosionDamage", "explosionDamageEnemy" }; private static readonly string[] _soFieldNames = new string[1] { "explosionPreset" }; public void Setup(ScaleController ctrl) { State state = new State(); state.ItemOrb = ((Component)ctrl).GetComponent(); ctrl.HandlerState = state; } public void OnScale(ScaleController ctrl) { State state = (State)ctrl.HandlerState; if (state != null) { state.AddedEquippable = PocketHelper.InjectEquippable(ctrl); } } public void OnRestore(ScaleController ctrl, bool isBonk) { State state = (State)ctrl.HandlerState; if (state != null && state.AddedEquippable) { PocketHelper.RemoveEquippable(ctrl); state.AddedEquippable = false; } } public void OnUpdate(ScaleController ctrl) { State state = (State)ctrl.HandlerState; if ((Object)(object)state?.ItemOrb != (Object)null) { OnUpdateOrb(state.ItemOrb, ctrl._options.Factor); } } public void OnLateUpdate(ScaleController ctrl) { } public void OnDestroy(ScaleController ctrl) { } internal static List? OnShrinkFields(ScaleController ctrl, float factor) { List list = new List(); List list2 = new List(); MonoBehaviour[] components = ((Component)ctrl).GetComponents(); foreach (MonoBehaviour val in components) { if ((Object)(object)val == (Object)null || (Object)(object)val == (Object)(object)ctrl) { continue; } list2.Add(val); Type type = ((object)val).GetType(); string[] soFieldNames = _soFieldNames; foreach (string text in soFieldNames) { FieldInfo field = type.GetField(text, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (!(field == null)) { object value = field.GetValue(val); if (value != null) { list2.Add(value); Plugin.Log.LogDebug((object)("[SC] following SO ref " + type.Name + "." + text + " -> " + value.GetType().Name)); } } } } foreach (object item in list2) { Type type2 = item.GetType(); string[] soFieldNames = _floatFieldsToScale; foreach (string text2 in soFieldNames) { FieldInfo field2 = type2.GetField(text2, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (!(field2 == null) && !(field2.FieldType != typeof(float))) { float num = (float)field2.GetValue(item); list.Add(new ScaledField { comp = item, field = field2, original = num }); field2.SetValue(item, num * factor); Plugin.Log.LogDebug((object)$"[SC] itemField {type2.Name}.{text2} {num:F2} -> {num * factor:F2}"); } } soFieldNames = _intFieldsToScale; foreach (string text3 in soFieldNames) { FieldInfo field3 = type2.GetField(text3, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (!(field3 == null) && !(field3.FieldType != typeof(int))) { int num2 = (int)field3.GetValue(item); int num3 = Mathf.RoundToInt((float)num2 * factor); list.Add(new ScaledField { comp = item, field = field3, original = num2 }); field3.SetValue(item, num3); Plugin.Log.LogDebug((object)$"[SC] itemField {type2.Name}.{text3} {num2} -> {num3}"); } } } if (list.Count == 0) { Plugin.Log.LogDebug((object)("[SC] itemField scan: no scalable fields found on " + ((Object)((Component)ctrl).gameObject).name)); return null; } return list; } internal static void OnRestoreFields(List? scaledFields) { if (scaledFields == null) { return; } foreach (ScaledField scaledField in scaledFields) { if (scaledField.comp != null) { if (scaledField.field.FieldType == typeof(int)) { scaledField.field.SetValue(scaledField.comp, (int)scaledField.original); } else { scaledField.field.SetValue(scaledField.comp, scaledField.original); } } } } internal static void OnUpdateOrb(ItemOrb itemOrb, float factor) { itemOrb.orbRadius = itemOrb.orbRadiusOriginal * factor; } } internal class PlayerHandler : IScaleHandler { internal sealed class State { internal PlayerAvatar PlayerAvatar; internal PlayerExpression? PlayerExpression; internal Vector3 OriginalCamOffset; internal float OriginalCrouchPos; internal float OriginalCrawlPos; internal CameraCrawlPosition? CameraCrawl; internal PlayerVisionTarget? VisionTarget; internal float VisionStandPos; internal float VisionCrouchPos; internal float VisionCrawlPos; internal CapsuleCollider? StandCheckCollider; internal float OriginalStandCheckHeight; internal float OriginalStandCheckRadius; internal Vector3 OriginalStandCheckOffset; internal Vector3 OriginalStandCollision; internal Vector3 OriginalCrouchCollision; internal float OriginalGrabMinDist; internal float OriginalGrabMaxDist; internal float OriginalFOV; internal float OriginalNearClip; internal bool WasExpressing; internal float TumbleFollowOriginalY = float.NaN; internal bool WasTumbling; internal Transform? MenuAvatarTransform; internal Vector3 MenuAvatarOriginalScale; internal PlayerAvatar? MenuPlayerAvatar; internal PlayerExpression? MenuExpression; internal PlayerEyes? MenuEyes; internal bool LocalEffectsApplied; } public const float Multiplier = 3f; public const int Priority = 4; public const float SpringSpeedIn = 3f; public const float SpringDampIn = 0.5f; public const float SpringSpeedOut = 5f; public const float SpringDampOut = 0.5f; public const float PupilReturnSpeed = 3f; private static (float strength, float range) GetGrabFactors(float factor) { float num = factor * 1.5f; float num2 = ((factor < 1f) ? 1f : 2f); return (Mathf.Clamp(num, 0.6f, num2), factor); } public void Setup(ScaleController ctrl) { //IL_0044: 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_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) PlayerAvatar component = ((Component)ctrl).GetComponent(); if (!((Object)(object)component == (Object)null)) { State state = new State { PlayerAvatar = component }; if ((Object)(object)component.playerAvatarVisuals != (Object)null) { ctrl._t = ((Component)component.playerAvatarVisuals).transform; ctrl.OriginalScale = ctrl._t.localScale; ctrl._target = ctrl.OriginalScale; ctrl._animScale = ctrl.OriginalScale; state.PlayerExpression = ((Component)component.playerAvatarVisuals).GetComponent(); } PlayerAvatarCollision component2 = ((Component)component).GetComponent(); if ((Object)(object)component2?.CollisionTransform != (Object)null) { (((Component)component2.CollisionTransform).GetComponent() ?? ((Component)component2.CollisionTransform).gameObject.AddComponent()).Controller = ctrl; Plugin.Log.LogDebug((object)("[SC] PlayerShrinkLink attached → " + ((Object)((Component)component2.CollisionTransform).gameObject).name + " colliderGO=" + (((Object)(object)component2.Collider != (Object)null) ? ((Object)((Component)component2.Collider).gameObject).name : "null") + " avatar=" + ((Object)((Component)ctrl).gameObject).name)); } else { Plugin.Log.LogWarning((object)$"[SC] PlayerShrinkLink SKIP pac={(Object)(object)component2 != (Object)null} collisionXform={(Object)(object)component2?.CollisionTransform != (Object)null} avatar={((Object)((Component)ctrl).gameObject).name}"); } ctrl.HandlerState = state; } } public void OnScale(ScaleController ctrl) { //IL_0037: 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) State state = (State)ctrl.HandlerState; if (state == null) { return; } if (!ctrl._options.SuppressVoicePitch) { if ((Object)(object)state.PlayerAvatar.voiceChat != (Object)null) { float num = ((ctrl.OriginalScale.x > 0f) ? (ctrl._target.x / ctrl.OriginalScale.x) : ctrl._options.Factor); float num2 = 1f + (1f - num) * 0.5f; state.PlayerAvatar.voiceChat.OverridePitch(num2, 0.2f, 0.5f, 9999f, 0f, 0f); ManualLogSource log = Plugin.Log; object[] obj = new object[4] { ctrl._displayName, num2, state.PlayerAvatar.isLocal, null }; PhotonView? networkPV = ctrl._networkPV; obj[3] = ((networkPV != null) ? new bool?(networkPV.IsMine) : null); log.LogDebug((object)string.Format("[SC] VOICE PITCH SET {0} pitch={1:F2} isLocal={2} isMine={3}", obj)); } else { Plugin.Log.LogDebug((object)$"[SC] VOICE PITCH SKIP {ctrl._displayName} voiceChat=null isLocal={state.PlayerAvatar.isLocal} voiceChatFetched={state.PlayerAvatar.voiceChatFetched}"); } } if (!PhotonNetwork.InRoom || ((Object)(object)ctrl._networkPV != (Object)null && ctrl._networkPV.IsMine)) { ApplyLocalPlayerShrinkEffects(ctrl); EjectPocketedShrunkItems(ctrl); } } public void OnRestore(ScaleController ctrl, bool isBonk) { State state = (State)ctrl.HandlerState; if (state == null) { return; } if ((Object)(object)ctrl._networkPV != (Object)null && PhotonNetwork.InRoom) { bool flag = SemiFunc.IsMasterClientOrSingleplayer(); PhysGrabber component = ((Component)ctrl).GetComponent(); var (grabStrength, grabRange, throwStrength) = GetBaseGrabStats(ctrl); if (!ctrl._options.SuppressVoicePitch) { ctrl._networkPV.RPC("RPC_PlayerPitchCancel", (RpcTarget)0, Array.Empty()); } if ((Object)(object)component != (Object)null && flag) { component.grabStrength = grabStrength; component.grabRange = grabRange; component.throwStrength = throwStrength; } } else if (!ctrl._options.SuppressVoicePitch) { PlayerVoiceChat voiceChat = state.PlayerAvatar.voiceChat; if (voiceChat != null) { voiceChat.OverridePitchCancel(); } } if (!PhotonNetwork.InRoom || ((Object)(object)ctrl._networkPV != (Object)null && ctrl._networkPV.IsMine)) { RestoreLocalPlayerShrinkEffects(ctrl); } } public void OnUpdate(ScaleController ctrl) { //IL_00aa: 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) bool flag = SemiFunc.IsMasterClientOrSingleplayer(); State state = (State)ctrl.HandlerState; if (state == null || !ctrl.IsScaled) { return; } (float strength, float range, float throwStr) baseGrabStats = GetBaseGrabStats(ctrl); float item = baseGrabStats.strength; float item2 = baseGrabStats.range; float item3 = baseGrabStats.throwStr; (float strength, float range) grabFactors = GetGrabFactors(ctrl._options.Factor); float item4 = grabFactors.strength; float item5 = grabFactors.range; bool flag2 = !PhotonNetwork.InRoom || ((Object)(object)ctrl._networkPV != (Object)null && ctrl._networkPV.IsMine); if (!ctrl._options.SuppressVoicePitch && (Object)(object)state.PlayerAvatar.voiceChat != (Object)null) { float num = ((ctrl.OriginalScale.x > 0f) ? (ctrl._target.x / ctrl.OriginalScale.x) : ctrl._options.Factor); float overridePitchMultiplierTarget = 1f + (1f - num) * 0.5f; state.PlayerAvatar.voiceChat.overridePitchMultiplierTarget = overridePitchMultiplierTarget; state.PlayerAvatar.voiceChat.overridePitchTimer = 0.2f; state.PlayerAvatar.voiceChat.overridePitchIsActive = true; } if (flag) { PhysGrabber component = ((Component)ctrl).GetComponent(); if ((Object)(object)component != (Object)null) { component.grabStrength = item * item4; component.grabRange = item2 * item5; component.throwStrength = item3 * item5; } } else if (flag2 && (Object)(object)PhysGrabber.instance != (Object)null) { PhysGrabber.instance.grabStrength = item * item4; PhysGrabber.instance.grabRange = item2 * item5; PhysGrabber.instance.throwStrength = item3 * item5; } } public void OnLateUpdate(ScaleController ctrl) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: 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_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_00c4: 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) State state = (State)ctrl.HandlerState; if (state == null) { return; } if (ctrl.IsScaled && !ctrl._transitioning) { ctrl._t.localScale = ctrl._target; } PlayerTumble tumble = state.PlayerAvatar.tumble; if ((Object)(object)tumble != (Object)null && (Object)(object)tumble.followPosition != (Object)null) { if (float.IsNaN(state.TumbleFollowOriginalY)) { state.TumbleFollowOriginalY = tumble.followPosition.localPosition.y; } if (ctrl.IsScaled && state.PlayerAvatar.isTumbling) { if (!state.WasTumbling && (Object)(object)tumble.rb != (Object)null) { Rigidbody rb = tumble.rb; rb.position += Vector3.up * 0.3f; } state.WasTumbling = true; float num = (1f - ctrl._options.Factor) * 0.1f; Vector3 localPosition = tumble.followPosition.localPosition; localPosition.y = state.TumbleFollowOriginalY + num; tumble.followPosition.localPosition = localPosition; } else { state.WasTumbling = false; if (tumble.followPosition.localPosition.y != state.TumbleFollowOriginalY) { Vector3 localPosition2 = tumble.followPosition.localPosition; localPosition2.y = state.TumbleFollowOriginalY; tumble.followPosition.localPosition = localPosition2; } } } if ((Object)(object)state.MenuAvatarTransform == (Object)null && (Object)(object)PlayerAvatarMenu.instance != (Object)null) { state.MenuAvatarTransform = ((Component)PlayerAvatarMenu.instance).transform; state.MenuAvatarOriginalScale = state.MenuAvatarTransform.localScale; state.MenuPlayerAvatar = ((Component)state.MenuAvatarTransform).GetComponentInChildren(); if ((Object)(object)state.MenuPlayerAvatar == (Object)null) { state.MenuExpression = ((Component)state.MenuAvatarTransform).GetComponentInChildren(); state.MenuEyes = ((Component)state.MenuAvatarTransform).GetComponentInChildren(); } Plugin.Log.LogDebug((object)($"[SC] MenuAvatar cached scale={state.MenuAvatarOriginalScale}" + " pupilCtrl=" + (((Object)(object)state.MenuPlayerAvatar != (Object)null) ? "PlayerAvatar" : (((Object)(object)state.MenuExpression != (Object)null) ? "PlayerExpression" : "NONE")))); } bool isLocal = state.PlayerAvatar.isLocal; if ((Object)(object)state.MenuAvatarTransform != (Object)null && isLocal) { Vector3 localScale = state.MenuAvatarTransform.localScale; Vector3 val = state.MenuAvatarOriginalScale * ctrl._options.Factor; float num2 = Time.deltaTime * 10f; if (ctrl.IsScaled) { state.MenuAvatarTransform.localScale = Vector3.Lerp(localScale, val, num2); } else if ((double)Vector3.Distance(localScale, state.MenuAvatarOriginalScale) > 0.001) { state.MenuAvatarTransform.localScale = Vector3.Lerp(localScale, state.MenuAvatarOriginalScale, num2); } else if (localScale != state.MenuAvatarOriginalScale) { state.MenuAvatarTransform.localScale = state.MenuAvatarOriginalScale; } } bool flag = (Object)(object)state.PlayerExpression != (Object)null && state.PlayerExpression.isExpressing; if (ctrl.IsScaled) { if (isLocal) { state.PlayerAvatar.OverrideAnimationSpeed(ctrl._options.AnimSpeedMultiplier, 3f, 5f, 9999f); if (!flag) { float num3 = (state.WasExpressing ? 3f : 3f); state.PlayerAvatar.OverridePupilSize(3f, 4, num3, 0.5f, 5f, 0.5f, 9999f); } else { state.PlayerAvatar.overridePupilSizeMultiplier = 1f; state.PlayerAvatar.overridePupilSizeMultiplierTarget = 1f; state.PlayerAvatar.overridePupilSizeTimer = 0f; } } else if (!flag) { PlayerEyes playerEyes = state.PlayerAvatar.playerAvatarVisuals.playerEyes; if ((Object)(object)playerEyes != (Object)null) { if (state.WasExpressing) { playerEyes.pupilSizeMultiplier = Mathf.Lerp(playerEyes.pupilSizeMultiplier, 3f, Time.deltaTime * 3f); } else { playerEyes.pupilSizeMultiplier = 3f; } } } else { state.PlayerAvatar.overridePupilSizeMultiplier = 1f; state.PlayerAvatar.overridePupilSizeMultiplierTarget = 1f; state.PlayerAvatar.overridePupilSizeTimer = 0f; } state.WasExpressing = flag; if ((Object)(object)state.MenuEyes != (Object)null && isLocal) { state.MenuEyes.pupilSizeMultiplier = (flag ? 1f : 3f); } } else if ((Object)(object)state.MenuEyes != (Object)null && state.MenuEyes.pupilSizeMultiplier > 1f && isLocal) { state.MenuEyes.pupilSizeMultiplier = 1f; } } public void OnDestroy(ScaleController ctrl) { } internal static void ApplyLocalPlayerShrinkEffects(ScaleController ctrl) { //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_0048: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_04c6: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: Unknown result type (might be due to invalid IL or missing references) //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: Unknown result type (might be due to invalid IL or missing references) State state = (State)ctrl.HandlerState; if (state == null || state.LocalEffectsApplied) { return; } float factor = ctrl._options.Factor; if ((Object)(object)CameraPosition.instance != (Object)null) { state.OriginalCamOffset = CameraPosition.instance.playerOffset; CameraPosition.instance.playerOffset = state.OriginalCamOffset * factor; } if ((Object)(object)CameraCrouchPosition.instance != (Object)null) { state.OriginalCrouchPos = CameraCrouchPosition.instance.Position; CameraCrouchPosition.instance.Position = state.OriginalCrouchPos * factor; } if ((Object)(object)state.CameraCrawl == (Object)null) { state.CameraCrawl = Object.FindObjectOfType(); } if ((Object)(object)state.CameraCrawl != (Object)null) { state.OriginalCrawlPos = state.CameraCrawl.Position; state.CameraCrawl.Position = state.OriginalCrawlPos * factor; } if ((Object)(object)state.VisionTarget == (Object)null) { state.VisionTarget = ((Component)state.PlayerAvatar).GetComponent(); } if ((Object)(object)state.VisionTarget != (Object)null) { state.VisionStandPos = state.VisionTarget.StandPosition; state.VisionCrouchPos = state.VisionTarget.CrouchPosition; state.VisionCrawlPos = state.VisionTarget.CrawlPosition; state.VisionTarget.StandPosition = state.VisionStandPos * factor; state.VisionTarget.CrouchPosition = state.VisionCrouchPos * factor; state.VisionTarget.CrawlPosition = state.VisionCrawlPos * factor; } if ((Object)(object)PhysGrabber.instance != (Object)null) { (float strength, float range, float throwStr) baseGrabStats = GetBaseGrabStats(ctrl); float item = baseGrabStats.strength; float item2 = baseGrabStats.range; float item3 = baseGrabStats.throwStr; (float strength, float range) grabFactors = GetGrabFactors(ctrl._options.Factor); float item4 = grabFactors.strength; float item5 = grabFactors.range; state.OriginalGrabMinDist = PhysGrabber.instance.minDistanceFromPlayer; state.OriginalGrabMaxDist = PhysGrabber.instance.maxDistanceFromPlayer; PhysGrabber.instance.grabStrength = item * item4; PhysGrabber.instance.grabRange = item2 * item5; PhysGrabber.instance.throwStrength = item3 * item5; PhysGrabber.instance.minDistanceFromPlayer = state.OriginalGrabMinDist * factor; PhysGrabber.instance.maxDistanceFromPlayer = state.OriginalGrabMaxDist * factor; PhysGrabber.instance.minDistanceFromPlayerOriginal = state.OriginalGrabMinDist * factor; Plugin.Log.LogDebug((object)$"[SC] player grab strength {item:F2}→{PhysGrabber.instance.grabStrength:F2} range {item2:F2}→{PhysGrabber.instance.grabRange:F2} throw {item3:F2}→{PhysGrabber.instance.throwStrength:F2} minDist {state.OriginalGrabMinDist:F2}→{PhysGrabber.instance.minDistanceFromPlayer:F2} maxDist {state.OriginalGrabMaxDist:F2}→{PhysGrabber.instance.maxDistanceFromPlayer:F2}"); } else { Plugin.Log.LogWarning((object)"[SC] PhysGrabber.instance null, grab range not scaled"); } float num = Mathf.Lerp(1f, factor, 0.5f); PlayerController instance = PlayerController.instance; if (instance != null) { instance.OverrideSpeed(num, 9999f); } if ((Object)(object)CameraZoom.Instance != (Object)null) { state.OriginalFOV = CameraZoom.Instance.playerZoomDefault; float num2 = state.OriginalFOV + 20f * (1f - factor); CameraZoom.Instance.playerZoomDefault = num2; CameraZoom.Instance.OverrideZoomSet(num2, 9999f, 3f, 3f, ((Component)ctrl).gameObject, 999); } if ((Object)(object)AssetManager.instance?.mainCamera != (Object)null) { state.OriginalNearClip = AssetManager.instance.mainCamera.nearClipPlane; AssetManager.instance.mainCamera.nearClipPlane = state.OriginalNearClip * factor * 0.5f; } if ((Object)(object)PlayerCollision.instance != (Object)null) { state.OriginalStandCollision = PlayerCollision.instance.StandCollision.localScale; state.OriginalCrouchCollision = PlayerCollision.instance.CrouchCollision.localScale; PlayerCollision.instance.StandCollision.localScale = state.OriginalStandCollision * factor; PlayerCollision.instance.CrouchCollision.localScale = state.OriginalCrouchCollision * factor; } if ((Object)(object)PlayerCollisionStand.instance != (Object)null) { if ((Object)(object)state.StandCheckCollider == (Object)null) { state.StandCheckCollider = ((Component)PlayerCollisionStand.instance).GetComponent(); } if ((Object)(object)state.StandCheckCollider != (Object)null) { state.OriginalStandCheckHeight = state.StandCheckCollider.height; state.OriginalStandCheckRadius = state.StandCheckCollider.radius; state.StandCheckCollider.height = state.OriginalStandCheckHeight * factor; state.StandCheckCollider.radius = state.OriginalStandCheckRadius * factor; } state.OriginalStandCheckOffset = PlayerCollisionStand.instance.Offset; PlayerCollisionStand.instance.Offset = state.OriginalStandCheckOffset * factor; } PlayerShrinkScreenEffects(ctrl, shrinking: true); state.LocalEffectsApplied = true; } internal static void RestoreLocalPlayerShrinkEffects(ScaleController ctrl) { //IL_002c: 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_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) State state = (State)ctrl.HandlerState; if (state != null && state.LocalEffectsApplied) { if ((Object)(object)CameraPosition.instance != (Object)null) { CameraPosition.instance.playerOffset = state.OriginalCamOffset; } if ((Object)(object)CameraCrouchPosition.instance != (Object)null) { CameraCrouchPosition.instance.Position = state.OriginalCrouchPos; } if ((Object)(object)state.CameraCrawl != (Object)null) { state.CameraCrawl.Position = state.OriginalCrawlPos; } if ((Object)(object)state.VisionTarget != (Object)null) { state.VisionTarget.StandPosition = state.VisionStandPos; state.VisionTarget.CrouchPosition = state.VisionCrouchPos; state.VisionTarget.CrawlPosition = state.VisionCrawlPos; } if ((Object)(object)PhysGrabber.instance != (Object)null) { var (grabStrength, grabRange, throwStrength) = GetBaseGrabStats(ctrl); PhysGrabber.instance.grabStrength = grabStrength; PhysGrabber.instance.grabRange = grabRange; PhysGrabber.instance.throwStrength = throwStrength; PhysGrabber.instance.minDistanceFromPlayer = state.OriginalGrabMinDist; PhysGrabber.instance.maxDistanceFromPlayer = state.OriginalGrabMaxDist; PhysGrabber.instance.minDistanceFromPlayerOriginal = state.OriginalGrabMinDist; } PlayerController instance = PlayerController.instance; if (instance != null) { instance.OverrideSpeed(1f, 0.1f); } state.PlayerAvatar.OverridePupilSizeActivate(false, 1f, 4, 3f, 0.5f, 5f, 0.5f, 0.1f); state.PlayerAvatar.OverrideAnimationSpeed(1f, 3f, 5f, 0.1f); if ((Object)(object)CameraZoom.Instance != (Object)null) { CameraZoom.Instance.playerZoomDefault = state.OriginalFOV; CameraZoom.Instance.OverrideZoomSet(state.OriginalFOV, 0.5f, 3f, 3f, ((Component)ctrl).gameObject, 999); } if ((Object)(object)AssetManager.instance?.mainCamera != (Object)null) { AssetManager.instance.mainCamera.nearClipPlane = state.OriginalNearClip; } if ((Object)(object)PlayerCollision.instance != (Object)null) { PlayerCollision.instance.StandCollision.localScale = state.OriginalStandCollision; PlayerCollision.instance.CrouchCollision.localScale = state.OriginalCrouchCollision; } if ((Object)(object)state.StandCheckCollider != (Object)null) { state.StandCheckCollider.height = state.OriginalStandCheckHeight; state.StandCheckCollider.radius = state.OriginalStandCheckRadius; } if ((Object)(object)PlayerCollisionStand.instance != (Object)null) { PlayerCollisionStand.instance.Offset = state.OriginalStandCheckOffset; } PlayerShrinkScreenEffects(ctrl, shrinking: false); state.LocalEffectsApplied = false; } } internal static (float strength, float range, float throwStr) GetBaseGrabStats(ScaleController ctrl) { State state = (State)ctrl.HandlerState; if (state == null || (Object)(object)StatsManager.instance == (Object)null) { return (1f, 4f, 0f); } string key = SemiFunc.PlayerGetSteamID(state.PlayerAvatar); StatsManager instance = StatsManager.instance; instance.playerUpgradeStrength.TryGetValue(key, out var value); instance.playerUpgradeRange.TryGetValue(key, out var value2); instance.playerUpgradeThrow.TryGetValue(key, out var value3); return (1f + (float)value * 0.2f, 4f + (float)value2 * 1f, (float)value3 * 0.3f); } private static void EjectPocketedShrunkItems(ScaleController playerCtrl) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Inventory.instance == (Object)null) { return; } PhysGrabber instance = PhysGrabber.instance; if ((Object)(object)instance == (Object)null) { return; } for (int i = 0; i < 3; i++) { InventorySpot spotByIndex = Inventory.instance.GetSpotByIndex(i); if ((Object)(object)spotByIndex == (Object)null || !spotByIndex.IsOccupied()) { continue; } ItemEquippable currentItem = spotByIndex.CurrentItem; if (!((Object)(object)currentItem == (Object)null)) { ScaleController component = ((Component)currentItem).GetComponent(); if (!((Object)(object)component == (Object)null) && component.IsScaled) { currentItem.ForceUnequip(playerCtrl._t.position + Vector3.up * 0.5f, instance.photonView.ViewID); Plugin.Log.LogDebug((object)$"[SC] Ejected shrunken item from slot {i}"); } } } } private static void PlayerShrinkScreenEffects(ScaleController ctrl, bool shrinking) { //IL_008e: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) CameraGlitch instance = CameraGlitch.Instance; if (instance != null) { instance.PlayTiny(); } GameDirector instance2 = GameDirector.instance; if (instance2 != null) { CameraShake cameraShake = instance2.CameraShake; if (cameraShake != null) { cameraShake.Shake(shrinking ? 2f : 3f, 0.35f); } } CameraNoise instance3 = CameraNoise.Instance; if (instance3 != null) { instance3.Override(0.7f, 0.5f); } if ((Object)(object)PostProcessing.Instance != (Object)null) { Color val = (shrinking ? new Color(0.1f, 0.35f, 1f) : new Color(1f, 0.55f, 0.1f)); PostProcessing.Instance.VignetteOverride(val, 0.45f, 0.5f, 15f, 4f, 0.3f, ((Component)ctrl).gameObject); } } } internal static class PocketHelper { internal static bool InjectEquippable(ScaleController ctrl) { //IL_0023: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Invalid comparison between Unknown and I4 //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Invalid comparison between Unknown and I4 //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Invalid comparison between Unknown and I4 if ((Object)(object)((Component)ctrl).GetComponent() != (Object)null) { return false; } ItemAttributes component = ((Component)ctrl).GetComponent(); if ((Object)(object)component == (Object)null) { return false; } itemType itemType = component.itemType; if ((int)itemType == 3 || (int)itemType == 4 || (int)itemType == 5 || (int)itemType == 8) { return false; } ItemEquippable val = (ctrl._itemEquippable = ((Component)ctrl).gameObject.AddComponent()); PhysGrabObject component2 = ((Component)ctrl).GetComponent(); if ((Object)(object)component2 != (Object)null) { val.physGrabObject = component2; } PhotonView? networkPV = ctrl._networkPV; if (networkPV != null) { networkPV.RefreshRpcMonoBehaviourCache(); } if ((Object)(object)((Component)ctrl).GetComponentInChildren(true) == (Object)null) { CreateIconMaker(((Component)ctrl).gameObject); } component.itemEquippable = val; component.icon = null; ((MonoBehaviour)component).StartCoroutine(component.GenerateIcon()); Plugin.Log.LogDebug((object)("[SC] PocketHelper: injected ItemEquippable on " + ctrl._displayName)); return true; } internal static void RemoveEquippable(ScaleController ctrl) { ItemEquippable component = ((Component)ctrl).GetComponent(); if (!((Object)(object)component == (Object)null) && !component.IsEquipped()) { Object.Destroy((Object)(object)component); ctrl._itemEquippable = null; ItemAttributes component2 = ((Component)ctrl).GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.itemEquippable = null; component2.icon = null; } PhotonView? networkPV = ctrl._networkPV; if (networkPV != null) { networkPV.RefreshRpcMonoBehaviourCache(); } Plugin.Log.LogDebug((object)("[SC] PocketHelper: removed ItemEquippable from " + ctrl._displayName)); } } private static void CreateIconMaker(GameObject item) { //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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_00c5: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_012e: 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) //IL_0137: 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_0152: 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_015c: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016c: 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_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Expected O, but got Unknown Bounds? maybeBounds = null; AccumulateRendererBounds(item.transform, ref maybeBounds); ItemVehicle component = item.GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component.meshTransform != (Object)null && !component.meshTransform.IsChildOf(item.transform)) { AccumulateRendererBounds(component.meshTransform, ref maybeBounds); } if (maybeBounds.HasValue) { Bounds value = maybeBounds.Value; GameObject val = new GameObject("ScalerCore_IconMaker"); val.SetActive(false); val.transform.SetParent(item.transform, false); Vector3 val2 = item.transform.InverseTransformPoint(((Bounds)(ref value)).center); float num = Mathf.Max(new float[3] { ((Bounds)(ref value)).extents.x, ((Bounds)(ref value)).extents.y, ((Bounds)(ref value)).extents.z }); Vector3 val3 = new Vector3(-0.8f, 0.35f, -1f); Vector3 normalized = ((Vector3)(ref val3)).normalized; float num2 = 2.5f; float fieldOfView = Mathf.Clamp(27f * Mathf.Max(1f, num / 0.55f), 27f, 80f); val.transform.localPosition = val2 + normalized * num2; Vector3 val4 = val2 + new Vector3(0.1f, -0.05f, 0f); val.transform.LookAt(item.transform.TransformPoint(val4)); Camera val5 = val.AddComponent(); val5.orthographic = false; val5.fieldOfView = fieldOfView; val5.nearClipPlane = 0.1f; val5.farClipPlane = 100f; val5.clearFlags = (CameraClearFlags)2; val5.backgroundColor = new Color(0.192f, 0.302f, 0.475f, 0f); val5.cullingMask = 9502721; ((Behaviour)val5).enabled = false; RenderTexture renderTexture = (val5.targetTexture = new RenderTexture(512, 512, 32, (RenderTextureFormat)0)); SemiIconMaker obj = val.AddComponent(); obj.iconCamera = val5; obj.renderTexture = renderTexture; val.SetActive(true); } } private static void AccumulateRendererBounds(Transform root, ref Bounds? maybeBounds) { //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_004d: 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_0032: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = ((Component)root).GetComponentsInChildren(true); foreach (Renderer val in componentsInChildren) { if (!(val is ParticleSystemRenderer) && !(val is TrailRenderer) && !(val is LineRenderer)) { if (!maybeBounds.HasValue) { maybeBounds = val.bounds; continue; } Bounds value = maybeBounds.Value; ((Bounds)(ref value)).Encapsulate(val.bounds); maybeBounds = value; } } } } public static class ScaleHandlerRegistry { private struct Entry { public IScaleHandler Handler; public Func Predicate; public int Priority; } private static readonly List _entries = new List(); private static bool _builtinsRegistered; public static void Register(IScaleHandler handler, Func predicate, int priority = 0) { _entries.Add(new Entry { Handler = handler, Predicate = predicate, Priority = priority }); _entries.Sort((Entry a, Entry b) => b.Priority.CompareTo(a.Priority)); } public static IScaleHandler? Resolve(GameObject target) { EnsureBuiltins(); foreach (Entry entry in _entries) { if (entry.Predicate(target)) { return entry.Handler; } } return null; } private static void EnsureBuiltins() { if (!_builtinsRegistered) { _builtinsRegistered = true; Register(new EnemyHandler(), (GameObject go) => (Object)(object)go.GetComponent() != (Object)null); Register(new PlayerHandler(), (GameObject go) => (Object)(object)go.GetComponent() != (Object)null); Register(new ValuableHandler(), (GameObject go) => (Object)(object)go.GetComponent() != (Object)null); Register(new CosmeticHandler(), (GameObject go) => (Object)(object)go.GetComponent() != (Object)null); Register(new VehicleHandler(), (GameObject go) => (Object)(object)go.GetComponent() != (Object)null, 1); Register(new CartHandler(), delegate(GameObject go) { PhysGrabCart component = go.GetComponent(); return (Object)(object)component != (Object)null && !component.isSmallCart; }); Register(new ItemHandler(), (GameObject go) => (Object)(object)go.GetComponent() != (Object)null && (Object)(object)go.GetComponent() == (Object)null); Register(new DoorHandler(), (GameObject go) => (Object)(object)go.GetComponent() != (Object)null); } } } internal class ValuableHandler : IScaleHandler { internal sealed class State { internal ValuableObject ValuableObject; internal float LastKnownValue = -1f; } public void Setup(ScaleController ctrl) { ValuableObject component = ((Component)ctrl).GetComponent(); if (!((Object)(object)component == (Object)null)) { State state = new State(); state.ValuableObject = component; ctrl.HandlerState = state; } } public void OnScale(ScaleController ctrl) { State state = (State)ctrl.HandlerState; if (state != null) { state.LastKnownValue = state.ValuableObject.dollarValueCurrent; } } public void OnRestore(ScaleController ctrl, bool isBonk) { State state = (State)ctrl.HandlerState; if (state != null) { state.LastKnownValue = -1f; } } public void OnUpdate(ScaleController ctrl) { State state = (State)ctrl.HandlerState; if (state != null && !ctrl._options.SuppressValueDropExpand) { float dollarValueCurrent = state.ValuableObject.dollarValueCurrent; if (ctrl._bonkImmuneTimer > 0f) { state.LastKnownValue = dollarValueCurrent; } else if (state.LastKnownValue >= 0f && dollarValueCurrent < state.LastKnownValue) { Plugin.Log.LogDebug((object)$"[SC] VALUE DROP {ctrl._displayName} ${state.LastKnownValue:F2} -> ${dollarValueCurrent:F2} -> bonk expand"); state.LastKnownValue = -1f; ctrl.DispatchExpandNow(); } else { state.LastKnownValue = dollarValueCurrent; } } } public void OnLateUpdate(ScaleController ctrl) { } public void OnDestroy(ScaleController ctrl) { } } internal class VehicleHandler : IScaleHandler { internal sealed class State { internal ItemVehicle Vehicle; internal Transform? Mesh; internal Vector3 OriginalMeshLocalScale = Vector3.one; internal bool AddedEquippable; } public void Setup(ScaleController ctrl) { //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) ItemVehicle component = ((Component)ctrl).GetComponent(); if (!((Object)(object)component == (Object)null)) { State state = new State { Vehicle = component, Mesh = component.meshTransform }; if ((Object)(object)state.Mesh != (Object)null) { state.OriginalMeshLocalScale = state.Mesh.localScale; } ctrl.HandlerState = state; } } public void OnScale(ScaleController ctrl) { State state = (State)ctrl.HandlerState; if (state != null) { state.AddedEquippable = PocketHelper.InjectEquippable(ctrl); } } public void OnRestore(ScaleController ctrl, bool isBonk) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) State state = (State)ctrl.HandlerState; if (state != null) { if (state.AddedEquippable) { PocketHelper.RemoveEquippable(ctrl); state.AddedEquippable = false; } if ((Object)(object)state.Mesh != (Object)null) { state.Mesh.localScale = state.OriginalMeshLocalScale; } } } public void OnUpdate(ScaleController ctrl) { } public void OnLateUpdate(ScaleController ctrl) { //IL_004f: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_0066: 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) State state = (State)ctrl.HandlerState; if (state != null && !((Object)(object)state.Mesh == (Object)null) && ctrl.IsScaled) { float factor = ctrl._options.Factor; Vector3 val = (((Object)(object)state.Mesh.parent == (Object)null) ? (state.OriginalMeshLocalScale * factor) : state.OriginalMeshLocalScale); if (state.Mesh.localScale != val) { state.Mesh.localScale = val; } } } public void OnDestroy(ScaleController ctrl) { } } } namespace ScalerCore.Handlers.EnemyVisuals { internal class BirthdayBoyVisualHandler : IEnemyVisualHandler { internal sealed class BirthdayBoyState { internal EnemyBirthdayBoy BirthdayBoy; } public object? Setup(ScaleController ctrl, EnemyHandler.State state, EnemyParent ep) { EnemyBirthdayBoy componentInChildren = ((Component)ep).GetComponentInChildren(); if ((Object)(object)componentInChildren == (Object)null) { Plugin.Log.LogWarning((object)"[SC] BirthdayBoy: EnemyBirthdayBoy component not found, falling back to default"); return null; } Plugin.Log.LogDebug((object)$"[SC] BirthdayBoy: cached, maxBalloons={componentInChildren.maxBalloons}"); return new BirthdayBoyState { BirthdayBoy = componentInChildren }; } public void OnLateUpdate(ScaleController ctrl, EnemyHandler.State state, object? visualState, float ratio) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)state.AnimTarget != (Object)null) { state.AnimTarget.localScale = state.AnimOriginalScale * ratio; } if ((Object)(object)state.BtHead != (Object)null) { ((Component)state.BtHead).transform.localScale = state.BtHeadOriginalScale * ratio; } if (!(visualState is BirthdayBoyState birthdayBoyState)) { return; } foreach (KeyValuePair balloon in birthdayBoyState.BirthdayBoy.balloons) { if (!((Object)(object)balloon.Value == (Object)null)) { balloon.Value.transform.localScale = Vector3.one * ratio; } } } public void OnRestore(ScaleController ctrl, EnemyHandler.State state, object? visualState) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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) if ((Object)(object)state.AnimTarget != (Object)null) { state.AnimTarget.localScale = state.AnimOriginalScale; state.AnimTarget.localPosition = state.AnimOriginalLocalPos; } if ((Object)(object)state.BtHead != (Object)null) { ((Component)state.BtHead).transform.localScale = state.BtHeadOriginalScale; } if (!(visualState is BirthdayBoyState birthdayBoyState)) { return; } foreach (KeyValuePair balloon in birthdayBoyState.BirthdayBoy.balloons) { if (!((Object)(object)balloon.Value == (Object)null)) { balloon.Value.transform.localScale = Vector3.one; } } } } internal class DefaultVisualHandler : IEnemyVisualHandler { public object? Setup(ScaleController ctrl, EnemyHandler.State state, EnemyParent ep) { return null; } public void OnLateUpdate(ScaleController ctrl, EnemyHandler.State state, object? visualState, float ratio) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)state.AnimTarget != (Object)null) { state.AnimTarget.localScale = state.AnimOriginalScale * ratio; } if ((Object)(object)state.BtHead != (Object)null) { ((Component)state.BtHead).transform.localScale = state.BtHeadOriginalScale * ratio; } } public void OnRestore(ScaleController ctrl, EnemyHandler.State state, object? visualState) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)state.AnimTarget != (Object)null) { state.AnimTarget.localScale = state.AnimOriginalScale; state.AnimTarget.localPosition = state.AnimOriginalLocalPos; } if ((Object)(object)state.BtHead != (Object)null) { ((Component)state.BtHead).transform.localScale = state.BtHeadOriginalScale; } } } internal class HeartHuggerVisualHandler : IEnemyVisualHandler { internal sealed class HuggerState { internal Transform? VisualsTransform; internal Vector3 VisualsOriginalScale; internal Vector3 VisualsOriginalLocalPos; internal List? SegmentColliders; internal List? SegmentOriginalScales; internal List? SegmentOriginalLocalPositions; } public object? Setup(ScaleController ctrl, EnemyHandler.State state, EnemyParent ep) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) HuggerState huggerState = new HuggerState(); if ((Object)(object)state.AnimTarget != (Object)null) { foreach (Transform item in state.AnimTarget) { Transform val = item; if (!((Object)(object)((Component)val).GetComponent() != (Object)null) && !((Object)(object)((Component)val).GetComponentInChildren() == (Object)null)) { huggerState.VisualsTransform = val; huggerState.VisualsOriginalScale = val.localScale; huggerState.VisualsOriginalLocalPos = val.localPosition; Plugin.Log.LogDebug((object)$"[SC] HeartHugger: visual root={((Object)val).name} localPos={val.localPosition}"); break; } } } huggerState.SegmentColliders = new List(); huggerState.SegmentOriginalScales = new List(); huggerState.SegmentOriginalLocalPositions = new List(); Collider[] componentsInChildren = ((Component)ep).GetComponentsInChildren(true); foreach (Collider val2 in componentsInChildren) { if (((Component)val2).gameObject.layer == 10 && ((Object)((Component)val2).gameObject).name.Contains("Segment") && (!((Object)(object)state.AnimTarget != (Object)null) || !((Component)val2).transform.IsChildOf(state.AnimTarget))) { huggerState.SegmentColliders.Add(((Component)val2).transform); huggerState.SegmentOriginalScales.Add(((Component)val2).transform.localScale); huggerState.SegmentOriginalLocalPositions.Add(((Component)val2).transform.localPosition); } } if (huggerState.SegmentColliders.Count > 0) { Plugin.Log.LogDebug((object)$"[SC] HeartHugger: found {huggerState.SegmentColliders.Count} external segment colliders"); } return huggerState; } public void OnLateUpdate(ScaleController ctrl, EnemyHandler.State state, object? visualState, float ratio) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_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_0056: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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) if (!(visualState is HuggerState huggerState)) { return; } if ((Object)(object)huggerState.VisualsTransform != (Object)null) { huggerState.VisualsTransform.localScale = huggerState.VisualsOriginalScale * ratio; Vector3 val = (huggerState.VisualsOriginalLocalPos - state.RbOriginalLocalPos) * ratio; huggerState.VisualsTransform.position = ctrl._t.position + ctrl._t.rotation * val; } if (huggerState.SegmentColliders == null) { return; } for (int i = 0; i < huggerState.SegmentColliders.Count; i++) { if (!((Object)(object)huggerState.SegmentColliders[i] == (Object)null)) { huggerState.SegmentColliders[i].localScale = huggerState.SegmentOriginalScales[i] * ratio; huggerState.SegmentColliders[i].localPosition = huggerState.SegmentOriginalLocalPositions[i] * ratio; } } } public void OnRestore(ScaleController ctrl, EnemyHandler.State state, object? visualState) { //IL_0020: 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_006e: 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) if (!(visualState is HuggerState huggerState)) { return; } if ((Object)(object)huggerState.VisualsTransform != (Object)null) { huggerState.VisualsTransform.localScale = huggerState.VisualsOriginalScale; huggerState.VisualsTransform.localPosition = huggerState.VisualsOriginalLocalPos; } if (huggerState.SegmentColliders == null) { return; } for (int i = 0; i < huggerState.SegmentColliders.Count; i++) { if (!((Object)(object)huggerState.SegmentColliders[i] == (Object)null)) { huggerState.SegmentColliders[i].localScale = huggerState.SegmentOriginalScales[i]; huggerState.SegmentColliders[i].localPosition = huggerState.SegmentOriginalLocalPositions[i]; } } } } internal class LoomVisualHandler : IEnemyVisualHandler { internal sealed class LoomState { internal EnemyShadow? Shadow; internal BotSystemSpringPoseAnimator? Spring; internal Transform? RightWrist; internal Transform? LeftWrist; internal Vector3 OrigRightWristPos; internal Vector3 OrigLeftWristPos; internal float OrigHandMoveDist; internal float OrigSlapDist; internal Dictionary? OrigLenBind; } private static readonly FieldInfo? _rightWristField = AccessTools.Field(typeof(EnemyShadow), "rightWristPivot"); private static readonly FieldInfo? _leftWristField = AccessTools.Field(typeof(EnemyShadow), "leftWristPivot"); private static readonly FieldInfo? _origRightPosField = AccessTools.Field(typeof(EnemyShadow), "originalRightWristPosition"); private static readonly FieldInfo? _origLeftPosField = AccessTools.Field(typeof(EnemyShadow), "originalLeftWristPosition"); private static readonly FieldInfo? _handMoveDistField = AccessTools.Field(typeof(EnemyShadow), "handMoveDistance"); private static readonly FieldInfo? _slapDistField = AccessTools.Field(typeof(EnemyShadow), "slapDistance"); private static readonly FieldInfo? _limbChainsField = AccessTools.Field(typeof(BotSystemSpringPoseAnimator), "limbChains"); public object? Setup(ScaleController ctrl, EnemyHandler.State state, EnemyParent ep) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_008d: 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_00b0: 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) EnemyShadow componentInChildren = ((Component)ep).GetComponentInChildren(); if ((Object)(object)componentInChildren == (Object)null) { Plugin.Log.LogWarning((object)"[SC] Loom: EnemyShadow component not found, falling back to default"); return null; } LoomState loomState = new LoomState { Shadow = componentInChildren }; if (_rightWristField != null) { loomState.RightWrist = (Transform)_rightWristField.GetValue(componentInChildren); } if (_leftWristField != null) { loomState.LeftWrist = (Transform)_leftWristField.GetValue(componentInChildren); } if (_origRightPosField != null) { loomState.OrigRightWristPos = (Vector3)_origRightPosField.GetValue(componentInChildren); } if (_origLeftPosField != null) { loomState.OrigLeftWristPos = (Vector3)_origLeftPosField.GetValue(componentInChildren); } if (_handMoveDistField != null) { loomState.OrigHandMoveDist = (float)_handMoveDistField.GetValue(componentInChildren); } if (_slapDistField != null) { loomState.OrigSlapDist = (float)_slapDistField.GetValue(componentInChildren); } loomState.Spring = componentInChildren.springPoseAnimator; CaptureBindLengths(loomState); Plugin.Log.LogDebug((object)($"[SC] Loom: wrists R={(Object)(object)loomState.RightWrist != (Object)null} L={(Object)(object)loomState.LeftWrist != (Object)null}" + $" handMoveDist={loomState.OrigHandMoveDist:F1} slapDist={loomState.OrigSlapDist:F1}" + $" chains={loomState.OrigLenBind?.Count ?? 0}")); return loomState; } public void OnLateUpdate(ScaleController ctrl, EnemyHandler.State state, object? visualState, float ratio) { //IL_0021: 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 ((Object)(object)state.AnimTarget == (Object)null || !(visualState is LoomState loomState)) { return; } state.AnimTarget.localScale = state.AnimOriginalScale * ratio; if ((Object)(object)loomState.Shadow != (Object)null) { if (_handMoveDistField != null) { _handMoveDistField.SetValue(loomState.Shadow, loomState.OrigHandMoveDist * ratio); } if (_slapDistField != null) { _slapDistField.SetValue(loomState.Shadow, loomState.OrigSlapDist * ratio); } } ApplyBindLengths(loomState, ratio); } public void OnRestore(ScaleController ctrl, EnemyHandler.State state, object? visualState) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)state.AnimTarget != (Object)null) { state.AnimTarget.localScale = state.AnimOriginalScale; state.AnimTarget.localPosition = state.AnimOriginalLocalPos; } if (!(visualState is LoomState loomState)) { return; } if ((Object)(object)loomState.Shadow != (Object)null) { if (_handMoveDistField != null) { _handMoveDistField.SetValue(loomState.Shadow, loomState.OrigHandMoveDist); } if (_slapDistField != null) { _slapDistField.SetValue(loomState.Shadow, loomState.OrigSlapDist); } } ApplyBindLengths(loomState, 1f); } private static void CaptureBindLengths(LoomState loom) { if ((Object)(object)loom.Spring == (Object)null || _limbChainsField == null || !(_limbChainsField.GetValue(loom.Spring) is IDictionary dictionary)) { return; } loom.OrigLenBind = new Dictionary(); foreach (DictionaryEntry item in dictionary) { object? value = item.Value; LimbChain val = (LimbChain)((value is LimbChain) ? value : null); if (val != null && val.lenBind != null) { loom.OrigLenBind[val] = (float[])val.lenBind.Clone(); } } } private static void ApplyBindLengths(LoomState loom, float ratio) { if (loom.OrigLenBind == null) { return; } foreach (KeyValuePair item in loom.OrigLenBind) { LimbChain key = item.Key; float[] value = item.Value; if (key.lenBind != null && key.lenBind.Length == value.Length) { for (int i = 0; i < value.Length; i++) { key.lenBind[i] = value[i] * ratio; } } } } } internal class SinkerVisualHandler : IEnemyVisualHandler { internal sealed class SinkerState { internal float OriginalGap; } public object? Setup(ScaleController ctrl, EnemyHandler.State state, EnemyParent ep) { if ((Object)(object)state.AnimTarget == (Object)null) { return null; } return new SinkerState { OriginalGap = state.RbOriginalLocalPos.y - state.AnimOriginalLocalPos.y }; } public void OnLateUpdate(ScaleController ctrl, EnemyHandler.State state, object? visualState, float ratio) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00b5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)state.AnimTarget == (Object)null) { return; } state.AnimTarget.localScale = state.AnimOriginalScale * ratio; if ((Object)(object)state.BtHead != (Object)null) { ((Component)state.BtHead).transform.localScale = state.BtHeadOriginalScale * ratio; } if (visualState is SinkerState sinkerState) { float num = sinkerState.OriginalGap * ratio; float num2 = ctrl._t.localPosition.y - state.AnimTarget.localPosition.y; float num3 = num - num2; if (Mathf.Abs(num3) > 0.001f) { Vector3 localPosition = state.AnimTarget.localPosition; localPosition.y -= num3; state.AnimTarget.localPosition = localPosition; } } } public void OnRestore(ScaleController ctrl, EnemyHandler.State state, object? visualState) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)state.AnimTarget != (Object)null) { state.AnimTarget.localScale = state.AnimOriginalScale; state.AnimTarget.localPosition = state.AnimOriginalLocalPos; } if ((Object)(object)state.BtHead != (Object)null) { ((Component)state.BtHead).transform.localScale = state.BtHeadOriginalScale; } } } internal class TricycleVisualHandler : IEnemyVisualHandler { internal sealed class TricycleState { internal Transform? TrikeMesh; internal Vector3 TrikeMeshOriginalScale; } public object? Setup(ScaleController ctrl, EnemyHandler.State state, EnemyParent ep) { //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) EnemyTricycleVisuals componentInChildren = ((Component)ep).GetComponentInChildren(); if ((Object)(object)componentInChildren == (Object)null) { return null; } return new TricycleState { TrikeMesh = ((Component)componentInChildren).transform, TrikeMeshOriginalScale = ((Component)componentInChildren).transform.localScale }; } public void OnLateUpdate(ScaleController ctrl, EnemyHandler.State state, object? visualState, float ratio) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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) if ((Object)(object)state.AnimTarget != (Object)null) { state.AnimTarget.localScale = state.AnimOriginalScale * ratio; } if (visualState is TricycleState tricycleState && (Object)(object)tricycleState.TrikeMesh != (Object)null) { tricycleState.TrikeMesh.localScale = tricycleState.TrikeMeshOriginalScale * ratio; } } public void OnRestore(ScaleController ctrl, EnemyHandler.State state, object? visualState) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)state.AnimTarget != (Object)null) { state.AnimTarget.localScale = state.AnimOriginalScale; state.AnimTarget.localPosition = state.AnimOriginalLocalPos; } if (visualState is TricycleState tricycleState && (Object)(object)tricycleState.TrikeMesh != (Object)null) { tricycleState.TrikeMesh.localScale = tricycleState.TrikeMeshOriginalScale; } } } } namespace ScalerCore.AprilFools { public class MapCollapse : MonoBehaviour { [CompilerGenerated] private sealed class d__61 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MapCollapse <>4__this; private Camera 5__2; private float 5__3; private float 5__4; private float 5__5; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__61(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Expected O, but got Unknown //IL_0238: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; MapCollapse mapCollapse = <>4__this; PostProcessing instance2; AudioScare instance3; switch (num) { default: return false; case 0: <>1__state = -1; 5__2 = Camera.main; if ((Object)(object)5__2 != (Object)null) { 5__3 = 5__2.fieldOfView; 5__4 = 25f; 5__5 = 0f; goto IL_0138; } goto IL_0148; case 1: <>1__state = -1; goto IL_0138; case 2: { <>1__state = -1; mapCollapse.PlayerSay("WERE CRUSHED\n{skull}{skull}{skull}"); if ((Object)(object)PlayerController.instance != (Object)null) { SemiFunc.CameraShakeImpactDistance(((Component)PlayerController.instance).transform.position, 30f, 5f, 20f, 100f); } PlayerAvatar[] players = mapCollapse.GetPlayers(); foreach (PlayerAvatar val in players) { if (!((Object)(object)val == (Object)null)) { AssetManager instance = AssetManager.instance; if (instance != null) { instance.PhysImpactEffect(((Component)val).transform.position); } } } if (!SemiFunc.IsMasterClientOrSingleplayer()) { return false; } players = mapCollapse.GetPlayers(); foreach (PlayerAvatar val2 in players) { if (!((Object)(object)val2 == (Object)null)) { PlayerHealth component = ((Component)val2).GetComponent(); if ((Object)(object)component != (Object)null && component.health > 0) { component.Hurt(999, false, -1, false); } } } return false; } IL_0138: if (5__5 < 0.3f) { 5__5 += Time.deltaTime; float num2 = 5__5 / 0.3f; if ((Object)(object)5__2 != (Object)null) { 5__2.fieldOfView = Mathf.Lerp(5__3, 5__4, num2 * num2); } if ((Object)(object)GameDirector.instance?.CameraShake != (Object)null) { GameDirector.instance.CameraShake.Shake(5f, 0.2f); } if ((Object)(object)GameDirector.instance?.CameraImpact != (Object)null) { GameDirector.instance.CameraImpact.Shake(8f, 0.15f); } <>2__current = null; <>1__state = 1; return true; } goto IL_0148; IL_0148: instance2 = PostProcessing.Instance; if ((Object)(object)instance2 != (Object)null) { instance2.VignetteOverride(Color.black, 0.8f, 0.1f, 0.5f, 0.1f, 0.5f, ((Component)mapCollapse).gameObject); } instance3 = AudioScare.instance; if (instance3 != null) { instance3.PlayImpact(); } if ((Object)(object)CameraGlitch.Instance != (Object)null) { CameraGlitch.Instance.PlayLong(); } <>2__current = (object)new WaitForSeconds(0.4f); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__60 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MapCollapse <>4__this; private float 5__2; private bool 5__3; private bool 5__4; private List 5__5; private List 5__6; private Vector3 5__7; private Vector3 5__8; private float 5__9; private float 5__10; private float 5__11; private float 5__12; private bool 5__13; private float

5__14; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__60(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__5 = null; 5__6 = null; <>1__state = -2; } private bool MoveNext() { //IL_09dc: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_065b: Unknown result type (might be due to invalid IL or missing references) //IL_06ae: Unknown result type (might be due to invalid IL or missing references) //IL_0787: Unknown result type (might be due to invalid IL or missing references) //IL_078c: Unknown result type (might be due to invalid IL or missing references) //IL_0735: Unknown result type (might be due to invalid IL or missing references) //IL_0741: Unknown result type (might be due to invalid IL or missing references) //IL_0722: Unknown result type (might be due to invalid IL or missing references) //IL_07b0: Unknown result type (might be due to invalid IL or missing references) //IL_07b5: Unknown result type (might be due to invalid IL or missing references) //IL_0626: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; MapCollapse mapCollapse = <>4__this; RoundDirector instance2; Camera main; int num5; int num6; switch (num) { default: return false; case 0: <>1__state = -1; 5__2 = Time.time; 5__3 = false; 5__4 = false; goto IL_0105; case 1: <>1__state = -1; goto IL_0105; case 2: <>1__state = -1; goto IL_0817; case 3: <>1__state = -1; goto IL_09af; case 4: { <>1__state = -1; break; } IL_0105: if (Time.time - 5__2 < 10f && mapCollapse._shrinking) { float num2 = Time.time - 5__2; float num3 = num2 / 10f; if ((Object)(object)GameDirector.instance?.CameraShake != (Object)null) { float num4 = 0.1f + num3 * num3 * 0.8f; GameDirector.instance.CameraShake.Shake(num4, 0.3f); } if (num2 >= 3f && !5__4) { 5__4 = true; AudioScare instance = AudioScare.instance; if (instance != null) { instance.PlaySoft(); } } if (num2 >= 6f && !5__3) { 5__3 = true; mapCollapse.PlayerSay("DID THE BUILDING JUST\nSHUDDER {:o}"); } <>2__current = null; <>1__state = 1; return true; } if (!mapCollapse._shrinking) { return false; } mapCollapse.DetachPhysObjects(); mapCollapse.SetupLightsAndSound(); mapCollapse.PanicEnemies(); instance2 = RoundDirector.instance; if ((Object)(object)instance2 != (Object)null && SemiFunc.IsMasterClientOrSingleplayer()) { instance2.extractionPointsCompleted = instance2.extractionPoints; instance2.allExtractionPointsCompleted = true; } mapCollapse._origFogEnd = RenderSettings.fogEndDistance; mapCollapse._origFogStart = RenderSettings.fogStartDistance; main = Camera.main; mapCollapse._origFov = (((Object)(object)main != (Object)null) ? main.fieldOfView : 66f); mapCollapse._nextGlitch = 5f; mapCollapse._nextScare = 8f; 5__5 = new List(Object.FindObjectsOfType()); 5__5.RemoveAll((PhysGrabHinge h) => (Object)(object)h == (Object)null || h.broken); 5__6 = new List(Object.FindObjectsOfType()); 5__6.RemoveAll((PhysGrabObject o) => (Object)(object)o == (Object)null || (Object)(object)((Component)o).GetComponent() != (Object)null); mapCollapse.PlayerSay("WHAT THE-\nWHAT IS HAPPENING TO THE BUILDING {:o}{:o}{:o}"); 5__7 = mapCollapse._level.localScale; 5__8 = mapCollapse._origScale * 0.02f; 5__9 = 0f; 5__10 = 2f; 5__11 = 1f; num5 = Mathf.Max(5__5.Count, 5__6.Count); 5__12 = ((num5 > 0) ? (72f / (float)num5) : 2f); 5__12 = Mathf.Clamp(5__12, 0.2f, 3f); 5__13 = false; goto IL_09af; IL_0817: if (5__9 >= mapCollapse._nextMsg && !5__13) { if (

5__14 < 0.8f) { mapCollapse._lastPanic1Idx = PickIndexNoRepeat(Panic1.Length, mapCollapse._lastPanic1Idx); mapCollapse.PlayerSay(Panic1[mapCollapse._lastPanic1Idx]); mapCollapse._nextMsg = 5__9 + Mathf.Lerp(10f, 4f,

5__14); } else { mapCollapse._lastPanic2Idx = PickIndexNoRepeat(Panic2.Length, mapCollapse._lastPanic2Idx); mapCollapse.PlayerSay(Panic2[mapCollapse._lastPanic2Idx]); mapCollapse._nextMsg = 5__9 + 3f; } } if (5__9 >= mapCollapse._nextTaxmanEmoji && !5__13) { mapCollapse._lastTaxmanEmojiIdx = PickIndexNoRepeat(TaxmanEmoji.Length, mapCollapse._lastTaxmanEmojiIdx); mapCollapse.TaxmanSay(TaxmanEmoji[mapCollapse._lastTaxmanEmojiIdx]); mapCollapse._nextTaxmanEmoji = 5__9 + Mathf.Lerp(7f, 3f,

5__14); } num6 = Mathf.CeilToInt(90f - 5__9); if (num6 <= 10 && num6 != mapCollapse._lastCountdown && num6 >= 0 && !5__13) { mapCollapse._lastCountdown = num6; int num7 = 10 - num6; if (num7 >= 0 && num7 < Countdown.Length) { mapCollapse.TaxmanSay("" + Countdown[num7] + ""); } } <>2__current = null; <>1__state = 3; return true; IL_09af: if (5__9 < 90f && mapCollapse._shrinking) { 5__9 += Time.deltaTime;

5__14 = Mathf.Clamp01(5__9 / 90f); float num8 =

5__14 *

5__14; Vector3 localScale = mapCollapse._level.localScale; Vector3 val = Vector3.Lerp(5__7, 5__8, num8); mapCollapse._level.localScale = val; if (localScale.x > 0.001f) { mapCollapse.TrackObjects(val.x / localScale.x); } mapCollapse.PulseLights(

5__14); mapCollapse.PitchAlarms(

5__14); mapCollapse.Beep(ref 5__10, 5__9,

5__14); mapCollapse.Shake(5__9,

5__14); mapCollapse.Visuals(5__9,

5__14); if ((Object)(object)TruckScreenText.instance?.background != (Object)null) { float num9 = Mathf.PingPong(Time.time * 3f, 1f); ((Graphic)TruckScreenText.instance.background).color = Color.Lerp(TruckScreenText.instance.evilBackgroundColor, new Color(0.7f, 0f, 0f), num9); } if (Time.frameCount % 30 == 0) { mapCollapse.KeepEnemiesPanicking(); } if (Time.frameCount % 120 == 0) { float num10 = 1.3f +

5__14 * 0.5f; foreach (var (val2, num11) in mapCollapse._enemySpeeds) { if ((Object)(object)val2 != (Object)null && (Object)(object)((Component)val2).gameObject != (Object)null) { val2.speed = num11 * num10; } } foreach (var (val3, num12) in mapCollapse._enemyAnims) { if ((Object)(object)val3 != (Object)null) { val3.speed = num12 * num10; } } } if (5__9 >= 5__11 && SemiFunc.IsMasterClientOrSingleplayer()) { 5__11 = 5__9 + 5__12; int num13 = ((

5__14 < 0.5f) ? 1 : ((

5__14 < 0.75f) ? 2 : 3)); for (int i = 0; i < num13; i++) { if (5__5.Count > 0) { PhysGrabHinge val4 = 5__5[5__5.Count - 1]; 5__5.RemoveAt(5__5.Count - 1); if ((Object)(object)val4 != (Object)null && !val4.broken) { val4.HingeBreakImpulse(); } } if (5__6.Count <= 0) { continue; } PhysGrabObject val5 = 5__6[5__6.Count - 1]; 5__6.RemoveAt(5__6.Count - 1); if ((Object)(object)val5 != (Object)null) { PhysGrabObjectImpactDetector component = ((Component)val5).GetComponent(); if ((Object)(object)component != (Object)null) { component.Break(9999f, ((Component)val5).transform.position, component.breakLevelHeavy, true); } else { val5.DestroyPhysGrabObject(); } } } } if (!5__13) { float num14 = val.x / mapCollapse._origScale.x; if (num14 < 0.5f && Time.frameCount % 30 == 0 && SemiFunc.IsMasterClientOrSingleplayer()) { mapCollapse.CrushEnemies(); } PlayerController instance3 = PlayerController.instance; bool flag = false; if ((Object)(object)instance3 != (Object)null) { bool flag2 = ((Component)instance3).transform.position.y < mapCollapse._pivot.y - 5f; Camera main2 = Camera.main; int mask = LayerMask.GetMask(new string[1] { "Default" }); ScaleController component2 = ((Component)instance3).GetComponent(); float num15 = ((!((Object)(object)component2 != (Object)null) || !component2.IsScaled) ? 1f : (((Object)(object)component2.ScaleTarget != (Object)null) ? (component2.ScaleTarget.localScale.y / component2.OriginalScale.y) : ((Component)instance3).transform.localScale.y)); float num16 = 0.2f * Mathf.Max(num15, 0.1f); float num17 = 0.3f * Mathf.Max(num15, 0.1f); bool flag3 = (Object)(object)main2 != (Object)null && Physics.Raycast(((Component)main2).transform.position, Vector3.up, num16, mask); bool flag4 = (Object)(object)main2 != (Object)null && Physics.Raycast(((Component)main2).transform.position, Vector3.down, num17, mask); flag = flag2 || (flag3 && flag4); } if (flag || num14 < 0.05f) { 5__13 = true; mapCollapse.PlayerSay("I CANT STAND UP\nTHE CEILING IS ON MY HEAD {:'(}"); <>2__current = ((MonoBehaviour)mapCollapse).StartCoroutine(mapCollapse.CrushSequence()); <>1__state = 2; return true; } } goto IL_0817; } if ((Object)(object)mapCollapse._level != (Object)null) { mapCollapse._level.localScale = 5__8; } mapCollapse._shrinking = false; mapCollapse._shrunken = true; mapCollapse._routine = null; if (!5__13) { <>2__current = ((MonoBehaviour)mapCollapse).StartCoroutine(mapCollapse.CrushSequence()); <>1__state = 4; return true; } break; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__64 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float seconds; public AudioSource src; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__64(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(seconds); <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)src != (Object)null && src.isPlaying) { src.Stop(); } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const float Factor = 0.02f; private const float Duration = 90f; internal static MapCollapse? _instance; private Transform? _level; private Vector3 _origScale; private Vector3 _pivot; private bool _shrinking; private bool _shrunken; private Coroutine? _routine; private readonly List<(Transform t, Transform parent)> _detached = new List<(Transform, Transform)>(); private readonly List _lights = new List(); private readonly List<(Color c, float i)> _origLights = new List<(Color, float)>(); private readonly List<(NavMeshAgent agent, float speed)> _enemySpeeds = new List<(NavMeshAgent, float)>(); private readonly List<(EnemyParent ep, EnemyState state)> _enemyStates = new List<(EnemyParent, EnemyState)>(); private TruckHealer? _healer; private GameObject? _alarmGO; private AudioSource? _loopSrc; private AudioSource? _beepSrc; private AudioSource? _truckSrc; private AudioSource? _sirenSrc; private AudioClip? _beepClip; private AudioClip? _sirenClip; private float _nextMsg; private float _nextGlitch; private float _nextScare; private float _nextTaxmanEmoji; private bool _lastBlinkOn; private int _lastCountdown = -1; private int _lastTaxmanEmojiIdx = -1; private int _lastPanic1Idx = -1; private int _lastPanic2Idx = -1; private float _origFogEnd; private float _origFogStart; private float _origFov; private readonly List<(Animator anim, float speed)> _enemyAnims = new List<(Animator, float)>(); private static readonly string[] Panic1 = new string[18] { "IS THE CEILING GETTING LOWER\nOR AM I LOSING IT {:'(}", "OK NO THE WALLS ARE\nDEFINITELY MOVING {fedup}", "THIS IS NOT IN MY CONTRACT\nTHIS IS NOT IN MY CONTRACT {:(}", "I DONT GET PAID ENOUGH\nFOR WHATEVER THIS IS {fedup}{fedup}", "GET YOUR STUFF AND GET\nBACK HERE NOW {:(}", "THE BUILDING IS EATING ITSELF\nHOW IS THAT EVEN POSSIBLE {:o}", "I CAN HEAR THE WALLS\nSCREAMING {:'(}{:'(}", "FORGET THE VALUABLES\nSAVE YOURSELVES {heartbreak}", "WHY DIDNT I LISTEN TO\nMY MOTHER {fedup}", "I HATE THIS JOB\nI HATE THIS JOB {fedup}", "WAIT WAS THAT WALL\nALWAYS THAT CLOSE {:o}", "PLEASE TELL ME YOURE\nSEEING THIS TOO {:(}", "I THINK THE FLOOR\nJUST MOVED {:o}", "DID ANYONE BRING\nA HELMET {:'(}", "MY KNEES ARE GIVING\nOUT {fedup}", "I JUST WANTED TO GO\nHOME TODAY {:'(}", "THE TAXMAN STOPPED\nMAKING SENSE {:'(}", "ARE WE STILL\nGETTING PAID FOR THIS {fedup}" }; private static readonly string[] Panic2 = new string[12] { "OH GOD OH NO\nOH GOD OH NO {:'(}{:'(}{:'(}", "WHY IS EVERYTHING SO SMALL\nWHY WHY WHY {fedup}", "I CANT FEEL MY LEGS\nIS THAT NORMAL {:o}", "TELL MY WIFE I LOVE\nHER MONEY {:(}", "IF YOU CAN READ THIS\nYOU ARE TOO CLOSE {heartbreak}", "THIS IS HOW IT ENDS\nISNT IT {:'(}", "I REGRET EVERYTHING\nEVERYTHING {fedup}", "TELL MOM\nIM SORRY {heartbreak}", "WHY WHY WHY WHY\nWHY {:'(}{:'(}", "LIGHTS OUT BABY\n{skull}{skull}", "WHO BROUGHT THE\nSHRINK GUN {fedup}{fedup}", "MY LAST WILL IS\nUNDER THE MATTRESS {heartbreak}" }; private static readonly string[] TaxmanEmoji = new string[15] { "{:o}", "{:o}{:o}", "{fedup}", "{:'(}", "{:(}", "{heartbreak}", "{skull}", "{:'(}{fedup}", "{:o}{:'(}", "{:(}{:(}", "{fedup}{fedup}", "{heartbreak}{heartbreak}", "{skull}{skull}", "{:o}{:o}{:o}", "{:'(}{:'(}{:'(}" }; private static readonly string[] Countdown = new string[10] { "10", "9", "8", "7", "6 {:'(}", "5 {:'(}{:'(}", "4 {fedup}", "3 {heartbreak}", "2 {skull}", "1 {skull}{skull}" }; private PlayerAvatar[]? _cachedPlayers; private float _playerCacheTime; private static AudioMixerGroup? SfxMixerGroup { get { if (!((Object)(object)AudioManager.instance != (Object)null)) { return null; } return AudioManager.instance.SoundMasterGroup; } } private void Awake() { _instance = this; } public static void OnMapHit() { if (!CanStart()) { return; } if (!SemiFunc.IsMultiplayer()) { _instance.Begin(); return; } MapCollapseRelay mapCollapseRelay = MapCollapseRelay.EnsureFor((MonoBehaviour?)(object)PunManager.instance); if ((Object)(object)mapCollapseRelay == (Object)null) { _instance.Begin(); } else if (SemiFunc.IsMasterClientOrSingleplayer()) { mapCollapseRelay.BroadcastStart(); } else { mapCollapseRelay.RequestStart(); } } internal static void OnLevelChange() { if ((Object)(object)_instance != (Object)null) { _instance.Restore(); } } internal static bool TryBegin() { if (!CanStart()) { return false; } _instance.Begin(); return true; } private static bool CanStart() { if ((Object)(object)_instance != (Object)null && !_instance._shrinking && !_instance._shrunken && (Object)(object)LevelGenerator.Instance != (Object)null) { return LevelGenerator.Instance.Generated; } return false; } private void Begin() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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) Transform parent = ((Component)LevelGenerator.Instance).transform.parent; _level = ((parent != null) ? parent.Find("Level") : null); if (!((Object)(object)_level == (Object)null)) { _origScale = _level.localScale; _pivot = _level.position; _shrinking = true; _nextMsg = 0f; _nextTaxmanEmoji = 5f; _lastCountdown = (_lastTaxmanEmojiIdx = (_lastPanic1Idx = (_lastPanic2Idx = -1))); if (_routine != null) { ((MonoBehaviour)this).StopCoroutine(_routine); } _routine = ((MonoBehaviour)this).StartCoroutine(Run()); } } private void DetachPhysObjects() { _detached.Clear(); PhysGrabObject[] componentsInChildren = ((Component)_level).GetComponentsInChildren(true); foreach (PhysGrabObject val in componentsInChildren) { _detached.Add((((Component)val).transform, ((Component)val).transform.parent)); ((Component)val).transform.SetParent((Transform)null, true); } } private void SetupLightsAndSound() { //IL_0093: 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_0148: Unknown result type (might be due to invalid IL or missing references) _lights.Clear(); _origLights.Clear(); ExtractionPoint[] array = Object.FindObjectsOfType(); foreach (ExtractionPoint val in array) { GrabLights(((Component)val).gameObject); } _healer = TruckHealer.instance; if ((Object)(object)_healer != (Object)null) { if ((Object)(object)_healer.healerLight != (Object)null) { _lights.Add(_healer.healerLight); _origLights.Add((_healer.healerLight.color, _healer.healerLight.intensity)); _healer.healerLight.color = Color.red; _healer.healerLight.intensity = 5f; ((Behaviour)_healer.healerLight).enabled = true; } if ((Object)(object)((Component)_healer).transform.parent != (Object)null) { GrabLights(((Component)((Component)_healer).transform.parent).gameObject); } } if ((Object)(object)TruckScreenText.instance?.background != (Object)null) { ((Graphic)TruckScreenText.instance.background).color = TruckScreenText.instance.evilBackgroundColor; } SetupAudio(); } private void GrabLights(GameObject root) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) Light[] componentsInChildren = root.GetComponentsInChildren(true); foreach (Light val in componentsInChildren) { if (!_lights.Contains(val)) { _lights.Add(val); _origLights.Add((val.color, val.intensity)); val.color = Color.red; val.intensity = Mathf.Max(val.intensity * 3f, 5f); ((Component)val).gameObject.SetActive(true); } } } private void SetupAudio() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Expected O, but got Unknown //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Expected O, but got Unknown //IL_0273: Unknown result type (might be due to invalid IL or missing references) ExtractionPoint val = Object.FindObjectOfType(); Dictionary m = SoundsFrom((MonoBehaviour?)(object)val); Dictionary m2 = SoundsFrom((MonoBehaviour?)(object)_healer); _alarmGO = new GameObject("MapCollapse_Audio"); _alarmGO.transform.SetParent(((Object)(object)val != (Object)null) ? ((Component)val).transform : ((Component)this).transform); _alarmGO.transform.localPosition = Vector3.zero; AudioClip val2 = Clip(m, "soundWarningLightsLoop") ?? Clip(m, "soundAlarm"); if ((Object)(object)val2 != (Object)null) { _loopSrc = MakeSource(_alarmGO, val2, loop: true, 0.3f, 0.7f); _loopSrc.Play(); } AudioClip val3 = Clip(m2, "soundLoop") ?? Clip(m2, "soundOpen"); if ((Object)(object)val3 != (Object)null && (Object)(object)val3 != (Object)(object)val2 && (Object)(object)_healer != (Object)null) { GameObject val4 = new GameObject("MapCollapse_TruckAudio"); val4.transform.SetParent(((Component)_healer).transform); val4.transform.localPosition = Vector3.zero; _truckSrc = MakeSource(val4, val3, loop: true, 0.5f, 0.6f, 0.8f); _truckSrc.Play(); } _beepClip = Clip(m, "soundAlarmFinal") ?? Clip(m, "soundAlarmGlobal") ?? Clip(m, "soundActivate1"); if ((Object)(object)_beepClip == (Object)(object)val2) { _beepClip = Clip(m, "soundActivate1") ?? Clip(m, "soundButton"); } if ((Object)(object)_beepClip != (Object)null) { _beepSrc = MakeSource(_alarmGO, null, loop: false, 0f, 0.8f); } _sirenClip = Clip(m, "soundAlarm") ?? Clip(m, "soundAlarmGlobal") ?? Clip(m, "soundAlarmFinal") ?? Clip(m, "soundActivate3"); if ((Object)(object)_sirenClip != (Object)null) { GameObject val5 = new GameObject("MapCollapse_Siren"); val5.transform.SetParent(((Object)(object)_healer != (Object)null) ? ((Component)_healer).transform : _alarmGO.transform); val5.transform.localPosition = Vector3.zero; _sirenSrc = MakeSource(val5, null, loop: false, 0.8f, 0.7f); _sirenSrc.minDistance = 2f; _sirenSrc.maxDistance = 80f; } } private static AudioSource MakeSource(GameObject go, AudioClip? clip, bool loop, float spatial, float vol, float pitch = 1f) { AudioSource obj = go.AddComponent(); obj.clip = clip; obj.loop = loop; obj.spatialBlend = spatial; obj.maxDistance = 500f; obj.volume = vol; obj.pitch = pitch; obj.outputAudioMixerGroup = SfxMixerGroup; return obj; } private static Dictionary SoundsFrom(MonoBehaviour? target) { Dictionary dictionary = new Dictionary(); if ((Object)(object)target == (Object)null) { return dictionary; } FieldInfo[] fields = ((object)target).GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.FieldType == typeof(Sound)) { object? value = fieldInfo.GetValue(target); Sound val = (Sound)((value is Sound) ? value : null); if (val != null) { dictionary[fieldInfo.Name] = val; } } } return dictionary; } private static AudioClip? Clip(Dictionary m, string k) { if (!m.TryGetValue(k, out Sound value)) { return null; } if (value.Sounds != null && value.Sounds.Length != 0 && (Object)(object)value.Sounds[0] != (Object)null) { return value.Sounds[0]; } AudioSource source = value.Source; if ((Object)(object)((source != null) ? source.clip : null) != (Object)null) { return value.Source.clip; } return null; } private void PanicEnemies() { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) _enemySpeeds.Clear(); _enemyStates.Clear(); _enemyAnims.Clear(); NavMeshAgent[] array = Object.FindObjectsOfType(); foreach (NavMeshAgent val in array) { _enemySpeeds.Add((val, val.speed)); val.speed *= 1.3f; } EnemyParent[] array2 = Object.FindObjectsOfType(); foreach (EnemyParent val2 in array2) { if (!((Object)(object)val2.Enemy == (Object)null)) { _enemyStates.Add((val2, val2.Enemy.CurrentState)); val2.Enemy.CurrentState = (EnemyState)2; if ((Object)(object)val2.Enemy.Vision != (Object)null) { val2.Enemy.Vision.DisableVision(120f); } Animator[] componentsInChildren = ((Component)val2).GetComponentsInChildren(true); foreach (Animator val3 in componentsInChildren) { _enemyAnims.Add((val3, val3.speed)); val3.speed *= 1.3f; } } } } private void KeepEnemiesPanicking() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Invalid comparison between Unknown and I4 //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 //IL_0050: Unknown result type (might be due to invalid IL or missing references) foreach (var enemyState in _enemyStates) { EnemyParent item = enemyState.ep; if (!((Object)(object)item?.Enemy == (Object)null)) { EnemyState currentState = item.Enemy.CurrentState; if ((int)currentState != 2 && (int)currentState != 11 && (int)currentState != 9) { item.Enemy.CurrentState = (EnemyState)2; } if ((Object)(object)item.Enemy.Vision != (Object)null) { item.Enemy.Vision.DisableVision(5f); } } } } private void TaxmanSay(string msg) { if (SemiFunc.IsMasterClientOrSingleplayer()) { TruckScreenText instance = TruckScreenText.instance; if (!((Object)(object)instance == (Object)null)) { instance.isTyping = false; instance.MessageSendCustom("", msg, 2); } } } private void PlayerSay(string msg) { if (SemiFunc.IsMasterClientOrSingleplayer()) { TruckScreenText instance = TruckScreenText.instance; if (!((Object)(object)instance == (Object)null)) { instance.isTyping = false; string text = PickRandomPlayerName(); instance.MessageSendCustom(text ?? "", msg, 2); } } } private static string? PickRandomPlayerName() { List list = GameDirector.instance?.PlayerList; if (list == null || list.Count == 0) { return null; } List list2 = new List(list.Count); foreach (PlayerAvatar item in list) { if (!((Object)(object)item == (Object)null) && !item.isDisabled) { string playerName = item.playerName; if (!string.IsNullOrEmpty(playerName)) { list2.Add(playerName); } } } if (list2.Count == 0) { return null; } return list2[Random.Range(0, list2.Count)]; } private static int PickIndexNoRepeat(int len, int last) { if (len <= 0) { return -1; } if (len == 1) { return 0; } int num; do { num = Random.Range(0, len); } while (num == last); return num; } [IteratorStateMachine(typeof(d__60))] private IEnumerator Run() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__60(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__61))] private IEnumerator CrushSequence() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__61(0) { <>4__this = this }; } private void CrushEnemies() { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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) int mask = LayerMask.GetMask(new string[1] { "Default" }); foreach (var enemyState in _enemyStates) { EnemyParent item = enemyState.ep; if ((Object)(object)item == (Object)null || (Object)(object)item.Enemy == (Object)null) { continue; } EnemyHealth componentInChildren = ((Component)item).GetComponentInChildren(); if (!((Object)(object)componentInChildren == (Object)null) && componentInChildren.healthCurrent > 0) { Vector3 position = ((Component)item).transform.position; bool flag = Physics.Raycast(position, Vector3.up, 0.5f, mask); bool flag2 = Physics.Raycast(position, Vector3.down, 0.5f, mask); if (flag && flag2) { componentInChildren.Hurt(9999, Vector3.down); } } } } private void PulseLights(float p) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Lerp(4f, 1.5f, p); bool flag = Time.time % num < num * 0.4f; float intensity = (flag ? (5f + p * 15f) : 0.2f); foreach (Light light in _lights) { if (!((Object)(object)light == (Object)null)) { light.color = Color.red; light.intensity = intensity; ((Component)light).gameObject.SetActive(true); } } if (flag && !_lastBlinkOn && (Object)(object)_sirenSrc != (Object)null && (Object)(object)_sirenClip != (Object)null) { _sirenSrc.Stop(); _sirenSrc.pitch = Mathf.Max(0.1f, 0.8f + p * 1.2f); _sirenSrc.clip = _sirenClip; _sirenSrc.volume = 0.5f; _sirenSrc.time = 0f; _sirenSrc.Play(); } _lastBlinkOn = flag; } [IteratorStateMachine(typeof(d__64))] private IEnumerator StopAfter(AudioSource src, float seconds) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__64(0) { src = src, seconds = seconds }; } private void PitchAlarms(float p) { if ((Object)(object)_loopSrc != (Object)null) { _loopSrc.pitch = Mathf.Max(0.1f, 1f + p * 1f); _loopSrc.volume = Mathf.Min(0.5f, 0.3f + p * 0.2f); } if ((Object)(object)_truckSrc != (Object)null) { _truckSrc.pitch = Mathf.Max(0.1f, 0.8f + p * 0.8f); _truckSrc.volume = Mathf.Min(0.5f, 0.3f + p * 0.2f); } } private void Beep(ref float next, float t, float p) { if (!((Object)(object)_beepSrc == (Object)null) && !((Object)(object)_beepClip == (Object)null) && !(t < next)) { float num = ((p < 0.3f) ? 4f : ((p < 0.5f) ? 2f : ((p < 0.65f) ? 1f : ((p < 0.75f) ? 0.5f : ((p < 0.85f) ? 0.25f : ((p < 0.92f) ? 0.15f : 0.08f)))))); _beepSrc.Stop(); _beepSrc.pitch = Mathf.Max(0.1f, 1f + p * 0.8f); _beepSrc.volume = Mathf.Min(0.6f, 0.4f + p * 0.2f); _beepSrc.clip = _beepClip; _beepSrc.time = 0f; _beepSrc.Play(); ((MonoBehaviour)this).StartCoroutine(StopAfter(_beepSrc, 0.5f)); next = t + num; } } private void Shake(float t, float p) { if (!((Object)(object)GameDirector.instance?.CameraShake == (Object)null)) { float num = Mathf.Min(3f, 0.2f + p * p * 4f); GameDirector.instance.CameraShake.Shake(num, 0.3f); } } private void Visuals(float t, float p) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) PostProcessing instance = PostProcessing.Instance; if ((Object)(object)instance != (Object)null) { instance.VignetteOverride(Color.black, p * 0.45f, 0.4f, 2f, 1f, 2f, ((Component)this).gameObject); instance.SaturationOverride((0f - p) * 40f, 2f, 1f, 2f, ((Component)this).gameObject); instance.ContrastOverride(p * 15f, 2f, 1f, 2f, ((Component)this).gameObject); if ((Object)(object)instance.grain != (Object)null) { ((PostProcessEffectSettings)instance.grain).active = true; ((ParameterOverride)(object)instance.grain.intensity).value = Mathf.Lerp(0.3f, 0.6f, p); ((ParameterOverride)(object)instance.grain.size).value = Mathf.Lerp(1f, 1.5f, p); } } if (_origFogEnd > 0f) { RenderSettings.fogEndDistance = Mathf.Lerp(_origFogEnd, _origFogEnd * 0.15f, p * p); RenderSettings.fogStartDistance = Mathf.Lerp(_origFogStart, 0f, p * p); } Camera main = Camera.main; if ((Object)(object)main != (Object)null) { main.fieldOfView = Mathf.Lerp(_origFov, _origFov * 0.7f, p * p); } if (t >= _nextGlitch && (Object)(object)CameraGlitch.Instance != (Object)null) { if (p < 0.4f) { CameraGlitch.Instance.PlayTiny(); _nextGlitch = t + Mathf.Lerp(12f, 5f, p); } else if (p < 0.75f) { CameraGlitch.Instance.PlayShort(); _nextGlitch = t + Mathf.Lerp(5f, 2f, p); } else { CameraGlitch.Instance.PlayLong(); _nextGlitch = t + Mathf.Lerp(2f, 0.5f, p); } } if (t >= _nextScare && (Object)(object)AudioScare.instance != (Object)null) { if (p < 0.3f) { AudioScare.instance.PlaySoft(); _nextScare = t + 15f; } else if (p < 0.6f) { AudioScare.instance.PlaySoft(); _nextScare = t + 10f; } else if (p < 0.85f) { AudioScare.instance.PlayImpact(); _nextScare = t + 6f; } else { AudioScare.instance.PlayImpact(); _nextScare = t + 3f; } } } private PlayerAvatar[] GetPlayers() { if (_cachedPlayers == null || Time.time - _playerCacheTime > 2f) { _cachedPlayers = Object.FindObjectsOfType(); _playerCacheTime = Time.time; } return _cachedPlayers; } private void TrackObjects(float ratio) { //IL_0059: 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_006f: 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_002a: 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_0036: 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_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_00ce: 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_00db: 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_00eb: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar[] players = GetPlayers(); foreach (PlayerAvatar val in players) { if (!((Object)(object)val == (Object)null)) { Rigidbody component = ((Component)val).GetComponent(); if ((Object)(object)component != (Object)null) { component.position = _pivot + (component.position - _pivot) * ratio; } else { ((Component)val).transform.position = _pivot + (((Component)val).transform.position - _pivot) * ratio; } } } foreach (var item2 in _detached) { Transform item = item2.t; if (!((Object)(object)item == (Object)null)) { Rigidbody component2 = ((Component)item).GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.position = _pivot + (component2.position - _pivot) * ratio; } } } } private void Restore() { //IL_0032: 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_0267: Unknown result type (might be due to invalid IL or missing references) _shrinking = (_shrunken = false); ((MonoBehaviour)this).StopAllCoroutines(); _routine = null; if ((Object)(object)_level != (Object)null) { _level.localScale = _origScale; } foreach (var (val, val2) in _detached) { if ((Object)(object)val != (Object)null && (Object)(object)val2 != (Object)null) { val.SetParent(val2, true); } } _detached.Clear(); foreach (var (val3, speed) in _enemySpeeds) { if ((Object)(object)val3 != (Object)null) { val3.speed = speed; } } foreach (var (val4, speed2) in _enemyAnims) { if ((Object)(object)val4 != (Object)null) { val4.speed = speed2; } } _enemySpeeds.Clear(); _enemyStates.Clear(); _enemyAnims.Clear(); for (int i = 0; i < _lights.Count; i++) { if (i < _origLights.Count && (Object)(object)_lights[i] != (Object)null) { _lights[i].color = _origLights[i].c; _lights[i].intensity = _origLights[i].i; } } _lights.Clear(); _origLights.Clear(); if (_origFogEnd > 0f) { RenderSettings.fogEndDistance = _origFogEnd; RenderSettings.fogStartDistance = _origFogStart; } Camera main = Camera.main; if ((Object)(object)main != (Object)null) { main.fieldOfView = _origFov; } if ((Object)(object)TruckScreenText.instance?.background != (Object)null) { ((Graphic)TruckScreenText.instance.background).color = TruckScreenText.instance.mainBackgroundColor; } if ((Object)(object)_sirenSrc != (Object)null) { Object.Destroy((Object)(object)((Component)_sirenSrc).gameObject); _sirenSrc = null; } if ((Object)(object)_alarmGO != (Object)null) { Object.Destroy((Object)(object)_alarmGO); _alarmGO = null; _loopSrc = (_beepSrc = null); } if ((Object)(object)_truckSrc != (Object)null) { Object.Destroy((Object)(object)((Component)_truckSrc).gameObject); _truckSrc = null; } _healer = null; } } internal class MapCollapseRelay : MonoBehaviourPun { internal static MapCollapseRelay? EnsureFor(MonoBehaviour? host) { if ((Object)(object)host == (Object)null) { return null; } MapCollapseRelay component = ((Component)host).GetComponent(); if ((Object)(object)component != (Object)null) { return component; } MapCollapseRelay result = ((Component)host).gameObject.AddComponent(); PhotonView component2 = ((Component)host).GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.RefreshRpcMonoBehaviourCache(); } return result; } internal void BroadcastStart() { if (SemiFunc.IsMasterClientOrSingleplayer()) { if ((Object)(object)((MonoBehaviourPun)this).photonView == (Object)null || !PhotonNetwork.InRoom) { MapCollapse.TryBegin(); } else { ((MonoBehaviourPun)this).photonView.RPC("RPC_MapCollapseStart", (RpcTarget)0, Array.Empty()); } } } internal void RequestStart() { if (!SemiFunc.IsMasterClientOrSingleplayer() && !((Object)(object)((MonoBehaviourPun)this).photonView == (Object)null) && PhotonNetwork.InRoom) { ((MonoBehaviourPun)this).photonView.RPC("RPC_MapCollapseRequest", (RpcTarget)2, Array.Empty()); } } [PunRPC] private void RPC_MapCollapseStart() { MapCollapse.TryBegin(); } [PunRPC] private void RPC_MapCollapseRequest() { if (SemiFunc.IsMasterClientOrSingleplayer()) { BroadcastStart(); } } } }