Decompiled source of Replay Intensifies v1.3.20
Distance.ReplayIntensifies.dll
Decompiled 3 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Distance.ReplayIntensifies.Data; using Distance.ReplayIntensifies.Helpers; using Distance.ReplayIntensifies.Randomizer; using Distance.ReplayIntensifies.Scripts; using Events; using Events.ReplayOptionsMenu; using HarmonyLib; using JsonFx.Json; using JsonFx.Model; using JsonFx.Serialization; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Distance.ReplayIntensifies")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Distance.ReplayIntensifies")] [assembly: AssemblyCopyright("Copyright © Robert Jordan 2022")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("7bcb2908-b003-45d9-be68-50cba5217603")] [assembly: AssemblyFileVersion("1.3.2.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.3.2.0")] [module: UnverifiableCode] public static class System__EnumExtensions { public static bool HasFlag<T>(this T value, T flag) where T : struct { ulong num = Convert.ToUInt64(value); ulong num2 = Convert.ToUInt64(flag); return (num & num2) != 0; } } namespace Distance.ReplayIntensifies { [BepInPlugin("Distance.ReplayIntensifies", "Replay Intensifies", "1.3.2")] public sealed class Mod : BaseUnityPlugin { private const string modGUID = "Distance.ReplayIntensifies"; private const string modName = "Replay Intensifies"; private const string modVersion = "1.3.2"; public const int OriginalMaxReplays = 20; public const int OriginalMaxSavedLocalReplays = 20; public const int OriginalMaxOnlineLeaderboards = 1000; public const int MaxReplaysAtAll = 1000; public const int MaxSavedLocalReplaysAtAll = 10000; public const int MaxOnlineLeaderboardsAtAll = 10000; public const int MinOnlineLeaderboards = 15; public const float MaxRandomWeight = 100f; public const bool Debug_TestBackerCars = false; public const Level MaxMaxLevelOfDetail = 2; public const Level MinMaxLevelOfDetail = 6; public const Level MaxMinLevelOfDetail = 1; private static readonly Harmony harmony = new Harmony("Distance.ReplayIntensifies"); public static ManualLogSource Log = new ManualLogSource("Replay Intensifies"); public static Mod Instance; private int unfixedRandomCount = 0; public static ConfigEntry<bool> EnableSeparateMaxForSelectedReplays { get; set; } public static ConfigEntry<int> MaxAutoReplays { get; set; } public static ConfigEntry<int> MaxSelectedReplays { get; set; } public static ConfigEntry<bool> FillWithLocalReplays { get; set; } public static ConfigEntry<LocalLeaderboardTrimming> LocalReplayTrimming { get; set; } public static ConfigEntry<int> MaxSavedLocalReplays { get; set; } public static ConfigEntry<int> MaxOnlineLeaderboards { get; set; } public static ConfigEntry<bool> GhostOutline { get; set; } public static ConfigEntry<Type> GhostDetailType { get; set; } public static ConfigEntry<bool> ReplayOutline { get; set; } public static ConfigEntry<Type> ReplayDetailType { get; set; } public static ConfigEntry<Level> MaxLevelOfDetail { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) Level val = MaxLevelOfDetail.Value; if ((int)val < 2) { val = (Level)2; } if ((int)val > 6) { val = (Level)6; } MaxLevelOfDetail.Value = val; return MaxLevelOfDetail; } set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 //IL_002c: Unknown result type (might be due to invalid IL or missing references) if ((int)value.Value < 2) { value.Value = (Level)2; } if ((int)value.Value > 6) { value.Value = (Level)6; } MaxLevelOfDetailCached = value.Value; } } public static ConfigEntry<Level> MinLevelOfDetail { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) Level val = MinLevelOfDetail.Value; if ((int)val < 1) { val = (Level)1; } MinLevelOfDetail.Value = val; return MinLevelOfDetail; } set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_0017: Unknown result type (might be due to invalid IL or missing references) if ((int)value.Value < 1) { value.Value = (Level)1; } MinLevelOfDetailCached = value.Value; } } public static ConfigEntry<bool> EnableUnrestrictedOpponentColors { get; set; } public static ConfigEntry<GhostOrReplay> UseDataEffectForMode { get; set; } public static ConfigEntry<GhostOrReplay> UseRivalStyleForMode { get; set; } public static ConfigEntry<bool> UseRivalStyleForSelf { get; set; } public static ConfigEntry<float> RivalBrightness { get; set; } public static ConfigEntry<bool> RivalOutline { get; set; } public static ConfigEntry<Type> RivalDetailType { get; set; } public static ConfigEntry<bool> EnableSteamRivals { get; set; } public static ConfigEntry<bool> HighlightRivalsInLeaderboards { get; set; } public static ConfigEntry<bool> EnableRandomizedCars { get; set; } public static ConfigEntry<uint> ExtraRandomnessSeed { get; set; } public static ConfigEntry<LocalOrOnline> UseRandomCarsFor { get; set; } public static ConfigEntry<bool> UseRandomRivalCars { get; set; } public static ConfigEntry<bool> RandomRespectBackerCars { get; set; } public static ConfigEntry<RandomSeedMethod> RandomCarSeedMethod { get; set; } public static ConfigEntry<RandomSeedMethod> RandomColorSeedMethod { get; set; } public static ConfigEntry<RandomCarMethod> RandomCarChoiceMethod { get; set; } public static ConfigEntry<RandomColorMethod> RandomColorChoiceMethod { get; set; } public static ConfigEntry<bool> RandomRequireCarUnlocks { get; set; } public static ConfigEntry<float> RandomCustomCarsDefaultWeight { get; set; } public static ConfigEntry<bool> RandomCustomCarsSplitDefaultWeight { get; set; } public static ConfigEntry<bool> ReplayModeDisableCinematicCameras { get; set; } public static ConfigEntry<bool> ReplayModePauseAtStart { get; set; } public static ConfigEntry<float> FinishPreSpectateTime { get; set; } public static Dictionary<ulong, string> SteamRivals { get; set; } public static Dictionary<string, float> RandomCarWeights { get; set; } public static Level MaxLevelOfDetailCached { get; private set; } public static Level MinLevelOfDetailCached { get; private set; } public void Awake() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Expected O, but got Unknown //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Expected O, but got Unknown //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Expected O, but got Unknown //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Expected O, but got Unknown //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Expected O, but got Unknown //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Expected O, but got Unknown //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Expected O, but got Unknown //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Expected O, but got Unknown //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Expected O, but got Unknown //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Expected O, but got Unknown //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Expected O, but got Unknown //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Expected O, but got Unknown //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Expected O, but got Unknown //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Expected O, but got Unknown //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Expected O, but got Unknown //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Expected O, but got Unknown //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Expected O, but got Unknown //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Expected O, but got Unknown //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Expected O, but got Unknown //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Expected O, but got Unknown //IL_04d2: Unknown result type (might be due to invalid IL or missing references) //IL_04dc: Expected O, but got Unknown //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_051b: Expected O, but got Unknown //IL_054a: Unknown result type (might be due to invalid IL or missing references) //IL_0554: Expected O, but got Unknown //IL_0577: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Expected O, but got Unknown //IL_05a4: Unknown result type (might be due to invalid IL or missing references) //IL_05ae: Expected O, but got Unknown //IL_05d1: Unknown result type (might be due to invalid IL or missing references) //IL_05db: Expected O, but got Unknown //IL_0605: Unknown result type (might be due to invalid IL or missing references) //IL_060f: Expected O, but got Unknown //IL_0632: Unknown result type (might be due to invalid IL or missing references) //IL_063c: Expected O, but got Unknown //IL_065f: Unknown result type (might be due to invalid IL or missing references) //IL_0669: Expected O, but got Unknown //IL_068c: Unknown result type (might be due to invalid IL or missing references) //IL_0696: Expected O, but got Unknown //IL_06b9: Unknown result type (might be due to invalid IL or missing references) //IL_06c3: Expected O, but got Unknown //IL_06f8: Unknown result type (might be due to invalid IL or missing references) //IL_0702: Expected O, but got Unknown //IL_0725: Unknown result type (might be due to invalid IL or missing references) //IL_072f: Expected O, but got Unknown //IL_0752: Unknown result type (might be due to invalid IL or missing references) //IL_075c: Expected O, but got Unknown Object.DontDestroyOnLoad((Object)(object)this); if ((Object)(object)Instance == (Object)null) { Instance = this; } Log = Logger.CreateLogSource("Distance.ReplayIntensifies"); try { SteamworksHelper.Init(); } catch (Exception ex) { Log.LogError((object)"Replay Intensifies: Error during SteamworksHelper.Init()"); Log.LogError((object)ex); throw; } UseDataEffectForMode = ((BaseUnityPlugin)this).Config.Bind<GhostOrReplay>("Rendering Settings", "USE DATA EFFECT FOR MODE", GhostOrReplay.Replay_Mode, new ConfigDescription("Which modes to use the data materialization spawn/finish-despawn effect in for non-ghost car styles.", (AcceptableValueBase)null, new object[0])); GhostDetailType = ((BaseUnityPlugin)this).Config.Bind<Type>("Rendering Settings", "GHOST CAR STYLE", (Type)2, new ConfigDescription("Change the visual detail type of Ghost cars.", (AcceptableValueBase)null, new object[0])); GhostOutline = ((BaseUnityPlugin)this).Config.Bind<bool>("Rendering Settings", "GHOST OUTLINE", true, new ConfigDescription("Whether or not Ghost cars have an outline", (AcceptableValueBase)null, new object[0])); ReplayDetailType = ((BaseUnityPlugin)this).Config.Bind<Type>("Rendering Settings", "REPLAY CAR STYLE", (Type)1, new ConfigDescription("Change the visual detail type of Replay Mode cars.", (AcceptableValueBase)null, new object[0])); ReplayOutline = ((BaseUnityPlugin)this).Config.Bind<bool>("Rendering Settings", "REPLAY OUTLINE", false, new ConfigDescription("Whether or not Replay Mode cars have an outline", (AcceptableValueBase)null, new object[0])); MaxLevelOfDetail = ((BaseUnityPlugin)this).Config.Bind<Level>("Rendering Settings", "MAX CAR LEVEL OF DETAIL", (Level)2, new ConfigDescription("Change the highest level of detail that opponent cars will render with. Lowering Max Level of Detail can improve performance when playing with more ghosts.", (AcceptableValueBase)null, new object[0])); MinLevelOfDetail = ((BaseUnityPlugin)this).Config.Bind<Level>("Rendering Settings", "MIN CAR LEVEL OF DETAIL", (Level)6, new ConfigDescription("Change the lowest level of detail that opponent cars will render with. Raising Min Level of Detail can decrease performance when playing with more ghosts. NOTE: In-Focus will force a car's LOD to be higher than normal for non-camera-focused cars.", (AcceptableValueBase)null, new object[0])); EnableSeparateMaxForSelectedReplays = ((BaseUnityPlugin)this).Config.Bind<bool>("Limits Settings", "USE MAX SELECTED REPLAYS", false, new ConfigDescription("Use a separate maximum for the number of selected ghosts from the leaderboards menu.", (AcceptableValueBase)null, new object[0])); MaxAutoReplays = ((BaseUnityPlugin)this).Config.Bind<int>("Limits Settings", "MAX AUTO REPLAYS", 5, new ConfigDescription("Maximum number of ghosts that will auto-load when playing a level. This is the [i]GHOSTS IN ARCADE COUNT[/i] option from the Replays menu, and is included here for convenience.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 1000), new object[0])); MaxSelectedReplays = ((BaseUnityPlugin)this).Config.Bind<int>("Limits Settings", "MAX SELECTED REPLAYS", 20, new ConfigDescription("Maximum number of ghosts that will be loaded when selecting from the leaderboards menu.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(20, 1000), new object[0])); MaxOnlineLeaderboards = ((BaseUnityPlugin)this).Config.Bind<int>("Limits Settings", "MAX ONLINE LEADERBOARD RANKS", 1000, new ConfigDescription("Maximum number of leaderboard ranks shown for Friends and Online tabs.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(15, 10000), new object[0])); MaxSavedLocalReplays = ((BaseUnityPlugin)this).Config.Bind<int>("Limits Settings", "MAX SAVED LOCAL REPLAYS", 500, new ConfigDescription("Maximum number of local leaderboard replays that will be saved.\n[FF0000]WARNING:[-] Completing a map with more than this number of ghosts will remove ALL ghosts past the maximum.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(20, 10000), new object[0])); LocalReplayTrimming = ((BaseUnityPlugin)this).Config.Bind<LocalLeaderboardTrimming>("Limits Settings", "LOCAL REPLAY TRIMMING", LocalLeaderboardTrimming.Current, new ConfigDescription("When creating a local leaderboard replay past the placement limit, choose whether replays are Never deleted, only your Current Run gets deleted, or if all replays past the limit Always get deleted.", (AcceptableValueBase)null, new object[0])); FillWithLocalReplays = ((BaseUnityPlugin)this).Config.Bind<bool>("Limits Settings", "FILL WITH LOCAL REPLAYS", false, new ConfigDescription("Fill remaining auto slots with local replays when there aren't enough online replays to load.", (AcceptableValueBase)null, new object[0])); EnableUnrestrictedOpponentColors = ((BaseUnityPlugin)this).Config.Bind<bool>("Limits Settings", "ENABLE UNRESTRICTED OPPONENT COLORS", false, new ConfigDescription("Online opponents and non-[i]Ghost Detail Type[/i] cars will NOT have their colors clamped, allowing for extremely bright cars. Bright cars are made by editing color preset files and changing the color channels to very large values.", (AcceptableValueBase)null, new object[0])); ReplayModeDisableCinematicCameras = ((BaseUnityPlugin)this).Config.Bind<bool>("Replay Mode Settings", "DISABLE CINEMATIC CAMERAS", false, new ConfigDescription("Turn off cinematic camera triggers in replay mode, allowing for more flexible camera movement.", (AcceptableValueBase)null, new object[0])); ReplayModePauseAtStart = ((BaseUnityPlugin)this).Config.Bind<bool>("Replay Mode Settings", "PAUSE AT START", false, new ConfigDescription("Pause at match start during replay mode, allowing easier tracking of extremely short runs.", (AcceptableValueBase)null, new object[0])); FinishPreSpectateTime = ((BaseUnityPlugin)this).Config.Bind<float>("Replay Mode Settings", "FINISH PRE-SPECTATE TIME", 5f, new ConfigDescription("Change the number of seconds to wait after finishing a level before going into spectate mode.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.02f, 300f), new object[0])); SteamRivals = LoadSteamRivals(); EnableSteamRivals = ((BaseUnityPlugin)this).Config.Bind<bool>("Steam Rival Settings", "ENABLE STEAM RIVALS", false, new ConfigDescription("Enable the Steam Rivals feature.", (AcceptableValueBase)null, new object[0])); HighlightRivalsInLeaderboards = ((BaseUnityPlugin)this).Config.Bind<bool>("Steam Rival Settings", "HIGHLIGHT RIVALS IN LEADERBOARDS", false, new ConfigDescription("Steam Rivals listed in the level select leaderboards menu will be colored differently.", (AcceptableValueBase)null, new object[0])); UseRivalStyleForMode = ((BaseUnityPlugin)this).Config.Bind<GhostOrReplay>("Steam Rival Settings", "USE CAR STYLE FOR MODE", GhostOrReplay.Ghost_Mode, new ConfigDescription("Which modes to use the Steam Rival car style in.", (AcceptableValueBase)null, new object[0])); UseRivalStyleForSelf = ((BaseUnityPlugin)this).Config.Bind<bool>("Steam Rival Settings", "USE CAR STYLE FOR SELF", false, new ConfigDescription("Steam Rival car styles will also be used for your own ghosts.", (AcceptableValueBase)null, new object[0])); RivalDetailType = ((BaseUnityPlugin)this).Config.Bind<Type>("Steam Rival Settings", "RIVAL CAR STYLE", (Type)0, new ConfigDescription("Change the visual detail type of Steam Rival cars.", (AcceptableValueBase)null, new object[0])); RivalOutline = ((BaseUnityPlugin)this).Config.Bind<bool>("Steam Rival Settings", "RIVAL CAR OUTLINE", true, new ConfigDescription("Change whether the Steam Rival has an outline", (AcceptableValueBase)null, new object[0])); RivalBrightness = ((BaseUnityPlugin)this).Config.Bind<float>("Steam Rival Settings", "RIVAL OUTLINE BRIGHTNESS", 1f, new ConfigDescription("Change the brightness for Steam Rival car outlines. NOTE: Brightness values higher than 1.0 will only increase the intensity of flames and wing trails.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 10f), new object[0])); RandomCarWeights = LoadCarWeights(); EnableRandomizedCars = ((BaseUnityPlugin)this).Config.Bind<bool>("Randomized Cars Settings", "ENABLE RANDOMIZED CARS", false, new ConfigDescription("Enable the randomized cars feature, allowing for more variety with opponents.", (AcceptableValueBase)null, new object[0])); UseRandomCarsFor = ((BaseUnityPlugin)this).Config.Bind<LocalOrOnline>("Randomized Cars Settings", "USE RANDOM CARS FOR", LocalOrOnline.Local_Replays, new ConfigDescription("Choose whether local and/or online leaderboards replays will be randomized. 'Online' is not recommended for normal play, since a player's car can be considered part of 'their identity' in the leaderboards.", (AcceptableValueBase)null, new object[0])); UseRandomRivalCars = ((BaseUnityPlugin)this).Config.Bind<bool>("Randomized Cars Settings", "USE RANDOM RIVAL CARS", false, new ConfigDescription("Rival cars will be randomized (STEAM RIVALS feature must be enabled).", (AcceptableValueBase)null, new object[0])); RandomRespectBackerCars = ((BaseUnityPlugin)this).Config.Bind<bool>("Randomized Cars Settings", "RESPECT KICKSTARTER BACKERS", true, new ConfigDescription("Disable randomizing online replays that use the Kickstarter backer car.", (AcceptableValueBase)null, new object[0])); ExtraRandomnessSeed = ((BaseUnityPlugin)this).Config.Bind<uint>("Randomized Cars Settings", "EXTRA RANDOMNESS SEED", 0u, new ConfigDescription("Change up the fixed randomness for replays a little.", (AcceptableValueBase)(object)new AcceptableValueRange<uint>(0u, 10u), new object[0])); RandomCarSeedMethod = ((BaseUnityPlugin)this).Config.Bind<RandomSeedMethod>("Randomized Car Settings", "CAR SEED METHOD", RandomSeedMethod.By_Replay, new ConfigDescription("Change how randomness is determined for car types. By Replay will use the replay data as the seed, so that each replay will always be the same. By Placement will use the placement between all replays as the seed.", (AcceptableValueBase)null, new object[0])); RandomColorSeedMethod = ((BaseUnityPlugin)this).Config.Bind<RandomSeedMethod>("Randomized Car Settings", "COLOR SEED METHOD", RandomSeedMethod.By_Replay, new ConfigDescription("Change how randomness is determined for car colors. By Replay will use the replay data as the seed, so that each replay will always be the same. By Placement will use the placement between all replays as the seed.", (AcceptableValueBase)null, new object[0])); RandomCarChoiceMethod = ((BaseUnityPlugin)this).Config.Bind<RandomCarMethod>("Randomized Car Settings", "CAR CHOICE METHOD", RandomCarMethod.Car_Types, new ConfigDescription("Choose how random car types will be decided. Cycle will randomly cycle through choices once before choosing duplicates.", (AcceptableValueBase)null, new object[0])); RandomColorChoiceMethod = ((BaseUnityPlugin)this).Config.Bind<RandomColorMethod>("Randomized Car Settings", "COLOR CHOICE METHOD", RandomColorMethod.Color_Presets, new ConfigDescription("Choose how random car colors will be decided. Cycle will randomly cycle through choices once before choosing duplicates.", (AcceptableValueBase)null, new object[0])); RandomCustomCarsDefaultWeight = ((BaseUnityPlugin)this).Config.Bind<float>("Randomized Car Settings", "DEFAULT CUSTOM CARS WEIGHT", 0f, new ConfigDescription("Default weighted chance for any custom car with an individual weight of 0.0. Use this when you want all custom cars to have a chance of appearing, without having to touch the settings after new additions (0.0 to disable).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), new object[0])); RandomCustomCarsSplitDefaultWeight = ((BaseUnityPlugin)this).Config.Bind<bool>("Randomized Car Settings", "SPLIT DEFAULT CUSTOM CARS WEIGHT", false, new ConfigDescription("Any custom car using the default weight will split the weighted chance of appearing among all custom cars, rather than being given the same weight (see option above).", (AcceptableValueBase)null, new object[0])); RandomRequireCarUnlocks = ((BaseUnityPlugin)this).Config.Bind<bool>("Randomized Car Settings", "REQUIRE CAR UNLOCKS", false, new ConfigDescription("Disable using random car types that you haven't unlocked yet.", (AcceptableValueBase)null, new object[0])); MaxAutoReplays.SettingChanged += OnConfigChanged; Log.LogInfo((object)"Replay Intensifies: Initializing..."); harmony.PatchAll(); Log.LogInfo((object)"Replay Intensifies: Initialized!"); } private void OnConfigChanged(object sender, EventArgs e) { SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((e is SettingChangedEventArgs) ? e : null); if (sender == MaxAutoReplays) { G.Sys.OptionsManager_.Replay_.GhostsInArcadeCount_ = (int)val.ChangedSetting.BoxedValue; ((OptionsSettings)G.Sys.OptionsManager_.Replay_).Save(); return; } if (sender == RivalBrightness) { StaticEvent<Data>.Broadcast((Data)null); return; } if (sender == ExtraRandomnessSeed) { } if (val != null) { } } public void SaveDictionary(Dictionary<string, float> dic) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown string path = "Car Weights.json"; string directoryName = Path.GetDirectoryName(Assembly.GetCallingAssembly().Location); DataWriterSettings val = new DataWriterSettings { PrettyPrint = true }; JsonWriter val2 = new JsonWriter(val); try { using StreamWriter streamWriter = new StreamWriter(Path.Combine(directoryName, path), append: false); streamWriter.WriteLine(((DataWriter<ModelTokenType>)(object)val2).Write((object)dic)); } catch (Exception ex) { Log.LogWarning((object)ex); } } public void SaveDictionary(Dictionary<ulong, string> dic) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown string path = "Steam Rivals.json"; string directoryName = Path.GetDirectoryName(Assembly.GetCallingAssembly().Location); DataWriterSettings val = new DataWriterSettings { PrettyPrint = true }; JsonWriter val2 = new JsonWriter(val); try { using StreamWriter streamWriter = new StreamWriter(Path.Combine(directoryName, path), append: false); streamWriter.WriteLine(((DataWriter<ModelTokenType>)(object)val2).Write((object)dic)); } catch (Exception ex) { Log.LogWarning((object)ex); } } private Dictionary<string, float> LoadCarWeights() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown string path = "Car Weights.json"; string directoryName = Path.GetDirectoryName(Assembly.GetCallingAssembly().Location); try { using StreamReader streamReader = new StreamReader(Path.Combine(directoryName, path)); string text = streamReader.ReadToEnd(); JsonReader val = new JsonReader(); return ((DataReader<ModelTokenType>)(object)val).Read<Dictionary<string, float>>(text); } catch (DirectoryNotFoundException) { Log.LogWarning((object)"Failed to load car randomization weights due to the directory not existing. \nNew weights will be saved when necessary."); return new Dictionary<string, float>(); } catch (Exception ex2) { Log.LogWarning((object)"Failed to load car randomization weights"); Log.LogWarning((object)ex2); return new Dictionary<string, float>(); } } private Dictionary<ulong, string> LoadSteamRivals() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown string path = "Steam Rivals.json"; string directoryName = Path.GetDirectoryName(Assembly.GetCallingAssembly().Location); try { using StreamReader streamReader = new StreamReader(Path.Combine(directoryName, path)); string text = streamReader.ReadToEnd(); JsonReader val = new JsonReader(); Dictionary<string, string> dictionary = ((DataReader<ModelTokenType>)(object)val).Read<Dictionary<string, string>>(text); Dictionary<ulong, string> dictionary2 = new Dictionary<ulong, string>(); foreach (KeyValuePair<string, string> item in dictionary) { dictionary2.Add(ulong.Parse(item.Key), item.Value); } return dictionary2; } catch (DirectoryNotFoundException) { Log.LogWarning((object)"Failed to load Steam Rivals due to the directory not existing. \nNew Rivals will be saved when necessary."); return new Dictionary<ulong, string>(); } catch (Exception ex2) { Log.LogWarning((object)"Failed to load Steam Rivals"); Log.LogWarning((object)("Exception Name: " + ex2.GetType().ToString())); Log.LogWarning((object)ex2); return new Dictionary<ulong, string>(); } } private static Dictionary<string, Level> GetLevelOfDetailSettingsEntries() { return new Dictionary<string, Level> { { "Very Low", (Level)6 }, { "Low", (Level)5 }, { "Medium", (Level)4 }, { "High", (Level)3 }, { "Ultra", (Level)2 }, { "Ultra (In-Focus)", (Level)1 }, { "Ultra (First Person)", (Level)0 } }; } private static Dictionary<string, Level> GetMaxLevelOfDetailSettingsEntries() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between Unknown and I4 //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 Dictionary<string, Level> levelOfDetailSettingsEntries = GetLevelOfDetailSettingsEntries(); KeyValuePair<string, Level>[] array = ICollectionEx.ToArray<KeyValuePair<string, Level>>((ICollection<KeyValuePair<string, Level>>)levelOfDetailSettingsEntries); for (int i = 0; i < array.Length; i++) { KeyValuePair<string, Level> keyValuePair = array[i]; if ((int)keyValuePair.Value < 2 || (int)keyValuePair.Value > 6) { levelOfDetailSettingsEntries.Remove(keyValuePair.Key); } } return levelOfDetailSettingsEntries; } private static Dictionary<string, Level> GetMinLevelOfDetailSettingsEntries() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between Unknown and I4 Dictionary<string, Level> levelOfDetailSettingsEntries = GetLevelOfDetailSettingsEntries(); KeyValuePair<string, Level>[] array = ICollectionEx.ToArray<KeyValuePair<string, Level>>((ICollection<KeyValuePair<string, Level>>)levelOfDetailSettingsEntries); for (int i = 0; i < array.Length; i++) { KeyValuePair<string, Level> keyValuePair = array[i]; if ((int)keyValuePair.Value < 1) { levelOfDetailSettingsEntries.Remove(keyValuePair.Key); } } return levelOfDetailSettingsEntries; } private string OnValidateFloat(string input) { if (string.IsNullOrEmpty(input)) { return null; } if (!float.TryParse(input, out var result) || float.IsNaN(result) || float.IsInfinity(result)) { return "This is not a valid decimal number"; } return null; } private string OnValidateFloatOrRng(string input) { if (string.IsNullOrEmpty(input)) { return null; } if (!float.TryParse(input, out var result) || float.IsNaN(result) || float.IsInfinity(result)) { return "This is not a valid decimal number or "; } return null; } private void OnSubmitRivalOutlineBrightness(string input) { if (!string.IsNullOrEmpty(input) && float.TryParse(input, out var result) && !float.IsNaN(result) && !float.IsInfinity(result)) { result = Mathf.Clamp(result, 0.05f, 100000f); if (RivalBrightness.Value != result) { RivalBrightness.Value = result; StaticEvent<Data>.Broadcast((Data)null); } } } private string OnValidateExtraRandomnessSeed(string input) { if (string.IsNullOrEmpty(input)) { return null; } if (!uint.TryParse(input, out var _)) { return $"Not a valid integer between 0 and {uint.MaxValue} or "; } return null; } private void OnSubmitExtraRandomnessSeed(string input) { if (!string.IsNullOrEmpty(input) && uint.TryParse(input, NumberStyles.AllowHexSpecifier, null, out var result)) { ExtraRandomnessSeed.Value = result; } } private static bool FilterCarType(string carName, string filter) { if (!string.IsNullOrEmpty(filter)) { return carName.IndexOf(filter, StringComparison.InvariantCultureIgnoreCase) != -1; } return true; } private void SetRandomCarWeights(IEnumerable<string> carNames, string filter) { Random random = new Random(); foreach (string item in carNames.Where((string c) => FilterCarType(c, filter))) { SetCarTypeChance(item, (float)random.NextDouble(), autoSave: false); } } public void SetCarWeights(IEnumerable<string> carNames, string filter, float weight) { Log.LogWarning((object)"Setting Car Weights"); weight = Mathf.Clamp(weight, 0f, 100f); foreach (string item in carNames.Where((string c) => FilterCarType(c, filter))) { Log.LogInfo((object)("Car weight for: " + item)); SetCarTypeChance(item, weight); } } private void OnSubmitSetVanillaCarWeights(string input) { if (!string.IsNullOrEmpty(input) && float.TryParse(input, out var result) && !float.IsNaN(result) && !float.IsInfinity(result)) { SetCarWeights(RandomCarType.AllowedVanillaCarNames, null, result); } } private void OnSubmitSetCustomCarWeights(string input, string filter) { if (!string.IsNullOrEmpty(input) && float.TryParse(input, out var result) && !float.IsNaN(result) && !float.IsInfinity(result)) { SetCarWeights(RandomCarType.CustomCarNames, filter, result); } } private void OnSubmitSetCustomCarWeightsWithFilter(string filter) { OnSubmit val = default(OnSubmit); ComponentEx.DoNextFrame((MonoBehaviour)(object)this, (Action)delegate { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_001f: Expected O, but got Unknown OnSubmit obj = val; if (obj == null) { OnSubmit val2 = delegate(out string error, string input) { error = OnValidateFloatOrRng(input); if (error == null) { OnSubmitSetCustomCarWeights(input, filter); return true; } return false; }; OnSubmit val3 = val2; val = val2; obj = val3; } InputPromptPanel.Create(obj, (OnPop)null, "ENTER CUSTOM WEIGHT", (string)null); }); } private void OnConfirmResetVanillaCarWeights() { Dictionary<string, float> defaultCarWeights = GetDefaultCarWeights(); foreach (string allowedVanillaCarName in RandomCarType.AllowedVanillaCarNames) { defaultCarWeights.TryGetValue(allowedVanillaCarName, out var value); SetCarTypeChance(allowedVanillaCarName, value, autoSave: false); } } public static int GetMaxAutoReplays() { return Mathf.Clamp(G.Sys.OptionsManager_.Replay_.GhostsInArcadeCount_, 20, 1000); } public static int GetMaxPickedReplays() { if (EnableSeparateMaxForSelectedReplays.Value) { return Mathf.Clamp(MaxSelectedReplays.Value, 20, 1000); } return GetMaxAutoReplays(); } public static int GetMaxSpawnReplays() { return Math.Max(GetMaxAutoReplays(), GetMaxPickedReplays()); } public static int GetMaxSavedLocalReplays() { return Mathf.Clamp(MaxSavedLocalReplays.Value, 20, 10000); } public static int GetMaxOnlineLeaderboards() { return Mathf.Clamp(MaxOnlineLeaderboards.Value, 15, 10000); } public static bool GetClampCarColors(PlayerDataBase playerDataBase) { bool clampCarColors_ = playerDataBase.ClampCarColors_; if (clampCarColors_ && playerDataBase is PlayerDataOpponent) { return !EnableUnrestrictedOpponentColors.Value; } return clampCarColors_; } public static bool GetIsGhostVisual(PlayerDataReplay playerDataReplay) { PlayerDataReplayCompoundData component = ((Component)playerDataReplay).GetComponent<PlayerDataReplayCompoundData>(); if (Object.op_Implicit((Object)(object)component)) { return component.IsGhostVisual; } return playerDataReplay.IsGhost_; } public static float GetGhostBrightness(PlayerDataReplay playerDataReplay) { PlayerDataReplayCompoundData component = ((Component)playerDataReplay).GetComponent<PlayerDataReplayCompoundData>(); if (Object.op_Implicit((Object)(object)component)) { return component.GetOutlineBrightness(); } return playerDataReplay.replaySettings_.GhostBrightness_; } public static void CreateCarOutline(PlayerDataReplay playerDataReplay) { PlayerDataReplayCompoundData component = ((Component)playerDataReplay).GetComponent<PlayerDataReplayCompoundData>(); if (component.HasOutline) { ((PlayerDataBase)playerDataReplay).CreateCarOutline(); } } public static bool GetDontShowDataEffect(PlayerDataReplay playerDataReplay) { PlayerDataReplayCompoundData component = ((Component)playerDataReplay).GetComponent<PlayerDataReplayCompoundData>(); if (Object.op_Implicit((Object)(object)component)) { return !component.ShowDataEffect; } return playerDataReplay.IsGhost_; } public static void UpdateLeaderboardButtonColor(LevelSelectLeaderboardButton button, bool force) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) if (!EnableSteamRivals.Value || !HighlightRivalsInLeaderboards.Value) { return; } Entry entry_ = ((UIExButtonListButton)button).entry_; Entry val = (Entry)(object)((entry_ is Entry) ? entry_ : null); Color val2 = ((!val.info_.isLocal_) ? Color.white : LevelSelectLeaderboardButton.localColor_); bool flag = false; if (!val.info_.isLocal_) { Entry leaderboardEntry_ = val.leaderboardEntry_; Entry val3 = (Entry)(object)((leaderboardEntry_ is Entry) ? leaderboardEntry_ : null); if (val3 != null) { ulong userID = SteamworksHelper.GetLeaderboardEntrySteamID(val3); if (Instance.IsSteamRival(userID, excludeSelf: true)) { val2 = ColorEx.HexToColor("9480E7", byte.MaxValue); flag = true; } } } if (flag || force) { button.SetLabelColor(button.nameLabel_, val2); button.SetLabelColor(button.placeLabel_, val2); button.SetLabelColor(button.dataLabel_, val2); } } public Type GetCarDetailType(bool isGhost, bool isCarRival) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_002d: Unknown result type (might be due to invalid IL or missing references) if (isCarRival) { return RivalDetailType.Value; } return isGhost ? GhostDetailType.Value : ReplayDetailType.Value; } public bool GetCarOutline(bool isGhost, bool isCarRival) { if (isCarRival) { return RivalOutline.Value; } return isGhost ? GhostOutline.Value : ReplayOutline.Value; } public bool IsCarSteamRival(bool isGhost, long userID) { return IsCarSteamRival(isGhost, (ulong)userID); } public bool IsCarSteamRival(bool isGhost, ulong userID) { if (EnableSteamRivals.Value && UseRivalStyleForMode.Value.HasGhostOrReplay(isGhost)) { return IsSteamRival(userID); } return false; } public float GetCarTypeChance(string carName) { if (RandomCarWeights.TryGetValue(carName, out var value)) { return value; } return 0f; } public void SetCarTypeChance(string carName, float weight, bool autoSave = true) { Dictionary<string, float> randomCarWeights = RandomCarWeights; if (!randomCarWeights.TryGetValue(carName, out var value) || value != weight) { randomCarWeights[carName] = weight; if (autoSave) { SaveDictionary(RandomCarWeights); } } } public bool IsCarRandomnessEnabled(bool isOnline, bool isCarRival, string carName) { if (EnableRandomizedCars.Value) { if (isOnline && RandomRespectBackerCars.Value && RandomCarType.IsBackerCar(carName)) { return false; } if (isCarRival) { return UseRandomRivalCars.Value; } if (isOnline) { return System__EnumExtensions.HasFlag(UseRandomCarsFor.Value, LocalOrOnline.Online_Replays); } return System__EnumExtensions.HasFlag(UseRandomCarsFor.Value, LocalOrOnline.Local_Replays); } return false; } public bool IsSteamRival(long userID, bool excludeSelf = false) { return IsSteamRival((ulong)userID, excludeSelf); } public bool IsSteamRival(ulong userID, bool excludeSelf = false) { if (SteamworksManager.GetSteamID() == userID) { return !excludeSelf && UseRivalStyleForSelf.Value; } return SteamRivals.ContainsKey(userID); } public bool TryGetSteamRival(long userID, out string nameComment) { return TryGetSteamRival((ulong)userID, out nameComment); } public bool TryGetSteamRival(ulong userID, out string nameComment) { return SteamRivals.TryGetValue(userID, out nameComment); } public bool AddSteamRival(long userID, string nameComment, bool autoSave = true) { return AddSteamRival((ulong)userID, nameComment, autoSave); } public bool AddSteamRival(ulong userID, string nameComment, bool autoSave = true) { if (nameComment == null) { nameComment = string.Empty; } Dictionary<ulong, string> steamRivals = SteamRivals; if (!steamRivals.ContainsKey(userID)) { steamRivals[userID] = nameComment; if (autoSave) { SaveDictionary(SteamRivals); } return true; } return false; } public bool RemoveSteamRival(long userID, bool autoSave = true) { return RemoveSteamRival((ulong)userID, autoSave); } public bool RemoveSteamRival(ulong userID, bool autoSave = true) { if (SteamRivals.Remove(userID)) { if (autoSave) { SaveDictionary(SteamRivals); } return true; } return false; } public int CountSteamRivals(IEnumerable<long> userIDs, bool countSelf = true) { return CountSteamRivals(userIDs.Select((long userID) => (ulong)userID), countSelf); } public int CountSteamRivals(IEnumerable<ulong> userIDs, bool countSelf = true) { ulong selfID = SteamworksManager.GetSteamID(); Dictionary<ulong, string> steamRivals = SteamRivals; return userIDs.Count((ulong userID) => (userID == selfID) ? countSelf : steamRivals.ContainsKey(userID)); } private Random GetRandom(int replaySeed, int placementSeed, RandomSeedMethod seedMethod, int skipCount) { Random random = new Random((seedMethod switch { RandomSeedMethod.By_Replay => replaySeed, RandomSeedMethod.By_Placement => placementSeed, _ => Environment.TickCount + unfixedRandomCount++, }) ^ (int)ExtraRandomnessSeed.Value); for (int i = 0; i < skipCount; i++) { random.NextDouble(); } return random; } public CarData ChooseRandomCarData(CarData origCarData, int replaySeed, int placementSeed, List<RandomCarType> carTypes, List<RandomColorPreset> colorPresets) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Invalid comparison between Unknown and I4 //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Invalid comparison between Unknown and I4 //IL_0302: 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_0325: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) Random random = GetRandom(replaySeed, placementSeed, RandomCarSeedMethod.Value, 0); Random random2 = GetRandom(replaySeed, placementSeed, RandomColorSeedMethod.Value, 1); if (!RandomCarType.TryCreate(origCarData.name_, 1f, 1, requireUnlock: false, out var carType)) { carType = RandomCarType.DefaultCarType; } RandomCarMethod value = RandomCarChoiceMethod.Value; if (value.IsCarTypes() && carTypes != null) { int index = carTypes.Count - 1; double num = ((IEnumerable<RandomCarType>)carTypes).Sum((Func<RandomCarType, double>)((RandomCarType x) => x.Weight)); double num2 = 0.0; double num3 = 0.0; if (value != RandomCarMethod.Car_Types_Ordered) { num3 = random.NextDouble() * num; } for (int i = 0; i < carTypes.Count; i++) { num2 += (double)carTypes[i].Weight; if (num3 < num2) { index = i; break; } } carType = carTypes[index]; if (value.IsAvoidDuplicates() && carType.MaxCount > 0 && --carType.RemainingCount <= 0) { carTypes.RemoveAt(index); } } CarColors val = origCarData.colors_; RandomColorMethod value2 = RandomColorChoiceMethod.Value; if (value2 == RandomColorMethod.Default_Colors) { val = carType.DefaultColors; } else if (value2.IsColorPresets()) { if (colorPresets != null) { int index2 = colorPresets.Count - 1; double num4 = ((IEnumerable<RandomColorPreset>)colorPresets).Sum((Func<RandomColorPreset, double>)((RandomColorPreset x) => x.Weight)); double num5 = 0.0; double num6 = 0.0; if (value2 != RandomColorMethod.Color_Presets_Ordered) { num6 = random2.NextDouble() * num4; } for (int j = 0; j < colorPresets.Count; j++) { num5 += (double)colorPresets[j].Weight; if (num6 < num5) { index2 = j; break; } } RandomColorPreset randomColorPreset = colorPresets[index2]; val = ((!randomColorPreset.IsDefault) ? randomColorPreset.Colors : carType.DefaultColors); if (value2.IsAvoidDuplicates() && randomColorPreset.MaxCount > 0 && --randomColorPreset.RemainingCount <= 0) { colorPresets.RemoveAt(index2); } } } else { switch (value2) { case RandomColorMethod.HSV: { for (ColorType val3 = (ColorType)0; (int)val3 < 4; val3 = (ColorType)(val3 + 1)) { ((CarColors)(ref val))[val3] = Color.HSVToRGB((float)random2.NextDouble(), (float)random2.NextDouble(), (float)random2.NextDouble()); } break; } case RandomColorMethod.RGB: { for (ColorType val2 = (ColorType)0; (int)val2 < 4; val2 = (ColorType)(val2 + 1)) { ((CarColors)(ref val))[val2] = new Color((float)random2.NextDouble(), (float)random2.NextDouble(), (float)random2.NextDouble()); } break; } } } return new CarData(carType.Name, val); } public List<RandomColorPreset> LoadRandomColorPresets() { List<RandomColorPreset> list = RandomColorPreset.LoadAllColorPresets(); if (RandomColorSeedMethod.Value == RandomSeedMethod.By_Placement) { list.RemoveAll((RandomColorPreset x) => x.IsDefault); } return list; } public List<RandomCarType> LoadRandomCarTypes() { Dictionary<string, RandomCarType> dictionary = new Dictionary<string, RandomCarType>(); int num = 0; bool value = RandomRequireCarUnlocks.Value; foreach (KeyValuePair<string, float> randomCarWeight in RandomCarWeights) { if (RandomCarType.TryCreate(randomCarWeight.Key, randomCarWeight.Value, 1, value, out var carType)) { dictionary.Add(carType.Name, carType); if (!carType.IsVanilla) { num++; } } } int num2 = RandomCarType.CustomCarsCount - num; float num3 = RandomCustomCarsDefaultWeight.Value; if (num2 > 0 && num3 > 0f) { if (RandomCustomCarsSplitDefaultWeight.Value) { num3 /= (float)num2; } foreach (string customCarName in RandomCarType.CustomCarNames) { if (!dictionary.ContainsKey(customCarName) && RandomCarType.TryCreate(customCarName, num3, 1, value, out var carType2)) { dictionary.Add(carType2.Name, carType2); } } } List<RandomCarType> list = dictionary.Values.ToList(); list.Sort(); if (list.Count == 0) { list.Add(RandomCarType.DefaultCarType); } return list; } public Dictionary<string, float> GetDefaultCarWeights() { return new Dictionary<string, float> { { "Spectrum", 100f }, { "Archive", 75f }, { "Interceptor", 50f }, { "Encryptor", 8f }, { "Halcyon", 5f } }; } } } namespace Distance.ReplayIntensifies.Helpers { public static class Crc { private static readonly uint[] Crc32Table = Enumerable.Range(0, 256).Select(Calculate32).ToArray(); public const uint Initial32 = 0u; private static uint Calculate32(int seed) { uint num = (uint)seed; for (int i = 0; i < 8; i++) { num = (((num & (true ? 1u : 0u)) != 0) ? ((num >> 1) ^ 0xEDB88320u) : (num >> 1)); } return num; } public static int Hash32(byte[] bytes, int init) { return (int)Hash32(bytes, (uint)init); } public static uint Hash32(byte[] bytes, uint init = 0u) { uint num = ~init; foreach (byte b in bytes) { num = (num >> 8) ^ Crc32Table[(byte)(num ^ b)]; } return ~num; } public static int Hash32(string text, int init) { return (int)Hash32(text, (uint)init); } public static uint Hash32(string text, uint init = 0u) { return Hash32(Encoding.UTF8.GetBytes(text), init); } } public static class SteamworksHelper { public static Func<Entry, ulong> GetLeaderboardEntrySteamID { get; private set; } public static void Init() { GetLeaderboardEntrySteamID = CreateAccessor<Entry, ulong>("steamID_.m_SteamID"); } private static Delegate CreateAccessor(Type type, string accessorPath) { Mod.Log.LogDebug((object)("CreateAccessor: " + type.Name + "." + accessorPath)); Stopwatch stopwatch = Stopwatch.StartNew(); ParameterExpression parameterExpression = Expression.Parameter(type, "x"); Expression expression = parameterExpression; string[] array = accessorPath.Split(new char[1] { '.' }); foreach (string propertyOrFieldName in array) { expression = Expression.PropertyOrField(expression, propertyOrFieldName); } Delegate result = Expression.Lambda(expression, parameterExpression).Compile(); stopwatch.Stop(); Mod.Log.LogDebug((object)$"CreateAccessor: {stopwatch.ElapsedMilliseconds}ms"); return result; } private static Func<T, R> CreateAccessor<T, R>(string accessorPath) { return (Func<T, R>)CreateAccessor(typeof(T), accessorPath); } } } namespace Distance.ReplayIntensifies.Scripts { public class ReplayManagerCompoundData : MonoBehaviour { public List<RandomCarType> OriginalCarTypes { get; internal set; } public List<RandomColorPreset> OriginalCarPresets { get; internal set; } public List<RandomCarType> CarTypes { get; internal set; } public List<RandomColorPreset> CarPresets { get; internal set; } public CarData ChooseRandomCarData(CarData origCarData, int replaySeed, int placementSeed) { //IL_0068: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) if (CarTypes != null && CarTypes.Count == 0) { CarTypes = RandomCarType.CloneListAndReset(OriginalCarTypes); } if (CarPresets != null && CarPresets.Count == 0) { CarPresets = RandomColorPreset.CloneListAndReset(OriginalCarPresets); } return Mod.Instance.ChooseRandomCarData(origCarData, replaySeed, placementSeed, CarTypes, CarPresets); } public static ReplayManagerCompoundData Create(ReplayManager replayManager) { //IL_01e6: Unknown result type (might be due to invalid IL or missing references) ReplayManagerCompoundData orAddComponent = GameObjectEx.GetOrAddComponent<ReplayManagerCompoundData>(((Component)replayManager).gameObject); if (!Mod.EnableRandomizedCars.Value) { return orAddComponent; } if (Mod.RandomCarChoiceMethod.Value.IsCarTypes()) { List<RandomCarType> carTypes = (orAddComponent.OriginalCarTypes = Mod.Instance.LoadRandomCarTypes()); orAddComponent.CarTypes = carTypes; if (Mod.RandomCarChoiceMethod.Value.IsAvoidDuplicates()) { orAddComponent.CarTypes = RandomCarType.CloneListAndReset(orAddComponent.OriginalCarTypes); } } else { List<RandomCarType> carTypes = (orAddComponent.OriginalCarTypes = null); orAddComponent.CarTypes = carTypes; } if (Mod.RandomColorChoiceMethod.Value.IsColorPresets()) { List<RandomColorPreset> carPresets = (orAddComponent.OriginalCarPresets = Mod.Instance.LoadRandomColorPresets()); orAddComponent.CarPresets = carPresets; if (Mod.RandomColorChoiceMethod.Value.IsAvoidDuplicates()) { orAddComponent.CarPresets = RandomColorPreset.CloneListAndReset(orAddComponent.OriginalCarPresets); } } else { List<RandomColorPreset> carPresets = (orAddComponent.OriginalCarPresets = null); orAddComponent.CarPresets = carPresets; } if (Mod.RandomCarSeedMethod.Value == RandomSeedMethod.By_Placement || Mod.RandomColorSeedMethod.Value == RandomSeedMethod.By_Placement) { List<CarReplayData> list5 = new List<CarReplayData>(); if (replayManager.IsReplayMode_) { if (replayManager.PlayingPickedReplay_) { AddPlacements(list5, replayManager.normalFinishReplays_, isGhost: false); AddPlacements(list5, replayManager.pickedReplays_, isGhost: false); } else if (replayManager.finishedNormally_) { AddPlacements(list5, replayManager.normalFinishReplays_, isGhost: false); AddPlacements(list5, replayManager.didNotFinishReplays_, isGhost: true); } else { AddPlacements(list5, replayManager.didNotFinishReplays_, isGhost: false, spawnLast: true); } } else { AddPlacements(list5, replayManager.pickedReplays_, isGhost: true); AddPlacements(list5, replayManager.loadedReplays_, isGhost: true); } if (GameModeIDEx.IsPointsBased(replayManager.gm_.NextGameModeID_)) { list5.Sort(ComparePlacementPoints); } else { list5.Sort(ComparePlacementTime); } int i = 0; int num = 1; for (; i < list5.Count; i++) { CarReplayData val = list5[i]; CarReplayDataCompoundData component = ((Component)val).GetComponent<CarReplayDataCompoundData>(); if (Object.op_Implicit((Object)(object)component) && !component.IsMyPlayer) { component.Placement = num++; } } } return orAddComponent; } private static void AddPlacements(List<CarReplayData> placements, GameObject group, bool isGhost, bool spawnLast = false) { CarReplayData[] componentsInChildren = group.GetComponentsInChildren<CarReplayData>(); if (!spawnLast) { CarReplayData[] array = componentsInChildren; foreach (CarReplayData replayData in array) { AddPlacement(replayData, placements, isGhost); } } else if (componentsInChildren.Length != 0) { CarReplayData replayData2 = ArrayEx.Last<CarReplayData>(componentsInChildren); AddPlacement(replayData2, placements, isGhost); } } private static void AddPlacement(CarReplayData replayData, List<CarReplayData> placements, bool isGhost) { if (ReplayManager.SaveLoadReplays_ && ((Behaviour)replayData).enabled) { placements.Add(replayData); } } private static int ComparePlacementPoints(CarReplayData x, CarReplayData y) { CarReplayDataCompoundData component = ((Component)x).GetComponent<CarReplayDataCompoundData>(); CarReplayDataCompoundData component2 = ((Component)y).GetComponent<CarReplayDataCompoundData>(); bool flag = x.FinishValue_ > 0; bool flag2 = y.FinishValue_ > 0; if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component2) && component.DidNotFinish != component2.DidNotFinish) { return component.DidNotFinish.CompareTo(component2.DidNotFinish); } if (flag != flag2) { return flag2.CompareTo(flag); } return y.FinishValue_.CompareTo(x.FinishValue_); } private static int ComparePlacementTime(CarReplayData x, CarReplayData y) { CarReplayDataCompoundData component = ((Component)x).GetComponent<CarReplayDataCompoundData>(); CarReplayDataCompoundData component2 = ((Component)y).GetComponent<CarReplayDataCompoundData>(); bool flag = x.FinishValue_ > 0; bool flag2 = y.FinishValue_ > 0; if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component2) && component.DidNotFinish != component2.DidNotFinish) { return component.DidNotFinish.CompareTo(component2.DidNotFinish); } if (flag != flag2) { return flag2.CompareTo(flag); } return x.FinishValue_.CompareTo(y.FinishValue_); } } public class CarReplayDataCompoundData : MonoBehaviour { public bool IsOnline { get; internal set; } public bool IsMyPlayer { get; internal set; } public bool DidNotFinish { get; internal set; } public int Placement { get; internal set; } } public class PlayerDataReplayCompoundData : MonoBehaviour { public PlayerDataReplay Player { get; internal set; } public bool IsGhostMode { get; internal set; } public Type DetailType { get; internal set; } public bool HasOutline { get; internal set; } public bool IsRival { get; internal set; } public bool ShowDataEffect { get; internal set; } public bool IsOnline { get; internal set; } public bool IsMyPlayer { get; internal set; } public bool DidNotFinish { get; internal set; } public int Placement { get; internal set; } public CarData OriginalCarData { get; internal set; } public CarData CarData { get; internal set; } public bool IsRandomnessEnabled { get; internal set; } public int ReplaySeed { get; internal set; } public bool IsGhostBehavior => Player.IsGhost_; public bool IsGhostVisual => (int)DetailType == 2; public float GetOutlineBrightness() { if (!HasOutline) { return 1f; } if (IsRival) { return Mod.RivalBrightness.Value; } return Player.replaySettings_.GhostBrightness_; } public static PlayerDataReplayCompoundData Create(PlayerDataReplay playerDataReplay, CarReplayData data, bool isGhost) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) bool flag = Mod.Instance.IsCarSteamRival(isGhost, data.steamID_); Type carDetailType = Mod.Instance.GetCarDetailType(isGhost, flag); bool carOutline = Mod.Instance.GetCarOutline(isGhost, flag); bool isGhost2 = isGhost && !PlayerDataReplay.simulateNetworkCar_; bool flag2 = Mod.UseDataEffectForMode.Value.HasGhostOrReplay(isGhost2); PlayerDataReplayCompoundData playerDataReplayCompoundData = ((Component)playerDataReplay).gameObject.AddComponent<PlayerDataReplayCompoundData>(); playerDataReplayCompoundData.Player = playerDataReplay; playerDataReplayCompoundData.IsGhostMode = isGhost; playerDataReplayCompoundData.DetailType = carDetailType; playerDataReplayCompoundData.HasOutline = carOutline; playerDataReplayCompoundData.IsRival = flag; playerDataReplayCompoundData.ShowDataEffect = !playerDataReplayCompoundData.IsGhostVisual && flag2; CarData carData = (playerDataReplayCompoundData.OriginalCarData = data.carData_); playerDataReplayCompoundData.CarData = carData; CarReplayDataCompoundData component = ((Component)data).GetComponent<CarReplayDataCompoundData>(); if (Object.op_Implicit((Object)(object)component)) { playerDataReplayCompoundData.IsOnline = component.IsOnline; playerDataReplayCompoundData.IsMyPlayer = component.IsMyPlayer; playerDataReplayCompoundData.DidNotFinish = component.DidNotFinish; playerDataReplayCompoundData.Placement = component.Placement; } playerDataReplayCompoundData.IsRandomnessEnabled = Mod.Instance.IsCarRandomnessEnabled(playerDataReplayCompoundData.IsOnline, flag, data.carData_.name_); if (playerDataReplayCompoundData.IsMyPlayer) { playerDataReplayCompoundData.IsRandomnessEnabled = false; } if (playerDataReplayCompoundData.IsRandomnessEnabled) { if (Mod.RandomCarSeedMethod.Value == RandomSeedMethod.By_Replay || Mod.RandomColorSeedMethod.Value == RandomSeedMethod.By_Replay) { int init = 0; init = Crc.Hash32(data.StateBuffer_, init); init = Crc.Hash32(data.EventBuffer_, init); playerDataReplayCompoundData.ReplaySeed = init; } ReplayManagerCompoundData component2 = ((Component)G.Sys.ReplayManager_).GetComponent<ReplayManagerCompoundData>(); if (Object.op_Implicit((Object)(object)component2)) { playerDataReplayCompoundData.CarData = component2.ChooseRandomCarData(data.carData_, playerDataReplayCompoundData.ReplaySeed, playerDataReplayCompoundData.Placement); } } return playerDataReplayCompoundData; } } } namespace Distance.ReplayIntensifies.Randomizer { public enum RandomCarMethod { Off, Car_Types, Car_Types_Cycle, Car_Types_Ordered } public static class RandomCarMethodExtensions { public static RandomCarMethod[] GetSupportedMethodsList() { return new RandomCarMethod[3] { RandomCarMethod.Off, RandomCarMethod.Car_Types, RandomCarMethod.Car_Types_Cycle }; } public static Dictionary<string, RandomCarMethod> GetSettingsEntries() { return GetSupportedMethodsList().ToDictionary((RandomCarMethod m) => m.GetSettingName()); } public static string GetSettingName(this RandomCarMethod carMethod) { string text = carMethod.ToString().Replace('_', ' '); switch (carMethod) { case RandomCarMethod.Car_Types_Cycle: text = text.Replace("Cycle", "(Cycle)"); break; case RandomCarMethod.Car_Types_Ordered: text = text.Replace("Ordered", "(Ordered)"); break; } return text; } public static bool IsCarTypes(this RandomCarMethod carMethod) { if ((uint)(carMethod - 1) <= 2u) { return true; } return false; } public static bool IsAvoidDuplicates(this RandomCarMethod carMethod) { if ((uint)(carMethod - 2) <= 1u) { return true; } return false; } } public enum RandomColorMethod { Off, Color_Presets, Color_Presets_Cycle, Color_Presets_Ordered, HSV, RGB, Default_Colors } public static class RandomColorMethodExtensions { public static RandomColorMethod[] GetSupportedMethodsList() { return new RandomColorMethod[6] { RandomColorMethod.Off, RandomColorMethod.Color_Presets, RandomColorMethod.Color_Presets_Cycle, RandomColorMethod.HSV, RandomColorMethod.RGB, RandomColorMethod.Default_Colors }; } public static Dictionary<string, RandomColorMethod> GetSettingsEntries() { return GetSupportedMethodsList().ToDictionary((RandomColorMethod m) => m.GetSettingName()); } public static string GetSettingName(this RandomColorMethod colorMethod) { string text = colorMethod.ToString().Replace('_', ' '); switch (colorMethod) { case RandomColorMethod.Color_Presets_Cycle: text = text.Replace("Cycle", "(Cycle)"); break; case RandomColorMethod.Color_Presets_Ordered: text = text.Replace("Ordered", "(Ordered)"); break; } return text; } public static bool IsColorPresets(this RandomColorMethod colorMethod) { if ((uint)(colorMethod - 1) <= 2u) { return true; } return false; } public static bool IsAvoidDuplicates(this RandomColorMethod colorMethod) { if ((uint)(colorMethod - 2) <= 1u) { return true; } return false; } } public enum RandomSeedMethod { Always_Random, By_Replay, By_Placement } public static class RandomSeedMethodExtensions { public static RandomSeedMethod[] GetSupportedMethodsList() { return new RandomSeedMethod[3] { RandomSeedMethod.Always_Random, RandomSeedMethod.By_Replay, RandomSeedMethod.By_Placement }; } public static Dictionary<string, RandomSeedMethod> GetSettingsEntries() { return GetSupportedMethodsList().ToDictionary((RandomSeedMethod m) => m.GetSettingName()); } public static string GetSettingName(this RandomSeedMethod seedMethod) { return seedMethod.ToString().Replace('_', ' '); } public static bool IsFixed(this RandomSeedMethod seedMethod) { if ((uint)(seedMethod - 1) <= 1u) { return true; } return false; } } public class RandomColorPreset : IComparable<RandomColorPreset> { public CarColors Colors { get; set; } public string Name { get; set; } public bool IsVanilla { get; set; } public bool IsDefault => IsVanilla && Name == "Default"; public int MaxCount { get; set; } public int RemainingCount { get; set; } public float Weight { get; set; } public bool IsPreset => Name != null; public static List<RandomColorPreset> LoadAllColorPresets(float defaultWeight = 1f, int defaultMaxCount = 1) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //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_0164: Unknown result type (might be due to invalid IL or missing references) List<RandomColorPreset> list = new List<RandomColorPreset>(); Object[] array = Resource.LoadAllInFolder<Object>("ColorPresets/"); Object[] array2 = array; foreach (Object val in array2) { string fileNameWithoutExtension = Resource.GetFileNameWithoutExtension(val.name); string text = Resource.resourcesColorPresetsDirPath_ + fileNameWithoutExtension + ".xml"; ColorPreset val2 = ColorPreset.Load(text); if (Object.op_Implicit((Object)(object)val2)) { RandomColorPreset randomColorPreset = new RandomColorPreset { Colors = val2.CarColors_, Name = val2.Name_, IsVanilla = true, MaxCount = defaultMaxCount, RemainingCount = defaultMaxCount, Weight = defaultWeight }; if (randomColorPreset.IsDefault) { list.Insert(0, randomColorPreset); } else { list.Add(randomColorPreset); } GameObjectEx.Destroy((Object)(object)val2); Object.DestroyImmediate((Object)(object)val2); } } if (DirectoryEx.Exists(Resource.PersonalColorPresetsDirPath_)) { FileInfo[] directoryFiles = DirectoryEx.GetDirectoryFiles(Resource.PersonalColorPresetsDirPath_, "*.xml"); FileInfo[] array3 = directoryFiles; foreach (FileInfo fileInfo in array3) { if (!System__EnumExtensions.HasFlag(fileInfo.Attributes, FileAttributes.Hidden)) { string text2 = Resource.NormalizePath(fileInfo.FullName); ColorPreset val3 = ColorPreset.Load(text2); if (Object.op_Implicit((Object)(object)val3)) { list.Add(new RandomColorPreset { Colors = val3.CarColors_, Name = val3.Name_, IsVanilla = false, MaxCount = defaultMaxCount, RemainingCount = defaultMaxCount, Weight = defaultWeight }); GameObjectEx.Destroy((Object)(object)val3); Object.DestroyImmediate((Object)(object)val3); } } } } list.Sort(); if (list.Count == 0) { list.Add(new RandomColorPreset { Colors = new CarColors(Color.white, Color.white, Color.white, Color.white), Name = "Default", IsVanilla = true, MaxCount = defaultMaxCount, RemainingCount = defaultMaxCount, Weight = defaultWeight }); } return list; } public int CompareTo(RandomColorPreset other) { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Invalid comparison between Unknown and I4 //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_00f9: Unknown result type (might be due to invalid IL or missing references) if (IsPreset != other.IsPreset) { return other.IsPreset.CompareTo(IsPreset); } if (IsPreset) { if (IsDefault != other.IsDefault) { return other.IsDefault.CompareTo(IsDefault); } if (IsVanilla != other.IsVanilla) { return other.IsVanilla.CompareTo(IsVanilla); } return string.Compare(Name, other.Name, StringComparison.InvariantCulture); } for (ColorType val = (ColorType)0; (int)val < 4; val = (ColorType)(val + 1)) { CarColors colors = Colors; Color a = ((CarColors)(ref colors))[val]; colors = other.Colors; int num = CompareColor(a, ((CarColors)(ref colors))[val]); if (num != 0) { return num; } } return 0; } private static int CompareColor(Color a, Color b) { for (int i = 0; i < 4; i++) { int num = ((Color)(ref b))[i].CompareTo(((Color)(ref a))[i]); if (num != 0) { return num; } } return 0; } public void ResetRemainingCount() { RemainingCount = MaxCount; } public static List<RandomColorPreset> CloneListAndReset(List<RandomColorPreset> colorPresets) { foreach (RandomColorPreset colorPreset in colorPresets) { colorPreset.ResetRemainingCount(); } return new List<RandomColorPreset>(colorPresets); } } public class RandomCarType : IComparable<RandomCarType> { private static bool? allowBackerCar; private static List<string> backerCarNames; private static List<string> vanillaCarNames; private static Dictionary<string, int> KnownCars => G.Sys.ProfileManager_.knownCars_; private static CarInfo[] CarInfos => G.Sys.ProfileManager_.CarInfos_; public static bool AllowBackerCar { get { if (!allowBackerCar.HasValue) { bool flag = false; allowBackerCar = SteamworksManager.IsSteamBuild_ && G.Sys.SteamworksManager_.OwnsCatalystDLC(); } return allowBackerCar.Value; } } public static List<string> BackerCarNames { get { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_003e: Unknown result type (might be due to invalid IL or missing references) if (backerCarNames == null) { backerCarNames = new List<string>(); UnlockableCar[] unlockableCars_ = ProfileManager.unlockableCars_; foreach (UnlockableCar val in unlockableCars_) { if (val.backerVehicle_) { string name_ = CarInfos[val.index_].name_; if (KnownCars.ContainsKey(name_)) { backerCarNames.Add(name_); } } } } return backerCarNames; } } public static List<string> VanillaCarNames { get { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (vanillaCarNames == null) { vanillaCarNames = new List<string>(); UnlockableCar[] unlockableCars_ = ProfileManager.unlockableCars_; foreach (UnlockableCar val in unlockableCars_) { string name_ = CarInfos[val.index_].name_; if (KnownCars.ContainsKey(name_)) { vanillaCarNames.Add(name_); } } } return vanillaCarNames; } } public static IEnumerable<string> AllowedVanillaCarNames { get { foreach (string carName in VanillaCarNames) { if (IsAllowedCar(carName)) { yield return carName; } } } } public static IEnumerable<string> CustomCarNames { get { foreach (string carName in KnownCars.Keys) { if (!IsVanillaCar(carName)) { yield return carName; } } } } public static RandomCarType DefaultCarType { get { string name_ = CarInfos[0].name_; return new RandomCarType { Name = name_, Index = 0, IsVanilla = IsVanillaCar(name_), MaxCount = -1, RemainingCount = -1, Weight = 1f }; } } public static int VanillaCarsCount => VanillaCarNames.Count; public static int CustomCarsCount => KnownCars.Count - VanillaCarsCount; public string Name { get; set; } public int Index { get; set; } public bool IsVanilla { get; set; } public bool IsBacker => IsBackerCar(Name); public int MaxCount { get; set; } public int RemainingCount { get; set; } public float Weight { get; set; } public CarColors DefaultColors => CarInfos[Index].colors_; public static bool IsBackerCar(string carName) { return BackerCarNames.Contains(carName); } public static bool IsVanillaCar(string carName) { return VanillaCarNames.Contains(carName); } public static bool IsAllowedCar(string carName) { return AllowBackerCar || !IsBackerCar(carName) || IsUnlocked(carName); } public static bool IsUnlocked(string carName) { return G.Sys.ProfileManager_.IsUnlocked(carName); } public static bool TryCreate(string carName, float weight, int maxCount, bool requireUnlock, out RandomCarType carType) { if (weight > 0f && KnownCars.TryGetValue(carName, out var value) && IsAllowedCar(carName) && (!requireUnlock || IsUnlocked(carName))) { carType = new RandomCarType { Name = carName, Index = value, IsVanilla = IsVanillaCar(carName), MaxCount = maxCount, RemainingCount = maxCount, Weight = weight }; return true; } carType = null; return false; } public static List<RandomCarType> LoadAllCarTypes(bool requireUnlock, float defaultWeight = 1f, int defaultMaxCount = 1) { List<RandomCarType> list = new List<RandomCarType>(); foreach (KeyValuePair<string, int> knownCar in KnownCars) { if (IsAllowedCar(knownCar.Key) && (!requireUnlock || IsUnlocked(knownCar.Key))) { list.Add(new RandomCarType { Name = knownCar.Key, Index = knownCar.Value, IsVanilla = IsVanillaCar(knownCar.Key), MaxCount = defaultMaxCount, RemainingCount = defaultMaxCount, Weight = defaultWeight }); } } list.Sort(); return list; } public int CompareTo(RandomCarType other) { return Index.CompareTo(other.Index); } public void ResetRemainingCount() { RemainingCount = MaxCount; } public static List<RandomCarType> CloneListAndReset(List<RandomCarType> carTypes) { foreach (RandomCarType carType in carTypes) { carType.ResetRemainingCount(); } return new List<RandomCarType>(carTypes); } } } namespace Distance.ReplayIntensifies.Patches { [HarmonyPatch(typeof(CinematicCameraMode), "SwitchToCamera", new Type[] { typeof(CinematicCamera), typeof(Transform), typeof(float), typeof(float), typeof(float), typeof(float) })] internal static class CinematicCameraMode__SwitchToCamera { [HarmonyPrefix] internal static bool Prefix(CinematicCameraMode __instance) { if (G.Sys.ReplayManager_.IsReplayMode_ && Mod.ReplayModeDisableCinematicCameras.Value) { return false; } return true; } } [HarmonyPatch(typeof(LevelSelectLeaderboardButton), "OnDisplayedVirtual")] internal static class LevelSelectLeaderboardButton__OnDisplayedVirtual { [HarmonyPostfix] internal static void Postfix(LevelSelectLeaderboardButton __instance) { Mod.UpdateLeaderboardButtonColor(__instance, force: false); } } [HarmonyPatch(typeof(LevelSelectLeaderboardMenu), "Display")] internal static class LevelSelectLeaderboardMenu__Display { [HarmonyTranspiler] internal static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown Mod.Log.LogInfo((object)"Transpiling..."); List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 3; i < list.Count; i++) { if (list[i - 2].opcode == OpCodes.Callvirt && ((MethodInfo)list[i - 2].operand).Name == "Push" && list[i].opcode == OpCodes.Call && ((MethodInfo)list[i].operand).Name == "ClearCategories") { Mod.Log.LogInfo((object)$"call MenuPanel.Push @ {i - 2}"); list.InsertRange(i - 3, (IEnumerable<CodeInstruction>)(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Call, (object)typeof(LevelSelectLeaderboardMenu__Display).GetMethod("AddMenuPanelButtons_")) }); break; } } return list.AsEnumerable(); } public static void AddMenuPanelButtons_(LevelSelectLeaderboardMenu leaderboardMenu) { if (Mod.EnableSteamRivals.Value) { MenuPanel component = ((Component)leaderboardMenu).GetComponent<MenuPanel>(); component.SetBottomLeftButton((InputAction)48, "ADD RIVAL"); } } } [HarmonyPatch(typeof(LevelSelectLeaderboardMenu), "Update")] internal static class LevelSelectLeaderboardMenu__Update { private struct PickedEntry { public readonly Entry entry; public readonly ulong steamID; public PickedEntry(Entry entry) { this.entry = entry; steamID = SteamworksHelper.GetLeaderboardEntrySteamID(entry); } } [HarmonyPostfix] internal static void Postfix(LevelSelectLeaderboardMenu __instance) { if (__instance.IsDownloading_ || !Mod.EnableSteamRivals.Value || !G.Sys.MenuPanelManager_.IsTop(((Component)__instance).gameObject)) { return; } List<PickedEntry> pickedSteamEntries_ = GetPickedSteamEntries_(__instance); pickedSteamEntries_.RemoveAll((PickedEntry entry) => SteamworksManager.GetSteamID() == entry.steamID); int count = pickedSteamEntries_.Count; int num = Mod.Instance.CountSteamRivals(pickedSteamEntries_.Select((PickedEntry entry) => entry.steamID)); bool flag = pickedSteamEntries_.Count > 0; string text; bool flag2; if (num < count || !flag) { text = ((count > 1) ? "ADD RIVALS" : "ADD RIVAL"); flag2 = false; } else { text = ((count > 1) ? "REMOVE RIVALS" : "REMOVE RIVAL"); flag2 = true; } G.Sys.MenuPanelManager_.SetBottomLeftActionButton((InputAction)48, text); G.Sys.MenuPanelManager_.SetBottomLeftActionButtonEnabled((InputAction)48, flag); if (!G.Sys.MenuPanelManager_.MenuInputEnabled_ || G.Sys.GameManager_.IsFadingOut_ || !flag || !__instance.inputManager_.GetKeyUp((InputAction)48, -2)) { return; } int num2 = 0; num2 = (flag2 ? pickedSteamEntries_.Count((PickedEntry entry) => Mod.Instance.RemoveSteamRival(entry.steamID, autoSave: false)) : pickedSteamEntries_.Count((PickedEntry entry) => Mod.Instance.AddSteamRival(entry.steamID, ((Entry)entry.entry).Name_, autoSave: false))); if (num2 <= 0) { return; } Mod.Instance.SaveDictionary(Mod.SteamRivals); foreach (UIExButtonListButton item in ((UIExButtonContainer)__instance.buttonList_).Buttons_) { LevelSelectLeaderboardButton val = (LevelSelectLeaderboardButton)(object)((item is LevelSelectLeaderboardButton) ? item : null); if (val != null) { Mod.UpdateLeaderboardButtonColor(val, force: true); } } } private static List<PickedEntry> GetPickedSteamEntries_(LevelSelectLeaderboardMenu leaderboardMenu) { List<PickedEntry> list = (from steamEntry in leaderboardMenu.allEntries_.Select(delegate(Entry entry) { Entry replayHandleIfToggled_ = entry.ReplayHandleIfToggled_; return (Entry)(object)((replayHandleIfToggled_ is Entry) ? replayHandleIfToggled_ : null); }) where steamEntry != null select new PickedEntry(steamEntry)).ToList(); if (list.Count == 0) { Entry selectedEntry_ = ((UIExButtonContainer)leaderboardMenu.buttonList_).SelectedEntry_; Entry val = (Entry)(object)((selectedEntry_ is Entry) ? selectedEntry_ : null); if (val != null) { Entry leaderboardEntry_ = val.leaderboardEntry_; Entry val2 = (Entry)(object)((leaderboardEntry_ is Entry) ? leaderboardEntry_ : null); if (val2 != null) { list.Add(new PickedEntry(val2)); } } } return list; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] internal static class PlayerDataReplay__get_CarScreenType_ { [HarmonyPostfix] internal static void Postfix(PlayerDataReplay __instance, ref CarScreenType __result) { PlayerDataReplayCompoundData component = ((Component)__instance).GetComponent<PlayerDataReplayCompoundData>(); if (Object.op_Implicit((Object)(object)component)) { __result = (CarScreenType)((!component.IsGhostVisual) ? 1 : 0); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] internal static class PlayerDataReplay__get_CreateCarScreen_ { [HarmonyPostfix] internal static void Postfix(PlayerDataReplay __instance, ref bool __result) { PlayerDataReplayCompoundData component = ((Component)__instance).GetComponent<PlayerDataReplayCompoundData>(); if (Object.op_Implicit((Object)(object)component)) { __result = !component.IsGhostVisual; } } } [HarmonyPatch(typeof(PlayerDataReplay), "InitCarVirtual")] internal static class PlayerDataReplay__InitCarVirtual { [HarmonyTranspiler] internal static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> list = new List<CodeInstruction>(instructions); Mod.Log.LogInfo((object)"Transpiling..."); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Ldfld && ((FieldInfo)list[i].operand).Name == "isGhost_") { Mod.Log.LogInfo((object)$"ldfld isGhost_ @ {i}"); list[i].opcode = OpCodes.Call; list[i].operand = typeof(Mod).GetMethod("GetIsGhostVisual"); break; } } return list.AsEnumerable(); } } [HarmonyPatch(typeof(PlayerDataReplay), "OnEventReplayOptionsMenuClosed")] internal static class PlayerDataReplay__OnEventReplayOptionsMenuClosed { [HarmonyPrefix] internal static void Prefix(PlayerDataReplay __instance) { PlayerDataReplayCompoundData component = ((Component)__instance).GetComponent<PlayerDataReplayCompoundData>(); if (Object.op_Implicit((Object)(object)component)) { ((PlayerDataBase)__instance).outlineBrightness_ = component.GetOutlineBrightness(); } } [HarmonyTranspiler] internal static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); Mod.Log.LogInfo((object)"Transpiling... (1/2)"); for (int i = 1; i < list.Count; i++) { if (list[i - 1].opcode == OpCodes.Ldfld && ((FieldInfo)list[i - 1].operand).Name == "replaySettings_" && list[i].opcode == OpCodes.Callvirt && ((MethodInfo)list[i].operand).Name == "get_GhostBrightness_") { Mod.Log.LogInfo((object)$"callvirt get_GhostBrightness_ @ {i}"); list.RemoveRange(i - 1, 2); list.InsertRange(i - 1, (IEnumerable<CodeInstruction>)(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)typeof(Mod).GetMethod("GetGhostBrightness")) }); break; } } Mod.Log.LogInfo((object)"Transpiling... (2/2)"); for (int j = 3; j < list.Count; j++) { if (list[j - 3].opcode == OpCodes.Ldfld && ((FieldInfo)list[j - 3].operand).Name == "isGhost_" && list[j - 2].opcode == OpCodes.Brfalse && list[j].opcode == OpCodes.Call && ((MethodInfo)list[j].operand).Name == "SetJetFlameColor") { Mod.Log.LogInfo((object)$"ldfld isGhost_ @ {j - 3}"); Mod.Log.LogInfo((object)$"call SetJetFlameColor @ {j}"); list[j - 3].opcode = OpCodes.Call; list[j - 3].operand = typeof(Mod).GetMethod("GetIsGhostVisual"); break; } } return list.AsEnumerable(); } } [HarmonyPatch(typeof(ReplayManager), "AddOnlineReplaysToGroup")] internal static class ReplayManager__AddOnlineReplaysToGroup { [HarmonyTranspiler] internal static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> list = new List<CodeInstruction>(instructions); Mod.Log.LogInfo((object)"Transpiling..."); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Call && ((MethodInfo)list[i].operand).Name == "AddReplayToGroup") { Mod.Log.LogInfo((object)$"call AddReplayToGroup @ {i}"); list[i].opcode = OpCodes.Call; list[i].operand = typeof(ReplayManager__AddOnlineReplaysToGroup).GetMethod("AddOnlineReplayToGroupOverride_"); break; } } return list.AsEnumerable(); } public static void AddOnlineReplayToGroupOverride_(ReplayManager replayManager, CarReplayData carReplayData, GameObject group) { if (Object.op_Implicit((Object)(object)carReplayData)) { CarReplayDataCompoundData orAddComponent = GameObjectEx.GetOrAddComponent<CarReplayDataCompoundData>(((Component)carReplayData).gameObject); if (Object.op_Implicit((Object)(object)orAddComponent)) { orAddComponent.IsOnline = true; } } replayManager.AddReplayToGroup(carReplayData, group); } } [HarmonyPatch(typeof(ReplayManager), "AddReplayToGroup")] internal static class ReplayManager__AddReplayToGroup { [HarmonyPostfix] internal static void Postfix(ReplayManager __instance, CarReplayData carReplayData, GameObject group) { if (Object.op_Implicit((Object)(object)carReplayData)) { CarReplayDataCompoundData orAddComponent = GameObjectEx.GetOrAddComponent<CarReplayDataCompoundData>(((Component)carReplayData).gameObject); if (Object.op_Implicit((Object)(object)orAddComponent)) { orAddComponent.DidNotFinish = (Object)(object)group == (Object)(object)__instance.didNotFinishReplays_; } } } } [HarmonyPatch(typeof(ReplayManager), "OnAllPlayerEventFinish")] internal static class ReplayManager__OnAllPlayerEventFinish { [HarmonyTranspiler] internal static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> list = new List<CodeInstruction>(instructions); Mod.Log.LogInfo((object)"Transpiling..."); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Call && ((MethodInfo)list[i].operand).Name == "AddReplayToGroup") { Mod.Log.LogInfo((object)$"call AddReplayToGroup @ {i}"); list[i].opcode = OpCodes.Call; list[i].operand = typeof(ReplayManager__OnAllPlayerEventFinish).GetMethod("AddMyPlayerReplayToGroupOverride_"); break; } } return list.AsEnumerable(); } public static void AddMyPlayerReplayToGroupOverride_(ReplayManager replayManager, CarReplayData carReplayData, GameObject group) { if (Object.op_Implicit((Object)(object)carReplayData)) { CarReplayDataCompoundData orAddComponent = GameObjectEx.GetOrAddComponent<CarReplayDataCompoundData>(((Component)carReplayData).gameObject); if (Object.op_Implicit((Object)(object)orAddComponent)) { orAddComponent.IsMyPlayer = true; } } replayManager.AddReplayToGroup(carReplayData, group); } } [HarmonyPatch(typeof(ReplayManager), "OnEventModeStarted")] internal static class ReplayManager__OnEventModeStarted { [HarmonyPrefix] internal static void Prefix(ReplayManager __instance) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 if ((int)__instance.gm_.ModeID_ != 6 && Mod.EnableRandomizedCars.Value) { ReplayManagerCompoundData.Create(__instance); } } [HarmonyPostfix] internal static void Postfix(ReplayManager __instance) { GameObjectEx.RemoveComponent<ReplayManagerCompoundData>(((Component)__instance).gameObject); } } [HarmonyPatch(typeof(ReplayManager), "OnEventSceneStartLoad")] internal static class ReplayManager__OnEventSceneStartLoad { [HarmonyPostfix] internal static void Postfix(ReplayManager __instance) { if (__instance.IsReplayMode_ && Mod.ReplayModePauseAtStart.Value) { __instance.TogglePause(); } } } [HarmonyPatch(typeof(ReplayManager), "OnLoadedOnlineReplaysDownloadFinished")] internal static class ReplayManager__OnLoadedOnlineReplaysDownloadFinished { [HarmonyTranspiler] internal static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); Mod.Log.LogInfo((object)"Transpiling..."); for (int i = 1; i < list.Count; i++) { if (list[i - 1].opcode == OpCodes.Ldfld && list[i].opcode == OpCodes.Call && ((MethodInfo)list[i].operand).Name == "AddOnlineReplaysToGroup") { Mod.Log.LogInfo((object)$"call AddOnlineReplaysToGroup @ {i}"); list.InsertRange(i + 1, (IEnumerable<CodeInstruction>)(object)new CodeInstruction[5] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, list[i - 1].operand), new CodeInstruction(OpCodes.Ldarg_2, (object)null), new CodeInstruction(OpCodes.Call, (object)typeof(ReplayManager__OnLoadedOnlineReplaysDownloadFinished).GetMethod("FillRemainingWithLocalReplays_")) }); break; } } return list.AsEnumerable(); } public static void FillRemainingWithLocalReplays_(ReplayManager replayManager, GameObject group, bool userSkipped) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_015d: 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_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: 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) //IL_01db: Unknown result type (might be due to invalid IL or missing references) if (!Mod.FillWithLocalReplays.Value) { return; } CarReplayData[] componentsInChildren = group.GetComponentsInChildren<CarReplayData>(); int num = replayManager.settings_.GhostsInArcadeCount_ - componentsInChildren.Length; if (num <= 0) { return; } string nextLevelPath_ = replayManager.gm_.NextLevelPath_; GameModeID nextGameModeID_ = replayManager.gm_.NextGameModeID_; LocalLeaderboard val = LocalLeaderboard.Load(nextLevelPath_, nextGameModeID_); if (!((Object)(object)val != (Object)null)) { return; } List<CarReplayData> list = CarReplayData.LoadReplaysFromLeaderboard(val, num + 1).ToList(); bool flag = false; for (int i = 0; i < componentsInChildren.Length; i++) { if (flag) { break; } CarReplayData val2 = componentsInChildren[i]; for (int j = 0; j < list.Count; j++) { CarReplayData val3 = list[j]; if ((val3.steamID_ == 0L || val3.steamID_ == val2.steamID_) && val3.FinishValue_ == val2.FinishValue_ && val3.ReplayLengthMS_ == val2.ReplayLengthMS_ && val3.StateBuffer_.Length == val2.StateBuffer_.Length && val3.EventBuffer_.Length == val2.EventBuffer_.Length && val3.carData_.name_ == val2.carData_.name_ && val3.carData_.colors_.primary_ == val2.carData_.colors_.primary_ && val3.carData_.colors_.secondary_ == val2.carData_.colors_.secondary_ && val3.carData_.colors_.glow_ == val2.carData_.colors_.glow_ && val3.carData_.colors_.sparkle_ == val2.carData_.colors_.sparkle_ && val3.StateBuffer_.SequenceEqual(val2.StateBuffer_) && val3.EventBuffer_.SequenceEqual(val2.EventBuffer_)) { list.RemoveAt(j); flag = true; break; } } } if (!flag && list.Count > num) { list.RemoveAt(list.Count - 1); } if (list.Count > 0) { replayManager.AddReplaysToGroup(list.ToArray(), replayManager.loadedReplays_); } Object.Destroy((Object)(object)((Component)val).gameObject); } } [HarmonyPatch(typeof(ReplayOptionsMenu), "OnPanelPop")] internal static class ReplayOptionsMenu__OnPanelPop { [HarmonyPostfix] internal static void Postfix(ReplayOptionsMenu __instance) { Mod.MaxAutoReplays.Value = __instance.settings_.GhostsInArcadeCount_; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] internal static class SpectatorCameraLogic__ctor { [HarmonyPostfix] internal static void Postfix(SpectatorCameraLogic __instance) { __instance.preSpectateTimer_ = Math.Max(Mod.FinishPreSpectateTime.Value, 1f / 60f); } } [HarmonyPatch(typeof(SplashScreenLogic), "Start")] internal static class SplashScreenLogic__Start { [HarmonyPostfix] internal static void CreateSettingList() { string path = "Car Weights.json"; string path2 = Path.Combine(Assembly.GetCallingAssembly().Location, path); if (!File.Exists(path2)) { Mod.Instance.SetCarWeights(RandomCarType.AllowedVanillaCarNames, null, 1f); Mod.Instance.SetCarWeights(RandomCarType.CustomCarNames, null, 1f); } } } [HarmonyPatch(typeof(CarLevelOfDetail), "SetLevelOfDetail")] internal static class CarLevelOfDetail__SetLevelOfDetail { [HarmonyPrefix] internal static bool Prefix(CarLevelOfDetail __instance, Level newLevel) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Invalid comparison between Unknown and I4 //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Invalid comparison between Unknown and I4 //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be du