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.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Extras;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Snowlance.LethalWashing.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
[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.2.4.0")]
[assembly: AssemblyInformationalVersion("1.2.4+59004499a7c78cef31288cd06a501cb645a18c8b")]
[assembly: AssemblyProduct("LethalWashing")]
[assembly: AssemblyTitle("Snowlance.LethalWashing")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.4.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
{
private static ManualLogSource logger = Plugin.LoggerInstance;
public AnimationCurve grenadeFallCurve = null;
public AnimationCurve grenadeVerticalFallCurve = null;
public AnimationCurve grenadeVerticalFallCurveNoBounce = null;
public AudioSource CoinAudio = null;
public List<AudioClip> CoinDropSFXs = new List<AudioClip>();
private Ray grenadeThrowRay;
private RaycastHit grenadeHit;
private int stunGrenadeMask = 268437761;
public override void Start()
{
((GrabbableObject)this).Start();
if (!((Object)(object)WashingMachine.Instance == (Object)null))
{
EjectFromWashingMachine(WashingMachine.Instance.CoinSpawn);
}
}
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), true);
}
public void EjectFromWashingMachine(Transform ejectFrom)
{
//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_0030: 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_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_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_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_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
Vector3 val = ejectFrom.position;
Plugin.logIfDebug("ejectFrom.position: " + ((object)(Vector3)(ref val)).ToString());
val = ((Component)ejectFrom).transform.position;
Plugin.logIfDebug("ejectFrom.transform.position: " + ((object)(Vector3)(ref val)).ToString());
val = ((Component)this).transform.position;
Plugin.logIfDebug("transform.position" + ((object)(Vector3)(ref val)).ToString());
((GrabbableObject)this).startFallingPosition = ((Component)this).transform.position;
val = ((GrabbableObject)this).startFallingPosition;
Plugin.logIfDebug("Start: " + ((object)(Vector3)(ref val)).ToString());
((GrabbableObject)this).targetFloorPosition = GetGrenadeThrowDestination(ejectFrom, Plugin.configEjectDistance.Value);
val = ((GrabbableObject)this).targetFloorPosition;
Plugin.logIfDebug("End: " + ((object)(Vector3)(ref val)).ToString());
((GrabbableObject)this).hasHitGround = false;
((GrabbableObject)this).fallTime = 0f;
}
public Vector3 GetGrenadeThrowDestination(Transform ejectPoint, float _throwDistance = 10f)
{
//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_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: 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_0057: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: 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_00dc: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: 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, stunGrenadeMask, (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, stunGrenadeMask, (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_0007: 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_0033: 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_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: 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_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
//IL_021a: Unknown result type (might be due to invalid IL or missing references)
//IL_0225: Unknown result type (might be due to invalid IL or missing references)
//IL_0240: Unknown result type (might be due to invalid IL or missing references)
//IL_024a: 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_0161: Unknown result type (might be due to invalid IL or missing references)
//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_0191: 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_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: 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)
Plugin.logIfDebug($"cFallWithCurve called. Start Position: {((GrabbableObject)this).startFallingPosition}, Target Position: {((GrabbableObject)this).targetFloorPosition}, Initial cfallTime: {((GrabbableObject)this).fallTime}");
Vector3 val = ((GrabbableObject)this).startFallingPosition - ((GrabbableObject)this).targetFloorPosition;
float magnitude = ((Vector3)(ref val)).magnitude;
Plugin.logIfDebug($"Calculated magnitude: {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);
Quaternion rotation = ((Component)this).transform.rotation;
Plugin.logIfDebug($"Updated rotation to: {((Quaternion)(ref rotation)).eulerAngles}");
((Component)this).transform.localPosition = Vector3.Lerp(((GrabbableObject)this).startFallingPosition, ((GrabbableObject)this).targetFloorPosition, grenadeFallCurve.Evaluate(((GrabbableObject)this).fallTime));
Plugin.logIfDebug($"Updated primary fall position to: {((Component)this).transform.localPosition}");
if (magnitude > 5f)
{
Plugin.logIfDebug("Magnitude > 5, using grenadeVerticalFallCurveNoBounce.");
((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
{
Plugin.logIfDebug("Magnitude <= 5, using grenadeVerticalFallCurve.");
((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));
}
Plugin.logIfDebug($"Updated local position after vertical fall: {((Component)this).transform.localPosition}");
((GrabbableObject)this).fallTime = ((GrabbableObject)this).fallTime + Mathf.Abs(Time.deltaTime * 12f / magnitude);
Plugin.logIfDebug($"Updated cfallTime to: {((GrabbableObject)this).fallTime}");
}
public override void OnHitGround()
{
((GrabbableObject)this).OnHitGround();
Plugin.logIfDebug("Hit ground");
RoundManager.PlayRandomClip(CoinAudio, CoinDropSFXs.ToArray(), true, 1f, 0, 1000);
}
protected override void __initializeVariables()
{
((PhysicsProp)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
((PhysicsProp)this).__initializeRpcs();
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "CoinBehavior";
}
}
[HarmonyPatch]
internal class Patches
{
private static ManualLogSource logger = Plugin.LoggerInstance;
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 (StartOfRound.Instance.isChallengeFile || (!val.isHeld && !val.isInShipRoom) || val.deactivated)
{
return true;
}
if (val.scrapValue > 0)
{
return true;
}
return false;
}
catch (Exception ex)
{
logger.LogError((object)ex);
return true;
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(RoundManager), "DespawnPropsAtEndOfRound")]
public static void DespawnPropsAtEndOfRoundPrefix(RoundManager __instance)
{
try
{
if (Plugin.IsServerOrHost)
{
despawningProps = true;
}
}
catch (Exception ex)
{
logger.LogError((object)ex);
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(RoundManager), "DespawnPropsAtEndOfRound")]
public static void DespawnPropsAtEndOfRoundPostfix(RoundManager __instance)
{
try
{
if (Plugin.IsServerOrHost)
{
despawningProps = false;
if (!((Object)(object)WashingMachine.Instance == (Object)null))
{
((NetworkBehaviour)WashingMachine.Instance).NetworkObject.Despawn(true);
}
}
}
catch (Exception ex)
{
logger.LogError((object)ex);
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(RoundManager), "LoadNewLevelWait")]
public static void LoadNewLevelWaitPrefix(RoundManager __instance)
{
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
try
{
if (!Plugin.IsServerOrHost)
{
return;
}
string name = ((Object)__instance.currentLevel).name;
string text = name;
if (!(text == "CompanyBuildingLevel"))
{
if (text == "GaletryLevel")
{
Object.Instantiate<GameObject>(Plugin.PluginInstance.WashingMachineRef.spawnableMapObject.prefabToSpawn, WashingMachine.worldPositionGaletry, WashingMachine.worldRotationGaletry).GetComponent<NetworkObject>().Spawn(true);
}
}
else
{
Object.Instantiate<GameObject>(Plugin.PluginInstance.WashingMachineRef.spawnableMapObject.prefabToSpawn, WashingMachine.worldPosition, WashingMachine.worldRotation).GetComponent<NetworkObject>().Spawn(true);
}
}
catch (Exception ex)
{
logger.LogError((object)ex);
}
}
}
[BepInPlugin("Snowlance.LethalWashing", "LethalWashing", "1.2.4")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
public static Plugin PluginInstance;
public static ManualLogSource LoggerInstance;
private readonly Harmony harmony = new Harmony("Snowlance.LethalWashing");
public SpawnableMapObjectDef WashingMachineRef = null;
public static AssetBundle ModAssets;
public GameObject CoinPrefab;
public static ConfigEntry<float> configWashTime;
public static ConfigEntry<int> configMaxItemsInMachine;
public static ConfigEntry<bool> configEnableDebugging;
public static ConfigEntry<float> configEjectDistance;
public static ConfigEntry<Vector3> configWorldPosition;
public static ConfigEntry<Quaternion> configWorldRotation;
public static ConfigEntry<Vector3> configGaletryWorldPosition;
public static ConfigEntry<Quaternion> configGaletryWorldRotation;
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()
{
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: 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_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)PluginInstance == (Object)null)
{
PluginInstance = this;
}
LoggerInstance = ((BaseUnityPlugin)PluginInstance).Logger;
harmony.PatchAll();
InitializeNetworkBehaviours();
configWashTime = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Wash Time", 10f, "Time it takes for the washing machine to finish washing scrap");
configMaxItemsInMachine = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Max items in machine", 5, "How many items can fit in the machine at a time");
configEnableDebugging = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable Debugging", false, "Shows debugging logs in the console");
configEjectDistance = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Eject Distance", 5f, "How far the coins should eject from the washing machine");
configWorldPosition = ((BaseUnityPlugin)this).Config.Bind<Vector3>("General", "World Position", new Vector3(-27.6681f, -2.5747f, -24.764f), "The world spawn position of the washing machine at the company. By default it spawns next to the sell counter");
configWorldRotation = ((BaseUnityPlugin)this).Config.Bind<Quaternion>("General", "World Rotation", Quaternion.Euler(0f, 90f, 0f), "The world spawn rotation of the washing machine at the company");
configGaletryWorldPosition = ((BaseUnityPlugin)this).Config.Bind<Vector3>("General", "Galetry World Position", new Vector3(-65.2742f, 1.1536f, 20.3886f), "The world spawn position of the washing machine at Galetry. By default it spawns next to the sell counter");
configGaletryWorldRotation = ((BaseUnityPlugin)this).Config.Bind<Quaternion>("General", "Galetry World Rotation", Quaternion.Euler(0f, 180f, 0f), "The world spawn rotation of the washing machine at Galetry");
WashingMachine.worldPosition = configWorldPosition.Value;
WashingMachine.worldRotation = configWorldRotation.Value;
WashingMachine.worldPositionGaletry = configGaletryWorldPosition.Value;
WashingMachine.worldRotationGaletry = configGaletryWorldRotation.Value;
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "washing_assets"));
if ((Object)(object)ModAssets == (Object)null)
{
((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load custom assets.");
return;
}
LoggerInstance.LogDebug((object)("Got AssetBundle at: " + Path.Combine(directoryName, "washing_assets")));
WashingMachineRef = ModAssets.LoadAsset<SpawnableMapObjectDef>("Assets/ModAssets/WashingMachine.asset");
if ((Object)(object)WashingMachineRef == (Object)null)
{
LoggerInstance.LogError((object)"Error: Couldnt get WashingMachine from assets");
return;
}
LoggerInstance.LogDebug((object)"Registering WashingMachine network prefab...");
NetworkPrefabs.RegisterNetworkPrefab(WashingMachineRef.spawnableMapObject.prefabToSpawn);
Utilities.FixMixerGroups(WashingMachineRef.spawnableMapObject.prefabToSpawn);
LoggerInstance.LogDebug((object)"Registering WashingMachine");
MapObjects.RegisterMapObject(WashingMachineRef, (LevelTypes)1, (string[])null, (Func<SelectableLevel, AnimationCurve>)null);
Item val = ModAssets.LoadAsset<Item>("Assets/ModAssets/CoinItem.asset");
if ((Object)(object)val == (Object)null)
{
LoggerInstance.LogError((object)"Error: Couldnt get CoinItem from assets");
return;
}
LoggerInstance.LogDebug((object)"Got Coin prefab");
CoinPrefab = val.spawnPrefab;
NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
Utilities.FixMixerGroups(val.spawnPrefab);
Items.RegisterScrap(val, (Dictionary<LevelTypes, int>)null, (Dictionary<string, int>)null);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Snowlance.LethalWashing v1.2.4 has loaded!");
}
public static void logIfDebug(string message)
{
if (configEnableDebugging.Value)
{
LoggerInstance.LogDebug((object)message);
}
}
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);
}
}
}
LoggerInstance.LogDebug((object)"Finished initializing network behaviours");
}
}
[HarmonyPatch]
public class TESTING : MonoBehaviour
{
private static ManualLogSource logger = Plugin.LoggerInstance;
[HarmonyPostfix]
[HarmonyPatch(typeof(HUDManager), "PingScan_performed")]
public static void PingScan_performedPostFix()
{
if (Utils.testing)
{
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")]
public static void SubmitChat_performedPrefix(HUDManager __instance)
{
//IL_0059: 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_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_007c: Unknown result type (might be due to invalid IL or missing references)
string text = __instance.chatTextField.text;
string[] array = text.Split(" ");
logger.LogDebug((object)text);
string text2 = array[0];
string text3 = text2;
if (text3 == "/spawn")
{
Object.Instantiate<GameObject>(Plugin.PluginInstance.WashingMachineRef.spawnableMapObject.prefabToSpawn, ((Component)Plugin.localPlayer).transform.position + ((Component)Plugin.localPlayer).transform.forward * 2f, Quaternion.identity).GetComponent<NetworkObject>().Spawn(true);
}
else
{
Utils.ChatCommand(array);
}
}
}
public static class Utils
{
private static ManualLogSource logger = Plugin.LoggerInstance;
public static bool testing = false;
public static bool spawningAllowed = true;
public static bool trailerMode = false;
public static bool inTestRoom => (Object)(object)StartOfRound.Instance?.testRoom != (Object)null;
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)
{
switch (args[0])
{
case "/spawning":
spawningAllowed = !spawningAllowed;
HUDManager.Instance.DisplayTip("Spawning Allowed", spawningAllowed.ToString(), false, false, "LC_Tip1");
break;
case "/hazards":
{
Dictionary<string, GameObject> allHazards = GetAllHazards();
{
foreach (KeyValuePair<string, GameObject> item in allHazards)
{
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)
{
logger.LogDebug((object)val3.surfaceTag);
}
break;
}
case "/enemies":
{
foreach (SpawnableEnemyWithRarity enemy in GetEnemies())
{
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)
{
logger.LogDebug((object)((Object)val2).name);
}
break;
}
case "/dungeon":
logger.LogDebug((object)((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name);
break;
case "/dungeons":
{
IndoorMapType[] dungeonFlowTypes = RoundManager.Instance.dungeonFlowTypes;
foreach (IndoorMapType val in dungeonFlowTypes)
{
logger.LogDebug((object)((Object)val.dungeonFlow).name);
}
break;
}
}
}
public static void LogChat(string msg)
{
HUDManager.Instance.AddChatMessage(msg, "Server", -1, false);
}
public static void RegisterItem(string itemPath, string levelRarities = "", string customLevelRarities = "", int minValue = 0, int maxValue = 0)
{
Item val = Plugin.ModAssets.LoadAsset<Item>(itemPath);
if ((Object)(object)val == (Object)null)
{
Plugin.LoggerInstance.LogError((object)("Error: Couldn't get prefab from " + itemPath));
return;
}
Plugin.LoggerInstance.LogDebug((object)("Got " + ((Object)val).name + " prefab"));
val.minValue = minValue;
val.maxValue = maxValue;
NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
Utilities.FixMixerGroups(val.spawnPrefab);
Items.RegisterScrap(val, GetLevelRarities(levelRarities), GetCustomLevelRarities(customLevelRarities));
}
public static void RegisterEnemy(string enemyPath, string tnPath, string tkPath, string levelRarities = "", string customLevelRarities = "")
{
EnemyType val = Plugin.ModAssets.LoadAsset<EnemyType>(enemyPath);
if ((Object)(object)val == (Object)null)
{
Plugin.LoggerInstance.LogError((object)("Error: Couldn't get prefab from " + enemyPath));
return;
}
Plugin.LoggerInstance.LogDebug((object)("Got " + ((Object)val).name + " prefab"));
TerminalNode val2 = Plugin.ModAssets.LoadAsset<TerminalNode>(tnPath);
TerminalKeyword val3 = Plugin.ModAssets.LoadAsset<TerminalKeyword>(tkPath);
NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
Enemies.RegisterEnemy(val, GetLevelRarities(levelRarities), GetCustomLevelRarities(customLevelRarities), val2, val3);
}
public static Dictionary<LevelTypes, int>? GetLevelRarities(string? levelsString)
{
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
try
{
Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>();
if (levelsString != null && levelsString != "")
{
string[] array = levelsString.Split(',');
string[] array2 = array;
foreach (string text in array2)
{
string[] array3 = text.Split(':');
if (array3.Length == 2)
{
string text2 = array3[0].Trim();
string text3 = array3[1].Trim();
if (Enum.TryParse<LevelTypes>(text2, out LevelTypes result) && int.TryParse(text3, out var result2))
{
dictionary.Add(result, result2);
}
else
{
Plugin.LoggerInstance.LogError((object)("Error: Invalid level rarity: " + text2 + ":" + text3));
}
}
}
}
return dictionary;
}
catch (Exception arg)
{
Plugin.LoggerInstance.LogError((object)$"Error: {arg}");
return null;
}
}
public static Dictionary<string, int>? GetCustomLevelRarities(string? levelsString)
{
try
{
Dictionary<string, int> dictionary = new Dictionary<string, int>();
if (levelsString != null)
{
string[] array = levelsString.Split(',');
string[] array2 = array;
foreach (string text in array2)
{
string[] array3 = text.Split(':');
if (array3.Length == 2)
{
string text2 = array3[0].Trim();
string text3 = array3[1].Trim();
if (int.TryParse(text3, out var result))
{
dictionary.Add(text2, result);
}
else
{
Plugin.LoggerInstance.LogError((object)("Error: Invalid level rarity: " + text2 + ":" + text3));
}
}
}
}
return dictionary;
}
catch (Exception arg)
{
Plugin.LoggerInstance.LogError((object)$"Error: {arg}");
return null;
}
}
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)
{
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.LoggerInstance.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);
}
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 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 GameObject? GetClosestGameObjectToPosition(this List<GameObject> list, Vector3 position)
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
GameObject result = null;
float num = float.PositiveInfinity;
foreach (GameObject item in list)
{
if (!((Object)(object)item == (Object)null))
{
float num2 = Vector3.Distance(position, item.transform.position);
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)
{
logger.LogDebug((object)"Choosing random node...");
GameObject[] array = (outside ? outsideAINodes : insideAINodes);
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)
{
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;
}
}
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)
{
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
{
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();
}
}
[HarmonyPatch]
public class UtilsPatches
{
private static ManualLogSource logger = Plugin.LoggerInstance;
[HarmonyPrefix]
[HarmonyPatch(typeof(RoundManager), "SpawnInsideEnemiesFromVentsIfReady")]
public static bool SpawnInsideEnemiesFromVentsIfReadyPrefix()
{
if (!Utils.spawningAllowed)
{
return false;
}
return true;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(RoundManager), "SpawnDaytimeEnemiesOutside")]
public static bool SpawnDaytimeEnemiesOutsidePrefix()
{
if (!Utils.spawningAllowed)
{
return false;
}
return true;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(RoundManager), "SpawnEnemiesOutside")]
public static bool SpawnEnemiesOutsidePrefix()
{
if (!Utils.spawningAllowed)
{
return false;
}
return true;
}
}
public class WashingMachine : NetworkBehaviour
{
[CompilerGenerated]
private sealed class <SpawnCoinsCoroutine>d__28 : 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__28(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_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Expected O, but got Unknown
try
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>4__this.DoAnimationClientRpc("hatchOpen", value: 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.DoAnimationClientRpc("hatchOpen", value: 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 static WashingMachine? Instance;
public GameObject CoinPrefab = null;
public Animator animator = null;
public Transform CoinSpawn = null;
public InteractTrigger trigger = null;
public AudioSource WashingMachineAudio = null;
public AudioClip DingSFX = null;
public AudioClip DoorOpenSFX = null;
public AudioClip DoorCloseSFX = null;
public Transform DrumPosition = null;
public Collider triggerCollider = null;
public InteractTrigger doorTrigger = null;
public Collider doorCollider = null;
public List<GrabbableObject> itemsInDrum = new List<GrabbableObject>();
private bool washing;
private float washTimer;
private bool readyForNextWash;
public static Vector3 worldPosition = new Vector3(-27.6681f, -2.5747f, -24.764f);
public static Quaternion worldRotation = Quaternion.Euler(0f, 90f, 0f);
public static Vector3 worldPositionGaletry = new Vector3(-65.2742f, 1.1536f, 20.3886f);
public static Quaternion worldRotationGaletry = Quaternion.Euler(0f, 180f, 0f);
private bool LocalPlayerHoldingScrap => (Object)(object)Plugin.localPlayer.currentlyHeldObjectServer != (Object)null && Plugin.localPlayer.currentlyHeldObjectServer.itemProperties.isScrap;
public override void OnNetworkSpawn()
{
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
((NetworkBehaviour)this).OnNetworkSpawn();
if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this)
{
if (Plugin.IsServerOrHost)
{
((NetworkBehaviour)Instance).NetworkObject.Despawn(true);
}
}
else
{
Instance = this;
ManualLogSource loggerInstance = Plugin.LoggerInstance;
Vector3 position = ((Component)this).transform.position;
loggerInstance.LogDebug((object)("Washing Machine spawned at " + ((object)(Vector3)(ref position)).ToString()));
}
}
public override void OnNetworkDespawn()
{
((NetworkBehaviour)this).OnNetworkDespawn();
if ((Object)(object)Instance == (Object)(object)this)
{
Instance = null;
}
}
public void Update()
{
if (washTimer > 0f)
{
washTimer -= Time.deltaTime;
if (washTimer <= 0f)
{
FinishWashScrap();
}
}
UpdateDrum();
doorCollider.enabled = !washing && itemsInDrum.Count > 0 && readyForNextWash;
if (!washing && itemsInDrum.Count >= 0)
{
if ((Object)(object)Plugin.localPlayer.currentlyHeldObjectServer != (Object)null)
{
if (LocalPlayerHoldingScrap)
{
if (itemsInDrum.Count >= Plugin.configMaxItemsInMachine.Value)
{
trigger.disabledHoverTip = "Washing machine is full";
triggerCollider.enabled = true;
trigger.interactable = false;
}
else
{
trigger.hoverTip = "Add Scrap [E]";
triggerCollider.enabled = true;
trigger.interactable = true;
}
}
else
{
triggerCollider.enabled = true;
trigger.interactable = false;
trigger.disabledHoverTip = "Requires scrap";
}
}
else
{
triggerCollider.enabled = false;
trigger.interactable = false;
}
}
else if (itemsInDrum.Count > 0 && washing)
{
doorCollider.enabled = false;
triggerCollider.enabled = true;
trigger.interactable = false;
trigger.disabledHoverTip = "Washing scrap - " + (int)washTimer;
}
}
public void UpdateDrum()
{
foreach (GrabbableObject item in itemsInDrum.ToList())
{
if (item.isHeld)
{
itemsInDrum.Remove(item);
}
}
}
public void FinishWashScrap()
{
if (itemsInDrum.Count == 0)
{
Plugin.LoggerInstance.LogError((object)"Items in washing machine is null!");
return;
}
washing = false;
animator.SetBool("doorOpen", 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.LoggerInstance.LogError((object)("Scan node is missing for item!: " + ((Object)((Component)item).gameObject).name));
}
item.grabbable = true;
}
if (Plugin.IsServerOrHost && list.Count != 0)
{
((MonoBehaviour)this).StartCoroutine(SpawnCoinsCoroutine(list));
}
}
[IteratorStateMachine(typeof(<SpawnCoinsCoroutine>d__28))]
private IEnumerator SpawnCoinsCoroutine(List<int> coinValues)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SpawnCoinsCoroutine>d__28(0)
{
<>4__this = this,
coinValues = coinValues
};
}
public void SpawnCoin(int value)
{
//IL_0012: 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_004e: Unknown result type (might be due to invalid IL or missing references)
CoinBehavior componentInChildren = Object.Instantiate<GameObject>(CoinPrefab, ((Component)CoinSpawn).transform.position, ((Component)CoinSpawn).transform.rotation).GetComponentInChildren<CoinBehavior>();
((GrabbableObject)componentInChildren).SetScrapValue(value);
((NetworkBehaviour)componentInChildren).NetworkObject.Spawn(false);
SpawnCoinFromHatchClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)componentInChildren).NetworkObject), value);
}
public void StartWash()
{
WashScrapServerRpc();
}
public void AddScrapToWasher()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
if (LocalPlayerHoldingScrap && !washing)
{
GrabbableObject currentlyHeldObjectServer = Plugin.localPlayer.currentlyHeldObjectServer;
Plugin.localPlayer.DiscardHeldObject(true, (NetworkObject)null, DrumPosition.position, true);
AddItemToDrumServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)currentlyHeldObjectServer).NetworkObject));
}
}
public void PlayDoorSFX()
{
if (washing)
{
WashingMachineAudio.PlayOneShot(DoorCloseSFX);
WashingMachineAudio.Play();
washTimer = Plugin.configWashTime.Value;
readyForNextWash = false;
}
else
{
WashingMachineAudio.Stop();
WashingMachineAudio.PlayOneShot(DingSFX);
WashingMachineAudio.PlayOneShot(DoorOpenSFX);
readyForNextWash = true;
}
}
[ServerRpc(RequireOwnership = false)]
public void RemoveItemFromDrumServerRpc(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_00f2: 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(753291338u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 753291338u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
if (Plugin.IsServerOrHost)
{
RemoveItemFromDrumClientRpc(netRef);
}
}
}
[ClientRpc]
public void RemoveItemFromDrumClientRpc(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(3925004389u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3925004389u, 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.Remove(item);
}
}
}
[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_00f2: 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 (Plugin.IsServerOrHost)
{
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);
}
}
}
[ClientRpc]
public void DoAnimationClientRpc(string animationName, bool value)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: 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_0088: 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_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: 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_00d5: 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(2276876021u, val, (RpcDelivery)0);
bool flag = animationName != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false);
}
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref value, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2276876021u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
animator.SetBool(animationName, value);
}
}
[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 (Plugin.IsServerOrHost)
{
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;
washing = true;
foreach (GrabbableObject item in itemsInDrum)
{
item.grabbable = false;
}
animator.SetBool("doorOpen", false);
}
[ClientRpc]
public void SpawnCoinFromHatchClientRpc(NetworkObjectReference netRef, int coinValue)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: 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_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: 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(1641096884u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
BytePacker.WriteValueBitPacked(val2, coinValue);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1641096884u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
base.__rpc_exec_stage = (__RpcExecStage)0;
NetworkObject val3 = default(NetworkObject);
if (((NetworkObjectReference)(ref netRef)).TryGet(ref val3, (NetworkManager)null))
{
CoinBehavior component = ((Component)val3).GetComponent<CoinBehavior>();
if ((Object)(object)component == (Object)null)
{
Plugin.LoggerInstance.LogError((object)"Coin in hatch is null!");
}
else
{
((GrabbableObject)component).SetScrapValue(coinValue);
}
}
}
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
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Expected O, but got Unknown
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Expected O, but got Unknown
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Expected O, but got Unknown
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(753291338u, new RpcReceiveHandler(__rpc_handler_753291338), "RemoveItemFromDrumServerRpc");
((NetworkBehaviour)this).__registerRpc(3925004389u, new RpcReceiveHandler(__rpc_handler_3925004389), "RemoveItemFromDrumClientRpc");
((NetworkBehaviour)this).__registerRpc(870401845u, new RpcReceiveHandler(__rpc_handler_870401845), "AddItemToDrumServerRpc");
((NetworkBehaviour)this).__registerRpc(4118516000u, new RpcReceiveHandler(__rpc_handler_4118516000), "AddItemToDrumClientRpc");
((NetworkBehaviour)this).__registerRpc(2276876021u, new RpcReceiveHandler(__rpc_handler_2276876021), "DoAnimationClientRpc");
((NetworkBehaviour)this).__registerRpc(2818544261u, new RpcReceiveHandler(__rpc_handler_2818544261), "WashScrapServerRpc");
((NetworkBehaviour)this).__registerRpc(273201484u, new RpcReceiveHandler(__rpc_handler_273201484), "WashScrapClientRpc");
((NetworkBehaviour)this).__registerRpc(1641096884u, new RpcReceiveHandler(__rpc_handler_1641096884), "SpawnCoinFromHatchClientRpc");
((NetworkBehaviour)this).__initializeRpcs();
}
private static void __rpc_handler_753291338(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).RemoveItemFromDrumServerRpc(netRef);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3925004389(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).RemoveItemFromDrumClientRpc(netRef);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
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_2276876021(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_0067: 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_009a: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string animationName = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false);
}
bool value = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref value, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)1;
((WashingMachine)(object)target).DoAnimationClientRpc(animationName, value);
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;
}
}
private static void __rpc_handler_1641096884(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_003e: 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_005c: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
NetworkObjectReference netRef = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
int coinValue = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref coinValue);
target.__rpc_exec_stage = (__RpcExecStage)1;
((WashingMachine)(object)target).SpawnCoinFromHatchClientRpc(netRef, coinValue);
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.2.4";
}
}
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
{
}
}