Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Melanie Crafting Core v1.2.7
MelanieMeliciousCraft.dll
Decompiled 3 days ago
The result has been truncated due to the large size, download it to view full contents!
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<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T> { 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<T>.Count => _items.Length; T IReadOnlyList<T>.this[int index] => _items[index]; int ICollection<T>.Count => _items.Length; bool ICollection<T>.IsReadOnly => true; T IList<T>.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<T> IEnumerable<T>.GetEnumerator() { return ((IEnumerable<T>)_items).GetEnumerator(); } void ICollection<T>.Add(T item) { throw new NotSupportedException(); } void ICollection<T>.Clear() { throw new NotSupportedException(); } bool ICollection<T>.Contains(T item) { return ((ICollection<T>)_items).Contains(item); } void ICollection<T>.CopyTo(T[] array, int arrayIndex) { ((ICollection<T>)_items).CopyTo(array, arrayIndex); } bool ICollection<T>.Remove(T item) { throw new NotSupportedException(); } int IList<T>.IndexOf(T item) { return ((IList<T>)_items).IndexOf(item); } void IList<T>.Insert(int index, T item) { throw new NotSupportedException(); } void IList<T>.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<int> workbench0Cost; internal static ConfigEntry<int> crucible0Cost; internal static ConfigEntry<float> craftMin; internal static ConfigEntry<float> craftMax; internal static ConfigEntry<int> refineMin; internal static ConfigEntry<int> refineMax; internal static ConfigEntry<string> hammerList; internal static ConfigEntry<string> sawList; internal static ConfigEntry<string> axeList; internal static ConfigEntry<string> ingredientList; internal static ConfigEntry<string> logList; internal static ConfigEntry<string> plankList; internal static ConfigEntry<string> metalSheetList; internal static ConfigEntry<string> metalBarList; internal static ConfigEntry<string> goldMeltList; internal static ConfigEntry<string> ironMeltList; internal static ConfigEntry<string> aluminiumMeltList; internal static ConfigEntry<string> brassMeltList; internal static ConfigEntry<string> copperMeltList; internal static ConfigEntry<string> paperScrapList; internal static ConfigEntry<string> workbenchCraftList; internal static ConfigEntry<string> crucibleCraftList; internal static ConfigEntry<string> sawmillCraftList; internal static ConfigEntry<string> crusherCraftList; internal static ConfigEntry<bool> rakeEnable; internal static ConfigEntry<int> rakeDamage; internal static ConfigEntry<int> rakeSpawn0; internal static ConfigEntry<string> rakeSpawn1; internal static ConfigEntry<string> rakeSpawn2; internal static ConfigEntry<int> resource0Spawn; internal static ConfigEntry<int> tool0Spawn; internal static ConfigEntry<int> hammer0Spawn; internal static ConfigEntry<int> saw0Spawn; internal static ConfigEntry<int> axe0Spawn; internal static ConfigEntry<int> hammer0Cost; internal static ConfigEntry<int> saw0Cost; internal static ConfigEntry<int> axe0Cost; internal static void SetupConfig(ConfigFile config) { workbench0Cost = config.Bind<int>("Prices", "Workbench", 120, "Modify the price for the workbench."); crucible0Cost = config.Bind<int>("Prices", "Crucible", 150, "Modify the price for the crucible."); craftMin = config.Bind<float>("Item Value", "Crafting Value Minimum", 10f, "Multiplier handling changed. This is no longer used."); craftMax = config.Bind<float>("Item Value", "Crafting Value Maximum MULTIPLIER", 0.25f, "Multiplier handling changed. This is no longer used."); refineMin = config.Bind<int>("Item Value", "Refine Value Minimum", 0, "Multiplier handling changed. This is no longer used."); refineMax = config.Bind<int>("Item Value", "Refine Value Maximum", 20, "Multiplier handling changed. This is no longer used."); hammerList = config.Bind<string>("Custom Tools", "Works as Hammer", string.Empty, "This is hammer."); sawList = config.Bind<string>("Custom Tools", "Works as Saw", string.Empty, "This is saw."); axeList = config.Bind<string>("Custom Tools", "Works as Axe", string.Empty, "This item can chop down trees. (Not 100% drop rate!)"); ingredientList = config.Bind<string>("Custom Ingredients", "Craft as Custom Ingredient", string.Empty, "This is [Custom Ingredient]. Format: Item0;IngredientID, Item1;IngredientID"); logList = config.Bind<string>("Custom Ingredients", "Craft as Log", string.Empty, "This is log."); plankList = config.Bind<string>("Custom Ingredients", "Craft as Plank", string.Empty, "This is plank."); metalSheetList = config.Bind<string>("Custom Ingredients", "Craft as Metal Sheet", string.Empty, "This is metal sheet."); metalBarList = config.Bind<string>("Custom Ingredients", "Craft as Metal Bar", string.Empty, "This is metal bar."); goldMeltList = config.Bind<string>("Custom Ingredients", "Craft as Meltable Gold", string.Empty, "This is meltable as gold."); ironMeltList = config.Bind<string>("Custom Ingredients", "Craft as Meltable Iron", string.Empty, "This is meltable as iron."); aluminiumMeltList = config.Bind<string>("Custom Ingredients", "Craft as Meltable Aluminium", string.Empty, "This is meltable as aluminium."); brassMeltList = config.Bind<string>("Custom Ingredients", "Craft as Meltable Brass", string.Empty, "This is meltable as brass."); copperMeltList = config.Bind<string>("Custom Ingredients", "Craft as Meltable Copper", string.Empty, "This is meltable as copper."); paperScrapList = config.Bind<string>("Custom Ingredients", "Recyclable to Paper", string.Empty, "This is paper scrap."); workbenchCraftList = config.Bind<string>("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<string>("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<string>("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<string>("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<bool>("Hazard Spawn", "Rake Traps Enabled", true, "Modify if rake traps spawn."); rakeDamage = config.Bind<int>("Hazard Spawn", "Rake Trap Damage", 40, "Modify the damage for rake traps."); rakeSpawn0 = config.Bind<int>("Hazard Spawn", "Rake Trap Global", 8, "Modify the weights for rake traps spawning on any moon."); rakeSpawn1 = config.Bind<string>("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<string>("Hazard Spawn", "Rake Trap By Key", "Experimentation:5", "Modify the weights for rake traps spawning on moons by certain keys."); resource0Spawn = config.Bind<int>("Scrap Spawn", "General Resource Global Spawns", 30, "Modify the weights for resources to spawn as scrap."); tool0Spawn = config.Bind<int>("Scrap Spawn", "General Tool Global Spawns", 30, "Modify the weights for tools to spawn as scrap."); hammer0Spawn = config.Bind<int>("Scrap Spawn", "Hammer Global Spawns", 40, "Modify the weights for hammers to spawn as scrap."); saw0Spawn = config.Bind<int>("Scrap Spawn", "Saw Global Spawns", 30, "Modify the weights for saw to spawn as scrap."); axe0Spawn = config.Bind<int>("Scrap Spawn", "Axe Global Spawns", 30, "Modify the weights for axe to spawn as scrap."); hammer0Cost = config.Bind<int>("Store Setup", "Hammer Price", -1, "Modify the price for hammers in the store. Set -1 to not register into the store."); saw0Cost = config.Bind<int>("Store Setup", "Saw Price", -1, "Modify the price for saws in the store. Set -1 to not register into the store."); axe0Cost = config.Bind<int>("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<short> tools = new List<short>(); public Transform spawnPos; public List<Recipe> recipeList; [SerializeField] private Animator anim; private int craftAnim = Animator.StringToHash("Craft"); public void Craft() { Craft(0); } public async void Craft(int delay) { List<NetworkObject> delete = new List<NetworkObject>(); List<short[]> ingredients = new List<short[]>(); 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<Ingredient>(ref ingredient) && ((Component)child).TryGetComponent<GrabbableObject>(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<NetworkObject>()); 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<NetworkObjectReference>(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<GameObject>(val3.spawnPrefab, spawnPos.position, spawnPos.rotation, ((Component)this).transform); val4.GetComponent<NetworkObject>().Spawn(false); SpawnItemClientRpc(NetworkObjectReference.op_Implicit(val4.GetComponent<NetworkObject>()), 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<NetworkObjectReference>(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<GrabbableObject>().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<NetworkObjectReference>(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<NetworkObjectReference>(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<float>(ref posX, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref posY, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(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<GameObject>(val3.spawnPrefab, new Vector3(posX, posY, posZ), Quaternion.identity, RoundManager.Instance.spawnedScrapContainer); val4.GetComponent<NetworkObject>().Spawn(false); SpawnItemClientRpc(NetworkObjectReference.op_Implicit(val4.GetComponent<NetworkObject>()), (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<NetworkObjectReference>(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<GrabbableObject>().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<float>(ref posX, default(ForPrimitives)); float posY = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref posY, default(ForPrimitives)); float posZ = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(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<NetworkObjectReference>(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<Ingredient>(ref ingredient)) { if (((Component)val).TryGetComponent<Ingredient>(ref ingredient2)) { ingredient2.ingredient = ingredient.ingredient; continue; } ingredient2 = ((Component)val).gameObject.AddComponent<Ingredient>(); 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<GameObject>(Plugin.bundle.LoadAsset<GameObject>("Assets/MelanieCrafting/Prefab/MMCraftSpawn.prefab"), Vector3.zero, Quaternion.identity); val.GetComponent<NetworkObject>().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<string> readOnlySpan = new ReadOnlySpan<string>(array); readOnlySpan.CopyTo(new Span<string>(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<string>(array2); readOnlySpan.CopyTo(new Span<string>(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<string>(array); readOnlySpan.CopyTo(new Span<string>(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<string>(array2); readOnlySpan.CopyTo(new Span<string>(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<string>(array); readOnlySpan.CopyTo(new Span<string>(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<short>(), 1, 1, 1, 5); Plugin.RegisterRecipe(Plugin.crucible, items11, new short[1][] { new short[2] { 41, 2 } }, Array.Empty<short>(), 2, 2, 2, 5); Plugin.RegisterRecipe(Plugin.crucible, items11, new short[1][] { new short[2] { 41, 3 } }, Array.Empty<short>(), 3, 3, 3, 5); Plugin.RegisterRecipe(Plugin.crucible, items11, new short[1][] { new short[2] { 41, 4 } }, Array.Empty<short>(), 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<short>(), 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<SpawnableOutsideObject>("Assets/MelanieCrafting/Asset/Hazard/RakeTrap0.asset"); int value = MelanieCraftCfg.rakeSpawn0.Value; List<SpawnableOutsideObjectWithRarity> list = new List<SpawnableOutsideObjectWithRarity>(); foreach (ExtendedLevel extendedLevel in PatchedContent.ExtendedLevels) { if (value != 0) { list.Clear(); list.AddRange(CollectionExtensions.AddItem<SpawnableOutsideObjectWithRarity>((IEnumerable<SpawnableOutsideObjectWithRarity>)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<SpawnableOutsideObjectWithRarity>((IEnumerable<SpawnableOutsideObjectWithRarity>)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<SpawnableOutsideObjectWithRarity>((IEnumerable<SpawnableOutsideObjectWithRarity>)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<TreeHit>(); } [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<Ingredient>(ref ingredient)) { ingredient.ingredient.Add(48); } else { ((Component)__instance).gameObject.AddComponent<Ingredient>().ingredient.Add(48); } } [HarmonyTranspiler] [HarmonyPatch(typeof(RoundManager), "SpawnMapObjects")] [HarmonyPriority(800)] private static IEnumerable<CodeInstruction> TranspilerSMO(IEnumerable<CodeInstruction> 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<CodeInstruction> 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>((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<Recipe> 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<Item> list = new List<Item>(); 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<short[]> list2 = new List<short[]>(); List<short> list3 = new List<short>(); 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<Ingredient>(ref ingredient)) { ingredient.ingredient.Add(ID); } else { item.spawnPrefab.AddComponent<Ingredient>().ingredient.Add(ID); } } private static void AddTool(Item item, short ID) { Ingredient ingredient = default(Ingredient); if (!item.spawnPrefab.TryGetComponent<Ingredient>(ref ingredient)) { ingredient = item.spawnPrefab.AddComponent<Ingredient>(); } ingredient.tool = ID; } } [InjectInterface(typeof(TerrainObstacleTrigger))] public interface IAwake { void Awake(); } public class Ingredient : MonoBehaviour { public List<short> ingredient = new List<short>(); 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<ScanNodeProperties>().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<Item> itemList; public static Plugin instance; public static List<GameObject> hazardInside = new List<GameObject>(); public static List<Recipe> workbench = new List<Recipe>(); public static List<Recipe> crucible = new List<Recipe>(); public static List<Recipe> sawmill = new List<Recipe>(); public static List<Recipe> crusher = new List<Recipe>(); 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<UnlockablesList>("Assets/MelanieCrafting/Asset/Unlockable.asset").unlockables.ToArray(); itemList = bundle.LoadAsset<AllItemsList>("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<ExtendedMod>("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<short>(), 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<short>(), 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<short>(), 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<short>(), 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<short>(), 1, 1, 1, 5, 5, 0.25f); RegisterRecipe(workbench, itemList[23], new short[1][] { new short[2] { 60, 1 } }, Array.Empty<short>(), 1, 1, 1, 5, 5, 0.25f); RegisterRecipe(crucible, itemList[9], new short[1][] { new short[2] { 31, 1 } }, Array.Empty<short>(), 1, 1, 1, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[9], new short[1][] { new short[2] { 31, 2 } }, Array.Empty<short>(), 2, 2, 2, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[9], new short[1][] { new short[2] { 31, 3 } }, Array.Empty<short>(), 3, 3, 3, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[9], new short[1][] { new short[2] { 31, 4 } }, Array.Empty<short>(), 4, 4, 4, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[10], new short[1][] { new short[2] { 33, 1 } }, Array.Empty<short>(), 1, 1, 1, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[10], new short[1][] { new short[2] { 33, 2 } }, Array.Empty<short>(), 2, 2, 2, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[10], new short[1][] { new short[2] { 33, 3 } }, Array.Empty<short>(), 3, 3, 3, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[10], new short[1][] { new short[2] { 33, 4 } }, Array.Empty<short>(), 4, 4, 4, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[11], new short[1][] { new short[2] { 35, 1 } }, Array.Empty<short>(), 1, 1, 1, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[11], new short[1][] { new short[2] { 35, 2 } }, Array.Empty<short>(), 2, 2, 2, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[11], new short[1][] { new short[2] { 35, 3 } }, Array.Empty<short>(), 3, 3, 3, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[11], new short[1][] { new short[2] { 35, 4 } }, Array.Empty<short>(), 4, 4, 4, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[11], new short[1][] { new short[2] { 62, 8 } }, Array.Empty<short>(), 8, 8, 1, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[12], new short[1][] { new short[2] { 37, 1 } }, Array.Empty<short>(), 1, 1, 1, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[12], new short[1][] { new short[2] { 37, 2 } }, Array.Empty<short>(), 2, 2, 2, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[12], new short[1][] { new short[2] { 37, 3 } }, Array.Empty<short>(), 3, 3, 3, 5, 5, 0.1f); RegisterRecipe(crucible, itemList[12], new short[1][] { new short[2] { 37, 4 } }, Array.Empty<short>(), 4, 4, 4, 5, 5, 0.1f); RegisterRecipe(sawmill, itemList[4], new short[1][] { new short[2] { 19, 1 } }, Array.Empty<short>(), 1, 1, 2, 5, 10, 1.25f); RegisterRecipe(sawmill, itemList[5], new short[1][] { new short[2] { 20, 1 } }, Array.Empty<short>(), 1, 1, 2, 5, 5, 0.5f); RegisterRecipe(crusher, itemList[22], new short[1][] { new short[2] { 61, 1 } }, Array.Empty<short>(), 1, 1, 1, 5, 10, 0.3f); LethalLevelLoaderNetworkManager.RegisterNetworkPrefab(bundle.LoadAsset<GameObject>("Assets/MelanieCrafting/Prefab/MMCraftSpawn.prefab")); LethalLevelLoaderNetworkManager.RegisterNetworkPrefab(bundle.LoadAsset<GameObject>("Assets/MelanieCrafting/Prefab/Hazard/RakeTrap0.prefab")); if (!alt) { PatchedContent.RegisterExtendedMod(extMod); } } public static void RegisterRecipe(List<Recipe> 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<Recipe> 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<StringWithRarity>(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<DawnItemInfo> val = NamespacedKey<DawnItemInfo>.From("melaniecrafting", ((Object)item).name); DawnLib.RegisterNetworkPrefab(item.spawnPrefab); DawnLib.DefineItem(val, item, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder itemInfo) { if (weight > 0) { itemInfo.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrap) { scrap.SetWeights((Action<WeightTableBuilder<DawnMoonInfo, SpawnWeightContext>>)delegate(WeightTableBuilder<DawnMoonInfo, SpawnWeightContext> setWeight) { setWeight.SetGlobalWeight(weight); }); }); } else { itemInfo.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrap) { scrap.SetWeights((Action<WeightTableBuilder<DawnMoonInfo, SpawnWeightContext>>)delegate { }); }); } if (cost != -1) { itemInfo.DefineShop((Action<ShopBuilder>)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<DawnUnlockableItemInfo>.From("melaniecrafting", unlock.unlockableName), unlock, (Action<UnlockableInfoBuilder>)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<bool>(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<bool>(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<NetworkObject>().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<NetworkObject>().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<bool>(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<bool>(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<Recipe> recipeList; public void Craft(PlayerControllerB playerWhoTriggered) { if (!playerWhoTriggered.isHoldingObject) { return; } GrabbableObject currentlyHeldObjectServer = playerWhoTriggered.currentlyHeldObjectServer; Ingredient ingredient = default(Ingredient); if (!((Component)currentlyHeldObjectServer).TryGetComponent<Ingredient>(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<GameObject>(val3.spawnPrefab, spawnPos.position, spawnPos.rotation, ((Component)this).transform); val4.GetComponent<NetworkObject>().Spawn(false); SpawnItemClientRpc(NetworkObjectReference.op_Implicit(val4.GetComponent<NetworkObject>()), 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<NetworkObjectReference>(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<GrabbableObject>().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<NetworkObjectReference>(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<GameObject> upgrades = new List<GameObject>(); public List<short> canAddTools = new List<short>(); private bool synced = false; public void AddTool(PlayerControllerB player) { Ingredient ingredient = default(Ingredient); if (player.isHoldingObject && ((Component)player.currentlyHeldObjectServer).TryGetComponent<Ingredient>(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