Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of WeatherTweaks v1.1.9
WeatherTweaks.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using ConsoleTables; using GameNetcodeStuff; using HarmonyLib; using LethalLevelLoader; using LethalNetworkAPI; using LobbyCompatibility.Enums; using LobbyCompatibility.Features; using Microsoft.CodeAnalysis; using MrovLib; using MrovLib.Compatibility; using MrovLib.Events; using Newtonsoft.Json; using Steamworks.Data; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using WeatherRegistry; using WeatherRegistry.Definitions; using WeatherRegistry.Enums; using WeatherRegistry.Modules; using WeatherRegistry.Patches; using WeatherRegistry.Utils; using WeatherTweaks.Compatibility; using WeatherTweaks.Definitions; using WeatherTweaks.Modules; using WeatherTweaks.Patches; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("EasyTextEffects")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("WeatherRegistry")] [assembly: AssemblyCompany("WeatherTweaks")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A template for Lethal Company")] [assembly: AssemblyFileVersion("1.1.9.0")] [assembly: AssemblyInformationalVersion("1.1.9+fb827db546ea5649b6e6c4fe241eddf8674af49a")] [assembly: AssemblyProduct("WeatherTweaks")] [assembly: AssemblyTitle("WeatherTweaks")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace WeatherTweaks { [HarmonyPatch(typeof(TimeOfDay))] public static class ChangeMidDay { [CompilerGenerated] private sealed class <>c__DisplayClass12_0 { public ProgressingWeatherEntry entry; internal bool <DoMidDayChange>b__0(WeatherTweaksWeather type) { return ((Weather)type).Name == entry.GetWeather().Name; } } [CompilerGenerated] private sealed class <DoMidDayChange>d__12 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ProgressingWeatherEntry entry; private <>c__DisplayClass12_0 <>8__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DoMidDayChange>d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0157: 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_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Invalid comparison between Unknown and I4 //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //IL_01de: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass12_0(); <>8__1.entry = entry; if (<>8__1.entry == null) { logger.LogError((object)"ProgressingWeatherEntry is null"); <>2__current = null; <>1__state = 1; return true; } goto IL_0071; case 1: <>1__state = -1; goto IL_0071; case 2: { <>1__state = -1; WeatherTweaksWeather weatherTweaksWeather = Variables.WeatherTweaksTypes.FirstOrDefault((WeatherTweaksWeather type) => ((Weather)type).Name == <>8__1.entry.GetWeather().Name); logger.LogWarning((object)$"{((Weather)weatherTweaksWeather).Name} {((Weather)weatherTweaksWeather).Type} {((Weather)weatherTweaksWeather).VanillaWeatherType}"); StartOfRound.Instance.currentLevel.currentWeather = ((Weather)weatherTweaksWeather).VanillaWeatherType; TimeOfDay.Instance.currentLevelWeather = ((Weather)weatherTweaksWeather).VanillaWeatherType; GameNetworkManager.Instance.localPlayerController.currentAudioTrigger.effectEnabled = false; CurrentEntry = <>8__1.entry; if ((int)<>8__1.entry.Weather.WeatherType == 1) { ((MonoBehaviour)TimeOfDay.Instance).StartCoroutine(MudPatches.SpawnMudPatches()); } WeatherController.SetWeatherEffects(((Weather)weatherTweaksWeather).VanillaWeatherType); return false; } IL_0071: logger.LogMessage((object)$"Changing weather to {<>8__1.entry.GetWeather().Name} at {<>8__1.entry.DayTime}, chance {<>8__1.entry.Chance} - is player inside? {Settings.IsPlayerInside}"); HUDManager.Instance.ReadDialogue(<>8__1.entry.GetDialogueSegment().ToArray()); <>2__current = (object)new WaitForSeconds(3f); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } internal static Random random; internal static ProgressingWeatherType currentWeather = null; internal static List<ProgressingWeatherEntry> weatherEntries = new List<ProgressingWeatherEntry>(); internal static float LastCheckedEntry = 0f; internal static ProgressingWeatherEntry CurrentEntry = null; internal static ManualLogSource logger = Logger.CreateLogSource("WeatherTweaks ChangeMidDay"); internal static ProgressingWeatherEntry NextEntry => weatherEntries.FirstOrDefault(); internal static float NextEntryTime { get { if (NextEntry == null) { return 0f; } return NextEntry.DayTime; } } [HarmonyPostfix] [HarmonyPatch("MoveTimeOfDay")] internal static void MoveTimeOfDayPatch(TimeOfDay __instance) { if (((NetworkBehaviour)StartOfRound.Instance).IsHost && currentWeather != null) { float normalizedTimeOfDay = __instance.normalizedTimeOfDay; if (normalizedTimeOfDay >= NextEntryTime) { RunProgressingEntryActions(normalizedTimeOfDay); } } } internal static void RunProgressingEntryActions(float normalizedTimeOfDay) { weatherEntries.RemoveAll((ProgressingWeatherEntry entry) => entry.DayTime < LastCheckedEntry); foreach (ProgressingWeatherEntry weatherEntry in weatherEntries) { if (normalizedTimeOfDay > weatherEntry.DayTime && weatherEntry.DayTime > LastCheckedEntry) { logger.LogInfo((object)$"Changing weather to {weatherEntry.GetWeather().Name} at {weatherEntry.DayTime}"); float num = (float)random.NextDouble(); if (num > weatherEntry.Chance) { logger.LogWarning((object)$"Random roll failed - got {num}, needed {weatherEntry.Chance} or lower"); LastCheckedEntry = weatherEntry.DayTime; break; } NetworkedConfig.SetProgressingWeatherEntry(weatherEntry); ((MonoBehaviour)TimeOfDay.Instance).StartCoroutine(DoMidDayChange(weatherEntry)); LastCheckedEntry = weatherEntry.DayTime; CurrentEntry = weatherEntry; break; } } } [IteratorStateMachine(typeof(<DoMidDayChange>d__12))] internal static IEnumerator DoMidDayChange(ProgressingWeatherEntry entry) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DoMidDayChange>d__12(0) { entry = entry }; } internal static void ShipLandingPatch(SelectableLevel currentLevel, Weather currentWeather) { if (currentWeather is ProgressingWeatherType progressingWeatherType) { SetCurrentWeather(progressingWeatherType); } } internal static void SetCurrentWeather(ProgressingWeatherType weather) { logger.LogInfo((object)("Setting current weather to " + ((Weather)weather).Name)); Reset(); if (random == null) { random = new Random(StartOfRound.Instance.randomMapSeed); } currentWeather = weather; weatherEntries = weather.WeatherEntries.ToList(); CurrentEntry = new ProgressingWeatherEntry { DayTime = 0f, Chance = 1f, Weather = weather.StartingWeather, WeatherName = weather.StartingWeather.WeatherName }; weatherEntries.Sort((ProgressingWeatherEntry a, ProgressingWeatherEntry b) => a.DayTime.CompareTo(b.DayTime)); NetworkedConfig.SetProgressingWeatherEntry(CurrentEntry); ((MonoBehaviour)TimeOfDay.Instance).StartCoroutine(DoMidDayChange(CurrentEntry)); } internal static void Reset() { currentWeather = null; LastCheckedEntry = 0f; weatherEntries = new List<ProgressingWeatherEntry>(); } } public class ConfigHelper { public static Weather GetWeatherFromString(string weatherName) { return ConfigHelper.ResolveStringToWeather(weatherName); } } public class ConfigManager { internal static ConfigFile configFile; public static ConfigManager Instance { get; private set; } public static ConfigEntry<LoggingType> LoggingLevels { get; private set; } public static ConfigEntry<int> FirstDaySeed { get; private set; } public static ConfigEntry<bool> FirstDaySpecial { get; private set; } public static ConfigEntry<bool> FirstDayRandomSeed { get; private set; } public static ConfigEntry<bool> UncertainWeatherEnabled { get; private set; } public static ConfigEntry<bool> GenerateSpecialWeatherEntries { get; private set; } public static ConfigEntry<bool> AlwaysUncertain { get; private set; } public static ConfigEntry<bool> AlwaysUnknown { get; private set; } public static ConfigEntry<bool> AlwaysClear { get; private set; } public static ConfigEntry<float> GameLengthMultiplier { get; private set; } public static ConfigEntry<float> GamePlayersMultiplier { get; private set; } public static ConfigEntry<float> MaxMultiplier { get; private set; } public static ConfigEntry<bool> ScaleDownClearWeather { get; private set; } public static void Init(ConfigFile config) { Instance = new ConfigManager(config); } private ConfigManager(ConfigFile config) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown configFile = config; LoggingLevels = configFile.Bind<LoggingType>("Debug", "Logging levels", (LoggingType)0, "Set the logging level."); UncertainWeatherEnabled = configFile.Bind<bool>("Uncertain Weathers", "UncertainWeatherEnabled", true, "Enable uncertain weather mechanic: some planets will not display current weather"); MaxMultiplier = configFile.Bind<float>("Multiplier Settings", "MaxMultiplier", 0.8f, new ConfigDescription("Maximum difficulty multiplier (between 0 and 1). Overrides GameLengthMultiplier and GamePlayersMultiplier", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); ScaleDownClearWeather = configFile.Bind<bool>("Multiplier Settings", "ScaleDownClearWeather", true, "Scale down clear weather's weight to keep its % chance the same, no matter how many weathers are in the pool"); GameLengthMultiplier = configFile.Bind<float>("Difficulty Multiplier Settings", "GameLengthMultiplier", 0.05f, "Difficulty multiplier - game length (quotas done)"); GamePlayersMultiplier = configFile.Bind<float>("Difficulty Multiplier Settings", "GamePlayersMultiplier", 0.01f, "Difficulty multiplier - players amount"); FirstDaySeed = configFile.Bind<int>("First Day", "FirstDaySeed", 0, "Seed for the first day's weather."); FirstDaySpecial = configFile.Bind<bool>("First Day", "FirstDaySpecial", true, "Enable a vanilla-like weather picking algorithm for the first day."); FirstDayRandomSeed = configFile.Bind<bool>("First Day", "FirstDayRandomSeed", true, "Use random seed for the first day's weather. Works independently from ButteryFixes."); GenerateSpecialWeatherEntries = configFile.Bind<bool>("Special Weather Configs", "GenerateSpecialWeatherEntries", false, "Generate special weather entries' in Registry config."); AlwaysUncertain = configFile.Bind<bool>("Special Modes", "AlwaysUncertain", false, "Always make weather uncertain"); AlwaysUnknown = configFile.Bind<bool>("Special Modes", "AlwaysUnknown", false, "Always make weather unknown"); AlwaysClear = configFile.Bind<bool>("Special Modes", "AlwaysClear", false, "Always make weather clear - good for testing"); } } public static class DisplayTable { public static void DisplayWeathersTable() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown if (!Variables.IsSetupFinished) { return; } ConsoleTable val = new ConsoleTable(new string[3] { "Planet", "Level weather", "Uncertain weather" }); if ((Object)(object)StartOfRound.Instance == (Object)null) { return; } List<SelectableLevel> sortedLevels = LevelHelper.SortedLevels; foreach (SelectableLevel item in sortedLevels) { bool flag = UncertainWeather.uncertainWeathers.ContainsKey(item.PlanetName); val.AddRow(new object[3] { StringResolver.GetNumberlessName(item), Variables.GetPlanetCurrentWeather(item, uncertain: false), flag ? UncertainWeather.uncertainWeathers[item.PlanetName] : "" }); } Plugin.logger.LogMessage((object)("Currently set weathers: \n" + val.ToMinimalString())); } } public class Init { public static void InitMethod() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Expected O, but got Unknown //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Expected O, but got Unknown //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Expected O, but got Unknown //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Expected O, but got Unknown //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Expected O, but got Unknown //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Expected O, but got Unknown //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Expected O, but got Unknown //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Expected O, but got Unknown //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Expected O, but got Unknown //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Expected O, but got Unknown //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Expected O, but got Unknown //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: 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_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Expected O, but got Unknown //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Expected O, but got Unknown //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Expected O, but got Unknown //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Expected O, but got Unknown //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Expected O, but got Unknown //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Expected O, but got Unknown //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Expected O, but got Unknown //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Expected O, but got Unknown //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Expected O, but got Unknown //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Expected O, but got Unknown //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Expected O, but got Unknown //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Expected O, but got Unknown //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Expected O, but got Unknown //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Expected O, but got Unknown //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0435: Expected O, but got Unknown //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Expected O, but got Unknown //IL_0471: Expected O, but got Unknown //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Expected O, but got Unknown //IL_04ce: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Expected O, but got Unknown //IL_04e7: Expected O, but got Unknown //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_0517: Unknown result type (might be due to invalid IL or missing references) //IL_0521: Expected O, but got Unknown //IL_0544: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Expected O, but got Unknown //IL_055d: Expected O, but got Unknown //IL_0564: Unknown result type (might be due to invalid IL or missing references) //IL_058d: Unknown result type (might be due to invalid IL or missing references) //IL_0597: Expected O, but got Unknown //IL_05a6: Expected O, but got Unknown //IL_05ad: Unknown result type (might be due to invalid IL or missing references) //IL_05d6: Unknown result type (might be due to invalid IL or missing references) //IL_05e0: Expected O, but got Unknown //IL_05ef: Expected O, but got Unknown //IL_05f6: Unknown result type (might be due to invalid IL or missing references) //IL_061f: Unknown result type (might be due to invalid IL or missing references) //IL_0629: Expected O, but got Unknown //IL_0638: Expected O, but got Unknown //IL_063f: Unknown result type (might be due to invalid IL or missing references) //IL_0668: Unknown result type (might be due to invalid IL or missing references) //IL_0672: Expected O, but got Unknown //IL_0681: Expected O, but got Unknown //IL_0694: Unknown result type (might be due to invalid IL or missing references) //IL_06c1: Unknown result type (might be due to invalid IL or missing references) //IL_06cb: Expected O, but got Unknown //IL_06da: Expected O, but got Unknown //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Expected O, but got Unknown //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Expected O, but got Unknown //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Expected O, but got Unknown //IL_03e7: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Expected O, but got Unknown //IL_06ed: Unknown result type (might be due to invalid IL or missing references) //IL_071a: Unknown result type (might be due to invalid IL or missing references) //IL_0724: Expected O, but got Unknown //IL_0733: Expected O, but got Unknown new CombinedWeatherType("Eclipsed + Flooded", new List<WeatherResolvable>(2) { (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)5), (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)4) }); new CombinedWeatherType("Foggy + Rainy", new List<WeatherResolvable>(2) { (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)3), (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)1) }); new CombinedWeatherType("Eclipsed + Rainy", new List<WeatherResolvable>(2) { (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)5), (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)1) }); new CombinedWeatherType("Stormy + Rainy", new List<WeatherResolvable>(2) { (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)2), (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)1) }); new CombinedWeatherType("Stormy + Flooded", new List<WeatherResolvable>(2) { (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)2), (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)4) }); new CombinedWeatherType("Foggy + Flooded", new List<WeatherResolvable>(2) { (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)3), (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)4) }); new CombinedWeatherType("Foggy + Eclipsed", new List<WeatherResolvable>(2) { (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)3), (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)5) }); new CombinedWeatherType("Stormy + Rainy + Eclipsed", new List<WeatherResolvable>(3) { (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)2), (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)1), (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)5) }); new CombinedWeatherType("Stormy + Rainy + Flooded", new List<WeatherResolvable>(3) { (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)2), (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)1), (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)4) }); new CombinedWeatherType("Stormy + Rainy + Flooded + Eclipsed", new List<WeatherResolvable>(4) { (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)2), (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)1), (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)4), (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)5) }); if (((CompatibilityBase)Plugin.MrovWeathersCompat).IsModPresent) { new CombinedWeatherType("Rainy + Blackout", new List<WeatherResolvable>(2) { (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)1), (WeatherResolvable)new WeatherNameResolvable("blackout") }); new CombinedWeatherType("Foggy + Blackout", new List<WeatherResolvable>(2) { (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)3), (WeatherResolvable)new WeatherNameResolvable("blackout") }); new CombinedWeatherType("Eclipsed + Blackout", new List<WeatherResolvable>(2) { (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)5), (WeatherResolvable)new WeatherNameResolvable("blackout") }); } if (((CompatibilityBase)Plugin.LethalElementsCompat).IsModPresent) { new CombinedWeatherType("Stormy + Solar Flare", new List<WeatherResolvable>(2) { (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)2), (WeatherResolvable)new WeatherNameResolvable("solarflare") }); new CombinedWeatherType("Foggy + Solar Flare", new List<WeatherResolvable>(2) { (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)3), (WeatherResolvable)new WeatherNameResolvable("solarflare") }); new CombinedWeatherType("Foggy + Snowfall", new List<WeatherResolvable>(2) { (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)3), (WeatherResolvable)new WeatherNameResolvable("snowfall") }); new CombinedWeatherType("Eclipsed + Snowfall", new List<WeatherResolvable>(2) { (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)5), (WeatherResolvable)new WeatherNameResolvable("snowfall") }); } if (((CompatibilityBase)Plugin.MrovWeathersCompat).IsModPresent && ((CompatibilityBase)Plugin.LethalElementsCompat).IsModPresent) { new CombinedWeatherType("Blackout + Solar Flare", new List<WeatherResolvable>(2) { (WeatherResolvable)new WeatherNameResolvable("blackout"), (WeatherResolvable)new WeatherNameResolvable("solarflare") }); new CombinedWeatherType("Blackout + Snowfall", new List<WeatherResolvable>(2) { (WeatherResolvable)new WeatherNameResolvable("blackout"), (WeatherResolvable)new WeatherNameResolvable("snowfall") }); } new ProgressingWeatherType("None > Foggy", (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)(-1)), new List<ProgressingWeatherEntry>(2) { new ProgressingWeatherEntry { DayTime = 0.25f, Chance = 0.8f, Weather = (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)3) }, new ProgressingWeatherEntry { DayTime = 0.75f, Chance = 1f, Weather = (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)3) } }); new ProgressingWeatherType("None > Stormy", (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)(-1)), new List<ProgressingWeatherEntry>(2) { new ProgressingWeatherEntry { DayTime = 0.35f, Chance = 0.35f, Weather = (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)2) }, new ProgressingWeatherEntry { DayTime = 0.75f, Chance = 1f, Weather = (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)2) } }); new ProgressingWeatherType("Eclipsed > Foggy", (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)5), new List<ProgressingWeatherEntry>(2) { new ProgressingWeatherEntry { DayTime = 0.4f, Chance = 0.5f, Weather = (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)3) }, new ProgressingWeatherEntry { DayTime = 0.85f, Chance = 1f, Weather = (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)3) } }); new ProgressingWeatherType("Foggy > None", (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)3), new List<ProgressingWeatherEntry>(1) { new ProgressingWeatherEntry { DayTime = 0.45f, Chance = 1f, Weather = (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)(-1)) } }); new ProgressingWeatherType("Eclipsed > None", (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)5), new List<ProgressingWeatherEntry>(1) { new ProgressingWeatherEntry { DayTime = 0.66f, Chance = 1f, Weather = (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)(-1)) } }); new ProgressingWeatherType("Stormy > Rainy", (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)2), new List<ProgressingWeatherEntry>(1) { new ProgressingWeatherEntry { DayTime = 0.55f, Chance = 1f, Weather = (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)1) } }); new ProgressingWeatherType("Rainy > Eclipsed", (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)1), new List<ProgressingWeatherEntry>(1) { new ProgressingWeatherEntry { DayTime = 0.66f, Chance = 1f, Weather = (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)5) } }); if (((CompatibilityBase)Plugin.MrovWeathersCompat).IsModPresent) { new ProgressingWeatherType("None > Blackout", (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)(-1)), new List<ProgressingWeatherEntry>(1) { new ProgressingWeatherEntry { DayTime = 0.66f, Chance = 1f, Weather = (WeatherResolvable)new WeatherNameResolvable("blackout") } }); } if (((CompatibilityBase)Plugin.LethalElementsCompat).IsModPresent) { new ProgressingWeatherType("None > Heatwave", (WeatherResolvable)new WeatherTypeResolvable((LevelWeatherType)(-1)), new List<ProgressingWeatherEntry>(1) { new ProgressingWeatherEntry { DayTime = 0.45f, Chance = 1f, Weather = (WeatherResolvable)new WeatherNameResolvable("heatwave") } }); } } } public class Logger : Logger { public Logger(string SourceName, LoggingType defaultLoggingType = 1) : base(SourceName, defaultLoggingType) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) ((Logger)this).ModName = SourceName; ((Logger)this).LogSource = Logger.CreateLogSource("WeatherTweaks"); ((Logger)this)._name = SourceName; } public override bool ShouldLog(LoggingType type) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return ConfigManager.LoggingLevels.Value >= type; } } public class MudPatches { [CompilerGenerated] private sealed class <SpawnMudPatches>d__2 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private Random <seededRandom>5__2; private NavMeshHit <navHit>5__3; private int <numberOfPuddles>5__4; private int <i>5__5; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SpawnMudPatches>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <seededRandom>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00cd: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; logger.LogDebug((object)"Spawning mud patches!"); if (random == null) { random = new Random(StartOfRound.Instance.randomMapSeed); } <seededRandom>5__2 = new Random(StartOfRound.Instance.randomMapSeed + 2); <navHit>5__3 = default(NavMeshHit); <numberOfPuddles>5__4 = random.Next(5, 15); if (random.Next(0, 100) < 7) { <numberOfPuddles>5__4 = random.Next(5, 30); } <i>5__5 = 0; break; case 1: <>1__state = -1; <i>5__5++; break; } if (<i>5__5 < <numberOfPuddles>5__4) { Vector3 val = TryGetValidMudPick(<seededRandom>5__2, <navHit>5__3) + Vector3.up; Object.Instantiate<GameObject>(RoundManager.Instance.quicksandPrefab, val, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform); <>2__current = null; <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } internal static Random random; internal static ManualLogSource logger = Logger.CreateLogSource("WeatherTweaks MudPatch"); [IteratorStateMachine(typeof(<SpawnMudPatches>d__2))] internal static IEnumerator SpawnMudPatches() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SpawnMudPatches>d__2(0); } internal static bool IsMudPickValid(Vector3 position) { //IL_0000: 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_0009: 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) //IL_0039: 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 (position == default(Vector3)) { return false; } float num = 100f; bool result = true; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (Vector3.SqrMagnitude(position - ((Component)val).transform.position) < num) { result = false; break; } } return result; } internal static Vector3 TryGetValidMudPick(Random seededRandom, NavMeshHit navHit) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) Vector3 val = default(Vector3); int i = 0; for (int num = 10; i < num; i++) { if (IsMudPickValid(val)) { break; } val = RoundManager.Instance.outsideAINodes[seededRandom.Next(0, RoundManager.Instance.outsideAINodes.Length)].transform.position; val = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(val, 30f, navHit, seededRandom, -1, 1f) + Vector3.up; } return val; } } internal class NetworkedConfig { public static LethalNetworkVariable<string> currentWeatherStringsSynced = new LethalNetworkVariable<string>("previousWeatherStrings"); public static LethalNetworkVariable<string> currentProgressingWeatherEntry = new LethalNetworkVariable<string>("currentProgressingWeatherEntry"); public static void Init() { currentWeatherStringsSynced.OnValueChanged += WeatherDisplayDataReceived; currentProgressingWeatherEntry.OnValueChanged += ProgressingWeatherEntryReceived; } public static void WeatherDisplayDataReceived(string weatherData) { Dictionary<string, string> dictionary = JsonConvert.DeserializeObject<Dictionary<string, string>>(weatherData); if (dictionary != null && !((NetworkBehaviour)StartOfRound.Instance).IsHost) { Plugin.logger.LogInfo((object)("Received weather display data " + weatherData + " from server, applying")); UncertainWeather.uncertainWeathers = dictionary; StartOfRound.Instance.SetMapScreenInfoToCurrentLevel(); } } public static void ProgressingWeatherEntryReceived(string progressingWeatherEntry) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown ProgressingWeatherEntry progressingWeatherEntry2 = JsonConvert.DeserializeObject<ProgressingWeatherEntry>(progressingWeatherEntry); if (progressingWeatherEntry2 != null && !((NetworkBehaviour)StartOfRound.Instance).IsHost) { Plugin.logger.LogWarning((object)("Received progressing weather entry data " + progressingWeatherEntry + " from server, applying")); progressingWeatherEntry2.Weather = (WeatherResolvable)new WeatherNameResolvable(progressingWeatherEntry2.WeatherName); ((MonoBehaviour)TimeOfDay.Instance).StartCoroutine(ChangeMidDay.DoMidDayChange(progressingWeatherEntry2)); } } public static void SetDisplayWeather(Dictionary<string, string> uncertainWeathers) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown string text = JsonConvert.SerializeObject((object)uncertainWeathers, (Formatting)0, new JsonSerializerSettings { ReferenceLoopHandling = (ReferenceLoopHandling)1 }); currentWeatherStringsSynced.Value = text; Plugin.logger.LogInfo((object)("Set weather display data on server: " + text)); } public static void SetProgressingWeatherEntry(ProgressingWeatherEntry entry) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown if (entry != null) { entry.WeatherName = entry.Weather.WeatherName; } string text = JsonConvert.SerializeObject((object)entry, (Formatting)0, new JsonSerializerSettings { ReferenceLoopHandling = (ReferenceLoopHandling)1 }); Plugin.logger.LogInfo((object)("Set progressing weather entry on server: " + text)); currentProgressingWeatherEntry.Value = text; } } [HarmonyPatch(typeof(EclipseWeather))] [HarmonyPatch(typeof(FloodWeather))] [HarmonyPatch(typeof(StormyWeather))] internal class BasegameWeatherPatch { internal static Logger logger = new Logger("BaseGameWeatherPatches", (LoggingType)1); internal static Harmony harmony = new Harmony("WeatherTweaks.BaseGame"); private static FieldInfo metalObjects = AccessTools.Field(typeof(StormyWeather), "metalObjects"); [HarmonyTranspiler] [HarmonyPatch(typeof(EclipseWeather), "OnEnable")] private static IEnumerable<CodeInstruction> EclipseOnEnablePatch(IEnumerable<CodeInstruction> instructions) { return CurrentWeatherVariablePatch(instructions, (LevelWeatherType)5, "EclipseWeather.OnEnable"); } [HarmonyTranspiler] [HarmonyPatch(typeof(FloodWeather), "OnEnable")] private static IEnumerable<CodeInstruction> FloodedOnEnablePatch(IEnumerable<CodeInstruction> instructions) { return CurrentWeatherVariablePatch(instructions, (LevelWeatherType)4, "FloodWeather.OnEnable"); } [HarmonyTranspiler] [HarmonyPatch(typeof(FloodWeather), "OnGlobalTimeSync")] private static IEnumerable<CodeInstruction> FloodedOnGlobalTimeSyncPatch(IEnumerable<CodeInstruction> instructions) { return CurrentWeatherVariable2Patch(instructions, (LevelWeatherType)4, "FloodWeather.OnGlobalTimeSync"); } [HarmonyTranspiler] [HarmonyPatch(typeof(FloodWeather), "Update")] private static IEnumerable<CodeInstruction> FloodedUpdatePatch(IEnumerable<CodeInstruction> instructions) { return CurrentWeatherVariablePatch(instructions, (LevelWeatherType)4, "FloodWeather.Update"); } [HarmonyPostfix] [HarmonyPatch(typeof(FloodWeather), "OnEnable")] private static void FloodedOnEnablePostfix(FloodWeather __instance) { __instance.floodLevelOffset = Mathf.Clamp(TimeOfDay.Instance.globalTime / 1080f, 0f, 100f) * Variables.GetLevelWeatherVariable((LevelWeatherType)4, variable2: true); ((Logger)logger).LogWarning($"Enabling FloodWeather with level offset {__instance.floodLevelOffset}"); } internal static IEnumerable<CodeInstruction> VariablePatch(IEnumerable<CodeInstruction> instructions, LevelWeatherType weatherType, string wherefrom, bool variable1 = true) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) ((Logger)logger).LogInfo($"Patching {wherefrom} for {weatherType}"); CodeMatcher codeMatcher = new CodeMatcher(instructions, (ILGenerator)null); CodeMatch val = new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(TimeOfDay), "currentWeatherVariable"), (string)null); CodeMatch val2 = new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(TimeOfDay), "currentWeatherVariable2"), (string)null); codeMatcher = codeMatcher.MatchForward(false, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(TimeOfDay), "Instance", (Type[])null, (Type[])null), (string)null), variable1 ? val : val2 }); ((Logger)logger).LogDebug($"Matched Ldfld for {wherefrom} for {weatherType}"); codeMatcher.Repeat((Action<CodeMatcher>)delegate { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected I4, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown ((Logger)logger).LogInfo($"Matched Ldfld for {wherefrom} for {weatherType}"); codeMatcher.RemoveInstruction(); codeMatcher.RemoveInstruction(); codeMatcher.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Ldc_I4, (object)(int)weatherType) }); codeMatcher.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Ldc_I4, (object)((!variable1) ? 1 : 0)) }); codeMatcher.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Variables), "GetLevelWeatherVariable", (Type[])null, (Type[])null)) }); }, (Action<string>)null); ((Logger)logger).LogDebug($"Patched {wherefrom} for {weatherType}"); return codeMatcher.InstructionEnumeration(); } internal static IEnumerable<CodeInstruction> CurrentWeatherVariablePatch(IEnumerable<CodeInstruction> instructions, LevelWeatherType weatherType, string wherefrom) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return VariablePatch(instructions, weatherType, wherefrom); } internal static IEnumerable<CodeInstruction> CurrentWeatherVariable2Patch(IEnumerable<CodeInstruction> instructions, LevelWeatherType weatherType, string wherefrom) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return VariablePatch(instructions, weatherType, wherefrom, variable1: false); } [HarmonyTranspiler] [HarmonyPatch(typeof(StormyWeather), "DetermineNextStrikeInterval")] private static IEnumerable<CodeInstruction> StormyDetermineNextStrikePatch(IEnumerable<CodeInstruction> instructions) { return CurrentWeatherVariablePatch(instructions, (LevelWeatherType)2, "StormyWeather.DetermineNextStrikeInterval"); } [HarmonyTranspiler] [HarmonyPatch(typeof(StormyWeather), "LightningStrikeRandom")] private static IEnumerable<CodeInstruction> StormyLightningStrikeRandomPatch(IEnumerable<CodeInstruction> instructions) { return CurrentWeatherVariablePatch(instructions, (LevelWeatherType)2, "StormyWeather.StormyLightningStrikeRandomPatch"); } [HarmonyPostfix] [HarmonyPatch(typeof(StormyWeather), "OnEnable")] private static void StormyOnEnablePostfix(StormyWeather __instance) { __instance.timeAtLastStrike = TimeOfDay.Instance.globalTime + 45f; ((Logger)logger).LogWarning($"StormyWeather.Enable: {__instance.randomThunderTime} {__instance.timeAtLastStrike}"); } [HarmonyPatch(typeof(StormyWeather), "OnDisable")] [HarmonyPostfix] public static void Fix_StormyNullRef(ref StormyWeather __instance) { ((List<GrabbableObject>)metalObjects.GetValue(__instance)).Clear(); } } public static class DisableAllWeathers { internal static void DisableAllWeather() { ChangeMidDay.Reset(); if (((NetworkBehaviour)StartOfRound.Instance).IsHost) { NetworkedConfig.SetProgressingWeatherEntry(null); } } } internal class LobbyCompatibilityCompatibility { public static void Init() { Plugin.logger.LogWarning((object)"LobbyCompatibility detected, registering plugin with LobbyCompatibility."); Version version = Version.Parse("1.1.9"); PluginHelper.RegisterPlugin("WeatherTweaks", version, (CompatibilityLevel)2, (VersionStrictness)0); } } [HarmonyPatch(typeof(StartOfRound))] public static class SetPlanetsWeatherPatch { [HarmonyPatch("SetPlanetsWeather")] [HarmonyPrefix] [HarmonyAfter(new string[] { "mrov.WeatherRegistry" })] private static bool GameMethodPatch(int connectedPlayersOnServer, StartOfRound __instance) { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) Plugin.logger.LogMessage((object)"SetPlanetsWeather called."); if (!Variables.IsSetupFinished || !WeatherManager.IsSetupFinished) { Plugin.logger.LogWarning((object)"Setup not finished"); return true; } if ((Object)(object)__instance == (Object)null) { Plugin.logger.LogWarning((object)"Instance is null"); return true; } List<SelectableLevel> gameLevels = Variables.GetGameLevels(); if (gameLevels == null) { Plugin.logger.LogWarning((object)"Levels are null"); return true; } ChangeMidDay.Reset(); Settings.IsPlayerInside = false; bool hasValue = GameNetworkManager.Instance.currentLobby.HasValue; if (((NetworkBehaviour)__instance).IsHost) { Dictionary<string, string> displayWeather = UncertainWeather.GenerateUncertainty(); NetworkedConfig.SetDisplayWeather(displayWeather); __instance.SetMapScreenInfoToCurrentLevel(); if (hasValue) { Lobby? currentLobby = GameNetworkManager.Instance.currentLobby; if (currentLobby.HasValue) { Lobby valueOrDefault = currentLobby.GetValueOrDefault(); ((Lobby)(ref valueOrDefault)).SetData("WeatherTweaks", "true"); } } } return false; } [HarmonyPatch("SetPlanetsWeather")] [HarmonyPostfix] private static void DisplayCurrentWeathers() { DisplayTable.DisplayWeathersTable(); } } [BepInPlugin("WeatherTweaks", "WeatherTweaks", "1.1.9")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Event <>9__6_0; public static Event <>9__6_1; public static ParameterEvent<(SelectableLevel level, Weather weather)> <>9__6_2; public static ParameterEvent<Terminal> <>9__6_3; public static ParameterEvent<StartOfRound> <>9__6_4; internal void <Awake>b__6_0() { DisableAllWeathers.DisableAllWeather(); } internal void <Awake>b__6_1() { TerminalStartPatch.Start(); } internal void <Awake>b__6_2((SelectableLevel level, Weather weather) args) { ChangeMidDay.ShipLandingPatch(args.level, args.weather); } internal void <Awake>b__6_3(Terminal terminal) { TerminalPatch.Postfix(); } internal void <Awake>b__6_4(StartOfRound startofround) { Reset.ResetThings(); } } internal static ManualLogSource logger; internal static Logger DebugLogger = new Logger("Debug", (LoggingType)1); internal static bool IsLLLPresent = false; internal static GeneralImprovementsCompat GeneralImprovements; internal static MrovWeathersCompat MrovWeathersCompat; internal static LethalElementsCompat LethalElementsCompat; private void Awake() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown logger = ((BaseUnityPlugin)this).Logger; ConfigManager.Init(((BaseUnityPlugin)this).Config); Harmony val = new Harmony("WeatherTweaks"); val.PatchAll(); NetworkedConfig.Init(); UncertainWeather.Init(); WeatherRegistryEvent disableAllWeathers = EventManager.DisableAllWeathers; object obj = <>c.<>9__6_0; if (obj == null) { Event val2 = delegate { DisableAllWeathers.DisableAllWeather(); }; <>c.<>9__6_0 = val2; obj = (object)val2; } ((CustomEvent)disableAllWeathers).AddListener((Event)obj); WeatherRegistryEvent setupFinished = EventManager.SetupFinished; object obj2 = <>c.<>9__6_1; if (obj2 == null) { Event val3 = delegate { TerminalStartPatch.Start(); }; <>c.<>9__6_1 = val3; obj2 = (object)val3; } ((CustomEvent)setupFinished).AddListener((Event)obj2); ((CustomEvent<(SelectableLevel, Weather)>)(object)EventManager.ShipLanding).AddListener((ParameterEvent<(SelectableLevel, Weather)>)delegate((SelectableLevel level, Weather weather) args) { ChangeMidDay.ShipLandingPatch(args.level, args.weather); }); if (Settings.WeatherSelectionAlgorithm != WeatherCalculation.VanillaAlgorithm) { WeatherCalculation.WeatherSelectionAlgorithm = (WeatherSelectionAlgorithm)(object)WeatherCalculation.weatherTweaksWeatherAlgorithm; } EventManager.TerminalStart.AddListener((ParameterEvent<Terminal>)delegate { TerminalPatch.Postfix(); }); EventManager.LobbyDisabled.AddListener((ParameterEvent<StartOfRound>)delegate { Reset.ResetThings(); }); if (Chainloader.PluginInfos.ContainsKey("imabatby.lethallevelloader")) { LLL.Init(); } MethodInfo method = typeof(StartOfRound).GetMethod("SetPlanetsWeather"); val.Unpatch((MethodBase)method, (HarmonyPatchType)2, "imabatby.lethallevelloader"); GeneralImprovements = new GeneralImprovementsCompat("ShaosilGaming.GeneralImprovements"); MrovWeathersCompat = new MrovWeathersCompat("MrovWeathers"); LethalElementsCompat = new LethalElementsCompat("voxx.LethalElementsPlugin", "1.3.0"); if (Chainloader.PluginInfos.ContainsKey("xxxstoner420bongmasterxxx.open_monitors")) { OpenMonitorsCompat.Init(); } if (Chainloader.PluginInfos.ContainsKey("BMX.LobbyCompatibility")) { LobbyCompatibilityCompatibility.Init(); } Init.InitMethod(); logger.LogInfo((object)"\n .::. \n :==: \n :-. :==: .-: \n .-==-. .::. .-===. \n .-=- .:----:. -==. \n -==========- \n ============== \n .-==========- :----- \n :-==-:. .=========- :----- \n .========: .-===== \n ============-. :==- \n -=============. . -==. \n :-==========: .-==-. \n ...... .-: "); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin WeatherTweaks is loaded!"); } } public static class TerminalPatch { public static void Postfix() { if (((CompatibilityBase)Plugin.GeneralImprovements).IsModPresent) { Plugin.logger.LogInfo((object)"GeneralImprovements is present"); GeneralImprovementsCompat.Init(); } } } internal class UncertainTypes { public class Uncertain : UncertainWeatherType { public Uncertain() : base("Uncertain") { } public override string CreateUncertaintyString(SelectableLevel level, Random random) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) Weather weather = WeatherManager.GetWeather(level.currentWeather); List<RandomWeatherWithVariables> list = level.randomWeathers.Where((RandomWeatherWithVariables w) => w.weatherType != weather.VanillaWeatherType).ToList(); if (list.Count == 0) { return weather.name; } Weather weather2 = WeatherManager.GetWeather(list[random.Next(list.Count)].weatherType); if (random.Next(0, 3) == 0) { return weather2.name + "?"; } return weather.name + "?"; } } public class Uncertain5050 : UncertainWeatherType { public Uncertain5050() : base("Uncertain5050") { } public override string CreateUncertaintyString(SelectableLevel level, Random random) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) Weather weather = WeatherManager.GetWeather(level.currentWeather); List<RandomWeatherWithVariables> list = level.randomWeathers.Where((RandomWeatherWithVariables w) => w.weatherType != weather.VanillaWeatherType).ToList(); if (list.Count == 0) { return ((object)weather).ToString(); } Weather weather2 = WeatherManager.GetWeather(list[random.Next(list.Count)].weatherType); if (random.Next(0, 2) == 0) { return weather.name + "/" + weather2.name; } return weather2.name + "/" + weather.name; } } public class Unknown : UncertainWeatherType { public Unknown() : base("Unknown") { } public override string CreateUncertaintyString(SelectableLevel level, Random random) { return "[UNKNOWN]"; } } } internal class UncertainWeather { public static Dictionary<string, string> uncertainWeathers = new Dictionary<string, string>(); public static List<UncertainWeatherType> uncertainWeatherTypes = new List<UncertainWeatherType>(); public static void Init() { Plugin.logger.LogInfo((object)"UncertainWeather initialized."); uncertainWeatherTypes = new List<UncertainWeatherType>(3) { new UncertainTypes.Uncertain(), new UncertainTypes.Uncertain5050(), new UncertainTypes.Unknown() }; } public static Dictionary<string, string> GenerateUncertainty() { uncertainWeathers.Clear(); if (!ConfigManager.UncertainWeatherEnabled.Value) { Plugin.logger.LogInfo((object)"Uncertain weathers are disabled."); if (ConfigManager.AlwaysUncertain.Value) { Plugin.logger.LogWarning((object)"AlwaysUncertain is enabled, but uncertain weathers are disabled. Uncertainty will not be generated!"); } return uncertainWeathers; } if (StartOfRound.Instance.gameStats.daysSpent == 0 && !ConfigManager.AlwaysUncertain.Value && !ConfigManager.AlwaysUnknown.Value) { Plugin.logger.LogInfo((object)"It's the first day, no uncertainty will be generated."); return uncertainWeathers; } Plugin.logger.LogInfo((object)"GenerateUncertainty called."); StartOfRound instance = StartOfRound.Instance; Random random = new Random(instance.randomMapSeed + 31); int num = Mathf.Clamp((int)((double)Mathf.Clamp(instance.planetsWeatherRandomCurve.Evaluate((float)random.NextDouble()) * 0.4f, 0f, 1f) * (double)Variables.GameLevels.Count), 1, Variables.GameLevels.Count - 2); if (ConfigManager.AlwaysUncertain.Value || ConfigManager.AlwaysUnknown.Value) { num = Variables.GameLevels.Count; } Plugin.logger.LogDebug((object)$"howManyPlanetsUncertain: {num}"); List<SelectableLevel> list = new List<SelectableLevel>(); for (int i = 0; i < num; i++) { SelectableLevel val = Variables.GameLevels[random.Next(Variables.GameLevels.Count)]; if (!((Object)(object)val == (Object)(object)LevelHelper.CompanyMoon)) { if (!list.Contains(val)) { list.Add(val); } else { i--; } } } Dictionary<string, string> dictionary = new Dictionary<string, string>(); List<UncertainWeatherType> list2 = new List<UncertainWeatherType>(); foreach (UncertainWeatherType uncertainWeatherType in uncertainWeatherTypes) { if (uncertainWeatherType.Enabled.Value) { list2.Add(uncertainWeatherType); } } if (ConfigManager.AlwaysUnknown.Value) { Plugin.logger.LogDebug((object)"Setting possible types to only unknown."); list2 = new List<UncertainWeatherType>(1) { new UncertainTypes.Unknown() }; } Plugin.logger.LogDebug((object)$"uncertainTypes: {list2.Count}"); if (list2.Count == 0) { Plugin.logger.LogInfo((object)"No uncertain types are enabled, skipping uncertainty generation."); return uncertainWeathers; } foreach (SelectableLevel item in list) { int index = random.Next(list2.Count); string text = list2[index].CreateUncertaintyString(item, random); Plugin.logger.LogDebug((object)("Rolled type: " + list2[index].Name + ", setting its uncertainty to " + text + ".")); dictionary.Add(item.PlanetName, text); } uncertainWeathers = dictionary; return dictionary; } } internal class Variables { internal static bool IsSetupFinished = false; public static List<CombinedWeatherType> CombinedWeathers = new List<CombinedWeatherType>(); public static List<ProgressingWeatherType> ProgressingWeathers = new List<ProgressingWeatherType>(); private static List<WeatherTweaksWeather> _weatherTweaksTypes = new List<WeatherTweaksWeather>(); public static List<ImprovedWeatherEffect> CurrentEffects = new List<ImprovedWeatherEffect>(); internal static List<SelectableLevel> GameLevels => LevelHelper.Levels; internal static Weather NoneWeather => WeatherManager.NoneWeather; public static List<LevelWeatherType> CombinedWeatherTypes => CombinedWeathers.Select((CombinedWeatherType x) => ((Weather)x).VanillaWeatherType).ToList(); public static List<LevelWeatherType> ProgressingWeatherTypes => ProgressingWeathers.Select((ProgressingWeatherType x) => ((Weather)x).VanillaWeatherType).ToList(); public static List<Weather> WeatherTypes => WeatherManager.Weathers; public static List<WeatherTweaksWeather> WeatherTweaksTypes { get { if (_weatherTweaksTypes.Count == 0) { foreach (Weather weatherType in WeatherTypes) { if (weatherType != null) { if (weatherType is WeatherTweaksWeather item) { Plugin.logger.LogDebug((object)("Weather " + weatherType.Name + " is a WeatherTweaks weather")); _weatherTweaksTypes.Add(item); } else { _weatherTweaksTypes.Add(new WeatherTweaksWeather(weatherType)); } } } } return _weatherTweaksTypes; } set { _weatherTweaksTypes = value; } } public static List<WeatherTweaksWeather> SpecialWeathers => CombinedWeathers.Cast<WeatherTweaksWeather>().Concat(ProgressingWeathers).ToList(); public static List<LevelWeatherType> WeatherTweaksWeathers => SpecialWeathers.Select((WeatherTweaksWeather x) => ((Weather)x).VanillaWeatherType).ToList(); public static WeatherTweaksWeather CurrentLevelWeather => GetFullWeatherType(StartOfRound.Instance.currentLevel.currentWeather); public static WeatherTweaksWeather GetCurrentWeather() { if (CurrentLevelWeather.CustomType == CustomWeatherType.Progressing) { if (ChangeMidDay.CurrentEntry == null) { Plugin.logger.LogWarning((object)"Current entry is null"); return CurrentLevelWeather; } return (WeatherTweaksWeather)(object)ChangeMidDay.CurrentEntry.GetWeather(); } return CurrentLevelWeather; } internal static Dictionary<int, LevelWeatherType> GetWeatherData(string weatherData) { return JsonConvert.DeserializeObject<Dictionary<int, LevelWeatherType>>(weatherData); } internal static List<SelectableLevel> GetGameLevels() { return GameLevels; } internal static List<WeatherTweaksWeather> GetPlanetWeatherTypes(SelectableLevel level, bool specialWeathers = false) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) List<LevelWeatherType> planetPossibleWeathers = WeatherManager.GetPlanetPossibleWeathers(level); if (planetPossibleWeathers.Count() == 0) { Plugin.logger.LogError((object)"Random weathers are empty"); return new List<WeatherTweaksWeather>(); } List<WeatherTweaksWeather> list = new List<WeatherTweaksWeather>(); foreach (WeatherTweaksWeather weatherTweaksType in WeatherTweaksTypes) { if (planetPossibleWeathers.Contains(((Weather)weatherTweaksType).VanillaWeatherType)) { list.Add(weatherTweaksType); } } if (specialWeathers) { foreach (WeatherTweaksWeather weather in SpecialWeathers) { switch (weather.CustomType) { case CustomWeatherType.Combined: { CombinedWeatherType combinedWeatherType = CombinedWeathers.Find((CombinedWeatherType x) => ((Weather)x).Name == ((Weather)weather).Name); if (combinedWeatherType.CanWeatherBeApplied(level)) { list.Add(weather); } break; } case CustomWeatherType.Progressing: { ProgressingWeatherType progressingWeatherType = ProgressingWeathers.Find((ProgressingWeatherType x) => ((Weather)x).Name == ((Weather)weather).Name); if (progressingWeatherType.CanWeatherBeApplied(level)) { list.Add(weather); } break; } } } } return list.Distinct().ToList(); } public static string GetPlanetCurrentWeather(SelectableLevel level, bool uncertain = true) { //IL_0084: Unknown result type (might be due to invalid IL or missing references) bool flag = UncertainWeather.uncertainWeathers.ContainsKey(level.PlanetName); if (!IsSetupFinished) { ((Logger)Plugin.DebugLogger).LogDebug("Setup is not finished yet"); return ((object)(LevelWeatherType)(ref level.currentWeather)).ToString(); } if (flag && uncertain) { ((Logger)Plugin.DebugLogger).LogDebug("Getting uncertain weather for " + level.PlanetName); return UncertainWeather.uncertainWeathers[level.PlanetName]; } ((Logger)Plugin.DebugLogger).LogDebug("Getting current weather for " + level.PlanetName); Weather weather = WeatherManager.GetWeather(level.currentWeather); return weather.Name; } public static WeatherTweaksWeather GetPlanetCurrentWeatherType(SelectableLevel level) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return GetFullWeatherType(level.currentWeather); } public static float GetLevelWeatherVariable(LevelWeatherType weatherType, bool variable2 = false) { //IL_0007: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) Logger logger = new Logger("Variables", (LoggingType)2); if ((Object)(object)StartOfRound.Instance == (Object)null) { Plugin.logger.LogError((object)"StartOfRound is null"); return 0f; } SelectableLevel currentLevel = StartOfRound.Instance.currentLevel; Weather weather = WeatherManager.GetWeather(weatherType); RandomWeatherWithVariables val = ((IEnumerable<RandomWeatherWithVariables>)currentLevel.randomWeathers).FirstOrDefault((Func<RandomWeatherWithVariables, bool>)((RandomWeatherWithVariables x) => x.weatherType == weatherType)); if (val == null || (Object)(object)currentLevel == (Object)null) { ((Logger)logger).LogWarning($"Level {StringResolver.GetNumberlessName(currentLevel)} doesn't have weather variables defined for weather {weatherType}!"); return variable2 ? weather.Effect.DefaultVariable2 : weather.Effect.DefaultVariable1; } ((Logger)Plugin.DebugLogger).LogDebug($"Got weather variables for {currentLevel.PlanetName}:{weatherType} with variables {val.weatherVariable} {val.weatherVariable2}"); if (variable2) { return val.weatherVariable2; } return val.weatherVariable; } public static LevelWeatherType LevelHasWeather(LevelWeatherType weatherType) { //IL_0007: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) Plugin.logger.LogDebug((object)$"Checking if level has weather {weatherType}"); SelectableLevel currentLevel = StartOfRound.Instance.currentLevel; if ((Object)(object)StartOfRound.Instance == (Object)null || (Object)(object)currentLevel == (Object)null) { Plugin.logger.LogError((object)$"Failed to get weather variables for {currentLevel.PlanetName}:{weatherType}"); return (LevelWeatherType)(-1); } WeatherTweaksWeather planetCurrentWeatherType = GetPlanetCurrentWeatherType(currentLevel); Plugin.logger.LogDebug((object)$"Level has weather {((Weather)planetCurrentWeatherType).Type}?"); switch (planetCurrentWeatherType.CustomType) { case CustomWeatherType.Combined: { CombinedWeatherType combinedWeatherType = (CombinedWeatherType)planetCurrentWeatherType; if (combinedWeatherType.WeatherTypes.Any((WeatherResolvable x) => x.WeatherType == weatherType)) { Plugin.logger.LogWarning((object)$"Level {currentLevel.PlanetName} has weather {weatherType}"); return weatherType; } break; } case CustomWeatherType.Progressing: { ProgressingWeatherType progressingWeatherType = (ProgressingWeatherType)planetCurrentWeatherType; if (progressingWeatherType.DoesHaveWeatherHappening(weatherType)) { Plugin.logger.LogWarning((object)$"Level {currentLevel.PlanetName} has weather {weatherType}"); return weatherType; } break; } default: if (((Weather)planetCurrentWeatherType).VanillaWeatherType == weatherType) { Plugin.logger.LogWarning((object)$"Level {currentLevel.PlanetName} has weather {weatherType}"); return weatherType; } break; } return (LevelWeatherType)(-1); } internal static Weather GetVanillaWeatherType(LevelWeatherType weatherType) { //IL_0007: 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) return WeatherTypes.Find((Weather x) => x.VanillaWeatherType == weatherType); } internal static WeatherTweaksWeather GetFullWeatherType(Weather weatherType) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return GetFullWeatherType(weatherType.VanillaWeatherType); } internal static WeatherTweaksWeather GetFullWeatherType(LevelWeatherType weatherType) { //IL_0007: 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_0018: Unknown result type (might be due to invalid IL or missing references) ((Logger)Plugin.DebugLogger).LogDebug($"Getting full weather type for {weatherType}"); return WeatherTweaksTypes.Find((WeatherTweaksWeather x) => ((Weather)x).VanillaWeatherType == weatherType); } internal static int GetWeatherLevelWeight(SelectableLevel level, LevelWeatherType weatherType) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return WeatherManager.GetWeather(weatherType).GetWeight(level); } internal static WeightHandler<Weather> GetPlanetWeightedList(SelectableLevel level, float difficulty = 0f) { //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Invalid comparison between Unknown and I4 //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Invalid comparison between Unknown and I4 Logger logger = new Logger("WeatherSelection", (LoggingType)1); WeightHandler<Weather> val = new WeightHandler<Weather>(); WeightHandler<LevelWeatherType> weatherTypeWeights = new WeightHandler<LevelWeatherType>(); difficulty = Math.Clamp(difficulty, 0f, ConfigManager.MaxMultiplier.Value); int possibleWeathersWeightSum = 0; List<WeatherTweaksWeather> weatherTypes = GetPlanetWeatherTypes(level, specialWeathers: true); WeatherTweaksTypes.Where((WeatherTweaksWeather weatherType) => weatherType.CustomType == CustomWeatherType.Normal).ToList().ForEach(delegate(WeatherTweaksWeather weatherType) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) int weatherLevelWeight = GetWeatherLevelWeight(level, ((Weather)weatherType).VanillaWeatherType); weatherTypeWeights.Add(((Weather)weatherType).VanillaWeatherType, weatherLevelWeight); if (weatherTypes.Contains(weatherType)) { possibleWeathersWeightSum += weatherLevelWeight; } }); weatherTypeWeights.Add((LevelWeatherType)(-1), GetWeatherLevelWeight(level, (LevelWeatherType)(-1))); foreach (WeatherTweaksWeather weatherType2 in weatherTypes) { int num = weatherTypeWeights.Get(((Weather)weatherType2).VanillaWeatherType); if (ConfigManager.ScaleDownClearWeather.Value && (int)((Weather)weatherType2).VanillaWeatherType == -1) { int weight = NoneWeather.GetWeight(level); int sum = weatherTypeWeights.Sum; double value = weight * Math.Max(possibleWeathersWeightSum, 1) / Math.Max(sum, 1); num = Convert.ToInt32(value); ((Logger)logger).LogDebug($"Scaling down clear weather weight from {weight} to {num} : ({weight} * {possibleWeathersWeightSum} / {sum}) == {num}"); } if (weatherType2.CustomType == CustomWeatherType.Combined) { CombinedWeatherType combinedWeatherType = CombinedWeathers.Find((CombinedWeatherType x) => ((Weather)x).Name == ((Weather)weatherType2).Name); if (!combinedWeatherType.CanWeatherBeApplied(level)) { ((Logger)logger).LogDebug("Combined weather: " + ((Weather)combinedWeatherType).Name + " can't be applied"); continue; } num = ((Weather)combinedWeatherType).GetWeight(level); } else if (weatherType2.CustomType == CustomWeatherType.Progressing) { num = ((Weather)weatherType2).GetWeight(level); } if ((int)((Weather)weatherType2).VanillaWeatherType != -1) { num = (int)((float)num * (1f + difficulty)); } ((Logger)logger).LogDebug($"{((Weather)weatherType2).Name} has weight {num}"); val.Add((Weather)(object)weatherType2, num); } return val; } } internal class WeatherCalculation { internal class WeatherTweaksWeatherAlgorithm : WeatherSelectionAlgorithm { public override Dictionary<SelectableLevel, LevelWeatherType> SelectWeathers(int connectedPlayersOnServer, StartOfRound startOfRound) { //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) Plugin.logger.LogMessage((object)"SetWeathers called."); if (!((NetworkBehaviour)StartOfRound.Instance).IsHost) { Plugin.logger.LogMessage((object)"Not a host, cannot generate weather!"); return null; } previousDayWeather.Clear(); Random random = ((WeatherSelectionAlgorithm)this).GetRandom(startOfRound); Dictionary<SelectableLevel, Weather> dictionary = new Dictionary<SelectableLevel, Weather>(); List<LevelWeatherType> vanillaWeathers = Defaults.VanillaWeathers; List<SelectableLevel> gameLevels = Variables.GetGameLevels(); int daysSpent = startOfRound.gameStats.daysSpent; int timesFulfilledQuota = TimeOfDay.Instance.timesFulfilledQuota; int num = daysSpent % 3; if (daysSpent == 0 && ConfigManager.FirstDaySpecial.Value) { return ((WeatherSelectionAlgorithm)firstDayWeathersAlgorithm).SelectWeathers(connectedPlayersOnServer, startOfRound); } float num2 = (float)timesFulfilledQuota * ConfigManager.GameLengthMultiplier.Value; float num3 = (float)StartOfRound.Instance.livingPlayers * ConfigManager.GamePlayersMultiplier.Value; float num4 = num2 + num3; Plugin.logger.LogDebug((object)$"Difficulty multiplier: {num4}"); foreach (SelectableLevel level in gameLevels) { previousDayWeather[level.PlanetName] = level.currentWeather; if (ConfigManager.AlwaysClear.Value) { Plugin.logger.LogDebug((object)"AlwaysClear is true, setting weather to None"); dictionary[level] = Variables.NoneWeather; continue; } if (level.overrideWeather) { Plugin.logger.LogDebug((object)$"Override weather present, changing weather to {level.overrideWeatherType}"); dictionary[level] = (Weather)(object)Variables.WeatherTweaksTypes.Find((WeatherTweaksWeather x) => ((Weather)x).VanillaWeatherType == level.overrideWeatherType && x.CustomType == CustomWeatherType.Normal); continue; } Plugin.logger.LogDebug((object)"-------------"); Plugin.logger.LogDebug((object)(level.PlanetName ?? "")); Plugin.logger.LogDebug((object)$"previousDayWeather: {previousDayWeather[level.PlanetName]}"); dictionary[level] = Variables.NoneWeather; WeightHandler<Weather> planetWeightedList = Variables.GetPlanetWeightedList(level, num4); Weather val = planetWeightedList.Random(); dictionary[level] = val; Plugin.logger.LogDebug((object)("Selected weather: " + val.Name)); try { Plugin.logger.LogDebug((object)$"Chance for that was {planetWeightedList.Get(val)} / {planetWeightedList.Sum} ({(float)planetWeightedList.Get(val) / (float)planetWeightedList.Sum * 100f}%)"); } catch { } } Plugin.logger.LogDebug((object)"-------------"); Dictionary<SelectableLevel, LevelWeatherType> dictionary2 = new Dictionary<SelectableLevel, LevelWeatherType>(); foreach (KeyValuePair<SelectableLevel, Weather> item in dictionary) { dictionary2[item.Key] = item.Value.VanillaWeatherType; } return dictionary2; } } internal class FirstDayWeathersAlgorithm : WeatherSelectionAlgorithm { public List<string> PlanetsWithoutWeather { get; set; } public override Random GetRandom(StartOfRound startOfRound) { Random random = new Random(startOfRound.randomMapSeed); int seed = ConfigManager.FirstDaySeed.Value; if (ConfigManager.FirstDayRandomSeed.Value) { seed = random.Next(0, 10000000); } return new Random(seed); } public override Dictionary<SelectableLevel, LevelWeatherType> SelectWeathers(int connectedPlayersOnServer, StartOfRound startOfRound) { //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Unknown result type (might be due to invalid IL or missing references) Plugin.logger.LogInfo((object)"First day, setting predefined weather conditions"); List<SelectableLevel> gameLevels = Variables.GetGameLevels(); Dictionary<SelectableLevel, Weather> dictionary = new Dictionary<SelectableLevel, Weather>(); List<string> noWeatherOnStartPlanets = new List<string>(2) { "41 Experimentation", "56 Vow" }; List<SelectableLevel> list = gameLevels.Where((SelectableLevel level) => !noWeatherOnStartPlanets.Contains(level.PlanetName)).ToList(); Random random = ((WeatherSelectionAlgorithm)this).GetRandom(startOfRound); if (gameLevels.Count > 9) { int num = (int)((double)gameLevels.Count * 0.5); Plugin.logger.LogDebug((object)$"Planets without weather: {num + 2}"); for (int i = 0; i < num; i++) { string planetName = list[random.Next(0, list.Count)].PlanetName; noWeatherOnStartPlanets.Add(planetName); list.RemoveAll((SelectableLevel level) => level.PlanetName == planetName); } } PlanetsWithoutWeather = noWeatherOnStartPlanets; foreach (SelectableLevel level2 in Variables.GameLevels) { string planetName2 = level2.PlanetName; Plugin.logger.LogDebug((object)("planet: " + planetName2)); if (ConfigManager.AlwaysClear.Value) { Plugin.logger.LogDebug((object)"AlwaysClear is true, setting weather to None"); dictionary[level2] = Variables.NoneWeather; continue; } if (level2.overrideWeather) { Plugin.logger.LogDebug((object)$"Override weather present, changing weather to {level2.overrideWeatherType}"); dictionary[level2] = (Weather)(object)Variables.WeatherTweaksTypes.Find((WeatherTweaksWeather x) => ((Weather)x).VanillaWeatherType == level2.overrideWeatherType && x.CustomType == CustomWeatherType.Normal); continue; } List<WeatherTweaksWeather> list2 = (from randomWeather in Variables.GetPlanetWeatherTypes(level2) where (int)((Weather)randomWeather).VanillaWeatherType != -1 && (int)((Weather)randomWeather).VanillaWeatherType != 0 && randomWeather.CustomType == CustomWeatherType.Normal select randomWeather).ToList(); string text = JsonConvert.SerializeObject((object)list2.Select(delegate(WeatherTweaksWeather x) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) LevelWeatherType vanillaWeatherType = ((Weather)x).VanillaWeatherType; return ((object)(LevelWeatherType)(ref vanillaWeatherType)).ToString(); }).ToList()); list2.RemoveAll((WeatherTweaksWeather x) => (int)((Weather)x).VanillaWeatherType == 5); if (list2.Count == 0 || list2 == null) { dictionary[level2] = Variables.NoneWeather; Plugin.logger.LogDebug((object)("No random weathers for " + planetName2 + ", skipping")); continue; } if (PlanetsWithoutWeather.Contains(planetName2)) { dictionary[level2] = Variables.NoneWeather; Plugin.logger.LogDebug((object)("Skipping " + planetName2 + " (predefined)")); continue; } bool flag = random.Next(0, 100) < 5; WeatherTweaksWeather selectedRandom = list2[random.Next(0, list2.Count)]; if (flag) { Plugin.logger.LogDebug((object)("Setting eclipsed for " + planetName2)); if (!list2.Any((WeatherTweaksWeather x) => (int)((Weather)x).VanillaWeatherType == 5)) { Plugin.logger.LogDebug((object)("Eclipsed not possible for " + planetName2 + ", setting random weather")); } else { selectedRandom = list2.First((WeatherTweaksWeather x) => (int)((Weather)x).VanillaWeatherType == 5); } } Weather val = (Weather)(object)Variables.WeatherTweaksTypes.Find((WeatherTweaksWeather x) => ((Weather)x).VanillaWeatherType == ((Weather)selectedRandom).VanillaWeatherType && x.CustomType == CustomWeatherType.Normal); dictionary[level2] = val; Plugin.logger.LogDebug((object)("Set weather for " + planetName2 + ": " + val.Name)); } if ((Object)(object)CompanyMoon != (Object)null) { dictionary[CompanyMoon] = Variables.NoneWeather; } Dictionary<SelectableLevel, LevelWeatherType> dictionary2 = new Dictionary<SelectableLevel, LevelWeatherType>(); foreach (KeyValuePair<SelectableLevel, Weather> item in dictionary) { dictionary2[item.Key] = item.Value.VanillaWeatherType; } return dictionary2; } } internal static Dictionary<string, LevelWeatherType> previousDayWeather = new Dictionary<string, LevelWeatherType>(); internal static FirstDayWeathersAlgorithm firstDayWeathersAlgorithm = new FirstDayWeathersAlgorithm(); internal static WeatherTweaksWeatherAlgorithm weatherTweaksWeatherAlgorithm = new WeatherTweaksWeatherAlgorithm(); internal static SelectableLevel CompanyMoon => LevelHelper.CompanyMoon; } public static class PluginInfo { public const string PLUGIN_GUID = "WeatherTweaks"; public const string PLUGIN_NAME = "WeatherTweaks"; public const string PLUGIN_VERSION = "1.1.9"; } } namespace WeatherTweaks.Patches { public class Reset { public static void ResetThings() { Variables.CurrentEffects.Clear(); Variables.IsSetupFinished = false; Variables.WeatherTweaksTypes.Clear(); } } public class TerminalStartPatch { public static void Start() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) Variables.CurrentEffects.Clear(); TMP_ColorGradient value = ColorConverter.ToTMPColorGradient(Color.white); Settings.ScreenMapColors.Add("+", value); Settings.ScreenMapColors.Add("plus", value); Settings.ScreenMapColors.Add("/", value); Settings.ScreenMapColors.Add("slash", value); Settings.ScreenMapColors.Add(">", value); Settings.ScreenMapColors.Add("arrow", value); Settings.ScreenMapColors.Add("?", value); Settings.ScreenMapColors.Add("question", value); Settings.ScreenMapColors.Add("[UNKNOWN]", ColorConverter.ToTMPColorGradient(new Color(0.29f, 0.29f, 0.29f))); Variables.IsSetupFinished = true; StartOfRound.Instance.SetPlanetsWeather(0); StartOfRound.Instance.SetMapScreenInfoToCurrentLevel(); } } } namespace WeatherTweaks.Modules { public abstract class UncertainWeatherType { public string Name; public ConfigEntry<bool> Enabled; public abstract string CreateUncertaintyString(SelectableLevel level, Random random); public UncertainWeatherType(string name) { Name = name; Plugin.logger.LogDebug((object)("Creating UncertainWeatherType: " + Name)); Enabled = ConfigManager.configFile.Bind<bool>("Uncertain mechanics", Name + " Enabled", true, "Enable " + Name + " uncertainty"); } } } namespace WeatherTweaks.Definitions { public class CombinedWeatherType : WeatherTweaksWeather { public float WeightModify; public List<Weather> Weathers => WeatherTypes.Select((WeatherResolvable weatherType) => WeatherManager.GetWeather(weatherType.WeatherType)).ToList(); public WeatherTweaksConfig Config => (WeatherTweaksConfig)(object)((Weather)this).Config; public bool Enabled => ((ConfigHandler<bool, bool>)(object)Config.EnableWeather).Value; public new bool CanWeatherBeApplied(SelectableLevel level) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (!Enabled) { return false; } RandomWeatherWithVariables[] randomWeathers = level.randomWeathers; List<LevelWeatherType> list = Weathers.Select((Weather weather) => weather.VanillaWeatherType).ToList(); RandomWeatherWithVariables[] array = randomWeathers; foreach (RandomWeatherWithVariables val in array) { if (list.Contains(val.weatherType)) { list.Remove(val.weatherType); } } return list.Count == 0; } public override (float valueMultiplier, float amountMultiplier) GetDefaultMultiplierData() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) WeatherMultiplierData weatherMultiplierData = new WeatherMultiplierData(((Weather)this).VanillaWeatherType, 0f, 0f); foreach (Weather weather in Weathers) { weatherMultiplierData.valueMultiplier += weather.ScrapValueMultiplier * 0.75f; weatherMultiplierData.spawnMultiplier += weather.ScrapAmountMultiplier * 0.75f; } return (weatherMultiplierData.valueMultiplier, weatherMultiplierData.spawnMultiplier); } public override void Init() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown int num = (int)Weathers.Average((Weather weather) => weather.DefaultWeight); ((RegistryWeatherConfig)Config).DefaultWeight = new IntegerConfigHandler((int)((float)num * WeightModify / (float)Weathers.Count), true); base.Init(); } public CombinedWeatherType(string name, List<WeatherResolvable> weathers, float weightModifier = 0.2f) : base(name, CustomWeatherType.Combined, weathers.ToArray()) { if (weathers.Count != 0) { WeightModify = weightModifier; ((Weather)this).Name = name; base.CustomType = CustomWeatherType.Combined; Plugin.logger.LogDebug((object)("Created CombinedWeatherType: " + ((Weather)this).Name)); Variables.CombinedWeathers.Add(this); WeatherManager.RegisterWeather((Weather)(object)this); } } } [JsonObject(/*Could not decode attribute arguments.*/)] public class ProgressingWeatherEntry { [JsonProperty] public float DayTime; [JsonProperty] public float Chance = 0.8f; [JsonProperty] public WeatherResolvable Weather; [JsonProperty] public string WeatherName; internal Weather GetWeather() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return WeatherManager.GetWeather(Weather.WeatherType); } internal List<DialogueSegment> GetDialogueSegment() { //IL_0007: 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown return new List<DialogueSegment>(1) { new DialogueSegment { speakerText = "Weather Forecast", bodyText = "The weather will be changing to " + GetWeather().Name, waitTime = 7f } }; } } public class ProgressingWeatherType : WeatherTweaksWeather { public List<ProgressingWeatherEntry> WeatherEntries = new List<ProgressingWeatherEntry>(); public WeatherResolvable StartingWeather; private Weather _weather; public float WeightModify; public bool Enabled => ((ConfigHandler<bool, bool>)(object)Config.EnableWeather).Value; public Weather Weather { get { //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (_weather == null) { _weather = WeatherManager.GetWeather(StartingWeather.WeatherType); } return _weather; } set { _weather = value; } } public WeatherTweaksConfig Config => (WeatherTweaksConfig)(object)((Weather)this).Config; public new bool CanWeatherBeApplied(SelectableLevel level) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) if (!Enabled) { return false; } RandomWeatherWithVariables[] randomWeathers = level.randomWeathers; List<LevelWeatherType> list = WeatherEntries.Select((ProgressingWeatherEntry entry) => entry.Weather.WeatherType).Append(StartingWeather.WeatherType).Distinct() .ToList(); list.RemoveAll((LevelWeatherType weather) => (int)weather == -1); RandomWeatherWithVariables[] array = randomWeathers; foreach (RandomWeatherWithVariables val in array) { if (list.Contains(val.weatherType)) { list.Remove(val.weatherType); } } return list.Count == 0; } public override void Init() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown int num = (int)(from entry in WeatherEntries.ToList() select entry.GetWeather()).Average((Weather weather) => weather.DefaultWeight); ((RegistryWeatherConfig)Config).DefaultWeight = new IntegerConfigHandler((int)((float)num * WeightModify / (float)WeatherEntries.Count), true); base.Init(); } public override (float valueMultiplier, float amountMultiplier) GetDefaultMultiplierData() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) WeatherMultiplierData weatherMultiplierData = new WeatherMultiplierData(((Weather)this).VanillaWeatherType, 0f, 0f); float num = 0f; float num2 = 0f; float num3 = 0f; foreach (ProgressingWeatherEntry weatherEntry in WeatherEntries) { Weather weather = weatherEntry.GetWeather(); WeatherMultiplierData weatherMultiplierData2 = new WeatherMultiplierData(weather.VanillaWeatherType, weather.ScrapValueMultiplier, weather.ScrapAmountMultiplier); num += weatherMultiplierData2.valueMultiplier * weatherEntry.Chance; num2 += weatherMultiplierData2.spawnMultiplier * weatherEntry.Chance; num3 += weatherEntry.Chance; } weatherMultiplierData.valueMultiplier = num / num3; weatherMultiplierData.spawnMultiplier = num2 / num3; return (weatherMultiplierData.valueMultiplier, weatherMultiplierData.spawnMultiplier); } public bool DoesHaveWeatherHappening(LevelWeatherType weatherType) { //IL_0007: 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) return WeatherEntries.Any((ProgressingWeatherEntry entry) => entry.Weather.WeatherType == weatherType); } public ProgressingWeatherType(string name, WeatherResolvable baseWeather, List<ProgressingWeatherEntry> weatherEntries, float weightModifier = 0.3f) : base(name, CustomWeatherType.Progressing, weatherEntries.Select((ProgressingWeatherEntry entry) => entry.Weather).Append(baseWeather).Distinct() .ToArray()) { ((Weather)this).Name = name; Plugin.logger.LogDebug((object)("Creating ChangingWeatherType: " + ((Weather)this).Name)); WeatherEntries = weatherEntries; WeatherEntries.Sort((ProgressingWeatherEntry a, ProgressingWeatherEntry b) => a.DayTime.CompareTo(b.DayTime)); Plugin.logger.LogWarning((object)$"{Config} is null? {Config == null}"); WeightModify = weightModifier; StartingWeather = baseWeather; Variables.ProgressingWeathers.Add(this); WeatherManager.RegisterWeather((Weather)(object)this); } } public class WeatherTweaksConfig : RegistryWeatherConfig { public BooleanConfigHandler EnableWeather = new BooleanConfigHandler(true, true); public override void Init(Weather weather) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown ((Logger)Plugin.DebugLogger).LogInfo($"Creating WeatherConfig: {weather}"); ((ConfigHandler<bool, bool>)(object)EnableWeather).SetConfigEntry(weather, "Enable Weather", new ConfigDescription("Enable this weather type", (AcceptableValueBase)null, Array.Empty<object>())); ((RegistryWeatherConfig)this).Init(weather); } } public class WeatherTweaksEffect : ImprovedWeatherEffect { public List<WeatherResolvable> weathers; public override bool EffectEnabled { get { return ((ImprovedWeatherEffect)this).EffectEnabled; } set { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (value) { if (Variables.CombinedWeatherTypes.Contains(((ImprovedWeatherEffect)this).LevelWeatherType)) { EnableCombinedEffect(); return; } if (Variables.ProgressingWeatherTypes.Contains(((ImprovedWeatherEffect)this).LevelWeatherType)) { EnableProgressingEffect(); return; } } ((ImprovedWeatherEffect)this).EffectEnabled = value; } } public WeatherTweaksEffect(GameObject effectObject, GameObject worldObject, List<WeatherResolvable> weatherTypes) : base(effectObject, worldObject) { weathers = weatherTypes; } public void EnableCombinedEffect() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missi