Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of DuckMod v1.6.0
plugins/DuckMod/DuckMod.dll
Decompiled a year ago
The result has been truncated due to the large size, download it to view full contents!
using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using DuckMod.Behaviors; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; using UnityEngine.Rendering.HighDefinition; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("DuckMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DuckMod")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("63ea62a8-9147-4f70-b5bf-9933a39b3e9b")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace DuckMod { [BepInPlugin("Dio93.DuckMod", "DuckMod", "1.6.0.0")] public class DuckMod : BaseUnityPlugin { private const string modGUID = "Dio93.DuckMod"; private const string modName = "DuckMod"; private const string modVersion = "1.6.0.0"; private readonly Harmony harmony = new Harmony("Dio93.DuckMod"); private static DuckMod instance; internal ManualLogSource mls; private ConfigEntry<bool> configDebug; private ConfigEntry<int> configMaxDucks; private ConfigEntry<int> configCarryAmount; private ConfigEntry<bool> configCanGrabTwoHanded; private ConfigEntry<bool> configCanGrabPlayer; private ConfigEntry<bool> configCanGrabHive; private ConfigEntry<bool> configCanUseItem; private ConfigEntry<int> configDuckPrice; private ConfigEntry<float> configSpeed; private ConfigEntry<bool> configHittable; private ConfigEntry<int> configHp; private ConfigEntry<bool> configUseFireExits; private ConfigEntry<bool> configCanOpenDoors; private ConfigEntry<float> configTextureWhite; private ConfigEntry<float> configTextureGreen; private ConfigEntry<float> configTextureGold; private void Awake() { if ((Object)(object)instance == (Object)null) { instance = this; } configDebug = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Debugging", false, "Enable logging in Console?"); configMaxDucks = ((BaseUnityPlugin)this).Config.Bind<int>("Duck", "Max Duck Count", -1, "Maximal number of ducks. -1 = infinite"); configDuckPrice = ((BaseUnityPlugin)this).Config.Bind<int>("Duck", "Duck Price", 25, "Price of a duck"); configCarryAmount = ((BaseUnityPlugin)this).Config.Bind<int>("Duck.Items", "Carry Amount", 1, "The amount of items the duck can carry"); configCanGrabPlayer = ((BaseUnityPlugin)this).Config.Bind<bool>("Duck.Items", "Can grab players", true, "Can the duck grab dead players?"); configCanGrabTwoHanded = ((BaseUnityPlugin)this).Config.Bind<bool>("Duck.Items", "Can grab two handed", true, "Can the duck grab two handed items?"); configCanGrabHive = ((BaseUnityPlugin)this).Config.Bind<bool>("Duck.Items", "Can grab hive", false, "Can the duck grab hives?"); configCanUseItem = ((BaseUnityPlugin)this).Config.Bind<bool>("Duck.Items", "Can use item", false, "Can the duck use items?"); configUseFireExits = ((BaseUnityPlugin)this).Config.Bind<bool>("Duck", "Use fire exits", true, "Can the duck use fire exits?"); configCanOpenDoors = ((BaseUnityPlugin)this).Config.Bind<bool>("Duck", "Can open doors", true, "Can ducks open doors?"); configSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Duck", "Speed", 0.8f, "The speed of the duck proportional to the player"); configHittable = ((BaseUnityPlugin)this).Config.Bind<bool>("Duck", "Hittable", false, "Is the duck hittable"); configHp = ((BaseUnityPlugin)this).Config.Bind<int>("Duck", "Hp", 10, "Health points of the duck"); configTextureWhite = ((BaseUnityPlugin)this).Config.Bind<float>("Duck.Textures", "White Texture", 0.5f, "Probability of white texture"); configTextureGreen = ((BaseUnityPlugin)this).Config.Bind<float>("Duck.Textures", "Green Texture", 0.5f, "Probability of green texture"); configTextureGold = ((BaseUnityPlugin)this).Config.Bind<float>("Duck.Textures", "Gold Texture", 0.01f, "Probability of gold texture"); mls = Logger.CreateLogSource("Dio93.DuckMod"); mls.LogInfo((object)"Start DuckMod 1.6.0.0"); PetAI.mls = (configDebug.Value ? mls : null); DeadDuckBehavior.InitializeRPCS_DeadDuckBehavior(); PetDuckAI.InitializeRPCS_PetDuckAI(); PetAI.InitializeRPCS_PetAI(); PetAI.maxPets = configMaxDucks.Value; int value = configDuckPrice.Value; string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text = Path.Combine(directoryName, "duckmod"); AssetBundle val = AssetBundle.LoadFromFile(text); Item val2 = val.LoadAsset<Item>("Assets/Items/PetDuck/DeadDuckItem.asset"); GameObject spawnPrefab = val2.spawnPrefab; val2.spawnPrefab.AddComponent<DeadDuckBehavior>(); PetDuckAI.deadDuckItem = val2; Material item = val.LoadAsset<Material>("Assets/Items/PetDuck/DuckShader White.mat"); Material item2 = val.LoadAsset<Material>("Assets/Items/PetDuck/DuckShader Green.mat"); Material item3 = val.LoadAsset<Material>("Assets/Items/PetDuck/DuckShader Gold.mat"); PetDuckAI.materials.Add((configTextureGold.Value, item3)); PetDuckAI.materials.Add((configTextureGreen.Value, item2)); PetDuckAI.materials.Add((configTextureWhite.Value, item)); PetAI.canGrabPlayers = configCanGrabPlayer.Value; PetAI.canGrabTwoHanded = configCanGrabTwoHanded.Value; PetAI.canGrabHive = configCanGrabHive.Value; PetAI.canUseItem = configCanUseItem.Value; PetAI.useFireExits = configUseFireExits.Value; PetAI.canOpenDoors = configCanOpenDoors.Value; Item val3 = val.LoadAsset<Item>("Assets/Items/PetDuck/PetDuckItem.asset"); PetDuckAI petDuckAI = val3.spawnPrefab.AddComponent<PetDuckAI>(); petDuckAI.itemCapacity = configCarryAmount.Value; petDuckAI.speedFactor = configSpeed.Value; petDuckAI.hittable = configHittable.Value; petDuckAI.maxHp = configHp.Value; petDuckAI.SetScrapValue((float)value / 2f); Item val4 = val.LoadAsset<Item>("Assets/Items/PetDuck/PetDuckHatItem.asset"); PetDuckAI petDuckAI2 = val4.spawnPrefab.AddComponent<PetDuckAI>(); petDuckAI2.itemCapacity = configCarryAmount.Value; petDuckAI2.speedFactor = configSpeed.Value; petDuckAI2.hittable = configHittable.Value; petDuckAI2.maxHp = configHp.Value; petDuckAI2.SetScrapValue((float)value / 2f); Item val5 = val.LoadAsset<Item>("Assets/Items/PetDuck/DuckEgg.asset"); DuckEggBehavior.petDuckPrefab = val3.spawnPrefab; val5.spawnPrefab.AddComponent<DuckEggBehavior>(); NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); Utilities.FixMixerGroups(val2.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab); Utilities.FixMixerGroups(val3.spawnPrefab); TerminalNode val6 = ScriptableObject.CreateInstance<TerminalNode>(); val6.clearPreviousText = true; val6.displayText = "You have requested to order mighty pet ducks. Amount: [variableAmount].\nTotal cost of items: [totalCost]\n\nPlease CONFIRM or DENY.\n\n"; Items.RegisterShopItem(val3, val6, (TerminalNode)null, (TerminalNode)null, value); NetworkPrefabs.RegisterNetworkPrefab(val4.spawnPrefab); Utilities.FixMixerGroups(val4.spawnPrefab); TerminalNode val7 = ScriptableObject.CreateInstance<TerminalNode>(); val7.clearPreviousText = true; val7.displayText = "You have requested to order gentle ducks with hats. Amount: [variableAmount].\nTotal cost of items: [totalCost]\n\nPlease CONFIRM or DENY.\n\n"; Items.RegisterShopItem(val4, val7, (TerminalNode)null, (TerminalNode)null, value); harmony.PatchAll(typeof(DuckMod)); } } } namespace DuckMod.Behaviors { internal class DeadDuckBehavior : NetworkBehaviour { private struct Data : INetworkSerializeByMemcpy { public Vector3 startFallingPos; public Vector3 targetFloorPos; public int shaderID; public Data(Vector3 startFallingPos, Vector3 targetFloorPos, int shaderID) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) this.startFallingPos = startFallingPos; this.targetFloorPos = targetFloorPos; this.shaderID = shaderID; } } public int shaderID; private int currShaderID; public static List<(float, Material)> materials; private SkinnedMeshRenderer[] meshRenderers; private PhysicsProp physicsProp; public void Start() { //IL_0051: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"Dead Duck Start"); physicsProp = ((Component)this).GetComponent<PhysicsProp>(); ((GrabbableObject)physicsProp).scrapValue = 5; Debug.Log((object)("Dead Duck PhysicsProp: " + (object)physicsProp)); Vector3 val = ((GrabbableObject)physicsProp).startFallingPosition; string? text = ((object)(Vector3)(ref val)).ToString(); val = ((GrabbableObject)physicsProp).targetFloorPosition; Debug.Log((object)("DEADDUCK: " + text + ", " + ((object)(Vector3)(ref val)).ToString())); currShaderID = shaderID; if (!((NetworkBehaviour)this).IsOwner) { InitServerRpc(); } } public void Update() { } public void Init(Vector3 startFallingPos, Vector3 targetFloorPos, int shaderID) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_0043: 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_0110: Unknown result type (might be due to invalid IL or missing references) ((Behaviour)physicsProp).enabled = false; ((GrabbableObject)physicsProp).startFallingPosition = startFallingPos; ((GrabbableObject)physicsProp).targetFloorPosition = targetFloorPos; ((Behaviour)physicsProp).enabled = true; Vector3 val = ((GrabbableObject)physicsProp).startFallingPosition; string? text = ((object)(Vector3)(ref val)).ToString(); val = ((GrabbableObject)physicsProp).targetFloorPosition; Debug.Log((object)("DEADDUCK INIT: " + text + ", " + ((object)(Vector3)(ref val)).ToString())); if (materials == null) { materials = PetDuckAI.materials; } meshRenderers = ((Component)this).GetComponentsInChildren<SkinnedMeshRenderer>(); Material item = materials[shaderID].Item2; ((Renderer)meshRenderers[0]).material = item; if (((Object)item).name == "DuckShader Gold") { HDAdditionalLightData val2 = ((Component)this).gameObject.AddComponent<HDAdditionalLightData>(); Light component = ((Component)this).gameObject.GetComponent<Light>(); component.intensity = 100f; component.color = new Color(1f, 0.75f, 0.5f, 1f); } } [ServerRpc(RequireOwnership = false)] public void InitServerRpc() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Invalid comparison between Unknown and I4 //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3079913600u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3079913600u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { InitClientRpc(((GrabbableObject)physicsProp).startFallingPosition, ((GrabbableObject)physicsProp).targetFloorPosition, currShaderID); } } } [ClientRpc] public void InitClientRpc(Vector3 startFallingPos, Vector3 targetFloorPos, int shaderID) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Invalid comparison between Unknown and I4 //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3079913601u, val, (RpcDelivery)0); Data data = new Data(startFallingPos, targetFloorPos, shaderID); ((FastBufferWriter)(ref val2)).WriteValueSafe<Data>(ref data, default(ForStructs)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3079913601u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Init(startFallingPos, targetFloorPos, shaderID); } } } private static void __rpc_handler_3079913600(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0026: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ((NetworkBehaviour)(DeadDuckBehavior)(object)target).__rpc_exec_stage = (__RpcExecStage)1; ((DeadDuckBehavior)(object)target).InitServerRpc(); ((NetworkBehaviour)(DeadDuckBehavior)(object)target).__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3079913601(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_001f: 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_0033: 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) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Data data = default(Data); ((FastBufferReader)(ref reader)).ReadValueSafe<Data>(ref data, default(ForStructs)); ((NetworkBehaviour)(DeadDuckBehavior)(object)target).__rpc_exec_stage = (__RpcExecStage)2; ((DeadDuckBehavior)(object)target).InitClientRpc(data.startFallingPos, data.targetFloorPos, data.shaderID); ((NetworkBehaviour)(DeadDuckBehavior)(object)target).__rpc_exec_stage = (__RpcExecStage)0; } } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_DeadDuckBehavior() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(3079913600u, new RpcReceiveHandler(__rpc_handler_3079913600)); NetworkManager.__rpc_func_table.Add(3079913601u, new RpcReceiveHandler(__rpc_handler_3079913601)); } } internal class DuckEggBehavior : NetworkBehaviour { public static GameObject petDuckPrefab; protected PhysicsProp physicsProp; protected NetworkObject networkObject; private float wait; public void Start() { networkObject = ((Component)this).GetComponent<NetworkObject>(); physicsProp = ((Component)this).GetComponent<PhysicsProp>(); wait = Random.Range(5, 30) * 60; } public void Update() { //IL_0053: 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) if (!((GrabbableObject)physicsProp).isHeld && ((GrabbableObject)physicsProp).isInShipRoom) { wait -= Time.deltaTime; if (wait <= 0f) { GameObject val = Object.Instantiate<GameObject>(petDuckPrefab, ((Component)this).transform.position, ((Component)this).transform.rotation); val.GetComponent<NetworkObject>().Spawn(false); networkObject.Despawn(true); } } } } internal class Teleport { public int id; public Vector3 entrance; public Vector3 exit; public Teleport(int id) { //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) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) this.id = id; entrance = Vector3.zero; exit = Vector3.zero; } } internal abstract class PetAI : NetworkBehaviour, IHittable, INoiseListener { public enum ShipState { None, InSpace, OnMoon } private static PetAI petAI; public static int maxPets; public static int petCount; public static ManualLogSource mls; protected NavMeshAgent agent; protected AudioSource audioQuacking; protected AudioSource audioWalking; protected PhysicsProp physicsProp; protected NetworkObject networkObject; protected Animator animator; protected Transform itemHolder; protected Transform interactPatter; protected InteractTrigger interactTrigger; protected SkinnedMeshRenderer[] meshRenderers; private float scrapValue; public int maxHp = 10; protected int hp; public bool hittable; protected bool isInsideShip; protected bool isInFactory; protected float checkForBoombox = 0f; protected float checkEnemyCooldown = 10f; protected float lastCheckEnemy = -1f; protected ShipState shipState; protected DoorLock[] doors; protected static ItemDropship dropShip; protected float nextItemInteract; protected static float grabbingCooldown = 0f; protected GrabbableObject targetItem; protected static IList<GrabbableObject> grabbableItems = new List<GrabbableObject>(); protected IList<GrabbableObject> grabbedItems = new List<GrabbableObject>(); public int itemCapacity = 1; public static bool canUseItem = false; public static bool canGrabPlayers = true; public static bool canGrabHive = false; public static bool canGrabTwoHanded = false; public static bool canOpenDoors = false; protected static float nextItemCheck = 0f; protected static float nextItemCheckCooldown = 10f; public float speedFactor = 0.8f; private float nextSpeedCheck = 0f; private float nextSpeedCheckCooldown = 30f; protected PlayerControllerB targetPlayer; protected float findTargetPlayerIn = 0f; protected Vector3 destination; protected float minPlayerDist = 4f; protected float maxPlayerDist = float.PositiveInfinity; protected RaycastHit[] hits; protected float sprintMultiplier = 2.25f; protected float speed; protected float curSpeed; private Vector3 serverPosition; private float updatePositionThreshold = 0.01f; private float previousYRotation; private short targetYRotation; private Vector3 tempVelocity = Vector3.zero; private float syncMovementSpeed = 0.1f; private bool freeze = false; public static bool useFireExits; protected List<Teleport> teleports = new List<Teleport>(); private Vector3 nextEntrance; private Vector3 targetEntrance; public virtual void Start() { //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Expected O, but got Unknown //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Expected O, but got Unknown //IL_0214: Unknown result type (might be due to invalid IL or missing references) if (petCount >= maxPets && maxPets > -1) { Object.Destroy((Object)(object)((Component)this).gameObject); } petCount++; meshRenderers = ((Component)((Component)this).transform).GetComponentsInChildren<SkinnedMeshRenderer>(); dropShip = Object.FindObjectOfType<ItemDropship>(); hp = maxHp; agent = ((Component)this).GetComponent<NavMeshAgent>(); networkObject = ((Component)this).GetComponent<NetworkObject>(); AudioSource[] components = ((Component)this).GetComponents<AudioSource>(); foreach (AudioSource val in components) { if (((Object)val.clip).name == "duck_quacking") { Log("Quacking Audio Clip found."); audioQuacking = val; audioQuacking.Play(); } else if (((Object)val.clip).name == "duck_walking") { Log("Walking Audio Clip found."); audioWalking = val; } } audioQuacking = ((Component)this).GetComponent<AudioSource>(); physicsProp = ((Component)this).GetComponent<PhysicsProp>(); ((GrabbableObject)physicsProp).EnablePhysics(false); ((GrabbableObject)physicsProp).isHeld = true; animator = ((Component)this).GetComponentInChildren<Animator>(); itemHolder = ((Component)this).transform.GetChild(1); interactTrigger = ((Component)itemHolder).gameObject.GetComponent<InteractTrigger>(); interactTrigger.onInteract = new InteractEvent(); ((UnityEvent<PlayerControllerB>)(object)interactTrigger.onInteract).AddListener((UnityAction<PlayerControllerB>)Interact); interactPatter = ((Component)this).transform.GetChild(2); InteractTrigger component = ((Component)interactPatter).GetComponent<InteractTrigger>(); component.onInteract = new InteractEvent(); ((UnityEvent<PlayerControllerB>)(object)component.onInteract).AddListener((UnityAction<PlayerControllerB>)InteractPat); if ((Object)(object)itemHolder == (Object)null) { itemHolder = ((Component)this).transform; } else { itemHolder.rotation = Quaternion.Euler(90f, 0f, 0f); } if (((NetworkBehaviour)this).IsOwner) { Init(); SyncPosition(); SyncRotation(); } } public virtual void Update() { //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) Init(); if (((NetworkBehaviour)this).IsOwner) { if (((Behaviour)agent).enabled) { GetNextTeleport(); nextItemCheck -= Time.deltaTime; if (nextItemCheck < 0f) { nextItemCheck = 0f; } if (nextItemCheck <= 0f) { UpdateGrabbableItems(); } if ((Object)(object)targetPlayer != (Object)null) { if (nextSpeedCheck <= 0f) { speed = targetPlayer.movementSpeed * speedFactor; nextSpeedCheck = nextSpeedCheckCooldown; } else { nextSpeedCheck -= Time.deltaTime; if (nextSpeedCheck < 0f) { nextSpeedCheck = 0f; } } } DoAI(); } SyncPosition(); SyncRotation(); Vector3 velocity = agent.velocity; SyncSpeedServerRpc(((Vector3)(ref velocity)).magnitude); } else { Vector3 position = ((Component)this).transform.position; float num = 1f; ((Component)this).transform.position = new Vector3(Mathf.Lerp(position.x, serverPosition.x, num), Mathf.Lerp(position.y, serverPosition.y, num), Mathf.Lerp(position.z, serverPosition.z, num)); Transform transform = ((Component)this).transform; Quaternion rotation = ((Component)this).transform.rotation; float x = ((Quaternion)(ref rotation)).eulerAngles.x; float num2 = targetYRotation; rotation = ((Component)this).transform.rotation; transform.rotation = Quaternion.Euler(x, num2, ((Quaternion)(ref rotation)).eulerAngles.z); } } public void TurnOnRendering() { SkinnedMeshRenderer[] array = meshRenderers; foreach (SkinnedMeshRenderer val in array) { if (((Renderer)val).forceRenderingOff) { ((Renderer)val).forceRenderingOff = false; } } foreach (GrabbableObject grabbedItem in grabbedItems) { MeshRenderer component = ((Component)grabbedItem).GetComponent<MeshRenderer>(); if ((Object)(object)component != (Object)null && ((Renderer)component).forceRenderingOff) { ((Renderer)component).forceRenderingOff = false; } } } public abstract void DoAI(); protected void StartQuacking() { if ((Object)(object)audioQuacking != (Object)null && !audioQuacking.isPlaying) { audioQuacking.Play(); } } protected bool IsInsideShip() { //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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) RaycastHit[] array = Physics.RaycastAll(((Component)this).transform.position, Vector3.down, 0.2f); RaycastHit[] array2 = array; for (int i = 0; i < array2.Length; i++) { RaycastHit val = array2[i]; if (((Object)((RaycastHit)(ref val)).transform).name == "ShipInside") { return true; } } return false; } protected void Init() { switch (shipState) { case ShipState.None: if (StartOfRound.Instance.shipHasLanded) { shipState = ShipState.OnMoon; Log("Init on Moon!"); StartRound(((NetworkBehaviour)this).IsOwner); } else { isInsideShip = true; shipState = ShipState.InSpace; Log("Init in space!"); EndRound(); } break; case ShipState.InSpace: if (StartOfRound.Instance.shipHasLanded) { shipState = ShipState.OnMoon; Log("Ship has landed!"); StartRound(((NetworkBehaviour)this).IsOwner); } break; case ShipState.OnMoon: if (StartOfRound.Instance.shipIsLeaving) { shipState = ShipState.InSpace; Log("Ship is leaving!"); EndRound(); } break; } NextToBoomBox(); if (freeze) { return; } grabbingCooldown -= Time.deltaTime; if (grabbingCooldown < 0f) { grabbingCooldown = 0f; } UpdateCollisions(); isInsideShip = IsInsideShip(); agent.speed = speed; if (isInsideShip && (Object)(object)((Component)this).transform.parent == (Object)null) { EnterShip(); } else if (!isInsideShip && (Object)(object)((Component)this).transform.parent != (Object)null) { LeaveShip(); } if (Time.time - lastCheckEnemy >= checkEnemyCooldown) { lastCheckEnemy = Time.time; if (CheckForEnemies()) { StartQuacking(); lastCheckEnemy = Time.time + 10f; } } } protected void EnterShip() { ((Component)this).transform.SetParent(StartOfRound.Instance.elevatorTransform, true); Log("Enters ship!"); OnEnterShip(); } protected void LeaveShip() { Log("Leaves ship!"); ((Component)this).transform.SetParent((Transform)null, true); OnLeaveShip(); } protected void StartRound(bool enableAgent) { //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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_0111: Unknown result type (might be due to invalid IL or missing references) freeze = false; ((Behaviour)agent).enabled = enableAgent; ((Behaviour)physicsProp).enabled = false; networkObject.SynchronizeTransform = false; dropShip = Object.FindObjectOfType<ItemDropship>(); Log("Start Round!"); doors = Object.FindObjectsOfType<DoorLock>(); teleports.Clear(); Teleport teleport = null; if (useFireExits) { EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>(); foreach (EntranceTeleport val in array) { teleport = null; foreach (Teleport teleport2 in teleports) { if (val.entranceId == teleport2.id) { teleport = teleport2; } } if (teleport == null) { teleport = new Teleport(val.entranceId); teleports.Add(teleport); } if (val.isEntranceToBuilding) { teleport.entrance = ((Component)val).transform.position; } else { teleport.exit = ((Component)val).transform.position; } } } teleport = new Teleport(-1); teleport.entrance = RoundManager.FindMainEntrancePosition(false, false); teleport.exit = RoundManager.FindMainEntrancePosition(false, true); teleports.Add(teleport); OnStartRound(); } protected void EndRound() { Log("End Round!"); if (isInsideShip) { freeze = true; ((Behaviour)agent).enabled = false; ((Behaviour)physicsProp).enabled = true; networkObject.SynchronizeTransform = true; OnEndRound(); } else { Object.Destroy((Object)(object)((Component)this).gameObject); } } protected virtual void OnEnterShip() { } protected virtual void OnLeaveShip() { } protected virtual void OnStartRound() { } protected virtual void OnEndRound() { } protected bool IsInSight(Transform target) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) bool flag = Physics.Linecast(itemHolder.position, target.position, StartOfRound.Instance.collidersAndRoomMask); return !flag; } protected PlayerControllerB GetClosestPlayer() { //IL_006f: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) if (findTargetPlayerIn > 0f && (Object)(object)targetPlayer != (Object)null) { findTargetPlayerIn -= Time.deltaTime; if (findTargetPlayerIn < 0f) { findTargetPlayerIn = 0f; } return targetPlayer; } float num = float.PositiveInfinity; PlayerControllerB result = null; float num2 = Vector3.Distance(((Component)this).transform.position, nextEntrance); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { float num3 = ((val.isInsideFactory != isInFactory) ? (Vector3.Distance(((Component)val).transform.position, targetEntrance) + num2) : Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position)); if (num3 < num) { result = val; num = num3; } } return result; } public void UpdateGrabbableItems() { //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) nextItemCheck = nextItemCheckCooldown; if (grabbableItems == null) { return; } grabbableItems.Clear(); GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>(); foreach (GrabbableObject val in array) { if (!((Object)(object)((Component)val).GetComponent<PetAI>() == (Object)null) || ((Object)val).name.Contains("Apparatus") || (val.itemProperties.twoHanded && !canGrabTwoHanded)) { continue; } if (((Object)val).name.Contains("RedLocustHive") && !canGrabHive) { Log("Can't grab Hive"); continue; } if ((Object)(object)((Component)val).GetComponent<RagdollGrabbableObject>() != (Object)null && !canGrabPlayers) { Log("Can't grab Players"); continue; } if ((Object)(object)dropShip != (Object)null && !val.isInShipRoom) { Log("Drop ship: " + ((Object)dropShip).name); if (Vector3.Distance(((Component)dropShip).transform.position, ((Component)val).transform.position) <= 5f) { Log("Skip Item: " + ((Object)val).name); continue; } } grabbableItems.Add(val); } } public void UpdateCollisions() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_002d: Unknown result type (might be due to invalid IL or missing references) hits = Physics.BoxCastAll(((Component)this).transform.position, Vector3.one * 2f, ((Component)this).transform.forward, ((Component)this).transform.rotation, 10f); } public bool CheckForEnemies() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) RaycastHit[] array = hits; for (int i = 0; i < array.Length; i++) { RaycastHit val = array[i]; if ((Object)(object)((Component)((RaycastHit)(ref val)).collider).gameObject.GetComponent<EnemyAI>() != (Object)null && (Object)(object)((Component)((RaycastHit)(ref val)).collider).gameObject.GetComponent<PetDuckAI>() == (Object)null) { return true; } } return false; } protected GrabbableObject GetClosestItem() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) if (grabbingCooldown > 0f) { return null; } GrabbableObject result = null; float num = 10f; foreach (GrabbableObject grabbableItem in grabbableItems) { Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(((Component)grabbableItem).transform.position, default(NavMeshHit), 5f, -1); if ((Object)(object)grabbableItem != (Object)null && (Object)(object)((Component)grabbableItem).GetComponent<PetDuckAI>() == (Object)null && RoundManager.Instance.GotNavMeshPositionResult && !grabbableItem.isInShipRoom) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)grabbableItem).transform.position); if (num2 <= num && grabbableItem.grabbable && !grabbableItem.isHeld && IsInSight(((Component)grabbableItem).transform)) { num = num2; result = grabbableItem; } } } return result; } internal bool IsDoorOpen(DoorLock door) { FieldInfo field = typeof(DoorLock).GetField("isDoorOpened", BindingFlags.Instance | BindingFlags.NonPublic); return (bool)field.GetValue(door); } public float Angle2D(Plane plane, Vector3 from, Vector3 to, bool signed = false) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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) Vector2 val = Vector2.op_Implicit(((Plane)(ref plane)).ClosestPointOnPlane(from)); Vector2 val2 = Vector2.op_Implicit(((Plane)(ref plane)).ClosestPointOnPlane(to)); float num = Vector2.Angle(val, val2); if (signed) { return num; } return Mathf.Abs(num); } public DoorLock GetNextDoor() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_0084: Unknown result type (might be due to invalid IL or missing references) if (!canOpenDoors) { return null; } DoorLock[] array = doors; foreach (DoorLock val in array) { Vector3 to = ((Component)val).transform.position - ((Component)this).transform.position; if (Angle2D(new Plane(Vector3.up, Vector3.zero), ((Component)this).transform.forward, to) <= 45f && Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position) <= 2f && !IsDoorOpen(val)) { return val; } } return null; } public void OpenDoor(DoorLock door) { Log("Try to open door"); if (door.isLocked && !door.isPickingLock) { Log("Door is locked"); KeyItem val = null; foreach (GrabbableObject grabbedItem in grabbedItems) { val = ((Component)grabbedItem).GetComponent<KeyItem>(); if ((Object)(object)val != (Object)null) { Log("Key found"); break; } } if ((Object)(object)val == (Object)null) { return; } Log("Door unlocked"); door.UnlockDoorSyncWithServer(); Object.Destroy((Object)(object)((Component)val).gameObject); } AnimatedObjectTrigger component = ((Component)door).GetComponent<AnimatedObjectTrigger>(); component.TriggerAnimationNonPlayer(false, true, false); door.OpenDoorAsEnemyServerRpc(); } public void NextToBoomBox() { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) if (animator.GetBool("IsWalking")) { animator.SetBool("IsDancing", false); return; } if (checkForBoombox > 0f) { checkForBoombox -= Time.deltaTime; if (checkForBoombox < 0f) { checkForBoombox = 0f; } return; } checkForBoombox = 2f; BoomboxItem[] array = Object.FindObjectsOfType<BoomboxItem>(); BoomboxItem[] array2 = array; foreach (BoomboxItem val in array2) { float num = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position); Log("Boombox distance: " + num); Log("Is Boombox playing? " + val.isPlayingMusic); if (val.isPlayingMusic && num <= 5f) { animator.SetBool("IsDancing", true); return; } } animator.SetBool("IsDancing", false); } protected void GetNextTeleport() { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) int index = -1; float num = float.PositiveInfinity; if (isInFactory) { for (int i = 0; i < teleports.Count; i++) { float num2 = Vector3.Distance(((Component)this).transform.position, teleports[i].exit); if (num2 < num) { index = i; num = num2; } } nextEntrance = teleports[index].exit; targetEntrance = teleports[index].entrance; return; } for (int j = 0; j < teleports.Count; j++) { float num3 = Vector3.Distance(((Component)this).transform.position, teleports[j].entrance); if (num3 < num) { index = j; num = num3; } } nextEntrance = teleports[index].entrance; targetEntrance = teleports[index].exit; } protected void Teleport() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (Vector3.Distance(((Component)this).transform.position, nextEntrance) > 2f) { agent.SetDestination(nextEntrance); return; } Log("Duck is teleporting"); ((Behaviour)agent).enabled = false; ((Component)this).transform.position = RoundManager.Instance.GetNavMeshPosition(targetEntrance, default(NavMeshHit), 5f, -1); ((Behaviour)agent).enabled = true; isInFactory = !isInFactory; targetItem = null; TurnOnRendering(); } protected void ChangeParent(NetworkObject networkObject) { ((Component)this).transform.parent = ((Component)networkObject).transform; } public void SetHP(int hp) { this.hp = Mathf.Clamp(hp, 0, maxHp); if (this.hp <= 0) { Destroy(); } } public void AddHP(int value) { hp = Mathf.Clamp(hp + value, 0, maxHp); if (hp <= 0) { Destroy(); } } public void Destroy() { OnDying(); networkObject.Despawn(true); } public override void OnDestroy() { petCount--; } protected virtual void OnDying() { } public void SyncPosition() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_004e: Unknown result type (might be due to invalid IL or missing references) if (Vector3.Distance(serverPosition, ((Component)this).transform.position) > updatePositionThreshold || shipState == ShipState.InSpace) { serverPosition = ((Component)this).transform.position; if (((NetworkBehaviour)this).IsServer) { UpdatePositionClientRpc(serverPosition); } else { UpdatePositionServerRpc(serverPosition); } } } [ServerRpc] private void UpdatePositionServerRpc(Vector3 newPos) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Invalid comparison between Unknown and I4 //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_0062: Invalid comparison between Unknown and I4 //IL_00d3: 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)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4287979890u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref newPos); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4287979890u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { UpdatePositionClientRpc(newPos); } } [ClientRpc] private void UpdatePositionClientRpc(Vector3 newPos) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Invalid comparison between Unknown and I4 //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00a4: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4287979891u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref newPos); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4287979891u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsOwner) { serverPosition = newPos; OnSyncPositionFromServer(newPos); } } } protected virtual void OnSyncPositionFromServer(Vector3 newPos) { } public void SyncRotation() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) Quaternion rotation = ((Component)this).transform.rotation; targetYRotation = (short)((Quaternion)(ref rotation)).eulerAngles.y; if (((NetworkBehaviour)this).IsServer) { UpdateRotationClientRpc(targetYRotation); } else { UpdateRotationServerRpc(targetYRotation); } } [ServerRpc] private void UpdateRotationServerRpc(short rotationY) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Invalid comparison between Unknown and I4 //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3079913700u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, rotationY); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3079913700u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { UpdateRotationClientRpc(rotationY); } } [ClientRpc] private void UpdateRotationClientRpc(short rotationY) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Invalid comparison between Unknown and I4 //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3079913701u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, rotationY); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3079913701u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { previousYRotation = ((Component)this).transform.eulerAngles.y; targetYRotation = rotationY; OnSyncRotationFromServer(rotationY); } } } protected virtual void OnSyncRotationFromServer(short newYRot) { } protected void GrabItem(NetworkObject networkObject) { Log("Grabbing " + ((Object)networkObject).name); GrabbableObject component = ((Component)networkObject).GetComponent<GrabbableObject>(); grabbedItems.Add(component); targetItem = null; component.parentObject = itemHolder; component.EnablePhysics(false); component.isHeld = true; component.hasHitGround = false; component.isInFactory = isInFactory; interactTrigger.interactable = true; } protected bool GrabAndSync() { //IL_003a: 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_0071: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsOwner) { return false; } if ((Object)(object)targetItem != (Object)null && grabbedItems.Count < itemCapacity && Vector3.Distance(((Component)this).transform.position, ((Component)targetItem).transform.position) < 0.75f) { NetworkObject component = ((Component)targetItem).GetComponent<NetworkObject>(); GrabItemServerRpc(NetworkObjectReference.op_Implicit(component)); return true; } return false; } [ServerRpc] private void GrabItemServerRpc(NetworkObjectReference objectRef) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Invalid comparison between Unknown and I4 //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Invalid comparison between Unknown and I4 //IL_00dd: 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)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2358561450u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref objectRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2358561450u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { GrabItemClientRpc(objectRef); } } [ClientRpc] private void GrabItemClientRpc(NetworkObjectReference objectRef) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Invalid comparison between Unknown and I4 //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(847487220u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref objectRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 847487220u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { NetworkObject val3 = default(NetworkObject); if (((NetworkObjectReference)(ref objectRef)).TryGet(ref val3, (NetworkManager)null)) { GrabItem(val3); } else { Debug.LogError((object)(((Object)((Component)this).gameObject).name + ": Failed to get network object from network object reference (Grab item RPC)")); } } } public void UseItem() { foreach (GrabbableObject grabbedItem in grabbedItems) { FlashlightItem component = ((Component)grabbedItem).GetComponent<FlashlightItem>(); if ((Object)(object)component != (Object)null) { bool enabled = (((GrabbableObject)component).isBeingUsed = !((GrabbableObject)component).isBeingUsed); ((Behaviour)component.flashlightBulb).enabled = enabled; ((Behaviour)component.flashlightBulbGlow).enabled = enabled; } else { grabbedItem.UseItemOnClient(true); } } nextItemInteract = Random.Range(30f, 300f); } [ServerRpc] public void UseItemServerRpc() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Invalid comparison between Unknown and I4 //IL_0081: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(235856144u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 235856144u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost) || !canUseItem) { return; } if (nextItemInteract > 0f) { nextItemInteract -= Time.deltaTime; if (nextItemInteract < 0f) { nextItemInteract = 0f; } } else { UseItemClientRpc(); nextItemInteract = Random.Range(30f, 300f); } } [ClientRpc] public void UseItemClientRpc() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Invalid comparison between Unknown and I4 //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Invalid comparison between Unknown and I4 //IL_0042: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(235856145u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 235856145u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { UseItem(); } } } protected void DropItem(NetworkObject networkObject) { //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) Log("Dropping " + ((Object)networkObject).name); GrabbableObject component = ((Component)networkObject).GetComponent<GrabbableObject>(); component.parentObject = null; if (isInsideShip) { ((Component)component).transform.SetParent(StartOfRound.Instance.elevatorTransform, true); component.scrapPersistedThroughRounds = true; component.isInShipRoom = true; component.isInFactory = false; RoundManager instance = RoundManager.Instance; instance.scrapCollectedInLevel += component.scrapValue; RoundManager.Instance.CollectNewScrapForThisRound(component); component.OnBroughtToShip(); StartOfRound instance2 = StartOfRound.Instance; instance2.currentShipItemCount++; } else { ((Component)component).transform.SetParent(StartOfRound.Instance.propsContainer, true); component.scrapPersistedThroughRounds = false; component.isInShipRoom = false; if (isInFactory) { component.isInFactory = true; } else { component.isInShipRoom = false; } } component.EnablePhysics(true); component.fallTime = 0f; component.startFallingPosition = ((Component)component).transform.parent.InverseTransformPoint(((Component)component).transform.position); Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(((Component)itemHolder).transform.position, default(NavMeshHit), 5f, -1); component.targetFloorPosition = ((Component)component).transform.parent.InverseTransformPoint(navMeshPosition); component.floorYRot = -1; component.EnableItemMeshes(true); component.isHeld = false; component.isPocketed = false; component.heldByPlayerOnServer = false; grabbedItems.Remove(component); grabbingCooldown = 5f; if (grabbedItems.Count == 0) { interactTrigger.interactable = false; } } protected void DropAndSync(GrabbableObject item) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) NetworkObject component = ((Component)item).GetComponent<NetworkObject>(); if (!((Object)(object)component == (Object)null)) { DropItemServerRpc(NetworkObjectReference.op_Implicit(component)); } } [ServerRpc] public void DropItemServerRpc(NetworkObjectReference objectRef) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Invalid comparison between Unknown and I4 //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(847487222u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref objectRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 847487222u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { DropItemClientRpc(objectRef); } } } [ClientRpc] public void DropItemClientRpc(NetworkObjectReference objectRef) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Invalid comparison between Unknown and I4 //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(847487223u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref objectRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 847487223u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { NetworkObject val3 = default(NetworkObject); if (((NetworkObjectReference)(ref objectRef)).TryGet(ref val3, (NetworkManager)null)) { DropItem(val3); } else { Debug.LogError((object)(((Object)((Component)this).gameObject).name + ": Failed to get network object from network object reference (Drop item RPC)")); } } } public void UpdateAnim() { if (curSpeed == 0f) { animator.SetBool("IsWalking", false); animator.speed = 1f; if ((Object)(object)audioWalking != (Object)null && audioWalking.isPlaying) { audioWalking.Stop(); } return; } float num = curSpeed / 4.5f; audioWalking.pitch = Mathf.Clamp(num, 1f, 2f); animator.SetBool("IsWalking", true); animator.speed = Mathf.Clamp(num, 1f, num); if ((Object)(object)audioWalking != (Object)null && !audioWalking.isPlaying) { audioWalking.Play(); } } [ServerRpc] public void SyncSpeedServerRpc(float speed) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Invalid comparison between Unknown and I4 //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2358561458u, val, (RpcDelivery)0); BytePacker.WriteValuePacked(val2, speed); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2358561458u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SyncSpeedClientRpc(speed); } } [ClientRpc] public void SyncSpeedClientRpc(float speed) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Invalid comparison between Unknown and I4 //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(847487229u, val, (RpcDelivery)0); BytePacker.WriteValuePacked(val2, speed); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 847487229u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { curSpeed = speed; UpdateAnim(); } } } public void Pat(PlayerControllerB player) { animator.SetTrigger("Pat"); audioQuacking.Play(); targetPlayer = player; findTargetPlayerIn = 30f; } [ServerRpc] public void PatServerRpc(NetworkObjectReference objectRef) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Invalid comparison between Unknown and I4 //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2358561456u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref objectRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2358561456u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { PatClientRpc(objectRef); } } } [ClientRpc] public void PatClientRpc(NetworkObjectReference objectRef) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Invalid comparison between Unknown and I4 //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(847487227u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref objectRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 847487227u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { NetworkObject val3 = default(NetworkObject); if (((NetworkObjectReference)(ref objectRef)).TryGet(ref val3, (NetworkManager)null)) { Pat(((Component)val3).GetComponent<PlayerControllerB>()); } else { Debug.LogError((object)(((Object)((Component)this).gameObject).name + ": Failed to get network object from network object reference (Grab item RPC)")); } } } public virtual void OnHit(int newHP) { hp = newHP; animator.SetTrigger("Hit"); if (hp <= 0) { animator.SetBool("IsDead", true); ((Component)itemHolder).gameObject.SetActive(false); ((Component)interactPatter).gameObject.SetActive(false); OnDying(); if (((NetworkBehaviour)this).IsServer) { ((Component)this).gameObject.GetComponent<NetworkObject>().Despawn(true); } } } public bool Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { Log("Duck got hit."); HitServerRpc(force); return true; } [ServerRpc(RequireOwnership = false)] public void HitServerRpc(int force) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Invalid comparison between Unknown and I4 //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(847487300u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, force); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 847487300u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { int num = (hittable ? (hp - force) : hp); HitClientRpc(Mathf.Clamp(num, 0, maxHp)); } } } [ClientRpc] public void HitClientRpc(int newHP) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Invalid comparison between Unknown and I4 //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(847487301u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, newHP); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 847487301u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { OnHit(newHP); } } } public virtual void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot, int noiseID) { } public virtual void Interact(PlayerControllerB player) { DropAndSync(grabbedItems[grabbedItems.Count - 1]); } public virtual void InteractPat(PlayerControllerB player) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) PatServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)player).NetworkObject)); } public void SetScrapValue(float value) { scrapValue = value; } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_PetAI() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Expected O, but got Unknown //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Expected O, but got Unknown //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Expected O, but got Unknown //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(4287979890u, new RpcReceiveHandler(__rpc_handler_4287979890)); NetworkManager.__rpc_func_table.Add(4287979891u, new RpcReceiveHandler(__rpc_handler_4287979891)); NetworkManager.__rpc_func_table.Add(3079913700u, new RpcReceiveHandler(__rpc_handler_3079913700)); NetworkManager.__rpc_func_table.Add(3079913701u, new RpcReceiveHandler(__rpc_handler_3079913701)); NetworkManager.__rpc_func_table.Add(2358561450u, new RpcReceiveHandler(__rpc_handler_2358561450)); NetworkManager.__rpc_func_table.Add(847487220u, new RpcReceiveHandler(__rpc_handler_847487220)); NetworkManager.__rpc_func_table.Add(847487222u, new RpcReceiveHandler(__rpc_handler_847487222)); NetworkManager.__rpc_func_table.Add(847487223u, new RpcReceiveHandler(__rpc_handler_847487223)); NetworkManager.__rpc_func_table.Add(2358561458u, new RpcReceiveHandler(__rpc_handler_2358561458)); NetworkManager.__rpc_func_table.Add(847487229u, new RpcReceiveHandler(__rpc_handler_847487229)); NetworkManager.__rpc_func_table.Add(2358561456u, new RpcReceiveHandler(__rpc_handler_2358561456)); NetworkManager.__rpc_func_table.Add(847487227u, new RpcReceiveHandler(__rpc_handler_847487227)); NetworkManager.__rpc_func_table.Add(847487300u, new RpcReceiveHandler(__rpc_handler_847487300)); NetworkManager.__rpc_func_table.Add(847487301u, new RpcReceiveHandler(__rpc_handler_847487301)); NetworkManager.__rpc_func_table.Add(235856144u, new RpcReceiveHandler(__rpc_handler_235856144)); NetworkManager.__rpc_func_table.Add(235856145u, new RpcReceiveHandler(__rpc_handler_235856145)); } private static void __rpc_handler_4287979890(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //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_0070: 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_008a: 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) //IL_0045: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { Vector3 newPos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref newPos); ((NetworkBehaviour)(PetAI)(object)target).__rpc_exec_stage = (__RpcExecStage)1; ((PetAI)(object)target).UpdatePositionServerRpc(newPos); ((NetworkBehaviour)(PetAI)(object)target).__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4287979891(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002a: 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_0043: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 newPos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref newPos); ((NetworkBehaviour)(PetAI)(object)target).__rpc_exec_stage = (__RpcExecStage)2; ((PetAI)(object)target).UpdatePositionClientRpc(newPos); ((NetworkBehaviour)(PetAI)(object)target).__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3079913700(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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) //IL_0045: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { short rotationY = default(short); ByteUnpacker.ReadValueBitPacked(reader, ref rotationY); ((NetworkBehaviour)(PetAI)(object)target).__rpc_exec_stage = (__RpcExecStage)1; ((PetAI)(object)target).UpdateRotationServerRpc(rotationY); ((NetworkBehaviour)(PetAI)(object)target).__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3079913701(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { short rotationY = default(short); ByteUnpacker.ReadValueBitPacked(reader, ref rotationY); ((NetworkBehaviour)(PetAI)(object)target).__rpc_exec_stage = (__RpcExecStage)2; ((PetAI)(object)target).UpdateRotationClientRpc(rotationY); ((NetworkBehaviour)(PetAI)(object)target).__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2358561450(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //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_0065: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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) //IL_0045: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { NetworkObjectReference objectRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref objectRef, default(ForNetworkSerializable)); ((NetworkBehaviour)(PetAI)(object)target).__rpc_exec_stage = (__RpcExecStage)1; ((PetAI)(object)target).GrabItemServerRpc(objectRef); ((NetworkBehaviour)(PetAI)(object)target).__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_847487220(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_001f: 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_0033: 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_004c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference objectRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref objectRef, default(ForNetworkSerializable)); ((NetworkBehaviour)(PetAI)(object)target).__rpc_exec_stage = (__RpcExecStage)2; ((PetAI)(object)target).GrabItemClientRpc(objectRef); ((NetworkBehaviour)(PetAI)(object)target).__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_847487222(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0025: 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_0039: 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_0052: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference objectRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref objectRef, default(ForNetworkSerializable)); ((NetworkBehaviour)(PetAI)(object)target).__rpc_exec_stage = (__RpcExecStage)1; ((PetAI)(object)target).DropItemServerRpc(objectRef); ((NetworkBehaviour)(PetAI)(object)target).__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_847487223(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_001f: 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_0033: 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_004c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference objectRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref objectRef, default(ForNetworkSerializable)); ((NetworkBehaviour)(PetAI)(object)target).__rpc_exec_stage = (__RpcExecStage)2; ((PetAI)(object)target).DropItemClientRpc(objectRef); ((NetworkBehaviour)(PetAI)(object)target).__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2358561458(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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) //IL_0045: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { float num = default(float); ByteUnpacker.ReadValuePacked(reader, ref num); ((NetworkBehaviour)(PetAI)(object)target).__rpc_exec_stage = (__RpcExecStage)1; ((PetAI)(object)target).SyncSpeedServerRpc(num); ((NetworkBehaviour)(PetAI)(object)target).__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_847487229(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float num = default(float); ByteUnpacker.ReadValuePacked(reader, ref num); ((NetworkBehaviour)(PetAI)(object)target).__rpc_exec_stage = (__RpcExecStage)2; ((PetAI)(object)target).SyncSpeedClientRpc(num); ((NetworkBehaviour)(PetAI)(object)target).__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2358561456(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0025: 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_0039: 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 refe