using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Anomalocaris.NetcodePatcher;
using BepInEx;
using BepInEx.Logging;
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("Anomalocaris")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+9bc39e3a44b1c75cb11ea2d5595bde5543172311")]
[assembly: AssemblyProduct("Anomalocaris")]
[assembly: AssemblyTitle("Anomalocaris")]
[assembly: AssemblyVersion("1.0.0.0")]
[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;
}
}
}
namespace Anomalocaris
{
[BepInPlugin("com.ccode.anomalocaris", "Anomalocaris", "0.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
public const string GUID = "com.ccode.anomalocaris";
public const string NAME = "Anomalocaris";
public const string VERSION = "0.0.1";
public static ManualLogSource Log;
public static EnemyType AnomalocarisEnemy;
public void Awake()
{
Assets.PopulateAssets();
AnomalocarisEnemy = Assets.MainAssetBundle.LoadAsset<EnemyType>("AnomalocarisEnemy");
TerminalNode val = Assets.MainAssetBundle.LoadAsset<TerminalNode>("AnomalocarisTN");
TerminalKeyword val2 = Assets.MainAssetBundle.LoadAsset<TerminalKeyword>("AnomalocarisKW");
NetworkPrefabs.RegisterNetworkPrefab(AnomalocarisEnemy.enemyPrefab);
Enemies.RegisterEnemy(AnomalocarisEnemy, 60, (LevelTypes)(-1), val, val2);
Log = ((BaseUnityPlugin)this).Logger;
Log.LogInfo((object)"Anomalocaris mod version 0.0.1 loaded.");
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 Assets
{
public static AssetBundle MainAssetBundle;
public static void PopulateAssets()
{
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
MainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "anomalocarisassets"));
if ((Object)(object)MainAssetBundle == (Object)null)
{
Plugin.Log.LogError((object)"Failed to load custom assets.");
}
}
}
}
namespace Anomalocaris.Enemy
{
internal class AnomalocarisAI : EnemyAI
{
private QuicksandTrigger water;
private BoxCollider waterCollider;
private readonly QuicksandTrigger[] sandAndWater = Object.FindObjectsOfType<QuicksandTrigger>();
private readonly List<QuicksandTrigger> waters = new List<QuicksandTrigger>();
private float wanderTimer;
private Vector3 wanderPos = Vector3.zero;
private bool wallInFront;
[SerializeField]
private Transform RaycastPos;
private const float Speed = 5f;
public override void Start()
{
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Invalid comparison between Unknown and I4
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Start();
if (!((NetworkBehaviour)this).IsServer)
{
return;
}
try
{
QuicksandTrigger[] array = sandAndWater;
foreach (QuicksandTrigger val in array)
{
if (val.isWater && !((Component)val).gameObject.CompareTag("SpawnDenialPoint"))
{
waters.Add(val);
}
}
if (waters.Count == 0)
{
RoundManager.Instance.DespawnEnemyOnServer(NetworkObjectReference.op_Implicit(new NetworkObjectReference(((Component)this).gameObject.GetComponent<NetworkObject>())));
return;
}
if ((int)TimeOfDay.Instance.currentLevelWeather == 4)
{
RoundManager.Instance.DespawnEnemyOnServer(NetworkObjectReference.op_Implicit(new NetworkObjectReference(((Component)this).gameObject.GetComponent<NetworkObject>())));
return;
}
water = waters[Random.Range(0, waters.Count)];
waterCollider = ((Component)water).gameObject.GetComponent<BoxCollider>();
SetWanderPos();
Transform transform = ((Component)this).transform;
float x = ((Component)water).transform.position.x;
Bounds bounds = ((Collider)waterCollider).bounds;
transform.position = new Vector3(x, ((Bounds)(ref bounds)).max.y, ((Component)water).transform.position.z);
}
catch (Exception ex)
{
Debug.LogException(ex);
}
}
private void SetWanderPos()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: 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_002d: 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_0052: 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_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: 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_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: 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_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_00ad: Unknown result type (might be due to invalid IL or missing references)
ref Vector3 reference = ref wanderPos;
Bounds bounds = ((Collider)waterCollider).bounds;
float x = ((Bounds)(ref bounds)).min.x;
bounds = ((Collider)waterCollider).bounds;
reference.x = Random.Range(x, ((Bounds)(ref bounds)).max.x);
ref Vector3 reference2 = ref wanderPos;
bounds = ((Collider)waterCollider).bounds;
float y = ((Bounds)(ref bounds)).min.y;
bounds = ((Collider)waterCollider).bounds;
reference2.y = Random.Range(y, ((Bounds)(ref bounds)).max.y);
ref Vector3 reference3 = ref wanderPos;
bounds = ((Collider)waterCollider).bounds;
float z = ((Bounds)(ref bounds)).min.z;
bounds = ((Collider)waterCollider).bounds;
reference3.z = Random.Range(z, ((Bounds)(ref bounds)).max.z);
wanderTimer = 0f;
}
private static bool Collision(Vector3 pos, Collider col)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
Bounds bounds = col.bounds;
return ((Bounds)(ref bounds)).Contains(pos);
}
private void TurnTowardsLocation3d(Vector3 location)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
((Component)this).transform.LookAt(location);
}
private bool CheckForWall()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
return Physics.Raycast(RaycastPos.position, RaycastPos.forward, 4f, 256);
}
private void Rise(float riseSpeed)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
((Component)this).transform.Translate(Vector3.up * (riseSpeed * Time.deltaTime));
}
private static float WaterTop(BoxCollider coll)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
return ((Component)coll).transform.localScale.y * coll.size.y / 2f + ((Component)coll).transform.position.y;
}
public override void Update()
{
//IL_0028: 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)
//IL_0040: 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)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: 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_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: 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_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Update();
if (!((NetworkBehaviour)this).IsServer)
{
return;
}
if (base.isEnemyDead)
{
float y = ((Component)this).transform.position.y;
Bounds bounds = ((Collider)waterCollider).bounds;
if (y < ((Bounds)(ref bounds)).max.y)
{
Rise(0.2f);
}
}
if (!base.isEnemyDead)
{
wanderTimer += Time.deltaTime;
((EnemyAI)this).DoAIInterval();
if (WaterTop(waterCollider) < ((Component)this).transform.position.y)
{
((Component)this).transform.position = new Vector3(((Component)this).transform.position.x, WaterTop(waterCollider), ((Component)this).transform.position.z);
}
if (wanderTimer >= 5f)
{
SetWanderPos();
}
Vector3 val = Vector3.MoveTowards(((Component)this).transform.position, wanderPos, 5f * Time.deltaTime);
TurnTowardsLocation3d(wanderPos);
if (wallInFront || !Collision(val, (Collider)(object)waterCollider))
{
SetWanderPos();
}
else
{
((Component)this).transform.position = val;
}
}
}
private void FixedUpdate()
{
if (((NetworkBehaviour)this).IsServer)
{
wallInFront = CheckForWall();
}
}
public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
{
((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
base.enemyHP -= force;
if (base.enemyHP <= 0)
{
((EnemyAI)this).KillEnemyOnOwnerClient(false);
}
}
protected override void __initializeVariables()
{
((EnemyAI)this).__initializeVariables();
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "AnomalocarisAI";
}
}
}
namespace Anomalocaris.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}