using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading.Tasks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Dawn; using GameNetcodeStuff; using HarmonyLib; using InjectionLibrary.Attributes; using LethalLevelLoader; using MelanieMeliciousCraft.NetcodePatcher; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: RequiresInjections] [assembly: AssemblyTitle("MelanieMeliciousCraft")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("MelanieMelicious")] [assembly: AssemblyProduct("Melanie Crafting Progression Core")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] [CompilerGenerated] internal sealed class <>z__ReadOnlyArray : IEnumerable, ICollection, IList, IEnumerable, IReadOnlyCollection, IReadOnlyList, ICollection, IList { int ICollection.Count => _items.Length; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection.Count => _items.Length; T IReadOnlyList.this[int index] => _items[index]; int ICollection.Count => _items.Length; bool ICollection.IsReadOnly => true; T IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyArray(T[] items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { ((ICollection)_items).CopyTo(array, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return ((IList)_items).Contains(value); } int IList.IndexOf(object value) { return ((IList)_items).IndexOf(value); } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.Add(T item) { throw new NotSupportedException(); } void ICollection.Clear() { throw new NotSupportedException(); } bool ICollection.Contains(T item) { return ((ICollection)_items).Contains(item); } void ICollection.CopyTo(T[] array, int arrayIndex) { ((ICollection)_items).CopyTo(array, arrayIndex); } bool ICollection.Remove(T item) { throw new NotSupportedException(); } int IList.IndexOf(T item) { return ((IList)_items).IndexOf(item); } void IList.Insert(int index, T item) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } internal static class MelanieCraftCfg { internal static ConfigEntry workbench0Cost; internal static ConfigEntry crucible0Cost; internal static ConfigEntry craftMin; internal static ConfigEntry craftMax; internal static ConfigEntry refineMin; internal static ConfigEntry refineMax; internal static ConfigEntry hammerList; internal static ConfigEntry sawList; internal static ConfigEntry axeList; internal static ConfigEntry ingredientList; internal static ConfigEntry logList; internal static ConfigEntry plankList; internal static ConfigEntry metalSheetList; internal static ConfigEntry metalBarList; internal static ConfigEntry goldMeltList; internal static ConfigEntry ironMeltList; internal static ConfigEntry aluminiumMeltList; internal static ConfigEntry brassMeltList; internal static ConfigEntry copperMeltList; internal static ConfigEntry paperScrapList; internal static ConfigEntry workbenchCraftList; internal static ConfigEntry crucibleCraftList; internal static ConfigEntry sawmillCraftList; internal static ConfigEntry crusherCraftList; internal static ConfigEntry rakeEnable; internal static ConfigEntry rakeDamage; internal static ConfigEntry rakeSpawn0; internal static ConfigEntry rakeSpawn1; internal static ConfigEntry rakeSpawn2; internal static ConfigEntry resource0Spawn; internal static ConfigEntry tool0Spawn; internal static ConfigEntry hammer0Spawn; internal static ConfigEntry saw0Spawn; internal static ConfigEntry axe0Spawn; internal static ConfigEntry hammer0Cost; internal static ConfigEntry saw0Cost; internal static ConfigEntry axe0Cost; internal static void SetupConfig(ConfigFile config) { workbench0Cost = config.Bind("Prices", "Workbench", 120, "Modify the price for the workbench."); crucible0Cost = config.Bind("Prices", "Crucible", 150, "Modify the price for the crucible."); craftMin = config.Bind("Item Value", "Crafting Value Minimum", 10f, "Multiplier handling changed. This is no longer used."); craftMax = config.Bind("Item Value", "Crafting Value Maximum MULTIPLIER", 0.25f, "Multiplier handling changed. This is no longer used."); refineMin = config.Bind("Item Value", "Refine Value Minimum", 0, "Multiplier handling changed. This is no longer used."); refineMax = config.Bind("Item Value", "Refine Value Maximum", 20, "Multiplier handling changed. This is no longer used."); hammerList = config.Bind("Custom Tools", "Works as Hammer", string.Empty, "This is hammer."); sawList = config.Bind("Custom Tools", "Works as Saw", string.Empty, "This is saw."); axeList = config.Bind("Custom Tools", "Works as Axe", string.Empty, "This item can chop down trees. (Not 100% drop rate!)"); ingredientList = config.Bind("Custom Ingredients", "Craft as Custom Ingredient", string.Empty, "This is [Custom Ingredient]. Format: Item0;IngredientID, Item1;IngredientID"); logList = config.Bind("Custom Ingredients", "Craft as Log", string.Empty, "This is log."); plankList = config.Bind("Custom Ingredients", "Craft as Plank", string.Empty, "This is plank."); metalSheetList = config.Bind("Custom Ingredients", "Craft as Metal Sheet", string.Empty, "This is metal sheet."); metalBarList = config.Bind("Custom Ingredients", "Craft as Metal Bar", string.Empty, "This is metal bar."); goldMeltList = config.Bind("Custom Ingredients", "Craft as Meltable Gold", string.Empty, "This is meltable as gold."); ironMeltList = config.Bind("Custom Ingredients", "Craft as Meltable Iron", string.Empty, "This is meltable as iron."); aluminiumMeltList = config.Bind("Custom Ingredients", "Craft as Meltable Aluminium", string.Empty, "This is meltable as aluminium."); brassMeltList = config.Bind("Custom Ingredients", "Craft as Meltable Brass", string.Empty, "This is meltable as brass."); copperMeltList = config.Bind("Custom Ingredients", "Craft as Meltable Copper", string.Empty, "This is meltable as copper."); paperScrapList = config.Bind("Custom Ingredients", "Recyclable to Paper", string.Empty, "This is paper scrap."); workbenchCraftList = config.Bind("Custom Crafting Recipes", "Custom Workbench Recipes", string.Empty, "Add custom recipes. \n Format: Product1|Product2 : ProductAmount : ToolID0|ToolID1 : IngredientID1;Amount|IngredientID2;Amount : Priority, [SecondRecipe] \n Examples: Aluminium Sheet : 0 : 50;1 : 5"); crucibleCraftList = config.Bind("Custom Crafting Recipes", "Custom Crucible Recipes", string.Empty, "Add custom recipes. \n Format: Product1|Product2 : ProductAmount : ToolID0|ToolID1 : IngredientID1;Amount|IngredientID2;Amount : Priority, [SecondRecipe] \n Examples: Aluminium Sheet : 0 : 50;1 : 5"); sawmillCraftList = config.Bind("Custom Crafting Recipes", "Custom Sawmill Recipes", string.Empty, "Add custom recipes. \n Format: Product1|Product2 : ProductAmount : ToolID0|ToolID1 : IngredientID1;Amount|IngredientID2;Amount : Priority, [SecondRecipe] \n Examples: Aluminium Sheet : 0 : 50;1 : 5"); crusherCraftList = config.Bind("Custom Crafting Recipes", "Custom Crusher Recipes", string.Empty, "Add custom recipes. \n Format: Product1|Product2 : ProductAmount : ToolID0|ToolID1 : IngredientID1;Amount|IngredientID2;Amount : Priority, [SecondRecipe] \n Examples: Aluminium Sheet : 0 : 50;1 : 5"); rakeEnable = config.Bind("Hazard Spawn", "Rake Traps Enabled", true, "Modify if rake traps spawn."); rakeDamage = config.Bind("Hazard Spawn", "Rake Trap Damage", 40, "Modify the damage for rake traps."); rakeSpawn0 = config.Bind("Hazard Spawn", "Rake Trap Global", 8, "Modify the weights for rake traps spawning on any moon."); rakeSpawn1 = config.Bind("Hazard Spawn", "Rake Trap By Tag", "canyon:4,marsh:10", "Modify the weights for rake traps spawning on moons with certain tags."); rakeSpawn2 = config.Bind("Hazard Spawn", "Rake Trap By Key", "Experimentation:5", "Modify the weights for rake traps spawning on moons by certain keys."); resource0Spawn = config.Bind("Scrap Spawn", "General Resource Global Spawns", 30, "Modify the weights for resources to spawn as scrap."); tool0Spawn = config.Bind("Scrap Spawn", "General Tool Global Spawns", 30, "Modify the weights for tools to spawn as scrap."); hammer0Spawn = config.Bind("Scrap Spawn", "Hammer Global Spawns", 40, "Modify the weights for hammers to spawn as scrap."); saw0Spawn = config.Bind("Scrap Spawn", "Saw Global Spawns", 30, "Modify the weights for saw to spawn as scrap."); axe0Spawn = config.Bind("Scrap Spawn", "Axe Global Spawns", 30, "Modify the weights for axe to spawn as scrap."); hammer0Cost = config.Bind("Store Setup", "Hammer Price", -1, "Modify the price for hammers in the store. Set -1 to not register into the store."); saw0Cost = config.Bind("Store Setup", "Saw Price", -1, "Modify the price for saws in the store. Set -1 to not register into the store."); axe0Cost = config.Bind("Store Setup", "Axe Price", -1, "Modify the price for axes in the store. Set -1 to not register into the store."); } } namespace MelMelCraft { public class Crafter : NetworkBehaviour { public List tools = new List(); public Transform spawnPos; public List recipeList; [SerializeField] private Animator anim; private int craftAnim = Animator.StringToHash("Craft"); public void Craft() { Craft(0); } public async void Craft(int delay) { List delete = new List(); List ingredients = new List(); int dishValue = 0; short iteration = 0; Ingredient ingredient = default(Ingredient); GrabbableObject item = default(GrabbableObject); foreach (Transform item2 in ((Component)this).transform) { Transform child = item2; if (((Component)child).TryGetComponent(ref ingredient) && ((Component)child).TryGetComponent(ref item)) { foreach (short type in ingredient.ingredient) { bool added = false; foreach (short[] heldType in ingredients) { if (heldType[0] == type) { heldType[1]++; added = true; break; } } if (!added) { ingredients.Add(new short[2] { type, 1 }); } } if (ingredient.consumable) { delete.Add(((Component)child).GetComponent()); dishValue += item.scrapValue; } iteration++; } ingredient = null; item = null; } if (iteration == 0) { return; } foreach (Recipe recipe in recipeList) { if (iteration < recipe.min || iteration > recipe.max) { continue; } bool added = true; short[] array = recipe.tools; foreach (short tool in array) { if (!tools.Contains(tool)) { added = false; break; } } if (!added) { continue; } short[][] ingredients2 = recipe.ingredients; foreach (short[] required in ingredients2) { added = false; foreach (short[] held in ingredients) { if (held[0] == required[0] && held[1] >= required[1]) { added = true; break; } } if (!added) { break; } } if (!added) { continue; } foreach (NetworkObject child2 in delete) { if ((Object)(object)child2 != (Object)null) { DeleteItemServerRpc(NetworkObjectReference.op_Implicit(child2)); } } if ((Object)(object)anim != (Object)null && anim.HasState(0, craftAnim)) { AnimServerRpc(); } await Task.Delay(delay, ((MonoBehaviour)this).destroyCancellationToken); for (int k = 0; k < recipe.quantity; k++) { SpawnItemServerRpc(Array.IndexOf(recipeList.ToArray(), recipe), (int)((float)dishValue + Random.Range((float)recipe.minValue, (float)dishValue * recipe.maxValue)) / recipe.quantity); } break; } } [ServerRpc(RequireOwnership = false)] internal void DeleteItemServerRpc(NetworkObjectReference netObj) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1677710912u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref netObj, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1677710912u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); if (((NetworkObjectReference)(ref netObj)).TryGet(ref val3, (NetworkManager)null)) { val3.Despawn(true); } } } [ServerRpc(RequireOwnership = false)] public void SpawnItemServerRpc(int itemList, int dishValue) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2569922090u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, itemList); BytePacker.WriteValueBitPacked(val, dishValue); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 2569922090u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; Item[] product = recipeList[itemList].product; foreach (Item val3 in product) { GameObject val4 = Object.Instantiate(val3.spawnPrefab, spawnPos.position, spawnPos.rotation, ((Component)this).transform); val4.GetComponent().Spawn(false); SpawnItemClientRpc(NetworkObjectReference.op_Implicit(val4.GetComponent()), dishValue); } } } [ClientRpc] private void SpawnItemClientRpc(NetworkObjectReference netObjRef, int value) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_008c: 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_00e9: 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 val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(531173574u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref netObjRef, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val, value); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 531173574u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); if (((NetworkObjectReference)(ref netObjRef)).TryGet(ref val3, (NetworkManager)null)) { ((Component)val3).GetComponent().SetScrapValue(value); } } } [ServerRpc(RequireOwnership = false)] private void AnimServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3912903399u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3912903399u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; AnimClientRpc(); } } } [ClientRpc] private void AnimClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1155555877u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1155555877u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; anim.Play(craftAnim, -1, 0f); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(1677710912u, new RpcReceiveHandler(__rpc_handler_1677710912), "DeleteItemServerRpc"); ((NetworkBehaviour)this).__registerRpc(2569922090u, new RpcReceiveHandler(__rpc_handler_2569922090), "SpawnItemServerRpc"); ((NetworkBehaviour)this).__registerRpc(531173574u, new RpcReceiveHandler(__rpc_handler_531173574), "SpawnItemClientRpc"); ((NetworkBehaviour)this).__registerRpc(3912903399u, new RpcReceiveHandler(__rpc_handler_3912903399), "AnimServerRpc"); ((NetworkBehaviour)this).__registerRpc(1155555877u, new RpcReceiveHandler(__rpc_handler_1155555877), "AnimClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_1677710912(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference netObj = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref netObj, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((Crafter)(object)target).DeleteItemServerRpc(netObj); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2569922090(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int itemList = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref itemList); int dishValue = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref dishValue); target.__rpc_exec_stage = (__RpcExecStage)1; ((Crafter)(object)target).SpawnItemServerRpc(itemList, dishValue); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_531173574(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference netObjRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref netObjRef, default(ForNetworkSerializable)); int value = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref value); target.__rpc_exec_stage = (__RpcExecStage)1; ((Crafter)(object)target).SpawnItemClientRpc(netObjRef, value); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3912903399(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((Crafter)(object)target).AnimServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1155555877(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((Crafter)(object)target).AnimClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "Crafter"; } } public class Crucible : Crafter { public override void OnNetworkSpawn() { recipeList = Plugin.crucible; } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { base.__initializeRpcs(); } protected internal override string __getTypeName() { return "Crucible"; } } public class Crusher : Refine { public override void OnNetworkSpawn() { recipeList = Plugin.crusher; } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { base.__initializeRpcs(); } protected internal override string __getTypeName() { return "Crusher"; } } public class GlobalSpawner : NetworkBehaviour { public static GlobalSpawner Instance { get; private set; } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); if ((Object)(object)Instance != (Object)null) { Object.Destroy((Object)(object)((Component)Instance).gameObject); } Instance = this; } [ServerRpc(RequireOwnership = false)] public void SpawnItemServerRpc(int itemList, float posX, float posY, float posZ) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0169: 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 val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(4034897490u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, itemList); ((FastBufferWriter)(ref val)).WriteValueSafe(ref posX, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref posY, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref posZ, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 4034897490u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; Item val3 = Plugin.itemList[itemList]; GameObject val4 = Object.Instantiate(val3.spawnPrefab, new Vector3(posX, posY, posZ), Quaternion.identity, RoundManager.Instance.spawnedScrapContainer); val4.GetComponent().Spawn(false); SpawnItemClientRpc(NetworkObjectReference.op_Implicit(val4.GetComponent()), (int)((float)Random.Range(val3.minValue, val3.maxValue) * RoundManager.Instance.scrapValueMultiplier)); } } } [ClientRpc] private void SpawnItemClientRpc(NetworkObjectReference netObjRef, int value) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_008c: 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_00e9: 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 val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(978084037u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref netObjRef, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val, value); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 978084037u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); if (((NetworkObjectReference)(ref netObjRef)).TryGet(ref val3, (NetworkManager)null)) { ((Component)val3).GetComponent().SetScrapValue(value); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(4034897490u, new RpcReceiveHandler(__rpc_handler_4034897490), "SpawnItemServerRpc"); ((NetworkBehaviour)this).__registerRpc(978084037u, new RpcReceiveHandler(__rpc_handler_978084037), "SpawnItemClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_4034897490(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int itemList = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref itemList); float posX = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref posX, default(ForPrimitives)); float posY = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref posY, default(ForPrimitives)); float posZ = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref posZ, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((GlobalSpawner)(object)target).SpawnItemServerRpc(itemList, posX, posY, posZ); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_978084037(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference netObjRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref netObjRef, default(ForNetworkSerializable)); int value = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref value); target.__rpc_exec_stage = (__RpcExecStage)1; ((GlobalSpawner)(object)target).SpawnItemClientRpc(netObjRef, value); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "GlobalSpawner"; } } internal class HarmonyPatches { private static bool loaded; [HarmonyPostfix] [HarmonyPatch(typeof(Terminal), "Awake")] private static void PostText(Terminal __instance) { try { TerminalNode specialKeywordResult = __instance.terminalNodes.allKeywords[7].specialKeywordResult; if (!specialKeywordResult.displayText.Contains("SHIP UPGRADES:") || specialKeywordResult.displayText.Contains("Workbench")) { return; } string text = string.Empty; foreach (ExtendedUnlockableItem extendedUnlockableItem in Plugin.extMod.ExtendedUnlockableItems) { text += $"\n* {extendedUnlockableItem.UnlockableItem.unlockableName} // Price: ${extendedUnlockableItem.ItemCost}"; } specialKeywordResult.displayText = specialKeywordResult.displayText.Insert(specialKeywordResult.displayText.IndexOf(":") + 1, text); } catch { Plugin.mls.LogError((object)"Could not find vanilla store terminal node!"); } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPriority(0)] private static void IngredientSync() { GrabbableObject[] array = (GrabbableObject[])(object)Object.FindObjectsOfType(typeof(GrabbableObject)); Ingredient ingredient = default(Ingredient); Ingredient ingredient2 = default(Ingredient); foreach (GrabbableObject val in array) { if ((Object)(object)val.itemProperties != (Object)null && (Object)(object)val.itemProperties.spawnPrefab != (Object)null && val.itemProperties.spawnPrefab.TryGetComponent(ref ingredient)) { if (((Component)val).TryGetComponent(ref ingredient2)) { ingredient2.ingredient = ingredient.ingredient; continue; } ingredient2 = ((Component)val).gameObject.AddComponent(); ingredient2.ingredient = ingredient.ingredient; } } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPriority(600)] private static void PostStart(StartOfRound __instance) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0bbd: Unknown result type (might be due to invalid IL or missing references) //IL_0bc7: Expected O, but got Unknown //IL_0cbe: Unknown result type (might be due to invalid IL or missing references) //IL_0cc8: Expected O, but got Unknown //IL_0dea: Unknown result type (might be due to invalid IL or missing references) //IL_0df4: Expected O, but got Unknown if (GameNetworkManager.Instance.isHostingGame) { GameObject val = Object.Instantiate(Plugin.bundle.LoadAsset("Assets/MelanieCrafting/Prefab/MMCraftSpawn.prefab"), Vector3.zero, Quaternion.identity); val.GetComponent().Spawn(false); } if (loaded) { return; } string[] source = MelanieCraftCfg.hammerList.Value.Split(','); string[] source2 = MelanieCraftCfg.sawList.Value.Split(','); string[] source3 = MelanieCraftCfg.axeList.Value.Split(','); string[] source4 = MelanieCraftCfg.logList.Value.Split(','); string[] source5 = MelanieCraftCfg.plankList.Value.Split(','); string[] array = MelanieCraftCfg.metalSheetList.Value.Split(','); int num = 0; string[] array2 = new string[1 + array.Length]; ReadOnlySpan readOnlySpan = new ReadOnlySpan(array); readOnlySpan.CopyTo(new Span(array2).Slice(num, readOnlySpan.Length)); num += readOnlySpan.Length; array2[num] = "Metal sheet"; string[] source6 = array2; string[] source7 = MelanieCraftCfg.metalBarList.Value.Split(','); array2 = MelanieCraftCfg.goldMeltList.Value.Split(','); num = 0; array = new string[2 + array2.Length]; readOnlySpan = new ReadOnlySpan(array2); readOnlySpan.CopyTo(new Span(array).Slice(num, readOnlySpan.Length)); num += readOnlySpan.Length; array[num] = "Golden cup"; num++; array[num] = "Ring"; string[] source8 = array; array = MelanieCraftCfg.ironMeltList.Value.Split(','); num = 0; array2 = new string[4 + array.Length]; readOnlySpan = new ReadOnlySpan(array); readOnlySpan.CopyTo(new Span(array2).Slice(num, readOnlySpan.Length)); num += readOnlySpan.Length; array2[num] = "Big bolt"; num++; array2[num] = "Large axle"; num++; array2[num] = "V-type engine"; num++; array2[num] = "Garbage lid"; string[] source9 = array2; array2 = MelanieCraftCfg.aluminiumMeltList.Value.Split(','); num = 0; array = new string[4 + array2.Length]; readOnlySpan = new ReadOnlySpan(array2); readOnlySpan.CopyTo(new Span(array).Slice(num, readOnlySpan.Length)); num += readOnlySpan.Length; array[num] = "Cookie pan"; num++; array[num] = "Red soda"; num++; array[num] = "Stop sign"; num++; array[num] = "Yield sign"; string[] source10 = array; array = MelanieCraftCfg.brassMeltList.Value.Split(','); num = 0; array2 = new string[3 + array.Length]; readOnlySpan = new ReadOnlySpan(array); readOnlySpan.CopyTo(new Span(array2).Slice(num, readOnlySpan.Length)); num += readOnlySpan.Length; array2[num] = "Bell"; num++; array2[num] = "Cash register"; num++; array2[num] = "Magnifying glass"; string[] source11 = array2; string[] source12 = MelanieCraftCfg.copperMeltList.Value.Split(','); string[] source13 = MelanieCraftCfg.paperScrapList.Value.Split(','); string[] array3 = MelanieCraftCfg.ingredientList.Value.Split(','); foreach (Item items in __instance.allItemsList.itemsList) { if (source.Contains(items.itemName)) { AddTool(items, 0); } if (source2.Contains(items.itemName)) { AddTool(items, 1); } if (source3.Contains(items.itemName)) { AddTool(items, 2); } if (source4.Contains(items.itemName)) { AddIngredient(items, 19); } if (source5.Contains(items.itemName)) { AddIngredient(items, 20); } if (source6.Contains(items.itemName)) { AddIngredient(items, 27); } if (source7.Contains(items.itemName)) { AddIngredient(items, 30); } if (source8.Contains(items.itemName)) { AddIngredient(items, 41); } if (source9.Contains(items.itemName)) { AddIngredient(items, 31); } if (source10.Contains(items.itemName)) { AddIngredient(items, 33); } if (source11.Contains(items.itemName)) { AddIngredient(items, 35); } if (source12.Contains(items.itemName)) { AddIngredient(items, 37); } if (source13.Contains(items.itemName)) { AddIngredient(items, 61); } try { string[] array4 = array3; foreach (string text in array4) { string[] array5 = text.Split(';'); if (items.itemName == array5[0]) { AddIngredient(items, short.Parse(array5[1], CultureInfo.InvariantCulture)); } } } catch { Plugin.mls.LogError((object)"Invalid config for Craft as Custom Ingredient."); } } foreach (Item items2 in __instance.allItemsList.itemsList) { if (items2.itemName == "Zap gun") { AddIngredient(items2, 49); break; } } foreach (Item items3 in __instance.allItemsList.itemsList) { if (items3.itemName == "Radar-booster") { AddIngredient(items3, 50); break; } } foreach (Item items4 in __instance.allItemsList.itemsList) { if (items4.itemName == "V-type engine") { AddIngredient(items4, 59); AddTool(items4, 6); break; } } foreach (Item items5 in __instance.allItemsList.itemsList) { if (items5.itemName == "Homemade flashbang") { Plugin.RegisterRecipe(Plugin.workbench, items5, new short[1][] { new short[2] { 63, 1 } }, new short[1] { 8 }, 1, 1, 10, 5, 1, 0.25f); break; } } foreach (Item items6 in __instance.allItemsList.itemsList) { if (items6.itemName == "Bottles") { AddIngredient(items6, 63); break; } } foreach (Item items7 in __instance.allItemsList.itemsList) { if (items7.itemName == "Toilet paper") { AddIngredient(items7, 61); break; } } foreach (Item items8 in __instance.allItemsList.itemsList) { if (items8.itemName == "Painting") { AddIngredient(items8, 61); break; } } foreach (Item items9 in __instance.allItemsList.itemsList) { if (items9.itemName == "Tragedy") { AddIngredient(items9, 64); break; } } foreach (Item items10 in __instance.allItemsList.itemsList) { if (items10.itemName == "Comedy") { AddIngredient(items10, 65); break; } } foreach (Item items11 in __instance.allItemsList.itemsList) { if (items11.itemName == "Gold bar") { AddIngredient(items11, 67); Plugin.RegisterRecipe(Plugin.crucible, items11, new short[1][] { new short[2] { 41, 1 } }, Array.Empty(), 1, 1, 1, 5); Plugin.RegisterRecipe(Plugin.crucible, items11, new short[1][] { new short[2] { 41, 2 } }, Array.Empty(), 2, 2, 2, 5); Plugin.RegisterRecipe(Plugin.crucible, items11, new short[1][] { new short[2] { 41, 3 } }, Array.Empty(), 3, 3, 3, 5); Plugin.RegisterRecipe(Plugin.crucible, items11, new short[1][] { new short[2] { 41, 4 } }, Array.Empty(), 4, 4, 4, 5); break; } } foreach (Item items12 in __instance.allItemsList.itemsList) { if (items12.itemName == "Key") { AddIngredient(items12, 62); Plugin.RegisterRecipe(Plugin.workbench, items12, new short[1][] { new short[2] { 36, 1 } }, Array.Empty(), 1, 1, 6, 5); break; } } AddRecipe(Plugin.workbench, MelanieCraftCfg.workbenchCraftList.Value); AddRecipe(Plugin.crucible, MelanieCraftCfg.crucibleCraftList.Value); if (MelanieCraftCfg.rakeEnable.Value) { SpawnableOutsideObject val2 = Plugin.bundle.LoadAsset("Assets/MelanieCrafting/Asset/Hazard/RakeTrap0.asset"); int value = MelanieCraftCfg.rakeSpawn0.Value; List list = new List(); foreach (ExtendedLevel extendedLevel in PatchedContent.ExtendedLevels) { if (value != 0) { list.Clear(); list.AddRange(CollectionExtensions.AddItem((IEnumerable)extendedLevel.SelectableLevel.spawnableOutsideObjects, new SpawnableOutsideObjectWithRarity(val2, AnimationCurve.Constant(0f, 1f, (float)value)))); extendedLevel.SelectableLevel.spawnableOutsideObjects = list.ToArray(); } foreach (ContentTag contentTag in ((ExtendedContent)extendedLevel).ContentTags) { string[] array6 = MelanieCraftCfg.rakeSpawn1.Value.Split(','); foreach (string text2 in array6) { if (text2 == string.Empty) { continue; } try { string[] array7 = text2.Split(':'); if (array7.Length == 3) { array7 = new string[2] { array7[1], array7[2] }; } if (contentTag.contentTagName.ToLower() == array7[0].ToLower()) { list.Clear(); list.AddRange(CollectionExtensions.AddItem((IEnumerable)extendedLevel.SelectableLevel.spawnableOutsideObjects, new SpawnableOutsideObjectWithRarity(val2, AnimationCurve.Constant(0f, 1f, (float)short.Parse(array7[1]))))); extendedLevel.SelectableLevel.spawnableOutsideObjects = list.ToArray(); break; } } catch { Plugin.mls.LogError((object)"Invalid config input for rake trap by tag. Skipping this iteration"); } } } string[] array8 = MelanieCraftCfg.rakeSpawn2.Value.Split(','); foreach (string text3 in array8) { if (text3 == string.Empty) { continue; } try { string[] array9 = text3.Split(':'); if (array9.Length == 3) { array9 = new string[2] { array9[1], array9[2] }; } if (extendedLevel.NumberlessPlanetName.ToLower() == array9[0].ToLower()) { list.Clear(); list.AddRange(CollectionExtensions.AddItem((IEnumerable)extendedLevel.SelectableLevel.spawnableOutsideObjects, new SpawnableOutsideObjectWithRarity(val2, AnimationCurve.Constant(0f, 1f, (float)short.Parse(array9[1]))))); extendedLevel.SelectableLevel.spawnableOutsideObjects = list.ToArray(); break; } } catch { Plugin.mls.LogError((object)"Invalid config input for rake trap by tag. Skipping this iteration"); } } } } loaded = true; } [HarmonyPostfix] [HarmonyPatch(typeof(TerrainObstacleTrigger), "Awake")] private static void TreeAwake(TerrainObstacleTrigger __instance) { ((Component)__instance).gameObject.layer = 21; ((Component)__instance).gameObject.AddComponent(); } [HarmonyPostfix] [HarmonyPatch(typeof(SandSpiderWebTrap), "Hit")] private static void WebBreak(SandSpiderWebTrap __instance) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) GlobalSpawner.Instance.SpawnItemServerRpc(0, ((Component)__instance).transform.position.x, ((Component)__instance).transform.position.y + 1f, ((Component)__instance).transform.position.z); } [HarmonyPostfix] [HarmonyPatch(typeof(SandSpiderAI), "KillEnemy")] private static void SpiderDie(SandSpiderAI __instance) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) GlobalSpawner.Instance.SpawnItemServerRpc(0, ((Component)__instance).transform.position.x, ((Component)__instance).transform.position.y + 1f, ((Component)__instance).transform.position.z); } [HarmonyPostfix] [HarmonyPatch(typeof(CentipedeAI), "KillEnemy")] private static void FleaDie(CentipedeAI __instance) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) GlobalSpawner.Instance.SpawnItemServerRpc(0, ((Component)__instance).transform.position.x, ((Component)__instance).transform.position.y + 1f, ((Component)__instance).transform.position.z); } [HarmonyPostfix] [HarmonyPatch(typeof(LungProp), "Start")] private static void PostLungProp(LungProp __instance) { Ingredient ingredient = default(Ingredient); if (((Component)__instance).gameObject.TryGetComponent(ref ingredient)) { ingredient.ingredient.Add(48); } else { ((Component)__instance).gameObject.AddComponent().ingredient.Add(48); } } [HarmonyTranspiler] [HarmonyPatch(typeof(RoundManager), "SpawnMapObjects")] [HarmonyPriority(800)] private static IEnumerable TranspilerSMO(IEnumerable instructions) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown List list = instructions.ToList(); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Stloc_2) { list.InsertRange(i + 1, new <>z__ReadOnlyArray((CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldloc_2, (object)null), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(HarmonyPatches), "AddHazard", (Type[])null, (Type[])null)) })); break; } } return list; } private void AddHazard(RandomMapObject[] spawns) { for (int i = 0; i < spawns.Length; i++) { spawns[i].spawnablePrefabs.AddRange(Plugin.hazardInside); } } private static void AddRecipe(List crafter, string recipe) { try { if (recipe == string.Empty) { return; } string[] array = recipe.Split(", "); string[] array2 = array; foreach (string text in array2) { string[] array3 = text.Split(" : "); List list = new List(); string[] array4 = array3[0].Split('|'); foreach (string text2 in array4) { foreach (Item items in StartOfRound.Instance.allItemsList.itemsList) { if (items.itemName == text2) { list.Add(items); break; } } } List list2 = new List(); List list3 = new List(); short num = 0; string[] array5 = array3[2].Split('|'); foreach (string s in array5) { list3.Add(short.Parse(s, CultureInfo.InvariantCulture)); } string[] array6 = array3[3].Split('|'); foreach (string text3 in array6) { string[] array7 = text3.Split(';'); list2.Add(new short[2] { short.Parse(array7[0], CultureInfo.InvariantCulture), short.Parse(array7[1], CultureInfo.InvariantCulture) }); num += short.Parse(array7[1], CultureInfo.InvariantCulture); } Plugin.RegisterRecipe(crafter, list.ToArray(), list2.ToArray(), list3.ToArray(), num, num, short.Parse(array3[1], CultureInfo.InvariantCulture), short.Parse(array3[4], CultureInfo.InvariantCulture)); } } catch { Plugin.mls.LogError((object)"Invalid config for Custom Recipes for Melanie Crafting Core."); } } private static void AddIngredient(Item item, short ID) { Ingredient ingredient = default(Ingredient); if (item.spawnPrefab.TryGetComponent(ref ingredient)) { ingredient.ingredient.Add(ID); } else { item.spawnPrefab.AddComponent().ingredient.Add(ID); } } private static void AddTool(Item item, short ID) { Ingredient ingredient = default(Ingredient); if (!item.spawnPrefab.TryGetComponent(ref ingredient)) { ingredient = item.spawnPrefab.AddComponent(); } ingredient.tool = ID; } } [InjectInterface(typeof(TerrainObstacleTrigger))] public interface IAwake { void Awake(); } public class Ingredient : MonoBehaviour { public List ingredient = new List(); public bool consumable = true; public short tool = -1; public ToolRandom[] toolRandom = new ToolRandom[0]; private void Awake() { if (toolRandom.Length != 0) { int num = Random.Range(0, toolRandom.Length); ((Component)this).GetComponentInChildren().headerText = toolRandom[num].toolName; tool = (short)toolRandom[num].toolID; } } } public class InteractItem : GrabbableObject { public UnityEvent onGrab; public UnityEvent onGrounded; public UnityEvent onUse; public override void GrabItem() { onGrab.Invoke(); } public override void OnHitGround() { onGrounded.Invoke(); } public override void ItemActivate(bool used, bool buttonDown = true) { onUse.Invoke(); } public void Damage(int damage) { PlayerControllerB playerHeldBy = base.playerHeldBy; playerHeldBy.health -= damage; } public void Despawn() { if ((Object)(object)base.playerHeldBy != (Object)null && base.playerHeldBy.isHoldingObject) { base.playerHeldBy.DespawnHeldObject(); } } public void Drunk(int time) { ((MonoBehaviour)base.playerHeldBy).StartCoroutine(DrunkTime(time)); } private IEnumerator DrunkTime(int time) { yield return (object)new WaitForSeconds(2f * Time.deltaTime); PlayerControllerB playerHeldBy = base.playerHeldBy; playerHeldBy.drunkness += 1f; PlayerControllerB playerHeldBy2 = base.playerHeldBy; playerHeldBy2.drunknessInertia += 1f; PlayerControllerB playerHeldBy3 = base.playerHeldBy; playerHeldBy3.drunknessSpeed += 1f; yield return (object)new WaitForSeconds((float)time * Time.deltaTime); PlayerControllerB playerHeldBy4 = base.playerHeldBy; playerHeldBy4.drunkness -= 1f; PlayerControllerB playerHeldBy5 = base.playerHeldBy; playerHeldBy5.drunknessInertia -= 1f; PlayerControllerB playerHeldBy6 = base.playerHeldBy; playerHeldBy6.drunknessSpeed -= 1f; } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { ((GrabbableObject)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "InteractItem"; } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("MelanieMelicious.CraftCore", "MelanieMelicious - Crafting Progression Core", "1.2.6")] public class Plugin : BaseUnityPlugin { private const string GUID = "MelanieMelicious.CraftCore"; private const string NAME = "MelanieMelicious - Crafting Progression Core"; private const string VERSION = "1.2.6"; public const string NAMESPACE = "melaniecrafting"; private readonly Harmony harmony = new Harmony("MelanieMelicious.CraftCore"); internal static ManualLogSource mls; public static AssetBundle bundle; public UnlockableItem[] unlockList; public static List itemList; public static Plugin instance; public static List hazardInside = new List(); public static List workbench = new List(); public static List crucible = new List(); public static List sawmill = new List(); public static List crusher = new List(); internal static int rakeDamage; internal static ExtendedMod extMod; private bool alt = false; private void Awake() { instance = this; MelanieCraftCfg.SetupConfig(((BaseUnityPlugin)this).Config); mls = Logger.CreateLogSource("MelanieMelicious - Crafting Progression Core"); mls = ((BaseUnityPlugin)this).Logger; string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); bundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "melaniecrafting")); unlockList = bundle.LoadAsset("Assets/MelanieCrafting/Asset/Unlockable.asset").unlockables.ToArray(); itemList = bundle.LoadAsset("Assets/MelanieCrafting/Asset/Item.asset").itemsList; rakeDamage = MelanieCraftCfg.rakeDamage.Value; if (Chainloader.PluginInfos.ContainsKey("com.github.teamxiaolan.dawnlib")) { alt = true; } harmony.PatchAll(typeof(HarmonyPatches)); harmony.PatchAll(typeof(SavePatches)); extMod = bundle.LoadAsset("Assets/MelanieCrafting/MelanieCrafting.asset"); Unlockable(unlockList[0], MelanieCraftCfg.workbench0Cost.Value); Unlockable(unlockList[1], MelanieCraftCfg.crucible0Cost.Value); Item(itemList[0]); Item(itemList[1], MelanieCraftCfg.hammer0Spawn.Value, MelanieCraftCfg.hammer0Cost.Value); Item(itemList[2], MelanieCraftCfg.saw0Spawn.Value, MelanieCraftCfg.saw0Cost.Value); Item(itemList[3]); Item(itemList[4]); Item(itemList[5]); Item(itemList[6]); Item(itemList[7], MelanieCraftCfg.axe0Spawn.Value, MelanieCraftCfg.axe0Cost.Value); Item(itemList[8]); Item(itemList[9]); Item(itemList[10]); Item(itemList[11]); Item(itemList[12], MelanieCraftCfg.resource0Spawn.Value); Item(itemList[13]); Item(itemList[14]); Item(itemList[15]); Item(itemList[16], MelanieCraftCfg.tool0Spawn.Value); Item(itemList[17], MelanieCraftCfg.resource0Spawn.Value); Item(itemList[18], MelanieCraftCfg.resource0Spawn.Value); Item(itemList[19]); Item(itemList[20]); Item(itemList[21]); Item(itemList[22], MelanieCraftCfg.resource0Spawn.Value); Item(itemList[23], MelanieCraftCfg.resource0Spawn.Value); RegisterRecipe(workbench, itemList[4], new short[1][] { new short[2] { 19, 1 } }, new short[1] { 1 }, 1, 1, 1, 5, 5, 0.25f); RegisterRecipe(workbench, itemList[5], new short[1][] { new short[2] { 20, 1 } }, new short[1] { 1 }, 1, 1, 2, 5, 5, 0.25f); RegisterRecipe(workbench, itemList[2], new short[1][] { new short[2] { 27, 2 } }, Array.Empty(), 2, 2, 1, 5, 5, 0.25f); RegisterRecipe(workbench, itemList[7], new short[2][] { new short[2] { 27, 2 }, new short[2] { 25, 1 } }, Array.Empty(), 3, 3, 1, 5, 5, 0.25f); RegisterRecipe(workbench, itemList[1], new short[2][] { new short[2] { 30, 1 }, new short[2] { 25, 1 } }, Array.Empty(), 2, 2, 1, 5, 5, 0.25f); RegisterRecipe(workbench, itemList[16], new short[2][] { new short[2] { 27, 1 }, new short[2] { 30, 2 } }, Array.Empty(), 3, 3, 1, 5, 5, 0.25f); RegisterRecipe(workbench, itemList[13], new short[1][] { new short[2] { 32, 5 } }, new short[1], 5, 5, 1, 5, 10, 0.25f); RegisterRecipe(workbench, itemList[14], new short[1][] { new short[2] { 32, 1 } }, new short[2] { 0, 2 }, 1, 1, 1, 5, 5, 0.25f); RegisterRecipe(workbench, itemList[15], new short[1][] { new short[2] { 34, 1 } }, new short[2] { 0, 2 }, 1, 1, 1, 5, 5, 0.25f); RegisterRecipe(workbench, itemList[17], new short[1][] { new short[2] { 38, 1 } }, new short[2] { 0, 2 }, 1, 1, 1, 5, 5, 0.25f); RegisterRecipe(workbench, itemList[18], new short[1][] { new short[2] { 56, 1 } }, new short[2] { 0, 3 }, 1, 1, 1, 5, 5, 0.25f); RegisterRecipe(workbench, itemList[19], new short[3][] { new short[2] { 27, 2 }, new short[2] { 32, 1 }, new short[2] { 57, 1 } }, new short[4] { 0, 2, 3, 6 }, 4, 4, 1, 5, 10, 0.25f); RegisterRecipe(workbench, itemList[20], new short[3][] { new short[2] { 58, 1 }, new short[2] { 39, 2 }, new short[2] { 20, 2 } }, new short[4] { 0, 2, 3, 7 }, 5, 5, 1, 5, 10, 0.5f); RegisterRecipe(workbench, itemList[21], new short[4][] { new short[2] { 58, 1 }, new short[2] { 32, 2 }, new short[2] { 27, 2 }, new short[2] { 20, 4 } }, new short[3] { 0, 2, 3 }, 9, 9, 1, 5, 10, 0.5f); RegisterRecipe(workbench, itemList[22], new short[1][] { new short[2] { 61, 1 } }, Array.Empty(), 1, 1, 1, 5, 5, 0.25f); RegisterRecipe(workbench, itemList[23], new short[1][] { new short[2] { 60, 1 } }, Array.Empty(), 1, 1, 1, 5, 5, 0.25f); RegisterRecipe(crucible, itemList[9], new short[1][] { new short[2] { 31, 1 } }, Array.Empty(), 1, 1, 1, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[9], new short[1][] { new short[2] { 31, 2 } }, Array.Empty(), 2, 2, 2, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[9], new short[1][] { new short[2] { 31, 3 } }, Array.Empty(), 3, 3, 3, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[9], new short[1][] { new short[2] { 31, 4 } }, Array.Empty(), 4, 4, 4, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[10], new short[1][] { new short[2] { 33, 1 } }, Array.Empty(), 1, 1, 1, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[10], new short[1][] { new short[2] { 33, 2 } }, Array.Empty(), 2, 2, 2, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[10], new short[1][] { new short[2] { 33, 3 } }, Array.Empty(), 3, 3, 3, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[10], new short[1][] { new short[2] { 33, 4 } }, Array.Empty(), 4, 4, 4, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[11], new short[1][] { new short[2] { 35, 1 } }, Array.Empty(), 1, 1, 1, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[11], new short[1][] { new short[2] { 35, 2 } }, Array.Empty(), 2, 2, 2, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[11], new short[1][] { new short[2] { 35, 3 } }, Array.Empty(), 3, 3, 3, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[11], new short[1][] { new short[2] { 35, 4 } }, Array.Empty(), 4, 4, 4, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[11], new short[1][] { new short[2] { 62, 8 } }, Array.Empty(), 8, 8, 1, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[12], new short[1][] { new short[2] { 37, 1 } }, Array.Empty(), 1, 1, 1, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[12], new short[1][] { new short[2] { 37, 2 } }, Array.Empty(), 2, 2, 2, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[12], new short[1][] { new short[2] { 37, 3 } }, Array.Empty(), 3, 3, 3, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[12], new short[1][] { new short[2] { 37, 4 } }, Array.Empty(), 4, 4, 4, 5, 5, 0.1f); RegisterRecipe(sawmill, itemList[4], new short[1][] { new short[2] { 19, 1 } }, Array.Empty(), 1, 1, 2, 5, 10, 1.25f); RegisterRecipe(sawmill, itemList[5], new short[1][] { new short[2] { 20, 1 } }, Array.Empty(), 1, 1, 2, 5, 5, 0.5f); RegisterRecipe(crusher, itemList[22], new short[1][] { new short[2] { 61, 1 } }, Array.Empty(), 1, 1, 1, 5, 10, 0.3f); LethalLevelLoaderNetworkManager.RegisterNetworkPrefab(bundle.LoadAsset("Assets/MelanieCrafting/Prefab/MMCraftSpawn.prefab")); LethalLevelLoaderNetworkManager.RegisterNetworkPrefab(bundle.LoadAsset("Assets/MelanieCrafting/Prefab/Hazard/RakeTrap0.prefab")); if (!alt) { PatchedContent.RegisterExtendedMod(extMod); } } public static void RegisterRecipe(List addToCookerRecipes, Item product, short[][] ingredientsAndCount, short[] tools, short min = 3, short max = 3, short productQuantity = 1, short priority = 0, int minValue = 0, float maxValue = 0f) { addToCookerRecipes.Add(new Recipe { ingredients = ingredientsAndCount, min = min, max = max, product = (Item[])(object)new Item[1] { product }, quantity = productQuantity, priority = priority, tools = tools, minValue = minValue, maxValue = maxValue }); } public static void RegisterRecipe(List addToCookerRecipes, Item[] product, short[][] ingredientsAndCount, short[] tools, short min = 3, short max = 3, short productQuantity = 1, short priority = 0, int minValue = 0, float maxValue = 0f) { addToCookerRecipes.Add(new Recipe { ingredients = ingredientsAndCount, min = min, max = max, product = product, quantity = productQuantity, priority = priority, tools = tools, minValue = minValue, maxValue = maxValue }); } private void Item(Item item, int weight = 0, int cost = -1) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_0063: Expected O, but got Unknown if (!alt) { ExtendedItem val = new ExtendedItem { Item = item }; if (weight != 0) { val.LevelMatchingProperties = new LevelMatchingProperties { levelTags = new List(2) { new StringWithRarity("Vanilla", weight), new StringWithRarity("Custom", weight) } }; } if (cost != -1) { item.creditsWorth = cost; val.IsBuyableItem = true; } extMod.ExtendedItems.Add(val); } else { ItemAlt(item, weight, cost); } } private void ItemAlt(Item item, int weight = 0, int cost = -1) { NamespacedKey val = NamespacedKey.From("melaniecrafting", ((Object)item).name); DawnLib.RegisterNetworkPrefab(item.spawnPrefab); DawnLib.DefineItem(val, item, (Action)delegate(ItemInfoBuilder itemInfo) { if (weight > 0) { itemInfo.DefineScrap((Action)delegate(ScrapBuilder scrap) { scrap.SetWeights((Action>)delegate(WeightTableBuilder setWeight) { setWeight.SetGlobalWeight(weight); }); }); } else { itemInfo.DefineScrap((Action)delegate(ScrapBuilder scrap) { scrap.SetWeights((Action>)delegate { }); }); } if (cost != -1) { itemInfo.DefineShop((Action)delegate(ShopBuilder shop) { shop.OverrideCost(cost); }); } }); } private void Unlockable(UnlockableItem unlock, int cost) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown if (!alt) { extMod.ExtendedUnlockableItems.Add(new ExtendedUnlockableItem { UnlockableItem = unlock, ItemCost = cost }); } else { UnlockableAlt(unlock, cost); } } private void UnlockableAlt(UnlockableItem unlock, int cost) { DawnLib.RegisterNetworkPrefab(unlock.prefabObject); DawnLib.DefineUnlockable(NamespacedKey.From("melaniecrafting", unlock.unlockableName), unlock, (Action)delegate(UnlockableInfoBuilder info) { info.SetCost(cost); }); } } public class RakeTrap : NetworkBehaviour { [SerializeField] private Animator animator; private const string play = "play"; public void Hit(PlayerControllerB player) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) HitServerRpc(state: true); player.DamagePlayer(Plugin.rakeDamage, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); } public void Hit2() { HitServerRpc(state: false); } [ServerRpc(RequireOwnership = false)] private void HitServerRpc(bool state) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2237943435u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref state, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 2237943435u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; HitClientRpc(state); } } } [ClientRpc] private void HitClientRpc(bool state) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3834622412u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref state, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3834622412u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; animator.SetBool("play", state); } } } public void Dismantle() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) GlobalSpawner.Instance.SpawnItemServerRpc(Random.Range(5, 8), ((Component)this).transform.position.x, ((Component)this).transform.position.y + 1f, ((Component)this).transform.position.z); DismantleServerRpc(); } [ServerRpc(RequireOwnership = false)] private void DismantleServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3820099073u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3820099073u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; ((Component)this).GetComponent().Despawn(true); } } } private void Start() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_00ac: Unknown result type (might be due to invalid IL or missing references) if (!GameNetworkManager.Instance.isHostingGame) { if (!((NetworkBehaviour)this).IsSpawned) { Object.Destroy((Object)(object)((Component)this).gameObject); } return; } RaycastHit val = default(RaycastHit); if (Physics.Raycast(((Component)this).transform.position + Vector3.up * 2f, Vector3.down, ref val, 3f, 1107298561)) { ((Component)this).transform.position = ((RaycastHit)(ref val)).point; ((Component)this).transform.up = ((RaycastHit)(ref val)).normal; ((Component)this).transform.Rotate(Vector3.up * (float)Random.Range(-180, 180), (Space)1); } ((Component)this).GetComponent().Spawn(true); } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2237943435u, new RpcReceiveHandler(__rpc_handler_2237943435), "HitServerRpc"); ((NetworkBehaviour)this).__registerRpc(3834622412u, new RpcReceiveHandler(__rpc_handler_3834622412), "HitClientRpc"); ((NetworkBehaviour)this).__registerRpc(3820099073u, new RpcReceiveHandler(__rpc_handler_3820099073), "DismantleServerRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_2237943435(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool state = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref state, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((RakeTrap)(object)target).HitServerRpc(state); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3834622412(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool state = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref state, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((RakeTrap)(object)target).HitClientRpc(state); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3820099073(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((RakeTrap)(object)target).DismantleServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "RakeTrap"; } } public class Recipe { internal short[][] ingredients; internal short[] tools = new short[0]; internal short min; internal short max; internal short quantity; internal short priority; internal Item[] product; internal int minValue; internal float maxValue; } public class Refine : NetworkBehaviour { public Transform spawnPos; public List recipeList; public void Craft(PlayerControllerB playerWhoTriggered) { if (!playerWhoTriggered.isHoldingObject) { return; } GrabbableObject currentlyHeldObjectServer = playerWhoTriggered.currentlyHeldObjectServer; Ingredient ingredient = default(Ingredient); if (!((Component)currentlyHeldObjectServer).TryGetComponent(ref ingredient)) { return; } foreach (Recipe recipe in recipeList) { if (ingredient.ingredient.Contains(recipe.ingredients[0][0])) { for (int i = 0; i < recipe.quantity; i++) { SpawnItemServerRpc(Array.IndexOf(recipeList.ToArray(), recipe), (int)((float)currentlyHeldObjectServer.scrapValue + Random.Range((float)recipe.minValue, (float)currentlyHeldObjectServer.scrapValue * recipe.maxValue)) / recipe.quantity); } playerWhoTriggered.DespawnHeldObject(); break; } } } [ServerRpc(RequireOwnership = false)] public void SpawnItemServerRpc(int itemList, int dishValue) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(891307308u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, itemList); BytePacker.WriteValueBitPacked(val, dishValue); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 891307308u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; Item[] product = recipeList[itemList].product; foreach (Item val3 in product) { GameObject val4 = Object.Instantiate(val3.spawnPrefab, spawnPos.position, spawnPos.rotation, ((Component)this).transform); val4.GetComponent().Spawn(false); SpawnItemClientRpc(NetworkObjectReference.op_Implicit(val4.GetComponent()), dishValue); } } } [ClientRpc] private void SpawnItemClientRpc(NetworkObjectReference netObjRef, int value) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_008c: 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_00e9: 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 val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1707190453u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref netObjRef, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val, value); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1707190453u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); if (((NetworkObjectReference)(ref netObjRef)).TryGet(ref val3, (NetworkManager)null)) { ((Component)val3).GetComponent().SetScrapValue(value); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(891307308u, new RpcReceiveHandler(__rpc_handler_891307308), "SpawnItemServerRpc"); ((NetworkBehaviour)this).__registerRpc(1707190453u, new RpcReceiveHandler(__rpc_handler_1707190453), "SpawnItemClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_891307308(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int itemList = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref itemList); int dishValue = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref dishValue); target.__rpc_exec_stage = (__RpcExecStage)1; ((Refine)(object)target).SpawnItemServerRpc(itemList, dishValue); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1707190453(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference netObjRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref netObjRef, default(ForNetworkSerializable)); int value = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref value); target.__rpc_exec_stage = (__RpcExecStage)1; ((Refine)(object)target).SpawnItemClientRpc(netObjRef, value); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "Refine"; } } public class SaveCrafter : Crafter { public List upgrades = new List(); public List canAddTools = new List(); private bool synced = false; public void AddTool(PlayerControllerB player) { Ingredient ingredient = default(Ingredient); if (player.isHoldingObject && ((Component)player.currentlyHeldObjectServer).TryGetComponent(ref ingredient) && ingredient.tool != -1 && canAddTools.Contains(ingredient.tool) && !tools.Contains(ingredient.tool)) { AddToolServerRpc(ingredient.tool); player.DespawnHeldObject(); } } [ServerRpc(RequireOwnership = false)] private void AddToolServerRpc(short tool) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3300359901u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, tool); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3300359901u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; AddToolClientRpc(tool); } } } [ClientRpc] private void AddToolClientRpc(short tool) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2782130414u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, tool); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2782130414u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; tools.Add(tool); upgrades[canAddTools.IndexOf(tool)].SetActive(true); } } } [ServerRpc(RequireOwnership = false)] private void SyncToolServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3574493460u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3574493460u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SyncToolClientRpc(tools.ToArray()); } } } [ClientRpc] private void SyncToolClientRpc(short[] addedTools) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2960638172u, val2, (RpcDelivery)0); bool flag = addedTools != null; ((FastBufferWriter)(ref val)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(addedTools, default(ForPrimitives)); } ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2960638172u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!synced) { foreach (short item in addedTools) { tools.Add(item); upgrades[canAddTools.IndexOf(item)].SetActive(true); } synced = true; } } public void LoadTools() { foreach (short tool in tools) { upgrades[canAddTools.IndexOf(tool)].SetActive(true); } } private void Start() { if (!((NetworkBehaviour)this).IsHost) { SyncToolServerRpc(); } } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3300359901u, new RpcReceiveHandler(__rpc_handler_3300359901), "AddToolServerRpc"); ((NetworkBehaviour)this).__registerRpc(2782130414u, new RpcReceiveHandler(__rpc_handler_2782130414), "AddToolClientRpc"); ((NetworkBehaviour)this).__registerRpc(3574493460u, new RpcReceiveHandler(__rpc_handler_3574493460), "SyncToolServerRpc"); ((NetworkBehaviour)this).__registerRpc(2960638172u, new RpcReceiveHandler(__rpc_handler_2960638172), "SyncToolClientRpc"); base.__initializeRpcs(); } private static void __rpc_handler_3300359901(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { short tool = default(short); ByteUnpacker.ReadValueBitPacked(reader, ref tool); target.__rpc_exec_stage = (__RpcExecStage)1; ((SaveCrafter)(object)target).AddToolServerRpc(tool); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2782130414(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { short tool = default(short); ByteUnpacker.ReadValueBitPacked(reader, ref tool); target.__rpc_exec_stage = (__RpcExecStage)1; ((SaveCrafter)(object)target).AddToolClientRpc(tool); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3574493460(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((SaveCrafter)(object)target).SyncToolServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2960638172(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); short[] addedTools = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref addedTools, default(ForPrimitives)); } target.__rpc_exec_stage = (__RpcExecStage)1; ((SaveCrafter)(object)target).SyncToolClientRpc(addedTools); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "SaveCrafter"; } } internal class SavePatches { internal static Workbench workbench; private const string versionSaveKey = "MelanieMeliciousCraftVersion"; private const string workbenchSaveKey = "MelanieMeliciousCraftWorkbench"; [HarmonyPrefix] [HarmonyPatch(typeof(GameNetworkManager), "SaveGameValues")] private static void SaveCrafters() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown if (!((NetworkBehaviour)StartOfRound.Instance).IsServer) { return; } try { string currentSaveFileName = GameNetworkManager.Instance.currentSaveFileName; ES3.Save("MelanieMeliciousCraftVersion", (short)0, currentSaveFileName); if ((Object)(object)workbench == (Object)null) { ES3.DeleteKey("MelanieMeliciousCraftWorkbench", currentSaveFileName); } else { ES3.Save("MelanieMeliciousCraftWorkbench", JsonConvert.SerializeObject((object)workbench.tools.ToArray()), currentSaveFileName, new ES3Settings(new Enum[1] { (Enum)(object)(ReferenceMode)0 })); } } catch { Plugin.mls.LogError((object)"Issue while saving Melanie Crafting Progression Core custom info. Aborting to prevent save break."); } try { foreach (Stack stack in Stack.stacks) { stack.Save(); } } catch { Plugin.mls.LogError((object)"Issue while saving Melanie Crafting Progression Core item stack info. Aborting to prevent save break."); } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "LoadAttachedVehicle")] private static void LoadCrafters(StartOfRound __instance) { if (!((NetworkBehaviour)__instance).IsServer) { return; } try { string currentSaveFileName = GameNetworkManager.Instance.currentSaveFileName; if (ES3.KeyExists("MelanieMeliciousCraftWorkbench", currentSaveFileName) && (Object)(object)SavePatches.workbench != (Object)null) { Workbench workbench = SavePatches.workbench; workbench.tools.AddRange(JsonConvert.DeserializeObject(ES3.Load("MelanieMeliciousCraftWorkbench", currentSaveFileName)).ToArray()); workbench.LoadTools(); } } catch { Plugin.mls.LogError((object)"Issue while loading Melanie Crafting Progression Core custom info. Aborting to prevent save break."); } } } public class Sawmill : Refine { public override void OnNetworkSpawn() { recipeList = Plugin.sawmill; } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { base.__initializeRpcs(); } protected internal override string __getTypeName() { return "Sawmill"; } } public class Stack : NetworkBehaviour { public Item item; [SerializeField] private short ingredientID; [SerializeField] private InteractTrigger trigger; [SerializeField] private GameObject[] stackVisual; internal static List stacks = new List(); private uint size = 0u; private uint value = 0u; public void Interact(PlayerControllerB player) { //IL_0096: Unknown result type (might be due to invalid IL or missing references) Ingredient ingredient = default(Ingredient); if (player.isHoldingObject && ((Object)(object)player.currentlyHeldObjectServer.itemProperties == (Object)(object)item || (((Component)player.currentlyHeldObjectServer).TryGetComponent(ref ingredient) && ingredient.ingredient.Contains(ingredientID))) && size != uint.MaxValue) { AddServerRpc(player.currentlyHeldObjectServer.scrapValue); player.DespawnHeldObject(); } else if (size != 0 && player.FirstEmptyItemSlot((GrabbableObject)null) != -1) { GrabServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)player).NetworkObject), (int)Math.Abs(value / size)); } } [ServerRpc(RequireOwnership = false)] private void AddServerRpc(int valAdd) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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 val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(522117114u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, valAdd); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 522117114u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; AddClientRpc(valAdd); } } } [ClientRpc] private void AddClientRpc(int valAdd) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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 val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3726995468u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, valAdd); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3726995468u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; size++; value = Math.Min(value + (uint)valAdd, uint.MaxValue); if (size <= stackVisual.Length) { for (int i = 0; i < stackVisual.Length; i++) { if (i >= size) { stackVisual[i].SetActive(false); } else { stackVisual[i].SetActive(true); } } } trigger.hoverTip = $"Add or Take : [LMB]\n{item.itemName} : {size}\nValue : {value}"; } [ServerRpc(RequireOwnership = false)] private void GrabServerRpc(NetworkObjectReference netPlayerRef, int valSub) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_008c: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0156: 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.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3116309782u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref netPlayerRef, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val, valSub); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3116309782u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if (size != 0) { NetworkObject component = Object.Instantiate(item.spawnPrefab, ((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform).GetComponent(); component.Spawn(false); NetworkObject val3 = default(NetworkObject); if (((NetworkObjectReference)(ref netPlayerRef)).TryGet(ref val3, (NetworkManager)null)) { PlayerControllerB component2 = ((Component)val3).GetComponent(); component2.GrabObjectClientRpc(true, NetworkObjectReference.op_Implicit(component)); ((Component)component).GetComponent().ChangeOwnershipOfPropServerRpc(component2.actualClientId); GrabClientRpc(NetworkObjectReference.op_Implicit(component), valSub, component2.actualClientId); } } } [ClientRpc] private void GrabClientRpc(NetworkObjectReference netObjRef, int valSub, ulong id) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_008c: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: 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 val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1834714071u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref netObjRef, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val, valSub); BytePacker.WriteValueBitPacked(val, id); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1834714071u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); ((NetworkObjectReference)(ref netObjRef)).TryGet(ref val3, (NetworkManager)null); ((Component)val3).GetComponent().SetScrapValue(valSub); size--; value -= (uint)valSub; if (size <= stackVisual.Length) { for (int i = 0; i < stackVisual.Length; i++) { if (i >= size) { stackVisual[i].SetActive(false); } else { stackVisual[i].SetActive(true); } } } trigger.hoverTip = $"Add or Take : [LMB]\n{item.itemName} : {size}\nValue : {value}"; ((Component)val3).transform.localScale = Vector3.one; if (GameNetworkManager.Instance.localPlayerController.actualClientId == id) { GrabbableObject component = ((Component)val3).GetComponent(); PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; localPlayerController.carryWeight += Mathf.Clamp(item.weight - 1f, 0f, 10f); component.heldByPlayerOnServer = true; component.parentObject = localPlayerController.localItemHolder; component.GrabItemOnClient(); } } [ServerRpc(RequireOwnership = false)] private void SyncServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1127347716u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1127347716u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; SyncClientRpc(size, value); } } } [ClientRpc] private void SyncClientRpc(uint sizeEq, uint valEq) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1995251302u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, sizeEq); BytePacker.WriteValueBitPacked(val, valEq); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1995251302u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; size = sizeEq; value = valEq; for (int i = 0; i < stackVisual.Length; i++) { if (i >= size) { stackVisual[i].SetActive(false); } else { stackVisual[i].SetActive(true); } } trigger.hoverTip = $"Add or Take : [LMB]\n{item.itemName} : {size}\nValue : {value}"; } internal void Save() { try { ES3.Save(((Object)item).name, size, GameNetworkManager.Instance.currentSaveFileName); ES3.Save(((Object)item).name + "Value", value, GameNetworkManager.Instance.currentSaveFileName); } catch { Plugin.mls.LogError((object)("Issue while saving Melanie Crafting Progression Core for " + item.itemName + " stack! Aborting to prevent save break.")); } } private void Start() { if (!GameNetworkManager.Instance.isHostingGame) { SyncServerRpc(); return; } stacks.Add(this); try { if (ES3.KeyExists(((Object)item).name, GameNetworkManager.Instance.currentSaveFileName)) { size = ES3.Load(((Object)item).name, GameNetworkManager.Instance.currentSaveFileName); } if (ES3.KeyExists(((Object)item).name + "Value", GameNetworkManager.Instance.currentSaveFileName)) { value = ES3.Load(((Object)item).name + "Value", GameNetworkManager.Instance.currentSaveFileName); } SyncServerRpc(); } catch { Plugin.mls.LogError((object)("Issue while loading Melanie Crafting Progression Core for " + ((Object)item).name + " stack! Aborting to prevent save break.")); } } public override void OnDestroy() { ((NetworkBehaviour)this).OnDestroy(); if (GameNetworkManager.Instance.isHostingGame) { stacks.Remove(this); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(522117114u, new RpcReceiveHandler(__rpc_handler_522117114), "AddServerRpc"); ((NetworkBehaviour)this).__registerRpc(3726995468u, new RpcReceiveHandler(__rpc_handler_3726995468), "AddClientRpc"); ((NetworkBehaviour)this).__registerRpc(3116309782u, new RpcReceiveHandler(__rpc_handler_3116309782), "GrabServerRpc"); ((NetworkBehaviour)this).__registerRpc(1834714071u, new RpcReceiveHandler(__rpc_handler_1834714071), "GrabClientRpc"); ((NetworkBehaviour)this).__registerRpc(1127347716u, new RpcReceiveHandler(__rpc_handler_1127347716), "SyncServerRpc"); ((NetworkBehaviour)this).__registerRpc(1995251302u, new RpcReceiveHandler(__rpc_handler_1995251302), "SyncClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_522117114(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int valAdd = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref valAdd); target.__rpc_exec_stage = (__RpcExecStage)1; ((Stack)(object)target).AddServerRpc(valAdd); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3726995468(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int valAdd = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref valAdd); target.__rpc_exec_stage = (__RpcExecStage)1; ((Stack)(object)target).AddClientRpc(valAdd); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3116309782(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference netPlayerRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref netPlayerRef, default(ForNetworkSerializable)); int valSub = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref valSub); target.__rpc_exec_stage = (__RpcExecStage)1; ((Stack)(object)target).GrabServerRpc(netPlayerRef, valSub); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1834714071(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference netObjRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref netObjRef, default(ForNetworkSerializable)); int valSub = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref valSub); ulong id = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref id); target.__rpc_exec_stage = (__RpcExecStage)1; ((Stack)(object)target).GrabClientRpc(netObjRef, valSub, id); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1127347716(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((Stack)(object)target).SyncServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1995251302(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { uint sizeEq = default(uint); ByteUnpacker.ReadValueBitPacked(reader, ref sizeEq); uint valEq = default(uint); ByteUnpacker.ReadValueBitPacked(reader, ref valEq); target.__rpc_exec_stage = (__RpcExecStage)1; ((Stack)(object)target).SyncClientRpc(sizeEq, valEq); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "Stack"; } } [Serializable] public class ToolRandom { public string toolName; public int toolID; } public class TreeHit : MonoBehaviour, IHittable { bool IHittable.Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit, bool playHitSFX, int hitID = -1) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) Ingredient ingredient = default(Ingredient); if (playerWhoHit.isHoldingObject && ((Component)playerWhoHit.currentlyHeldObjectServer).TryGetComponent(ref ingredient) && ingredient.tool == 2) { RoundManager.Instance.DestroyTreeOnLocalClient(((Component)this).transform.position); if (Random.Range(0, 2) == 0) { GlobalSpawner.Instance.SpawnItemServerRpc(3, ((Component)this).transform.position.x, ((Component)this).transform.position.y + 3f, ((Component)this).transform.position.z); } if (Random.Range(0, 2) == 0) { GlobalSpawner.Instance.SpawnItemServerRpc(8, ((Component)this).transform.position.x, ((Component)this).transform.position.y + 3f, ((Component)this).transform.position.z); } return true; } return false; } } public class Workbench : SaveCrafter { public override void OnNetworkSpawn() { recipeList = Plugin.workbench; SavePatches.workbench = this; } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { base.__initializeRpcs(); } protected internal override string __getTypeName() { return "Workbench"; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace MelanieMeliciousCraft.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }