using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using Microsoft.CodeAnalysis;
using Sodalite.Api;
using SupplyRaid;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using Valve.VR;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("Packer")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("MGS Library")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+9d7f3ea8faf347c9e762f202b2fc221e3e52ece0")]
[assembly: AssemblyProduct("Packer.MGSPlugin")]
[assembly: AssemblyTitle("MGS Plugin")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[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 BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string id = null, string name = null, string version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string id = null, string name = null, string version = null)
{
}
}
}
namespace MGS
{
public class MGS_Area : MonoBehaviour
{
[CompilerGenerated]
private sealed class <ClearSosig>d__22 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public Sosig sosig;
public MGS_Area <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ClearSosig>d__22(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(10f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if ((Object)(object)sosig != (Object)null)
{
sosig.ClearSosig();
}
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[] areaObjects;
public MGS_Area[] connectedAreas;
public Transform[] respawnPoints;
public MGS_SosigSpawner[] spawners;
public Transform items;
public MGS_MusicManager.Music music = MGS_MusicManager.Music.None;
[Header("Sky")]
public float transitionSpeed = 0.2f;
public float fogStart = 10f;
public float fogEnd = 100f;
public Color fogColor = new Color(0f, 0f, 0f);
public Color skyColor = new Color(27f / 34f, 0.9318459f, 1f);
public Color equatorColor = new Color(123f / 136f, 1f, 0.968357f);
public Color groundColor = new Color(0.1946367f, 0.2077019f, 0.2205882f);
public Material skyboxMaterial;
public void SetArea(bool state)
{
MGS_AreaManager.DisableAllAreas();
for (int i = 0; i < areaObjects.Length; i++)
{
if ((Object)(object)areaObjects[i] != (Object)null)
{
areaObjects[i].SetActive(state);
}
}
for (int j = 0; j < connectedAreas.Length; j++)
{
if (!((Object)(object)connectedAreas[j] != (Object)null))
{
continue;
}
SetAreaObjects(connectedAreas[j], state);
if (MGS_Manager.instance.Gamemode != 0)
{
for (int k = 0; k < connectedAreas[j].connectedAreas.Length; k++)
{
SetAreaObjects(connectedAreas[j].connectedAreas[k], state);
}
}
}
MGS_AreaManager.SetArea(this);
MGS_MusicManager.PlayAreaTrack(this);
((Component)items).gameObject.SetActive(MGS_Manager.instance.itemSpawners);
}
private void SetAreaObjects(MGS_Area area, bool state)
{
for (int i = 0; i < area.areaObjects.Length; i++)
{
if ((Object)(object)area.areaObjects[i] != (Object)null)
{
area.areaObjects[i].SetActive(state);
}
}
}
public void ForceSceneSky()
{
//IL_001a: 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_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
RenderSettings.fogStartDistance = fogStart;
RenderSettings.fogEndDistance = fogEnd;
RenderSettings.fogColor = fogColor;
RenderSettings.ambientSkyColor = skyColor;
RenderSettings.ambientEquatorColor = equatorColor;
RenderSettings.ambientGroundColor = groundColor;
RenderSettings.skybox = skyboxMaterial;
MGS_AreaManager.instance.sunLight.color = equatorColor;
}
private void Start()
{
((MonoBehaviour)this).Invoke("DelaySetup", 2f);
}
private void DelaySetup()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected O, but got Unknown
GM.CurrentSceneSettings.SosigKillEvent += new SosigKill(OnSosigDeath);
GM.CurrentSceneSettings.PlayerDeathFromIFFEvent += new PlayerDeathFromIFF(PlayerDeathEvent);
}
private void OnDestroy()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected O, but got Unknown
GM.CurrentSceneSettings.SosigKillEvent -= new SosigKill(OnSosigDeath);
GM.CurrentSceneSettings.PlayerDeathFromIFFEvent -= new PlayerDeathFromIFF(PlayerDeathEvent);
}
private void PlayerDeathEvent(bool killedSelf, int iff)
{
}
private void OnSosigDeath(Sosig s)
{
}
private IEnumerator ClearSosig(Sosig sosig)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ClearSosig>d__22(0)
{
<>4__this = this,
sosig = sosig
};
}
}
public class MGS_AreaManager : MonoBehaviour
{
public static MGS_AreaManager instance;
public Material defaultSkybox;
public Light sunLight;
private MGS_Area currentArea;
public MGS_Area[] areas;
[Header("Used to sort items quickly")]
public GameObject[] allItems;
[Header("Sky")]
public float fogStart = 10f;
public float fogEnd = 100f;
public Color fogColor = Color.black;
public Color skyColor = new Color(27f / 34f, 0.9318459f, 1f);
public Color equatorColor = new Color(123f / 136f, 1f, 0.968357f);
public Color groundColor = new Color(0.1946367f, 0.2077019f, 0.2205882f);
private void Awake()
{
instance = this;
}
private void Start()
{
DisableAllAreas();
}
public static void SortAllItems()
{
//IL_0027: 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)
for (int i = 0; i < instance.allItems.Length; i++)
{
float num = 999f;
MGS_Area mGS_Area = null;
for (int j = 0; j < instance.areas.Length; j++)
{
float num2 = Vector3.Distance(instance.allItems[i].transform.position, ((Component)instance.areas[j]).transform.position);
if (num2 < num)
{
num = num2;
mGS_Area = instance.areas[j];
}
}
if ((Object)(object)mGS_Area != (Object)null)
{
instance.allItems[i].transform.SetParent(mGS_Area.items, true);
}
}
instance.allItems = (GameObject[])(object)new GameObject[0];
}
private void Update()
{
//IL_008c: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: 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_0117: 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_0174: 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_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: 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_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: 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_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: 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_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)currentArea == (Object)null))
{
if (RenderSettings.fogStartDistance != fogStart)
{
RenderSettings.fogStartDistance = Mathf.MoveTowards(RenderSettings.fogStartDistance, fogStart, Time.deltaTime * currentArea.transitionSpeed);
}
if (RenderSettings.fogEndDistance != fogEnd)
{
RenderSettings.fogEndDistance = Mathf.MoveTowards(RenderSettings.fogEndDistance, fogEnd, Time.deltaTime * currentArea.transitionSpeed);
}
if (RenderSettings.fogColor != fogColor)
{
RenderSettings.fogColor = Color.op_Implicit(Vector4.MoveTowards(Color.op_Implicit(RenderSettings.fogColor), Color.op_Implicit(fogColor), Time.deltaTime * currentArea.transitionSpeed));
}
if (RenderSettings.ambientSkyColor != skyColor)
{
RenderSettings.ambientSkyColor = Color.op_Implicit(Vector4.MoveTowards(Color.op_Implicit(RenderSettings.ambientSkyColor), Color.op_Implicit(skyColor), Time.deltaTime * currentArea.transitionSpeed));
}
if (RenderSettings.ambientEquatorColor != equatorColor)
{
RenderSettings.ambientEquatorColor = Color.op_Implicit(Vector4.MoveTowards(Color.op_Implicit(RenderSettings.ambientSkyColor), Color.op_Implicit(equatorColor), Time.deltaTime * currentArea.transitionSpeed));
}
if (RenderSettings.ambientGroundColor != groundColor)
{
RenderSettings.ambientGroundColor = Color.op_Implicit(Vector4.MoveTowards(Color.op_Implicit(RenderSettings.ambientGroundColor), Color.op_Implicit(groundColor), Time.deltaTime * currentArea.transitionSpeed));
}
if (sunLight.color != equatorColor)
{
sunLight.color = Color.op_Implicit(Vector4.MoveTowards(Color.op_Implicit(sunLight.color), Color.op_Implicit(equatorColor), Time.deltaTime * currentArea.transitionSpeed));
}
}
}
public static void ForceSceneSky()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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_0080: Unknown result type (might be due to invalid IL or missing references)
RenderSettings.fogStartDistance = instance.fogStart;
RenderSettings.fogEndDistance = instance.fogEnd;
RenderSettings.fogColor = instance.fogColor;
RenderSettings.ambientSkyColor = instance.skyColor;
RenderSettings.ambientEquatorColor = instance.equatorColor;
RenderSettings.ambientGroundColor = instance.groundColor;
RenderSettings.skybox = instance.defaultSkybox;
instance.sunLight.color = instance.equatorColor;
}
public static void SetArea(MGS_Area area)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: 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)
instance.currentArea = area;
instance.fogColor = area.fogColor;
instance.fogStart = area.fogStart;
instance.fogEnd = area.fogEnd;
instance.skyColor = area.skyColor;
instance.equatorColor = area.equatorColor;
instance.groundColor = area.groundColor;
if ((Object)(object)area.skyboxMaterial != (Object)null)
{
RenderSettings.skybox = area.skyboxMaterial;
}
for (int i = 0; i < instance.areas.Length; i++)
{
if ((Object)(object)instance.areas[i] == (Object)(object)area)
{
MGS_Manager.instance.spawnAreaIndex = i;
}
}
}
public static void DisableAllAreas(MGS_Area ignoreArea = null)
{
if ((Object)(object)instance == (Object)null || instance.areas == null)
{
return;
}
for (int i = 0; i < instance.areas.Length; i++)
{
if (!((Object)(object)instance.areas[i] != (Object)null) || (Object)(object)ignoreArea == (Object)(object)instance.areas[i])
{
continue;
}
if ((Object)(object)instance.areas[i].items != (Object)null)
{
((Component)instance.areas[i].items).gameObject.SetActive(false);
}
for (int j = 0; j < instance.areas[i].areaObjects.Length; j++)
{
if ((Object)(object)instance.areas[i].areaObjects[j] != (Object)null)
{
instance.areas[i].areaObjects[j].SetActive(false);
}
}
}
}
private void OnValidate()
{
if ((Object)(object)instance == (Object)null)
{
instance = this;
}
}
}
public class MGS_AreaTrigger : MonoBehaviour
{
public MGS_Area area;
private void Awake()
{
}
private void OnTriggerEnter(Collider collider)
{
if (((Object)collider).name.Contains("Controller ("))
{
area.SetArea(state: true);
}
}
}
public class MGS_AudioManager : MonoBehaviour
{
public static MGS_AudioManager instance;
public float masterVolume = 0.25f;
public AudioSource[] audioSources;
public AudioSource globalAudioSource;
protected int sourceIndex = 0;
public AudioClip[] audioClips;
private void Awake()
{
instance = this;
}
public static void ChangeMasterVolume(float volume)
{
instance.masterVolume = volume;
instance.globalAudioSource.volume = volume;
for (int i = 0; i < instance.audioSources.Length; i++)
{
instance.audioSources[i].volume = volume;
}
}
public static void PlayOneShot(AudioClipEnum clip, Vector3 position, float pitch = 1f)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
PlayOneShot(instance.audioClips[(int)clip], position, pitch);
}
public static void PlayOneShot(AudioClip clip, Vector3 position, float pitch = 1f)
{
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
instance.audioSources[instance.sourceIndex].Stop();
instance.audioSources[instance.sourceIndex].loop = false;
instance.audioSources[instance.sourceIndex].volume = instance.masterVolume;
((Component)instance.audioSources[instance.sourceIndex]).transform.position = position;
instance.audioSources[instance.sourceIndex].pitch = pitch;
instance.audioSources[instance.sourceIndex].clip = clip;
instance.audioSources[instance.sourceIndex].Play();
instance.sourceIndex++;
if (instance.sourceIndex >= instance.audioSources.Length)
{
instance.sourceIndex = 0;
}
}
public static void PlayGlobalOneShot(AudioClipEnum clip)
{
PlayGlobalOneShot(instance.audioClips[(int)clip]);
}
public static void PlayGlobalOneShot(AudioClip clip)
{
instance.globalAudioSource.PlayOneShot(clip);
}
}
public enum AudioClipEnum
{
ItemEquip,
ItemSpawn,
ButtonBeep,
MenuSelectA,
MenuSelectB,
MenuGunshot,
MenuExit,
DoorLocked,
DoorToggle
}
public class MGS_Backpack : MonoBehaviour
{
public static MGS_Backpack instance;
private void Awake()
{
instance = this;
}
}
public class MGS_Compass : MonoBehaviour
{
public static MGS_Compass instance;
private float distance = 0.225f;
public Slider healthBar;
public Slider bossHealthBar;
public Text bossName;
public Text cardLevelText;
public GameObject cardLevel;
private void Awake()
{
instance = this;
}
private void Start()
{
}
private void Update()
{
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: 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_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)MGS_Manager.instance == (Object)null) && !((Object)(object)GM.CurrentPlayerBody == (Object)null))
{
bool flag = true;
if ((MGS_Manager.instance.Gamemode != 2) ? MGS_Manager.instance.optionHand : (!MGS_SR.GetSRHand()))
{
((Component)this).transform.position = GM.CurrentPlayerBody.LeftHand.position - GM.CurrentPlayerBody.LeftHand.forward * distance;
}
else
{
((Component)this).transform.position = GM.CurrentPlayerBody.RightHand.position - GM.CurrentPlayerBody.RightHand.forward * distance;
}
((Component)this).transform.LookAt(GM.CurrentPlayerBody.headPositionFiltered);
healthBar.value = GM.GetPlayerHealth();
}
}
public static void UpdateCompass()
{
instance.healthBar.maxValue = GM.CurrentPlayerBody.GetMaxHealthPlayerRaw();
if (MGS_Manager.instance.KeycardLevel > 0)
{
instance.cardLevel.SetActive(true);
instance.cardLevelText.text = "LV." + MGS_Manager.instance.KeycardLevel;
}
else
{
instance.cardLevel.SetActive(false);
}
}
}
public class MGS_Destructable : MGS_TriggerSystem, IFVRDamageable
{
public GameObject[] destructableObjects;
public GameObject[] destroyedObjects;
public MGS_TriggerSystem triggerSystem;
[Tooltip("List of blacklisted damage types that will do no damage, e.g. Melee for a tank")]
public DamageClass[] allowedDamageType;
public void Damage(Damage dam)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Invalid comparison between Unknown and I4
for (int i = 0; i < allowedDamageType.Length; i++)
{
if ((int)dam.Class == (int)allowedDamageType[i])
{
Destruct();
break;
}
}
}
public void Destruct()
{
for (int i = 0; i < destroyedObjects.Length; i++)
{
if ((Object)(object)destroyedObjects[i] != (Object)null)
{
destroyedObjects[i].SetActive(true);
}
}
for (int j = 0; j < destructableObjects.Length; j++)
{
if ((Object)(object)destructableObjects[j] != (Object)null)
{
destructableObjects[j].SetActive(false);
}
}
if ((Object)(object)triggerSystem != (Object)null)
{
triggerSystem.InvokeTrigger(this);
}
}
}
public class MGS_Door : MGS_TriggerSystem
{
[Tooltip("What level Keycard is required to open this door")]
public int keycardLevel = 0;
[Tooltip("Can a sosig walk through this door?")]
public bool sosigOpens = false;
[Tooltip("Disabled the game object after opening")]
public bool disableAfterClose = false;
[Header("Door Settings")]
public bool locked = false;
public float doorSpeed = 4f;
public Rigidbody door;
public Transform doorOpenPosition;
public Transform doorClosePosition;
[Header("Audio")]
public AudioClipEnum doorToggleClip = AudioClipEnum.DoorToggle;
public AudioClipEnum doorLocked = AudioClipEnum.DoorLocked;
public AudioClip openSound;
public AudioClip closeSound;
public AudioClip lockedSound;
private bool doorOpen = false;
private bool doorTransision = false;
[Header("Debug")]
public bool debugToggle = false;
private void Start()
{
}
public void OpenDoor()
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_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_002e: Unknown result type (might be due to invalid IL or missing references)
doorOpen = true;
if (Object.op_Implicit((Object)(object)openSound))
{
MGS_AudioManager.PlayOneShot(openSound, ((Component)this).transform.position + Vector3.up);
}
else
{
MGS_AudioManager.PlayOneShot(doorToggleClip, ((Component)this).transform.position + Vector3.up);
}
doorTransision = true;
}
public void CloseDoor()
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_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_002e: Unknown result type (might be due to invalid IL or missing references)
doorOpen = false;
if (Object.op_Implicit((Object)(object)closeSound))
{
MGS_AudioManager.PlayOneShot(closeSound, ((Component)this).transform.position + Vector3.up);
}
else
{
MGS_AudioManager.PlayOneShot(doorToggleClip, ((Component)this).transform.position + Vector3.up);
}
doorTransision = true;
}
private void LockedDoor()
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)lockedSound))
{
MGS_AudioManager.PlayOneShot(lockedSound, ((Component)this).transform.position + Vector3.up);
}
else
{
MGS_AudioManager.PlayOneShot(doorLocked, ((Component)this).transform.position + Vector3.up);
}
}
private void Update()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: 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_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: 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)
if (debugToggle)
{
if (door.position == doorClosePosition.position)
{
OpenDoor();
}
else
{
CloseDoor();
}
debugToggle = false;
}
if (!doorTransision)
{
return;
}
if (doorOpen)
{
door.MovePosition(Vector3.MoveTowards(door.position, doorOpenPosition.position, Time.deltaTime * doorSpeed));
if (door.position == doorOpenPosition.position)
{
doorTransision = false;
}
return;
}
door.MovePosition(Vector3.MoveTowards(door.position, doorClosePosition.position, Time.deltaTime * doorSpeed));
if (door.position == doorClosePosition.position)
{
doorTransision = false;
if (disableAfterClose)
{
((Component)this).gameObject.SetActive(false);
}
}
}
public override void InvokeTrigger(MGS_TriggerSystem invoker)
{
if (index == 1)
{
locked = false;
}
if (MGS_Manager.instance.KeycardLevel >= keycardLevel && !doorOpen && !locked)
{
OpenDoor();
}
else if (locked)
{
LockedDoor();
}
}
private void OnTriggerEnter(Collider other)
{
if (((Object)other).name.Contains("Controller ("))
{
if (MGS_Manager.instance.KeycardLevel >= keycardLevel && !doorOpen && !locked)
{
OpenDoor();
}
else if (locked)
{
LockedDoor();
}
}
else
{
SosigLink component = ((Component)other).gameObject.GetComponent<SosigLink>();
if ((sosigOpens || MGS_Manager.instance.KeycardLevel + 1 >= keycardLevel) && (Object)(object)component != (Object)null)
{
OpenDoor();
}
}
}
private void OnTriggerExit(Collider other)
{
if (((Object)other).name.Contains("Controller ("))
{
if (MGS_Manager.instance.KeycardLevel >= keycardLevel && doorOpen)
{
CloseDoor();
}
return;
}
SosigLink component = ((Component)other).gameObject.GetComponent<SosigLink>();
if ((sosigOpens || MGS_Manager.instance.KeycardLevel + 1 >= keycardLevel) && (Object)(object)component != (Object)null)
{
CloseDoor();
}
}
}
public class MGS_ElevatorSystem : MGS_TriggerSystem
{
[Serializable]
public class Floor
{
public Transform level;
public GameObject Button_On;
public GameObject Button_Off;
public MGS_Door[] ElevatorDoors;
}
[SerializeField]
public Floor[] floors;
public GameObject containCollision;
public Rigidbody elevator;
public float elevatorSpeed = 1.5f;
public int targetFloor = 0;
public bool atTargetFloor = false;
private float timeout = 0f;
public bool debugRandomFloor = false;
private void Start()
{
}
public void SetFloor(int i)
{
if (timeout > 0f)
{
return;
}
atTargetFloor = false;
for (int j = 0; j < floors.Length; j++)
{
for (int k = 0; k < floors[j].ElevatorDoors.Length; k++)
{
floors[j].ElevatorDoors[k].CloseDoor();
}
}
targetFloor = i;
SetAllButtonsOff();
SetFloorButton(i, set: true);
if ((Object)(object)containCollision != (Object)null)
{
containCollision.SetActive(true);
}
timeout = 1f;
}
private void SetAllButtonsOff()
{
for (int i = 0; i < floors.Length; i++)
{
SetFloorButton(i, set: false);
}
}
private void SetFloorButton(int i, bool set)
{
if (Object.op_Implicit((Object)(object)floors[i].Button_On))
{
floors[i].Button_On.SetActive(set);
}
if (Object.op_Implicit((Object)(object)floors[i].Button_Off))
{
floors[i].Button_Off.SetActive(!set);
}
}
public override void InvokeTrigger(MGS_TriggerSystem invoker)
{
SetFloor(invoker.index);
}
private void Update()
{
if (timeout > 0f)
{
timeout = Mathf.Clamp(timeout -= Time.deltaTime, 0f, 1f);
}
if (debugRandomFloor)
{
SetFloor(Random.Range(0, floors.Length));
debugRandomFloor = false;
}
}
public void FixedUpdate()
{
MoveTowardsFloor();
}
private void MoveTowardsFloor()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: 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_0071: Unknown result type (might be due to invalid IL or missing references)
if (atTargetFloor)
{
return;
}
elevator.MovePosition(Vector3.MoveTowards(elevator.position, floors[targetFloor].level.position, elevatorSpeed * Time.deltaTime));
if (elevator.position.y == floors[targetFloor].level.position.y)
{
atTargetFloor = true;
for (int i = 0; i < floors[targetFloor].ElevatorDoors.Length; i++)
{
floors[targetFloor].ElevatorDoors[i].OpenDoor();
}
if ((Object)(object)containCollision != (Object)null)
{
containCollision.SetActive(false);
}
}
}
}
public class MGS_ItemSpawner : MonoBehaviour
{
public string[] objectIDs;
private List<FVRObject> fvrObjects;
public float respawnTime = 60f;
public static List<FVRPhysicalObject> spawnedObjects = new List<FVRPhysicalObject>();
private void Awake()
{
fvrObjects = ItemIDToList(objectIDs);
if (fvrObjects.Count == 0)
{
((Component)this).gameObject.SetActive(false);
}
}
private void Update()
{
((Component)this).transform.Rotate(0f, 0f, 45f * Time.deltaTime);
}
public void OnTriggerEnter(Collider collider)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: 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)
if (!((Object)collider).name.Contains("Controller ("))
{
return;
}
MGS_AudioManager.PlayOneShot(AudioClipEnum.ItemEquip, ((Component)this).transform.position);
for (int i = 0; i < fvrObjects.Count; i++)
{
GameObject val = Object.Instantiate<GameObject>(((AnvilAsset)fvrObjects[i]).GetGameObject(), ((Component)this).transform.position + Vector3.up * 0.2f * (float)i, ((Component)this).transform.rotation);
FVRPhysicalObject component = val.GetComponent<FVRPhysicalObject>();
if ((Object)(object)component != (Object)null)
{
spawnedObjects.Add(component);
}
}
if (respawnTime > 0f)
{
MGS_Manager.RespawnGameObject(((Component)this).gameObject, respawnTime);
}
((Component)this).gameObject.SetActive(false);
}
public static List<FVRObject> ItemIDToList(string[] itemIDs)
{
List<FVRObject> list = new List<FVRObject>();
for (int i = 0; i < itemIDs.Length; i++)
{
if (IM.OD.TryGetValue(itemIDs[i], out var value))
{
list.Add(value);
}
else
{
Debug.Log((object)("Could not find " + itemIDs));
}
}
return list;
}
}
public class MGS_KillZone : MGS_TriggerSystem
{
private void OnTriggerEnter(Collider collider)
{
if (((Object)collider).name.Contains("Controller ("))
{
GM.CurrentPlayerBody.KillPlayer(false);
}
SosigLink component = ((Component)collider).gameObject.GetComponent<SosigLink>();
if ((Object)(object)component != (Object)null)
{
component.S.KillSosig();
}
}
}
public class MGS_Manager : MonoBehaviour
{
public enum GamemodeID
{
Sandbox,
StorySR,
SupplyRaid,
TnH
}
public delegate void HeadFadeDelegate();
[CompilerGenerated]
private sealed class <FadeCamera>d__33 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public MGS_Manager <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <FadeCamera>d__33(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0026: 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_0053: Expected O, but got Unknown
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
SteamVR_Fade.Start(<>4__this.fadeColor, <>4__this.fadeTime, false);
<>2__current = (object)new WaitForSeconds(<>4__this.fadeHoldTime);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
MGS_Manager.OnHeadFaded?.Invoke();
SteamVR_Fade.Start(Color.clear, <>4__this.fadeTime, false);
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 <Respawn>d__39 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public GameObject go;
public float respawnTime;
public MGS_Manager <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Respawn>d__39(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(respawnTime);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if ((Object)(object)go != (Object)null)
{
go.SetActive(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();
}
}
public static MGS_Manager instance;
public bool running = false;
[Tooltip("Simple toggle to set this to TnH for building")]
public bool takeAndHold = false;
[Header("Gamemode")]
public int Gamemode = -1;
public GameObject mainMenu;
public GameObject[] sandBoxObjects;
public GameObject[] storyObjects;
public GameObject[] supplyRaidObjects;
public GameObject[] TnHObjects;
[Header("Save Data")]
public int saveSlot = 0;
public int spawnAreaIndex = 0;
public bool optionHand = false;
private int keycardLevel = 0;
public int storyTask = 0;
public bool itemSpawners = true;
[Header("Game Data")]
private float playerHealthMax = 5000f;
public static GameObject boss;
[Header("Player")]
public float fadeTime = 1f;
public float fadeHoldTime = 0.1f;
public Color fadeColor = Color.white;
public float PlayerHealthMax
{
get
{
return playerHealthMax;
}
set
{
playerHealthMax = value;
MGS_Compass.UpdateCompass();
}
}
public int KeycardLevel
{
get
{
return keycardLevel;
}
set
{
keycardLevel = value;
MGS_Compass.UpdateCompass();
}
}
public static event HeadFadeDelegate OnHeadFaded;
private void Awake()
{
instance = this;
if (takeAndHold)
{
SetGamemode(3);
}
}
public static void TriggerFade(float fadeLength = 1f, float fadeHold = 0.1f)
{
instance.fadeTime = fadeLength;
instance.fadeHoldTime = fadeHold;
((MonoBehaviour)instance).StartCoroutine(instance.FadeCamera());
}
public IEnumerator FadeCamera()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <FadeCamera>d__33(0)
{
<>4__this = this
};
}
public void SetGamemode(int mode)
{
Gamemode = mode;
for (int i = 0; i < sandBoxObjects.Length; i++)
{
if ((Object)(object)sandBoxObjects[i] != (Object)null)
{
sandBoxObjects[i].SetActive(mode == 0);
}
}
if (mode == 0 || mode == 3)
{
keycardLevel = 99;
}
for (int j = 0; j < storyObjects.Length; j++)
{
if ((Object)(object)storyObjects[j] != (Object)null)
{
storyObjects[j].SetActive(mode == 1);
}
}
bool flag = mode == 2 || mode == 1;
for (int k = 0; k < supplyRaidObjects.Length; k++)
{
if ((Object)(object)supplyRaidObjects[k] != (Object)null)
{
supplyRaidObjects[k].SetActive(flag);
}
}
if (flag)
{
mainMenu.SetActive(false);
}
if (mode == 1)
{
MGS_SR.SetSRStorymode();
}
}
public void SaveGame()
{
PlayerPrefs.SetInt("MGS_" + saveSlot + "_SaveData", 1);
PlayerPrefs.SetInt("MGS_" + saveSlot + "_Area", spawnAreaIndex);
}
public void LoadGame()
{
spawnAreaIndex = PlayerPrefs.GetInt("MGS_" + saveSlot + "_Area", 0);
}
public void NewGame()
{
spawnAreaIndex = 0;
}
public static void RespawnGameObject(GameObject go, float time)
{
((MonoBehaviour)instance).StartCoroutine(instance.Respawn(go, time));
}
protected IEnumerator Respawn(GameObject go, float respawnTime)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Respawn>d__39(0)
{
<>4__this = this,
go = go,
respawnTime = respawnTime
};
}
public void OnValidate()
{
if (TnHObjects.Length == 0 || TnHObjects[0].activeSelf == takeAndHold)
{
return;
}
for (int i = 0; i < TnHObjects.Length; i++)
{
if ((Object)(object)TnHObjects[i] != (Object)null)
{
TnHObjects[i].SetActive(takeAndHold);
}
}
}
}
public enum StoryTask
{
None = -1,
DarpaChief,
MerylEscape,
Ocelot,
RavenTank,
Ninja,
ToiletMeeting,
PsychoMantis,
MerylShot,
PSG1,
PassageSniper,
Captured,
Prison,
TowerChase,
TowerDestroy,
RopeDown,
OtaconElevator,
HindD,
ElevatorFight,
SniperWolf,
ColdElevator,
VulcanRaven,
ActivateMetalGear,
RexFight,
LiquidFight,
TunnelEscape,
Ending
}
public class MGS_Menu : MonoBehaviour
{
public enum Locations
{
Caverns,
Heliport,
TankHanger,
Canyon,
Warhead,
Offices,
Labs,
LabHallway,
labHal,
Caves,
Passage,
TowerA,
TowerTop,
TowerB,
Snowfield,
Furnance,
StorageElevator,
ColdStorage,
Sewer,
RexLayer,
RexHanger,
Tunnel
}
public static MGS_Menu instance;
public Material bgA;
public Material bgB;
private float bgA_Color = 0.5f;
private float bgB_Color = 0f;
private float bgB_Alpha;
private bool bgB_ping = false;
public Text[] enableItems;
public Text[] enableMusic;
[Header("Gamemode")]
public GameObject gamemodeSelect;
public GameObject sandboxModePanel;
public GameObject storyModePanel;
public GameObject tnhPanel;
[Header("Buttons")]
public GameObject loadGameBtn;
public GameObject[] boxTeleportBtns;
private void Start()
{
bgA_Color = 0.5f;
bgB_Color = 0f;
loadGameBtn.SetActive(PlayerPrefs.GetInt("MGS_" + MGS_Manager.instance.saveSlot + "_SaveData") == 1);
sandboxModePanel.SetActive(false);
storyModePanel.SetActive(false);
tnhPanel.SetActive(MGS_Manager.instance.takeAndHold);
gamemodeSelect.SetActive(!MGS_Manager.instance.takeAndHold);
}
public void Update()
{
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: 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)
bgA_Color += Time.deltaTime * 0.0533f;
if (bgA_Color > 1f)
{
bgA_Color -= 1f;
}
bgB_Color += Time.deltaTime * 0.0493f;
if (bgB_Color > 1f)
{
bgB_Color -= 1f;
}
bgB_Alpha += Time.deltaTime * 0.15f * (float)(bgB_ping ? 1 : (-1));
if (bgB_Alpha >= 1f && bgB_ping)
{
bgB_ping = false;
}
else if (bgB_Alpha <= 0f && !bgB_ping)
{
bgB_ping = true;
}
Color val = Color.HSVToRGB(bgA_Color, 1f, 1f);
Color val2 = Color.HSVToRGB(bgB_Color, 1f, 1f);
val2.a = bgB_Alpha;
bgA.SetColor("_Color", val);
bgB.SetColor("_TintColor", val2);
bgB.SetTextureScale("_MainTex", Vector2.one * Mathf.Lerp(0.25f, 0.5f, bgB_Alpha));
}
public void SelectGamemode(int i)
{
MGS_Manager.instance.SetGamemode(i);
gamemodeSelect.SetActive(false);
if (i == 0 || i != 1)
{
sandboxModePanel.SetActive(true);
}
else
{
storyModePanel.SetActive(true);
}
MGS_AudioManager.PlayGlobalOneShot(AudioClipEnum.MenuGunshot);
}
public void TeleportToPoint(Transform point)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: 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_0021: Unknown result type (might be due to invalid IL or missing references)
Vector3 position = point.position;
NavMeshHit val = default(NavMeshHit);
if (NavMesh.SamplePosition(position, ref val, 15f, -1))
{
position = ((NavMeshHit)(ref val)).position;
}
FVRMovementManager currentMovementManager = GM.CurrentMovementManager;
Vector3 position2 = point.position;
Quaternion rotation = point.rotation;
currentMovementManager.TeleportToPoint(position2, true, ((Quaternion)(ref rotation)).eulerAngles);
}
public void ToggleItemSpawners()
{
MGS_Manager.instance.itemSpawners = !MGS_Manager.instance.itemSpawners;
for (int i = 0; i < enableItems.Length; i++)
{
if ((Object)(object)enableItems[i] != (Object)null)
{
enableItems[i].text = (MGS_Manager.instance.itemSpawners ? "Items Enabled" : "Items Disabled");
}
}
}
public void ToggleMusic()
{
if (MGS_MusicManager.instance.masterVolume > 0f)
{
MGS_MusicManager.instance.masterVolume = 0f;
}
else
{
MGS_MusicManager.instance.masterVolume = MGS_MusicManager.instance.masterVolumeDefault;
}
for (int i = 0; i < enableMusic.Length; i++)
{
if ((Object)(object)enableMusic[i] != (Object)null)
{
enableMusic[i].text = ((MGS_MusicManager.instance.masterVolume > 0f) ? "Music Enabled" : "Music Disabled");
}
}
}
public void TeleportToLocation(int location)
{
MGS_AudioManager.PlayGlobalOneShot(AudioClipEnum.MenuSelectA);
MGS_AreaManager mGS_AreaManager = MGS_AreaManager.instance;
Transform point = ((Component)mGS_AreaManager.areas[location]).transform;
if (mGS_AreaManager.areas[location].respawnPoints.Length != 0 && (Object)(object)mGS_AreaManager.areas[location].respawnPoints[0] != (Object)null)
{
point = mGS_AreaManager.areas[location].respawnPoints[0];
}
mGS_AreaManager.areas[location].SetArea(state: true);
TeleportToPoint(point);
}
public void DisableGameobject(GameObject go)
{
go.SetActive(false);
}
private void OnValidate()
{
instance = this;
}
}
public class MGS_MusicManager : MonoBehaviour
{
public enum Music
{
None = -1,
Introduction,
Discovery,
Cavern,
Intruder_1,
Intruder_2,
Intruder_3,
Encounter,
WarheadStorage,
MantisHymn,
HindD,
Duel,
Enclosure,
BlastFurnace,
Colosseo,
RexsLair,
Escape,
EndTitle,
VRTraining,
Wind
}
public static MGS_MusicManager instance;
public float masterVolume = 0.25f;
[HideInInspector]
public float masterVolumeDefault = 0.25f;
public int currentSource = 0;
public AudioSource[] audioSources;
public AudioClip[] musicBGM;
public float audioFade = 1.25f;
public MGS_Area currentArea;
public Music overlayMusic = Music.None;
public Music DebugID;
public bool DebugPlayback = false;
public bool DebugQuickPlay = false;
protected float playDelay = 0f;
private void Awake()
{
instance = this;
masterVolumeDefault = masterVolume;
}
private void Update()
{
if (DebugPlayback)
{
if (DebugQuickPlay)
{
PlayTrack(DebugID, playOnce: false, 0.2f);
}
else
{
PlayTrack(DebugID);
}
DebugPlayback = false;
}
for (int i = 0; i < audioSources.Length; i++)
{
if (i == currentSource && audioSources[i].volume != masterVolume)
{
if (audioSources[i].isPlaying)
{
audioSources[i].volume = Mathf.MoveTowards(audioSources[i].volume, masterVolume, Time.deltaTime * audioFade);
}
else if (Time.time >= playDelay)
{
audioSources[i].Play();
}
}
else if (i != currentSource && audioSources[i].volume != 0f)
{
audioSources[i].volume = Mathf.MoveTowards(audioSources[i].volume, 0f, Time.deltaTime);
if (audioSources[i].volume == 0f)
{
audioSources[i].Stop();
}
}
}
}
public static void SetVolume(float volume = 1f)
{
for (int i = 0; i < instance.audioSources.Length; i++)
{
instance.audioSources[i].volume = volume;
}
}
public static void StopTracks(bool instant = false)
{
instance.currentSource = instance.audioSources.Length - 1;
if (instant)
{
for (int i = 0; i < instance.audioSources.Length; i++)
{
instance.audioSources[i].volume = 0f;
instance.audioSources[i].Stop();
}
}
}
protected static void PlayTrack(Music id, bool playOnce = false, float delay = 1.25f)
{
if (id <= Music.None || id == Music.None)
{
if (instance.currentSource < instance.audioSources.Length)
{
instance.audioSources[instance.currentSource].Stop();
}
}
else
{
if ((int)id >= instance.musicBGM.Length || id < Music.None || (Object)(object)instance.audioSources[instance.currentSource].clip == (Object)(object)instance.musicBGM[(int)id])
{
return;
}
instance.currentSource++;
if (instance.currentSource >= instance.audioSources.Length)
{
instance.currentSource = 0;
}
AudioSource val = instance.audioSources[instance.currentSource];
if (delay <= 0f)
{
for (int i = 0; i < instance.audioSources.Length; i++)
{
instance.audioSources[i].volume = 0f;
instance.audioSources[i].Stop();
}
}
val.clip = instance.musicBGM[(int)id];
val.loop = !playOnce;
val.volume = 0f;
instance.playDelay = Time.time + delay;
}
}
public static void PlayAreaTrack(MGS_Area area, float delay = 1.25f)
{
PlayTrack(area.music);
instance.currentArea = area;
}
public static void PlayOverlayTrack(Music track, bool playOnce = false, float delay = 1.25f)
{
PlayTrack(track);
}
public static void StopOverlayTrack()
{
PlayAreaTrack(instance.currentArea);
}
}
public class MGS_Platform : MovingPlatformBase
{
public void Awake()
{
((MovingPlatformBase)this).Awake();
}
public void FixedUpdate()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
base.refT.position = ((Component)this).transform.position;
base.refT.rotation = ((Component)this).transform.rotation;
}
public override Vector3 PhysicsStep()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
base.refT.position = ((Component)this).transform.position;
base.refT.rotation = ((Component)this).transform.rotation;
return ((MovingPlatformBase)this).PhysicsStep();
}
}
public class MGS_PlayerTeleportTrigger : MGS_TriggerSystem
{
[CompilerGenerated]
private sealed class <TeleportFade>d__4 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public MGS_PlayerTeleportTrigger <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <TeleportFade>d__4(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Expected O, but got Unknown
//IL_007d: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
MGS_Manager.instance.fadeColor = Color.black;
MGS_Manager.TriggerFade(0.25f, 0.25f);
<>2__current = (object)new WaitForSeconds(0.25f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
GM.CurrentMovementManager.TeleportToPoint(<>4__this.teleportLocation.position, true, <>4__this.teleportLocation.forward);
if ((Object)(object)<>4__this.area != (Object)null)
{
<>4__this.area.SetArea(state: true);
}
<>2__current = (object)new WaitForSeconds(0.25f);
<>1__state = 2;
return true;
case 2:
<>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 Transform teleportLocation;
public MGS_Area area;
private void Start()
{
}
public override void InvokeTrigger(MGS_TriggerSystem invoker)
{
((MonoBehaviour)this).StartCoroutine(TeleportFade());
}
public IEnumerator TeleportFade()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <TeleportFade>d__4(0)
{
<>4__this = this
};
}
}
[RequireComponent(typeof(Rigidbody))]
public class MGS_Projectile : MonoBehaviour
{
public Rigidbody rb;
[Header("Damage")]
public Damage damage;
public float speed = 50f;
public GameObject impactPrefab;
[Header("Target")]
public Vector3 targetPosition;
public bool guided = false;
private void Awake()
{
}
private void Start()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
((Component)this).transform.LookAt(targetPosition);
rb.velocity = ((Component)this).transform.forward * speed;
}
private void OnCollisionEnter(Collision col)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
IFVRDamageable component = col.gameObject.GetComponent<IFVRDamageable>();
if (component != null)
{
component.Damage(damage);
}
Object.Destroy((Object)(object)Object.Instantiate<GameObject>(impactPrefab, ((ContactPoint)(ref col.contacts[0])).point, ((Component)this).transform.rotation), 1f);
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
public class MGS_Test : MovingPlatformBase
{
public Transform start;
public Transform end;
public float moveSpeed = 3f;
public float rotateSpeed = 5f;
public void Awake()
{
((MovingPlatformBase)this).Awake();
((Component)this).gameObject.layer = LayerMask.NameToLayer("Environment");
}
private void FixedUpdate()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
Transform transform = ((Component)this).transform;
transform.position += Vector3.forward * 0.1f * Time.deltaTime;
}
public override Vector3 PhysicsStep()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: 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_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
Debug.Log((object)"Moving");
base.refT.position = Vector3.MoveTowards(base.refT.position, end.position, moveSpeed * Time.deltaTime);
base.refT.rotation = Quaternion.RotateTowards(base.refT.rotation, end.rotation, rotateSpeed * Time.deltaTime);
if (base.refT.position == end.position)
{
base.refT.position = start.position;
base.refT.rotation = start.rotation;
}
return ((MovingPlatformBase)this).PhysicsStep();
}
}
public class MGS_TriggerSystem : MonoBehaviour
{
[Header("Trigger System")]
public int index = 0;
public virtual void InvokeTrigger(MGS_TriggerSystem invoker)
{
}
}
public class MGS_TriggerZone : MGS_TriggerSystem
{
public MGS_TriggerSystem triggerSystem;
public AudioClip triggerSound;
private void OnTriggerEnter(Collider collider)
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
if (((Object)collider).name.Contains("Controller ("))
{
if ((Object)(object)triggerSystem != (Object)null)
{
triggerSystem.InvokeTrigger(this);
}
if ((Object)(object)triggerSound != (Object)null)
{
MGS_AudioManager.PlayOneShot(triggerSound, ((Component)this).transform.position);
}
}
}
}
public class MGS_Turret : MonoBehaviour, IFVRDamageable
{
public bool damagable = true;
public DamageClass[] damageBlacklist;
public bool blindImmune = true;
public const float blindTime = 5f;
private bool isBlinded = false;
private float blindTimeout = 0f;
private bool playerSpotted = false;
[Header("Turret")]
public bool requiresLOS = false;
public float sightRange = 20f;
public float turnSpeed = 25f;
public float fov = 90f;
public Transform pivot;
public Transform muzzle;
public GameObject[] playerSightedObjects;
public GameObject[] playerHiddenObjects;
[Header("Attack")]
public GameObject projectilePrefab;
public float fireRate = 1f;
public int fireShots = 1;
public float fireShotBreak = 0.35f;
private float fireCooldown = 0f;
[Header("Health")]
public int health = 1;
private int healthMax = 1;
public int damage = 1;
public GameObject[] aliveObjects;
public GameObject[] damagedObjects;
public GameObject[] destroyedObjects;
private void Awake()
{
healthMax = health;
for (int i = 0; i < aliveObjects.Length; i++)
{
aliveObjects[i].SetActive(true);
}
for (int j = 0; j < damagedObjects.Length; j++)
{
damagedObjects[j].SetActive(false);
}
for (int k = 0; k < destroyedObjects.Length; k++)
{
destroyedObjects[k].SetActive(false);
}
}
private void FixedUpdate()
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
if (health > 0 && !isBlinded && playerSpotted)
{
Quaternion val = Quaternion.LookRotation(((Component)GM.CurrentPlayerBody.Head).transform.position - pivot.position, Vector3.up);
pivot.rotation = Quaternion.RotateTowards(pivot.rotation, val, Time.deltaTime * turnSpeed);
}
}
private void FireUpdate()
{
if (playerSpotted)
{
}
}
public void Damage(Damage dam)
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Invalid comparison between Unknown and I4
if (!damagable)
{
return;
}
if (!blindImmune && dam.Dam_Blinding > 0f)
{
isBlinded = true;
blindTimeout = 5f + Time.time;
}
for (int i = 0; i < damageBlacklist.Length; i++)
{
if ((int)dam.Class == (int)damageBlacklist[i])
{
return;
}
}
health -= damage;
if (health <= 0)
{
Kill();
}
else if (health <= healthMax / 2)
{
for (int j = 0; j < damagedObjects.Length; j++)
{
damagedObjects[j].SetActive(true);
}
}
}
public void Kill()
{
for (int i = 0; i < aliveObjects.Length; i++)
{
aliveObjects[i].SetActive(false);
}
for (int j = 0; j < damagedObjects.Length; j++)
{
damagedObjects[j].SetActive(false);
}
for (int k = 0; k < destroyedObjects.Length; k++)
{
destroyedObjects[k].SetActive(true);
}
}
}
[BepInPlugin("Packer.MGSPlugin", "MGSPlugin", "1.0.1")]
[BepInProcess("h3vr.exe")]
public class MGSPlugin : BaseUnityPlugin
{
public static MGSPlugin instance;
public static bool tnhMode;
internal static ManualLogSource Logger { get; private set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
instance = this;
SceneManager.activeSceneChanged += ChangedActiveScene;
}
public void ChangedActiveScene(Scene current, Scene next)
{
if (((Scene)(ref current)).name != null)
{
if (((Scene)(ref current)).name.Contains("TakeAndHold_Lobby"))
{
tnhMode = true;
}
else if (!((Scene)(ref current)).name.Contains("MGS-Integral"))
{
tnhMode = false;
}
}
}
private void Start()
{
}
private void OnDestroy()
{
SceneManager.activeSceneChanged -= ChangedActiveScene;
}
}
public class MGS_Boss : MGS_SosigSpawner
{
private int selectedBoss = 0;
public Sosig bossSosig;
public bool bossNotClear = false;
private void Start()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
GM.CurrentSceneSettings.SosigKillEvent += new SosigKill(OnBossDeath);
GM.CurrentSceneSettings.PlayerDeathFromIFFEvent += new PlayerDeathFromIFF(PlayerDeathEvent);
}
private void OnDestroy()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
GM.CurrentSceneSettings.SosigKillEvent -= new SosigKill(OnBossDeath);
GM.CurrentSceneSettings.PlayerDeathFromIFFEvent -= new PlayerDeathFromIFF(PlayerDeathEvent);
}
public override void InvokeTrigger(MGS_TriggerSystem invoker)
{
if (MGS_Manager.instance.storyTask != invoker.index || !((Object)(object)bossSosig == (Object)null))
{
return;
}
for (int i = 0; i < patrols.Length; i++)
{
if (patrols[i].storyTask == (StoryTask)invoker.index)
{
selectedBoss = i;
bossSosig = MGS_SosigSpawner.SpawnPatrolSosig(patrols[i], MGS_SosigSpawner._spawnOptions);
break;
}
}
}
public override void PlayerDeathEvent(bool killedSelf, int iff)
{
bossNotClear = true;
bossSosig.ClearSosig();
bossNotClear = false;
}
private void OnBossDeath(Sosig s)
{
if (!((Object)(object)s != (Object)(object)bossSosig) && !bossNotClear)
{
MGS_Manager.instance.storyTask = (int)(patrols[selectedBoss].storyTask + 1);
((MonoBehaviour)this).StartCoroutine(ClearSosig(s));
}
}
}
public class MGS_DialogueSosig : MGS_TriggerSystem
{
public class Sequence
{
public AudioClip clip;
public GameObject[] disableGameObjects;
public GameObject[] enableGameObjects;
public void Play()
{
}
}
[Header("Dialogue")]
public Sosig sosig;
public string[] spawnsOnDeath;
public AudioSource audiosource;
public override void InvokeTrigger(MGS_TriggerSystem invoker)
{
}
}
public class MGS_EscapeSequence : MGS_TriggerSystem
{
public Animator animator;
public GameObject jeepWalls;
public GameObject startButton;
public int stateIndex = 0;
[Header("Key Objects")]
public GameObject gateDoor;
public string sosigID;
public Transform jeep;
public Transform endTeleport;
[Header("Gate A")]
public MGS_SosigSpawner gateASosigs;
public MGS_SosigSpawner gateBSosigs;
public void Awake()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
GM.CurrentSceneSettings.PlayerDeathFromIFFEvent += new PlayerDeathFromIFF(PlayerDeathEvent);
}
private void OnDisable()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
GM.CurrentSceneSettings.PlayerDeathFromIFFEvent -= new PlayerDeathFromIFF(PlayerDeathEvent);
}
private void PlayerDeathEvent(bool killedSelf, int iff)
{
if ((Object)(object)((Component)GM.CurrentMovementManager.Body).transform.parent == (Object)(object)jeep)
{
((Component)GM.CurrentMovementManager.Body).transform.SetParent((Transform)null);
}
}
public override void InvokeTrigger(MGS_TriggerSystem invoker)
{
jeepWalls.SetActive(true);
SetState(1);
((Component)GM.CurrentMovementManager.Body).transform.SetParent(jeep, true);
}
private void Update()
{
switch (stateIndex)
{
case 1:
if (gateDoor.activeSelf)
{
((Component)gateASosigs).gameObject.SetActive(true);
gateASosigs.ForceTrigger(noMusic: true);
SetState(2);
}
break;
case 2:
if (gateASosigs.sosigs.Count == 0)
{
((Component)gateBSosigs).gameObject.SetActive(true);
gateBSosigs.ForceTrigger(noMusic: true);
SetState(3);
}
break;
case 3:
if (gateBSosigs.sosigs.Count == 0)
{
SetState(4);
}
break;
case 0:
break;
}
}
public void OnEscapeEnd()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
((Component)GM.CurrentMovementManager.Body).transform.SetParent((Transform)null, true);
GM.CurrentMovementManager.TeleportToPoint(endTeleport.position, true, endTeleport.forward);
MGS_Manager.instance.fadeColor = Color.white;
MGS_Manager.TriggerFade(0.5f, 1f);
RestartSequence();
}
private void SetState(int newState)
{
stateIndex = newState;
animator.SetInteger("State", stateIndex);
}
public void RestartSequence()
{
jeepWalls.SetActive(false);
SetState(0);
}
}
public class MGS_HindFight : MonoBehaviour, IFVRDamageable
{
[Header("Health")]
public int totalHealth = 14;
public int health = 14;
public GameObject[] damageVisuals;
[Header("Movement")]
public Transform targetPoint;
public Transform[] safePoints;
public Transform[] attackPoints;
public Transform crashPoint;
public int pointIndex = 0;
public float moveSpeed = 4f;
public float rotateSpeed = 15f;
public Rigidbody rb;
public float movementTimer = 3f;
public float movementTime = 0f;
public Transform movePoint;
public float randomDistance = 1f;
public float damageTimeoutTime = 12f;
[Header("Weapons")]
public bool debugDamage = false;
[Header("Sounds")]
public AudioSource audioSource;
public AudioClip[] damagedSounds;
public AudioClip deathSound;
public AudioClip fireAlert;
public AudioClip mgFire;
public AudioClip missleFire;
public AudioClip missileExplode;
protected float currentSpeed = 0f;
protected float damageTimeout = 0f;
protected float randomTimer = 1f;
public void Damage(Damage dam)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
if ((int)dam.Class != 2)
{
return;
}
if (Time.time < damageTimeout)
{
health--;
damageTimeout = Time.time + damageTimeoutTime;
if (health != 0)
{
audioSource.PlayOneShot(damagedSounds[Random.Range(0, damagedSounds.Length)]);
}
if (health == 8)
{
damageVisuals[0].SetActive(true);
}
else if (health == 4)
{
damageVisuals[1].SetActive(true);
}
else if (health == 0)
{
damageVisuals[2].SetActive(true);
}
}
ChangeStance(damaged: true);
}
private void Start()
{
targetPoint = safePoints[0];
}
private void Update()
{
//IL_002f: 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_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
//IL_001b: 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_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
if (debugDamage)
{
debugDamage = false;
Damage val = new Damage();
val.Class = (DamageClass)2;
Damage(val);
}
if (Vector3.Distance(rb.position, movePoint.position) > 5f)
{
currentSpeed = moveSpeed * 0.25f;
}
else
{
currentSpeed = Mathf.MoveTowards(currentSpeed, moveSpeed, Time.deltaTime * 2f);
}
rb.MovePosition(Vector3.Lerp(rb.position, targetPoint.position, currentSpeed * Time.deltaTime));
rb.MoveRotation(Quaternion.RotateTowards(rb.rotation, targetPoint.rotation, rotateSpeed * Time.deltaTime));
if (Time.time >= movementTime)
{
ChangeStance();
}
}
private void ChangeStance(bool damaged = false)
{
if (health == 0)
{
movePoint = (targetPoint = crashPoint);
return;
}
if (damaged)
{
targetPoint = safePoints[GetRandomAdjacent(safePoints)];
}
else
{
targetPoint = attackPoints[Random.Range(0, attackPoints.Length)];
}
movementTime = Time.time + movementTimer;
}
private int GetRandomAdjacent(Transform[] list)
{
int num = pointIndex;
num = ((Random.Range(0, 100) > 50) ? (num + 1) : (num - 1));
if (num < 0)
{
num = list.Length - 1;
}
else if (num >= list.Length)
{
num = 0;
}
return num;
}
}
public class MGS_SosigSpawner : MGS_TriggerSystem
{
[Serializable]
public class SosigPatrol
{
public int sosigID;
public Transform[] waypoints;
public StoryTask storyTask = StoryTask.None;
public MGS_MusicManager.Music music = MGS_MusicManager.Music.None;
}
[CompilerGenerated]
private sealed class <ClearSosig>d__12 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public Sosig sosig;
public MGS_SosigSpawner <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ClearSosig>d__12(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(<>4__this.explodeTimer);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if ((Object)(object)sosig != (Object)null)
{
<>4__this.sosigs.Remove(sosig);
sosig.ClearSosig();
}
if (<>4__this.sosigs.Count > 0 || <>4__this.music != MGS_MusicManager.Music.None)
{
}
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 MGS_MusicManager.Music music = MGS_MusicManager.Music.None;
public float explodeTimer = 5f;
[Header("Sosigs")]
public SosigPatrol[] patrols;
public List<Sosig> sosigs = new List<Sosig>();
public static readonly SpawnOptions _spawnOptions = new SpawnOptions
{
IFF = 4,
SpawnState = (SosigOrder)10,
SpawnActivated = true,
EquipmentMode = (EquipmentSlots)7,
SpawnWithFullAmmo = true
};
private void OnEnable()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
GM.CurrentSceneSettings.SosigKillEvent += new SosigKill(OnSosigDeath);
GM.CurrentSceneSettings.PlayerDeathFromIFFEvent += new PlayerDeathFromIFF(PlayerDeathEvent);
}
private void OnDestroy()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
GM.CurrentSceneSettings.SosigKillEvent -= new SosigKill(OnSosigDeath);
GM.CurrentSceneSettings.PlayerDeathFromIFFEvent -= new PlayerDeathFromIFF(PlayerDeathEvent);
}
public override void InvokeTrigger(MGS_TriggerSystem invoker)
{
if (MGS_Manager.instance.storyTask == invoker.index)
{
ForceTrigger();
}
}
public void ForceTrigger(bool noMusic = false)
{
if (patrols != null)
{
for (int i = 0; i < patrols.Length; i++)
{
sosigs.Add(SpawnPatrolSosig(patrols[i], _spawnOptions));
}
}
if (!noMusic)
{
MGS_MusicManager.PlayOverlayTrack(music);
}
}
public virtual void PlayerDeathEvent(bool killedSelf, int iff)
{
for (int i = 0; i < sosigs.Count; i++)
{
sosigs[i].ClearSosig();
}
sosigs.Clear();
}
private void OnSosigDeath(Sosig s)
{
if (sosigs.Contains(s))
{
((MonoBehaviour)this).StartCoroutine(ClearSosig(s));
}
}
protected IEnumerator ClearSosig(Sosig sosig)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ClearSosig>d__12(0)
{
<>4__this = this,
sosig = sosig
};
}
public static Sosig SpawnPatrolSosig(SosigPatrol patrol, SpawnOptions spawnOptions)
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
if (patrol == null || patrol.waypoints.Length == 0)
{
Debug.Log((object)"MGS: Missing Patrol");
return null;
}
Vector3 position = patrol.waypoints[0].position;
Sosig val = CreateSosig(spawnOptions, position, patrol.waypoints[0].rotation, patrol.sosigID);
if ((Object)(object)val == (Object)null)
{
Debug.LogError((object)"MGS: No sosig spawned");
return null;
}
List<Vector3> list = TransformsToPositions(patrol.waypoints);
List<Vector3> list2 = TransformsToRotationDirections(patrol.waypoints);
val.CommandPathTo(list, list2, 1f, Vector2.one * 4f, 2f, (SosigMoveSpeed)3, (PathLoopType)4, (List<Sosig>)null, 0.2f, 1f, true, 50f);
return val;
}
public static Sosig CreateSosig(SpawnOptions spawnOptions, Vector3 position, Quaternion rotation, int sosigID)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Invalid comparison between Unknown and I4
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: 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_0047: Unknown result type (might be due to invalid IL or missing references)
SosigEnemyID val = (SosigEnemyID)sosigID;
if ((int)val == -1)
{
Debug.LogError((object)("MGS: Invalid Sosig ID " + sosigID));
return null;
}
position = GetValidNavPosition(position, 30f);
Sosig val2 = SosigAPI.Spawn(ManagerSingleton<IM>.Instance.odicSosigObjsByID[val], spawnOptions, position, rotation);
NavMeshAgent component = ((Component)val2).GetComponent<NavMeshAgent>();
component.obstacleAvoidanceType = (ObstacleAvoidanceType)1;
component.stoppingDistance = 1f;
return val2;
}
public static Vector3 GetValidNavPosition(Vector3 position, float distance)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
NavMeshHit val = default(NavMeshHit);
if (NavMesh.SamplePosition(position, ref val, distance, -1))
{
return ((NavMeshHit)(ref val)).position;
}
return position;
}
public static List<Vector3> TransformsToPositions(Transform[] list)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
List<Vector3> list2 = new List<Vector3>();
foreach (Transform val in list)
{
list2.Add(val.position);
}
return list2;
}
public static List<Vector3> TransformsToRotationDirections(Transform[] list)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
List<Vector3> list2 = new List<Vector3>();
foreach (Transform val in list)
{
Quaternion rotation = val.rotation;
list2.Add(((Quaternion)(ref rotation)).eulerAngles);
}
return list2;
}
private void OnDrawGizmos()
{
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: 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)
if (patrols == null)
{
return;
}
for (int i = 0; i < patrols.Length; i++)
{
if (patrols[i] == null)
{
continue;
}
for (int j = 0; j < patrols[i].waypoints.Length; j++)
{
if (!((Object)(object)patrols[i].waypoints[j] == (Object)null) && (j == 0 || !((Object)(object)patrols[i].waypoints[j - 1] == (Object)null)))
{
if (j == 0)
{
Gizmos.DrawLine(patrols[i].waypoints[j].position, patrols[i].waypoints[patrols[i].waypoints.Length - 1].position);
}
else
{
Gizmos.DrawLine(patrols[i].waypoints[j].position, patrols[i].waypoints[j - 1].position);
}
}
}
}
}
}
public class MGS_ToggleObjects : MGS_TriggerSystem
{
public bool triggerFadeout = false;
public Color fadeoutColor = Color.white;
public GameObject[] enableGameObjects;
public GameObject[] disableGameObjects;
public override void InvokeTrigger(MGS_TriggerSystem invoker)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
base.InvokeTrigger(invoker);
if (triggerFadeout)
{
MGS_Manager.OnHeadFaded += ToggleObjects;
MGS_Manager.instance.fadeColor = fadeoutColor;
MGS_Manager.TriggerFade();
}
else
{
ToggleObjects();
}
}
private void OnDisable()
{
MGS_Manager.OnHeadFaded -= ToggleObjects;
}
public void ToggleObjects()
{
for (int i = 0; i < enableGameObjects.Length; i++)
{
if ((Object)(object)enableGameObjects[i] != (Object)null)
{
enableGameObjects[i].SetActive(true);
}
}
for (int j = 0; j < disableGameObjects.Length; j++)
{
if ((Object)(object)disableGameObjects[j] != (Object)null)
{
disableGameObjects[j].SetActive(false);
}
}
}
}
public class MGS_SR : MonoBehaviour
{
public static MGS_SR instance;
private void Awake()
{
instance = this;
}
private void Start()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
SR_Manager.SupplyPointChangeEvent += new SupplyPointChangeDelegate(Captured);
}
private void OnDestroy()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
SR_Manager.SupplyPointChangeEvent -= new SupplyPointChangeDelegate(Captured);
}
private void Update()
{
MusicUpdate();
}
public static bool GetSRHand()
{
return SR_Manager.profile.hand;
}
public static void SetSRStorymode()
{
SR_Manager.profile.captures = 15;
SR_Manager.profile.spawnLocking = false;
SR_Manager.profile.faction = "Smokey Moses";
SR_Manager.profile.character = "Solo Steak";
for (int i = 0; i < SR_Manager.instance.characters.Count; i++)
{
if (SR_Manager.instance.characters[i].name == "Solo Steak")
{
SR_Manager.instance.character = SR_Manager.instance.characters[i];
}
}
for (int j = 0; j < SR_Manager.instance.factions.Count; j++)
{
if (SR_Manager.instance.factions[j].name == "Smokey Moses")
{
SR_Manager.instance.faction = SR_Manager.instance.factions[j];
}
}
SR_Manager.instance.LaunchGame();
}
public void Captured()
{
MGS_MusicManager.PlayOverlayTrack(MGS_MusicManager.instance.currentArea.music);
switch (SR_Manager.instance.CurrentCaptures)
{
case 2:
MGS_Manager.instance.KeycardLevel = 1;
break;
case 3:
MGS_Manager.instance.KeycardLevel = 2;
break;
case 4:
MGS_Manager.instance.KeycardLevel = 3;
break;
case 6:
MGS_Manager.instance.KeycardLevel = 4;
break;
case 7:
MGS_Manager.instance.KeycardLevel = 5;
break;
case 8:
MGS_Manager.instance.KeycardLevel = 6;
break;
case 13:
MGS_Manager.instance.KeycardLevel = 7;
break;
case 15:
break;
case 5:
case 9:
case 10:
case 11:
case 12:
case 14:
break;
}
}
public void StopBattleMusic()
{
}
public void MusicUpdate()
{
if (SR_Manager.instance.captureZone.captureRemain > 0f && SR_Manager.instance.captureZone.captureRemain != (float)SR_Manager.AttackSupplyPoint().captureTime)
{
switch (SR_Manager.instance.CurrentCaptures)
{
default:
MGS_MusicManager.PlayOverlayTrack(MGS_MusicManager.Music.Encounter);
break;
case 1:
case 2:
case 3:
case 5:
case 6:
case 7:
case 8:
case 9:
case 12:
case 13:
MGS_MusicManager.PlayOverlayTrack(MGS_MusicManager.Music.Duel);
break;
}
}
}
}
}