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 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("Oh_Good_Lord_the_Scoutmasters_are_Plentiful")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Oh_Good_Lord_the_Scoutmasters_are_Plentiful")]
[assembly: AssemblyTitle("OhGoodLordtheScoutmastersarePlentiful")]
[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 ogltsap
{
[HarmonyPatch(typeof(Character), "Awake")]
internal static class PlentifulMe
{
internal static void Postfix(Character __instance)
{
((Component)__instance).gameObject.AddComponent<ThePlentifulnessIsEverywhere>().character = __instance;
}
}
internal class ThePlentifulnessIsEverywhere : MonoBehaviour
{
public Character character;
public Character scoutmasterChasingThisFella;
public Scoutmaster scoutyComponent;
public bool beingChasedRN = false;
public float graceTimer = Plugin.gracePeriod.Value;
public void Awake()
{
((MonoBehaviour)this).StartCoroutine((IEnumerator)doit());
}
public IEnumerator<WaitForSeconds> doit()
{
yield return new WaitForSeconds(20f);
while (!character.inAirport && PhotonNetwork.IsMasterClient && !character.isBot && Plugin.plentifulMode.Value)
{
graceTimer -= 1f;
try
{
if ((Object)(object)scoutyComponent.currentTarget == (Object)null)
{
beingChasedRN = false;
}
else
{
graceTimer = Plugin.gracePeriod.Value;
}
}
catch
{
beingChasedRN = false;
}
foreach (Character c2 in Character.AllCharacters)
{
if (beingChasedRN || !(graceTimer < 0f) || !(character.Center.y - c2.Center.y > Plugin.minDistanceForChase.Value) || (c2.data.dead && character.data.dead && c2.data.passedOut && character.data.passedOut))
{
continue;
}
if ((Object)(object)scoutmasterChasingThisFella != (Object)null)
{
scoutyComponent.currentTarget = null;
scoutyComponent.SetCurrentTarget(character, Plugin.forcedChaseTime.Value);
}
else
{
scoutmasterChasingThisFella = PhotonNetwork.InstantiateRoomObject("Character_Scoutmaster", ((Component)this).transform.position, ((Component)this).transform.rotation, (byte)0, (object[])null).GetComponent<Character>();
scoutyComponent = ((Component)scoutmasterChasingThisFella).gameObject.GetComponent<Scoutmaster>();
scoutmasterChasingThisFella.data.spawnPoint = ((Component)this).transform;
}
if (Plugin.maxScoutmasters.Value < 30)
{
Scoutmaster[] allScoutMs = Object.FindObjectsByType<Scoutmaster>((FindObjectsInactive)1, (FindObjectsSortMode)0);
if (allScoutMs.Length > Plugin.maxScoutmasters.Value)
{
graceTimer = Plugin.gracePeriod.Value;
yield return new WaitForSeconds(5f);
}
}
yield return new WaitForSeconds(0.01f);
scoutyComponent.SetCurrentTarget(character, Plugin.forcedChaseTime.Value);
beingChasedRN = true;
break;
}
yield return new WaitForSeconds(1f);
}
Scoutmaster scoutmaster = default(Scoutmaster);
while (!character.inAirport && PhotonNetwork.IsMasterClient && !character.isBot)
{
graceTimer -= 1f;
Scoutmaster.GetPrimaryScoutmaster(ref scoutmaster);
if ((Object)(object)scoutmaster.currentTarget != (Object)null)
{
graceTimer = Plugin.gracePeriod.Value;
}
foreach (Character c in Character.AllCharacters)
{
if (graceTimer < 0f && character.Center.y - c.Center.y > Plugin.minDistanceForChase.Value && Object.op_Implicit((Object)(object)scoutmaster))
{
scoutmaster.SetCurrentTarget(character, Plugin.forcedChaseTime.Value);
}
}
yield return new WaitForSeconds(1f);
scoutmaster = null;
}
}
}
[BepInPlugin("ohgoodlordthescoutmastersareplentiful", "ohgoodlordthescoutmastersareplentiful", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
internal static ConfigEntry<bool> plentifulMode;
internal static ConfigEntry<int> maxScoutmasters;
internal static int currentScoutmasterCount;
internal static ConfigEntry<float> minDistanceForChase;
internal static ConfigEntry<float> forcedChaseTime;
internal static ConfigEntry<float> gracePeriod;
internal static ManualLogSource Log { get; private set; }
private void Awake()
{
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Expected O, but got Unknown
plentifulMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Plentiful Mode", "Enabled", false, "Allows many scoutmasters to spawn");
maxScoutmasters = ((BaseUnityPlugin)this).Config.Bind<int>("Plentiful Mode", "Max Scoutmasters (30 or more means no max)", 30, "Max amount of scoutmasters");
minDistanceForChase = ((BaseUnityPlugin)this).Config.Bind<float>("Rule 0 Stuff", "Minimum Height Difference for a Scoutmaster Chase", 150f, (ConfigDescription)null);
forcedChaseTime = ((BaseUnityPlugin)this).Config.Bind<float>("Rule 0 Stuff", "Forced Chase Time", 30f, (ConfigDescription)null);
gracePeriod = ((BaseUnityPlugin)this).Config.Bind<float>("Rule 0 Stuff", "Grace Period", 45f, (ConfigDescription)null);
Log = ((BaseUnityPlugin)this).Logger;
Log.LogInfo((object)"Plugin oh good lord the scoutmasters are plentiful is loaded!");
Harmony val = new Harmony("ogltsap");
val.PatchAll();
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}