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.3.0
Joyrider_IL2CPP.dll
Decompiled 2 days 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.NPCs.Responses; 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.2", "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+d21c1fef0aeb7afe2bb915ff4eebfedbe985077e")] [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.2"; public const string DownloadLink = null; } public class Joyrider : MelonMod { [HarmonyPatch(typeof(LandVehicle), "EnterVehicle")] public static class Patch_EnterVehicle { public static void Postfix(LandVehicle __instance) { if (__instance.isParked) { __instance.ExitPark(false); } MelonCoroutines.Start(HandleEnter(__instance)); } } [CompilerGenerated] private sealed class <HandleEnter>d__10 : 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; private Crime <crime>5__7; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <HandleEnter>d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <police>5__2 = null; <crime>5__3 = null; <npc>5__4 = null; <crime>5__7 = null; <>1__state = -2; } private bool MoveNext() { //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Expected O, but got Unknown //IL_020f: 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_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022a: 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_0174: Expected O, but got Unknown NPC obj; switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (((Il2CppArrayBase<NPC>)(object)__instance.OccupantNPCs).Length <= 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_039f; 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_02f6; } IL_02f6: obj = <npc>5__4; if (obj != null) { NPCResponses responses = obj.Responses; if (responses != null) { responses.PlayerFailedPickpocket(Player.Local); } } <crime>5__7 = new Crime(); AccessTools.Property(typeof(Crime), "CrimeName")?.SetValue(<crime>5__7, "Joyriding"); Player.Local.CrimeData.AddCrime(<crime>5__7, 1); Player.Local.CrimeData.SetPursuitLevel((EPursuitLevel)1); <crime>5__7 = null; goto IL_037e; IL_037e: <npc>5__4 = null; goto IL_0385; IL_0385: <police>5__2 = null; goto IL_038d; IL_039f: if (<i>5__1 >= ((Il2CppArrayBase<NPC>)(object)__instance.OccupantNPCs).Length) { break; } if ((Object)(object)((Il2CppArrayBase<NPC>)(object)__instance.OccupantNPCs)[<i>5__1] == (Object)null) { goto IL_038d; } <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; <crime>5__3 = new Crime(); AccessTools.Property(typeof(Crime), "CrimeName")?.SetValue(<crime>5__3, "Joyriding"); Player.Local.CrimeData.AddCrime(<crime>5__3, 1); Player.Local.CrimeData.SetPursuitLevel((EPursuitLevel)2); <crime>5__3 = null; goto IL_0385; } <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; __instance.CurrentParkData = null; if ((Object)(object)<npc>5__4.Behaviour.activeBehaviour != (Object)null) { <npc>5__4.Behaviour.activeBehaviour.Disable(); } <npc>5__4.ExitVehicle(); if (<i>5__1 == 0) { __instance.ExitPark(false); <>2__current = null; <>1__state = 1; return true; } goto IL_02f6; } goto IL_037e; IL_038d: <i>5__1++; goto IL_039f; } 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(); } } private const float ProximityRadius = 12f; private const float VehicleRefreshIntervalSeconds = 20f; private const float SceneLoadGraceSeconds = 7f; private static LandVehicle[] _vehicleCache = Array.Empty<LandVehicle>(); private static float _nextVehicleRefreshTime; private static readonly Dictionary<int, LandVehicle> _tempOwnedVehicles = new Dictionary<int, LandVehicle>(); private static readonly MethodInfo _setOwnerMethod = AccessTools.Method(typeof(LandVehicle), "SetOwner", new Type[1] { typeof(NetworkConnection) }, (Type[])null); private static NetworkConnection GetLocalConnection() { if ((Object)(object)Player.Local == (Object)null) { return null; } if (Player.Local.Connection != (NetworkConnection)null) { return Player.Local.Connection; } PropertyInfo propertyInfo = AccessTools.Property(((object)Player.Local).GetType(), "Owner"); if (propertyInfo == null) { return null; } object? value = propertyInfo.GetValue(Player.Local, null); return (NetworkConnection)((value is NetworkConnection) ? value : null); } private static void TrySetOwner(LandVehicle vehicle, NetworkConnection connection) { if (!((Object)(object)vehicle == (Object)null) && !(connection == (NetworkConnection)null) && !(_setOwnerMethod == null)) { _setOwnerMethod.Invoke(vehicle, new object[1] { connection }); } } [IteratorStateMachine(typeof(<HandleEnter>d__10))] private static IEnumerator HandleEnter(LandVehicle __instance) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <HandleEnter>d__10(0) { __instance = __instance }; } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { _vehicleCache = Array.Empty<LandVehicle>(); _tempOwnedVehicles.Clear(); _nextVehicleRefreshTime = Time.time + 7f; } public override void OnUpdate() { try { UpdateTemporaryVehicleOwnership(); } catch (Exception ex) { MelonLogger.Error("Error updating temporary vehicle ownership: " + ex.Message); } } private static void UpdateTemporaryVehicleOwnership() { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.Local == (Object)null || (Object)(object)((Component)Player.Local).transform == (Object)null) { return; } NetworkConnection localConnection = GetLocalConnection(); if (localConnection == (NetworkConnection)null) { return; } if (Time.time >= _nextVehicleRefreshTime) { _vehicleCache = Il2CppArrayBase<LandVehicle>.op_Implicit(Object.FindObjectsOfType<LandVehicle>()); _nextVehicleRefreshTime = Time.time + 20f; } Vector3 position = ((Component)Player.Local).transform.position; float num = 144f; for (int i = 0; i < _vehicleCache.Length; i++) { LandVehicle val = _vehicleCache[i]; if ((Object)(object)val == (Object)null) { continue; } int instanceID = ((Object)val).GetInstanceID(); bool flag = _tempOwnedVehicles.ContainsKey(instanceID); if (!flag && val.IsPlayerOwned) { continue; } Vector3 val2 = ((Component)val).transform.position - position; if (((Vector3)(ref val2)).sqrMagnitude <= num) { if (!val.IsPlayerOwned) { TrySetOwner(val, localConnection); val.SetIsPlayerOwned(localConnection, true); } if (!flag) { _tempOwnedVehicles[instanceID] = val; } } else if (flag) { if (val.IsPlayerOwned) { val.SetIsPlayerOwned(localConnection, false); } _tempOwnedVehicles.Remove(instanceID); } } if (_tempOwnedVehicles.Count <= 0) { return; } List<int> list = null; foreach (KeyValuePair<int, LandVehicle> tempOwnedVehicle in _tempOwnedVehicles) { if (!((Object)(object)tempOwnedVehicle.Value != (Object)null)) { if (list == null) { list = new List<int>(); } list.Add(tempOwnedVehicle.Key); } } if (list != null) { for (int j = 0; j < list.Count; j++) { _tempOwnedVehicles.Remove(list[j]); } } } }
Joyrider_Mono.dll
Decompiled 2 days 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.Law; using ScheduleOne.NPCs; using ScheduleOne.NPCs.Responses; 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.2", "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+d21c1fef0aeb7afe2bb915ff4eebfedbe985077e")] [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.2"; public const string DownloadLink = null; } public class Joyrider : MelonMod { [HarmonyPatch(typeof(LandVehicle), "EnterVehicle")] public static class Patch_EnterVehicle { public static void Postfix(LandVehicle __instance) { if (__instance.isParked) { __instance.ExitPark(false); } MelonCoroutines.Start(HandleEnter(__instance)); } } [CompilerGenerated] private sealed class <HandleEnter>d__10 : 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; private Crime <crime>5__7; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <HandleEnter>d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <police>5__2 = null; <crime>5__3 = null; <npc>5__4 = null; <crime>5__7 = null; <>1__state = -2; } private bool MoveNext() { //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Expected O, but got Unknown //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Expected O, but got Unknown NPC obj; 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_0384; 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_02db; } IL_02db: obj = <npc>5__4; if (obj != null) { NPCResponses responses = obj.Responses; if (responses != null) { responses.PlayerFailedPickpocket(Player.Local); } } <crime>5__7 = new Crime(); AccessTools.Property(typeof(Crime), "CrimeName")?.SetValue(<crime>5__7, "Joyriding"); Player.Local.CrimeData.AddCrime(<crime>5__7, 1); Player.Local.CrimeData.SetPursuitLevel((EPursuitLevel)1); <crime>5__7 = null; goto IL_0363; IL_0363: <npc>5__4 = null; goto IL_036a; IL_036a: <police>5__2 = null; goto IL_0372; IL_0384: if (<i>5__1 >= __instance.OccupantNPCs.Length) { break; } if ((Object)(object)__instance.OccupantNPCs[<i>5__1] == (Object)null) { goto IL_0372; } <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; <crime>5__3 = new Crime(); AccessTools.Property(typeof(Crime), "CrimeName")?.SetValue(<crime>5__3, "Joyriding"); Player.Local.CrimeData.AddCrime(<crime>5__3, 1); Player.Local.CrimeData.SetPursuitLevel((EPursuitLevel)2); <crime>5__3 = null; goto IL_036a; } <npc>5__4 = __instance.OccupantNPCs[<i>5__1]; if (<npc>5__4 != null) { <vehPos>5__5 = ((Component)__instance).transform.position; <vehRot>5__6 = ((Component)__instance).transform.rotation; __instance.CurrentParkData = null; if ((Object)(object)<npc>5__4.Behaviour.activeBehaviour != (Object)null) { <npc>5__4.Behaviour.activeBehaviour.Disable(); } <npc>5__4.ExitVehicle(); if (<i>5__1 == 0) { __instance.ExitPark(false); <>2__current = null; <>1__state = 1; return true; } goto IL_02db; } goto IL_0363; IL_0372: <i>5__1++; goto IL_0384; } 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(); } } private const float ProximityRadius = 12f; private const float VehicleRefreshIntervalSeconds = 20f; private const float SceneLoadGraceSeconds = 7f; private static LandVehicle[] _vehicleCache = Array.Empty<LandVehicle>(); private static float _nextVehicleRefreshTime; private static readonly Dictionary<int, LandVehicle> _tempOwnedVehicles = new Dictionary<int, LandVehicle>(); private static readonly MethodInfo _setOwnerMethod = AccessTools.Method(typeof(LandVehicle), "SetOwner", new Type[1] { typeof(NetworkConnection) }, (Type[])null); private static NetworkConnection GetLocalConnection() { if ((Object)(object)Player.Local == (Object)null) { return null; } if (Player.Local.Connection != (NetworkConnection)null) { return Player.Local.Connection; } PropertyInfo propertyInfo = AccessTools.Property(((object)Player.Local).GetType(), "Owner"); if (propertyInfo == null) { return null; } object? value = propertyInfo.GetValue(Player.Local, null); return (NetworkConnection)((value is NetworkConnection) ? value : null); } private static void TrySetOwner(LandVehicle vehicle, NetworkConnection connection) { if (!((Object)(object)vehicle == (Object)null) && !(connection == (NetworkConnection)null) && !(_setOwnerMethod == null)) { _setOwnerMethod.Invoke(vehicle, new object[1] { connection }); } } [IteratorStateMachine(typeof(<HandleEnter>d__10))] private static IEnumerator HandleEnter(LandVehicle __instance) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <HandleEnter>d__10(0) { __instance = __instance }; } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { _vehicleCache = Array.Empty<LandVehicle>(); _tempOwnedVehicles.Clear(); _nextVehicleRefreshTime = Time.time + 7f; } public override void OnUpdate() { try { UpdateTemporaryVehicleOwnership(); } catch (Exception ex) { MelonLogger.Error("Error updating temporary vehicle ownership: " + ex.Message); } } private static void UpdateTemporaryVehicleOwnership() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.Local == (Object)null || (Object)(object)((Component)Player.Local).transform == (Object)null) { return; } NetworkConnection localConnection = GetLocalConnection(); if (localConnection == (NetworkConnection)null) { return; } if (Time.time >= _nextVehicleRefreshTime) { _vehicleCache = Object.FindObjectsOfType<LandVehicle>(); _nextVehicleRefreshTime = Time.time + 20f; } Vector3 position = ((Component)Player.Local).transform.position; float num = 144f; for (int i = 0; i < _vehicleCache.Length; i++) { LandVehicle val = _vehicleCache[i]; if ((Object)(object)val == (Object)null) { continue; } int instanceID = ((Object)val).GetInstanceID(); bool flag = _tempOwnedVehicles.ContainsKey(instanceID); if (!flag && val.IsPlayerOwned) { continue; } Vector3 val2 = ((Component)val).transform.position - position; if (((Vector3)(ref val2)).sqrMagnitude <= num) { if (!val.IsPlayerOwned) { TrySetOwner(val, localConnection); val.SetIsPlayerOwned(localConnection, true); } if (!flag) { _tempOwnedVehicles[instanceID] = val; } } else if (flag) { if (val.IsPlayerOwned) { val.SetIsPlayerOwned(localConnection, false); } _tempOwnedVehicles.Remove(instanceID); } } if (_tempOwnedVehicles.Count <= 0) { return; } List<int> list = null; foreach (KeyValuePair<int, LandVehicle> tempOwnedVehicle in _tempOwnedVehicles) { if (!((Object)(object)tempOwnedVehicle.Value != (Object)null)) { if (list == null) { list = new List<int>(); } list.Add(tempOwnedVehicle.Key); } } if (list != null) { for (int j = 0; j < list.Count; j++) { _tempOwnedVehicles.Remove(list[j]); } } } }