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.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
[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("WednesdayFix")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A mod for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+1171dff4612470fe0222023de2f3a5edd3d98d97")]
[assembly: AssemblyProduct("WednesdayFix")]
[assembly: AssemblyTitle("WednesdayFix")]
[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 WednesdayFix
{
public class Config
{
public ConfigEntry<bool> FixWednesday;
public ConfigEntry<bool> FixFriday;
public Config(ConfigFile cfg)
{
FixWednesday = cfg.Bind<bool>("General", "FixWednesday", true, "Whether to enable Double-Loot Wednesday");
FixFriday = cfg.Bind<bool>("General", "FixFriday", true, "Whether to enable Half-Facility Friday");
}
}
[BepInPlugin("moe.sylvi.WednesdayFix", "WednesdayFix", "1.1.0")]
public class Plugin : BaseUnityPlugin
{
private static DayOfWeek startingDay;
private static float normalScrapAmountMultiplier;
private static float normalMapSizeMultiplier;
public static Config Config { get; private set; }
private void Awake()
{
Config = new Config(((BaseUnityPlugin)this).Config);
startingDay = DateTime.Now.DayOfWeek;
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin moe.sylvi.WednesdayFix is loaded!");
((BaseUnityPlugin)this).Logger.LogInfo((object)$"- Active day: {startingDay}");
switch (startingDay)
{
case DayOfWeek.Wednesday:
((BaseUnityPlugin)this).Logger.LogInfo((object)"- Active event: Double Loot");
break;
case DayOfWeek.Friday:
((BaseUnityPlugin)this).Logger.LogInfo((object)"- Active event: Half Facility");
break;
default:
((BaseUnityPlugin)this).Logger.LogInfo((object)"- Active event: None");
break;
}
Harmony.CreateAndPatchAll(typeof(Plugin), "moe.sylvi.WednesdayFix");
}
[HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")]
[HarmonyPrefix]
private static void SpawnScrapInLevel_Prefix(RoundManager __instance)
{
normalScrapAmountMultiplier = __instance.scrapAmountMultiplier;
if (Config.FixWednesday.Value && startingDay == DayOfWeek.Wednesday && !StartOfRound.Instance.isChallengeFile)
{
__instance.scrapAmountMultiplier *= 2f;
}
}
[HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")]
[HarmonyPostfix]
private static void SpawnScrapInLevel_Postfix(RoundManager __instance)
{
__instance.scrapAmountMultiplier = normalScrapAmountMultiplier;
}
[HarmonyPatch(typeof(RoundManager), "GenerateNewFloor")]
[HarmonyPrefix]
private static void GenerateNewFloor_Prefix(RoundManager __instance)
{
normalMapSizeMultiplier = __instance.mapSizeMultiplier;
if (Config.FixFriday.Value && startingDay == DayOfWeek.Friday && !StartOfRound.Instance.isChallengeFile)
{
__instance.mapSizeMultiplier *= 0.5f;
}
}
[HarmonyPatch(typeof(RoundManager), "GenerateNewFloor")]
[HarmonyPostfix]
private static void GenerateNewFloor_Postfix(RoundManager __instance)
{
__instance.mapSizeMultiplier = normalMapSizeMultiplier;
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "moe.sylvi.WednesdayFix";
public const string PLUGIN_NAME = "WednesdayFix";
public const string PLUGIN_VERSION = "1.1.0";
}
}