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 LCEndermanMod v1.0.0
LCEndermanMod.dll
Decompiled 2 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [CreateAssetMenu(menuName = "LCEndermanMod/AllAssets")] public class AllAssets : ScriptableObject { public GameObject[] allNetworkPrefabs; [Space(3f)] [Header("Main")] public GameObject managerPrefab; [Space] public EnemyType endermanEnemy; [Space] public Item enderPearlItem; public BlockData[] placeableBlockItems; public Item[] miscItems; [Space(3f)] [Header("LethalCompany")] public TerminalKeyword bestiaryEndermanKeyword; public TerminalNode bestiaryEndermanNode; [Space(3f)] [Header("Audiovisual")] public GameObject teleportPrefabVFX; public GameObject blockBreakVFX; [Space] public Material[] helmetMaterials; public Texture2D[] blockBreakTextures; [Space] public Material[] linkedColorMaterials; public Color[] linkedMaterialColors; [Space] public AudioClip playerHitSFX; public AudioClip minecraftBreakSFX; public AudioClip minecraftDeathSFX; public AudioClip[] teleportSFX; [Space] public GameObject uiPrefabCrosshair; public GameObject uiPrefabStackCount; [Space] public AnimationCurve endermanTeleportCurve; [Space(3f)] [Header("Cross-Mod Compatibility")] public Item chickenJockeyEgg; } [CreateAssetMenu(menuName = "LCEndermanMod/BlockData")] public class BlockData : ScriptableObject { public Item blockItemProperties; public GameObject blockPlaceablePrefab; public SurfaceTag blockTag = SurfaceTag.Untagged; [Space(3f)] [Header("Parameters")] public int startingHealth = 3; [Range(1f, 64f)] public int maxStartingAmount = 5; [Range(0f, 10f)] public float blastResistance = 1f; [Space(3f)] [Header("Audiovisual")] public AudioClip placeSFX; public AudioClip[] diggingSFX; public AudioClip breakSFX; [Space] public string pluralItemName; [Space(3f)] [Header("Breaking")] public Color breakColor = Color.op_Implicit(new Vector4(1f, 1f, 1f, 1f)); [Space] public Item dropItem; [Range(0f, 64f)] public int minDropAmount = 1; [Range(0f, 64f)] public int maxDropAmount = 1; } public class BlockItem : GrabbableObject, IMinecraftItem { public BlockData blockData; [Space(3f)] [Header("IMinecraftItem")] public ScanNodeProperties scanNode; public Animator idleAnimator; public MeshRenderer stackableVisualizer; private int amount = 1; public int maxStackable = 64; int IMinecraftItem.stackAmount { get { return amount; } set { amount = value; } } int IMinecraftItem.maxAmountStackable { get { return maxStackable; } set { maxStackable = value; } } MeshRenderer IMinecraftItem.stackedItemVisualizer { get { return stackableVisualizer; } set { stackableVisualizer = value; } } Animator IMinecraftItem.idleItemAnimator { get { return idleAnimator; } set { idleAnimator = value; } } ScanNodeProperties IMinecraftItem.scanNode { get { return scanNode; } set { scanNode = value; } } private void Awake() { EnderManager.RetagMinecraftBlockVisualizer((GrabbableObject)(object)this); } public override int GetItemDataToSave() { ((GrabbableObject)this).GetItemDataToSave(); return amount; } public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); EnderManager.SetStackableAmount((GrabbableObject)(object)this, saveData, addOrSnap: false); } public override void GrabItem() { ((GrabbableObject)this).GrabItem(); EnderManager.StackItem((GrabbableObject)(object)this); EnderManager.SetStackableUICounter((GrabbableObject)(object)this); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); EnderManager.SetMinecraftBlockVisualizer((GrabbableObject)(object)this); EnderManager.SetCrosshairVisibility(); if ((Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.equippedUsableItemQE = true; } } public override void SetControlTipsForItem() { ((GrabbableObject)this).SetControlTipsForItem(); EnderManager.AddHalveStackToControlTips((GrabbableObject)(object)this); } public override void PocketItem() { if ((Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.equippedUsableItemQE = false; } EnderManager.SetCrosshairVisibility(); ((GrabbableObject)this).PocketItem(); } public override void DiscardItem() { if ((Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.equippedUsableItemQE = false; EnderManager.DestroyUnusedStackableUICounters(base.playerHeldBy); } EnderManager.SetCrosshairVisibility(); ((GrabbableObject)this).DiscardItem(); } public override void OnHitGround() { ((GrabbableObject)this).OnHitGround(); EnderManager.SetMinecraftBlockVisualizer((GrabbableObject)(object)this); } public override void ItemInteractLeftRight(bool right) { ((GrabbableObject)this).ItemInteractLeftRight(right); if (!right) { EnderManager.HalveStack((GrabbableObject)(object)this); } } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_0042: 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) if (amount > 0 && !base.deactivated && !((Object)(object)base.playerHeldBy != (Object)(object)GameNetworkManager.Instance.localPlayerController) && !((Object)(object)EnderManager.Instance == (Object)null)) { PlaceBlockFromPosition(base.playerHeldBy.playerEye.position, base.playerHeldBy.playerEye.forward, base.playerHeldBy); } } public bool PlaceBlockFromPosition(Vector3 position, Vector3 forward, PlayerControllerB playerUsing) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: 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_0021: Unknown result type (might be due to invalid IL or missing references) RaycastHit rayHit = default(RaycastHit); if (Physics.Raycast(position, forward, ref rayHit, 5f, LayerMask.op_Implicit(EnderManager.Instance.placeableBlockMask), (QueryTriggerInteraction)1)) { return EnderManager.PlaceBlockAtPosition(this, rayHit, playerUsing); } return false; } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { ((GrabbableObject)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "BlockItem"; } } internal class Configs { private static ManualLogSource Logger; public static ConfigFile myConfig; private static Dictionary<string, ConfigEntry<bool>> boolConfigs = new Dictionary<string, ConfigEntry<bool>>(); private static Dictionary<string, ConfigEntry<int>> intConfigs = new Dictionary<string, ConfigEntry<int>>(); private static Dictionary<string, ConfigEntry<float>> floatConfigs = new Dictionary<string, ConfigEntry<float>>(); private static Dictionary<string, ConfigEntry<string>> stringConfigs = new Dictionary<string, ConfigEntry<string>>(); public static string keyDeathSFX = "Death SFX"; public static string keyEnableSpawning = "Enable Spawning"; public static string keyEnemyHP = "Enemy HP"; public static string keyMaxCount = "Max Count"; public static string keySpawnGroups = "Spawn Groups"; public static string keyPowerLevel = "Power Level"; public static string keyDiversityLevel = "Diversity Level"; public static string keyInvalidLevels = "Invalid Levels"; public static void SetUpConfigs(StartOfRound __instance) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Expected O, but got Unknown //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Expected O, but got Unknown if ((Object)(object)__instance == (Object)null || __instance.levels == null || __instance.levels.Length == 0) { return; } BindConfig("Secret", keyDeathSFX, defaultValue: false, "Play a classic sound effect upon dying to an enderman."); BindConfig("General", keyEnableSpawning, defaultValue: true, "Set if the Enderman can be added to levels as a spawnable enemy.\nHost's values are used."); BindConfig("General", keyEnemyHP, 9, new ConfigDescription("Set how much base health most Endermen have.\nHost's values are used.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>())); BindConfig("General", keyMaxCount, 15, new ConfigDescription("Set how many Endermen can spawn at most during a day.\nHost's values are used.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>())); BindConfig("General", keySpawnGroups, 3, new ConfigDescription("Set the maximum possible amount for how many Enderman can randomly spawn at a time.\nThe higher, the likelier Enderman are to spawn in batches.\nHost's values are used.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>())); BindConfig("General", keyPowerLevel, 0.5f, new ConfigDescription("Set how much space Endermen take up in a day's total enemy pool.\nThe higher, the fewer other enemies can spawn.\nHost's values are used.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f), Array.Empty<object>())); BindConfig("General", keyDiversityLevel, 1, new ConfigDescription("Set how strongly the spawn chance of Endermen is determined by how many different types of enemies have spawned.\nThe higher, the less likely it is to spawn if many enemies have already spawned.\nHost's values are used.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 3), Array.Empty<object>())); BindConfig("General", keyInvalidLevels, "71 Gordion;44 Liquidation", "The PlanetNames of all levels where the enemy should not be added as a spawnable enemy.\nSeparate planet names with a ; symbol.\nHost's values are used."); if (GetConfigValueBool(keyEnableSpawning)) { for (int i = 0; i < __instance.levels.Length; i++) { SelectableLevel val = __instance.levels[i]; if (!((Object)(object)val == (Object)null) && Plugin.LevelValidToSpawn(val)) { int defaultValue = 50; switch (val.PlanetName) { case "41 Experimentation": defaultValue = 3; break; case "220 Assurance": defaultValue = 11; break; case "56 Vow": defaultValue = 7; break; case "61 March": defaultValue = 1; break; case "20 Adamance": defaultValue = 10; break; case "85 Rend": defaultValue = 67; break; case "7 Dine": defaultValue = 14; break; case "21 Offense": defaultValue = 150; break; case "8 Titan": defaultValue = 13; break; case "68 Artifice": defaultValue = 9; break; case "5 Embrion": defaultValue = 5; break; } BindConfig("Spawning", val.PlanetName, defaultValue, new ConfigDescription("Chance for the Enderman to spawn on " + val.PlanetName + ".\nHost's values are used.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 200), Array.Empty<object>())); } } } myConfig.Save(); } public static void BindConfig(string categoryName, string configName, bool defaultValue, string configDescription) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown BindConfig(categoryName, configName, defaultValue, new ConfigDescription(configDescription, (AcceptableValueBase)null, Array.Empty<object>())); } public static void BindConfig(string categoryName, string configName, bool defaultValue, ConfigDescription configDescription) { if (!string.IsNullOrEmpty(categoryName) && !string.IsNullOrEmpty(configName)) { ConfigEntry<bool> val = myConfig.Bind<bool>(categoryName, configName, defaultValue, configDescription); if (boolConfigs.TryAdd(configName, val)) { Logger.LogDebug((object)$"Successfully bound Config \"{((ConfigEntryBase)val).Definition}\" with Value {val.Value}."); return; } Logger.LogWarning((object)$"Failed to add Config with categoryName \"{categoryName}\", configName \"{configName}\", defaultValue {defaultValue}, and configDescription \"{configDescription}\"."); } } public static void BindConfig(string categoryName, string configName, int defaultValue, string configDescription) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown BindConfig(categoryName, configName, defaultValue, new ConfigDescription(configDescription, (AcceptableValueBase)null, Array.Empty<object>())); } public static void BindConfig(string categoryName, string configName, int defaultValue, ConfigDescription configDescription) { if (!string.IsNullOrEmpty(categoryName) && !string.IsNullOrEmpty(configName)) { ConfigEntry<int> val = myConfig.Bind<int>(categoryName, configName, defaultValue, configDescription); if (intConfigs.TryAdd(configName, val)) { Logger.LogDebug((object)$"Successfully bound Config \"{((ConfigEntryBase)val).Definition}\" with Value {val.Value}."); return; } Logger.LogWarning((object)$"Failed to add Config with categoryName \"{categoryName}\", configName \"{configName}\", defaultValue {defaultValue}, and configDescription \"{configDescription}\"."); } } public static void BindConfig(string categoryName, string configName, float defaultValue, string configDescription) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown BindConfig(categoryName, configName, defaultValue, new ConfigDescription(configDescription, (AcceptableValueBase)null, Array.Empty<object>())); } public static void BindConfig(string categoryName, string configName, float defaultValue, ConfigDescription configDescription) { if (!string.IsNullOrEmpty(categoryName) && !string.IsNullOrEmpty(configName)) { ConfigEntry<float> val = myConfig.Bind<float>(categoryName, configName, defaultValue, configDescription); if (floatConfigs.TryAdd(configName, val)) { Logger.LogDebug((object)$"Successfully bound Config \"{((ConfigEntryBase)val).Definition}\" with Value {val.Value}."); return; } Logger.LogWarning((object)$"Failed to add Config with categoryName \"{categoryName}\", configName \"{configName}\", defaultValue {defaultValue}, and configDescription \"{configDescription}\"."); } } public static void BindConfig(string categoryName, string configName, string defaultValue, string configDescription) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown BindConfig(categoryName, configName, defaultValue, new ConfigDescription(configDescription, (AcceptableValueBase)null, Array.Empty<object>())); } public static void BindConfig(string categoryName, string configName, string defaultValue, ConfigDescription configDescription) { if (!string.IsNullOrEmpty(categoryName) && !string.IsNullOrEmpty(configName)) { ConfigEntry<string> val = myConfig.Bind<string>(categoryName, configName, defaultValue, configDescription); if (stringConfigs.TryAdd(configName, val)) { Logger.LogDebug((object)$"Successfully bound Config \"{((ConfigEntryBase)val).Definition}\" with Value {val.Value}."); return; } Logger.LogWarning((object)$"Failed to add Config with categoryName \"{categoryName}\", configName \"{configName}\", defaultValue {defaultValue}, and configDescription \"{configDescription}\"."); } } public static bool GetConfigValueBool(string configName) { if (string.IsNullOrEmpty(configName)) { return false; } ConfigEntry<bool> value = null; if (boolConfigs.TryGetValue(configName, out value)) { return value.Value; } return false; } public static int GetConfigValueInt(string configName) { if (string.IsNullOrEmpty(configName)) { return -1; } ConfigEntry<int> value = null; if (intConfigs.TryGetValue(configName, out value)) { return value.Value; } return -1; } public static float GetConfigValueFloat(string configName) { if (string.IsNullOrEmpty(configName)) { return -1f; } ConfigEntry<float> value = null; if (floatConfigs.TryGetValue(configName, out value)) { return value.Value; } return -1f; } public static string GetConfigValueString(string configName) { if (string.IsNullOrEmpty(configName)) { return string.Empty; } ConfigEntry<string> value = null; if (stringConfigs.TryGetValue(configName, out value)) { return value.Value; } return string.Empty; } } public class EnderManager : NetworkBehaviour { private static ManualLogSource Logger; public static EnderManager Instance; public static AllAssets allAssets; private static List<GameObject> spawnedProjectiles; private static int checkEnemyIndex; private static float enemyBreakBlockTimer; private static Collider[] tempBlockColliders = (Collider[])(object)new Collider[64]; public static PlacedBlockProp[] tempBlocksArray = new PlacedBlockProp[64]; public static int endermenKilledThisSession; public static EntranceTeleport[] allEntrances; public static bool hasCheckedEntrancesToday; private static GameObject spawnedCrosshair; public AudioSource[] tempAudioSources; private bool givenInvalidPlaceInShipWarning; [Space(3f)] public LayerMask placeableBlockMask; public LayerMask invalidateBlockMask; public LayerMask blockSelfMask; public LayerMask waterMask; private void Awake() { if ((Object)(object)Instance != (Object)null) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } Instance = this; spawnedProjectiles = new List<GameObject>(); ((Component)this).transform.SetParent(Plugin.SearchForObject("SimonTendoManagers", ((Component)StartOfRound.Instance).transform.parent).transform); ((Object)((Component)this).gameObject).name = "LCEndermanMod"; } private void Start() { RandomizeMaxSpawnCount(); } private void Update() { if (((NetworkBehaviour)this).IsServer) { if (enemyBreakBlockTimer > 0f) { enemyBreakBlockTimer -= Time.deltaTime; } else { CheckEnemyNearBreakableBlocks(); } } } public static void AddProjectile(GameObject projectile) { if (spawnedProjectiles != null && !((Object)(object)projectile == (Object)null) && !spawnedProjectiles.Contains(projectile)) { spawnedProjectiles.Add(projectile); } } public static int GetProjectile(GameObject projectile) { if ((Object)(object)projectile == (Object)null || spawnedProjectiles == null || spawnedProjectiles.Count == 0) { return -1; } for (int i = 0; i < spawnedProjectiles.Count; i++) { GameObject val = spawnedProjectiles[i]; if (!((Object)(object)val == (Object)null) && !((Object)(object)val != (Object)(object)projectile)) { return i; } } return -1; } public static void RemoveProjectile(GameObject projectile) { if (spawnedProjectiles != null && spawnedProjectiles.Count != 0 && !((Object)(object)projectile == (Object)null) && spawnedProjectiles.Contains(projectile)) { spawnedProjectiles.Remove(projectile); Object.Destroy((Object)(object)projectile); } } public static void RemoveProjectile(int atIndex) { if (spawnedProjectiles != null && spawnedProjectiles.Count != 0 && atIndex >= 0 && atIndex < spawnedProjectiles.Count) { GameObject val = spawnedProjectiles[atIndex]; if (!((Object)(object)val == (Object)null)) { spawnedProjectiles.Remove(val); Object.Destroy((Object)(object)val); } } } public static void PlayAudio(AudioClip playClip, AudioSource fromSource, bool audible = false, float noiseRange = 10f, float noiseLoudness = 0.33f) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)playClip == (Object)null) && !((Object)(object)fromSource == (Object)null)) { fromSource.PlayOneShot(playClip); WalkieTalkie.TransmitOneShotAudio(fromSource, playClip, 1f); if (noiseRange > 0f) { RoundManager.Instance.PlayAudibleNoise(((Component)fromSource).transform.position, noiseRange, noiseLoudness, 0, false, 0); } } } public static void PlayAudioAtLocation(AudioClip playClip, Vector3 audioPosition, bool audible = false, float noiseRange = 10f, float noiseLoudness = 0.33f) { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)playClip == (Object)null || (Object)(object)Instance == (Object)null) { return; } AudioSource val = null; if (Instance.tempAudioSources != null && Instance.tempAudioSources.Length != 0) { for (int i = 0; i < Instance.tempAudioSources.Length; i++) { if ((Object)(object)Instance.tempAudioSources[i] != (Object)null && (!Instance.tempAudioSources[i].isPlaying || i == Instance.tempAudioSources.Length - 1)) { val = Instance.tempAudioSources[i]; break; } } } if (!((Object)(object)val == (Object)null)) { val.Stop(); ((Component)val).transform.position = audioPosition; val.volume = noiseLoudness; val.maxDistance = noiseRange * 1.25f; val.PlayOneShot(playClip); WalkieTalkie.TransmitOneShotAudio(val, playClip, 1f); if (audible) { RoundManager.Instance.PlayAudibleNoise(audioPosition, noiseRange, noiseLoudness, 0, false, 0); } } } public static void InstantiateNewTeleportVFX(float lifetime, Vector3 startPos, Vector3 endPos) { //IL_0008: 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_003b: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (lifetime <= 0f || startPos == endPos || (Object)(object)allAssets == (Object)null || (Object)(object)allAssets.teleportPrefabVFX == (Object)null) { return; } GameObject val = Object.Instantiate<GameObject>(allAssets.teleportPrefabVFX, startPos, Quaternion.identity); if (!((Object)(object)val == (Object)null)) { TeleportParticles component = val.GetComponent<TeleportParticles>(); if ((Object)(object)component == (Object)null) { Object.Destroy((Object)(object)val); } else { component.StartTeleportEffect(lifetime, startPos, endPos); } } } public static void InstantiateNewBreakVFX(Vector3 position, Color particleColor) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(allAssets.blockBreakVFX, position, Quaternion.identity); if ((Object)(object)val == (Object)null) { return; } ParticleSystem component = val.GetComponent<ParticleSystem>(); if ((Object)(object)component == (Object)null) { Object.Destroy((Object)(object)val); return; } ParticleSystemRenderer component2 = val.GetComponent<ParticleSystemRenderer>(); if ((Object)(object)component2 != (Object)null) { ((Renderer)component2).material.color = particleColor; } component.Play(); } public static bool ChanceOneIn(float oneInHundred) { return Random.Range(0.01f, 100f) <= Mathf.Clamp(oneInHundred, 0f, 100f); } public static int GetRandomNumber(int maxRange, EnemyAI usingEnemy = null, GrabbableObject usingItem = null) { int seed = 20260420; int num = 0; if ((Object)(object)StartOfRound.Instance != (Object)null) { num += StartOfRound.Instance.randomMapSeed; } if ((Object)(object)TimeOfDay.Instance != (Object)null) { num += TimeOfDay.Instance.hour; } if ((Object)(object)usingEnemy != (Object)null) { num += usingEnemy.thisEnemyIndex; num += usingEnemy.enemyHP; } if ((Object)(object)usingItem != (Object)null) { num += usingItem.scrapValue; } if (num > 0) { seed = num; } return new Random(seed).Next(0, maxRange); } public static Color GetColorOfMaterial(Material helmetMat) { //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) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)helmetMat == (Object)null) { return Color.white; } Color result = Color.white; for (int i = 0; i < allAssets.linkedColorMaterials.Length; i++) { Material val = allAssets.linkedColorMaterials[i]; if (!((Object)(object)val == (Object)null) && !((Object)(object)val != (Object)(object)helmetMat) && i >= 0 && i < allAssets.linkedMaterialColors.Length) { result = allAssets.linkedMaterialColors[i]; break; } } return result; } public static GrabbableObject SpawnItemAtPosition(Item itemProperties, Vector3 spawnPos, int overrideScrapValue = -1, int stackableAmount = -1, bool newItem = true) { //IL_0038: 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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)itemProperties == (Object)null || (Object)(object)itemProperties.spawnPrefab == (Object)null || (Object)(object)Instance == (Object)null || !((NetworkBehaviour)Instance).IsServer) { return null; } GameObject val = Object.Instantiate<GameObject>(itemProperties.spawnPrefab, spawnPos, Quaternion.identity); if ((Object)(object)val == (Object)null) { return null; } NetworkObject component = val.GetComponent<NetworkObject>(); GrabbableObject component2 = val.GetComponent<GrabbableObject>(); if ((Object)(object)component == (Object)null || (Object)(object)component2 == (Object)null) { Object.Destroy((Object)(object)val); return null; } IMinecraftItem component3 = ((Component)component2).GetComponent<IMinecraftItem>(); if (component3 != null && stackableAmount <= 0) { Object.Destroy((Object)(object)val); return null; } component.Spawn(false); if (component3 != null && stackableAmount > component3.maxAmountStackable) { stackableAmount = component3.maxAmountStackable; } int num = 0; int num2 = 0; if (overrideScrapValue != -1) { num2 = overrideScrapValue; } else if (stackableAmount <= 1) { num2 = (int)Random.Range((float)itemProperties.minValue * RoundManager.Instance.scrapValueMultiplier, (float)itemProperties.maxValue * RoundManager.Instance.scrapValueMultiplier); } else if (component3 != null) { while (num < stackableAmount) { num++; num2 += (int)Random.Range((float)itemProperties.minValue * RoundManager.Instance.scrapValueMultiplier, (float)itemProperties.maxValue * RoundManager.Instance.scrapValueMultiplier); } } num2 = Mathf.Max(1, num2); SharedSpawnItemFunctionality(component2, spawnPos, num2, stackableAmount, newItem); Instance.SpawnItemClientRpc(NetworkObjectReference.op_Implicit(component), spawnPos, num2, stackableAmount, newItem); return component2; } [ClientRpc] private void SpawnItemClientRpc(NetworkObjectReference itemNOR, Vector3 spawnPos, int scrapValue, int amount, bool newItem) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(47353849u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref itemNOR, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref spawnPos); BytePacker.WriteValueBitPacked(val2, scrapValue); BytePacker.WriteValueBitPacked(val2, amount); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref newItem, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 47353849u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { ((MonoBehaviour)this).StartCoroutine(SpawnItemOnClient(itemNOR, spawnPos, scrapValue, amount, newItem)); } } } private IEnumerator SpawnItemOnClient(NetworkObjectReference itemNOR, Vector3 spawnPos, int scrapValue, int amount, bool newItem) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) NetworkObject netObj = null; float waited = 0f; for (float waitIntervals = 0.2f; waited < 8f; waited += waitIntervals) { if (((NetworkObjectReference)(ref itemNOR)).TryGet(ref netObj, (NetworkManager)null)) { break; } yield return (object)new WaitForSeconds(0.2f); } if (!((Object)(object)netObj == (Object)null)) { SharedSpawnItemFunctionality(((Component)netObj).GetComponent<GrabbableObject>(), spawnPos, scrapValue, amount, newItem); } } private static void SharedSpawnItemFunctionality(GrabbableObject itemScript, Vector3 spawnPos, int scrapValue, int amount, bool newItem) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)itemScript == (Object)null)) { if (((Component)itemScript).GetComponent<IMinecraftItem>() != null) { SetStackableAmount(itemScript, amount, addOrSnap: false, scrapValue); } else { itemScript.SetScrapValue(scrapValue); } itemScript.scrapPersistedThroughRounds = !newItem; int num = scrapValue; if (((NetworkBehaviour)itemScript).IsSpawned) { num += (int)((NetworkBehaviour)itemScript).NetworkObjectId; } CalculateTargetFloorPosition(itemScript, spawnPos, num); if (HoarderBugAI.grabbableObjectsInMap != null && !HoarderBugAI.grabbableObjectsInMap.Contains(((Component)itemScript).gameObject)) { HoarderBugAI.grabbableObjectsInMap.Add(((Component)itemScript).gameObject); } } } public static void ThrowableHitObject(ThrownItemProp throwable, Vector3 impactPos, Collider colliderHit) { //IL_005d: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01da: 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_0159: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Instance == (Object)null || (Object)(object)throwable == (Object)null || (Object)(object)throwable.spawnedBy == (Object)null || (Object)(object)throwable.spawnedBy != (Object)(object)GameNetworkManager.Instance.localPlayerController || !throwable.spawnedBy.isPlayerControlled || (Object)(object)colliderHit == (Object)null) { return; } Logger.LogDebug((object)$"ThrowableHitObject({throwable}, {impactPos}, {colliderHit})"); int projectile = GetProjectile(((Component)throwable).gameObject); Vector3 position = ((Component)throwable.spawnedBy).transform.position; NetworkBehaviour component = ((Component)colliderHit).GetComponent<NetworkBehaviour>(); if ((Object)(object)component != (Object)null) { OnThrowableHitColliderLocal(throwable.spawnedBy, impactPos, throwable.isEnderPearl, throwable.impactPower, projectile, position, component.NetworkObject); Instance.OnThrowableHitColliderServerRpc((int)throwable.spawnedBy.playerClientId, impactPos, throwable.isEnderPearl, throwable.impactPower, projectile, position, NetworkObjectReference.op_Implicit(component.NetworkObject)); return; } EnemyAICollisionDetect component2 = ((Component)colliderHit).GetComponent<EnemyAICollisionDetect>(); if ((Object)(object)component2 != (Object)null && (Object)(object)component2.mainScript != (Object)null && !component2.mainScript.isEnemyDead && (Object)(object)((NetworkBehaviour)component2.mainScript).NetworkObject != (Object)null && ((NetworkBehaviour)component2.mainScript).NetworkObject.IsSpawned) { OnThrowableHitColliderLocal(throwable.spawnedBy, impactPos, throwable.isEnderPearl, throwable.impactPower, projectile, position, ((NetworkBehaviour)component2.mainScript).NetworkObject); Instance.OnThrowableHitColliderServerRpc((int)throwable.spawnedBy.playerClientId, impactPos, throwable.isEnderPearl, throwable.impactPower, projectile, position, NetworkObjectReference.op_Implicit(((NetworkBehaviour)component2.mainScript).NetworkObject)); } else { OnThrowableHitColliderLocal(throwable.spawnedBy, impactPos, throwable.isEnderPearl, throwable.impactPower, projectile, position); Instance.OnThrowableHitColliderServerRpc((int)throwable.spawnedBy.playerClientId, impactPos, throwable.isEnderPearl, throwable.impactPower, projectile, position); } } [ServerRpc(RequireOwnership = false)] private void OnThrowableHitColliderServerRpc(int ownerID, Vector3 impactPos, bool isEnderPearl, int impactPower, int removeAtIndex, Vector3 oldOwnerPos) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) 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(2805269131u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, ownerID); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref impactPos); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isEnderPearl, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, impactPower); BytePacker.WriteValueBitPacked(val2, removeAtIndex); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref oldOwnerPos); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2805269131u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; OnThrowableHitColliderClientRpc(ownerID, impactPos, isEnderPearl, impactPower, removeAtIndex, oldOwnerPos); } } } [ServerRpc(RequireOwnership = false)] private void OnThrowableHitColliderServerRpc(int ownerID, Vector3 impactPos, bool isEnderPearl, int impactPower, int removeAtIndex, Vector3 oldOwnerPos, NetworkObjectReference hitNOR) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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(2860864751u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, ownerID); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref impactPos); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isEnderPearl, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, impactPower); BytePacker.WriteValueBitPacked(val2, removeAtIndex); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref oldOwnerPos); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref hitNOR, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2860864751u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; OnThrowableHitColliderClientRpc(ownerID, impactPos, isEnderPearl, impactPower, removeAtIndex, oldOwnerPos, hitNOR); } } } [ClientRpc] private void OnThrowableHitColliderClientRpc(int ownerId, Vector3 impactPos, bool isEnderPearl, int impactPower, int removeAtIndex, Vector3 oldOwnerPos) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015f: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1006837502u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, ownerId); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref impactPos); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isEnderPearl, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, impactPower); BytePacker.WriteValueBitPacked(val2, removeAtIndex); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref oldOwnerPos); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1006837502u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if (ownerId != (int)GameNetworkManager.Instance.localPlayerController.playerClientId) { PlayerControllerB ownerPlayer = null; if (ownerId >= 0 && ownerId < StartOfRound.Instance.allPlayerScripts.Length) { ownerPlayer = StartOfRound.Instance.allPlayerScripts[ownerId]; } OnThrowableHitColliderLocal(ownerPlayer, impactPos, isEnderPearl, impactPower, removeAtIndex, oldOwnerPos); } } [ClientRpc] private void OnThrowableHitColliderClientRpc(int ownerId, Vector3 impactPos, bool isEnderPearl, int impactPower, int removeAtIndex, Vector3 oldOwnerPos, NetworkObjectReference hitNOR) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(14753856u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, ownerId); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref impactPos); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isEnderPearl, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, impactPower); BytePacker.WriteValueBitPacked(val2, removeAtIndex); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref oldOwnerPos); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref hitNOR, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 14753856u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if (ownerId != (int)GameNetworkManager.Instance.localPlayerController.playerClientId) { PlayerControllerB ownerPlayer = null; if (ownerId >= 0 && ownerId < StartOfRound.Instance.allPlayerScripts.Length) { ownerPlayer = StartOfRound.Instance.allPlayerScripts[ownerId]; } NetworkObject hitNetObj = default(NetworkObject); if (((NetworkObjectReference)(ref hitNOR)).TryGet(ref hitNetObj, (NetworkManager)null)) { OnThrowableHitColliderLocal(ownerPlayer, impactPos, isEnderPearl, impactPower, removeAtIndex, oldOwnerPos, hitNetObj); } else { OnThrowableHitColliderLocal(ownerPlayer, impactPos, isEnderPearl, impactPower, removeAtIndex, oldOwnerPos); } } } private static void OnThrowableHitColliderLocal(PlayerControllerB ownerPlayer, Vector3 impactPos, bool isEnderPearl, int impactPower, int removeAtIndex, Vector3 oldOwnerPos, NetworkObject hitNetObj = null) { //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: 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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0234: 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_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) RemoveProjectile(removeAtIndex); if (isEnderPearl && (Object)(object)ownerPlayer != (Object)null) { InstantiateNewTeleportVFX(0.33f, oldOwnerPos + Vector3.up * 1f, impactPos + Vector3.up * 1f); ownerPlayer.TeleportPlayer(impactPos, false, 0f, false, true); Bounds bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds; ownerPlayer.isInHangarShipRoom = ((Bounds)(ref bounds)).Contains(impactPos); ownerPlayer.isInsideFactory = impactPos.y < -80f; int num = (ownerPlayer.isInHangarShipRoom ? 3 : (ownerPlayer.isInsideFactory ? 2 : 0)); AudioReverbPresets val = Object.FindAnyObjectByType<AudioReverbPresets>((FindObjectsInactive)0); if ((Object)(object)val != (Object)null) { val.audioPresets[num].ChangeAudioReverbForPlayer(ownerPlayer); } if ((Object)(object)ownerPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController) { TimeOfDay.Instance.SetInsideLightingDimness(false, false); ownerPlayer.DamagePlayer(25, true, true, (CauseOfDeath)16, 0, true, default(Vector3)); } } bool flag = false; Vector3 audioPosition = impactPos; if ((Object)(object)hitNetObj != (Object)null) { Vector3 val2 = (Vector3.Normalize(((Component)hitNetObj).transform.position - new Vector3(impactPos.x, ((Component)hitNetObj).transform.position.y, impactPos.z)) * 5f + Vector3.up * 10f) * Mathf.Max(1f, (float)impactPower * 0.6f); PlayerControllerB component = ((Component)hitNetObj).GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null) { if (component.isPlayerControlled && (Object)(object)component != (Object)(object)ownerPlayer) { flag = true; audioPosition = component.playerEye.position; if ((Object)(object)component == (Object)(object)GameNetworkManager.Instance.localPlayerController) { component.DamagePlayer(10 * impactPower, false, true, (CauseOfDeath)1, 0, false, val2); component.externalForceAutoFade += val2; } } } else { EnemyAI component2 = ((Component)hitNetObj).GetComponent<EnemyAI>(); if ((Object)(object)component2 != (Object)null) { if (!component2.isEnemyDead) { flag = true; audioPosition = component2.eye.position; if ((Object)(object)ownerPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController) { component2.HitEnemyOnLocalClient(impactPower, val2, ownerPlayer, false, -1); } } } else { IHittable componentInChildren = ((Component)hitNetObj).GetComponentInChildren<IHittable>(); if (componentInChildren != null && (Object)(object)ownerPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController) { flag = false; componentInChildren.Hit(impactPower, val2, ownerPlayer, true, -1); } } } } if (isEnderPearl) { PlayAudioAtLocation(allAssets.teleportSFX[GetRandomNumber(allAssets.teleportSFX.Length)], impactPos, audible: true, 7.5f); } else { InstantiateNewBreakVFX(impactPos, Color.white); } if (flag) { PlayAudioAtLocation(allAssets.playerHitSFX, audioPosition, audible: false, 15f, 1f); } } public static PlacedBlockProp GetBlockAtPosition(Vector3 position, float range = 0.45f) { //IL_0000: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) if (Physics.OverlapSphereNonAlloc(position, range, tempBlockColliders, LayerMask.op_Implicit(Instance.blockSelfMask), (QueryTriggerInteraction)1) == 0) { return null; } for (int i = 0; i < tempBlockColliders.Length; i++) { if (!((Object)(object)tempBlockColliders[i] == (Object)null) && Vector3.Distance(position, ((Component)tempBlockColliders[i]).transform.position) == 0f) { PlacedBlockProp component = ((Component)tempBlockColliders[i]).GetComponent<PlacedBlockProp>(); if ((Object)(object)component != (Object)null) { return component; } } } return null; } public static bool GetBlocksInRange(Vector3 position, float range) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < tempBlocksArray.Length; i++) { tempBlocksArray[i] = null; } for (int j = 0; j < tempBlockColliders.Length; j++) { tempBlockColliders[j] = null; } if (Physics.OverlapSphereNonAlloc(position, range, tempBlockColliders, LayerMask.op_Implicit(Instance.blockSelfMask), (QueryTriggerInteraction)1) == 0) { return false; } int num = 0; for (int k = 0; k < tempBlockColliders.Length; k++) { if ((Object)(object)tempBlockColliders[k] == (Object)null) { continue; } PlacedBlockProp component = ((Component)tempBlockColliders[k]).GetComponent<PlacedBlockProp>(); if ((Object)(object)component != (Object)null) { tempBlocksArray[num] = component; num++; if (num >= tempBlocksArray.Length) { break; } } } return num > 0; } public static bool PlaceBlockAtPosition(BlockItem blockUsed, RaycastHit rayHit, PlayerControllerB playerUsing) { //IL_0068: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Instance == (Object)null || (Object)(object)blockUsed == (Object)null || (Object)(object)blockUsed.blockData == (Object)null || (Object)(object)blockUsed.blockData.blockPlaceablePrefab == (Object)null) { return false; } int newAmount = 0; int blockScrapValue = 1; IMinecraftItem component = ((Component)blockUsed).GetComponent<IMinecraftItem>(); if (component != null) { newAmount = component.stackAmount - 1; blockScrapValue = Mathf.Max(1, ((GrabbableObject)blockUsed).scrapValue / (component.stackAmount + 1)); } Vector3 val = ((RaycastHit)(ref rayHit)).point + ((RaycastHit)(ref rayHit)).normal * 0.5f; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor((float)Mathf.RoundToInt(val.x), (float)Mathf.RoundToInt(val.y), (float)Mathf.RoundToInt(val.z)); if ((Object)(object)GetBlockAtPosition(val2) != (Object)null) { return false; } if (Physics.OverlapSphereNonAlloc(val2, 0.5f, RoundManager.Instance.tempColliderResults, LayerMask.op_Implicit(Instance.invalidateBlockMask), (QueryTriggerInteraction)2) > 0) { return false; } int playerUsingID = -1; if ((Object)(object)playerUsing != (Object)null) { playerUsingID = (int)playerUsing.playerClientId; } PlaceBlockAtPositionLocal(blockUsed, val2, newAmount, blockScrapValue, playerUsing); Instance.PlaceBlockAtPositionServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId, NetworkObjectReference.op_Implicit(((NetworkBehaviour)blockUsed).NetworkObject), playerUsingID, val2, newAmount, blockScrapValue); return true; } [ServerRpc(RequireOwnership = false)] private void PlaceBlockAtPositionServerRpc(int playerID, NetworkObjectReference itemNOR, int playerUsingID, Vector3 placePos, int newAmount, int blockScrapValue) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0126: 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(2815546520u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref itemNOR, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, playerUsingID); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref placePos); BytePacker.WriteValueBitPacked(val2, newAmount); BytePacker.WriteValueBitPacked(val2, blockScrapValue); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2815546520u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; PlaceBlockAtPositionClientRpc(playerID, itemNOR, playerUsingID, placePos, newAmount, blockScrapValue); } } } [ClientRpc] private void PlaceBlockAtPositionClientRpc(int playerID, NetworkObjectReference itemNOR, int playerUsingID, Vector3 placePos, int newAmount, int blockScrapValue) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0176: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(980646091u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref itemNOR, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, playerUsingID); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref placePos); BytePacker.WriteValueBitPacked(val2, newAmount); BytePacker.WriteValueBitPacked(val2, blockScrapValue); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 980646091u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if (playerID == (int)GameNetworkManager.Instance.localPlayerController.playerClientId) { return; } PlayerControllerB playerUsing = null; if (playerUsingID >= 0 && playerUsingID < StartOfRound.Instance.allPlayerScripts.Length) { playerUsing = StartOfRound.Instance.allPlayerScripts[playerUsingID]; } NetworkObject val3 = default(NetworkObject); if (((NetworkObjectReference)(ref itemNOR)).TryGet(ref val3, (NetworkManager)null)) { BlockItem component = ((Component)val3).GetComponent<BlockItem>(); if (!((Object)(object)component == (Object)null)) { PlaceBlockAtPositionLocal(component, placePos, newAmount, blockScrapValue, playerUsing); } } } private static PlacedBlockProp PlaceBlockAtPositionLocal(BlockItem blockUsed, Vector3 placePos, int newAmount, int blockScrapValue, PlayerControllerB playerUsing = null, bool visualEffects = true, int overrideStartingHealth = -1) { //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)blockUsed == (Object)null || (Object)(object)blockUsed.blockData == (Object)null || (Object)(object)blockUsed.blockData.blockPlaceablePrefab == (Object)null) { return null; } Transform val = null; if ((Object)(object)StartOfRound.Instance != (Object)null && (Object)(object)StartOfRound.Instance.shipInnerRoomBounds != (Object)null) { Bounds bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds; if (((Bounds)(ref bounds)).Contains(placePos)) { if (StartOfRound.Instance.inShipPhase || StartOfRound.Instance.shipHasLanded) { AnimatorStateInfo currentAnimatorStateInfo = StartOfRound.Instance.shipAnimator.GetCurrentAnimatorStateInfo(0); if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).tagHash == Animator.StringToHash("ShipIdle")) { val = StartOfRound.Instance.elevatorTransform; goto IL_013a; } } if ((Object)(object)playerUsing != (Object)null && (Object)(object)playerUsing == (Object)(object)GameNetworkManager.Instance.localPlayerController && !Instance.givenInvalidPlaceInShipWarning && (Object)(object)HUDManager.Instance != (Object)null) { Instance.givenInvalidPlaceInShipWarning = true; HUDManager.Instance.DisplayTip("LCEndermanMod", "Can't place blocks inside the ship while it is leaving or landing.", false, false, "LC_Tip1"); } return null; } } if ((Object)(object)RoundManager.Instance.mapPropsContainer != (Object)null) { val = RoundManager.Instance.mapPropsContainer.transform; } goto IL_013a; IL_013a: GameObject val2 = Object.Instantiate<GameObject>(blockUsed.blockData.blockPlaceablePrefab, placePos, Quaternion.identity, val); if ((Object)(object)val2 == (Object)null) { return null; } PlacedBlockProp component = val2.GetComponent<PlacedBlockProp>(); if ((Object)(object)component == (Object)null) { Object.Destroy((Object)(object)val2); return null; } component.blockProperties = blockUsed.blockData; component.placedItemValue = blockScrapValue; UpdateBlockHealthLocal(component, (overrideStartingHealth != -1) ? overrideStartingHealth : component.blockProperties.startingHealth, spawnItemOnDestroy: false); if (!SetStackableAmount((GrabbableObject)(object)blockUsed, newAmount, addOrSnap: false, ((GrabbableObject)blockUsed).scrapValue - blockScrapValue) && (Object)(object)playerUsing != (Object)null) { playerUsing.activatingItem = true; if (visualEffects) { playerUsing.playerBodyAnimator.SetBool("cancelHolding", true); playerUsing.playerBodyAnimator.SetBool("Grab", true); playerUsing.playerBodyAnimator.SetBool("GrabValidated", true); } } if (visualEffects) { PlayAudioAtLocation(blockUsed.blockData.placeSFX, placePos); } if ((Object)(object)Instance != (Object)null && (Object)(object)playerUsing != (Object)null) { ((MonoBehaviour)Instance).StartCoroutine(Instance.PlaceBlockDelayedFunctionality(playerUsing)); } return component; } private static PlacedBlockProp PlaceBlockAtPositionLocal(BlockData blockPlaced, Vector3 placePos, int blockScrapValue, PlayerControllerB playerUsing = null, bool visualEffects = true, int overrideStartingHealth = -1) { //IL_012b: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)blockPlaced == (Object)null || (Object)(object)blockPlaced.blockPlaceablePrefab == (Object)null) { return null; } Transform val = null; if ((Object)(object)StartOfRound.Instance != (Object)null && (Object)(object)StartOfRound.Instance.shipInnerRoomBounds != (Object)null) { Bounds bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds; if (((Bounds)(ref bounds)).Contains(placePos)) { if (StartOfRound.Instance.inShipPhase || StartOfRound.Instance.shipHasLanded) { AnimatorStateInfo currentAnimatorStateInfo = StartOfRound.Instance.shipAnimator.GetCurrentAnimatorStateInfo(0); if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).tagHash == Animator.StringToHash("ShipIdle")) { val = StartOfRound.Instance.elevatorTransform; goto IL_0125; } } if ((Object)(object)playerUsing != (Object)null && (Object)(object)playerUsing == (Object)(object)GameNetworkManager.Instance.localPlayerController && !Instance.givenInvalidPlaceInShipWarning && (Object)(object)HUDManager.Instance != (Object)null) { Instance.givenInvalidPlaceInShipWarning = true; HUDManager.Instance.DisplayTip("LCEndermanMod", "Can't place blocks inside the ship while it is leaving or landing.", false, false, "LC_Tip1"); } return null; } } if ((Object)(object)RoundManager.Instance.mapPropsContainer != (Object)null) { val = RoundManager.Instance.mapPropsContainer.transform; } goto IL_0125; IL_0125: GameObject val2 = Object.Instantiate<GameObject>(blockPlaced.blockPlaceablePrefab, placePos, Quaternion.identity, val); if ((Object)(object)val2 == (Object)null) { return null; } PlacedBlockProp component = val2.GetComponent<PlacedBlockProp>(); if ((Object)(object)component == (Object)null) { Object.Destroy((Object)(object)val2); return null; } component.blockProperties = blockPlaced; component.placedItemValue = blockScrapValue; UpdateBlockHealthLocal(component, (overrideStartingHealth != -1) ? overrideStartingHealth : component.blockProperties.startingHealth, spawnItemOnDestroy: false); if ((Object)(object)playerUsing != (Object)null) { playerUsing.activatingItem = true; if (visualEffects) { playerUsing.playerBodyAnimator.SetBool("cancelHolding", true); playerUsing.playerBodyAnimator.SetBool("Grab", true); playerUsing.playerBodyAnimator.SetBool("GrabValidated", true); } } if (visualEffects) { PlayAudioAtLocation(blockPlaced.placeSFX, placePos); } if ((Object)(object)Instance != (Object)null && (Object)(object)playerUsing != (Object)null) { ((MonoBehaviour)Instance).StartCoroutine(Instance.PlaceBlockDelayedFunctionality(playerUsing)); } return component; } private IEnumerator PlaceBlockDelayedFunctionality(PlayerControllerB playerUsing) { yield return (object)new WaitForSeconds(0.33f); if ((Object)(object)playerUsing != (Object)null) { playerUsing.activatingItem = false; playerUsing.playerBodyAnimator.SetBool("cancelHolding", false); } } public static GrabbableObject UpdateBlockHealth(PlacedBlockProp block, int change, bool subtractOrSnap, bool spawnItemOnDestroy) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)block == (Object)null || (Object)(object)Instance == (Object)null || (subtractOrSnap && change == 0) || block.health == -999) { return null; } int num = 0; num = ((!subtractOrSnap) ? change : (block.health - change)); GrabbableObject result = UpdateBlockHealthLocal(block, num, spawnItemOnDestroy); Instance.UpdateBlockHealthServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId, ((Component)block).transform.position, num, spawnItemOnDestroy); return result; } [ServerRpc(RequireOwnership = false)] private void UpdateBlockHealthServerRpc(int playerID, Vector3 blockPos, int newHealth, bool spawnItemOnDestroy) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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) 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(3105084376u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref blockPos); BytePacker.WriteValueBitPacked(val2, newHealth); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref spawnItemOnDestroy, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3105084376u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; UpdateBlockHealthClientRpc(playerID, blockPos, newHealth, spawnItemOnDestroy); } } } [ClientRpc] private void UpdateBlockHealthClientRpc(int playerID, Vector3 blockPos, int newHealth, bool spawnItemOnDestroy) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2073756241u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref blockPos); BytePacker.WriteValueBitPacked(val2, newHealth); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref spawnItemOnDestroy, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2073756241u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if (playerID != (int)GameNetworkManager.Instance.localPlayerController.playerClientId) { PlacedBlockProp blockAtPosition = GetBlockAtPosition(blockPos); if ((Object)(object)blockAtPosition != (Object)null) { UpdateBlockHealthLocal(blockAtPosition, newHealth, spawnItemOnDestroy); } } } private static GrabbableObject UpdateBlockHealthLocal(PlacedBlockProp block, int newHealth, bool spawnItemOnDestroy) { if ((Object)(object)block == (Object)null) { return null; } return block.SetHealth(newHealth, spawnItemOnDestroy); } private static void CheckEnemyNearBreakableBlocks() { //IL_0100: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_013d: 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) enemyBreakBlockTimer = 2f; RoundManager instance = RoundManager.Instance; if ((Object)(object)instance == (Object)null || instance.SpawnedEnemies == null || instance.SpawnedEnemies.Count == 0 || (Object)(object)Instance == (Object)null || !((NetworkBehaviour)Instance).IsServer) { return; } enemyBreakBlockTimer = Mathf.Lerp(enemyBreakBlockTimer, 0.2f, (instance.currentEnemyPower + instance.currentOutsideEnemyPower) / (instance.currentMaxInsidePower + instance.currentMaxOutsidePower)); checkEnemyIndex++; if (checkEnemyIndex >= instance.SpawnedEnemies.Count) { checkEnemyIndex = 0; } EnemyAI val = instance.SpawnedEnemies[checkEnemyIndex]; if ((Object)(object)val == (Object)null || val.isEnemyDead || (Object)(object)val.agent == (Object)null || val.stunNormalizedTimer > 0f || !val.ventAnimationFinished) { return; } EndermanAI component = ((Component)val).GetComponent<EndermanAI>(); if (!((Object)(object)component != (Object)null) || component.CanBeHit()) { Vector3 val2 = ((Component)val).transform.position + Vector3.up * val.agent.height * 0.33f; float range = val.agent.radius * 1.75f; if (GetBlocksInRange(val2, range)) { ((MonoBehaviour)Instance).StartCoroutine(Instance.BreakBlocksByEnemy(val, val2, range)); } } } private IEnumerator BreakBlocksByEnemy(EnemyAI enemy, Vector3 pos, float range) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)enemy == (Object)null) { yield break; } int explodedThisFrame = 0; for (int i = 0; i < tempBlocksArray.Length; i++) { explodedThisFrame++; if (explodedThisFrame >= 2) { explodedThisFrame = 0; yield return null; } PlacedBlockProp placedBlockProp = tempBlocksArray[i]; if ((Object)(object)placedBlockProp == (Object)null || placedBlockProp.health <= 0) { continue; } if (StartOfRound.Instance.hangarDoorsClosed) { Bounds bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds; if (((Bounds)(ref bounds)).Contains(((Component)placedBlockProp).transform.position)) { bounds = StartOfRound.Instance.shipStrictInnerRoomBounds.bounds; if (!((Bounds)(ref bounds)).Contains(pos)) { continue; } } } int num = (int)enemy.enemyType.PowerLevel; if (enemy.enemyType.PowerLevel % 1f != 0f) { num = (int)(enemy.enemyType.PowerLevel + 1f); } num++; if (Application.isEditor) { Logger.LogDebug((object)$"CheckEnemyNearBreakableBlocks(): ENEMY {enemy} #{enemy.thisEnemyIndex} damaging BLOCK {placedBlockProp} at TRANSFORM {((Component)placedBlockProp).transform.position} with POWER {num} after checking from POSITION {pos} and RADIUS {range} from DISTANCE {Vector3.Distance(pos, ((Component)placedBlockProp).transform.position)}"); } UpdateBlockHealth(placedBlockProp, num, subtractOrSnap: true, spawnItemOnDestroy: false); } } public static void CheckExplosionNearBreakableBlocks(Vector3 explosionPosition, float killRange, float damageRange, int nonLethalDamage) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Instance == (Object)null) && ((NetworkBehaviour)Instance).IsServer) { ((MonoBehaviour)Instance).StartCoroutine(Instance.BreakBlocksByExplosion(explosionPosition, killRange, damageRange, nonLethalDamage)); } } private IEnumerator BreakBlocksByExplosion(Vector3 explosionPosition, float killRange, float damageRange, int nonLethalDamage) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (!GetBlocksInRange(explosionPosition, damageRange)) { yield break; } int explodedThisFrame = 0; for (int i = 0; i < tempBlocksArray.Length; i++) { explodedThisFrame++; if (explodedThisFrame >= 2) { explodedThisFrame = 0; yield return null; } PlacedBlockProp placedBlockProp = tempBlocksArray[i]; if ((Object)(object)placedBlockProp == (Object)null || placedBlockProp.health <= 0 || (Object)(object)placedBlockProp.blockProperties == (Object)null) { continue; } if (StartOfRound.Instance.hangarDoorsClosed) { Bounds bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds; if (((Bounds)(ref bounds)).Contains(((Component)placedBlockProp).transform.position)) { bounds = StartOfRound.Instance.shipStrictInnerRoomBounds.bounds; if (!((Bounds)(ref bounds)).Contains(explosionPosition)) { continue; } } } float num = Vector3.Distance(((Component)placedBlockProp).transform.position, explosionPosition); float num2 = 1.33f - num / damageRange; if (num < killRange) { float num3 = 10f * num2 - placedBlockProp.blockProperties.blastResistance; if (num3 >= 1f) { int num4 = (int)num3; if (Application.isEditor) { Logger.LogDebug((object)$"ExplodeBlocksNearPosition(): BIG explosion damage to BLOCK {placedBlockProp} at TRANSFORM {((Component)placedBlockProp).transform.position} which has RESISTANCE {placedBlockProp.blockProperties.blastResistance} with POWER {num4} after checking from POSITION {explosionPosition} and RANGE {killRange} with DAMAGE 10.0f from DISTANCE {num} using NORMALIZED {num2}"); } UpdateBlockHealth(placedBlockProp, num4, subtractOrSnap: true, spawnItemOnDestroy: false); } } else { if (!(num < damageRange)) { continue; } float num5 = (float)nonLethalDamage / 10f * num2 - placedBlockProp.blockProperties.blastResistance; if (num5 >= 1f) { int num6 = (int)num5; if (Application.isEditor) { Logger.LogDebug((object)$"ExplodeBlocksNearPosition(): SMALL explosion damage to BLOCK {placedBlockProp} at TRANSFORM {((Component)placedBlockProp).transform.position} which has RESISTANCE {placedBlockProp.blockProperties.blastResistance} with POWER {num6} after checking from POSITION {explosionPosition} and RANGE {damageRange} with DAMAGE {nonLethalDamage} from DISTANCE {num} using NORMALIZED {num2}"); } UpdateBlockHealth(placedBlockProp, num6, subtractOrSnap: true, spawnItemOnDestroy: false); } } } } public static bool SetStackableAmount(GrabbableObject onItem, int change, bool addOrSnap, int overrideScrapValue = -1, int destroyAtAndBelowAmount = 0) { if ((Object)(object)onItem == (Object)null) { return false; } IMinecraftItem component = ((Component)onItem).GetComponent<IMinecraftItem>(); if (component == null) { return false; } if (addOrSnap) { component.stackAmount += change; } else { component.stackAmount = change; } if (component.stackAmount <= destroyAtAndBelowAmount) { DestroyItem(onItem); return true; } SetStackableUICounter(onItem); if (onItem.isHeld && !onItem.isPocketed) { AddHalveStackToControlTips(onItem); } if (overrideScrapValue != -1) { onItem.SetScrapValue(overrideScrapValue); } SetMinecraftBlockVisualizer(onItem); return false; } public static void SetMinecraftBlockVisualizer(GrabbableObject onItem) { if ((Object)(object)onItem == (Object)null || (Object)(object)onItem.itemProperties == (Object)null) { return; } IMinecraftItem component = ((Component)onItem).GetComponent<IMinecraftItem>(); if (component == null) { return; } if ((Object)(object)component.stackedItemVisualizer != (Object)null) { ((Renderer)component.stackedItemVisualizer).enabled = !onItem.isHeld && !onItem.isHeldByEnemy && !onItem.isPocketed && !onItem.deactivated && component.stackAmount > 1 && (Object)(object)onItem.playerHeldBy == (Object)null && (Object)(object)onItem.parentObject == (Object)null; } if ((Object)(object)component.scanNode != (Object)null) { if (component.stackAmount <= 1) { component.scanNode.headerText = onItem.itemProperties.itemName ?? ""; } else { BlockItem component2 = ((Component)onItem).GetComponent<BlockItem>(); if ((Object)(object)component2 != (Object)null && (Object)(object)component2.blockData != (Object)null) { if (!string.IsNullOrEmpty(component2.blockData.pluralItemName)) { component.scanNode.headerText = $"{component.stackAmount} {component2.blockData.pluralItemName}"; } else { component.scanNode.headerText = $"{component.stackAmount} {onItem.itemProperties.itemName}"; } } else if (!string.IsNullOrEmpty(onItem.itemProperties.pocketAnim)) { component.scanNode.headerText = $"{component.stackAmount} {onItem.itemProperties.pocketAnim}"; } else { component.scanNode.headerText = $"{component.stackAmount} {onItem.itemProperties.itemName}"; } } } if ((Object)(object)component.idleItemAnimator != (Object)null) { component.idleItemAnimator.SetBool("OnGround", !onItem.isHeld && !onItem.isHeldByEnemy && !onItem.isPocketed && !onItem.deactivated && (Object)(object)onItem.playerHeldBy == (Object)null && (Object)(object)onItem.parentObject == (Object)null); } } public static void AddHalveStackToControlTips(GrabbableObject forItem) { if ((Object)(object)HUDManager.Instance == (Object)null || (Object)(object)forItem == (Object)null || (Object)(object)forItem.itemProperties == (Object)null || (Object)(object)forItem.playerHeldBy == (Object)null || (Object)(object)forItem.playerHeldBy != (Object)(object)GameNetworkManager.Instance.localPlayerController) { return; } IMinecraftItem component = ((Component)forItem).GetComponent<IMinecraftItem>(); if (component != null) { HUDManager.Instance.ClearControlTips(); List<string> list = new List<string>(); if (forItem.itemProperties.toolTips != null && forItem.itemProperties.toolTips.Length != 0) { list.AddRange(forItem.itemProperties.toolTips); } if (component.stackAmount >= 2) { list.Add("Halve stack : [Q]"); } HUDManager.Instance.ChangeControlTipMultiple(list.ToArray(), forItem.isHeld, forItem.itemProperties); } } public static void RetagMinecraftBlockVisualizer(GrabbableObject onItem) { if (!((Object)(object)onItem == (Object)null) && !((Object)(object)onItem.itemProperties == (Object)null)) { IMinecraftItem component = ((Component)onItem).GetComponent<IMinecraftItem>(); if (component != null && !((Object)(object)component.stackedItemVisualizer == (Object)null)) { ((Component)component.stackedItemVisualizer).gameObject.tag = "DoNotSet"; } } } public static void SpawnCrosshair() { if ((Object)(object)StartOfRound.Instance == (Object)null || (Object)(object)((Component)StartOfRound.Instance).transform.parent == (Object)null || (Object)(object)((Component)StartOfRound.Instance).transform.parent.parent == (Object)null) { return; } Transform val = ((Component)StartOfRound.Instance).transform.parent.parent.Find("UI"); if (!((Object)(object)val == (Object)null)) { Canvas componentInChildren = ((Component)val).GetComponentInChildren<Canvas>(); if ((Object)(object)componentInChildren != (Object)null) { spawnedCrosshair = Object.Instantiate<GameObject>(allAssets.uiPrefabCrosshair, ((Component)componentInChildren).transform.GetChild(0)); } SetCrosshairVisibility(); } } public static void SetCrosshairVisibility() { if (!((Object)(object)spawnedCrosshair == (Object)null) && !((Object)(object)StartOfRound.Instance == (Object)null) && !((Object)(object)StartOfRound.Instance.localPlayerController == (Object)null)) { PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; GrabbableObject val = null; if (localPlayerController.currentItemSlot == 50) { val = localPlayerController.ItemOnlySlot; } else if (localPlayerController.currentItemSlot >= 0 && localPlayerController.currentItemSlot < localPlayerController.ItemSlots.Length) { val = localPlayerController.ItemSlots[localPlayerController.currentItemSlot]; } spawnedCrosshair.SetActive(localPlayerController.isPlayerControlled && (Object)(object)val != (Object)null && (Object)(object)((Component)val).GetComponent<BlockItem>() != (Object)null); } } public static void SetStackableUICounter(GrabbableObject forItem) { if ((Object)(object)forItem == (Object)null || (Object)(object)forItem.playerHeldBy == (Object)null || (Object)(object)forItem.playerHeldBy != (Object)(object)GameNetworkManager.Instance.localPlayerController || forItem.playerHeldBy.ItemSlots == null || (Object)(object)HUDManager.Instance == (Object)null || HUDManager.Instance.itemSlotIcons == null) { return; } IMinecraftItem component = ((Component)forItem).GetComponent<IMinecraftItem>(); if (component == null) { return; } Transform val = null; if ((Object)(object)forItem.playerHeldBy.ItemOnlySlot != (Object)null && (Object)(object)forItem.playerHeldBy.ItemOnlySlot == (Object)(object)forItem && (Object)(object)HUDManager.Instance.itemOnlySlotIcon != (Object)null) { val = ((Component)HUDManager.Instance.itemOnlySlotIcon).transform; } if ((Object)(object)val == (Object)null) { for (int i = 0; i < forItem.playerHeldBy.ItemSlots.Length; i++) { if (!((Object)(object)forItem.playerHeldBy.ItemSlots[i] == (Object)null) && !((Object)(object)forItem.playerHeldBy.ItemSlots[i] != (Object)(object)forItem) && i >= 0 && i < HUDManager.Instance.itemSlotIcons.Length && !((Object)(object)HUDManager.Instance.itemSlotIcons[i] == (Object)null)) { val = ((Component)HUDManager.Instance.itemSlotIcons[i]).transform; } } } if ((Object)(object)val == (Object)null) { return; } UIElement componentInChildren = ((Component)val).GetComponentInChildren<UIElement>(); if ((Object)(object)componentInChildren == (Object)null) { componentInChildren = Object.Instantiate<GameObject>(allAssets.uiPrefabStackCount, val).GetComponent<UIElement>(); if ((Object)(object)componentInChildren != (Object)null) { if (component.stackAmount <= 1) { ((TMP_Text)componentInChildren.textField).text = null; } else { ((TMP_Text)componentInChildren.textField).text = component.stackAmount.ToString(); } } } else if (component.stackAmount <= 1) { Object.Destroy((Object)(object)((Component)componentInChildren).gameObject); } else { ((TMP_Text)componentInChildren.textField).text = component.stackAmount.ToString(); } } public static void DestroyUnusedStackableUICounters(PlayerControllerB inventoryOf) { if ((Object)(object)inventoryOf == (Object)null || (Object)(object)inventoryOf != (Object)(object)GameNetworkManager.Instance.localPlayerController || inventoryOf.ItemSlots == null || (Object)(object)HUDManager.Instance == (Object)null || HUDManager.Instance.itemSlotIcons == null) { return; } for (int i = 0; i < inventoryOf.ItemSlots.Length; i++) { if (i >= 0 && i < HUDManager.Instance.itemSlotIcons.Length && !((Object)(object)HUDManager.Instance.itemSlotIcons[i] == (Object)null) && (!((Object)(object)inventoryOf.ItemSlots[i] != (Object)null) || ((Component)inventoryOf.ItemSlots[i]).GetComponent<IMinecraftItem>() == null)) { UIElement componentInChildren = ((Component)HUDManager.Instance.itemSlotIcons[i]).GetComponentInChildren<UIElement>(); if ((Object)(object)componentInChildren != (Object)null) { Object.Destroy((Object)(object)((Component)componentInChildren).gameObject); } } } if ((Object)(object)inventoryOf.ItemOnlySlot != (Object)null && ((Component)inventoryOf.ItemOnlySlot).GetComponent<IMinecraftItem>() == null && (Object)(object)HUDManager.Instance.itemOnlySlotIcon != (Object)null) { UIElement componentInChildren2 = ((Component)HUDManager.Instance.itemOnlySlotIcon).GetComponentInChildren<UIElement>(); if ((Object)(object)componentInChildren2 != (Object)null) { Object.Destroy((Object)(object)((Component)componentInChildren2).gameObject); } } } public static void StackItem(GrabbableObject newlyPickedUpItem) { if ((Object)(object)Instance != (Object)null && (Object)(object)newlyPickedUpItem != (Object)null && (Object)(object)newlyPickedUpItem.itemProperties != (Object)null && ((NetworkBehaviour)newlyPickedUpItem).IsOwner) { ((MonoBehaviour)Instance).StartCoroutine(Instance.StackItemsOnDelay(newlyPickedUpItem, newlyPickedUpItem.playerHeldBy)); } } private IEnumerator StackItemsOnDelay(GrabbableObject newlyPickedUpItem, PlayerControllerB playerStacking) { if ((Object)(object)playerStacking == (Object)null || (Object)(object)newlyPickedUpItem == (Object)null || (Object)(object)newlyPickedUpItem.itemProperties == (Object)null) { Logger.LogDebug((object)$"StackItem() - A: null playerStacking ({playerStacking}) or null newlyPickedUpItem ({newlyPickedUpItem}), breaking"); yield break; } IMinecraftItem newItemInterface = ((Component)newlyPickedUpItem).GetComponent<IMinecraftItem>(); if (newItemInterface == null) { Logger.LogDebug((object)"StackItem() - B: null IMinecraftItem, breaking"); yield break; } IMinecraftItem stackOnInterface = null; Logger.LogDebug((object)$"StackItem() - C: playerStacking ({playerStacking}) // newlyPickedUpItem ({newlyPickedUpItem})"); playerStacking.activatingItem = true; yield return (object)new WaitForSeconds(0.25f); GrabbableObject val = null; for (int i = 0; i < playerStacking.ItemSlots.Length; i++) { GrabbableObject val2 = playerStacking.ItemSlots[i]; if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2 == (Object)(object)newlyPickedUpItem) && !((Object)(object)val2.itemProperties == (Object)null)) { IMinecraftItem component = ((Component)val2).GetComponent<IMinecraftItem>(); if (component != null && component.stackAmount < component.maxAmountStackable && (Object)(object)val2.itemProperties == (Object)(object)newlyPickedUpItem.itemProperties) { val = val2; stackOnInterface = component; Logger.LogDebug((object)$"OTHER {((Object)val2).name} #{((NetworkBehaviour)val2).NetworkObjectId} found NORMAL {((Object)newlyPickedUpItem).name} #{((NetworkBehaviour)this).NetworkObjectId}"); break; } } } if ((Object)(object)val == (Object)null) { GrabbableObject itemOnlySlot = playerStacking.ItemOnlySlot; if ((Object)(object)itemOnlySlot != (Object)null && (Object)(object)itemOnlySlot != (Object)(object)newlyPickedUpItem && (Object)(object)itemOnlySlot.itemProperties != (Object)null) { IMinecraftItem component2 = ((Component)itemOnlySlot).GetComponent<IMinecraftItem>(); if (component2 != null && component2.stackAmount < component2.maxAmountStackable && (Object)(object)itemOnlySlot.itemProperties == (Object)(object)newlyPickedUpItem.itemProperties) { val = itemOnlySlot; stackOnInterface = component2; Logger.LogDebug((object)$"OTHER {((Object)itemOnlySlot).name} #{((NetworkBehaviour)itemOnlySlot).NetworkObjectId} found BELT {((Object)newlyPickedUpItem).name} #{((NetworkBehaviour)this).NetworkObjectId}"); } } } if ((Object)(object)val != (Object)null && stackOnInterface != null) { int num = newItemInterface.stackAmount; int num2 = stackOnInterface.stackAmount + num; int newlyPickedUpAmount = newItemInterface.stackAmount - num; if (num2 > stackOnInterface.maxAmountStackable) { num = stackOnInterface.maxAmountStackable - stackOnInterface.stackAmount; num2 = stackOnInterface.stackAmount + num; newlyPickedUpAmount = newItemInterface.stackAmount - nu