#define DEBUG
using System;
using System.Collections;
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 Gnomes.NetcodePatcher;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
[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("Gnomes")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Gnomes, GNOMES! Get ya GNOMES HERE!")]
[assembly: AssemblyFileVersion("2.1.7.0")]
[assembly: AssemblyInformationalVersion("2.1.7+46619184e748b9bf195407bcea4b161f0801657f")]
[assembly: AssemblyProduct("Gnomes")]
[assembly: AssemblyTitle("Gnomes")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.1.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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace Gnomes
{
internal class FlashbangGnomeAI : EnemyAI
{
private enum State
{
SearchingForPlayer,
PlayerFound
}
public Transform turnCompass;
public Transform attackArea;
private float timeSinceHittingLocalPlayer;
private float timeSinceNewRandPos;
private Vector3 lastKnownPlayerPos;
private bool gotLastPos = false;
public float stareDistance;
public Transform cornerDetection;
private LineRenderer line;
private float currentChaseSpeed = 6f;
private Random enemyRandom;
private bool isDeadAnimationDone;
public AudioClip gnomeTeleport;
private float chaseTime;
private bool startChase;
private bool chaseStarted;
private float teleportTimer;
public AudioClip flashbangSound;
private Vector3 newTeleport;
private PlayerControllerB previousTarget;
[Conditional("DEBUG")]
private void LogIfDebugBuild(string text)
{
Plugin.Logger.LogInfo((object)text);
}
public override void Start()
{
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Start();
LogIfDebugBuild("Blue Gnome Spawned");
stareDistance = 40f;
line = ((Component)this).gameObject.AddComponent<LineRenderer>();
line.widthMultiplier = 0.2f;
timeSinceHittingLocalPlayer = 0f;
base.creatureAnimator.SetTrigger("startWalk");
timeSinceNewRandPos = 0f;
enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex);
isDeadAnimationDone = false;
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
base.currentBehaviourStateIndex = 0;
}
public override void Update()
{
//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: 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_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: 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_00a3: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_034f: Unknown result type (might be due to invalid IL or missing references)
//IL_020e: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Update();
if (!chaseStarted)
{
teleportTimer += Time.deltaTime;
if (teleportTimer > 45f && (Object)(object)((EnemyAI)this).GetClosestPlayer(false, false, false) != (Object)null && RoundManager.Instance.insideAINodes.Length != 0 && 0 == 0)
{
bool flag = true;
timeSinceHittingLocalPlayer = 0f;
newTeleport = GenerateTeleportLocation(Vector3.zero, isPlayer: false);
base.serverPosition = newTeleport;
((Component)this).transform.position = newTeleport;
base.agent.Warp(newTeleport);
((EnemyAI)this).SyncPositionToClients();
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
if (((NetworkBehaviour)this).IsOwner && ((NetworkBehaviour)this).OwnerClientId != 0)
{
((EnemyAI)this).ChangeEnemyOwnerServerRpc(StartOfRound.Instance.allPlayerScripts[0].actualClientId);
}
teleportTimer = 0f;
((EnemyAI)this).SwitchToBehaviourClientRpc(0);
}
}
timeSinceHittingLocalPlayer += Time.deltaTime;
timeSinceNewRandPos += Time.deltaTime;
int currentBehaviourStateIndex = base.currentBehaviourStateIndex;
bool flag2 = false;
if (chaseTime <= 3f)
{
base.agent.speed = 6f;
}
if (((NetworkBehaviour)this).IsOwner)
{
for (int i = 0; i < GameNetworkManager.Instance.maxAllowedPlayers; i++)
{
if (((EnemyAI)this).PlayerIsTargetable(StartOfRound.Instance.allPlayerScripts[i], false, false) && StartOfRound.Instance.allPlayerScripts[i].HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 1.6f, 68f, 60, -1f) && Vector3.Distance(((Component)StartOfRound.Instance.allPlayerScripts[i].gameplayCamera).transform.position, base.eye.position) > 0.3f)
{
flag2 = true;
chaseTime = 0f;
}
if (startChase != flag2)
{
startChase = flag2;
}
}
}
if (chaseStarted && ((NetworkBehaviour)this).IsOwner)
{
chaseTime += Time.deltaTime;
base.agent.speed = 8f;
}
if (startChase)
{
if (!chaseStarted)
{
chaseStarted = true;
if (GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(((Component)this).transform.position, 70f, 25, -1f))
{
chaseTime = 0f;
}
}
}
else if (chaseTime >= 6f)
{
chaseStarted = false;
if (((NetworkBehaviour)this).IsOwner)
{
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
base.agent.speed = 2f;
}
}
else
{
chaseTime += Time.deltaTime;
}
}
public static IEnumerator DrawPath(LineRenderer line, NavMeshAgent agent)
{
if (((Behaviour)agent).enabled)
{
yield return (object)new WaitForEndOfFrame();
line.SetPosition(0, ((Component)agent).transform.position);
line.positionCount = agent.path.corners.Length;
for (int i = 1; i < agent.path.corners.Length; i++)
{
line.SetPosition(i, agent.path.corners[i]);
}
}
}
public override void DoAIInterval()
{
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).DoAIInterval();
if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
{
return;
}
switch (base.currentBehaviourStateIndex)
{
case 0:
{
if (!((NetworkBehaviour)this).IsServer)
{
((EnemyAI)this).ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId);
break;
}
for (int i = 0; i < GameNetworkManager.Instance.maxAllowedPlayers; i++)
{
if (((EnemyAI)this).PlayerIsTargetable(StartOfRound.Instance.allPlayerScripts[i], false, false) && !Physics.Linecast(((Component)this).transform.position + Vector3.up * 0.5f, ((Component)StartOfRound.Instance.allPlayerScripts[i].gameplayCamera).transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault) && Vector3.Distance(((Component)this).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position) < 30f)
{
((EnemyAI)this).SwitchToBehaviourServerRpc(1);
return;
}
}
base.movingTowardsTargetPlayer = false;
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
break;
}
case 1:
base.agent.speed = 0f;
if (base.currentSearch != null)
{
((EnemyAI)this).StopSearch(base.currentSearch, true);
}
if (((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f))
{
if ((Object)(object)previousTarget != (Object)(object)base.targetPlayer)
{
previousTarget = base.targetPlayer;
((EnemyAI)this).ChangeEnemyOwnerServerRpc(base.targetPlayer.actualClientId);
}
base.movingTowardsTargetPlayer = true;
}
else
{
base.agent.speed = 2f;
((EnemyAI)this).SwitchToBehaviourServerRpc(0);
((EnemyAI)this).ChangeEnemyOwnerServerRpc(StartOfRound.Instance.allPlayerScripts[0].actualClientId);
}
break;
default:
LogIfDebugBuild("This Behavior State doesn't exist!");
break;
}
}
private bool FoundClosestPlayerInRange(float range, float senseRange)
{
//IL_004e: 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)
((EnemyAI)this).TargetClosestPlayer(1.5f, true, 70f);
if ((Object)(object)base.targetPlayer == (Object)null)
{
((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f);
range = senseRange;
}
return (Object)(object)base.targetPlayer != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < range;
}
private bool TargetClosestPlayerInAnyCase()
{
//IL_001f: 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)
base.mostOptimalDistance = 2000f;
base.targetPlayer = null;
for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; i++)
{
base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position);
if (base.tempDist < base.mostOptimalDistance)
{
base.mostOptimalDistance = base.tempDist;
base.targetPlayer = StartOfRound.Instance.allPlayerScripts[i];
}
}
if ((Object)(object)base.targetPlayer == (Object)null)
{
return false;
}
return true;
}
public override void OnCollideWithPlayer(Collider other)
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: 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_00e0: 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_010b: Unknown result type (might be due to invalid IL or missing references)
PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
if (!((Object)(object)val != (Object)null))
{
return;
}
((Component)this).GetComponentInChildren<AudioSource>().PlayOneShot(gnomeTeleport);
StunExplosion(((Component)this).transform.position, affectAudio: true, 1f, 7.5f);
if (RoundManager.Instance.insideAINodes.Length != 0 && 0 == 0)
{
((Component)((EnemyAI)this).GetClosestPlayer(false, false, false)).GetComponentInChildren<AudioSource>().PlayOneShot(flashbangSound);
((Component)((EnemyAI)this).GetClosestPlayer(false, false, false)).GetComponentInChildren<AudioSource>().PlayOneShot(gnomeTeleport);
bool flag = true;
timeSinceHittingLocalPlayer = 0f;
newTeleport = GenerateTeleportLocation(Vector3.zero, isPlayer: false);
base.serverPosition = newTeleport;
((Component)this).transform.position = newTeleport;
base.agent.Warp(newTeleport);
((EnemyAI)this).SyncPositionToClients();
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
if (((NetworkBehaviour)this).IsOwner && ((NetworkBehaviour)this).OwnerClientId != 0)
{
((EnemyAI)this).ChangeEnemyOwnerServerRpc(StartOfRound.Instance.allPlayerScripts[0].actualClientId);
}
((EnemyAI)this).SwitchToBehaviourClientRpc(0);
}
}
private Vector3 GenerateTeleportLocation(Vector3 teleportposition, bool isPlayer)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: 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_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: 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_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: 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_00de: 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_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
Vector3 position = RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length)].transform.position;
Plugin.Logger.LogInfo((object)"Generating Teleport Location!");
if (!isPlayer && (Object)(object)((EnemyAI)this).GetClosestPlayer(false, false, false) != (Object)null)
{
while (Vector3.Distance(position, ((Component)((EnemyAI)this).GetClosestPlayer(false, false, false)).transform.position) <= 40f)
{
position = RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length)].transform.position;
if (Vector3.Distance(position, ((Component)((EnemyAI)this).GetClosestPlayer(false, false, false)).transform.position) >= 40f)
{
position = RoundManager.Instance.GetRandomNavMeshPositionInRadiusSpherical(position, 10f, default(NavMeshHit));
teleportposition = position;
return teleportposition;
}
}
return teleportposition;
}
position = RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length)].transform.position;
position = RoundManager.Instance.GetRandomNavMeshPositionInRadiusSpherical(position, 10f, default(NavMeshHit));
teleportposition = position;
return teleportposition;
}
private void StunExplosion(Vector3 explosionPosition, bool affectAudio, float flashSeverityMultiplier, float enemyStunTime, float flashSeverityDistanceRolloff = 1f, bool isHeldItem = false, float addToFlashSeverity = 0f)
{
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: 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_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: 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_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_021e: Unknown result type (might be due to invalid IL or missing references)
//IL_0223: Unknown result type (might be due to invalid IL or missing references)
//IL_022d: Unknown result type (might be due to invalid IL or missing references)
//IL_0232: Unknown result type (might be due to invalid IL or missing references)
//IL_0243: Unknown result type (might be due to invalid IL or missing references)
//IL_0244: Unknown result type (might be due to invalid IL or missing references)
PlayerControllerB val = GameNetworkManager.Instance.localPlayerController;
if (GameNetworkManager.Instance.localPlayerController.isPlayerDead && (Object)(object)GameNetworkManager.Instance.localPlayerController.spectatedPlayerScript != (Object)null)
{
val = GameNetworkManager.Instance.localPlayerController.spectatedPlayerScript;
}
float num = Vector3.Distance(((Component)val).transform.position, explosionPosition);
float num2 = 7f / (num * flashSeverityDistanceRolloff);
if (Physics.Linecast(explosionPosition + Vector3.up * 0.5f, ((Component)val.gameplayCamera).transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
{
num2 /= 13f;
}
else if (num < 2f)
{
num2 = 1f;
}
else if (!val.HasLineOfSightToPosition(explosionPosition, 60f, 15, 2f))
{
num2 = Mathf.Clamp(num2 / 3f, 0f, 1f);
}
num2 = Mathf.Clamp(num2 * flashSeverityMultiplier, 0f, 1f);
if (num2 > 0.6f)
{
num2 += addToFlashSeverity;
}
HUDManager.Instance.flashFilter = num2;
if (affectAudio)
{
SoundManager.Instance.earsRingingTimer = num2;
}
if (enemyStunTime <= 0f)
{
return;
}
Collider[] array = Physics.OverlapSphere(explosionPosition, 12f, 524288);
if (array.Length == 0)
{
return;
}
for (int i = 0; i < array.Length; i++)
{
EnemyAICollisionDetect component = ((Component)array[i]).GetComponent<EnemyAICollisionDetect>();
if (!((Object)(object)component == (Object)null))
{
Vector3 val2 = ((Component)component.mainScript).transform.position + Vector3.up * 0.5f;
if (((Component)component).GetComponentInParent<FlashbangGnomeAI>().DWHasLineOfSightToPosition(explosionPosition + Vector3.up * 0.5f, 120f, 23, 7f) || (!Physics.Linecast(explosionPosition + Vector3.up * 0.5f, ((Component)component.mainScript).transform.position + Vector3.up * 0.5f, 256) && Vector3.Distance(explosionPosition, val2) < 11f))
{
component.mainScript.SetEnemyStunned(true, enemyStunTime, (PlayerControllerB)null);
}
}
}
}
public bool DWHasLineOfSightToPosition(Vector3 pos, float width = 45f, int range = 30, float proximityAwareness = 7.5f)
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: 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_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: 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_006c: 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_0078: 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_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)base.eye == (Object)null)
{
_ = ((Component)this).transform;
}
else
{
_ = base.eye;
}
if (Vector3.Distance(base.eye.position, pos) < (float)range && !Physics.Linecast(base.eye.position, pos, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
{
Vector3 val = pos - base.eye.position;
if (Vector3.Angle(base.eye.forward, val) < width || Vector3.Distance(((Component)this).transform.position, pos) < proximityAwareness)
{
return true;
}
}
return false;
}
protected override void __initializeVariables()
{
((EnemyAI)this).__initializeVariables();
}
protected internal override string __getTypeName()
{
return "FlashbangGnomeAI";
}
}
internal class GnomeAI : EnemyAI
{
private enum State
{
SearchingForPlayer,
PlayerFound
}
public Transform turnCompass;
public Transform attackArea;
private float timeSinceHittingLocalPlayer;
private float timeSinceNewRandPos;
private Vector3 lastKnownPlayerPos;
private bool gotLastPos = false;
public float stareDistance;
public Transform cornerDetection;
private LineRenderer line;
private float currentChaseSpeed = 6f;
private Random enemyRandom;
private bool isDeadAnimationDone;
public AudioClip gnomeTeleport;
private Vector3 newTeleport;
private Vector3 newTeleportPlayer;
private bool stopmoving;
private bool hasStopped;
private bool wasOwnerLastFrame;
private float stopAndGoMinimumInterval;
private PlayerControllerB previousTarget;
[Conditional("DEBUG")]
private void LogIfDebugBuild(string text)
{
Plugin.Logger.LogInfo((object)text);
}
public override void Start()
{
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Start();
LogIfDebugBuild("Example Enemy Spawned");
stareDistance = 40f;
line = ((Component)this).gameObject.AddComponent<LineRenderer>();
line.widthMultiplier = 0.2f;
timeSinceHittingLocalPlayer = 0f;
base.creatureAnimator.SetTrigger("startWalk");
timeSinceNewRandPos = 0f;
enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex);
isDeadAnimationDone = false;
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
base.currentBehaviourStateIndex = 0;
}
public override void Update()
{
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: 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_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_0288: Unknown result type (might be due to invalid IL or missing references)
//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Update();
timeSinceHittingLocalPlayer += Time.deltaTime;
timeSinceNewRandPos += Time.deltaTime;
int currentBehaviourStateIndex = base.currentBehaviourStateIndex;
if (!((NetworkBehaviour)this).IsOwner)
{
return;
}
if (stopAndGoMinimumInterval > 0f)
{
stopAndGoMinimumInterval -= Time.deltaTime;
}
if (!wasOwnerLastFrame)
{
wasOwnerLastFrame = true;
if (!stopmoving)
{
base.agent.speed = currentChaseSpeed;
}
else
{
base.agent.speed = 0f;
}
}
bool flag = false;
for (int i = 0; i < GameNetworkManager.Instance.maxAllowedPlayers; i++)
{
if ((((EnemyAI)this).PlayerIsTargetable(StartOfRound.Instance.allPlayerScripts[i], false, false) && StartOfRound.Instance.allPlayerScripts[i].HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 1.6f, 68f, 60, -1f) && Vector3.Distance(((Component)StartOfRound.Instance.allPlayerScripts[i].gameplayCamera).transform.position, base.eye.position) > 0.3f) || (((EnemyAI)this).PlayerIsTargetable(StartOfRound.Instance.allPlayerScripts[i], false, false) && StartOfRound.Instance.allPlayerScripts[i].HasLineOfSightToPosition(cornerDetection.position + Vector3.up * 1.6f, 68f, 60, -1f) && Vector3.Distance(((Component)StartOfRound.Instance.allPlayerScripts[i].gameplayCamera).transform.position, base.eye.position) > 0.3f))
{
flag = true;
}
}
if (base.stunNormalizedTimer > 0f)
{
flag = true;
}
if (flag != stopmoving && stopAndGoMinimumInterval <= 0f)
{
stopAndGoMinimumInterval = 0.15f;
stopmoving = flag;
}
if (stopmoving)
{
if (!hasStopped)
{
hasStopped = true;
if (GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(((Component)this).transform.position, 70f, 25, -1f) || GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(cornerDetection.position, 70f, 25, -1f))
{
base.agent.speed = 0f;
}
}
if (((NetworkBehaviour)this).IsOwner)
{
base.agent.speed = 0f;
}
}
else
{
if (hasStopped)
{
hasStopped = false;
}
if (((NetworkBehaviour)this).IsOwner)
{
base.agent.speed = Mathf.Lerp(base.agent.speed, currentChaseSpeed, 4.5f * Time.deltaTime);
((EnemyAI)this).SwitchToBehaviourServerRpc(0);
}
}
}
public static IEnumerator DrawPath(LineRenderer line, NavMeshAgent agent)
{
if (((Behaviour)agent).enabled)
{
yield return (object)new WaitForEndOfFrame();
line.SetPosition(0, ((Component)agent).transform.position);
line.positionCount = agent.path.corners.Length;
for (int i = 1; i < agent.path.corners.Length; i++)
{
line.SetPosition(i, agent.path.corners[i]);
}
}
}
public override void DoAIInterval()
{
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).DoAIInterval();
if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
{
return;
}
switch (base.currentBehaviourStateIndex)
{
case 0:
{
if (!((NetworkBehaviour)this).IsServer)
{
((EnemyAI)this).ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId);
break;
}
for (int i = 0; i < GameNetworkManager.Instance.maxAllowedPlayers; i++)
{
if (((EnemyAI)this).PlayerIsTargetable(StartOfRound.Instance.allPlayerScripts[i], false, false) && !Physics.Linecast(((Component)this).transform.position + Vector3.up * 0.5f, ((Component)StartOfRound.Instance.allPlayerScripts[i].gameplayCamera).transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault) && Vector3.Distance(((Component)this).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position) < 30f)
{
((EnemyAI)this).SwitchToBehaviourServerRpc(1);
return;
}
}
base.agent.speed = 6f;
if (base.currentSearch == null)
{
base.movingTowardsTargetPlayer = false;
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
}
break;
}
case 1:
if (base.currentSearch != null)
{
((EnemyAI)this).StopSearch(base.currentSearch, true);
}
if (((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f))
{
if ((Object)(object)previousTarget != (Object)(object)base.targetPlayer)
{
previousTarget = base.targetPlayer;
((EnemyAI)this).ChangeEnemyOwnerServerRpc(base.targetPlayer.actualClientId);
}
base.movingTowardsTargetPlayer = true;
}
else
{
((EnemyAI)this).SwitchToBehaviourServerRpc(0);
((EnemyAI)this).ChangeEnemyOwnerServerRpc(StartOfRound.Instance.allPlayerScripts[0].actualClientId);
}
break;
default:
LogIfDebugBuild("This Behavior State doesn't exist!");
break;
}
}
private bool FoundClosestPlayerInRange(float range, float senseRange)
{
//IL_004e: 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)
((EnemyAI)this).TargetClosestPlayer(1.5f, true, 70f);
if ((Object)(object)base.targetPlayer == (Object)null)
{
((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f);
range = senseRange;
}
return (Object)(object)base.targetPlayer != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < range;
}
private bool TargetClosestPlayerInAnyCase()
{
//IL_001f: 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)
base.mostOptimalDistance = 2000f;
base.targetPlayer = null;
for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; i++)
{
base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position);
if (base.tempDist < base.mostOptimalDistance)
{
base.mostOptimalDistance = base.tempDist;
base.targetPlayer = StartOfRound.Instance.allPlayerScripts[i];
}
}
if ((Object)(object)base.targetPlayer == (Object)null)
{
return false;
}
return true;
}
public override void OnCollideWithPlayer(Collider other)
{
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: 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)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
if (timeSinceHittingLocalPlayer < 1f)
{
return;
}
PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
if (!((Object)(object)val != (Object)null))
{
return;
}
((Component)this).GetComponentInChildren<AudioSource>().PlayOneShot(gnomeTeleport);
if (RoundManager.Instance.insideAINodes.Length == 0)
{
return;
}
if (0 == 0)
{
bool flag = true;
newTeleport = GenerateTeleportLocation(Vector3.zero, isPlayer: true);
val.movementAudio.PlayOneShot(gnomeTeleport);
val.averageVelocity = 0f;
StartOfRound.Instance.allPlayerScripts[val.playerClientId].TeleportPlayer(newTeleport, false, 0f, false, true);
}
if (0 == 0)
{
((Component)((EnemyAI)this).GetClosestPlayer(false, false, false)).GetComponentInChildren<AudioSource>().PlayOneShot(gnomeTeleport);
bool flag2 = true;
timeSinceHittingLocalPlayer = 0f;
newTeleport = GenerateTeleportLocation(Vector3.zero, isPlayer: false);
base.serverPosition = newTeleport;
((Component)this).transform.position = newTeleport;
base.agent.Warp(newTeleport);
((EnemyAI)this).SyncPositionToClients();
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
if (((NetworkBehaviour)this).IsOwner && ((NetworkBehaviour)this).OwnerClientId != 0)
{
((EnemyAI)this).ChangeEnemyOwnerServerRpc(StartOfRound.Instance.allPlayerScripts[0].actualClientId);
}
((EnemyAI)this).SwitchToBehaviourClientRpc(0);
}
}
private Vector3 GenerateTeleportLocation(Vector3 teleportposition, bool isPlayer)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: 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_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: 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_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: 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_0148: 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_00a6: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
Vector3 position = RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length)].transform.position;
if (!isPlayer)
{
while (Vector3.Distance(position, ((Component)((EnemyAI)this).GetClosestPlayer(false, false, false)).transform.position) <= 60f && ((EnemyAI)this).GetClosestPlayer(false, false, false).isInsideFactory)
{
position = RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length)].transform.position;
if (Vector3.Distance(position, ((Component)((EnemyAI)this).GetClosestPlayer(false, false, false)).transform.position) >= 60f && ((EnemyAI)this).GetClosestPlayer(false, false, false).isInsideFactory)
{
position = RoundManager.Instance.GetRandomNavMeshPositionInRadiusSpherical(position, 10f, default(NavMeshHit));
teleportposition = position;
return teleportposition;
}
}
return teleportposition;
}
position = RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length)].transform.position;
position = RoundManager.Instance.GetRandomNavMeshPositionInRadiusSpherical(position, 10f, default(NavMeshHit));
teleportposition = position;
return teleportposition;
}
protected override void __initializeVariables()
{
((EnemyAI)this).__initializeVariables();
}
protected internal override string __getTypeName()
{
return "GnomeAI";
}
}
[BepInPlugin("sconeys.Gnomes", "Gnomes", "2.1.7")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
public const string ModGUID = "sconeys.Gnomes";
internal static ManualLogSource Logger;
public static AssetBundle ModAssets;
private int gnomespawnrate = 100;
private int gnomeitemspawnrate = 30;
private int bluegnomespawnrate = 300;
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
loadConfig();
InitializeNetworkBehaviours();
string path = "gnomes-dev";
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>("GnomeAI");
EnemyType val2 = ModAssets.LoadAsset<EnemyType>("BlueGnomeAI");
Item val3 = ModAssets.LoadAsset<Item>("GnomeItem");
NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab);
Utilities.FixMixerGroups(val3.spawnPrefab);
Utilities.FixMixerGroups(val.enemyPrefab);
Enemies.RegisterEnemy(val, gnomespawnrate, (LevelTypes)(-1), (SpawnType)0, (TerminalNode)null, (TerminalKeyword)null);
Enemies.RegisterEnemy(val2, bluegnomespawnrate, (LevelTypes)(-1), (SpawnType)0, (TerminalNode)null, (TerminalKeyword)null);
Items.RegisterScrap(val3, gnomeitemspawnrate, (LevelTypes)(-1));
Logger.LogInfo((object)"Plugin Gnomes 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 int RandomNumber(int value)
{
Random random = new Random(StartOfRound.Instance.randomMapSeed);
return random.Next(0, 100);
}
private void loadConfig()
{
gnomespawnrate = ((BaseUnityPlugin)this).Config.Bind<int>("General", "GnomeSpawnRate", 100, "What should the spawnrate of the Gnome be?").Value;
gnomeitemspawnrate = ((BaseUnityPlugin)this).Config.Bind<int>("General", "GnomeItemSpawnRate", 30, "What should the spawnrate of the Gnome Item be?").Value;
bluegnomespawnrate = ((BaseUnityPlugin)this).Config.Bind<int>("General", "BlueGnomeSpawnRate", 300, "What should the spawnrate of the Blue Gnome be?").Value;
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "Gnomes";
public const string PLUGIN_NAME = "Gnomes";
public const string PLUGIN_VERSION = "2.1.7";
}
}
namespace Gnomes.src.Items
{
internal class GnomeItem : GrabbableObject
{
public AudioClip gnomeTeleport;
public AudioSource gnomeAudio;
private PlayerControllerB localPlayer;
private float randomchance;
private int isrealgnome;
private float giggletimer;
private float randomgiggletime;
private bool giggletimemade;
private bool teleporttimertriggered;
private float teleporttimer;
private ulong playerID;
public override void Start()
{
((GrabbableObject)this).Start();
isrealgnome = Random.Range(0, 1);
if (isrealgnome == 0)
{
((GrabbableObject)this).SetScrapValue(base.scrapValue / 2);
}
}
public override void Update()
{
((GrabbableObject)this).Update();
if (teleporttimertriggered)
{
teleporttimer += Time.deltaTime;
}
giggletimer += Time.deltaTime;
if (!giggletimemade)
{
randomgiggletime = Random.Range(15, 45);
}
if (giggletimer >= randomgiggletime)
{
gnomeAudio.PlayOneShot(gnomeTeleport);
giggletimer = 0f;
giggletimemade = false;
}
if (teleporttimer >= 5f)
{
RollChanceToTeleport();
teleporttimer = 0f;
teleporttimertriggered = false;
}
if (base.isHeld)
{
playerID = base.playerHeldBy.actualClientId;
localPlayer = base.playerHeldBy;
}
}
public override void GrabItem()
{
((GrabbableObject)this).GrabItem();
if (StartOfRound.Instance.allPlayerScripts[playerID].isInsideFactory)
{
teleporttimertriggered = true;
}
}
public override void DiscardItem()
{
((GrabbableObject)this).DiscardItem();
if (teleporttimertriggered)
{
teleporttimertriggered = false;
}
}
private void RollChanceToTeleport()
{
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: 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_008d: 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_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
RandomNumberServerRpc();
if (randomchance > 75f && (Object)(object)localPlayer != (Object)null)
{
base.playerHeldBy.DropAllHeldItemsServerRpc();
base.playerHeldBy.movementAudio.PlayOneShot(gnomeTeleport);
Vector3 position = RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length)].transform.position;
bool flag = true;
position = RoundManager.Instance.GetRandomNavMeshPositionInRadiusSpherical(position, 10f, default(NavMeshHit));
base.playerHeldBy.isInElevator = false;
base.playerHeldBy.isInHangarShipRoom = false;
base.playerHeldBy.isInsideFactory = true;
base.playerHeldBy.averageVelocity = 0f;
base.playerHeldBy.TeleportPlayer(position, false, 0f, false, true);
}
}
[ServerRpc]
private void RandomNumberServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Invalid comparison between Unknown and I4
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3203003125u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3203003125u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
RandomNumberClientRpc();
}
}
[ClientRpc]
private void RandomNumberClientRpc()
{
//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(2956753183u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2956753183u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
Random random = new Random(StartOfRound.Instance.randomMapSeed);
randomchance = random.Next(0, 100);
}
}
}
protected override void __initializeVariables()
{
((GrabbableObject)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_GnomeItem()
{
//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
NetworkManager.__rpc_func_table.Add(3203003125u, new RpcReceiveHandler(__rpc_handler_3203003125));
NetworkManager.__rpc_func_table.Add(2956753183u, new RpcReceiveHandler(__rpc_handler_2956753183));
}
private static void __rpc_handler_3203003125(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: 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_0076: 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_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Invalid comparison between Unknown and I4
NetworkManager networkManager = target.NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
}
else
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((GnomeItem)(object)target).RandomNumberServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2956753183(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;
((GnomeItem)(object)target).RandomNumberClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "GnomeItem";
}
}
}
namespace Gnomes.Configuration
{
public class PluginConfig
{
private void ClearUnusedEntries(BaseUnityPlugin plugin)
{
PropertyInfo property = ((object)plugin.Config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic);
Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(plugin.Config, null);
dictionary.Clear();
plugin.Config.Save();
}
}
}
namespace Gnomes.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}