Decompiled source of CustomTimer v1.0.1

plugins\GambleWithFriendsTimerMod.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
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("GambleWithFriendsTimerMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("GambleWithFriendsTimerMod")]
[assembly: AssemblyTitle("GambleWithFriendsTimerMod")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace GambleWithFriendsTimerMod
{
	[BepInPlugin("com.yourname.gamblewithfriends.customtimer", "Custom Timer Mod", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static ConfigEntry<float> CustomTimerValue;

		internal static ManualLogSource Logger;

		private void Awake()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin com.yourname.gamblewithfriends.customtimer is loaded!");
			CustomTimerValue = ((BaseUnityPlugin)this).Config.Bind<float>("General", "CustomTimerValue", 300f, "The duration of the timer in seconds. Default is 300 (5 minutes).");
			new Harmony("com.yourname.gamblewithfriends.customtimer").PatchAll();
			Logger.LogInfo((object)$"Patches applied. Custom timer set to {CustomTimerValue.Value} seconds.");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "com.yourname.gamblewithfriends.customtimer";

		public const string PLUGIN_NAME = "Custom Timer Mod";

		public const string PLUGIN_VERSION = "1.0.0";
	}
	[HarmonyPatch(typeof(GameManager))]
	internal class TimerPatch
	{
		[HarmonyPatch("StartDay")]
		[HarmonyPrefix]
		private static void Prefix(ref GameSettings ____gs)
		{
			if ((Object)(object)____gs != (Object)null)
			{
				____gs.dayDuration = Plugin.CustomTimerValue.Value;
				Plugin.Logger.LogInfo((object)$"[TimerPatch] Successfully overrode the timer to {Plugin.CustomTimerValue.Value} seconds.");
			}
		}
	}
}