using System;
using System.Collections;
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 KinsChaoticTrials;
using KinsChaoticTrials.Events;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Toasts_Dastardly_Coconut_of_Doom")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Toasts_Dastardly_Coconut_of_Doom")]
[assembly: AssemblyTitle("ToastsDastardlyCoconutofDoom")]
[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.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 toastscocoofdoom
{
[HarmonyPatch(typeof(Character), "Awake")]
internal static class addCocoHandler
{
internal static void Postfix(Character __instance)
{
if (__instance.IsLocal && PhotonNetwork.IsMasterClient)
{
((Component)__instance).gameObject.AddComponent<cocoHandler>();
}
}
}
internal class cocoHandler : MonoBehaviour
{
internal float clock;
internal void Update()
{
clock += Time.deltaTime;
if (clock > Plugin.timer.Value)
{
float num = Random.Range(1, 101);
if (Plugin.percentChance.Value > num)
{
((MonoBehaviour)this).StartCoroutine((IEnumerator)cocoRoutine());
}
clock = 0f;
}
}
public IEnumerator<WaitForSeconds> cocoRoutine()
{
Character chosenOne = Character.AllCharacters[Random.Range(0, Character.AllCharacters.Count)];
for (int i = 0; i < Plugin.amountOfPlayersTarget.Value; i++)
{
chosenOne = Character.AllCharacters[Random.Range(0, Character.AllCharacters.Count)];
if (!chosenOne.inAirport)
{
GameObject coco = PhotonNetwork.Instantiate("0_items/Item_Coconut", chosenOne.Center + Vector3.up * 10f, Quaternion.identity, (byte)0, (object[])null);
try
{
Item cocoItem = coco.GetComponent<Item>();
cocoItem.rig.AddForce(Vector3.down * 250f);
}
catch (Exception)
{
}
}
yield return new WaitForSeconds(1f);
}
yield return new WaitForSeconds(6f);
if (chosenOne.inAirport)
{
yield break;
}
for (int o = 0; o < Plugin.amountOfEventProcs.Value; o++)
{
foreach (ChaosEvent c in KinsChaoticTrials.all_events)
{
bool runIt = true;
Type type = ((object)c).GetType();
if (!Plugin.EruptionOn.Value && type == typeof(EruptionChaosEvent))
{
runIt = false;
}
else if (!Plugin.TumbleOn.Value && type == typeof(TumbleweedChaosEvent))
{
runIt = false;
}
else if (!Plugin.TornadoOn.Value && type == typeof(TornadoChaosEvent))
{
runIt = false;
}
else if (!Plugin.PeelOn.Value && type == typeof(PeelChaosEvent))
{
runIt = false;
}
else if (!Plugin.RemedyOn.Value && type == typeof(RemedyChaosEvent))
{
runIt = false;
}
else if (!Plugin.ScorpionOn.Value && type == typeof(ScorpionChaosEvent))
{
runIt = false;
}
else if (!Plugin.DynamiteOn.Value && type == typeof(DynamiteChaosEvent))
{
runIt = false;
}
if (c != null && runIt)
{
c.Trigger();
}
}
}
}
}
[BepInPlugin("toastsdastardlycoconutofdoom", "toastsdastardlycoconutofdoom", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
internal static ConfigEntry<float> percentChance;
internal static ConfigEntry<float> timer;
internal static ConfigEntry<int> amountOfPlayersTarget;
internal static ConfigEntry<int> amountOfEventProcs;
internal static ConfigEntry<bool> EruptionOn;
internal static ConfigEntry<bool> TumbleOn;
internal static ConfigEntry<bool> TornadoOn;
internal static ConfigEntry<bool> PeelOn;
internal static ConfigEntry<bool> RemedyOn;
internal static ConfigEntry<bool> ScorpionOn;
internal static ConfigEntry<bool> DynamiteOn;
internal static List<ChaosEvent> eventList = new List<ChaosEvent>();
internal static ManualLogSource Log { get; private set; } = null;
private void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Expected O, but got Unknown
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Expected O, but got Unknown
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Expected O, but got Unknown
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
//IL_01de: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Expected O, but got Unknown
eventList.Add((ChaosEvent)new EruptionChaosEvent());
eventList.Add((ChaosEvent)new TumbleweedChaosEvent());
eventList.Add((ChaosEvent)new TornadoChaosEvent());
eventList.Add((ChaosEvent)new PeelChaosEvent());
eventList.Add((ChaosEvent)new RemedyChaosEvent());
eventList.Add((ChaosEvent)new ScorpionChaosEvent());
eventList.Add((ChaosEvent)new DynamiteChaosEvent());
EruptionOn = ((BaseUnityPlugin)this).Config.Bind<bool>("Events Active For Coconut", "Eruptions", false, (ConfigDescription)null);
TumbleOn = ((BaseUnityPlugin)this).Config.Bind<bool>("Events Active For Coconut", "Tumbles", true, (ConfigDescription)null);
TornadoOn = ((BaseUnityPlugin)this).Config.Bind<bool>("Events Active For Coconut", "Tornados", true, (ConfigDescription)null);
PeelOn = ((BaseUnityPlugin)this).Config.Bind<bool>("Events Active For Coconut", "Peels", true, (ConfigDescription)null);
RemedyOn = ((BaseUnityPlugin)this).Config.Bind<bool>("Events Active For Coconut", "Remedys", true, (ConfigDescription)null);
ScorpionOn = ((BaseUnityPlugin)this).Config.Bind<bool>("Events Active For Coconut", "Scorpions", false, (ConfigDescription)null);
DynamiteOn = ((BaseUnityPlugin)this).Config.Bind<bool>("Events Active For Coconut", "Dynamite", false, (ConfigDescription)null);
percentChance = ((BaseUnityPlugin)this).Config.Bind<float>("Coco of Doom", "Percent Chance", 1f, "Percent chance for it to proc");
timer = ((BaseUnityPlugin)this).Config.Bind<float>("Coco of Doom", "Timer", 60f, "How many seconds it takes to roll");
amountOfPlayersTarget = ((BaseUnityPlugin)this).Config.Bind<int>("Coco of Doom", "Coco spawns", 1, "How many coconuts will spawn on random players");
amountOfEventProcs = ((BaseUnityPlugin)this).Config.Bind<int>("Coco of Doom", "Event Procs", 5, "How many events proc after the coconut spawns");
Log = ((BaseUnityPlugin)this).Logger;
Log.LogInfo((object)"Plugin toastsdastardlycoconutofdoom is loaded!");
Harmony val = new Harmony("toastsdastardlycoconutofdoom");
val.PatchAll();
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}