Decompiled source of MoreLighting v1.0.1

plugins/MoreLighting.dll

Decompiled a year ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MoreLighting")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("MoreLighting mod for lethal comapany")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d951b9ffc307c7d3a1b4ce5202d60f84b65f9a28")]
[assembly: AssemblyProduct("MoreLighting")]
[assembly: AssemblyTitle("MoreLighting")]
[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 MoreLighting
{
	[BepInPlugin("com.github.phawitpp.morelighting", "MoreLighting", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource log;

		public Harmony harmony = new Harmony("com.github.phawitpp.morelighting");

		private void Awake()
		{
			log = ((BaseUnityPlugin)this).Logger;
			log.LogInfo((object)"Loading plugin MoreLighting ...");
			harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin MoreLighting is loaded!");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "MoreLighting";

		public const string PLUGIN_NAME = "MoreLighting";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace MoreLighting.Patchs
{
	[HarmonyPatch(typeof(StormyWeather))]
	internal class MoreLightingPatch
	{
		private static Random seed = new Random();

		[HarmonyPatch("DetermineNextStrikeInterval")]
		[HarmonyPrefix]
		public static void DetermineNextStrikeInterval(StormyWeather __instance)
		{
			float value = Traverse.Create((object)__instance).Field("randomThunderTime").GetValue<float>();
			Plugin.log.LogInfo((object)$"randomThunderTime: {value}");
			Traverse.Create((object)__instance).Field("timeAtLastStrike").SetValue((object)value);
			float num = value + Mathf.Clamp((float)seed.Next(-5, 110) * 0.85f, 1f, 5f) / (float)Mathf.Clamp(TimeOfDay.Instance.currentWeatherVariable, 1, 100);
			Plugin.log.LogInfo((object)$"newThunderTime: {num}");
			Traverse.Create((object)__instance).Field("randomThunderTime").SetValue((object)num);
		}
	}
}