using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using Dawn;
using Dawn.Utils;
using Dusk;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Snowlance.LethalWashing.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Animations.Rigging;
[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: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("EasyTextEffects")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("Snowlance.LethalWashing")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.3.1.0")]
[assembly: AssemblyInformationalVersion("1.3.1+e5cdba5f10e29dd114a9ddb4804dfb9038bf324e")]
[assembly: AssemblyProduct("LethalWashing")]
[assembly: AssemblyTitle("Snowlance.LethalWashing")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
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 LethalWashing
{
internal class CoinBehavior : PhysicsProp
{
public AnimationCurve grenadeFallCurve;
public AnimationCurve grenadeVerticalFallCurve;
public AnimationCurve grenadeVerticalFallCurveNoBounce;
public AudioSource audioSource;
private static Random? coinRandom;
private BoundedRange coinFallRange = new BoundedRange(-1f, 1f);
public List<AudioClip> coinDropSFXs = new List<AudioClip>();
private Ray grenadeThrowRay;
private RaycastHit grenadeHit;
private const int stunGrenadeMask = 268437761;
private const float ejectDistance = 3.5f;
public bool ejectingFromWashingMachine;
public override void Start()
{
((GrabbableObject)this).Start();
if ((Object)(object)WashingMachine.Instance != (Object)null && ejectingFromWashingMachine)
{
EjectFromWashingMachine();
}
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
((GrabbableObject)this).ItemActivate(used, buttonDown);
((GrabbableObject)this).playerHeldBy.DiscardHeldObject(true, (NetworkObject)null, GetGrenadeThrowDestination(((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform, Configs.ThrowDistance), true);
}
public void EjectFromWashingMachine()
{
//IL_0018: 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_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)
Plugin.logger.LogDebug((object)"EjectFromWashingMachine");
((GrabbableObject)this).startFallingPosition = ((Component)this).transform.position;
((GrabbableObject)this).targetFloorPosition = GetGrenadeThrowDestination(WashingMachine.Instance.coinSpawn, 3.5f);
((GrabbableObject)this).hasHitGround = false;
((GrabbableObject)this).fallTime = 0f;
}
public Vector3 GetGrenadeThrowDestination(Transform ejectPoint, float _throwDistance)
{
//IL_0007: 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_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: 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_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: 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_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: 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_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: 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_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: 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_0114: Unknown result type (might be due to invalid IL or missing references)
Vector3 position = ((Component)this).transform.position;
grenadeThrowRay = new Ray(ejectPoint.position, ejectPoint.forward);
position = (Physics.Raycast(grenadeThrowRay, ref grenadeHit, _throwDistance, 268437761, (QueryTriggerInteraction)1) ? ((Ray)(ref grenadeThrowRay)).GetPoint(((RaycastHit)(ref grenadeHit)).distance - 0.05f) : ((Ray)(ref grenadeThrowRay)).GetPoint(_throwDistance - 2f));
grenadeThrowRay = new Ray(position, Vector3.down);
position = ((!Physics.Raycast(grenadeThrowRay, ref grenadeHit, 30f, 268437761, (QueryTriggerInteraction)1)) ? ((Ray)(ref grenadeThrowRay)).GetPoint(30f) : (((RaycastHit)(ref grenadeHit)).point + Vector3.up * 0.05f));
return position + new Vector3(Random.Range(-1f, 1f), 0f, Random.Range(-1f, 1f));
}
public override void FallWithCurve()
{
//IL_0002: 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_000d: 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_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: 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_0062: 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_0082: 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_009e: 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_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: 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_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: 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_00c5: 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_00ea: 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_0110: 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_0130: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = ((GrabbableObject)this).startFallingPosition - ((GrabbableObject)this).targetFloorPosition;
float magnitude = ((Vector3)(ref val)).magnitude;
Quaternion val2 = Quaternion.Euler(((GrabbableObject)this).itemProperties.restingRotation.x, ((Component)this).transform.eulerAngles.y, ((GrabbableObject)this).itemProperties.restingRotation.z);
((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, val2, 14f * Time.deltaTime / magnitude);
((Component)this).transform.localPosition = Vector3.Lerp(((GrabbableObject)this).startFallingPosition, ((GrabbableObject)this).targetFloorPosition, grenadeFallCurve.Evaluate(((GrabbableObject)this).fallTime));
if (magnitude > 5f)
{
((Component)this).transform.localPosition = Vector3.Lerp(new Vector3(((Component)this).transform.localPosition.x, ((GrabbableObject)this).startFallingPosition.y, ((Component)this).transform.localPosition.z), new Vector3(((Component)this).transform.localPosition.x, ((GrabbableObject)this).targetFloorPosition.y, ((Component)this).transform.localPosition.z), grenadeVerticalFallCurveNoBounce.Evaluate(((GrabbableObject)this).fallTime));
}
else
{
((Component)this).transform.localPosition = Vector3.Lerp(new Vector3(((Component)this).transform.localPosition.x, ((GrabbableObject)this).startFallingPosition.y, ((Component)this).transform.localPosition.z), new Vector3(((Component)this).transform.localPosition.x, ((GrabbableObject)this).targetFloorPosition.y, ((Component)this).transform.localPosition.z), grenadeVerticalFallCurve.Evaluate(((GrabbableObject)this).fallTime));
}
((GrabbableObject)this).fallTime = ((GrabbableObject)this).fallTime + Mathf.Abs(Time.deltaTime * 12f / magnitude);
}
public override void OnHitGround()
{
((GrabbableObject)this).OnHitGround();
Plugin.logger.LogDebug((object)"OnHitGround");
RoundManager.PlayRandomClip(audioSource, coinDropSFXs.ToArray(), true, 1f, 0, 1000);
}
[ClientRpc]
public void SetScrapValueClientRpc(int setValueTo)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: 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_0071: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1957598905u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, setValueTo);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1957598905u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
Plugin.logger.LogDebug((object)"SetScrapValueClientRpc");
((GrabbableObject)this).SetScrapValue(setValueTo);
ejectingFromWashingMachine = true;
}
}
}
protected override void __initializeVariables()
{
((PhysicsProp)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(1957598905u, new RpcReceiveHandler(__rpc_handler_1957598905), "SetScrapValueClientRpc");
((PhysicsProp)this).__initializeRpcs();
}
private static void __rpc_handler_1957598905(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int scrapValueClientRpc = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref scrapValueClientRpc);
target.__rpc_exec_stage = (__RpcExecStage)1;
((CoinBehavior)(object)target).SetScrapValueClientRpc(scrapValueClientRpc);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "CoinBehavior";
}
}
public static class Configs
{
public static string Blacklist => ((AssetBundleLoader<LethalWashingContentHandler.WashingMachineAssets>)(object)ContentHandler<LethalWashingContentHandler>.Instance.WashingMachine).GetConfig<string>("Washing Machine | Blacklist").Value;
public static bool PreventDespawnOnTeamWipe => ((AssetBundleLoader<LethalWashingContentHandler.WashingMachineAssets>)(object)ContentHandler<LethalWashingContentHandler>.Instance.WashingMachine).GetConfig<bool>("Washing Machine | Prevent Despawn On Team Wipe").Value;
public static string TeamWipeBlacklist => ((AssetBundleLoader<LethalWashingContentHandler.WashingMachineAssets>)(object)ContentHandler<LethalWashingContentHandler>.Instance.WashingMachine).GetConfig<string>("Washing Machine | Team Wipe Blacklist").Value;
public static float WashTime => ((AssetBundleLoader<LethalWashingContentHandler.WashingMachineAssets>)(object)ContentHandler<LethalWashingContentHandler>.Instance.WashingMachine).GetConfig<float>("Washing Machine | Wash Time").Value;
public static bool UsableOnlyOnCompanyDay => ((AssetBundleLoader<LethalWashingContentHandler.WashingMachineAssets>)(object)ContentHandler<LethalWashingContentHandler>.Instance.WashingMachine).GetConfig<bool>("Washing Machine | Usable Only On Company Day").Value;
public static bool CombineCoinValues => ((AssetBundleLoader<LethalWashingContentHandler.WashingMachineAssets>)(object)ContentHandler<LethalWashingContentHandler>.Instance.WashingMachine).GetConfig<bool>("Washing Machine | Combine Coin Values").Value;
public static int CoinsToSpawn => ((AssetBundleLoader<LethalWashingContentHandler.WashingMachineAssets>)(object)ContentHandler<LethalWashingContentHandler>.Instance.WashingMachine).GetConfig<int>("Washing Machine | Coins To Spawn").Value;
public static float ThrowDistance => ((AssetBundleLoader<LethalWashingContentHandler.WashingMachineAssets>)(object)ContentHandler<LethalWashingContentHandler>.Instance.WashingMachine).GetConfig<float>("Coin | Throw Distance").Value;
}
public class LethalWashingContentHandler : ContentHandler<LethalWashingContentHandler>
{
public class WashingMachineAssets : AssetBundleLoader<WashingMachineAssets>
{
public WashingMachineAssets(DuskMod mod, string filePath)
: base(mod, filePath)
{
}
}
public WashingMachineAssets? WashingMachine;
public LethalWashingContentHandler(DuskMod mod)
: base(mod)
{
((ContentHandler)this).RegisterContent<WashingMachineAssets>("washingmachine", ref WashingMachine, true);
}
}
public static class LethalWashingKeys
{
public const string Namespace = "lethalwashing";
internal static NamespacedKey LastVersion = NamespacedKey.From("lethalwashing", "last_version");
public static readonly NamespacedKey<DawnUnlockableItemInfo> WashingMachine = NamespacedKey<DawnUnlockableItemInfo>.From("lethalwashing", "washing_machine");
public static readonly NamespacedKey<DawnItemInfo> Coin = NamespacedKey<DawnItemInfo>.From("lethalwashing", "coin");
}
[HarmonyPatch]
internal class Patches
{
private static string[] teamWipeBlacklist = Array.Empty<string>();
private static bool despawningProps = false;
[HarmonyPrefix]
[HarmonyPatch(typeof(NetworkObject), "Despawn")]
public static bool DespawnPrefix(NetworkObject __instance)
{
try
{
if (!despawningProps)
{
return true;
}
if (StartOfRound.Instance.firingPlayersCutsceneRunning)
{
return true;
}
GrabbableObject val = default(GrabbableObject);
if (!((Component)__instance).TryGetComponent<GrabbableObject>(ref val))
{
return true;
}
if (teamWipeBlacklist.Contains(((Object)val.itemProperties).name))
{
return true;
}
if (StartOfRound.Instance.isChallengeFile || (!val.isHeld && !val.isInShipRoom) || val.deactivated)
{
return true;
}
if (val.scrapValue > 0)
{
return true;
}
return false;
}
catch (Exception ex)
{
Plugin.logger.LogError((object)ex);
return true;
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(RoundManager), "DespawnPropsAtEndOfRound")]
public static void DespawnPropsAtEndOfRoundPrefix(RoundManager __instance)
{
try
{
despawningProps = Configs.PreventDespawnOnTeamWipe;
if (despawningProps)
{
teamWipeBlacklist = Configs.TeamWipeBlacklist.Replace(" ", "").Split(",");
}
}
catch (Exception ex)
{
Plugin.logger.LogError((object)ex);
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(RoundManager), "DespawnPropsAtEndOfRound")]
public static void DespawnPropsAtEndOfRoundPostfix(RoundManager __instance)
{
despawningProps = false;
}
}
[BepInPlugin("Snowlance.LethalWashing", "LethalWashing", "1.3.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("Snowlance.LethalWashing");
public static Plugin Instance { get; private set; }
public static ManualLogSource logger { get; private set; }
public static DuskMod Mod { get; private set; }
public static PlayerControllerB localPlayer => GameNetworkManager.Instance.localPlayerController;
public static bool IsServerOrHost => NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost;
public static PlayerControllerB PlayerFromId(ulong id)
{
return StartOfRound.Instance.allPlayerScripts[StartOfRound.Instance.ClientPlayerList[id]];
}
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
logger = ((BaseUnityPlugin)Instance).Logger;
harmony.PatchAll();
AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "lethalwashing_mainassets"));
Mod = DuskMod.RegisterMod((BaseUnityPlugin)(object)this, val);
Mod.RegisterContentHandlers();
InitializeNetworkBehaviours();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Snowlance.LethalWashing v1.3.1 has loaded!");
}
private static void InitializeNetworkBehaviours()
{
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);
}
}
}
logger.LogDebug((object)"Finished initializing network behaviours");
}
}
[HarmonyPatch]
public class TESTING : MonoBehaviour
{
[HarmonyPostfix]
[HarmonyPatch(typeof(HUDManager), "PingScan_performed")]
public static void PingScan_performedPostFix()
{
if (Utils.testing && Utils.isBeta)
{
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")]
public static void SubmitChat_performedPrefix(HUDManager __instance)
{
string text = __instance.chatTextField.text;
string[] array = text.Split(" ");
string text2 = array[0];
string text3 = text2;
if (text3 == "/lw_items")
{
{
foreach (DawnItemInfo value in ((Registry<DawnItemInfo>)(object)LethalContent.Items).Values)
{
Plugin.logger.LogInfo((object)((Object)value.Item).name);
}
return;
}
}
Utils.ChatCommand(array);
}
}
public static class Utils
{
public static bool isBeta;
public static bool _testing;
public static bool trailerMode;
public static bool DEBUG_disableSpawning;
public static bool DEBUG_disableTargetting;
public static bool DEBUG_disableHostTargetting;
public static bool DEBUG_disableMoving;
public static bool localPlayerFrozen;
public static bool testing => _testing && isBeta;
public static bool inTestRoom => (Object)(object)StartOfRound.Instance?.testRoom != (Object)null;
public static GameObject[] allAINodes => inTestRoom ? GameObject.FindGameObjectsWithTag("AINode") : insideAINodes.Concat(outsideAINodes).ToArray();
public static GameObject[] insideAINodes
{
get
{
if (RoundManager.Instance.insideAINodes != null && RoundManager.Instance.insideAINodes.Length != 0)
{
return RoundManager.Instance.insideAINodes;
}
return GameObject.FindGameObjectsWithTag("AINode");
}
}
public static GameObject[] outsideAINodes
{
get
{
if (RoundManager.Instance.outsideAINodes != null && RoundManager.Instance.outsideAINodes.Length != 0)
{
return RoundManager.Instance.outsideAINodes;
}
return GameObject.FindGameObjectsWithTag("OutsideAINode");
}
}
public static void ChatCommand(string[] args)
{
if (!isBeta)
{
return;
}
switch (args[0])
{
case "/spawning":
DEBUG_disableSpawning = !DEBUG_disableSpawning;
HUDManager.Instance.DisplayTip("Disable Spawning", DEBUG_disableSpawning.ToString(), false, false, "LC_Tip1");
break;
case "/hazards":
{
Dictionary<string, GameObject> allHazards = GetAllHazards();
{
foreach (KeyValuePair<string, GameObject> item in allHazards)
{
Plugin.logger.LogDebug((object)item);
}
break;
}
}
case "/testing":
_testing = !_testing;
HUDManager.Instance.DisplayTip("Testing", _testing.ToString(), false, false, "LC_Tip1");
break;
case "/surfaces":
{
FootstepSurface[] footstepSurfaces = StartOfRound.Instance.footstepSurfaces;
foreach (FootstepSurface val3 in footstepSurfaces)
{
Plugin.logger.LogDebug((object)val3.surfaceTag);
}
break;
}
case "/enemies":
{
foreach (SpawnableEnemyWithRarity enemy in GetEnemies())
{
Plugin.logger.LogDebug((object)((Object)enemy.enemyType).name);
}
break;
}
case "/refresh":
RoundManager.Instance.RefreshEnemiesList();
HoarderBugAI.RefreshGrabbableObjectsInMapList();
break;
case "/levels":
{
SelectableLevel[] levels = StartOfRound.Instance.levels;
foreach (SelectableLevel val2 in levels)
{
Plugin.logger.LogDebug((object)((Object)val2).name);
}
break;
}
case "/dungeon":
Plugin.logger.LogDebug((object)((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name);
break;
case "/dungeons":
{
IndoorMapType[] dungeonFlowTypes = RoundManager.Instance.dungeonFlowTypes;
foreach (IndoorMapType val in dungeonFlowTypes)
{
Plugin.logger.LogDebug((object)((Object)val.dungeonFlow).name);
}
break;
}
case "/time":
RoundManager.Instance.currentLevel.planetHasTime = !RoundManager.Instance.currentLevel.planetHasTime;
HUDManager.Instance.DisplayTip("planetHasTime", RoundManager.Instance.currentLevel.planetHasTime.ToString(), false, false, "LC_Tip1");
break;
case "/playerAnimations":
LogAnimatorParameters(Plugin.localPlayer.playerBodyAnimator);
break;
case "/quota":
TimeOfDay.Instance.daysUntilDeadline = int.Parse(args[1]);
break;
}
}
public static void LogAnimatorParameters(Animator animator)
{
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)animator == (Object)null))
{
Plugin.logger.LogDebug((object)("Animator on " + ((Object)((Component)animator).gameObject).name));
AnimatorControllerParameter[] parameters = animator.parameters;
foreach (AnimatorControllerParameter val in parameters)
{
Plugin.logger.LogDebug((object)("Name: " + val.name + " | " + $"Type: {val.type} | " + $"Hash: {val.nameHash}"));
}
}
}
public static void LogChat(string msg)
{
HUDManager.Instance.AddChatMessage(msg, "Server", -1, false);
}
public static Transform? GetClosestAINodeToPosition(Vector3 pos)
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
Transform result = null;
float num = float.PositiveInfinity;
GameObject[] array = allAINodes;
foreach (GameObject val in array)
{
if (!((Object)(object)val == (Object)null))
{
float num2 = Vector3.Distance(pos, val.transform.position);
if (!(num2 > num))
{
num = num2;
result = val.transform;
}
}
}
return result;
}
public static Vector3 GetBestThrowDirection(Vector3 origin, Vector3 forward, int rayCount, float maxDistance, LayerMask layerMask)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: 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_0089: 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_00a6: 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_007b: Unknown result type (might be due to invalid IL or missing references)
Vector3 result = forward;
float num = 0f;
RaycastHit val2 = default(RaycastHit);
for (int i = 0; i < rayCount; i++)
{
float num2 = (float)i * (360f / (float)rayCount);
Vector3 val = Quaternion.Euler(0f, num2, 0f) * ((Vector3)(ref forward)).normalized;
if (Physics.Raycast(origin + Vector3.up * 0.5f, val, ref val2, maxDistance, LayerMask.op_Implicit(layerMask)))
{
if (((RaycastHit)(ref val2)).distance > num)
{
result = val;
num = ((RaycastHit)(ref val2)).distance;
}
continue;
}
return val;
}
return result;
}
public static Vector3 GetSpeed()
{
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_0255: Unknown result type (might be due to invalid IL or missing references)
//IL_0260: Unknown result type (might be due to invalid IL or missing references)
//IL_0277: Unknown result type (might be due to invalid IL or missing references)
//IL_027c: Unknown result type (might be due to invalid IL or missing references)
//IL_0286: Unknown result type (might be due to invalid IL or missing references)
//IL_028b: Unknown result type (might be due to invalid IL or missing references)
//IL_0295: Unknown result type (might be due to invalid IL or missing references)
//IL_029a: Unknown result type (might be due to invalid IL or missing references)
//IL_029f: Unknown result type (might be due to invalid IL or missing references)
//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
//IL_03de: Unknown result type (might be due to invalid IL or missing references)
//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
//IL_040c: Unknown result type (might be due to invalid IL or missing references)
//IL_0411: Unknown result type (might be due to invalid IL or missing references)
//IL_0416: Unknown result type (might be due to invalid IL or missing references)
//IL_0417: Unknown result type (might be due to invalid IL or missing references)
//IL_041c: Unknown result type (might be due to invalid IL or missing references)
//IL_041e: Unknown result type (might be due to invalid IL or missing references)
//IL_0425: Unknown result type (might be due to invalid IL or missing references)
//IL_042a: Unknown result type (might be due to invalid IL or missing references)
//IL_042f: Unknown result type (might be due to invalid IL or missing references)
//IL_0431: Unknown result type (might be due to invalid IL or missing references)
//IL_0433: Unknown result type (might be due to invalid IL or missing references)
//IL_0437: Unknown result type (might be due to invalid IL or missing references)
//IL_036c: Unknown result type (might be due to invalid IL or missing references)
//IL_0377: Unknown result type (might be due to invalid IL or missing references)
//IL_038e: Unknown result type (might be due to invalid IL or missing references)
//IL_0393: Unknown result type (might be due to invalid IL or missing references)
//IL_039d: Unknown result type (might be due to invalid IL or missing references)
//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
//IL_032e: Unknown result type (might be due to invalid IL or missing references)
//IL_0345: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
float num = Plugin.localPlayer.movementSpeed / Plugin.localPlayer.carryWeight;
if (Plugin.localPlayer.sinkingValue > 0.73f)
{
num = 0f;
}
else
{
if (Plugin.localPlayer.isCrouching)
{
num /= 1.5f;
}
else if (Plugin.localPlayer.criticallyInjured && !Plugin.localPlayer.isCrouching)
{
num *= Plugin.localPlayer.limpMultiplier;
}
if (Plugin.localPlayer.isSpeedCheating)
{
num *= 15f;
}
if (Plugin.localPlayer.movementHinderedPrev > 0)
{
num /= 2f * Plugin.localPlayer.hinderedMultiplier;
}
if (Plugin.localPlayer.drunkness > 0f)
{
num *= StartOfRound.Instance.drunknessSpeedEffect.Evaluate(Plugin.localPlayer.drunkness) / 5f + 1f;
}
if (!Plugin.localPlayer.isCrouching && Plugin.localPlayer.crouchMeter > 1.2f)
{
num *= 0.5f;
}
if (!Plugin.localPlayer.isCrouching)
{
float num2 = Vector3.Dot(Plugin.localPlayer.playerGroundNormal, Plugin.localPlayer.walkForce);
if (num2 > 0.05f)
{
Plugin.localPlayer.slopeModifier = Mathf.MoveTowards(Plugin.localPlayer.slopeModifier, num2, (Plugin.localPlayer.slopeModifierSpeed + 0.45f) * Time.deltaTime);
}
else
{
Plugin.localPlayer.slopeModifier = Mathf.MoveTowards(Plugin.localPlayer.slopeModifier, num2, Plugin.localPlayer.slopeModifierSpeed / 2f * Time.deltaTime);
}
num = Mathf.Max(num * 0.8f, num + Plugin.localPlayer.slopeIntensity * Plugin.localPlayer.slopeModifier);
}
}
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(0f, 0f, 0f);
int num3 = Physics.OverlapSphereNonAlloc(((Component)Plugin.localPlayer).transform.position, 0.65f, Plugin.localPlayer.nearByPlayers, StartOfRound.Instance.playersMask);
for (int i = 0; i < num3; i++)
{
val += Vector3.Normalize((((Component)Plugin.localPlayer).transform.position - ((Component)Plugin.localPlayer.nearByPlayers[i]).transform.position) * 100f) * 1.2f;
}
int num4 = Physics.OverlapSphereNonAlloc(((Component)Plugin.localPlayer).transform.position, 1.25f, Plugin.localPlayer.nearByPlayers, 524288);
for (int j = 0; j < num4; j++)
{
EnemyAICollisionDetect component = ((Component)Plugin.localPlayer.nearByPlayers[j]).gameObject.GetComponent<EnemyAICollisionDetect>();
if ((Object)(object)component != (Object)null && (Object)(object)component.mainScript != (Object)null && !component.mainScript.isEnemyDead && Vector3.Distance(((Component)Plugin.localPlayer).transform.position, ((Component)Plugin.localPlayer.nearByPlayers[j]).transform.position) < component.mainScript.enemyType.pushPlayerDistance)
{
val += Vector3.Normalize((((Component)Plugin.localPlayer).transform.position - ((Component)Plugin.localPlayer.nearByPlayers[j]).transform.position) * 100f) * component.mainScript.enemyType.pushPlayerForce;
}
}
Vector3 val2 = Plugin.localPlayer.walkForce * num * Plugin.localPlayer.sprintMultiplier + new Vector3(0f, Plugin.localPlayer.fallValue, 0f) + val;
return val2 + Plugin.localPlayer.externalForces;
}
public static void FreezePlayer(PlayerControllerB player, bool value)
{
localPlayerFrozen = value;
player.disableInteract = value;
player.disableLookInput = value;
player.disableMoveInput = value;
}
public static void DespawnItemInSlotOnClient(int itemSlot)
{
((Behaviour)HUDManager.Instance.itemSlotIcons[itemSlot]).enabled = false;
Plugin.localPlayer.DestroyItemInSlotAndSync(itemSlot);
}
public static void MakePlayerInvisible(PlayerControllerB player, bool value)
{
GameObject gameObject = ((Component)((Component)player).gameObject.transform.Find("ScavengerModel")).gameObject;
if ((Object)(object)gameObject == (Object)null)
{
Plugin.logger.LogError((object)"ScavengerModel not found");
return;
}
((Component)gameObject.transform.Find("LOD1")).gameObject.SetActive(!value);
((Component)gameObject.transform.Find("LOD2")).gameObject.SetActive(!value);
((Component)gameObject.transform.Find("LOD3")).gameObject.SetActive(!value);
((Component)gameObject.transform.Find("metarig/spine/spine.001/spine.002/spine.003/LevelSticker")).gameObject.SetActive(!value);
((Component)gameObject.transform.Find("metarig/spine/spine.001/spine.002/spine.003/BetaBadge")).gameObject.SetActive(!value);
((Component)player.playerBadgeMesh).gameObject.SetActive(!value);
}
public static List<SpawnableEnemyWithRarity> GetEnemies()
{
List<SpawnableEnemyWithRarity> list = new List<SpawnableEnemyWithRarity>();
return (from x in GameObject.Find("Terminal").GetComponentInChildren<Terminal>().moonsCatalogueList.SelectMany((SelectableLevel x) => x.Enemies.Concat(x.DaytimeEnemies).Concat(x.OutsideEnemies))
where x != null && (Object)(object)x.enemyType != (Object)null && ((Object)x.enemyType).name != null
select x).GroupBy((SpawnableEnemyWithRarity x) => ((Object)x.enemyType).name, (string k, IEnumerable<SpawnableEnemyWithRarity> v) => v.First()).ToList();
}
public static EnemyVent GetClosestVentToPosition(Vector3 pos)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
float num = 2000f;
EnemyVent result = null;
EnemyVent[] allEnemyVents = RoundManager.Instance.allEnemyVents;
foreach (EnemyVent val in allEnemyVents)
{
float num2 = Vector3.Distance(pos, ((Component)val.floorNode).transform.position);
if (num2 < num)
{
num = num2;
result = val;
}
}
return result;
}
public static bool CalculatePath(Vector3 fromPos, Vector3 toPos)
{
//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_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//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_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Expected O, but got Unknown
//IL_003f: 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_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(fromPos, RoundManager.Instance.navHit, 1.75f, -1);
Vector3 navMeshPosition2 = RoundManager.Instance.GetNavMeshPosition(toPos, RoundManager.Instance.navHit, 1.75f, -1);
NavMeshPath val = new NavMeshPath();
return NavMesh.CalculatePath(navMeshPosition, navMeshPosition2, -1, val) && Vector3.Distance(val.corners[val.corners.Length - 1], RoundManager.Instance.GetNavMeshPosition(navMeshPosition2, RoundManager.Instance.navHit, 2.7f, -1)) <= 1.55f;
}
public static bool CalculatePath(Vector3 fromPos, Vector3 toPos, Vector3 mainEntranceInsidePosition, Vector3 mainEntranceOutsidePosition, bool isOutside)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: 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_0018: 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_001d: 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_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
if (!CalculatePath(fromPos, toPos))
{
Vector3 toPos2 = (isOutside ? mainEntranceOutsidePosition : mainEntranceInsidePosition);
Vector3 fromPos2 = (isOutside ? mainEntranceInsidePosition : mainEntranceOutsidePosition);
return CalculatePath(fromPos, toPos2) && CalculatePath(fromPos2, toPos);
}
return true;
}
public static T? GetClosestGameObjectOfType<T>(Vector3 position) where T : Component
{
//IL_0028: 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)
T[] array = Object.FindObjectsOfType<T>();
T result = default(T);
float num = float.PositiveInfinity;
T[] array2 = array;
foreach (T val in array2)
{
float num2 = Vector3.Distance(position, ((Component)val).transform.position);
if (num2 < num)
{
num = num2;
result = val;
}
}
return result;
}
public static void Shuffle<T>(this List<T> list)
{
int num = list.Count;
while (num > 1)
{
num--;
int index = Random.Range(0, num + 1);
T value = list[index];
list[index] = list[num];
list[num] = value;
}
}
public static T? GetClosestToPosition<T>(this IEnumerable<T> list, Vector3 position, Func<T, Vector3> positionSelector) where T : class
{
//IL_0032: 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)
T result = null;
float num = float.PositiveInfinity;
foreach (T item in list)
{
if (item != null)
{
float num2 = Vector3.Distance(position, positionSelector(item));
if (!(num2 >= num))
{
result = item;
num = num2;
}
}
}
return result;
}
public static T? GetFarthestFromPosition<T>(this IEnumerable<T> list, Vector3 position, Func<T, Vector3> positionSelector) where T : class
{
//IL_0032: 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)
T result = null;
float num = 0f;
foreach (T item in list)
{
if (item != null)
{
float num2 = Vector3.Distance(position, positionSelector(item));
if (!(num2 <= num))
{
result = item;
num = num2;
}
}
}
return result;
}
public static Dictionary<string, GameObject> GetAllHazards()
{
Dictionary<string, GameObject> dictionary = new Dictionary<string, GameObject>();
List<SpawnableMapObject> list = (from x in StartOfRound.Instance.levels.SelectMany((SelectableLevel level) => level.spawnableMapObjects)
group x by ((Object)x.prefabToSpawn).name into g
select g.First()).ToList();
foreach (SpawnableMapObject item in list)
{
dictionary.Add(((Object)item.prefabToSpawn).name, item.prefabToSpawn);
}
return dictionary;
}
public static GameObject? GetRandomNode(bool outside, GameObject[]? excludedNodes = null)
{
Plugin.logger.LogDebug((object)"Choosing random node...");
if (excludedNodes == null)
{
excludedNodes = Array.Empty<GameObject>();
}
GameObject[] first = (outside ? outsideAINodes : insideAINodes);
first = first.Except(excludedNodes).ToArray();
if (first.Length == 0)
{
return null;
}
int num = Random.Range(0, first.Length);
return first[num];
}
public static GameObject? GetRandomNode(GameObject[]? excludedNodes = null)
{
Plugin.logger.LogDebug((object)"Choosing random node...");
if (excludedNodes == null)
{
excludedNodes = Array.Empty<GameObject>();
}
GameObject[] array = allAINodes.Except(excludedNodes).ToArray();
if (array.Length == 0)
{
return null;
}
int num = Random.Range(0, array.Length);
return array[num];
}
public static Vector3 GetRandomNavMeshPositionInAnnulus(Vector3 center, float minRadius, float maxRadius, int sampleCount = 10)
{
//IL_0001: 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_0025: 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_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0062: 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_00ae: 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_0084: 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)
float y = center.y;
if (minRadius >= maxRadius)
{
Plugin.logger.LogWarning((object)"minRadius should be less than maxRadius. Returning original position.");
return center;
}
NavMeshHit val2 = default(NavMeshHit);
for (int i = 0; i < sampleCount; i++)
{
Vector3 insideUnitSphere = Random.insideUnitSphere;
insideUnitSphere.y = 0f;
((Vector3)(ref insideUnitSphere)).Normalize();
float num = Random.Range(minRadius, maxRadius);
Vector3 val = center + insideUnitSphere * num;
val.y = y;
if (NavMesh.SamplePosition(val, ref val2, 2f, -1))
{
return ((NavMeshHit)(ref val2)).position;
}
}
Plugin.logger.LogWarning((object)"Unable to find valid NavMesh position in annulus. Returning original position.");
return center;
}
public static List<Vector3> GetEvenlySpacedNavMeshPositions(Vector3 center, int count, float minRadius, float maxRadius)
{
//IL_002f: 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_0086: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
List<Vector3> list = new List<Vector3>();
if (count <= 0 || minRadius > maxRadius)
{
Plugin.logger.LogWarning((object)"Invalid parameters for turret spawn positions.");
return list;
}
float y = center.y;
float num = 360f / (float)count;
Vector3 val = default(Vector3);
NavMeshHit val2 = default(NavMeshHit);
for (int i = 0; i < count; i++)
{
float num2 = (float)i * num;
float num3 = num2 * (MathF.PI / 180f);
float num4 = Random.Range(minRadius, maxRadius);
float num5 = Mathf.Cos(num3) * num4;
float num6 = Mathf.Sin(num3) * num4;
((Vector3)(ref val))..ctor(center.x + num5, y, center.z + num6);
if (NavMesh.SamplePosition(val, ref val2, 2f, -1))
{
list.Add(((NavMeshHit)(ref val2)).position);
}
else
{
Plugin.logger.LogWarning((object)$"Could not find valid NavMesh position for turret {i}. Skipping.");
}
}
return list;
}
public static PlayerControllerB[] GetNearbyPlayers(Vector3 position, float distance = 10f, List<PlayerControllerB>? ignoredPlayers = null)
{
//IL_0050: 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)
List<PlayerControllerB> list = new List<PlayerControllerB>();
PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
foreach (PlayerControllerB val in allPlayerScripts)
{
if (!((Object)(object)val == (Object)null) && val.isPlayerControlled && (ignoredPlayers == null || !ignoredPlayers.Contains(val)) && !(Vector3.Distance(position, ((Component)val).transform.position) > distance))
{
list.Add(val);
}
}
return list.ToArray();
}
public static void RebuildRig(PlayerControllerB pcb)
{
if ((Object)(object)pcb != (Object)null && (Object)(object)pcb.playerBodyAnimator != (Object)null)
{
pcb.playerBodyAnimator.WriteDefaultValues();
RigBuilder component = ((Component)pcb.playerBodyAnimator).GetComponent<RigBuilder>();
if (component != null)
{
component.Build();
}
}
}
public static bool IsPlayerChild(PlayerControllerB player)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
return player.thisPlayerBody.localScale.y < 1f;
}
public static PlayerControllerB? GetFarthestPlayerFromPosition(Vector3 position, float minDistance = 0f)
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
float num = minDistance;
PlayerControllerB result = null;
PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
foreach (PlayerControllerB val in allPlayerScripts)
{
if (!((Object)(object)val == (Object)null) && val.isPlayerControlled)
{
float num2 = Vector3.Distance(position, ((Component)val).transform.position);
if (!(num2 < num))
{
num = num2;
result = val;
}
}
}
return result;
}
public static float CanPathToPoint(Vector3 startPos, Vector3 endPos)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//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_0019: Invalid comparison between Unknown and I4
//IL_0054: 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)
NavMeshPath val = new NavMeshPath();
if (!NavMesh.CalculatePath(startPos, endPos, -1, val) || (int)val.status > 0)
{
return -1f;
}
float num = 0f;
if (val.corners.Length > 1)
{
for (int i = 1; i < val.corners.Length; i++)
{
num += Vector3.Distance(val.corners[i - 1], val.corners[i]);
}
}
return num;
}
public static void PlaySoundAtPosition(Vector3 pos, AudioClip clip, float volume = 1f, bool randomizePitch = true, bool spatial3D = true, float min3DDistance = 1f, float max3DDistance = 10f)
{
//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_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
GameObject val = Object.Instantiate<GameObject>(new GameObject("TempSoundEffectObj"), pos, Quaternion.identity);
AudioSource val2 = val.AddComponent<AudioSource>();
OccludeAudio val3 = val.AddComponent<OccludeAudio>();
val3.lowPassOverride = 20000f;
val2.rolloffMode = (AudioRolloffMode)1;
if (randomizePitch)
{
val2.pitch = Random.Range(0.94f, 1.06f);
}
val2.clip = clip;
val2.volume = volume;
val2.spatialBlend = (spatial3D ? 1 : 0);
val2.minDistance = min3DDistance;
val2.maxDistance = max3DDistance;
val2.Play();
Object.Destroy((Object)(object)val, val2.clip.length);
}
public static void PlaySoundAtPosition(Vector3 pos, AudioClip[] clips, float volume = 1f, bool randomizePitch = true, bool spatial3D = true, float min3DDistance = 1f, float max3DDistance = 10f)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
int num = Random.Range(0, clips.Length);
PlaySoundAtPosition(pos, clips[num], volume, randomizePitch, spatial3D, min3DDistance, max3DDistance);
}
public static PlayerControllerB? GetRandomPlayer()
{
PlayerControllerB[] array = StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB x) => (Object)(object)x != (Object)null && x.isPlayerControlled).ToArray();
if (array.Length == 0)
{
return null;
}
int num = Random.Range(0, array.Length);
return array[num];
}
public static void MufflePlayer(PlayerControllerB player, bool muffle)
{
if ((Object)(object)player.currentVoiceChatAudioSource == (Object)null)
{
StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects();
}
if ((Object)(object)player.currentVoiceChatAudioSource != (Object)null)
{
OccludeAudio component = ((Component)player.currentVoiceChatAudioSource).GetComponent<OccludeAudio>();
((Component)player.currentVoiceChatAudioSource).GetComponent<AudioLowPassFilter>().lowpassResonanceQ = (muffle ? 5f : 1f);
component.overridingLowPass = muffle;
component.lowPassOverride = (muffle ? 500f : 20000f);
player.voiceMuffledByEnemy = muffle;
}
}
public static EntranceTeleport? GetClosestExitFromPosition(Vector3 position, bool checkForPath = false)
{
//IL_0087: 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_00ad: 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)
EntranceTeleport result = null;
float num = float.PositiveInfinity;
foreach (EntranceTeleport item in Object.FindObjectsOfType<EntranceTeleport>(false).ToList())
{
if ((Object)(object)item.exitPoint == (Object)null && !item.FindExitPoint())
{
Plugin.logger.LogError((object)("Couldnt find exit point for entrance with id of " + item.entranceId));
}
else if (!((Object)(object)item.exitPoint == (Object)null) && (!checkForPath || CalculatePath(position, item.exitPoint.position)))
{
float num2 = Vector3.Distance(item.exitPoint.position, position);
if (num2 < num)
{
num = num2;
result = item;
}
}
}
return result;
}
public static Vector3 GetFloorPosition(Vector3 position, float verticalOffset = 0f)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: 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_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(position, -Vector3.up, ref val, 80f, 268437761, (QueryTriggerInteraction)1))
{
return ((RaycastHit)(ref val)).point + Vector3.up * 0.04f + verticalOffset * Vector3.up;
}
return position;
}
public static GrabbableObject? SpawnItem(NamespacedKey<DawnItemInfo> key, Vector3 position, Quaternion rotation = default(Quaternion), Transform? parentTo = null, float fallTime = 0f)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
if (!Plugin.IsServerOrHost)
{
return null;
}
GameObject val = Object.Instantiate<GameObject>(((Registry<DawnItemInfo>)(object)LethalContent.Items)[key].Item.spawnPrefab, position, rotation, parentTo);
GrabbableObject component = val.GetComponent<GrabbableObject>();
component.fallTime = fallTime;
((NetworkBehaviour)component).NetworkObject.Spawn(false);
return component;
}
public static Vector3 GetRandomPositionInRadius(Vector3 center, float radius)
{
//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_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: 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_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
Vector2 val = Random.insideUnitCircle * radius;
return center + new Vector3(val.x, 0f, val.y);
}
public static Vector3 GetRandomPositionInRadius(Vector3 center, float radius, float y)
{
//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_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: 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_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
Vector2 val = Random.insideUnitCircle * radius;
return new Vector3(center.x + val.x, y, center.z + val.y);
}
public static Vector3 GetRandomPositionOnRadius(Vector3 center, float radius)
{
//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_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_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: 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_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
Vector2 insideUnitCircle = Random.insideUnitCircle;
Vector2 normalized = ((Vector2)(ref insideUnitCircle)).normalized;
return center + new Vector3(normalized.x, 0f, normalized.y) * radius;
}
public static T GetRandom<T>(this IEnumerable<T> source, Random random)
{
if (source == null)
{
throw new ArgumentNullException("source");
}
if (random == null)
{
throw new ArgumentNullException("random");
}
T result = default(T);
int num = 0;
foreach (T item in source)
{
num++;
if (random.Next(num) == 0)
{
result = item;
}
}
if (num == 0)
{
throw new InvalidOperationException("Sequence contains no elements.");
}
return result;
}
public static T GetRandom<T>(this IEnumerable<T> source)
{
if (source == null)
{
throw new ArgumentNullException("source");
}
T result = default(T);
int num = 0;
foreach (T item in source)
{
num++;
if (Random.Range(0, num) == 0)
{
result = item;
}
}
if (num == 0)
{
throw new InvalidOperationException("Sequence contains no elements.");
}
return result;
}
}
[HarmonyPatch]
public class UtilsPatches
{
[HarmonyPrefix]
[HarmonyPatch(typeof(RoundManager), "SpawnInsideEnemiesFromVentsIfReady")]
public static bool SpawnInsideEnemiesFromVentsIfReadyPrefix()
{
if (Utils.isBeta && Utils.DEBUG_disableSpawning)
{
return false;
}
return true;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(RoundManager), "SpawnDaytimeEnemiesOutside")]
public static bool SpawnDaytimeEnemiesOutsidePrefix()
{
if (Utils.isBeta && Utils.DEBUG_disableSpawning)
{
return false;
}
return true;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(RoundManager), "SpawnEnemiesOutside")]
public static bool SpawnEnemiesOutsidePrefix()
{
if (Utils.isBeta && Utils.DEBUG_disableSpawning)
{
return false;
}
return true;
}
}
public class WashingMachine : NetworkBehaviour
{
[CompilerGenerated]
private sealed class <SpawnCoinsCoroutine>d__35 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public List<int> coinValues;
public WashingMachine <>4__this;
private List<int>.Enumerator <>s__1;
private int <coinValue>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SpawnCoinsCoroutine>d__35(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
int num = <>1__state;
if (num == -3 || num == 2)
{
try
{
}
finally
{
<>m__Finally1();
}
}
<>s__1 = default(List<int>.Enumerator);
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Expected O, but got Unknown
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Expected O, but got Unknown
try
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>4__this.animator.SetBool("hatchOpen", true);
<>2__current = (object)new WaitForSeconds(1.5f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>s__1 = coinValues.GetEnumerator();
<>1__state = -3;
break;
case 2:
<>1__state = -3;
break;
}
while (<>s__1.MoveNext())
{
<coinValue>5__2 = <>s__1.Current;
if (<coinValue>5__2 <= 0)
{
continue;
}
<>4__this.SpawnCoin(<coinValue>5__2);
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 2;
return true;
}
<>m__Finally1();
<>s__1 = default(List<int>.Enumerator);
<>4__this.animator.SetBool("hatchOpen", false);
return false;
}
catch
{
//try-fault
((IDisposable)this).Dispose();
throw;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
private void <>m__Finally1()
{
<>1__state = -1;
((IDisposable)<>s__1).Dispose();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public Animator animator;
public Transform coinSpawn;
public Transform drumPosition;
public InteractTrigger drumTrigger;
public InteractTrigger doorTrigger;
public AudioSource audioSource;
public AudioClip dingSFX;
public AudioClip doorOpenSFX;
public AudioClip doorCloseSFX;
public Collider drumCollider;
public Collider doorCollider;
public PlaceableObjectsSurface placeableSurface;
public PlaceableShipObject placeableShipObject;
public List<GrabbableObject> itemsInDrum = new List<GrabbableObject>();
private float washTimer;
private bool readyForNextWash;
private bool doorOpen;
private bool closedUntilCompanyDay = true;
private string[] blacklist = Array.Empty<string>();
public static WashingMachine? Instance { get; private set; }
private bool localPlayerHoldingScrap => Plugin.localPlayer.isHoldingObject && (Object)(object)Plugin.localPlayer.currentlyHeldObjectServer != (Object)null && Plugin.localPlayer.currentlyHeldObjectServer.itemProperties.isScrap;
private bool washing => washTimer > 0f;
private bool usable => TimeOfDay.Instance.daysUntilDeadline <= 0 || !Configs.UsableOnlyOnCompanyDay;
public void Start()
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
Instance = this;
blacklist = Configs.Blacklist.Replace(" ", "").Split(",");
ManualLogSource logger = Plugin.logger;
Vector3 position = ((Component)this).transform.position;
logger.LogDebug((object)("Washing Machine spawned at " + ((object)(Vector3)(ref position)).ToString()));
}
public override void OnDestroy()
{
Instance = null;
}
public void Update()
{
if (washTimer > 0f)
{
washTimer -= Time.deltaTime;
if (washTimer <= 0f)
{
FinishWashScrap();
}
}
doorCollider.enabled = !washing && doorOpen && itemsInDrum.Count > 0 && readyForNextWash && usable && (Object)(object)Plugin.localPlayer.currentlyHeldObjectServer == (Object)null;
drumCollider.enabled = !washing && readyForNextWash && (Object)(object)Plugin.localPlayer.currentlyHeldObjectServer != (Object)null;
drumTrigger.interactable = !washing && doorOpen && readyForNextWash && usable && localPlayerHoldingScrap && !blacklist.Contains(((Object)Plugin.localPlayer.currentlyHeldObjectServer.itemProperties).name);
foreach (GrabbableObject item in itemsInDrum.ToList())
{
if (item.isHeld || (Object)(object)item.playerHeldBy != (Object)null)
{
itemsInDrum.Remove(item);
}
}
if (!readyForNextWash && itemsInDrum.Count <= 0)
{
readyForNextWash = true;
}
if (!usable)
{
if (itemsInDrum.Count <= 0 && doorOpen)
{
OpenDoor(open: false);
closedUntilCompanyDay = true;
}
drumTrigger.disabledHoverTip = "No washing until company day";
}
if (usable && closedUntilCompanyDay)
{
closedUntilCompanyDay = false;
OpenDoor(open: true);
}
if (!washing)
{
if (!((Object)(object)Plugin.localPlayer.currentlyHeldObjectServer != (Object)null))
{
return;
}
if (localPlayerHoldingScrap)
{
if (blacklist.Contains(((Object)Plugin.localPlayer.currentlyHeldObjectServer.itemProperties).name))
{
drumTrigger.disabledHoverTip = "Blacklisted";
}
else
{
drumTrigger.hoverTip = "Add scrap [E]";
}
}
else
{
drumTrigger.disabledHoverTip = "Requires scrap";
}
}
else
{
drumTrigger.disabledHoverTip = "Washing scrap - " + (int)washTimer;
}
}
public void OpenDoor(bool open)
{
animator.SetBool("doorOpen", open);
doorOpen = open;
}
public void FinishWashScrap()
{
if (itemsInDrum.Count == 0)
{
return;
}
OpenDoor(open: true);
List<int> list = new List<int>();
foreach (GrabbableObject item in itemsInDrum)
{
if (item.scrapValue > 0)
{
list.Add(item.scrapValue);
item.SetScrapValue(0);
}
ScanNodeProperties componentInChildren = ((Component)item).gameObject.GetComponentInChildren<ScanNodeProperties>();
if ((Object)(object)componentInChildren != (Object)null)
{
componentInChildren.subText = "";
}
else
{
Plugin.logger.LogWarning((object)("Cant find scannode for " + ((Object)item.itemProperties).name));
}
item.grabbable = true;
}
if (list.Count == 0)
{
Plugin.logger.LogDebug((object)"No scrap values");
}
else
{
SpawnCoins(list);
}
}
private void SpawnCoins(List<int> values)
{
if (Configs.CombineCoinValues && Configs.CoinsToSpawn > 0)
{
int num = values.Sum();
if (num > 0)
{
values.Clear();
int num2 = num / Configs.CoinsToSpawn;
int num3 = num % Configs.CoinsToSpawn;
for (int i = 0; i < Configs.CoinsToSpawn; i++)
{
values.Add(num2 + ((i < num3) ? 1 : 0));
}
}
}
Plugin.logger.LogDebug((object)$"Spawning {values.Count} coins");
((MonoBehaviour)this).StartCoroutine(SpawnCoinsCoroutine(values));
}
[IteratorStateMachine(typeof(<SpawnCoinsCoroutine>d__35))]
private IEnumerator SpawnCoinsCoroutine(List<int> coinValues)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SpawnCoinsCoroutine>d__35(0)
{
<>4__this = this,
coinValues = coinValues
};
}
public void SpawnCoin(int value)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
if (((NetworkBehaviour)this).IsServer)
{
CoinBehavior componentInChildren = ((Component)Utils.SpawnItem(LethalWashingKeys.Coin, ((Component)coinSpawn).transform.position, ((Component)coinSpawn).transform.rotation)).GetComponentInChildren<CoinBehavior>();
componentInChildren.SetScrapValueClientRpc(value);
}
}
public void StartWash()
{
WashScrapServerRpc();
}
public void AddScrapToWasher()
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
GrabbableObject currentlyHeldObjectServer = Plugin.localPlayer.currentlyHeldObjectServer;
if (localPlayerHoldingScrap && !Plugin.localPlayer.isGrabbingObjectAnimation)
{
Plugin.localPlayer.DiscardHeldObject(true, ((NetworkBehaviour)this).NetworkObject, ((Component)((NetworkBehaviour)this).NetworkObject).transform.InverseTransformPoint(drumPosition.position), false);
AddItemToDrumServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)currentlyHeldObjectServer).NetworkObject));
}
}
public void PlayDoorSFX()
{
if (usable)
{
if (washing)
{
audioSource.PlayOneShot(doorCloseSFX);
audioSource.Play();
readyForNextWash = false;
}
else
{
audioSource.Stop();
audioSource.PlayOneShot(dingSFX);
audioSource.PlayOneShot(doorOpenSFX);
}
}
}
[ServerRpc(RequireOwnership = false)]
public void AddItemToDrumServerRpc(NetworkObjectReference netRef)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: 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_007d: 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_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: 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(870401845u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 870401845u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
if (((NetworkBehaviour)this).IsServer)
{
AddItemToDrumClientRpc(netRef);
}
}
}
[ClientRpc]
public void AddItemToDrumClientRpc(NetworkObjectReference netRef)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: 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_007d: 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_0097: 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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4118516000u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4118516000u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
NetworkObject val3 = default(NetworkObject);
GrabbableObject item = default(GrabbableObject);
if (((NetworkObjectReference)(ref netRef)).TryGet(ref val3, (NetworkManager)null) && ((Component)val3).TryGetComponent<GrabbableObject>(ref item))
{
itemsInDrum.Add(item);
}
}
}
[ServerRpc(RequireOwnership = false)]
public void WashScrapServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_007c: 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)
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(2818544261u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2818544261u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
if (((NetworkBehaviour)this).IsServer)
{
WashScrapClientRpc();
}
}
}
[ClientRpc]
public void WashScrapClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_007c: 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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(273201484u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 273201484u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
base.__rpc_exec_stage = (__RpcExecStage)0;
foreach (GrabbableObject item in itemsInDrum)
{
item.grabbable = false;
}
OpenDoor(open: false);
washTimer = Configs.WashTime;
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(870401845u, new RpcReceiveHandler(__rpc_handler_870401845), "AddItemToDrumServerRpc");
((NetworkBehaviour)this).__registerRpc(4118516000u, new RpcReceiveHandler(__rpc_handler_4118516000), "AddItemToDrumClientRpc");
((NetworkBehaviour)this).__registerRpc(2818544261u, new RpcReceiveHandler(__rpc_handler_2818544261), "WashScrapServerRpc");
((NetworkBehaviour)this).__registerRpc(273201484u, new RpcReceiveHandler(__rpc_handler_273201484), "WashScrapClientRpc");
((NetworkBehaviour)this).__initializeRpcs();
}
private static void __rpc_handler_870401845(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: 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_0044: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
NetworkObjectReference netRef = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
target.__rpc_exec_stage = (__RpcExecStage)1;
((WashingMachine)(object)target).AddItemToDrumServerRpc(netRef);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_4118516000(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: 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_0044: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
NetworkObjectReference netRef = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
target.__rpc_exec_stage = (__RpcExecStage)1;
((WashingMachine)(object)target).AddItemToDrumClientRpc(netRef);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2818544261(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((WashingMachine)(object)target).WashScrapServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_273201484(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((WashingMachine)(object)target).WashScrapClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "WashingMachine";
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "Snowlance.LethalWashing";
public const string PLUGIN_NAME = "LethalWashing";
public const string PLUGIN_VERSION = "1.3.1";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace __GEN
{
internal class NetworkVariableSerializationHelper
{
[RuntimeInitializeOnLoadMethod]
internal static void InitializeSerialization()
{
}
}
}
namespace Snowlance.LethalWashing.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}