using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using Dawn; using Dawn.Utils; using Dusk; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Snowlance.Rats.NetcodePatcher; using SnowyLib; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("DunGen")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.ASPP")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.UnityNav")] [assembly: IgnoresAccessChecksTo("EasyTextEffects")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.XR.CoreUtils")] [assembly: IgnoresAccessChecksTo("Unity.XR.Management")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.ConformanceAutomation")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MetaQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MockRuntime")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.OculusQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.RuntimeDebugger")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SpatialTracking")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("UnityEngine.XR.LegacyInputHelpers")] [assembly: AssemblyCompany("Snowlance.Rats")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.4.0.0")] [assembly: AssemblyInformationalVersion("1.4.0+663681ecebe4b798c0f8f4c83c0f89871a760b32")] [assembly: AssemblyProduct("Rats")] [assembly: AssemblyTitle("Snowlance.Rats")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.4.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Rats { internal static class Configs { public static int cfgMaxRats { get; private set; } public static int cfgBatchGroupCount { get; private set; } public static float cfgBatchUpdateInterval { get; private set; } public static bool cfgHolidayRats { get; private set; } public static bool cfgUseJermaRats { get; private set; } public static bool cfgEnableInfestationSystem { get; private set; } public static int cfgThreatToAttackPlayer { get; private set; } public static int cfgThreatToAttackEnemy { get; private set; } public static float cfgSwarmRadius { get; private set; } public static int cfgEnemyHitsToDoDamage { get; private set; } public static float cfgSqueakChance { get; private set; } public static string[] cfgFoodItemNames { get; private set; } public static string[] cfgFoodItemTags { get; private set; } public static BoundedRange cfgRatSpawnTime { get; private set; } public static int cfgFoodToSpawnRat { get; private set; } public static int cfgEnemyFoodPerHPPoint { get; private set; } public static int cfgMaxDefenseRats { get; private set; } public static int cfgPlayerFoodAmount { get; private set; } public static bool cfgRatsTakePlayerCorpses { get; private set; } public static float cfgMaxFluid { get; private set; } public static float cfgPourRate { get; private set; } public static float cfgPoisonToCloseNest { get; private set; } public static int cfgGlueBoardAmount { get; private set; } public static int cfgScrapValuePerRat { get; private set; } public static int cfgMaxRatsOnGlueBoard { get; private set; } public static int cfgSnapTrapAmount { get; private set; } public static float cfgDespawnTime { get; private set; } public static void Init() { //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Expected O, but got Unknown cfgMaxRats = ((BaseUnityPlugin)Plugin.Instance).Config.Bind("Performance", "Max Rats", 100, "The maximum number of rats that can be on the map. Lowering this can improve performance.").Value; cfgBatchGroupCount = ((BaseUnityPlugin)Plugin.Instance).Config.Bind("Performance", "Batch Group Count", 5, "The amount of groups the rats will be split into to update. (if you dont know what this means, just leave this config alone)").Value; cfgBatchUpdateInterval = ((BaseUnityPlugin)Plugin.Instance).Config.Bind("Performance", "Batch Update Interval", 0.2f, "The amount of time between each group update. (if you dont know what this means, just leave this config alone)").Value; cfgHolidayRats = ((BaseUnityPlugin)Plugin.Instance).Config.Bind("Other", "Holiday Rats", false, "Rats spawn with a santa hat").Value; cfgUseJermaRats = ((BaseUnityPlugin)Plugin.Instance).Config.Bind("Other", "Use Jerma Rats", false, "Uses a lower quality model for the rats with no animations. Can help with performance if enabled.").Value; cfgEnableInfestationSystem = ((BaseUnityPlugin)Plugin.Instance).Config.Bind("Other", "Enable Infestation System", true, "Enables the infestation system").Value; cfgThreatToAttackPlayer = ((BaseUnityPlugin)Plugin.Instance).Config.Bind("Rats", "Threat To Attack Player", 75, "The threat level at which rats begin attacking the player").Value; cfgThreatToAttackEnemy = ((BaseUnityPlugin)Plugin.Instance).Config.Bind("Rats", "Threat To Attack Enemy", 50, "The threat level at which rats begin attacking other enemies").Value; cfgSwarmRadius = ((BaseUnityPlugin)Plugin.Instance).Config.Bind("Rats", "Swarm Radius", 2f, "The radius in which rats swarm around their target").Value; cfgEnemyHitsToDoDamage = ((BaseUnityPlugin)Plugin.Instance).Config.Bind("Rats", "Enemy Hits To Do Damage", 10, "The amount of attacks needed to do 1 shovel hit of damage to an enemy. If 10, thumper will need to be attacked 40 times by a rat.").Value; cfgSqueakChance = ((BaseUnityPlugin)Plugin.Instance).Config.Bind("Rats", "Squeak Chance", 0.01f, "The chance a rat will squeak when completing a run cycle (every second)").Value; cfgFoodItemNames = ((BaseUnityPlugin)Plugin.Instance).Config.Bind("Rats", "Food Item Names", "melaniemeliciouscooked:meatzero,melaniemeliciouscooked:carrotzero,melaniemeliciouscooked:soupveggiezero,melaniemeliciouscooked:soupmeatzero,melaniemeliciouscooked:loafmeatzero,melaniemeliciouscooked:potatozero,melaniemeliciouscooked:wheatzero,melaniemeliciouscooked:flourzero,melaniemeliciouscooked:loafbreadzero,melaniemeliciouscooked:piezero,melaniemeliciouscooked:sliderzero,melaniemeliciouscooked:burgerzero,melaniemeliciouscooked:meatone,melaniemeliciouscooked:sandwichcheesezero,melaniemeliciouscooked:grapezero,melaniemeliciouscooked:juicezero,melaniemeliciouscooked:grapeone,melaniemeliciouscooked:juiceone,melaniemeliciouscooked:alcoholzero,melaniemeliciouscooked:alcoholone,melaniemeliciouscooked:alcoholtwo,melaniemeliciouscooked:alcoholthree,melaniemeliciouscooked:alcoholfour,melaniemeliciouscooked:juicetwo,melaniemeliciouscooked:juicethree,melaniemeliciouscooked:burstberryzero,melaniemeliciouscooked:burstberryone,melaniemeliciouscooked:pieone,melaniemeliciouscooked:honeyzero,melaniemeliciouscooked:hivezero,melaniemeliciouscooked:alcoholfive,melaniemeliciouscooked:hiveone,melaniemeliciouscooked:fishzero,melaniemeliciouscooked:fishone,melaniemeliciouscooked:baitzero,melaniemeliciouscooked:baitone,melaniemeliciouscooked:tomatozero,melaniemeliciouscooked:tomatoone,melaniemeliciouscooked:seedtomato,melaniemeliciouscooked:barrelone,melaniemeliciouscooked:pietwo,melaniemeliciouscooked:cookiezero,melaniemeliciouscooked:bruschettazero,melaniemeliciouscooked:kabobzero,melaniemeliciouscooked:popsiclezero,melaniemeliciouscooked:popsicleone,melaniemeliciouscooked:popsicletwo,melaniemeliciouscooked:fishtwo,melaniemeliciouscooked:fishthree,melaniemeliciouscooked:fishstickszero,lethal_company:candy,lethal_company:jar_of_pickles,lethal_company:pill_bottle,lethal_company:egg,lethal_company:hand,lethal_company:bone,lethal_company:ribcage,lethal_company:ear,lethal_company:foot,lethal_company:knee,lethal_company:heart,lethal_company:tongue", "Dawnlib NamespaceKeys for items rats should steal").Value.Replace(" ", "").ToLower().Split(","); cfgFoodItemTags = ((BaseUnityPlugin)Plugin.Instance).Config.Bind("Rats", "Food Item Tags", "food,edible,organic,consumable,meat,produce,ingredient,snack,perishable,corpse,garbage,ration,snack,candy,waste,carcass,rat_food", "Dawnlib tags for items rats should steal").Value.Replace(" ", "").ToLower().Split(","); cfgRatSpawnTime = ((BaseUnityPlugin)Plugin.Instance).Config.Bind("RatNest", "Rat Spawn Time", new BoundedRange(10f, 30f), "The min/max time in seconds before a rat can spawn from a nest after the last rat was spawned").Value; cfgFoodToSpawnRat = ((BaseUnityPlugin)Plugin.Instance).Config.Bind("RatNest", "Food To Spawn Rat", 5, "The amount of food needed in the nest to spawn a new rat").Value; cfgEnemyFoodPerHPPoint = ((BaseUnityPlugin)Plugin.Instance).Config.Bind("RatNest", "Enemy Food Per HP Point", 10, "How much food points one HP will equal for enemies. ex: if 10, thumper will give 40 food points").Value; cfgMaxDefenseRats = ((BaseUnityPlugin)Plugin.Instance).Config.Bind("RatNest", "Max Defense Rats", 10, "The maximum number of defense rats assigned to protect the nest").Value; cfgPlayerFoodAmount = ((BaseUnityPlugin)Plugin.Instance).Config.Bind("RatNest", "Player Food Amount", 30, "How much food points a player corpse gives when brought to the nest").Value; cfgRatsTakePlayerCorpses = ((BaseUnityPlugin)Plugin.Instance).Config.Bind("RatNest", "Rats Take Player Corpses", true, "If this is true, allows rats to drag players to their nest to eat").Value; cfgMaxFluid = ((BaseUnityPlugin)Plugin.Instance).Config.Bind("RatPoison", "Max Fluid", 5f, "The amount of rat poison in a jug of rat poison").Value; cfgPourRate = ((BaseUnityPlugin)Plugin.Instance).Config.Bind("RatPoison", "Pour Rate", 0.1f, "How fast the rat poison pours out of the container").Value; cfgPoisonToCloseNest = ((BaseUnityPlugin)Plugin.Instance).Config.Bind("RatPoison", "Poison To Close Nest", 1f, "The amount of poison you need to pour in a rat nest to disable it").Value; cfgGlueBoardAmount = ((BaseUnityPlugin)Plugin.Instance).Config.Bind("GlueTrap", "Glue Board Amount", 4, "The amount of glue boards you can place down from a glue board trap item").Value; cfgScrapValuePerRat = ((BaseUnityPlugin)Plugin.Instance).Config.Bind("GlueTrap", "Scrap Value Per Rat", 2, "The scrap value added to the glue board per rat stuck in trap").Value; cfgMaxRatsOnGlueBoard = ((BaseUnityPlugin)Plugin.Instance).Config.Bind("GlueTrap", "Max Rats On Glue Board", 5, "The maximum number of rats that can be caught on a single glue board").Value; cfgSnapTrapAmount = ((BaseUnityPlugin)Plugin.Instance).Config.Bind("BoxOfSnapTraps", "Snap Trap Amount", 100, "The amount of snap traps that come with a Box Of Snap Traps").Value; cfgDespawnTime = ((BaseUnityPlugin)Plugin.Instance).Config.Bind("BoxOfSnapTraps", "Despawn Time", 65, "The time in seconds for snap traps to despawn after being triggered").Value; } } public class RatAI : NetworkBehaviour { public enum State { ReturnToNest, Scouting, Swarming } [CompilerGenerated] private sealed class <g__InSpecialAnimationFalseRoutine|71_0>d : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public RatAI <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <g__InSpecialAnimationFalseRoutine|71_0>d(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = (object)new WaitForSeconds(4.7f); <>1__state = 2; return true; case 2: <>1__state = -1; <>4__this.inSpecialAnimation = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static List Instances = new List(); public static List StealableObjects = new List(); public AudioClip[] squeakSFX = null; public AudioClip[] attackSFX = null; public AudioClip[] hitSFX = null; public AudioClip[] nibbleSFX = null; public AudioClip screamSFX = null; public Transform ratMouthTransform = null; public GameObject christmasHat = null; public GameObject jermaRatObj = null; public GameObject ratObj = null; public Animator? animator; public Transform eye = null; public AudioSource creatureSFX = null; public AudioSource creatureVoice = null; public SmartAgentNavigator nav = null; [HideInInspector] public bool isDead; private GoToDestinationResult destinationResult = (GoToDestinationResult)1; private GameObject? targetNode; private bool inSpecialAnimation; private State previousBehaviorState; private State currentBehaviorState = State.ReturnToNest; [HideInInspector] public PlayerControllerB? targetPlayer; private GrabbableObject? targetObject; private GrabbableObject? heldObject; private DeadBodyInfo? targetBody; private DeadBodyInfo? heldBody; private bool holdingFood; private int hashDie; private int hashSpeed; private float timeSinceCollision; private float timeSinceCheck; private float timeSinceSwitchBehavior; private float timeIdle; private RatNest? closestNest; private GameObject? swarmTarget; private Vector3 swarmTargetPos; public static UnityEvent RallyRats = new UnityEvent(); private bool rallying; private int health = 1; private float swarmRadiusDefault = 6f; private Vector3 lastPosition; private float currentSpeed; private const float timeToDoChecks = 3f; private const float maxIdleTime = 1f; private const float distanceNeededToLoseRats = 20f; private const float rallyDistance = 20f; private const float scentRange = 20f; public bool isOutside => nav.IsAgentOutside(); public void Start() { hashDie = Animator.StringToHash("die"); hashSpeed = Animator.StringToHash("speed"); christmasHat.SetActive(Configs.cfgHolidayRats); animator = (Configs.cfgUseJermaRats ? null : animator); ratObj.SetActive(!Configs.cfgUseJermaRats); jermaRatObj.SetActive(Configs.cfgUseJermaRats); nav.SetAllValues(false); RallyRats.AddListener((UnityAction)ListenForRallyCall); ManualLogSource? logger = Plugin.logger; if (logger != null) { logger.LogDebug((object)"Rat spawned"); } } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); Instances.Add(this); } public override void OnNetworkDespawn() { ResetVariables(); Instances.Remove(this); ((NetworkBehaviour)this).OnNetworkDespawn(); } public void Update() { timeSinceCollision += Time.deltaTime; timeSinceCheck += Time.deltaTime; timeSinceSwitchBehavior += Time.deltaTime; } public void LateUpdate() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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) Vector3 val = ((Component)this).transform.position - lastPosition; currentSpeed = ((Vector3)(ref val)).magnitude / Time.deltaTime / 2f; Animator? obj = animator; if (obj != null) { obj.SetFloat(hashSpeed, currentSpeed); } lastPosition = ((Component)this).transform.position; timeIdle = ((currentSpeed > 0.1f) ? 0f : (timeIdle + Time.deltaTime)); } public void DoAIInterval() { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: 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) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Invalid comparison between Unknown and I4 //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Invalid comparison between Unknown and I4 //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Invalid comparison between Unknown and I4 //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Invalid comparison between Unknown and I4 //IL_044c: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Invalid comparison between Unknown and I4 //IL_061d: Unknown result type (might be due to invalid IL or missing references) //IL_05fc: Unknown result type (might be due to invalid IL or missing references) //IL_0607: Unknown result type (might be due to invalid IL or missing references) //IL_060c: Unknown result type (might be due to invalid IL or missing references) //IL_0611: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_04e5: Unknown result type (might be due to invalid IL or missing references) //IL_04f0: Unknown result type (might be due to invalid IL or missing references) //IL_04f5: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Unknown result type (might be due to invalid IL or missing references) //IL_058c: Unknown result type (might be due to invalid IL or missing references) //IL_0598: Unknown result type (might be due to invalid IL or missing references) //IL_059d: Unknown result type (might be due to invalid IL or missing references) //IL_05a2: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer) { return; } if (isDead || StartOfRound.Instance.allPlayersDead || inSpecialAnimation) { nav.StopAgent(); return; } switch (currentBehaviorState) { case State.ReturnToNest: nav.agent.speed = 5f; if (closestNest == null) { closestNest = RatNest.GetClosestNestToPosition(((Component)this).transform.position); } if ((Object)(object)closestNest == (Object)null) { EnemyVent closestToPosition = IEnumerableExtensions.GetClosestToPosition((IEnumerable)RoundManager.Instance.allEnemyVents, ((Component)this).transform.position, (Func)((EnemyVent x) => ((Component)x).transform.position), false, (IEnumerable)null); nav.DoPathingToDestination(closestToPosition.floorNode.position); if (timeIdle > 1f) { NetworkObject networkObject = ((NetworkBehaviour)this).NetworkObject; if (networkObject != null) { networkObject.Despawn(true); } } break; } nav.TryDoPathingToDestination(((Component)closestNest).transform.position, ref destinationResult); if (timeIdle > 1f && (int)destinationResult == 0) { if (holdingFood) { closestNest.AddFood(); } holdingFood = false; if ((Object)(object)heldBody != (Object)null) { closestNest.AddFood(Configs.cfgPlayerFoodAmount); DropObjectClientRpc(despawn: true); } if ((Object)(object)heldObject != (Object)null) { closestNest.AddFood(Mathf.CeilToInt(heldObject.itemProperties.weight * 2.5f)); DropObjectClientRpc(despawn: true); } if ((Object)(object)closestNest != (Object)null && closestNest.DefenseRats != null && closestNest.DefenseRats.Count < Configs.cfgMaxDefenseRats) { swarmTarget = ((Component)closestNest).gameObject; closestNest.DefenseRats.Add(this); SwitchToBehaviorClientRpc(State.Swarming); } else { SwitchToBehaviorClientRpc(State.Scouting); } } break; case State.Scouting: nav.agent.speed = 5f; if ((Object)(object)targetBody != (Object)null && nav.TryDoPathingToDestination(((Component)targetBody).transform.position, ref destinationResult) && (int)destinationResult != 2) { if ((int)destinationResult == 0) { int attachedLimbIndex = Random.Range(0, targetBody.bodyParts.Length); GrabBodyClientRpc(targetBody.playerScript.actualClientId, attachedLimbIndex); targetBody = null; } break; } if ((Object)(object)targetObject != (Object)null && nav.TryDoPathingToDestination(((Component)targetObject).transform.position, ref destinationResult) && (int)destinationResult != 2) { if ((int)destinationResult == 0) { GrabObjectClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)targetObject).NetworkObject)); targetObject = null; } break; } if (timeSinceCheck > 3f) { timeSinceCheck = 0f; DoChecks(); } if (timeIdle > 1f) { targetNode = ((Instances.Count >= Configs.cfgMaxRats - Configs.cfgMaxRats / 4) ? IEnumerableExtensions.GetRandom((IEnumerable)Utils.allAINodes) : IEnumerableExtensions.GetRandom((IEnumerable)Utils.insideAINodes)); } if ((Object)(object)targetNode != (Object)null) { nav.DoPathingToDestination(targetNode.transform.position); } break; case State.Swarming: { nav.agent.speed = 10f; if ((Object)(object)swarmTarget == (Object)null) { SwitchToBehaviorClientRpc(State.ReturnToNest); break; } float cfgSwarmRadius = Configs.cfgSwarmRadius; PlayerControllerB val = default(PlayerControllerB); Vector3 val2; EnemyAICollisionDetect val3 = default(EnemyAICollisionDetect); if (GameObjectExtensions.TryGetComponentInChildren(swarmTarget, ref val)) { if ((Object)(object)val == (Object)null || !val.isPlayerControlled) { goto IL_0516; } if (!rallying && timeIdle > 1f && timeSinceSwitchBehavior > 3f) { val2 = ((Component)this).transform.position - ((Component)val).transform.position; if (((Vector3)(ref val2)).sqrMagnitude > 400f) { goto IL_0516; } } } else if (GameObjectExtensions.TryGetComponentInChildren(swarmTarget, ref val3)) { EnemyAI val4 = val3?.mainScript; if ((Object)(object)val4 == (Object)null || val4.isEnemyDead) { goto IL_05be; } if (!rallying && timeIdle > 1f && timeSinceSwitchBehavior > 2f) { val2 = ((Component)this).transform.position - ((Component)val4).transform.position; if (((Vector3)(ref val2)).sqrMagnitude > 400f) { goto IL_05be; } } } else { cfgSwarmRadius = swarmRadiusDefault; } if (timeIdle > 1f) { swarmTargetPos = RoundManager.Instance.GetRandomNavMeshPositionInRadius(swarmTarget.transform.position, cfgSwarmRadius, RoundManager.Instance.navHit); } nav.DoPathingToDestination(swarmTargetPos); break; } default: { ManualLogSource? logger = Plugin.logger; if (logger != null) { logger.LogWarning((object)("Invalid state: " + currentBehaviorState)); } break; } IL_0516: SwitchToBehaviorClientRpc(State.ReturnToNest); break; IL_05be: SwitchToBehaviorClientRpc(State.ReturnToNest); break; } } public void ListenForRallyCall(Vector3 rallyPos, GameObject target) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //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) if (!rallying) { int num; if (!isDead) { Vector3 val = rallyPos - ((Component)this).transform.position; num = ((((Vector3)(ref val)).sqrMagnitude < 400f) ? 1 : 0); } else { num = 0; } rallying = (byte)num != 0; if (rallying) { swarmTarget = target; SwitchToBehaviorClientRpc(State.Swarming); } } } private void DoChecks() { CheckForThreatsInLOS(); CheckLineOfSightForPlayerDeadBody(); CheckForItemsToSteal(); } private void CheckLineOfSightForPlayerDeadBody() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) if (!Configs.cfgRatsTakePlayerCorpses) { return; } targetBody = null; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { DeadBodyInfo deadBody = val.deadBody; if (!((Object)(object)deadBody == (Object)null) && !deadBody.deactivated && CheckLineOfSightForPosition(((Component)deadBody.grabBodyObject).transform.position, 60f, 60, 5f) && SmartAgentNavigatorExtensions.CanPathToPoint(nav, ((Component)deadBody.grabBodyObject).transform.position)) { targetBody = deadBody; break; } } } private void CheckForThreatsInLOS() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 EnemyAI val = CheckLineOfSightForEnemy(30); if ((Object)(object)val != (Object)null && val.enemyType.canDie && (int)val.enemyType.EnemySize == 0) { AddThreat(val); } PlayerControllerB val2 = CheckLineOfSightForPlayer(60f, 60, 5); if ((Object)(object)val2 != (Object)null && val2.isPlayerControlled) { AddThreat(val2); } } private void CheckForItemsToSteal() { //IL_006a: 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_007f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)targetBody != (Object)null || (Object)(object)heldBody != (Object)null) { return; } targetObject = null; float num = 400f; foreach (GrabbableObject item in StealableObjects.ToList()) { if (IsObjectGrabbable(item)) { Vector3 val = ((Component)this).transform.position - ((Component)item).transform.position; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (!(sqrMagnitude >= num)) { targetObject = item; num = sqrMagnitude; } } } } private bool IsObjectGrabbable(GrabbableObject obj) { return (Object)(object)heldObject == (Object)null && (Object)(object)heldBody == (Object)null && (Object)(object)obj != (Object)null && obj.grabbable && obj.grabbableToEnemies && !obj.isHeld && !obj.isHeldByEnemy && obj.hasHitGround && (Object)(object)obj.playerHeldBy == (Object)null; } public bool CheckLineOfSightForPosition(Vector3 objectPosition, float width = 45f, int range = 60, float proximityAwareness = -1f, Transform? overrideEye = null) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_0077: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) if (!isOutside) { if (objectPosition.y > -80f) { return false; } } else if (objectPosition.y < -100f) { return false; } Transform val = (Transform)(((Object)(object)overrideEye != (Object)null) ? overrideEye : ((!((Object)(object)eye == (Object)null)) ? ((object)eye) : ((object)((Component)this).transform))); Vector3 val2 = val.position - objectPosition; RaycastHit val3 = default(RaycastHit); if (((Vector3)(ref val2)).sqrMagnitude < (float)(range * range) && !Physics.Linecast(val.position, objectPosition, ref val3, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { Vector3 val4 = objectPosition - val.position; if (!(Vector3.Angle(val.forward, val4) < width)) { val2 = ((Component)this).transform.position - objectPosition; if (!(((Vector3)(ref val2)).sqrMagnitude < proximityAwareness * proximityAwareness)) { goto IL_0100; } } return true; } goto IL_0100; IL_0100: return false; } public PlayerControllerB? CheckLineOfSightForPlayer(float width = 45f, int range = 60, int proximityAwareness = -1) { //IL_001f: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_0084: 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) //IL_009d: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++) { Vector3 position = ((Component)StartOfRound.Instance.allPlayerScripts[i].gameplayCamera).transform.position; Vector3 val = position - eye.position; if (!(((Vector3)(ref val)).sqrMagnitude < (float)(range * range)) || Physics.Linecast(eye.position, position, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { continue; } Vector3 val2 = position - eye.position; if (!(Vector3.Angle(eye.forward, val2) < width)) { if (proximityAwareness == -1) { continue; } val = eye.position - position; if (!(((Vector3)(ref val)).sqrMagnitude < (float)(proximityAwareness * proximityAwareness))) { continue; } } return StartOfRound.Instance.allPlayerScripts[i]; } return null; } public EnemyAI? CheckLineOfSightForEnemy(int range) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_0073: Unknown result type (might be due to invalid IL or missing references) foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies) { if (!((Object)(object)spawnedEnemy == (Object)null) && spawnedEnemy.enemyType.canDie && (int)spawnedEnemy.enemyType.EnemySize <= 0) { Vector3 objectPosition = (((Object)(object)spawnedEnemy.eye != (Object)null) ? spawnedEnemy.eye.position : ((Component)spawnedEnemy).transform.position); if (CheckLineOfSightForPosition(objectPosition, 60f, range, 5f)) { return spawnedEnemy; } } } return null; } public void HitFromExplosion(float distance) { KillEnemyClientRpc(); } public void OnCollideWithPlayer(Collider other) { //IL_00be: 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) if (isDead || timeSinceCollision < 1f) { return; } timeSinceCollision = 0f; PlayerControllerB component = ((Component)other).gameObject.GetComponent(); if ((Object)(object)component == (Object)null || !component.isPlayerControlled) { return; } rallying = false; if (currentBehaviorState == State.Swarming) { RoundManager.PlayRandomClip(creatureSFX, attackSFX, true, 1f, 0, 1000); if (!((Object)(object)component != (Object)(object)Plugin.localPlayer)) { int num = ((Random.Range(0, 2) == 1) ? 7 : 0); component.DamagePlayer(1, true, true, (CauseOfDeath)6, num, false, default(Vector3)); AddThreat(component); } } } public void OnCollideWithEnemy(Collider other, EnemyAI? collidedEnemy = null) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Invalid comparison between Unknown and I4 //IL_0132: Unknown result type (might be due to invalid IL or missing references) if (isDead || currentBehaviorState == State.ReturnToNest || timeSinceCollision < 1f || (Object)(object)collidedEnemy == (Object)null || !collidedEnemy.enemyType.canDie || (int)collidedEnemy.enemyType.EnemySize > 0) { return; } rallying = false; ManualLogSource? logger = Plugin.logger; if (logger != null) { logger.LogDebug((object)("Collided with: " + collidedEnemy.enemyType.enemyName)); } timeSinceCollision = 0f; if (collidedEnemy.isEnemyDead) { AutoDictionary enemyFoodPointsLeft = RatNest.enemyFoodPointsLeft; EnemyAI val = collidedEnemy; enemyFoodPointsLeft[val] -= 1; holdingFood = true; if (RatNest.enemyFoodPointsLeft[collidedEnemy] <= 0) { ((Dictionary)(object)RatNest.enemyFoodPointsLeft).Remove(collidedEnemy); RoundManager.Instance.DespawnEnemyOnServer(((NetworkBehaviour)collidedEnemy).NetworkObject); } RoundManager.PlayRandomClip(creatureSFX, nibbleSFX, true, 1f, 0, 1000); if (Plugin.localPlayer.HasLineOfSightToPosition(((Component)this).transform.position, 45f, 60, -1f, -1)) { Plugin.localPlayer.IncreaseFearLevelOverTime(0.8f, 1f); } if (((NetworkBehaviour)this).IsServer) { SwitchToBehaviorClientRpc(State.ReturnToNest); } } else if (RatNest.enemyThreatCounter[collidedEnemy] > Configs.cfgThreatToAttackEnemy) { AutoDictionary enemyFoodPointsLeft = RatNest.enemyHitCount; EnemyAI val = collidedEnemy; enemyFoodPointsLeft[val] -= 1; if (RatNest.enemyHitCount[collidedEnemy] <= 0) { collidedEnemy.HitEnemy(1, (PlayerControllerB)null, true, -1); RatNest.enemyHitCount[collidedEnemy] = Configs.cfgEnemyHitsToDoDamage; } } if (currentBehaviorState == State.Swarming) { RoundManager.PlayRandomClip(creatureSFX, attackSFX, true, 1f, 0, 1000); } } private void AddThreat(EnemyAI enemy, int amount = 1) { if ((Object)(object)enemy == (Object)null) { return; } AutoDictionary enemyThreatCounter = RatNest.enemyThreatCounter; enemyThreatCounter[enemy] += amount; int num = RatNest.enemyThreatCounter[enemy]; ManualLogSource? logger = Plugin.logger; if (logger != null) { logger.LogDebug((object)$"{enemy.enemyType.enemyName}: {num} threat"); } if (currentBehaviorState != State.Swarming) { if (num > Configs.cfgThreatToAttackEnemy * 2 && !rallying && ((NetworkBehaviour)this).IsServer) { RallyCall(((Component)enemy).gameObject); } else if (RatNest.enemyThreatCounter[enemy] > Configs.cfgThreatToAttackEnemy && ((NetworkBehaviour)this).IsServer) { swarmTarget = ((Component)enemy).gameObject; SwitchToBehaviorClientRpc(State.Swarming); } } } private void AddThreat(PlayerControllerB player, int amount = 1) { if ((Object)(object)player == (Object)null || !player.isPlayerControlled) { return; } if (((Dictionary)(object)RatNest.playerThreatCounter).ContainsKey(player)) { AutoDictionary playerThreatCounter = RatNest.playerThreatCounter; playerThreatCounter[player] += amount; } else { ((Dictionary)(object)RatNest.playerThreatCounter).Add(player, amount); } int num = RatNest.playerThreatCounter[player]; ManualLogSource? logger = Plugin.logger; if (logger != null) { logger.LogDebug((object)$"{player.playerUsername}: {num} threat"); } if (currentBehaviorState != State.Swarming) { if (num > Configs.cfgThreatToAttackPlayer * 2 && !rallying) { RallyCall(((Component)player).gameObject); } else if (num > Configs.cfgThreatToAttackPlayer) { targetPlayer = player; swarmTarget = ((Component)player).gameObject; SwitchToBehaviorClientRpc(State.Swarming); } } } private void RallyCall(GameObject target) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) swarmTarget = target; inSpecialAnimation = true; rallying = true; creatureVoice.PlayOneShot(screamSFX); RallyRats.Invoke(((Component)this).transform.position, swarmTarget); if (Configs.cfgUseJermaRats) { ((MonoBehaviour)this).StartCoroutine(InSpecialAnimationFalseRoutine()); return; } Animator? obj = animator; if (obj != null) { obj.SetTrigger("rally"); } [IteratorStateMachine(typeof(<g__InSpecialAnimationFalseRoutine|71_0>d))] IEnumerator InSpecialAnimationFalseRoutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <g__InSpecialAnimationFalseRoutine|71_0>d(0) { <>4__this = this }; } } public void FinishRunCycle() { if (Random.Range(0f, 1f) < Configs.cfgSqueakChance) { RoundManager.PlayRandomClip(creatureSFX, squeakSFX, true, 1f, 0, 1000); } } public void SetInSpecialAnimationFalse() { inSpecialAnimation = false; } public void HitEnemy(int force, int playerHitBy = -1) { if (playerHitBy != -1) { PlayerControllerB player = Plugin.PlayerFromId((ulong)playerHitBy); AddThreat(player); } health -= force; RoundManager.PlayRandomClip(creatureSFX, hitSFX, true, 1f, 0, 1000); if (health <= 0) { KillEnemy(); } if ((Object)(object)heldObject != (Object)null || (Object)(object)heldBody != (Object)null) { DropObjectOnLocalClient(despawn: false); } } public void KillEnemy() { isDead = true; Animator? obj = animator; if (obj != null) { obj.SetTrigger(hashDie); } Animator? obj2 = animator; if (obj2 != null) { obj2.Update(0f); } if (((NetworkBehaviour)this).IsServer) { ((MonoBehaviour)this).StopAllCoroutines(); ((Behaviour)nav.agent).enabled = false; nav.OnEnableOrDisableAgent.Invoke(false); ResetVariables(); } } public void ResetVariables() { if (previousBehaviorState == State.Swarming) { foreach (RatNest nest in RatNest.nests) { nest?.DefenseRats?.Remove(this); } } closestNest = null; } public void SwitchToBehaviorOnLocalClient(State state) { if (currentBehaviorState != state) { previousBehaviorState = currentBehaviorState; currentBehaviorState = state; timeSinceSwitchBehavior = 0f; ResetVariables(); } } [ClientRpc] public void SwitchToBehaviorClientRpc(State state) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2151512038u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref state, default(ForEnums)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2151512038u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; SwitchToBehaviorOnLocalClient(state); } } } [ClientRpc] public void PlayRallySFXClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2845775495u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2845775495u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; creatureSFX.PlayOneShot(screamSFX); } } } [ClientRpc] public void GrabObjectClientRpc(NetworkObjectReference netRef) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2230573478u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref netRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2230573478u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); ((NetworkObjectReference)(ref netRef)).TryGet(ref val3, (NetworkManager)null); GrabbableObject component = ((Component)val3).GetComponent(); component.parentObject = ratMouthTransform; component.hasHitGround = false; component.isHeldByEnemy = true; component.EnablePhysics(false); HoarderBugAI.grabbableObjectsInMap.Remove(((Component)component).gameObject); heldObject = component; RoundManager.PlayRandomClip(creatureSFX, nibbleSFX, true, 1f, -1, 1000); SwitchToBehaviorOnLocalClient(State.ReturnToNest); } } } [ClientRpc] public void GrabBodyClientRpc(ulong clientId, int attachedLimbIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3500738837u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientId); BytePacker.WriteValueBitPacked(val2, attachedLimbIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3500738837u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; targetPlayer = Plugin.PlayerFromId(clientId); heldBody = targetPlayer.deadBody; heldBody.attachedTo = ratMouthTransform; heldBody.attachedLimb = targetPlayer.deadBody.bodyParts[attachedLimbIndex]; heldBody.matchPositionExactly = true; RoundManager.PlayRandomClip(creatureSFX, nibbleSFX, true, 1f, -1, 1000); SwitchToBehaviorOnLocalClient(State.ReturnToNest); } } } [ClientRpc] public void DropObjectClientRpc(bool despawn) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3305414665u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref despawn, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3305414665u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; DropObjectOnLocalClient(despawn); } } } public void DropObjectOnLocalClient(bool despawn) { //IL_0071: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)heldBody != (Object)null) { heldBody.attachedTo = null; heldBody.attachedLimb = null; heldBody.matchPositionExactly = false; if (despawn) { heldBody.DeactivateBody(false); } heldBody = null; } if ((Object)(object)heldObject != (Object)null) { Vector3 floorPosition = Vector3Extensions.GetFloorPosition(((Component)heldObject).transform.position, 0f); heldObject.parentObject = null; ((Component)heldObject).transform.SetParent(StartOfRound.Instance.propsContainer, true); heldObject.EnablePhysics(true); heldObject.fallTime = 0f; heldObject.startFallingPosition = ((Component)heldObject).transform.parent.InverseTransformPoint(((Component)heldObject).transform.position); heldObject.targetFloorPosition = ((Component)heldObject).transform.parent.InverseTransformPoint(floorPosition); heldObject.DiscardItemFromEnemy(); heldObject.isHeldByEnemy = false; if (despawn) { ((NetworkBehaviour)heldObject).NetworkObject.Despawn(true); } else { HoarderBugAI.grabbableObjectsInMap.Add(((Component)heldObject).gameObject); } heldObject = null; } } [ServerRpc(RequireOwnership = false)] public void HitEnemyServerRpc(int force, int playerHitBy = -1) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3308590472u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, force); BytePacker.WriteValueBitPacked(val2, playerHitBy); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3308590472u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkBehaviour)this).IsServer) { HitEnemyClientRpc(force, playerHitBy); } } } [ClientRpc] private void HitEnemyClientRpc(int force, int playerHitBy = -1) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2203808049u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, force); BytePacker.WriteValueBitPacked(val2, playerHitBy); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2203808049u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; HitEnemy(force, playerHitBy); } } } [ServerRpc(RequireOwnership = false)] public void KillEnemyServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3223101186u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3223101186u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkBehaviour)this).IsServer) { KillEnemyClientRpc(); } } } [ClientRpc] private void KillEnemyClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4064924559u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4064924559u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; KillEnemy(); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2151512038u, new RpcReceiveHandler(__rpc_handler_2151512038), "SwitchToBehaviorClientRpc"); ((NetworkBehaviour)this).__registerRpc(2845775495u, new RpcReceiveHandler(__rpc_handler_2845775495), "PlayRallySFXClientRpc"); ((NetworkBehaviour)this).__registerRpc(2230573478u, new RpcReceiveHandler(__rpc_handler_2230573478), "GrabObjectClientRpc"); ((NetworkBehaviour)this).__registerRpc(3500738837u, new RpcReceiveHandler(__rpc_handler_3500738837), "GrabBodyClientRpc"); ((NetworkBehaviour)this).__registerRpc(3305414665u, new RpcReceiveHandler(__rpc_handler_3305414665), "DropObjectClientRpc"); ((NetworkBehaviour)this).__registerRpc(3308590472u, new RpcReceiveHandler(__rpc_handler_3308590472), "HitEnemyServerRpc"); ((NetworkBehaviour)this).__registerRpc(2203808049u, new RpcReceiveHandler(__rpc_handler_2203808049), "HitEnemyClientRpc"); ((NetworkBehaviour)this).__registerRpc(3223101186u, new RpcReceiveHandler(__rpc_handler_3223101186), "KillEnemyServerRpc"); ((NetworkBehaviour)this).__registerRpc(4064924559u, new RpcReceiveHandler(__rpc_handler_4064924559), "KillEnemyClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_2151512038(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { State state = default(State); ((FastBufferReader)(ref reader)).ReadValueSafe(ref state, default(ForEnums)); target.__rpc_exec_stage = (__RpcExecStage)1; ((RatAI)(object)target).SwitchToBehaviorClientRpc(state); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2845775495(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; ((RatAI)(object)target).PlayRallySFXClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2230573478(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference netRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref netRef, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((RatAI)(object)target).GrabObjectClientRpc(netRef); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3500738837(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong clientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); int attachedLimbIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref attachedLimbIndex); target.__rpc_exec_stage = (__RpcExecStage)1; ((RatAI)(object)target).GrabBodyClientRpc(clientId, attachedLimbIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3305414665(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool despawn = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref despawn, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((RatAI)(object)target).DropObjectClientRpc(despawn); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3308590472(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int force = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref force); int playerHitBy = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerHitBy); target.__rpc_exec_stage = (__RpcExecStage)1; ((RatAI)(object)target).HitEnemyServerRpc(force, playerHitBy); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2203808049(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int force = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref force); int playerHitBy = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerHitBy); target.__rpc_exec_stage = (__RpcExecStage)1; ((RatAI)(object)target).HitEnemyClientRpc(force, playerHitBy); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3223101186(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; ((RatAI)(object)target).KillEnemyServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4064924559(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; ((RatAI)(object)target).KillEnemyClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "RatAI"; } } public class RatAICollisionDetect : MonoBehaviour, IHittable { public RatAI mainScript = null; private void OnTriggerStay(Collider other) { if (((Component)other).CompareTag("Player")) { mainScript.OnCollideWithPlayer(other); } else if (((Component)other).CompareTag("Enemy")) { EnemyAICollisionDetect component = ((Component)other).gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { mainScript.OnCollideWithEnemy(other, component.mainScript); } } } bool IHittable.Hit(int force, Vector3 hitDirection, PlayerControllerB? playerWhoHit, bool playHitSFX, int hitID) { int playerHitBy = (((Object)(object)playerWhoHit != (Object)null) ? ((int)playerWhoHit.actualClientId) : (-1)); mainScript.HitEnemyServerRpc(force, playerHitBy); return true; } } [HarmonyPatch] internal static class RatAIPatches { [HarmonyPostfix] [HarmonyPatch(typeof(Landmine), "SpawnExplosion")] public static void Landmine_SpawnExplosion_Postfix(Vector3 explosionPosition, bool spawnExplosionEffect = false, float killRange = 1f, float damageRange = 1f, int nonLethalDamage = 50, float physicsForce = 0f, GameObject overridePrefab = null, bool goThroughCar = false) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.IsServerOrHost) { return; } foreach (RatAI instance in RatAI.Instances) { if (!((Object)(object)instance == (Object)null) && !instance.isDead) { float num = Vector3.Distance(((Component)instance).transform.position, explosionPosition); if (num < damageRange) { instance.HitFromExplosion(num); } } } } [HarmonyPostfix] [HarmonyPatch(typeof(GrabbableObject), "Start")] public static void GrabbableObject_Start_Postfix(GrabbableObject __instance) { if (Plugin.IsServerOrHost) { DawnItemInfo dawnInfo = ItemExtensions.GetDawnInfo(__instance.itemProperties); if (dawnInfo != null && (((DawnBaseInfo)(object)dawnInfo).AllTags().Any((NamespacedKey x) => Configs.cfgFoodItemTags.Contains(((object)x).ToString())) || Configs.cfgFoodItemNames.Contains(((object)((DawnBaseInfo)(object)dawnInfo).TypedKey).ToString()))) { RatAI.StealableObjects.Add(__instance); } } } [HarmonyPostfix] [HarmonyPatch(typeof(GrabbableObject), "OnDestroy")] public static void GrabbableObject_OnDestroy_Postfix(GrabbableObject __instance) { if (Plugin.IsServerOrHost) { RatAI.StealableObjects.Remove(__instance); } } } internal class LethalDiseasesCompatibility { } internal static class LevelInfestations { public static Dictionary levelInfestations = new Dictionary(); public static string currentLevel = ""; private const string saveName = "RatLevelInfestations"; public static float currentLevelInfestationPercentage => RatAI.Instances.Where((RatAI x) => !x.isDead).Count() / Configs.cfgMaxRats; public static float currentLevelInfestation => RatAI.Instances.Where((RatAI x) => !x.isDead).Count(); public static void UpdateLevelInfestation() { if (Configs.cfgEnableInfestationSystem && !(currentLevel == "")) { if (!levelInfestations.ContainsKey(currentLevel)) { levelInfestations.Add(currentLevel, 0); } levelInfestations[currentLevel] = Mathf.Min(RatAI.Instances.Where((RatAI x) => !x.isDead).Count(), Configs.cfgMaxRats); } } public static void SpawnRatsForLevel() { if (!Configs.cfgEnableInfestationSystem) { return; } currentLevel = ((Object)StartOfRound.Instance.currentLevel).name; if (!levelInfestations.ContainsKey(currentLevel)) { return; } int num = levelInfestations[currentLevel]; if (num <= 0 || RatNest.nests.Count == 0) { return; } int amount = num / RatNest.nests.Count; foreach (RatNest nest in RatNest.nests) { nest.SpawnRats(amount); } } public static void LoadData() { if (Configs.cfgEnableInfestationSystem) { ManualLogSource? logger = Plugin.logger; if (logger != null) { logger.LogDebug((object)"Loading infestation data"); } levelInfestations = ES3.Load>("RatLevelInfestations", GameNetworkManager.Instance.currentSaveFileName); Log(); } } public static void SaveData() { if (Configs.cfgEnableInfestationSystem) { ManualLogSource? logger = Plugin.logger; if (logger != null) { logger.LogDebug((object)"Saving infestation data"); } ES3.Save>("RatLevelInfestations", levelInfestations, GameNetworkManager.Instance.currentSaveFileName); } } public static void ResetData() { if (Configs.cfgEnableInfestationSystem) { levelInfestations.Clear(); ES3.DeleteKey("RatLevelInfestations", GameNetworkManager.Instance.currentSaveFileName); } } public static void Log() { foreach (KeyValuePair levelInfestation in levelInfestations) { ManualLogSource? logger = Plugin.logger; if (logger != null) { logger.LogDebug((object)$"{levelInfestation.Key}: {levelInfestation.Value}"); } } } } [HarmonyPatch] internal static class LevelInfestationsPatches { [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "OnShipLandedMiscEvents")] public static void StartOfRound_OnShipLandedMiscEvents_Postfix() { try { if (Plugin.IsServerOrHost) { LevelInfestations.SpawnRatsForLevel(); } } catch (Exception ex) { ManualLogSource? logger = Plugin.logger; if (logger != null) { logger.LogError((object)ex); } } } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "SaveGameValues")] public static void GameNetworkManager_SaveGameValues_Postfix() { try { if (Plugin.IsServerOrHost) { LevelInfestations.SaveData(); } } catch (Exception ex) { ManualLogSource? logger = Plugin.logger; if (logger != null) { logger.LogError((object)ex); } } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Start")] public static void StartOfRound_Start_Postfix() { try { if (Plugin.IsServerOrHost) { LevelInfestations.SaveData(); } } catch (Exception ex) { ManualLogSource? logger = Plugin.logger; if (logger != null) { logger.LogError((object)ex); } } } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "ResetSavedGameValues")] public static void GameNetworkManager_ResetSavedGameValues_Postfix() { try { if (Plugin.IsServerOrHost) { LevelInfestations.ResetData(); } } catch (Exception ex) { ManualLogSource? logger = Plugin.logger; if (logger != null) { logger.LogError((object)ex); } } } } [BepInPlugin("Snowlance.Rats", "Rats", "1.4.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("Snowlance.Rats"); public static Plugin Instance { get; private set; } public static ManualLogSource? logger { get; private set; } public static DuskMod Mod { get; private set; } public static PlayerControllerB localPlayer => GameNetworkManager.Instance.localPlayerController; public static bool IsServerOrHost => NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost; public static PlayerControllerB PlayerFromId(ulong id) { return StartOfRound.Instance.allPlayerScripts[StartOfRound.Instance.ClientPlayerList[id]]; } public void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } logger = (Utils.testing ? ((BaseUnityPlugin)Instance).Logger : null); harmony.PatchAll(); AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "rats_mainassets")); Mod = DuskMod.RegisterMod((BaseUnityPlugin)(object)this, val); Mod.RegisterContentHandlers(); Configs.Init(); InitializeNetworkBehaviours(); ManualLogSource? obj = logger; if (obj != null) { obj.LogInfo((object)"Snowlance.Rats v1.4.0 has loaded!"); } } public 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); } } } ManualLogSource? obj = logger; if (obj != null) { obj.LogDebug((object)"Finished initializing network behaviours"); } } } public class RatNest : NetworkBehaviour { [CompilerGenerated] private sealed class <g__SpawnRatsCoroutine|41_0>d : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public int amount; public RatNest <>4__this; private int 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <g__SpawnRatsCoroutine|41_0>d(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; 5__1 = 0; break; case 2: <>1__state = -1; <>4__this.SpawnRat(); 5__1++; break; } if (5__1 < amount) { <>2__current = null; <>1__state = 2; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public GameObject ratPrefab = null; public GameObject jermaRatPrefab = null; public GameObject meshObj = null; public ScanNodeProperties scanNode = null; public MeshRenderer voidPlaneRenderer = null; public GameObject poisonLiquidPlaneObj = null; public Material yellowMat = null; public ParticleSystem gasParticleSystem = null; public Animator animator = null; public AudioSource audioSource = null; public static AutoDictionary enemyHitCount = new AutoDictionary((Func)((EnemyAI enemy) => Configs.cfgEnemyHitsToDoDamage)); public static AutoDictionary playerThreatCounter = new AutoDictionary((Func)((PlayerControllerB player) => 0)); public static AutoDictionary enemyThreatCounter = new AutoDictionary((Func)((EnemyAI enemy) => 0)); public static AutoDictionary enemyFoodPointsLeft = new AutoDictionary((Func)((EnemyAI enemy) => enemy.enemyType.enemyPrefab.GetComponent().enemyHP * Configs.cfgEnemyFoodPerHPPoint)); public bool isOpen = true; private float timeSinceSpawnRat; private float nextRatSpawnTime; private int food; public float poisonInNest; private Vector3 poisonPlaneStart; private Vector3 poisonPlaneEnd; private const float poisonUpOffset = 0.0219f; private int batchIndex = 0; public HashSet DefenseRats = new HashSet(); public static RatNest? mainInstance => nests.FirstOrDefault(); public bool isMainInstance => (Object)(object)mainInstance != (Object)null && (Object)(object)mainInstance == (Object)(object)this; public static HashSet nests { get; private set; } = new HashSet(); public static List nestsOpen => nests.Where((RatNest x) => x.isOpen).ToList(); public void Start() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) ManualLogSource? logger = Plugin.logger; if (logger != null) { Vector3 position = ((Component)this).transform.position; logger.LogDebug((object)("Rat nest spawned at: " + ((object)(Vector3)(ref position)).ToString())); } poisonPlaneStart = poisonLiquidPlaneObj.transform.position; poisonPlaneEnd = poisonPlaneStart + Vector3.up * 0.0219f; nextRatSpawnTime = Configs.cfgRatSpawnTime.GetRandomInRange(Utils.randomLocal); } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); nests.Add(this); } public override void OnNetworkDespawn() { if (nests.Count <= 1) { LevelInfestations.UpdateLevelInfestation(); if (((NetworkBehaviour)this).IsServer) { foreach (RatAI item in RatAI.Instances.ToList()) { if (item != null) { NetworkObject networkObject = ((NetworkBehaviour)item).NetworkObject; if (networkObject != null) { networkObject.Despawn(true); } } } } ((Dictionary)(object)enemyHitCount).Clear(); ((Dictionary)(object)playerThreatCounter).Clear(); ((Dictionary)(object)enemyThreatCounter).Clear(); ((Dictionary)(object)enemyFoodPointsLeft).Clear(); } nests.Remove(this); ((NetworkBehaviour)this).OnNetworkDespawn(); } public void Update() { timeSinceSpawnRat += Time.unscaledDeltaTime; if (!((NetworkBehaviour)this).IsServer) { return; } if (isOpen) { if (RatAI.Instances.Count < Configs.cfgMaxRats && timeSinceSpawnRat > nextRatSpawnTime) { timeSinceSpawnRat = 0f; nextRatSpawnTime = Configs.cfgRatSpawnTime.GetRandomInRange(Utils.randomLocal); SpawnRat(); } if (poisonInNest >= Configs.cfgPoisonToCloseNest) { isOpen = false; CloseNestClientRpc(); if (nestsOpen.Count > 1) { } } } if (isMainInstance && Time.frameCount % Mathf.CeilToInt(Configs.cfgBatchUpdateInterval / Time.deltaTime) == 0) { RunBatch(); } } private void RunBatch() { List list = RatAI.Instances.Where((RatAI x) => !x.isDead).ToList(); int count = list.Count; if (count == 0) { return; } int num = Mathf.Max(1, count / Mathf.CeilToInt(1f / Configs.cfgBatchUpdateInterval)); for (int i = 0; i < num; i++) { RatAI ratAI = list[batchIndex]; if ((Object)(object)ratAI != (Object)null) { ratAI.DoAIInterval(); } batchIndex++; if (batchIndex >= count) { batchIndex = 0; } } } public void AddFood(int amount = 1) { if (((NetworkBehaviour)this).IsServer) { food += amount; int amount2 = food / Configs.cfgFoodToSpawnRat; int num = food % Configs.cfgFoodToSpawnRat; food = num; SpawnRats(amount2); } } private void SpawnRat() { //IL_0089: 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_0096: 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_00a5: 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) if ((Utils.testing || (!StartOfRound.Instance.inShipPhase && !StartOfRound.Instance.shipIsLeaving)) && RatAI.Instances.Where((RatAI x) => !x.isDead).Count() < Configs.cfgMaxRats) { GameObject val = (Configs.cfgUseJermaRats ? jermaRatPrefab : ratPrefab); Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(((Component)this).transform.position, default(NavMeshHit), 5f, -1); GameObject val2 = Object.Instantiate(val, navMeshPosition, Quaternion.identity); val2.GetComponent().Spawn(false); } } public void SpawnRats(int amount) { if (amount != 0) { ManualLogSource? logger = Plugin.logger; if (logger != null) { logger.LogDebug((object)("Spawning rats from food: " + amount)); } ((MonoBehaviour)this).StartCoroutine(SpawnRatsCoroutine(amount)); } [IteratorStateMachine(typeof(<g__SpawnRatsCoroutine|41_0>d))] IEnumerator SpawnRatsCoroutine(int amount) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <g__SpawnRatsCoroutine|41_0>d(0) { <>4__this = this, amount = amount }; } } public static RatNest? GetClosestNestToPosition(Vector3 position, bool checkForPath = false) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_0073: Unknown result type (might be due to invalid IL or missing references) float num = float.PositiveInfinity; RatNest result = null; foreach (RatNest nest in nests) { if (!((Object)(object)nest == (Object)null) && nest.isOpen) { Vector3 val = position - ((Component)nest).transform.position; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (!(sqrMagnitude >= num) && (!checkForPath || Utils.CanPathToPoint(position, ((Component)nest).transform.position))) { num = sqrMagnitude; result = nest; } } } return result; } public void OnNestClosed() { if (((NetworkBehaviour)this).IsServer) { ((NetworkBehaviour)this).NetworkObject.Despawn(true); } } [ServerRpc(RequireOwnership = false)] public void AddPoisonServerRpc(float amount) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3899135728u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref amount, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3899135728u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkBehaviour)this).IsServer) { AddPoisonClientRpc(amount); } } } [ClientRpc] private void AddPoisonClientRpc(float amount) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(493184450u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref amount, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 493184450u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; ((Renderer)voidPlaneRenderer).material = yellowMat; poisonInNest = Mathf.Min(poisonInNest + amount, Configs.cfgPoisonToCloseNest); float num = Mathf.Clamp01(poisonInNest / Configs.cfgPoisonToCloseNest); poisonLiquidPlaneObj.transform.position = Vector3.Lerp(poisonPlaneStart, poisonPlaneEnd, num); } } } [ClientRpc] public void CloseNestClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3776607502u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3776607502u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; isOpen = false; gasParticleSystem.Play(); animator.SetTrigger("destroy"); ((Component)scanNode).gameObject.SetActive(false); audioSource.Play(); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3899135728u, new RpcReceiveHandler(__rpc_handler_3899135728), "AddPoisonServerRpc"); ((NetworkBehaviour)this).__registerRpc(493184450u, new RpcReceiveHandler(__rpc_handler_493184450), "AddPoisonClientRpc"); ((NetworkBehaviour)this).__registerRpc(3776607502u, new RpcReceiveHandler(__rpc_handler_3776607502), "CloseNestClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_3899135728(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float amount = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref amount, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((RatNest)(object)target).AddPoisonServerRpc(amount); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_493184450(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float amount = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref amount, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((RatNest)(object)target).AddPoisonClientRpc(amount); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3776607502(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; ((RatNest)(object)target).CloseNestClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "RatNest"; } } public class RatsContentHandler : ContentHandler { public class RatNestAssets : AssetBundleLoader { public RatNestAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class GlueTrapAssets : AssetBundleLoader { public GlueTrapAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class BoxOfSnapTrapsAssets : AssetBundleLoader { public BoxOfSnapTrapsAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class RatPoisonAssets : AssetBundleLoader { public RatPoisonAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public RatNestAssets? RatNest; public GlueTrapAssets? GlueTrap; public BoxOfSnapTrapsAssets? BoxOfSnapTraps; public RatPoisonAssets? RatPoison; public RatsContentHandler(DuskMod mod) : base(mod) { ((ContentHandler)this).RegisterContent("rat_nest", ref RatNest, false); ((ContentHandler)this).RegisterContent("glue_trap", ref GlueTrap, false); ((ContentHandler)this).RegisterContent("box_of_snap_traps", ref BoxOfSnapTraps, false); ((ContentHandler)this).RegisterContent("rat_poison", ref RatPoison, false); } } public static class RatsKeys { public static readonly NamespacedKey GlueBoard = NamespacedKey.From("rats", "glue_board"); public static readonly NamespacedKey GlueTrap = NamespacedKey.From("rats", "glue_trap"); public static readonly NamespacedKey RatPoison = NamespacedKey.From("rats", "rat_poison"); public static readonly NamespacedKey BoxOfSnapTraps = NamespacedKey.From("rats", "box_of_snap_traps"); public static readonly NamespacedKey RatNest = NamespacedKey.From("rats", "rat_nest"); } [HarmonyPatch] public class TESTING : MonoBehaviour { [HarmonyPostfix] [HarmonyPatch(typeof(HUDManager), "PingScan_performed")] public static void PingScan_performedPostFix() { try { if (Utils.testing) { } } catch { } } [HarmonyPrefix] [HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")] public static void SubmitChat_performedPrefix(HUDManager __instance) { try { if (Utils.testing) { string text = __instance.chatTextField.text; string[] array = text.Split(" "); string text2 = array[0]; string text3 = text2; Utils.ChatCommand(array); } } catch { } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Snowlance.Rats"; public const string PLUGIN_NAME = "Rats"; public const string PLUGIN_VERSION = "1.4.0"; } } namespace Rats.Items { internal class BoxOfSnapTrapsBehavior : PhysicsProp { public GameObject snapTrapPrefab = null; public ScanNodeProperties scanNode = null; private int snapTrapAmount; public void Awake() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).itemProperties.floorYOffset = 0; ((GrabbableObject)this).itemProperties.rotationOffset = new Vector3(0f, 0f, 0f); ((GrabbableObject)this).itemProperties.positionOffset = new Vector3(0f, 0f, 0f); ((GrabbableObject)this).itemProperties.meshOffset = true; } public override void Start() { ((GrabbableObject)this).Start(); scanNode.subText = ""; snapTrapAmount = Configs.cfgSnapTrapAmount; } public override void SetControlTipsForItem() { if (!((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)(object)Plugin.localPlayer)) { string[] toolTips = ((GrabbableObject)this).itemProperties.toolTips; toolTips[0] = $"Drop Snap Trap [LMB] ({snapTrapAmount} left)"; HUDManager.Instance.ChangeControlTipMultiple(toolTips, true, ((GrabbableObject)this).itemProperties); } } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (buttonDown && snapTrapAmount > 0) { SpawnRatTrapServerRpc(); } } public override void GrabItem() { ((GrabbableObject)this).GrabItem(); ((GrabbableObject)this).SetControlTipsForItem(); } public override int GetItemDataToSave() { return snapTrapAmount; } public override void LoadItemSaveData(int saveData) { snapTrapAmount = saveData; } [ServerRpc(RequireOwnership = false)] public void SpawnRatTrapServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4206628366u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4206628366u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkBehaviour)this).IsServer) { SpawnRatTrapClientRpc(); } } } [ClientRpc] public void SpawnRatTrapClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(824490576u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 824490576u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(((Component)this).transform.position, -Vector3.up, ref val3, 80f, 268437761, (QueryTriggerInteraction)1)) { Object.Instantiate(snapTrapPrefab, ((RaycastHit)(ref val3)).point, ((Component)((GrabbableObject)this).playerHeldBy).transform.rotation); snapTrapAmount--; ((GrabbableObject)this).SetControlTipsForItem(); } } } protected override void __initializeVariables() { ((PhysicsProp)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(4206628366u, new RpcReceiveHandler(__rpc_handler_4206628366), "SpawnRatTrapServerRpc"); ((NetworkBehaviour)this).__registerRpc(824490576u, new RpcReceiveHandler(__rpc_handler_824490576), "SpawnRatTrapClientRpc"); ((PhysicsProp)this).__initializeRpcs(); } private static void __rpc_handler_4206628366(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; ((BoxOfSnapTrapsBehavior)(object)target).SpawnRatTrapServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_824490576(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; ((BoxOfSnapTrapsBehavior)(object)target).SpawnRatTrapClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "BoxOfSnapTrapsBehavior"; } } internal class SnapTrapBehavior : MonoBehaviour { public AudioSource ItemAudio = null; public AudioClip[] SetSFX = null; public AudioClip[] SnapSFX = null; public Animator ItemAnimator = null; public GameObject TriggerMesh = null; public GameObject RatMesh = null; public GameObject JermaRatMesh = null; public Rigidbody rb = null; public Transform LaunchDirection = null; public BoxCollider collider = null; private bool triggered; private Quaternion ratRotationOffset; private Vector3 ratPositionOffset; private float minLaunchForce = 10f; private float maxLaunchForce = 15f; public void Start() { RoundManager.PlayRandomClip(ItemAudio, SetSFX, true, 1f, 0, 1000); } public void OnTriggerEnter(Collider other) { //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) if (triggered) { return; } ManualLogSource? logger = Plugin.logger; if (logger != null) { logger.LogDebug((object)"In OnTriggerEnter()"); } RatAICollisionDetect ratAICollisionDetect = default(RatAICollisionDetect); if (((Component)other).gameObject.TryGetComponent(ref ratAICollisionDetect)) { ManualLogSource? logger2 = Plugin.logger; if (logger2 != null) { logger2.LogDebug((object)"Got rat collision"); } ratAICollisionDetect.mainScript.KillEnemy(); if (Plugin.IsServerOrHost) { ((NetworkBehaviour)ratAICollisionDetect.mainScript).NetworkObject.Despawn(false); } Object.Destroy((Object)(object)((Component)ratAICollisionDetect.mainScript).gameObject); ItemAnimator.SetTrigger("trigger"); RoundManager.PlayRandomClip(ItemAudio, SnapSFX, true, 1f, 0, 1000); TriggerMesh.SetActive(false); if (Configs.cfgUseJermaRats) { JermaRatMesh.SetActive(true); } else { RatMesh.SetActive(true); } ((Collider)collider).isTrigger = false; ((Collider)collider).providesContacts = true; rb.isKinematic = false; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(Random.Range(0f, 5f), 0f, Random.Range(-3f, -10f)); rb.AddForce(LaunchDirection.forward * Random.Range(minLaunchForce, maxLaunchForce), (ForceMode)1); rb.AddTorque(val, (ForceMode)1); rb.useGravity = true; triggered = true; Object.Destroy((Object)(object)((Component)this).gameObject, Configs.cfgDespawnTime); } } } internal class GlueTrapBehavior : PhysicsProp { public GameObject glueBoardPrefab = null; public ScanNodeProperties scanNode = null; private int glueTrapAmount; public void Awake() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_004a: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).itemProperties.floorYOffset = 180; ((GrabbableObject)this).itemProperties.rotationOffset = new Vector3(180f, 0f, 0f); ((GrabbableObject)this).itemProperties.positionOffset = new Vector3(0.2f, 0.2f, -0.25f); ((GrabbableObject)this).itemProperties.meshOffset = true; } public override void Start() { ((GrabbableObject)this).Start(); scanNode.subText = ""; glueTrapAmount = Configs.cfgGlueBoardAmount; } public override void SetControlTipsForItem() { if (!((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)(object)Plugin.localPlayer)) { string[] toolTips = ((GrabbableObject)this).itemProperties.toolTips; toolTips[0] = $"Drop Glue Trap [LMB] ({glueTrapAmount} left)"; HUDManager.Instance.ChangeControlTipMultiple(toolTips, true, ((GrabbableObject)this).itemProperties); } } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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) ((GrabbableObject)this).ItemActivate(used, buttonDown); RaycastHit val = default(RaycastHit); if (buttonDown && glueTrapAmount > 0 && Physics.Raycast(((Component)this).transform.position, -Vector3.up, ref val, 80f, 268437761, (QueryTriggerInteraction)1)) { SpawnGlueBoardServerRpc(((RaycastHit)(ref val)).point, ((Component)((GrabbableObject)this).playerHeldBy).transform.rotation); } } public override void GrabItem() { ((GrabbableObject)this).GrabItem(); ((GrabbableObject)this).SetControlTipsForItem(); } public override int GetItemDataToSave() { return glueTrapAmount; } public override void LoadItemSaveData(int saveData) { glueTrapAmount = saveData; } [ServerRpc(RequireOwnership = false)] public void SpawnGlueBoardServerRpc(Vector3 position, Quaternion rotation) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3740524913u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref rotation); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3740524913u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkBehaviour)this).IsServer) { GameObject val3 = Object.Instantiate(glueBoardPrefab, position, rotation); val3.GetComponent().Spawn(true); SpawnGlueBoardClientRpc(); } } } [ClientRpc] public void SpawnGlueBoardClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(192576605u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 192576605u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; glueTrapAmount--; ((GrabbableObject)this).SetControlTipsForItem(); } } } protected override void __initializeVariables() { ((PhysicsProp)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3740524913u, new RpcReceiveHandler(__rpc_handler_3740524913), "SpawnGlueBoardServerRpc"); ((NetworkBehaviour)this).__registerRpc(192576605u, new RpcReceiveHandler(__rpc_handler_192576605), "SpawnGlueBoardClientRpc"); ((PhysicsProp)this).__initializeRpcs(); } private static void __rpc_handler_3740524913(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); Quaternion rotation = default(Quaternion); ((FastBufferReader)(ref reader)).ReadValueSafe(ref rotation); target.__rpc_exec_stage = (__RpcExecStage)1; ((GlueTrapBehavior)(object)target).SpawnGlueBoardServerRpc(position, rotation); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_192576605(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; ((GlueTrapBehavior)(object)target).SpawnGlueBoardClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "GlueTrapBehavior"; } } internal class GlueBoardBehavior : PhysicsProp { [CompilerGenerated] private sealed class d__9 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public RatAI rat; public float delay; public GlueBoardBehavior <>4__this; private float 5__1; private float 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown ManualLogSource? logger2; switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)rat == (Object)null) { return false; } 5__1 = 0f; 5__2 = 0.5f; goto IL_00d7; case 2: <>1__state = -1; goto IL_00d7; case 3: { <>1__state = -1; ManualLogSource? logger = Plugin.logger; if (logger != null) { logger.LogDebug((object)"Calling AddRatToBoardClientRpc"); } <>4__this.AddRatToBoardClientRpc(((Component)rat).transform.position, ((Component)rat).transform.rotation); ((NetworkBehaviour)rat).NetworkObject.Despawn(true); return false; } IL_00d7: if (5__1 < delay) { rat.nav.agent.speed = Mathf.Lerp(5__2, 0f, 5__1 / delay); 5__1 += Time.deltaTime; <>2__current = null; <>1__state = 2; return true; } logger2 = Plugin.logger; if (logger2 != null) { logger2.LogDebug((object)"Finished slowing, calling rpc now"); } rat.KillEnemyServerRpc(); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 3; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public BoxCollider GlueCollider = null; public GameObject RatProp = null; public GameObject RatPropJerma = null; public ScanNodeProperties ScanNode = null; private List ratsOnBoard = new List(); private const float slowTime = 1f; public void Awake() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).itemProperties.floorYOffset = 0; ((GrabbableObject)this).itemProperties.rotationOffset = new Vector3(0f, 0f, 0f); ((GrabbableObject)this).itemProperties.positionOffset = new Vector3(-0.5f, 0.1f, 0f); ((GrabbableObject)this).itemProperties.meshOffset = true; } public override void Start() { ((GrabbableObject)this).Start(); GrabbableObjectPhysicsTrigger val = ((Component)GlueCollider).gameObject.AddComponent(); val.itemScript = (GrabbableObject)(object)this; } public override void ActivatePhysicsTrigger(Collider other) { ((GrabbableObject)this).ActivatePhysicsTrigger(other); ManualLogSource? logger = Plugin.logger; if (logger != null) { logger.LogDebug((object)"In ActivatePhysicsTrigger()"); } RatAICollisionDetect ratAICollisionDetect = default(RatAICollisionDetect); if (ratsOnBoard.Count < Configs.cfgMaxRatsOnGlueBoard && Plugin.IsServerOrHost && ((Component)other).gameObject.TryGetComponent(ref ratAICollisionDetect)) { ((MonoBehaviour)this).StartCoroutine(KillRatCoroutine(ratAICollisionDetect.mainScript, 1f)); } } [IteratorStateMachine(typeof(d__9))] private IEnumerator KillRatCoroutine(RatAI rat, float delay) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__9(0) { <>4__this = this, rat = rat, delay = delay }; } public override int GetItemDataToSave() { return ratsOnBoard.Count; } public override void LoadItemSaveData(int saveData) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).scrapValue = 0; if (Plugin.IsServerOrHost) { for (int i = 0; i < saveData; i++) { Vector3 randomPositionOnBoard = GetRandomPositionOnBoard(); Quaternion rot = Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f); AddRatToBoardClientRpc(randomPositionOnBoard, rot); } } } private Vector3 GetRandomPositionOnBoard() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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) Vector3 position = ((Component)this).transform.position; float num = 0.3f; float num2 = 0.2f; float num3 = Random.Range((0f - num) / 2f, num / 2f); float num4 = Random.Range((0f - num2) / 2f, num2 / 2f); return position + new Vector3(num3, 0.01f, num4); } [ClientRpc] public void AddRatToBoardClientRpc(Vector3 pos, Quaternion rot) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_010e: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1841741070u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref pos); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref rot); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1841741070u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ManualLogSource? logger = Plugin.logger; if (logger != null) { logger.LogDebug((object)"In ParentRatToBoardClientRpc()"); } GameObject val3 = (Configs.cfgUseJermaRats ? RatPropJerma : RatProp); GameObject val4 = Object.Instantiate(val3, pos, rot); ManualLogSource? logger2 = Plugin.logger; if (logger2 != null) { logger2.LogDebug((object)"Parenting rat to board"); } val4.transform.SetParent(((Component)this).transform); ratsOnBoard.Add(val4); ((GrabbableObject)this).SetScrapValue(ratsOnBoard.Count * Configs.cfgScrapValuePerRat); } } protected override void __initializeVariables() { ((PhysicsProp)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(1841741070u, new RpcReceiveHandler(__rpc_handler_1841741070), "AddRatToBoardClientRpc"); ((PhysicsProp)this).__initializeRpcs(); } private static void __rpc_handler_1841741070(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 pos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref pos); Quaternion rot = default(Quaternion); ((FastBufferReader)(ref reader)).ReadValueSafe(ref rot); target.__rpc_exec_stage = (__RpcExecStage)1; ((GlueBoardBehavior)(object)target).AddRatToBoardClientRpc(pos, rot); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "GlueBoardBehavior"; } } internal class RatPoisonBehavior : PhysicsProp { public AudioSource audioSource = null; public ParticleSystem particleSystem = null; public Animator animator = null; public Transform pourDirection = null; public ScanNodeProperties scanNode = null; public PlayerControllerB? lastPlayerHeldBy; private readonly float downAngle = 0.7f; private bool pouring; private float currentFluid; private float pourRate; public void Awake() { //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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).itemProperties.floorYOffset = 90; ((GrabbableObject)this).itemProperties.rotationOffset = new Vector3(180f, 180f, 60f); ((GrabbableObject)this).itemProperties.positionOffset = new Vector3(-0.65f, 0.55f, 0f); ((GrabbableObject)this).itemProperties.restingRotation = new Vector3(0f, 0f, 0f); ((GrabbableObject)this).itemProperties.syncUseFunction = true; ((GrabbableObject)this).itemProperties.weight = 1.2f; } public override void Start() { ((GrabbableObject)this).Start(); scanNode.subText = ""; currentFluid = Configs.cfgMaxFluid; pourRate = Configs.cfgPourRate; } public override void Update() { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null) { lastPlayerHeldBy = ((GrabbableObject)this).playerHeldBy; } if (pouring) { currentFluid -= pourRate * Time.deltaTime; ((GrabbableObject)this).SetControlTipsForItem(); RaycastHit val = default(RaycastHit); RatNest ratNest = default(RatNest); if (currentFluid <= 0f) { SetPouring(_pouring: false); currentFluid = 0f; } else if (!isPlayerLookingDown()) { SetPouring(_pouring: false); } else if (!((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null) && !((Object)(object)Plugin.localPlayer != (Object)(object)((GrabbableObject)this).playerHeldBy) && Physics.Raycast(pourDirection.position, -Vector3.up, ref val, 80f) && ((Component)((RaycastHit)(ref val)).collider).gameObject.TryGetComponent(ref ratNest) && ratNest.poisonInNest < Configs.cfgPoisonToCloseNest) { ratNest.AddPoisonServerRpc(pourRate * Time.deltaTime); } } } public override void SetControlTipsForItem() { if (!((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null) && !((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)(object)Plugin.localPlayer)) { string[] toolTips = ((GrabbableObject)this).itemProperties.toolTips; toolTips[0] = "Pour [LMB] (" + currentFluid.ToString("F1") + "L left)"; HUDManager.Instance.ChangeControlTipMultiple(toolTips, true, ((GrabbableObject)this).itemProperties); } } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); bool flag = isPlayerLookingDown(); bool flag2 = buttonDown && flag && currentFluid > 0f; SetPouring(flag2); } private bool isPlayerLookingDown() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) return Vector3.Dot(((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.forward, Vector3.down) > downAngle; } private void SetPouring(bool _pouring) { if (!((Object)(object)lastPlayerHeldBy == (Object)null)) { pouring = _pouring; lastPlayerHeldBy.activatingItem = pouring; animator.SetBool("pour", pouring); if (pouring) { particleSystem.Play(); audioSource.Play(); } else { particleSystem.Stop(); audioSource.Stop(); } } } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); SetPouring(_pouring: false); } public override void GrabItem() { ((GrabbableObject)this).GrabItem(); ((GrabbableObject)this).SetControlTipsForItem(); } public override int GetItemDataToSave() { return (int)currentFluid; } public override void LoadItemSaveData(int saveData) { currentFluid = saveData; } protected override void __initializeVariables() { ((PhysicsProp)this).__initializeVariables(); } protected override void __initializeRpcs() { ((PhysicsProp)this).__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "RatPoisonBehavior"; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace Snowlance.Rats.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }