Decompiled source of SupplyRaid v1.2.4
SupplyRaid.dll
Decompiled 2 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 Atlas; using Atlas.Loaders; using Atlas.MappingComponents.TakeAndHold; 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.Events; 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+e237600112d239bed41dab318a05a560eb07e21c")] [assembly: AssemblyProduct("SupplyRaid")] [assembly: AssemblyTitle("SupplyRaid")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] public class SR_FVRPhysicalObject : FVRPhysicalObject { } public class SR_FVRPointable : FVRPointable { } public class SR_FVRPointableButton : FVRPointableButton { } 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.2.4"; } public class BGM { public static void SetTakeMusic(int level) { } public static void SetHoldMusic(int level) { } public static void QueueTake(int situation) { } public static void SpawnPanel(Vector3 position, Quaternion rotation) { } public static void InitializeSoundtrackInterface() { } } public class SR_TNH : MonoBehaviour { public TNH_Manager tnhManager; public SR_Manager srManager; public TNH_ManagerOverride tnHOverideManager; public void Start() { if (Object.op_Implicit((Object)(object)tnHOverideManager)) { ((MonoBehaviour)this).StartCoroutine(DelaySetup()); } else { ((MonoBehaviour)this).StartCoroutine(SetupSupplyRaid()); } } public IEnumerator DelaySetup() { yield return null; tnhManager = Object.FindObjectOfType<TNH_Manager>(); yield return null; if ((Object)(object)tnhManager != (Object)null) { ((MonoBehaviour)this).StartCoroutine(SetupSupplyRaid()); } } public IEnumerator SetupSupplyRaid() { if (Object.op_Implicit((Object)(object)tnhManager)) { tnhManager.FMODController.SwitchTo(0, 0f, true, true); tnhManager.ClearMiscEnemies(); ((Component)tnhManager).gameObject.SetActive(false); tnhManager.FMODController.SetMasterVolume(0f); for (int i = 0; i < tnhManager.HoldPoints.Count; i++) { tnhManager.HoldPoints[i].ForceClearConfiguration(); ((Component)tnhManager.HoldPoints[i]).gameObject.SetActive(false); } for (int j = 0; j < tnhManager.SupplyPoints.Count; j++) { tnhManager.SupplyPoints[j].ClearConfiguration(); ((Component)tnhManager.SupplyPoints[j]).gameObject.SetActive(false); } } if (Object.op_Implicit((Object)(object)tnHOverideManager)) { ((Component)tnHOverideManager).gameObject.SetActive(false); } VaultSystem.ClearExistingSaveableObjects(true); Object.Instantiate<GameObject>(new GameObject()).AddComponent<SR_ModLoader>(); yield return null; SetupManager(); yield return null; yield return ((MonoBehaviour)this).StartCoroutine(SetupSupplyPoints()); yield return ((MonoBehaviour)this).StartCoroutine(SetupSupplyPointsHold()); ((MonoBehaviour)this).StartCoroutine(SR_ModLoader.LoadSupplyRaidAssets()); } private void SetupManager() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_006f: 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_0083: 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) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(new GameObject()); srManager = val.AddComponent<SR_Manager>(); Transform transform = new GameObject().transform; Transform transform2 = new GameObject().transform; transform2.SetPositionAndRotation(tnhManager.ScoreDisplayPoint.position + Vector3.down * 1.5f, tnhManager.ScoreDisplayPoint.rotation); transform.SetPositionAndRotation(transform2.position + -(transform2.forward * 2f), transform2.rotation); Transform transform3 = new GameObject().transform; transform3.position = tnhManager.ScoreDisplayPoint.position + Vector3.down * 5f; srManager.srMenu = transform2; srManager.spawnMenu = transform2; srManager.resultsMenu = transform2; srManager.spawnPoint = transform; srManager.spawnStation = transform2; srManager.itemSpawner = tnhManager.ItemSpawner.transform; ((Component)srManager.itemSpawner).transform.SetParent((Transform)null); srManager.itemSpawner.SetPositionAndRotation(transform2.position + Vector3.up + -srManager.itemSpawner.forward * 2f, transform2.rotation * Quaternion.Euler(0f, 180f, 0f)); srManager.buyMenu = transform3; srManager.ammoStation = transform3; srManager.recycler = transform3; srManager.duplicator = transform3; srManager.attachmentStation = transform3; srManager.itemSpawner = transform3; srManager.captureZone = ((Component)transform3).gameObject.AddComponent<SR_CaptureZone>(); srManager.captureZone.zone = ((Component)this).transform; GM.CurrentMovementManager.TeleportToPoint(srManager.spawnPoint.position, true, srManager.spawnPoint.forward); } public Transform TryGetLocation(List<Transform> safeLocations, int index, List<Transform> tryLocations = null) { if (tryLocations != null && tryLocations.Count > index) { return tryLocations[index]; } if (safeLocations.Count > index) { return safeLocations[index]; } return safeLocations[Random.Range(0, safeLocations.Count)]; } public IEnumerator SetupSupplyPoints() { yield return null; Random.InitState(tnhManager.m_seed); List<Transform> list = new List<Transform>(); List<Transform> list2 = new List<Transform>(); for (int i = 0; i < tnhManager.SupplyPoints.Count; i++) { TNH_SupplyPoint val = tnhManager.SupplyPoints[i]; list.Clear(); list2.Clear(); list.AddRange(val.SpawnPoints_Panels); list.AddRange(val.SpawnPoint_Tables); list.Add(val.SpawnPoint_PlayerSpawn); list.AddRange(val.SpawnPoints_Boxes); list.AddRange(val.SpawnPoints_Sosigs_Defense); list.AddRange(val.SpawnPoints_Turrets); list2.Add(val.SpawnPoint_PlayerSpawn); list2.AddRange(val.SpawnPoints_Boxes); list2.AddRange(val.SpawnPoints_Sosigs_Defense); list2.AddRange(val.SpawnPoints_Turrets); list2.AddRange(val.SpawnPoints_Panels); for (int j = 0; j < val.CoverPoints.Count; j++) { list2.Add(((Component)val.CoverPoints[j]).transform); } for (int num = list2.Count - 1; num >= 0; num--) { if ((Object)(object)list2[num] == (Object)null) { list2.RemoveAt(num); } } SR_SupplyPoint sR_SupplyPoint = Object.Instantiate<GameObject>(new GameObject()).AddComponent<SR_SupplyPoint>(); ((Object)sR_SupplyPoint).name = "SupplyPoint_" + i; if (Object.op_Implicit((Object)(object)((Component)val).GetComponent<AtlasSupplyPoint>())) { Debug.Log((object)"Supply Raid: Found First Spawn Atlas"); if (((Component)val).GetComponent<AtlasSupplyPoint>().ForceSpawnHere) { sR_SupplyPoint.forceFirstSpawn = true; } } else if (Object.op_Implicit((Object)(object)((Component)val).GetComponent("WurstMod.MappingComponents.TakeAndHold.ForcedSpawn"))) { Debug.Log((object)"Supply Raid: Found First Spawn Wurst"); sR_SupplyPoint.forceFirstSpawn = true; } sR_SupplyPoint.respawn = val.SpawnPoint_PlayerSpawn; sR_SupplyPoint.captureZone = val.Bounds; sR_SupplyPoint.squadPoint = val.SpawnPoint_PlayerSpawn; sR_SupplyPoint.buyMenu = TryGetLocation(list, 0); ((Component)sR_SupplyPoint.buyMenu).transform.Rotate(0f, 90f, 0f); sR_SupplyPoint.ammoStation = TryGetLocation(list, 3); ((Component)sR_SupplyPoint.ammoStation).transform.Rotate(0f, 90f, 0f); sR_SupplyPoint.attachmentStation = TryGetLocation(list, 1); ((Component)sR_SupplyPoint.attachmentStation).transform.Rotate(0f, 90f, 0f); sR_SupplyPoint.recycler = TryGetLocation(list, 2); ((Component)sR_SupplyPoint.recycler).transform.Rotate(0f, 90f, 0f); sR_SupplyPoint.duplicator = TryGetLocation(list, 4); ((Component)sR_SupplyPoint.duplicator).transform.Rotate(0f, 90f, 0f); sR_SupplyPoint.sosigSpawns = (Transform[])(object)new Transform[4]; for (int k = 0; k < sR_SupplyPoint.sosigSpawns.Length; k++) { sR_SupplyPoint.sosigSpawns[k] = TryGetLocation(list2, k); } sR_SupplyPoint.sniperPoints.AddRange(list2); sR_SupplyPoint.guardPoints.AddRange(list2); PatrolPath[] array = new PatrolPath[2]; for (int l = 0; l < array.Length; l++) { array[l] = new PatrolPath(); array[l].patrolPoints.AddRange(list2); list2.Reverse(); } sR_SupplyPoint.patrolPaths = array; } } public IEnumerator SetupSupplyPointsHold() { yield return null; List<Transform> list = new List<Transform>(); List<Transform> list2 = new List<Transform>(); for (int i = 0; i < tnhManager.HoldPoints.Count; i++) { TNH_HoldPoint val = tnhManager.HoldPoints[i]; list.Clear(); list2.Clear(); list.Add(val.m_systemNode.NodeCenter); for (int j = 0; j < val.CoverPoints.Count; j++) { list.Add(((Component)val.CoverPoints[j]).transform); } list.AddRange(val.SpawnPoints_Sosigs_Defense); list.AddRange(val.SpawnPoints_Turrets); for (int k = 0; k < val.AttackVectors.Count; k++) { list2.AddRange(val.AttackVectors[k].SpawnPoints_Sosigs_Attack); list2.Add(val.AttackVectors[k].GrenadeVector); } list2.AddRange(val.SpawnPoints_Sosigs_Defense); list2.AddRange(val.SpawnPoints_Turrets); for (int l = 0; l < val.CoverPoints.Count; l++) { list2.Add(((Component)val.CoverPoints[l]).transform); } list2.Add(val.m_systemNode.NodeCenter); for (int num = list2.Count - 1; num >= 0; num--) { if ((Object)(object)list2[num] == (Object)null) { list2.RemoveAt(num); } } SR_SupplyPoint sR_SupplyPoint = Object.Instantiate<GameObject>(new GameObject()).AddComponent<SR_SupplyPoint>(); ((Object)sR_SupplyPoint).name = "SupplyPoint_" + i; if (Object.op_Implicit((Object)(object)((Component)val).GetComponent<AtlasSupplyPoint>())) { Debug.Log((object)"Supply Raid: Found First Spawn Atlas"); if (((Component)val).GetComponent<AtlasSupplyPoint>().ForceSpawnHere) { sR_SupplyPoint.forceFirstSpawn = true; } } else if (Object.op_Implicit((Object)(object)((Component)val).GetComponent("WurstMod.MappingComponents.TakeAndHold.ForcedSpawn"))) { Debug.Log((object)"Supply Raid: Found First Spawn Wurst"); sR_SupplyPoint.forceFirstSpawn = true; } sR_SupplyPoint.respawn = val.m_systemNode.NodeCenter; Transform captureZone = null; Vector3 val2 = default(Vector3); for (int m = 0; m < val.Bounds.Count; m++) { if (val.Bounds[m].localScale.x > val2.x || val.Bounds[m].localScale.y > val2.y || val.Bounds[m].localScale.z > val2.z) { captureZone = val.Bounds[m]; } } sR_SupplyPoint.captureZone = captureZone; sR_SupplyPoint.squadPoint = val.m_systemNode.NodeCenter; sR_SupplyPoint.buyMenu = TryGetLocation(list, 0); ((Component)sR_SupplyPoint.buyMenu).transform.Rotate(0f, 90f, 0f); sR_SupplyPoint.ammoStation = TryGetLocation(list, 3); ((Component)sR_SupplyPoint.ammoStation).transform.Rotate(0f, 90f, 0f); sR_SupplyPoint.attachmentStation = TryGetLocation(list, 1); ((Component)sR_SupplyPoint.attachmentStation).transform.Rotate(0f, 90f, 0f); sR_SupplyPoint.recycler = TryGetLocation(list, 2); ((Component)sR_SupplyPoint.recycler).transform.Rotate(0f, 90f, 0f); sR_SupplyPoint.duplicator = TryGetLocation(list, 4); ((Component)sR_SupplyPoint.duplicator).transform.Rotate(0f, 90f, 0f); sR_SupplyPoint.sosigSpawns = (Transform[])(object)new Transform[4]; for (int n = 0; n < sR_SupplyPoint.sosigSpawns.Length; n++) { sR_SupplyPoint.sosigSpawns[n] = TryGetLocation(list2, n); } sR_SupplyPoint.sniperPoints.AddRange(list2); sR_SupplyPoint.guardPoints.AddRange(list2); PatrolPath[] array = new PatrolPath[2]; for (int num2 = 0; num2 < array.Length; num2++) { array[num2] = new PatrolPath(); array[num2].patrolPoints.AddRange(list2); list2.Reverse(); } sR_SupplyPoint.patrolPaths = array; } } } internal class SR_SosigData { public static MeshRenderer GetSosigMeshRenderer(string title, Transform geoParent) { for (int i = 0; i < geoParent.childCount; i++) { if (((Object)geoParent.GetChild(i)).name == title) { return ((Component)geoParent.GetChild(i)).GetComponent<MeshRenderer>(); } } return null; } public static void UpdateSosigLink(SosigLink link, Vector3 bodyScale, Vector3 linkScale, Material sosigMaterial, bool stopSever, MeshRenderer geo) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00b6: 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_0122: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)link == (Object)null) { return; } CapsuleCollider val = (CapsuleCollider)link.C; val.height *= linkScale.y; val.radius *= ((linkScale.x > linkScale.z) ? linkScale.x : linkScale.z); CharacterJoint val2 = (((Object)(object)link.J != (Object)null) ? link.J : ((Component)link).GetComponent<CharacterJoint>()); if (Object.op_Implicit((Object)(object)val2)) { ((Joint)val2).autoConfigureConnectedAnchor = false; ((Joint)val2).anchor = new Vector3(0f, ((Joint)val2).anchor.y * bodyScale.y, 0f); ((Joint)val2).connectedAnchor = new Vector3(0f, ((Joint)val2).connectedAnchor.y * bodyScale.y, 0f); } ((Renderer)geo).sharedMaterial = sosigMaterial; ((Component)geo).transform.localScale = linkScale; if (stopSever) { link.m_isJointSevered = true; } if (link.m_wearables.Count <= 0) { return; } foreach (SosigWearable wearable in link.m_wearables) { ((Component)wearable).gameObject.transform.localScale = ((Component)geo).transform.localScale; } } } public class SR_Networking : MonoBehaviour { public static SR_Networking instance; public bool isClient; 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) { } 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_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: 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_0408: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Expected O, but got Unknown //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: 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_UpdateStats")) { updateStats_ID = Mod.registeredCustomPacketIDs["SR_UpdateStats"]; Mod.customPacketHandlers[updateStats_ID] = new CustomPacketHandler(UpdateStats_Handler); } else { ClientSend.RegisterCustomPacketType("SR_UpdateStats"); Mod.CustomPacketHandlerReceived += new CustomPacketHandlerReceivedDelegate(UpdateStats_Received); } if (Mod.registeredCustomPacketIDs.ContainsKey("SR_RequestSync")) { requestSync_ID = Mod.registeredCustomPacketIDs["SR_RequestSync"]; Mod.customPacketHandlers[requestSync_ID] = new CustomPacketHandler(RequestSync_Handler); } else { ClientSend.RegisterCustomPacketType("SR_RequestSync"); Mod.CustomPacketHandlerReceived += new CustomPacketHandlerReceivedDelegate(RequestSync_Received); } } public void LevelUpdate_Send(bool gameComplete) { //IL_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.profile.playerCount); val.Write(SR_Manager.profile.difficulty); val.Write(SR_Manager.profile.freeBuyMenu); val.Write(SR_Manager.profile.spawnLocking); val.Write(SR_Manager.profile.startLevel); val.Write(SR_Manager.profile.playerHealth); val.Write(SR_Manager.profile.itemSpawner); val.Write(SR_Manager.profile.captureZone); val.Write(SR_Manager.profile.captureOrder); val.Write(SR_Manager.profile.captures); val.Write(SR_Manager.profile.respawn); val.Write(SR_Manager.profile.itemsDrop); val.Write(SR_Manager.profile.maxEnemies); val.Write(SR_Manager.profile.maxSquadEnemies); string text = ""; if (SR_Manager.Faction() != null) { text = SR_Manager.Faction().name; } val.Write(text); ServerSend.SendTCPDataToAll(val, true); } } private void GameOptions_Handler(int clientID, Packet packet) { float playerCount = packet.ReadFloat(true); float difficulty = packet.ReadFloat(true); bool freeBuyMenu = packet.ReadBool(true); bool spawnLocking = packet.ReadBool(true); int startLevel = packet.ReadInt(true); int playerHealth = packet.ReadInt(true); bool itemSpawner = packet.ReadBool(true); bool captureZone = packet.ReadBool(true); int order = packet.ReadInt(true); int captures = packet.ReadInt(true); bool respawn = packet.ReadBool(true); int itemsDrop = packet.ReadInt(true); int maxEnemies = packet.ReadInt(true); int maxSquadEnemies = packet.ReadInt(true); string factionID = packet.ReadString(true); SR_Manager.instance.Network_GameOptions(playerCount, difficulty, freeBuyMenu, spawnLocking, startLevel, playerHealth, itemSpawner, captureZone, order, captures, respawn, itemsDrop, 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)"Networking: Client Sending Captured Zone"); Packet val = new Packet(capturedZone_ID); ClientSend.SendTCPData(val, true); } } private void CapturedZone_Handler(int clientID, Packet packet) { Debug.Log((object)"Networking: Received Client Captured zone"); if (SR_Manager.instance.captureProtection <= 0f) { SR_Manager.instance.CapturedPoint(); } } public void ServerRunning_Send() { //IL_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)"Networking: Client Sending Request Sync"); Packet val = new Packet(requestSync_ID); ClientSend.SendTCPData(val, true); } } private void RequestSync_Handler(int clientID, Packet packet) { Debug.Log((object)"Networking: Received Client Request Sync"); GameOptions_Send(); LevelUpdate_Send(SR_Manager.instance.gameCompleted); UpdateStats_Send(); ServerRunning_Send(); } private void LevelUpdate_Received(string identifier, int index) { //IL_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; public GameObject togglePagesButton; [HideInInspector] [Tooltip("0 = Rearm \n1 = Speed Loader\n2 = Clip\n3 Round")] private bool[] purchaseButtons = new bool[4]; private SR_GenericButton[] ammoButtons = new SR_GenericButton[28]; public GameObject[] ammoTypeButtons = (GameObject[])(object)new GameObject[28]; public AmmoEnum selectedAmmoType; public FireArmRoundClass roundClass = (FireArmRoundClass)1; private List<FVRFireArmMagazine> m_detectedMags = new List<FVRFireArmMagazine>(); private List<FVRFireArmClip> m_detectedClips = new List<FVRFireArmClip>(); private List<Speedloader> m_detectedSLs = new List<Speedloader>(); private List<SosigWeaponPlayerInterface> m_detectedSweapons = new List<SosigWeaponPlayerInterface>(); private List<FVRFireArm> m_detectedFirearms = new List<FVRFireArm>(); private List<FireArmRoundType> m_roundTypes = new List<FireArmRoundType>(); private Collider[] colbuffer; private Dictionary<FireArmRoundType, FireArmRoundClass> m_decidedTypes = new Dictionary<FireArmRoundType, FireArmRoundClass>(); private float m_scanTick = 1f; private List<AmmoRound> ammoList = new List<AmmoRound>(); private List<FireArmRoundType> allRoundTypes = new List<FireArmRoundType>(); [Header("Ammo Page")] public GameObject ammoPage; [Header("Round Page")] public GameObject roundPage; public GameObject roundButtonPrefab; public Transform roundContainer; private List<SR_GenericButton> roundButtons = new List<SR_GenericButton>(); private List<FVRObject> rounds = new List<FVRObject>(); public static List<FVRObject> GetAllRounds() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 List<FVRObject> list = new List<FVRObject>(); foreach (string key in IM.OD.Keys) { if (IM.OD.TryGetValue(key, out var value) && Object.op_Implicit((Object)(object)value) && (int)value.Category == 4) { list.Add(value); } } return list; } private void PopulateRoundPage() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < roundButtons.Count; i++) { if (Object.op_Implicit((Object)(object)roundButtons[i])) { Object.Destroy((Object)(object)((Component)roundButtons[i]).gameObject); } } List<FireArmRoundType> list = new List<FireArmRoundType>(); list.AddRange(m_roundTypes); for (int j = 0; j < m_detectedMags.Count; j++) { if (Object.op_Implicit((Object)(object)m_detectedMags[j]) && !list.Contains(m_detectedMags[j].RoundType)) { list.Add(m_detectedMags[j].RoundType); } } for (int k = 0; k < m_detectedClips.Count; k++) { if (Object.op_Implicit((Object)(object)m_detectedClips[k]) && !list.Contains(m_detectedClips[k].RoundType)) { list.Add(m_detectedClips[k].RoundType); } } for (int l = 0; l < m_detectedSLs.Count; l++) { if (Object.op_Implicit((Object)(object)m_detectedSLs[l]) && Object.op_Implicit((Object)(object)((FVRPhysicalObject)m_detectedSLs[l]).ObjectWrapper) && !list.Contains(((FVRPhysicalObject)m_detectedSLs[l]).ObjectWrapper.RoundType)) { list.Add(((FVRPhysicalObject)m_detectedSLs[l]).ObjectWrapper.RoundType); } } for (int m = 0; m < m_detectedSweapons.Count; m++) { if (Object.op_Implicit((Object)(object)m_detectedSweapons[m]) && Object.op_Implicit((Object)(object)((FVRPhysicalObject)m_detectedSweapons[m]).ObjectWrapper) && !list.Contains(((FVRPhysicalObject)m_detectedSweapons[m]).ObjectWrapper.RoundType)) { list.Add(((FVRPhysicalObject)m_detectedSweapons[m]).ObjectWrapper.RoundType); } } for (int n = 0; n < m_detectedFirearms.Count; n++) { if (Object.op_Implicit((Object)(object)m_detectedFirearms[n]) && !list.Contains(m_detectedFirearms[n].RoundType)) { list.Add(m_detectedFirearms[n].RoundType); } } rounds = GetAllRounds(); for (int num = rounds.Count - 1; num >= 0; num--) { if (!list.Contains(rounds[num].RoundType)) { rounds.RemoveAt(num); } } for (int num2 = 0; num2 < rounds.Count; num2++) { ManagerSingleton<IM>.Instance.SpawnerIDDic.TryGetValue(rounds[num2].SpawnedFromId, out var value); if ((Object)(object)value != (Object)null) { SR_GenericButton component = Object.Instantiate<GameObject>(roundButtonPrefab, roundContainer).GetComponent<SR_GenericButton>(); ((Component)component).gameObject.SetActive(true); roundButtons.Add(component); component.fvrObject = rounds[num2]; component.textB.text = rounds[num2].DisplayName; FireArmRoundClass firearmRoundClassFromType = GetFirearmRoundClassFromType(rounds[num2].ItemID, rounds[num2].RoundType); AmmoEnum ammoEnum = (AmmoEnum)(component.index = (int)SR_Global.GetAmmoEnum(firearmRoundClassFromType)); component.genericButton = ammoButtons[(int)ammoEnum]; if (purchasedAmmoTypes[(int)ammoEnum]) { if (SR_Manager.Character().modeRounds == 4) { int roundPowerCost = SR_Manager.Character().GetRoundPowerCost(rounds[num2].TagFirearmRoundPower, 1); component.text.text = roundPowerCost.ToString(); } else { component.text.text = ""; } } else { component.text.text = SR_Manager.Character().ammoUpgradeCost[(int)ammoEnum].ToString(); } component.thumbnail.sprite = ammoTypeButtons[(int)ammoEnum].GetComponent<Image>().sprite; } else { Debug.Log((object)"Supply Raid: No ID found for rounds"); } } } public void BuySpecificRound(FVRObject fvrObject) { //IL_0038: 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) if (!CanSpawn(SR_Manager.Character().modeRounds, SR_Manager.Character().roundsCost, 3)) { SR_Manager.PlayFailSFX(); return; } if ((Object)(object)fvrObject != (Object)null) { Object.Instantiate<GameObject>(((AnvilAsset)fvrObject).GetGameObject(), Spawnpoint_Round.position, Spawnpoint_Round.rotation); } SR_Manager.PlayRearmSFX(); } public void TogglePages() { roundPage.SetActive(ammoPage.activeSelf); ammoPage.SetActive(!roundPage.activeSelf); ((Component)selectionIcon).gameObject.SetActive(!roundPage.activeSelf); } private void Start() { instance = this; colbuffer = (Collider[])(object)new Collider[50]; } private void Update() { //IL_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) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) m_scanTick -= Time.deltaTime; if (m_scanTick <= 0f) { float num = Vector3.Distance(((Component)this).transform.position, ((Component)GM.CurrentPlayerBody).transform.position); if (num < 12f) { Scan(); m_scanTick = Random.Range(0.8f, 1f); } else { m_scanTick = Random.Range(2f, 3f); } } if (((Component)selectionIcon).gameObject.activeSelf && selectedAmmoType != AmmoEnum.None) { selectionIcon.position = ammoTypeButtons[(int)selectedAmmoType].transform.position; } } public void Setup() { ammoButtons = new SR_GenericButton[ammoTypeButtons.Length]; for (int i = 0; i < ammoTypeButtons.Length; i++) { SR_GenericButton component = ammoTypeButtons[i].GetComponent<SR_GenericButton>(); ammoButtons[i] = component; if (SR_Manager.instance.character.ammoUpgradeCost[i] == 0) { purchasedAmmoTypes[i] = true; component.text.text = ""; } else { component.text.text = SR_Manager.instance.character.ammoUpgradeCost[i].ToString(); } } switch (SR_Manager.instance.character.modeRearming) { case 0: rearmButton.SetActive(false); break; default: rearmButton.SetActive(true); rearmButton.GetComponent<FVRPointableButton>().Text.text = ""; break; case 2: case 3: if (SR_Manager.instance.character.rearmingCost > 0) { rearmButton.GetComponent<FVRPointableButton>().Text.text = SR_Manager.instance.character.rearmingCost.ToString(); } else { rearmButton.GetComponent<FVRPointableButton>().Text.text = ""; } break; } switch (SR_Manager.instance.character.modeSpeedLoaders) { case 0: speedloaderButton.SetActive(false); break; default: speedloaderButton.SetActive(true); speedloaderButton.GetComponent<FVRPointableButton>().Text.text = ""; break; case 2: case 3: if (SR_Manager.instance.character.speedLoadersCost > 0) { speedloaderButton.GetComponent<FVRPointableButton>().Text.text = SR_Manager.instance.character.speedLoadersCost.ToString(); } else { speedloaderButton.GetComponent<FVRPointableButton>().Text.text = ""; } break; } switch (SR_Manager.instance.character.modeClips) { case 0: clipButton.SetActive(false); break; default: clipButton.SetActive(true); clipButton.GetComponent<FVRPointableButton>().Text.text = ""; break; case 2: case 3: if (SR_Manager.instance.character.clipsCost > 0) { clipButton.GetComponent<FVRPointableButton>().Text.text = SR_Manager.instance.character.clipsCost.ToString(); } else { clipButton.GetComponent<FVRPointableButton>().Text.text = ""; } break; } switch (SR_Manager.instance.character.modeRounds) { case 0: roundButton.SetActive(false); togglePagesButton.SetActive(false); break; default: roundButton.SetActive(true); togglePagesButton.SetActive(true); roundButton.GetComponent<FVRPointableButton>().Text.text = ""; break; case 2: case 3: if (SR_Manager.instance.character.roundsCost > 0) { roundButton.GetComponent<FVRPointableButton>().Text.text = SR_Manager.instance.character.roundsCost.ToString(); } else { roundButton.GetComponent<FVRPointableButton>().Text.text = ""; } break; } } public void SetAmmoType(AmmoEnum ammo) { //IL_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 3: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Invalid comparison between Unknown and I4 //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) if (!CanSpawn(SR_Manager.instance.character.modeSpeedLoaders, SR_Manager.instance.character.speedLoadersCost, 1)) { SR_Manager.PlayFailSFX(); return; } bool flag = false; List<FVRObject> list = new List<FVRObject>(); for (int i = 0; i < m_detectedFirearms.Count; i++) { if (!IM.OD.ContainsKey(((FVRPhysicalObject)m_detectedFirearms[i]).ObjectWrapper.ItemID)) { continue; } List<FVRObject> list2 = new List<FVRObject>(ManagerSingleton<IM>.Instance.odicTagCategory[(ObjectCategory)6]); for (int num = list2.Count - 1; num >= 0; num--) { if ((int)list2[num].Category == 6 && list2[num].RoundType == m_detectedFirearms[i].RoundType) { list.Add(list2[num]); } } } for (int j = 0; j < list.Count; j++) { GameObject gameObject = ((AnvilAsset)list[j]).GetGameObject(); Speedloader component = gameObject.GetComponent<Speedloader>(); if (!component.IsPretendingToBeAMagazine) { flag = true; GameObject val = Object.Instantiate<GameObject>(gameObject, Spawnpoint_Round.position + Vector3.up * (float)j * 0.1f, Spawnpoint_Round.rotation); } } if (flag) { SR_Manager.PlayRearmSFX(); } else { SR_Manager.PlayFailSFX(); } } public void Button_SpawnClip() { //IL_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 GetFirearmRoundClassFromType(string itemID, FireArmRoundType t) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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) for (int i = 0; i < AM.SRoundDisplayDataDic[t].Classes.Length; i++) { if (AM.SRoundDisplayDataDic[t].Classes[i].ObjectID.ItemID == itemID) { return AM.SRoundDisplayDataDic[t].Classes[i].Class; } } return AM.SRoundDisplayDataDic[t].Classes[0].Class; } private void Scan() { //IL_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); } ClearAmmoButtons(); if (ammoList.Count == 0) { ((Component)selectionIcon).gameObject.SetActive(false); SetAmmoType(AmmoEnum.Standard); UpdateDisplayButtons(); return; } if (roundPage.activeSelf) { PopulateRoundPage(); } SetAmmoType(selectedAmmoType); UpdateAmmoList(); } private void UpdateAmmoList() { //IL_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 ClearAmmoButtons() { for (int i = 0; i < roundButtons.Count; i++) { if (Object.op_Implicit((Object)(object)roundButtons[i])) { Object.Destroy((Object)(object)((Component)roundButtons[i]).gameObject); } } } private void UpdateDisplayButtons() { ((Component)selectionIcon).gameObject.SetActive(false); for (int i = 0; i < ammoTypeButtons.Length; i++) { if ((Object)(object)ammoTypeButtons[i] != (Object)null) { ammoTypeButtons[i].SetActive(false); } } for (int j = 0; j < ammoList.Count; j++) { if (ammoList[j].roundClasses == null) { continue; } for (int k = 0; k < ammoList[j].roundClasses.Count; k++) { if (!((Object)(object)ammoTypeButtons[(int)ammoList[j].roundClasses[k].ammo] == (Object)null) && SR_Manager.instance.character.ammoUpgradeCost[(int)ammoList[j].roundClasses[k].ammo] > -1 && SR_Manager.instance.character.ammoUpgradeCost[(int)ammoList[j].roundClasses[k].ammo] >= 0 && ammoPage.activeSelf) { ammoTypeButtons[(int)ammoList[j].roundClasses[k].ammo].SetActive(true); if (purchasedAmmoTypes[(int)ammoList[j].roundClasses[k].ammo]) { SetSelectionIcon((int)selectedAmmoType); } } } } if (ammoList.Count > 0 && ammoPage.activeSelf) { SetSelectionIcon((int)selectedAmmoType); } } private void SetSelectionIcon(int i) { //IL_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); } } [CreateAssetMenu(fileName = "SR Assets", menuName = "Supply Raid/SR Assets", order = 1)] public class SR_Assets : ScriptableObject { [Header("Gameplay")] public SR_Compass srCompass; public SR_CaptureZone srCaptureZone; public SR_Manager srManager; [Header("Menus")] public SR_Menu srMenu; public SR_BuyMenu srBuyMenu; public SR_AmmoSpawner srAmmoSpawner; public SR_MagazineDuplicator srMagazineDuplicator; public SR_ModTable srModTable; public SR_Recycler srRecycler; public SR_ResultsMenu srResultsMenu; public SR_SpawnMenu srSpawnMenu; public SR_SpawnStation srSpawnStation; } public class SR_BuyMenu : MonoBehaviour { public class CategoryButton { public GameObject categoryButton; public SR_ItemCategory itemCategory; } public static SR_BuyMenu instance; public List<CategoryButton> categoryItems = new List<CategoryButton>(); [Header("Spawn Points")] [SerializeField] private Transform[] spawnPoints; [Header("Loot Tables")] private List<SR_PurchaseCategory> purchaseCategories = new List<SR_PurchaseCategory>(); private LootTable[] lootTables; [Header("Prefabs")] [SerializeField] private GameObject buttonTabPrefab; [SerializeField] private GameObject buttonContainerPrefab; [SerializeField] private GameObject buyButtonPrefab; [Header("Tabs")] [SerializeField] private Transform tabContainer; [SerializeField] private BuyMenuContainer[] tabContainers; public Text pointDisplay; private void Awake() { instance = this; } public void Setup() { if ((Object)(object)SR_Manager.instance != (Object)null) { SR_Manager.PointEvent += UpdatePoints; SR_Manager.LaunchedEvent += StartGame; pointDisplay.text = SR_Manager.instance.Points.ToString(); } } private void OnDestroy() { SR_Manager.PointEvent -= UpdatePoints; SR_Manager.LaunchedEvent -= StartGame; } private void Update() { } private void StartGame() { purchaseCategories = SR_Manager.instance.character.purchaseCategories; GenerateLootTables(); GenerateButtons(); } public void OpenMenu(int index) { for (int i = 0; i < tabContainers.Length; i++) { if (Object.op_Implicit((Object)(object)tabContainers[i].container)) { tabContainers[i].container.SetActive(false); } } tabContainers[index].container.SetActive(true); SR_Manager.PlayConfirmSFX(); } private void UpdatePoints(int i) { if ((Object)(object)SR_Manager.instance != (Object)null) { pointDisplay.text = SR_Manager.instance.Points.ToString(); } } private void GenerateButtons() { //IL_0064: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected I4, but got Unknown List<string> list = new List<string>(); for (int i = 0; i < purchaseCategories.Count; i++) { if (list.Contains(purchaseCategories[i].ItemCategory().category)) { continue; } if (purchaseCategories[i].ItemCategory().category == "") { LootTableType type = purchaseCategories[i].ItemCategory().type; string text = (int)type switch { 1 => "Standard_Powerup", 2 => "Standard_Thrown", 3 => "Standard_Attachments", 4 => "Standard_Melee", _ => "Standard_Firearm", }; if (!list.Contains(text)) { list.Add(text); } purchaseCategories[i].ItemCategory().category = text; } else { list.Add(purchaseCategories[i].ItemCategory().category); } } tabContainers = new BuyMenuContainer[list.Count]; for (int j = 0; j < tabContainers.Length; j++) { tabContainers[j] = new BuyMenuContainer(); tabContainers[j].name = list[j]; tabContainers[j].container = Object.Instantiate<GameObject>(buttonContainerPrefab, buttonContainerPrefab.transform.parent); tabContainers[j].container.SetActive(false); tabContainers[j].tabButton = Object.Instantiate<GameObject>(buttonTabPrefab, tabContainer).GetComponent<SR_GenericButton>(); ((Component)tabContainers[j].tabButton).gameObject.SetActive(true); tabContainers[j].tabButton.index = j; if (tabContainers[j].name != "") { string[] files = Directory.GetFiles(Paths.PluginPath, "*" + tabContainers[j].name + ".png", SearchOption.AllDirectories); if (files.Length != 0 && files[0] != "") { Sprite sprite = SR_Global.LoadSprite(files[0]); tabContainers[j].tabButton.thumbnail.sprite = sprite; } } else { Debug.LogError((object)("Supply Raid: No Icon found for category " + tabContainers[j].name)); } } for (int k = 0; k < purchaseCategories.Count; k++) { if (purchaseCategories[k].ItemCategory().objectGroups.Count == 0 && lootTables[k].Loot.Count == 0) { continue; } for (int l = 0; l < tabContainers.Length; l++) { if (purchaseCategories[k].ItemCategory().category == tabContainers[l].name) { SR_GenericButton component = Object.Instantiate<GameObject>(buyButtonPrefab, tabContainers[l].container.transform).GetComponent<SR_GenericButton>(); ((Component)component).gameObject.SetActive(true); component.index = k; component.thumbnail.sprite = purchaseCategories[k].ItemCategory().Thumbnail(); component.text.text = purchaseCategories[k].cost.ToString(); ((Object)component).name = purchaseCategories[k].ItemCategory().name; CategoryButton categoryButton = new CategoryButton(); categoryButton.itemCategory = purchaseCategories[k].ItemCategory(); categoryButton.categoryButton = ((Component)component).gameObject; categoryItems.Add(categoryButton); break; } } } UpdateBuyItems(); } public void UpdateBuyItems() { for (int i = 0; i < categoryItems.Count; i++) { if (categoryItems[i] != null) { if ((categoryItems[i].itemCategory.minLevel == -1 || categoryItems[i].itemCategory.minLevel <= SR_Manager.instance.CurrentCaptures) && (categoryItems[i].itemCategory.maxLevel == -1 || categoryItems[i].itemCategory.maxLevel >= SR_Manager.instance.CurrentCaptures)) { categoryItems[i].categoryButton.SetActive(true); } else { categoryItems[i].categoryButton.SetActive(false); } } } } public void SpawnLootButton(int i) { if (i > lootTables.Length || i > purchaseCategories.Count) { SR_Manager.PlayFailSFX(); } else if (SR_Manager.EnoughPoints(purchaseCategories[i].cost)) { if (SR_Global.SpawnLoot(lootTables[i], purchaseCategories[i].ItemCategory(), spawnPoints)) { SR_Manager.PlayConfirmSFX(); SR_Manager.SpendPoints(purchaseCategories[i].cost); } else { SR_Manager.PlayFailSFX(); } } else { SR_Manager.PlayFailSFX(); } } private void GenerateLootTables() { Debug.Log((object)("Supply Raid: Purchase Items: " + purchaseCategories.Count)); lootTables = (LootTable[])(object)new LootTable[purchaseCategories.Count]; for (int i = 0; i < purchaseCategories.Count; i++) { if (purchaseCategories[i] != null) { lootTables[i] = purchaseCategories[i].ItemCategory().InitializeLootTable(); } else { Debug.Log((object)"Supply Raid: Missing Purchase Category"); } } } public void SpawnObjectAtPlace(FVRObject obj, Vector3 pos, Quaternion rotation) { //IL_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); } } } } [Serializable] public class BuyMenuContainer { public string name; public SR_GenericButton tabButton; public SR_GenericButton[] buttons; public GameObject container; } public class SR_CaptureZone : MonoBehaviour { public bool replaced; public Transform zone; [HideInInspector] public float captureRemain = 15f; private float captureTick = 1f; [Header("Audio")] private Bounds bounds; private float guardCaptureTime; private void Start() { ((Component)this).gameObject.SetActive(false); } private void Update() { if (Object.op_Implicit((Object)(object)SR_Compass.instance)) { if (SR_Manager.instance.gameRunning && SR_Manager.profile.captureZone) { CaptureZoneScan(); } else { ((Component)this).gameObject.SetActive(false); } } } private void CaptureZoneScan() { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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) //IL_00f3: 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_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: 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 (guardCaptureTime < Time.time) { guardCaptureTime = Time.time + (float)Random.Range(2, 10); for (int i = 0; i < SR_Manager.instance.defenderSosigs.Count; i++) { Sosig val = SR_Manager.instance.defenderSosigs[i]; Transform captureZone = SR_Manager.AttackSupplyPoint().captureZone; float num = captureZone.localScale.x / 2f; float num2 = captureZone.localScale.z / 2f; Vector3 val2 = captureZone.position + new Vector3(Random.Range(0f - num, num), 0f, Random.Range(0f - num2, num2)); val.CommandGuardPoint(val2, false); } } if (captureRemain > 5f) { SR_Manager.PlayTickSFX(); } else { SR_Manager.PlayTickAlmostSFX(); } if (Object.op_Implicit((Object)(object)SR_Compass.instance) && !((Component)SR_Compass.instance.captureText).gameObject.activeSelf) { ((Component)SR_Compass.instance.captureText).gameObject.SetActive(true); } if (Object.op_Implicit((Object)(object)SR_Compass.instance)) { SR_Compass.instance.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); if (Object.op_Implicit((Object)(object)SR_Compass.instance)) { ((Component)SR_Compass.instance.captureText).gameObject.SetActive(false); } } return; } if (Object.op_Implicit((Object)(object)SR_Compass.instance) && ((Component)SR_Compass.instance.captureText).gameObject.activeSelf) { if (SR_Manager.instance.captureProtection <= 0f) { SR_Manager.PlayFailSFX(); } if (Object.op_Implicit((Object)(object)SR_Compass.instance)) { ((Component)SR_Compass.instance.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]; public bool pointsCatchup = true; [Tooltip("Cost of a new Magazine - if -1 disable")] public float newMagazineCost = 1f; [Tooltip("Cost of upgrading a magazine - if -1 disable")] public float upgradeMagazineCost = 2f; [Tooltip("Cost of Duplicating a magazine - if -1 disable")] public float duplicateMagazineCost = 1f; public float[] powerMultiplier = new float[10]; public bool perRound; [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; [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("These objectIDs won't drop off the player")] public List<string> dropProtectionObjectIDs = 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; } public int GetRoundPowerCost(OTagFirearmRoundPower power, int amount) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return Mathf.CeilToInt(powerMultiplier[power] * (float)amount * (float)roundsCost); } public int GetRoundCost(float cost, int amount, float multiplier) { if (perRound) { return Mathf.CeilToInt(cost * (float)amount * multiplier); } return Mathf.CeilToInt(cost * multiplier); } } [Serializable] public class SR_LootCategory { private int index = -1; public float chance = 0.01f; public string itemCategory; public int levelUnlock; public int levelLock = -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; } } [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 { public static SR_Compass instance; [Header("Directions")] public Transform supplyPointDirection; public Transform lastSupplyDirection; public Text captureText; [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 Awake() { instance = this; } 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_00ba: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_019b: 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) if ((Object)(object)SR_Manager.instance == (Object)null || !SR_Manager.instance.gameRunning) { return; } if (!SR_Manager.profile.hand) { ((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 = Quater