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 GameNetcodeStuff;
using HarmonyLib;
using LethalMin;
using Microsoft.CodeAnalysis;
using PikMoons;
using UnityEngine;
using itolib.Behaviours.Grabbables;
using itolib.Behaviours.Networking;
using itolib.Behaviours.Props;
using itolib.Enums;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("NoteBoxz.LethalMin")]
[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.2.3.0")]
[assembly: AssemblyInformationalVersion("3.2.3+c0d14c0aafe8df251dcd592bdb9cbbe6d66f8c80")]
[assembly: AssemblyProduct("PikMoons")]
[assembly: AssemblyTitle("PikMoons")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.2.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.2.3")]
public class Plugin : BaseUnityPlugin
{
internal const string GUID = "PF1MIL.PikMoons";
internal const string PLUGIN_NAME = "PikMoons";
internal const string VERSION = "3.2.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))
{
return;
}
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null)
{
ConfigEntry<bool> val2 = val.ChangedSetting as ConfigEntry<bool>;
if (val2 == null)
{
}
}
}
private void ChangeBonusShovelsOn(object sender, EventArgs args)
{
if ((Object)(object)shovels != (Object)null)
{
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
ScrapSpawner val3 = default(ScrapSpawner);
if (val != null && val.ChangedSetting is ConfigEntry<bool> && ((Component)this).TryGetComponent<ScrapSpawner>(ref val3))
{
((NetworkedSpawner<GrabbableObject>)(object)val3).ActivationTime = (ActivationTime)4;
}
}
}
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))
{
return;
}
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null)
{
ConfigEntry<bool> val2 = val.ChangedSetting as ConfigEntry<bool>;
if (val2 == null)
{
}
}
}
private void ChangeEasterEggLocationsOn(object sender, EventArgs args)
{
if (!((Object)(object)easterEggs != (Object)null))
{
return;
}
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null);
if (val != null)
{
ConfigEntry<bool> val2 = val.ChangedSetting as ConfigEntry<bool>;
if (val2 == null)
{
}
}
}
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);
}
}
}
}
}
namespace Pikmoons.Behaviours
{
public class CaveMusicManager : MonoBehaviour
{
[Serializable]
public class CaveMusic
{
public AudioClip? defaultMusic;
public AudioClip? nearEnemyMusic;
public AudioClip? inBattleMusic;
public AudioClip? workingMusic;
public AudioClip? carryingTreasureMusic;
}
public MoonMusicManager currentMoonManager;
public AudioSource caveMusicSource;
internal PlayerControllerB localPlayerController;
internal bool isInCave;
public CaveMusic caveMusicClips;
public void Start()
{
localPlayerController = GameNetworkManager.Instance.localPlayerController;
}
public void Update()
{
}
public void SwapTrack()
{
int timeSamples = caveMusicSource.timeSamples;
caveMusicSource.Stop();
if (currentMoonManager.isInBattle)
{
caveMusicSource.clip = caveMusicClips.inBattleMusic;
}
else if (currentMoonManager.isNearEnemy)
{
caveMusicSource.clip = caveMusicClips.nearEnemyMusic;
}
else if (currentMoonManager.isCarryingTreasure)
{
caveMusicSource.clip = caveMusicClips.carryingTreasureMusic;
}
else if (currentMoonManager.isWorking)
{
caveMusicSource.clip = caveMusicClips.workingMusic;
}
else
{
caveMusicSource.clip = caveMusicClips.defaultMusic;
}
caveMusicSource.Play();
caveMusicSource.timeSamples = timeSamples;
}
public void PlayCaveMusic(bool playMusic)
{
if (playMusic)
{
currentMoonManager.pikminMusicSource.mute = true;
SwapTrack();
isInCave = true;
}
else
{
caveMusicSource.Stop();
currentMoonManager.pikminMusicSource.mute = false;
isInCave = false;
}
}
}
public class GrabbableToEnemiesDisabler : MonoBehaviour
{
private ItemGrabbable thisItem;
public void Awake()
{
thisItem = ((Component)this).GetComponent<ItemGrabbable>();
}
public void EnableGrabbableToEnemies(bool grabbable)
{
((GrabbableObject)thisItem).grabbableToEnemies = grabbable;
}
}
public class MoonMusicManager : MonoBehaviour
{
public enum TimeOfDay
{
Morning,
Day,
Night
}
[Serializable]
public class MorningMusic
{
public AudioClip? defaultMusic;
public AudioClip? nearEnemyMusic;
public AudioClip? inBattleMusic;
public AudioClip? workingMusic;
public AudioClip? carryingTreasureMusic;
public AudioClip? nearSpiderwortMusic;
}
[Serializable]
public class DayMusic
{
public AudioClip? defaultMusic;
public AudioClip? nearEnemyMusic;
public AudioClip? inBattleMusic;
public AudioClip? workingMusic;
public AudioClip? carryingTreasureMusic;
public AudioClip? nearSpiderwortMusic;
}
[Serializable]
public class NightMusic
{
public AudioClip? defaultMusic;
public AudioClip? nearEnemyMusic;
public AudioClip? inBattleMusic;
public AudioClip? workingMusic;
public AudioClip? carryingTreasureMusic;
public AudioClip? nearSpiderwortMusic;
}
[Serializable]
public class RainMusic
{
public AudioClip? defaultMusic;
public AudioClip? inBattleMusic;
public AudioClip? workingMusic;
public AudioClip? carryingTreasureMusic;
public AudioClip? nightMusic;
}
public AudioSource pikminMusicSource;
internal TimeOfDay currentTOD = TimeOfDay.Morning;
public bool useMorningMusic;
internal bool isNearEnemy;
internal bool isInBattle;
internal bool isWorking;
internal bool isCarryingTreasure;
internal bool isNearSpiderwort;
internal bool hasScrap;
internal bool isRaining;
internal PlayerControllerB localPlayerController;
[SerializeField]
private GameObject carriedScrapSensorPrefab;
internal GameObject spawnedCarriedScrapSensor;
internal float timer;
[SerializeField]
private List<CaveMusicManager> easterEggCaves;
public MorningMusic morningMusicClips;
public DayMusic dayMusicClips;
public NightMusic nightMusicClips;
public RainMusic rainMusicClips;
public void Start()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Invalid comparison between Unknown and I4
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Invalid comparison between Unknown and I4
localPlayerController = GameNetworkManager.Instance.localPlayerController;
LevelWeatherType currentWeather = RoundManager.Instance.currentLevel.currentWeather;
if ((currentWeather - 1 <= 1 || (int)currentWeather == 4) ? true : false)
{
isRaining = true;
}
if (useMorningMusic)
{
pikminMusicSource.clip = morningMusicClips.defaultMusic;
Plugin.StaticLogger.LogMessage((object)"PIKMOONS MUSIC MANAGER: Use Morning Music is set to true, setting clip to default morning music.");
}
else
{
currentTOD = TimeOfDay.Day;
pikminMusicSource.clip = dayMusicClips.defaultMusic;
Plugin.StaticLogger.LogMessage((object)"PIKMOONS MUSIC MANAGER: Use Morning Music is set to false, setting clip to default day music.");
}
SwapTrack();
Plugin.StaticLogger.LogMessage((object)"PIKMOONS MUSIC MANAGER: Starting music.");
if (Object.op_Implicit((Object)(object)((Component)localPlayerController).gameObject.GetComponentInChildren<PikminCarriedScrapSensor>()))
{
spawnedCarriedScrapSensor = ((Component)((Component)localPlayerController).gameObject.GetComponentInChildren<PikminCarriedScrapSensor>()).gameObject;
return;
}
SpawnCarriedScrapSensor();
spawnedCarriedScrapSensor.GetComponent<PikminCarriedScrapSensor>().SetMusicManager(((Component)this).gameObject.GetComponent<MoonMusicManager>());
}
public void Update()
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
if (timer < 10f)
{
timer += Time.deltaTime;
}
else
{
spawnedCarriedScrapSensor.transform.position = ((Component)localPlayerController).transform.position;
}
int num = 0;
for (int i = 0; i < localPlayerController.ItemSlots.Length; i++)
{
if ((Object)(object)localPlayerController.ItemSlots[i] != (Object)null && localPlayerController.ItemSlots[i].itemProperties.isScrap)
{
num++;
}
}
if (num > 0)
{
if (!isWorking)
{
isWorking = true;
SwapTrack();
}
}
else if (isWorking)
{
isWorking = false;
SwapTrack();
}
if (StartOfRound.Instance.fearLevel >= 0.5f && !isInBattle)
{
isInBattle = true;
SwapTrack();
return;
}
float fearLevel = StartOfRound.Instance.fearLevel;
if (fearLevel >= 0.01f && fearLevel <= 0.5f && !isNearEnemy)
{
isInBattle = false;
isNearEnemy = true;
SwapTrack();
}
else if (StartOfRound.Instance.fearLevel < 0.01f && (isInBattle || isNearEnemy))
{
isInBattle = false;
isNearEnemy = false;
SwapTrack();
}
}
public void IncrementTimeOfDay()
{
TimeOfDay timeOfDay = currentTOD;
switch (currentTOD)
{
case TimeOfDay.Morning:
currentTOD = TimeOfDay.Day;
break;
case TimeOfDay.Day:
currentTOD = TimeOfDay.Night;
break;
case TimeOfDay.Night:
Plugin.StaticLogger.LogError((object)"PIKMOONS MUSIC MANAGER: Time of Day was already night, and cannot be incremented further.");
return;
}
Plugin.StaticLogger.LogMessage((object)("PIKMOONS MUSIC MANAGER: Time of Day has been incremented from " + timeOfDay.ToString() + " to " + currentTOD.ToString() + ". Swapping music track accordingly."));
SwapTrack();
}
public void DecrementTimeOfDay()
{
TimeOfDay timeOfDay = currentTOD;
switch (currentTOD)
{
case TimeOfDay.Morning:
Plugin.StaticLogger.LogMessage((object)"PIKMOONS MUSIC MANAGER: Time of Day was already set to Morning, and cannot be decremented further.");
break;
case TimeOfDay.Day:
if (!useMorningMusic)
{
Plugin.StaticLogger.LogError((object)"PIKMOONS MUSIC MANAGER: Time of Day cannot be decremented to Morning, due to UseMorning bool state.");
return;
}
currentTOD = TimeOfDay.Morning;
break;
case TimeOfDay.Night:
currentTOD = TimeOfDay.Day;
return;
}
Plugin.StaticLogger.LogMessage((object)("PIKMOONS MUSIC MANAGER: Time of Day has been decremented from " + timeOfDay.ToString() + " to " + currentTOD.ToString() + ". Swapping music track accordingly."));
SwapTrack();
}
public void FlagInBattle(bool inBattle)
{
if (inBattle)
{
if (isInBattle)
{
Plugin.StaticLogger.LogMessage((object)"PIKMOONS MUSIC MANAGER: 'in battle' was already flagged.");
return;
}
Plugin.StaticLogger.LogMessage((object)"PIKMOONS MUSIC MANAGER: 'in battle' has been flagged.");
}
else if (!inBattle)
{
if (!isInBattle)
{
Plugin.StaticLogger.LogMessage((object)"PIKMOONS MUSIC MANAGER: 'in battle' was already unflagged.");
return;
}
Plugin.StaticLogger.LogMessage((object)"PIKMOONS MUSIC MANAGER: 'in battle' has been unflagged.");
}
isInBattle = inBattle;
SwapTrack();
}
public void FlagNearEnemy(bool nearEnemy)
{
if (nearEnemy)
{
if (isNearEnemy)
{
Plugin.StaticLogger.LogMessage((object)"PIKMOONS MUSIC MANAGER: 'near enemy' was already flagged.");
return;
}
Plugin.StaticLogger.LogMessage((object)"PIKMOONS MUSIC MANAGER: 'near enemy' has been flagged.");
}
else if (!nearEnemy)
{
if (!isNearEnemy)
{
Plugin.StaticLogger.LogMessage((object)"PIKMOONS MUSIC MANAGER: 'near enemy' was already unflagged.");
return;
}
Plugin.StaticLogger.LogMessage((object)"PIKMOONS MUSIC MANAGER: 'near enemy' has been unflagged.");
}
isNearEnemy = nearEnemy;
SwapTrack();
}
public void FlagNearSpiderwort(bool nearSpiderwort)
{
if (nearSpiderwort)
{
if (isNearSpiderwort)
{
Plugin.StaticLogger.LogMessage((object)"PIKMOONS MUSIC MANAGER: 'near spiderwort' was already flagged.");
return;
}
Plugin.StaticLogger.LogMessage((object)"PIKMOONS MUSIC MANAGER: 'near spiderwort' has been flagged.");
}
else if (!nearSpiderwort)
{
if (!isNearSpiderwort)
{
Plugin.StaticLogger.LogMessage((object)"PIKMOONS MUSIC MANAGER: 'near spiderwort' was already unflagged.");
return;
}
Plugin.StaticLogger.LogMessage((object)"PIKMOONS MUSIC MANAGER: 'near spiderwort' has been unflagged.");
}
isNearSpiderwort = nearSpiderwort;
SwapTrack();
}
public void FlagCarryingTreasure(bool carryingTreasure)
{
if (carryingTreasure)
{
if (isCarryingTreasure)
{
Plugin.StaticLogger.LogMessage((object)"PIKMOONS MUSIC MANAGER: 'carrying treasure' was already flagged.");
return;
}
Plugin.StaticLogger.LogMessage((object)"PIKMOONS MUSIC MANAGER: 'carrying treasure' has been flagged.");
}
else if (!carryingTreasure)
{
if (!isCarryingTreasure)
{
Plugin.StaticLogger.LogMessage((object)"PIKMOONS MUSIC MANAGER: 'carrying treasure' was already unflagged.");
return;
}
Plugin.StaticLogger.LogMessage((object)"PIKMOONS MUSIC MANAGER: 'carrying treasure' has been unflagged.");
}
isCarryingTreasure = carryingTreasure;
SwapTrack();
}
public void FlagWorking(bool working)
{
if (working)
{
if (isWorking)
{
Plugin.StaticLogger.LogMessage((object)"PIKMOONS MUSIC MANAGER: 'working' was already flagged.");
return;
}
Plugin.StaticLogger.LogMessage((object)"PIKMOONS MUSIC MANAGER: 'working' has been flagged.");
}
else if (!working)
{
if (!isWorking)
{
Plugin.StaticLogger.LogMessage((object)"PIKMOONS MUSIC MANAGER: 'working' was already unflagged.");
return;
}
Plugin.StaticLogger.LogMessage((object)"PIKMOONS MUSIC MANAGER: 'working' has been unflagged.");
}
isWorking = working;
SwapTrack();
}
public void SwapTrack()
{
int timeSamples = pikminMusicSource.timeSamples;
pikminMusicSource.Stop();
if (isInBattle)
{
if (isRaining)
{
TimeOfDay timeOfDay = currentTOD;
if ((uint)timeOfDay <= 1u)
{
pikminMusicSource.clip = rainMusicClips.inBattleMusic;
}
else
{
pikminMusicSource.clip = rainMusicClips.nightMusic;
}
}
else
{
switch (currentTOD)
{
case TimeOfDay.Morning:
pikminMusicSource.clip = morningMusicClips.inBattleMusic;
break;
case TimeOfDay.Day:
pikminMusicSource.clip = dayMusicClips.inBattleMusic;
break;
case TimeOfDay.Night:
pikminMusicSource.clip = nightMusicClips.inBattleMusic;
break;
}
}
}
else if (isNearEnemy)
{
if (isRaining)
{
TimeOfDay timeOfDay = currentTOD;
if ((uint)timeOfDay <= 1u)
{
pikminMusicSource.clip = rainMusicClips.inBattleMusic;
}
else
{
pikminMusicSource.clip = rainMusicClips.nightMusic;
}
}
else
{
switch (currentTOD)
{
case TimeOfDay.Morning:
pikminMusicSource.clip = morningMusicClips.nearEnemyMusic;
break;
case TimeOfDay.Day:
pikminMusicSource.clip = dayMusicClips.nearEnemyMusic;
break;
case TimeOfDay.Night:
pikminMusicSource.clip = nightMusicClips.nearEnemyMusic;
break;
}
}
}
else if (isNearSpiderwort)
{
if (isRaining)
{
TimeOfDay timeOfDay = currentTOD;
if ((uint)timeOfDay <= 1u)
{
pikminMusicSource.clip = rainMusicClips.carryingTreasureMusic;
}
else
{
pikminMusicSource.clip = rainMusicClips.nightMusic;
}
}
else
{
switch (currentTOD)
{
case TimeOfDay.Morning:
pikminMusicSource.clip = morningMusicClips.nearSpiderwortMusic;
break;
case TimeOfDay.Day:
pikminMusicSource.clip = dayMusicClips.nearSpiderwortMusic;
break;
case TimeOfDay.Night:
pikminMusicSource.clip = nightMusicClips.nearSpiderwortMusic;
break;
}
}
}
else if (isCarryingTreasure)
{
if (isRaining)
{
TimeOfDay timeOfDay = currentTOD;
if ((uint)timeOfDay <= 1u)
{
pikminMusicSource.clip = rainMusicClips.carryingTreasureMusic;
}
else
{
pikminMusicSource.clip = rainMusicClips.nightMusic;
}
}
else
{
switch (currentTOD)
{
case TimeOfDay.Morning:
pikminMusicSource.clip = morningMusicClips.carryingTreasureMusic;
break;
case TimeOfDay.Day:
pikminMusicSource.clip = dayMusicClips.carryingTreasureMusic;
break;
case TimeOfDay.Night:
pikminMusicSource.clip = nightMusicClips.carryingTreasureMusic;
break;
}
}
}
else if (isWorking)
{
if (isRaining)
{
TimeOfDay timeOfDay = currentTOD;
if ((uint)timeOfDay <= 1u)
{
pikminMusicSource.clip = rainMusicClips.workingMusic;
}
else
{
pikminMusicSource.clip = rainMusicClips.nightMusic;
}
}
else
{
switch (currentTOD)
{
case TimeOfDay.Morning:
pikminMusicSource.clip = morningMusicClips.workingMusic;
break;
case TimeOfDay.Day:
pikminMusicSource.clip = dayMusicClips.workingMusic;
break;
case TimeOfDay.Night:
pikminMusicSource.clip = nightMusicClips.workingMusic;
break;
}
}
}
else if (isRaining)
{
TimeOfDay timeOfDay = currentTOD;
if ((uint)timeOfDay <= 1u)
{
pikminMusicSource.clip = rainMusicClips.defaultMusic;
}
else
{
pikminMusicSource.clip = rainMusicClips.nightMusic;
}
}
else
{
switch (currentTOD)
{
case TimeOfDay.Morning:
pikminMusicSource.clip = morningMusicClips.defaultMusic;
break;
case TimeOfDay.Day:
pikminMusicSource.clip = dayMusicClips.defaultMusic;
break;
case TimeOfDay.Night:
pikminMusicSource.clip = nightMusicClips.defaultMusic;
break;
}
}
pikminMusicSource.Play();
pikminMusicSource.timeSamples = timeSamples;
if (easterEggCaves == null)
{
return;
}
foreach (CaveMusicManager easterEggCafe in easterEggCaves)
{
if (easterEggCafe.isInCave)
{
easterEggCafe.SwapTrack();
}
}
}
public void SpawnCarriedScrapSensor()
{
spawnedCarriedScrapSensor = Object.Instantiate<GameObject>(carriedScrapSensorPrefab);
spawnedCarriedScrapSensor.transform.parent = ((Component)localPlayerController).transform;
}
}
public class PikminCarriedScrapSensor : MonoBehaviour
{
internal MoonMusicManager localMoonMusicManager;
internal int carriedInRangeCount;
internal List<PikminItem> itemsInRange;
public void Start()
{
}
public void Update()
{
int num = 0;
if (itemsInRange != null)
{
foreach (PikminItem item in itemsInRange)
{
if (item.IsBeingCarried)
{
num++;
}
}
}
if (carriedInRangeCount > 0 && !localMoonMusicManager.isCarryingTreasure)
{
localMoonMusicManager.isCarryingTreasure = true;
localMoonMusicManager.SwapTrack();
}
else if (carriedInRangeCount == 0 && localMoonMusicManager.isCarryingTreasure)
{
localMoonMusicManager.isCarryingTreasure = false;
localMoonMusicManager.SwapTrack();
}
}
public void OnTriggerEnter(Collider other)
{
GrabbableObject val = default(GrabbableObject);
if (((Component)other).TryGetComponent<GrabbableObject>(ref val))
{
itemsInRange.Add(((Component)val).GetComponent<PikminItem>());
Plugin.StaticLogger.LogMessage((object)"PIKMOONS CARRY SENSOR: Nearby PikminItem added to list.");
}
}
public void OnTriggerExit(Collider other)
{
GrabbableObject val = default(GrabbableObject);
if (((Component)other).TryGetComponent<GrabbableObject>(ref val) && itemsInRange.Contains(((Component)val).GetComponent<PikminItem>()))
{
if (itemsInRange.Remove(((Component)val).GetComponent<PikminItem>()))
{
Plugin.StaticLogger.LogMessage((object)"PIKMOONS CARRY SENSOR: Nearby PikminItem left sensor range; removed from list.");
}
else
{
Plugin.StaticLogger.LogError((object)"PIKMOONS CARRY SENSOR: Nearby PikminItem that left sensor range was not in list, or removal has failed.");
}
}
}
public void SetMusicManager(MoonMusicManager manager)
{
localMoonMusicManager = manager;
}
}
public class ReceiveShadowsOff : MonoBehaviour
{
public void Awake()
{
MeshRenderer val = default(MeshRenderer);
if (((Component)((Component)this).transform).TryGetComponent<MeshRenderer>(ref val))
{
((Renderer)val).receiveShadows = false;
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}