Decompiled source of CZ SEREK MEMES v1.0.8

BepInEx/plugins/Nextbot/Hamunii.ExampleEnemy.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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 ExampleEnemy.Configuration;
using GameNetcodeStuff;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;

[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: AssemblyCompany("Hamunii.ExampleEnemy")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ExampleEnemy")]
[assembly: AssemblyTitle("Hamunii.ExampleEnemy")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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;
		}
	}
	[CompilerGenerated]
	[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 ExampleEnemy
{
	public class Billboard : MonoBehaviour
	{
		private Camera targetCamera = null;

		private void LateUpdate()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)targetCamera == (Object)null)
			{
				targetCamera = Camera.main;
				if ((Object)(object)targetCamera == (Object)null)
				{
					return;
				}
			}
			Vector3 val = ((Component)this).transform.position - ((Component)targetCamera).transform.position;
			val.y = 0f;
			if (((Vector3)(ref val)).sqrMagnitude > 0.0001f)
			{
				((Component)this).transform.rotation = Quaternion.LookRotation(val);
			}
		}
	}
	public class NextbotAI : EnemyAI
	{
		private enum State
		{
			SearchingForPlayer,
			ChasingPlayer
		}

		public Transform turnCompass = null;

		[Header("Custom Audio")]
		public AudioClip[] spotSFX = null;

		public AudioClip[] killSFX = null;

		[Header("Tuning")]
		public float chaseSpeed = 3.5f;

		public float searchSpeed = 4f;

		public float detectionRange = 40f;

		public float senseRange = 10f;

		public float loseTargetDistance = 25f;

		public float hitCooldown = 1f;

		public int attackDamage = 20;

		private float timeSinceHittingLocalPlayer;

		private Random enemyRandom = null;

		private bool hasAlertedToPlayer;

		public override void Start()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Start();
			timeSinceHittingLocalPlayer = hitCooldown;
			enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex);
			hasAlertedToPlayer = false;
			base.currentBehaviourStateIndex = 0;
			((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
		}

		public override void Update()
		{
			((EnemyAI)this).Update();
			if (!base.isEnemyDead)
			{
				timeSinceHittingLocalPlayer += Time.deltaTime;
				if (base.stunNormalizedTimer > 0f)
				{
					base.agent.speed = 0f;
				}
			}
		}

		public override void DoAIInterval()
		{
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				base.agent.speed = searchSpeed;
				if (FoundClosestPlayerInRange(detectionRange, senseRange))
				{
					((EnemyAI)this).StopSearch(base.currentSearch, true);
					hasAlertedToPlayer = false;
					((EnemyAI)this).SwitchToBehaviourClientRpc(1);
				}
				break;
			case 1:
				base.agent.speed = chaseSpeed;
				if (!hasAlertedToPlayer)
				{
					hasAlertedToPlayer = true;
					PlaySpotSoundClientRpc();
				}
				if (!TargetClosestPlayerInAnyCase() || Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > loseTargetDistance)
				{
					hasAlertedToPlayer = false;
					((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
					((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				}
				else
				{
					((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false);
				}
				break;
			}
		}

		private bool FoundClosestPlayerInRange(float range, float senseRange)
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).TargetClosestPlayer(1.5f, true, 70f, false, false, true);
			if ((Object)(object)base.targetPlayer == (Object)null)
			{
				((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f, false, false, true);
				range = senseRange;
			}
			return (Object)(object)base.targetPlayer != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < range;
		}

		private bool TargetClosestPlayerInAnyCase()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			base.mostOptimalDistance = 2000f;
			base.targetPlayer = null;
			for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; i++)
			{
				float num = Vector3.Distance(((Component)this).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position);
				if (num < base.mostOptimalDistance)
				{
					base.mostOptimalDistance = num;
					base.targetPlayer = StartOfRound.Instance.allPlayerScripts[i];
				}
			}
			return (Object)(object)base.targetPlayer != (Object)null;
		}

		private void OnTriggerEnter(Collider other)
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			if (!(timeSinceHittingLocalPlayer < hitCooldown))
			{
				PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
				if ((Object)(object)val != (Object)null)
				{
					timeSinceHittingLocalPlayer = 0f;
					val.DamagePlayer(attackDamage, true, true, (CauseOfDeath)6, 0, false, default(Vector3));
					PlayHitSoundClientRpc();
				}
			}
		}

		[ClientRpc]
		public void PlaySpotSoundClientRpc()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			if (spotSFX != null && spotSFX.Length != 0)
			{
				AudioClip val = spotSFX[enemyRandom.Next(0, spotSFX.Length)];
				base.creatureVoice.PlayOneShot(val);
				RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 20f, 0.9f, 0, false, 0);
			}
		}

		[ClientRpc]
		public void PlayHitSoundClientRpc()
		{
			if (killSFX != null && killSFX.Length != 0)
			{
				AudioClip val = killSFX[enemyRandom.Next(0, killSFX.Length)];
				base.creatureSFX.PlayOneShot(val);
			}
		}
	}
	[BepInPlugin("Hamunii.ExampleEnemy", "ExampleEnemy", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		public static AssetBundle? ModAssets;

		internal static PluginConfig BoundConfig { get; private set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			BoundConfig = new PluginConfig(((BaseUnityPlugin)this).Config);
			InitializeNetworkBehaviours();
			string path = "nextbot";
			ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), path));
			if ((Object)(object)ModAssets == (Object)null)
			{
				Logger.LogError((object)"Failed to load custom assets.");
				return;
			}
			EnemyType val = ModAssets.LoadAsset<EnemyType>("ExampleEnemy");
			TerminalNode val2 = ModAssets.LoadAsset<TerminalNode>("ExampleEnemyTN");
			TerminalKeyword val3 = ModAssets.LoadAsset<TerminalKeyword>("ExampleEnemyTK");
			NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
			Enemies.RegisterEnemy(val, BoundConfig.SpawnWeight.Value, (LevelTypes)(-1), val2, val3);
			Logger.LogInfo((object)"Plugin Hamunii.ExampleEnemy is loaded!");
		}

		private static void InitializeNetworkBehaviours()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "Hamunii.ExampleEnemy";

		public const string PLUGIN_NAME = "ExampleEnemy";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace ExampleEnemy.Configuration
{
	public class PluginConfig
	{
		public ConfigEntry<int> SpawnWeight;

		public PluginConfig(ConfigFile cfg)
		{
			SpawnWeight = cfg.Bind<int>("General", "Spawn weight", 20, "The spawn chance weight for ExampleEnemy, relative to other existing enemies.\nGoes up from 0, lower is more rare, 100 and up is very common.");
			ClearUnusedEntries(cfg);
		}

		private void ClearUnusedEntries(ConfigFile cfg)
		{
			PropertyInfo property = ((object)cfg).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic);
			Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(cfg, null);
			dictionary.Clear();
			cfg.Save();
		}
	}
}

