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.Runtime.Versioning; using DCDMapLoader; using HarmonyLib; using MelonLoader; using Photon.Pun; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(MapLoader), "DCDMapLoader", "1.1.0", "RusticVoid", null)] [assembly: MelonGame("Joseph Cook", "Ducks Can Drive")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("DCDMapLoader")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("DCDMapLoader")] [assembly: AssemblyTitle("DCDMapLoader")] [assembly: AssemblyVersion("1.0.0.0")] public class TriggerHandler : MonoBehaviour { public event Action OnTriggered; private void OnTriggerEnter(Collider other) { this.OnTriggered?.Invoke(((Component)other).gameObject); } } namespace DCDMapLoader; public class InfoData { public string Name; public string Desc; public string Author; public bool isCity; } public class customTrack { public string name; public Texture2D icon; public string mapPath; public string desc; public bool isCity; public customTrack(string name, string mapPath, string desc, Texture2D icon = null, bool isCity = false) { this.name = name; this.mapPath = mapPath; this.icon = icon; this.desc = desc; this.isCity = isCity; } } public class customTrackLoader { public static int currentTrackId; public static List customTracks = new List(); public static void LoadRace(int MapID) { if (PhotonNetwork.InRoom) { MelonLogger.Msg("Loading " + customTracks[MapID].name + "!"); currentTrackId = MapID; PhotonNetwork.LoadLevel(Path.GetFileNameWithoutExtension(customTracks[MapID].mapPath)); } } public static void ToLastCheckPoint(GameObject other) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_009d: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_00fa: Unknown result type (might be due to invalid IL or missing references) if (!((Component)other.GetComponent()).GetComponent().IsMine) { return; } GameObject val = GameObject.Find("CheckpointManager"); int num = 0; num = ((other.GetComponent().furthestCheckpointReached != 0) ? (other.GetComponent().furthestCheckpointReached - 1) : (val.GetComponent().checkpoints.Length - 1)); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(0f, 20f, 0f); Rigidbody[] componentsInChildren = other.GetComponentsInChildren(); foreach (Rigidbody val3 in componentsInChildren) { val3.velocity = Vector3.zero; val3.angularVelocity = Vector3.zero; val3.isKinematic = true; Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).buildIndex == 3) { val3.position = val.GetComponent().checkpoints[num].GetComponent().position + val2; } else { activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).buildIndex > 3) { val3.position = val.GetComponent().checkpoints[num].GetComponent().position + val2; } } val3.isKinematic = false; } other.GetComponent().position = val.GetComponent().checkpoints[num].GetComponent().position + val2; } public static void InitCustomMaps() { //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown string[] directories = Directory.GetDirectories(Directory.GetParent(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)).FullName, "*", SearchOption.TopDirectoryOnly); for (int i = 0; i < directories.Length; i++) { string path = directories[i] + "/Maps/"; if (!Directory.Exists(path)) { continue; } string[] directories2 = Directory.GetDirectories(path, "*", SearchOption.TopDirectoryOnly); for (int j = 0; j < directories2.Length; j++) { string[] files = Directory.GetFiles(directories2[j], "*", SearchOption.TopDirectoryOnly); Texture2D val = new Texture2D(2, 2); AssetBundle val2 = null; InfoData infoData = null; string[] array = files; foreach (string text in array) { if (Path.GetExtension(text) == "") { val2 = AssetBundle.LoadFromFile(text); } else if (Path.GetExtension(text) == ".json") { infoData = JsonUtility.FromJson(File.ReadAllText(text)); } else { ImageConversion.LoadImage(val, File.ReadAllBytes(text)); } } if ((Object)(object)val2 == (Object)null) { MelonLogger.Msg("Failed to load AssetBundle!"); MelonLogger.Msg("Is map already loaded?"); continue; } if (val2.GetAllScenePaths().Length == 0) { MelonLogger.Msg("No scenes found in AssetBundle!"); continue; } array = val2.GetAllScenePaths(); foreach (string text2 in array) { customTrack item = new customTrack(Path.GetFileNameWithoutExtension(text2), text2, "No Desc", val); if (infoData != null) { item = new customTrack(infoData.Name + " By: " + infoData.Author, text2, infoData.Desc, val, infoData.isCity); } customTracks.Add(item); } } } directories = Directory.GetDirectories(AppDomain.CurrentDomain.BaseDirectory + "/Maps/", "*", SearchOption.TopDirectoryOnly); for (int i = 0; i < directories.Length; i++) { string[] files2 = Directory.GetFiles(directories[i], "*", SearchOption.TopDirectoryOnly); Texture2D val3 = new Texture2D(2, 2); AssetBundle val4 = null; InfoData infoData2 = null; string[] directories2 = files2; foreach (string text3 in directories2) { if (Path.GetExtension(text3) == "") { val4 = AssetBundle.LoadFromFile(text3); } else if (Path.GetExtension(text3) == ".json") { infoData2 = JsonUtility.FromJson(File.ReadAllText(text3)); } else { ImageConversion.LoadImage(val3, File.ReadAllBytes(text3)); } } if ((Object)(object)val4 == (Object)null) { MelonLogger.Msg("Failed to load AssetBundle!"); MelonLogger.Msg("Is map already loaded?"); continue; } if (val4.GetAllScenePaths().Length == 0) { MelonLogger.Msg("No scenes found in AssetBundle!"); continue; } directories2 = val4.GetAllScenePaths(); foreach (string text4 in directories2) { customTrack item2 = new customTrack(Path.GetFileNameWithoutExtension(text4), text4, "No Desc", val3); if (infoData2 != null) { item2 = new customTrack(infoData2.Name + " By: " + infoData2.Author, text4, infoData2.Desc, val3, infoData2.isCity); } customTracks.Add(item2); } } if (customTracks.Count <= 0) { MelonLogger.Msg("No Custom Maps Found!"); return; } MelonLogger.Msg("Found Custom Maps: " + string.Join(", ", customTracks.Select((customTrack track) => track.name))); } public static void initCustomMapObjects(int buildIndex, string sceneName) { //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_013d: 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_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) if (customTracks.FirstOrDefault((customTrack ct) => Path.GetFileNameWithoutExtension(ct.mapPath) == sceneName) == null || !PhotonNetwork.InRoom) { return; } GameObject[] array = Object.FindObjectsOfType(); MelonLogger.Msg("Initializing Spawns and Triggers!"); List list = new List(); GameObject[] array2 = array; foreach (GameObject val in array2) { if (((Object)val).name == "Spawn" || ((Object)val).name == "spawn") { list.Add(val.transform); } if ((((Object)val).name == "ToLastCheckpoint" || ((Object)val).name == "toLastCheckpoint") && (Object)(object)val.GetComponent() != (Object)null) { val.AddComponent().OnTriggered += ToLastCheckPoint; } } if (list.Count == 0) { MelonLogger.Msg("INVALID MAP NO SPAWNS FOUND!"); MelonLogger.Msg("SPAWN SET TO 0,5,0 THIS MIGHT BREAK THINGS!"); Transform transform = new GameObject().transform; transform.position = new Vector3(0f, 5f, 0f); transform.rotation = Quaternion.Euler(0f, 0f, 0f); for (int num2 = 0; num2 < PhotonNetwork.CurrentRoom.PlayerCount; num2++) { list.Add(transform); } } Transform[] array3 = list.ToArray(); MelonLogger.Msg("Initializing Player!"); int num3 = PhotonNetwork.LocalPlayer.ActorNumber - 1; if (buildIndex > 3) { PhotonNetwork.Instantiate(Path.Combine("PhotonPrefabs", "PlayerController"), array3[num3].position, array3[num3].rotation, (byte)0, (object[])null); return; } GameObject val2 = PhotonNetwork.Instantiate(Path.Combine("PhotonPrefabs", "PlayerController"), array3[num3].position, array3[num3].rotation, (byte)0, (object[])null); Garage[] array4 = Object.FindObjectsOfType(); for (int num4 = 0; num4 < array4.Length; num4++) { array4[num4].localPlayer = val2.GetComponent(); } } } public class customTrackMenu { private static Vector2 scrollPosition = Vector2.zero; public static bool CustomMapsOnly = false; public static bool BaseGameMapsOnly = false; public static void menu() { //IL_0029: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: 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_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) int num = 75; int num2 = 365; int num3 = 500; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor((float)(Screen.width - num2) - 20f, 20f); GUI.Box(new Rect(val.x, val.y, (float)num2, (float)num3), "Custom Tracks"); int num4 = customTrackLoader.customTracks.Count * num + 10; scrollPosition = GUI.BeginScrollView(new Rect(val.x, val.y + 25f, (float)num2, (float)(num3 - 55)), scrollPosition, new Rect(0f, 0f, (float)(num2 - 20), (float)num4)); Rect val2 = default(Rect); Rect val3 = default(Rect); for (int i = 0; i < customTrackLoader.customTracks.Count; i++) { customTrack customTrack2 = customTrackLoader.customTracks[i]; ((Rect)(ref val2))..ctor(10f, (float)(num * i), (float)(num2 - 20), (float)num); if (GUI.Button(val2, "")) { customTrackLoader.LoadRace(i); } ((Rect)(ref val3))..ctor(((Rect)(ref val2)).x, ((Rect)(ref val2)).y, (float)num, (float)num); GUI.DrawTexture(val3, (Texture)(object)customTrack2.icon); GUI.Label(new Rect(((Rect)(ref val2)).x + ((Rect)(ref val3)).width + 2f, ((Rect)(ref val2)).y, ((Rect)(ref val2)).width - (float)num, (float)num), customTrack2.name + "\n" + customTrack2.desc); } GUI.EndScrollView(); if (GUI.Button(new Rect(val.x + 10f, (float)(num3 - 10), 100f, 20f), "Refesh Maps")) { customTrackLoader.InitCustomMaps(); } Vector2 val4 = default(Vector2); ((Vector2)(ref val4))..ctor(val.x, (float)(num3 + 20)); GUI.Box(new Rect(val4.x, val4.y, (float)num2, 70f), "Custom Tracks Options"); CustomMapsOnly = GUI.Toggle(new Rect(val4.x + 10f, val4.y + 20f, 200f, 20f), CustomMapsOnly, "Custom Maps Only"); if (CustomMapsOnly) { BaseGameMapsOnly = false; } BaseGameMapsOnly = GUI.Toggle(new Rect(val4.x + 10f, val4.y + 40f, 200f, 20f), BaseGameMapsOnly, "Base Game Maps Only"); if (BaseGameMapsOnly) { CustomMapsOnly = false; } } } [HarmonyPatch(typeof(Launcher), "OnJoinedRoom")] public class Patch_lobbyCreated { private static void Postfix() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0039: Expected O, but got Unknown Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == "Lobby" && PhotonNetwork.IsMasterClient) { ((MelonEventBase)(object)MelonEvents.OnGUI).Subscribe(new LemonAction(customTrackMenu.menu), 100, false); } } } [HarmonyPatch(typeof(Launcher), "LeaveRoom")] public class Patch_lobbyLeft { private static void Postfix() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown ((MelonEventBase)(object)MelonEvents.OnGUI).Unsubscribe(new LemonAction(customTrackMenu.menu)); } } public class MapLoader : MelonMod { public override void OnInitializeMelon() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) MelonLogger.Msg("DCDMapLoader loaded!"); string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Maps"); if (!Directory.Exists(path)) { MelonLogger.Msg("No maps folder found! Creating one now."); Directory.CreateDirectory(path); } customTrackLoader.InitCustomMaps(); new Harmony("com.rusticvoid.dcdmaploader").PatchAll(); } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown ((MelonEventBase)(object)MelonEvents.OnGUI).Unsubscribe(new LemonAction(customTrackMenu.menu)); customTrackLoader.initCustomMapObjects(buildIndex, sceneName); } public override void OnUpdate() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == "Lobby" && PhotonNetwork.InRoom && PhotonNetwork.IsMasterClient && !PhotonNetwork.CurrentRoom.IsVisible) { ((MelonEventBase)(object)MelonEvents.OnGUI).Subscribe(new LemonAction(customTrackMenu.menu), 100, false); } else { ((MelonEventBase)(object)MelonEvents.OnGUI).Unsubscribe(new LemonAction(customTrackMenu.menu)); } } } [HarmonyPatch(typeof(RoundTimer), "LoadRace")] public class Patch_LoadRace { private static bool Prefix(RoundTimer __instance, ref IEnumerator __result) { if (customTrackMenu.BaseGameMapsOnly) { return true; } __result = CustomLoadRace(__instance); return false; } private static IEnumerator CustomLoadRace(RoundTimer instance) { AccessTools.Field(typeof(RoundTimer), "loadingRace").SetValue(instance, true); yield return (object)new WaitForSeconds(2.5f); FieldInfo fieldInfo = AccessTools.Field(typeof(RoundTimer), "tracks"); string[] baseTracks = (string[])fieldInfo.GetValue(instance); List list = new List(); if (!customTrackMenu.CustomMapsOnly) { for (int i = 0; i < baseTracks.Length; i++) { int index = i; list.Add(delegate { PhotonNetwork.LoadLevel(baseTracks[index]); }); } } if (!customTrackMenu.BaseGameMapsOnly) { for (int num = 0; num < customTrackLoader.customTracks.Count; num++) { int index2 = num; if (!customTrackLoader.customTracks[num].isCity) { list.Add(delegate { customTrackLoader.LoadRace(index2); }); } } } if (list.Count != 0) { int index3 = Random.Range(0, list.Count); list[index3](); } } } [HarmonyPatch(typeof(Car), "Start")] public class Patch_CarStart { private static bool Prefix(Car __instance) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (!customTrackLoader.customTracks[customTrackLoader.currentTrackId].isCity) { return true; } Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name != Path.GetFileNameWithoutExtension(customTrackLoader.customTracks[customTrackLoader.currentTrackId].mapPath)) { return true; } CustomStart(__instance); return false; } private static void CustomStart(Car __instance) { object? value = AccessTools.Field(typeof(Car), "pv").GetValue(__instance); object? obj = ((value is PhotonView) ? value : null); object? value2 = AccessTools.Field(typeof(Car), "rb").GetValue(__instance); Rigidbody val = (Rigidbody)((value2 is Rigidbody) ? value2 : null); object value3 = AccessTools.Field(typeof(Car), "arcadeVehicleController").GetValue(__instance); object? value4 = AccessTools.Field(typeof(Car), "moneyText").GetValue(__instance); Text val2 = (Text)((value4 is Text) ? value4 : null); object value5 = AccessTools.Field(typeof(Car), "rankBar").GetValue(__instance); object? value6 = AccessTools.Field(typeof(Car), "exitButton").GetValue(__instance); GameObject val3 = (GameObject)((value6 is GameObject) ? value6 : null); object? value7 = AccessTools.Field(typeof(Car), "playerCamera").GetValue(__instance); GameObject val4 = (GameObject)((value7 is GameObject) ? value7 : null); MethodInfo methodInfo = AccessTools.Method(typeof(Car), "UpdateDarkMode", (Type[])null, (Type[])null); if (!((PhotonView)obj).IsMine) { Object.Destroy((Object)(object)val); return; } if (customTrackLoader.customTracks[customTrackLoader.currentTrackId].isCity) { methodInfo.Invoke(__instance, null); FieldInfo fieldInfo = AccessTools.Field(value3.GetType(), "onRoadSpeed"); FieldInfo fieldInfo2 = AccessTools.Field(value3.GetType(), "accelaration"); FieldInfo fieldInfo3 = AccessTools.Field(value3.GetType(), "offRoadMultiplier"); FieldInfo fieldInfo4 = AccessTools.Field(value3.GetType(), "boostForce"); FieldInfo fieldInfo5 = AccessTools.Field(value3.GetType(), "turn"); fieldInfo.SetValue(value3, 100f); fieldInfo2.SetValue(value3, 20f); fieldInfo3.SetValue(value3, 0.5f); fieldInfo4.SetValue(value3, 50f); fieldInfo5.SetValue(value3, 5f); AccessTools.Method(AccessTools.TypeByName("SaveSystem"), "SaveCar", (Type[])null, (Type[])null).Invoke(null, new object[1] { value3 }); ((Component)val2).gameObject.SetActive(true); } else { methodInfo.Invoke(__instance, null); AccessTools.Field(typeof(Car), "raceStarted").SetValue(__instance, false); object obj2 = AccessTools.Method(AccessTools.TypeByName("SaveSystem"), "LoadCar", (Type[])null, (Type[])null).Invoke(null, null); if (obj2 != null) { FieldInfo fieldInfo6 = AccessTools.Field(value3.GetType(), "onRoadSpeed"); FieldInfo fieldInfo7 = AccessTools.Field(value3.GetType(), "accelaration"); FieldInfo fieldInfo8 = AccessTools.Field(value3.GetType(), "offRoadMultiplier"); FieldInfo fieldInfo9 = AccessTools.Field(value3.GetType(), "boostForce"); FieldInfo fieldInfo10 = AccessTools.Field(value3.GetType(), "turn"); fieldInfo6.SetValue(value3, AccessTools.Field(obj2.GetType(), "onRoadSpeed").GetValue(obj2)); fieldInfo7.SetValue(value3, AccessTools.Field(obj2.GetType(), "acceleration").GetValue(obj2)); fieldInfo8.SetValue(value3, AccessTools.Field(obj2.GetType(), "offRoadMultiplier").GetValue(obj2)); fieldInfo9.SetValue(value3, AccessTools.Field(obj2.GetType(), "boostForce").GetValue(obj2)); fieldInfo10.SetValue(value3, AccessTools.Field(obj2.GetType(), "handling").GetValue(obj2)); } } AccessTools.Method(value5.GetType(), "LoadRank", (Type[])null, (Type[])null).Invoke(value5, null); AccessTools.Field(typeof(RoomManager), "Instance").GetValue(null); RoomManager.Instance.raceStarted = true; val3.SetActive(true); ((MonoBehaviour)__instance).StartCoroutine("Quack"); val4.SetActive(true); AccessTools.Field(typeof(Car), "goldMedals").SetValue(__instance, PlayerPrefs.GetInt("Wins", 0)); AccessTools.Field(typeof(Car), "silverMedals").SetValue(__instance, PlayerPrefs.GetInt("Seconds", 0)); AccessTools.Field(typeof(Car), "bronzeMedals").SetValue(__instance, PlayerPrefs.GetInt("Thirds", 0)); } } [HarmonyPatch(typeof(Car), "FixedUpdate")] public class Patch_CarFixedUpdate { private static bool Prefix(Car __instance) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (!customTrackLoader.customTracks[customTrackLoader.currentTrackId].isCity) { return true; } Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name != Path.GetFileNameWithoutExtension(customTrackLoader.customTracks[customTrackLoader.currentTrackId].mapPath)) { return true; } CustomFixedUpdate(__instance); return false; } private static void CustomFixedUpdate(Car __instance) { //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) object? value = AccessTools.Field(typeof(Car), "pv").GetValue(__instance); PhotonView val = (PhotonView)((value is PhotonView) ? value : null); bool flag = (bool)AccessTools.Field(typeof(Car), "raceFinished").GetValue(__instance); FieldInfo fieldInfo = AccessTools.Field(typeof(Car), "shownFinished"); object? value2 = AccessTools.Field(typeof(Car), "resetButton").GetValue(__instance); GameObject val2 = (GameObject)((value2 is GameObject) ? value2 : null); object? value3 = AccessTools.Field(typeof(Car), "duckTransform").GetValue(__instance); Transform val3 = (Transform)((value3 is Transform) ? value3 : null); object? value4 = AccessTools.Field(typeof(Car), "racePositionText").GetValue(__instance); Text val4 = (Text)((value4 is Text) ? value4 : null); object? value5 = AccessTools.Field(typeof(Car), "finishText").GetValue(__instance); Text val5 = (Text)((value5 is Text) ? value5 : null); object? value6 = AccessTools.Field(typeof(Car), "nameTag").GetValue(__instance); object? obj = ((value6 is GameObject) ? value6 : null); AccessTools.Field(typeof(Car), "arcadeVehicleController").GetValue(__instance); AccessTools.Field(typeof(Car), "playerCamera").GetValue(__instance); FieldInfo fieldInfo2 = AccessTools.Field(typeof(Car), "timer"); bool flag2 = (bool)AccessTools.Field(typeof(Car), "raceStarted").GetValue(__instance); MethodInfo methodInfo = AccessTools.Method(typeof(Car), "ResetPosition", (Type[])null, (Type[])null); AccessTools.Method(typeof(Car), "FixedUpdate", (Type[])null, (Type[])null); float num = (float)fieldInfo2.GetValue(__instance); if (!customTrackLoader.customTracks[customTrackLoader.currentTrackId].isCity && flag2 && val.IsMine) { num += Time.deltaTime; ((Component)val4).gameObject.SetActive(true); if (num > 600f) { PhotonNetwork.SendAllOutgoingCommands(); PhotonNetwork.Disconnect(); } fieldInfo2.SetValue(__instance, num); } bool flag3 = (bool)fieldInfo.GetValue(__instance); if (flag && !flag3) { val5.text = string.Concat(str2: LanguageManager.Instance.currentLang["FINISHED!"], str0: val.Controller.NickName, str1: " "); ((Component)val5).gameObject.SetActive(true); ((Component)val4).gameObject.SetActive(false); fieldInfo.SetValue(__instance, true); } else if (!flag) { ((Component)val5).gameObject.SetActive(false); } ((GameObject)obj).SetActive(true); if (val.IsMine) { val3.localRotation = Quaternion.Euler(0f, 0f, 35f * Input.GetAxis("Horizontal") * -1f); if (!flag2) { val2.SetActive(false); ((Component)__instance).GetComponent().velocity = Vector3.zero; AccessTools.Field(typeof(Car), "arcadeVehicleController").SetValue(__instance, LayerMask.GetMask(new string[1] { "" })); } else { AccessTools.Field(typeof(Car), "arcadeVehicleController").SetValue(__instance, LayerMask.GetMask(new string[1] { "drivable" })); val2.SetActive(true); } Vector3 position = ((Component)__instance).transform.position; if (position.x < -2000f || position.x > 2000f || position.y < -10f || position.y > 100f || position.z < -2000f || position.z > 2000f) { methodInfo.Invoke(__instance, null); } } } } [HarmonyPatch(typeof(Compass), "Update")] public class Patch_CompassUpdate { private static bool Prefix(Compass __instance) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (!customTrackLoader.customTracks[customTrackLoader.currentTrackId].isCity) { return true; } Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name != Path.GetFileNameWithoutExtension(customTrackLoader.customTracks[customTrackLoader.currentTrackId].mapPath)) { return true; } CustomUpdate(__instance); return false; } private static void CustomUpdate(Compass __instance) { //IL_0159: 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_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) object? value = AccessTools.Field(typeof(Compass), "pv").GetValue(__instance); PhotonView val = (PhotonView)((value is PhotonView) ? value : null); object? value2 = AccessTools.Field(typeof(Compass), "compass").GetValue(__instance); GameObject val2 = (GameObject)((value2 is GameObject) ? value2 : null); object? value3 = AccessTools.Field(typeof(Compass), "compassBG").GetValue(__instance); GameObject val3 = (GameObject)((value3 is GameObject) ? value3 : null); object? value4 = AccessTools.Field(typeof(Compass), "arrow").GetValue(__instance); Transform val4 = (Transform)((value4 is Transform) ? value4 : null); object? value5 = AccessTools.Field(typeof(Compass), "compassImage").GetValue(__instance); RawImage val5 = (RawImage)((value5 is RawImage) ? value5 : null); List list = AccessTools.Field(typeof(Compass), "questMarkers").GetValue(__instance) as List; float num = (float)AccessTools.Field(typeof(Compass), "maxDistance").GetValue(__instance); MethodInfo methodInfo = AccessTools.Method(typeof(Compass), "GameStart", (Type[])null, (Type[])null); if (customTrackLoader.customTracks[customTrackLoader.currentTrackId].isCity) { if (!val2.activeSelf && val.IsMine) { val2.SetActive(true); val3.SetActive(true); ((Component)val4).gameObject.SetActive(true); methodInfo.Invoke(__instance, null); } if (!val.IsMine) { return; } val5.uvRect = new Rect(((Component)__instance).transform.localEulerAngles.y / 360f, 0f, 1f, 1f); float num2 = float.PositiveInfinity; { foreach (QuestMarker item in list) { ((Graphic)item.image).rectTransform.anchoredPosition = (Vector2)(((??)(AccessTools.Method(typeof(Compass), "GetPosOnCompass", (Type[])null, (Type[])null).Invoke(__instance, new object[1] { item }) as Vector2?)) ?? Vector2.zero); float num3 = Vector2.Distance(new Vector2(((Component)__instance).transform.position.x, ((Component)__instance).transform.position.z), item.position); float num4 = 0f; if (num3 < num2) { num2 = num3; val4.LookAt(((Component)item).transform.position); } if (num3 < num) { num4 = 1f - num3 / num; } ((Transform)((Graphic)item.image).rectTransform).localScale = Vector3.one * num4; } return; } } ((Component)val4).gameObject.SetActive(false); val2.SetActive(false); val3.SetActive(false); } }