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.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LobbyCompatibility.Enums;
using LobbyCompatibility.Features;
using Microsoft.CodeAnalysis;
using RemoveAds.Compat;
using RemoveAds.Configs;
using RemoveAds.Patches;
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("RemoveAds")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Get enough dystopian hellscape in real life? Hate ads? Say no more!")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+371ea690fe12e4f07339e6901a5db2ee794e4816")]
[assembly: AssemblyProduct("RemoveAds")]
[assembly: AssemblyTitle("RemoveAds")]
[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 RemoveAds
{
[BepInPlugin("com.github.cdusold.LethalRemoveAds", "RemoveAds", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("cdusold.LethalRemoveAds");
private static Plugin Instance;
public static ManualLogSource logger;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
logger = ((BaseUnityPlugin)this).Logger;
((BaseUnityPlugin)this).Logger.LogInfo((object)"Mod cdusold.LethalRemoveAds is loaded!");
ConfigManager.Init(((BaseUnityPlugin)this).Config);
if (Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig"))
{
LethalConfigManager.Init(((BaseUnityPlugin)this).Config);
}
if (Chainloader.PluginInfos.ContainsKey("BMX.LobbyCompatibility"))
{
LobbyCompatibilityManager.Init();
}
harmony.PatchAll(typeof(Plugin));
harmony.PatchAll(typeof(HUDManagerPatch));
harmony.PatchAll(typeof(TimeOfDayPatch));
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "RemoveAds";
public const string PLUGIN_NAME = "RemoveAds";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace RemoveAds.Patches
{
[HarmonyPatch(typeof(HUDManager))]
internal class HUDManagerPatch
{
[HarmonyPatch("BeginDisplayAd")]
[HarmonyPrefix]
private static bool BeginDisplayAd()
{
Plugin.logger.LogInfo((object)"Skipping the display of the ad. You're welcome!");
return false;
}
}
[HarmonyPatch(typeof(TimeOfDay))]
internal class TimeOfDayPatch
{
[HarmonyPatch("SetTimeForAdToPlay")]
[HarmonyPrefix]
private static bool SetTimeForAdToPlay()
{
if (ConfigManager.PiHole.Value)
{
Plugin.logger.LogInfo((object)"PiHole is enabled, not playing an ad today.");
TimeOfDay.Instance.normalizedTimeToShowAd = -1f;
return false;
}
return true;
}
}
}
namespace RemoveAds.Configs
{
internal class ConfigManager
{
public static ConfigManager Instance { get; private set; }
public static ConfigEntry<bool> PiHole { get; private set; }
public static void Init(ConfigFile config)
{
if (Instance == null)
{
Instance = new ConfigManager(config);
}
}
private ConfigManager(ConfigFile config)
{
PiHole = config.Bind<bool>("General", "Prevent ads in lobby as host", false, "If enabled, the mod will prevent ads from showing for anyone but only when you are the host. No one else will have to install this mod in that case.");
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
internal class LethalConfigManager
{
public static LethalConfigManager Instance { get; private set; }
public static void Init(ConfigFile config)
{
if (Instance == null)
{
Instance = new LethalConfigManager(config);
}
}
private LethalConfigManager(ConfigFile config)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
LethalConfigManager.SetModDescription("The company does not approve of your unauthorized adblocker.");
LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(ConfigManager.PiHole, false));
}
}
}
namespace RemoveAds.Compat
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
internal class LobbyCompatibilityManager
{
public static LobbyCompatibilityManager Instance { get; private set; }
public static void Init()
{
if (Instance == null)
{
Instance = new LobbyCompatibilityManager();
}
}
private LobbyCompatibilityManager()
{
PluginHelper.RegisterPlugin("RemoveAds", new Version("1.0.0"), (CompatibilityLevel)0, (VersionStrictness)0);
}
}
}