using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
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 DroneEnemy.NetcodePatcher;
using GameNetcodeStuff;
using Microsoft.CodeAnalysis;
using SolidLib.Registry;
using SolidLib.Utils;
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("DroneEnemy")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Drone Enemy for Lethal Company.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DroneEnemy")]
[assembly: AssemblyTitle("DroneEnemy")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
static <Module>()
{
}
}
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 DroneEnemy
{
internal class DroneEnemyAI : EnemyAI
{
private enum State
{
IdleRoaming,
Scanning
}
public Transform scanArea;
public AISearchRoutine scoutingSearchRoutine;
public AudioSource mineAudio;
public AudioSource mineFarAudio;
public AudioSource scanAudio;
public AudioSource idleSound;
public AudioClip antennaBeep;
public AudioClip beginScanSound;
public AudioClip scanSound;
public AudioClip mineDetonate;
public AudioClip mineTrigger;
public AudioClip mineDetonateFar;
public ParticleSystem shockwaveParticle;
public Light antennaLight;
public BoxCollider enemyCollider;
public Material[] antennaMats;
public GameObject droneScrapPrefab;
private float timeSincePrevScan;
private int randomScanInterval = PluginConfig.minAttackTime.Value;
private bool isDeadAnimationDone;
private bool stunnedAnimation;
private Random enemyRandom;
private List<PlayerControllerB> playersToSlow = new List<PlayerControllerB>();
private int hitCount = 0;
private bool hasHitCondition = false;
private Coroutine explodeCoroutine;
public override void Start()
{
((EnemyAI)this).Start();
timeSincePrevScan = 0f;
((Collider)enemyCollider).isTrigger = !PluginConfig.hasCollision.Value;
enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex);
isDeadAnimationDone = false;
((MonoBehaviour)this).StartCoroutine(AntennaCoroutine());
base.currentBehaviourStateIndex = 0;
}
public override void Update()
{
((EnemyAI)this).Update();
if (base.isEnemyDead)
{
if (!isDeadAnimationDone)
{
isDeadAnimationDone = true;
base.creatureVoice.Stop();
base.creatureVoice.PlayOneShot(base.dieSFX);
}
return;
}
if (((NetworkBehaviour)this).IsServer && base.stunNormalizedTimer <= 0f)
{
timeSincePrevScan += Time.deltaTime;
}
if (base.stunNormalizedTimer > 0f && !stunnedAnimation)
{
base.agent.speed = 0f;
base.creatureAnimator.SetBool("stunned", true);
stunnedAnimation = true;
}
else if (stunnedAnimation && base.stunNormalizedTimer <= 0f)
{
base.creatureAnimator.SetBool("stunned", false);
stunnedAnimation = false;
}
}
public IEnumerator AntennaCoroutine()
{
while (true)
{
((Renderer)base.skinnedMeshRenderers[0]).materials[2] = antennaMats[1];
((Behaviour)antennaLight).enabled = true;
idleSound.PlayOneShot(antennaBeep);
yield return (object)new WaitForSeconds(0.3f);
((Renderer)base.skinnedMeshRenderers[0]).materials[2] = antennaMats[0];
((Behaviour)antennaLight).enabled = false;
yield return (object)new WaitForSeconds(3f);
}
}
public override void DoAIInterval()
{
((EnemyAI)this).DoAIInterval();
if (!base.isEnemyDead && !StartOfRound.Instance.allPlayersDead)
{
ScanningUpdate(ref scoutingSearchRoutine);
switch (base.currentBehaviourStateIndex)
{
case 0:
base.agent.speed = PluginConfig.moveSpeed.Value;
break;
case 1:
base.agent.speed = PluginConfig.idleSpeed.Value;
break;
default:
Debug.Log((object)"This Behavior State doesn't exist!");
break;
}
}
}
private void ScanningUpdate(ref AISearchRoutine routine)
{
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
if (((NetworkBehaviour)this).IsServer)
{
int num = (int)(timeSincePrevScan % 60f);
if (num > randomScanInterval)
{
randomScanInterval = enemyRandom.Next(PluginConfig.minAttackTime.Value, PluginConfig.maxAttackTime.Value);
timeSincePrevScan = 0f;
((EnemyAI)this).SwitchToBehaviourClientRpc(1);
TriggerScanOnClientsServerRpc();
}
}
if (!routine.inProgress)
{
Debug.Log((object)"Roam");
((EnemyAI)this).StartSearch(((Component)this).transform.position, routine);
}
}
[ClientRpc]
private void UpdateScanNodeClientRpc(NetworkObjectReference objRef, int value)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: 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_007d: 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_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2549252628u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref objRef, default(ForNetworkSerializable));
BytePacker.WriteValueBitPacked(val2, value);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2549252628u, val, (RpcDelivery)0);
}
NetworkObject val3 = default(NetworkObject);
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref objRef)).TryGet(ref val3, (NetworkManager)null))
{
ScanNodeProperties componentInChildren = ((Component)val3).gameObject.GetComponentInChildren<ScanNodeProperties>();
if ((Object)(object)componentInChildren != (Object)null)
{
componentInChildren.scrapValue = value;
componentInChildren.subText = $"Value: ${value}";
}
}
}
[ServerRpc(RequireOwnership = false)]
private void TriggerScanOnClientsServerRpc()
{
//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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(555519031u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 555519031u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
ScanOnAllClientsClientRpc();
}
}
}
[ClientRpc]
private void ScanOnAllClientsClientRpc()
{
//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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4128408083u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4128408083u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
((MonoBehaviour)this).StartCoroutine(Scan());
}
}
}
private IEnumerator Scan()
{
if (base.isEnemyDead)
{
yield break;
}
if (playersToSlow.Count > 0)
{
foreach (PlayerControllerB player in playersToSlow)
{
player.isMovementHindered--;
player.hinderedMultiplier *= 0.4f;
playersToSlow.Remove(player);
}
}
scanAudio.PlayOneShot(beginScanSound);
WalkieTalkie.TransmitOneShotAudio(scanAudio, beginScanSound, 1f);
yield return (object)new WaitForSeconds(3f);
DoAnimationTriggerClientRpc("scan");
yield return (object)new WaitForSeconds(0.5f);
scanAudio.PlayOneShot(scanSound);
WalkieTalkie.TransmitOneShotAudio(scanAudio, scanSound, 1f);
if (PluginConfig.screenShake.Value)
{
float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)this).transform.position);
if (num < 14f)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)3);
}
else if (num < 24f)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
}
}
shockwaveParticle.Emit(1);
int defaultLayer = 1;
int playerLayer = 8;
int roomLayer = 256;
int combinedLayer = defaultLayer | playerLayer | roomLayer;
Collider[] hitColliders = Physics.OverlapBox(scanArea.position, scanArea.localScale, Quaternion.identity, playerLayer);
if (hitColliders.Length != 0)
{
Collider[] array = hitColliders;
RaycastHit hit = default(RaycastHit);
foreach (Collider playerCollider in array)
{
Vector3 position = ((Component)this).transform.position;
Bounds bounds = playerCollider.bounds;
if (!Physics.Linecast(position, ((Bounds)(ref bounds)).center, ref hit, combinedLayer) || !((Object)(object)((RaycastHit)(ref hit)).collider != (Object)(object)playerCollider) || PluginConfig.hitThroughWalls.Value)
{
PlayerControllerB playerControllerB = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(playerCollider, false, false);
if ((Object)(object)playerControllerB != (Object)null)
{
playerControllerB.DamagePlayer(enemyRandom.Next(10, 25), true, true, (CauseOfDeath)0, 0, false, default(Vector3));
playerControllerB.isMovementHindered++;
playerControllerB.hinderedMultiplier *= 2f;
playersToSlow.Add(playerControllerB);
}
hit = default(RaycastHit);
}
}
yield return (object)new WaitForSeconds((float)enemyRandom.Next(1, 4));
foreach (PlayerControllerB player2 in playersToSlow)
{
player2.isMovementHindered--;
player2.hinderedMultiplier *= 0.4f;
playersToSlow.Remove(player2);
}
}
yield return (object)new WaitForSeconds(2f);
((EnemyAI)this).SwitchToBehaviourClientRpc(0);
}
public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
{
((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
base.creatureAnimator.SetTrigger("HitEnemy");
if (base.isEnemyDead)
{
return;
}
hitCount++;
int num = enemyRandom.Next(1, 8);
bool flag = num < hitCount;
Plugin.Logger.LogInfo((object)$"Drone Hit: {hitCount}, Random Hit Value: {num}, Condition Met: {flag}");
if (!flag || hasHitCondition)
{
return;
}
hasHitCondition = true;
hitCount = 0;
((MonoBehaviour)this).StopCoroutine(Scan());
foreach (PlayerControllerB item in playersToSlow)
{
item.isMovementHindered--;
item.hinderedMultiplier *= 0.4f;
playersToSlow.Remove(item);
}
((MonoBehaviour)this).StartCoroutine(KillDroneDelay());
}
public IEnumerator KillDroneDelay()
{
mineAudio.PlayOneShot(mineTrigger, 1f);
yield return (object)new WaitForSeconds(PluginConfig.explosionSpeed.Value);
if (((NetworkBehaviour)this).IsOwner && !base.isEnemyDead)
{
((EnemyAI)this).KillEnemyOnOwnerClient(false);
}
yield return (object)new WaitUntil((Func<bool>)(() => base.isEnemyDead));
DestroyDroneServerRpc();
}
public override void KillEnemy(bool destroy = false)
{
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: 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_00d9: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).KillEnemy(destroy);
if (((NetworkBehaviour)this).IsHost)
{
int num = enemyRandom.Next(1, 100);
if (num <= PluginConfig.scrapChance.Value || PluginConfig.scrapChance.Value == 100)
{
Plugin.Logger.LogInfo((object)("Scrap Chance on random was " + num + "of Config value " + PluginConfig.scrapChance.Value));
Plugin.Logger.LogInfo((object)"Spawning Drone Scrap ");
Vector3 val = ((Component)this).transform.position + Vector3.up * 0.6f;
val += new Vector3(Random.Range(-0.8f, 0.8f), 0f, Random.Range(-0.8f, 0.8f));
SolidLibUtils.Instance.SpawnItem("DroneScrap", val, (Action<GameObject>)delegate
{
});
}
}
}
[ServerRpc(RequireOwnership = false)]
public void DestroyDroneServerRpc()
{
//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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3970229352u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3970229352u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
if (((NetworkBehaviour)this).IsServer)
{
SetOffMineAnimation();
}
DestroyDroneClientRpc();
}
}
[ClientRpc]
public void DestroyDroneClientRpc()
{
//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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1405841301u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1405841301u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsServer)
{
SetOffMineAnimation();
}
}
}
public override void OnDestroy()
{
((EnemyAI)this).OnDestroy();
foreach (PlayerControllerB item in playersToSlow)
{
item.isMovementHindered--;
item.hinderedMultiplier *= 0.4f;
playersToSlow.Remove(item);
}
}
public void SetOffMineAnimation()
{
if (explodeCoroutine == null)
{
Plugin.Logger.LogInfo((object)"Start Explosion Coroutine");
explodeCoroutine = ((MonoBehaviour)this).StartCoroutine(detonateMineDelayed());
}
else
{
Plugin.Logger.LogInfo((object)"Explosion already started");
}
}
private IEnumerator detonateMineDelayed()
{
Detonate();
yield return (object)new WaitForSeconds(0.2f);
if (((NetworkBehaviour)this).IsServer)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
public void Detonate()
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
mineAudio.pitch = Random.Range(0.93f, 1.07f);
Plugin.Logger.LogInfo((object)"Detonating");
CreateExplosion(((Component)this).transform.position + Vector3.up, spawnExplosionEffect: true, PluginConfig.explosionDamage.Value, 5.7f, 6.4f, 6, (CauseOfDeath)3);
}
[ClientRpc]
public void DoAnimationTriggerClientRpc(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_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 != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(945943318u, 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, 945943318u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
base.creatureAnimator.SetTrigger(animationName);
}
}
[ClientRpc]
public void DoAnimationFloatClientRpc(string animationName, float value)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: 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_00bb: 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_00d5: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3014858118u, val, (RpcDelivery)0);
bool flag = animationName != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false);
}
((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref value, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3014858118u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
base.creatureAnimator.SetFloat(animationName, value);
}
}
public void CreateExplosion(Vector3 explosionPosition, bool spawnExplosionEffect = false, int damage = 20, float minDamageRange = 0f, float maxDamageRange = 1f, int enemyHitForce = 6, CauseOfDeath causeOfDeath = 3, PlayerControllerB attacker = null)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: 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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_032d: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_0362: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
Debug.Log((object)$"Spawning explosion at pos: {explosionPosition}");
Transform val = null;
if ((Object)(object)RoundManager.Instance != (Object)null && (Object)(object)RoundManager.Instance.mapPropsContainer != (Object)null && (Object)(object)RoundManager.Instance.mapPropsContainer.transform != (Object)null)
{
val = RoundManager.Instance.mapPropsContainer.transform;
}
if (spawnExplosionEffect)
{
Object.Instantiate<GameObject>(StartOfRound.Instance.explosionPrefab, explosionPosition, Quaternion.Euler(-90f, 0f, 0f), val).SetActive(true);
}
float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, explosionPosition);
if (num < 14f)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
}
else if (num < 25f)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
}
Collider[] array = Physics.OverlapSphere(explosionPosition, maxDamageRange, 2621448, (QueryTriggerInteraction)2);
PlayerControllerB val2 = null;
for (int i = 0; i < array.Length; i++)
{
float num2 = Vector3.Distance(explosionPosition, ((Component)array[i]).transform.position);
if (num2 > 4f && Physics.Linecast(explosionPosition, ((Component)array[i]).transform.position + Vector3.up * 0.3f, 256, (QueryTriggerInteraction)1))
{
continue;
}
if (((Component)array[i]).gameObject.layer == 3)
{
val2 = ((Component)array[i]).gameObject.GetComponent<PlayerControllerB>();
if ((Object)(object)val2 != (Object)null && ((NetworkBehaviour)val2).IsOwner)
{
float num3 = 1f - Mathf.Clamp01((num2 - minDamageRange) / (maxDamageRange - minDamageRange));
val2.DamagePlayer((int)((float)damage * num3), true, true, causeOfDeath, 0, false, default(Vector3));
}
}
else if (((Component)array[i]).gameObject.layer == 21)
{
Landmine componentInChildren = ((Component)array[i]).gameObject.GetComponentInChildren<Landmine>();
if ((Object)(object)componentInChildren != (Object)null && !componentInChildren.hasExploded && num2 < 6f)
{
Debug.Log((object)"Setting off other mine");
((MonoBehaviour)componentInChildren).StartCoroutine(componentInChildren.TriggerOtherMineDelayed(componentInChildren));
}
}
else if (((Component)array[i]).gameObject.layer == 19)
{
EnemyAICollisionDetect component = ((Component)enemyCollider).gameObject.GetComponent<EnemyAICollisionDetect>();
EnemyAICollisionDetect componentInChildren2 = ((Component)array[i]).gameObject.GetComponentInChildren<EnemyAICollisionDetect>();
if ((Object)(object)componentInChildren2 != (Object)null && (Object)(object)componentInChildren2 != (Object)(object)component && ((NetworkBehaviour)componentInChildren2.mainScript).IsOwner && num2 < 4.5f)
{
componentInChildren2.mainScript.HitEnemyOnLocalClient(enemyHitForce, default(Vector3), attacker, false, -1);
}
}
}
int num4 = ~LayerMask.GetMask(new string[1] { "Room" });
num4 = ~LayerMask.GetMask(new string[1] { "Colliders" });
array = Physics.OverlapSphere(explosionPosition, 10f, num4);
for (int j = 0; j < array.Length; j++)
{
Rigidbody component2 = ((Component)array[j]).GetComponent<Rigidbody>();
if ((Object)(object)component2 != (Object)null)
{
component2.AddExplosionForce(70f, explosionPosition, 10f);
}
}
}
protected override void __initializeVariables()
{
((EnemyAI)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_DroneEnemyAI()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Expected O, but got Unknown
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(2549252628u, new RpcReceiveHandler(__rpc_handler_2549252628));
NetworkManager.__rpc_func_table.Add(555519031u, new RpcReceiveHandler(__rpc_handler_555519031));
NetworkManager.__rpc_func_table.Add(4128408083u, new RpcReceiveHandler(__rpc_handler_4128408083));
NetworkManager.__rpc_func_table.Add(3970229352u, new RpcReceiveHandler(__rpc_handler_3970229352));
NetworkManager.__rpc_func_table.Add(1405841301u, new RpcReceiveHandler(__rpc_handler_1405841301));
NetworkManager.__rpc_func_table.Add(945943318u, new RpcReceiveHandler(__rpc_handler_945943318));
NetworkManager.__rpc_func_table.Add(3014858118u, new RpcReceiveHandler(__rpc_handler_3014858118));
}
private static void __rpc_handler_2549252628(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_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
NetworkObjectReference objRef = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref objRef, default(ForNetworkSerializable));
int value = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref value);
target.__rpc_exec_stage = (__RpcExecStage)2;
((DroneEnemyAI)(object)target).UpdateScanNodeClientRpc(objRef, value);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_555519031(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;
((DroneEnemyAI)(object)target).TriggerScanOnClientsServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_4128408083(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)2;
((DroneEnemyAI)(object)target).ScanOnAllClientsClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3970229352(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;
((DroneEnemyAI)(object)target).DestroyDroneServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1405841301(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)2;
((DroneEnemyAI)(object)target).DestroyDroneClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_945943318(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)2;
((DroneEnemyAI)(object)target).DoAnimationTriggerClientRpc(animationName);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3014858118(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_0067: 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_009a: 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);
}
float value = default(float);
((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref value, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)2;
((DroneEnemyAI)(object)target).DoAnimationFloatClientRpc(animationName, value);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "DroneEnemyAI";
}
}
public static class PluginInformation
{
public const string PLUGIN_GUID = "droneenemy";
public const string PLUGIN_NAME = "Shockwave Drone";
public const string PLUGIN_VERSION = "0.6.1";
}
[BepInPlugin("droneenemy", "Shockwave Drone", "0.6.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Logger;
internal static PluginConfig BoundConfig { get; private set; }
private void Awake()
{
//IL_0030: 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_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Expected O, but got Unknown
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: 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_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
BoundConfig = new PluginConfig(((BaseUnityPlugin)this).Config);
string text = "droneenemyassets";
CoolBootUpThingy();
List<ItemConfig> list = new List<ItemConfig>
{
new ItemConfig
{
Name = "DroneScrap",
AssetName = "DroneScrapAsset",
Enabled = false,
IsShopItem = false
}
};
List<EnemyConfig> list2 = new List<EnemyConfig>
{
new EnemyConfig
{
Name = "ShockwaveDrone",
AssetName = "DroneEnemyAsset",
Enabled = true,
TerminalKeywordAsset = "DroneEnemyTK",
TerminalNodeAsset = "DroneEnemyTN",
MaxSpawnCount = 2,
PowerLevel = 1f,
SpawnWeights = PluginConfig.spawnWeight.Value
}
};
ItemInitializer.Initialize(text, list);
EnemyInitializer.Initialize(text, list2);
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);
}
}
}
Logger.LogInfo((object)"Drone Bootup Sequence complete. Ready for operation.");
}
public void CoolBootUpThingy()
{
Logger.LogInfo((object)"Drone Bootup Sequence Activated. Please wait...\n \r\n \r\n @@@ \r\n @ \r\n @@ \r\n \r\n @ @ \r\n @ @ \r\n @ @ \r\n @ \r\n @@@@@@@@@@ \r\n @ @@@ \r\n @@@@ @@@@@ \r\n @@@@ @@@ @ @ @@@@@ @@@@@@@@@@@@@ \r\n @@@@@@@@@@@@ @@ @@@@@@ @@@@@@@@@@ \r\n @@ @@@@ @@@@ @@@@@@@@@@ @ @@@ \r\n @@ @@ @@@@@@@ @@@@@@@@@@ @@ @@@@@@@@@@@@ \r\n @@@@@@@@@@@@@@@@ @ @ @@@@@@@@@@@ @@@@ \r\n @@@@@@@@@@@@@@@@ @@@@@@ @@@@@@@ @ @ @@ @@@@@@@@ @@ \r\n @@ @@ @@ @ @ @@@@@ @@@@@@@@ @@@ @@@@@@@@@@@@@@@ @ \r\n @@@@@@@ @@ @ @ @@@@@ @@ @ @ @@ @@@@ @@@@@@@@ @@@@ \r\n @@@@ @@ @@@@@@ @@@@ @@@ @@@ @ @@@@ @@@ @@ @@@@@ @@@ \r\n @@@@ @@ @@ @@@ @ @ @@@@ @@ @@@@@ @ @ @@@ @@ @@@ @ \r\n @@ @ @@@@@@@@@@@@@@@@@@@@@@ @@ @@@@ @@@ @@ @@ @ @@ \r\n @@ @@@@@ @@@@@ @@ @@@ @ @ @ @@ @@ \r\n @ @@@@ @@@ @@ @@@@@ @ @ @@ @@ @ @@ \r\n @@@@@@@@@@@@ @@ @@@ @ @ @@@@@ @ @ @@ @@ @@@ \r\n @@@ @@@@@@@@@@@@@ @@@@@@@@@ @@ @@@@@@ @@ @@@@@@ @@@ \r\n @@ @@@@@@ @@@@@@ @@@@ @ @@ \r\n @@@@@ @@@ @@@@ @@ @@@@@@@@@ @@ \r\n @@@@@@@@@@@@@@@@ @@@@@@@@ @@@@@@@@@@@ \r\n @@@@@ @@@ \r\n ");
}
}
public class PluginConfig
{
public static ConfigEntry<string> spawnWeight;
public static ConfigEntry<int> minAttackTime;
public static ConfigEntry<int> maxAttackTime;
public static ConfigEntry<int> scrapChance;
public static ConfigEntry<int> explosionDamage;
public static ConfigEntry<float> explosionSpeed;
public static ConfigEntry<bool> hitThroughWalls;
public static ConfigEntry<bool> hasCollision;
public static ConfigEntry<bool> screenShake;
public static ConfigEntry<float> moveSpeed;
public static ConfigEntry<float> idleSpeed;
public PluginConfig(ConfigFile cfg)
{
spawnWeight = cfg.Bind<string>("General", "SpawnWeight", "Modded:60,ExperimentationLevel:40,AssuranceLevel:50,VowLevel:60,OffenseLevel:50,MarchLevel:60,RendLevel:30,DineLevel:30,TitanLevel:70,Adamance:65,Embrion:80,Artifice:95", "The spawn chance weights for the Shockwave Drone 0 - 100 for both modded and vanilla");
minAttackTime = cfg.Bind<int>("General", "MinAttackTime", 15, "Minimum Attack Time Interval (Actual Seconds)");
maxAttackTime = cfg.Bind<int>("General", "MaxAttackTime", 60, "Maximum Attack Time Interval (Actual Seconds)");
scrapChance = cfg.Bind<int>("General", "ScrapChance", 85, "Percentage whether the drone will drop scrap when destroyed 1 - 100%");
explosionDamage = cfg.Bind<int>("General", "ExplosionDamage", 100, "The Amount of damage you take from the drone exploding");
explosionSpeed = cfg.Bind<float>("General", "ExplosionSpeed", 0.5f, "Time it takes for the drone to explode after being hit");
moveSpeed = cfg.Bind<float>("Speed", "MoveSpeed", 2.3f, "The Movement speed of the drone");
idleSpeed = cfg.Bind<float>("Speed", "IdleSpeed", 0f, "Set this higher than 0 if you want the drone to move while doing an attack");
screenShake = cfg.Bind<bool>("Other", "ScreenShake", true, "Toggle the screenshake on the drone");
hitThroughWalls = cfg.Bind<bool>("Other", "HitThroughWalls", false, "If the Drones attacks can hit through walls");
hasCollision = cfg.Bind<bool>("Other", "HasCollision", true, "If the Drone can collide with the player");
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();
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "DroneEnemy";
public const string PLUGIN_NAME = "DroneEnemy";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace DroneEnemy.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}