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 LongerDays v0.1.0
plugins/LongerDays.dll
Decompiled 15 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LongerDays")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+87711078433e7dbe8004349d45feae143538e9b4")] [assembly: AssemblyProduct("LongerDays")] [assembly: AssemblyTitle("LongerDays")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 LongerDays { [BepInPlugin("alexis.longerdays", "LongerDays", "0.1.0")] public class Plugin : BaseUnityPlugin { internal static ConfigEntry<float> DayLength; internal static ConfigEntry<float> DifficultyRamp; internal static ConfigEntry<bool> ScaleMaxPower; private void Awake() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) DayLength = ((BaseUnityPlugin)this).Config.Bind<float>("General", "DayLengthMultiplier", 1.5f, new ConfigDescription("La journée dure X fois plus longtemps en temps réel (1 = vanilla).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 4f), Array.Empty<object>())); DifficultyRamp = ((BaseUnityPlugin)this).Config.Bind<float>("General", "DifficultyRampMultiplier", 0.75f, new ConfigDescription("Vitesse de montée des spawns pendant la journée (1 = vanilla, 0.5 = deux fois moins vite).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.25f, 1f), Array.Empty<object>())); ScaleMaxPower = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ScaleMaxPower", false, "Multiplie aussi la puissance max des monstres (intérieur et extérieur) par DifficultyRampMultiplier."); new Harmony("alexis.longerdays").PatchAll(typeof(Plugin).Assembly); ((BaseUnityPlugin)this).Logger.LogInfo((object)($"LongerDays chargé : DayLengthMultiplier={DayLength.Value}, " + $"DifficultyRampMultiplier={DifficultyRamp.Value}, ScaleMaxPower={ScaleMaxPower.Value}")); } } [HarmonyPatch(typeof(TimeOfDay), "MoveGlobalTime")] internal static class ClockPatch { private static void Prefix(TimeOfDay __instance, out float __state) { __state = __instance.globalTimeSpeedMultiplier; __instance.globalTimeSpeedMultiplier /= Plugin.DayLength.Value; } private static void Finalizer(TimeOfDay __instance, float __state) { __instance.globalTimeSpeedMultiplier = __state; } } [HarmonyPatch] internal static class SpawnCurvePatch { private static AnimationCurve inside; private static AnimationCurve outside; private static AnimationCurve daytime; private static IEnumerable<MethodBase> TargetMethods() { yield return AccessTools.Method(typeof(RoundManager), "PlotOutEnemiesForNextHour", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(RoundManager), "SpawnEnemiesOutside", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(RoundManager), "SpawnDaytimeEnemiesOutside", (Type[])null, (Type[])null); } private static void Prefix(RoundManager __instance) { SelectableLevel currentLevel = __instance.currentLevel; float value = Plugin.DifficultyRamp.Value; inside = currentLevel.enemySpawnChanceThroughoutDay; outside = currentLevel.outsideEnemySpawnChanceThroughDay; daytime = currentLevel.daytimeEnemySpawnChanceThroughDay; currentLevel.enemySpawnChanceThroughoutDay = Stretch(inside, value); currentLevel.outsideEnemySpawnChanceThroughDay = Stretch(outside, value); currentLevel.daytimeEnemySpawnChanceThroughDay = Stretch(daytime, value); } private static void Finalizer(RoundManager __instance) { SelectableLevel currentLevel = __instance.currentLevel; currentLevel.enemySpawnChanceThroughoutDay = inside; currentLevel.outsideEnemySpawnChanceThroughDay = outside; currentLevel.daytimeEnemySpawnChanceThroughDay = daytime; } internal static AnimationCurve Stretch(AnimationCurve curve, float f) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown if (curve == null || f >= 1f) { return curve; } Keyframe[] keys = curve.keys; for (int i = 0; i < keys.Length; i++) { ref Keyframe reference = ref keys[i]; ((Keyframe)(ref reference)).time = ((Keyframe)(ref reference)).time / f; ref Keyframe reference2 = ref keys[i]; ((Keyframe)(ref reference2)).inTangent = ((Keyframe)(ref reference2)).inTangent * f; ref Keyframe reference3 = ref keys[i]; ((Keyframe)(ref reference3)).outTangent = ((Keyframe)(ref reference3)).outTangent * f; } return new AnimationCurve(keys) { preWrapMode = curve.preWrapMode, postWrapMode = curve.postWrapMode }; } } [HarmonyPatch(typeof(RoundManager), "RefreshEnemiesList")] internal static class MaxPowerPatch { private static void Postfix(RoundManager __instance) { if (Plugin.ScaleMaxPower.Value) { __instance.currentMaxInsidePower *= Plugin.DifficultyRamp.Value; __instance.currentMaxOutsidePower *= Plugin.DifficultyRamp.Value; } } } }