Decompiled source of SupplyRaid v1.1.0
SupplyRaid.dll
Decompiled 5 months ago
The result has been truncated due to the large size, download it to view full contents!
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 BepInEx; using BepInEx.Bootstrap; using FistVR; using H3MP; using H3MP.Networking; using H3MP.Scripts; using Sodalite.Api; using SupplyRaid; using UnityEngine; using UnityEngine.AI; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyCompany("SupplyRaid")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+4127f5b3237d401685f181718f9c0cb184ee2be4")] [assembly: AssemblyProduct("SupplyRaid")] [assembly: AssemblyTitle("SupplyRaid")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] 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 SupplyRaid { public class Hooks { public void Hook() { } public void Unhook() { } } internal static class PluginInfo { internal const string NAME = "Supply Raid"; internal const string GUID = "com.Packer.SupplyRaid"; internal const string VERSION = "1.1.0"; } public class SR_Networking : MonoBehaviour { public static SR_Networking instance; public bool isClient; 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()) { 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) { Debug.Log((object)(">>>>>>>>> OnPlayerJoined: " + clientID)); } private void SetupPacketTypes() { //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Expected O, but got Unknown //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Expected O, but got Unknown //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Expected O, but got Unknown //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Expected O, but got Unknown //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Expected O, but got Unknown //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Expected O, but got Unknown //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Expected O, but got Unknown //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Expected O, but got Unknown //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Expected O, but got Unknown //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: 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_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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown if (Networking.ServerRunning() && !Networking.IsClient()) { Packet val = new Packet(gameOptions_ID); val.Write(SR_Manager.instance.optionPlayerCount); val.Write(SR_Manager.instance.optionDifficulty); val.Write(SR_Manager.instance.optionFreeBuyMenu); val.Write(SR_Manager.instance.optionSpawnLocking); val.Write(SR_Manager.instance.optionStartLevel); val.Write(SR_Manager.instance.optionPlayerHealth); val.Write(SR_Manager.instance.optionItemSpawner); val.Write(SR_Manager.instance.optionCaptureZone); val.Write(SR_Manager.instance.optionCaptureOrder); val.Write(SR_Manager.instance.optionCaptures); val.Write(SR_Manager.instance.optionRespawn); val.Write(SR_Manager.instance.optionMaxEnemies); val.Write(SR_Manager.instance.optionMaxSquadEnemies); string text = ""; if (SR_Manager.Faction() != null) { text = SR_Manager.Faction().name; } val.Write(text); ServerSend.SendTCPDataToAll(val, true); } } private void GameOptions_Handler(int clientID, Packet packet) { int playerCount = packet.ReadInt(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 maxEnemies = packet.ReadInt(true); int maxSquadEnemies = packet.ReadInt(true); string factionID = packet.ReadString(true); SR_Manager.instance.Network_GameOptions(playerCount, difficulty, freeBuyMenu, spawnLocking, startLevel, playerHealth, itemSpawner, captureZone, order, captures, respawn, maxEnemies, maxSquadEnemies, factionID); } public void CapturedZone_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.IsHost()) { Debug.Log((object)"Client Sending CaptureZone"); Packet val = new Packet(capturedZone_ID); ClientSend.SendTCPData(val, true); } } private void CapturedZone_Handler(int clientID, Packet packet) { Debug.Log((object)"Received Client Captured zone"); if (SR_Manager.instance.captureProtection <= 0f) { SR_Manager.instance.CapturedPoint(); } } public void ServerRunning_Send() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown if (Networking.ServerRunning() && !Networking.IsHost()) { Debug.Log((object)"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)"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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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; } 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; [HideInInspector] [Tooltip("0 = Rearm \n1 = Speed Loader\n2 = Clip\n3 Round")] private bool[] purchaseButtons = new bool[4]; public GameObject[] ammoTypeButtons = (GameObject[])(object)new GameObject[28]; public AmmoEnum selectedAmmoType; 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 List<OTagEra> m_validEras = new List<OTagEra>(); private List<OTagSet> m_validSets = new List<OTagSet>(); private float m_scanTick = 1f; private List<AmmoRound> ammoList = new List<AmmoRound>(); private List<FireArmRoundType> allRoundTypes = new List<FireArmRoundType>(); private void Start() { instance = this; colbuffer = (Collider[])(object)new Collider[50]; } private void Update() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) 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); } } } public void Setup() { for (int i = 0; i < ammoTypeButtons.Length; i++) { SR_GenericButton component = ammoTypeButtons[i].GetComponent<SR_GenericButton>(); 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); break; default: roundButton.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_0033: 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 4: roundButton.GetComponent<FVRPointableButton>().Text.text = ""; break; } } return true; } return false; } public void Button_SpawnRound() { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: 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_0186: 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; for (int i = 0; i < m_detectedFirearms.Count; i++) { if (!IM.OD.ContainsKey(((FVRPhysicalObject)m_detectedFirearms[i]).ObjectWrapper.ItemID)) { continue; } 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; } FVRObject val = IM.OD[((FVRPhysicalObject)m_detectedFirearms[i]).ObjectWrapper.ItemID]; if (val.CompatibleSpeedLoaders.Count > 0 && ammoList[j].roundType == val.CompatibleSpeedLoaders[0].RoundType) { GameObject gameObject = ((AnvilAsset)val.CompatibleSpeedLoaders[0]).GetGameObject(); Speedloader component = gameObject.GetComponent<Speedloader>(); if (!component.IsPretendingToBeAMagazine) { flag = true; GameObject val2 = Object.Instantiate<GameObject>(gameObject, Spawnpoint_Round.position + Vector3.up * (float)i * 0.1f, Spawnpoint_Round.rotation); component = val2.GetComponent<Speedloader>(); component.ReloadClipWithType(ammoList[j].roundClasses[k].roundClass); } } } } } if (flag) { SR_Manager.PlayRearmSFX(); } else { SR_Manager.PlayFailSFX(); } } public void Button_SpawnClip() { //IL_00e6: 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_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: 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) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: 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_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_023e: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: 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 GetClassFromType(FireArmRoundType t) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) if (!m_decidedTypes.ContainsKey(t)) { List<FireArmRoundClass> list = new List<FireArmRoundClass>(); for (int i = 0; i < AM.SRoundDisplayDataDic[t].Classes.Length; i++) { FVRObject objectID = AM.SRoundDisplayDataDic[t].Classes[i].ObjectID; if (m_validEras.Contains(objectID.TagEra) && m_validSets.Contains(objectID.TagSet)) { list.Add(AM.SRoundDisplayDataDic[t].Classes[i].Class); } } if (list.Count > 0) { m_decidedTypes.Add(t, list[Random.Range(0, list.Count)]); } else { m_decidedTypes.Add(t, AM.GetRandomValidRoundClass(t)); } } return m_decidedTypes[t]; } private void Scan() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Invalid comparison between Unknown and I4 //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Invalid comparison between Unknown and I4 //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Invalid comparison between Unknown and I4 //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_011d: 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_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: 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); } if (ammoList.Count == 0) { ((Component)selectionIcon).gameObject.SetActive(false); SetAmmoType(AmmoEnum.Standard); UpdateDisplayButtons(); } else { SetAmmoType(selectedAmmoType); UpdateAmmoList(); } } private void UpdateAmmoList() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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) for (int i = 0; i < ammoList.Count; i++) { int count = AM.STypeClassLists[ammoList[i].roundType].Count; ammoList[i].roundClasses.Clear(); for (int j = 0; j < count; j++) { FireArmRoundClass round = AM.STypeClassLists[ammoList[i].roundType][j]; AmmoClass item = new AmmoClass { roundClass = round, ammo = SR_Global.GetAmmoEnum(round), isOnlyType = true }; ammoList[i].roundClasses.Add(item); } } UpdateDisplayButtons(); } 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) { ammoTypeButtons[(int)ammoList[j].roundClasses[k].ammo].SetActive(true); if (purchasedAmmoTypes[(int)ammoList[j].roundClasses[k].ammo]) { SetSelectionIcon((int)selectedAmmoType); } } } } if (ammoList.Count > 0) { SetSelectionIcon((int)selectedAmmoType); } } private void SetSelectionIcon(int i) { //IL_0024: 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_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) Gizmos.color = Color.yellow; Gizmos.DrawWireCube(ScanningVolume.position, ScanningVolume.localScale * 0.5f); } } public class SR_BuyMenu : MonoBehaviour { [Header("Spawn Points")] [SerializeField] private Transform[] spawnPoints; [Header("Loot Tables")] private List<SR_PurchaseCategory> purchaseCategories = new List<SR_PurchaseCategory>(); private LootTable[] lootTables; [Header("Loot Buttons")] [SerializeField] private Transform[] tabContent; [HideInInspector] public SR_GenericButton[] buttons; [SerializeField] private GameObject buttonPrefab; public Text pointDisplay; private void Start() { 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(); } private void UpdatePoints(int i) { if ((Object)(object)SR_Manager.instance != (Object)null) { pointDisplay.text = SR_Manager.instance.Points.ToString(); } } private void GenerateButtons() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) buttons = new SR_GenericButton[purchaseCategories.Count]; for (int i = 0; i < purchaseCategories.Count; i++) { SR_GenericButton component = Object.Instantiate<GameObject>(buttonPrefab, tabContent[purchaseCategories[i].ItemCategory().type]).GetComponent<SR_GenericButton>(); ((Component)component).gameObject.SetActive(true); buttons[i] = component; component.button = ((Component)component).GetComponent<Button>(); component.index = i; component.spawner = this; component.thumbnail.sprite = purchaseCategories[i].ItemCategory().Thumbnail(); component.text.text = purchaseCategories[i].cost.ToString(); ((Object)component).name = purchaseCategories[i].ItemCategory().name; } } public void SpawnLootButton(int i) { 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(); } } } public void SetTab(int exception) { for (int i = 0; i < tabContent.Length; i++) { ((Component)tabContent[i]).gameObject.SetActive(false); if (i == exception) { ((Component)tabContent[i]).gameObject.SetActive(true); } } } public void SpawnObjectAtPlace(FVRObject obj, Vector3 pos, Quaternion rotation) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(((AnvilAsset)obj).GetGameObject(), pos, rotation); FVRFireArmMagazine component = val.GetComponent<FVRFireArmMagazine>(); if ((Object)(object)component != (Object)null && (int)component.RoundType != 997) { component.ReloadMagWithTypeUpToPercentage(AM.GetDefaultRoundClass(component.RoundType), Mathf.Clamp(Random.Range(0.3f, 1f), 0.1f, 1f)); } } public void SpawnAmmoAtPlaceForGun(FVRObject gun, Vector3 pos, Quaternion rotation) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) if (gun.CompatibleMagazines.Count > 0) { SpawnObjectAtPlace(gun.CompatibleMagazines[Random.Range(0, gun.CompatibleMagazines.Count - 1)], pos, rotation); } else if (gun.CompatibleClips.Count > 0) { SpawnObjectAtPlace(gun.CompatibleClips[Random.Range(0, gun.CompatibleClips.Count - 1)], pos, rotation); } else if (gun.CompatibleSpeedLoaders.Count > 0) { SpawnObjectAtPlace(gun.CompatibleSpeedLoaders[Random.Range(0, gun.CompatibleSpeedLoaders.Count - 1)], pos, rotation); } else if (gun.CompatibleSingleRounds.Count > 0) { int num = Random.Range(2, 5); for (int i = 0; i < num; i++) { Vector3 pos2 = pos + Vector3.up * (0.05f * (float)i); SpawnObjectAtPlace(gun.CompatibleSingleRounds[Random.Range(0, gun.CompatibleSingleRounds.Count - 1)], pos2, rotation); } } } public static FVRObject GetLowestCapacityAmmoObject(FVRObject o, List<OTagEra> eras = null, int Min = -1, int Max = -1, List<OTagSet> sets = null) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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) o = IM.OD[o.ItemID]; if (o.CompatibleMagazines.Count > 0) { List<FVRObject> lowestCapacity = GetLowestCapacity(o.CompatibleMagazines, Min); return lowestCapacity[Random.Range(0, lowestCapacity.Count)]; } if ((int)o.Category == 1 && (int)o.MagazineType != 0) { List<FVRObject> lowestCapacity2 = GetLowestCapacity(IM.CompatMags[o.MagazineType], Min); return lowestCapacity2[Random.Range(0, lowestCapacity2.Count)]; } if (o.CompatibleClips.Count > 0) { List<FVRObject> lowestCapacity3 = GetLowestCapacity(o.CompatibleClips, Min); return lowestCapacity3[Random.Range(0, lowestCapacity3.Count)]; } if (o.CompatibleSpeedLoaders.Count > 0) { List<FVRObject> lowestCapacity4 = GetLowestCapacity(o.CompatibleSpeedLoaders, Min); return lowestCapacity4[Random.Range(0, lowestCapacity4.Count)]; } if (o.CompatibleSingleRounds.Count > 0) { if ((eras == null || eras.Count < 1) && (sets == null || sets.Count < 1)) { return o.CompatibleSingleRounds[Random.Range(0, o.CompatibleSingleRounds.Count)]; } List<FVRObject> list = new List<FVRObject>(); for (int i = 0; i < o.CompatibleSingleRounds.Count; i++) { bool flag = true; if (eras != null && eras.Count > 0 && !eras.Contains(o.CompatibleSingleRounds[i].TagEra)) { flag = false; } if (sets != null && sets.Count > 0 && !sets.Contains(o.CompatibleSingleRounds[i].TagSet)) { flag = false; } if (flag) { list.Add(o.CompatibleSingleRounds[i]); } } if (list.Count > 0) { FVRObject result = list[Random.Range(0, list.Count)]; list.Clear(); return result; } return o.CompatibleSingleRounds[0]; } return null; } public static List<FVRObject> GetLowestCapacity(List<FVRObject> ammo, int minCapacity) { List<FVRObject> list = new List<FVRObject>(); int num = int.MaxValue; for (int i = 0; i < ammo.Count; i++) { if (ammo[i].MagazineCapacity < num && ammo[i].MagazineCapacity >= minCapacity) { num = ammo[i].MagazineCapacity; } } for (int j = 0; j < ammo.Count; j++) { if (ammo[j].MagazineCapacity == num) { list.Add(ammo[j]); } } return list; } } public class SR_CaptureZone : MonoBehaviour { public Transform zone; public Text captureText; [HideInInspector] public float captureRemain = 15f; private float captureTick = 1f; [Header("Audio")] private Bounds bounds; private void Start() { ((Component)this).gameObject.SetActive(false); } private void Update() { if (SR_Manager.instance.gameRunning && SR_Manager.instance.optionCaptureZone) { CaptureZoneScan(); } else { ((Component)this).gameObject.SetActive(false); } } private void CaptureZoneScan() { //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) captureTick -= Time.deltaTime; if (!(captureTick <= 0f)) { return; } if (WithinCaptureZone()) { captureRemain -= 1f; if (captureRemain < 0f) { captureRemain = 0f; } captureTick = 1f; if (captureRemain > 5f) { SR_Manager.PlayTickSFX(); } else { SR_Manager.PlayTickAlmostSFX(); } if (!((Component)captureText).gameObject.activeSelf) { ((Component)captureText).gameObject.SetActive(true); } captureText.text = Mathf.RoundToInt(captureRemain).ToString(); if (captureRemain <= 0f) { if (Networking.IsClient()) { Transform obj = zone; obj.position -= Vector3.up * 100f; SR_Networking.instance.CapturedZone_Send(); } else if (SR_Manager.instance.captureProtection <= 0f) { SR_Manager.instance.CapturedPoint(); } captureRemain = SR_Manager.AttackSupplyPoint().captureTime; captureTick = Random.Range(0, 3); ((Component)captureText).gameObject.SetActive(false); } return; } if (((Component)captureText).gameObject.activeSelf) { if (SR_Manager.instance.captureProtection <= 0f) { SR_Manager.PlayFailSFX(); } ((Component)captureText).gameObject.SetActive(false); } captureRemain = SR_Manager.AttackSupplyPoint().captureTime; captureTick = Random.Range(0, 2); } public void MoveCaptureZone(Transform point) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) zone.position = point.position; zone.localScale = point.localScale; zone.rotation = point.rotation; ((Bounds)(ref bounds)).center = zone.position; ((Bounds)(ref bounds)).size = zone.localScale; captureRemain = SR_Manager.AttackSupplyPoint().captureTime; } private bool WithinCaptureZone() { //IL_0006: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0058: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Quaternion.Inverse(zone.rotation) * (GM.CurrentPlayerBody.Head.position - zone.position); if (Mathf.Abs(val.x) <= zone.localScale.x / 2f && Mathf.Abs(val.y) <= zone.localScale.y / 2f) { return Mathf.Abs(val.z) <= zone.localScale.z / 2f; } return false; } } [Serializable] public class SR_CharacterPreset { [Tooltip("(REQUIRED) Name of this character")] public string name = "Character Name"; [Tooltip("Short explanation of this character")] [Multiline(6)] public string description = "Put a brief explination of the character here"; [Tooltip("(REQUIRED) The menu category this character will go in, Recommend mod creator names etc")] public string category = "Mod"; public string factionName = ""; [Tooltip("Points player receives per capture, endless reuses the last array position")] public int[] pointsLevel = new int[1]; [Tooltip("Cost of a new Magazine - if -1 disable")] public int newMagazineCost = 1; [Tooltip("Cost of upgrading a magazine - if -1 disable")] public int upgradeMagazineCost = 2; [Tooltip("Cost of Duplicating a magazine - if -1 disable")] public int duplicateMagazineCost = 1; [Tooltip("Custom Mod Cost")] public int modCost = 1; [Tooltip("How many points the players get for recycling weapons")] public int recyclerPoints = 1; [Tooltip("How many points the players get for recycling the golden token")] public int recyclerTokens = 1; [Tooltip("0 = False\n1 = True\n3 = Buy Once\n 4 = Pay Every Time")] public int modeRearming = 1; public int rearmingCost; [Tooltip("0 = False\n1 = True\n3 = Buy Once\n 4 = Pay Every Time")] public int modeSpeedLoaders = 1; public int speedLoadersCost; [Tooltip("0 = False\n1 = True\n3 = Buy Once\n 4 = Pay Every Time")] public int modeClips = 1; public int clipsCost; [Tooltip("0 = False\n1 = True\n3 = Buy Once\n 4 = Pay Every Time")] public int modeRounds = 1; public int roundsCost; public bool disableAmmoTable; public bool disableModtable; public bool disableBuyMenu; public bool disableDuplicator; public bool disableRecycler; public int deathMode; public float deathCount; [Tooltip("Cost of each ammo upgrade, 0 is normally free as its the standard - 28 Ammo Types - if set to -1 disable")] public int[] ammoUpgradeCost = new int[28]; [Tooltip("Cost of each attachment - 16 Attachment Types, if set to -1 disable")] public int[] attachmentsCost = new int[16]; public List<string> startGearCategories = new List<string>(); [Tooltip("(REQUIRED) What buy categories are available to this character")] public List<SR_PurchaseCategory> purchaseCategories = new List<SR_PurchaseCategory>(); public List<SR_LootCategory> lootCategories = new List<SR_LootCategory>(); [Tooltip("Globally Removes these ObjectIDs from ALL system including Attachments and Ammo types")] public List<string> subtractionObjectIDs = new List<string>(); [Tooltip("Preview image of the character when selected")] private Sprite thumbnail; private int[] startGearIndex = new int[0]; private string thumbnailPath = ""; public void SetupCharacterPreset(List<SR_ItemCategory> items) { startGearIndex = new int[startGearCategories.Count]; for (int i = 0; i < startGearCategories.Count; i++) { startGearIndex[i] = -1; for (int j = 0; j < items.Count; j++) { if (items[j] != null && startGearCategories[i] == items[j].name) { startGearIndex[i] = j; break; } } if (startGearIndex[i] == -1) { Debug.LogError((object)("Supply Raid - Missing character start gear index: " + i)); } } List<SR_PurchaseCategory> list = new List<SR_PurchaseCategory>(); for (int k = 0; k < purchaseCategories.Count; k++) { for (int l = 0; l < items.Count; l++) { if (purchaseCategories[k].itemCategory == items[l].name) { purchaseCategories[k].SetIndex(l); break; } } if (purchaseCategories[k].GetIndex() == -1) { Debug.Log((object)("Supply Raid - Purchase Category " + purchaseCategories[k].itemCategory + " could not set item Category")); list.Add(purchaseCategories[k]); } } for (int m = 0; m < list.Count; m++) { purchaseCategories.Remove(list[m]); } List<SR_LootCategory> list2 = new List<SR_LootCategory>(); for (int n = 0; n < lootCategories.Count; n++) { if (lootCategories[n].GetIndex() != -1) { continue; } for (int num = 0; num < items.Count; num++) { if (lootCategories[n].itemCategory == items[num].name) { lootCategories[n].SetIndex(num); break; } } if (lootCategories[n].GetIndex() == -1) { Debug.Log((object)("Supply Raid - Purchase Category " + lootCategories[n].itemCategory + " could not set item Category")); list2.Add(lootCategories[n]); } } for (int num2 = 0; num2 < list2.Count; num2++) { lootCategories.Remove(list2[num2]); } if (factionName != "" && factionName != " ") { for (int num3 = 0; num3 < SR_Manager.instance.factions.Count && (SR_Manager.instance.factions[num3] == null || !(factionName == SR_Manager.instance.factions[num3].name)); num3++) { } } } public void SetupThumbnailPath(string thumbPath) { thumbnailPath = thumbPath; } public Sprite Thumbnail() { if (thumbnailPath == "") { Debug.LogError((object)("Supply Raid - Thumbnail not defined for character : " + category + "/" + name)); return null; } if ((Object)(object)thumbnail == (Object)null) { thumbnail = SR_Global.LoadSprite(thumbnailPath); } if ((Object)(object)thumbnail == (Object)null) { return SR_Manager.instance.fallbackThumbnail; } return thumbnail; } public int StartGearLength() { return startGearCategories.Count; } public SR_ItemCategory StartGear(int i) { if (i != -1 && startGearIndex[i] != -1) { return SR_Manager.instance.itemCategories[startGearIndex[i]]; } return null; } public bool HasRequirement() { if (name == "") { return false; } if (category == "") { return false; } return true; } } [Serializable] public class SR_LootCategory { private int index = -1; public float chance = 0.01f; public string itemCategory; public void SetIndex(int i) { index = i; } public int GetIndex() { return index; } public SR_ItemCategory ItemCategory() { if (index != -1) { return SR_Manager.instance.itemCategories[index]; } return null; } } [Serializable] public class SR_PurchaseCategory { private int index = -1; public string itemCategory; public int cost = 1; public void SetIndex(int i) { index = i; } public int GetIndex() { return index; } public SR_ItemCategory ItemCategory() { if (index != -1) { return SR_Manager.instance.itemCategories[index]; } return null; } } public class SR_Compass : MonoBehaviour { [Header("Directions")] public Transform supplyPointDirection; public Transform lastSupplyDirection; [Header("Setup")] public Transform face; public Text directionText; public Text pointsText; public float distance = 0.25f; public Slider healthBar; public Text healthText; public Text capturesText; [Header("Networking")] public GameObject playerArrowPrefab; public int playerCount; public List<Transform> playerArrows = new List<Transform>(); private void Start() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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) //IL_0089: Unknown result type (might be due to invalid IL or missing references) Transform transform = Object.Instantiate<GameObject>(((Component)supplyPointDirection.GetChild(0)).gameObject, supplyPointDirection.GetChild(0)).transform; ((Behaviour)((Component)supplyPointDirection.GetChild(0)).GetComponent<Image>()).enabled = false; supplyPointDirection.GetChild(0).localRotation = Quaternion.Euler(new Vector3(0f, 0f, 0f)); transform.localRotation = Quaternion.Euler(new Vector3(270f, 0f, 0f)); transform.localPosition = Vector3.zero; } private void Update() { //IL_0071: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)SR_Manager.instance == (Object)null || !SR_Manager.instance.gameRunning) { return; } if (!SR_Manager.instance.optionHand) { ((Component)this).transform.position = GM.CurrentPlayerBody.LeftHand.position - GM.CurrentPlayerBody.LeftHand.forward * distance; } else { ((Component)this).transform.position = GM.CurrentPlayerBody.RightHand.position - GM.CurrentPlayerBody.RightHand.forward * distance; } ((Component)this).transform.rotation = Quaternion.identity; ((Component)face).transform.LookAt(GM.CurrentPlayerBody.Head.position); Text obj = directionText; Quaternion rotation = GM.CurrentPlayerBody.Head.rotation; obj.text = Mathf.FloorToInt(((Quaternion)(ref rotation)).eulerAngles.y).ToString(); Vector3 position = SR_Manager.instance.GetLastSupplyPoint().position; position.y = ((Component)this).transform.position.y; lastSupplyDirection.LookAt(position); healthBar.value = GM.GetPlayerHealth(); if ((Object)(object)healthText != (Object)null) { healthText.text = Mathf.CeilToInt(GM.GetPlayerHealth() * (float)GM.CurrentPlayerBody.GetMaxHealthPlayerRaw()).ToString(); } Transform compassMarker = SR_Manager.instance.GetCompassMarker(); if (Object.op_Implicit((Object)(object)compassMarker)) { position = compassMarker.position; supplyPointDirection.GetChild(0).LookAt(position); position.y = ((Component)this).transform.position.y; supplyPointDirection.LookAt(position); pointsText.text = SR_Manager.instance.Points.ToString(); capturesText.text = (SR_Manager.instance.CurrentCaptures - SR_Manager.instance.optionStartLevel).ToString(); if (SupplyRaidPlugin.h3mpEnabled) { NetworkUpdate(); } } } private void NetworkUpdate() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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) if (Networking.ServerRunning()) { if (playerCount != Networking.GetPlayerCount()) { CreatePlayerArrows(); playerCount = Networking.GetPlayerCount(); } int[] playerIDs = Networking.GetPlayerIDs(); for (int i = 0; i < playerIDs.Length; i++) { Vector3 position = Networking.GetPlayer(playerIDs[i]).head.position; position.y = ((Component)this).transform.position.y; ((Component)playerArrows[i]).transform.LookAt(position); } } } private void CreatePlayerArrows() { for (int i = 0; i < playerArrows.Count; i++) { Object.Destroy((Object)(object)((Component)playerArrows[i]).gameObject); } playerArrows.Clear(); for (int j = 0; j < Networking.GetPlayerCount(); j++) { GameObject val = Object.Instantiate<GameObject>(playerArrowPrefab, playerArrowPrefab.transform.parent); val.SetActive(true); playerArrows.Add(val.transform); } } } public class SR_CustomSosig { } public class SR_GameObjects : MonoBehaviour { public enum SetStateEnum { False, True, Inverse, Random } public enum GameStateEnum { None, SupplyPointCaptured, SupplyPointAttack, SupplyPointIdle, BeforeLaunch, GameLaunch, GameComplete, Capture, FinalSupplyPoint, EndlessStart, ObjectiveComplete, ObjectiveFail, ObjectiveEnd } public GameStateEnum activeOn; public SetStateEnum setState = SetStateEnum.True; [Tooltip("Optional Supply Point Picker")] public SR_SupplyPoint supplyPoint; public GameObject[] gameObjects; private void Start() { switch (activeOn) { case GameStateEnum.SupplyPointCaptured: case GameStateEnum.SupplyPointAttack: case GameStateEnum.SupplyPointIdle: if (!((Object)(object)supplyPoint == (Object)null)) { SR_Manager.SupplyPointChangeEvent += OnSupplyPointChange; } break; case GameStateEnum.GameLaunch: SR_Manager.LaunchedEvent += SetGameObjects; break; case GameStateEnum.Capture: SR_Manager.SupplyPointChangeEvent += SetGameObjects; break; case GameStateEnum.GameComplete: SR_Manager.GameCompleteEvent += SetGameObjects; break; case GameStateEnum.FinalSupplyPoint: SR_Manager.SupplyPointChangeEvent += OnFinalSupplyPoint; break; case GameStateEnum.EndlessStart: SR_Manager.EndlessEvent += SetGameObjects; break; case GameStateEnum.ObjectiveComplete: case GameStateEnum.ObjectiveFail: case GameStateEnum.ObjectiveEnd: SR_Manager.ObjectiveEvent += OnObjectiveChange; break; case GameStateEnum.None: case GameStateEnum.BeforeLaunch: break; } } private void OnDestroy() { switch (activeOn) { case GameStateEnum.SupplyPointCaptured: case GameStateEnum.SupplyPointAttack: case GameStateEnum.SupplyPointIdle: SR_Manager.SupplyPointChangeEvent -= OnSupplyPointChange; break; case GameStateEnum.GameLaunch: SR_Manager.LaunchedEvent -= SetGameObjects; break; case GameStateEnum.GameComplete: SR_Manager.GameCompleteEvent -= SetGameObjects; break; case GameStateEnum.Capture: SR_Manager.SupplyPointChangeEvent -= SetGameObjects; break; case GameStateEnum.FinalSupplyPoint: SR_Manager.SupplyPointChangeEvent -= OnFinalSupplyPoint; break; case GameStateEnum.EndlessStart: SR_Manager.EndlessEvent -= SetGameObjects; break; case GameStateEnum.ObjectiveComplete: case GameStateEnum.ObjectiveFail: case GameStateEnum.ObjectiveEnd: SR_Manager.ObjectiveEvent -= OnObjectiveChange; break; case GameStateEnum.None: case GameStateEnum.BeforeLaunch: break; } } private void Update() { switch (activeOn) { case GameStateEnum.BeforeLaunch: if (!SR_Manager.instance.gameRunning) { SetGameObjects(); } break; } } private void OnFinalSupplyPoint() { if (SR_Manager.instance.optionCaptures > 0 && SR_Manager.instance.CurrentCaptures >= SR_Manager.instance.optionCaptures - 1) { SetGameObjects(); } } private void OnObjectiveChange() { switch (activeOn) { case GameStateEnum.ObjectiveComplete: if (SR_Manager.instance.stats.ObjectiveComplete) { SetGameObjects(); } break; case GameStateEnum.ObjectiveFail: if (!SR_Manager.instance.stats.ObjectiveComplete && SR_Manager.instance.optionCaptures > 0) { SetGameObjects(); } break; case GameStateEnum.ObjectiveEnd: if (!SR_Manager.instance.stats.ObjectiveComplete && SR_Manager.instance.optionCaptures <= 0) { SetGameObjects(); } break; } } private void OnSupplyPointChange() { switch (activeOn) { case GameStateEnum.SupplyPointCaptured: if ((Object)(object)SR_Manager.LastSupplyPoint() == (Object)(object)supplyPoint) { SetGameObjects(); } break; case GameStateEnum.SupplyPointAttack: if ((Object)(object)SR_Manager.AttackSupplyPoint() == (Object)(object)supplyPoint) { SetGameObjects(); } break; default: if ((Object)(object)SR_Manager.LastSupplyPoint() != (Object)(object)supplyPoint && (Object)(object)SR_Manager.AttackSupplyPoint() != (Object)(object)supplyPoint) { SetGameObjects(); } break; } } public void SetGameObjects() { for (int i = 0; i < gameObjects.Length; i++) { if (!((Object)(object)gameObjects[i] == (Object)null)) { if (setState == SetStateEnum.True) { gameObjects[i].SetActive(true); } else if (setState == SetStateEnum.False) { gameObjects[i].SetActive(false); } else if (setState == SetStateEnum.Inverse) { gameObjects[i].SetActive(!gameObjects[i].activeSelf); } else if (setState == SetStateEnum.Random) { int num = Random.Range(0, 10); gameObjects[i].SetActive(num < 6); } } } } } public class SR_GenericButton : MonoBehaviour { public int index = -1; public Image thumbnail; public Button button; public SR_BuyMenu spawner; public Text text; public GameObject go; public void SelectCharacter() { if (SR_Manager.instance.characters.Count > 0) { SR_Manager.instance.character = SR_Manager.instance.characters[index]; SR_Manager.PlayConfirmSFX(); SR_Menu.instance.UpdateCharacter(); if (SR_Manager.Character().factionName != "") { SR_Manager.instance.faction = SR_Global.GetFactionByName(SR_Manager.Character().factionName); SR_Menu.instance.UpdateFaction(); } } else { SR_Manager.PlayErrorSFX(); } } public void SelectCharacterCategory() { go.GetComponent<SR_Menu>().OpenCharacterCategory(index); SR_Manager.PlayConfirmSFX(); } public void SelectFactionCategory() { go.GetComponent<SR_Menu>().OpenFactionCategory(index); SR_Manager.PlayConfirmSFX(); } public void SelectFaction() { if (index < SR_Manager.instance.factions.Count) { SR_Manager.instance.faction = SR_Manager.instance.factions[index]; SR_Manager.PlayConfirmSFX(); SR_Manager.PlayConfirmSFX(); SR_Menu.instance.UpdateFaction(); } else { SR_Manager.PlayErrorSFX(); } } public void BuyLoot() { spawner.SpawnLootButton(index); } public void SpawnAtPlayer() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) if (index == -1) { Debug.Log((object)"Supply Raid: Attempting to spawn at player without an index set!"); return; } Transform head = Networking.GetPlayer(index).head; if ((Object)(object)head != (Object)null) { Vector3 val = head.position - head.forward; val.y = head.position.y - 0.4f; FVRMovementManager currentMovementManager = GM.CurrentMovementManager; Vector3 val2 = val; Quaternion rotation = head.rotation; currentMovementManager.TeleportToPoint(val2, true, ((Quaternion)(ref rotation)).eulerAngles); } else { Debug.LogError((object)("Supply Raid: Player " + index + " is missing their teleport transform")); } } public void BuyModAttachment() { go.GetComponent<SR_ModTable>().BuyAttachment(index); } public void TryBuyAmmo() { if ((Object)(object)SR_AmmoSpawner.instance == (Object)null || SR_Manager.instance.character.ammoUpgradeCost[index] <= -1) { return; } if (!SR_AmmoSpawner.instance.purchasedAmmoTypes[index]) { if (!SR_Manager.EnoughPoints(SR_Manager.instance.character.ammoUpgradeCost[index])) { SR_Manager.PlayFailSFX(); return; } if (SR_Manager.SpendPoints(SR_Manager.instance.character.ammoUpgradeCost[index])) { SR_AmmoSpawner.instance.purchasedAmmoTypes[index] = true; text.text = ""; SR_Manager.PlayPointsGainSFX(); } } if (SR_AmmoSpawner.instance.purchasedAmmoTypes[index]) { SR_Manager.PlayConfirmSFX(); SR_AmmoSpawner.instance.SetAmmoType((AmmoEnum)index); } } } public class SR_Global : MonoBehaviour { public static Material goldMaterial; public static Sprite LoadSprite(string path) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown Texture2D val = null; if (File.Exists(path) && (Object)(object)val == (Object)null) { byte[] array = File.ReadAllBytes(path); val = new Texture2D(2, 2); val.LoadImage(array); } if ((Object)(object)val == (Object)null) { Debug.LogError((object)("Supply Raid - Texture Not Found: " + path)); return null; } return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0f, 0f), 100f); } public static IEnumerator SpawnAllLevelSosigs() { Debug.Log((object)"Supply Raid - Spawning all Sosigs"); Transform spawnPoint = SR_Manager.AttackSupplyPoint().respawn; List<SosigEnemyID> idList = new List<SosigEnemyID>(); for (int x = 0; x < SR_Manager.instance.faction.levels.Length; x++) { if (SR_Manager.instance.faction.levels[x].guardPool != null && SR_Manager.instance.faction.levels[x].guardPool.sosigEnemyID != null) { for (int i = 0; i < SR_Manager.instance.faction.levels[x].guardPool.sosigEnemyID.Length; i++) { if (!idList.Contains(SR_Manager.instance.faction.levels[x].guardPool.sosigEnemyID[i])) { idList.Add(SR_Manager.instance.faction.levels[x].guardPool.sosigEnemyID[i]); } } } if (SR_Manager.instance.faction.levels[x].sniperPool != null && SR_Manager.instance.faction.levels[x].sniperPool.sosigEnemyID != null) { for (int j = 0; j < SR_Manager.instance.faction.levels[x].sniperPool.sosigEnemyID.Length; j++) { if (!idList.Contains(SR_Manager.instance.faction.levels[x].sniperPool.sosigEnemyID[j])) { idList.Add(SR_Manager.instance.faction.levels[x].sniperPool.sosigEnemyID[j]); } } } if (SR_Manager.instance.faction.levels[x].patrolPool != null && SR_Manager.instance.faction.levels[x].patrolPool.sosigEnemyID != null) { for (int k = 0; k < SR_Manager.instance.faction.levels[x].patrolPool.sosigEnemyID.Length; k++) { if (!idList.Contains(SR_Manager.instance.faction.levels[x].patrolPool.sosigEnemyID[k])) { idList.Add(SR_Manager.instance.faction.levels[x].patrolPool.sosigEnemyID[k]); } } } if (SR_Manager.instance.faction.levels[x].squadPool != null && SR_Manager.instance.faction.levels[x].squadPool.sosigEnemyID != null) { for (int l = 0; l < SR_Manager.instance.faction.levels[x].squadPool.sosigEnemyID.Length; l++) { if (!idList.Contains(SR_Manager.instance.faction.levels[x].squadPool.sosigEnemyID[l])) { idList.Add(SR_Manager.instance.faction.levels[x].squadPool.sosigEnemyID[l]); } } } foreach (SosigEnemyID item in idList) { SpawnTempSosig(item, spawnPoint); yield return (object)new WaitForSeconds(0.33f); } } } public static void SpawnTempSosig(SosigEnemyID id, Transform spawnPoint) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected I4, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)("Supply Raid - Spawning: " + (int)id + " - " + ((object)(SosigEnemyID)(ref id)).ToString())); Sosig val = SosigAPI.Spawn(ManagerSingleton<IM>.Instance.odicSosigObjsByID[id], SR_Manager.instance._spawnOptions, spawnPoint.position, spawnPoint.rotation); if ((Object)(object)val.Hand_Primary.HeldObject != (Object)null) { Object.Destroy((Object)(object)val.Hand_Primary.HeldObject); } if ((Object)(object)val.Hand_Secondary.HeldObject != (Object)null) { Object.Destroy((Object)(object)val.Hand_Secondary.HeldObject); } Object.Destroy((Object)(object)((Component)val).gameObject); } public static SosigEnemyID GetRandomSosigIDFromPool(SosigEnemyID[] pool) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) SosigEnemyID val = (SosigEnemyID)(-1); if (pool.Length == 0) { return val; } int num = 0; while (true) { if (num >= pool.Length) { Debug.LogError((object)("Supply Raid - Faction level " + SR_Manager.GetFactionLevel().name + " has no valid SosigEnemyIDs, Not Spawning Sosigs")); return val; } val = pool[Random.Range(0, pool.Length)]; if (ValidSosigEnemyID(val)) { break; } num++; } return val; } public static bool ValidSosigEnemyID(SosigEnemyID id) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) if ((int)id == -1) { return false; } if (ManagerSingleton<IM>.Instance.odicSosigObjsByID.ContainsKey(id)) { return true; } return false; } public static SR_SosigFaction GetFactionByName(string factionName) { for (int i = 0; i < SR_Manager.instance.factions.Count; i++) { if (SR_Manager.instance.factions[i].name == factionName) { return SR_Manager.instance.factions[i]; } } return null; } public static LootTable RemoveGlobalSubtractionOnTable(LootTable table) { List<int> list = new List<int>(); if (SR_Manager.Character() != null && SR_Manager.Character().subtractionObjectIDs.Count > 0) { for (int i = 0; i < table.Loot.Count; i++) { if (SR_Manager.Character().subtractionObjectIDs.Contains(table.Loot[i].ItemID)) { list.Add(i); } } } for (int num = list.Count - 1; num >= 0; num--) { table.Loot.RemoveAt(list[num]); } return table; } public static bool SpawnLoot(LootTable table, SR_ItemCategory itemCategory, Transform[] spawns) { //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_031f: 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_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_04cd: Unknown result type (might be due to invalid IL or missing references) //IL_04d5: Unknown result type (might be due to invalid IL or missing references) //IL_0504: Unknown result type (might be due to invalid IL or missing references) //IL_050c: Unknown result type (might be due to invalid IL or missing references) //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Unknown result type (might be due to invalid IL or missing references) //IL_047d: Unknown result type (might be due to invalid IL or missing references) //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_048a: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_053b: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Unknown result type (might be due to invalid IL or missing references) if (table == null) { return false; } FVRObject value = null; FVRObject val = null; int num = 1; int num2 = 0; bool flag = true; bool flag2 = false; if (itemCategory != null) { if (itemCategory.objectGroups.Count > 0) { flag2 = true; num2 += itemCategory.objectGroups.Count; } if (itemCategory.lootTagsEnabled) { num2 += table.Loot.Count; } else { flag = false; } } else { num2 += table.Loot.Count; } int num3 = Random.Range(0, num2); List<string> list = new List<string>(); if (flag2) { if (flag) { num3 -= table.Loot.Count - 1; } if (itemCategory != null && itemCategory.objectGroups != null && itemCategory.objectGroups.Count > 0) { list = itemCategory.objectGroups[num3].objectID; } if (list.Count > 1) { num = list.Count; } } bool result = false; int min = -1; if (itemCategory != null) { min = itemCategory.minCapacity; } for (int i = 0; i < num; i++) { if (flag2) { if (list[i] == "" || list[i] == null) { return false; } if (!IM.OD.TryGetValue(list[i], out value)) { Debug.Log((object)("Supply Raid - Cannot find object with id: " + list[i])); continue; } if (!((Object)(object)value != (Object)null)) { return false; } val = GetLowestCapacityAmmoObject(value, null, min); } else { value = table.Loot[num3]; if (!((Object)(object)value != (Object)null)) { if (itemCategory != null) { Debug.Log((object)("Supply Raid - NO OBJECT FOUND IN ITEM CATEGORY: " + itemCategory.name)); } else { Debug.Log((object)"Supply Raid - NO OBJECT FOUND "); } return false; } val = GetLowestCapacityAmmoObject(value, table.Eras, min); } if ((Object)(object)value == (Object)null) { return false; } FVRObject val2 = null; FVRObject val3 = null; FVRObject val4 = null; if (value.RequiredSecondaryPieces.Count > 0) { val2 = value.RequiredSecondaryPieces[0]; if (value.RequiredSecondaryPieces.Count > 1) { val3 = value.RequiredSecondaryPieces[1]; } if (value.RequiredSecondaryPieces.Count > 2) { val4 = value.RequiredSecondaryPieces[2]; } } else if (value.RequiresPicatinnySight) { val2 = SR_Manager.instance.lt_RequiredAttachments.GetRandomObject(); if ((Object)(object)val2 != (Object)null && val2.RequiredSecondaryPieces.Count > 0) { val3 = val2.RequiredSecondaryPieces[0]; } } else if (value.BespokeAttachments.Count > 0) { float num4 = Random.Range(0f, 1f); if (num4 > 0.75f) { val2 = table.GetRandomBespokeAttachment(value); if (val2.RequiredSecondaryPieces.Count > 0) { val3 = val2.RequiredSecondaryPieces[0]; } } } GameObject val5 = null; GameObject val6 = null; GameObject val7 = null; GameObject val8 = null; GameObject val9 = null; int num5 = 1; if (!SR_Manager.instance.optionSpawnLocking && !value.UsesRoundTypeFlag && value.TagFirearmFeedOption.Contains((OTagFirearmFeedOption)0) && value.TagFirearmFiringModes.Contains((OTagFirearmFiringMode)4)) { num5 = 3; } if ((Object)(object)value != (Object)null && (Object)(object)((AnvilAsset)value).GetGameObject() != (Object)null) { for (int j = 0; j < num5; j++) { val5 = Object.Instantiate<GameObject>(((AnvilAsset)value).GetGameObject(), spawns[0].position + Vector3.up * 0.25f * (float)j + Vector3.up * 0.2f * (float)i, spawns[0].rotation); if (((Object)val5).name == "CharcoalBriquette(Clone)") { Material material = SetToGoldMaterial(((Component)val5.transform.GetChild(0)).GetComponent<Renderer>().material); if (Object.op_Implicit((Object)(object)val5.GetComponent<Renderer>())) { val5.GetComponent<Renderer>().material = material; } else if (Object.op_Implicit((Object)(object)val5.transform.GetChild(0))) { ((Component)val5.transform.GetChild(0)).GetComponent<Renderer>().material = material; } } } } int num6 = 4; if (UsesRounds(value)) { num6 = value.MagazineCapacity * 2; } if (SR_Manager.instance.optionSpawnLocking) { num6 = 3; if (itemCategory != null && itemCategory.ammoSpawnLockedCount >= 0) { num6 = itemCategory.ammoSpawnLockedCount; } } else if (num6 < 12) { num6 = 12; if (itemCategory != null && itemCategory.ammoLimitedCount >= 0) { num6 = itemCategory.ammoLimitedCount; } } if ((Object)(object)val != (Object)null && (Object)(object)((AnvilAsset)val).GetGameObject() != (Object)null) { for (int k = 0; k < num6; k++) { val6 = Object.Instantiate<GameObject>(((AnvilAsset)val).GetGameObject(), spawns[1].position + Vector3.up * 0.25f * (float)k, spawns[1].rotation); } } if ((Object)(object)val2 != (Object)null && (Object)(object)((AnvilAsset)val2).GetGameObject() != (Object)null) { val7 = Object.Instantiate<GameObject>(((AnvilAsset)val2).GetGameObject(), spawns[2].position, spawns[2].rotation); } if ((Object)(object)val3 != (Object)null && (Object)(object)((AnvilAsset)val3).GetGameObject() != (Object)null) { val8 = Object.Instantiate<GameObject>(((AnvilAsset)val3).GetGameObject(), spawns[3].position, spawns[3].rotation); } if ((Object)(object)val4 != (Object)null && (Object)(object)((AnvilAsset)val4).GetGameObject() != (Object)null) { val9 = Object.Instantiate<GameObject>(((AnvilAsset)val4).GetGameObject(), spawns[4].position, spawns[4].rotation); } if ((Object)(object)val5 != (Object)null || (Object)(object)val6 != (Object)null || (Object)(object)val7 != (Object)null || (Object)(object)val8 != (Object)null || (Object)(object)val9 != (Object)null) { result = true; } } return result; } public static bool UsesRounds(FVRObject o) { o = IM.OD[o.ItemID]; if (o.CompatibleSingleRounds.Count > 0 || o.UsesRoundTypeFlag) { return true; } return false; } public static FVRObject GetLowestCapacityAmmoObject(FVRObject o, List<OTagEra> eras = null, int Min = -1, int Max = -1, List<OTagSet> sets = null) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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) o = IM.OD[o.ItemID]; if (o.CompatibleMagazines.Count > 0) { List<FVRObject> lowestCapacity = GetLowestCapacity(o.CompatibleMagazines, Min); return lowestCapacity[Random.Range(0, lowestCapacity.Count)]; } if ((int)o.Category == 1 && (int)o.MagazineType != 0) { List<FVRObject> lowestCapacity2 = GetLowestCapacity(IM.CompatMags[o.MagazineType], Min); return lowestCapacity2[Random.Range(0, lowestCapacity2.Count)]; } if (o.CompatibleClips.Count > 0) { List<FVRObject> lowestCapacity3 = GetLowestCapacity(o.CompatibleClips, Min); return lowestCapacity3[Random.Range(0, lowestCapacity3.Count)]; } if (o.CompatibleSpeedLoaders.Count > 0) { List<FVRObject> lowestCapacity4 = GetLowestCapacity(o.CompatibleSpeedLoaders, Min); return lowestCa