Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of Joyrider v1.0.1
Joyrider_IL2CPP.dll
Decompiled 2 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using HarmonyLib; using Il2CppFishNet.Connection; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppScheduleOne.Law; using Il2CppScheduleOne.NPCs; using Il2CppScheduleOne.PlayerScripts; using Il2CppScheduleOne.Vehicles; using Joyrider; using MelonLoader; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(global::Joyrider.Joyrider), "Joyrider", "1.0", "Jumble", null)] [assembly: MelonColor] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("Joyrider_IL2CPP")] [assembly: AssemblyConfiguration("Debug_IL2CPP")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Joyrider_IL2CPP")] [assembly: AssemblyTitle("Joyrider_IL2CPP")] [assembly: AssemblyVersion("1.0.0.0")] namespace Joyrider; public static class BuildInfo { public const string Name = "Joyrider"; public const string Description = "Steal and carjack vehicles from NPCs and police."; public const string Author = "Jumble"; public const string Company = null; public const string Version = "1.0"; public const string DownloadLink = null; } public class Joyrider : MelonMod { [HarmonyPatch(typeof(Object), "Instantiate", new Type[] { typeof(Object) })] private class InstantiatePatch { private static void Postfix(Object __result) { LandVehicle val = (LandVehicle)(object)((__result is LandVehicle) ? __result : null); if (val != null && !val.IsPlayerOwned) { val.SetIsPlayerOwned(Player.Local.Connection, true); } } } [HarmonyPatch(typeof(LandVehicle), "EnterVehicle")] public static class Patch_EnterVehicle { public static void Postfix(LandVehicle __instance) { if (__instance.isStatic || __instance.isParked) { __instance.ExitPark(false); } MelonCoroutines.Start(HandleEnter(__instance)); } } [HarmonyPatch(typeof(NPC), "EnterVehicle")] public static class Patch_NPCEnterVehicle { public static void Postfix(NetworkConnection connection, LandVehicle veh) { if (((Il2CppArrayBase<NPC>)(object)veh.OccupantNPCs).Count > 0 && (Object)(object)((Il2CppArrayBase<NPC>)(object)veh.OccupantNPCs)[0] != (Object)null && (veh.OccupantPlayers.Count == 0 || (Object)(object)veh.OccupantPlayers[0] == (Object)null)) { veh.SetIsPlayerOwned(Player.Local.Connection, true); } } } [CompilerGenerated] private sealed class <FindVehicles>d__5 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private LandVehicle[] <vehicles>5__1; private int <i>5__2; private Exception <er>5__3; private Exception <er>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FindVehicles>d__5(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <vehicles>5__1 = null; <er>5__3 = null; <er>5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(7f); <>1__state = 1; return true; case 1: <>1__state = -1; try { <vehicles>5__1 = Il2CppArrayBase<LandVehicle>.op_Implicit(Object.FindObjectsOfType<LandVehicle>()); <i>5__2 = 0; while (<i>5__2 < <vehicles>5__1.Length) { try { if ((Object)(object)<vehicles>5__1[<i>5__2] != (Object)null && !<vehicles>5__1[<i>5__2].IsPlayerOwned && ((Il2CppArrayBase<NPC>)(object)<vehicles>5__1[<i>5__2].OccupantNPCs).Count > 0 && (Object)(object)((Il2CppArrayBase<NPC>)(object)<vehicles>5__1[<i>5__2].OccupantNPCs)[0] != (Object)null) { <vehicles>5__1[<i>5__2].SetIsPlayerOwned(Player.Local.Connection, true); } } catch (Exception ex) { <er>5__3 = ex; MelonLogger.Error("Error accessing LandVehicles: " + <er>5__3.Message); MelonLogger.Error(<er>5__3.StackTrace); } <i>5__2++; } return false; } catch (Exception ex) { <er>5__4 = ex; MelonLogger.Error("Error finding LandVehicles: " + <er>5__4.Message); MelonLogger.Error(<er>5__4.StackTrace); return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <HandleEnter>d__2 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public LandVehicle __instance; private int <i>5__1; private NPC <police>5__2; private Crime <crime>5__3; private NPC <npc>5__4; private Vector3 <vehPos>5__5; private Quaternion <vehRot>5__6; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <HandleEnter>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <police>5__2 = null; <crime>5__3 = null; <npc>5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_02d1: 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_031d: 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_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0217: 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_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_0190: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (((Il2CppArrayBase<NPC>)(object)__instance.OccupantNPCs).Count <= 0 || !((Object)(object)((Il2CppArrayBase<NPC>)(object)__instance.OccupantNPCs)[0] != (Object)null) || __instance.OccupantPlayers.Count <= 0 || !((Object)(object)__instance.OccupantPlayers[0] != (Object)null)) { break; } <i>5__1 = 0; goto IL_0354; case 1: <>1__state = -1; ((Component)__instance).transform.position = <vehPos>5__5; ((Component)__instance).transform.rotation = <vehRot>5__6; <>2__current = null; <>1__state = 2; return true; case 2: { <>1__state = -1; goto IL_030b; } IL_030b: ((Component)<npc>5__4).transform.position = __instance.GetClosestExitPoint(<vehPos>5__5).position; goto IL_0333; IL_0333: <npc>5__4 = null; goto IL_033a; IL_0342: <i>5__1++; goto IL_0354; IL_0354: if (<i>5__1 >= ((Il2CppArrayBase<NPC>)(object)__instance.OccupantNPCs).Count) { break; } if ((Object)(object)((Il2CppArrayBase<NPC>)(object)__instance.OccupantNPCs)[<i>5__1] == (Object)null) { goto IL_0342; } <police>5__2 = ((Il2CppArrayBase<NPC>)(object)__instance.OccupantNPCs)[<i>5__1]; if (<police>5__2 != null && ((Object)((Il2CppArrayBase<NPC>)(object)__instance.OccupantNPCs)[<i>5__1]).name.Contains("Officer")) { if ((Object)(object)<police>5__2.behaviour.activeBehaviour != (Object)null) { <police>5__2.behaviour.activeBehaviour.Disable(); } <police>5__2.ExitVehicle(); <police>5__2.Aggression = 1f; if (<i>5__1 == 0) { <crime>5__3 = new Crime { CrimeName = "Joyriding" }; Player.Local.CrimeData.AddCrime(<crime>5__3, 1); Player.Local.CrimeData.SetPursuitLevel((EPursuitLevel)2); <crime>5__3 = null; } goto IL_033a; } <npc>5__4 = ((Il2CppArrayBase<NPC>)(object)__instance.OccupantNPCs)[<i>5__1]; if (<npc>5__4 != null) { <vehPos>5__5 = ((Component)__instance).transform.position; <vehRot>5__6 = ((Component)__instance).transform.rotation; if ((Object)(object)<npc>5__4.behaviour.activeBehaviour != (Object)null) { <npc>5__4.behaviour.activeBehaviour.Disable(); } __instance.CurrentParkingSpot = null; __instance.CurrentParkData = null; <npc>5__4.ExitVehicle(); <npc>5__4.responses.PlayerFailedPickpocket(Player.Local); if (<i>5__1 == 0) { __instance.ExitPark(false); <>2__current = null; <>1__state = 1; return true; } goto IL_030b; } goto IL_0333; IL_033a: <police>5__2 = null; goto IL_0342; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [IteratorStateMachine(typeof(<HandleEnter>d__2))] private static IEnumerator HandleEnter(LandVehicle __instance) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <HandleEnter>d__2(0) { __instance = __instance }; } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { MelonCoroutines.Start(FindVehicles()); } [IteratorStateMachine(typeof(<FindVehicles>d__5))] private static IEnumerator FindVehicles() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FindVehicles>d__5(0); } }
Joyrider_Mono.dll
Decompiled 2 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using FishNet.Connection; using HarmonyLib; using Joyrider; using MelonLoader; using ScheduleOne.NPCs; using ScheduleOne.PlayerScripts; using ScheduleOne.Vehicles; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(global::Joyrider.Joyrider), "Joyrider", "1.0", "Jumble", null)] [assembly: MelonColor] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("Joyrider_Mono")] [assembly: AssemblyConfiguration("Debug_Mono")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Joyrider_Mono")] [assembly: AssemblyTitle("Joyrider_Mono")] [assembly: AssemblyVersion("1.0.0.0")] namespace Joyrider; public static class BuildInfo { public const string Name = "Joyrider"; public const string Description = "Steal and carjack vehicles from NPCs and police."; public const string Author = "Jumble"; public const string Company = null; public const string Version = "1.0"; public const string DownloadLink = null; } public class Joyrider : MelonMod { [HarmonyPatch(typeof(Object), "Instantiate", new Type[] { typeof(Object) })] private class InstantiatePatch { private static void Postfix(Object __result) { LandVehicle val = (LandVehicle)(object)((__result is LandVehicle) ? __result : null); if (val != null && !val.IsPlayerOwned) { val.SetIsPlayerOwned(Player.Local.Connection, true); } } } [HarmonyPatch(typeof(LandVehicle), "EnterVehicle")] public static class Patch_EnterVehicle { public static void Postfix(LandVehicle __instance) { if (__instance.isStatic || __instance.isParked) { __instance.ExitPark(false); } MelonCoroutines.Start(HandleEnter(__instance)); } } [HarmonyPatch(typeof(NPC), "EnterVehicle")] public static class Patch_NPCEnterVehicle { public static void Postfix(NetworkConnection connection, LandVehicle veh) { if (veh.OccupantNPCs.Length != 0 && (Object)(object)veh.OccupantNPCs[0] != (Object)null && (veh.OccupantPlayers.Count == 0 || (Object)(object)veh.OccupantPlayers[0] == (Object)null)) { veh.SetIsPlayerOwned(Player.Local.Connection, true); } } } [CompilerGenerated] private sealed class <FindVehicles>d__5 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private LandVehicle[] <vehicles>5__1; private int <i>5__2; private Exception <er>5__3; private Exception <er>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FindVehicles>d__5(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <vehicles>5__1 = null; <er>5__3 = null; <er>5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(7f); <>1__state = 1; return true; case 1: <>1__state = -1; try { <vehicles>5__1 = Object.FindObjectsOfType<LandVehicle>(); <i>5__2 = 0; while (<i>5__2 < <vehicles>5__1.Length) { try { if ((Object)(object)<vehicles>5__1[<i>5__2] != (Object)null && !<vehicles>5__1[<i>5__2].IsPlayerOwned && <vehicles>5__1[<i>5__2].OccupantNPCs.Length != 0 && (Object)(object)<vehicles>5__1[<i>5__2].OccupantNPCs[0] != (Object)null) { <vehicles>5__1[<i>5__2].SetIsPlayerOwned(Player.Local.Connection, true); } } catch (Exception ex) { <er>5__3 = ex; MelonLogger.Error("Error accessing LandVehicles: " + <er>5__3.Message); MelonLogger.Error(<er>5__3.StackTrace); } <i>5__2++; } return false; } catch (Exception ex) { <er>5__4 = ex; MelonLogger.Error("Error finding LandVehicles: " + <er>5__4.Message); MelonLogger.Error(<er>5__4.StackTrace); return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <HandleEnter>d__2 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public LandVehicle __instance; private int <i>5__1; private NPC <police>5__2; private NPC <npc>5__3; private Vector3 <vehPos>5__4; private Quaternion <vehRot>5__5; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <HandleEnter>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <police>5__2 = null; <npc>5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_01af: 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_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (__instance.OccupantNPCs.Length == 0 || !((Object)(object)__instance.OccupantNPCs[0] != (Object)null) || __instance.OccupantPlayers.Count <= 0 || !((Object)(object)__instance.OccupantPlayers[0] != (Object)null)) { break; } <i>5__1 = 0; goto IL_02ef; case 1: <>1__state = -1; ((Component)__instance).transform.position = <vehPos>5__4; ((Component)__instance).transform.rotation = <vehRot>5__5; <>2__current = null; <>1__state = 2; return true; case 2: { <>1__state = -1; goto IL_02ab; } IL_02ab: ((Component)<npc>5__3).transform.position = __instance.GetExitPoint(0).position; goto IL_02ce; IL_02ce: <npc>5__3 = null; goto IL_02d5; IL_02dd: <i>5__1++; goto IL_02ef; IL_02ef: if (<i>5__1 >= __instance.OccupantNPCs.Length) { break; } if ((Object)(object)__instance.OccupantNPCs[<i>5__1] == (Object)null) { goto IL_02dd; } <police>5__2 = __instance.OccupantNPCs[<i>5__1]; if (<police>5__2 != null && ((Object)__instance.OccupantNPCs[<i>5__1]).name.Contains("Officer")) { if ((Object)(object)<police>5__2.behaviour.activeBehaviour != (Object)null) { <police>5__2.behaviour.activeBehaviour.Disable(); } <police>5__2.ExitVehicle(); <police>5__2.Aggression = 1f; if (<i>5__1 == 0) { Player.Local.CrimeData.SetPursuitLevel((EPursuitLevel)2); } goto IL_02d5; } <npc>5__3 = __instance.OccupantNPCs[<i>5__1]; if (<npc>5__3 != null) { <vehPos>5__4 = ((Component)__instance).transform.position; <vehRot>5__5 = ((Component)__instance).transform.rotation; if ((Object)(object)<npc>5__3.behaviour.activeBehaviour != (Object)null) { <npc>5__3.behaviour.activeBehaviour.Disable(); } __instance.CurrentParkData = null; <npc>5__3.ExitVehicle(); <npc>5__3.responses.PlayerFailedPickpocket(Player.Local); if (<i>5__1 == 0) { __instance.ExitPark(false); <>2__current = null; <>1__state = 1; return true; } goto IL_02ab; } goto IL_02ce; IL_02d5: <police>5__2 = null; goto IL_02dd; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [IteratorStateMachine(typeof(<HandleEnter>d__2))] private static IEnumerator HandleEnter(LandVehicle __instance) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <HandleEnter>d__2(0) { __instance = __instance }; } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { MelonCoroutines.Start(FindVehicles()); } [IteratorStateMachine(typeof(<FindVehicles>d__5))] private static IEnumerator FindVehicles() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FindVehicles>d__5(0); } }