Please disclose if any significant portion of your mod was created 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 WeatherMultiplier v1.0.0
WeatherMultiplier.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using TMPro; using UnityEngine; using WeatherMultiplier.Patches; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("WeatherMultipliers")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("WeatherMultipliers")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("f7d37cdb-70e3-4bf8-8657-7c7b72ab6546")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace WeatherMultiplier { [BepInPlugin("rogan.WeatherMultiplier", "Weather Multiplier", "1.0.0")] public class WeatherMultiplierBase : BaseUnityPlugin { private const string modGUID = "rogan.WeatherMultiplier"; private const string modName = "Weather Multiplier"; private const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("rogan.WeatherMultiplier"); private static WeatherMultiplierBase Instance; internal static ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("rogan.WeatherMultiplier"); mls.LogInfo((object)"WeatherMultiplier Started!"); harmony.PatchAll(typeof(WeatherMultiplierBase)); harmony.PatchAll(typeof(WeatherNamePatch)); harmony.PatchAll(typeof(WeatherPricePatch)); harmony.PatchAll(typeof(WeatherScreenPatch)); } } } namespace WeatherMultiplier.Patches { [HarmonyPatch(typeof(Terminal), "TextPostProcess")] public class WeatherNamePatch { private static bool Prefix(Terminal __instance, ref string modifiedDisplayText, ref TerminalNode node) { int num = modifiedDisplayText.Split(new string[1] { "[planetTime]" }, StringSplitOptions.None).Length - 1; if (num > 0) { Regex regex = new Regex(Regex.Escape("[planetTime]")); for (int i = 0; i < num && __instance.moonsCatalogueList.Length > i; i++) { modifiedDisplayText = regex.Replace(modifiedDisplayText, "", 1); } } if (node.displayPlanetInfo != -1) { modifiedDisplayText = modifiedDisplayText.Replace("[currentPlanetTime]", "[wx_unavailable]"); } return true; } } [HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")] internal class WeatherPricePatch { public const float rainy = 1.25f; public const float stormy = 1.5f; public const float flooded = 1.5f; public const float eclipsed = 2.5f; private static void Prefix(RoundManager __instance) { //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) LevelWeatherType currentWeather = __instance.currentLevel.currentWeather; if (((object)(LevelWeatherType)(ref currentWeather)).ToString() == "Rainy") { __instance.scrapValueMultiplier *= 1.25f; } else if (((object)(LevelWeatherType)(ref currentWeather)).ToString() == "Stormy") { __instance.scrapValueMultiplier *= 1.5f; } else if (((object)(LevelWeatherType)(ref currentWeather)).ToString() == "Flooded") { __instance.scrapValueMultiplier *= 1.5f; } else if (((object)(LevelWeatherType)(ref currentWeather)).ToString() == "Eclipsed") { __instance.scrapValueMultiplier *= 2.5f; } } private static void Postfix(RoundManager __instance) { //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) LevelWeatherType currentWeather = __instance.currentLevel.currentWeather; if (((object)(LevelWeatherType)(ref currentWeather)).ToString() == "Rainy") { __instance.scrapValueMultiplier /= 1.25f; } else if (((object)(LevelWeatherType)(ref currentWeather)).ToString() == "Stormy") { __instance.scrapValueMultiplier /= 1.5f; } else if (((object)(LevelWeatherType)(ref currentWeather)).ToString() == "Flooded") { __instance.scrapValueMultiplier /= 1.5f; } else if (((object)(LevelWeatherType)(ref currentWeather)).ToString() == "Eclipsed") { __instance.scrapValueMultiplier /= 2.5f; } } } [HarmonyPatch(typeof(StartOfRound), "SetMapScreenInfoToCurrentLevel")] public class WeatherScreenPatch { private static bool Prefix(StartOfRound __instance) { //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) WeatherMultiplierBase.mls.LogInfo((object)"Changing weather!"); ((Behaviour)__instance.screenLevelVideoReel).enabled = false; ((Component)__instance.screenLevelVideoReel).gameObject.SetActive(false); __instance.screenLevelVideoReel.clip = __instance.currentLevel.videoReel; TimeOfDay val = Object.FindObjectOfType<TimeOfDay>(); if (val.totalTime == 0f) { val.totalTime = (float)val.numberOfHours * val.lengthOfHours; } string text = ""; string levelDescription = __instance.currentLevel.LevelDescription; ((TMP_Text)__instance.screenLevelDescription).SetText("Orbiting: " + __instance.currentLevel.PlanetName + "\n" + levelDescription + "\n" + text, true); __instance.mapScreen.overrideCameraForOtherUse = true; ((Component)__instance.mapScreen.cam).transform.position = new Vector3(0f, 100f, 0f); ((Behaviour)__instance.screenLevelDescription).enabled = true; if ((Object)(object)__instance.currentLevel.videoReel != (Object)null) { ((Behaviour)__instance.screenLevelVideoReel).enabled = true; ((Component)__instance.screenLevelVideoReel).gameObject.SetActive(true); __instance.screenLevelVideoReel.Play(); } return false; } } }