using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using Atlas;
using Atlas.Loaders;
using Atlas.MappingComponents.TakeAndHold;
using BepInEx;
using BepInEx.Bootstrap;
using FistVR;
using H3MP;
using H3MP.Networking;
using H3MP.Scripts;
using Microsoft.CodeAnalysis;
using Sodalite.Api;
using SupplyRaid;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[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("Supply Raid(SR) Gamemode, with native H3MP integration")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: AssemblyInformationalVersion("1.3.0+4bc0b7988634f3c797c601acdc56f7c95fd7dac3")]
[assembly: AssemblyProduct("SupplyRaid")]
[assembly: AssemblyTitle("SupplyRaid")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.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;
}
}
}
public class SR_FVRPhysicalObject : FVRPhysicalObject
{
}
public class SR_FVRPointable : FVRPointable
{
}
public class SR_FVRPointableButton : FVRPointableButton
{
}
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 H3MP.Networking
{
public class Networking
{
public static bool ServerRunning()
{
if (SupplyRaidPlugin.h3mpEnabled)
{
return isServerRunning();
}
return false;
}
private static bool isServerRunning()
{
if ((Object)(object)Mod.managerObject == (Object)null)
{
return false;
}
return true;
}
public static bool IsClient()
{
if (SupplyRaidPlugin.h3mpEnabled)
{
return isClient();
}
return false;
}
private static bool isClient()
{
if ((Object)(object)Mod.managerObject == (Object)null)
{
return false;
}
if (!ThreadManager.host)
{
return true;
}
return false;
}
public static bool IsHost()
{
if (SupplyRaidPlugin.h3mpEnabled)
{
return isHosting();
}
return false;
}
private static bool isHosting()
{
if ((Object)(object)Mod.managerObject == (Object)null)
{
return false;
}
if (ThreadManager.host)
{
return true;
}
return false;
}
public static int GetPlayerCount()
{
if (SupplyRaidPlugin.h3mpEnabled)
{
return GetNetworkPlayerCount();
}
return 1;
}
private static int GetNetworkPlayerCount()
{
return GameManager.players.Count;
}
public static int[] GetPlayerIDs()
{
int[] array = new int[GameManager.players.Count];
int num = 0;
foreach (KeyValuePair<int, PlayerManager> player in GameManager.players)
{
array[num] = player.Key;
num++;
}
return array;
}
public static int GetLocalID()
{
return GameManager.ID;
}
public static int RegisterHostCustomPacket(string identifier)
{
if (Mod.registeredCustomPacketIDs.ContainsKey(identifier))
{
return Mod.registeredCustomPacketIDs[identifier];
}
return Server.RegisterCustomPacketType(identifier, 0);
}
public static PlayerData GetPlayer(int i)
{
return PlayerData.GetPlayer(i);
}
}
public class PlayerData
{
public Transform head;
public string username;
public Transform handLeft;
public Transform handRight;
public int ID;
public float health;
public int iff;
public static PlayerData GetPlayer(int i)
{
return new PlayerData
{
head = GameManager.players[i].head,
username = GameManager.players[i].username,
handLeft = GameManager.players[i].leftHand,
handRight = GameManager.players[i].rightHand
};
}
}
}
namespace BGM
{
public class BGM
{
public static void SetTakeMusic(int level)
{
}
public static void SetHoldMusic(int level)
{
}
public static void QueueTake(int situation)
{
}
public static void SpawnPanel(Vector3 position, Quaternion rotation)
{
}
public static void InitializeSoundtrackInterface()
{
}
}
}
namespace SupplyRaid
{
internal static class PluginInfo
{
internal const string NAME = "Supply Raid";
internal const string GUID = "com.Packer.SupplyRaid";
internal const string VERSION = "1.3.1";
}
public class SR_TNH : MonoBehaviour
{
[CompilerGenerated]
private sealed class <DelaySetup>d__7 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public SR_TNH <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DelaySetup>d__7(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = null;
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>4__this.tnhManager = Object.FindObjectOfType<TNH_Manager>();
<>2__current = null;
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
if ((Object)(object)<>4__this.tnhManager != (Object)null)
{
((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.SetupSupplyRaid());
}
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 <SetupSupplyPoints>d__11 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public SR_TNH <>4__this;
private List<Transform> <validPanels>5__1;
private List<Transform> <validSosigPoints>5__2;
private List<Transform> <validPatrolPoints>5__3;
private int <x>5__4;
private TNH_SupplyPoint <tnhSP>5__5;
private SR_SupplyPoint <sp>5__6;
private float <largestSize>5__7;
private PatrolPath[] <patrols>5__8;
private int <i>5__9;
private int <i>5__10;
private int <z>5__11;
private int <i>5__12;
private Transform <spot>5__13;
private NavMeshHit <hit>5__14;
private int <z>5__15;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SetupSupplyPoints>d__11(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<validPanels>5__1 = null;
<validSosigPoints>5__2 = null;
<validPatrolPoints>5__3 = null;
<tnhSP>5__5 = null;
<sp>5__6 = null;
<patrols>5__8 = null;
<spot>5__13 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_02af: Unknown result type (might be due to invalid IL or missing references)
//IL_02b9: Expected O, but got Unknown
//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
//IL_0646: Unknown result type (might be due to invalid IL or missing references)
//IL_0678: Unknown result type (might be due to invalid IL or missing references)
//IL_068a: Unknown result type (might be due to invalid IL or missing references)
//IL_06bf: Unknown result type (might be due to invalid IL or missing references)
//IL_06c4: Unknown result type (might be due to invalid IL or missing references)
//IL_06d5: Unknown result type (might be due to invalid IL or missing references)
//IL_06fe: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = null;
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
Debug.Log((object)("Supply Raid: Found Supply Points - " + <>4__this.tnhManager.SupplyPoints.Count));
Random.InitState(<>4__this.tnhManager.m_seed);
<validPanels>5__1 = new List<Transform>();
<validSosigPoints>5__2 = new List<Transform>();
<validPatrolPoints>5__3 = new List<Transform>();
<x>5__4 = 0;
while (<x>5__4 < <>4__this.tnhManager.SupplyPoints.Count)
{
<tnhSP>5__5 = <>4__this.tnhManager.SupplyPoints[<x>5__4];
<validPanels>5__1.Clear();
<validSosigPoints>5__2.Clear();
<validPatrolPoints>5__3.Clear();
<validPanels>5__1.AddRange(<tnhSP>5__5.SpawnPoints_Panels);
<validPanels>5__1.AddRange(<tnhSP>5__5.SpawnPoint_Tables);
<validPanels>5__1.Add(<tnhSP>5__5.SpawnPoint_PlayerSpawn);
<validPanels>5__1.AddRange(<tnhSP>5__5.SpawnPoints_Boxes);
<validPanels>5__1.AddRange(<tnhSP>5__5.SpawnPoints_Sosigs_Defense);
<validPanels>5__1.AddRange(<tnhSP>5__5.SpawnPoints_Turrets);
<validSosigPoints>5__2.Add(<tnhSP>5__5.SpawnPoint_PlayerSpawn);
<validSosigPoints>5__2.AddRange(<tnhSP>5__5.SpawnPoints_Boxes);
<validSosigPoints>5__2.AddRange(<tnhSP>5__5.SpawnPoints_Sosigs_Defense);
<validSosigPoints>5__2.AddRange(<tnhSP>5__5.SpawnPoints_Turrets);
<validSosigPoints>5__2.AddRange(<tnhSP>5__5.SpawnPoints_Panels);
<i>5__9 = 0;
while (<i>5__9 < <tnhSP>5__5.CoverPoints.Count)
{
<validSosigPoints>5__2.Add(((Component)<tnhSP>5__5.CoverPoints[<i>5__9]).transform);
<i>5__9++;
}
<i>5__10 = <validSosigPoints>5__2.Count - 1;
while (<i>5__10 >= 0)
{
if ((Object)(object)<validSosigPoints>5__2[<i>5__10] == (Object)null)
{
<validSosigPoints>5__2.RemoveAt(<i>5__10);
}
<i>5__10--;
}
<sp>5__6 = Object.Instantiate<GameObject>(new GameObject()).AddComponent<SR_SupplyPoint>();
((Object)<sp>5__6).name = "SupplyPoint_" + <x>5__4;
if (Object.op_Implicit((Object)(object)((Component)<tnhSP>5__5).GetComponent<AtlasSupplyPoint>()))
{
Debug.Log((object)"Supply Raid: Found First Spawn Atlas");
if (((Component)<tnhSP>5__5).GetComponent<AtlasSupplyPoint>().ForceSpawnHere)
{
<sp>5__6.forceFirstSpawn = true;
}
}
else if (Object.op_Implicit((Object)(object)((Component)<tnhSP>5__5).GetComponent("WurstMod.MappingComponents.TakeAndHold.ForcedSpawn")))
{
Debug.Log((object)"Supply Raid: Found First Spawn Wurst");
<sp>5__6.forceFirstSpawn = true;
}
<sp>5__6.respawn = <tnhSP>5__5.SpawnPoint_PlayerSpawn;
<sp>5__6.captureZone = <tnhSP>5__5.Bounds;
<sp>5__6.squadPoint = <tnhSP>5__5.SpawnPoint_PlayerSpawn;
<largestSize>5__7 = Mathf.Max(<sp>5__6.captureZone.localScale.x, Mathf.Max(<sp>5__6.captureZone.localScale.y, <sp>5__6.captureZone.localScale.z)) * 1.5f;
<sp>5__6.captureTime = Mathf.CeilToInt(Mathf.Clamp(((float)<sp>5__6.captureTime < <largestSize>5__7) ? <largestSize>5__7 : ((float)<sp>5__6.captureTime), 20f, 45f));
<sp>5__6.buyMenu = <>4__this.TryGetLocation(<validPanels>5__1, 0);
((Component)<sp>5__6.buyMenu).transform.Rotate(0f, 90f, 0f);
<sp>5__6.ammoStation = <>4__this.TryGetLocation(<validPanels>5__1, 3);
((Component)<sp>5__6.ammoStation).transform.Rotate(0f, 90f, 0f);
<sp>5__6.attachmentStation = <>4__this.TryGetLocation(<validPanels>5__1, 1);
((Component)<sp>5__6.attachmentStation).transform.Rotate(0f, 90f, 0f);
<sp>5__6.recycler = <>4__this.TryGetLocation(<validPanels>5__1, 2);
((Component)<sp>5__6.recycler).transform.Rotate(0f, 90f, 0f);
<sp>5__6.duplicator = <>4__this.TryGetLocation(<validPanels>5__1, 4);
((Component)<sp>5__6.duplicator).transform.Rotate(0f, 90f, 0f);
<sp>5__6.sosigSpawns = (Transform[])(object)new Transform[4];
<z>5__11 = 0;
while (<z>5__11 < <sp>5__6.sosigSpawns.Length)
{
<sp>5__6.sosigSpawns[<z>5__11] = <>4__this.TryGetLocation(<validSosigPoints>5__2, <z>5__11);
<z>5__11++;
}
<sp>5__6.sniperPoints.AddRange(<validSosigPoints>5__2);
<sp>5__6.guardPoints.AddRange(<validSosigPoints>5__2);
<patrols>5__8 = new PatrolPath[2];
<i>5__12 = 0;
while (<i>5__12 < 8)
{
<spot>5__13 = new GameObject().transform;
<validPatrolPoints>5__3.Add(<spot>5__13);
<spot>5__13.position = <sp>5__6.captureZone.position;
Transform obj = <spot>5__13;
obj.position += new Vector3(Random.Range(0f - spawnHalfExtent, spawnHalfExtent), Random.Range(0f - spawnHalfExtent, spawnHalfExtent), Random.Range(0f - spawnHalfExtent, spawnHalfExtent));
if (NavMesh.SamplePosition(<spot>5__13.position, ref <hit>5__14, navRange, -1))
{
<spot>5__13.position = ((NavMeshHit)(ref <hit>5__14)).position;
}
<spot>5__13 = null;
<i>5__12++;
}
<z>5__15 = 0;
while (<z>5__15 < <patrols>5__8.Length)
{
<patrols>5__8[<z>5__15] = new PatrolPath();
<patrols>5__8[<z>5__15].patrolPoints.AddRange(<validPatrolPoints>5__3);
<validPatrolPoints>5__3.Reverse();
<z>5__15++;
}
<sp>5__6.patrolPaths = <patrols>5__8;
<tnhSP>5__5 = null;
<sp>5__6 = null;
<patrols>5__8 = null;
<x>5__4++;
}
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 <SetupSupplyPointsHold>d__12 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public SR_TNH <>4__this;
private List<Transform> <validPanels>5__1;
private List<Transform> <validSosigPoints>5__2;
private List<Transform> <validPatrolPoints>5__3;
private int <x>5__4;
private TNH_HoldPoint <tnhHP>5__5;
private SR_SupplyPoint <sp>5__6;
private AtlasSupplyPoint <ASP>5__7;
private Transform <bounds>5__8;
private Transform <boundsBiggest>5__9;
private Vector3 <boundsScale>5__10;
private float <largestSize>5__11;
private PatrolPath[] <patrols>5__12;
private int <i>5__13;
private int <y>5__14;
private int <i>5__15;
private int <i>5__16;
private int <i>5__17;
private NavMeshHit <hit>5__18;
private int <z>5__19;
private int <i>5__20;
private Transform <spot>5__21;
private NavMeshHit <hit>5__22;
private int <z>5__23;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SetupSupplyPointsHold>d__12(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<validPanels>5__1 = null;
<validSosigPoints>5__2 = null;
<validPatrolPoints>5__3 = null;
<tnhHP>5__5 = null;
<sp>5__6 = null;
<ASP>5__7 = null;
<bounds>5__8 = null;
<boundsBiggest>5__9 = null;
<patrols>5__12 = null;
<spot>5__21 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
//IL_04c3: Expected O, but got Unknown
//IL_05f6: Unknown result type (might be due to invalid IL or missing references)
//IL_05fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0623: Unknown result type (might be due to invalid IL or missing references)
//IL_0650: Unknown result type (might be due to invalid IL or missing references)
//IL_08dd: Unknown result type (might be due to invalid IL or missing references)
//IL_08ed: Unknown result type (might be due to invalid IL or missing references)
//IL_08fd: Unknown result type (might be due to invalid IL or missing references)
//IL_07a6: Unknown result type (might be due to invalid IL or missing references)
//IL_07b0: Expected O, but got Unknown
//IL_07c0: Unknown result type (might be due to invalid IL or missing references)
//IL_07ca: Unknown result type (might be due to invalid IL or missing references)
//IL_067d: Unknown result type (might be due to invalid IL or missing references)
//IL_06d3: Unknown result type (might be due to invalid IL or missing references)
//IL_06fa: Unknown result type (might be due to invalid IL or missing references)
//IL_081d: Unknown result type (might be due to invalid IL or missing references)
//IL_0721: Unknown result type (might be due to invalid IL or missing references)
//IL_08a2: Unknown result type (might be due to invalid IL or missing references)
//IL_0859: Unknown result type (might be due to invalid IL or missing references)
//IL_0882: Unknown result type (might be due to invalid IL or missing references)
//IL_0b6c: Unknown result type (might be due to invalid IL or missing references)
//IL_0b9e: Unknown result type (might be due to invalid IL or missing references)
//IL_0bb0: Unknown result type (might be due to invalid IL or missing references)
//IL_0beb: Unknown result type (might be due to invalid IL or missing references)
//IL_0bf0: Unknown result type (might be due to invalid IL or missing references)
//IL_0c01: Unknown result type (might be due to invalid IL or missing references)
//IL_0c2a: Unknown result type (might be due to invalid IL or missing references)
int num = <>1__state;
if (num != 0)
{
if (num != 1)
{
return false;
}
<>1__state = -1;
<tnhHP>5__5 = null;
<sp>5__6 = null;
<ASP>5__7 = null;
<bounds>5__8 = null;
<boundsBiggest>5__9 = null;
<patrols>5__12 = null;
goto IL_0d20;
}
<>1__state = -1;
if ((Object)(object)<>4__this.tnhManager == (Object)null || <>4__this.tnhManager.HoldPoints == null)
{
return false;
}
Debug.Log((object)("Supply Raid: Found Hold Points - " + <>4__this.tnhManager.HoldPoints.Count));
<validPanels>5__1 = new List<Transform>();
<validSosigPoints>5__2 = new List<Transform>();
<validPatrolPoints>5__3 = new List<Transform>();
<x>5__4 = 0;
goto IL_0d30;
IL_0d30:
if (<x>5__4 < <>4__this.tnhManager.HoldPoints.Count)
{
<tnhHP>5__5 = <>4__this.tnhManager.HoldPoints[<x>5__4];
if ((Object)(object)<tnhHP>5__5 == (Object)null)
{
goto IL_0d20;
}
<validPanels>5__1.Clear();
<validSosigPoints>5__2.Clear();
if ((Object)(object)<tnhHP>5__5.m_systemNode != (Object)null && (Object)(object)<tnhHP>5__5.m_systemNode.NodeCenter != (Object)null)
{
<validPanels>5__1.Add(<tnhHP>5__5.m_systemNode.NodeCenter);
}
<i>5__13 = 0;
while (<i>5__13 < <tnhHP>5__5.CoverPoints.Count)
{
if ((Object)(object)<tnhHP>5__5.CoverPoints[<i>5__13] != (Object)null && (Object)(object)((Component)<tnhHP>5__5.CoverPoints[<i>5__13]).transform != (Object)null)
{
<validPanels>5__1.Add(((Component)<tnhHP>5__5.CoverPoints[<i>5__13]).transform);
}
<i>5__13++;
}
<validPanels>5__1.AddRange(<tnhHP>5__5.SpawnPoints_Sosigs_Defense);
<validPanels>5__1.AddRange(<tnhHP>5__5.SpawnPoints_Turrets);
<y>5__14 = 0;
while (<y>5__14 < <tnhHP>5__5.AttackVectors.Count)
{
if (<tnhHP>5__5.AttackVectors[<y>5__14] != null)
{
if (<tnhHP>5__5.AttackVectors[<y>5__14].SpawnPoints_Sosigs_Attack.Count > 0)
{
<validSosigPoints>5__2.AddRange(<tnhHP>5__5.AttackVectors[<y>5__14].SpawnPoints_Sosigs_Attack);
}
if ((Object)(object)<tnhHP>5__5.AttackVectors[<y>5__14].GrenadeVector != (Object)null)
{
<validSosigPoints>5__2.Add(<tnhHP>5__5.AttackVectors[<y>5__14].GrenadeVector);
}
}
<y>5__14++;
}
<validSosigPoints>5__2.AddRange(<tnhHP>5__5.SpawnPoints_Sosigs_Defense);
<validSosigPoints>5__2.AddRange(<tnhHP>5__5.SpawnPoints_Turrets);
<i>5__15 = 0;
while (<i>5__15 < <tnhHP>5__5.CoverPoints.Count)
{
if ((Object)(object)<tnhHP>5__5.CoverPoints[<i>5__15] != (Object)null && (Object)(object)((Component)<tnhHP>5__5.CoverPoints[<i>5__15]).transform != (Object)null)
{
<validSosigPoints>5__2.Add(((Component)<tnhHP>5__5.CoverPoints[<i>5__15]).transform);
}
<i>5__15++;
}
if ((Object)(object)<tnhHP>5__5.m_systemNode != (Object)null && (Object)(object)<tnhHP>5__5.m_systemNode.NodeCenter != (Object)null)
{
<validSosigPoints>5__2.Add(<tnhHP>5__5.m_systemNode.NodeCenter);
}
<i>5__16 = <validSosigPoints>5__2.Count - 1;
while (<i>5__16 >= 0)
{
if ((Object)(object)<validSosigPoints>5__2[<i>5__16] == (Object)null)
{
<validSosigPoints>5__2.RemoveAt(<i>5__16);
}
<i>5__16--;
}
<sp>5__6 = Object.Instantiate<GameObject>(new GameObject()).AddComponent<SR_SupplyPoint>();
((Object)<sp>5__6).name = "SupplyPoint_" + <x>5__4;
<ASP>5__7 = ((Component)<tnhHP>5__5).GetComponent<AtlasSupplyPoint>();
if ((Object)(object)<ASP>5__7 != (Object)null)
{
Debug.Log((object)"Supply Raid: Found First Spawn Atlas");
if (<ASP>5__7.ForceSpawnHere)
{
<sp>5__6.forceFirstSpawn = true;
}
}
else if (Object.op_Implicit((Object)(object)((Component)<tnhHP>5__5).GetComponent("WurstMod.MappingComponents.TakeAndHold.ForcedSpawn")))
{
Debug.Log((object)"Supply Raid: Found First Spawn Wurst");
<sp>5__6.forceFirstSpawn = true;
}
if ((Object)(object)<tnhHP>5__5.m_systemNode != (Object)null && (Object)(object)<tnhHP>5__5.m_systemNode.NodeCenter != (Object)null)
{
<sp>5__6.respawn = <tnhHP>5__5.m_systemNode.NodeCenter;
}
else
{
<sp>5__6.respawn = <validSosigPoints>5__2[Random.Range(0, <validSosigPoints>5__2.Count)];
}
<bounds>5__8 = null;
<boundsBiggest>5__9 = null;
<boundsScale>5__10 = Vector3.zero;
<i>5__17 = 0;
while (<i>5__17 < <tnhHP>5__5.Bounds.Count)
{
if (<tnhHP>5__5.Bounds[<i>5__17].localScale.x > <boundsScale>5__10.x || <tnhHP>5__5.Bounds[<i>5__17].localScale.y > <boundsScale>5__10.y || <tnhHP>5__5.Bounds[<i>5__17].localScale.z > <boundsScale>5__10.z)
{
<boundsBiggest>5__9 = <tnhHP>5__5.Bounds[<i>5__17];
if (<tnhHP>5__5.Bounds[<i>5__17].localScale.x <= maxBoundsSize || <tnhHP>5__5.Bounds[<i>5__17].localScale.y <= maxBoundsSize || <tnhHP>5__5.Bounds[<i>5__17].localScale.z <= maxBoundsSize)
{
<bounds>5__8 = <tnhHP>5__5.Bounds[<i>5__17];
}
}
<i>5__17++;
}
if ((Object)(object)<bounds>5__8 == (Object)null)
{
<bounds>5__8 = Object.Instantiate<GameObject>(new GameObject()).transform;
<bounds>5__8.localScale = Vector3.one * maxBoundsSize;
if ((Object)(object)<tnhHP>5__5.m_systemNode != (Object)null && (Object)(object)<tnhHP>5__5.m_systemNode.NodeCenter != (Object)null)
{
<bounds>5__8.position = <tnhHP>5__5.m_systemNode.NodeCenter.position;
}
else if (<tnhHP>5__5.Bounds.Count > 0)
{
if (NavMesh.SamplePosition(<tnhHP>5__5.Bounds[0].position, ref <hit>5__18, navRange, -1))
{
<bounds>5__8.position = ((NavMeshHit)(ref <hit>5__18)).position;
}
}
else
{
<bounds>5__8.position = ((Component)<tnhHP>5__5).transform.position;
}
}
<sp>5__6.captureZone = <bounds>5__8;
<sp>5__6.squadPoint = <sp>5__6.respawn;
<largestSize>5__11 = Mathf.Max(<bounds>5__8.localScale.x, Mathf.Max(<bounds>5__8.localScale.y, <bounds>5__8.localScale.z)) * 1.5f;
<sp>5__6.captureTime = Mathf.CeilToInt(Mathf.Clamp(((float)<sp>5__6.captureTime < <largestSize>5__11) ? <largestSize>5__11 : ((float)<sp>5__6.captureTime), 20f, 45f));
<sp>5__6.buyMenu = <>4__this.TryGetLocation(<validPanels>5__1, 0);
((Component)<sp>5__6.buyMenu).transform.Rotate(0f, 90f, 0f);
<sp>5__6.ammoStation = <>4__this.TryGetLocation(<validPanels>5__1, 3);
((Component)<sp>5__6.ammoStation).transform.Rotate(0f, 90f, 0f);
<sp>5__6.attachmentStation = <>4__this.TryGetLocation(<validPanels>5__1, 1);
((Component)<sp>5__6.attachmentStation).transform.Rotate(0f, 90f, 0f);
<sp>5__6.recycler = <>4__this.TryGetLocation(<validPanels>5__1, 2);
((Component)<sp>5__6.recycler).transform.Rotate(0f, 90f, 0f);
<sp>5__6.duplicator = <>4__this.TryGetLocation(<validPanels>5__1, 4);
((Component)<sp>5__6.duplicator).transform.Rotate(0f, 90f, 0f);
<sp>5__6.sosigSpawns = (Transform[])(object)new Transform[4];
<z>5__19 = 0;
while (<z>5__19 < <sp>5__6.sosigSpawns.Length)
{
<sp>5__6.sosigSpawns[<z>5__19] = <>4__this.TryGetLocation(<validSosigPoints>5__2, <z>5__19);
<z>5__19++;
}
<sp>5__6.sniperPoints.AddRange(<validSosigPoints>5__2);
<sp>5__6.guardPoints.AddRange(<validSosigPoints>5__2);
<patrols>5__12 = new PatrolPath[2];
<i>5__20 = 0;
while (<i>5__20 < 8)
{
<spot>5__21 = new GameObject().transform;
<validPatrolPoints>5__3.Add(<spot>5__21);
<spot>5__21.position = <sp>5__6.captureZone.position;
Transform obj = <spot>5__21;
obj.position += new Vector3(Random.Range(0f - spawnHalfExtent, spawnHalfExtent), Random.Range(0f - spawnHalfExtent, spawnHalfExtent) * 0.5f, Random.Range(0f - spawnHalfExtent, spawnHalfExtent));
if (NavMesh.SamplePosition(<spot>5__21.position, ref <hit>5__22, navRange, -1))
{
<spot>5__21.position = ((NavMeshHit)(ref <hit>5__22)).position;
}
<spot>5__21 = null;
<i>5__20++;
}
<z>5__23 = 0;
while (<z>5__23 < <patrols>5__12.Length)
{
<patrols>5__12[<z>5__23] = new PatrolPath();
<patrols>5__12[<z>5__23].patrolPoints.AddRange(<validPatrolPoints>5__3);
<validPatrolPoints>5__3.Reverse();
<z>5__23++;
}
<sp>5__6.patrolPaths = <patrols>5__12;
<>2__current = null;
<>1__state = 1;
return true;
}
return false;
IL_0d20:
<x>5__4++;
goto IL_0d30;
}
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 <SetupSupplyRaid>d__8 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public SR_TNH <>4__this;
private int <i>5__1;
private int <i>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SetupSupplyRaid>d__8(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
if (Object.op_Implicit((Object)(object)<>4__this.tnhManager))
{
<>4__this.tnhManager.FMODController.SwitchTo(0, 0f, true, true);
<>4__this.tnhManager.ClearMiscEnemies();
((Component)<>4__this.tnhManager).gameObject.SetActive(false);
<>4__this.tnhManager.FMODController.SetMasterVolume(0f);
<i>5__1 = 0;
while (<i>5__1 < <>4__this.tnhManager.HoldPoints.Count)
{
<>4__this.tnhManager.HoldPoints[<i>5__1].ForceClearConfiguration();
((Component)<>4__this.tnhManager.HoldPoints[<i>5__1]).gameObject.SetActive(false);
<i>5__1++;
}
<i>5__2 = 0;
while (<i>5__2 < <>4__this.tnhManager.SupplyPoints.Count)
{
<>4__this.tnhManager.SupplyPoints[<i>5__2].ClearConfiguration();
((Component)<>4__this.tnhManager.SupplyPoints[<i>5__2]).gameObject.SetActive(false);
<i>5__2++;
}
}
if (Object.op_Implicit((Object)(object)<>4__this.tnHOverideManager))
{
((Component)<>4__this.tnHOverideManager).gameObject.SetActive(false);
}
VaultSystem.ClearExistingSaveableObjects(true);
Object.Instantiate<GameObject>(new GameObject()).AddComponent<SR_ModLoader>();
<>2__current = null;
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>4__this.SetupManager();
<>2__current = null;
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.SetupSupplyPoints());
<>1__state = 3;
return true;
case 3:
<>1__state = -1;
<>2__current = null;
<>1__state = 4;
return true;
case 4:
<>1__state = -1;
<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.SetupSupplyPointsHold());
<>1__state = 5;
return true;
case 5:
<>1__state = -1;
Debug.Log((object)("Supply Raid: SR Supply Points Total: " + SR_Manager.instance.supplyPoints.Count));
((MonoBehaviour)<>4__this).StartCoroutine(SR_ModLoader.LoadSupplyRaidAssets());
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 TNH_Manager tnhManager;
public SR_Manager srManager;
public TNH_ManagerOverride tnHOverideManager;
public static float maxBoundsSize = 10f;
public static float spawnHalfExtent = 20f;
public static float navRange = 30f;
public void Start()
{
if (Object.op_Implicit((Object)(object)tnHOverideManager))
{
((MonoBehaviour)this).StartCoroutine(DelaySetup());
}
else
{
((MonoBehaviour)this).StartCoroutine(SetupSupplyRaid());
}
}
public IEnumerator DelaySetup()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DelaySetup>d__7(0)
{
<>4__this = this
};
}
public IEnumerator SetupSupplyRaid()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SetupSupplyRaid>d__8(0)
{
<>4__this = this
};
}
private void SetupManager()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//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_003a: 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_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: 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_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: 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)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_00b2: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: 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_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: 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_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_0222: Unknown result type (might be due to invalid IL or missing references)
//IL_0233: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(new GameObject());
srManager = val.AddComponent<SR_Manager>();
Transform transform = new GameObject().transform;
Transform transform2 = new GameObject().transform;
transform2.SetPositionAndRotation(tnhManager.ScoreDisplayPoint.position + Vector3.down * 1.5f, tnhManager.ScoreDisplayPoint.rotation);
transform.SetPositionAndRotation(transform2.position + -(transform2.forward * 2f), transform2.rotation);
Transform transform3 = new GameObject().transform;
transform3.position = tnhManager.ScoreDisplayPoint.position + Vector3.down * 5f;
srManager.srMenu = transform2;
srManager.spawnMenu = transform2;
srManager.resultsMenu = transform2;
srManager.spawnPoint = transform;
srManager.spawnStation = transform2;
srManager.itemSpawner = tnhManager.ItemSpawner.transform;
((Component)srManager.itemSpawner).transform.SetParent((Transform)null);
srManager.itemSpawner.SetPositionAndRotation(transform2.position + Vector3.up + -srManager.itemSpawner.forward * 2f, transform2.rotation * Quaternion.Euler(0f, 180f, 0f));
srManager.buyMenu = transform3;
srManager.ammoStation = transform3;
srManager.recycler = transform3;
srManager.duplicator = transform3;
srManager.attachmentStation = transform3;
srManager.itemSpawner = transform3;
srManager.captureZone = ((Component)transform3).gameObject.AddComponent<SR_CaptureZone>();
srManager.captureZone.zone = ((Component)this).transform;
GM.CurrentMovementManager.TeleportToPoint(srManager.spawnPoint.position, true, srManager.spawnPoint.forward);
}
public Transform TryGetLocation(List<Transform> safeLocations, int index, List<Transform> tryLocations = null)
{
if (tryLocations != null && tryLocations.Count > index)
{
return tryLocations[index];
}
if (safeLocations.Count > index)
{
return safeLocations[index];
}
return safeLocations[Random.Range(0, safeLocations.Count)];
}
public IEnumerator SetupSupplyPoints()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SetupSupplyPoints>d__11(0)
{
<>4__this = this
};
}
public IEnumerator SetupSupplyPointsHold()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SetupSupplyPointsHold>d__12(0)
{
<>4__this = this
};
}
}
internal class SR_SosigData
{
public static MeshRenderer GetSosigMeshRenderer(string title, Transform geoParent)
{
for (int i = 0; i < geoParent.childCount; i++)
{
if (((Object)geoParent.GetChild(i)).name == title)
{
return ((Component)geoParent.GetChild(i)).GetComponent<MeshRenderer>();
}
}
return null;
}
public static void UpdateSosigLink(SosigLink link, Vector3 bodyScale, Vector3 linkScale, Material sosigMaterial, bool stopSever, MeshRenderer geo)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
//IL_0024: 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_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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_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)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//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_0144: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)link == (Object)null)
{
return;
}
CapsuleCollider val = (CapsuleCollider)link.C;
val.height *= linkScale.y;
val.radius *= ((linkScale.x > linkScale.z) ? linkScale.x : linkScale.z);
CharacterJoint val2 = (((Object)(object)link.J != (Object)null) ? link.J : ((Component)link).GetComponent<CharacterJoint>());
if (Object.op_Implicit((Object)(object)val2))
{
((Joint)val2).autoConfigureConnectedAnchor = false;
((Joint)val2).anchor = new Vector3(0f, ((Joint)val2).anchor.y * bodyScale.y, 0f);
((Joint)val2).connectedAnchor = new Vector3(0f, ((Joint)val2).connectedAnchor.y * bodyScale.y, 0f);
}
((Renderer)geo).sharedMaterial = sosigMaterial;
((Component)geo).transform.localScale = linkScale;
if (stopSever)
{
link.m_isJointSevered = true;
}
if (link.m_wearables.Count <= 0)
{
return;
}
foreach (SosigWearable wearable in link.m_wearables)
{
((Component)wearable).gameObject.transform.localScale = ((Component)geo).transform.localScale;
}
}
}
public class SR_Networking : MonoBehaviour
{
public static SR_Networking instance;
public bool isClient = false;
private int levelUpdate_ID = -1;
private int gameOptions_ID = -1;
private int capturedZone_ID = -1;
private int serverRunning_ID = -1;
private int updateStats_ID = -1;
private int requestSync_ID = -1;
private void Awake()
{
instance = this;
}
private void StartNetworking()
{
if (Networking.ServerRunning())
{
if (Networking.IsHost())
{
}
if (Networking.IsHost() || Client.isFullyConnected)
{
SetupPacketTypes();
}
if (Networking.IsClient())
{
SR_Manager.instance.SetLocalAsClient();
}
}
}
private void Start()
{
if (SupplyRaidPlugin.h3mpEnabled)
{
StartNetworking();
}
}
private void OnPlayerJoined(int clientID)
{
if (clientID != 0)
{
}
}
private void SetupPacketTypes()
{
//IL_0266: Unknown result type (might be due to invalid IL or missing references)
//IL_0270: Expected O, but got Unknown
//IL_024a: Unknown result type (might be due to invalid IL or missing references)
//IL_0250: Expected O, but got Unknown
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Expected O, but got Unknown
//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
//IL_02d5: Expected O, but got Unknown
//IL_02af: Unknown result type (might be due to invalid IL or missing references)
//IL_02b5: Expected O, but got Unknown
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Expected O, but got Unknown
//IL_0330: Unknown result type (might be due to invalid IL or missing references)
//IL_033a: Expected O, but got Unknown
//IL_0314: Unknown result type (might be due to invalid IL or missing references)
//IL_031a: Expected O, but got Unknown
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Expected O, but got Unknown
//IL_0395: Unknown result type (might be due to invalid IL or missing references)
//IL_039f: Expected O, but got Unknown
//IL_0379: Unknown result type (might be due to invalid IL or missing references)
//IL_037f: Expected O, but got Unknown
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Expected O, but got Unknown
//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0404: Expected O, but got Unknown
//IL_03de: Unknown result type (might be due to invalid IL or missing references)
//IL_03e4: Expected O, but got Unknown
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Expected O, but got Unknown
//IL_045f: Unknown result type (might be due to invalid IL or missing references)
//IL_0469: Expected O, but got Unknown
//IL_0443: Unknown result type (might be due to invalid IL or missing references)
//IL_0449: Expected O, but got Unknown
//IL_0200: Unknown result type (might be due to invalid IL or missing references)
//IL_0206: Expected O, but got Unknown
if (Networking.IsHost())
{
if (Mod.registeredCustomPacketIDs.ContainsKey("SR_LevelUpdate"))
{
levelUpdate_ID = Mod.registeredCustomPacketIDs["SR_LevelUpdate"];
}
else
{
levelUpdate_ID = Server.RegisterCustomPacketType("SR_LevelUpdate", 0);
}
Mod.customPacketHandlers[levelUpdate_ID] = new CustomPacketHandler(LevelUpdate_Handler);
if (Mod.registeredCustomPacketIDs.ContainsKey("SR_GameOptions"))
{
gameOptions_ID = Mod.registeredCustomPacketIDs["SR_GameOptions"];
}
else
{
gameOptions_ID = Server.RegisterCustomPacketType("SR_GameOptions", 0);
}
Mod.customPacketHandlers[gameOptions_ID] = new CustomPacketHandler(GameOptions_Handler);
if (Mod.registeredCustomPacketIDs.ContainsKey("SR_CapturedZone"))
{
capturedZone_ID = Mod.registeredCustomPacketIDs["SR_CapturedZone"];
}
else
{
capturedZone_ID = Server.RegisterCustomPacketType("SR_CapturedZone", 0);
}
Mod.customPacketHandlers[capturedZone_ID] = new CustomPacketHandler(CapturedZone_Handler);
if (Mod.registeredCustomPacketIDs.ContainsKey("SR_ServerRunning"))
{
serverRunning_ID = Mod.registeredCustomPacketIDs["SR_ServerRunning"];
}
else
{
serverRunning_ID = Server.RegisterCustomPacketType("SR_ServerRunning", 0);
}
Mod.customPacketHandlers[serverRunning_ID] = new CustomPacketHandler(ServerRunning_Handler);
if (Mod.registeredCustomPacketIDs.ContainsKey("SR_UpdateStats"))
{
updateStats_ID = Mod.registeredCustomPacketIDs["SR_UpdateStats"];
}
else
{
updateStats_ID = Server.RegisterCustomPacketType("SR_UpdateStats", 0);
}
Mod.customPacketHandlers[updateStats_ID] = new CustomPacketHandler(UpdateStats_Handler);
if (Mod.registeredCustomPacketIDs.ContainsKey("SR_RequestSync"))
{
requestSync_ID = Mod.registeredCustomPacketIDs["SR_RequestSync"];
}
else
{
requestSync_ID = Server.RegisterCustomPacketType("SR_RequestSync", 0);
}
Mod.customPacketHandlers[requestSync_ID] = new CustomPacketHandler(RequestSync_Handler);
return;
}
if (Mod.registeredCustomPacketIDs.ContainsKey("SR_LevelUpdate"))
{
levelUpdate_ID = Mod.registeredCustomPacketIDs["SR_LevelUpdate"];
Mod.customPacketHandlers[levelUpdate_ID] = new CustomPacketHandler(LevelUpdate_Handler);
}
else
{
ClientSend.RegisterCustomPacketType("SR_LevelUpdate");
Mod.CustomPacketHandlerReceived += new CustomPacketHandlerReceivedDelegate(LevelUpdate_Received);
}
if (Mod.registeredCustomPacketIDs.ContainsKey("SR_GameOptions"))
{
gameOptions_ID = Mod.registeredCustomPacketIDs["SR_GameOptions"];
Mod.customPacketHandlers[gameOptions_ID] = new CustomPacketHandler(GameOptions_Handler);
}
else
{
ClientSend.RegisterCustomPacketType("SR_GameOptions");
Mod.CustomPacketHandlerReceived += new CustomPacketHandlerReceivedDelegate(GameOptions_Received);
}
if (Mod.registeredCustomPacketIDs.ContainsKey("SR_CapturedZone"))
{
capturedZone_ID = Mod.registeredCustomPacketIDs["SR_CapturedZone"];
Mod.customPacketHandlers[capturedZone_ID] = new CustomPacketHandler(CapturedZone_Handler);
}
else
{
ClientSend.RegisterCustomPacketType("SR_CapturedZone");
Mod.CustomPacketHandlerReceived += new CustomPacketHandlerReceivedDelegate(CapturedZone_Received);
}
if (Mod.registeredCustomPacketIDs.ContainsKey("SR_ServerRunning"))
{
serverRunning_ID = Mod.registeredCustomPacketIDs["SR_ServerRunning"];
Mod.customPacketHandlers[serverRunning_ID] = new CustomPacketHandler(ServerRunning_Handler);
}
else
{
ClientSend.RegisterCustomPacketType("SR_ServerRunning");
Mod.CustomPacketHandlerReceived += new CustomPacketHandlerReceivedDelegate(ServerRunning_Received);
}
if (Mod.registeredCustomPacketIDs.ContainsKey("SR_UpdateStats"))
{
updateStats_ID = Mod.registeredCustomPacketIDs["SR_UpdateStats"];
Mod.customPacketHandlers[updateStats_ID] = new CustomPacketHandler(UpdateStats_Handler);
}
else
{
ClientSend.RegisterCustomPacketType("SR_UpdateStats");
Mod.CustomPacketHandlerReceived += new CustomPacketHandlerReceivedDelegate(UpdateStats_Received);
}
if (Mod.registeredCustomPacketIDs.ContainsKey("SR_RequestSync"))
{
requestSync_ID = Mod.registeredCustomPacketIDs["SR_RequestSync"];
Mod.customPacketHandlers[requestSync_ID] = new CustomPacketHandler(RequestSync_Handler);
}
else
{
ClientSend.RegisterCustomPacketType("SR_RequestSync");
Mod.CustomPacketHandlerReceived += new CustomPacketHandlerReceivedDelegate(RequestSync_Received);
}
}
public void LevelUpdate_Send(bool gameComplete)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
if (Networking.ServerRunning() && !Networking.IsClient())
{
Packet val = new Packet(levelUpdate_ID);
val.Write(SR_Manager.instance.CurrentCaptures);
val.Write(SR_Manager.instance.attackSupplyID);
val.Write(SR_Manager.instance.playerSupplyID);
val.Write(SR_Manager.instance.inEndless);
val.Write(SR_Manager.instance.stats.ObjectiveComplete);
val.Write(gameComplete);
ServerSend.SendTCPDataToAll(val, true);
Debug.Log((object)("Supply Raid: Host - Level Update: " + SR_Manager.instance.CurrentCaptures));
}
}
private void LevelUpdate_Handler(int clientID, Packet packet)
{
int num = packet.ReadInt(true);
int attackSupply = packet.ReadInt(true);
int playerSupply = packet.ReadInt(true);
bool isEndless = packet.ReadBool(true);
bool objectiveComplete = packet.ReadBool(true);
bool flag = packet.ReadBool(true);
if (flag)
{
SR_Manager.instance.CurrentCaptures = num;
SR_Manager.instance.gameCompleted = flag;
SR_Manager.instance.stats.ObjectiveComplete = objectiveComplete;
SR_Manager.instance.CompleteGame();
}
else
{
SR_Manager.instance.SetLevel_Client(num, attackSupply, playerSupply, isEndless);
}
Debug.Log((object)("Supply Raid: Client - Level Update: " + num));
}
public void GameOptions_Send()
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
if (Networking.ServerRunning() && !Networking.IsClient())
{
Packet val = new Packet(gameOptions_ID);
val.Write(SR_Manager.profile.playerCount);
val.Write(SR_Manager.profile.difficulty);
val.Write(SR_Manager.profile.freeBuyMenu);
val.Write(SR_Manager.profile.spawnLocking);
val.Write(SR_Manager.profile.startLevel);
val.Write(SR_Manager.profile.playerHealth);
val.Write(SR_Manager.profile.itemSpawner);
val.Write(SR_Manager.profile.captureZone);
val.Write(SR_Manager.profile.captureOrder);
val.Write(SR_Manager.profile.captures);
val.Write(SR_Manager.profile.respawn);
val.Write(SR_Manager.profile.itemsDrop);
val.Write(SR_Manager.profile.maxEnemies);
val.Write(SR_Manager.profile.maxSquadEnemies);
string text = "";
if (SR_Manager.Faction() != null)
{
text = SR_Manager.Faction().name;
}
val.Write(text);
val.Write(SR_Manager.profile.sosigWeapons);
ServerSend.SendTCPDataToAll(val, true);
}
}
private void GameOptions_Handler(int clientID, Packet packet)
{
float playerCount = packet.ReadFloat(true);
float difficulty = packet.ReadFloat(true);
bool freeBuyMenu = packet.ReadBool(true);
bool spawnLocking = packet.ReadBool(true);
int startLevel = packet.ReadInt(true);
int playerHealth = packet.ReadInt(true);
bool itemSpawner = packet.ReadBool(true);
bool captureZone = packet.ReadBool(true);
int order = packet.ReadInt(true);
int captures = packet.ReadInt(true);
bool respawn = packet.ReadBool(true);
int itemsDrop = packet.ReadInt(true);
int maxEnemies = packet.ReadInt(true);
int maxSquadEnemies = packet.ReadInt(true);
string factionID = packet.ReadString(true);
bool sosigWeapons = packet.ReadBool(true);
SR_Manager.instance.Network_GameOptions(playerCount, difficulty, freeBuyMenu, spawnLocking, startLevel, playerHealth, itemSpawner, captureZone, order, captures, respawn, itemsDrop, maxEnemies, maxSquadEnemies, factionID, sosigWeapons);
}
public void CapturedZone_Send()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
if (Networking.ServerRunning() && !Networking.IsHost())
{
Debug.Log((object)"Networking: Client Sending Captured Zone");
Packet val = new Packet(capturedZone_ID);
ClientSend.SendTCPData(val, true);
}
}
private void CapturedZone_Handler(int clientID, Packet packet)
{
Debug.Log((object)"Networking: Received Client Captured zone");
if (SR_Manager.instance.captureProtection <= 0f)
{
SR_Manager.instance.CapturedPoint();
}
}
public void ServerRunning_Send()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
if (Networking.ServerRunning() && !Networking.IsClient())
{
Packet val = new Packet(serverRunning_ID);
val.Write(SR_Manager.instance.gameServerRunning);
ServerSend.SendTCPDataToAll(val, true);
}
}
private void ServerRunning_Handler(int clientID, Packet packet)
{
bool flag = packet.ReadBool(true);
SR_Manager.instance.gameServerRunning = flag;
SR_Menu.instance.lauchGameButton.SetActive(flag);
}
public void UpdateStats_Send()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
if (Networking.ServerRunning() && !Networking.IsClient())
{
Packet val = new Packet(updateStats_ID);
val.Write(SR_Manager.instance.CurrentCaptures);
val.Write(SR_Manager.instance.stats.GameTime);
val.Write(SR_Manager.instance.stats.Kills);
ServerSend.SendTCPDataToAll(val, true);
}
}
private void UpdateStats_Handler(int clientID, Packet packet)
{
int num = packet.ReadInt(true);
if (num > SR_Manager.instance.CurrentCaptures)
{
SR_Manager.instance.CurrentCaptures = num;
}
float num2 = packet.ReadFloat(true);
if (num2 > SR_Manager.instance.stats.GameTime)
{
SR_Manager.instance.stats.GameTime = num2;
}
int num3 = packet.ReadInt(true);
if (SR_Manager.instance.stats.Kills > num3)
{
SR_Manager.instance.stats.Kills = num3;
}
SR_ResultsMenu.instance.UpdateResults();
}
public void RequestSync_Send()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
if (Networking.ServerRunning() && !Networking.IsHost())
{
Debug.Log((object)"Networking: Client Sending Request Sync");
Packet val = new Packet(requestSync_ID);
ClientSend.SendTCPData(val, true);
}
}
private void RequestSync_Handler(int clientID, Packet packet)
{
Debug.Log((object)"Networking: Received Client Request Sync");
GameOptions_Send();
LevelUpdate_Send(SR_Manager.instance.gameCompleted);
UpdateStats_Send();
ServerRunning_Send();
}
private void LevelUpdate_Received(string identifier, int index)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
if (identifier == "SR_LevelUpdate")
{
levelUpdate_ID = index;
Mod.customPacketHandlers[index] = new CustomPacketHandler(LevelUpdate_Handler);
Mod.CustomPacketHandlerReceived -= new CustomPacketHandlerReceivedDelegate(LevelUpdate_Received);
}
}
private void GameOptions_Received(string handlerID, int index)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
if (handlerID == "SR_GameOptions")
{
gameOptions_ID = index;
Mod.customPacketHandlers[index] = new CustomPacketHandler(GameOptions_Handler);
Mod.CustomPacketHandlerReceived -= new CustomPacketHandlerReceivedDelegate(GameOptions_Received);
}
}
private void CapturedZone_Received(string handlerID, int index)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
if (handlerID == "SR_CapturedZone")
{
capturedZone_ID = index;
Mod.customPacketHandlers[index] = new CustomPacketHandler(CapturedZone_Handler);
Mod.CustomPacketHandlerReceived -= new CustomPacketHandlerReceivedDelegate(CapturedZone_Received);
}
}
private void ServerRunning_Received(string handlerID, int index)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
if (handlerID == "SR_ServerRunning")
{
serverRunning_ID = index;
Mod.customPacketHandlers[index] = new CustomPacketHandler(ServerRunning_Handler);
Mod.CustomPacketHandlerReceived -= new CustomPacketHandlerReceivedDelegate(ServerRunning_Received);
}
}
private void UpdateStats_Received(string handlerID, int index)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
if (handlerID == "SR_UpdateStats")
{
updateStats_ID = index;
Mod.customPacketHandlers[index] = new CustomPacketHandler(UpdateStats_Handler);
Mod.CustomPacketHandlerReceived -= new CustomPacketHandlerReceivedDelegate(UpdateStats_Received);
}
}
private void RequestSync_Received(string handlerID, int index)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
if (handlerID == "SR_RequestSync")
{
requestSync_ID = index;
Mod.customPacketHandlers[index] = new CustomPacketHandler(RequestSync_Handler);
Mod.CustomPacketHandlerReceived -= new CustomPacketHandlerReceivedDelegate(RequestSync_Received);
RequestSync_Send();
}
}
public bool NamespaceExists(string desiredNamespace)
{
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (Assembly assembly in assemblies)
{
Type[] types = assembly.GetTypes();
foreach (Type type in types)
{
if (type.Namespace == desiredNamespace)
{
return true;
}
}
}
return false;
}
private void OnDestroy()
{
}
}
public class SR_AmmoSpawner : MonoBehaviour
{
public class AmmoRound
{
public FireArmRoundType roundType;
public List<AmmoClass> roundClasses = new List<AmmoClass>();
}
public class AmmoClass
{
public FireArmRoundClass roundClass;
public AmmoEnum ammo;
public bool isOnlyType = false;
}
public static SR_AmmoSpawner instance;
public Transform Spawnpoint_Round;
public Transform ScanningVolume;
public LayerMask ScanningLM;
public Transform selectionIcon;
[HideInInspector]
public bool[] purchasedAmmoTypes = new bool[28];
public GameObject rearmButton;
public GameObject speedloaderButton;
public GameObject clipButton;
public GameObject roundButton;
public GameObject togglePagesButton;
[HideInInspector]
[Tooltip("0 = Rearm \n1 = Speed Loader\n2 = Clip\n3 Round")]
private bool[] purchaseButtons = new bool[4];
private SR_GenericButton[] ammoButtons = new SR_GenericButton[28];
public GameObject[] ammoTypeButtons = (GameObject[])(object)new GameObject[28];
public AmmoEnum selectedAmmoType = AmmoEnum.Standard;
public FireArmRoundClass roundClass = (FireArmRoundClass)1;
private List<FVRFireArmMagazine> m_detectedMags = new List<FVRFireArmMagazine>();
private List<FVRFireArmClip> m_detectedClips = new List<FVRFireArmClip>();
private List<Speedloader> m_detectedSLs = new List<Speedloader>();
private List<SosigWeaponPlayerInterface> m_detectedSweapons = new List<SosigWeaponPlayerInterface>();
private List<FVRFireArm> m_detectedFirearms = new List<FVRFireArm>();
private List<FireArmRoundType> m_roundTypes = new List<FireArmRoundType>();
private Collider[] colbuffer;
private Dictionary<FireArmRoundType, FireArmRoundClass> m_decidedTypes = new Dictionary<FireArmRoundType, FireArmRoundClass>();
private float m_scanTick = 1f;
private List<AmmoRound> ammoList = new List<AmmoRound>();
private List<FireArmRoundType> allRoundTypes = new List<FireArmRoundType>();
[Header("Ammo Page")]
public GameObject ammoPage;
[Header("Round Page")]
public GameObject roundPage;
public GameObject roundButtonPrefab;
public Transform roundContainer;
private List<SR_GenericButton> roundButtons = new List<SR_GenericButton>();
private List<FVRObject> rounds = new List<FVRObject>();
public static List<FVRObject> GetAllRounds()
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Invalid comparison between Unknown and I4
List<FVRObject> list = new List<FVRObject>();
foreach (string key in IM.OD.Keys)
{
if (IM.OD.TryGetValue(key, out var value) && Object.op_Implicit((Object)(object)value) && (int)value.Category == 4)
{
list.Add(value);
}
}
return list;
}
private void PopulateRoundPage()
{
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_0221: Unknown result type (might be due to invalid IL or missing references)
//IL_024a: Unknown result type (might be due to invalid IL or missing references)
//IL_029c: Unknown result type (might be due to invalid IL or missing references)
//IL_0312: Unknown result type (might be due to invalid IL or missing references)
//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
//IL_040e: Unknown result type (might be due to invalid IL or missing references)
//IL_0413: Unknown result type (might be due to invalid IL or missing references)
//IL_0418: Unknown result type (might be due to invalid IL or missing references)
//IL_041a: Unknown result type (might be due to invalid IL or missing references)
//IL_0472: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < roundButtons.Count; i++)
{
if (Object.op_Implicit((Object)(object)roundButtons[i]))
{
Object.Destroy((Object)(object)((Component)roundButtons[i]).gameObject);
}
}
List<FireArmRoundType> list = new List<FireArmRoundType>();
list.AddRange(m_roundTypes);
for (int j = 0; j < m_detectedMags.Count; j++)
{
if (Object.op_Implicit((Object)(object)m_detectedMags[j]) && !list.Contains(m_detectedMags[j].RoundType))
{
list.Add(m_detectedMags[j].RoundType);
}
}
for (int k = 0; k < m_detectedClips.Count; k++)
{
if (Object.op_Implicit((Object)(object)m_detectedClips[k]) && !list.Contains(m_detectedClips[k].RoundType))
{
list.Add(m_detectedClips[k].RoundType);
}
}
for (int l = 0; l < m_detectedSLs.Count; l++)
{
if (Object.op_Implicit((Object)(object)m_detectedSLs[l]) && Object.op_Implicit((Object)(object)((FVRPhysicalObject)m_detectedSLs[l]).ObjectWrapper) && !list.Contains(((FVRPhysicalObject)m_detectedSLs[l]).ObjectWrapper.RoundType))
{
list.Add(((FVRPhysicalObject)m_detectedSLs[l]).ObjectWrapper.RoundType);
}
}
for (int m = 0; m < m_detectedSweapons.Count; m++)
{
if (Object.op_Implicit((Object)(object)m_detectedSweapons[m]) && Object.op_Implicit((Object)(object)((FVRPhysicalObject)m_detectedSweapons[m]).ObjectWrapper) && !list.Contains(((FVRPhysicalObject)m_detectedSweapons[m]).ObjectWrapper.RoundType))
{
list.Add(((FVRPhysicalObject)m_detectedSweapons[m]).ObjectWrapper.RoundType);
}
}
for (int n = 0; n < m_detectedFirearms.Count; n++)
{
if (Object.op_Implicit((Object)(object)m_detectedFirearms[n]) && !list.Contains(m_detectedFirearms[n].RoundType))
{
list.Add(m_detectedFirearms[n].RoundType);
}
}
rounds = GetAllRounds();
for (int num = rounds.Count - 1; num >= 0; num--)
{
if (!list.Contains(rounds[num].RoundType))
{
rounds.RemoveAt(num);
}
}
for (int num2 = 0; num2 < rounds.Count; num2++)
{
ManagerSingleton<IM>.Instance.SpawnerIDDic.TryGetValue(rounds[num2].SpawnedFromId, out var value);
if ((Object)(object)value != (Object)null)
{
SR_GenericButton component = Object.Instantiate<GameObject>(roundButtonPrefab, roundContainer).GetComponent<SR_GenericButton>();
((Component)component).gameObject.SetActive(true);
roundButtons.Add(component);
component.fvrObject = rounds[num2];
component.textB.text = rounds[num2].DisplayName;
FireArmRoundClass firearmRoundClassFromType = GetFirearmRoundClassFromType(rounds[num2].ItemID, rounds[num2].RoundType);
AmmoEnum ammoEnum = (AmmoEnum)(component.index = (int)SR_Global.GetAmmoEnum(firearmRoundClassFromType));
component.genericButton = ammoButtons[(int)ammoEnum];
if (purchasedAmmoTypes[(int)ammoEnum])
{
if (SR_Manager.Character().modeRounds == 4)
{
int roundPowerCost = SR_Manager.Character().GetRoundPowerCost(rounds[num2].TagFirearmRoundPower, 1);
component.text.text = roundPowerCost.ToString();
}
else
{
component.text.text = "";
}
}
else
{
component.text.text = SR_Manager.Character().ammoUpgradeCost[(int)ammoEnum].ToString();
}
component.thumbnail.sprite = ammoTypeButtons[(int)ammoEnum].GetComponent<Image>().sprite;
}
else
{
Debug.Log((object)"Supply Raid: No ID found for rounds");
}
}
}
public void BuySpecificRound(FVRObject fvrObject)
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
if (!CanSpawn(SR_Manager.Character().modeRounds, SR_Manager.Character().roundsCost, 3))
{
SR_Manager.PlayFailSFX();
return;
}
if ((Object)(object)fvrObject != (Object)null)
{
Object.Instantiate<GameObject>(((AnvilAsset)fvrObject).GetGameObject(), Spawnpoint_Round.position, Spawnpoint_Round.rotation);
}
SR_Manager.PlayRearmSFX();
}
public void TogglePages()
{
roundPage.SetActive(ammoPage.activeSelf);
ammoPage.SetActive(!roundPage.activeSelf);
((Component)selectionIcon).gameObject.SetActive(!roundPage.activeSelf);
}
private void Start()
{
instance = this;
colbuffer = (Collider[])(object)new Collider[50];
}
private void Update()
{
//IL_002e: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
m_scanTick -= Time.deltaTime;
if (m_scanTick <= 0f)
{
float num = Vector3.Distance(((Component)this).transform.position, ((Component)GM.CurrentPlayerBody).transform.position);
if (num < 12f)
{
Scan();
m_scanTick = Random.Range(0.8f, 1f);
}
else
{
m_scanTick = Random.Range(2f, 3f);
}
}
if (((Component)selectionIcon).gameObject.activeSelf && selectedAmmoType != AmmoEnum.None)
{
selectionIcon.position = ammoTypeButtons[(int)selectedAmmoType].transform.position;
}
}
public void Setup()
{
ammoButtons = new SR_GenericButton[ammoTypeButtons.Length];
for (int i = 0; i < ammoTypeButtons.Length; i++)
{
SR_GenericButton component = ammoTypeButtons[i].GetComponent<SR_GenericButton>();
ammoButtons[i] = component;
if (SR_Manager.instance.character.ammoUpgradeCost[i] == 0)
{
purchasedAmmoTypes[i] = true;
component.text.text = "";
}
else
{
component.text.text = SR_Manager.instance.character.ammoUpgradeCost[i].ToString();
}
}
switch (SR_Manager.instance.character.modeRearming)
{
case 0:
rearmButton.SetActive(false);
break;
default:
rearmButton.SetActive(true);
rearmButton.GetComponent<FVRPointableButton>().Text.text = "";
break;
case 2:
case 3:
if (SR_Manager.instance.character.rearmingCost > 0)
{
rearmButton.GetComponent<FVRPointableButton>().Text.text = SR_Manager.instance.character.rearmingCost.ToString();
}
else
{
rearmButton.GetComponent<FVRPointableButton>().Text.text = "";
}
break;
}
switch (SR_Manager.instance.character.modeSpeedLoaders)
{
case 0:
speedloaderButton.SetActive(false);
break;
default:
speedloaderButton.SetActive(true);
speedloaderButton.GetComponent<FVRPointableButton>().Text.text = "";
break;
case 2:
case 3:
if (SR_Manager.instance.character.speedLoadersCost > 0)
{
speedloaderButton.GetComponent<FVRPointableButton>().Text.text = SR_Manager.instance.character.speedLoadersCost.ToString();
}
else
{
speedloaderButton.GetComponent<FVRPointableButton>().Text.text = "";
}
break;
}
switch (SR_Manager.instance.character.modeClips)
{
case 0:
clipButton.SetActive(false);
break;
default:
clipButton.SetActive(true);
clipButton.GetComponent<FVRPointableButton>().Text.text = "";
break;
case 2:
case 3:
if (SR_Manager.instance.character.clipsCost > 0)
{
clipButton.GetComponent<FVRPointableButton>().Text.text = SR_Manager.instance.character.clipsCost.ToString();
}
else
{
clipButton.GetComponent<FVRPointableButton>().Text.text = "";
}
break;
}
switch (SR_Manager.instance.character.modeRounds)
{
case 0:
roundButton.SetActive(false);
togglePagesButton.SetActive(false);
break;
default:
roundButton.SetActive(true);
togglePagesButton.SetActive(true);
roundButton.GetComponent<FVRPointableButton>().Text.text = "";
break;
case 2:
case 3:
if (SR_Manager.instance.character.roundsCost > 0)
{
roundButton.GetComponent<FVRPointableButton>().Text.text = SR_Manager.instance.character.roundsCost.ToString();
}
else
{
roundButton.GetComponent<FVRPointableButton>().Text.text = "";
}
break;
}
}
public void SetAmmoType(AmmoEnum ammo)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
selectedAmmoType = ammo;
if (ammoTypeButtons[(int)selectedAmmoType].activeSelf)
{
selectionIcon.position = ammoTypeButtons[(int)selectedAmmoType].transform.position;
}
else
{
((Component)selectionIcon).gameObject.SetActive(false);
}
}
private bool CanSpawn(int mode, int cost, int id)
{
if (purchaseButtons[id] || mode <= 1)
{
return true;
}
if (mode > 1 && cost > 0 && SR_Manager.EnoughPoints(cost) && SR_Manager.SpendPoints(cost))
{
if (mode == 2)
{
purchaseButtons[id] = true;
switch (id)
{
case 0:
rearmButton.GetComponent<FVRPointableButton>().Text.text = "";
break;
case 1:
speedloaderButton.GetComponent<FVRPointableButton>().Text.text = "";
break;
case 2:
clipButton.GetComponent<FVRPointableButton>().Text.text = "";
break;
case 3:
roundButton.GetComponent<FVRPointableButton>().Text.text = "";
break;
}
}
return true;
}
return false;
}
public void Button_SpawnRound()
{
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
if (m_roundTypes == null || m_roundTypes.Count < 1 || ammoList == null || !CanSpawn(SR_Manager.instance.character.modeRounds, SR_Manager.instance.character.roundsCost, 3))
{
SR_Manager.PlayFailSFX();
return;
}
for (int i = 0; i < ammoList.Count; i++)
{
if (ammoList[i].roundClasses == null)
{
continue;
}
for (int j = 0; j < ammoList[i].roundClasses.Count; j++)
{
if (ammoList[i].roundClasses[j].ammo == selectedAmmoType)
{
FVRObject roundSelfPrefab = AM.GetRoundSelfPrefab(ammoList[i].roundType, ammoList[i].roundClasses[j].roundClass);
if ((Object)(object)roundSelfPrefab != (Object)null)
{
Object.Instantiate<GameObject>(((AnvilAsset)roundSelfPrefab).GetGameObject(), Spawnpoint_Round.position + Vector3.up * (float)i * 0.1f, Spawnpoint_Round.rotation);
break;
}
}
}
}
SR_Manager.PlayRearmSFX();
}
public void Button_SpawnSpeedLoader()
{
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Invalid comparison between Unknown and I4
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
if (!CanSpawn(SR_Manager.instance.character.modeSpeedLoaders, SR_Manager.instance.character.speedLoadersCost, 1))
{
SR_Manager.PlayFailSFX();
return;
}
bool flag = false;
List<FVRObject> list = new List<FVRObject>();
for (int i = 0; i < m_detectedFirearms.Count; i++)
{
if (!IM.OD.ContainsKey(((FVRPhysicalObject)m_detectedFirearms[i]).ObjectWrapper.ItemID))
{
continue;
}
List<FVRObject> list2 = new List<FVRObject>(ManagerSingleton<IM>.Instance.odicTagCategory[(ObjectCategory)6]);
for (int num = list2.Count - 1; num >= 0; num--)
{
if ((int)list2[num].Category == 6 && list2[num].RoundType == m_detectedFirearms[i].RoundType)
{
list.Add(list2[num]);
}
}
}
for (int j = 0; j < list.Count; j++)
{
GameObject gameObject = ((AnvilAsset)list[j]).GetGameObject();
Speedloader component = gameObject.GetComponent<Speedloader>();
if (!component.IsPretendingToBeAMagazine)
{
flag = true;
GameObject val = Object.Instantiate<GameObject>(gameObject, Spawnpoint_Round.position + Vector3.up * (float)j * 0.1f, Spawnpoint_Round.rotation);
}
}
if (flag)
{
SR_Manager.PlayRearmSFX();
}
else
{
SR_Manager.PlayFailSFX();
}
}
public void Button_SpawnClip()
{
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: 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_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: 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_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: Unknown result type (might be due to invalid IL or missing references)
//IL_0236: Unknown result type (might be due to invalid IL or missing references)
//IL_023d: Unknown result type (might be due to invalid IL or missing references)
//IL_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_024c: Unknown result type (might be due to invalid IL or missing references)
//IL_0257: Unknown result type (might be due to invalid IL or missing references)
//IL_0287: Unknown result type (might be due to invalid IL or missing references)
if (!CanSpawn(SR_Manager.instance.character.modeClips, SR_Manager.instance.character.clipsCost, 2))
{
SR_Manager.PlayFailSFX();
return;
}
bool flag = false;
for (int i = 0; i < m_detectedFirearms.Count; i++)
{
if (!IM.OD.ContainsKey(((FVRPhysicalObject)m_detectedFirearms[i]).ObjectWrapper.ItemID))
{
continue;
}
FVRObject val = IM.OD[((FVRPhysicalObject)m_detectedFirearms[i]).ObjectWrapper.ItemID];
for (int j = 0; j < ammoList.Count; j++)
{
if (ammoList[j].roundClasses == null)
{
continue;
}
for (int k = 0; k < ammoList[j].roundClasses.Count; k++)
{
if (ammoList[j].roundClasses[k].ammo != selectedAmmoType)
{
continue;
}
if (val.CompatibleClips.Count > 0 && ammoList[j].roundType == val.CompatibleClips[0].RoundType)
{
flag = true;
FVRObject val2 = val.CompatibleClips[0];
GameObject val3 = Object.Instantiate<GameObject>(((AnvilAsset)val2).GetGameObject(), Spawnpoint_Round.position + Vector3.up * (float)i * 0.1f, Spawnpoint_Round.rotation);
FVRFireArmClip component = val3.GetComponent<FVRFireArmClip>();
component.ReloadClipWithType(ammoList[j].roundClasses[k].roundClass);
}
else if (val.CompatibleMagazines.Count > 0 && ammoList[j].roundType == val.CompatibleMagazines[0].RoundType)
{
GameObject gameObject = ((AnvilAsset)val.CompatibleMagazines[0]).GetGameObject();
FVRFireArmMagazine component2 = gameObject.GetComponent<FVRFireArmMagazine>();
if (component2.IsEnBloc)
{
flag = true;
GameObject val4 = Object.Instantiate<GameObject>(gameObject, Spawnpoint_Round.position + Vector3.up * (float)i * 0.1f, Spawnpoint_Round.rotation);
component2 = val4.GetComponent<FVRFireArmMagazine>();
component2.ReloadMagWithType(ammoList[j].roundClasses[k].roundClass);
}
}
}
}
}
if (flag)
{
SR_Manager.PlayRearmSFX();
}
else
{
SR_Manager.PlayFailSFX();
}
}
public void Button_ReloadGuns()
{
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_0245: Unknown result type (might be due to invalid IL or missing references)
if (!CanSpawn(SR_Manager.instance.character.modeRearming, SR_Manager.instance.character.rearmingCost, 0))
{
SR_Manager.PlayFailSFX();
return;
}
if (m_detectedMags.Count < 1 && m_detectedClips.Count < 1 && m_detectedSLs.Count < 1 && m_detectedSweapons.Count < 1)
{
SR_Manager.PlayFailSFX();
return;
}
for (int i = 0; i < ammoList.Count; i++)
{
if (ammoList[i].roundClasses == null)
{
continue;
}
for (int j = 0; j < ammoList[i].roundClasses.Count; j++)
{
if (ammoList[i].roundClasses[j].ammo != selectedAmmoType)
{
continue;
}
for (int k = 0; k < m_detectedMags.Count; k++)
{
if (ammoList[i].roundType == m_detectedMags[k].RoundType)
{
m_detectedMags[k].ReloadMagWithType(ammoList[i].roundClasses[j].roundClass);
}
}
for (int l = 0; l < m_detectedClips.Count; l++)
{
if (ammoList[i].roundType == m_detectedClips[l].RoundType)
{
m_detectedClips[l].ReloadClipWithType(ammoList[i].roundClasses[j].roundClass);
}
}
for (int m = 0; m < m_detectedSLs.Count; m++)
{
if (ammoList[i].roundType == m_detectedSLs[m].Chambers[0].Type)
{
m_detectedSLs[m].ReloadClipWithType(ammoList[i].roundClasses[j].roundClass);
}
}
for (int n = 0; n < m_detectedSweapons.Count; n++)
{
m_detectedSweapons[n].W.InstaReload();
}
}
}
SR_Manager.PlayRearmSFX();
}
private FireArmRoundClass GetFirearmRoundClassFromType(string itemID, FireArmRoundType t)
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: 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)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < AM.SRoundDisplayDataDic[t].Classes.Length; i++)
{
if (AM.SRoundDisplayDataDic[t].Classes[i].ObjectID.ItemID == itemID)
{
return AM.SRoundDisplayDataDic[t].Classes[i].Class;
}
}
return AM.SRoundDisplayDataDic[t].Classes[0].Class;
}
private void Scan()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: 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_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Invalid comparison between Unknown and I4
//IL_0305: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: 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_0329: Unknown result type (might be due to invalid IL or missing references)
//IL_0378: Unknown result type (might be due to invalid IL or missing references)
//IL_0382: Invalid comparison between Unknown and I4
//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_020c: Unknown result type (might be due to invalid IL or missing references)
//IL_044c: Unknown result type (might be due to invalid IL or missing references)
//IL_0452: Invalid comparison between Unknown and I4
int num = Physics.OverlapBoxNonAlloc(ScanningVolume.position, ScanningVolume.localScale * 0.5f, colbuffer, ScanningVolume.rotation, LayerMask.op_Implicit(ScanningLM), (QueryTriggerInteraction)2);
m_roundTypes.Clear();
m_detectedMags.Clear();
m_detectedClips.Clear();
m_detectedSLs.Clear();
m_detectedSweapons.Clear();
m_detectedFirearms.Clear();
for (int i = 0; i < num; i++)
{
if (!((Object)(object)colbuffer[i].attachedRigidbody != (Object)null))
{
continue;
}
FVRFireArm component = ((Component)colbuffer[i].attachedRigidbody).gameObject.GetComponent<FVRFireArm>();
if ((Object)(object)component != (Object)null && (int)component.RoundType != 993)
{
if (!m_detectedFirearms.Contains(component))
{
m_detectedFirearms.Add(component);
}
if (!m_roundTypes.Contains(component.RoundType))
{
m_roundTypes.Add(component.RoundType);
}
if ((Object)(object)component.Magazine != (Object)null && !m_detectedMags.Contains(component.Magazine))
{
m_detectedMags.Add(component.Magazine);
}
if (((FVRPhysicalObject)component).Attachments.Count > 0)
{
for (int j = 0; j < ((FVRPhysicalObject)component).Attachments.Count; j++)
{
if (((FVRPhysicalObject)component).Attachments[j] is AttachableFirearmPhysicalObject)
{
List<FireArmRoundType> roundTypes = m_roundTypes;
FVRFireArmAttachment obj = ((FVRPhysicalObject)component).Attachments[j];
if (!roundTypes.Contains(((AttachableFirearmPhysicalObject)((obj is AttachableFirearmPhysicalObject) ? obj : null)).FA.RoundType))
{
List<FireArmRoundType> roundTypes2 = m_roundTypes;
FVRFireArmAttachment obj2 = ((FVRPhysicalObject)component).Attachments[j];
roundTypes2.Add(((AttachableFirearmPhysicalObject)((obj2 is AttachableFirearmPhysicalObject) ? obj2 : null)).FA.RoundType);
}
FVRFireArmAttachment obj3 = ((FVRPhysicalObject)component).Attachments[j];
if ((Object)(object)((AttachableFirearmPhysicalObject)((obj3 is AttachableFirearmPhysicalObject) ? obj3 : null)).FA.Magazine != (Object)null)
{
List<FVRFireArmMagazine> detectedMags = m_detectedMags;
FVRFireArmAttachment obj4 = ((FVRPhysicalObject)component).Attachments[j];
detectedMags.Add(((AttachableFirearmPhysicalObject)((obj4 is AttachableFirearmPhysicalObject) ? obj4 : null)).FA.Magazine);
}
}
}
}
if ((Object)(object)component.GetIntegratedAttachableFirearm() != (Object)null && !m_roundTypes.Contains(component.GetIntegratedAttachableFirearm().RoundType))
{
m_roundTypes.Add(component.GetIntegratedAttachableFirearm().RoundType);
}
}
AttachableFirearmPhysicalObject component2 = ((Component)colbuffer[i].attachedRigidbody).gameObject.GetComponent<AttachableFirearmPhysicalObject>();
if ((Object)(object)component2 != (Object)null && !m_roundTypes.Contains(component2.FA.RoundType))
{
m_roundTypes.Add(component2.FA.RoundType);
}
FVRFireArmMagazine component3 = ((Component)colbuffer[i].attachedRigidbody).gameObject.GetComponent<FVRFireArmMagazine>();
if ((Object)(object)component3 != (Object)null && (Object)(object)component3.FireArm == (Object)null && !m_detectedMags.Contains(component3) && (int)component3.RoundType != 993)
{
m_detectedMags.Add(component3);
}
FVRFireArmClip component4 = ((Component)colbuffer[i].attachedRigidbody).gameObject.GetComponent<FVRFireArmClip>();
if ((Object)(object)component4 != (Object)null && (Object)(object)component4.FireArm == (Object)null && !m_detectedClips.Contains(component4))
{
m_detectedClips.Add(component4);
}
Speedloader component5 = ((Component)colbuffer[i].attachedRigidbody).gameObject.GetComponent<Speedloader>();
if ((Object)(object)component5 != (Object)null && !m_detectedSLs.Contains(component5))
{
m_detectedSLs.Add(component5);
}
if ((int)SR_Manager.instance.shakeReloading == 1)
{
SosigWeaponPlayerInterface component6 = ((Component)colbuffer[i].attachedRigidbody).gameObject.GetComponent<SosigWeaponPlayerInterface>();
if ((Object)(object)component6 != (Object)null && !m_detectedSweapons.Contains(component6))
{
m_detectedSweapons.Add(component6);
}
}
}
UpdateAmmoTypeDisplay();
}
private void UpdateAmmoTypeDisplay()
{
//IL_002b: 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_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
allRoundTypes.Clear();
ammoList.Clear();
for (int i = 0; i < m_roundTypes.Count; i++)
{
if (!allRoundTypes.Contains(m_roundTypes[i]))
{
allRoundTypes.Add(m_roundTypes[i]);
}
}
for (int j = 0; j < m_detectedMags.Count; j++)
{
if (!allRoundTypes.Contains(m_detectedMags[j].RoundType))
{
allRoundTypes.Add(m_detectedMags[j].RoundType);
}
}
for (int k = 0; k < m_detectedClips.Count; k++)
{
if (!allRoundTypes.Contains(m_detectedClips[k].RoundType))
{
allRoundTypes.Add(m_detectedClips[k].RoundType);
}
}
for (int l = 0; l < m_detectedSLs.Count; l++)
{
if (!allRoundTypes.Contains(m_detectedSLs[l].Chambers[0].Type))
{
allRoundTypes.Add(m_detectedSLs[l].Chambers[0].Type);
}
}
for (int m = 0; m < allRoundTypes.Count; m++)
{
AmmoRound ammoRound = new AmmoRound();
ammoRound.roundType = allRoundTypes[m];
ammoRound.roundClasses = new List<AmmoClass>();
ammoList.Add(ammoRound);
}
ClearAmmoButtons();
if (ammoList.Count == 0)
{
((Component)selectionIcon).gameObject.SetActive(false);
SetAmmoType(AmmoEnum.Standard);
UpdateDisplayButtons();
return;
}
if (roundPage.activeSelf)
{
PopulateRoundPage();
}
SetAmmoType(selectedAmmoType);
UpdateAmmoList();
}
private void UpdateAmmoList()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < ammoList.Count; i++)
{
if (ammoList[i] == null)
{
continue;
}
AM.STypeClassLists.TryGetValue(ammoList[i].roundType, out var value);
if (value != null)
{
int count = value.Count;
ammoList[i].roundClasses.Clear();
for (int j = 0; j < count; j++)
{
FireArmRoundClass round = value[j];
AmmoClass item = new AmmoClass
{
roundClass = round,
ammo = SR_Global.GetAmmoEnum(round),
isOnlyType = true
};
ammoList[i].roundClasses.Add(item);
}
}
}
UpdateDisplayButtons();
}
private void ClearAmmoButtons()
{
for (int i = 0; i < roundButtons.Count; i++)
{
if (Object.op_Implicit((Object)(object)roundButtons[i]))
{
Object.Destroy((Object)(object)((Component)roundButtons[i]).gameObject);
}
}
}
private void UpdateDisplayButtons()
{
((Component)selectionIcon).gameObject.SetActive(false);
for (int i = 0; i < ammoTypeButtons.Length; i++)
{
if ((Object)(object)ammoTypeButtons[i] != (Object)null)
{
ammoTypeButtons[i].SetActive(false);
}
}
for (int j = 0; j < ammoList.Count; j++)
{
if (ammoList[j].roundClasses == null)
{
continue;
}
for (int k = 0; k < ammoList[j].roundClasses.Count; k++)
{
if (!((Object)(object)ammoTypeButtons[(int)ammoList[j].roundClasses[k].ammo] == (Object)null) && SR_Manager.instance.character.ammoUpgradeCost[(int)ammoList[j].roundClasses[k].ammo] > -1 && SR_Manager.instance.character.ammoUpgradeCost[(int)ammoList[j].roundClasses[k].ammo] >= 0 && ammoPage.activeSelf)
{
ammoTypeButtons[(int)ammoList[j].roundClasses[k].ammo].SetActive(true);
if (purchasedAmmoTypes[(int)ammoList[j].roundClasses[k].ammo])
{
SetSelectionIcon((int)selectedAmmoType);
}
}
}
}
if (ammoList.Count > 0 && ammoPage.activeSelf)
{
SetSelectionIcon((int)selectedAmmoType);
}
}
private void SetSelectionIcon(int i)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
((Component)selectionIcon).gameObject.SetActive(true);
selectionIcon.position = ammoTypeButtons[i].transform.position;
}
private void OnDrawGizmos()
{
//IL_0001: 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_001d: 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)
Gizmos.color = Color.yellow;
Gizmos.DrawWireCube(ScanningVolume.position, ScanningVolume.localScale * 0.5f);
}
}
[CreateAssetMenu(fileName = "SR Assets", menuName = "Supply Raid/SR Assets", order = 1)]
public class SR_Assets : ScriptableObject
{
[Header("Gameplay")]
public SR_Compass srCompass;
public SR_CaptureZone srCaptureZone;
public SR_Manager srManager;
[Header("Menus")]
public SR_Menu srMenu;
public SR_BuyMenu srBuyMenu;
public SR_AmmoSpawner srAmmoSpawner;
public SR_MagazineDuplicator srMagazineDuplicator;
public SR_ModTable srModTable;
public SR_Recycler srRecycler;
public SR_ResultsMenu srResultsMenu;
public SR_SpawnMenu srSpawnMenu;
public SR_SpawnStation srSpawnStation;
public SR_MapSelector srMapSelector;
}
public class SR_BuyMenu : MonoBehaviour
{
public class CategoryButton
{
public GameObject categoryButton;
public SR_ItemCategory itemCategory;
}
public static SR_BuyMenu instance;
public List<CategoryButton> categoryItems = new List<CategoryButton>();
[Header("Spawn Points")]
[SerializeField]
private Transform[] spawnPoints;
[Header("Loot Tables")]
private List<SR_PurchaseCategory> purchaseCategories = new List<SR_PurchaseCategory>();
private LootTable[] lootTables;
[Header("Prefabs")]
[SerializeField]
private GameObject buttonTabPrefab;
[SerializeField]
private GameObject buttonContainerPrefab;
[SerializeField]
private GameObject buyButtonPrefab;
[Header("Tabs")]
[SerializeField]
private Transform tabContainer;
[SerializeField]
private BuyMenuContainer[] tabContainers;
public Text pointDisplay;
private void Awake()
{
instance = this;
}
public void Setup()
{
if ((Object)(object)SR_Manager.instance != (Object)null)
{
SR_Manager.PointEvent += UpdatePoints;
SR_Manager.LaunchedEvent += StartGame;
pointDisplay.text = SR_Manager.instance.Points.ToString();
}
}
private void OnDestroy()
{
SR_Manager.PointEvent -= UpdatePoints;
SR_Manager.LaunchedEvent -= StartGame;
}
private void Update()
{
}
private void StartGame()
{
purchaseCategories = SR_Manager.instance.character.purchaseCategories;
GenerateLootTables();
GenerateButtons();
}
public void OpenMenu(int index)
{
for (int i = 0; i < tabContainers.Length; i++)
{
if (Object.op_Implicit((Object)(object)tabContainers[i].container))
{
tabContainers[i].container.SetActive(false);
}
}
tabContainers[index].container.SetActive(true);
SR_Manager.PlayConfirmSFX();
}
private void UpdatePoints(int i)
{
if ((Object)(object)SR_Manager.instance != (Object)null)
{
pointDisplay.text = SR_Manager.instance.Points.ToString();
}
}
private void GenerateButtons()
{
//IL_006f: 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_0076: 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_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Expected I4, but got Unknown
List<string> list = new List<string>();
for (int i = 0; i < purchaseCategories.Count; i++)
{
if (list.Contains(purchaseCategories[i].ItemCategory().category))
{
continue;
}
if (purchaseCategories[i].ItemCategory().category == "")
{
LootTableType type = purchaseCategories[i].ItemCategory().type;
LootTableType val = type;
string text = (int)val switch
{
1 => "Standard_Powerup",
2 => "Standard_Thrown",
3 => "Standard_Attachments",
4 => "Standard_Melee",
_ => "Standard_Firearm",
};
if (!list.Contains(text))
{
list.Add(text);
}
purchaseCategories[i].ItemCategory().category = text;
}
else
{
list.Add(purchaseCategories[i].ItemCategory().category);
}
}
tabContainers = new BuyMenuContainer[list.Count];
for (int j = 0; j < tabContainers.Length; j++)
{
tabContainers[j] = new BuyMenuContainer();
tabContainers[j].name = list[j];
tabContainers[j].container = Object.Instantiate<GameObject>(buttonContainerPrefab, buttonContainerPrefab.transform.parent);
tabContainers[j].container.SetActive(false);
tabContainers[j].tabButton = Object.Instantiate<GameObject>(buttonTabPrefab, tabContainer).GetComponent<SR_GenericButton>();
((Component)tabContainers[j].tabButton).gameObject.SetActive(true);
tabContainers[j].tabButton.index = j;
if (tabContainers[j].name != "")
{
string[] files = Directory.GetFiles(Paths.PluginPath, "*" + tabContainers[j].name + ".png", SearchOption.AllDirectories);
if (files.Length != 0 && files[0] != "")
{
Sprite sprite = SR_Global.LoadSprite(files[0]);
tabContainers[j].tabButton.thumbnail.sprite = sprite;
}
}
else
{
Debug.LogError((object)("Supply Raid: No Icon found for category " + tabContainers[j].name));
}
}
for (int k = 0; k < purchaseCategories.Count; k++)
{
if (purchaseCategories[k].ItemCategory().objectGroups.Count == 0 && lootTables[k].Loot.Count == 0)
{
continue;
}
for (int l = 0; l < tabContainers.Length; l++)
{
if (purchaseCategories[k].ItemCategory().category == tabContainers[l].name)
{
SR_GenericButton component = Object.Instantiate<GameObject>(buyButtonPrefab, tabContainers[l].container.transform).GetComponent<SR_GenericButton>();
((Component)component).gameObject.SetActive(true);
component.index = k;
component.thumbnail.sprite = purchaseCategories[k].ItemCategory().Thumbnail();
component.text.text = purchaseCategories[k].cost.ToString();
((Object)component).name = purchaseCategories[k].ItemCategory().name;
CategoryButton categoryButton = new CategoryButton();
categoryButton.itemCategory = purchaseCategories[k].ItemCategory();
categoryButton.categoryButton = ((Component)component).gameObject;
categoryItems.Add(categoryButton);
break;
}
}
}
UpdateBuyItems();
}
public void UpdateBuyItems()
{
for (int i = 0; i < categoryItems.Count; i++)
{
if (categoryItems[i] != null)
{
if ((categoryItems[i].itemCategory.minLevel == -1 || categoryItems[i].itemCategory.minLevel <= SR_Manager.instance.CurrentCaptures) && (categoryItems[i].itemCategory.maxLevel == -1 || categoryItems[i].itemCategory.maxLevel >= SR_Manager.instance.CurrentCaptures))
{
categoryItems[i].categoryButton.SetActive(true);
}
else
{
categoryItems[i].categoryButton.SetActive(false);
}
}
}
}
public void SpawnLootButton(int i)
{
if (i > lootTables.Length || i > purchaseCategories.Count)
{
SR_Manager.PlayFailSFX();
}
else if (SR_Manager.EnoughPoints(purchaseCategories[i].cost))
{
if (SR_Global.SpawnLoot(lootTables[i], purchaseCategories[i].ItemCategory(), spawnPoints))
{
SR_Manager.PlayConfirmSFX();
SR_Manager.SpendPoints(purchaseCategories[i].cost);
}
else
{
SR_Manager.PlayFailSFX();
}
}
else
{
SR_Manager.PlayFailSFX();
}
}
private void GenerateLootTables()
{
Debug.Log((object)("Supply Raid: Purchase Items: " + purchaseCategories.Count));
lootTables = (LootTable[])(object)new LootTable[purchaseCategories.Count];
for (int i = 0; i < purchaseCategories.Count; i++)
{
if (purchaseCategories[i] != null)
{
lootTables[i] = purchaseCategories[i].ItemCategory().InitializeLootTable();
}
else
{
Debug.Log((object)"Supply Raid: Missing Purchase Category");
}
}
}
public void SpawnObjectAtPlace(FVRObject obj, Vector3 pos, Quaternion rotation)
{
//IL_0007: U