Decompiled source of More Events v1.0.1

MoreEvents.dll

Decompiled 2 years ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using MoreEvents.Data;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v7.0", FrameworkDisplayName = ".NET 7.0")]
[assembly: AssemblyCompany("MoreEvents")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MoreEvents")]
[assembly: AssemblyTitle("MoreEvents")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : System.Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	internal sealed class NullableAttribute : System.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]
	[Embedded]
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	internal sealed class NullableContextAttribute : System.Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	internal sealed class RefSafetyRulesAttribute : System.Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace MoreEvents
{
	[BepInPlugin("MoreEvents", "MoreEvents", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static bool loaded;

		private Harmony _harmony = new Harmony("MoreEvents");

		public static List<SelectableLevel> levelsModified = new List<SelectableLevel>();

		public static Dictionary<SelectableLevel, List<SpawnableEnemyWithRarity>> levelEnemySpawns;

		public static Dictionary<SpawnableEnemyWithRarity, int> enemyRaritys;

		public static Dictionary<SpawnableEnemyWithRarity, AnimationCurve> enemyPropCurves;

		public static ManualLogSource mls;

		private void Awake()
		{
			mls = Logger.CreateLogSource("More Events");
			mls.LogInfo((object)"Loaded More Events and applying patches.");
			_harmony.PatchAll(typeof(Plugin));
			mls = ((BaseUnityPlugin)this).Logger;
			enemyRaritys = new Dictionary<SpawnableEnemyWithRarity, int>();
			levelEnemySpawns = new Dictionary<SelectableLevel, List<SpawnableEnemyWithRarity>>();
			enemyPropCurves = new Dictionary<SpawnableEnemyWithRarity, AnimationCurve>();
		}

		[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
		[HarmonyPrefix]
		private static bool ModifyLevel(ref SelectableLevel newLevel)
		{
			EventEnum eventEnum = (EventEnum)Mathf.Clamp(Random.Range(-1, 3), 0, 99);
			if (newLevel.sceneName == "CompanyBuilding")
			{
				eventEnum = EventEnum.None;
			}
			switch (eventEnum)
			{
			default:
				HUDManager.Instance.AddTextToChatOnServer("<color=green>Level event: NONE</color>", -1);
				break;
			case EventEnum.None:
				HUDManager.Instance.AddTextToChatOnServer("<color=green>Level event: NONE</color>", -1);
				StartOfRound.Instance.localPlayerController.movementSpeed = 1f;
				if (StartOfRound.Instance.localPlayerController.isSprinting)
				{
					StartOfRound.Instance.localPlayerController.movementSpeed = 1.5f;
				}
				StartOfRound.Instance.localPlayerController.jumpForce = 1f;
				StartOfRound.Instance.localPlayerController.healthRegenerateTimer = 1f;
				break;
			case EventEnum.Speedy:
				HUDManager.Instance.AddTextToChatOnServer("<color=yellow>[More Events]Level event: Speed goes BRRRRR", -1);
				StartOfRound.Instance.localPlayerController.movementSpeed = 25f;
				if (StartOfRound.Instance.localPlayerController.isSprinting)
				{
					StartOfRound.Instance.localPlayerController.movementSpeed = 50f;
					StartOfRound.Instance.localPlayerController.healthRegenerateTimer = 1f;
				}
				StartOfRound.Instance.localPlayerController.jumpForce = 1f;
				StartOfRound.Instance.localPlayerController.health = 100;
				StartOfRound.Instance.localPlayerController.healthRegenerateTimer = 1f;
				break;
			case EventEnum.Slowly:
				HUDManager.Instance.AddTextToChatOnServer("<color=red>[More Events]Level event: Stop being Fat", -1);
				StartOfRound.Instance.localPlayerController.movementSpeed = 0.5f;
				StartOfRound.Instance.localPlayerController.jumpForce = 1f;
				StartOfRound.Instance.localPlayerController.health = 100;
				StartOfRound.Instance.localPlayerController.healthRegenerateTimer = 1f;
				break;
			case EventEnum.jumpi:
				HUDManager.Instance.AddTextToChatOnServer("<color=yellow>[More Events]Level event: Too many leg days", -1);
				StartOfRound.Instance.localPlayerController.jumpForce = 3f;
				StartOfRound.Instance.localPlayerController.health = 100;
				StartOfRound.Instance.localPlayerController.healthRegenerateTimer = 1f;
				break;
			case EventEnum.hpbye:
				HUDManager.Instance.AddTextToChatOnServer("<color=red>[More Events]Level event: care for your Health", -1);
				StartOfRound.Instance.localPlayerController.health = 1;
				StartOfRound.Instance.localPlayerController.healthRegenerateTimer = 100000f;
				break;
			}
			SelectableLevel val = newLevel;
			if (!levelsModified.Contains(newLevel))
			{
				levelsModified.Add(newLevel);
				newLevel = val;
			}
			return true;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "MoreEvents";

		public const string PLUGIN_NAME = "MoreEvents";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace MoreEvents.Data
{
	internal enum EventEnum
	{
		None,
		Speedy,
		Slowly,
		jumpi,
		hpbye
	}
}