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 LethalLevelLoader;
using LethalLevelLoader.AssetBundles;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Rendering.HighDefinition;
using Welcome_To_Ooblterra.Enemies;
using Welcome_To_Ooblterra.Enemies.EnemyThings;
using Welcome_To_Ooblterra.Items;
using Welcome_To_Ooblterra.NetcodePatcher;
using Welcome_To_Ooblterra.Patches;
using Welcome_To_Ooblterra.Properties;
using Welcome_To_Ooblterra.RoomBehaviors;
using Welcome_To_Ooblterra.Things;
[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("")]
[assembly: AssemblyCompany("Welcome_To_Ooblterra")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("3.0.0.0")]
[assembly: AssemblyInformationalVersion("3.0.0+e1384e274236bd06f1a4a6538a6f01dc86a52cf6")]
[assembly: AssemblyProduct("Welcome_To_Ooblterra")]
[assembly: AssemblyTitle("Welcome_To_Ooblterra")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.0.0.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 Welcome_To_Ooblterra
{
internal class WTONetworkHandler : NetworkBehaviour
{
public static WTONetworkHandler Instance { get; private set; }
public static event Action<string> LevelEvent;
public override void OnNetworkSpawn()
{
WTONetworkHandler.LevelEvent = null;
if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
{
WTONetworkHandler instance = Instance;
if (instance != null)
{
((Component)instance).gameObject.GetComponent<NetworkObject>().Despawn(true);
}
}
Instance = this;
((NetworkBehaviour)this).OnNetworkSpawn();
}
[ClientRpc]
public void EventClientRpc(string eventName)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
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(1907558404u, val, (RpcDelivery)0);
bool flag = eventName != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(eventName, false);
}
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1907558404u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
WTONetworkHandler.LevelEvent?.Invoke(eventName);
}
}
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
((NetworkBehaviour)this).__registerRpc(1907558404u, new RpcReceiveHandler(__rpc_handler_1907558404), "EventClientRpc");
((NetworkBehaviour)this).__initializeRpcs();
}
private static void __rpc_handler_1907558404(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_0061: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string eventName = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref eventName, false);
}
target.__rpc_exec_stage = (__RpcExecStage)1;
((WTONetworkHandler)(object)target).EventClientRpc(eventName);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "WTONetworkHandler";
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "Welcome_To_Ooblterra";
public const string PLUGIN_NAME = "Welcome_To_Ooblterra";
public const string PLUGIN_VERSION = "3.0.0";
}
}
namespace Welcome_To_Ooblterra.Security
{
internal class SpikeTrap : NetworkBehaviour
{
[CompilerGenerated]
private sealed class <LowerSpikes>d__21 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public SpikeTrap <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LowerSpikes>d__21(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>4__this.TimeElapsed += Time.deltaTime;
Log.Debug($"Current Lerp Position: {<>4__this.TimeElapsed / 0.2f}");
<>4__this.SpikeMesh.transform.localPosition = Vector3.Lerp(<>4__this.SpikeRaisePos, <>4__this.SpikeFallPos, <>4__this.TimeElapsed / 0.2f);
if (<>4__this.TimeElapsed / 0.2f >= 1f)
{
<>4__this.AllowDamagePlayer = false;
Log.Info("Finished Lowering Spikes");
((MonoBehaviour)<>4__this).StopCoroutine(<>4__this.LowerSpikes());
<>4__this.SecondsSinceSpikesActivated = 0f;
((Renderer)<>4__this.SpikeMesh.GetComponent<MeshRenderer>()).enabled = false;
}
<>2__current = null;
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <RaiseSpikes>d__20 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public SpikeTrap <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <RaiseSpikes>d__20(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>4__this.TimeElapsed += Time.deltaTime;
<>4__this.SpikeMesh.transform.localPosition = Vector3.Lerp(<>4__this.SpikeFallPos, <>4__this.SpikeRaisePos, <>4__this.TimeElapsed / 0.2f);
if (<>4__this.TimeElapsed / 0.2f >= 1f)
{
<>4__this.AllowDamagePlayer = true;
Log.Info("Finished Raising Spikes");
((MonoBehaviour)<>4__this).StopCoroutine(<>4__this.RaiseSpikes());
}
<>2__current = null;
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public GameObject SpikeMesh;
public AudioClip SpikesExtend;
public AudioClip SpikesRetract;
public AudioClip SpikesDisable;
public AudioSource SpikeSoundPlayer;
public Transform RootRotation;
private bool SpikesEnabled = true;
private bool SpikesActivated;
private bool AllowDamagePlayer;
private float SecondsSinceSpikesActivated;
private float SecondsUntilCanDamagePlayer;
private int PlayerDamageAmount = 80;
private float TimeElapsed;
private const float MoveTime = 0.2f;
private readonly Vector3 SpikeRaisePos = new Vector3(0f, 1.163f, 0f);
private readonly Vector3 SpikeFallPos = new Vector3(0f, 0f, 0f);
private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(SpikeTrap), LogSourceType.Room);
public void OnTriggerEnter(Collider other)
{
if (SpikesEnabled && !SpikesActivated && ((Component)other).gameObject.CompareTag("Player"))
{
Log.Debug("Player entered spike trap, calling Raise RPC!");
RaiseSpikesServerRpc();
}
}
public void OnTriggerStay(Collider other)
{
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
if (AllowDamagePlayer && ((Component)other).gameObject.CompareTag("Player") && SecondsUntilCanDamagePlayer <= 0f)
{
PlayerDamageAmount = ((StartOfRound.Instance.connectedPlayersAmount <= 0) ? 80 : 100);
((Component)other).GetComponent<PlayerControllerB>().DamagePlayer(PlayerDamageAmount, true, true, (CauseOfDeath)6, 0, false, default(Vector3));
SecondsUntilCanDamagePlayer = 0.75f;
}
}
public void Update()
{
if (SecondsUntilCanDamagePlayer > 0f)
{
SecondsUntilCanDamagePlayer -= Time.deltaTime;
}
if (SecondsSinceSpikesActivated >= 3f)
{
if (SpikesActivated)
{
SpikeSoundPlayer.clip = SpikesRetract;
SpikeSoundPlayer.Play();
TimeElapsed = 0f;
}
SpikesActivated = false;
Log.Info("Lowering Spikes!");
((MonoBehaviour)this).StartCoroutine(LowerSpikes());
}
if (SpikesEnabled && SpikesActivated)
{
Log.Info("Raising Spikes!");
((MonoBehaviour)this).StartCoroutine(RaiseSpikes());
SecondsSinceSpikesActivated += Time.deltaTime;
}
}
[IteratorStateMachine(typeof(<RaiseSpikes>d__20))]
private IEnumerator RaiseSpikes()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <RaiseSpikes>d__20(0)
{
<>4__this = this
};
}
[IteratorStateMachine(typeof(<LowerSpikes>d__21))]
private IEnumerator LowerSpikes()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LowerSpikes>d__21(0)
{
<>4__this = this
};
}
public void RecieveToggleSpikes(bool enabled)
{
Log.Debug($"Called toggle spikes with state: {enabled}");
ToggleSpikesServerRpc(enabled);
ToggleSpikes(enabled);
}
[ServerRpc(RequireOwnership = false)]
public void ToggleSpikesServerRpc(bool enabled)
{
//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)
{
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1273677579u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref enabled, default(ForPrimitives));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1273677579u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
Log.Debug($"Toggling spikes to {enabled} serverRpc");
ToggleSpikesClientRpc(enabled);
}
}
}
[ClientRpc]
public void ToggleSpikesClientRpc(bool enabled)
{
//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(1768198554u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref enabled, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1768198554u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
Log.Debug($"Toggling spikes to {enabled} clientRpc");
if (SpikesEnabled != enabled)
{
ToggleSpikes(enabled);
}
}
}
private void ToggleSpikes(bool enabled)
{
if (!enabled)
{
SpikeSoundPlayer.clip = SpikesDisable;
SpikeSoundPlayer.Play();
}
SpikesEnabled = enabled;
Log.Debug($"SPIKES STATE: {SpikesEnabled}");
if (SpikesActivated)
{
SecondsSinceSpikesActivated = 5f;
}
}
[ServerRpc(RequireOwnership = false)]
public void RaiseSpikesServerRpc()
{
//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)
{
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2638217131u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2638217131u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
RaiseSpikesClientRpc();
}
}
}
[ClientRpc]
public void RaiseSpikesClientRpc()
{
//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)
{
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3449189664u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3449189664u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
TimeElapsed = 0f;
SpikeSoundPlayer.clip = SpikesExtend;
SpikeSoundPlayer.Play();
((Renderer)SpikeMesh.GetComponent<MeshRenderer>()).enabled = true;
SpikesActivated = true;
}
}
}
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(1273677579u, new RpcReceiveHandler(__rpc_handler_1273677579), "ToggleSpikesServerRpc");
((NetworkBehaviour)this).__registerRpc(1768198554u, new RpcReceiveHandler(__rpc_handler_1768198554), "ToggleSpikesClientRpc");
((NetworkBehaviour)this).__registerRpc(2638217131u, new RpcReceiveHandler(__rpc_handler_2638217131), "RaiseSpikesServerRpc");
((NetworkBehaviour)this).__registerRpc(3449189664u, new RpcReceiveHandler(__rpc_handler_3449189664), "RaiseSpikesClientRpc");
((NetworkBehaviour)this).__initializeRpcs();
}
private static void __rpc_handler_1273677579(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_005e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool enabled = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref enabled, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)1;
((SpikeTrap)(object)target).ToggleSpikesServerRpc(enabled);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1768198554(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_005e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool enabled = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref enabled, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)1;
((SpikeTrap)(object)target).ToggleSpikesClientRpc(enabled);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2638217131(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;
((SpikeTrap)(object)target).RaiseSpikesServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3449189664(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;
((SpikeTrap)(object)target).RaiseSpikesClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "SpikeTrap";
}
}
}
namespace Welcome_To_Ooblterra.RoomBehaviors
{
public class FrankensteinVisuals : MonoBehaviour
{
[CompilerGenerated]
private sealed class <VisualsHandler>d__13 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public FrankensteinVisuals <>4__this;
private ParticleSystem[] <>s__1;
private int <>s__2;
private ParticleSystem <LightningBolt>5__3;
private LightComponent[] <>s__4;
private int <>s__5;
private LightComponent <Light>5__6;
private ParticleSystem[] <>s__7;
private int <>s__8;
private ParticleSystem <LightningBolt>5__9;
private LightComponent[] <>s__10;
private int <>s__11;
private LightComponent <Light>5__12;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <VisualsHandler>d__13(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>s__1 = null;
<LightningBolt>5__3 = null;
<>s__4 = null;
<Light>5__6 = null;
<>s__7 = null;
<LightningBolt>5__9 = null;
<>s__10 = null;
<Light>5__12 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
if (!<>4__this.AnimStarted)
{
<>4__this.ReviveSoundPlayer.clip = <>4__this.ReviveSound;
<>4__this.ReviveSoundPlayer.Play();
<>4__this.CoilAnim.SetTrigger("HeatCoils");
<>s__1 = <>4__this.LightningParticles;
for (<>s__2 = 0; <>s__2 < <>s__1.Length; <>s__2++)
{
<LightningBolt>5__3 = <>s__1[<>s__2];
<LightningBolt>5__3.Play();
<LightningBolt>5__3 = null;
}
<>s__1 = null;
<>4__this.AnimStarted = true;
}
if (!<>4__this.AnimStopped)
{
<>s__4 = <>4__this.Lights;
for (<>s__5 = 0; <>s__5 < <>s__4.Length; <>s__5++)
{
<Light>5__6 = <>s__4[<>s__5];
<Light>5__6.SetLightBrightness((<>4__this.MyRandom.Next(0, 10) % 2 == 0) ? 200 : 0);
<Light>5__6 = null;
}
<>s__4 = null;
}
<>2__current = (object)new WaitForSeconds(3.4f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if (!<>4__this.AnimStopped)
{
<>s__7 = <>4__this.LightningParticles;
for (<>s__8 = 0; <>s__8 < <>s__7.Length; <>s__8++)
{
<LightningBolt>5__9 = <>s__7[<>s__8];
<LightningBolt>5__9.Stop();
<LightningBolt>5__9 = null;
}
<>s__7 = null;
<>s__10 = <>4__this.Lights;
for (<>s__11 = 0; <>s__11 < <>s__10.Length; <>s__11++)
{
<Light>5__12 = <>s__10[<>s__11];
<Light>5__12.SetLightBrightness(0);
<Light>5__12 = null;
}
<>s__10 = null;
<>4__this.AnimStopped = true;
}
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[InspectorName("SceneAnim")]
public AudioClip ReviveSound;
public AudioSource ReviveSoundPlayer;
public Animator CoilAnim;
public ParticleSystem[] LightningParticles;
public LightComponent[] Lights;
private bool ShouldAnimate;
private bool AnimStarted;
private bool AnimStopped;
private Random MyRandom;
private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(FrankensteinVisuals), LogSourceType.Room);
private void Start()
{
MyRandom = new Random(StartOfRound.Instance.randomMapSeed);
}
private void Update()
{
if (ShouldAnimate)
{
((MonoBehaviour)this).StartCoroutine(VisualsHandler());
}
}
public void StartVisuals()
{
Log.Debug("Visuals script starting coroutine ...");
ShouldAnimate = true;
}
[IteratorStateMachine(typeof(<VisualsHandler>d__13))]
private IEnumerator VisualsHandler()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <VisualsHandler>d__13(0)
{
<>4__this = this
};
}
}
}
namespace Welcome_To_Ooblterra.Properties
{
[HideInInspector]
public enum SuitStatus
{
Enable,
Purchase,
Disable,
SleepsSpecial
}
public enum PosterStatus
{
ReplaceVanilla,
AddAsDecor,
Disable
}
public enum FootstepEnum
{
Enable,
Quiet,
Disable
}
public enum TiedToLabEnum
{
WTOOnly,
AppendWTO,
UseMoonDefault
}
public enum LogType
{
Debug,
Info,
Warning,
Error
}
public enum LogSourceType
{
Generic,
Enemy,
Item,
Thing,
Room
}
public enum StartupType
{
Normal,
ContourMapRender
}
[BepInPlugin("SkullCrusher.WTO", "Welcome To Ooblterra", "2.0.0")]
public class WTOBase : BaseUnityPlugin
{
public class WTOLogger
{
public readonly Type Type;
public readonly LogSourceType SourceType;
public WTOLogger(Type Type, LogSourceType SourceType = LogSourceType.Generic)
{
this.Type = Type;
this.SourceType = SourceType;
base..ctor();
}
public void Debug(string text, bool AddFlair = true, bool ForcePrint = false)
{
LogToConsole(Type, SourceType, LogType.Debug, text, AddFlair, ForcePrint);
}
public void Info(string text, bool AddFlair = true, bool ForcePrint = false)
{
LogToConsole(Type, SourceType, LogType.Info, text, AddFlair, ForcePrint);
}
public void Warning(string text, bool AddFlair = true, bool ForcePrint = false)
{
LogToConsole(Type, SourceType, LogType.Warning, text, AddFlair, ForcePrint);
}
public void Error(string text, bool AddFlair = true, bool ForcePrint = false)
{
LogToConsole(Type, SourceType, LogType.Error, text, AddFlair, ForcePrint);
}
}
private class AssetBundleLoadException : Exception
{
public AssetBundleLoadException(string message)
: base(message)
{
}
}
private const string modGUID = "SkullCrusher.WTO";
private const string modName = "Welcome To Ooblterra";
private const string modVersion = "2.0.0";
private readonly Harmony WTOHarmony = new Harmony("SkullCrusher.WTO");
public static ManualLogSource WTOLogSource;
public static WTOBase Instance;
private static AssetBundle ContentAssetBundle;
private static readonly string[] RootPaths = new string[4] { "Assets/Resources/WelcomeToOoblterra/", "Assets/WelcomeToOoblterra/", "WelcomeToOoblterra/", "" };
private static string resolvedRootPath = "";
public static ConfigEntry<bool> WTODebug;
public static ConfigEntry<bool> WTOCustomSuits;
public static ConfigEntry<bool> WTOCustomPoster;
public static ConfigEntry<bool> WTOScalePrice;
public static ConfigEntry<string> WTOHazardList;
public static ConfigEntry<string> WTOHazardMoonList;
public static ConfigEntry<int> WTOFootsteps;
public static ConfigEntry<int> WTOMusic;
public static ConfigEntry<TiedToLabEnum> WTOForceHazards;
public static ConfigEntry<TiedToLabEnum> WTOForceInsideMonsters;
public static ConfigEntry<TiedToLabEnum> WTOForceOutsideMonsters;
public static ConfigEntry<TiedToLabEnum> WTOForceDaytimeMonsters;
public static ConfigEntry<TiedToLabEnum> WTOForceScrap;
public static ConfigEntry<bool> WTOForceOutsideOnly;
public static ConfigEntry<int> WTOWeightScale;
public static ConfigEntry<bool> WTOLogging_Debug;
public static ConfigEntry<bool> WTOLogging_Info;
public static ConfigEntry<bool> WTOLogging_Warning;
public static ConfigEntry<bool> WTOLogging_Error;
public static ConfigEntry<string> WTOLogging_Filter;
public static ConfigEntry<bool> WTOTestRoom;
public static ConfigEntry<StartupType> WTOStartupType;
public static ConfigEntry<bool> WTOAutoRoute;
public static ConfigEntry<string> WTOContourMapWritePath;
private static readonly WTOLogger Log = new WTOLogger(typeof(WTOBase));
private void Awake()
{
WTODebug = ((BaseUnityPlugin)this).Config.Bind<bool>("1. Debugging", "Print Debug Strings", false, "Whether or not to write WTO's debug print-strings to the log.");
WTOLogging_Debug = ((BaseUnityPlugin)this).Config.Bind<bool>("1. Debugging", "Log Level Debug Messages", false, "Whether or not to write debug messages to the log. These are the lowest, most spammy logs.");
WTOLogging_Info = ((BaseUnityPlugin)this).Config.Bind<bool>("1. Debugging", "Log Level Info Messages", true, "Whether or not to write info messages to the log. General info logs that shouldn't be printed too often.");
WTOLogging_Warning = ((BaseUnityPlugin)this).Config.Bind<bool>("1. Debugging", "Log Level Warning Messages", true, "Whether or not to write warning messages to the log. Warnings that are potentially errors or misconfigurations.");
WTOLogging_Error = ((BaseUnityPlugin)this).Config.Bind<bool>("1. Debugging", "Log Level Error Messages", true, "Whether or not to write error messages to the log. Errors that represent genuine problems that should not be happening.");
WTOLogging_Filter = ((BaseUnityPlugin)this).Config.Bind<string>("1. Debugging", "Log Filter", "WTO", "The filter to apply to the log. Only messages that match this RegEx filter will be printed. If empty, all messages will be printed. This is applied to the final log string, including class name.");
WTOFootsteps = ((BaseUnityPlugin)this).Config.Bind<int>("2. Accessibility", "Footstep Sounds", 100, "Adjust the volume of 523 Ooblterra's custom footstep sound. Binds between 0 and 100.");
WTOMusic = ((BaseUnityPlugin)this).Config.Bind<int>("2. Accessibility", "Music Volume", 100, "Adjust the volume of 523-Ooblterra's custom Time-Of-Day music. Binds between 0 and 100.");
WTOCustomSuits = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Ship Stuff", "Custom Suit Status", true, "Whether or not to add WTO's custom suits.");
WTOCustomPoster = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Ship Stuff", "Visit Ooblterra Poster Status", true, "Whether or not to add WTO's custom poster.");
WTOHazardList = ((BaseUnityPlugin)this).Config.Bind<string>("4. Map Hazards", "Custom Hazard List", "SpikeTrap, TeslaCoil, BabyLurkerEgg, BearTrap", "A list of all of WTO's custom hazards to enable. Affects 523-Ooblterra, and also has influence on the settings below.");
WTOForceHazards = ((BaseUnityPlugin)this).Config.Bind<TiedToLabEnum>("5. Modpack Controls", "Bind WTO Hazards to Oobl Lab", TiedToLabEnum.WTOOnly, "Whether the Oobl Lab should always spawn with its own hazards, regardless of moon. See the wiki on Thunderstore for more information.");
WTOForceInsideMonsters = ((BaseUnityPlugin)this).Config.Bind<TiedToLabEnum>("5. Modpack Controls", "Bind WTO Inside Enemies to Oobl Lab", TiedToLabEnum.WTOOnly, "Whether the Oobl Lab should always spawn with its own inside enemies, regardless of moon. See the wiki on Thunderstore for more information.");
WTOForceOutsideMonsters = ((BaseUnityPlugin)this).Config.Bind<TiedToLabEnum>("5. Modpack Controls", "Bind WTO Outside Enemies to Oobl Lab", TiedToLabEnum.WTOOnly, "Whether the Oobl Lab should always spawn with 523 Ooblterra's outside enemies, regardless of moon. See the wiki on Thunderstore for more information.");
WTOForceDaytimeMonsters = ((BaseUnityPlugin)this).Config.Bind<TiedToLabEnum>("5. Modpack Controls", "Bind WTO Daytime Enemies to Oobl Lab", TiedToLabEnum.WTOOnly, "Whether the Oobl Lab should always spawn with 523 Ooblterra's daytime enemies, regardless of moon. See the wiki on Thunderstore for more information.");
WTOForceScrap = ((BaseUnityPlugin)this).Config.Bind<TiedToLabEnum>("5. Modpack Controls", "Bind WTO Scrap to Oobl Lab", TiedToLabEnum.WTOOnly, "Whether the Oobl Lab should always spawn with its own scrap, regardless of moon. See the wiki on Thunderstore for more information.");
WTOWeightScale = ((BaseUnityPlugin)this).Config.Bind<int>("5. Modpack Controls", "WTOAppend Weight Scale", 1, "For any setting configured to WTOAppend above, this setting multiplies that thing's weight before appending it to list.");
WTOTestRoom = ((BaseUnityPlugin)this).Config.Bind<bool>("6. Testing", "Enable Test Room Teleporter", false, "Whether or not to enable the test room teleporter in Ooblterra. This spawns a teleporter outside of the ship and spawns the test room.");
WTOStartupType = ((BaseUnityPlugin)this).Config.Bind<StartupType>("6. Testing", "Startup Type", StartupType.Normal, "The type of startup to use for the game. Leave this set to Normal. The other modes are for internal use only (e.g. for automated tools)");
WTOAutoRoute = ((BaseUnityPlugin)this).Config.Bind<bool>("6. Testing", "Auto Route", false, "When true, automatically routes to Ooblterra on game start.");
WTOContourMapWritePath = ((BaseUnityPlugin)this).Config.Bind<string>("7. Contour Map Render", "Contour Map Write Path", "contourmap.exr", "The file path to write the contour map file to when Startup Type is set to ContourMapRender");
if (Instance == null)
{
Instance = this;
}
WTOLogSource = Logger.CreateLogSource("SkullCrusher.WTO");
FixLLLLoadingFreeze();
try
{
LoadWelcomeToOoblterra();
}
catch (Exception ex)
{
Log.Error("Failed to load Welcome To Ooblterra. If you have the time, please report this error on our GitHub repository https://github.com/Skeleton-Studios/Welcome_To_Ooblterra/issues : " + ex.Message);
}
}
private void FixLLLLoadingFreeze()
{
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
Assembly assembly = Assembly.GetAssembly(typeof(AssetBundleLoader));
Type type = assembly.GetType("LethalLevelLoader.AssetBundles.AssetBundleLoader");
if (type == null)
{
Log.Warning("Could not find LethalLevelLoader.AssetBundles.AssetBundleLoader type");
return;
}
PropertyInfo property = type.GetProperty("AllowLoading", BindingFlags.Static | BindingFlags.NonPublic);
if (property == null)
{
Log.Warning("Could not find AllowLoading field in AssetBundleLoader");
return;
}
if ((bool)property.GetValue(null))
{
Log.Info("AllowLoading is already true, so AssetBundleLoader is not in a stuck state. No need to apply fix.");
return;
}
PropertyInfo property2 = type.GetProperty("Instance", BindingFlags.Static | BindingFlags.Public);
if (property2 == null)
{
Log.Warning("Could not find Instance field in AssetBundleLoader");
return;
}
object value = property2.GetValue(null);
FieldInfo field = type.GetField("AssetBundleInfos", BindingFlags.Instance | BindingFlags.NonPublic);
if (field == null)
{
Log.Warning("Could not find AssetBundleInfos field in AssetBundleLoader");
return;
}
List<AssetBundleInfo> list = (List<AssetBundleInfo>)field.GetValue(value);
if (list.Count == 0)
{
Log.Info("AssetBundleInfos list is empty, so AssetBundleLoader is not in a stuck state. No need to apply fix.");
return;
}
FieldInfo field2 = type.GetField("knownSceneBundles", BindingFlags.Static | BindingFlags.NonPublic);
if (field2 == null)
{
Log.Warning("Could not find knownSceneBundles field in AssetBundleLoader");
return;
}
Dictionary<string, LethalBundleManifest> dictionary = (Dictionary<string, LethalBundleManifest>)field2.GetValue(null);
bool flag = true;
foreach (AssetBundleInfo item in list)
{
if (!dictionary.TryGetValue(item.AssetBundleFileName, out var value2))
{
flag = false;
break;
}
if (value2.timestamp != File.GetLastWriteTime(item.AssetBundleFilePath).Ticks)
{
flag = false;
break;
}
}
if (!flag)
{
Log.Info("Not all scene bundles are known and skipped, so AssetBundleLoader is not in a stuck state. No need to apply fix.");
return;
}
FieldInfo field3 = typeof(AssetBundleInfo).GetField("hasInitialized", BindingFlags.Instance | BindingFlags.NonPublic);
if (field3 == null)
{
Log.Warning("Could not find hasInitialized field in AssetBundleInfo");
return;
}
FieldInfo field4 = typeof(AssetBundleInfo).GetField("activeLoadRequest", BindingFlags.Instance | BindingFlags.NonPublic);
if (field4 == null)
{
Log.Warning("Could not find activeLoadRequest field in AssetBundleInfo");
return;
}
foreach (AssetBundleInfo item2 in list)
{
bool flag2 = (bool)field3.GetValue(item2);
object value3 = field4.GetValue(item2);
if (!flag2 || value3 != null)
{
return;
}
}
FieldInfo field5 = type.GetField("requestedBundleCount", BindingFlags.Static | BindingFlags.NonPublic);
if (field5 == null)
{
Log.Warning("Could not find requestedBundleCount field in AssetBundleLoader");
return;
}
FieldInfo field6 = type.GetField("processedBundleCount", BindingFlags.Static | BindingFlags.NonPublic);
if (field6 == null)
{
Log.Warning("Could not find processedBundleCount field in AssetBundleLoader");
return;
}
Log.Info("AssetBundleLoader appears to be in a stuck state where all bundles are being skipped due to being known, but they have not been marked as initialized. Attempting to fix by loading bundles directly.");
field5.SetValue(value, list.Count);
field6.SetValue(value, 0);
foreach (AssetBundleInfo item3 in list)
{
item3.TryLoadBundle();
}
}
private void LoadWelcomeToOoblterra()
{
Log.Info("Loading - Start!");
WTOHarmony.PatchAll(typeof(WTOBase));
WTOHarmony.PatchAll(typeof(FactoryPatch));
WTOHarmony.PatchAll(typeof(ItemPatch));
WTOHarmony.PatchAll(typeof(MonsterPatch));
WTOHarmony.PatchAll(typeof(MoonPatch));
WTOHarmony.PatchAll(typeof(SuitPatch));
WTOHarmony.PatchAll(typeof(TerminalPatch));
Log.Info("Harmony Patches applied! Loading asset bundle...");
LoadAssetBundle();
Log.Info("Asset bundle loaded! Reading assets and registering objects...");
MoonPatch.Start();
FactoryPatch.Start();
ItemPatch.Start();
MonsterPatch.Start();
Log.Info("Assets read successfully! Applying netcode runtime init...");
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);
}
}
}
Log.Info("Runtime init applied! Welcome To Ooblterra successfully loaded");
}
private void LoadAssetBundle()
{
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string text = Path.Combine(directoryName, "content");
if (!File.Exists(text))
{
throw new FileNotFoundException("Asset bundle not found at path: " + text);
}
ContentAssetBundle = AssetBundle.LoadFromFile(text);
if (!Object.op_Implicit((Object)(object)ContentAssetBundle))
{
throw new AssetBundleLoadException("Failed to load asset bundle from path: " + text);
}
}
private static string ResolveRootPath(string pathToAsset)
{
string[] rootPaths = RootPaths;
foreach (string text in rootPaths)
{
string text2 = Path.Join((ReadOnlySpan<char>)text, (ReadOnlySpan<char>)pathToAsset).ToLower();
if (ContentAssetBundle.Contains(text2))
{
Log.Info("Resolved asset bundle root path: " + text);
return text;
}
}
string[] allAssetNames = ContentAssetBundle.GetAllAssetNames();
foreach (string text3 in allAssetNames)
{
string text4 = text3.ToLower();
if (text4.EndsWith(pathToAsset.ToLower()))
{
string text5 = text3;
int length = pathToAsset.Length;
return text5.Substring(0, text5.Length - length);
}
}
Log.Error("Could not resolve asset bundle root path using target " + pathToAsset + ". This will most likely cause asset loading to fail.");
return "";
}
public static T ContextualLoadAsset<T>(string PathToAsset, bool LogLoading = true) where T : Object
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
if ((int)Application.platform == 7)
{
string text = PathToAsset.Substring(17);
text = text.Substring(0, text.LastIndexOf("."));
if (LogLoading)
{
Log.Info("Loading " + text + " from resources folder...", AddFlair: true, ForcePrint: true);
}
return Resources.Load<T>(text);
}
if (LogLoading)
{
Log.Info("Loading " + PathToAsset + "...", AddFlair: true, ForcePrint: true);
}
if (!Object.op_Implicit((Object)(object)ContentAssetBundle))
{
throw new AssetBundleLoadException("Cannot load " + PathToAsset + " because ContentAssetBundle is not loaded yet.");
}
if (resolvedRootPath == "")
{
resolvedRootPath = ResolveRootPath(PathToAsset);
}
PathToAsset = Path.Join((ReadOnlySpan<char>)resolvedRootPath, (ReadOnlySpan<char>)PathToAsset);
return ContentAssetBundle.LoadAsset<T>(PathToAsset) ?? throw new AssetBundleLoadException("Failed to load asset at path " + PathToAsset + ". Asset was null after loading.");
}
private static void LogToConsole(Type LogClassType, LogSourceType SourceType, LogType logType, string text, bool AddFlair = true, bool ForcePrint = false)
{
if (!ForcePrint)
{
if (1 == 0)
{
}
bool flag = logType switch
{
LogType.Debug => WTOLogging_Debug.Value,
LogType.Info => WTOLogging_Info.Value,
LogType.Warning => WTOLogging_Warning.Value,
LogType.Error => WTOLogging_Error.Value,
_ => true,
};
if (1 == 0)
{
}
bool flag2 = flag;
if (!WTODebug.Value || !flag2)
{
return;
}
}
text = "[" + LogClassType.Name + "]: " + text;
if (AddFlair)
{
text = "=======" + text + "=======";
}
switch (logType)
{
case LogType.Debug:
WTOLogSource.LogDebug((object)text);
break;
case LogType.Info:
WTOLogSource.LogInfo((object)text);
break;
case LogType.Warning:
WTOLogSource.LogWarning((object)text);
break;
case LogType.Error:
WTOLogSource.LogError((object)text);
break;
default:
WTOLogSource.LogMessage((object)text);
break;
}
}
public static List<string> CSVSeperatedStringList(string InputString)
{
return new List<string>(InputString.Replace(" ", "").ToLower().Split(','));
}
public static ClientRpcSendParams AllClientsButSender(ServerRpcParams rpcParams)
{
//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_0010: 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_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
ClientRpcSendParams result = default(ClientRpcSendParams);
List<ulong> list = new List<ulong>();
list.AddRange(NetworkManager.Singleton.ConnectedClientsIds.Where((ulong id) => id != rpcParams.Receive.SenderClientId));
result.TargetClientIds = new <>z__ReadOnlyList<ulong>(list);
return result;
}
private static void PrintReferences(IEnumerable<Object> objects)
{
foreach (Object @object in objects)
{
PrintReference(@object);
}
static string HierarchyString(GameObject x)
{
string text = ((Object)x).name;
while ((Object)(object)x.transform.parent != (Object)null)
{
x = ((Component)x.transform.parent).gameObject;
text = ((Object)x).name + "/" + text;
}
return text;
}
static void PrintReference(Object o)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Expected O, but got Unknown
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Expected O, but got Unknown
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: Expected O, but got Unknown
if (!(o == (Object)null))
{
if (o is GameObject)
{
GameObject val = (GameObject)o;
Component[] components = val.GetComponents(typeof(Component));
foreach (Component o2 in components)
{
PrintReference((Object)(object)o2);
}
for (int j = 0; j < val.transform.childCount; j++)
{
PrintReference((Object)(object)((Component)val.transform.GetChild(j)).gameObject);
}
}
else if (o is MeshFilter)
{
MeshFilter val2 = (MeshFilter)o;
if (!((Object)(object)val2.sharedMesh == (Object)null))
{
string text2 = HierarchyString(((Component)val2).gameObject);
Log.Info(text2 + ": " + ((Object)val2.sharedMesh).name);
}
}
else if (o is MeshRenderer)
{
MeshRenderer val3 = (MeshRenderer)o;
string text3 = HierarchyString(((Component)val3).gameObject);
for (int k = 0; k < ((Renderer)val3).materials.Length; k++)
{
Log.Info(text3 + " - " + k + ": " + ((Object)((Renderer)val3).materials[k]).name);
}
}
else if (o is AudioSource)
{
AudioSource val4 = (AudioSource)o;
string text4 = HierarchyString(((Component)val4).gameObject);
if ((Object)(object)val4.clip != (Object)null)
{
Log.Info(text4 + ": " + ((Object)val4.clip).name);
}
if ((Object)(object)val4.outputAudioMixerGroup != (Object)null)
{
Log.Info(text4 + ": " + ((Object)val4.outputAudioMixerGroup).name);
}
}
else
{
string name = o.name;
Log.Info(name + ": " + ((object)o).GetType().ToString());
}
}
}
}
}
}
namespace Welcome_To_Ooblterra.Patches
{
internal class FactoryPatch
{
private const string DungeonPath = "CustomDungeon/Data/";
private const string BehaviorPath = "CustomDungeon/Behaviors/";
private const string SecurityPath = "CustomDungeon/Security/";
private const string DoorPath = "CustomDungeon/Doors/";
private const string EmptyPrefabsPath = "CustomDungeon/Rooms/EMPTY.PREFABS/";
public static List<SpawnableMapObject> SecurityList = new List<SpawnableMapObject>();
public static ExtendedDungeonFlow OoblDungeonFlow;
private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(FactoryPatch));
[HarmonyPatch(typeof(RoundManager), "SpawnMapObjects")]
[HarmonyPrefix]
private static bool WTOSpawnMapObjects(RoundManager __instance)
{
//IL_030d: Unknown result type (might be due to invalid IL or missing references)
//IL_0312: Unknown result type (might be due to invalid IL or missing references)
//IL_0327: Unknown result type (might be due to invalid IL or missing references)
//IL_0330: Unknown result type (might be due to invalid IL or missing references)
if (WTOBase.WTOForceHazards.Value == TiedToLabEnum.UseMoonDefault && __instance.currentLevel.PlanetName != MoonPatch.MoonFriendlyName)
{
return true;
}
if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)(object)OoblDungeonFlow)
{
return true;
}
if (__instance.currentLevel.spawnableMapObjects == null || __instance.currentLevel.spawnableMapObjects.Length == 0)
{
return true;
}
Random random = new Random(StartOfRound.Instance.randomMapSeed + 587);
__instance.mapPropsContainer = GameObject.FindGameObjectWithTag("MapPropsContainer");
RandomMapObject[] array = Object.FindObjectsOfType<RandomMapObject>();
List<string> list = WTOBase.CSVSeperatedStringList(WTOBase.WTOHazardList.Value);
if (WTOBase.WTOForceHazards.Value != 0)
{
SpawnableMapObject[] spawnableMapObjects = __instance.currentLevel.spawnableMapObjects;
foreach (SpawnableMapObject val in spawnableMapObjects)
{
list.Add(((Object)val.prefabToSpawn).name.ToLower());
}
}
for (int j = 0; j < __instance.currentLevel.spawnableMapObjects.Length; j++)
{
if (!list.Contains(((Object)__instance.currentLevel.spawnableMapObjects[j].prefabToSpawn).name.ToLower()))
{
Log.Error("Object " + ((Object)__instance.currentLevel.spawnableMapObjects[j].prefabToSpawn).name.ToLower() + " not found in valid spawn list!");
continue;
}
List<RandomMapObject> list2 = new List<RandomMapObject>();
int num = (int)__instance.currentLevel.spawnableMapObjects[j].numberToSpawn.Evaluate((float)random.NextDouble());
WTOBase.WTOLogSource.LogInfo((object)$"Attempting to spawn {__instance.currentLevel.spawnableMapObjects[j].prefabToSpawn}; Quantity: {num}");
if (__instance.increasedMapHazardSpawnRateIndex == j)
{
num = Mathf.Min(num * 2, 150);
}
if (num <= 0)
{
continue;
}
for (int k = 0; k < array.Length; k++)
{
string text = "";
foreach (GameObject spawnablePrefab in array[k].spawnablePrefabs)
{
if (object.Equals(spawnablePrefab, __instance.currentLevel.spawnableMapObjects[j].prefabToSpawn))
{
list2.Add(array[k]);
}
text = text + ((object)spawnablePrefab)?.ToString() + ", ";
}
}
for (int l = 0; l < num; l++)
{
if (list2.Count <= 0)
{
WTOBase.WTOLogSource.LogInfo((object)"Objects will not spawn; no valid random spots found!");
break;
}
RandomMapObject val2 = list2[random.Next(0, list2.Count)];
Vector3 position = ((Component)val2).transform.position;
GameObject val3 = Object.Instantiate<GameObject>(__instance.currentLevel.spawnableMapObjects[j].prefabToSpawn, position, ((Component)val2).transform.rotation, __instance.mapPropsContainer.transform);
val3.GetComponent<NetworkObject>().Spawn(true);
WTOBase.WTOLogSource.LogInfo((object)$"Spawned new {val3}");
list2.Remove(val2);
}
}
return false;
}
public static void Start()
{
OoblDungeonFlow = WTOBase.ContextualLoadAsset<ExtendedDungeonFlow>("CustomDungeon/Data/OoblLabExtendedDungeonFlow.asset", LogLoading: true);
PatchedContent.RegisterExtendedDungeonFlow(OoblDungeonFlow);
NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset<GameObject>("CustomDungeon/Behaviors/ChargedBattery.prefab", LogLoading: true));
NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset<GameObject>("CustomDungeon/Behaviors/DrainedBattery.prefab", LogLoading: true));
NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset<GameObject>("CustomDungeon/Behaviors/ScrapShelf.prefab", LogLoading: true));
NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset<GameObject>("CustomDungeon/Behaviors/BatteryRecepticleTransform.prefab", LogLoading: true));
NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset<GameObject>("CustomDungeon/Behaviors/OoblShutter.prefab", LogLoading: true));
NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset<GameObject>("CustomDungeon/Security/TeslaCoil.prefab", LogLoading: true));
NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset<GameObject>("CustomDungeon/Security/SpikeTrap.prefab", LogLoading: true));
NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset<GameObject>("CustomDungeon/Security/BabyLurkerEgg.prefab", LogLoading: true));
NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset<GameObject>("CustomDungeon/Rooms/EMPTY.PREFABS/EntranceTeleportA.prefab", LogLoading: true));
NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset<GameObject>("CustomDungeon/Rooms/EMPTY.PREFABS/EntranceTeleportB.prefab", LogLoading: true));
NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset<GameObject>("CustomDungeon/Rooms/EMPTY.PREFABS/Landmine.prefab", LogLoading: true));
NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset<GameObject>("CustomDungeon/Rooms/EMPTY.PREFABS/SpikeRoofTrapHazard.prefab", LogLoading: true));
NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset<GameObject>("CustomDungeon/Rooms/EMPTY.PREFABS/Turret.prefab", LogLoading: true));
NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset<GameObject>("CustomDungeon/Rooms/EMPTY.PREFABS/VentEntrance.prefab", LogLoading: true));
NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset<GameObject>("CustomDungeon/TestRoom.prefab", LogLoading: true));
NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset<GameObject>("CustomDungeon/TestRoomTeleport.prefab", LogLoading: true));
}
}
internal class ItemPatch
{
public class ItemData
{
private readonly string AssetName;
private readonly int Rarity;
private Item Itemref;
public ItemData(string name, int rarity)
{
AssetName = "CustomItems/" + name;
Rarity = rarity;
}
public string GetItemPath()
{
return AssetName;
}
public int GetRarity()
{
return Rarity;
}
public void SetItem(Item ItemToSet)
{
Itemref = ItemToSet;
}
public Item GetItem()
{
return Itemref;
}
}
private static AudioClip CachedDiscoBallMusic;
private static AudioClip OoblterraDiscoMusic;
private const string ItemPath = "CustomItems/";
private static readonly Dictionary<string, List<SpawnableItemWithRarity>> MoonsToItemLists = new Dictionary<string, List<SpawnableItemWithRarity>>();
public static ItemData[] ItemList = new ItemData[11]
{
new ItemData("AlienCrate.asset", 30),
new ItemData("FiveSixShovel.asset", 10),
new ItemData("HandCrystal.asset", 30),
new ItemData("OoblCorpse.asset", 5),
new ItemData("StatueSmall.asset", 40),
new ItemData("WandCorpse.asset", 5),
new ItemData("WandFeed.asset", 20),
new ItemData("SprintTotem.asset", 25),
new ItemData("CursedTotem.asset", 20),
new ItemData("Chems.asset", 0),
new ItemData("Battery.asset", 0)
};
[HarmonyPatch(typeof(RoundManager), "SetLockedDoors")]
[HarmonyPrefix]
private static void ReplaceKeys(RoundManager __instance)
{
if (!(__instance.currentLevel.PlanetName != MoonPatch.MoonFriendlyName))
{
GameObject keyPrefab = Object.Instantiate<GameObject>(WTOBase.ContextualLoadAsset<GameObject>("CustomItems/OoblKey.prefab", LogLoading: true), __instance.mapPropsContainer.transform);
__instance.keyPrefab = keyPrefab;
}
}
[HarmonyPatch(typeof(CozyLights), "SetAudio")]
[HarmonyPrefix]
private static bool ReplaceDiscoBall(CozyLights __instance)
{
if (StartOfRound.Instance.currentLevel.PlanetName != MoonPatch.MoonFriendlyName)
{
if ((Object)(object)__instance.turnOnAudio != (Object)null)
{
__instance.turnOnAudio.clip = CachedDiscoBallMusic;
}
return true;
}
if ((Object)(object)__instance.turnOnAudio != (Object)null)
{
__instance.turnOnAudio.clip = OoblterraDiscoMusic;
}
return true;
}
[HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")]
[HarmonyPrefix]
private static void SetItemsWTO(RoundManager __instance)
{
string planetName = __instance.currentLevel.PlanetName;
if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)(object)FactoryPatch.OoblDungeonFlow)
{
if (MoonsToItemLists.TryGetValue(planetName, out List<SpawnableItemWithRarity> value))
{
__instance.currentLevel.spawnableScrap = value;
}
}
else
{
SetItemStuff(WTOBase.WTOForceScrap.Value, ref __instance.currentLevel.spawnableScrap, MoonsToItemLists[MoonPatch.MoonFriendlyName]);
}
}
public static void Start()
{
ItemData[] itemList = ItemList;
foreach (ItemData itemData in itemList)
{
Item val = WTOBase.ContextualLoadAsset<Item>(itemData.GetItemPath(), LogLoading: true);
NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
Items.RegisterScrap(val, itemData.GetRarity(), (LevelTypes)1);
itemData.SetItem(val);
}
NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset<GameObject>("CustomItems/OoblKey.prefab", LogLoading: true));
CachedDiscoBallMusic = WTOBase.ContextualLoadAsset<AudioClip>("CustomItems/Boombox6QuestionMark.ogg", LogLoading: false);
OoblterraDiscoMusic = WTOBase.ContextualLoadAsset<AudioClip>("CustomItems/ooblboombox.ogg", LogLoading: false);
if (!MoonsToItemLists.ContainsKey(MoonPatch.MoonFriendlyName))
{
MoonsToItemLists.Add(MoonPatch.MoonFriendlyName, MoonPatch.OoblterraExtendedLevel.SelectableLevel.spawnableScrap);
}
}
private static void SetItemStuff(TiedToLabEnum TiedToLabState, ref List<SpawnableItemWithRarity> CurrentMoonItemList, List<SpawnableItemWithRarity> OoblterraItemList)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Expected O, but got Unknown
List<SpawnableItemWithRarity> list = new List<SpawnableItemWithRarity>();
foreach (SpawnableItemWithRarity OoblterraItem in OoblterraItemList)
{
list.Add(new SpawnableItemWithRarity
{
spawnableItem = OoblterraItem.spawnableItem,
rarity = OoblterraItem.rarity * WTOBase.WTOWeightScale.Value
});
}
switch (TiedToLabState)
{
case TiedToLabEnum.WTOOnly:
CurrentMoonItemList = OoblterraItemList;
break;
case TiedToLabEnum.AppendWTO:
CurrentMoonItemList.AddRange(list);
break;
}
}
}
internal class MonsterPatch
{
public static List<SpawnableEnemyWithRarity> InsideEnemies = new List<SpawnableEnemyWithRarity>();
public static List<SpawnableEnemyWithRarity> OutsideEnemies = new List<SpawnableEnemyWithRarity>();
public static List<SpawnableEnemyWithRarity> DaytimeEnemies = new List<SpawnableEnemyWithRarity>();
public static List<SpawnableEnemyWithRarity> AdultWandererContainer = new List<SpawnableEnemyWithRarity>();
private const string EnemyPath = "CustomEnemies/";
public const bool ShouldDebugEnemies = true;
private static readonly Dictionary<string, List<SpawnableEnemyWithRarity>> MoonsToInsideSpawnLists = new Dictionary<string, List<SpawnableEnemyWithRarity>>();
private static readonly Dictionary<string, List<SpawnableEnemyWithRarity>> MoonsToOutsideSpawnLists = new Dictionary<string, List<SpawnableEnemyWithRarity>>();
private static readonly Dictionary<string, List<SpawnableEnemyWithRarity>> MoonsToDaytimeSpawnLists = new Dictionary<string, List<SpawnableEnemyWithRarity>>();
private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(MonsterPatch));
[HarmonyPatch(typeof(EnemyAI), "SetEnemyStunned")]
[HarmonyPostfix]
private static void SetOwnershipToStunningPlayer(EnemyAI __instance)
{
if (__instance is WTOEnemy && !((Object)(object)__instance.stunnedByPlayer == (Object)null))
{
Log.Info($"Enemy: {((object)__instance).GetType()} STUNNED BY: {__instance.stunnedByPlayer}; Switching ownership...");
__instance.ChangeOwnershipOfEnemy(__instance.stunnedByPlayer.actualClientId);
}
}
[HarmonyPatch(typeof(EnemyAI), "SetClientCalculatingAI")]
[HarmonyPrefix]
private static bool PreventGhostAgentEnable(EnemyAI __instance, bool enable)
{
if (__instance is OoblGhostAI)
{
__instance.isClientCalculatingAI = enable;
return false;
}
return true;
}
[HarmonyPatch(typeof(HUDManager), "UseSignalTranslatorClientRpc")]
[HarmonyPostfix]
private static void TellAllGhostsOfSignalTransmission()
{
OoblGhostAI[] array = Object.FindObjectsOfType<OoblGhostAI>();
OoblGhostAI[] array2 = array;
foreach (OoblGhostAI ooblGhostAI in array2)
{
ooblGhostAI.EvalulateSignalTranslatorUse();
}
}
[HarmonyPatch(typeof(RoundManager), "AssignRandomEnemyToVent")]
[HarmonyPrefix]
private static void SetInsideEnemiesWTO(RoundManager __instance)
{
string planetName = __instance.currentLevel.PlanetName;
if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)(object)FactoryPatch.OoblDungeonFlow)
{
if (MoonsToInsideSpawnLists.TryGetValue(planetName, out List<SpawnableEnemyWithRarity> value))
{
__instance.currentLevel.Enemies = value;
}
}
else
{
SetMonsterStuff(WTOBase.WTOForceInsideMonsters.Value, ref __instance.currentLevel.Enemies, MoonsToInsideSpawnLists[MoonPatch.MoonFriendlyName]);
}
}
[HarmonyPatch(typeof(RoundManager), "SpawnRandomOutsideEnemy")]
[HarmonyPrefix]
private static void SetOutsideEnemiesWTO(RoundManager __instance, GameObject[] spawnPoints, float timeUpToCurrentHour)
{
string planetName = __instance.currentLevel.PlanetName;
if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)(object)FactoryPatch.OoblDungeonFlow)
{
if (MoonsToOutsideSpawnLists.TryGetValue(planetName, out List<SpawnableEnemyWithRarity> value))
{
__instance.currentLevel.OutsideEnemies = value;
}
}
else
{
SetMonsterStuff(WTOBase.WTOForceOutsideMonsters.Value, ref __instance.currentLevel.OutsideEnemies, MoonsToOutsideSpawnLists[MoonPatch.MoonFriendlyName]);
}
}
[HarmonyPatch(typeof(RoundManager), "SpawnRandomDaytimeEnemy")]
[HarmonyPrefix]
private static void SetDaytimeEnemiesWTO(RoundManager __instance)
{
string planetName = __instance.currentLevel.PlanetName;
if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)(object)FactoryPatch.OoblDungeonFlow)
{
if (MoonsToDaytimeSpawnLists.TryGetValue(planetName, out List<SpawnableEnemyWithRarity> value))
{
__instance.currentLevel.OutsideEnemies = value;
}
}
else
{
SetMonsterStuff(WTOBase.WTOForceDaytimeMonsters.Value, ref __instance.currentLevel.DaytimeEnemies, MoonsToDaytimeSpawnLists[MoonPatch.MoonFriendlyName]);
}
}
public static void Start()
{
CreateEnemy("Wanderer.asset", DaytimeEnemies, 50, (SpawnType)1, "WandererTerminal.asset", "WandererKeyword.asset");
CreateEnemy("AdultWanderer.asset", AdultWandererContainer, 0, (SpawnType)2, "AdultWandererTerminal.asset", "AdultWandererKeyword.asset");
CreateEnemy("Gallenarma.asset", InsideEnemies, 30, (SpawnType)0, "GallenTerminal.asset", "GallenKeyword.asset");
CreateEnemy("EyeSecurity.asset", InsideEnemies, 20, (SpawnType)0, "EyeSecTerminal.asset", "EyeSecKeyword.asset");
CreateEnemy("OoblGhost.asset", InsideEnemies, 20, (SpawnType)0, "OoblGhostTerminal.asset", "OoblGhostKeyword.asset");
CreateEnemy("Enforcer.asset", InsideEnemies, 10, (SpawnType)0, "EnforcerTerminal.asset", "EnforcerKeyword.asset");
CreateEnemy("BabyLurker.asset", InsideEnemies, 10, (SpawnType)0, "BabyLurkerTerminal.asset", "BabyLurkerKeyword.asset");
CreateEnemy("GhostPlayer.asset", OutsideEnemies, 10, (SpawnType)2);
if (!MoonsToInsideSpawnLists.ContainsKey(MoonPatch.MoonFriendlyName))
{
MoonsToInsideSpawnLists.Add(MoonPatch.MoonFriendlyName, MoonPatch.OoblterraExtendedLevel.SelectableLevel.Enemies);
}
if (!MoonsToOutsideSpawnLists.ContainsKey(MoonPatch.MoonFriendlyName))
{
MoonsToOutsideSpawnLists.Add(MoonPatch.MoonFriendlyName, MoonPatch.OoblterraExtendedLevel.SelectableLevel.OutsideEnemies);
}
if (!MoonsToDaytimeSpawnLists.ContainsKey(MoonPatch.MoonFriendlyName))
{
MoonsToDaytimeSpawnLists.Add(MoonPatch.MoonFriendlyName, MoonPatch.OoblterraExtendedLevel.SelectableLevel.DaytimeEnemies);
}
}
public static void CreateEnemy(string EnemyName, List<SpawnableEnemyWithRarity> EnemyList, int rarity, SpawnType SpawnType, string InfoName = null, string KeywordName = null)
{
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Expected O, but got Unknown
string text = EnemyName.Remove(EnemyName.Length - 6, 6) + "/";
TerminalNode val = null;
TerminalKeyword val2 = null;
EnemyType val3 = WTOBase.ContextualLoadAsset<EnemyType>("CustomEnemies/" + text + EnemyName, LogLoading: true);
val3.enemyPrefab.GetComponent<EnemyAI>().debugEnemyAI = false;
if (InfoName != null)
{
val = WTOBase.ContextualLoadAsset<TerminalNode>("CustomEnemies/" + text + InfoName, LogLoading: true);
}
if (KeywordName != null)
{
val2 = WTOBase.ContextualLoadAsset<TerminalKeyword>("CustomEnemies/" + text + KeywordName, LogLoading: true);
}
NetworkPrefabs.RegisterNetworkPrefab(val3.enemyPrefab);
Enemies.RegisterEnemy(val3, rarity, (LevelTypes)1, SpawnType, val, val2);
EnemyList?.Add(new SpawnableEnemyWithRarity
{
enemyType = val3,
rarity = rarity
});
Log.Info("Monster Loaded: " + EnemyName.Remove(EnemyName.Length - 6, 6));
}
private static void SetMonsterStuff(TiedToLabEnum TiedToLabState, ref List<SpawnableEnemyWithRarity> CurrentMoonEnemyList, List<SpawnableEnemyWithRarity> OoblterraEnemyList)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Expected O, but got Unknown
List<SpawnableEnemyWithRarity> list = new List<SpawnableEnemyWithRarity>();
foreach (SpawnableEnemyWithRarity OoblterraEnemy in OoblterraEnemyList)
{
list.Add(new SpawnableEnemyWithRarity
{
enemyType = OoblterraEnemy.enemyType,
rarity = OoblterraEnemy.rarity * WTOBase.WTOWeightScale.Value
});
}
switch (TiedToLabState)
{
case TiedToLabEnum.WTOOnly:
CurrentMoonEnemyList = OoblterraEnemyList;
break;
case TiedToLabEnum.AppendWTO:
CurrentMoonEnemyList.AddRange(list);
break;
}
}
}
internal class MoonPatch
{
[CompilerGenerated]
private sealed class <RouteToOoblterraOnceLLLIsLoaded>d__22 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public StartMatchLever startMatchLever;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <RouteToOoblterraOnceLLLIsLoaded>d__22(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
Log.Info("Waiting for LLL to finish loading before routing to Ooblterra...");
<>2__current = (object)new WaitUntil(GetIsLLLReadyFunc());
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
Log.Info("LLL finished loading, routing to Ooblterra...");
StartOfRound.Instance.ChangeLevel(OoblterraExtendedLevel.SelectableLevel.levelID);
StartOfRound.Instance.ArriveAtLevel();
Log.Info("Pulling lever to start match...");
startMatchLever.leverHasBeenPulled = true;
startMatchLever.leverAnimatorObject.SetBool("pullLever", true);
startMatchLever.triggerScript.interactable = false;
startMatchLever.PullLever();
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public static string MoonFriendlyName;
public static Animator OoblFogAnimator;
public const string MoonPath = "CustomMoon/";
private static FootstepSurface GrassSurfaceRef;
private static AudioClip[] OoblFootstepClips;
private static AudioClip OoblHitSFX;
private static AudioClip[] GrassFootstepClips;
private static AudioClip GrassHitSFX;
private static AudioClip[] CachedTODMusic;
private static AudioClip[] CachedAmbientMusic;
private static AudioClip[] OoblTODMusic;
private static SpawnableMapObject[] CachedSpawnableMapObjects;
public static ExtendedLevel OoblterraExtendedLevel;
private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(MoonPatch));
[HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")]
[HarmonyPostfix]
private static void ManageNav(StartOfRound __instance)
{
GrassSurfaceRef = StartOfRound.Instance.footstepSurfaces[4];
if (GrassFootstepClips == null)
{
GrassFootstepClips = StartOfRound.Instance.footstepSurfaces[4].clips;
GrassHitSFX = StartOfRound.Instance.footstepSurfaces[4].hitSurfaceSFX;
}
if (OoblFootstepClips == null)
{
OoblFootstepClips = (AudioClip[])(object)new AudioClip[5]
{
WTOBase.ContextualLoadAsset<AudioClip>("CustomMoon/Sound/Footsteps/TENTACLESTEP01.wav", LogLoading: true),
WTOBase.ContextualLoadAsset<AudioClip>("CustomMoon/Sound/Footsteps/TENTACLESTEP02.wav", LogLoading: true),
WTOBase.ContextualLoadAsset<AudioClip>("CustomMoon/Sound/Footsteps/TENTACLESTEP03.wav", LogLoading: true),
WTOBase.ContextualLoadAsset<AudioClip>("CustomMoon/Sound/Footsteps/TENTACLESTEP04.wav", LogLoading: true),
WTOBase.ContextualLoadAsset<AudioClip>("CustomMoon/Sound/Footsteps/TENTACLESTEP05.wav", LogLoading: true)
};
OoblHitSFX = WTOBase.ContextualLoadAsset<AudioClip>("CustomMoon/Sound/Footsteps/TENTACLE_Fall.wav", LogLoading: true);
}
if (CachedTODMusic == null)
{
CachedTODMusic = TimeOfDay.Instance.timeOfDayCues;
CachedAmbientMusic = SoundManager.Instance.DaytimeMusic;
}
if (OoblTODMusic == null)
{
OoblTODMusic = (AudioClip[])(object)new AudioClip[4]
{
WTOBase.ContextualLoadAsset<AudioClip>("CustomMoon/Oobl_StartOfDay.ogg", LogLoading: true),
WTOBase.ContextualLoadAsset<AudioClip>("CustomMoon/Oobl_MidDay.ogg", LogLoading: true),
WTOBase.ContextualLoadAsset<AudioClip>("CustomMoon/Oobl_LateDay.ogg", LogLoading: true),
WTOBase.ContextualLoadAsset<AudioClip>("CustomMoon/Oobl_Night.ogg", LogLoading: true)
};
}
if (__instance.currentLevel.PlanetName != MoonFriendlyName)
{
TimeOfDay.Instance.timeOfDayCues = CachedTODMusic;
SoundManager.Instance.DaytimeMusic = CachedAmbientMusic;
GrassSurfaceRef.clips = GrassFootstepClips;
GrassSurfaceRef.hitSurfaceSFX = GrassHitSFX;
}
else
{
MoveNavNodesToNewPositions();
GrassSurfaceRef.clips = OoblFootstepClips;
GrassSurfaceRef.hitSurfaceSFX = OoblHitSFX;
TimeOfDay.Instance.timeOfDayCues = OoblTODMusic;
SoundManager.Instance.DaytimeMusic = (AudioClip[])(object)new AudioClip[0];
ReplaceStoryLogIDs();
}
}
[HarmonyPatch(typeof(StartOfRound), "OnShipLandedMiscEvents")]
[HarmonyPostfix]
private static void SetFogTies(StartOfRound __instance)
{
if (!(__instance.currentLevel.PlanetName != MoonFriendlyName))
{
OoblFogAnimator = GameObject.Find("OoblFog").gameObject.GetComponent<Animator>();
Log.Debug($"Fog animator found : {(Object)(object)OoblFogAnimator != (Object)null}");
if ((Object)(object)TimeOfDay.Instance.sunAnimator == (Object)(object)OoblFogAnimator)
{
Log.Debug("Sun Animator IS fog animator, supposedly");
return;
}
TimeOfDay.Instance.sunAnimator = OoblFogAnimator;
Log.Debug($"Is Sun Animator Fog Animator? {(Object)(object)TimeOfDay.Instance.sunAnimator == (Object)(object)OoblFogAnimator}");
TimeOfDay.Instance.playDelayedMusicCoroutine = null;
}
}
[HarmonyPatch(typeof(TimeOfDay), "SetInsideLightingDimness")]
[HarmonyPrefix]
private static void SpoofLightValues(TimeOfDay __instance)
{
if (!(__instance.currentLevel.PlanetName != MoonFriendlyName))
{
Light component = GameObject.Find("ActualSun").GetComponent<Light>();
Light component2 = GameObject.Find("ActualIndirect").GetComponent<Light>();
TimeOfDay val = Object.FindObjectOfType<TimeOfDay>();
val.sunIndirect = component2;
val.sunDirect = component;
}
}
[HarmonyPatch(typeof(PlayerControllerB), "PlayFootstepSound")]
[HarmonyPrefix]
private static void PatchFootstepSound(PlayerControllerB __instance)
{
if (StartOfRound.Instance.currentLevel.PlanetName != MoonFriendlyName || __instance.currentFootstepSurfaceIndex != 4)
{
__instance.movementAudio.volume = 0.447f;
return;
}
float num = Mathf.Clamp((float)WTOBase.WTOFootsteps.Value, 0f, 100f);
__instance.movementAudio.volume = num / 100f * 0.447f;
}
[HarmonyPatch(typeof(RoundManager), "SpawnOutsideHazards")]
[HarmonyPrefix]
private static bool WTOSpawnOutsideObjects(RoundManager __instance)
{
if (__instance.currentLevel.PlanetName != MoonFriendlyName)
{
return true;
}
if (!WTOBase.CSVSeperatedStringList(WTOBase.WTOHazardList.Value).Contains("beartrap"))
{
__instance.currentLevel.spawnableMapObjects = null;
return false;
}
__instance.currentLevel.spawnableMapObjects = CachedSpawnableMapObjects;
return true;
}
[HarmonyPatch(typeof(TimeOfDay), "Start")]
[HarmonyPrefix]
private static bool AdjustTODMusic(TimeOfDay __instance)
{
if (RoundManager.Instance.currentLevel.PlanetName != MoonFriendlyName)
{
__instance.TimeOfDayMusic.volume = 1f;
return true;
}
float num = Mathf.Clamp((float)WTOBase.WTOFootsteps.Value, 0f, 100f);
__instance.TimeOfDayMusic.volume = num / 100f;
return true;
}
[HarmonyPatch(typeof(StartMatchLever), "Start")]
[HarmonyPrefix]
private static void AutoRouteToOoblterra(StartMatchLever __instance)
{
if (WTOBase.WTOAutoRoute.Value && ((NetworkBehaviour)StartOfRound.Instance).IsServer)
{
((MonoBehaviour)StartOfRound.Instance).StartCoroutine(RouteToOoblterraOnceLLLIsLoaded(__instance));
}
}
private static Func<bool> GetIsLLLReadyFunc()
{
Assembly assembly = Assembly.GetAssembly(typeof(AssetBundleLoader));
Type type = assembly.GetType("LethalLevelLoader.NetworkBundleManager");
if (type == null)
{
Log.Warning("Could not find LethalLevelLoader.NetworkBundleManager type");
return () => true;
}
PropertyInfo property = type.GetProperty("Instance", BindingFlags.Static | BindingFlags.Public);
if (property == null)
{
Log.Warning("Could not find Instance field in NetworkBundleManager");
return () => true;
}
object value = property.GetValue(null);
FieldInfo field = type.GetField("allowedToLoadLevel", BindingFlags.Instance | BindingFlags.NonPublic);
if (field == null)
{
Log.Warning("Could not find allowedToLoadLevel field in NetworkBundleManager");
return () => true;
}
NetworkVariable<bool> allowedToLoadLevel = field.GetValue(value) as NetworkVariable<bool>;
return delegate
{
try
{
return allowedToLoadLevel.Value;
}
catch (Exception arg)
{
Log.Warning($"Exception while trying to get allowedToLoadLevel value: {arg}");
return true;
}
};
}
[IteratorStateMachine(typeof(<RouteToOoblterraOnceLLLIsLoaded>d__22))]
private static IEnumerator RouteToOoblterraOnceLLLIsLoaded(StartMatchLever startMatchLever)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <RouteToOoblterraOnceLLLIsLoaded>d__22(0)
{
startMatchLever = startMatchLever
};
}
public static void Start()
{
OoblterraExtendedLevel = WTOBase.ContextualLoadAsset<ExtendedLevel>("CustomMoon/OoblterraExtendedLevel.asset", LogLoading: true);
MoonFriendlyName = OoblterraExtendedLevel.SelectableLevel.PlanetName;
Log.Info($"Ooblterra Found: {(Object)(object)OoblterraExtendedLevel != (Object)null}");
PatchedContent.RegisterExtendedLevel(OoblterraExtendedLevel);
CachedSpawnableMapObjects = OoblterraExtendedLevel.SelectableLevel.spawnableMapObjects;
foreach (SpawnableItemWithRarity item in OoblterraExtendedLevel.SelectableLevel.spawnableScrap)
{
Log.Info(((Object)item.spawnableItem).name ?? "");
}
}
private static void MoveNavNodesToNewPositions()
{
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
GameObject[] array = GameObject.FindGameObjectsWithTag("OutsideAINode");
List<GameObject> list = new List<GameObject>();
IEnumerable<GameObject> enumerable = from obj in Object.FindObjectsOfType<GameObject>()
where ((Object)obj).name == "OoblOutsideNode"
select obj;
foreach (GameObject item in enumerable)
{
list.Add(item);
}
Log.Info("Outside nav points: " + list.Count());
for (int i = 0; i < array.Count(); i++)
{
if (list.Count() > i)
{
array[i].transform.position = list[i].transform.position;
}
else
{
Object.Destroy((Object)(object)array[i]);
}
}
}
private static void ReplaceStoryLogIDs()
{
StoryLog[] array = Object.FindObjectsOfType<StoryLog>();
StoryLog[] array2 = array;
foreach (StoryLog val in array2)
{
if (TerminalPatch.LogDictionary.TryGetValue(val.storyLogID, out var value))
{
val.storyLogID = value;
}
}
}
}
internal class SuitPatch
{
private const string SuitPath = "CustomSuits/";
private const string BlackSuitPath = "CustomSuits/BlackSuits";
private const string PosterGameObject = "HangarShip/Plane.001";
private static readonly string[] SuitMaterialNames = new string[7] { "RedSuit.mat", "ProtSuit.mat", "YellowSuit.mat", "GreenSuit.mat", "BlueSuit.mat", "IndigoSuit.mat", "MackSuit.mat" };
private static bool SuitsLoaded = false;
public static Material GhostPlayerSuit;
private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(SuitPatch));
[HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")]
[HarmonyPrefix]
private static void StartPatch(ref StartOfRound __instance)
{
GhostPlayerSuit = WTOBase.ContextualLoadAsset<Material>("CustomSuits/GhostPlayerSuit.mat", LogLoading: true);
if (WTOBase.WTOCustomSuits.Value)
{
LoadSuits("CustomSuits/");
}
}
[HarmonyPatch(typeof(StartOfRound), "Start")]
[HarmonyPatch(typeof(RoundManager), "GenerateNewLevelClientRpc")]
[HarmonyPostfix]
[HarmonyPriority(0)]
private static void PatchPosters(StartOfRound __instance)
{
if (WTOBase.WTOCustomPoster.Value)
{
ReplacePoster();
}
}
private static void LoadSuits(string RelevantPath)
{
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected O, but got Unknown
if (SuitsLoaded)
{
Log.Warning("SUITS ALREADY LOADED!");
return;
}
UnlockableItem val = StartOfRound.Instance.unlockablesList.unlockables.First((UnlockableItem x) => (Object)(object)x.suitMaterial != (Object)null);
string[] suitMaterialNames = SuitMaterialNames;
foreach (string text in suitMaterialNames)
{
UnlockableItem val2 = JsonUtility.FromJson<UnlockableItem>(JsonUtility.ToJson((object)val));
UnlockableSuit val3 = new UnlockableSuit();
val2.suitMaterial = WTOBase.ContextualLoadAsset<Material>(RelevantPath + text, LogLoading: true);
string unlockableName = text.Substring(0, text.Length - 4);
val2.unlockableName = unlockableName;
StartOfRound.Instance.unlockablesList.unlockables.Add(val2);
}
SuitsLoaded = true;
}
private static void AddSuitPurchaseNode()
{
}
private static void ReplacePoster()
{
if (!((Object)(object)GameObject.Find("HangarShip/Plane.001") == (Object)null))
{
Material[] materials = ((Renderer)GameObject.Find("HangarShip/Plane.001").GetComponent<MeshRenderer>()).materials;
materials[1] = WTOBase.ContextualLoadAsset<Material>("CustomSuits/Poster.mat", LogLoading: true);
((Renderer)GameObject.Find("HangarShip/Plane.001").GetComponent<MeshRenderer>()).materials = materials;
}
}
private static void AddPosterShipDeco()
{
}
}
internal class TerminalPatch
{
public static Dictionary<int, int> LogDictionary = new Dictionary<int, int>();
private const string TerminalPath = "CustomTerminal/";
private static List<TerminalKeyword> KeywordList;
private static List<TerminalNode> NodeList = new List<TerminalNode>();
private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(TerminalPatch));
[HarmonyPatch(typeof(StartOfRound), "Start")]
[HarmonyPostfix]
private static void AddLogs()
{
LoadLogKeywords();
LoadLogNodes();
LoadStoryLogs();
}
private static void LoadLogKeywords()
{
KeywordList = new List<TerminalKeyword>
{
WTOBase.ContextualLoadAsset<TerminalKeyword>("CustomTerminal/WTOLogFile1Keyword.asset", LogLoading: true),
WTOBase.ContextualLoadAsset<TerminalKeyword>("CustomTerminal/WTOLogFile2Keyword.asset", LogLoading: true),
WTOBase.ContextualLoadAsset<TerminalKeyword>("CustomTerminal/WTOLogFile3Keyword.asset", LogLoading: true),
WTOBase.ContextualLoadAsset<TerminalKeyword>("CustomTerminal/WTOLogFile4Keyword.asset", LogLoading: true),
WTOBase.ContextualLoadAsset<TerminalKeyword>("CustomTerminal/WTOLogFile5Keyword.asset", LogLoading: true)
};
}
private static void LoadLogNodes()
{
NodeList = new List<TerminalNode>
{
WTOBase.ContextualLoadAsset<TerminalNode>("CustomTerminal/WTOLogFile1.asset", LogLoading: true),
WTOBase.ContextualLoadAsset<TerminalNode>("CustomTerminal/WTOLogFile2.asset", LogLoading: true),
WTOBase.ContextualLoadAsset<TerminalNode>("CustomTerminal/WTOLogFile3.asset", LogLoading: true),
WTOBase.ContextualLoadAsset<TerminalNode>("CustomTerminal/WTOLogFile4.asset", LogLoading: true),
WTOBase.ContextualLoadAsset<TerminalNode>("CustomTerminal/WTOLogFile5.asset", LogLoading: true)
};
}
private static void LoadStoryLogs()
{
try
{
Object.FindObjectOfType<Terminal>().logEntryFiles.First((TerminalNode x) => x.creatureName == NodeList[0].creatureName);
return;
}
catch
{
Log.Info("WTO Story logs not found in list. Attempting to add...");
}
int num = Object.FindObjectOfType<Terminal>().logEntryFiles.Count;
TerminalKeyword val = Object.FindObjectOfType<Terminal>().terminalNodes.allKeywords[19];
List<int> list = new List<int> { 5231111, 5231112, 5231113, 5231114, 5231115 };
bool flag = false;
TerminalKeyword[] allKeywords = Object.FindObjectOfType<Terminal>().terminalNodes.allKeywords;
foreach (TerminalKeyword val2 in allKeywords)
{
if (val2.word == "mack1")
{
flag = true;
}
}
for (int j = 0; j < NodeList.Count; j++)
{
Log.Debug($"nextIndex = {num}");
KeywordList[j].defaultVerb = val;
NodeList[j].storyLogFileID = num;
Object.FindObjectOfType<Terminal>().logEntryFiles.Add(NodeList[j]);
try
{
LogDictionary.Add(list[j], num);
}
catch
{
}
if (!flag)
{
Extensions.AddCompatibleNoun(val, KeywordList[j], NodeList[j]);
num++;
}
}
List<TerminalKeyword> list2 = new List<TerminalKeyword>();
list2.AddRange(Object.FindObjectOfType<Terminal>().terminalNodes.allKeywords);
list2.AddRange(KeywordList);
Object.FindObjectOfType<Terminal>().terminalNodes.allKeywords = list2.ToArray();
Log.Info("END ADD WTO STORY LOGS!");
}
}
}
namespace Welcome_To_Ooblterra.Items
{
public class Chemical : GrabbableObject
{
[HideInInspector]
public enum ChemColor
{
Red,
Orange,
Yellow,
Green,
Blue,
Indigo,
Purple,
Clear
}
[InspectorName("Defaults")]
public MeshRenderer BeakerMesh;
public List<AudioClip> ShakeSounds;
private readonly Random MyRandom = new Random();
private float ShakeCooldownSeconds = 0f;
private ChemColor Color = ChemColor.Clear;
private int ScrapValue = 0;
private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(Chemical), LogSourceType.Item);
public override void Start()
{
((GrabbableObject)this).Start();
if (((NetworkBehaviour)this).IsServer)
{
Random random = new Random(StartOfRound.Instance.randomMapSeed);
int num = random.Next(base.itemProperties.minValue, base.itemProperties.maxValue);
num = (int)Mathf.Round((float)num * 0.4f);
SetChemState(RandomColor(), num, playShakeSound: false);
}
}
public override void Update()
{
((GrabbableObject)this).Update();
if (ShakeCooldownSeconds > 0f)
{
ShakeCooldownSeconds -= Time.deltaTime;
}
}
public override void EquipItem()
{
((GrabbableObject)this).EquipItem();
base.playerHeldBy.equippedUsableItemQE = true;
}
public override void ItemInteractLeftRight(bool right)
{
((GrabbableObject)this).ItemInteractLeftRight(right);
if (!right && ShakeCooldownSeconds <= 0f && GetCurrentColor() != ChemColor.Clear)
{
ShakeCooldownSeconds = 1.2f;
base.playerHeldBy.playerBodyAnimator.SetTrigger("shakeItem");
SetChemState(NextColor(Color), ScrapValue, playShakeSound: true);
}
}
private ChemColor RandomColor()
{
return (ChemColor)MyRandom.Next(0, 7);
}
private static ChemColor NextColor(ChemColor color)
{
int num = (int)(color + 1);
int num2 = 6;
return (ChemColor)(num % num2);
}
public void EmptyBeaker()
{
SetChemState(ChemColor.Clear, ScrapValue / 3, playShakeSound: false);
}
public ChemColor GetCurrentColor()
{
return Color;
}
public static Color GetColorFromEnum(ChemColor inColor)
{
//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_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_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_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00bb: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: 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_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_0115: Unknown result type (might be due to invalid IL or missing references)
if (1 == 0)
{
}
Color result = (Color)(inColor switch
{
ChemColor.Red => new Color(1f, 0f, 0f),
ChemColor.Orange => new Color(1f, 0.4f, 0f),
ChemColor.Yellow => new Color(1f, 1f, 0f),
ChemColor.Green => new Color(0f, 1f, 0f),
ChemColor.Blue => new Color(0f, 1f, 1f),
ChemColor.Indigo => new Color(0f, 0f, 1f),
ChemColor.Purple => new Color(1f, 0f, 1f),
ChemColor.Clear => new Color(0f, 0f, 0f, 0f),
_ => new Color(1f, 1f, 1f),
});
if (1 == 0)
{
}
return result;
}
[ServerRpc]
private void SetChemStateServerRpc(ChemColor color, int scrapValue, bool playShakeSound, ServerRpcParams rpcParams = default(ServerRpcParams))
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Invalid comparison between Unknown and I4
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: 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_00c3: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: 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_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2988978897u, rpcParams, (RpcDelivery)0);
((FastBufferWriter)(ref val)).WriteValueSafe<ChemColor>(ref color, default(ForEnums));
BytePacker.WriteValueBitPacked(val, scrapValue);
((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref playShakeSound, default(ForPrimitives));
((NetworkBehaviour)this).__endSendServerRpc(ref val, 2988978897u, rpcParams, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
SetChemStateClientRpc(color, scrapValue, playShakeSound, new ClientRpcParams
{
Send = WTOBase.AllClientsButSender(rpcParams)
});
}
}
[ClientRpc]
private void SetChemStateClientRpc(ChemColor color, int scrapValue, bool playShakeSound, ClientRpcParams rpcParams = default(ClientRpcParams))
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: 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))
{
FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2956456148u, rpcParams, (RpcDelivery)0);
((FastBufferWriter)(ref val)).WriteValueSafe<ChemColor>(ref color, default(ForEnums));
BytePacker.WriteValueBitPacked(val, scrapValue);
((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref playShakeSound, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val, 2956456148u, rpcParams, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
UpdateChemStateOnClient(color, scrapValue, playShakeSound);
}
}
}
private void UpdateChemStateOnClient(ChemColor color, int scrapValue, bool playShakeSound)
{
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
if (playShakeSound)
{
((Component)this).GetComponent<AudioSource>().PlayOneShot(ShakeSounds[MyRandom.Next(0, ShakeSounds.Count - 1)]);
}
Color = color;
ScrapValue = scrapValue;
((GrabbableObject)this).SetScrapValue(ScrapValue);
((Renderer)BeakerMesh).materials[1].SetColor("_BaseColor", GetColorFromEnum(Color));
}
private void SetChemState(ChemColor color, int scrapValue, bool playShakeSound)
{
//IL_0050: 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_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)
Log.Info($"Next Color Value: {color}");
if (((NetworkBehaviour)this).IsClient)
{
UpdateChemStateOnClient(color, scrapValue, playShakeSound);
SetChemStateServerRpc(color, scrapValue, playShakeSound);
}
else
{
SetChemStateClientRpc(color, scrapValue, playShakeSound);
}
}
protected override void __initializeVariables()
{
((GrabbableObject)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
((NetworkBehaviour)this).__registerRpc(2988978897u, new RpcReceiveHandler(__rpc_handler_2988978897), "SetChemStateServerRpc");
((NetworkBehaviour)this).__registerRpc(2956456148u, new RpcReceiveHandler(__rpc_handler_2956456148), "SetChemStateClientRpc");
((GrabbableObject)this).__initializeRpcs();
}
private static void __rpc_handler_2988978897(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//I