using System;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using Atlas;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace Packer.SR_SnowFields
{
[BepInPlugin("Packer.SR_SnowFields", "SR_SnowFields", "1.0.1")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("nrgill28.Atlas", "1.0.1")]
public class SR_SnowFieldsPlugin : BaseUnityPlugin
{
private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
internal static ManualLogSource Logger;
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
LoadAssets();
}
private void LoadAssets()
{
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Packer.SR_SnowFields");
AtlasPlugin.RegisterScene(Path.Combine(BasePath, "snowfields"));
}
}
}
public class CameraRange : MonoBehaviour
{
public float minDistance = 0.02f;
public float maxDistance = 3500f;
private Camera[] cameras;
private GameObject[] dndObjects;
private void Start()
{
((MonoBehaviour)this).Invoke("DelayedStart", 5f);
}
private void DelayedStart()
{
Debug.Log((object)"Attempting to find cameras");
dndObjects = GetDontDestroyOnLoadObjects();
cameras = Object.FindObjectsOfType<Camera>();
for (int i = 0; i < cameras.Length; i++)
{
Debug.Log((object)("Camera " + i + " default Near/Far values: " + cameras[i].nearClipPlane + " / " + cameras[i].farClipPlane));
cameras[i].nearClipPlane = minDistance;
cameras[i].farClipPlane = maxDistance;
}
if (dndObjects == null)
{
return;
}
for (int j = 0; j < dndObjects.Length; j++)
{
Camera component = dndObjects[j].GetComponent<Camera>();
if ((Object)(object)component != (Object)null)
{
Debug.Log((object)("DnD Camera " + j + " default Near/Far values: " + component.nearClipPlane + " / " + component.farClipPlane));
component.nearClipPlane = minDistance;
component.farClipPlane = maxDistance;
}
}
}
public static GameObject[] GetDontDestroyOnLoadObjects()
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Expected O, but got Unknown
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
GameObject val = null;
try
{
val = new GameObject();
Object.DontDestroyOnLoad((Object)(object)val);
Scene scene = val.scene;
Object.DestroyImmediate((Object)(object)val);
val = null;
return ((Scene)(ref scene)).GetRootGameObjects();
}
finally
{
if ((Object)(object)val != (Object)null)
{
Object.DestroyImmediate((Object)(object)val);
}
}
}
}
namespace Packer
{
[RequireComponent(typeof(AudioSource))]
public class Door : MonoBehaviour
{
[Tooltip("How fast the door opens (Meters a second)")]
public float doorSpeed = 1f;
[Tooltip("Default State of this door")]
public bool open = false;
[Tooltip("The closed local position of the door")]
public Vector3 closeOffset;
[Tooltip("The opened local position of the door")]
public Vector3 openOffset;
public AudioClip openSound;
public AudioClip closeSound;
private AudioSource audioSource;
private void Update()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
if (open && ((Component)this).transform.localPosition != openOffset)
{
((Component)this).transform.localPosition = Vector3.MoveTowards(((Component)this).transform.localPosition, openOffset, doorSpeed * Time.deltaTime);
}
else if (!open && ((Component)this).transform.localPosition != closeOffset)
{
((Component)this).transform.localPosition = Vector3.MoveTowards(((Component)this).transform.localPosition, closeOffset, doorSpeed * Time.deltaTime);
}
}
public void SetDoor(bool state)
{
open = state;
if (open)
{
if ((Object)(object)openSound != (Object)null)
{
audioSource.PlayOneShot(openSound);
}
}
else if ((Object)(object)closeSound != (Object)null)
{
audioSource.PlayOneShot(closeSound);
}
}
public void SetOpenOffset()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
if (!ErrorCheck())
{
openOffset = ((Component)this).transform.localPosition;
}
}
public void SetCloseOffset()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
if (!ErrorCheck())
{
closeOffset = ((Component)this).transform.localPosition;
}
}
public void MoveToOpenOffset()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
if (!ErrorCheck())
{
((Component)this).transform.localPosition = openOffset;
}
}
public void MoveToCloseOffset()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
if (!ErrorCheck())
{
((Component)this).transform.localPosition = closeOffset;
}
}
private bool ErrorCheck()
{
if ((Object)(object)((Component)this).transform.parent == (Object)null)
{
Debug.LogError((object)(((Object)this).name + " is missing a parent gameobject"));
return true;
}
return false;
}
}
[RequireComponent(typeof(AudioSource), typeof(BoxCollider))]
public class DoorSwitch : MonoBehaviour
{
[Tooltip("All the doors that will be triggered when this switch is hit")]
public Door[] doors;
[Tooltip("All Switches that will be set to this switches state")]
public DoorSwitch[] switches;
[Tooltip("Default switch state")]
public bool switchState = false;
public AudioClip openSound;
public AudioClip closeSound;
private BoxCollider triggerZone;
private LayerMask mask;
private AudioSource audioSource;
private float timeout = 0f;
private void Start()
{
audioSource = ((Component)this).GetComponent<AudioSource>();
triggerZone = ((Component)this).GetComponent<BoxCollider>();
((Collider)triggerZone).isTrigger = true;
((Component)this).gameObject.layer = LayerMask.NameToLayer("Enviroment");
}
private void Update()
{
if (timeout > 0f)
{
timeout = Mathf.Clamp(timeout -= Time.deltaTime, 0f, 1f);
}
}
private void ToggleDoors()
{
switchState = !switchState;
for (int i = 0; i < doors.Length; i++)
{
if ((Object)(object)doors[i] != (Object)null)
{
doors[i].SetDoor(switchState);
}
}
for (int j = 0; j < switches.Length; j++)
{
if ((Object)(object)switches[j] != (Object)null)
{
switches[j].switchState = switchState;
}
}
if (switchState)
{
if ((Object)(object)openSound != (Object)null)
{
audioSource.PlayOneShot(openSound);
}
}
else if ((Object)(object)closeSound != (Object)null)
{
audioSource.PlayOneShot(closeSound);
}
}
private void OnTriggerEnter(Collider collider)
{
if (!(timeout > 0f))
{
timeout = 1f;
ToggleDoors();
}
}
}
[ExecuteInEditMode]
public class GameObjectReplacer : MonoBehaviour
{
public enum ReplaceModeEnum
{
ReplaceAndDestroy,
HideAndKeepOld
}
public ReplaceModeEnum mode = ReplaceModeEnum.ReplaceAndDestroy;
public GameObject prefab;
public GameObject[] replaceGameObjects;
public void ReplaceGameObjects()
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)prefab == (Object)null)
{
Debug.LogError((object)"GAMEOBJECT REPLACER IS MISSING A PREFAB");
return;
}
for (int i = 0; i < replaceGameObjects.Length; i++)
{
if (!((Object)(object)replaceGameObjects[i] == (Object)null))
{
GameObject val = Object.Instantiate<GameObject>(prefab, replaceGameObjects[i].transform.position, replaceGameObjects[i].transform.rotation, replaceGameObjects[i].transform.parent);
switch (mode)
{
case ReplaceModeEnum.ReplaceAndDestroy:
val.SetActive(replaceGameObjects[i].activeSelf);
Object.DestroyImmediate((Object)(object)replaceGameObjects[i]);
break;
case ReplaceModeEnum.HideAndKeepOld:
replaceGameObjects[i].SetActive(false);
break;
}
}
}
replaceGameObjects = (GameObject[])(object)new GameObject[0];
}
}
}
public class KillTrigger : MonoBehaviour
{
private Bounds bounds;
private void Start()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
((Bounds)(ref bounds)).center = ((Component)this).transform.position;
((Bounds)(ref bounds)).size = ((Component)this).transform.localScale;
}
private void Update()
{
if (WithinTrigger())
{
GM.CurrentPlayerBody.KillPlayer(true);
}
}
private bool WithinTrigger()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
if (((Bounds)(ref bounds)).Contains(GM.CurrentPlayerBody.Head.position))
{
return true;
}
return false;
}
private void OnDrawGizmos()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: 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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
Gizmos.color = Color.red;
Gizmos.DrawWireCube(((Component)this).transform.position, ((Component)this).transform.lossyScale * 2f);
Gizmos.color = new Color(1f, 0f, 0f, 0.25f);
Gizmos.DrawCube(((Component)this).transform.position, ((Component)this).transform.lossyScale * 2f);
}
}
namespace Packer
{
public class Rotator : MonoBehaviour
{
private void Update()
{
((Component)this).transform.Rotate(0f, 20f, 0f);
}
}
public class TimeOfDay : MonoBehaviour
{
[Serializable]
public class Sky
{
public string name;
public Material skybox;
[Range(0f, 1f)]
public float lightIntensity = 1f;
public bool fogEnabled = false;
public Color fogColor = Color.white;
public int fogMin = 0;
public int fogMax = 1000;
[Header("Sun")]
public Color sunColor;
public Vector3 sunDirection;
}
public int defaultSky = 0;
public Light sun;
public Sky[] skies;
private void Start()
{
SetSky(defaultSky);
}
public void SetSky(int i)
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
RenderSettings.skybox = skies[i].skybox;
RenderSettings.ambientIntensity = skies[i].lightIntensity;
RenderSettings.fog = skies[i].fogEnabled;
RenderSettings.fogColor = skies[i].fogColor;
RenderSettings.fogStartDistance = skies[i].fogMin;
RenderSettings.fogEndDistance = skies[i].fogMax;
((Component)sun).transform.rotation = Quaternion.Euler(skies[i].sunDirection);
sun.color = skies[i].sunColor;
}
}
public class TriggerSystem : MonoBehaviour
{
public int index = 0;
public virtual void InvokeTrigger(TriggerSystem invoker)
{
}
private void Start()
{
Debug.Log((object)"Alive");
}
}
public class TriggerZone : TriggerSystem
{
public TriggerSystem triggerSystem;
private void OnTriggerEnter(Collider collider)
{
triggerSystem.InvokeTrigger(this);
}
}
}