#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 GameNetcodeStuff;
using HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using ReavsStuff.ShibaEnemy.NetcodePatcher;
using ShibaEnemy.Configuration;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.VFX;
[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("ReavsStuff.ShibaEnemy")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.0.7.0")]
[assembly: AssemblyInformationalVersion("0.0.7")]
[assembly: AssemblyProduct("ShibaEnemy")]
[assembly: AssemblyTitle("ReavsStuff.ShibaEnemy")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.7.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 ShibaEnemy
{
[BepInPlugin("ReavsStuff.ShibaEnemy", "ShibaEnemy", "0.0.7")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Logger;
public static AssetBundle? ModAssets;
private readonly Harmony _harmony = new Harmony("ShibaEnemy");
internal static PluginConfig BoundConfig { get; private set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
BoundConfig = new PluginConfig(((BaseUnityPlugin)this).Config);
_harmony.PatchAll(Assembly.GetExecutingAssembly());
string path = "ShibaBatInu";
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>("ShibaEnemy");
TerminalNode val2 = ModAssets.LoadAsset<TerminalNode>("ShibaEnemyTN");
TerminalKeyword val3 = ModAssets.LoadAsset<TerminalKeyword>("ShibaEnemyTK");
NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
Enemies.RegisterEnemy(val, BoundConfig.SpawnWeight.Value, (LevelTypes)(-1), val2, val3);
InitializeNetworkBehaviours();
Logger.LogInfo((object)"Plugin ReavsStuff.ShibaEnemy 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 class ShibaEnemyAI : EnemyAI
{
public enum State
{
RoamSearch,
Chasing,
Attacking,
AttackingSpecial,
PostSpecial,
Death
}
private AISearchRoutine searchForPlayers;
private bool chasingPlayer;
private Vector3 targetPoint = Vector3.zero;
private float attackFuncTimer;
private Vector3 lastPositionOfSeenPlayer;
private bool lostPlayerInChase;
private float lostPlayerInChaseTimer;
private float timeSinceHittingLocalPlayer;
private bool attackAudioClipTrue;
[Header("Audio Stuff")]
public AudioSource audioSource;
public AudioClip AudioClipRoaming;
public AudioClip AudioClipChasing;
public AudioClip AudioClipAttacking;
public AudioClip AudioClipSpecialAttacking;
public AudioClip AudioClipSlideSFX;
private bool fadeOutSpecialSFX = false;
private bool disableFootstepSFX = false;
public float currentPitchTime = 0f;
public Transform turnCompass = null;
public Transform attackArea = null;
public Transform specialAttackArea = null;
private int observedState = -1;
public bool canAttack = false;
public bool attackingDone = true;
public bool attackTriggerBool = false;
private readonly float shibaVolume = PluginConfig.ShibaVolumeAdjustment.Value;
private readonly float shibaRoamSpeed = PluginConfig.ShibaRoamSpeed.Value;
private readonly float shibaChaseSpeed = PluginConfig.ShibaChaseSpeed.Value;
private readonly int shibaDamage = PluginConfig.ShibaDamage.Value;
private readonly int shibaHealth = PluginConfig.ShibaHealth.Value;
private float shibaChaseMaxSpeed = 0f;
private float SpeedAccelerationTime = 0f;
private float SpeedToMaxSpeed = 3f;
private int specialAttackChanceValue;
private bool setSpecialAttackChance;
private bool SpecialAttackEngaged = false;
private int specialAttackChance = PluginConfig.ShibaSpecialAttackChance.Value;
private bool attackingPlayer = false;
private int specialAttackCurrentHits;
private int specialAttackMaxHits = 8;
public VisualEffect visualEffect;
private static VFXExposedProperty specialVFXBeginTrigger;
private static VFXExposedProperty specialVFXEndTrigger;
private static readonly string specialVFXBeginTriggerName = "StartSpecial";
private static readonly string specialVFXEndTriggerName = "StopSpecial";
private int animCountSpecial = 0;
private List<ulong> hitPlayers = new List<ulong>();
public bool allowCollisionDamage = false;
private bool slideAfterAttack = false;
private bool sliderAfterDis = false;
private float randomPitchInterval = 0f;
private Ray ray;
private RaycastHit rayHit;
private RoundManager roundManager;
[Conditional("DEBUG")]
public void LogIfDebugBuild(string text)
{
Plugin.Logger.LogInfo((object)text);
}
public override void Start()
{
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Expected O, but got Unknown
((EnemyAI)this).Start();
base.enemyHP = shibaHealth;
shibaChaseMaxSpeed = shibaChaseSpeed + 4f;
NavMeshAgent agent = base.agent;
timeSinceHittingLocalPlayer = 0f;
roundManager = Object.FindObjectOfType<RoundManager>();
agent.acceleration = 300f;
agent.angularSpeed = 200f;
agent.stoppingDistance = 0.1f;
base.openDoorSpeedMultiplier = 50f;
specialVFXBeginTrigger.name = specialVFXBeginTriggerName;
specialVFXEndTrigger.name = specialVFXEndTriggerName;
searchForPlayers = new AISearchRoutine();
if (specialAttackChance >= 14)
{
specialAttackChance = 100;
}
((EnemyAI)this).SwitchToBehaviourState(0);
}
public void StartAnimVFX()
{
visualEffect.SendEvent(specialVFXBeginTrigger.name);
}
public void EndAnimVFX()
{
visualEffect.SendEvent(specialVFXBeginTrigger.name);
}
public override void DoAIInterval()
{
//IL_0094: 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)
((EnemyAI)this).DoAIInterval();
if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
{
audioSource.Stop();
base.creatureVoice.Stop();
base.creatureSFX.Stop();
return;
}
switch (base.currentBehaviourStateIndex)
{
case 0:
base.movingTowardsTargetPlayer = false;
if (!searchForPlayers.inProgress)
{
((EnemyAI)this).StartSearch(((Component)this).transform.position, searchForPlayers);
}
break;
case 1:
if (lostPlayerInChase)
{
base.movingTowardsTargetPlayer = false;
if (!searchForPlayers.inProgress)
{
searchForPlayers.searchWidth = 30f;
((EnemyAI)this).StartSearch(lastPositionOfSeenPlayer, searchForPlayers);
}
}
else if (searchForPlayers.inProgress)
{
((EnemyAI)this).StopSearch(searchForPlayers, true);
base.movingTowardsTargetPlayer = true;
}
break;
case 2:
if (searchForPlayers.inProgress)
{
((EnemyAI)this).StopSearch(searchForPlayers, true);
}
break;
case 3:
if (searchForPlayers.inProgress)
{
((EnemyAI)this).StopSearch(searchForPlayers, true);
}
break;
case 4:
if (base.movingTowardsTargetPlayer)
{
base.movingTowardsTargetPlayer = false;
}
if (searchForPlayers.inProgress)
{
((EnemyAI)this).StopSearch(searchForPlayers, true);
}
break;
}
}
private void LookAtTarget(Vector3 target, float speed)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//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_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: 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)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
Quaternion val = Quaternion.LookRotation(target - ((Component)this).transform.position);
((Component)this).transform.rotation = Quaternion.RotateTowards(((Component)this).transform.rotation, val, speed * Time.deltaTime);
}
public override void Update()
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
//IL_0b01: Unknown result type (might be due to invalid IL or missing references)
//IL_0b06: Unknown result type (might be due to invalid IL or missing references)
//IL_0b10: Unknown result type (might be due to invalid IL or missing references)
//IL_0b15: Unknown result type (might be due to invalid IL or missing references)
//IL_06ed: Unknown result type (might be due to invalid IL or missing references)
//IL_06f2: Unknown result type (might be due to invalid IL or missing references)
//IL_06f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0702: Unknown result type (might be due to invalid IL or missing references)
//IL_0707: Unknown result type (might be due to invalid IL or missing references)
//IL_070c: Unknown result type (might be due to invalid IL or missing references)
//IL_0712: Unknown result type (might be due to invalid IL or missing references)
//IL_074b: Unknown result type (might be due to invalid IL or missing references)
//IL_0739: Unknown result type (might be due to invalid IL or missing references)
//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
//IL_07ea: Unknown result type (might be due to invalid IL or missing references)
//IL_0750: Unknown result type (might be due to invalid IL or missing references)
//IL_0758: Unknown result type (might be due to invalid IL or missing references)
//IL_075c: Unknown result type (might be due to invalid IL or missing references)
//IL_0762: Unknown result type (might be due to invalid IL or missing references)
//IL_076a: Unknown result type (might be due to invalid IL or missing references)
//IL_076f: Unknown result type (might be due to invalid IL or missing references)
//IL_0772: Unknown result type (might be due to invalid IL or missing references)
//IL_0541: Unknown result type (might be due to invalid IL or missing references)
//IL_0546: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Update();
if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
{
return;
}
if ((!slideAfterAttack || !sliderAfterDis) && (Object)(object)base.targetPlayer != (Object)null && Vector3.Distance(((Component)base.targetPlayer).transform.position, ((Component)this).transform.position) < 5f && (base.currentBehaviourStateIndex == 1 || base.currentBehaviourStateIndex == 2 || base.currentBehaviourStateIndex == 3))
{
LookAtTarget(((Component)base.targetPlayer).transform.position, 300f);
}
if (timeSinceHittingLocalPlayer > 0f)
{
attackAudioClipTrue = true;
timeSinceHittingLocalPlayer -= Time.deltaTime;
}
switch (base.currentBehaviourStateIndex)
{
case 0:
if (observedState != base.currentBehaviourStateIndex)
{
base.creatureAnimator.SetTrigger("RoamSearch");
base.creatureAnimator.SetFloat("speedMultiplier", 1f);
hitPlayers.Clear();
disableFootstepSFX = false;
PlaySound(0, loopClip: true);
setSpecialAttackChance = false;
attackFuncTimer = 0f;
lostPlayerInChaseTimer = 0f;
base.openDoorSpeedMultiplier = 50f;
base.agent.stoppingDistance = 0f;
base.agent.speed = shibaRoamSpeed;
chasingPlayer = false;
observedState = base.currentBehaviourStateIndex;
}
if (!chasingPlayer && !FoundTargetablePlayer())
{
}
break;
case 1:
if (observedState != base.currentBehaviourStateIndex)
{
base.creatureAnimator.SetTrigger("Chasing");
base.creatureAnimator.SetFloat("speedMultiplier", 1f);
hitPlayers.Clear();
disableFootstepSFX = false;
attackFuncTimer = 0f;
PlaySound(1, loopClip: true);
lostPlayerInChase = false;
allowCollisionDamage = false;
lostPlayerInChaseTimer = 0f;
base.openDoorSpeedMultiplier = 75f;
base.agent.stoppingDistance = 0.25f;
chasingPlayer = true;
setSpecialAttackChance = false;
SpeedAccelerationTime = 0f;
SpecialAttackEngaged = false;
attackingPlayer = false;
base.agent.speed = shibaChaseSpeed;
if ((Object)(object)base.targetPlayer != (Object)null)
{
LookAtTarget(((Component)base.targetPlayer).transform.position, 1000f);
}
observedState = base.currentBehaviourStateIndex;
}
if (SpeedAccelerationTime <= 1f)
{
SpeedAccelerationTime += Time.deltaTime / SpeedToMaxSpeed;
}
base.agent.speed = Mathf.Lerp(shibaChaseSpeed, shibaChaseMaxSpeed, SpeedAccelerationTime);
base.creatureAnimator.SetFloat("speedMultiplier", Mathf.Lerp(1f, 2f, SpeedAccelerationTime));
if ((Object)(object)base.targetPlayer != (Object)null && !SpecialAttackEngaged && !attackingPlayer && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < 4f && !SpecialAttackEngaged)
{
attackingPlayer = true;
((EnemyAI)this).SwitchToBehaviourState(2);
return;
}
if (attackingPlayer)
{
return;
}
if (lostPlayerInChase)
{
setSpecialAttackChance = false;
if (FindNewTargetablePlayer())
{
lostPlayerInChase = false;
lostPlayerInChaseTimer = 0f;
break;
}
if (lostPlayerInChaseTimer >= 10f)
{
((EnemyAI)this).SwitchToBehaviourState(0);
SetTargetServerRpc(-1);
}
lostPlayerInChaseTimer += Time.deltaTime;
break;
}
if (FoundCloserTargetablePlayer(2.5f) && (Object)(object)base.targetPlayer != (Object)null)
{
lostPlayerInChaseTimer = 0f;
break;
}
if (NoPlayerVisible())
{
lostPlayerInChaseTimer += Time.deltaTime;
if (lostPlayerInChaseTimer > 2.5f)
{
lostPlayerInChase = true;
}
}
else if (!NoPlayerVisible())
{
lostPlayerInChaseTimer = 0f;
}
if ((Object)(object)base.targetPlayer != (Object)null && !lostPlayerInChase)
{
((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer);
lastPositionOfSeenPlayer = ((Component)base.targetPlayer).transform.position;
}
break;
case 2:
if (observedState != base.currentBehaviourStateIndex)
{
base.creatureAnimator.SetTrigger("Attacking");
base.creatureAnimator.SetFloat("speedMultiplier", 1f);
PlaySound(4, loopClip: false);
disableFootstepSFX = true;
attackAudioClipTrue = true;
allowCollisionDamage = true;
attackFuncTimer = 0f;
setSpecialAttackChance = false;
base.openDoorSpeedMultiplier = 100f;
base.agent.stoppingDistance = 0.01f;
base.agent.speed = 10f;
slideAfterAttack = false;
sliderAfterDis = false;
attackingDone = false;
chasingPlayer = true;
observedState = base.currentBehaviourStateIndex;
}
if (attackingDone)
{
audioSource.volume = 0f;
slideAfterAttack = false;
sliderAfterDis = false;
PlaySound(4, loopClip: false);
base.movingTowardsTargetPlayer = false;
if (attackFuncTimer >= 0.2f)
{
attackFuncTimer = 0f;
((EnemyAI)this).SwitchToBehaviourState(0);
}
attackFuncTimer += Time.deltaTime;
}
else if (!attackingDone)
{
if (slideAfterAttack)
{
base.movingTowardsTargetPlayer = false;
PlaySound(4, loopClip: false);
audioSource.pitch = Random.Range(1.3f, 1.5f);
ray = new Ray(((Component)this).transform.position + Vector3.up, ((Component)this).transform.forward);
Vector3 val = ((!Physics.Raycast(ray, ref rayHit, 15f, StartOfRound.Instance.collidersAndRoomMask)) ? ((Ray)(ref ray)).GetPoint(15f) : ((RaycastHit)(ref rayHit)).point);
val = roundManager.GetNavMeshPosition(val, default(NavMeshHit), 5f, -1);
((EnemyAI)this).SetDestinationToPosition(val, false);
PlaySound(3, loopClip: false);
base.agent.speed = 13f;
slideAfterAttack = false;
sliderAfterDis = true;
allowCollisionDamage = false;
}
else if (!sliderAfterDis)
{
((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer);
}
if ((Object)(object)base.targetPlayer != (Object)null)
{
LookAtTarget(((Component)base.targetPlayer).transform.position, 50f);
}
}
if (attackTriggerBool)
{
AttackProcClientRpc();
base.agent.speed = 0f;
slideAfterAttack = true;
attackTriggerBool = false;
}
break;
case 3:
if (observedState != base.currentBehaviourStateIndex)
{
base.creatureAnimator.SetTrigger("AttackingSpecial");
base.creatureAnimator.SetFloat("speedMultiplier", 1f);
disableFootstepSFX = true;
attackAudioClipTrue = true;
audioSource.pitch = Random.Range(0.9f, 1.1f);
PlaySound(2, loopClip: true);
animCountSpecial = 0;
specialAttackCurrentHits = 0;
SpecialAttackEngaged = true;
allowCollisionDamage = true;
attackFuncTimer = 0f;
chasingPlayer = true;
base.openDoorSpeedMultiplier = 150f;
base.agent.stoppingDistance = 0.01f;
base.agent.speed = shibaChaseSpeed * 1.25f;
observedState = base.currentBehaviourStateIndex;
}
if (attackFuncTimer >= 8f || specialAttackCurrentHits >= specialAttackMaxHits)
{
allowCollisionDamage = false;
attackingDone = true;
attackFuncTimer = 0f;
SpecialAttackEngaged = false;
specialAttackCurrentHits = 0;
animCountSpecial = 0;
((EnemyAI)this).SwitchToBehaviourState(4);
}
if (attackTriggerBool)
{
hitPlayers.Clear();
AttackProcSpecialClientRpc();
attackTriggerBool = false;
}
if (!FoundCloserTargetablePlayerSpecialAttack(1f))
{
attackFuncTimer += Time.deltaTime;
}
break;
case 4:
if (observedState != base.currentBehaviourStateIndex)
{
base.creatureAnimator.SetTrigger("PostSpecial");
disableFootstepSFX = true;
attackFuncTimer = 0f;
PlaySound(4, loopClip: false);
setSpecialAttackChance = false;
allowCollisionDamage = false;
chasingPlayer = false;
base.openDoorSpeedMultiplier = 0.5f;
base.agent.stoppingDistance = 0f;
base.agent.speed = 0f;
observedState = base.currentBehaviourStateIndex;
}
if (attackFuncTimer >= 3f)
{
attackFuncTimer = 0f;
((EnemyAI)this).SwitchToBehaviourState(0);
}
attackFuncTimer += Time.deltaTime;
break;
}
if (randomPitchInterval >= 1f)
{
base.creatureVoice.pitch = Random.Range(0.8f, 1.1f);
randomPitchInterval = 0f;
}
randomPitchInterval += Time.deltaTime;
if (GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 0.25f, 50f, 25, 5f))
{
if (base.currentBehaviourStateIndex == 1 || base.currentBehaviourStateIndex == 2 || base.currentBehaviourStateIndex == 3)
{
GameNetworkManager.Instance.localPlayerController.IncreaseFearLevelOverTime(1f, 1f);
}
else if ((Object)(object)base.targetPlayer != (Object)null)
{
GameNetworkManager.Instance.localPlayerController.IncreaseFearLevelOverTime(0.8f, 0.25f);
}
else
{
GameNetworkManager.Instance.localPlayerController.IncreaseFearLevelOverTime(0.8f, 0f);
}
}
}
public void SpecialAttackCounter()
{
animCountSpecial++;
}
private bool FoundTargetablePlayer()
{
PlayerControllerB val = ((EnemyAI)this).CheckLineOfSightForClosestPlayer(90f, 40, 10, 5f);
if ((Object)(object)val != (Object)null)
{
if ((Object)(object)val != (Object)(object)base.targetPlayer)
{
SetTargetServerRpc((int)val.actualClientId);
}
((EnemyAI)this).SetMovingTowardsTargetPlayer(val);
if (base.currentOwnershipOnThisClient != (int)val.actualClientId)
{
((EnemyAI)this).ChangeOwnershipOfEnemy(val.actualClientId);
}
((EnemyAI)this).SwitchToBehaviourState(1);
return true;
}
return false;
}
private bool FoundCloserTargetablePlayer(float differenceDistance)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
PlayerControllerB val = ((EnemyAI)this).CheckLineOfSightForClosestPlayer(120f, 40, 10, 5f);
if ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)base.targetPlayer && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) - differenceDistance > Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position))
{
SetTargetServerRpc((int)val.actualClientId);
((EnemyAI)this).SetMovingTowardsTargetPlayer(val);
if (base.currentOwnershipOnThisClient != (int)val.actualClientId)
{
((EnemyAI)this).ChangeOwnershipOfEnemy(val.actualClientId);
}
return true;
}
return false;
}
private bool FoundCloserTargetablePlayerSpecialAttack(float differenceDistance)
{
//IL_002e: 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_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
PlayerControllerB closestPlayer = ((EnemyAI)this).GetClosestPlayer(false, false, false);
if ((Object)(object)closestPlayer != (Object)null && (Object)(object)closestPlayer != (Object)(object)base.targetPlayer && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) - differenceDistance > Vector3.Distance(((Component)this).transform.position, ((Component)closestPlayer).transform.position))
{
SetTargetServerRpc((int)closestPlayer.actualClientId);
((EnemyAI)this).SetMovingTowardsTargetPlayer(closestPlayer);
return true;
}
return false;
}
private bool NoPlayerVisible()
{
PlayerControllerB closestPlayer = ((EnemyAI)this).GetClosestPlayer(true, false, false);
if ((Object)(object)closestPlayer == (Object)null)
{
return true;
}
return false;
}
private bool FindNewTargetablePlayer()
{
PlayerControllerB val = ((EnemyAI)this).CheckLineOfSightForClosestPlayer(90f, 40, 10, 5f);
if ((Object)(object)val != (Object)null)
{
if ((Object)(object)val != (Object)(object)base.targetPlayer)
{
SetTargetServerRpc((int)val.actualClientId);
}
((EnemyAI)this).SetMovingTowardsTargetPlayer(val);
if (base.currentOwnershipOnThisClient != (int)val.actualClientId)
{
((EnemyAI)this).ChangeOwnershipOfEnemy(val.actualClientId);
}
return true;
}
return false;
}
[ServerRpc(RequireOwnership = false)]
public void SetSpecialValuesServerRpc()
{
//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(1137051355u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1137051355u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
base.agent.speed = base.agent.speed - 1f;
specialAttackCurrentHits++;
timeSinceHittingLocalPlayer += 0.2f;
LogIfDebugBuild($"agent speed: {base.agent.speed}");
}
}
}
[ClientRpc]
public void SetSpecialValuesClientRpc()
{
//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(2644737267u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2644737267u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && !networkManager.IsClient && networkManager.IsHost)
{
}
}
}
[ClientRpc]
public void AttackProcSpecialClientRpc()
{
//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_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: 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_0143: 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)
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(4184175889u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4184175889u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
int num = 8;
Collider[] array = Physics.OverlapBox(specialAttackArea.position, specialAttackArea.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 && !hitPlayers.Contains(val4.actualClientId))
{
val4.DamagePlayer(shibaDamage, false, true, (CauseOfDeath)1, 0, false, default(Vector3));
if (attackAudioClipTrue)
{
base.creatureSFX.PlayOneShot(AudioClipAttacking, shibaVolume);
attackAudioClipTrue = false;
}
SetSpecialValuesServerRpc();
hitPlayers.Add(val4.actualClientId);
}
}
}
[ClientRpc]
public void AttackProcClientRpc()
{
//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_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: 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_0143: 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)
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(160190100u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 160190100u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
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 && !hitPlayers.Contains(val4.actualClientId))
{
val4.DamagePlayer(shibaDamage, false, true, (CauseOfDeath)1, 0, false, default(Vector3));
if (attackAudioClipTrue)
{
base.creatureSFX.PlayOneShot(AudioClipAttacking, shibaVolume);
attackAudioClipTrue = false;
}
hitPlayers.Add(val4.actualClientId);
}
}
}
public override void OnCollideWithPlayer(Collider other)
{
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).OnCollideWithPlayer(other);
if (!allowCollisionDamage)
{
return;
}
PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
if ((Object)(object)val != (Object)null && !SpecialAttackEngaged && !hitPlayers.Contains(val.actualClientId))
{
val.DamagePlayer(shibaDamage, false, true, (CauseOfDeath)1, 0, false, default(Vector3));
if (attackAudioClipTrue)
{
base.creatureVoice.PlayOneShot(AudioClipAttacking, shibaVolume);
attackAudioClipTrue = false;
}
hitPlayers.Add(val.actualClientId);
}
else if ((Object)(object)val != (Object)null && SpecialAttackEngaged && !hitPlayers.Contains(val.actualClientId))
{
val.DamagePlayer(shibaDamage, false, true, (CauseOfDeath)1, 0, false, default(Vector3));
if (attackAudioClipTrue)
{
base.creatureVoice.PlayOneShot(AudioClipAttacking, shibaVolume);
attackAudioClipTrue = false;
}
SetSpecialValuesServerRpc();
hitPlayers.Add(val.actualClientId);
}
}
public override void FinishedCurrentSearchRoutine()
{
((EnemyAI)this).FinishedCurrentSearchRoutine();
}
public void AttackTriggerFunction()
{
attackTriggerBool = true;
}
public void AttackDoneAnimation()
{
attackingDone = true;
}
public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
{
if (!base.isEnemyDead && !SpecialAttackEngaged)
{
((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
base.enemyHP -= force;
if (base.enemyHP <= 0 && !base.isEnemyDead && ((NetworkBehaviour)this).IsOwner)
{
((EnemyAI)this).KillEnemyOnOwnerClient(false);
}
}
}
public override void KillEnemy(bool destroy = false)
{
((EnemyAI)this).KillEnemy(destroy);
base.agent.speed = 0f;
((EnemyAI)this).SwitchToBehaviourState(5);
base.creatureSFX.Stop();
base.creatureVoice.Stop();
audioSource.Stop();
if (((NetworkBehaviour)this).IsServer)
{
base.creatureAnimator.SetTrigger("KillEnemy");
}
}
public void Footsteps()
{
if (!disableFootstepSFX)
{
base.creatureSFX.pitch = Random.Range(0.85f, 1.15f);
base.creatureSFX.PlayOneShot(base.enemyType.audioClips[0]);
}
}
public void PlaySound(int audioID, bool loopClip)
{
AudioClip val = null;
audioSource.Stop();
audioSource.volume = shibaVolume;
audioSource.loop = loopClip;
switch (audioID)
{
case 0:
audioSource.clip = AudioClipRoaming;
audioSource.Play();
break;
case 1:
audioSource.clip = AudioClipChasing;
audioSource.Play();
break;
case 2:
audioSource.clip = AudioClipSpecialAttacking;
audioSource.Play();
break;
case 3:
audioSource.clip = AudioClipSlideSFX;
audioSource.Play();
break;
case 4:
audioSource.Stop();
break;
}
}
[ServerRpc(RequireOwnership = false)]
public void SetTargetServerRpc(int playerID)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: 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_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: 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(1929920899u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, playerID);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1929920899u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
SetTargetClientRpc(playerID);
}
}
}
[ClientRpc]
public void SetTargetClientRpc(int playerID)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: 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_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: 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(3318832948u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, playerID);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3318832948u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
if (playerID == -1)
{
base.targetPlayer = null;
}
else if (!((Object)(object)StartOfRound.Instance.allPlayerScripts[playerID] == (Object)null))
{
base.targetPlayer = StartOfRound.Instance.allPlayerScripts[playerID];
}
}
}
protected override void __initializeVariables()
{
((EnemyAI)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_ShibaEnemyAI()
{
//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
NetworkManager.__rpc_func_table.Add(1137051355u, new RpcReceiveHandler(__rpc_handler_1137051355));
NetworkManager.__rpc_func_table.Add(2644737267u, new RpcReceiveHandler(__rpc_handler_2644737267));
NetworkManager.__rpc_func_table.Add(4184175889u, new RpcReceiveHandler(__rpc_handler_4184175889));
NetworkManager.__rpc_func_table.Add(160190100u, new RpcReceiveHandler(__rpc_handler_160190100));
NetworkManager.__rpc_func_table.Add(1929920899u, new RpcReceiveHandler(__rpc_handler_1929920899));
NetworkManager.__rpc_func_table.Add(3318832948u, new RpcReceiveHandler(__rpc_handler_3318832948));
}
private static void __rpc_handler_1137051355(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;
((ShibaEnemyAI)(object)target).SetSpecialValuesServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2644737267(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;
((ShibaEnemyAI)(object)target).SetSpecialValuesClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_4184175889(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;
((ShibaEnemyAI)(object)target).AttackProcSpecialClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_160190100(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;
((ShibaEnemyAI)(object)target).AttackProcClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1929920899(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int targetServerRpc = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref targetServerRpc);
target.__rpc_exec_stage = (__RpcExecStage)1;
((ShibaEnemyAI)(object)target).SetTargetServerRpc(targetServerRpc);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3318832948(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int targetClientRpc = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref targetClientRpc);
target.__rpc_exec_stage = (__RpcExecStage)2;
((ShibaEnemyAI)(object)target).SetTargetClientRpc(targetClientRpc);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "ShibaEnemyAI";
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "ReavsStuff.ShibaEnemy";
public const string PLUGIN_NAME = "ShibaEnemy";
public const string PLUGIN_VERSION = "0.0.7";
}
}
namespace ShibaEnemy.Configuration
{
public class PluginConfig
{
public ConfigEntry<int> SpawnWeight;
public static ConfigEntry<float> ShibaVolumeAdjustment;
public static ConfigEntry<float> ShibaRoamSpeed;
public static ConfigEntry<float> ShibaChaseSpeed;
public static ConfigEntry<int> ShibaDamage;
public static ConfigEntry<int> ShibaHealth;
public static ConfigEntry<int> ShibaSpecialAttackChance;
public PluginConfig(ConfigFile cfg)
{
SpawnWeight = cfg.Bind<int>("General", "Spawn weight", 20, "The spawn chance weight for Shiba, relative to other existing enemies.\nGoes up from 0, lower is more rare, 100 and up is very common.");
CreateIntCfgEntry(SpawnWeight);
ShibaVolumeAdjustment = cfg.Bind<float>("General", "Volume", 1f, "Adjust volume.\n1.0 = 100%, 0.0 = 0%");
CreateFloatCfgEntry(ShibaVolumeAdjustment, 0f, 1.25f);
ShibaDamage = cfg.Bind<int>("General", "Damage", 10, "How much damage the doggy does.\nMin: 5 Max: 15");
CreateIntCfgEntry(ShibaDamage, 5, 15);
ShibaHealth = cfg.Bind<int>("General", "Health", 4, "How much health the doggy has.\nMin: 2 Max: 6");
CreateIntCfgEntry(ShibaHealth, 2, 6);
ShibaSpecialAttackChance = cfg.Bind<int>("General", "Specialattack Chance", 5, "The chance for a special attack.\nMin: 2 Max: 15");
CreateIntCfgEntry(ShibaSpecialAttackChance, 2, 15);
ShibaRoamSpeed = cfg.Bind<float>("Speed Variables", "Roamspeed", 4f, "How fast the roam speed is.\nMin: 4 Max: 8");
CreateFloatCfgEntry(ShibaRoamSpeed, 4f, 8f);
ShibaChaseSpeed = cfg.Bind<float>("Speed Variables", "Chasespeed", 8f, "How fast the chase speed is.\nMin: 8 Max: 12");
CreateFloatCfgEntry(ShibaChaseSpeed, 8f, 12f);
ClearUnusedEntries(cfg);
}
private void CreateFloatCfgEntry(ConfigEntry<float> cfgEntry, float min = 0f, float max = 100f)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
FloatSliderOptions val = new FloatSliderOptions();
((BaseRangeOptions<float>)(object)val).Min = min;
((BaseRangeOptions<float>)(object)val).Max = max;
((BaseOptions)val).RequiresRestart = false;
FloatSliderConfigItem val2 = new FloatSliderConfigItem(cfgEntry, val);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
}
private void CreateIntCfgEntry(ConfigEntry<int> cfgEntry, int min = 0, int max = 100)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
IntSliderOptions val = new IntSliderOptions();
((BaseRangeOptions<int>)(object)val).Min = min;
((BaseRangeOptions<int>)(object)val).Max = max;
((BaseOptions)val).RequiresRestart = false;
IntSliderConfigItem val2 = new IntSliderConfigItem(cfgEntry, val);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
}
private void CreateStringCfgEntry(ConfigEntry<string> cfgEntry, bool requireRestart = false)
{
//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_0014: Expected O, but got Unknown
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Expected O, but got Unknown
TextInputFieldConfigItem val = new TextInputFieldConfigItem(cfgEntry, new TextInputFieldOptions
{
RequiresRestart = requireRestart
});
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val);
}
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 ReavsStuff.ShibaEnemy.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}