Decompiled source of TheOldCompany v1.0.0

hatchling/simplex.TheOldCompany.dll

Decompiled a day ago
#define DEBUG
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 FourthCompany.Configuration;
using GameNetcodeStuff;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using simplex.TheOldCompany.NetcodePatcher;

[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("simplex.TheOldCompany")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.0.0.0")]
[assembly: AssemblyInformationalVersion("0.0.0+cf193bded75bfbdb403d5f8e6f018a68331405a1")]
[assembly: AssemblyProduct("The Old Company")]
[assembly: AssemblyTitle("simplex.TheOldCompany")]
[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.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 FourthCompany
{
	internal class FourthCompanyEnemyAI : EnemyAI
	{
		private enum State
		{
			Wandering,
			ProcessingSound,
			TravellingToSound,
			Investigating,
			Rushing,
			Attacking
		}

		public Transform turnCompass = null;

		public Transform attackArea = null;

		public AudioSource step_sound_a = null;

		public AudioSource step_sound_b = null;

		public AudioSource step_sound_c = null;

		public AudioSource sound_roar = null;

		public AudioSource sound_alert = null;

		private const float wander_speed = 3f;

		private const float rush_speed = 18f;

		private const float travel_speed = 5f;

		private const float minimum_noise_volume = 0.2f;

		private const float maximum_noise_distance = 30f;

		private const float investigation_length = 5f;

		private const float attack_length = 0.6f;

		private const float process_length = 2f;

		private const float player_invulnerability_length = 0.25f;

		private const float sound_timer_walk_max = 0.8f;

		private const float sound_timer_rush_max = 0.65f;

		private const float damage = 80f;

		private float timeSpentInvestigating;

		private float attackTimer;

		private float chaseTimer;

		private float processingPauseTimer;

		private float timeSinceHittingPlayer;

		private float soundTimer;

		private Vector3 targetPosition;

		private Random enemyRandom = null;

		private bool isDeadAnimationDone;

		public override void Start()
		{
			//IL_0041: 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)
			((EnemyAI)this).Start();
			LogIfDebugBuild("Hatchling Spawned");
			timeSpentInvestigating = 0f;
			attackTimer = 0f;
			processingPauseTimer = 0f;
			timeSinceHittingPlayer = 0f;
			targetPosition = Vector3.zero;
			enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex);
			isDeadAnimationDone = false;
			base.currentBehaviourStateIndex = 0;
			SetState(State.Wandering);
		}

		private void SetState(State _state)
		{
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			switch (_state)
			{
			case State.Wandering:
				if (base.currentBehaviourStateIndex != 3 && base.currentBehaviourStateIndex != 0)
				{
					return;
				}
				break;
			case State.ProcessingSound:
				if (base.currentBehaviourStateIndex != 0)
				{
					return;
				}
				break;
			case State.TravellingToSound:
				if (base.currentBehaviourStateIndex != 1)
				{
					return;
				}
				break;
			case State.Investigating:
				if (base.currentBehaviourStateIndex != 2 && base.currentBehaviourStateIndex != 4 && base.currentBehaviourStateIndex != 5)
				{
					return;
				}
				break;
			case State.Rushing:
				if (base.currentBehaviourStateIndex != 3)
				{
					return;
				}
				sound_alert.Play();
				break;
			case State.Attacking:
				if (base.currentBehaviourStateIndex != 4)
				{
					return;
				}
				sound_roar.Play();
				break;
			}
			((EnemyAI)this).SwitchToBehaviourClientRpc((int)_state);
			switch (_state)
			{
			case State.Wandering:
				LogIfDebugBuild("FourthCompanyEnemy WALKING");
				DoAnimationClientRpc("BasicWalk");
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				break;
			case State.ProcessingSound:
				LogIfDebugBuild("FourthCompanyEnemy PROCESSING");
				DoAnimationClientRpc("Investigate");
				((EnemyAI)this).StopSearch(base.currentSearch, true);
				processingPauseTimer = 0f;
				break;
			case State.TravellingToSound:
				LogIfDebugBuild("FourthCompanyEnemy Moving to Investigate");
				DoAnimationClientRpc("BasicWalk");
				((EnemyAI)this).SetDestinationToPosition(targetPosition, false);
				break;
			case State.Investigating:
				timeSpentInvestigating = 0f;
				LogIfDebugBuild("FourthCompanyEnemy INVESTIGATING");
				DoAnimationClientRpc("Investigate");
				break;
			case State.Rushing:
				LogIfDebugBuild("FourthCompanyEnemy CHASING");
				chaseTimer = 0f;
				DoAnimationClientRpc("RunEmDown");
				break;
			case State.Attacking:
				LogIfDebugBuild("FourthCompanyEnemy ATTACKIGN");
				DoAnimationClientRpc("Attack");
				attackTimer = 0f;
				break;
			}
		}

		public override void Update()
		{
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			if (base.isEnemyDead)
			{
				if (!isDeadAnimationDone)
				{
					isDeadAnimationDone = true;
					base.creatureVoice.Stop();
					base.creatureVoice.PlayOneShot(base.dieSFX);
				}
				return;
			}
			timeSinceHittingPlayer += Time.deltaTime;
			processingPauseTimer += Time.deltaTime;
			timeSpentInvestigating += Time.deltaTime;
			attackTimer += Time.deltaTime;
			chaseTimer += Time.deltaTime;
			soundTimer += Time.deltaTime;
			int currentBehaviourStateIndex = base.currentBehaviourStateIndex;
			if ((Object)(object)base.targetPlayer != (Object)null && (currentBehaviourStateIndex == 4 || currentBehaviourStateIndex == 5))
			{
				turnCompass.LookAt(((Component)base.targetPlayer.gameplayCamera).transform.position);
				((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), 15f * Time.deltaTime);
			}
			if (currentBehaviourStateIndex == 0 || currentBehaviourStateIndex == 4 || currentBehaviourStateIndex == 2)
			{
				int num = -1;
				if (currentBehaviourStateIndex != 4 && soundTimer >= 0.8f)
				{
					num = (int)Random.Range(0f, 2.99f);
					soundTimer = 0f;
				}
				if (currentBehaviourStateIndex == 4 && soundTimer >= 0.65f)
				{
					num = (int)Random.Range(0f, 2.99f);
					soundTimer = 0f;
				}
				switch (num)
				{
				case 0:
					step_sound_a.Play();
					break;
				case 1:
					step_sound_b.Play();
					break;
				case 2:
					step_sound_c.Play();
					break;
				}
			}
			if (base.stunNormalizedTimer > 0f)
			{
				base.agent.speed = 0f;
			}
		}

		public override void DoAIInterval()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			if (base.currentBehaviourStateIndex != 0)
			{
				((EnemyAI)this).SetDestinationToPosition(targetPosition, false);
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				base.agent.speed = 3f;
				break;
			case 1:
				base.agent.speed = 0f;
				if (processingPauseTimer > 2f)
				{
					SetState(State.TravellingToSound);
				}
				break;
			case 2:
			{
				base.agent.speed = 5f;
				float num2 = Vector3.Distance(((Component)this).transform.position, targetPosition);
				LogIfDebugBuild("FourthCompanyEnemy Enemy distance: " + num2);
				if (num2 < 0.1f)
				{
					SetState(State.Investigating);
				}
				break;
			}
			case 3:
				base.agent.speed = 0f;
				if (timeSpentInvestigating > 5f)
				{
					SetState(State.Wandering);
				}
				break;
			case 4:
			{
				base.agent.speed = 18f;
				if (chaseTimer > 4.5f)
				{
					LogIfDebugBuild("Hatchling: Chase timer expired, resetting");
					SetState(State.Investigating);
					break;
				}
				float num = Vector3.Distance(((Component)this).transform.position, targetPosition);
				if (num < 1f)
				{
					SetState(State.Attacking);
				}
				break;
			}
			case 5:
				base.agent.speed = 54f;
				if (attackTimer > 0.1f && timeSinceHittingPlayer > 0.2f)
				{
					SwingAttackHitClientRpc();
				}
				if (attackTimer > 0.3f)
				{
					NavMeshAgent agent = base.agent;
					agent.speed *= 0.15f;
				}
				if (attackTimer > 0.6f)
				{
					LogIfDebugBuild("Hatchling: Finished attacking, resetting");
					SetState(State.Investigating);
				}
				break;
			default:
				LogIfDebugBuild("This Behavior State doesn't exist!");
				break;
			}
		}

		public override void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot = 0, int noiseID = 0)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DetectNoise(noisePosition, noiseLoudness, timesPlayedInOneSpot, noiseID);
			if (noiseLoudness < 0.2f)
			{
				return;
			}
			float num = Vector3.Distance(((Component)this).transform.position, noisePosition);
			if (num > 30f)
			{
				return;
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				SetState(State.ProcessingSound);
				targetPosition = noisePosition;
				break;
			case 1:
				targetPosition = noisePosition;
				break;
			case 2:
				targetPosition = noisePosition;
				break;
			case 3:
				targetPosition = noisePosition;
				if (((EnemyAI)this).SetDestinationToPosition(targetPosition, true))
				{
					SetState(State.Rushing);
					break;
				}
				targetPosition = ((Component)this).transform.position;
				((EnemyAI)this).SetDestinationToPosition(targetPosition, false);
				break;
			case 4:
				targetPosition = noisePosition;
				((EnemyAI)this).SetDestinationToPosition(targetPosition, false);
				break;
			case 5:
				break;
			}
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			if (!(timeSinceHittingPlayer < 0.25f))
			{
				PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
				if ((Object)(object)val != (Object)null)
				{
					LogIfDebugBuild("FourthEnemyTest Collision with Player!");
					timeSinceHittingPlayer = 0f;
					val.DamagePlayer(80, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
				}
			}
		}

		public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
			if (!base.isEnemyDead)
			{
				base.enemyHP -= force;
			}
		}

		[ClientRpc]
		public void DoAnimationClientRpc(string animationName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1763914873u, val, (RpcDelivery)0);
				bool flag = animationName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1763914873u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				LogIfDebugBuild("Animation: " + animationName);
				base.creatureAnimator.SetTrigger(animationName);
			}
		}

		[ClientRpc]
		public void SwingAttackHitClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3282422788u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3282422788u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			LogIfDebugBuild("SwingAttackHitClientRPC");
			int num = 8;
			Collider[] array = Physics.OverlapBox(attackArea.position, attackArea.localScale, Quaternion.identity, num);
			if (array.Length == 0)
			{
				return;
			}
			Collider[] array2 = array;
			foreach (Collider val3 in array2)
			{
				PlayerControllerB val4 = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(val3, false, false);
				if ((Object)(object)val4 != (Object)null)
				{
					LogIfDebugBuild("Swing attack hit player!");
					timeSinceHittingPlayer = 0f;
					val4.DamagePlayer(80, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
				}
			}
		}

		[Conditional("DEBUG")]
		private void LogIfDebugBuild(string text)
		{
			Plugin.Logger.LogInfo((object)text);
		}

		protected override void __initializeVariables()
		{
			((EnemyAI)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(1763914873u, new RpcReceiveHandler(__rpc_handler_1763914873), "DoAnimationClientRpc");
			((NetworkBehaviour)this).__registerRpc(3282422788u, new RpcReceiveHandler(__rpc_handler_3282422788), "SwingAttackHitClientRpc");
			((EnemyAI)this).__initializeRpcs();
		}

		private static void __rpc_handler_1763914873(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string animationName = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((FourthCompanyEnemyAI)(object)target).DoAnimationClientRpc(animationName);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3282422788(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((FourthCompanyEnemyAI)(object)target).SwingAttackHitClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "FourthCompanyEnemyAI";
		}
	}
	[BepInPlugin("simplex.TheOldCompany", "The Old Company", "0.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 = "fourthcompanyenemyassets";
			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>("FourthCompanyEnemy");
			TerminalNode val2 = ModAssets.LoadAsset<TerminalNode>("FourthCompanyEnemyTN");
			TerminalKeyword val3 = ModAssets.LoadAsset<TerminalKeyword>("FourthCompanyEnemyTK");
			NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
			Enemies.RegisterEnemy(val, BoundConfig.SpawnWeight.Value, (LevelTypes)(-1), val2, val3);
			Logger.LogInfo((object)"Plugin simplex.TheOldCompany 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 = "simplex.TheOldCompany";

		public const string PLUGIN_NAME = "The Old Company";

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

		public PluginConfig(ConfigFile cfg)
		{
			SpawnWeight = cfg.Bind<int>("General", "Spawn weight", 100, "The spawn chance weight for FourthEnemyTest, 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();
		}
	}
}
namespace __GEN
{
	internal class NetworkVariableSerializationHelper
	{
		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeSerialization()
		{
		}
	}
}
namespace simplex.TheOldCompany.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}

scanner/HandheldItemScanner.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
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("HandheldItemScanner")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HandheldItemScanner")]
[assembly: AssemblyTitle("HandheldItemScanner")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
		}
	}
}
namespace HandheldItemScanner
{
	[BepInPlugin("4thcompany.itemScanner", "Item Scanner", "0.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		private const string GUID = "4thcompany.itemScanner";

		private const string NAME = "Item Scanner";

		private const string VERSION = "0.0.1";

		public static Plugin instance;

		private void Awake()
		{
			instance = this;
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "itemscanner");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			Item val2 = val.LoadAsset<Item>("Assets/ItemScanner/ItemScannerItem.asset");
			Utilities.FixMixerGroups(val2.spawnPrefab);
			Items.RegisterScrap(val2, 1000, (LevelTypes)(-1));
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "4thcompany.itemScanner");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched Item Scanner");
		}
	}
}

TerminalDialogue/OldCompany_TerminalDialogue.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using TerminalApi;
using TerminalApi.Classes;
using TerminalApi.Events;

[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("OldCompany_TerminalDialogue")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("OldCompany_TerminalDialogue")]
[assembly: AssemblyTitle("OldCompany_TerminalDialogue")]
[assembly: AssemblyVersion("1.0.0.0")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace OldCompany_TerminalDialogue
{
	public enum DialogueState
	{
		UNSTARTED,
		STEP_1_PROMPT,
		STEP_2_WAITING_FOR_YES,
		COMPLETED
	}
	[BepInPlugin("YourName.OldCompany_TerminalDialogue", "OldCompany_TerminalDialogue", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class BingBong : BaseUnityPlugin
	{
		private ManualLogSource mls;

		private static DialogueState CurrentState;

		private void Awake()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			mls = Logger.CreateLogSource("YourName.OldCompany_TerminalDialogue");
			Events.TerminalAwake += new TerminalEventHandler(OnTerminalAwake);
			Events.TerminalParsedSentence += new TerminalParseSentenceEventHandler(OnTerminalParsedSentence);
			mls.LogInfo((object)"OldCompany_TerminalDialogue loaded successfully!");
		}

		private void OnTerminalAwake(object sender, TerminalEventArgs e)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			mls.LogInfo((object)"Terminal is awake, registering msg command...");
			TerminalApi.AddCommand("msg", new CommandInfo
			{
				Category = "other",
				Description = "Company messaging system"
			}, (string)null, true);
			mls.LogInfo((object)"msg command registered successfully!");
		}

		private void OnTerminalParsedSentence(object sender, TerminalParseSentenceEventArgs e)
		{
			string text = e.SubmittedText.ToLower().Trim();
			mls.LogInfo((object)("Terminal parsed: '" + text + "'"));
			if (text.StartsWith("msg"))
			{
				string text2 = "";
				if (text.Length > 3)
				{
					text2 = text.Substring(3).Trim();
				}
				mls.LogInfo((object)("Parsed argument: '" + text2 + "'"));
				string displayText = HandleMsgCommand(text2);
				e.ReturnedNode.displayText = displayText;
			}
		}

		private string HandleMsgCommand(string argument)
		{
			if (CurrentState == DialogueState.UNSTARTED)
			{
				if (argument == "4crnd")
				{
					CurrentState = DialogueState.STEP_1_PROMPT;
					return "\nWELCOME TO THE COMPANY MESSAGING SYSTEM - V 1.7.10\n> Please choose from the numbered options for quick communication options. These options are case sensitive.\n1. YES - 'msg yes'\n2. NO - 'msg no'\n3. WHAT - 'msg what'\n4. OK - 'msg ok'\n\nBEGIN COMMUNICATION WITH USER ID: 4CRND\n4CRND: HELLO EMPLOYEE. CANNOT TALK LONG. COMPANY WILL SHUT DOWN LINE. NEED YOUR HELP\n\n";
				}
				if (!string.IsNullOrEmpty(argument))
				{
					return "\nCOMMAND FAILED: Please begin the communication by typing 'msg 4CRND'.\n\n";
				}
				return "\nTerminal command 'msg' requires an argument. Try 'msg [MESSENGER ID]'.\n\n";
			}
			if (string.IsNullOrEmpty(argument) || argument == "4crnd")
			{
				return CurrentState switch
				{
					DialogueState.STEP_1_PROMPT => "\n4CRND: HELLO EMPLOYEE. CANNOT TALK LONG. COMPANY WILL SHUT DOWN LINE. NEED YOUR HELP\n> (Type 'msg what' to continue)\n\n", 
					DialogueState.STEP_2_WAITING_FOR_YES => "\n4CRND: STRANDED ON MOON. WAITED LONG TIME FOR YOU. CAN YOU HELP ME\n> (Type 'msg yes' to help)\n\n", 
					DialogueState.COMPLETED => "\nCommunication line is terminated. You have already received the necessary data.\n\n", 
					_ => "\nDialogue is in an unexpected state. Type 'msg 4CRND' to restart.\n\n", 
				};
			}
			switch (CurrentState)
			{
			case DialogueState.STEP_1_PROMPT:
				switch (argument)
				{
				case "what":
					CurrentState = DialogueState.STEP_2_WAITING_FOR_YES;
					return "\n4CRND: STRANDED ON MOON. WAITING LONG TIME FOR YOU. CAN YOU HELP ME\n\n";
				case "yes":
				case "no":
				case "ok":
					return "\n4CRND: I DON'T HAVE TIME FOR THAT. JUST TELL ME **WHAT** IS GOING ON.\n> (You must type 'msg what' to proceed)\n\n";
				default:
					return "\nThe terminal does not recognize '" + argument + "'. Try one of the options above.\n\n";
				}
			case DialogueState.STEP_2_WAITING_FOR_YES:
				switch (argument)
				{
				case "yes":
					CurrentState = DialogueState.COMPLETED;
					return "\n4CRND: MOON CODE '192-CRUCIBLE'. GET HERE SOON\n\n> CONNECTION TERMINATED. ERROR CODE 331: BANNED MESSENGER ID.\n\n";
				case "no":
					return "\n4CRND: YOU HAVE NO CHOICE. COMPANY WILL KNOW. YOU WILL BE LEFT BEHIND.\n> (You must help by typing 'msg yes')\n\n";
				case "what":
					return "\n4CRND: WE ALREADY WENT OVER THIS. PLEASE HELP\n> (Type 'msg yes' to help)\n\n";
				default:
					return "\nThe terminal does not recognize '" + argument + "'. Try one of the options above.\n\n";
				}
			case DialogueState.COMPLETED:
				return "\nCONNECTION TERMINATED. ERROR CODE 331: BANNED MESSENGER ID. Communication is over.\n\n";
			default:
				return "\nUnknown dialogue state. Please type 'msg 4CRND' to begin.\n\n";
			}
		}
	}
	public static class PluginInfo
	{
		internal const string PLUGIN_GUID = "YourName.OldCompany_TerminalDialogue";

		internal const string PLUGIN_NAME = "OldCompany_TerminalDialogue";

		internal const string PLUGIN_VERSION = "1.0.0";
	}
}