using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
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 HarmonyLib;
using Microsoft.CodeAnalysis;
using MyceliumNetworking;
using Photon.Pun;
using Steamworks;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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]
[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]
[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 Spookdivers
{
public class CustomButton : Interactable
{
private static bool Clicked
{
get
{
return Plugin.Instance.CalledBellButtonClicked;
}
set
{
Plugin.Instance.CalledBellButtonClicked = value;
}
}
private static DivingBell[] DivingBells => Plugin.Instance.DivingBells;
private void Update()
{
((Interactable)this).hoverText = "Call the Diving Bell";
}
public override void Interact(Player player)
{
if (!Clicked)
{
Clicked = true;
int num = 0;
do
{
num = Random.Range(0, DivingBells.Length);
}
while (((Component)DivingBells[num]).gameObject.activeSelf);
MyceliumNetwork.RPC((uint)Plugin.ModID, "DivingBellButtonClicked", (ReliableType)1, new object[1] { num });
}
}
public override bool IsValid(Player player)
{
if (Clicked)
{
return false;
}
((Interactable)this).hoverText = "Call the Diving Bell";
return true;
}
}
public class FakeCustomButton : Interactable
{
private static bool Clicked
{
get
{
return Plugin.Instance.CalledFakeBellButtonClicked;
}
set
{
Plugin.Instance.CalledFakeBellButtonClicked = value;
}
}
private static DivingBell[] DivingBells => Plugin.Instance.DivingBells;
private void Update()
{
((Interactable)this).hoverText = "Call the Diving Bell";
}
public override void Interact(Player player)
{
if (!Clicked)
{
Clicked = true;
int num = 0;
do
{
num = Random.Range(0, DivingBells.Length);
}
while (((Component)DivingBells[num]).gameObject.activeSelf);
int num2 = Random.Range(0, 5);
MyceliumNetwork.RPC((uint)Plugin.ModID, "FakeDivingBellButtonClicked", (ReliableType)1, new object[2] { num, num2 });
}
}
public override bool IsValid(Player player)
{
if (Clicked)
{
return false;
}
((Interactable)this).hoverText = "Call the Diving Bell";
return true;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "cheese.spookdivers";
public const string PLUGIN_NAME = "Spookdivers";
public const string PLUGIN_VERSION = "1.0.4";
}
[BepInPlugin("cheese.spookdivers", "Spookdivers", "1.0.5")]
public class Plugin : BaseUnityPlugin
{
internal static readonly ushort ModID;
private static int _day;
private const int ButtonCountFactory = 4;
private static readonly Vector3[] ButtonPositionsFactory;
private static readonly Quaternion[] ButtonRotationsFactory;
private const int ButtonCountHarbor = 4;
private static readonly Vector3[] ButtonPositionsHarbor;
private static readonly Quaternion[] ButtonRotationsHarbor;
private const int ButtonCountMines = 4;
private static readonly Vector3[] ButtonPositionsMines;
private static readonly Quaternion[] ButtonRotationsMines;
internal ConfigEntry<float> ReadyTime;
internal ConfigEntry<bool> ForceScene;
internal ConfigEntry<string> SceneName;
internal ConfigEntry<bool> FakeBellsConfig;
internal ConfigEntry<float> LoweringSpeedConfig;
private int _playerCount = 1;
internal DivingBell[] DivingBells = Array.Empty<DivingBell>();
private bool _isInPhaseState;
private bool _isInReadyState;
internal bool CalledBellButtonClicked;
internal bool CalledFakeBellButtonClicked;
private bool _evening;
public static Plugin Instance { get; private set; }
private static ManualLogSource Logger { get; set; }
private static Harmony? Harmony { get; set; }
private static int PlayerCountReady
{
get
{
return MyceliumNetwork.GetLobbyData<int>("ReadyPlayers");
}
set
{
MyceliumNetwork.SetLobbyData("ReadyPlayers", (object)value);
}
}
private bool IsHost => PhotonNetwork.IsMasterClient;
private static bool StartedWithoutDivingBell
{
get
{
return MyceliumNetwork.GetLobbyData<bool>("StartedWithoutDivingBell");
}
set
{
MyceliumNetwork.SetLobbyData("StartedWithoutDivingBell", (object)value);
}
}
internal static bool FakeBells
{
get
{
return MyceliumNetwork.GetLobbyData<bool>("FakeBells");
}
set
{
MyceliumNetwork.SetLobbyData("FakeBells", (object)value);
}
}
internal static int RandomID
{
get
{
return MyceliumNetwork.GetLobbyData<int>("RandomID");
}
set
{
MyceliumNetwork.SetLobbyData("RandomID", (object)value);
}
}
internal static int FakeBellRandomID
{
get
{
return MyceliumNetwork.GetLobbyData<int>("FakeBellRandomID");
}
set
{
MyceliumNetwork.SetLobbyData("FakeBellRandomID", (object)value);
}
}
internal static float LoweringSpeed
{
get
{
return MyceliumNetwork.GetLobbyData<float>("LoweringSpeed");
}
set
{
MyceliumNetwork.SetLobbyData("LoweringSpeed", (object)value);
}
}
private void Start()
{
SceneManager.sceneLoaded += OnSceneLoaded;
MyceliumNetwork.RegisterNetworkObject((object)this, (uint)ModID, 0);
MyceliumNetwork.RegisterLobbyDataKey("ReadyPlayers");
MyceliumNetwork.RegisterLobbyDataKey("StartedWithoutDivingBell");
MyceliumNetwork.RegisterLobbyDataKey("RandomID");
MyceliumNetwork.RegisterLobbyDataKey("FakeBells");
MyceliumNetwork.RegisterLobbyDataKey("FakeBellRandomID");
MyceliumNetwork.RegisterLobbyDataKey("LoweringSpeed");
MyceliumNetwork.PlayerEntered += delegate
{
_playerCount++;
};
MyceliumNetwork.PlayerLeft += delegate
{
_playerCount--;
};
}
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
Instance.ReadyTime = ((BaseUnityPlugin)this).Config.Bind<float>("SETTINGS", "ReadyTime", 30f, "Time to wait for all players to be ready.");
Instance.ForceScene = ((BaseUnityPlugin)this).Config.Bind<bool>("SETTINGS", "ForceScene", false, "Forces the scene to change. (HOST ONLY)");
Instance.SceneName = ((BaseUnityPlugin)this).Config.Bind<string>("SETTINGS", "SceneName", "FactoryScene", "Scene to force change to [FactoryScene, HarbourScene, MinesScene] (HOST ONLY)");
Instance.FakeBellsConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("SETTINGS", "FakeBells", false, "Enables fake diving bells, they are somewhat distinguishable from the real ones. (HOST ONLY)");
Instance.LoweringSpeedConfig = ((BaseUnityPlugin)this).Config.Bind<float>("SETTINGS", "LoweringSpeed", 2f, "Speed at which the diving bell will lower. (HOST ONLY)");
Patch();
Logger.LogInfo((object)"cheese.spookdivers v1.0.5 has loaded!");
}
private static void Patch()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
if (Harmony == null)
{
Harmony = new Harmony("cheese.spookdivers");
}
Logger.LogDebug((object)"Patching...");
Harmony.PatchAll();
Logger.LogDebug((object)"Finished patching!");
}
private void Update()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
//IL_0074: 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)
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name != "SurfaceScene" || SurfaceNetworkHandler.RoomStats == null || (Object)Player.localPlayer == (Object)null)
{
return;
}
if (SurfaceNetworkHandler.RoomStats.CurrentQuotaDay != _day)
{
_day = SurfaceNetworkHandler.RoomStats.CurrentQuotaDay;
CheckForEvening();
}
if (!_evening)
{
if (Player.localPlayer.refs.headPos.position.y < -50f && !_isInPhaseState)
{
_isInPhaseState = true;
BlackScreen.instance.SetBlackScreen(60f);
Logger.LogInfo((object)"Waiting for other players to join!");
}
if (Player.localPlayer.refs.headPos.position.y < -90f && !_isInReadyState)
{
FreezePlayer();
Ready();
Logger.LogInfo((object)"Player is ready");
((MonoBehaviour)this).StartCoroutine(ReadyState("FactoryScene", ReadyTime.Value));
}
}
}
private IEnumerator ReadyState(string sceneName, float time)
{
for (float secondsWaited = 0f; secondsWaited < time; secondsWaited += 1f)
{
if (IsHost && _playerCount == PlayerCountReady)
{
Logger.LogInfo((object)"All players are ready! Starting the game!");
yield return (object)new WaitForSeconds(3f);
string text = new List<string> { "FactoryScene", "MinesScene", "HarbourScene" }[SurfaceNetworkHandler.RoomStats.LevelToPlay];
if (ForceScene.Value)
{
text = SceneName.Value;
}
PhotonNetwork.LoadLevel(text);
StartedWithoutDivingBell = true;
yield break;
}
yield return (object)new WaitForSeconds(1f);
}
UnfreezePlayer();
yield return (object)new WaitForSeconds(1f);
NotReady();
}
[CustomRPC]
public void DivingBellButtonClicked(int randomID, RPCInfo info)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
Debug.Log((object)(SteamFriends.GetFriendPersonaName(info.SenderSteamID) + " called the diving bell!"));
CalledBellButtonClicked = true;
HelmetText.Instance.SetHelmetText("The Diving Bell has been called!", 2f);
DivingBell divingBell = DivingBells[randomID];
Vector3 oldPosition = ((Component)divingBell).transform.position;
((Component)divingBell).transform.position = new Vector3(oldPosition.x, 150f, oldPosition.z);
((MonoBehaviour)this).StartCoroutine(MoveBellDown(LoweringSpeed));
Logger.LogInfo((object)("Activated Diving Bell: " + randomID));
IEnumerator MoveBellDown(float speed)
{
yield return (object)new WaitForSeconds(5f);
((Component)divingBell).gameObject.SetActive(true);
while (((Component)divingBell).transform.position.y > oldPosition.y)
{
Transform transform = ((Component)divingBell).transform;
transform.position -= new Vector3(0f, speed * Time.deltaTime, 0f);
yield return null;
}
divingBell.RPC_Open();
}
}
[CustomRPC]
public void FakeDivingBellButtonClicked(int randomID, int randomMod, RPCInfo info)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: 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_0093: Unknown result type (might be due to invalid IL or missing references)
Debug.Log((object)(SteamFriends.GetFriendPersonaName(info.SenderSteamID) + " called the diving bell!"));
CalledFakeBellButtonClicked = true;
HelmetText.Instance.SetHelmetText("The Diving Bell has been called!", 2f);
DivingBell divingBell = DivingBells[randomID];
Vector3 oldPosition = ((Component)divingBell).transform.position;
((Component)divingBell).transform.position = new Vector3(oldPosition.x, 150f, oldPosition.z);
((MonoBehaviour)this).StartCoroutine(MoveBellDown(LoweringSpeed));
Logger.LogInfo((object)("Activated Diving Bell: " + randomID));
IEnumerator MoveBellDown(float speed)
{
yield return (object)new WaitForSeconds(5f);
((Component)divingBell).gameObject.SetActive(true);
while (((Component)divingBell).transform.position.y > oldPosition.y)
{
Transform transform = ((Component)divingBell).transform;
transform.position -= new Vector3(0f, speed * Time.deltaTime, 0f);
yield return null;
}
GameObject light;
switch (randomMod)
{
case 0:
((Component)((Component)((Component)((Component)((Component)((Component)((Component)divingBell).transform.GetChild(2)).transform.GetChild(2)).transform.GetChild(0)).transform.GetChild(1)).transform.GetChild(0)).transform).GetComponent<TMP_Text>().text = "DiveOS V0.00rc";
break;
case 1:
((Component)((Component)((Component)((Component)((Component)((Component)((Component)divingBell).transform.GetChild(2)).transform.GetChild(2)).transform.GetChild(0)).transform.GetChild(1)).transform.GetChild(2)).transform).GetComponent<TMP_Text>().text = "You are being watched";
break;
case 2:
((Component)((Component)((Component)divingBell).transform.GetChild(2)).transform.GetChild(1)).gameObject.SetActive(false);
break;
case 3:
((Component)((Component)((Component)divingBell).transform.GetChild(2)).transform.GetChild(1)).gameObject.SetActive(false);
break;
case 4:
light = ((Component)((Component)((Component)divingBell).transform.GetChild(1)).transform.GetChild(8)).gameObject;
((MonoBehaviour)this).StartCoroutine(FlickerLight());
break;
}
divingBell.RPC_Open();
((MonoBehaviour)this).StartCoroutine(WaitForPlayer());
IEnumerator FlickerLight()
{
while (((Component)divingBell).gameObject.activeSelf)
{
light.SetActive(true);
yield return (object)new WaitForSeconds(Random.Range(5f, 15f));
light.SetActive(false);
yield return (object)new WaitForSeconds(Random.Range(0.1f, 0.5f));
}
}
}
IEnumerator WaitForPlayer()
{
while (divingBell.playerDetector.CheckForPlayers().Count == 0)
{
yield return (object)new WaitForSeconds(1f);
}
ICollection<Player> players = divingBell.playerDetector.CheckForPlayers();
((MonoBehaviour)this).StartCoroutine(divingBell.door.Close());
divingBell.LockDoors();
((MonoBehaviour)this).StartCoroutine(CheckAndKill());
yield return (object)new WaitForSeconds(3f);
while (((Component)divingBell).transform.position.y < 150f)
{
Transform transform = ((Component)divingBell).transform;
transform.position += new Vector3(0f, 1f * Time.deltaTime, 0f);
yield return null;
}
((Component)divingBell).gameObject.SetActive(false);
IEnumerator CheckAndKill()
{
while (true)
{
bool flag = false;
foreach (Player item in players)
{
if (!divingBell.playerDetector.CheckForPlayers().Contains(item))
{
item.Die();
}
if (!item.data.dead)
{
flag = true;
}
}
if (!flag)
{
break;
}
yield return (object)new WaitForSeconds(1f);
}
}
}
}
[CustomRPC]
public void RPC_MakeStaticSeed(int seed, RPCInfo info)
{
Random.InitState(seed);
}
public void Ready()
{
_isInReadyState = true;
_isInPhaseState = true;
MyceliumNetwork.RPC((uint)ModID, "ReadyStatusReceived", (ReliableType)1, new object[1] { "ready" });
}
public void NotReady()
{
_isInReadyState = false;
_isInPhaseState = false;
BlackScreen.instance.blackScreenForSeconds = 0f;
MyceliumNetwork.RPC((uint)ModID, "ReadyStatusReceived", (ReliableType)1, new object[1] { "not ready" });
}
[CustomRPC]
public void ReadyStatusReceived(string message, RPCInfo info)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
string friendPersonaName = SteamFriends.GetFriendPersonaName(info.SenderSteamID);
if (message == "ready")
{
Debug.Log((object)(friendPersonaName + " is Ready!"));
PlayerCountReady++;
}
else
{
Debug.Log((object)(friendPersonaName + " is not Ready!"));
PlayerCountReady--;
}
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
//IL_0284: Unknown result type (might be due to invalid IL or missing references)
Random.InitState((int)DateTime.Now.Ticks);
_isInReadyState = false;
_isInPhaseState = false;
DivingBells = Array.Empty<DivingBell>();
CalledBellButtonClicked = false;
CalledFakeBellButtonClicked = false;
if (!PhotonNetwork.InRoom)
{
return;
}
RandomID = -1;
FakeBellRandomID = -1;
PlayerCountReady = 0;
_playerCount = PhotonNetwork.CurrentRoom.PlayerCount;
if (((Scene)(ref scene)).name == "SurfaceScene")
{
StartedWithoutDivingBell = false;
if (IsHost)
{
FakeBells = FakeBellsConfig.Value;
LoweringSpeed = LoweringSpeedConfig.Value;
}
((MonoBehaviour)this).StartCoroutine(Check());
}
bool flag;
switch (((Scene)(ref scene)).name)
{
case "FactoryScene":
case "HarbourScene":
case "MinesScene":
flag = true;
break;
default:
flag = false;
break;
}
if (!flag || !StartedWithoutDivingBell)
{
return;
}
int num = 0;
switch (((Scene)(ref scene)).name)
{
case "FactoryScene":
num = 4;
break;
case "HarbourScene":
num = 4;
break;
case "MinesScene":
num = 4;
break;
}
if (RandomID == -1)
{
RandomID = Random.Range(0, num);
}
if (FakeBells && FakeBellRandomID == -1)
{
do
{
FakeBellRandomID = Random.Range(0, num);
}
while (FakeBellRandomID == RandomID);
}
GameObject val = null;
if (((Scene)(ref scene)).name == "FactoryScene")
{
val = GameObject.Find("Spawns");
}
else if (((Scene)(ref scene)).name == "HarbourScene")
{
val = GameObject.Find("DiveBells");
}
else if (((Scene)(ref scene)).name == "MinesScene")
{
val = ((Component)GameObject.Find("Misc").transform.GetChild(3)).gameObject;
}
DivingBells = val.GetComponentsInChildren<DivingBell>();
DivingBell[] divingBells = DivingBells;
foreach (DivingBell val2 in divingBells)
{
if (((Component)val2).gameObject.activeSelf)
{
if (((Scene)(ref scene)).name == "MinesScene")
{
((Component)((Component)val2).transform.Find("Spawns")).gameObject.transform.position = new Vector3(140f, 80f, 80f);
}
else
{
((Component)((Component)val2).transform.Find("Spawns")).gameObject.transform.position = new Vector3(0f, 70f, 0f);
}
}
}
GameObject button = ((Component)((Component)((Component)val.transform.GetChild(0)).transform.GetChild(2)).transform.GetChild(1)).gameObject;
((MonoBehaviour)this).StartCoroutine(Async());
IEnumerator Async()
{
while ((Object)Player.localPlayer == (Object)null)
{
yield return null;
}
DivingBell[] divingBells2 = DivingBells;
for (int j = 0; j < divingBells2.Length; j++)
{
((Component)divingBells2[j]).gameObject.SetActive(false);
}
GameObject gameObject = ((Component)DivingBells[^1]).gameObject;
((Object)gameObject).name = "SpawnFixBell";
gameObject.transform.position = new Vector3(0f, 1000f, 0f);
gameObject.SetActive(true);
Array.Resize(ref DivingBells, DivingBells.Length + 1);
FreezePlayer();
if (((Scene)(ref scene)).name == "FactoryScene")
{
FactoryTeleportRandom();
}
else if (((Scene)(ref scene)).name == "HarbourScene")
{
HarborTeleportRandom();
}
else if (((Scene)(ref scene)).name == "MinesScene")
{
MinesTeleportRandom();
}
UnfreezePlayer();
yield return (object)new WaitForSeconds(8f);
switch (_day)
{
case 1:
HelmetText.Instance.SetHelmetText("What have you done?", 2f);
yield return (object)new WaitForSeconds(4f);
HelmetText.Instance.SetHelmetText("You need to find a way back...", 2f);
break;
case 2:
HelmetText.Instance.SetHelmetText("Now this is more than just a \"slip\"...", 2f);
break;
default:
HelmetText.Instance.SetHelmetText("Well you know the drill...", 2f);
break;
}
Vector3[] array = (Vector3[])(object)new Vector3[0];
Quaternion[] array2 = (Quaternion[])(object)new Quaternion[0];
if (((Scene)(ref scene)).name == "FactoryScene")
{
array = ButtonPositionsFactory;
array2 = ButtonRotationsFactory;
}
else if (((Scene)(ref scene)).name == "HarbourScene")
{
array = ButtonPositionsHarbor;
array2 = ButtonRotationsHarbor;
}
else if (((Scene)(ref scene)).name == "MinesScene")
{
array = ButtonPositionsMines;
array2 = ButtonRotationsMines;
}
GameObject obj = Object.Instantiate<GameObject>(button, array[RandomID], array2[RandomID]);
obj.transform.localScale = new Vector3(10f, 10f, 5f);
((Object)obj).name = "CallDivingBellButton";
Object.Destroy((Object)obj.GetComponent<UseDivingBellButton>());
obj.AddComponent<CustomButton>();
obj.SetActive(true);
if (FakeBells)
{
GameObject obj2 = Object.Instantiate<GameObject>(button, array[FakeBellRandomID], array2[FakeBellRandomID]);
obj2.transform.localScale = new Vector3(10f, 10f, 5f);
((Object)obj2).name = "CallFakeDivingBellButton";
Object.Destroy((Object)obj2.GetComponent<UseDivingBellButton>());
obj2.AddComponent<FakeCustomButton>();
obj2.SetActive(true);
if (IsHost)
{
MyceliumNetwork.RPC((uint)ModID, "RPC_MakeStaticSeed", (ReliableType)1, new object[1] { RandomStateS0() });
}
}
}
IEnumerator Check()
{
yield return (object)new WaitForSeconds(3f);
CheckForEvening();
}
}
private static int RandomStateS0()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
return (int)typeof(State).GetField("s0", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(Random.state);
}
private void TeleportPlayer(Vector3 newPosition, Vector3 newForward)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_0050: 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)
if ((Object)Player.localPlayer == (Object)null)
{
Logger.LogInfo((object)"Player object is null");
return;
}
MethodInfo method = typeof(Player).GetMethod("Teleport", BindingFlags.Instance | BindingFlags.NonPublic);
if (method != null)
{
method.Invoke(Player.localPlayer, new object[2] { newPosition, newForward });
}
else
{
Logger.LogInfo((object)"Teleport method not found");
}
}
private void FactoryTeleportRandom()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: 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)
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor((float)Random.Range(-120, 60), 80f, (float)Random.Range(-120, 60));
Vector3 newForward = default(Vector3);
((Vector3)(ref newForward))..ctor(val.x, 0f, val.z);
TeleportPlayer(val, newForward);
}
private void HarborTeleportRandom()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: 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)
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor((float)Random.Range(-48, 45), 80f, (float)Random.Range(0, 12));
Vector3 newForward = default(Vector3);
((Vector3)(ref newForward))..ctor(val.x, 0f, val.z);
TeleportPlayer(val, newForward);
}
private void MinesTeleportRandom()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = ((Vector3[])(object)new Vector3[4]
{
new Vector3((float)Random.Range(126, 140), 80f, (float)Random.Range(80, 100)),
new Vector3((float)Random.Range(4, 20), 60f, (float)Random.Range(62, 65)),
new Vector3((float)Random.Range(60, 80), 50f, (float)Random.Range(111, 130)),
new Vector3((float)Random.Range(0, 10), 56f, (float)Random.Range(-3, 8))
})[Random.Range(0, 4)];
Vector3 newForward = default(Vector3);
((Vector3)(ref newForward))..ctor(val.x, 0f, val.z);
TeleportPlayer(val, newForward);
}
protected void CheckForEvening()
{
GameObject gameObject = ((Component)GameObject.Find("Misc").transform.GetChild(4)).gameObject;
_evening = gameObject.activeSelf;
}
private void FreezePlayer()
{
MyceliumNetwork.RPC((uint)ModID, "RPC_FreezePlayer", (ReliableType)1, new object[1] { Player.localPlayer.refs.view.ViewID });
}
private void UnfreezePlayer()
{
MyceliumNetwork.RPC((uint)ModID, "RPC_UnFreezePlayer", (ReliableType)1, new object[1] { Player.localPlayer.refs.view.ViewID });
}
[CustomRPC]
private void RPC_FreezePlayer(int viewID, RPCInfo info)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
object obj = typeof(PlayerHandler).GetMethod("TryGetPlayerFromViewID", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(PlayerHandler.instance, new object[1] { viewID });
((Player)((obj is Player) ? obj : null)).data.gravityDirection = Vector3.zero;
}
[CustomRPC]
private void RPC_UnFreezePlayer(int viewID, RPCInfo info)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
object obj = typeof(PlayerHandler).GetMethod("TryGetPlayerFromViewID", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(PlayerHandler.instance, new object[1] { viewID });
((Player)((obj is Player) ? obj : null)).data.gravityDirection = new Vector3(0f, -1f, 0f);
}
static Plugin()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: 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_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: 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_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_0200: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_0230: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_024b: Unknown result type (might be due to invalid IL or missing references)
//IL_0261: Unknown result type (might be due to invalid IL or missing references)
//IL_0266: Unknown result type (might be due to invalid IL or missing references)
//IL_027c: Unknown result type (might be due to invalid IL or missing references)
//IL_0281: Unknown result type (might be due to invalid IL or missing references)
//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
ModID = (ushort)((object)Hash128.Compute("cheese.spookdivers")/*cast due to .constrained prefix*/).GetHashCode();
_day = 0;
ButtonPositionsFactory = (Vector3[])(object)new Vector3[4]
{
new Vector3(-123.3f, 0.4f, -45.7f),
new Vector3(34.8f, 2.6f, -5.16f),
new Vector3(34.5f, 5.5f, 19f),
new Vector3(3.5f, -19.9f, -9.22f)
};
ButtonRotationsFactory = (Quaternion[])(object)new Quaternion[4]
{
Quaternion.Euler(270f, 0f, 0f),
Quaternion.Euler(0f, 0f, 0f),
Quaternion.Euler(0f, 90f, 0f),
Quaternion.Euler(270f, 0f, 0f)
};
ButtonPositionsHarbor = (Vector3[])(object)new Vector3[4]
{
new Vector3(-22.7f, -1.6f, 29.1f),
new Vector3(-51.6f, -2f, 17.55f),
new Vector3(27.2f, -3.6f, 13.8f),
new Vector3(-1f, -7f, 10.6f)
};
ButtonRotationsHarbor = (Quaternion[])(object)new Quaternion[4]
{
Quaternion.Euler(357f, 22f, 0f),
Quaternion.Euler(272f, 180f, 180f),
Quaternion.Euler(348f, 200f, 0f),
Quaternion.Euler(0f, 295f, 0f)
};
ButtonPositionsMines = (Vector3[])(object)new Vector3[4]
{
new Vector3(12f, -6f, 67.9f),
new Vector3(134.2f, 25.2f, 2.9f),
new Vector3(165.8f, 11f, 55.75f),
new Vector3(152.4f, 7f, 44f)
};
ButtonRotationsMines = (Quaternion[])(object)new Quaternion[4]
{
Quaternion.Euler(0f, 22f, 0f),
Quaternion.Euler(0f, 0f, 0f),
Quaternion.Euler(0f, 0f, 0f),
Quaternion.Euler(0f, 90f, 0f)
};
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}