using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using ArcadiaMoonPlugin.NetcodePatcher;
using BepInEx;
using BepInEx.Configuration;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Rendering;
[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: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[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 ArcadiaMoonPlugin
{
[BepInPlugin("ArcadiaMoonPlugin", "ArcadiaMoonPlugin", "1.4.0")]
public class ArcadiaMoonPlugin : BaseUnityPlugin
{
private Harmony harmony;
public static ArcadiaMoonPlugin instance;
public static ConfigEntry<bool> ForceSpawnFlowerman { get; private set; }
public static ConfigEntry<bool> ForceSpawnBaboon { get; private set; }
public static ConfigEntry<bool> ForceSpawnRadMech { get; private set; }
private void Awake()
{
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Expected O, but got Unknown
instance = this;
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ArcadiaMoonPlugin is loaded!");
ForceSpawnFlowerman = ((BaseUnityPlugin)this).Config.Bind<bool>("Spawning", "ForceSpawnFlowerman", true, "Enable custom deterministic spawner for Bracken");
ForceSpawnBaboon = ((BaseUnityPlugin)this).Config.Bind<bool>("Spawning", "ForceSpawnBaboon", true, "Enable custom deterministic spawner for Baboon hawk");
ForceSpawnRadMech = ((BaseUnityPlugin)this).Config.Bind<bool>("Spawning", "ForceSpawnRadMech", true, "Enable custom deterministic spawner for Old Bird");
harmony = new Harmony("ArcadiaMoonPlugin");
harmony.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ArcadiaMoonPlugin patched PlayerControllerB!");
}
}
public class EnemySpawner : MonoBehaviour
{
[SerializeField]
private string enemyName = "RadMech";
[SerializeField]
private float timer = 0.5f;
private EnemyType enemyType;
private GameObject nestPrefab;
private List<GameObject> spawnedNests = new List<GameObject>();
private Random random = new Random(StartOfRound.Instance.randomMapSeed + 42);
private void LoadResources(string enemyName)
{
IEnumerable<EnemyType> source = Resources.FindObjectsOfTypeAll<EnemyType>().Distinct();
enemyType = source.FirstOrDefault((Func<EnemyType, bool>)((EnemyType e) => e.enemyName == enemyName));
if ((Object)(object)enemyType != (Object)null)
{
nestPrefab = enemyType.nestSpawnPrefab;
Debug.Log((object)(enemyType.enemyName + " and its prefab loaded successfully!"));
}
else
{
Debug.LogError((object)"Failed to load EnemyType!");
}
}
private void Start()
{
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Expected O, but got Unknown
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
if (!GameNetworkManager.Instance.isHostingGame)
{
return;
}
LoadResources(enemyName);
if (!IsSpawningEnabled())
{
Debug.Log((object)("Forced spawning for " + enemyName + " is disabled in the config."));
((Behaviour)this).enabled = false;
return;
}
foreach (Transform item in ((Component)this).transform)
{
Transform val = item;
if ((Object)(object)nestPrefab != (Object)null)
{
Debug.Log((object)"Started nest prefab spawning routine!");
Vector3 randomNavMeshPositionInBoxPredictable = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(val.position, 10f, default(NavMeshHit), random, RoundManager.Instance.GetLayermaskForEnemySizeLimit(enemyType), 1f);
randomNavMeshPositionInBoxPredictable = RoundManager.Instance.PositionEdgeCheck(randomNavMeshPositionInBoxPredictable, enemyType.nestSpawnPrefabWidth);
GameObject val2 = Object.Instantiate<GameObject>(nestPrefab, randomNavMeshPositionInBoxPredictable, Quaternion.identity);
val2.transform.Rotate(Vector3.up, (float)random.Next(-180, 180), (Space)0);
spawnedNests.Add(val2);
if (Object.op_Implicit((Object)(object)val2.GetComponentInChildren<NetworkObject>()))
{
val2.GetComponentInChildren<NetworkObject>().Spawn(true);
Debug.Log((object)("Spawned an " + enemyName + " nest prefab!"));
}
else
{
Debug.LogError((object)("Nest prefab of " + enemyName + " does not have a NetworkObject component. Desync possible!"));
}
}
}
}
private void Update()
{
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Expected O, but got Unknown
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
if (!(TimeOfDay.Instance.normalizedTimeOfDay > timer) || !TimeOfDay.Instance.timeHasStarted || !GameNetworkManager.Instance.isHostingGame)
{
return;
}
if ((Object)(object)nestPrefab != (Object)null)
{
foreach (GameObject spawnedNest in spawnedNests)
{
Vector3 position = spawnedNest.transform.position;
Quaternion rotation = spawnedNest.transform.rotation;
float y = ((Quaternion)(ref rotation)).eulerAngles.y;
Object.Destroy((Object)(object)spawnedNest);
SpawnEnemyAtPosition(position, y);
Debug.Log((object)("Spawned enemy " + enemyName + " in place of a nest prefab!"));
}
spawnedNests.Clear();
Debug.Log((object)("Destroyed all spawned enemy nest prefabs of " + enemyType.enemyName + "!"));
}
else
{
foreach (Transform item in ((Component)this).transform)
{
Transform val = item;
SpawnEnemyAtPosition(val.position);
Debug.Log((object)"Force spawned an enemy!");
}
}
((Behaviour)this).enabled = false;
}
private void SpawnEnemyAtPosition(Vector3 position, float yRot = 0f)
{
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
Debug.Log((object)("Current enemy type for force spawn is " + enemyType.enemyName));
if ((Object)(object)enemyType.enemyPrefab == (Object)null)
{
Debug.LogError((object)(enemyType.enemyName + " does not have a valid enemy prefab to spawn."));
}
else
{
RoundManager.Instance.SpawnEnemyGameObject(position, yRot, -1, enemyType);
}
}
private bool IsSpawningEnabled()
{
string text = enemyName.ToLower();
if (1 == 0)
{
}
bool result = text switch
{
"flowerman" => ArcadiaMoonPlugin.ForceSpawnFlowerman.Value,
"baboon hawk" => ArcadiaMoonPlugin.ForceSpawnBaboon.Value,
"radmech" => ArcadiaMoonPlugin.ForceSpawnRadMech.Value,
_ => true,
};
if (1 == 0)
{
}
return result;
}
}
internal class HeatwaveZoneInteract : MonoBehaviour
{
[SerializeField]
private float timeInHeatZoneMax = 10f;
[SerializeField]
private Volume exhaustionFilter;
public bool CheckConditionsForHeatingPause(PlayerControllerB playerController)
{
if (!playerController.inSpecialInteractAnimation && !Object.op_Implicit((Object)(object)playerController.inAnimationWithEnemy) && !playerController.isClimbingLadder)
{
return (Object)(object)playerController.physicsParent != (Object)null;
}
return true;
}
public bool CheckConditionsForHeatingStop(PlayerControllerB playerController)
{
if (!playerController.beamUpParticle.isPlaying && !playerController.isInElevator)
{
return playerController.isInHangarShipRoom;
}
return true;
}
private void OnTriggerEnter(Collider other)
{
if (((Component)other).CompareTag("Player"))
{
PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
if (!((Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController))
{
PlayerHeatManager.SetEffectsVolume(exhaustionFilter);
}
}
}
private void OnTriggerStay(Collider other)
{
if (!((Component)other).CompareTag("Player"))
{
return;
}
PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
if ((Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController)
{
return;
}
if (component.isPlayerDead)
{
PlayerHeatManager.heatSeverityMultiplier = 1f;
PlayerHeatManager.isInHeatZone = false;
PlayerHeatManager.SetHeatSeverity(0f - PlayerHeatManager.heatSeverity);
return;
}
if (CheckConditionsForHeatingStop(component))
{
PlayerHeatManager.heatSeverityMultiplier = 1f;
PlayerHeatManager.isInHeatZone = false;
return;
}
if (CheckConditionsForHeatingPause(component))
{
PlayerHeatManager.heatSeverityMultiplier = 0.33f;
}
else
{
PlayerHeatManager.heatSeverityMultiplier = 1f;
}
if (PlayerHeatManager.isInHeatZone)
{
PlayerHeatManager.SetHeatSeverity(Time.deltaTime / timeInHeatZoneMax);
}
else
{
PlayerHeatManager.isInHeatZone = true;
}
}
private void OnTriggerExit(Collider other)
{
if (((Component)other).CompareTag("Player"))
{
PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
if (!((Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController))
{
PlayerHeatManager.heatSeverityMultiplier = 1f;
PlayerHeatManager.isInHeatZone = false;
}
}
}
private void OnDestroy()
{
PlayerHeatManager.heatSeverityMultiplier = 1f;
PlayerHeatManager.isInHeatZone = false;
PlayerHeatManager.SetEffectsVolume(null);
}
}
internal class PlayerHeatManager : MonoBehaviour
{
public static bool isInHeatZone = false;
public static float heatSeverityMultiplier = 1f;
public static float heatSeverity = 0f;
private static Volume heatEffectVolume;
public static void SetEffectsVolume(Volume volume)
{
if ((Object)(object)volume != (Object)null)
{
heatEffectVolume = volume;
}
}
internal static void SetHeatSeverity(float heatSeverityDelta)
{
heatSeverity = Mathf.Clamp01(heatSeverity + heatSeverityDelta * heatSeverityMultiplier);
if ((Object)(object)heatEffectVolume != (Object)null)
{
heatEffectVolume.weight = heatSeverity;
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "ArcadiaMoonPlugin";
public const string PLUGIN_NAME = "ArcadiaMoonPlugin";
public const string PLUGIN_VERSION = "1.4.0";
}
public class TimeAnimSyncronizer : MonoBehaviour
{
private Animator timeSyncAnimator;
private void Start()
{
timeSyncAnimator = ((Component)this).GetComponent<Animator>();
if ((Object)(object)timeSyncAnimator == (Object)null)
{
Debug.LogError((object)"There is no Animator component attached to this object!");
}
}
private void FixedUpdate()
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Invalid comparison between Unknown and I4
if ((Object)(object)timeSyncAnimator != (Object)null && TimeOfDay.Instance.timeHasStarted)
{
timeSyncAnimator.SetFloat("timeOfDay", Mathf.Clamp(TimeOfDay.Instance.normalizedTimeOfDay, 0f, 0.99f));
if ((int)TimeOfDay.Instance.currentLevelWeather == 0)
{
timeSyncAnimator.SetBool("dusty", true);
}
}
}
}
}
namespace ArcadiaMoonPlugin.Patches
{
[HarmonyPatch]
internal class PlayerControllerBHeatStrokePatch
{
private static float prevSprintMeter;
private static float severityInfluenceMultiplier = 1.25f;
private static float timeToCool = 17f;
[HarmonyPatch(typeof(PlayerControllerB), "Update")]
[HarmonyPrefix]
[HarmonyPriority(600)]
private static void HeatStrokePatchPrefix(PlayerControllerB __instance)
{
if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled)
{
prevSprintMeter = __instance.sprintMeter;
}
}
[HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")]
[HarmonyPostfix]
[HarmonyPriority(200)]
private static void HeatStrokePatchLatePostfix(PlayerControllerB __instance)
{
if (!((NetworkBehaviour)__instance).IsOwner || !__instance.isPlayerControlled)
{
return;
}
if (__instance.isInsideFactory)
{
PlayerHeatManager.heatSeverityMultiplier = 1f;
PlayerHeatManager.isInHeatZone = false;
}
if (!PlayerHeatManager.isInHeatZone)
{
PlayerHeatManager.SetHeatSeverity((0f - Time.deltaTime) / timeToCool);
}
float heatSeverity = PlayerHeatManager.heatSeverity;
if (heatSeverity > 0f)
{
float num = __instance.sprintMeter - prevSprintMeter;
if ((double)num < 0.0)
{
__instance.sprintMeter = Mathf.Max(prevSprintMeter + num * (1f + heatSeverity * severityInfluenceMultiplier), 0f);
}
else if ((double)num > 0.0)
{
__instance.sprintMeter = Mathf.Min(prevSprintMeter + num / (1f + heatSeverity * severityInfluenceMultiplier), 1f);
}
}
}
}
}
namespace __GEN
{
internal class NetworkVariableSerializationHelper
{
[RuntimeInitializeOnLoadMethod]
internal static void InitializeSerialization()
{
}
}
}
namespace ArcadiaMoonPlugin.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}