using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using Microsoft.CodeAnalysis; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LethalPisser")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("LethalPisser")] [assembly: AssemblyTitle("LethalPisser")] [assembly: AssemblyVersion("1.0.1.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LethalPisser { [BepInPlugin("com.lethalpisser.plugin", "LethalPisser", "1.1.0")] public sealed class LethalPisserPlugin : BaseUnityPlugin { public const string PluginGuid = "com.lethalpisser.plugin"; public const string PluginName = "LethalPisser"; public const string PluginVersion = "1.1.0"; private const string RequestMessageName = "LethalPisser.RequestPeeState"; private const string StateMessageName = "LethalPisser.PeeState"; private const float ChargerShockCooldown = 0.85f; private const int ChargerShockDamage = 35; private static ManualLogSource? logger; private readonly Dictionary activeStreams = new Dictionary(); private readonly List staleStreamIds = new List(); private InputAction? peeAction; private NetworkManager? registeredNetworkManager; private bool localPlayerIsPeeing; private float nextLocalChargerShockTime; private void Awake() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_002e: 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) logger = ((BaseUnityPlugin)this).Logger; peeAction = new InputAction("LethalPisser.Pee", (InputActionType)1, (string)null, (string)null, (string)null, (string)null); InputActionSetupExtensions.AddBinding(peeAction, "/p", (string)null, (string)null, (string)null); InputActionSetupExtensions.AddBinding(peeAction, "/dpad/up", (string)null, (string)null, (string)null); peeAction.Enable(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"LethalPisser 1.1.0 loaded for Lethal Company v81."); } private void Update() { EnsureNetworkHandlers(); UpdateLocalPeeInput(); CleanupInvalidStreams(); } private void OnDestroy() { StopLocalPeeing(); UnregisterNetworkHandlers(); InputAction? obj = peeAction; if (obj != null) { obj.Disable(); } InputAction? obj2 = peeAction; if (obj2 != null) { obj2.Dispose(); } peeAction = null; foreach (PeeStream value in activeStreams.Values) { if ((Object)(object)value != (Object)null) { Object.Destroy((Object)(object)((Component)value).gameObject); } } activeStreams.Clear(); } private void UpdateLocalPeeInput() { PlayerControllerB localPlayer = GetLocalPlayer(); if (!CanPlayerPee(localPlayer)) { if (localPlayerIsPeeing) { StopLocalPeeing(); } return; } bool flag = IsPeeInputHeld(); if (flag == localPlayerIsPeeing) { if (localPlayerIsPeeing && (Object)(object)localPlayer != (Object)null) { SetPeeState(localPlayer.playerClientId, isPeeing: true); } } else if (flag) { StartLocalPeeing(localPlayer); } else { StopLocalPeeing(); } } private static PlayerControllerB? GetLocalPlayer() { if ((Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null) { return GameNetworkManager.Instance.localPlayerController; } if (!((Object)(object)StartOfRound.Instance != (Object)null)) { return null; } return StartOfRound.Instance.localPlayerController; } private static bool CanPlayerPee(PlayerControllerB? player) { if ((Object)(object)player == (Object)null || !player.isPlayerControlled || player.isPlayerDead) { return false; } if (player.isTypingChat || player.inTerminalMenu) { return false; } if (!((Object)(object)player.quickMenuManager == (Object)null)) { return !player.quickMenuManager.isMenuOpen; } return true; } private bool IsPeeInputHeld() { try { if (peeAction != null) { return peeAction.IsPressed(); } } catch (Exception ex) { ManualLogSource? obj = logger; if (obj != null) { obj.LogDebug((object)("InputSystem read failed; falling back to legacy keyboard input. " + ex.Message)); } } return Input.GetKey((KeyCode)112); } private void StartLocalPeeing(PlayerControllerB localPlayer) { localPlayerIsPeeing = true; SetPeeState(localPlayer.playerClientId, isPeeing: true); SendPeeState(localPlayer.playerClientId, isPeeing: true); } private void StopLocalPeeing() { if (localPlayerIsPeeing) { localPlayerIsPeeing = false; PlayerControllerB localPlayer = GetLocalPlayer(); if (!((Object)(object)localPlayer == (Object)null)) { SetPeeState(localPlayer.playerClientId, isPeeing: false); SendPeeState(localPlayer.playerClientId, isPeeing: false); } } } private void EnsureNetworkHandlers() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown NetworkManager singleton = NetworkManager.Singleton; if (!((Object)(object)singleton == (Object)null) && singleton.CustomMessagingManager != null && registeredNetworkManager != singleton) { UnregisterNetworkHandlers(); singleton.CustomMessagingManager.RegisterNamedMessageHandler("LethalPisser.RequestPeeState", new HandleNamedMessageDelegate(HandleRequestMessage)); singleton.CustomMessagingManager.RegisterNamedMessageHandler("LethalPisser.PeeState", new HandleNamedMessageDelegate(HandleStateMessage)); registeredNetworkManager = singleton; } } private void UnregisterNetworkHandlers() { if ((Object)(object)registeredNetworkManager == (Object)null || registeredNetworkManager.CustomMessagingManager == null) { registeredNetworkManager = null; return; } registeredNetworkManager.CustomMessagingManager.UnregisterNamedMessageHandler("LethalPisser.RequestPeeState"); registeredNetworkManager.CustomMessagingManager.UnregisterNamedMessageHandler("LethalPisser.PeeState"); registeredNetworkManager = null; } private void SendPeeState(ulong playerClientId, bool isPeeing) { //IL_0033: 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_0046: Unknown result type (might be due to invalid IL or missing references) NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null || singleton.CustomMessagingManager == null || !singleton.IsListening) { return; } if (singleton.IsServer) { BroadcastPeeState(playerClientId, isPeeing); return; } FastBufferWriter val = CreateStateWriter(playerClientId, isPeeing); try { singleton.CustomMessagingManager.SendNamedMessage("LethalPisser.RequestPeeState", 0uL, val, (NetworkDelivery)3); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } private void HandleRequestMessage(ulong senderClientId, FastBufferReader reader) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) NetworkManager singleton = NetworkManager.Singleton; if (!((Object)(object)singleton == (Object)null) && singleton.IsServer && TryReadState(reader, out var playerClientId, out var isPeeing)) { PlayerControllerB val = FindPlayerByPlayerClientId(playerClientId); if (!((Object)(object)val == (Object)null) && val.actualClientId == senderClientId) { SetPeeState(playerClientId, isPeeing); BroadcastPeeState(playerClientId, isPeeing); } } } private void HandleStateMessage(ulong senderClientId, FastBufferReader reader) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) NetworkManager singleton = NetworkManager.Singleton; if ((!((Object)(object)singleton != (Object)null) || singleton.IsServer || senderClientId == 0L) && TryReadState(reader, out var playerClientId, out var isPeeing)) { SetPeeState(playerClientId, isPeeing); } } private void BroadcastPeeState(ulong playerClientId, bool isPeeing) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null || singleton.CustomMessagingManager == null || !singleton.IsServer || !singleton.IsListening) { return; } FastBufferWriter val = CreateStateWriter(playerClientId, isPeeing); try { singleton.CustomMessagingManager.SendNamedMessageToAll("LethalPisser.PeeState", val, (NetworkDelivery)3); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } private static FastBufferWriter CreateStateWriter(ulong playerClientId, bool isPeeing) { //IL_0011: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter result = default(FastBufferWriter); ((FastBufferWriter)(ref result))..ctor(16, (Allocator)2, -1); ((FastBufferWriter)(ref result)).WriteValueSafe(ref playerClientId, default(ForPrimitives)); ((FastBufferWriter)(ref result)).WriteValueSafe(ref isPeeing, default(ForPrimitives)); return result; } private static bool TryReadState(FastBufferReader reader, out ulong playerClientId, out bool isPeeing) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) playerClientId = 0uL; isPeeing = false; try { ((FastBufferReader)(ref reader)).ReadValueSafe(ref playerClientId, default(ForPrimitives)); ((FastBufferReader)(ref reader)).ReadValueSafe(ref isPeeing, default(ForPrimitives)); return true; } catch (Exception ex) { ManualLogSource? obj = logger; if (obj != null) { obj.LogWarning((object)("Failed to read pee state message: " + ex.Message)); } return false; } } private void SetPeeState(ulong playerClientId, bool isPeeing) { if (!isPeeing) { StopStream(playerClientId); return; } PlayerControllerB val = FindPlayerByPlayerClientId(playerClientId); PeeStream value; if (!CanRenderPeeStream(val)) { DestroyStream(playerClientId); } else if (activeStreams.TryGetValue(playerClientId, out value) && (Object)(object)value != (Object)null) { value.Bind(val, OnStreamHitCharger); } else { activeStreams[playerClientId] = PeeStream.Create(val, OnStreamHitCharger); } } private void StopStream(ulong playerClientId) { if (activeStreams.TryGetValue(playerClientId, out PeeStream value) && (Object)(object)value != (Object)null) { value.StopFlow(); } } private void OnStreamHitCharger(PlayerControllerB streamPlayer, ItemCharger charger, Vector3 hitPoint) { //IL_0059: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB localPlayer = GetLocalPlayer(); if (!((Object)(object)localPlayer == (Object)null) && !((Object)(object)streamPlayer != (Object)(object)localPlayer) && !localPlayer.isPlayerDead && !(Time.time < nextLocalChargerShockTime)) { nextLocalChargerShockTime = Time.time + 0.85f; PlayLocalChargerZap(charger); charger.PlayChargeItemEffectServerRpc((int)localPlayer.playerClientId); Vector3 val = ((Component)localPlayer).transform.position - hitPoint; Vector3 val2 = ((Vector3)(ref val)).normalized * 10f + Vector3.up * 4f; localPlayer.DamagePlayer(35, true, true, (CauseOfDeath)11, 0, false, val2); } } private static void PlayLocalChargerZap(ItemCharger charger) { if ((Object)(object)charger.zapAudio != (Object)null) { charger.zapAudio.Play(); } if ((Object)(object)charger.chargeStationAnimator != (Object)null) { charger.chargeStationAnimator.SetTrigger("zap"); } } private static bool CanRenderPeeStream(PlayerControllerB? player) { if ((Object)(object)player != (Object)null && player.isPlayerControlled && !player.isPlayerDead) { return ((Component)player).gameObject.activeInHierarchy; } return false; } private static PlayerControllerB? FindPlayerByPlayerClientId(ulong playerClientId) { PlayerControllerB[] array = (((Object)(object)StartOfRound.Instance != (Object)null) ? StartOfRound.Instance.allPlayerScripts : null); if (array == null) { return null; } foreach (PlayerControllerB val in array) { if ((Object)(object)val != (Object)null && val.playerClientId == playerClientId) { return val; } } return null; } private void CleanupInvalidStreams() { staleStreamIds.Clear(); foreach (KeyValuePair activeStream in activeStreams) { if ((Object)(object)activeStream.Value == (Object)null || !activeStream.Value.HasValidTarget) { staleStreamIds.Add(activeStream.Key); } } for (int i = 0; i < staleStreamIds.Count; i++) { DestroyStream(staleStreamIds[i]); } } private void DestroyStream(ulong playerClientId) { if (activeStreams.TryGetValue(playerClientId, out PeeStream value)) { activeStreams.Remove(playerClientId); if ((Object)(object)value != (Object)null) { Object.Destroy((Object)(object)((Component)value).gameObject); } } } } internal sealed class PeeStream : MonoBehaviour { private const int MaxSegments = 16; private const float SegmentTime = 0.045f; private const float StreamSpeed = 11.5f; private const float GravityScale = 0.58f; private const float SplashEmissionRate = 45f; private const float BaseAudioVolume = 0.08f; private const float FizzleDuration = 0.7f; private const float MinimumShockStrength = 0.35f; private static readonly Color streamColor = new Color(1f, 0.78f, 0.12f, 0.92f); private static readonly Color streamEndColor = new Color(1f, 0.95f, 0.35f, 0.55f); private static Material? streamMaterial; private static AudioClip? streamAudioClip; private readonly Vector3[] pathPoints = (Vector3[])(object)new Vector3[16]; private readonly RaycastHit[] raycastHits = (RaycastHit[])(object)new RaycastHit[12]; private PlayerControllerB? player; private Action? chargerHitHandler; private LineRenderer lineRenderer; private ParticleSystem splashParticles; private AudioSource audioSource; private float seed; private bool isFlowing = true; private float fizzleTimer; public bool HasValidTarget { get { if ((Object)(object)player != (Object)null && player.isPlayerControlled && !player.isPlayerDead) { return ((Component)player).gameObject.activeInHierarchy; } return false; } } public static PeeStream Create(PlayerControllerB player, Action chargerHitHandler) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) PeeStream peeStream = new GameObject($"LethalPisser_Stream_{player.playerClientId}").AddComponent(); peeStream.Bind(player, chargerHitHandler); return peeStream; } public void Bind(PlayerControllerB targetPlayer, Action chargerHitHandler) { player = targetPlayer; this.chargerHitHandler = chargerHitHandler; isFlowing = true; fizzleTimer = 0f; } public void StopFlow() { isFlowing = false; fizzleTimer = 0f; } private void Awake() { seed = Random.Range(0f, 1000f); lineRenderer = ((Component)this).gameObject.AddComponent(); ConfigureLineRenderer(); ConfigureSplashParticles(); ConfigureAudio(); } private void OnDestroy() { if ((Object)(object)audioSource != (Object)null) { audioSource.Stop(); } } private void LateUpdate() { //IL_004c: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) if (!HasValidTarget || (Object)(object)player == (Object)null) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } float streamStrength = GetStreamStrength(); if (streamStrength <= 0f) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { if (!TryGetEmitter(streamStrength, out var origin, out var velocity)) { return; } int pointCount; Vector3 impactPoint; Vector3 impactNormal; Collider hitCollider; bool flag = BuildPath(origin, velocity, streamStrength, out pointCount, out impactPoint, out impactNormal, out hitCollider); lineRenderer.positionCount = pointCount; lineRenderer.widthMultiplier = streamStrength; for (int i = 0; i < pointCount; i++) { lineRenderer.SetPosition(i, pathPoints[i]); } ((Component)splashParticles).transform.position = impactPoint + impactNormal * 0.015f; ((Component)splashParticles).transform.rotation = Quaternion.LookRotation(impactNormal); SetSplashEmission(flag ? (45f * streamStrength) : 0f); ((Component)audioSource).transform.position = origin; audioSource.volume = 0.08f * streamStrength; if (!audioSource.isPlaying) { audioSource.Play(); } if (flag && streamStrength >= 0.35f && (Object)(object)hitCollider != (Object)null) { ItemCharger componentInParent = ((Component)hitCollider).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { chargerHitHandler?.Invoke(player, componentInParent, impactPoint); } } } } private void ConfigureLineRenderer() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Expected O, but got Unknown //IL_00d6: 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_00e5: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) lineRenderer.useWorldSpace = true; lineRenderer.textureMode = (LineTextureMode)0; lineRenderer.alignment = (LineAlignment)0; lineRenderer.numCapVertices = 5; lineRenderer.numCornerVertices = 3; ((Renderer)lineRenderer).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)lineRenderer).receiveShadows = false; lineRenderer.widthCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[3] { new Keyframe(0f, 0.035f), new Keyframe(0.7f, 0.028f), new Keyframe(1f, 0.012f) }); Material material = GetMaterial(); if ((Object)(object)material != (Object)null) { ((Renderer)lineRenderer).material = material; } Gradient val = new Gradient(); val.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(streamColor, 0f), new GradientColorKey(streamEndColor, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[2] { new GradientAlphaKey(streamColor.a, 0f), new GradientAlphaKey(streamEndColor.a, 1f) }); lineRenderer.colorGradient = val; } private void ConfigureSplashParticles() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Expected O, but got Unknown //IL_017c: 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_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: 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) GameObject val = new GameObject("Splash"); val.transform.SetParent(((Component)this).transform, false); splashParticles = val.AddComponent(); MainModule main = splashParticles.main; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.12f, 0.28f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.25f, 0.85f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.018f, 0.04f); ((MainModule)(ref main)).startColor = new MinMaxGradient(streamColor, streamEndColor); ((MainModule)(ref main)).maxParticles = 90; EmissionModule emission = splashParticles.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(45f); ShapeModule shape = splashParticles.shape; ((ShapeModule)(ref shape)).enabled = true; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)4; ((ShapeModule)(ref shape)).angle = 38f; ((ShapeModule)(ref shape)).radius = 0.025f; VelocityOverLifetimeModule velocityOverLifetime = splashParticles.velocityOverLifetime; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).space = (ParticleSystemSimulationSpace)0; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = new MinMaxCurve(0.08f, 0.45f); ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).x = new MinMaxCurve(-0.25f, 0.25f); ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).z = new MinMaxCurve(-0.25f, 0.25f); ColorOverLifetimeModule colorOverLifetime = splashParticles.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val2 = new Gradient(); val2.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(streamColor, 0f), new GradientColorKey(streamEndColor, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[2] { new GradientAlphaKey(0.85f, 0f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val2); ParticleSystemRenderer component = val.GetComponent(); component.renderMode = (ParticleSystemRenderMode)0; ((Renderer)component).sortingOrder = 1; Material material = GetMaterial(); if ((Object)(object)material != (Object)null) { ((Renderer)component).material = material; } } private void ConfigureAudio() { audioSource = ((Component)this).gameObject.AddComponent(); audioSource.clip = GetAudioClip(); audioSource.loop = true; audioSource.playOnAwake = false; audioSource.spatialBlend = 1f; audioSource.dopplerLevel = 0f; audioSource.rolloffMode = (AudioRolloffMode)1; audioSource.minDistance = 1.5f; audioSource.maxDistance = 9f; audioSource.volume = 0.08f; } private float GetStreamStrength() { if (isFlowing) { return 1f; } fizzleTimer += Time.deltaTime; float num = Mathf.Clamp01(fizzleTimer / 0.7f); return Mathf.SmoothStep(1f, 0f, num); } private bool TryGetEmitter(float streamStrength, out Vector3 origin, out Vector3 velocity) { //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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_011f: 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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: 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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_00e7: 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_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_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: 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) origin = Vector3.zero; velocity = Vector3.zero; if ((Object)(object)player == (Object)null) { return false; } Transform val = (((Object)(object)player.gameplayCamera != (Object)null) ? ((Component)player.gameplayCamera).transform : ((Component)player).transform); Vector3 forward = val.forward; Vector3 forward2 = ((Component)player).transform.forward; Vector3 val2 = Vector3.Cross(Vector3.up, forward2); if (((Vector3)(ref val2)).sqrMagnitude < 0.01f) { val2 = ((Component)player).transform.right; } ((Vector3)(ref val2)).Normalize(); bool flag = (Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)player; origin = (flag ? (val.position + forward * 0.22f - val.up * 0.48f + val2 * 0.04f) : (((Component)player).transform.position + Vector3.up * 0.78f + forward2 * 0.34f + val2 * 0.04f)); float num = Mathf.Sin(Time.time * 24f + seed) * 1.35f; float num2 = Mathf.Sin(Time.time * 31f + seed * 0.37f) * 0.75f; Quaternion val3 = Quaternion.AngleAxis(num, Vector3.up) * Quaternion.AngleAxis(num2, val2); Vector3 val4 = forward + Vector3.down * 0.11f; Vector3 val5 = val3 * ((Vector3)(ref val4)).normalized; velocity = ((Vector3)(ref val5)).normalized * Mathf.Lerp(2.5f, 11.5f, streamStrength); return true; } private bool BuildPath(Vector3 origin, Vector3 velocity, float streamStrength, out int pointCount, out Vector3 impactPoint, out Vector3 impactNormal, out Collider? hitCollider) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_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_006e: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_0143: 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_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0170: 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_0122: 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_0127: Unknown result type (might be due to invalid IL or missing references) pathPoints[0] = origin; pointCount = 1; impactPoint = origin; impactNormal = Vector3.up; hitCollider = null; Vector3 from = origin; bool flag = false; int num = Mathf.Max(3, Mathf.CeilToInt(16f * Mathf.Lerp(0.22f, 1f, streamStrength))); for (int i = 1; i < num; i++) { float num2 = (float)i * 0.045f; Vector3 val = origin + velocity * num2 + Physics.gravity * (0.29f * num2 * num2); val += Vector3.right * (Mathf.Sin(Time.time * 18f + seed + (float)i * 0.8f) * 0.01f * (float)i * streamStrength); if (TryGetSegmentHit(from, val, out var closestHit)) { pathPoints[pointCount] = ((RaycastHit)(ref closestHit)).point; pointCount++; impactPoint = ((RaycastHit)(ref closestHit)).point; Vector3 normal = ((RaycastHit)(ref closestHit)).normal; impactNormal = ((((Vector3)(ref normal)).sqrMagnitude > 0.01f) ? ((RaycastHit)(ref closestHit)).normal : Vector3.up); hitCollider = ((RaycastHit)(ref closestHit)).collider; flag = true; break; } pathPoints[pointCount] = val; pointCount++; from = val; } if (!flag) { impactPoint = pathPoints[pointCount - 1]; } return flag; } private bool TryGetSegmentHit(Vector3 from, Vector3 to, out RaycastHit closestHit) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) closestHit = default(RaycastHit); Vector3 val = to - from; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude <= 0.001f) { return false; } int num = Physics.RaycastNonAlloc(from, val / magnitude, raycastHits, magnitude, -1, (QueryTriggerInteraction)2); float num2 = float.MaxValue; bool result = false; for (int i = 0; i < num; i++) { RaycastHit val2 = raycastHits[i]; if (!((Object)(object)((RaycastHit)(ref val2)).collider == (Object)null) && !ShouldIgnoreCollider(((RaycastHit)(ref val2)).collider) && ((RaycastHit)(ref val2)).distance < num2) { num2 = ((RaycastHit)(ref val2)).distance; closestHit = val2; result = true; } } return result; } private bool ShouldIgnoreCollider(Collider hitCollider) { if ((Object)(object)player == (Object)null) { return true; } if ((Object)(object)((Component)hitCollider).transform == (Object)(object)((Component)player).transform || ((Component)hitCollider).transform.IsChildOf(((Component)player).transform)) { return true; } if (hitCollider.isTrigger) { return (Object)(object)((Component)hitCollider).GetComponentInParent() == (Object)null; } return false; } private void SetSplashEmission(float rate) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) EmissionModule emission = splashParticles.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(rate); } private static Material? GetMaterial() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_0092: 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_00dc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)streamMaterial != (Object)null) { return streamMaterial; } Shader val = Shader.Find("Sprites/Default") ?? Shader.Find("HDRP/Unlit") ?? Shader.Find("Universal Render Pipeline/Unlit") ?? Shader.Find("Unlit/Color") ?? Shader.Find("Standard"); if ((Object)(object)val == (Object)null) { return null; } streamMaterial = new Material(val) { name = "LethalPisser_StreamMaterial" }; if (streamMaterial.HasProperty("_Color")) { streamMaterial.SetColor("_Color", streamColor); } if (streamMaterial.HasProperty("_BaseColor")) { streamMaterial.SetColor("_BaseColor", streamColor); } if (streamMaterial.HasProperty("_UnlitColor")) { streamMaterial.SetColor("_UnlitColor", streamColor); } return streamMaterial; } private static AudioClip GetAudioClip() { if ((Object)(object)streamAudioClip != (Object)null) { return streamAudioClip; } int num = Mathf.CeilToInt(9922.5f); float[] array = new float[num]; int num2 = 7231; for (int i = 0; i < num; i++) { num2 = num2 * 1103515245 + 12345; float num3 = (float)((num2 >> 16) & 0x7FFF) / 16384f - 1f; float num4 = Mathf.Sin((float)i * 0.17f) * 0.012f + Mathf.Sin((float)i * 0.041f) * 0.008f; array[i] = num3 * 0.018f + num4; } streamAudioClip = AudioClip.Create("LethalPisser_StreamLoop", num, 1, 22050, false); streamAudioClip.SetData(array, 0); return streamAudioClip; } } }