using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.UI; using Zorro.Core; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("DepthsOfWarning")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("DepthsOfWarning")] [assembly: AssemblyTitle("DepthsOfWarning")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace DepthsOfWarning { [HarmonyPatch] internal static class ArmsAIUpdate { private const float GRAB_RANGE_INCREASE = 1.8f; private const float HAND_FORCE = 15f; private const float DRAG_FORCE = 12f; private const float REEL_FORCE = 12f; private const float BITE_DAMAGE = 25f; private const float BITE_INTERVAL = 1.5f; private static Vector3 BotCenter(Bot bot) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) return Traverse.Create((object)bot).Method("Center", Array.Empty()).GetValue(); } private static Vector3 PlayerCenter(Player p) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) return Traverse.Create((object)p).Method("Center", Array.Empty()).GetValue(); } private static Bodypart GetBodypart(object ragdoll, BodypartType type) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) return Traverse.Create(ragdoll).Method("GetBodypart", new Type[1] { typeof(BodypartType) }, (object[])null).GetValue(new object[1] { type }); } private static bool CanSeeTarget(Bot bot, Vector3 head, float angle) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) return Traverse.Create((object)bot).Method("CanSeeTarget", new Type[2] { typeof(Vector3), typeof(float) }, (object[])null).GetValue(new object[2] { head, angle }); } [HarmonyPatch(typeof(Attacks_Arms), "TryAttack")] [HarmonyPrefix] private static bool TryAttackPrefix(Attacks_Arms __instance) { //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0211: 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) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0251: 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_025f: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_029a: 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_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: 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_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) Bot value = Traverse.Create((object)__instance).Field("bot").GetValue(); PhotonView value2 = Traverse.Create((object)__instance).Field("view").GetValue(); if ((Object)(object)value == (Object)null || (Object)(object)value2 == (Object)null || !value2.IsMine) { return true; } if ((Object)(object)value.targetPlayer == (Object)null || value.targetPlayer.data.dead || !value.aggro) { return true; } Transform value3 = Traverse.Create((object)__instance).Field("handPoint1").GetValue(); Transform value4 = Traverse.Create((object)__instance).Field("handPoint2").GetValue(); Rigidbody value5 = Traverse.Create((object)__instance).Field("rig1").GetValue(); Rigidbody value6 = Traverse.Create((object)__instance).Field("rig2").GetValue(); Traverse val = Traverse.Create((object)__instance).Field("strength"); Traverse val2 = Traverse.Create((object)__instance).Field("counter"); Traverse val3 = Traverse.Create((object)__instance).Field("toggle"); Traverse val4 = Traverse.Create((object)__instance).Field("grabAmount"); SFX_Instance[] value7 = Traverse.Create((object)__instance).Field("grabSFX").GetValue(); if ((Object)(object)value3 == (Object)null || (Object)(object)value4 == (Object)null || (Object)(object)value5 == (Object)null || (Object)(object)value6 == (Object)null) { return true; } Vector3 val5 = (value3.position + value4.position) * 0.5f; float value8 = val.GetValue(); float value9 = val2.GetValue(); float num = Mathf.Clamp(value8, 0f, 2f); if (Vector3.Distance(val5, PlayerCenter(value.targetPlayer)) < 1.8f) { Bodypart bodypart = GetBodypart(value.targetPlayer.refs.ragdoll, (BodypartType)2); Rigidbody val6 = (((Object)(object)bodypart != (Object)null) ? Traverse.Create((object)bodypart).Field("rig").GetValue() : null); if ((Object)(object)val6 == (Object)null) { return true; } Vector3 val7 = val5 - val6.position; Vector3 normalized = ((Vector3)(ref val7)).normalized; val6.AddForce(normalized * num * 12f, (ForceMode)5); val7 = PlayerCenter(value.targetPlayer) - BotCenter(value); Vector3 normalized2 = ((Vector3)(ref val7)).normalized; val6.AddForce(normalized2 * num * 12f, (ForceMode)5); Vector3 val8 = Vector3.ClampMagnitude((val6.position - value3.position) * 3f, 1f); Vector3 val9 = Vector3.ClampMagnitude((val6.position - value4.position) * 3f, 1f); value5.AddForceAtPosition(val8 * num * 15f, value3.position, (ForceMode)5); value6.AddForceAtPosition(val9 * num * 15f, value4.position, (ForceMode)5); if ((Object)(object)value.targetPlayer.data.currentItem != (Object)null && value.targetPlayer.IsLocal) { value.targetPlayer.data.dropItemsFor = 0.1f; Plugin.Logger.LogInfo("Arms ripped item from player"); } value9 += Time.fixedDeltaTime; if (value9 > 1.5f) { value9 = 0f; if (value.targetPlayer.IsLocal) { value.targetPlayer.CallTakeDamage(25f); Plugin.Logger.LogInfo($"Arms dealt {25f} bite damage"); } } val2.SetValue((object)value9); if (!val3.GetValue()) { val3.SetValue((object)true); if (value7 != null) { for (int i = 0; i < value7.Length; i++) { if ((Object)(object)value7[i] != (Object)null) { value7[i].Play(PlayerCenter(value.targetPlayer), false, 1f, (Transform)null); } } } } val4.SetValue((object)Mathf.MoveTowards(val4.GetValue(), 1f, Time.deltaTime * 2.5f)); val.SetValue((object)Mathf.MoveTowards(value8, 0.5f, Time.fixedDeltaTime * 0.4f)); } else { val2.SetValue((object)Mathf.MoveTowards(value9, 0f, Time.fixedDeltaTime)); val.SetValue((object)Mathf.MoveTowards(value8, 3f, Time.fixedDeltaTime)); val3.SetValue((object)false); val4.SetValue((object)Mathf.MoveTowards(val4.GetValue(), 0f, Time.deltaTime * 1.5f)); } MonsterAnimationHandler value10 = Traverse.Create((object)__instance).Field("animator").GetValue(); FieldInfo fieldInfo = AccessTools.Field(typeof(Attacks_Arms), "GrabAmountProp"); if ((Object)(object)value10 != (Object)null && fieldInfo != null) { int num2 = (int)fieldInfo.GetValue(null); Traverse.Create((object)value10).Method("SetFloat", new Type[2] { typeof(int), typeof(float) }, (object[])null).GetValue(new object[2] { num2, val4.GetValue() }); } return false; } [HarmonyPatch(typeof(Attacks_Arms), "Arms")] [HarmonyPrefix] private static bool ArmsPrefix(Attacks_Arms __instance) { if ((Object)(object)Traverse.Create((object)__instance).Field("bot").GetValue() == (Object)null) { return true; } return false; } } public class BellDiverSystem : MonoBehaviour { private float _cooldownTimer; private float _talkDuration; private bool _isTalking; private bool _onCooldown; private const float TALK_DURATION = 8f; private const float COOLDOWN_DURATION = 6f; private const KeyCode ACTIVATE_KEY = (KeyCode)114; private AudioLowPassFilter _lowPass; private AudioDistortionFilter _distortion; private static GUIStyle _cachedBold; private static GUIStyle _cachedNormal; private static bool _guiInit; internal static BellDiverSystem Instance { get; private set; } internal bool IsTalking => _isTalking; private void Awake() { Instance = this; } private void Update() { if ((Object)(object)Player.localPlayer == (Object)null || !Player.localPlayer.data.dead) { if (_isTalking) { StopTalking(); } return; } if (_onCooldown) { _cooldownTimer -= Time.deltaTime; if (_cooldownTimer <= 0f) { _onCooldown = false; _cooldownTimer = 0f; } } if (_isTalking) { _talkDuration -= Time.deltaTime; if (_talkDuration <= 0f) { StopTalking(); } } else if (!_onCooldown && Input.GetKeyDown((KeyCode)114)) { StartTalking(); } } private void StartTalking() { Player talkTarget = GetTalkTarget(); if ((Object)(object)talkTarget == (Object)null) { Plugin.Logger.LogInfo("Bell Diver Saving System: no alive players to contact"); return; } _isTalking = true; _talkDuration = 8f; ApplyVoiceRouting(); SetupAudioEffects(); Plugin.Logger.LogInfo("Bell Diver Saving System: Transmission started to " + ((TMP_Text)talkTarget.m_name).text); } private void StopTalking() { _isTalking = false; _onCooldown = true; _cooldownTimer = 6f; RestoreVoiceRouting(); RemoveAudioEffects(); Plugin.Logger.LogInfo("Bell Diver Saving System: Transmission ended"); } private void ApplyVoiceRouting() { try { NetworkVoiceHandler.TalkToAlive(); } catch (Exception ex) { Plugin.Logger.LogWarning("Bell Diver TalkToAlive failed: " + ex.Message); } } private void RestoreVoiceRouting() { try { NetworkVoiceHandler.TalkToDead(); } catch (Exception ex) { Plugin.Logger.LogWarning("Bell Diver TalkToDead failed: " + ex.Message); } } private Player GetTalkTarget() { try { if ((Object)(object)Player.observedPlayer != (Object)null && !Player.observedPlayer.data.dead) { return Player.observedPlayer; } if ((Object)(object)PlayerHandler.instance != (Object)null && PlayerHandler.instance.playersAlive != null) { foreach (Player item in PlayerHandler.instance.playersAlive) { if ((Object)(object)item != (Object)null && !item.data.dead) { return item; } } } } catch { } return null; } private void SetupAudioEffects() { PlayerVoiceHandler instance = PlayerVoiceHandler.Instance; if (!((Object)(object)instance == (Object)null)) { AddFilters(((Component)instance).gameObject); if ((Object)(object)instance.audioSource != (Object)null) { AddFilters(((Component)instance.audioSource).gameObject); } } } private void AddFilters(GameObject go) { if (!((Object)(object)go == (Object)null)) { AudioLowPassFilter val = go.GetComponent(); if ((Object)(object)val == (Object)null) { val = go.AddComponent(); } _lowPass = val; AudioDistortionFilter val2 = go.GetComponent(); if ((Object)(object)val2 == (Object)null) { val2 = go.AddComponent(); } _distortion = val2; ApplyDistortionSettings(); } } private void ApplyDistortionSettings() { if ((Object)(object)_lowPass != (Object)null) { ((Behaviour)_lowPass).enabled = true; _lowPass.cutoffFrequency = Random.Range(400f, 900f); } if ((Object)(object)_distortion != (Object)null) { ((Behaviour)_distortion).enabled = true; _distortion.distortionLevel = Random.Range(0.4f, 0.8f); } } private void RemoveAudioEffects() { if ((Object)(object)_lowPass != (Object)null) { Object.Destroy((Object)(object)_lowPass); _lowPass = null; } if ((Object)(object)_distortion != (Object)null) { Object.Destroy((Object)(object)_distortion); _distortion = null; } } private void OnGUI() { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Player.localPlayer == (Object)null) && Player.localPlayer.data.dead) { string text = "Unknown"; Player talkTarget = GetTalkTarget(); if ((Object)(object)talkTarget != (Object)null) { text = ((TMP_Text)talkTarget.m_name).text; } float num = (float)Screen.height - 150f; float x = 20f; if (_onCooldown) { DrawLabel(x, num + 60f, 420f, 25f, $"System Recharging... {Mathf.CeilToInt(_cooldownTimer)}s", new Color(0.7f, 0.7f, 0.7f), 16); } else if (_isTalking) { DrawLabel(x, num, 500f, 35f, "=== BELL DIVER SAVING SYSTEM ===", new Color(0.2f, 0.8f, 1f), 22, bold: true); DrawLabel(x, num + 38f, 500f, 25f, "Transmitting - Distorted Signal", new Color(0.2f, 1f, 0.4f), 18); DrawLabel(x, num + 66f, 500f, 22f, $"Connection: {Mathf.CeilToInt(_talkDuration)}s remaining", new Color(0.8f, 0.8f, 0.8f), 15); } else { DrawLabel(x, num, 500f, 35f, "=== BELL DIVER SAVING SYSTEM ===", new Color(0.2f, 0.8f, 1f), 22, bold: true); DrawLabel(x, num + 38f, 500f, 25f, ((Object)(object)talkTarget != (Object)null) ? ("Press [R] to Contact " + text) : "No survivors to contact", new Color(0.6f, 0.9f, 1f), 18); } } } private static void EnsureStyles() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0032: Expected O, but got Unknown //IL_003c: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) if (!_guiInit) { _cachedBold = new GUIStyle(GUI.skin.label) { fontSize = 22, fontStyle = (FontStyle)1, alignment = (TextAnchor)0 }; _cachedBold.normal.textColor = Color.white; _cachedNormal = new GUIStyle(GUI.skin.label) { fontSize = 16, alignment = (TextAnchor)0 }; _cachedNormal.normal.textColor = Color.white; _guiInit = true; } } private static void DrawLabel(float x, float y, float w, float h, string text, Color color, int size, bool bold = false) { //IL_0024: 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) EnsureStyles(); GUIStyle val = (bold ? _cachedBold : _cachedNormal); val.fontSize = size; val.normal.textColor = color; GUI.Label(new Rect(x, y, w, h), text, val); } } public class CameraViewSystem : MonoBehaviour { private VideoCamera _heldCamera; private float _rescanTimer; internal static CameraViewSystem Instance { get; private set; } private void Awake() { Instance = this; } private void Update() { if ((Object)(object)Player.localPlayer == (Object)null) { _heldCamera = null; } else if (!Player.localPlayer.input.aimIsPressed || !GlobalInputHandler.CanTakeInput()) { _heldCamera = null; } else if ((Object)(object)_heldCamera == (Object)null) { _rescanTimer -= Time.deltaTime; if (_rescanTimer <= 0f) { _rescanTimer = 0.25f; FindHeldCamera(); } } } private void FindHeldCamera() { VideoCamera[] array = Object.FindObjectsOfType(); foreach (VideoCamera val in array) { if (((ItemInstanceBehaviour)val).isHeldByMe) { _heldCamera = val; break; } } } private void OnGUI() { //IL_006b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_heldCamera == (Object)null) { return; } Camera camera = _heldCamera.m_camera; if (!((Object)(object)camera == (Object)null)) { RenderTexture targetTexture = camera.targetTexture; if (!((Object)(object)targetTexture == (Object)null) && !((Object)(object)Player.localPlayer == (Object)null) && Player.localPlayer.input.aimIsPressed) { GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), (Texture)(object)targetTexture, (ScaleMode)0); } } } } public class ChargerBehaviour : MonoBehaviour { private Pickup _pickup; private ParticleSystem _chargeParticles; private float _checkTimer; private bool _hasParticles; private const float CHARGE_RANGE = 4f; private const float CHARGE_RATE = 30f; private const float CHECK_INTERVAL = 0.5f; private void Start() { _pickup = ((Component)this).GetComponentInParent(); SetupChargeParticles(); } private void SetupChargeParticles() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_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_0066: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("ChargeParticles"); val.transform.SetParent(((Component)this).transform, false); val.transform.localPosition = Vector3.zero; ParticleSystem val2 = val.AddComponent(); MainModule main = val2.main; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.3f, 0.6f, 1f, 0.7f)); ((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(0.15f); ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(1f); ((MainModule)(ref main)).maxParticles = 15; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).playOnAwake = false; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).enabled = true; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(8f); ShapeModule shape = val2.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0; ((ShapeModule)(ref shape)).radius = 0.3f; val.GetComponent().renderMode = (ParticleSystemRenderMode)0; _chargeParticles = val2; _hasParticles = true; } private bool IsHeld() { if ((Object)(object)_pickup == (Object)null || (Object)(object)_pickup.itemInstance == (Object)null) { return true; } return Traverse.Create((object)_pickup.itemInstance).Field("isHeld").GetValue(); } private void Update() { if ((Object)(object)_pickup == (Object)null) { return; } if (IsHeld()) { if (_hasParticles && _chargeParticles.isPlaying) { _chargeParticles.Stop(); } return; } _checkTimer -= Time.deltaTime; if (_checkTimer > 0f) { return; } _checkTimer = 0.5f; bool flag = ChargeNearbyItems(); if (_hasParticles) { if (flag && !_chargeParticles.isPlaying) { _chargeParticles.Play(); } else if (!flag && _chargeParticles.isPlaying) { _chargeParticles.Stop(); } } } private bool ChargeNearbyItems() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) bool result = false; Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, 4f); BatteryEntry val = default(BatteryEntry); for (int i = 0; i < array.Length; i++) { Pickup componentInParent = ((Component)array[i]).GetComponentInParent(); if (!((Object)(object)componentInParent == (Object)null) && !((Object)(object)componentInParent == (Object)(object)_pickup) && componentInParent.itemInstance?.instanceData != null && componentInParent.itemInstance.instanceData.TryGetEntry(ref val) && val.m_charge < val.m_maxCharge) { val.AddCharge(15f); result = true; } } return result; } private void OnDestroy() { if (_hasParticles && (Object)(object)_chargeParticles != (Object)null) { Object.Destroy((Object)(object)((Component)_chargeParticles).gameObject); } } } [HarmonyPatch] internal static class CompanyBranding { internal const string COMPANY_NAME = "ABYSSAL DEPTHS INDUSTRIES"; internal const string COMPANY_TAGLINE = "Because Someone Has to Pay for It"; internal const string BELL_MODEL = "Submersible Bell Mk.IV"; internal const string SUIT_LINE = "Standard-Issue Dive Gear"; private static Texture2D _companyLogoTex; private static Texture2D _warningTex; private static Texture2D _headerTex; private static GUIStyle _companyStyle; private static GUIStyle _taglineStyle; private static GUIStyle _bellInfoStyle; private static GUIStyle _warningStyle; private static bool _stylesInit; [HarmonyPatch(typeof(BellDiverSystem), "OnGUI")] [HarmonyPrefix] private static bool RedesignBellUI(BellDiverSystem __instance) { if (!Spectate.spectating || (Object)(object)Player.localPlayer == (Object)null || !Player.localPlayer.data.dead) { return false; } EnsureTextures(); EnsureStyles(); bool value = Traverse.Create((object)__instance).Field("_onCooldown").GetValue(); bool value2 = Traverse.Create((object)__instance).Field("_isTalking").GetValue(); bool value3 = Traverse.Create((object)__instance).Field("_wasActivated").GetValue(); float value4 = Traverse.Create((object)__instance).Field("_cooldownTimer").GetValue(); float value5 = Traverse.Create((object)__instance).Field("_talkDuration").GetValue(); bool value6 = Traverse.Create((object)__instance).Field("_signalLost").GetValue(); string speaker = "Unknown"; if ((Object)(object)Player.observedPlayer != (Object)null) { FieldInfo fieldInfo = AccessTools.Field(typeof(Player), "nickName"); if (fieldInfo != null) { speaker = (fieldInfo.GetValue(Player.observedPlayer) as string) ?? "Unknown"; } } float num = (float)Screen.width * 0.5f; float num2 = 420f; float x = num - num2 * 0.5f; float num3 = (float)Screen.height - 200f; DrawCompanyHeader(x, num3, num2); float num4 = num3 + 65f; if (value) { DrawCooldownPanel(x, num4, num2, value4); } else if (value2) { DrawTalkingPanel(x, num4, num2, value5, value6, speaker); } else if (value3) { DrawActivationPanel(x, num4, num2, speaker); } else { DrawIdlePanel(x, num4, num2, speaker); } DrawBellInfo(x, num4 + 90f, num2); return false; } private static void DrawCompanyHeader(float x, float y, float width) { //IL_0014: 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_0035: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) GUI.color = new Color(0.05f, 0.08f, 0.15f, 0.92f); GUI.DrawTexture(new Rect(x, y, width, 58f), (Texture)(object)_headerTex); GUI.color = Color.white; _companyStyle.fontSize = 16; _companyStyle.fontStyle = (FontStyle)1; _companyStyle.alignment = (TextAnchor)4; _companyStyle.normal.textColor = new Color(0.7f, 0.85f, 1f); GUI.Label(new Rect(x, y + 4f, width, 24f), "ABYSSAL DEPTHS INDUSTRIES", _companyStyle); _taglineStyle.fontSize = 10; _taglineStyle.fontStyle = (FontStyle)2; _taglineStyle.alignment = (TextAnchor)4; _taglineStyle.normal.textColor = new Color(0.5f, 0.6f, 0.7f); GUI.Label(new Rect(x, y + 28f, width, 18f), "Because Someone Has to Pay for It", _taglineStyle); GUI.color = new Color(0.3f, 0.5f, 0.8f, 0.6f); GUI.DrawTexture(new Rect(x + 10f, y + 50f, width - 20f, 1f), (Texture)(object)_warningTex); GUI.color = Color.white; } private static void DrawCooldownPanel(float x, float y, float width, float timer) { //IL_0014: 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_0035: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) GUI.color = new Color(0.1f, 0.1f, 0.15f, 0.85f); GUI.DrawTexture(new Rect(x, y, width, 45f), (Texture)(object)_warningTex); GUI.color = Color.white; _bellInfoStyle.fontSize = 13; _bellInfoStyle.alignment = (TextAnchor)4; _bellInfoStyle.normal.textColor = new Color(0.6f, 0.65f, 0.7f); GUI.Label(new Rect(x, y + 5f, width, 20f), "SYSTEM RECHARGING - Cooldown Protocol", _bellInfoStyle); _bellInfoStyle.fontSize = 18; _bellInfoStyle.fontStyle = (FontStyle)1; _bellInfoStyle.normal.textColor = new Color(0.8f, 0.6f, 0.2f); GUI.Label(new Rect(x, y + 24f, width, 20f), $"{Mathf.CeilToInt(timer)}s remaining", _bellInfoStyle); } private static void DrawTalkingPanel(float x, float y, float width, float duration, bool signalLost, string speaker) { //IL_0014: 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_0035: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_010e: 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_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) GUI.color = new Color(0.05f, 0.12f, 0.08f, 0.85f); GUI.DrawTexture(new Rect(x, y, width, 75f), (Texture)(object)_warningTex); GUI.color = Color.white; string text = (signalLost ? "SIGNAL LOST - Reconnecting..." : "ACTIVE TRANSMISSION"); Color textColor = (signalLost ? new Color(1f, 0.3f, 0.3f) : new Color(0.3f, 1f, 0.5f)); _bellInfoStyle.fontSize = 14; _bellInfoStyle.fontStyle = (FontStyle)1; _bellInfoStyle.alignment = (TextAnchor)4; _bellInfoStyle.normal.textColor = textColor; GUI.Label(new Rect(x, y + 5f, width, 22f), "[ " + text + " ]", _bellInfoStyle); _bellInfoStyle.fontSize = 12; _bellInfoStyle.fontStyle = (FontStyle)0; _bellInfoStyle.normal.textColor = new Color(0.7f, 0.8f, 0.9f); GUI.Label(new Rect(x, y + 28f, width, 18f), "Channel: " + speaker, _bellInfoStyle); _bellInfoStyle.fontSize = 16; _bellInfoStyle.fontStyle = (FontStyle)1; _bellInfoStyle.normal.textColor = new Color(0.9f, 0.9f, 0.9f); GUI.Label(new Rect(x, y + 48f, width, 22f), $"{Mathf.CeilToInt(duration)}s remaining", _bellInfoStyle); } private static void DrawActivationPanel(float x, float y, float width, string speaker) { //IL_0014: 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_0035: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) GUI.color = new Color(0.1f, 0.08f, 0.02f, 0.85f); GUI.DrawTexture(new Rect(x, y, width, 55f), (Texture)(object)_warningTex); GUI.color = Color.white; _bellInfoStyle.fontSize = 13; _bellInfoStyle.fontStyle = (FontStyle)1; _bellInfoStyle.alignment = (TextAnchor)4; _bellInfoStyle.normal.textColor = new Color(1f, 0.85f, 0.3f); GUI.Label(new Rect(x, y + 5f, width, 20f), "EMERGENCY CONTACT AVAILABLE", _bellInfoStyle); _bellInfoStyle.fontSize = 12; _bellInfoStyle.fontStyle = (FontStyle)0; _bellInfoStyle.normal.textColor = new Color(0.8f, 0.9f, 1f); GUI.Label(new Rect(x, y + 28f, width, 20f), "Press [R] to Contact " + speaker, _bellInfoStyle); } private static void DrawIdlePanel(float x, float y, float width, string speaker) { //IL_0014: 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_0035: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) GUI.color = new Color(0.08f, 0.08f, 0.12f, 0.85f); GUI.DrawTexture(new Rect(x, y, width, 55f), (Texture)(object)_warningTex); GUI.color = Color.white; _bellInfoStyle.fontSize = 13; _bellInfoStyle.fontStyle = (FontStyle)1; _bellInfoStyle.alignment = (TextAnchor)4; _bellInfoStyle.normal.textColor = new Color(0.5f, 0.7f, 1f); GUI.Label(new Rect(x, y + 5f, width, 20f), "DIVE BELL COMMUNICATION SYSTEM", _bellInfoStyle); _bellInfoStyle.fontSize = 12; _bellInfoStyle.fontStyle = (FontStyle)0; _bellInfoStyle.normal.textColor = new Color(0.7f, 0.8f, 0.9f); GUI.Label(new Rect(x, y + 28f, width, 20f), "Press [R] to Open Channel to " + speaker, _bellInfoStyle); } private static void DrawBellInfo(float x, float y, float width) { //IL_0014: 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_0035: 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_0092: Unknown result type (might be due to invalid IL or missing references) GUI.color = new Color(0.05f, 0.05f, 0.08f, 0.7f); GUI.DrawTexture(new Rect(x, y, width, 22f), (Texture)(object)_warningTex); GUI.color = Color.white; _bellInfoStyle.fontSize = 9; _bellInfoStyle.fontStyle = (FontStyle)0; _bellInfoStyle.alignment = (TextAnchor)4; _bellInfoStyle.normal.textColor = new Color(0.4f, 0.5f, 0.6f); GUI.Label(new Rect(x, y + 3f, width, 16f), string.Format("Model: {0} | Dept: Equipment Rental | Ref: ADI-{1}", "Submersible Bell Mk.IV", Random.Range(1000, 9999)), _bellInfoStyle); } private static void EnsureTextures() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0021: 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_004d: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_companyLogoTex != (Object)null)) { _companyLogoTex = new Texture2D(1, 1); _companyLogoTex.SetPixel(0, 0, Color.white); _companyLogoTex.Apply(); ((Object)_companyLogoTex).hideFlags = (HideFlags)61; _warningTex = new Texture2D(1, 1); _warningTex.SetPixel(0, 0, Color.white); _warningTex.Apply(); ((Object)_warningTex).hideFlags = (HideFlags)61; _headerTex = new Texture2D(1, 1); _headerTex.SetPixel(0, 0, Color.white); _headerTex.Apply(); ((Object)_headerTex).hideFlags = (HideFlags)61; } } private static void EnsureStyles() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0032: Expected O, but got Unknown //IL_003c: 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_0049: 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_005c: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown if (!_stylesInit) { _companyStyle = new GUIStyle(GUI.skin.label) { fontSize = 16, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; _taglineStyle = new GUIStyle(GUI.skin.label) { fontSize = 10, fontStyle = (FontStyle)2, alignment = (TextAnchor)4 }; _bellInfoStyle = new GUIStyle(GUI.skin.label) { fontSize = 12, alignment = (TextAnchor)4 }; _warningStyle = new GUIStyle(GUI.skin.label) { fontSize = 11, alignment = (TextAnchor)4 }; _stylesInit = true; } } } public class DarkWorldSystem : MonoBehaviour { private Texture2D _overlayTex; private Texture2D _vignetteTex; private float _targetAlpha; private float _currentAlpha; private const float DARKNESS_MAX = 0.78f; private const float DARK_START_DEPTH = -8f; private const float DARK_MAX_DEPTH = -200f; private static readonly Color CREEPY_TINT = new Color(0.02f, 0.05f, 0.035f); internal static DarkWorldSystem Instance { get; private set; } private void Awake() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_001b: Unknown result type (might be due to invalid IL or missing references) Instance = this; _overlayTex = new Texture2D(1, 1); _overlayTex.SetPixel(0, 0, Color.white); _overlayTex.Apply(); ((Object)_overlayTex).hideFlags = (HideFlags)61; _vignetteTex = CreateVignetteTexture(256); ((Object)_vignetteTex).hideFlags = (HideFlags)61; } private static Texture2D CreateVignetteTexture(int size) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(size, size, (TextureFormat)4, false); float num = (float)size * 0.5f; float num2 = Mathf.Sqrt(num * num + num * num); for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num3 = ((float)j + 0.5f - num) / num; float num4 = ((float)i + 0.5f - num) / num; float num5 = Mathf.Clamp01((Mathf.Sqrt(num3 * num3 + num4 * num4) - 0.55f) / (num2 - 0.55f)); val.SetPixel(j, i, new Color(0f, 0f, 0f, num5)); } } val.Apply(); ((Texture)val).wrapMode = (TextureWrapMode)1; return val; } private void Update() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.localPlayer == (Object)null) { _targetAlpha = 0f; } else { float y = ((Component)Player.localPlayer).transform.position.y; if (y < -8f) { float num = Mathf.Clamp01((0f - y - -8f) / -192f); _targetAlpha = Mathf.Lerp(0f, 0.78f, num); } else { _targetAlpha = 0f; } } _currentAlpha = Mathf.MoveTowards(_currentAlpha, _targetAlpha, Time.deltaTime * 0.5f); } private void OnGUI() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) if (!(_currentAlpha <= 0.001f) && !((Object)(object)_overlayTex == (Object)null) && !((Object)(object)_vignetteTex == (Object)null)) { float num = 1f + 0.04f * Mathf.Sin(Time.time * 0.9f) * (_currentAlpha / 0.78f); Color color = GUI.color; GUI.color = new Color(CREEPY_TINT.r, CREEPY_TINT.g, CREEPY_TINT.b, _currentAlpha * num); GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), (Texture)(object)_overlayTex); GUI.color = new Color(0f, 0f, 0f, _currentAlpha * 0.6f); GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), (Texture)(object)_vignetteTex); GUI.color = color; } } private void OnDestroy() { if ((Object)(object)_overlayTex != (Object)null) { Object.Destroy((Object)(object)_overlayTex); _overlayTex = null; } if ((Object)(object)_vignetteTex != (Object)null) { Object.Destroy((Object)(object)_vignetteTex); _vignetteTex = null; } } } [HarmonyPatch] internal static class DebtSystem { internal const int DISANTATION_FEE = 45; internal const int SUIT_LOSS_FEE = 20; internal const int OXYGEN_TANK_FEE = 2; internal const string COMPANY_NAME = "ABYSSAL DEPTHS INDUSTRIES"; internal const string COMPANY_TAGLINE = "Because Someone Has to Pay for It"; private static int _deathsSinceLastBill; [HarmonyPatch(typeof(Player), "RPCA_PlayerDie")] [HarmonyPostfix] private static void CountDeath(Player __instance) { if (!((Object)(object)__instance == (Object)null) && !__instance.ai) { _deathsSinceLastBill++; Plugin.Logger.LogInfo(string.Format("[{0}] Casualty recorded ({1} this dive)", "ABYSSAL DEPTHS INDUSTRIES", _deathsSinceLastBill)); } } [HarmonyPatch(typeof(Player), "RPCA_PlayerRevive")] [HarmonyPostfix] private static void UncountRevive(Player __instance) { if (!((Object)(object)__instance == (Object)null) && !__instance.ai && _deathsSinceLastBill > 0) { _deathsSinceLastBill--; } } [HarmonyPatch(typeof(SurfaceNetworkHandler), "InitSurface")] [HarmonyPostfix] private static void BillCompanyFeesOnReturn() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 if (SurfaceNetworkHandler.RoomStats == null || (int)TimeOfDayHandler.TimeOfDay != 10) { return; } int deathsSinceLastBill = _deathsSinceLastBill; if (deathsSinceLastBill > 0) { int num = 45 * deathsSinceLastBill; int num2 = 20 * deathsSinceLastBill; int num3 = 2 * deathsSinceLastBill; int num4 = num + num2 + num3; ShowBill("Disantation Fee", num); ShowBill("Diving Suit Recovery", num2); ShowBill("Oxygen Tank Replacement", num3); if (PhotonNetwork.IsMasterClient) { SurfaceNetworkHandler.RoomStats.RemoveMoney(num4); Plugin.Logger.LogInfo(string.Format("[{0}] Total bill: ${1} for {2} casualty(ies)", "ABYSSAL DEPTHS INDUSTRIES", num4, deathsSinceLastBill)); } _deathsSinceLastBill = 0; } } private static void ShowBill(string reason, int amount) { UserInterface.ShowMoneyNotification(reason, $"${amount}", (MoneyCellType)0); } [HarmonyPatch(typeof(SurfaceNetworkHandler), "CheckForHospitalBill")] [HarmonyPrefix] private static bool SuppressVanillaHospitalBill() { return false; } [HarmonyPatch(typeof(RoomStatsHolder), "RemoveMoney")] [HarmonyPostfix] private static void LogMoneyAfterDeduction(RoomStatsHolder __instance, int money) { Plugin.Logger.LogInfo(string.Format("[{0}] Money after deduction: ${1}", "ABYSSAL DEPTHS INDUSTRIES", __instance.Money)); } [HarmonyPatch(typeof(UI_Money), "Update")] [HarmonyPostfix] private static void ShowDebtWarning(UI_Money __instance) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) if (SurfaceNetworkHandler.RoomStats == null) { return; } int money = SurfaceNetworkHandler.RoomStats.Money; if (money < 0) { TextMeshProUGUI value = Traverse.Create((object)__instance).Field("text").GetValue(); if ((Object)(object)value != (Object)null) { ((Graphic)value).color = new Color(1f, 0.2f, 0.2f); ((TMP_Text)value).text = $"$ {money} [DEBT]"; } } } } [HarmonyPatch] internal static class EmotePreservation { private static Item _savedEmote; [HarmonyPatch(typeof(Player), "RPCA_PlayerDie")] [HarmonyPrefix] private static void SaveEmoteBeforeDeath(Player __instance) { if (__instance.refs.view.IsMine) { PlayerInventory value = Traverse.Create((object)__instance.data).Field("inventory").GetValue(); if ((Object)(object)value != (Object)null && (Object)(object)value.emote != (Object)null) { _savedEmote = value.emote; Plugin.Logger.LogInfo("Saved emote: " + value.emote.displayName); } } } [HarmonyPatch(typeof(Player), "RPCA_PlayerRevive")] [HarmonyPostfix] private static void RestoreEmoteAfterRevive(Player __instance) { if (__instance.refs.view.IsMine && !((Object)(object)_savedEmote == (Object)null)) { PlayerInventory value = Traverse.Create((object)__instance.data).Field("inventory").GetValue(); if ((Object)(object)value != (Object)null) { value.emote = _savedEmote; Plugin.Logger.LogInfo("Restored emote: " + _savedEmote.displayName); _savedEmote = null; } } } [HarmonyPatch(typeof(PlayerInventory), "Clear")] [HarmonyPrefix] private static void PreserveEmoteOnClear(PlayerInventory __instance) { Item emote = __instance.emote; if ((Object)(object)emote != (Object)null) { Plugin.Logger.LogInfo("Preserving emote through inventory clear: " + emote.displayName); } if ((Object)(object)_savedEmote == (Object)null && (Object)(object)emote != (Object)null) { _savedEmote = emote; } __instance.emote = null; } [HarmonyPatch(typeof(PlayerInventory), "Clear")] [HarmonyPostfix] private static void RestoreEmoteAfterClear(PlayerInventory __instance) { if ((Object)(object)_savedEmote != (Object)null) { __instance.emote = _savedEmote; } } } public class FallDamageSystem : MonoBehaviour { private bool _wasGrounded; private float _lastFallVelocity; private bool _tracking; private const float MIN_FALL_SPEED = 12f; private const float DAMAGE_PER_SPEED = 2.5f; private const float MAX_DAMAGE = 80f; private const float RAGDOLL_THRESHOLD = 25f; private const float RAGDOLL_DURATION = 2f; private const float DARK_WORLD_DEPTH = -10f; private const float DARK_GRAVITY_MULTIPLIER = 1.8f; private const float DARK_FALL_DAMAGE_MULTIPLIER = 1.5f; private float _originalGravity; private float _originalConstantGravity; private bool _gravityModified; private bool _gravityCached; internal static FallDamageSystem Instance { get; private set; } private void Awake() { Instance = this; } private void FixedUpdate() { //IL_00ed: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.localPlayer == (Object)null || Player.localPlayer.data == null || !Player.localPlayer.data.isLocal || Player.localPlayer.data.dead) { return; } PlayerController val = Player.localPlayer.refs?.controller; if ((Object)(object)val == (Object)null) { return; } CacheGravity(val); bool isGrounded = Player.localPlayer.data.isGrounded; if (_tracking && isGrounded && !_wasGrounded) { HandleLanding(); } if (!isGrounded) { _tracking = true; Dictionary value = Traverse.Create((object)Player.localPlayer.refs.ragdoll).Field("bodypartDict").GetValue>(); if (value != null && value.TryGetValue((BodypartType)0, out var value2)) { Rigidbody value3 = Traverse.Create((object)value2).Field("rig").GetValue(); if ((Object)(object)value3 != (Object)null) { float y = value3.linearVelocity.y; if (y < _lastFallVelocity) { _lastFallVelocity = y; } } } } else { _tracking = false; _lastFallVelocity = 0f; } ApplyDarkWorldGravity(val); _wasGrounded = isGrounded; } private void HandleLanding() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Abs(_lastFallVelocity); if (num < 12f) { return; } float num2 = (num - 12f) * 2.5f; bool flag = ((Component)Player.localPlayer).transform.position.y < -10f; if (flag) { num2 *= 1.5f; } num2 = Mathf.Min(num2, 80f); if (num2 > 0.5f) { if (num >= 25f) { Traverse.Create((object)Player.localPlayer).Method("CallTakeDamageAndAddForceAndFall", new Type[3] { typeof(float), typeof(Vector3), typeof(float) }, (object[])null).GetValue(new object[3] { num2, Vector3.zero, 2f }); } else { Player.localPlayer.CallTakeDamage(num2); } Plugin.Logger.LogInfo($"Fall damage: {num2:F1} (speed: {num:F1}" + (flag ? ", dark world" : "") + ")"); } } private void CacheGravity(PlayerController controller) { if (!_gravityCached) { _originalGravity = controller.gravity; _originalConstantGravity = controller.constantGravity; _gravityCached = true; } } private void ApplyDarkWorldGravity(PlayerController controller) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) bool flag = ((Component)Player.localPlayer).transform.position.y < -10f; if (flag && !_gravityModified) { controller.gravity = _originalGravity * 1.8f; controller.constantGravity = _originalConstantGravity * 1.8f; _gravityModified = true; Plugin.Logger.LogInfo("Dark world gravity applied"); } else if (!flag && _gravityModified) { controller.gravity = _originalGravity; controller.constantGravity = _originalConstantGravity; _gravityModified = false; Plugin.Logger.LogInfo("Dark world gravity removed"); } } private void OnDestroy() { if (_gravityModified) { PlayerController val = Player.localPlayer?.refs?.controller; if ((Object)(object)val != (Object)null) { val.gravity = _originalGravity; val.constantGravity = _originalConstantGravity; } _gravityModified = false; } } } [HarmonyPatch] internal static class FlashlightEnhancement { private const float BLUR_RANGE_MULT = 0.8f; private const float BLUR_ANGLE_MULT = 1.3f; private const float BLUR_INTENSITY_MULT = 0.9f; private const float BLUR_BEAM_STRENGTH_MULT = 0.75f; private static readonly Dictionary _originals = new Dictionary(); [HarmonyPatch(typeof(Flashlight), "ConfigItem")] [HarmonyPostfix] private static void BlurFlashlight(Flashlight __instance) { if (!((Object)(object)__instance.m_light == (Object)null)) { int instanceID = ((Object)__instance).GetInstanceID(); if (!_originals.TryGetValue(instanceID, out (float, float, float) value)) { value = (__instance.m_light.range, __instance.m_light.spotAngle, __instance.m_light.intensity); _originals[instanceID] = value; } __instance.m_light.range = value.Item1 * 0.8f; __instance.m_light.spotAngle = value.Item2 * 1.3f; __instance.m_light.intensity = value.Item3 * 0.9f; if ((Object)(object)__instance.lightBeam != (Object)null && (Object)(object)((Renderer)__instance.lightBeam).material != (Object)null) { int num = Shader.PropertyToID("_Strength"); float num2 = ((Renderer)__instance.lightBeam).material.GetFloat(num); ((Renderer)__instance.lightBeam).material.SetFloat(num, num2 * 0.75f); } } } } [HarmonyPatch] internal static class KnifoAIUpdate { private const float FLASH_FLEE_DURATION = 4f; private const float FLEE_AFTER_BITE_DURATION = 3f; private const float BITE_DAMAGE = 20f; private const float BITE_COOLDOWN = 1.5f; private const float BITE_RANGE = 1.5f; private static readonly Dictionary _biteCooldowns = new Dictionary(); private static readonly Dictionary _flashLitHistory = new Dictionary(); private static Vector3 PlayerCenter(Player p) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) return Traverse.Create((object)p).Method("Center", Array.Empty()).GetValue(); } private static bool PlayerNoControl(Player p) { return Traverse.Create((object)p).Method("NoControl", Array.Empty()).GetValue(); } private static int GetBotId(Bot bot) { return ((Object)((Component)bot).gameObject).GetInstanceID(); } [HarmonyPatch(typeof(Bot_Knifo), "Update")] [HarmonyPostfix] private static void UpdatePostfix(Bot_Knifo __instance) { //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) PhotonView value = Traverse.Create((object)__instance).Field("view").GetValue(); if ((Object)(object)value == (Object)null || !value.IsMine) { return; } Player value2 = Traverse.Create((object)__instance).Field("player").GetValue(); if ((Object)(object)value2 == (Object)null || PlayerNoControl(value2)) { return; } Bot value3 = Traverse.Create((object)__instance).Field("bot").GetValue(); if ((Object)(object)value3 == (Object)null) { return; } int botId = GetBotId(value3); Traverse val = Traverse.Create((object)__instance).Field("fleeFor"); float sinceFlashLit_PlayerLight = value3.sinceFlashLit_PlayerLight; if (sinceFlashLit_PlayerLight < 0.3f) { if (!_flashLitHistory.TryGetValue(botId, out var value4) || value4 >= 0.3f) { Vector3 val2 = (((Object)(object)value3.targetPlayer != (Object)null) ? PlayerCenter(value3.targetPlayer) : (((Component)value3).transform.position + ((Component)value3).transform.forward)); Traverse.Create((object)__instance).Field("fleeFromPoint").SetValue((object)val2); val.SetValue((object)4f); Plugin.Logger.LogInfo($"Knifo startled by flashlight, fleeing for {4f}s"); } _flashLitHistory[botId] = sinceFlashLit_PlayerLight; if (val.GetValue() > 0f) { return; } } else { _flashLitHistory[botId] = sinceFlashLit_PlayerLight; } if (!(val.GetValue() > 0f)) { if (!_biteCooldowns.TryGetValue(botId, out var value5)) { value5 = 0f; } _biteCooldowns[botId] = Mathf.Max(0f, value5 - Time.deltaTime); if (!((Object)(object)value3.targetPlayer == (Object)null) && !value3.targetPlayer.data.dead && !(value3.distanceToTarget > 1.5f) && !(_biteCooldowns[botId] > 0f)) { _biteCooldowns[botId] = 1.5f; value3.targetPlayer.CallTakeDamage(20f); Plugin.Logger.LogInfo($"Knifo bit {((TMP_Text)value3.targetPlayer.m_name).text} for {20f} damage"); Traverse.Create((object)__instance).Field("fleeFromPoint").SetValue((object)PlayerCenter(value3.targetPlayer)); val.SetValue((object)3f); } } } } [HarmonyPatch] internal static class KnifoShockPatch { private static Vector3 BotCenter(Bot bot) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) return Traverse.Create((object)bot).Method("Center", Array.Empty()).GetValue(); } [HarmonyPatch(typeof(ShockStickTrigger), "OnTriggerStay")] [HarmonyPostfix] private static void ShockKnifoPostfix(Collider other) { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)other == (Object)null || other.isTrigger) { return; } Player component = ((Component)((Component)other).transform.root).GetComponent(); if ((Object)(object)component == (Object)null) { return; } Bot componentInChildren = ((Component)component).GetComponentInChildren(); if ((Object)(object)componentInChildren == (Object)null || (Object)(object)((Component)componentInChildren).GetComponent() == (Object)null) { return; } Plugin.Logger.LogInfo("Knifo shocked! Fleeing..."); int num = 0; Bot[] array = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (Bot val in array) { if (!((Object)(object)val == (Object)(object)componentInChildren) && (Object)(object)((Component)val).GetComponent() != (Object)null && Vector3.Distance(BotCenter(componentInChildren), BotCenter(val)) < 20f) { num++; } } if (num >= 1) { Plugin.Logger.LogInfo($"Knifo group ({num + 1} total) - shocked one flees, others stay"); } else { Plugin.Logger.LogInfo("Knifo alone - fleeing from shock"); } componentInChildren.hurt = true; Traverse.Create((object)componentInChildren).Method("LoseTarget", Array.Empty()).GetValue(); } } public class KnifoTag : MonoBehaviour { } [HarmonyPatch] internal static class KnifoTagPatch { [HarmonyPatch(typeof(Bot_Knifo), "Start")] [HarmonyPostfix] private static void TagKnifo(Bot_Knifo __instance) { if ((Object)(object)((Component)__instance).GetComponent() == (Object)null) { ((Component)__instance).gameObject.AddComponent(); Plugin.Logger.LogInfo("Tagged Knifo monster"); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "fatoo.DepthsOfWarning"; public const string PLUGIN_NAME = "Depths of Warning"; public const string PLUGIN_VERSION = "1.0.0"; } [HarmonyPatch] internal static class Patches { private const byte DIVING_BELL_CAT = 8; private const string DIVING_BELL_NAME = "ADI Equipment"; private const string UPGRADE_NAME = "Bell Power Cell"; private const int UPGRADE_PRICE = 350; private const byte MUTATIONS_CAT = 9; private const string MUTATIONS_NAME = "Mutations"; private const string SIZE_MUTATION_NAME = "Size Mutation"; private const int SIZE_MUTATION_PRICE = 500; private static byte _upgradeItemId; private static bool _upgradeInitialized; private static Item _upgradeItem; private static Material _cachedMat; private static byte _sizeMutationItemId; private static bool _sizeMutationInitialized; private static Item _sizeMutationItem; [HarmonyPatch(typeof(PlayerInventory), "Awake")] [HarmonyPostfix] private static void ResizeInventorySlots(PlayerInventory __instance) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown PlayerAttributeSystem instance = PlayerAttributeSystem.Instance; if ((Object)(object)instance == (Object)null) { return; } int inventorySlotCount = instance.GetInventorySlotCount(); if (__instance.slots.Length == inventorySlotCount) { return; } InventorySlot[] array = (InventorySlot[])(object)new InventorySlot[inventorySlotCount]; for (int i = 0; i < inventorySlotCount; i++) { if (i < __instance.slots.Length) { array[i] = __instance.slots[i]; } else { array[i] = new InventorySlot(i, __instance); } } __instance.slots = array; } [HarmonyPatch(typeof(Player), "Start")] [HarmonyPostfix] private static void ApplyInitialSizeModifiers(Player __instance) { PlayerAttributeSystem instance = PlayerAttributeSystem.Instance; if (!((Object)(object)instance == (Object)null) && __instance.data.isLocal) { float sizeMultiplier = instance.SizeMultiplier; if (!Mathf.Approximately(sizeMultiplier, 1f)) { float num = (PlayerData.maxHealth = 100f * sizeMultiplier); __instance.data.health = Mathf.Min(__instance.data.health, num); float num2 = 500f * sizeMultiplier; __instance.data.remainingOxygen = num2; __instance.data.maxOxygen = num2; } } } [HarmonyPatch(typeof(PlayerAnimationHandler), "HandleAnimationTarget")] [HarmonyPostfix] private static void FixTargetHeightForScale(PlayerAnimationHandler __instance) { PlayerAttributeSystem instance = PlayerAttributeSystem.Instance; if (!((Object)(object)instance == (Object)null) && !Mathf.Approximately(instance.SizeMultiplier, 1f)) { Player value = Traverse.Create((object)__instance).Field("player").GetValue(); if (!((Object)(object)value == (Object)null) && value.data.isLocal) { PlayerData data = value.data; data.targetHeight /= instance.SizeMultiplier; } } } [HarmonyPatch(typeof(Spectate), "Switching")] [HarmonyPrefix] private static bool PreventSpectateSwitch() { BellDiverSystem instance = BellDiverSystem.Instance; if ((Object)(object)instance != (Object)null && instance.IsTalking) { return false; } return true; } [HarmonyPatch(typeof(ShopViewScreen), "DrawCategories")] [HarmonyPostfix] private static void AddDivingBellCategory(ShopViewScreen __instance) { Traverse obj = Traverse.Create((object)__instance); GameObject value = obj.Field("m_CategoryCell").GetValue(); Transform value2 = obj.Field("m_CategoriesGrid").GetValue(); ShopHandler value3 = obj.Field("m_ShopHandler").GetValue(); GameObject obj2 = Object.Instantiate(value, value2); obj2.SetActive(true); Traverse obj3 = Traverse.Create((object)obj2.GetComponent()); obj3.Field("m_Category").SetValue((object)(ShopItemCategory)8); obj3.Field("m_ShopHandler").SetValue((object)value3); obj3.Method("UpdateCategoryText", Array.Empty()).GetValue(); GameObject obj4 = Object.Instantiate(value, value2); obj4.SetActive(true); Traverse obj5 = Traverse.Create((object)obj4.GetComponent()); obj5.Field("m_Category").SetValue((object)(ShopItemCategory)9); obj5.Field("m_ShopHandler").SetValue((object)value3); obj5.Method("UpdateCategoryText", Array.Empty()).GetValue(); } [HarmonyPatch(typeof(ShopInteractibleCategory), "UpdateCategoryText")] [HarmonyPrefix] private static bool DivingBellCategoryText(ShopInteractibleCategory __instance) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) switch ((byte)(object)Traverse.Create((object)__instance).Field("m_Category").GetValue()) { case 8: Traverse.Create((object)__instance).Field("m_CategoryText").GetValue() .text = "ADI Equipment"; ((Interactable)__instance).hoverText = "View ADI Equipment Items"; return false; case 9: Traverse.Create((object)__instance).Field("m_CategoryText").GetValue() .text = "Mutations"; ((Interactable)__instance).hoverText = "View Mutations Items"; return false; default: return true; } } [HarmonyPatch(typeof(ShopViewScreen), "UpdateViewScreen")] [HarmonyPrefix] private static bool DivingBellViewScreen(ShopViewScreen __instance) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) byte b = (byte)(object)Traverse.Create((object)__instance).Field("m_CurrentCategoryScreenIndex").GetValue(); string text = null; switch (b) { case 8: text = "ADI Equipment"; break; case 9: text = "Mutations"; break; } if (text != null) { Traverse.Create((object)__instance).Field("m_CurrentCategoryNameText").GetValue() .text = text.ToUpper(); IDictionary obj = (IDictionary)Traverse.Create((object)Traverse.Create((object)__instance).Field("m_ShopHandler").GetValue()).Field("m_CategoryItemDic").GetValue(); List list = new List(); foreach (DictionaryEntry item in obj) { if ((byte)item.Key == b) { List collection = (List)item.Value; list.AddRange(collection); } } Traverse.Create((object)__instance).Property("CurrentShopItems", (object[])null).SetValue((object)list.ToArray()); Traverse.Create((object)__instance).Method("DrawItems", Array.Empty()).GetValue(); return false; } return true; } [HarmonyPatch(typeof(ShopViewScreen), "DrawItems")] [HarmonyPostfix] private static void AddScrollingToItems(ShopViewScreen __instance) { RectTransform value = Traverse.Create((object)__instance).Field("m_ItemsGrid").GetValue(); if ((Object)(object)value == (Object)null) { return; } Transform parent = ((Transform)value).parent; RectTransform val = (RectTransform)(object)((parent is RectTransform) ? parent : null); if ((Object)(object)val == (Object)null) { return; } ScrollRect val2 = ((Component)val).GetComponent(); if ((Object)(object)val2 == (Object)null) { val2 = ((Component)val).gameObject.AddComponent(); val2.content = value; val2.horizontal = false; val2.vertical = true; val2.movementType = (MovementType)2; val2.inertia = true; val2.decelerationRate = 0.135f; if ((Object)(object)((Component)val).GetComponent() == (Object)null) { ((Component)val).gameObject.AddComponent(); } } val2.verticalNormalizedPosition = 1f; } [HarmonyPatch(typeof(ShopHandler), "InitShop")] [HarmonyPostfix] private static void AddChargingUpgrade(ShopHandler __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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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) //IL_00d4: 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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_016b: 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_023c: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0274: 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) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_039d: 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) if (_upgradeInitialized) { return; } _upgradeInitialized = true; try { _upgradeItem = ScriptableObject.CreateInstance(); _upgradeItem.displayName = "Bell Power Cell"; _upgradeItem.purchasable = true; _upgradeItem.price = 350; _upgradeItem.Category = (ShopItemCategory)8; _upgradeItem.itemType = (ItemType)1; _upgradeItem.spawnable = false; _upgradeItem.mass = 2f; _upgradeItem.holdPos = new Vector3(0f, -0.3f, 0.5f); _upgradeItem.holdRotation = Vector3.zero; _upgradeItem.groundSizeMultiplier = 1f; _upgradeItem.groundMassMultiplier = 1f; GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val).name = "ChargerPlaceholder"; val.transform.localScale = Vector3.zero; Object.DontDestroyOnLoad((Object)(object)val); _upgradeItem.itemObject = val; ((DatabaseAsset)(object)SingletonAsset.Instance).AddRuntimeEntry(_upgradeItem); _upgradeItemId = _upgradeItem.id; IDictionary dictionary = (IDictionary)Traverse.Create((object)__instance).Field("m_CategoryItemDic").GetValue(); IDictionary obj = (IDictionary)Traverse.Create((object)__instance).Field("m_ItemsForSaleDictionary").GetValue(); ShopItem val2 = default(ShopItem); ((ShopItem)(ref val2))..ctor(_upgradeItem); ShopItemCategory val3 = (ShopItemCategory)8; if (!dictionary.Contains(val3)) { dictionary.Add(value: Activator.CreateInstance(typeof(List)), key: val3); } ((IList)dictionary[val3]).Add(val2); obj.Add(_upgradeItemId, val2); Plugin.Logger.LogInfo(string.Format("Added {0} (ID: {1}) to shop", "Bell Power Cell", _upgradeItemId)); } catch (Exception ex) { Plugin.Logger.LogError("Failed to add Charging Upgrade: " + ex.Message); } if (_sizeMutationInitialized) { return; } _sizeMutationInitialized = true; try { _sizeMutationItem = ScriptableObject.CreateInstance(); _sizeMutationItem.displayName = "Size Mutation"; _sizeMutationItem.purchasable = true; _sizeMutationItem.price = 500; _sizeMutationItem.Category = (ShopItemCategory)9; _sizeMutationItem.itemType = (ItemType)1; _sizeMutationItem.spawnable = false; _sizeMutationItem.mass = 0.5f; _sizeMutationItem.holdPos = new Vector3(0.3f, -0.2f, 0.4f); _sizeMutationItem.holdRotation = Vector3.zero; _sizeMutationItem.groundSizeMultiplier = 1f; _sizeMutationItem.groundMassMultiplier = 1f; GameObject val4 = GameObject.CreatePrimitive((PrimitiveType)0); ((Object)val4).name = "SizeMutationPlaceholder"; val4.transform.localScale = Vector3.zero; Object.DontDestroyOnLoad((Object)(object)val4); _sizeMutationItem.itemObject = val4; ((DatabaseAsset)(object)SingletonAsset.Instance).AddRuntimeEntry(_sizeMutationItem); _sizeMutationItemId = _sizeMutationItem.id; IDictionary dictionary2 = (IDictionary)Traverse.Create((object)__instance).Field("m_CategoryItemDic").GetValue(); IDictionary obj2 = (IDictionary)Traverse.Create((object)__instance).Field("m_ItemsForSaleDictionary").GetValue(); ShopItem val5 = default(ShopItem); ((ShopItem)(ref val5))..ctor(_sizeMutationItem); ShopItemCategory val6 = (ShopItemCategory)9; if (!dictionary2.Contains(val6)) { dictionary2.Add(value: Activator.CreateInstance(typeof(List)), key: val6); } ((IList)dictionary2[val6]).Add(val5); obj2.Add(_sizeMutationItemId, val5); Plugin.Logger.LogInfo(string.Format("Added {0} (ID: {1}) to shop", "Size Mutation", _sizeMutationItemId)); } catch (Exception ex2) { Plugin.Logger.LogError("Failed to add SizeMutation: " + ex2.Message); } } [HarmonyPatch(typeof(Pickup), "ConfigurePickup", new Type[] { typeof(byte), typeof(ItemInstanceData), typeof(Vector3), typeof(Vector3) })] [HarmonyPostfix] private static void SetupChargerVisual(Pickup __instance, byte itemID) { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Expected O, but got Unknown //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Expected O, but got Unknown //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Expected O, but got Unknown if ((!_upgradeInitialized && !_sizeMutationInitialized) || (Object)(object)__instance.itemInstance == (Object)null || (Object)(object)__instance.itemInstance.item == (Object)null) { return; } byte id = __instance.itemInstance.item.id; if (_upgradeInitialized && id == _upgradeItemId) { Plugin.Logger.LogInfo("Creating charger visual..."); GameObject val = GameObject.CreatePrimitive((PrimitiveType)2); ((Object)val).name = "ChargerVisual"; val.transform.SetParent(((Component)__instance).transform, false); val.transform.localScale = new Vector3(0.4f, 0.3f, 0.4f); MeshRenderer component = val.GetComponent(); if ((Object)(object)_cachedMat == (Object)null) { MeshRenderer[] array = Object.FindObjectsOfType(); foreach (MeshRenderer val2 in array) { if ((Object)(object)val2 != (Object)(object)component && (Object)(object)((Renderer)val2).sharedMaterial != (Object)null && (Object)(object)((Renderer)val2).sharedMaterial.shader != (Object)null) { _cachedMat = new Material(((Renderer)val2).sharedMaterial); break; } } } if ((Object)(object)_cachedMat != (Object)null) { ((Renderer)component).material = new Material(_cachedMat); ((Renderer)component).material.color = new Color(0.15f, 0.35f, 0.7f); } val.AddComponent(); Plugin.Logger.LogInfo("Charger visual created on pickup"); } if (!_sizeMutationInitialized || id != _sizeMutationItemId) { return; } Plugin.Logger.LogInfo("Creating SizeMutation visual..."); GameObject val3 = GameObject.CreatePrimitive((PrimitiveType)0); ((Object)val3).name = "SizeMutationVisual"; val3.transform.SetParent(((Component)__instance).transform, false); val3.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f); MeshRenderer component2 = val3.GetComponent(); if ((Object)(object)_cachedMat == (Object)null) { MeshRenderer[] array = Object.FindObjectsOfType(); foreach (MeshRenderer val4 in array) { if ((Object)(object)val4 != (Object)(object)component2 && (Object)(object)((Renderer)val4).sharedMaterial != (Object)null && (Object)(object)((Renderer)val4).sharedMaterial.shader != (Object)null) { _cachedMat = new Material(((Renderer)val4).sharedMaterial); break; } } } if ((Object)(object)_cachedMat != (Object)null) { ((Renderer)component2).material = new Material(_cachedMat); ((Renderer)component2).material.color = new Color(0.2f, 0.4f, 0.9f); } val3.AddComponent(); Plugin.Logger.LogInfo("SizeMutation visual created on pickup"); } } public class PlayerAttributeSystem : MonoBehaviour { private float _sizeMultiplier = 1f; private float _targetSize = 1f; private float _appliedSizeMultiplier = 1f; private const float MIN_SIZE = 1f; private const float MAX_SIZE = 1.5f; private const float SIZE_STEP = 0.1f; private const float SIZE_LERP_SPEED = 2f; private const int BASE_INVENTORY_SLOTS = 4; private const int MAX_INVENTORY_SLOTS = 5; private float _baseMovementForce; private float _baseSprintMultiplier; private float _baseJumpImpulse; private float _baseStandForce; private bool _baseCached; private float _syncTimer; private float _lastSyncedSize = 1f; private float _resyncTimer; private Dictionary _originalMasses = new Dictionary(); private bool _massesCached; internal static PlayerAttributeSystem Instance { get; private set; } internal float SizeMultiplier => _sizeMultiplier; private void Awake() { Instance = this; } private void Update() { if ((Object)(object)Player.localPlayer == (Object)null || Player.localPlayer.data == null || (Object)(object)Player.localPlayer.refs?.controller == (Object)null) { return; } if (Input.GetKeyDown((KeyCode)61) || Input.GetKeyDown((KeyCode)270)) { _targetSize = Mathf.Clamp(_targetSize + 0.1f, 1f, 1.5f); _targetSize = Mathf.Round(_targetSize * 10f) / 10f; Plugin.Logger.LogInfo($"Size target: x{_targetSize:F1}"); } else if (Input.GetKeyDown((KeyCode)45) || Input.GetKeyDown((KeyCode)269)) { _targetSize = Mathf.Clamp(_targetSize - 0.1f, 1f, 1.5f); _targetSize = Mathf.Round(_targetSize * 10f) / 10f; Plugin.Logger.LogInfo($"Size target: x{_targetSize:F1}"); } if (!_baseCached) { CacheBaseValues(); } if (!Mathf.Approximately(_sizeMultiplier, _targetSize)) { _sizeMultiplier = Mathf.MoveTowards(_sizeMultiplier, _targetSize, 2f * Time.deltaTime); if (Mathf.Abs(_sizeMultiplier - _targetSize) < 0.005f) { _sizeMultiplier = _targetSize; } ResizeInventorySlots(); } if (_baseCached) { ApplyModifiers(); } if (!Mathf.Approximately(_appliedSizeMultiplier, _sizeMultiplier)) { ApplyVisualScale(); } SyncSizeOverNetwork(); } private void SyncSizeOverNetwork() { _syncTimer -= Time.deltaTime; if (_syncTimer <= 0f) { _syncTimer = 0.2f; if (Mathf.Abs(_sizeMultiplier - _lastSyncedSize) > 0.005f) { SizeSyncSystem.BroadcastSize(_sizeMultiplier); _lastSyncedSize = _sizeMultiplier; } } _resyncTimer -= Time.deltaTime; if (_resyncTimer <= 0f) { _resyncTimer = 2f; if (!Mathf.Approximately(_sizeMultiplier, 1f)) { SizeSyncSystem.BroadcastSize(_sizeMultiplier); } } } private void CacheBaseValues() { PlayerController controller = Player.localPlayer.refs.controller; _baseMovementForce = controller.movementForce; _baseSprintMultiplier = controller.sprintMultiplier; _baseJumpImpulse = controller.jumpImpulse; _baseStandForce = controller.standForce; _baseCached = true; Plugin.Logger.LogInfo($"Cached base: speed={_baseMovementForce}, sprint={_baseSprintMultiplier}, jump={_baseJumpImpulse}, stand={_baseStandForce}"); } public void SetTargetSize(float newSize) { newSize = Mathf.Clamp(newSize, 1f, 1.5f); _targetSize = Mathf.Round(newSize * 10f) / 10f; Plugin.Logger.LogInfo($"SizeMutation target: x{_targetSize:F1}"); } private void ApplyModifiers() { PlayerController controller = Player.localPlayer.refs.controller; PlayerData data = Player.localPlayer.data; float num = (PlayerData.maxHealth = 100f * _sizeMultiplier); if (data.health > num) { data.health = num; } float num2 = (data.maxOxygen = 500f * _sizeMultiplier); if (data.remainingOxygen > num2) { data.remainingOxygen = num2; } SpeedModeSystem instance = SpeedModeSystem.Instance; if (!((Object)(object)instance != (Object)null) || !instance.IsSpeedModeActive) { float num3 = 1f - (_sizeMultiplier - 1f) * 0.08f; controller.movementForce = _baseMovementForce * num3; controller.sprintMultiplier = _baseSprintMultiplier; } float num4 = _sizeMultiplier * _sizeMultiplier * _sizeMultiplier; controller.standForce = _baseStandForce * num4; if (!Mathf.Approximately(_sizeMultiplier, 1f) && data.isSprinting) { float num5 = (_sizeMultiplier - 1f) * 15f * Time.deltaTime; data.currentStamina = Mathf.Max(0f, data.currentStamina - num5); } } private void ApplyVisualScale() { //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) PlayerRefs refs = Player.localPlayer.refs; if (refs == null) { return; } float appliedSizeMultiplier = _appliedSizeMultiplier; float sizeMultiplier = _sizeMultiplier; float num = sizeMultiplier - appliedSizeMultiplier; if ((Object)(object)refs.rigRoot != (Object)null && !Mathf.Approximately(num, 0f)) { float num2 = num * 0.9f; Bodypart value = Traverse.Create((object)refs.ragdoll).Method("GetBodypart", new Type[1] { typeof(BodypartType) }, (object[])null).GetValue(new object[1] { (object)(BodypartType)0 }); if ((Object)(object)value != (Object)null) { Rigidbody value2 = Traverse.Create((object)value).Field("rig").GetValue(); if ((Object)(object)value2 != (Object)null) { Transform transform = ((Component)value2).transform; transform.position += Vector3.up * num2; } } } if ((Object)(object)refs.rigRoot != (Object)null) { refs.rigRoot.transform.localScale = Vector3.one * sizeMultiplier; } if ((Object)(object)refs.animatorTransform != (Object)null) { refs.animatorTransform.localScale = Vector3.one * sizeMultiplier; } ScaleMasses(); if ((Object)(object)refs.ragdoll != (Object)null) { Traverse.Create((object)refs.ragdoll).Method("BodyChanged", Array.Empty()).GetValue(); } if ((Object)(object)refs.cameraPos != (Object)null) { refs.cameraPos.localScale = Vector3.one / _sizeMultiplier; } if ((Object)(object)Player.localPlayer.m_name != (Object)null) { Player.localPlayer.m_name.transform.localScale = Vector3.one / _sizeMultiplier; } _appliedSizeMultiplier = _sizeMultiplier; } private void ScaleMasses() { PlayerRefs refs = Player.localPlayer.refs; if ((Object)(object)refs.ragdoll == (Object)null) { return; } float num = _sizeMultiplier * _sizeMultiplier * _sizeMultiplier; List value = Traverse.Create((object)refs.ragdoll).Field("bodypartList").GetValue>(); if (value == null) { return; } if (!_massesCached) { _originalMasses.Clear(); foreach (Bodypart item in value) { if (!((Object)(object)item == (Object)null)) { Rigidbody component = ((Component)item).GetComponent(); if ((Object)(object)component != (Object)null) { _originalMasses[component] = component.mass; } } } _massesCached = true; } foreach (Bodypart item2 in value) { if (!((Object)(object)item2 == (Object)null)) { Rigidbody component2 = ((Component)item2).GetComponent(); if ((Object)(object)component2 != (Object)null && _originalMasses.TryGetValue(component2, out var value2)) { component2.mass = value2 * num; } } } SphereCollider value3 = Traverse.Create((object)refs).Field("simpleCollider").GetValue(); if ((Object)(object)value3 != (Object)null) { value3.radius = 0.5f * _sizeMultiplier; } } internal int GetInventorySlotCount() { int num = Mathf.FloorToInt((_sizeMultiplier - 1f) * 1f); return Mathf.Clamp(4 + num, 4, 5); } private void ResizeInventorySlots() { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown if ((Object)(object)Player.localPlayer == (Object)null) { return; } PlayerData data = Player.localPlayer.data; if (data == null) { return; } PhotonView val = Player.localPlayer.refs?.view; if ((Object)(object)val == (Object)null || !val.IsMine) { return; } int inventorySlotCount = GetInventorySlotCount(); PlayerInventory value = Traverse.Create((object)data).Field("inventory").GetValue(); if ((Object)(object)value == (Object)null || value.slots == null || value.slots.Length == inventorySlotCount) { return; } InventorySlot[] array = (InventorySlot[])(object)new InventorySlot[inventorySlotCount]; for (int i = 0; i < inventorySlotCount; i++) { if (i < value.slots.Length) { array[i] = value.slots[i]; } else { array[i] = new InventorySlot(i, value); } } value.slots = array; Plugin.Logger.LogInfo($"Inventory resized to {inventorySlotCount} slots"); } internal void Reset() { _sizeMultiplier = 1f; _targetSize = 1f; _appliedSizeMultiplier = 1f; _baseCached = false; _massesCached = false; _originalMasses.Clear(); _lastSyncedSize = 1f; _syncTimer = 0f; _resyncTimer = 0f; } private void OnDestroy() { Reset(); } } [ContentWarningPlugin("fatoo.DepthsOfWarning", "1.0.0", false)] public class Plugin { public static class Logger { public static void LogInfo(string msg) { Debug.Log((object)("[DepthsOfWarning] " + msg)); } public static void LogError(string msg) { Debug.LogError((object)("[DepthsOfWarning] " + msg)); } public static void LogWarning(string msg) { Debug.LogWarning((object)("[DepthsOfWarning] " + msg)); } } static Plugin() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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) Logger.LogInfo("Loading v1.0.0..."); GameObject val = new GameObject("DepthsOfWarning"); Object.DontDestroyOnLoad((Object)val); val.AddComponent(); val.AddComponent(); val.AddComponent(); val.AddComponent(); val.AddComponent(); val.AddComponent(); val.AddComponent(); Logger.LogInfo("Loaded successfully!"); } } public class SizeMutationBehaviour : MonoBehaviour { private Pickup _pickup; private bool _used; private void Start() { _pickup = ((Component)this).GetComponentInParent(); } private void Update() { if (!((Object)(object)_pickup == (Object)null) && !_used && !((Object)(object)_pickup.itemInstance == (Object)null) && Traverse.Create((object)_pickup.itemInstance).Field("isHeld").GetValue() && !((Object)(object)Player.localPlayer == (Object)null) && Player.localPlayer.input != null && Player.localPlayer.input.clickWasPressed) { UseMutation(); } } private void UseMutation() { //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) _used = true; float num = Random.Range(1f, 1.5f); num = Mathf.Round(num * 10f) / 10f; Plugin.Logger.LogInfo($"SizeMutation used! New target size: x{num:F1}"); PlayerAttributeSystem.Instance.SetTargetSize(num); if ((Object)(object)Player.localPlayer.refs?.view != (Object)null && Player.localPlayer.refs.view.IsMine) { PlayerInventory value = Traverse.Create((object)Player.localPlayer.data).Field("inventory").GetValue(); if ((Object)(object)value != (Object)null) { for (int i = 0; i < value.slots.Length; i++) { if ((Object)(object)value.slots[i].ItemInSlot.item != (Object)null && value.slots[i].ItemInSlot.item.id == _pickup.itemInstance.item.id) { value.slots[i].Clear(); break; } } } } Plugin.Logger.LogInfo("SizeMutation consumed"); } } public class SizeSyncSystem : MonoBehaviour { private const byte SIZE_EVENT_CODE = 222; private static readonly Dictionary _actorSizes = new Dictionary(); private void Awake() { PhotonNetwork.NetworkingClient.EventReceived += OnSizeEvent; } private void OnDestroy() { PhotonNetwork.NetworkingClient.EventReceived -= OnSizeEvent; _actorSizes.Clear(); } private void Update() { if (_actorSizes.Count == 0) { return; } foreach (KeyValuePair actorSize in _actorSizes) { ApplySizeToActor(actorSize.Key, actorSize.Value); } } internal static void BroadcastSize(float size) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.InRoom || size < 1f) { return; } try { object[] array = new object[2] { PhotonNetwork.LocalPlayer.ActorNumber, size }; RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)0 }; SendOptions val2 = default(SendOptions); ((SendOptions)(ref val2)).Reliability = true; SendOptions val3 = val2; PhotonNetwork.RaiseEvent((byte)222, (object)array, val, val3); } catch (Exception ex) { Plugin.Logger.LogWarning("SizeSync send error: " + ex.Message); } } private static void OnSizeEvent(EventData eventData) { if (eventData.Code != 222) { return; } try { if (eventData.CustomData is object[] array && array.Length >= 2) { int num = (int)array[0]; float num2 = (float)array[1]; if (!(num2 <= 0.01f)) { _actorSizes[num] = num2; ApplySizeToActor(num, num2); } } } catch (Exception ex) { Plugin.Logger.LogWarning("SizeSync receive error: " + ex.Message); } } private static void ApplySizeToActor(int actor, float size) { if ((Object)(object)PlayerHandler.instance == (Object)null) { return; } List players = PlayerHandler.instance.players; if (players == null) { return; } foreach (Player item in players) { if (!((Object)(object)item == (Object)null) && !((Object)(object)item.refs?.view == (Object)null) && item.refs.view.OwnerActorNr == actor) { ApplyVisualScaleRemote(item, size); break; } } } private static void ApplyVisualScaleRemote(Player p, float size) { //IL_002c: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if (p.refs != null) { if ((Object)(object)p.refs.rigRoot != (Object)null) { p.refs.rigRoot.transform.localScale = Vector3.one * size; } if ((Object)(object)p.refs.animatorTransform != (Object)null) { ((Component)p.refs.animatorTransform).transform.localScale = Vector3.one * size; } SphereCollider value = Traverse.Create((object)p.refs).Field("simpleCollider").GetValue(); if ((Object)(object)value != (Object)null) { value.radius = 0.5f * size; } } } internal static void Reset() { _actorSizes.Clear(); } } public class SpeedModeSystem : MonoBehaviour { private bool _speedModeActive; private bool _wasSprinting; private float _originalMovementForce; private float _originalSprintMultiplier; private float _originalJumpImpulse; private const float SPEED_BOOST_MULTIPLIER = 1.4f; private const float SPRINT_BOOST_MULTIPLIER = 1.3f; private const float STAMINA_BOOST_PERCENT = 0.15f; private const float STAMINA_DRAIN_MULTIPLIER = 2.5f; private const float JUMP_BOOST_MULTIPLIER = 1.5f; internal static SpeedModeSystem Instance { get; private set; } internal bool IsSpeedModeActive => _speedModeActive; private void Awake() { Instance = this; } private void Update() { if ((Object)(object)Player.localPlayer == (Object)null || Player.localPlayer.data == null) { if (_speedModeActive) { ExitSpeedMode(); } return; } PlayerData data = Player.localPlayer.data; PlayerController val = Player.localPlayer.refs?.controller; if ((Object)(object)val == (Object)null) { if (_speedModeActive) { ExitSpeedMode(); } return; } bool isSprinting = data.isSprinting; bool flag = Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305); if (!_speedModeActive && isSprinting && flag) { EnterSpeedMode(val, data); } else if (_speedModeActive && (!isSprinting || !flag)) { ExitSpeedMode(); } if (_speedModeActive) { ApplySpeedModeDrain(data); } } private void EnterSpeedMode(PlayerController controller, PlayerData data) { _speedModeActive = true; _originalMovementForce = controller.movementForce; _originalSprintMultiplier = controller.sprintMultiplier; _originalJumpImpulse = controller.jumpImpulse; controller.movementForce *= 1.4f; controller.sprintMultiplier *= 1.3f; controller.jumpImpulse *= 1.5f; Plugin.Logger.LogInfo("Speed Mode activated"); } private void ExitSpeedMode() { if (_speedModeActive) { _speedModeActive = false; PlayerController val = Player.localPlayer?.refs?.controller; if ((Object)(object)val != (Object)null) { val.movementForce = _originalMovementForce; val.sprintMultiplier = _originalSprintMultiplier; val.jumpImpulse = _originalJumpImpulse; } Plugin.Logger.LogInfo("Speed Mode deactivated"); } } private void ApplySpeedModeDrain(PlayerData data) { PlayerController val = Player.localPlayer?.refs?.controller; if (!((Object)(object)val == (Object)null)) { float num = val.staminaRegRate * 1.5f * Time.deltaTime; data.currentStamina = Mathf.Max(0f, data.currentStamina - num); } } private void OnDestroy() { if (_speedModeActive) { ExitSpeedMode(); } } } [HarmonyPatch] internal static class VideoEnhancementSystem { private sealed class EventMoment { public string Name; public float Time; public float SeenAmount; public ushort EventId; public string PlayerName; public bool IsMonster; public bool IsDeath; public bool IsSpeech; public bool IsMic; public bool IsDamage; public bool IsCatch; public bool IsEmote; public bool IsFall; public bool IsRagdoll; public bool IsBomb; public bool IsHat; public bool IsShroom; public bool IsStreamer; } private static int _totalSubscribers; private static int _totalLikes; private static int _currentViews; private static int _videoViews; private static bool _donationsUnlocked; private static readonly List _donationComments = new List(); private const int DONATION_UNLOCK_THRESHOLD = 20; private const float SUBS_PER_VIEW = 0.03f; private const float LIKES_PER_VIEW = 0.12f; private const float MAX_COMMENT_LIKES_FRACTION = 0.08f; private const float KILLER_WINDOW_SECONDS = 20f; private const float SPEECH_THRESHOLD = 0.4f; private const int MAX_BRAIN_COMMENTS = 60; private const int MIN_ORGANIC_COMMENTS = 6; private const int MAX_ORGANIC_COMMENTS = 12; private const int MIN_DONATION = 5; private const int MAX_DONATION = 50; private static readonly string[] DONATION_NAMES = new string[16] { "xX_GhoulFan_Xx", "SpookyViewer42", "DeepSeaLurker", "ContentConnoisseur", "VideoVulture", "BellBoyFan", "AbyssWatcher", "CreepCamera", "MonsterMash_Mike", "DiveBellDan", "QuotaCrusher99", "OxygenThief", "DepthCharge", "SirenSongStan", "PressurePunk", "GooGooGaGa420" }; private static readonly string[] GENERIC_COMMENTS = new string[59] { "bro the dive bell is BACK", "wait they actually came back??", "the bell crew strikes again", "SCUBA legends", "how did they even survive that", "my uncle works for ADI he says it's fine", "the depths are NOT a joke", "absolute cinema", "peak content", "this is why I subscribed", "chills", "the audio is so clean", "crisp upload as always", "been waiting all week for this", "W upload", "this channel is so underrated", "immediately shared with my group", "10/10 would dive again", "the jumpscare timing is perfect", "bro has NO fear", "GG crew", "insane run", "the editing goes crazy", "whoever records these is a menace", "I screamed", "my heart rate is up", "can't wait for the next one", "the diving physics in this game are unreal", "did they just casually do that", "absolute madmen", "the bell sound gives me ptsd", "quality content as always", "this deserves way more views", "POV you watch this at 2am", "I replayed this 5 times", "the music adds so much", "what a way to start the day", "they really committed", "no thoughts just vibes", "the suspense is killing me", "wait no way", "I can't look away", "this is gold", "deserved the upload", "new favorite clip", "the sound design goes hard", "I'm showing everyone I know", "this channel never misses", "the energy is unmatched", "pure panic and I love it", "certified classic", "the camera work was clean", "respect the grind", "this needs a part 2", "instant subscribe", "the bell dive is elite", "those depths are no joke", "I felt that in my chest", "the whole crew is insane" }; private static readonly string[] DETAILED_COMMENTS = new string[14] { " is actually insane for this", " you absolute legend", "respect to for holding the camera", " owes me new headphones", "that reaction is everything", " went through it", "I'd pay to see do it again", "the scream though", "shoutout for the clutch", " has the worst luck istg", "nobody talk to today", "how is still alive", " carrying the whole team", "that panic was so real" }; private static readonly string[] ANTICIPATION_POOL = new string[8] { "something bad is about to happen", "oh no", "don't do it", "I have a bad feeling about this", "they're going to regret this", "turn back now", "the music is ominous", "wait for it" }; private static readonly string[] MONSTER_PANIC_POOL = new string[20] { "RUN", "NOPE NOPE NOPE", "it's so over", "that thing is NOT friendly", "scream at the monster", "bro booked it", "the chase scene was intense", "no way they got away", "that jump scare got me", "how are they still alive", "I would've died immediately", "the panic is real", "run run run", "that thing came out of NOWHERE", "I'm hiding behind my screen", "the teeth on that thing", "it chased them for so long", "absolutely not", "why are they not running", "I screamed so loud" }; private static readonly string[] MONSTER_NAMED_POOL = new string[12] { "the is genuinely terrifying", "scream at the ", "never seen a that close", "the chase was intense", "bro booked it from the ", "that came out of NOWHERE", "the got SO close", "how did they escape the ", "the design is nightmare fuel", "the is NOT friendly", "I would've died to the ", "the panic is real" }; private static readonly string[] DEATH_POOL = new string[12] { "bro actually died", "RIP", "the hospital bill is gonna be insane", "mans saw the afterlife", "F in chat", "the death was cinematic", "bro didn't pay the medical bill", "classic", "the ragdoll physics did them dirty", "ded", "screaming", "that was brutal" }; private static readonly string[] KILLER_POOL = new string[7] { "It seems might have been killed by ", "I think got ", "pretty sure the ended ", "RIP , the said no", "the caught ", "so the claimed another victim", "the did NOT let leave" }; private static readonly string[] SPEECH_POOL = new string[14] { "WHAT THE HECK WAS THAT SOUND", "did anyone else hear that??", "the screaming LMAO", "that audio caught something", "my headphones just died", "THE MIC PICKED THAT UP PERFECTLY", "did I just hear footsteps", "someone say something", "the panic in that voice", "who screamed", "I heard that from here", "the audio is insane", "I think that was a scream", "LET'S MAKE A SCENE!!" }; private static readonly string[] CHILL_POOL = new string[15] { "the vibes are immaculate", "looks like a chill day at the surface", "they made it back safe", "the crew is back", "beautiful weather down here", "wish I was there", "just vibing today", "another day another dive", "the good ending", "no monsters today", "the calm before the next dive", "cozy watch", "relaxing episode", "this is the content I'm here for", "wholesome upload" }; private static readonly string[] FALL_POOL = new string[9] { "that fall was brutal", "mans hit the floor HARD", "gravity wins again", "the fall damage is no joke", "should've checked their landing", "that landing was personal", "fell for the classic trick", "smooth landing... not", "the impact sound LMAO" }; private static readonly string[] RAGDOLL_POOL = new string[9] { "physics went brrr", "ragdoll moment", "the physics engine said no", "bro became a noodle", "that flop was funny", "the body hit the ground so fast", "get this man a chiropractor", "I'm crying", "he folded" }; private static readonly string[] DAMAGE_POOL = new string[9] { "OW", "that looked painful", "the monster got a clean hit", "ouch", "bro felt that one", "health bar said goodbye", "that's gonna leave a mark", "the scream says it all", "why would you go in there" }; private static readonly string[] EMOTE_POOL = new string[8] { "the emote mid-crisis lol", "NOT THE DANCE", "emoting while being chased is wild", "the confidence is unmatched", "that dance was the highlight", "bro is having fun", "the emote timing was perfect", "certified goofball" }; private static readonly string[] CATCH_POOL = new string[8] { "great catch!", "clutch!", "perfect toss", "the reflexes are insane", "smooth catch", "that was actually impressive", "teamwork", "I'd fumble that every time" }; private static readonly string[] HAT_POOL = new string[8] { "the hat LMAO", "fashion icon", "the hat is the real MVP", "who let them wear that", "the drip", "immediately better with a hat", "that hat has seen things", "main character energy" }; private static readonly string[] BOMB_POOL = new string[8] { "RUN IT'S A BOMB", "the bomb!!!", "get AWAY from it", "boom", "why did they pick it up", "the explosion was loud", "they had one job", "everyone panic" }; private static readonly string[] SHROOM_POOL = new string[8] { "the shrooms hit hard", "bro is seeing colors", "mushroom moment", "they ate the wrong thing", "trippy", "the shroom did them in", "cosmic brain", "they went to another dimension" }; private static readonly string[] MIC_POOL = new string[8] { "DJ on the scene", "mic check", "the broadcast went crazy", "they're live", "announcer moment", "spreading the news", "the mic is iconic", "someone give them a show" }; private static readonly string[] STREAMER_POOL = new string[8] { "this is going straight to the top", "streamer clip incoming", "the viral moment", "clip it", "this is the one", "guaranteed views", "the algorithm loves this", "going mainstream" }; private static TextMeshProUGUI _statsLabel; [HarmonyPatch(typeof(ContentBuffer), "GenerateComments")] [HarmonyPostfix] private static void GenerateContextualComments(ContentBuffer __instance, List __result) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (__result == null) { return; } List list = new List(); float num = 0f; foreach (BufferedContent item in __instance.buffer) { ContentEventFrame frame = item.frame; if (frame.contentEvent != null) { num += item.score; list.Add(Classify(frame.contentEvent, frame.time, frame.seenAmount)); } } int num2 = ((num > 0f) ? BigNumbers.GetScoreToViews(num, GameAPI.CurrentDay) : _currentViews); if (num2 > 0) { _videoViews = num2; } list.Sort((EventMoment a, EventMoment b) => a.Time.CompareTo(b.Time)); List list2 = BuildBrainComments(list, num2); AddOrganicComments(list2, list, num2); foreach (Comment item2 in __result) { item2.Likes = ScaleLikes(num2); } __result.AddRange(list2); __result.Sort((Comment a, Comment b) => a.Time.CompareTo(b.Time)); Plugin.Logger.LogInfo($"[VideoEnhancement] {__result.Count} comments ({list2.Count} contextual) at {num2} views"); } private static EventMoment Classify(ContentEvent contentEvent, float time, float seenAmount) { EventMoment eventMoment = new EventMoment { Name = SafeName(contentEvent.GetName()), Time = time, SeenAmount = seenAmount, EventId = contentEvent.GetID(), PlayerName = SafeName(((PlayerBaseEvent)(((contentEvent is PlayerBaseEvent) ? contentEvent : null)?)).playerName), IsMonster = (contentEvent is MonsterContentEvent || contentEvent is MultiMonsterEvent), IsDeath = (contentEvent is PlayerDeadContentEvent), IsMic = (contentEvent is PlayerHoldingMicContentEvent), IsDamage = (contentEvent is PlayerTookDamageContentEvent), IsCatch = (contentEvent is GoodCatchContentEvent), IsEmote = (contentEvent is PlayerEmoteContentEvent), IsFall = (contentEvent is PlayerFallingContentEvent), IsRagdoll = (contentEvent is PlayerRagdollContentEvent), IsBomb = (contentEvent is BombContentEvent || contentEvent is BombsContentEvent), IsHat = (contentEvent is PlayerWearingHatContentEvent), IsShroom = (contentEvent is PlayerShroomContentEvent), IsStreamer = (contentEvent is StreamerContentEvent) }; PlayerContentEvent val = (PlayerContentEvent)(object)((contentEvent is PlayerContentEvent) ? contentEvent : null); if (val != null) { eventMoment.IsSpeech = val.microphoneFactor > 0.4f; } return eventMoment; } private static List BuildBrainComments(List moments, int views) { List list = new List(); bool hasMonster = false; string text = null; float num = -999f; float num2 = -999f; float num3 = -999f; float num4 = -999f; foreach (EventMoment moment in moments) { if (moment.IsMonster) { hasMonster = true; text = moment.Name; num = moment.Time; if (moment.Time - num2 > 3f && list.Count < 60) { string text2 = ((moment.Name != null && Random.value < 0.55f) ? Pick(MONSTER_NAMED_POOL).Replace("", PrettyName(moment.Name)) : Pick(MONSTER_PANIC_POOL)); list.Add(MakeComment(text2, moment.Time + Random.Range(0.2f, 1.6f), moment.EventId, views)); num2 = moment.Time; _ = moment.Time; } } else if (moment.IsDeath) { string text3 = ((text != null && moment.Time - num <= 20f) ? Pick(KILLER_POOL).Replace("", moment.PlayerName).Replace("", PrettyName(text)) : Pick(DEATH_POOL)); list.Add(MakeComment(text3, moment.Time + Random.Range(0.4f, 1.8f), moment.EventId, views)); _ = moment.Time; } else if (moment.IsSpeech && moment.Time - num3 > 3f) { list.Add(MakeComment(Pick(SPEECH_POOL), moment.Time + Random.Range(0.3f, 1.5f), moment.EventId, views)); num3 = moment.Time; } else if (!(moment.Time - num4 <= 4f) && list.Count < 60) { if (moment.IsMic || moment.IsCatch || moment.IsEmote) { string[] pool = (moment.IsMic ? MIC_POOL : (moment.IsCatch ? CATCH_POOL : EMOTE_POOL)); list.Add(MakeComment(Pick(pool), moment.Time + Random.Range(0.3f, 1.4f), moment.EventId, views)); num4 = moment.Time; } else if (moment.IsDamage || moment.IsBomb || moment.IsFall || moment.IsRagdoll || moment.IsHat || moment.IsShroom || moment.IsStreamer) { string[] pool2 = (moment.IsDamage ? DAMAGE_POOL : (moment.IsBomb ? BOMB_POOL : (moment.IsFall ? FALL_POOL : (moment.IsRagdoll ? RAGDOLL_POOL : (moment.IsHat ? HAT_POOL : (moment.IsShroom ? SHROOM_POOL : STREAMER_POOL)))))); list.Add(MakeComment(Pick(pool2), moment.Time + Random.Range(0.3f, 1.4f), moment.EventId, views)); num4 = moment.Time; } } } list.AddRange(GetAnticipationComments(moments, views, hasMonster)); return list; } private static void AddOrganicComments(List brain, List moments, int views) { bool flag = false; float num = 0f; foreach (EventMoment moment in moments) { if (moment.IsMonster) { flag = true; } if (moment.Time > num) { num = moment.Time; } } if (num < 1f) { num = 12f; } List playerNames = GetPlayerNames(); int num2 = Mathf.Clamp(Mathf.RoundToInt(num / 3f), 6, 12); for (int i = 0; i < num2; i++) { float time = Mathf.Clamp(Mathf.Lerp(0.6f, num, ((float)i + 1f) / ((float)num2 + 1f)) + Random.Range(-0.5f, 0.5f), 0f, num); float value = Random.value; if (value < 0.45f) { brain.Add(MakeComment(Pick(GENERIC_COMMENTS), time, 1000, views)); } else if (value < 0.7f && playerNames.Count > 0) { string newValue = playerNames[Random.Range(0, playerNames.Count)]; brain.Add(MakeComment(Pick(DETAILED_COMMENTS).Replace("", newValue), time, 1000, views)); } else if (flag) { brain.Add(MakeComment(Pick(ANTICIPATION_POOL), time, 1000, views)); } else { brain.Add(MakeComment(Pick(CHILL_POOL), time, 1000, views)); } } } private static List GetAnticipationComments(List moments, int views, bool hasMonster) { List list = new List(); if (!hasMonster) { return list; } foreach (EventMoment moment in moments) { if (moment.IsMonster) { if (list.Count >= 3) { break; } if (list.Count <= 0 || !(Mathf.Abs(list[list.Count - 1].Time - moment.Time) < 6f)) { list.Add(MakeComment(Pick(ANTICIPATION_POOL), Mathf.Max(0f, moment.Time - Random.Range(0.8f, 2.2f)), moment.EventId, views)); } } } return list; } private static Comment MakeComment(string text, float time, ushort eventId, int views) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown return new Comment(text) { Time = Mathf.Max(0f, time), EventID = eventId, Likes = ScaleLikes(views), Face = FaceDatabase.GetRandomFaceIndex(), FaceColor = FaceDatabase.GetRandomColorIndex() }; } private static int ScaleLikes(int views) { if (views <= 0) { return Random.Range(1, 4); } return Mathf.Clamp(Mathf.RoundToInt((float)views * (0.02f + Random.value * 0.05f)), 1, Mathf.Max(2, Mathf.RoundToInt((float)views * 0.08f))); } private static string Pick(string[] pool) { return pool[Random.Range(0, pool.Length)]; } private static string SafeName(string name) { if (string.IsNullOrWhiteSpace(name)) { return null; } name = name.Trim(); if (name.Length <= 24) { return name; } return name.Substring(0, 24); } private static string PrettyName(string raw) { if (string.IsNullOrEmpty(raw)) { return "the monster"; } StringBuilder stringBuilder = new StringBuilder(raw.Length + 4); for (int i = 0; i < raw.Length; i++) { char c = raw[i]; if (i > 0 && char.IsUpper(c) && char.IsLower(raw[i - 1])) { stringBuilder.Append(' '); } stringBuilder.Append(c); } string text = stringBuilder.ToString().Trim(); if (text.EndsWith(" Bot")) { text = text.Substring(0, text.Length - 4); } return text; } private static List GetPlayerNames() { List list = new List(); try { if ((Object)(object)PlayerHandler.instance != (Object)null && PlayerHandler.instance.players != null) { foreach (Player player in PlayerHandler.instance.players) { if (!((Object)(object)player == (Object)null) && !((Object)(object)player.m_name == (Object)null)) { string text = ((TMP_Text)player.m_name).text; if (!string.IsNullOrWhiteSpace(text) && !list.Contains(text)) { list.Add(text); } } } } } catch { } return list; } [HarmonyPatch(typeof(CommentUI), "GetLocalizedText")] [HarmonyPrefix] private static bool UseRawCommentText(Comment comment, ref string __result) { if (comment != null && comment.Text != null && comment.Text.Length > 3 && !comment.Text.StartsWith("Content_") && !comment.Text.StartsWith("content_")) { __result = comment.Text; return false; } return true; } [HarmonyPatch(typeof(CommentUI), "Setup")] [HarmonyPrefix] private static void CapCommentLikes(Comment comment) { int num = ((_videoViews > 0) ? _videoViews : _currentViews); if (num > 0) { int num2 = Mathf.Max(2, Mathf.RoundToInt((float)num * 0.08f)); if (comment.Likes > num2) { comment.Likes = num2; } } } private static void ApplyViews(int views) { if (views > 0) { _currentViews = views; _videoViews = views; _totalSubscribers = Mathf.RoundToInt((float)views * 0.03f); _totalLikes = Mathf.RoundToInt((float)views * 0.12f); _donationsUnlocked = _totalSubscribers >= 20; Plugin.Logger.LogInfo($"[VideoEnhancement] Views: {views}, Subs: {_totalSubscribers}, " + string.Format("Likes: {0}, Donations: {1}", _totalLikes, _donationsUnlocked ? "unlocked" : "locked")); } } [HarmonyPatch(typeof(UploadCompleteUI), "PlayVideosAsync")] [HarmonyPostfix] private static void AddSubscriberCounter(UploadCompleteUI __instance, int views) { ApplyViews(views); ((MonoBehaviour)__instance).StartCoroutine(ShowSubscriberStats(__instance)); } [HarmonyPatch(typeof(UploadCompleteUI), "PlayVideo")] [HarmonyPostfix] private static void AddSubscriberCounterLostFootage(UploadCompleteUI __instance, int views) { ApplyViews(views); ((MonoBehaviour)__instance).StartCoroutine(ShowSubscriberStats(__instance)); } private static IEnumerator ShowSubscriberStats(UploadCompleteUI ui) { yield return (object)new WaitForSeconds(1.2f); if ((Object)(object)ui == (Object)null) { yield break; } int subs = _totalSubscribers; int likes = _totalLikes; if (subs <= 0) { yield break; } TextMeshProUGUI label = EnsureStatsLabel(ui); if ((Object)(object)label == (Object)null) { yield break; } float t = 0f; while ((Object)(object)ui != (Object)null && ((Component)ui).gameObject.activeInHierarchy) { if (t < 1.8f) { t += Time.deltaTime; int num = Mathf.RoundToInt(Mathf.Lerp(0f, (float)subs, t / 1.8f)); int num2 = Mathf.RoundToInt(Mathf.Lerp(0f, (float)likes, t / 1.8f)); ((TMP_Text)label).text = $"Subscribers: {num:N0} Likes: {num2:N0}"; } else { ((TMP_Text)label).text = $"Subscribers: {subs:N0} Likes: {likes:N0}"; } UpdateLabelPosition(ui, label); yield return null; } } private static TextMeshProUGUI EnsureStatsLabel(UploadCompleteUI ui) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_statsLabel != (Object)null && (Object)(object)((Component)_statsLabel).gameObject != (Object)null) { return _statsLabel; } if ((Object)(object)ui == (Object)null || (Object)(object)ui.m_views == (Object)null || (Object)(object)((TMP_Text)ui.m_views).transform == (Object)null || (Object)(object)((TMP_Text)ui.m_views).transform.parent == (Object)null) { return null; } RectTransform val = (RectTransform)((TMP_Text)ui.m_views).transform; GameObject val2 = new GameObject("DepthsSubscriberStats", new Type[2] { typeof(RectTransform), typeof(TextMeshProUGUI) }); val2.transform.SetParent(((TMP_Text)ui.m_views).transform.parent, false); TextMeshProUGUI component = val2.GetComponent(); RectTransform val3 = (RectTransform)((TMP_Text)component).transform; val3.anchorMin = val.anchorMin; val3.anchorMax = val.anchorMax; val3.pivot = new Vector2(0f, 0.5f); val3.anchoredPosition = val.anchoredPosition + new Vector2(10f, 0f); val3.sizeDelta = new Vector2(580f, 60f); ((TMP_Text)component).font = ((TMP_Text)ui.m_views).font; ((TMP_Text)component).fontSize = 20f; ((TMP_Text)component).alignment = (TextAlignmentOptions)513; ((Graphic)component).color = new Color(1f, 0.85f, 0.2f); ((TMP_Text)component).text = ""; _statsLabel = component; return component; } private static void UpdateLabelPosition(UploadCompleteUI ui, TextMeshProUGUI label) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Invalid comparison between Unknown and I4 //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Invalid comparison between Unknown and I4 //IL_0070: 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_0086: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)ui == (Object)null) && !((Object)(object)ui.m_views == (Object)null) && !((Object)(object)label == (Object)null)) { RectTransform val = (RectTransform)((TMP_Text)label).transform; RectTransform val2 = (RectTransform)((TMP_Text)ui.m_views).transform; float preferredWidth = ((TMP_Text)ui.m_views).preferredWidth; HorizontalAlignmentOptions horizontalAlignment = ((TMP_Text)ui.m_views).horizontalAlignment; float num = (((int)horizontalAlignment == 1) ? preferredWidth : (((int)horizontalAlignment == 4) ? 0f : (preferredWidth * 0.5f))); val.anchoredPosition = val2.anchoredPosition + new Vector2(num + 10f, 0f); } } [HarmonyPatch(typeof(UploadCompleteUI), "DisplayVideoEval")] [HarmonyPostfix] private static void AddDonationComments(UploadCompleteUI __instance, int views, Comment[] comments) { if (_donationsUnlocked && comments != null && comments.Length != 0) { ((MonoBehaviour)__instance).StartCoroutine(SpawnDonations(__instance)); } } private static IEnumerator SpawnDonations(UploadCompleteUI ui) { int donationCount = Random.Range(1, 4); for (int i = 0; i < donationCount; i++) { yield return (object)new WaitForSeconds(Random.Range(2f, 5f)); int num = Random.Range(5, 51); string arg = DONATION_NAMES[Random.Range(0, DONATION_NAMES.Length)]; Plugin.Logger.LogInfo($"[VideoEnhancement] Donation: ${num} from {arg}"); } } [HarmonyPatch(typeof(UploadCompleteState), "PlayVideo")] [HarmonyPostfix] private static void AddDonationRevenue(UploadCompleteState __instance, int views) { ApplyViews(views); if (!_donationsUnlocked) { return; } int num = Mathf.RoundToInt((float)views * 0.1f); if (num > 0) { UserInterface.ShowMoneyNotification("Viewer Donations", $"${num}", (MoneyCellType)1); if (PhotonNetwork.IsMasterClient) { SurfaceNetworkHandler.RoomStats.AddMoney(num); } Plugin.Logger.LogInfo($"[VideoEnhancement] Added ${num} from viewer donations"); } } internal static void Reset() { _totalSubscribers = 0; _totalLikes = 0; _donationsUnlocked = false; _currentViews = 0; _videoViews = 0; _donationComments.Clear(); } } [HarmonyPatch] internal static class VoiceCommsPatch { [HarmonyPatch(typeof(PlayerVoiceHandler), "Update")] [HarmonyPostfix] private static void AllowBellDiverAudio(PlayerVoiceHandler __instance) { if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.audioSource == (Object)null || (Object)(object)__instance.player == (Object)null || __instance.player.ai || (Object)(object)Player.localPlayer == (Object)null || PhotonGameLobbyHandler.IsSurface || Player.localPlayer.data.dead || !__instance.player.data.dead) { return; } float num = 1f; try { object value = Traverse.Create((object)__instance).Field("m_GlobalPlayerData").GetValue(); if (value != null) { float value2 = Traverse.Create(value).Field("localVoiceVolume").GetValue(); if (value2 > 0f) { num = value2; } } } catch { } __instance.audioSource.volume = num * __instance.player.data.voiceVolumeModifier; } } }