using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using CarJack.AllCityNetwork; using CarJack.BombRushCamera; using CarJack.Common; using CarJack.Common.WhipRemix; using CommonAPI; using CommonAPI.Phone; using HarmonyLib; using Microsoft.CodeAnalysis; using Reptile; using Reptile.Phone; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("CarJack.Plugin")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("CarJack Plugin")] [assembly: AssemblyFileVersion("1.9.2.0")] [assembly: AssemblyInformationalVersion("1.9.2+378538fa9503b5513da6dbe7c4c8fe62d1c5de3d")] [assembly: AssemblyProduct("CarJack.Plugin")] [assembly: AssemblyTitle("CarJack.Plugin")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.9.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace CarJack.Plugin { public class CarDebugController : MonoBehaviour { public static CarDebugController Create() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown GameObject val = new GameObject("Car Debug Controller"); Object.DontDestroyOnLoad((Object)val); return val.AddComponent(); } private void Update() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(CarController.Config.ReloadBundlesKey)) { Core.Instance.BaseModule.StageManager.ExitCurrentStage(Utility.GetCurrentStage(), (Stage)(-1)); CarAssets.Instance.UnloadAllBundles(); CarAssets.Instance.LoadBundles(); CarDatabase.Initialize(); RecolorManager.UnloadRecolors(); RecolorManager.LoadRecolors(); } } } public class CarJackApp : CustomApp { private static Sprite Icon; private SimplePhoneButton _doorButton; private SimplePhoneButton _muteButton; private SimplePhoneButton _autoRecoverButton; private SimplePhoneButton _whipRemixButton; public static void Initialize(string location) { Icon = TextureUtility.LoadSprite(Path.Combine(location, "Phone-App-Icon.png")); PhoneAPI.RegisterApp("carjack", Icon); PhoneAPI.RegisterApp("spawn car", Icon); PhoneAPI.RegisterApp("choose bundle", Icon); PhoneAPI.RegisterApp("whipremix", Icon); } public override void OnAppInit() { ((CustomApp)this).OnAppInit(); ((CustomApp)this).CreateTitleBar("CarJack", Icon, 80f); base.ScrollView = PhoneScrollView.Create((CustomApp)(object)this, 275f, 1600f); SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Spawn Car"); ((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate { CarController instance = CarController.Instance; if ((Object)(object)instance != (Object)null) { DrivableCar currentCar = instance.CurrentCar; if ((Object)(object)currentCar != (Object)null && !currentCar.Driving) { return; } } if (CarAssets.Instance.Bundles.Count == 1) { ((App)this).MyPhone.GetAppInstance().SetBundleFilter(); ((App)this).MyPhone.OpenApp(typeof(SpawnCarApp)); } else { ((App)this).MyPhone.OpenApp(typeof(SpawnCarByBundleApp)); } }); base.ScrollView.AddButton((PhoneButton)(object)val); _doorButton = PhoneUIUtility.CreateSimpleButton("Doors: Unlocked"); SimplePhoneButton doorButton = _doorButton; ((PhoneButton)doorButton).OnConfirm = (Action)Delegate.Combine(((PhoneButton)doorButton).OnConfirm, (Action)delegate { ToggleDoorsLocked(); }); base.ScrollView.AddButton((PhoneButton)(object)_doorButton); _muteButton = PhoneUIUtility.CreateSimpleButton("Mute Players: OFF"); SimplePhoneButton muteButton = _muteButton; ((PhoneButton)muteButton).OnConfirm = (Action)Delegate.Combine(((PhoneButton)muteButton).OnConfirm, (Action)delegate { ToggleMutePlayers(); }); base.ScrollView.AddButton((PhoneButton)(object)_muteButton); _autoRecoverButton = PhoneUIUtility.CreateSimpleButton("Auto-Recovery: ON"); SimplePhoneButton autoRecoverButton = _autoRecoverButton; ((PhoneButton)autoRecoverButton).OnConfirm = (Action)Delegate.Combine(((PhoneButton)autoRecoverButton).OnConfirm, (Action)delegate { ToggleAutoRecover(); }); base.ScrollView.AddButton((PhoneButton)(object)_autoRecoverButton); } private void UpdateWhipRemix() { if (RecolorApp.AvailableForCurrentCar() && (Object)(object)_whipRemixButton == (Object)null) { CreateWhipRemixButton(); } else if (!RecolorApp.AvailableForCurrentCar() && (Object)(object)_whipRemixButton != (Object)null) { base.ScrollView.RemoveButton((PhoneButton)(object)_whipRemixButton); _whipRemixButton = null; } } private void CreateWhipRemixButton() { _whipRemixButton = PhoneUIUtility.CreateSimpleButton("WhipRemix"); SimplePhoneButton whipRemixButton = _whipRemixButton; ((PhoneButton)whipRemixButton).OnConfirm = (Action)Delegate.Combine(((PhoneButton)whipRemixButton).OnConfirm, (Action)delegate { ((App)this).MyPhone.OpenApp(typeof(RecolorApp)); }); base.ScrollView.AddButton((PhoneButton)(object)_whipRemixButton); } public override void OnAppUpdate() { ((App)this).OnAppUpdate(); UpdateDoorsLockedLabel(); UpdateMutePlayersLabel(); UpdateAutoRecoverLabel(); UpdateWhipRemix(); } private void ToggleAutoRecover() { PlayerData.Instance.AutoRecover = !PlayerData.Instance.AutoRecover; UpdateAutoRecoverLabel(); PlayerData.Instance.Save(); } private void ToggleDoorsLocked() { PlayerData.Instance.DoorsLocked = !PlayerData.Instance.DoorsLocked; UpdateDoorsLockedLabel(); PlayerData.Instance.Save(); } private void ToggleMutePlayers() { PlayerData.Instance.MutePlayers = !PlayerData.Instance.MutePlayers; UpdateMutePlayersLabel(); PlayerData.Instance.Save(); } private void UpdateAutoRecoverLabel() { ((TMP_Text)_autoRecoverButton.Label).text = "Auto-Recovery: " + (PlayerData.Instance.AutoRecover ? "ON" : "OFF"); } private void UpdateMutePlayersLabel() { ((TMP_Text)_muteButton.Label).text = "Mute Players: " + (PlayerData.Instance.MutePlayers ? "ON" : "OFF"); } private void UpdateDoorsLockedLabel() { ((TMP_Text)_doorButton.Label).text = "Doors: " + (PlayerData.Instance.DoorsLocked ? "Locked" : "Unlocked"); } } [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] public class CarJackPluginAttribute : Attribute { } [BepInPlugin("CarJack.Plugin", "CarJack.Plugin", "1.9.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] internal class Plugin : BaseUnityPlugin { private static Type ForceLoadCarJackCommonAssembly = typeof(DrivableCar); private void Awake() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading CarJack.Plugin 1.9.2"); try { new Harmony("CarJack.Plugin").PatchAll(); string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); new CarAssets { MainBundlePath = Path.Combine(directoryName, "carjack"), AddonBundlePath = Paths.PluginPath, PluginDirectoryName = Path.GetFileName(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location)) }.LoadBundles(); new RecolorSaveData(); RecolorManager.Initialize(Paths.PluginPath); RecolorManager.LoadRecolors(); RecolorApp.Initialize(); CarController.Initialize((ICarConfig)(object)new PluginCarConfig(((BaseUnityPlugin)this).Config)); if (CarController.Config.DeveloperMode) { CarDebugController.Create(); } CarDatabase.Initialize(); CarJackApp.Initialize(directoryName); LoadCompatibilityPlugins(); new PlayerData().LoadOrCreate(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded CarJack.Plugin 1.9.2!"); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)string.Format("Failed to load {0} {1}!{2}{3}", "CarJack.Plugin", "1.9.2", Environment.NewLine, ex)); } } private void LoadCompatibilityPlugins() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) if (Chainloader.PluginInfos.ContainsKey("BombRushMP.Plugin")) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading CarJack All City Network Plugin!"); try { new Plugin(); } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"Failed to load CarJack All City Network Plugin!{Environment.NewLine}{arg}"); } } if (Chainloader.PluginInfos.ContainsKey("BombRushCamera")) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading CarJack BombRushCamera Plugin!"); try { new Plugin(); } catch (Exception arg2) { ((BaseUnityPlugin)this).Logger.LogError((object)$"Failed to load CarJack BombRushCamera Plugin!{Environment.NewLine}{arg2}"); } } } } public class PluginCarConfig : ICarConfig { private ConfigEntry _mouseCameraControlsOnController; private ConfigEntry _acnIntegration; private ConfigEntry _continuousCollisionDetection; private ConfigEntry _developerMode; private ConfigEntry _reloadBundlesKey; private ConfigEntry _chopperControlType; public ChopperControlTypes ChopperControlType { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _chopperControlType.Value; } set { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _chopperControlType.Value = value; } } public bool DeveloperMode { get { return _developerMode.Value; } set { _developerMode.Value = value; } } public KeyCode ReloadBundlesKey { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _reloadBundlesKey.Value; } set { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _reloadBundlesKey.Value = value; } } public bool AllCityNetworkIntegration { get { return _acnIntegration.Value; } set { _acnIntegration.Value = value; } } public bool ContinuousCollisionDetection { get { return _continuousCollisionDetection.Value; } set { _continuousCollisionDetection.Value = value; } } public bool MouseCameraControlsOnController { get { return _mouseCameraControlsOnController.Value; } set { _mouseCameraControlsOnController.Value = value; } } public PluginCarConfig(ConfigFile configFile) { _continuousCollisionDetection = configFile.Bind("General", "ContinuousCollisionDetection", true, "Prevents cars from going through geometry at high speeds."); _acnIntegration = configFile.Bind("General", "AllCityNetworkIntegration", true, "Synchronize cars in All City Network."); _developerMode = configFile.Bind("Development", "DeveloperMode", false, "Enables development features."); _reloadBundlesKey = configFile.Bind("Development", "ReloadBundlesKey", (KeyCode)289, "Key to reload all bundles when in developer mode."); _chopperControlType = configFile.Bind("Controls", "ChopperControlType", (ChopperControlTypes)0, "Control type for helicopters on controller.\r\nA: Left Stick to adjust pitch/roll, face buttons to adjust yaw.\r\nB: Left Stick to adjust pitch/yaw, face buttons to adjust roll."); _mouseCameraControlsOnController = configFile.Bind("Controls", "MouseCameraControlsOnController", true, "Makes controller camera controls equal to mouse ones."); } } public class RecolorApp : CustomApp { private const string NewRecolorFolder = "WhipRemix"; public override bool Available => false; public static void Initialize() { CarController.OnPlayerEnteredCar = (Action)Delegate.Combine(CarController.OnPlayerEnteredCar, new Action(OnEnterCar)); } private static void OnEnterCar() { Player currentPlayer = WorldHandler.instance.GetCurrentPlayer(); if ((Object)(object)currentPlayer == (Object)null) { return; } Phone phone = currentPlayer.phone; if (!((Object)(object)phone == (Object)null)) { RecolorApp appInstance = phone.GetAppInstance(); if (!((Object)(object)appInstance == (Object)null)) { appInstance.SetForCurrentCar(); } } } public static bool AvailableForCurrentCar() { CarController instance = CarController.Instance; if ((Object)(object)instance == (Object)null) { return false; } DrivableCar currentCar = instance.CurrentCar; if ((Object)(object)currentCar == (Object)null) { return false; } if (!currentCar.Driving) { return false; } if ((Object)(object)((Component)currentCar).GetComponent() == (Object)null) { return false; } return true; } public void SetForCurrentCar() { base.ScrollView.RemoveAllButtons(); base.ScrollView.ResetScroll(); base.ScrollView.CancelAnimation(); CarController instance = CarController.Instance; if ((Object)(object)instance == (Object)null) { return; } DrivableCar car = instance.CurrentCar; if ((Object)(object)car == (Object)null) { return; } SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Stock"); ((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate { ((Component)car).GetComponent().ApplyDefaultColor(); RecolorSaveData.Instance.SetRecolorForCar(car.InternalName, (string)null); Core.Instance.SaveManager.SaveCurrentSaveSlot(); }); base.ScrollView.AddButton((PhoneButton)(object)val); foreach (KeyValuePair recolor in RecolorManager.RecolorsByGUID) { if (!(recolor.Value.Properties.CarInternalName != car.InternalName)) { SimplePhoneButton val2 = PhoneUIUtility.CreateSimpleButton(recolor.Value.Properties.RecolorDisplayName); ((PhoneButton)val2).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val2).OnConfirm, (Action)delegate { ((Component)car).GetComponent().ApplyRecolor(recolor.Value); RecolorSaveData.Instance.SetRecolorForCar(car.InternalName, recolor.Value.Properties.RecolorGUID); Core.Instance.SaveManager.SaveCurrentSaveSlot(); }); base.ScrollView.AddButton((PhoneButton)(object)val2); } } SimplePhoneButton val3 = PhoneUIUtility.CreateSimpleButton("Create New Recolor"); ((PhoneButton)val3).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val3).OnConfirm, (Action)delegate { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown CarController instance2 = CarController.Instance; Recolor val4 = new Recolor(); val4.CreateDefault(((Component)instance2.CurrentCar).GetComponent()); string text = Path.Combine(RecolorManager.RecolorFolder, "WhipRemix"); if (!Directory.Exists(text)) { Directory.CreateDirectory(text); } string name = ((Object)CarDatabase.CarByInternalName[car.InternalName].Prefab).name; string uniquePath = GetUniquePath(Path.Combine(text, name + " Recolor.whipremix")); val4.Properties.RecolorDisplayName = Path.GetFileNameWithoutExtension(uniquePath); val4.Save(uniquePath); Core.Instance.UIManager.ShowNotification("New recolor ZIP saved to BepInEx/plugins/WhipRemix/" + val4.Properties.RecolorDisplayName + ".whipremix", Array.Empty()); }); base.ScrollView.AddButton((PhoneButton)(object)val3); } public override void OnAppInit() { ((CustomApp)this).OnAppInit(); ((CustomApp)this).CreateIconlessTitleBar("WhipRemix", 80f); base.ScrollView = PhoneScrollView.Create((CustomApp)(object)this, 275f, 1600f); } public override void OnAppUpdate() { ((App)this).OnAppUpdate(); if (!AvailableForCurrentCar()) { ((App)this).MyPhone.CloseCurrentApp(); } } private string GetUniquePath(string path) { if (!File.Exists(path)) { return path; } int i = 2; string extension = Path.GetExtension(path); string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(path); string directoryName; for (directoryName = Path.GetDirectoryName(path); File.Exists(Path.Combine(directoryName, $"{fileNameWithoutExtension} {i}{extension}")); i++) { } return Path.Combine(directoryName, $"{fileNameWithoutExtension} {i}{extension}"); } } public class SpawnCarApp : CustomApp { public override bool Available => false; public void SetBundleFilter(CarBundle bundle = null) { base.ScrollView.RemoveAllButtons(); base.ScrollView.ResetScroll(); base.ScrollView.CancelAnimation(); foreach (KeyValuePair item in CarDatabase.CarByInternalName) { if (bundle == null || item.Value.Bundle == bundle) { SimplePhoneButton val = CreateCarButton(item.Key); base.ScrollView.AddButton((PhoneButton)(object)val); } } } public override void OnAppInit() { ((CustomApp)this).OnAppInit(); ((CustomApp)this).CreateIconlessTitleBar("Spawn Car", 80f); base.ScrollView = PhoneScrollView.Create((CustomApp)(object)this, 275f, 1600f); } public override void OnAppUpdate() { ((App)this).OnAppUpdate(); CarController instance = CarController.Instance; if (!((Object)(object)instance == (Object)null)) { DrivableCar currentCar = instance.CurrentCar; if (!((Object)(object)currentCar == (Object)null) && !currentCar.Driving) { ((App)this).MyPhone.CloseCurrentApp(); } } } private SimplePhoneButton CreateCarButton(string carInternalName) { SimplePhoneButton obj = PhoneUIUtility.CreateSimpleButton(((Object)CarDatabase.CarByInternalName[carInternalName].Prefab).name); ((PhoneButton)obj).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj).OnConfirm, (Action)delegate { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) CarController.Instance.ExitCar(); ((App)this).MyPhone.ReturnToHome(); Player currentPlayer = WorldHandler.instance.GetCurrentPlayer(); GameObject obj2 = Object.Instantiate(CarDatabase.CarByInternalName[carInternalName].Prefab); obj2.transform.position = ((Component)currentPlayer).transform.position; obj2.transform.rotation = ((Component)currentPlayer).transform.rotation; DrivableCar component = obj2.GetComponent(); component.Initialize(); component.DoorsLocked = PlayerData.Instance.DoorsLocked; RecolorableCar component2 = ((Component)component).GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.ApplySavedRecolor(); } CarController.Instance.EnterCar(component); }); return obj; } } public class SpawnCarByBundleApp : CustomApp { public override bool Available => false; public override void OnAppInit() { ((CustomApp)this).OnAppInit(); ((CustomApp)this).CreateIconlessTitleBar("Choose Bundle", 80f); base.ScrollView = PhoneScrollView.Create((CustomApp)(object)this, 275f, 1600f); base.ScrollView.RemoveAllButtons(); base.ScrollView.ResetScroll(); base.ScrollView.CancelAnimation(); foreach (CarBundle bundle in CarAssets.Instance.Bundles) { SimplePhoneButton val = CreateBundleButton(bundle); base.ScrollView.AddButton((PhoneButton)(object)val); } } public override void OnAppUpdate() { ((App)this).OnAppUpdate(); CarController instance = CarController.Instance; if (!((Object)(object)instance == (Object)null)) { DrivableCar currentCar = instance.CurrentCar; if (!((Object)(object)currentCar == (Object)null) && !currentCar.Driving) { ((App)this).MyPhone.CloseCurrentApp(); } } } private SimplePhoneButton CreateBundleButton(CarBundle bundle) { SimplePhoneButton obj = PhoneUIUtility.CreateSimpleButton(bundle.Name); ((PhoneButton)obj).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj).OnConfirm, (Action)delegate { ((App)this).MyPhone.GetAppInstance().SetBundleFilter(bundle); ((App)this).MyPhone.OpenApp(typeof(SpawnCarApp)); }); return obj; } } public static class PluginInfo { public const string PLUGIN_GUID = "CarJack.Plugin"; public const string PLUGIN_NAME = "CarJack.Plugin"; public const string PLUGIN_VERSION = "1.9.2"; } } namespace CarJack.Plugin.Patches { [HarmonyPatch(typeof(AmbientTrigger))] internal static class AmbientTriggerPatch { [HarmonyPrefix] [HarmonyPatch("OnTriggerEnter")] private static bool OnTriggerEnter(Collider trigger) { DrivableCar componentInParent = ((Component)trigger).GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null) { return true; } return componentInParent.InCar; } [HarmonyPrefix] [HarmonyPatch("OnTriggerExit")] private static bool OnTriggerExit(Collider trigger) { DrivableCar componentInParent = ((Component)trigger).GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null) { return true; } return componentInParent.InCar; } } [HarmonyPatch(typeof(AppHomeScreen))] internal static class AppHomeScreenPatch { [HarmonyPrefix] [HarmonyPatch("OnPressRight")] private static bool OnPressRight_Prefix(AppHomeScreen __instance) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 if ((Object)(object)CarController.Instance == (Object)null) { return true; } if (!((Object)(object)CarController.Instance.CurrentCar != (Object)null)) { return true; } PhoneScrollButton selectedButtton = ((PhoneScroll)__instance.m_ScrollView).SelectedButtton; if ((int)((HomescreenButton)((selectedButtton is HomescreenButton) ? selectedButtton : null)).AssignedApp.appType != 3) { return true; } ((App)__instance).m_AudioManager.PlaySfxGameplay((SfxCollectionID)14, (AudioClipID)305, 0f); return false; } } [HarmonyPatch(typeof(BMXOnlyGateway))] internal static class BMXOnlyGatewayPatch { [HarmonyPrefix] [HarmonyPatch("OnTriggerStay")] private static bool OnTriggerStay(Collider other) { if ((Object)(object)((Component)other).GetComponentInParent() != (Object)null) { return false; } return true; } } [HarmonyPatch(typeof(CharacterSelect))] internal static class CharacterSelectPatch { [HarmonyPrefix] [HarmonyPatch("Init")] private static void Init_Prefix(Player p, CharacterSelect __instance) { if (!p.isAI) { CarController instance = CarController.Instance; if (!((Object)(object)instance.CurrentCar == (Object)null)) { instance.ExitCar(); } } } } [HarmonyPatch(typeof(Player))] internal static class PlayerPatch { [HarmonyPostfix] [HarmonyPatch("InitVisual")] private static void InitVisual_Postfix(Player __instance) { UpdatePlayer(__instance); } private static void UpdatePlayer(Player player) { CarController.OnPlayerVisualUpdated?.Invoke(player); if (player.isAI) { return; } CarController instance = CarController.Instance; if (!((Object)(object)instance == (Object)null)) { if ((Object)(object)instance.CurrentCar != (Object)null && (Object)(object)instance.CurrentSeat == (Object)null) { ((CarSeat)instance.CurrentCar.DriverSeat).UpdateVisual(); } else if ((Object)(object)instance.CurrentCar != (Object)null && (Object)(object)instance.CurrentSeat != (Object)null) { ((CarSeat)instance.CurrentSeat).UpdateVisual(); } } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }