Decompiled source of ContestEdition v1.0.0

ContestEdition.dll

Decompiled 2 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using ChainedPuzzles;
using Enemies;
using GTFO.API;
using GameData;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("ContestEdition")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ContestEdition")]
[assembly: AssemblyTitle("ContestEdition")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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;
		}
	}
}
namespace ContestEdition
{
	internal static class DinoLogger
	{
		private static ManualLogSource logger = Logger.CreateLogSource("ContestEdition");

		public static void Log(string format, params object[] args)
		{
			Log(string.Format(format, args));
		}

		public static void Log(string str)
		{
			if (logger != null)
			{
				logger.Log((LogLevel)8, (object)str);
			}
		}

		public static void Warning(string format, params object[] args)
		{
			Warning(string.Format(format, args));
		}

		public static void Warning(string str)
		{
			if (logger != null)
			{
				logger.Log((LogLevel)4, (object)str);
			}
		}

		public static void Error(string format, params object[] args)
		{
			Error(string.Format(format, args));
		}

		public static void Error(string str)
		{
			if (logger != null)
			{
				logger.Log((LogLevel)2, (object)str);
			}
		}

		public static void Debug(string format, params object[] args)
		{
			Debug(string.Format(format, args));
		}

		public static void Debug(string str)
		{
			if (logger != null)
			{
				logger.Log((LogLevel)32, (object)str);
			}
		}
	}
	[BepInPlugin("Dinorush.ContestEdition", "ContestEdition", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal sealed class EntryPoint : BasePlugin
	{
		[HarmonyPatch]
		private static class OnLoadedPatches
		{
			[HarmonyPatch(typeof(ProjectileManager), "LoadAssets")]
			[HarmonyPostfix]
			private static void OnProjectilesLoaded(ProjectileManager __instance)
			{
				foreach (GameObject item in (Il2CppArrayBase<GameObject>)(object)__instance.m_projectilePrefabs)
				{
					ProjectileTargeting component = item.GetComponent<ProjectileTargeting>();
					if (!((Object)(object)component == (Object)null))
					{
						component.Speed *= 5f;
						component.TargetStrength *= 3.3f;
						component.m_targetingDelay *= 0.2f;
						component.m_initialTargetStrength *= 3.3f;
						component.m_initialTargetingDuration *= 0.2f;
					}
				}
			}

			[HarmonyPatch(typeof(ChainedPuzzleManager), "OnAssetsLoaded")]
			[HarmonyPostfix]
			internal static void Postfix(ChainedPuzzleManager __instance)
			{
				Enumerator<uint, GameObject> enumerator = __instance.m_puzzleComponentPrefabs.Values.GetEnumerator();
				while (enumerator.MoveNext())
				{
					CP_PlayerScanner component = enumerator.Current.GetComponent<CP_PlayerScanner>();
					if ((Object)(object)component != (Object)null)
					{
						for (int i = 1; i < ((Il2CppArrayBase<float>)(object)component.m_scanSpeeds).Count; i++)
						{
							((Il2CppArrayBase<float>)(object)component.m_scanSpeeds)[i] = ((Il2CppArrayBase<float>)(object)component.m_scanSpeeds)[0];
						}
					}
				}
			}
		}

		public const string MODNAME = "ContestEdition";

		public override void Load()
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			EnemyPrefabManager.OnEnemiesGenerated += Action.op_Implicit((Action)delegate
			{
				Enumerator<uint, GameObject> enumerator = EnemyPrefabManager.Current.m_enemyPrefabs.Values.GetEnumerator();
				while (enumerator.MoveNext())
				{
					Il2CppArrayBase<EAB_ProjectileShooter> componentsInChildren = enumerator.Current.GetComponentsInChildren<EAB_ProjectileShooter>();
					if (componentsInChildren.Count != 0)
					{
						foreach (EAB_ProjectileShooter item in componentsInChildren)
						{
							item.m_burstDelay *= 0.2f;
							item.m_shotDelayMax *= 0.2f;
							item.m_shotDelayMin *= 0.2f;
						}
					}
				}
			});
			GameDataAPI.OnGameDataInitialized += delegate
			{
				foreach (EnemyDataBlock allBlock in GameDataBlockBase<EnemyDataBlock>.GetAllBlocks())
				{
					Enumerator<AbilityData> enumerator2 = allBlock.AI_Abilities.GetEnumerator();
					while (enumerator2.MoveNext())
					{
						AbilityData current = enumerator2.Current;
						if (current.AbilityPrefab.Contains("Projectile"))
						{
							current.Cooldown *= 0.2f;
						}
					}
				}
				foreach (EnemyBalancingDataBlock allBlock2 in GameDataBlockBase<EnemyBalancingDataBlock>.GetAllBlocks())
				{
					allBlock2.EnemyCollisionRadius *= 8f;
					allBlock2.EnemyCollisionPlayerMovementReduction = 0.5f;
					allBlock2.EnemyCollisionMinimumMoveSpeedModifier = 0.2f;
				}
				foreach (LevelLayoutDataBlock allBlock3 in GameDataBlockBase<LevelLayoutDataBlock>.GetAllBlocks())
				{
					if (allBlock3.Zones.Count != 0)
					{
						ExpeditionZoneData val = allBlock3.Zones[0];
						if (val.ChainedPuzzleToEnter == 0)
						{
							val.ChainedPuzzleToEnter = 4u;
						}
					}
				}
				uint[] array = new uint[8] { 6u, 42u, 43u, 45u, 47u, 51u, 56u, 61u };
				for (int i = 0; i < array.Length; i++)
				{
					PlayerOfflineGearDataBlock block = GameDataBlockBase<PlayerOfflineGearDataBlock>.GetBlock(array[i]);
					if (block != null)
					{
						((GameDataBlockBase<PlayerOfflineGearDataBlock>)(object)block).internalEnabled = false;
					}
				}
				PlayerDataBlock block2 = GameDataBlockBase<PlayerDataBlock>.GetBlock(1u);
				if (block2 != null)
				{
					block2.runMoveSpeed -= 1f;
					block2.StaminaRegenNotRestingInCombat = 0f;
					block2.StaminaRegenNotRestingOutOfCombat = 0f;
					block2.StaminaRegenRestingInCombat = 0f;
					block2.StaminaRegenRestingOutOfCombat = 0f;
					block2.breathingStaminaEnabled = false;
				}
			};
			new Harmony("ContestEdition").PatchAll();
			((BasePlugin)this).Log.LogMessage((object)"Loaded ContestEdition");
		}
	}
}