Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of DebuggingPlains v1.2.0
DebuggingPlains.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using On.RoR2; using On.RoR2.Networking; using On.RoR2.UI.MainMenu; using R2API.Utils; using RoR2; using RoR2.CharacterAI; using RoR2.Networking; using RoR2.UI; using RoR2.UI.MainMenu; using SimpleJSON; using TMPro; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("DebuggingPlains")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("DebuggingPlains")] [assembly: AssemblyTitle("DebuggingPlains")] [assembly: AssemblyVersion("1.0.0.0")] namespace DebuggingPlains; [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.Dragonyck.DebuggingPlains", "DebuggingPlains", "1.2.0")] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class DebuggingPlains : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_ShouldUpdateRunStopwatch <>9__2_1; public static hook_OnClientConnect <>9__2_2; internal bool <Awake>b__2_1(orig_ShouldUpdateRunStopwatch orig, Run self) { return false; } internal void <Awake>b__2_2(orig_OnClientConnect self, NetworkManagerSystemSteam user, NetworkConnection t) { } } private DPConfig config; private ScenesData scenesData; public void Awake() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Expected O, but got Unknown //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Expected O, but got Unknown //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Expected O, but got Unknown //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) config = new DPConfig(((BaseUnityPlugin)this).Config); if (!config.CfgEnabled.Value) { return; } if (config.CfgEnableMenuSkip.Value) { MainMenuController.UpdateMenuTransition += new hook_UpdateMenuTransition(MainMenuController_UpdateMenuTransition); } if (config.CfgSkipLobbyScreen.Value) { PreGameRuleVoteController.ServerHandleClientVoteUpdate += new hook_ServerHandleClientVoteUpdate(PreGameRuleVoteController_ServerHandleClientVoteUpdate); } Run.onRunStartGlobal += delegate { Console.instance.SubmitCmd(NetworkUser.readOnlyLocalPlayersList[0], config.CfgInitCmds.Value, false); }; PreGameRuleVoteController.UpdateGameVotes += new hook_UpdateGameVotes(PreGameRuleVoteController_UpdateGameVotes); Run.PickNextStageScene += new hook_PickNextStageScene(Run_PickNextStageScene); Stage.RespawnCharacter += new hook_RespawnCharacter(Stage_RespawnCharacter); SceneDirector.PopulateScene += new hook_PopulateScene(SceneDirector_PopulateScene); if (config.CfgFreezeTimer.Value) { object obj = <>c.<>9__2_1; if (obj == null) { hook_ShouldUpdateRunStopwatch val = (orig_ShouldUpdateRunStopwatch orig, Run self) => false; <>c.<>9__2_1 = val; obj = (object)val; } Run.ShouldUpdateRunStopwatch += (hook_ShouldUpdateRunStopwatch)obj; } object obj2 = <>c.<>9__2_2; if (obj2 == null) { hook_OnClientConnect val2 = delegate { }; <>c.<>9__2_2 = val2; obj2 = (object)val2; } NetworkManagerSystemSteam.OnClientConnect += (hook_OnClientConnect)obj2; if (config.CfgEnableTexts.Value) { GameObject val3 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/UI/HUDSimple.prefab").WaitForCompletion(); Transform transform = val3.GetComponent<HUD>().mainUIPanel.transform; GameObject val4 = new GameObject("DebugLocation", new Type[2] { typeof(RectTransform), typeof(TextMeshProUGUI) }); RectTransform val5 = (RectTransform)val4.transform; val4.transform.SetParent(transform); ((Component)val5).transform.localScale = Vector3.one; TextMeshProUGUI component = val4.GetComponent<TextMeshProUGUI>(); ((Transform)val5).localPosition = Vector3.zero; val5.anchoredPosition = config.CfgTextsPosition.Value; ((TMP_Text)component).fontSize = config.CfgTextsSize.Value; GameObject val6 = new GameObject("DebugDirection", new Type[2] { typeof(RectTransform), typeof(TextMeshProUGUI) }); RectTransform val7 = (RectTransform)val6.transform; val6.transform.SetParent(transform); ((Component)val7).transform.localScale = Vector3.one; TextMeshProUGUI component2 = val6.GetComponent<TextMeshProUGUI>(); ((Transform)val7).localPosition = Vector3.zero; val7.anchoredPosition = new Vector2(config.CfgTextsPosition.Value.x, config.CfgTextsPosition.Value.y + 100f); ((TMP_Text)component2).fontSize = config.CfgTextsSize.Value; GameObject val8 = new GameObject("DebugVelocity", new Type[2] { typeof(RectTransform), typeof(TextMeshProUGUI) }); RectTransform val9 = (RectTransform)val8.transform; val8.transform.SetParent(transform); ((Component)val9).transform.localScale = Vector3.one; TextMeshProUGUI component3 = val8.GetComponent<TextMeshProUGUI>(); ((Transform)val9).localPosition = Vector3.zero; val9.anchoredPosition = new Vector2(config.CfgTextsPosition.Value.x, config.CfgTextsPosition.Value.y + 200f); ((TMP_Text)component3).fontSize = config.CfgTextsSize.Value; VectorDataBehaviour vectorDataBehaviour = val3.AddComponent<VectorDataBehaviour>(); vectorDataBehaviour.location = component; vectorDataBehaviour.direction = component2; vectorDataBehaviour.velocity = component3; } } private void MainMenuController_UpdateMenuTransition(orig_UpdateMenuTransition orig, MainMenuController self) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (LocalUserManager.isAnyUserSignedIn) { Console.instance.SubmitCmd(CmdSender.op_Implicit(LocalUserManager.GetFirstLocalUser()), "transition_command gamemode ClassicRun; host 0;", false); } else { Debug.LogWarning((object)"[DebuggingPlains] No profile selected, MainMenu can't be skipped."); } } private void SceneDirector_PopulateScene(orig_PopulateScene orig, SceneDirector self) { //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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_009d: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_016c: 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_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Invalid comparison between Unknown and I4 //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Invalid comparison between Unknown and I4 //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (config.CfgDisableTPZones.Value) { Utils.DisableMapZones(); } SceneData sceneDataBySceneName = config.scenesData.GetSceneDataBySceneName(SceneInfo.instance.sceneDef.baseSceneName); if (sceneDataBySceneName != null) { foreach (ObjectToSpawn objects in sceneDataBySceneName.objectsList.GetObjectsList()) { SpawnCard val = Resources.Load<SpawnCard>(objects.objName); if (Object.op_Implicit((Object)(object)val)) { DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(val, new DirectorPlacementRule { placementMode = (PlacementMode)0, position = objects.position }, new Xoroshiro128Plus(0uL))).transform.rotation = objects.rotation; } else { Debug.LogWarning((object)("[DebuggingPlains] No spawn card with name " + objects.objName + " found! ignoring.")); } } using (List<DummyToSpawn>.Enumerator enumerator2 = sceneDataBySceneName.dummyList.GetObjectsList().GetEnumerator()) { if (NetworkServer.active) { while (enumerator2.MoveNext()) { DummyToSpawn current2 = enumerator2.Current; GameObject val2 = MasterCatalog.FindMasterPrefab(current2.objName); GameObject bodyPrefab = val2.GetComponent<CharacterMaster>().bodyPrefab; if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)bodyPrefab)) { GameObject obj = Object.Instantiate<GameObject>(val2, current2.position, Quaternion.identity); CharacterMaster component = obj.GetComponent<CharacterMaster>(); NetworkServer.Spawn(obj); component.bodyPrefab = bodyPrefab; component.SpawnBody(current2.position, current2.rotation); component.inventory.GiveItem(Items.BoostHp, 999999999); Object.Destroy((Object)(object)((Component)component).GetComponent<BaseAI>()); } else { Debug.LogWarning((object)("[DebuggingPlains] No master prefab with name " + current2.objName + " found! ignoring.")); } } } } using (List<DummyToSpawn>.Enumerator enumerator3 = sceneDataBySceneName.allyList.GetObjectsList().GetEnumerator()) { if (NetworkServer.active) { while (enumerator3.MoveNext()) { DummyToSpawn current3 = enumerator3.Current; GameObject val3 = MasterCatalog.FindMasterPrefab(current3.objName); GameObject bodyPrefab2 = val3.GetComponent<CharacterMaster>().bodyPrefab; if (Object.op_Implicit((Object)(object)val3) && Object.op_Implicit((Object)(object)bodyPrefab2)) { GameObject val4 = Object.Instantiate<GameObject>(val3, current3.position, Quaternion.identity); CharacterMaster component2 = val4.GetComponent<CharacterMaster>(); component2.teamIndex = (TeamIndex)1; NetworkServer.Spawn(val4); component2.bodyPrefab = bodyPrefab2; component2.SpawnBody(current3.position, current3.rotation).teamComponent.teamIndex = (TeamIndex)1; component2.inventory.GiveItem(Items.BoostHp, 999999999); Object.Destroy((Object)(object)((Component)component2).GetComponent<BaseAI>()); } else { Debug.LogWarning((object)("[DebuggingPlains] No master prefab with name " + current3.objName + " found! ignoring.")); } } } } foreach (PickupToSpawn objects2 in sceneDataBySceneName.pickupList.GetObjectsList()) { PickupIndex val5 = PickupIndex.none; EquipmentIndex val6 = EquipmentCatalog.FindEquipmentIndex(objects2.objName); ItemIndex val7 = ItemCatalog.FindItemIndex(objects2.objName); if ((int)val6 != -1) { val5 = PickupCatalog.FindPickupIndex(val6); } if ((int)val7 != -1) { val5 = PickupCatalog.FindPickupIndex(val7); } PickupDropletController.CreatePickupDroplet(val5, objects2.position, new Vector3(0f, 5f, 0f)); } } Debug.LogWarning((object)("[DebuggingPlains] no scene data for scene " + SceneInfo.instance.sceneDef.baseSceneName + " found!")); } private void Stage_RespawnCharacter(orig_RespawnCharacter orig, Stage self, CharacterMaster characterMaster) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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_00fa: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_011d: 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_0072: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)characterMaster)) { return; } Vector3 val = Vector3.zero; Quaternion val2 = Quaternion.identity; SceneData sceneDataBySceneName = config.scenesData.GetSceneDataBySceneName(self.sceneDef.baseSceneName); if (sceneDataBySceneName != null) { val = ((sceneDataBySceneName.playerSpawnPosition.x == 0f && sceneDataBySceneName.playerSpawnPosition.y == 0f && sceneDataBySceneName.playerSpawnPosition.z == 0f) ? Vector3.zero : sceneDataBySceneName.playerSpawnPosition); val2 = sceneDataBySceneName.playerSpawnRotation; } if (val == Vector3.zero) { Transform playerSpawnTransform = self.GetPlayerSpawnTransform(); if (Object.op_Implicit((Object)(object)playerSpawnTransform)) { val = playerSpawnTransform.position; } } GameObject val3 = BodyCatalog.FindBodyPrefab(config.CfgCharacter.Value); if (!Object.op_Implicit((Object)(object)val3)) { Debug.LogWarning((object)("[DebuggingPlains] Body " + config.CfgCharacter.Value + " could not be found!")); val3 = BodyCatalog.FindBodyPrefab("CommandoBody"); } characterMaster.bodyPrefab = val3; CharacterBody val4 = characterMaster.Respawn(val, val2, false); if (config.CfgSpawnWithDropPod.Value) { Run.instance.HandlePlayerFirstEntryAnimation(val4, val, val2); } } private void Run_PickNextStageScene(orig_PickNextStageScene orig, Run self, WeightedSelection<SceneDef> choices) { SceneDef sceneDefFromSceneName = SceneCatalog.GetSceneDefFromSceneName(config.CfgStartingStage.Value); if (!Object.op_Implicit((Object)(object)sceneDefFromSceneName)) { Debug.LogWarning((object)("[DebuggingPlains] Scene " + config.CfgStartingStage.Value + " not found! going to debugging plains")); sceneDefFromSceneName = SceneCatalog.GetSceneDefFromSceneName("golemplains"); } new List<string>(); sceneDefFromSceneName.nameToken = "Debugging Plains"; sceneDefFromSceneName.subtitleToken = "Ground 0011010010"; self.nextStageScene = sceneDefFromSceneName; } private void PreGameRuleVoteController_UpdateGameVotes(orig_UpdateGameVotes orig) { orig.Invoke(); string[] array = config.CfgArtifactsList.Value.Split(new char[1] { ',' }); foreach (string text in array) { if (!(text == "")) { RuleChoiceDef val = RuleCatalog.FindChoiceDef("Artifacts." + text + ".On"); if (val != null) { PreGameController.instance.ApplyChoice(val.globalIndex); } else { Debug.Log((object)("[DebuggingPlains] Could not find Artifact " + text + "! ignoring")); } } } RuleChoiceDef val2 = RuleCatalog.FindChoiceDef("Difficulty." + config.CfgDifficulty.Value); if (val2 != null) { PreGameController.instance.ApplyChoice(val2.globalIndex); } else { Debug.LogWarning((object)("[DebuggingPlains] could not find Difficulty " + config.CfgDifficulty.Value + "! ignoring")); } } private void PreGameRuleVoteController_ServerHandleClientVoteUpdate(orig_ServerHandleClientVoteUpdate orig, NetworkMessage netMsg) { orig.Invoke(netMsg); foreach (NetworkUser readOnlyLocalPlayers in NetworkUser.readOnlyLocalPlayersList) { if (Object.op_Implicit((Object)(object)readOnlyLocalPlayers)) { readOnlyLocalPlayers.CallCmdSubmitVote(((Component)PreGameController.instance).gameObject, 0); } else { Debug.Log((object)"[DebuggingPlains] Null network user in readonly local player list!"); } } } } internal class DPConfig { private readonly ConfigFile config; public ConfigEntry<bool> CfgEnabled { get; set; } public ConfigEntry<string> CfgScenesConfigPath { get; set; } public ConfigEntry<bool> CfgSkipLobbyScreen { get; set; } public ConfigEntry<bool> CfgDisableTPZones { get; set; } public ConfigEntry<string> CfgInitCmds { get; set; } public ConfigEntry<string> CfgCharacter { get; set; } public ConfigEntry<bool> CfgSpawnWithDropPod { get; set; } public ConfigEntry<string> CfgArtifactsList { get; set; } public ConfigEntry<string> CfgDifficulty { get; set; } public ConfigEntry<string> CfgStartingStage { get; set; } public ConfigEntry<bool> CfgFreezeTimer { get; set; } public ScenesData scenesData { get; set; } public ConfigEntry<bool> CfgEnableTexts { get; set; } public ConfigEntry<bool> CfgEnableMenuSkip { get; set; } public ConfigEntry<Vector2> CfgTextsPosition { get; set; } public ConfigEntry<float> CfgTextsSize { get; set; } public DPConfig(ConfigFile config) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown config = new ConfigFile(Paths.ConfigPath + "\\DebuggingPlains\\BaseConfig.cfg", true); this.config = config; InitConfig(); LoadScenesDataFromJson(); } private void InitConfig() { //IL_01e0: Unknown result type (might be due to invalid IL or missing references) CfgEnabled = config.Bind<bool>("mod_config", "enabled", true, "change to false if you want to disable the mod hooks and run the classic game"); CfgScenesConfigPath = config.Bind<string>("mod_config", "scenes_config_path", "scenesConfig.json", "path to the scenes config file containing a json with all the scenes data (if it does not exists, it is created automatically)"); CfgEnableMenuSkip = config.Bind<bool>("mod_config", "skip_menu", true, "skip main menu screen"); CfgSkipLobbyScreen = config.Bind<bool>("mod_config", "skip_lobby", true, "skip the character selection screen and head straight to the run"); CfgDisableTPZones = config.Bind<bool>("mod_config", "disable_tp", true, "disable teleport out of bounds zones"); CfgInitCmds = config.Bind<string>("run_config", "initial_cmds", "no_enemies; kill_all 2; give_money 999;", "Commands to run at the beginning of the run (must be ConCommands concatenated with ';' as a seperator)"); CfgCharacter = config.Bind<string>("run_config", "character_body", "CommandoBody", "selected character body to spawn (Must be the bodyprefab name). Works with any bodyprefab, even monsters."); CfgSpawnWithDropPod = config.Bind<bool>("run_config", "drop_pod", false, "spawn from a falling drop pod or simply appearing on the map"); CfgArtifactsList = config.Bind<string>("run_config", "artifacts", "Command", "Artifacts to activate (must be the artifact asset names concatenated with ',' as a seperator) "); CfgDifficulty = config.Bind<string>("run_config", "difficulty", "Normal", "Desired difficulty (Easy, Normal, Hard or any other difficulty you got)"); CfgStartingStage = config.Bind<string>("run_config", "starting_stage", "golemplains", "Starting stage"); CfgFreezeTimer = config.Bind<bool>("run_config", "freeze_timer", true, "freeze the timer"); CfgEnableTexts = config.Bind<bool>("run_config", "character_vector_info", true, "Enable character vector informations (Location, Direction and Velocity)."); CfgTextsPosition = config.Bind<Vector2>("run_config", "character_vector_info_text_position", new Vector2(800f, -300f), "Vector infos text position on screen."); CfgTextsSize = config.Bind<float>("run_config", "character_vector_info_text_font_size", 20f, "Vector infos text font size."); } private void LoadScenesDataFromJson() { string path = Path.Combine(Path.GetDirectoryName(config.ConfigFilePath), CfgScenesConfigPath.Value); string text = ""; bool flag = true; bool flag2 = true; if (File.Exists(path)) { text = File.ReadAllText(path); try { JSONNode.Parse(text); } catch { Debug.LogWarning((object)"[DebuggingPlains] scene config file malformed! using defaults"); flag = false; } } else { Debug.LogWarning((object)"[DebuggingPlains] scene config file not found! using defaults"); flag = false; flag2 = false; } if (!flag) { using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("DebuggingPlains.sampleJson.json")) { text = new StreamReader(stream).ReadToEnd(); } if (!flag2) { File.WriteAllText(path, text); } } scenesData = new ScenesData(JSONNode.Parse(text)); } } public class PickupLocations { private List<PickupToSpawn> pickupList; public PickupLocations(List<PickupToSpawn> objectsList) { pickupList = objectsList; } public PickupLocations() { pickupList = new List<PickupToSpawn>(); } public List<PickupToSpawn> GetObjectsList() { return pickupList; } public void SetObjectsList(List<PickupToSpawn> objectsList) { pickupList = objectsList; } public void Add(string objName, Vector3 position) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) pickupList.Add(new PickupToSpawn(objName, position)); } public void Add(PickupToSpawn objectToSpawn) { pickupList.Add(objectToSpawn); } } public class AllyLocations : DummyLocations { } public class DummyLocations { private List<DummyToSpawn> dummyList; public DummyLocations(List<DummyToSpawn> objectsList) { dummyList = objectsList; } public DummyLocations() { dummyList = new List<DummyToSpawn>(); } public List<DummyToSpawn> GetObjectsList() { return dummyList; } public void SetObjectsList(List<DummyToSpawn> objectsList) { dummyList = objectsList; } public void Add(string objName, Vector3 position, Quaternion rotation) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) dummyList.Add(new DummyToSpawn(objName, position, rotation)); } public void Add(DummyToSpawn objectToSpawn) { dummyList.Add(objectToSpawn); } } public class ObjectsLocations { private List<ObjectToSpawn> objectsList; public ObjectsLocations(List<ObjectToSpawn> objectsList) { this.objectsList = objectsList; } public ObjectsLocations() { objectsList = new List<ObjectToSpawn>(); } public List<ObjectToSpawn> GetObjectsList() { return objectsList; } public void SetObjectsList(List<ObjectToSpawn> objectsList) { this.objectsList = objectsList; } public void Add(string objName, Vector3 position, Quaternion rotation) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) objectsList.Add(new ObjectToSpawn(objName, position, rotation)); } public void Add(ObjectToSpawn objectToSpawn) { objectsList.Add(objectToSpawn); } } public class PickupToSpawn { public string objName; public Vector3 position; public PickupToSpawn(string objName, Vector3 position) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) this.objName = objName; this.position = position; } } public class DummyToSpawn { public string objName; public Vector3 position; public Quaternion rotation; public DummyToSpawn(string objName, Vector3 position, Quaternion rotation) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) this.objName = objName; this.position = position; this.rotation = rotation; } } public class ObjectToSpawn { public string objName; public Vector3 position; public Quaternion rotation; public ObjectToSpawn(string objName, Vector3 position, Quaternion rotation) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) this.objName = objName; this.position = position; this.rotation = rotation; } } public class SceneData { public string sceneName; public Vector3 playerSpawnPosition; public Quaternion playerSpawnRotation; public ObjectsLocations objectsList; public DummyLocations dummyList; public PickupLocations pickupList; public AllyLocations allyList; public SceneData(string sceneName, Vector3 playerSpawnPosition, Quaternion playerSpawnRotation, ObjectsLocations objectsList, DummyLocations dummyList, PickupLocations pickupList, AllyLocations allyList) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) this.sceneName = sceneName; this.playerSpawnPosition = playerSpawnPosition; this.playerSpawnRotation = playerSpawnRotation; this.objectsList = objectsList; this.dummyList = dummyList; this.pickupList = pickupList; this.allyList = allyList; } public SceneData() { } } public class ScenesData { private List<SceneData> scenesDataList = new List<SceneData>(); public SceneData GetSceneDataBySceneName(string sceneName) { foreach (SceneData scenesData in scenesDataList) { if (scenesData.sceneName == sceneName) { return scenesData; } } return null; } public void AddSceneData(SceneData scene) { scenesDataList.Add(scene); } public ScenesData() { } public ScenesData(JSONNode jsonBuffer) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Expected O, but got Unknown //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Expected O, but got Unknown //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Expected O, but got Unknown //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Expected O, but got Unknown //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_050c: Unknown result type (might be due to invalid IL or missing references) foreach (JSONNode item in jsonBuffer["scenesData"].AsArray) { JSONNode val = item; SceneData sceneData = new SceneData { sceneName = JSONNode.op_Implicit(val["sceneName"]), playerSpawnPosition = new Vector3(val["playerSpawnPosition"]["x"].AsFloat, val["playerSpawnPosition"]["y"].AsFloat, val["playerSpawnPosition"]["z"].AsFloat), playerSpawnRotation = new Quaternion(val["playerSpawnPosition"]["x"].AsFloat, val["playerSpawnPosition"]["y"].AsFloat, val["playerSpawnPosition"]["z"].AsFloat, val["playerSpawnPosition"]["w"].AsFloat), objectsList = new ObjectsLocations(), dummyList = new DummyLocations(), pickupList = new PickupLocations(), allyList = new AllyLocations() }; foreach (JSONNode item2 in val["objectsLocations"].AsArray) { JSONNode val2 = item2; sceneData.objectsList.Add(JSONNode.op_Implicit(val2["objName"]), new Vector3(val2["position"]["x"].AsFloat, val2["position"]["y"].AsFloat, val2["position"]["z"].AsFloat), Quaternion.Euler(val2["rotation"]["x"].AsFloat, val2["rotation"]["y"].AsFloat, val2["rotation"]["z"].AsFloat)); } foreach (JSONNode item3 in val["dummyLocations"].AsArray) { JSONNode val3 = item3; sceneData.dummyList.Add(JSONNode.op_Implicit(val3["objName"]), new Vector3(val3["position"]["x"].AsFloat, val3["position"]["y"].AsFloat, val3["position"]["z"].AsFloat), Quaternion.Euler(val3["rotation"]["x"].AsFloat, val3["rotation"]["y"].AsFloat, val3["rotation"]["z"].AsFloat)); } foreach (JSONNode item4 in val["pickupLocations"].AsArray) { JSONNode val4 = item4; sceneData.pickupList.Add(JSONNode.op_Implicit(val4["objName"]), new Vector3(val4["position"]["x"].AsFloat, val4["position"]["y"].AsFloat, val4["position"]["z"].AsFloat)); } foreach (JSONNode item5 in val["allyLocations"].AsArray) { JSONNode val5 = item5; sceneData.allyList.Add(JSONNode.op_Implicit(val5["objName"]), new Vector3(val5["position"]["x"].AsFloat, val5["position"]["y"].AsFloat, val5["position"]["z"].AsFloat), Quaternion.Euler(val5["rotation"]["x"].AsFloat, val5["rotation"]["y"].AsFloat, val5["rotation"]["z"].AsFloat)); } scenesDataList.Add(sceneData); } } } internal class Utils { public static void DisableMapZones() { MapZone[] array = Object.FindObjectsOfType<MapZone>(); for (int i = 0; i < array.Length; i++) { ((Component)array[i]).gameObject.SetActive(false); } } } internal class VectorDataBehaviour : MonoBehaviour { private HUD hud; private CharacterBody body; private RigidbodyDirection rigidDirection; public TextMeshProUGUI location; public TextMeshProUGUI direction; public TextMeshProUGUI velocity; private void Awake() { hud = ((Component)this).GetComponent<HUD>(); } private void Update() { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)hud.targetBodyObject)) { body = hud.targetBodyObject.GetComponent<CharacterBody>(); } if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)location) && Object.op_Implicit((Object)(object)direction) && Object.op_Implicit((Object)(object)velocity)) { Vector3 footPosition = body.footPosition; ((TMP_Text)location).text = "Position:" + Environment.NewLine + "X: " + footPosition.x + Environment.NewLine + "Y: " + footPosition.y + Environment.NewLine + "Z: " + footPosition.z; Vector3 val = ((!Object.op_Implicit((Object)(object)body.characterDirection)) ? ((Component)body).gameObject.transform.forward : (Object.op_Implicit((Object)(object)rigidDirection) ? rigidDirection.aimDirection : body.characterDirection.forward)); ((TMP_Text)direction).text = "Direction:" + Environment.NewLine + "X: " + val.x + Environment.NewLine + "Y: " + val.y + Environment.NewLine + "Z: " + val.z; Vector3 val2 = (Object.op_Implicit((Object)(object)body.characterMotor) ? body.characterMotor.velocity : body.rigidbody.velocity); ((TMP_Text)velocity).text = "Velocity:" + Environment.NewLine + "X: " + val2.x + Environment.NewLine + "Y: " + val2.y + Environment.NewLine + "Z: " + val2.z; } } }