BepInEx/plugins/SolosPosterChanger/SolosPosterChanger.dll

Decompiled a month ago
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using UnityEngine;
using UnityEngine.SceneManagement;

[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 = "")]
[assembly: AssemblyCompany("SolosPosterChanger")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Solo's Poster Changer")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SolosPosterChanger")]
[assembly: AssemblyTitle("SolosPosterChanger")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace SolosPosterChanger;

[BepInPlugin("SolosPosterChanger", "Solo's Poster Changer", "1.0")]
public class Plugin : BaseUnityPlugin
{
	private string[] texturepaths = new string[8] { "/TipsPoster2.png", "/posters.png", "/manual1.png", "/manual2v2.png", "/manual3v2.png", "/manual4v2.png", "/LightSwitchTex.png", "/LightSwitchTex2.png" };

	private string[] hierarchypaths = new string[8] { "Environment/HangarShip/Plane.001", "Environment/HangarShip/Plane.001", "Environment/HangarShip/ClipboardManual/Plane", "Environment/HangarShip/ClipboardManual/Plane.001", "Environment/HangarShip/ClipboardManual/Plane.002", "Environment/HangarShip/ClipboardManual/Plane.003", "Environment/HangarShip/LightSwitchContainer/LightSwitch", "Environment/HangarShip/LightSwitchContainer/LightSwitch/Switch" };

	private int[] materialnumber = new int[8] { 2, 1, 1, 1, 1, 1, 1, 1 };

	private Texture2D[] textures = (Texture2D[])(object)new Texture2D[8];

	private static Plugin Instance;

	public void Awake()
	{
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Expected O, but got Unknown
		if ((Object)(object)Instance == (Object)null)
		{
			Instance = this;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
		}
		else if ((Object)(object)Instance != (Object)(object)this)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin SolosPosterChanger is loaded!");
		for (int i = 0; i < texturepaths.Length; i++)
		{
			if (File.Exists(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + texturepaths[i]))
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)$"Texture {i} loading!");
				textures[i] = new Texture2D(2, 2);
				ImageConversion.LoadImage(textures[i], File.ReadAllBytes(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + texturepaths[i]));
				((BaseUnityPlugin)this).Logger.LogInfo((object)$"Texture {i} loaded!");
			}
		}
		SceneManager.sceneLoaded += OnSceneLoaded;
	}

	public void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		if (!(((Scene)(ref scene)).name == "MainMenu") && !(((Scene)(ref scene)).name == "InitScene") && !(((Scene)(ref scene)).name == "InitSceneLaunchOptions"))
		{
			((MonoBehaviour)this).StartCoroutine(LoadTextures());
		}
	}

	private IEnumerator LoadTextures()
	{
		yield return (object)new WaitForSeconds(5f);
		for (int i = 0; i < texturepaths.Length; i++)
		{
			if ((Object)(object)GameObject.Find(hierarchypaths[i]).GetComponent<Renderer>() != (Object)null)
			{
				GameObject.Find(hierarchypaths[i]).GetComponent<Renderer>().materials[materialnumber[i] - 1].mainTexture = (Texture)(object)textures[i];
			}
			else if ((Object)(object)GameObject.Find(hierarchypaths[i]).GetComponent<Renderer>() == (Object)null)
			{
				((Renderer)GameObject.Find(hierarchypaths[i]).GetComponent<MeshRenderer>()).materials[materialnumber[i] - 1].mainTexture = (Texture)(object)textures[i];
			}
		}
	}
}
public static class PluginInfo
{
	public const string PLUGIN_GUID = "SolosPosterChanger";

	public const string PLUGIN_NAME = "SolosPosterChanger";

	public const string PLUGIN_VERSION = "1.0.0";
}