using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("VentureValheim.NoSeasonalRestrictions")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VentureValheim.NoSeasonalRestrictions")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4DAFB458-BCCC-4956-B374-4B5AFA7F762C")]
[assembly: AssemblyFileVersion("0.1.8")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.8.0")]
[module: UnverifiableCode]
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 VentureValheim.NoSeasonalRestrictions
{
[BepInPlugin("com.orianaventure.mod.NoSeasonalRestrictions", "NoSeasonalRestrictions", "0.1.8")]
public class NoSeasonalRestrictionsPlugin : BaseUnityPlugin
{
private const string ModName = "NoSeasonalRestrictions";
private const string ModVersion = "0.1.8";
private const string Author = "com.orianaventure.mod";
private const string ModGUID = "com.orianaventure.mod.NoSeasonalRestrictions";
private readonly Harmony HarmonyInstance = new Harmony("com.orianaventure.mod.NoSeasonalRestrictions");
public static readonly ManualLogSource NoSeasonalRestrictionsLogger = Logger.CreateLogSource("NoSeasonalRestrictions");
public void Awake()
{
NoSeasonalRestrictionsLogger.LogInfo((object)"The weather is hot and snowy!");
Assembly executingAssembly = Assembly.GetExecutingAssembly();
HarmonyInstance.PatchAll(executingAssembly);
}
}
public class NoSeasonalRestrictions
{
[HarmonyPatch(typeof(ObjectDB), "Awake")]
public static class Patch_ObjectDB_Awake
{
private static void Postfix()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name.Equals("main"))
{
EnableSeasonalItems();
NoSeasonalRestrictionsPlugin.NoSeasonalRestrictionsLogger.LogInfo((object)"Done enabling seasonal items.");
}
}
}
private static readonly NoSeasonalRestrictions _instance = new NoSeasonalRestrictions();
public static NoSeasonalRestrictions Instance => _instance;
private NoSeasonalRestrictions()
{
}
private static void EnableSeasonalItems()
{
EnablePiece("piece_maypole");
EnablePiece("piece_jackoturnip");
EnablePiece("piece_gift1");
EnablePiece("piece_gift2");
EnablePiece("piece_gift3");
EnablePiece("piece_mistletoe");
EnablePiece("piece_xmascrown");
EnablePiece("piece_xmasgarland");
EnablePiece("piece_xmastree");
EnableRecipe("Recipe_HelmetMidsummerCrown");
EnableRecipe("Recipe_HelmetPointyHat");
}
private static void EnablePiece(string name)
{
try
{
ZNetScene.instance.GetPrefab(name).GetComponent<Piece>().m_enabled = true;
return;
}
catch
{
NoSeasonalRestrictionsPlugin.NoSeasonalRestrictionsLogger.LogWarning((object)("Error, skipping configuring Piece: " + name));
}
NoSeasonalRestrictionsPlugin.NoSeasonalRestrictionsLogger.LogWarning((object)("Not found, skipping configuring Piece: " + name));
}
private static void EnableRecipe(string name)
{
try
{
for (int i = 0; i < ObjectDB.instance.m_recipes.Count; i++)
{
Recipe val = ObjectDB.instance.m_recipes[i];
if ((Object)(object)val != (Object)null && ((Object)val).name.Equals(name))
{
ObjectDB.instance.m_recipes[i].m_enabled = true;
return;
}
}
}
catch
{
NoSeasonalRestrictionsPlugin.NoSeasonalRestrictionsLogger.LogWarning((object)("Error, skipping configuring Recipe: " + name));
}
NoSeasonalRestrictionsPlugin.NoSeasonalRestrictionsLogger.LogWarning((object)("Not found, skipping configuring Recipe: " + name));
}
}
}