Decompiled source of LethalElements v1.1.8
voxx.LethalElementsPlugin.dll
Decompiled 2 months 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.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Experimental.Rendering; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.VFX; using VoxxWeatherPlugin.Behaviours; using VoxxWeatherPlugin.Patches; using VoxxWeatherPlugin.Utils; using VoxxWeatherPlugin.Weathers; using WeatherRegistry; using voxx.LethalElementsPlugin.NetcodePatcher; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("voxx.LethalElementsPlugin")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("A plugin adding new weather types to Lethal Company")] [assembly: AssemblyFileVersion("1.1.8.0")] [assembly: AssemblyInformationalVersion("1.1.8+d0c8a17f2c1a984cad3c0c686aaa5d774ff3e299")] [assembly: AssemblyProduct("voxx.LethalElementsPlugin")] [assembly: AssemblyTitle("voxx.LethalElementsPlugin")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.8.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace VoxxWeatherPlugin { [BepInPlugin("voxx.LethalElementsPlugin", "voxx.LethalElementsPlugin", "1.1.8")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class VoxxWeatherPlugin : BaseUnityPlugin { private Harmony harmony; public static VoxxWeatherPlugin instance; internal static ManualLogSource StaticLogger; public static ConfigEntry<bool> EnableHeatwaveWeather; public static ConfigEntry<bool> EnableSolarFlareWeather; public static ConfigEntry<uint> AuroraHeight; public static ConfigEntry<float> AuroraSpawnAreaBox; public static ConfigEntry<float> AuroraVisibilityThreshold; public static ConfigEntry<float> AuroraSpawnRate; public static ConfigEntry<float> AuroraSize; public static ConfigEntry<uint> HeatwaveParticlesSpawnRate; public static ConfigEntry<float> TimeUntilStrokeMin; public static ConfigEntry<float> TimeUntilStrokeMax; public static ConfigEntry<bool> DistortOnlyVoiceDuringSolarFlare; public static ConfigEntry<float> BatteryDrainMultiplier; public static ConfigEntry<bool> DrainBatteryInFacility; public static ConfigEntry<bool> DoorMalfunctionEnabled; public static ConfigEntry<float> DoorMalfunctionChance; public static ConfigEntry<float> NoiseStaticLevel; private void Awake() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown instance = this; StaticLogger = ((BaseUnityPlugin)this).Logger; NetcodePatcher(); InitializeConfig(); harmony = new Harmony("voxx.LethalElementsPlugin"); if (EnableSolarFlareWeather.Value) { WeatherTypeLoader.RegisterFlareWeather(); harmony.PatchAll(typeof(FlarePatches)); if (!DistortOnlyVoiceDuringSolarFlare.Value) { harmony.PatchAll(typeof(FlareOptionalWalkiePatches)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"voxx.LethalElementsPlugin optional solar flare patches successfully applied!"); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"voxx.LethalElementsPlugin solar flare patches successfully applied!"); } if (EnableHeatwaveWeather.Value) { WeatherTypeLoader.RegisterHeatwaveWeather(); harmony.PatchAll(typeof(HeatwavePatches)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"voxx.LethalElementsPlugin heatwave patches successfully applied!"); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin voxx.LethalElementsPlugin is loaded!"); } private static void NetcodePatcher() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } private void InitializeConfig() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Expected O, but got Unknown //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Expected O, but got Unknown //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Expected O, but got Unknown //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Expected O, but got Unknown //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Expected O, but got Unknown EnableHeatwaveWeather = ((BaseUnityPlugin)this).Config.Bind<bool>("Weather", "EnableHeatwaveWeather", true, "Enable or disable Heatwave weather"); EnableSolarFlareWeather = ((BaseUnityPlugin)this).Config.Bind<bool>("Weather", "EnableSolarFlareWeather", true, "Enable or disable Solar Flare weather"); HeatwaveParticlesSpawnRate = ((BaseUnityPlugin)this).Config.Bind<uint>("Heatwave", "ParticlesSpawnRate", 20u, new ConfigDescription("Spawn rate of Heatwave particles. Particles per second", (AcceptableValueBase)(object)new AcceptableValueRange<uint>(0u, 42u), Array.Empty<object>())); TimeUntilStrokeMin = ((BaseUnityPlugin)this).Config.Bind<float>("Heatwave", "TimeUntilStrokeMin", 40f, new ConfigDescription("Minimal time in seconds until heatstroke (min)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 9999f), Array.Empty<object>())); TimeUntilStrokeMax = ((BaseUnityPlugin)this).Config.Bind<float>("Heatwave", "TimeUntilStrokeMax", 80f, new ConfigDescription("Maximal time in seconds until heatstroke (max). Must be higher than min! Actual time is random between min and max", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 9999f), Array.Empty<object>())); AuroraHeight = ((BaseUnityPlugin)this).Config.Bind<uint>("SolarFlare", "AuroraHeight", 120u, "Height of the Aurora effect above the ground"); AuroraSpawnAreaBox = ((BaseUnityPlugin)this).Config.Bind<float>("SolarFlare", "AuroraSpawnArea", 500f, "Size of the Aurora spawn area. The Aurora effect will spawn randomly within this square area. VFX may disappear at certain angles if the area is too small or too large."); AuroraVisibilityThreshold = ((BaseUnityPlugin)this).Config.Bind<float>("SolarFlare", "AuroraVisibilityThreshold", 9f, "Light threshold when Aurora becomes visible (in Lux). Increase to make it more visible."); AuroraSpawnRate = ((BaseUnityPlugin)this).Config.Bind<float>("SolarFlare", "AuroraSpawnRate", 0.1f, new ConfigDescription("Spawn rate of Aurora effects. Auroras per second", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 32f), Array.Empty<object>())); AuroraSize = ((BaseUnityPlugin)this).Config.Bind<float>("SolarFlare", "AuroraSize", 100f, "Size of the Aurora 'strips' in the sky"); DistortOnlyVoiceDuringSolarFlare = ((BaseUnityPlugin)this).Config.Bind<bool>("SolarFlare", "DistortOnlyVoice", true, "Distort only player voice during Solar Flare (true) or all sounds (false) on a walkie-talkie"); BatteryDrainMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("SolarFlare", "BatteryDrainMultiplier", 1f, new ConfigDescription("Multiplier for additional battery drain during Solar Flare. 1.0 is normal drain, 0.5 is half drain, 2.0 is double drain, 0 no additional drain, etc. Default value is equal to 60 - 200 % faster drain depending on the type of flare.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>())); DrainBatteryInFacility = ((BaseUnityPlugin)this).Config.Bind<bool>("SolarFlare", "DrainBatteryInFacility", false, "Drain item battery even when inside a facility during Solar Flare"); DoorMalfunctionEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("SolarFlare", "DoorMalfunctionEnabled", true, "Enable or disable door malfunction during Average and Strong Solar Flare"); DoorMalfunctionChance = ((BaseUnityPlugin)this).Config.Bind<float>("SolarFlare", "DoorMalfunctionChance", 0.5f, new ConfigDescription("Chance of metal doors opening/closing by themselves during Solar Flare. 0.1 is 10% chance, 0.5 is 50% chance, 1.0 is 100% chance. Low chance might cause you to get soft locked behind a door in the facility!", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); NoiseStaticLevel = ((BaseUnityPlugin)this).Config.Bind<float>("SolarFlare", "NoiseStaticLevel", 0.005f, new ConfigDescription("Level of static noise from the walkie talkie during Solar Flare. This is signal amplitude, the actual volume in dB will follow a logarithmic scale. For example the volume for value 0.1 relative to 0.2 is not reduced by 100%, it's actually by ~log10(0.2/0.1) %", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); } } public static class Debug { private static ManualLogSource Logger => VoxxWeatherPlugin.StaticLogger; public static void Log(string message) { Logger.LogInfo((object)message); } public static void LogError(string message) { Logger.LogError((object)message); } public static void LogWarning(string message) { Logger.LogWarning((object)message); } public static void LogDebug(string message) { Logger.LogDebug((object)message); } public static void LogMessage(string message) { Logger.LogMessage((object)message); } public static void LogFatal(string message) { Logger.LogFatal((object)message); } } public static class PluginInfo { public const string PLUGIN_GUID = "voxx.LethalElementsPlugin"; public const string PLUGIN_NAME = "voxx.LethalElementsPlugin"; public const string PLUGIN_VERSION = "1.1.8"; } } namespace VoxxWeatherPlugin.Weathers { internal class HeatwaveWeather : MonoBehaviour { public VolumeProfile heatwaveFilter; internal HeatwaveVFXManager heatwaveVFXManager; private Volume exhaustionFilter; private BoxCollider heatwaveTrigger; private Vector3 heatwaveZoneSize; private Vector3 heatwaveZoneLocation; private Random seededRandom; [SerializeField] private float timeInHeatZoneMax = 50f; private float timeUntilStrokeMin => VoxxWeatherPlugin.TimeUntilStrokeMin.Value; private float timeUntilStrokeMax => VoxxWeatherPlugin.TimeUntilStrokeMax.Value; private void Awake() { if ((Object)(object)heatwaveTrigger == (Object)null) { heatwaveTrigger = ((Component)this).gameObject.AddComponent<BoxCollider>(); } ((Collider)heatwaveTrigger).isTrigger = true; Volume val = ((Component)this).gameObject.AddComponent<Volume>(); val.profile = heatwaveFilter; val.weight = 0f; exhaustionFilter = val; PlayerTemperatureManager.heatEffectVolume = exhaustionFilter; } private void OnEnable() { seededRandom = new Random(StartOfRound.Instance.randomMapSeed); CalculateZoneSize(); heatwaveVFXManager.CalculateEmitterRadius(); heatwaveVFXManager.PopulateLevelWithVFX(ref heatwaveZoneSize, ref heatwaveZoneLocation, seededRandom); SetupHeatwaveWeather(); } private void OnDisable() { Object.Destroy((Object)(object)heatwaveVFXManager.heatwaveVFXContainer); heatwaveVFXManager.heatwaveVFXContainer = null; Debug.Log("Heatwave VFX container destroyed."); PlayerTemperatureManager.isInHeatZone = false; PlayerTemperatureManager.heatSeverityMultiplier = 1f; } private void SetupHeatwaveWeather() { //IL_0008: 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_0035: Unknown result type (might be due to invalid IL or missing references) heatwaveTrigger.size = heatwaveZoneSize; ((Component)heatwaveTrigger).transform.position = heatwaveZoneLocation; ((Component)heatwaveTrigger).transform.rotation = Quaternion.identity; Debug.Log("Heatwave zone placed!"); timeInHeatZoneMax = Mathf.Clamp(seededRandom.NextDouble(timeUntilStrokeMin, timeUntilStrokeMax), 1f, 9999f); Debug.Log($"Set time until heatstroke: {timeInHeatZoneMax} seconds"); } private void CalculateZoneSize() { //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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013e: 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_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) List<Vector3> list = new List<Vector3>(1); Bounds bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds; list.Add(((Bounds)(ref bounds)).center); List<Vector3> list2 = list; GameObject[] outsideAINodes = RoundManager.Instance.outsideAINodes; foreach (GameObject val in outsideAINodes) { if (!((Object)(object)val == (Object)null)) { list2.Add(val.transform.position); } } EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>(); EntranceTeleport[] array2 = array; foreach (EntranceTeleport val2 in array2) { if (!((Object)(object)val2 == (Object)null) && val2.isEntranceToBuilding) { Vector3 position = val2.entrancePoint.position; list2.Add(position); } } Vector3 val3 = list2[0]; Vector3 val4 = list2[0]; foreach (Vector3 item in list2) { val3 = Vector3.Min(val3, item); val4 = Vector3.Max(val4, item); } Vector3 val5 = val4 - val3; Vector3 val6 = (val3 + val4) / 2f; heatwaveZoneSize = val5 * 1.25f; heatwaveZoneLocation = val6; Debug.Log($"Heatwave zone size: {heatwaveZoneSize}"); } public bool CheckConditionsForHeatingPause(PlayerControllerB playerController) { return playerController.inSpecialInteractAnimation || Object.op_Implicit((Object)(object)playerController.inAnimationWithEnemy) || playerController.isClimbingLadder || (Object)(object)playerController.physicsParent != (Object)null; } public bool CheckConditionsForHeatingStop(PlayerControllerB playerController) { return playerController.beamUpParticle.isPlaying || playerController.isInElevator || playerController.isInHangarShipRoom || playerController.isUnderwater; } private void OnTriggerStay(Collider other) { if (!((Component)other).CompareTag("Player")) { return; } PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController) { return; } if (component.isPlayerDead) { PlayerTemperatureManager.heatSeverityMultiplier = 1f; PlayerTemperatureManager.isInHeatZone = false; PlayerTemperatureManager.SetHeatSeverity(0f - PlayerTemperatureManager.heatSeverity); return; } if (CheckConditionsForHeatingStop(component)) { PlayerTemperatureManager.heatSeverityMultiplier = 1f; PlayerTemperatureManager.isInHeatZone = false; return; } if (CheckConditionsForHeatingPause(component)) { PlayerTemperatureManager.heatSeverityMultiplier = 0.33f; } else { PlayerTemperatureManager.heatSeverityMultiplier = 1f; } if (PlayerTemperatureManager.isInHeatZone) { PlayerTemperatureManager.SetHeatSeverity(Time.deltaTime / timeInHeatZoneMax); } else { PlayerTemperatureManager.isInHeatZone = true; } } private void OnTriggerExit(Collider other) { if (((Component)other).CompareTag("Player")) { PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if (!((Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController)) { PlayerTemperatureManager.heatSeverityMultiplier = 1f; PlayerTemperatureManager.isInHeatZone = false; } } } } public class HeatwaveVFXManager : MonoBehaviour { public GameObject heatwaveParticlePrefab; public GameObject heatwaveVFXContainer; private float emitterSize; private float raycastHeight = 500f; internal void CalculateEmitterRadius() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) Transform transform = heatwaveParticlePrefab.transform; emitterSize = Mathf.Max(transform.localScale.x, transform.localScale.z) * 5f; } internal void PopulateLevelWithVFX(ref Vector3 heatwaveZoneSize, ref Vector3 heatwaveZoneLocation, Random seededRandom) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0142: 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_0179: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)heatwaveVFXContainer == (Object)null) { heatwaveVFXContainer = new GameObject("HeatwaveVFXContainer"); } int num = 0; int num2 = Mathf.CeilToInt(heatwaveZoneSize.x / emitterSize); int num3 = Mathf.CeilToInt(heatwaveZoneSize.z / emitterSize); Debug.LogDebug($"Placing {num2 * num3} emitters..."); Vector3 val = heatwaveZoneLocation - heatwaveZoneSize * 0.5f; float num4 = -1f; float num5 = 1f; for (int i = 0; i < num2; i++) { for (int j = 0; j < num3; j++) { float num6 = (float)seededRandom.NextDouble() - 0.5f; float num7 = (float)seededRandom.NextDouble() - 0.5f; Vector3 rayOrigin = val + new Vector3(((float)i + num6) * emitterSize, raycastHeight, ((float)j + num7) * emitterSize); var (val2, val3) = CastRayAndSampleNavMesh(rayOrigin); if (val2 != Vector3.zero) { float num8 = (float)seededRandom.NextDouble() * 360f; Quaternion val4 = Quaternion.AngleAxis(num8, val3) * Quaternion.LookRotation(val3); GameObject val5 = Object.Instantiate<GameObject>(heatwaveParticlePrefab, val2, val4); val5.transform.parent = heatwaveVFXContainer.transform; num++; num4 = Mathf.Min(num4, val2.y); num5 = Mathf.Max(num5, val2.y); } } } heatwaveZoneSize.y = (num5 - num4) * 1.1f; heatwaveZoneLocation.y = (num4 + num5) / 2f; Debug.Log($"Placed {num} emitters."); } private (Vector3, Vector3) CastRayAndSampleNavMesh(Vector3 rayOrigin) { //IL_0021: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) int num = (1 << LayerMask.NameToLayer("Room")) | (1 << LayerMask.NameToLayer("Default")); RaycastHit val = default(RaycastHit); NavMeshHit val2 = default(NavMeshHit); if (Physics.Raycast(rayOrigin, Vector3.down, ref val, 1000f, num, (QueryTriggerInteraction)1) && NavMesh.SamplePosition(((RaycastHit)(ref val)).point, ref val2, 3f, -1)) { Bounds bounds = StartOfRound.Instance.shipBounds.bounds; Vector3 center = ((Bounds)(ref bounds)).center; bounds = StartOfRound.Instance.shipBounds.bounds; Bounds val3 = default(Bounds); ((Bounds)(ref val3))..ctor(center, ((Bounds)(ref bounds)).size * 2f); if (!((Bounds)(ref val3)).Contains(((NavMeshHit)(ref val2)).position)) { return (((NavMeshHit)(ref val2)).position, ((RaycastHit)(ref val)).normal); } } return (Vector3.zero, Vector3.up); } private void OnEnable() { if ((Object)(object)heatwaveVFXContainer != (Object)null) { heatwaveVFXContainer.SetActive(true); } } private void OnDisable() { if ((Object)(object)heatwaveVFXContainer != (Object)null) { heatwaveVFXContainer.SetActive(false); } } } internal enum FlareIntensity { Weak, Mild, Average, Strong } internal class FlareData { public FlareIntensity Intensity { get; internal set; } public float ScreenDistortionIntensity { get; internal set; } public float RadioDistortionIntensity { get; internal set; } public float RadioBreakthroughLength { get; internal set; } public float RadioFrequencyShift { get; internal set; } public float FlareSize { get; internal set; } public Color AuroraColor1 { get; internal set; } public Color AuroraColor2 { get; internal set; } public bool IsDoorMalfunction { get; internal set; } public FlareData(FlareIntensity intensity) { //IL_0074: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) Intensity = intensity; switch (intensity) { case FlareIntensity.Weak: ScreenDistortionIntensity = 0.3f; RadioDistortionIntensity = 0.25f; RadioBreakthroughLength = 1.25f; RadioFrequencyShift = 1000f; AuroraColor1 = new Color(0f, 11.98f, 0.69f, 1f); AuroraColor2 = new Color(0.29f, 8.33f, 8.17f, 1f); FlareSize = 1f; IsDoorMalfunction = false; break; case FlareIntensity.Mild: ScreenDistortionIntensity = 0.5f; RadioDistortionIntensity = 0.45f; RadioBreakthroughLength = 0.75f; RadioFrequencyShift = 250f; AuroraColor1 = new Color(0.13f, 8.47f, 8.47f, 1f); AuroraColor2 = new Color(9.46f, 0.25f, 15.85f, 1f); FlareSize = 1.1f; IsDoorMalfunction = false; break; case FlareIntensity.Average: ScreenDistortionIntensity = 0.8f; RadioDistortionIntensity = 0.6f; RadioBreakthroughLength = 0.5f; RadioFrequencyShift = 50f; AuroraColor1 = new Color(0.38f, 6.88f, 0f, 1f); AuroraColor2 = new Color(15.55f, 0.83f, 7.32f, 1f); FlareSize = 1.25f; IsDoorMalfunction = true; break; case FlareIntensity.Strong: ScreenDistortionIntensity = 1f; RadioDistortionIntensity = 0.85f; RadioBreakthroughLength = 0.25f; RadioFrequencyShift = 10f; AuroraColor1 = new Color(5.92f, 0f, 11.98f, 1f); AuroraColor2 = new Color(8.65f, 0.83f, 1.87f, 1f); FlareSize = 1.4f; IsDoorMalfunction = true; break; } } } internal class SolarFlareWeather : MonoBehaviour { [SerializeField] internal static Material glitchMaterial; [SerializeField] internal GlitchEffect glitchPass; internal static FlareData flareData; internal CustomPassVolume glitchVolume; internal TerminalAccessibleObject[] bigDoors; internal bool isDoorMalfunctionEnabled => VoxxWeatherPlugin.DoorMalfunctionEnabled.Value; internal float doorMalfunctionChance => Mathf.Clamp01(VoxxWeatherPlugin.DoorMalfunctionChance.Value); internal void GlitchRadarMap() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("Systems/GameSystems/ItemSystems/MapCamera"); if ((Object)(object)val != (Object)null) { HDAdditionalCameraData component = val.GetComponent<HDAdditionalCameraData>(); FrameSettingsOverrideMask renderingPathCustomFrameSettingsOverrideMask = component.renderingPathCustomFrameSettingsOverrideMask; ((BitArray128)(ref renderingPathCustomFrameSettingsOverrideMask.mask))[6u] = false; component.renderingPathCustomFrameSettingsOverrideMask = renderingPathCustomFrameSettingsOverrideMask; Transform val2 = null; foreach (Transform item in val.transform) { Transform val3 = item; if (((Object)val3).name.StartsWith("VolumeMain")) { val2 = val3; break; } } if ((Object)(object)val2 != (Object)null) { glitchVolume = ((Component)val2).gameObject.AddComponent<CustomPassVolume>(); glitchVolume.injectionPoint = (CustomPassInjectionPoint)3; glitchVolume.isGlobal = false; GlitchEffect glitchEffect = new GlitchEffect(); ((CustomPass)glitchEffect).name = "Glitch Pass"; glitchEffect.m_Material = glitchMaterial; glitchPass = glitchEffect; glitchVolume.customPasses.Add((CustomPass)(object)glitchPass); ((CustomPass)glitchPass).enabled = false; Debug.Log("Glitch Pass added to the Radar camera."); } else { Debug.LogError("Radar camera volume not found!"); } } else { Debug.LogError("Radar camera not found!"); } } private void OnEnable() { if ((Object)(object)glitchVolume == (Object)null) { GlitchRadarMap(); } Random random = new Random(StartOfRound.Instance.randomMapSeed); FlareIntensity[] array = (FlareIntensity[])Enum.GetValues(typeof(FlareIntensity)); FlareIntensity intensity = array[random.Next(array.Length)]; flareData = new FlareData(intensity); SolarFlareVFXManager.PopulateLevelWithVFX(); if (glitchPass != null) { ((VolumeParameter<float>)(object)glitchPass.intensity).value = flareData.ScreenDistortionIntensity; ((CustomPass)glitchPass).enabled = true; } TerminalAccessibleObject[] source = Object.FindObjectsOfType<TerminalAccessibleObject>(); bigDoors = source.Where((TerminalAccessibleObject obj) => obj.isBigDoor).ToArray(); } private void OnDisable() { if (glitchPass != null) { ((CustomPass)glitchPass).enabled = false; } flareData = null; bigDoors = null; SolarFlareVFXManager.ResetVFX(); } private void Update() { if (glitchPass != null && flareData != null) { ((VolumeParameter<float>)(object)glitchPass.intensity).value = flareData.ScreenDistortionIntensity; } if ((double)(TimeOfDay.Instance.normalizedTimeOfDay % 0.03f) < 0.0001) { foreach (Animator allPoweredLightsAnimator in RoundManager.Instance.allPoweredLightsAnimators) { allPoweredLightsAnimator.SetTrigger("Flicker"); } } if ((double)(TimeOfDay.Instance.normalizedTimeOfDay % 0.07f) < 0.0001 && flareData.IsDoorMalfunction && bigDoors != null && GameNetworkManager.Instance.isHostingGame && isDoorMalfunctionEnabled) { TerminalAccessibleObject[] array = bigDoors; foreach (TerminalAccessibleObject val in array) { bool doorLocalClient = Random.value < doorMalfunctionChance; val.SetDoorLocalClient(doorLocalClient); } } } } internal class SolarFlareVFXManager : MonoBehaviour { public static GameObject flarePrefab; public static GameObject auroraPrefab; [SerializeField] internal static GameObject flareObject; [SerializeField] internal static GameObject auroraObject; internal float auroraSunThreshold = 8f; internal static void PopulateLevelWithVFX() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_0111: 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_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0163: 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_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0206: 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_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0247: 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_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_028c: 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_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) GameObject val = null; if ((Object)(object)TimeOfDay.Instance.sunDirect == (Object)null) { Debug.LogWarning("Sun animator is null! Disabling Corona VFX. Aurora force enabled."); } else { foreach (Transform item in ((Component)TimeOfDay.Instance.sunDirect).transform.parent) { Transform val2 = item; if (((Object)val2).name == "SunTexture" && ((Component)val2).gameObject.activeSelf) { val = ((Component)val2).gameObject; break; } } } if ((Object)(object)flarePrefab == (Object)null || (Object)(object)auroraPrefab == (Object)null) { Debug.LogError("Flare or aurora prefab is null!"); return; } auroraObject = Object.Instantiate<GameObject>(auroraPrefab, Vector3.zero, Quaternion.identity); auroraObject.SetActive(false); VisualEffect component = auroraObject.GetComponent<VisualEffect>(); component.SetVector4("auroraColor", Color.op_Implicit(SolarFlareWeather.flareData.AuroraColor1)); component.SetVector4("auroraColor2", Color.op_Implicit(SolarFlareWeather.flareData.AuroraColor2)); Debug.LogDebug("Aurora VFX instantiated."); if ((Object)(object)val != (Object)null) { flareObject = Object.Instantiate<GameObject>(flarePrefab, val.transform.position, val.transform.rotation); flareObject.transform.SetParent(val.transform); flareObject.transform.localScale = Vector3.one * SolarFlareWeather.flareData.FlareSize; Texture mainTexture = val.GetComponent<Renderer>().material.mainTexture; Texture2D val3 = (Texture2D)(object)((mainTexture is Texture2D) ? mainTexture : null); if ((Object)(object)val3 == (Object)null) { Debug.LogWarning("sunTexture does not have a texture assigned!"); } Color averageTextureColor = GetAverageTextureColor(val3); Color color = val.GetComponent<Renderer>().material.color; Color val4 = Color.Lerp(color, averageTextureColor, color.a); Color val5 = val4; val5.r += 0.2f; float num = Mathf.Pow(2f, 1.3f); ((Color)(ref val4))..ctor(val4.r * num, val4.g * num, val4.b * num, 1f); num = Mathf.Pow(2f, 2.7f); ((Color)(ref val5))..ctor(val5.r * num, val5.g * num, val5.b * num, 1f); VisualEffect component2 = flareObject.GetComponent<VisualEffect>(); component2.SetVector4("coronaColor", Color.op_Implicit(val4)); component2.SetVector4("coronaColor2", Color.op_Implicit(val5)); flareObject.SetActive(true); Debug.LogDebug("Corona VFX instantiated."); } else { Debug.LogWarning("Sun texture not found! Corona VFX disabled."); } } internal void Update() { if (!((Object)(object)auroraObject == (Object)null)) { float num = 0f; if ((Object)(object)TimeOfDay.Instance.sunDirect != (Object)null) { HDAdditionalLightData component = ((Component)TimeOfDay.Instance.sunDirect).GetComponent<HDAdditionalLightData>(); num = component.intensity; } if (num < auroraSunThreshold) { auroraObject.SetActive(true); } else { auroraObject.SetActive(false); } } } internal static Color GetAverageTextureColor(Texture2D texture) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) RenderTexture temporary = RenderTexture.GetTemporary(((Texture)texture).width, ((Texture)texture).height, 0, (RenderTextureFormat)7, (RenderTextureReadWrite)1); Graphics.Blit((Texture)(object)texture, temporary); Texture2D val = new Texture2D(((Texture)texture).width, ((Texture)texture).height); RenderTexture.active = temporary; val.ReadPixels(new Rect(0f, 0f, (float)((Texture)temporary).width, (float)((Texture)temporary).height), 0, 0); val.Apply(); RenderTexture.active = null; RenderTexture.ReleaseTemporary(temporary); Color[] pixels = val.GetPixels(); float num = 0f; float num2 = 0f; float num3 = 0f; for (int i = 0; i < pixels.Length; i++) { if (!((double)pixels[i].a < 0.5)) { num += pixels[i].r; num2 += pixels[i].g; num3 += pixels[i].b; } } num /= (float)pixels.Length; num2 /= (float)pixels.Length; num3 /= (float)pixels.Length; float num4 = default(float); float num6 = default(float); float num5 = default(float); Color.RGBToHSV(new Color(num, num2, num3), ref num4, ref num5, ref num6); num5 = Mathf.Clamp01(num5 + 0.65f); Color result = Color.HSVToRGB(num4, num5, num6); result.a = 1f; return result; } internal static void ResetVFX() { if ((Object)(object)flareObject != (Object)null) { Object.Destroy((Object)(object)flareObject); flareObject = null; } if ((Object)(object)auroraObject != (Object)null) { Object.Destroy((Object)(object)auroraObject); auroraObject = null; } } private void OnEnable() { if ((Object)(object)auroraObject != (Object)null) { auroraObject.SetActive(true); } if ((Object)(object)flareObject != (Object)null) { flareObject.SetActive(true); } } private void OnDisable() { if ((Object)(object)auroraObject != (Object)null) { auroraObject.SetActive(false); } if ((Object)(object)flareObject != (Object)null) { flareObject.SetActive(false); } } } } namespace VoxxWeatherPlugin.Tests { public class ConeTestScript : MonoBehaviour { public Material coneMaterial; public float coneHeight = 10f; public float coneRadius = 2f; public int pointCount = 40; public Color coneColor = Color.white; private void Start() { CreateCone(); } private void CreateCone() { //IL_004c: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown //IL_019e: Unknown result type (might be due to invalid IL or missing references) if (pointCount < 3 || pointCount >= 254) { throw new ArgumentOutOfRangeException("pointCount"); } Vector3[] array = (Vector3[])(object)new Vector3[pointCount + 1]; int[] array2 = new int[pointCount * 3]; array[0] = Vector3.zero; for (int i = 0; i < pointCount; i++) { float num = (float)i / (float)pointCount * MathF.PI * 2f; Vector3 val = new Vector3(Mathf.Cos(num), Mathf.Sin(num), 0f) * coneRadius; array[i + 1] = new Vector3(0f, 0f, coneHeight) + val; array2[i * 3] = 0; array2[i * 3 + 1] = 1 + (i + 1) % pointCount; array2[i * 3 + 2] = i + 1; } GameObject val2 = new GameObject("TestCone"); val2.transform.SetParent(((Component)this).transform); MeshFilter val3 = val2.AddComponent<MeshFilter>(); MeshRenderer val4 = val2.AddComponent<MeshRenderer>(); MeshCollider val5 = val2.AddComponent<MeshCollider>(); Mesh val7 = (val3.mesh = new Mesh()); val7.vertices = array; val7.triangles = array2; val7.RecalculateNormals(); ((Renderer)val4).material = coneMaterial; ((Renderer)val4).material.color = new Color(coneColor.r, coneColor.g, coneColor.b, 0.21960784f); val5.sharedMesh = val7; val5.convex = true; ((Collider)val5).isTrigger = true; val2.AddComponent<BetterCooldownTrigger>(); } } public class ConeTriggerHandler : MonoBehaviour { private void OnTriggerEnter(Collider other) { if (((Component)other).CompareTag("Player")) { Debug.Log("Player entered the cone trigger!"); } } private void OnTriggerExit(Collider other) { if (((Component)other).CompareTag("Player")) { Debug.Log("Player exited the cone trigger."); } } } public class BetterCooldownTrigger : NetworkBehaviour { public enum DeathAnimation { Default, HeadBurst, Spring, Electrocuted, ComedyMask, TragedyMask, Burnt, Snipped, SliceHead } public enum ForceDirection { Forward, Backward, Up, Down, Left, Right, Center } [Header("Script Enabled")] [Tooltip("Whether this script is enabled.")] public bool enabledScript = true; [Header("Death Animation Settings")] [Tooltip("Different ragdoll body types that spawn after death.")] public DeathAnimation deathAnimation = DeathAnimation.Default; [Space(2f)] [Header("Force Settings")] [Tooltip("The force direction of the damage.")] public ForceDirection forceDirection = ForceDirection.Forward; [Tooltip("The force magnitude of the damage.")] public float forceMagnitudeAfterDamage = 0f; [Tooltip("The force magnitude after death of player.")] public float forceMagnitudeAfterDeath = 0f; [Tooltip("If true, the force direction will be calculated from the object's transform. If false, the force direction will be calculated from the player's transform.")] public bool forceDirectionFromThisObject = true; [Space(2f)] [Header("Cause of Death")] [Tooltip("Cause of death displayed in ScanNode after death.")] public CauseOfDeath causeOfDeath = (CauseOfDeath)0; [Space(2f)] [Header("Trigger Settings")] [Tooltip("Whether to trigger for enemies.")] public bool triggerForEnemies = false; [Tooltip("Whether player/enemy can exit the trigger's effect.")] public bool canThingExit = true; [Tooltip("Whether to use shared cooldown between different GameObjects that use this script.")] public bool sharedCooldown = false; [Tooltip("Whether to play default player damage SFX when damage is dealt.")] public bool playDefaultPlayerDamageSFX = false; [Tooltip("Whether to play sound when damage is dealt to player that enemies can hear.")] public bool soundAttractsDogs = false; [Space(2f)] [Header("Damage Settings")] [Tooltip("Timer in which the gameobject will disable itself, 0 will not disable itself after any point of time.")] public float damageDuration = 0f; [Tooltip("Damage to deal every interval for players.")] public int damageToDealForPlayers = 0; [Tooltip("Damage to deal every interval for enemies.")] public int damageToDealForEnemies = 0; [Tooltip("Cooldown to deal damage for players.")] public float damageIntervalForPlayers = 0.25f; [Tooltip("Cooldown to deal damage for enemies.")] public float damageIntervalForEnemies = 0.25f; [Space(2f)] [Header("Audio Settings")] [Tooltip("Damage clip to play when damage is dealt to player/enemy.")] public List<AudioClip>? damageClip = null; [Tooltip("Damage audio sources to play when damage is dealt to player (picks the closest AudioSource to the player).")] public List<AudioSource>? damageAudioSources = null; [Space(2f)] [Header("Death Prefab Settings")] [Tooltip("Prefab to spawn when the player dies.")] public GameObject? deathPrefabForPlayer = null; [Tooltip("Prefab to spawn when the enemy dies.")] public GameObject? deathPrefabForEnemy = null; [Space(2f)] [Header("Particle System Settings")] [Tooltip("Use particle systems when damage is dealt to player/enemy.")] public bool useParticleSystems = false; [Tooltip("Teleport particle system to enemy/player when damage is dealt.")] public bool teleportParticles = false; [Tooltip("Particle system to play when the player dies.")] public List<ParticleSystem> deathParticlesForPlayer = new List<ParticleSystem>(); [Tooltip("Particle system to play when the player is damaged.")] public List<ParticleSystem> damageParticlesForPlayer = new List<ParticleSystem>(); [Tooltip("Particle system to play when the enemy dies.")] public List<ParticleSystem> deathParticlesForEnemy = new List<ParticleSystem>(); [Tooltip("Particle system to play when the enemy is damaged.")] public List<ParticleSystem> damageParticlesForEnemy = new List<ParticleSystem>(); private static float lastDamageTime = float.NegativeInfinity; private bool currentlyDamagingLocalPlayer = false; private Dictionary<EnemyAI, bool> enemyCoroutineStatus = new Dictionary<EnemyAI, bool>(); private Dictionary<PlayerControllerB, AudioSource> playerClosestAudioSources = new Dictionary<PlayerControllerB, AudioSource>(); private Dictionary<EnemyAI, AudioSource> enemyClosestAudioSources = new Dictionary<EnemyAI, AudioSource>(); private void OnEnable() { Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] BetterCooldownTrigger enabled"); ((MonoBehaviour)this).StartCoroutine(ManageDamageTimer()); } private IEnumerator ManageDamageTimer() { if (damageDuration <= 0f) { Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] Damage duration is 0 or negative, not disabling"); yield break; } Debug.Log($"[{((Object)((Component)this).gameObject).name}] Starting damage timer for {damageDuration} seconds"); yield return (object)new WaitForSeconds(damageDuration); Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] Damage duration expired, disabling GameObject"); ((Component)this).gameObject.SetActive(false); } private void OnTriggerEnter(Collider other) { Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] OnTriggerEnter called with " + ((Object)other).name); PlayerControllerB val = default(PlayerControllerB); if (!enabledScript) { Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] Script is disabled, ignoring trigger enter"); } else if (((Component)other).CompareTag("Player") && ((Component)other).TryGetComponent<PlayerControllerB>(ref val) && (Object)(object)val == (Object)(object)GameNetworkManager.Instance.localPlayerController && !val.isPlayerDead) { Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] Local player " + ((Object)val).name + " entered trigger"); if (!currentlyDamagingLocalPlayer) { Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] Starting to damage local player"); currentlyDamagingLocalPlayer = true; if (damageAudioSources != null && damageAudioSources.Count > 0) { playerClosestAudioSources[val] = GetClosestAudioSource(((Component)val).transform); Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] Set closest audio source for player"); } ((MonoBehaviour)this).StartCoroutine(DamageLocalPlayerCoroutine()); } } else { if (!triggerForEnemies) { return; } Transform val2 = TryFindRoot(((Component)other).transform); EnemyAI val3 = default(EnemyAI); if (!((Object)(object)val2 != (Object)null) || !((Component)val2).TryGetComponent<EnemyAI>(ref val3) || val3.isEnemyDead || !(val3.enemyType.enemyName != "Redwood Titan")) { return; } Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] Enemy " + val3.enemyType.enemyName + " entered trigger"); if (!enemyCoroutineStatus.ContainsKey(val3)) { Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] Starting to damage enemy " + val3.enemyType.enemyName); enemyCoroutineStatus[val3] = true; if (damageAudioSources != null && damageAudioSources.Count > 0) { enemyClosestAudioSources[val3] = GetClosestAudioSource(((Component)val3).transform); Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] Set closest audio source for enemy"); } ((MonoBehaviour)this).StartCoroutine(DamageEnemyCoroutine(val3)); } } } private void OnTriggerExit(Collider other) { Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] OnTriggerExit called with " + ((Object)other).name); PlayerControllerB val = default(PlayerControllerB); if (!enabledScript) { Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] Script is disabled, ignoring trigger exit"); } else if (!canThingExit) { Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] canThingExit is false, ignoring trigger exit"); } else if (((Component)other).CompareTag("Player") && ((Component)other).TryGetComponent<PlayerControllerB>(ref val) && (Object)(object)val == (Object)(object)GameNetworkManager.Instance.localPlayerController && !val.isPlayerDead) { Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] Local player " + ((Object)val).name + " exited trigger"); currentlyDamagingLocalPlayer = false; playerClosestAudioSources.Remove(val); Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] Stopped damaging local player and removed audio source"); } else if (triggerForEnemies) { Transform val2 = TryFindRoot(((Component)other).transform); EnemyAI val3 = default(EnemyAI); if ((Object)(object)val2 != (Object)null && ((Component)val2).TryGetComponent<EnemyAI>(ref val3) && !val3.isEnemyDead) { Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] Enemy " + val3.enemyType.enemyName + " exited trigger"); enemyCoroutineStatus[val3] = false; enemyClosestAudioSources.Remove(val3); Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] Stopped damaging enemy and removed audio source"); } } } private IEnumerator DamageLocalPlayerCoroutine() { Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] Started DamageLocalPlayerCoroutine"); while (currentlyDamagingLocalPlayer) { if (sharedCooldown && Time.time < lastDamageTime + damageIntervalForPlayers) { Debug.Log($"[{((Object)((Component)this).gameObject).name}] Waiting for shared cooldown, time left: {lastDamageTime + damageIntervalForPlayers - Time.time}"); yield return null; continue; } lastDamageTime = Time.time; Debug.Log($"[{((Object)((Component)this).gameObject).name}] Applying damage to local player at time {Time.time}"); ApplyDamageToLocalPlayer(); yield return (object)new WaitForSeconds(damageIntervalForPlayers); } Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] Exited DamageLocalPlayerCoroutine"); } private IEnumerator DamageEnemyCoroutine(EnemyAI enemy) { Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] Started DamageEnemyCoroutine for " + enemy.enemyType.enemyName); while (enemyCoroutineStatus[enemy]) { if (sharedCooldown && Time.time < lastDamageTime + damageIntervalForEnemies) { Debug.Log($"[{((Object)((Component)this).gameObject).name}] Waiting for shared cooldown for enemy, time left: {lastDamageTime + damageIntervalForEnemies - Time.time}"); yield return null; continue; } lastDamageTime = Time.time; Debug.Log($"[{((Object)((Component)this).gameObject).name}] Applying damage to enemy {enemy.enemyType.enemyName} at time {Time.time}"); ApplyDamageToEnemy(enemy); yield return (object)new WaitForSeconds(damageIntervalForEnemies); } Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] Exited DamageEnemyCoroutine for " + enemy.enemyType.enemyName); } private void ApplyDamageToLocalPlayer() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_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_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_029e: 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_01a5: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] Applying damage to local player " + ((Object)localPlayerController).name); Vector3 val = CalculateForceDirection(localPlayerController, forceMagnitudeAfterDamage); Vector3 val2 = CalculateForceDirection(localPlayerController, forceMagnitudeAfterDeath); Debug.Log($"[{((Object)((Component)this).gameObject).name}] Calculated force after damage: {val}, after death: {val2}"); localPlayerController.DamagePlayer(damageToDealForPlayers, playDefaultPlayerDamageSFX, true, causeOfDeath, (int)deathAnimation, false, val2); Debug.Log($"[{((Object)((Component)this).gameObject).name}] Damage applied to player, amount: {damageToDealForPlayers}"); PlayDamageSound(((Component)localPlayerController).transform, playerClosestAudioSources.ContainsKey(localPlayerController) ? playerClosestAudioSources[localPlayerController] : null); if (teleportParticles) { Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] Teleporting particles to player position"); foreach (ParticleSystem item in damageParticlesForPlayer) { if ((Object)(object)item != (Object)null) { ((Component)item).transform.position = ((Component)localPlayerController).transform.position; } } foreach (ParticleSystem item2 in deathParticlesForPlayer) { if ((Object)(object)item2 != (Object)null) { ((Component)item2).transform.position = ((Component)localPlayerController).transform.position; } } } if (!localPlayerController.isPlayerDead) { Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] Player is not dead, applying external force"); localPlayerController.externalForces += val; } else { Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] Player is dead, spawning death prefab if available"); if ((Object)(object)deathPrefabForPlayer != (Object)null && (Object)(object)deathPrefabForPlayer.GetComponent<NetworkObject>() != (Object)null) { SpawnDeathPrefabServerRpc(((Component)localPlayerController).transform.position, ((Component)localPlayerController).transform.rotation, forPlayer: true); } else if ((Object)(object)deathPrefabForPlayer != (Object)null) { Object.Instantiate<GameObject>(deathPrefabForPlayer, ((Component)localPlayerController).transform.position, ((Component)localPlayerController).transform.rotation); currentlyDamagingLocalPlayer = false; playerClosestAudioSources.Remove(localPlayerController); } } if (useParticleSystems) { Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] Handling particle systems for player"); HandleParticleSystemStuffServerRpc(((Component)localPlayerController).transform.position, forPlayer: true, localPlayerController.isPlayerDead); } } private void ApplyDamageToEnemy(EnemyAI enemy) { //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) Debug.Log($"[{((Object)((Component)this).gameObject).name}] Applying damage to {enemy.enemyType.enemyName}, amount: {damageToDealForEnemies}"); enemy.HitEnemy(damageToDealForEnemies, (PlayerControllerB)null, false, -1); PlayDamageSound(((Component)enemy).transform, enemyClosestAudioSources.ContainsKey(enemy) ? enemyClosestAudioSources[enemy] : null); if (enemy.isEnemyDead) { Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] Enemy " + enemy.enemyType.enemyName + " is dead, spawning death prefab if available"); if ((Object)(object)deathPrefabForEnemy != (Object)null && (Object)(object)deathPrefabForEnemy.GetComponent<NetworkObject>() != (Object)null) { SpawnDeathPrefabServerRpc(((Component)enemy).transform.position, ((Component)enemy).transform.rotation, forPlayer: false); } else if ((Object)(object)deathPrefabForEnemy != (Object)null) { Object.Instantiate<GameObject>(deathPrefabForEnemy, ((Component)enemy).transform.position, ((Component)enemy).transform.rotation); } enemyCoroutineStatus[enemy] = false; enemyClosestAudioSources.Remove(enemy); } if (useParticleSystems) { Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] Handling particle systems for enemy"); HandleParticleSystemStuffServerRpc(((Component)enemy).transform.position, forPlayer: false, enemy.isEnemyDead); } } [ServerRpc(RequireOwnership = false)] private void HandleParticleSystemStuffServerRpc(Vector3 position, bool forPlayer, bool isDead) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_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_0127: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2893753244u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref forPlayer, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isDead, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2893753244u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Debug.Log($"[{((Object)((Component)this).gameObject).name}] ServerRpc: Handling particle system stuff for player: {forPlayer}, isDead: {isDead}"); HandleParticleSystemStuffClientRpc(position, forPlayer, isDead); } } } [ClientRpc] private void HandleParticleSystemStuffClientRpc(Vector3 position, bool forPlayer, bool isDead) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_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_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2899264836u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref forPlayer, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isDead, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2899264836u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } Debug.Log($"[{((Object)((Component)this).gameObject).name}] ClientRpc: Handling particle system stuff for player: {forPlayer}, isDead: {isDead}"); if (teleportParticles) { if (forPlayer) { foreach (ParticleSystem item in damageParticlesForPlayer) { if ((Object)(object)item != (Object)null) { ((Component)item).transform.position = position; } } foreach (ParticleSystem item2 in deathParticlesForPlayer) { if ((Object)(object)item2 != (Object)null) { ((Component)item2).transform.position = position; } } } else { foreach (ParticleSystem item3 in damageParticlesForEnemy) { if ((Object)(object)item3 != (Object)null) { ((Component)item3).transform.position = position; } } foreach (ParticleSystem item4 in deathParticlesForEnemy) { if ((Object)(object)item4 != (Object)null) { ((Component)item4).transform.position = position; } } } } if (forPlayer) { if (!isDead && damageParticlesForPlayer.Count > 0) { ParticleSystem val3 = damageParticlesForPlayer[Random.Range(0, damageParticlesForPlayer.Count)]; val3.Play(); } else if (isDead && deathParticlesForPlayer.Count > 0) { ParticleSystem val4 = deathParticlesForPlayer[Random.Range(0, deathParticlesForPlayer.Count)]; val4.Play(); } } else if (!isDead) { ParticleSystem val5 = damageParticlesForEnemy[Random.Range(0, damageParticlesForEnemy.Count)]; val5.Play(); } else { ParticleSystem val6 = deathParticlesForEnemy[Random.Range(0, deathParticlesForEnemy.Count)]; val6.Play(); } } [ServerRpc(RequireOwnership = false)] private void SpawnDeathPrefabServerRpc(Vector3 position, Quaternion rotation, bool forPlayer) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_014e: 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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3551861553u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref rotation); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref forPlayer, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3551861553u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } Debug.Log($"[{((Object)((Component)this).gameObject).name}] ServerRpc: Spawning death prefab for player: {forPlayer} at position {position}"); if (forPlayer) { Object.Instantiate<GameObject>(deathPrefabForPlayer, position, rotation); GameObject? obj = deathPrefabForPlayer; if (obj != null) { obj.GetComponent<NetworkObject>().Spawn(false); } } else { Object.Instantiate<GameObject>(deathPrefabForEnemy, position, rotation); GameObject? obj2 = deathPrefabForEnemy; if (obj2 != null) { obj2.GetComponent<NetworkObject>().Spawn(false); } } } private Vector3 CalculateForceDirection(PlayerControllerB player, float baseForce) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.zero; switch (forceDirection) { case ForceDirection.Forward: val = (forceDirectionFromThisObject ? ((Component)this).transform.forward : ((Component)player).transform.forward); break; case ForceDirection.Backward: val = (forceDirectionFromThisObject ? (-((Component)this).transform.forward) : (-((Component)player).transform.forward)); break; case ForceDirection.Up: val = Vector3.up; break; case ForceDirection.Down: val = Vector3.down; break; case ForceDirection.Left: val = (forceDirectionFromThisObject ? (-((Component)this).transform.right) : (-((Component)player).transform.right)); break; case ForceDirection.Right: val = (forceDirectionFromThisObject ? ((Component)this).transform.right : ((Component)player).transform.right); break; case ForceDirection.Center: { Vector3 val2; Vector3 normalized; if (!forceDirectionFromThisObject) { val2 = ((Component)this).transform.position - ((Component)player).transform.position; normalized = ((Vector3)(ref val2)).normalized; } else { val2 = ((Component)player).transform.position - ((Component)this).transform.position; normalized = ((Vector3)(ref val2)).normalized; } val = normalized; break; } } Debug.Log($"[{((Object)((Component)this).gameObject).name}] Calculated force direction: {val}, magnitude: {baseForce}"); return ((Vector3)(ref val)).normalized * baseForce; } private void PlayDamageSound(Transform targetTransform, AudioSource? audioSource) { //IL_0012: 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) Debug.Log($"[{((Object)((Component)this).gameObject).name}] Playing damage sound at {targetTransform.position}"); if (damageClip != null && (Object)(object)audioSource != (Object)null) { if (soundAttractsDogs) { Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] Sound attracts dogs, playing audible noise"); RoundManager.Instance.PlayAudibleNoise(((Component)audioSource).transform.position, audioSource.maxDistance, audioSource.volume, 0, false, 0); } Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] Transmitting one-shot audio"); WalkieTalkie.TransmitOneShotAudio(audioSource, damageClip[Random.Range(0, damageClip.Count)], audioSource.volume); RoundManager.PlayRandomClip(audioSource, damageClip.ToArray(), true, audioSource.volume, 0, damageClip.Count); } } private AudioSource GetClosestAudioSource(Transform targetTransform) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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) Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] Getting closest audio source for " + ((Object)targetTransform).name); AudioSource val = damageAudioSources[0]; float num = Vector3.Distance(((Component)val).transform.position, targetTransform.position); foreach (AudioSource damageAudioSource in damageAudioSources) { float num2 = Vector3.Distance(((Component)damageAudioSource).transform.position, targetTransform.position); if (num2 < num) { val = damageAudioSource; num = num2; } } return val; } public void OnDisable() { Debug.Log("[" + ((Object)((Component)this).gameObject).name + "] BetterCooldownTrigger disabled"); ((MonoBehaviour)this).StopAllCoroutines(); currentlyDamagingLocalPlayer = false; enemyCoroutineStatus.Clear(); playerClosestAudioSources.Clear(); enemyClosestAudioSources.Clear(); } public static Transform? TryFindRoot(Transform child) { Transform val = child; while ((Object)(object)val != (Object)null) { if ((Object)(object)((Component)val).GetComponent<NetworkObject>() != (Object)null) { return val; } val = ((Component)val).transform.parent; } return null; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_BetterCooldownTrigger() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(2893753244u, new RpcReceiveHandler(__rpc_handler_2893753244)); NetworkManager.__rpc_func_table.Add(2899264836u, new RpcReceiveHandler(__rpc_handler_2899264836)); NetworkManager.__rpc_func_table.Add(3551861553u, new RpcReceiveHandler(__rpc_handler_3551861553)); } private static void __rpc_handler_2893753244(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_008e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); bool forPlayer = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref forPlayer, default(ForPrimitives)); bool isDead = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isDead, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((BetterCooldownTrigger)(object)target).HandleParticleSystemStuffServerRpc(position, forPlayer, isDead); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2899264836(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_008e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); bool forPlayer = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref forPlayer, default(ForPrimitives)); bool isDead = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isDead, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((BetterCooldownTrigger)(object)target).HandleParticleSystemStuffClientRpc(position, forPlayer, isDead); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3551861553(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); Quaternion rotation = default(Quaternion); ((FastBufferReader)(ref reader)).ReadValueSafe(ref rotation); bool forPlayer = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref forPlayer, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((BetterCooldownTrigger)(object)target).SpawnDeathPrefabServerRpc(position, rotation, forPlayer); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "BetterCooldownTrigger"; } } public static class TerrainInstancedToggle { public static void ToggleTerrainInstancing(bool enable) { Terrain[] activeTerrains = Terrain.activeTerrains; foreach (Terrain val in activeTerrains) { val.heightmapPixelError = (enable ? 80 : 5); val.drawInstanced = enable; } } } } namespace VoxxWeatherPlugin.Utils { public static class RandomExtensions { public static float NextDouble(this Random random, float min, float max) { if (min > max) { float num = max; max = min; min = num; Debug.LogWarning("Minimum value for random range must be less than maximum value. Switching them around!"); } return (float)random.NextDouble() * (max - min) + min; } } [Serializable] [VolumeComponentMenu("Post-processing/Custom/Glitch Effect")] public sealed class GlitchEffect : CustomPass { private static class ShaderIDs { internal static readonly int InputTexture = Shader.PropertyToID("_InputTexture"); internal static readonly int BlockStrength = Shader.PropertyToID("_BlockStrength"); internal static readonly int BlockStride = Shader.PropertyToID("_BlockStride"); internal static readonly int BlockSeed1 = Shader.PropertyToID("_BlockSeed1"); internal static readonly int BlockSeed2 = Shader.PropertyToID("_BlockSeed2"); internal static readonly int Drift = Shader.PropertyToID("_Drift"); internal static readonly int Jump = Shader.PropertyToID("_Jump"); internal static readonly int Shake = Shader.PropertyToID("_Shake"); internal static readonly int Seed = Shader.PropertyToID("_Seed"); } [Tooltip("Overall glitch intensity.")] public ClampedFloatParameter intensity = new ClampedFloatParameter(0f, 0f, 1f, false); [Tooltip("Strength of block glitching.")] public ClampedFloatParameter blockStrength = new ClampedFloatParameter(0.7f, 0f, 1f, false); [Tooltip("Horizontal drift intensity.")] public ClampedFloatParameter drift = new ClampedFloatParameter(1.5f, 0f, 2f, false); [Tooltip("Vertical jump intensity.")] public ClampedFloatParameter jump = new ClampedFloatParameter(0.4f, 0f, 1f, false); [Tooltip("Random shaking intensity.")] public ClampedFloatParameter shake = new ClampedFloatParameter(0.7f, 0f, 1f, false); [Tooltip("Shader material.")] public Material m_Material; private float m_PrevTime; private float m_JumpTime; private int m_BlockSeed1 = 71; private int m_BlockSeed2 = 113; private int m_BlockStride = 1; private float m_BlockTime; private RTHandle tempColorBuffer = null; protected override bool executeInSceneView => true; protected override void Execute(CustomPassContext ctx) { //IL_0023: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: 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_021e: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_Material == (Object)null) { Debug.LogError("Missing shader for Glitch Effect."); } else { if (DebugCheckBuffers(ctx)) { return; } HDUtils.BlitCameraTexture(ctx.cmd, ctx.cameraColorBuffer, tempColorBuffer, 0f, false); float time = Time.time; float num = time - m_PrevTime; m_JumpTime += num * ((VolumeParameter<float>)(object)jump).value * 11.3f; m_PrevTime = time; float num2 = ((VolumeParameter<float>)(object)blockStrength).value * ((VolumeParameter<float>)(object)blockStrength).value * ((VolumeParameter<float>)(object)blockStrength).value; m_BlockTime += num * 60f; if (m_BlockTime > 1f) { if (Random.value < 0.09f) { m_BlockSeed1 += 251; } if (Random.value < 0.29f) { m_BlockSeed2 += 373; } if (Random.value < 0.25f) { m_BlockStride = Random.Range(1, 32); } m_BlockTime = 0f; } m_Material.SetFloat(ShaderIDs.BlockStrength, num2 * ((VolumeParameter<float>)(object)intensity).value); m_Material.SetInt(ShaderIDs.BlockStride, m_BlockStride); m_Material.SetInt(ShaderIDs.BlockSeed1, m_BlockSeed1); m_Material.SetInt(ShaderIDs.BlockSeed2, m_BlockSeed2); m_Material.SetVector(ShaderIDs.Drift, Vector4.op_Implicit(new Vector2(time * 606.11f % (MathF.PI * 2f), ((VolumeParameter<float>)(object)drift).value * 0.04f * ((VolumeParameter<float>)(object)intensity).value))); m_Material.SetVector(ShaderIDs.Jump, Vector4.op_Implicit(new Vector2(m_JumpTime, ((VolumeParameter<float>)(object)jump).value * ((VolumeParameter<float>)(object)intensity).value))); m_Material.SetFloat(ShaderIDs.Shake, ((VolumeParameter<float>)(object)shake).value * 0.2f * ((VolumeParameter<float>)(object)intensity).value); m_Material.SetInt(ShaderIDs.Seed, (int)(time * 10000f)); m_Material.SetTexture(ShaderIDs.InputTexture, RTHandle.op_Implicit(tempColorBuffer)); CoreUtils.SetRenderTarget(ctx.cmd, ctx.cameraColorBuffer, (ClearFlag)0, 0, (CubemapFace)(-1), -1); CoreUtils.DrawFullScreen(ctx.cmd, m_Material, ctx.propertyBlock, 0); } } protected override void Cleanup() { tempColorBuffer.Release(); ((CustomPass)this).Cleanup(); } internal bool DebugCheckBuffers(CustomPassContext ctx) { //IL_002c: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_027f: 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_02bc: Unknown result type (might be due to invalid IL or missing references) bool result = false; if (tempColorBuffer == null) { Debug.LogWarning($"[Frame {Time.frameCount}] tempColorBuffer is null, allocating new buffer"); UpdateTempBuffer(ctx); result = true; } else if ((Object)(object)tempColorBuffer.rt == (Object)null) { Debug.LogWarning($"[Frame {Time.frameCount}] tempColorBuffer.rt is null"); UpdateTempBuffer(ctx); result = true; } if (ctx.cameraColorBuffer == null) { Debug.LogError($"[Frame {Time.frameCount}] ctx.cameraColorBuffer is null"); result = true; } else if ((Object)(object)ctx.cameraColorBuffer.rt == (Object)null) { Debug.LogError($"[Frame {Time.frameCount}] ctx.cameraColorBuffer.rt is null"); result = true; } if (ctx.hdCamera == null || (Object)(object)ctx.hdCamera?.camera == (Object)null) { Debug.LogError($"[Frame {Time.frameCount}] ctx.hdCamera or ctx.hdCamera.camera is null. " + $"ctx.hdCamera: {ctx.hdCamera == null}, ctx.hdCamera.camera: {(Object)(object)ctx.hdCamera?.camera == (Object)null}"); result = true; } else if (!((Behaviour)ctx.hdCamera.camera).enabled) { Debug.LogError($"[Frame {Time.frameCount}] Camera {((Object)ctx.hdCamera.camera).name} is disabled"); result = true; } RTHandle obj = tempColorBuffer; if ((Object)(object)((obj != null) ? obj.rt : null) != (Object)null) { RTHandle cameraColorBuffer = ctx.cameraColorBuffer; if ((Object)(object)((cameraColorBuffer != null) ? cameraColorBuffer.rt : null) != (Object)null && (((Texture)tempColorBuffer.rt).width != ((Texture)ctx.cameraColorBuffer.rt).width || ((Texture)tempColorBuffer.rt).height != ((Texture)ctx.cameraColorBuffer.rt).height)) { Debug.LogWarning($"[Frame {Time.frameCount}] Buffer dimensions do not match! " + $"tempColorBuffer: {((Texture)tempColorBuffer.rt).width}x{((Texture)tempColorBuffer.rt).height}, " + $"cameraColorBuffer: {((Texture)ctx.cameraColorBuffer.rt).width}x{((Texture)ctx.cameraColorBuffer.rt).height}"); result = true; UpdateTempBuffer(ctx); } } return result; } private void UpdateTempBuffer(CustomPassContext ctx) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) if (tempColorBuffer != null) { Debug.Log("GlitchPass: Releasing temp color buffer!"); tempColorBuffer.Release(); } tempColorBuffer = RTHandles.Alloc(((Texture)ctx.cameraColorBuffer.rt).width, ((Texture)ctx.cameraColorBuffer.rt).height, TextureXR.slices, (DepthBits)0, (GraphicsFormat)74, (FilterMode)0, (TextureWrapMode)0, TextureXR.dimension, false, false, true, false, 1, 0f, (MSAASamples)1, false, true, (RenderTextureMemoryless)0, (VRTextureUsage)0, "Glitch Buffer"); Debug.Log("GlitchPass: Allocated temp color buffer!"); } } [RequireComponent(typeof(AudioSource))] public class InterferenceDistortionFilter : MonoBehaviour { [SerializeField] [Range(0f, 1f)] internal float noiseLevel = 0.005f; [SerializeField] [Range(0f, 1f)] internal float distortionChance = 0.35f; [SerializeField] internal float maxFrequencyShift = 250f; [SerializeField] internal float freqModulationPeriod = 30f; [SerializeField] internal float minClarityDuration = 0.01f; [SerializeField] internal float maxClarityDuration = 1f; [SerializeField] internal float freqShiftMultiplier = 1.5f; private float phase = 0f; private float freqPhase = 0f; private bool isClarity = false; private int remainingClaritySamples = 0; private int sampleRate; private Random random; private void Start() { sampleRate = AudioSettings.outputSampleRate; random = new Random(42); noiseLevel = VoxxWeatherPlugin.NoiseStaticLevel.Value; } private void OnAudioFilterRead(float[] data, int channels) { int num = data.Length; for (int i = 0; i < num; i++) { if (!isClarity && remainingClaritySamples <= 0) { int num2 = (int)(1f + (minClarityDuration + maxClarityDuration) / 2f * (float)sampleRate * (float)channels); float num3 = (0f - (1f - 1f / (distortionChance + float.Epsilon))) / (float)num2; if (random.NextDouble() < (double)num3) { isClarity = true; float num4 = random.NextDouble(minClarityDuration, maxClarityDuration); remainingClaritySamples = (int)(num4 * (float)sampleRate * (float)channels); } } if (isClarity) { float num5 = data[i]; freqPhase += 1f / ((float)(sampleRate * 2) * freqModulationPeriod); freqPhase %= 1f; float num6 = maxFrequencyShift * Mathf.Cos(MathF.PI * 2f * freqPhase); phase += num6 / (float)sampleRate; phase %= 1f; num5 *= freqShiftMultiplier * Mathf.Cos(MathF.PI * 2f * phase); num5 *= 1f - distortionChance + random.NextDouble(0f, distortionChance); data[i] = Mathf.Clamp(num5, -1f, 1f); remainingClaritySamples--; if (remainingClaritySamples <= 0) { isClarity = false; } } else { data[i] = random.NextDouble(0f - noiseLevel, noiseLevel); } } } } internal class PlayerTemperatureManager { public static bool isInHeatZone = false; public static float heatSeverityMultiplier = 1f; public static float heatSeverity = 0f; internal static Volume heatEffectVolume; internal static void SetHeatSeverity(float heatSeverityDelta) { heatSeverity = Mathf.Clamp01(heatSeverity + heatSeverityDelta * heatSeverityMultiplier); if ((Object)(object)heatEffectVolume != (Object)null) { heatEffectVolume.weight = heatSeverity; } } } public class WeatherAssetLoader { private static readonly Dictionary<string, AssetBundle> loadedBundles = new Dictionary<string, AssetBundle>(); public static T LoadAsset<T>(string bundleName, string assetName) where T : Object { AssetBundle val = LoadBundle(bundleName); if ((Object)(object)val == (Object)null) { return default(T); } return val.LoadAsset<T>(assetName); } private static AssetBundle LoadBundle(string bundleName) { if (loadedBundles.ContainsKey(bundleName)) { return loadedBundles[bundleName]; } string location = Assembly.GetExecutingAssembly().Location; string directoryName = Path.GetDirectoryName(location); string text = Path.Combine(directoryName, bundleName); AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val != (Object)null) { loadedBundles.Add(bundleName, val); } else { Debug.LogError("Failed to load AssetBundle: " + bundleName); } return val; } public static void UnloadAllBundles() { foreach (AssetBundle value in loadedBundles.Values) { value.Unload(true); } loadedBundles.Clear(); } private void OnDisable() { UnloadAllBundles(); Debug.Log("Unloaded assetbundles."); } } public class WeatherTypeLoader { internal static string bundleName = "voxxweather.assetbundle"; public static void RegisterHeatwaveWeather() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_00f1: 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_0104: Expected O, but got Unknown //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Expec