Decompiled source of DepthsOfWarning v1.0.0
Plugins\DepthsOfWarning\DepthsOfWarning.dll
Decompiled 16 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.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<object>()).GetValue<Vector3>(); } 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<object>()).GetValue<Vector3>(); } 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<Bodypart>(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<bool>(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<Bot>(); PhotonView value2 = Traverse.Create((object)__instance).Field("view").GetValue<PhotonView>(); 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>(); Transform value4 = Traverse.Create((object)__instance).Field("handPoint2").GetValue<Transform>(); Rigidbody value5 = Traverse.Create((object)__instance).Field("rig1").GetValue<Rigidbody>(); Rigidbody value6 = Traverse.Create((object)__instance).Field("rig2").GetValue<Rigidbody>(); 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<SFX_Instance[]>(); 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>(); float value9 = val2.GetValue<float>(); 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<Rigidbody>() : 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<bool>()) { 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<float>(), 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<float>(), 0f, Time.deltaTime * 1.5f)); } MonsterAnimationHandler value10 = Traverse.Create((object)__instance).Field("animator").GetValue<MonsterAnimationHandler>(); 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<float>() }); } 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<Bot>() == (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<AudioLowPassFilter>(); if ((Object)(object)val == (Object)null) { val = go.AddComponent<AudioLowPassFilter>(); } _lowPass = val; AudioDistortionFilter val2 = go.GetComponent<AudioDistortionFilter>(); if ((Object)(object)val2 == (Object)null) { val2 = go.AddComponent<AudioDistortionFilter>(); } _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<VideoCamera>(); 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<Pickup>(); 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<ParticleSystem>(); 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<ParticleSystemRenderer>().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<bool>(); } 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<Pickup>(); if (!((Object)(object)componentInParent == (Object)null) && !((Object)(object)componentInParent == (Object)(object)_pickup) && componentInParent.itemInstance?.instanceData != null && componentInParent.itemInstance.instanceData.TryGetEntry<BatteryEntry>(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>(); bool value2 = Traverse.Create((object)__instance).Field("_isTalking").GetValue<bool>(); bool value3 = Traverse.Create((object)__instance).Field("_wasActivated").GetValue<bool>(); float value4 = Traverse.Create((object)__instance).Field("_cooldownTimer").GetValue<float>(); float value5 = Traverse.Create((object)__instance).Field("_talkDuration").GetValue<float>(); bool value6 = Traverse.Create((object)__instance).Field("_signalLost").GetValue<bool>(); 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<TextMeshProUGUI>(); 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<PlayerInventory>(); 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<PlayerInventory>(); 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<BodypartType, Bodypart> value = Traverse.Create((object)Player.localPlayer.refs.ragdoll).Field("bodypartDict").GetValue<Dictionary<BodypartType, Bodypart>>(); if (value != null && value.TryGetValue((BodypartType)0, out var value2)) { Rigidbody value3 = Traverse.Create((object)value2).Field("rig").GetValue<Rigidbody>(); 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<int, (float range, float angle, float intensity)> _originals = new Dictionary<int, (float, float, float)>(); [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<int, float> _biteCooldowns = new Dictionary<int, float>(); private static readonly Dictionary<int, float> _flashLitHistory = new Dictionary<int, float>(); 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<object>()).GetValue<Vector3>(); } private static bool PlayerNoControl(Player p) { return Traverse.Create((object)p).Method("NoControl", Array.Empty<object>()).GetValue<bool>(); } 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<PhotonView>(); if ((Object)(object)value == (Object)null || !value.IsMine) { return; } Player value2 = Traverse.Create((object)__instance).Field("player").GetValue<Player>(); if ((Object)(object)value2 == (Object)null || PlayerNoControl(value2)) { return; } Bot value3 = Traverse.Create((object)__instance).Field("bot").GetValue<Bot>(); 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<float>() > 0f) { return; } } else { _flashLitHistory[botId] = sinceFlashLit_PlayerLight; } if (!(val.GetValue<float>() > 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<object>()).GetValue<Vector3>(); } [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<Player>(); if ((Object)(object)component == (Object)null) { return; } Bot componentInChildren = ((Component)component).GetComponentInChildren<Bot>(); if ((Object)(object)componentInChildren == (Object)null || (Object)(object)((Component)componentInChildren).GetComponent<KnifoTag>() == (Object)null) { return; } Plugin.Logger.LogInfo("Knifo shocked! Fleeing..."); int num = 0; Bot[] array = Object.FindObjectsByType<Bot>((FindObjectsSortMode)0); foreach (Bot val in array) { if (!((Object)(object)val == (Object)(object)componentInChildren) && (Object)(object)((Component)val).GetComponent<KnifoTag>() != (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<object>()).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<KnifoTag>() == (Object)null) { ((Component)__instance).gameObject.AddComponent<KnifoTag>(); 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<Player>(); 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<GameObject>(); Transform value2 = obj.Field("m_CategoriesGrid").GetValue<Transform>(); ShopHandler value3 = obj.Field("m_ShopHandler").GetValue<ShopHandler>(); GameObject obj2 = Object.Instantiate<GameObject>(value, value2); obj2.SetActive(true); Traverse obj3 = Traverse.Create((object)obj2.GetComponent<ShopInteractibleCategory>()); obj3.Field("m_Category").SetValue((object)(ShopItemCategory)8); obj3.Field("m_ShopHandler").SetValue((object)value3); obj3.Method("UpdateCategoryText", Array.Empty<object>()).GetValue(); GameObject obj4 = Object.Instantiate<GameObject>(value, value2); obj4.SetActive(true); Traverse obj5 = Traverse.Create((object)obj4.GetComponent<ShopInteractibleCategory>()); obj5.Field("m_Category").SetValue((object)(ShopItemCategory)9); obj5.Field("m_ShopHandler").SetValue((object)value3); obj5.Method("UpdateCategoryText", Array.Empty<object>()).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<ShopItemCategory>()) { case 8: Traverse.Create((object)__instance).Field("m_CategoryText").GetValue<TMP_Text>() .text = "ADI Equipment"; ((Interactable)__instance).hoverText = "View ADI Equipment Items"; return false; case 9: Traverse.Create((object)__instance).Field("m_CategoryText").GetValue<TMP_Text>() .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<ShopItemCategory>(); 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<TMP_Text>() .text = text.ToUpper(); IDictionary obj = (IDictionary)Traverse.Create((object)Traverse.Create((object)__instance).Field("m_ShopHandler").GetValue<ShopHandler>()).Field("m_CategoryItemDic").GetValue(); List<ShopItem> list = new List<ShopItem>(); foreach (DictionaryEntry item in obj) { if ((byte)item.Key == b) { List<ShopItem> collection = (List<ShopItem>)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<object>()).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<RectTransform>(); 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<ScrollRect>(); if ((Object)(object)val2 == (Object)null) { val2 = ((Component)val).gameObject.AddComponent<ScrollRect>(); 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<RectMask2D>() == (Object)null) { ((Component)val).gameObject.AddComponent<RectMask2D>(); } } 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<Item>(); _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<ItemDatabase, Item>)(object)SingletonAsset<ItemDatabase>.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<ShopItem>)), 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<Item>(); _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<ItemDatabase, Item>)(object)SingletonAsset<ItemDatabase>.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<ShopItem>)), 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<MeshRenderer>(); if ((Object)(object)_cachedMat == (Object)null) { MeshRenderer[] array = Object.FindObjectsOfType<MeshRenderer>(); 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<ChargerBehaviour>(); 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<MeshRenderer>(); if ((Object)(object)_cachedMat == (Object)null) { MeshRenderer[] array = Object.FindObjectsOfType<MeshRenderer>(); 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<SizeMutationBehaviour>(); 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<Rigidbody, float> _originalMasses = new Dictionary<Rigidbody, float>(); 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<Bodypart>(new object[1] { (object)(BodypartType)0 }); if ((Object)(object)value != (Object)null) { Rigidbody value2 = Traverse.Create((object)value).Field("rig").GetValue<Rigidbody>(); 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<object>()).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<Bodypart> value = Traverse.Create((object)refs.ragdoll).Field("bodypartList").GetValue<List<Bodypart>>(); if (value == null) { return; } if (!_massesCached) { _originalMasses.Clear(); foreach (Bodypart item in value) { if (!((Object)(object)item == (Object)null)) { Rigidbody component = ((Component)item).GetComponent<Rigidbody>(); 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<Rigidbody>(); 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<SphereCollider>(); 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<PlayerInventory>(); 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<PlayerAttributeSystem>(); val.AddComponent<SizeSyncSystem>(); val.AddComponent<BellDiverSystem>(); val.AddComponent<SpeedModeSystem>(); val.AddComponent<DarkWorldSystem>(); val.AddComponent<CameraViewSystem>(); val.AddComponent<FallDamageSystem>(); Logger.LogInfo("Loaded successfully!"); } } public class SizeMutationBehaviour : MonoBehaviour { private Pickup _pickup; private bool _used; private void Start() { _pickup = ((Component)this).GetComponentInParent<Pickup>(); } private void Update() { if (!((Object)(object)_pickup == (Object)null) && !_used && !((Object)(object)_pickup.itemInstance == (Object)null) && Traverse.Create((object)_pickup.itemInstance).Field("isHeld").GetValue<bool>() && !((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<PlayerInventory>(); 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<int, float> _actorSizes = new Dictionary<int, float>(); 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<int, float> 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<Player> 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<SphereCollider>(); 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<Comment> _donationComments = new List<Comment>(); 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