using System;
using System.Collections.Generic;
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 BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Events;
[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("PikMoons")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Plugin for PF1MIL's PikMoons.")]
[assembly: AssemblyFileVersion("3.0.3.0")]
[assembly: AssemblyInformationalVersion("3.0.3+38e77137f99c22eb16c1fc54bb23bfab1429a451")]
[assembly: AssemblyProduct("PikMoons")]
[assembly: AssemblyTitle("PikMoons")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.0.3.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.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;
}
}
[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 PikMoons
{
public class Config
{
public ConfigEntry<bool> PIKMIN_MUSIC { get; private set; }
public ConfigEntry<float> MUSIC_VOLUME { get; private set; }
public Config(ConfigFile cfg)
{
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Expected O, but got Unknown
cfg.SaveOnConfigSet = false;
PIKMIN_MUSIC = cfg.Bind<bool>("Audio", "PikminMusic", true, "Enable Pikmin music and ambience.");
MUSIC_VOLUME = cfg.Bind<float>("Audio", "MusicVolume", 1f, new ConfigDescription("Change volume of outdoor Pikmin music.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>()));
ClearOrphanedEntries(cfg);
cfg.SaveOnConfigSet = true;
cfg.Save();
}
private void ClearOrphanedEntries(ConfigFile config)
{
PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries");
((Dictionary<ConfigDefinition, string>)propertyInfo.GetValue(config))?.Clear();
}
}
[BepInPlugin("PF1MIL.PikMoons", "PikMoons", "3.0.3")]
public class Plugin : BaseUnityPlugin
{
internal const string GUID = "PF1MIL.PikMoons";
internal const string PLUGIN_NAME = "PikMoons";
internal const string VERSION = "3.0.3";
internal static ManualLogSource? StaticLogger { get; private set; }
public static Config Settings { get; private set; }
private void Awake()
{
StaticLogger = ((BaseUnityPlugin)this).Logger;
try
{
Settings = new Config(((BaseUnityPlugin)this).Config);
ManualLogSource? staticLogger = StaticLogger;
if (staticLogger != null)
{
staticLogger.LogInfo((object)"'PikMoons' loaded!");
}
}
catch (Exception arg)
{
StaticLogger.LogError((object)string.Format("Error while initializing '{0}': {1}", "PikMoons", arg));
}
}
}
}
namespace PikMoons.Behaviours
{
public class ChangeSettings : MonoBehaviour
{
[SerializeField]
private AudioSource? musicSource;
[SerializeField]
private GameObject? brambleGates;
[SerializeField]
private GameObject? stoneGates;
[SerializeField]
private GameObject? electricGates;
[SerializeField]
private GameObject? waterDrains;
[SerializeField]
private GameObject? crushableBags;
[SerializeField]
private GameObject? clamclamps;
[SerializeField]
private GameObject? bombRocks;
[SerializeField]
private GameObject? pushableBox;
[SerializeField]
private GameObject? pelletPosies;
[SerializeField]
private GameObject? defaultFieldPellets;
[SerializeField]
private GameObject? customFieldPellets;
[SerializeField]
private GameObject? nectarGrassPatches;
[SerializeField]
private GameObject? nectarRockPatches;
[SerializeField]
private GameObject? eggs;
[SerializeField]
private GameObject? honeyWisps;
[SerializeField]
private GameObject? unmarkedSpectralids;
[SerializeField]
private GameObject? shovels;
[SerializeField]
private GameObject? extraParticles;
[SerializeField]
private GameObject? betaTrees;
[SerializeField]
private GameObject? snagretHoleOldTreeModel;
[SerializeField]
private GameObject? snagretHoleNewTreeModel;
[SerializeField]
private GameObject? waterGeysers;
[SerializeField]
private GameObject? fireGeysers;
[SerializeField]
private GameObject? gasPipes;
[SerializeField]
private GameObject? burgeoningSpiderwort;
[SerializeField]
private GameObject? easterEggs;
[SerializeField]
private GameObject? lightRayMeshes;
private float defaultVolume = 1f;
private void Start()
{
if ((Object)(object)musicSource != (Object)null)
{
defaultVolume = musicSource.volume;
musicSource.mute = !Plugin.Settings.PIKMIN_MUSIC.Value;
AudioSource? obj = musicSource;
obj.volume *= Plugin.Settings.MUSIC_VOLUME.Value;
Plugin.Settings.PIKMIN_MUSIC.SettingChanged += ChangeMusicMute;
Plugin.Settings.MUSIC_VOLUME.SettingChanged += ChangeMusicVolume;
}
}
private void OnDestroy()
{
Plugin.Settings.PIKMIN_MUSIC.SettingChanged -= ChangeMusicMute;
Plugin.Settings.MUSIC_VOLUME.SettingChanged -= ChangeMusicVolume;
}
private void ChangeMusicMute(object sender, EventArgs args)
{
if ((Object)(object)musicSource != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null && val.ChangedSetting is ConfigEntry<bool> val2)
{
musicSource.mute = !val2.Value;
}
}
}
private void ChangeMusicVolume(object sender, EventArgs args)
{
if ((Object)(object)musicSource != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null && val.ChangedSetting is ConfigEntry<float> val2)
{
musicSource.volume = defaultVolume * val2.Value;
}
}
}
private void ChangeBrambleGatesOn(object sender, EventArgs args)
{
if ((Object)(object)brambleGates != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null && val.ChangedSetting is ConfigEntry<bool> val2)
{
brambleGates.SetActive(!val2.Value);
}
}
}
private void ChangeStoneGatesOn(object sender, EventArgs args)
{
if ((Object)(object)stoneGates != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null && val.ChangedSetting is ConfigEntry<bool> val2)
{
stoneGates.SetActive(!val2.Value);
}
}
}
private void ChangeElectricGatesOn(object sender, EventArgs args)
{
if ((Object)(object)electricGates != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null && val.ChangedSetting is ConfigEntry<bool> val2)
{
electricGates.SetActive(!val2.Value);
}
}
}
private void ChangeWaterDrainsOn(object sender, EventArgs args)
{
if ((Object)(object)waterDrains != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null && val.ChangedSetting is ConfigEntry<bool> val2)
{
waterDrains.SetActive(!val2.Value);
}
}
}
private void ChangeCrushableBagsOn(object sender, EventArgs args)
{
if ((Object)(object)crushableBags != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null && val.ChangedSetting is ConfigEntry<bool> val2)
{
crushableBags.SetActive(!val2.Value);
}
}
}
private void ChangeClamclampsOn(object sender, EventArgs args)
{
if ((Object)(object)clamclamps != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null && val.ChangedSetting is ConfigEntry<bool> val2)
{
clamclamps.SetActive(!val2.Value);
}
}
}
private void ChangeBombRocksOn(object sender, EventArgs args)
{
if ((Object)(object)bombRocks != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null && val.ChangedSetting is ConfigEntry<bool> val2)
{
bombRocks.SetActive(!val2.Value);
}
}
}
private void ChangePushableBoxesOn(object sender, EventArgs args)
{
if ((Object)(object)pushableBox != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null && val.ChangedSetting is ConfigEntry<bool> val2)
{
pushableBox.SetActive(!val2.Value);
}
}
}
private void ChangePelletPosiesOn(object sender, EventArgs args)
{
if ((Object)(object)pelletPosies != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null && val.ChangedSetting is ConfigEntry<bool> val2)
{
pelletPosies.SetActive(!val2.Value);
}
}
}
private void ChangeDefaultFieldPelletsOn(object sender, EventArgs args)
{
if ((Object)(object)defaultFieldPellets != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null && val.ChangedSetting is ConfigEntry<bool> val2)
{
defaultFieldPellets.SetActive(!val2.Value);
}
}
}
private void ChangeCustomFieldPelletsOn(object sender, EventArgs args)
{
if ((Object)(object)customFieldPellets != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null && val.ChangedSetting is ConfigEntry<bool> val2)
{
customFieldPellets.SetActive(!val2.Value);
}
}
}
private void ChangeNectarGrassPatchesOn(object sender, EventArgs args)
{
if ((Object)(object)nectarGrassPatches != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null && val.ChangedSetting is ConfigEntry<bool> val2)
{
nectarGrassPatches.SetActive(!val2.Value);
}
}
}
private void ChangeNectarRockPatchesOn(object sender, EventArgs args)
{
if ((Object)(object)nectarRockPatches != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null && val.ChangedSetting is ConfigEntry<bool> val2)
{
nectarRockPatches.SetActive(!val2.Value);
}
}
}
private void ChangeEggsOn(object sender, EventArgs args)
{
if ((Object)(object)eggs != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null && val.ChangedSetting is ConfigEntry<bool> val2)
{
eggs.SetActive(!val2.Value);
}
}
}
private void ChangeHoneywispsOn(object sender, EventArgs args)
{
if ((Object)(object)honeyWisps != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null && val.ChangedSetting is ConfigEntry<bool> val2)
{
honeyWisps.SetActive(!val2.Value);
}
}
}
private void ChangeUnmarkedSpectralidsOn(object sender, EventArgs args)
{
if ((Object)(object)unmarkedSpectralids != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null && val.ChangedSetting is ConfigEntry<bool> val2)
{
unmarkedSpectralids.SetActive(!val2.Value);
}
}
}
private void ChangeBonusShovelsOn(object sender, EventArgs args)
{
if ((Object)(object)shovels != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null && val.ChangedSetting is ConfigEntry<bool> val2)
{
shovels.SetActive(!val2.Value);
}
}
}
private void ChangeExtraParticlesOn(object sender, EventArgs args)
{
if ((Object)(object)extraParticles != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null && val.ChangedSetting is ConfigEntry<bool> val2)
{
extraParticles.SetActive(!val2.Value);
}
}
}
private void ChangeBetaTreesOn(object sender, EventArgs args)
{
if ((Object)(object)betaTrees != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null && val.ChangedSetting is ConfigEntry<bool> val2)
{
betaTrees.SetActive(!val2.Value);
}
}
}
private void ChangeWaterGeysersOn(object sender, EventArgs args)
{
if ((Object)(object)waterGeysers != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null && val.ChangedSetting is ConfigEntry<bool> val2)
{
waterGeysers.SetActive(!val2.Value);
}
}
}
private void ChangeFireGeysersOn(object sender, EventArgs args)
{
if ((Object)(object)fireGeysers != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null && val.ChangedSetting is ConfigEntry<bool> val2)
{
fireGeysers.SetActive(!val2.Value);
}
}
}
private void ChangeGasPipesOn(object sender, EventArgs args)
{
if ((Object)(object)gasPipes != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null && val.ChangedSetting is ConfigEntry<bool> val2)
{
gasPipes.SetActive(!val2.Value);
}
}
}
private void ChangeBerryPlantsOn(object sender, EventArgs args)
{
if ((Object)(object)burgeoningSpiderwort != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null && val.ChangedSetting is ConfigEntry<bool> val2)
{
burgeoningSpiderwort.SetActive(!val2.Value);
}
}
}
private void ChangeEasterEggLocationsOn(object sender, EventArgs args)
{
if ((Object)(object)easterEggs != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null && val.ChangedSetting is ConfigEntry<bool> val2)
{
easterEggs.SetActive(!val2.Value);
}
}
}
private void ChangeLightRayMeshesOn(object sender, EventArgs args)
{
if ((Object)(object)lightRayMeshes != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null && val.ChangedSetting is ConfigEntry<bool> val2)
{
lightRayMeshes.SetActive(!val2.Value);
}
}
}
private void NewSnagretHoleGeometry(object sender, EventArgs args)
{
if ((Object)(object)snagretHoleNewTreeModel != (Object)null && (Object)(object)snagretHoleOldTreeModel != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null && val.ChangedSetting is ConfigEntry<bool> val2)
{
snagretHoleNewTreeModel.SetActive(!val2.Value);
snagretHoleOldTreeModel.SetActive(val2.Value);
}
}
}
}
public class SeesawBlocks : MonoBehaviour
{
internal int blockOneWeight;
internal int blockTwoWeight;
[field: Tooltip("Invoked when block one weighs more than block two, used to set animation trigger.")]
[field: SerializeField]
public UnityEvent OnBlockOneLower { get; set; } = new UnityEvent();
[field: Tooltip("Invoked when block two weighs more than block one, used to set animation trigger.")]
[field: SerializeField]
public UnityEvent OnBlockTwoLower { get; set; } = new UnityEvent();
public void Start()
{
}
public void Update()
{
}
public void OnEnable()
{
((Behaviour)this).enabled = false;
}
public void ChangeWeightOne(int oneChangeAmount)
{
if (((Behaviour)this).enabled)
{
blockOneWeight += oneChangeAmount;
CheckWeight();
}
}
public void ChangeWeightTwo(int twoChangeAmount)
{
if (((Behaviour)this).enabled)
{
blockTwoWeight += twoChangeAmount;
CheckWeight();
}
}
public void CheckWeight()
{
if (((Behaviour)this).enabled)
{
if (blockOneWeight > blockTwoWeight)
{
OnBlockOneLower.Invoke();
}
else if (blockOneWeight < blockTwoWeight)
{
OnBlockTwoLower.Invoke();
}
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}