using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.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]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
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> 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<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> 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, "Directly change the first random range value (usually minimum) for how much value is added when crafting.");
craftMax = config.Bind<float>("Item Value", "Crafting Value Maximum MULTIPLIER", 0.25f, "Change the multiplier applied to the second random range value (usually maximum) applied to a copy of total craft value.");
refineMin = config.Bind<int>("Item Value", "Refine Value Minimum", 0, "Change the minimum value added when refining.");
refineMax = config.Bind<int>("Item Value", "Refine Value Maximum", 20, "Change the maximum value added when refining.");
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!)");
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.");
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.");
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 Recipe[] recipeList;
public float craftMin = 0f;
public float craftMax = 0f;
[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 child2 = item2;
if (((Component)child2).TryGetComponent<Ingredient>(ref ingredient) && ((Component)child2).TryGetComponent<GrabbableObject>(ref item))
{
foreach (short type in ingredient.ingredient)
{
bool added2 = false;
foreach (short[] heldType in ingredients)
{
if (heldType[0] == type)
{
heldType[1]++;
added2 = true;
break;
}
}
if (!added2)
{
ingredients.Add(new short[2] { type, 1 });
}
}
if (ingredient.consumable)
{
delete.Add(((Component)child2).GetComponent<NetworkObject>());
dishValue += item.scrapValue;
}
iteration++;
}
ingredient = null;
item = null;
}
if (iteration == 0)
{
return;
}
Recipe[] array = recipeList;
foreach (Recipe recipe in array)
{
if (iteration < recipe.min || iteration > recipe.max)
{
continue;
}
bool added2 = true;
short[] array2 = recipe.tools;
foreach (short tool in array2)
{
if (!tools.Contains(tool))
{
added2 = false;
break;
}
}
if (!added2)
{
continue;
}
short[][] ingredients2 = recipe.ingredients;
foreach (short[] required in ingredients2)
{
added2 = false;
foreach (short[] held in ingredients)
{
if (held[0] == required[0] && held[1] >= required[1])
{
added2 = true;
break;
}
}
if (!added2)
{
break;
}
}
if (!added2)
{
continue;
}
foreach (NetworkObject child in delete)
{
if ((Object)(object)child != (Object)null)
{
DeleteItemServerRpc(NetworkObjectReference.op_Implicit(child));
}
}
if ((Object)(object)anim != (Object)null && anim.HasState(0, craftAnim))
{
AnimServerRpc();
}
await Task.Delay(delay, ((MonoBehaviour)this).destroyCancellationToken);
for (int i = 0; i < recipe.quantity; i++)
{
SpawnItemServerRpc(Array.IndexOf(recipeList, recipe), (int)((float)dishValue + Random.Range(craftMin, (float)dishValue * craftMax)) / 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 val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1677710912u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netObj, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1677710912u, val, (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_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2569922090u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, itemList);
BytePacker.WriteValueBitPacked(val2, dishValue);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2569922090u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
GameObject val3 = Object.Instantiate<GameObject>(recipeList[itemList].product.spawnPrefab, spawnPos.position, spawnPos.rotation, spawnPos);
val3.GetComponent<NetworkObject>().Spawn(false);
SpawnItemClientRpc(NetworkObjectReference.op_Implicit(val3.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 val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(531173574u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable));
BytePacker.WriteValueBitPacked(val2, value);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 531173574u, val, (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 val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3912903399u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3912903399u, val, (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 val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1155555877u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1155555877u, val, (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.ToArray();
HarmonyPatches.crucible = this;
}
protected override void __initializeVariables()
{
base.__initializeVariables();
}
protected override void __initializeRpcs()
{
base.__initializeRpcs();
}
protected internal override string __getTypeName()
{
return "Crucible";
}
}
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 val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4034897490u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, itemList);
((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref posX, default(ForPrimitives));
((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref posY, default(ForPrimitives));
((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref posZ, default(ForPrimitives));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4034897490u, val, (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>()), Random.Range(val3.minValue, val3.maxValue));
}
}
}
[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 val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(978084037u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable));
BytePacker.WriteValueBitPacked(val2, value);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 978084037u, val, (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";
}
}
public class HarmonyPatches
{
internal static Workbench workbench;
internal static Crucible crucible;
private static bool loadedIngredient;
private static bool loadedHazard;
[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")]
private static void PostStart(StartOfRound __instance)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
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 (!loadedIngredient)
{
string[] array = MelanieCraftCfg.hammerList.Value.Split(',');
string[] array2 = MelanieCraftCfg.sawList.Value.Split(',');
string[] array3 = MelanieCraftCfg.axeList.Value.Split(',');
string[] array4 = MelanieCraftCfg.logList.Value.Split(',');
string[] array5 = MelanieCraftCfg.plankList.Value.Split(',');
string[] array6 = MelanieCraftCfg.metalSheetList.Value.Split(',');
int num = 0;
string[] array7 = new string[1 + array6.Length];
ReadOnlySpan<string> readOnlySpan = new ReadOnlySpan<string>(array6);
readOnlySpan.CopyTo(new Span<string>(array7).Slice(num, readOnlySpan.Length));
num += readOnlySpan.Length;
array7[num] = "Metal sheet";
string[] array8 = array7;
string[] array9 = MelanieCraftCfg.metalBarList.Value.Split(',');
array7 = MelanieCraftCfg.goldMeltList.Value.Split(',');
num = 0;
array6 = new string[2 + array7.Length];
readOnlySpan = new ReadOnlySpan<string>(array7);
readOnlySpan.CopyTo(new Span<string>(array6).Slice(num, readOnlySpan.Length));
num += readOnlySpan.Length;
array6[num] = "Golden cup";
num++;
array6[num] = "Ring";
string[] array10 = array6;
array6 = MelanieCraftCfg.ironMeltList.Value.Split(',');
num = 0;
array7 = new string[4 + array6.Length];
readOnlySpan = new ReadOnlySpan<string>(array6);
readOnlySpan.CopyTo(new Span<string>(array7).Slice(num, readOnlySpan.Length));
num += readOnlySpan.Length;
array7[num] = "Big bolt";
num++;
array7[num] = "Large axle";
num++;
array7[num] = "V-type engine";
num++;
array7[num] = "Garbage lid";
string[] array11 = array7;
array7 = MelanieCraftCfg.aluminiumMeltList.Value.Split(',');
num = 0;
array6 = new string[4 + array7.Length];
readOnlySpan = new ReadOnlySpan<string>(array7);
readOnlySpan.CopyTo(new Span<string>(array6).Slice(num, readOnlySpan.Length));
num += readOnlySpan.Length;
array6[num] = "Cookie pan";
num++;
array6[num] = "Red soda";
num++;
array6[num] = "Stop sign";
num++;
array6[num] = "Yield sign";
string[] array12 = array6;
array6 = MelanieCraftCfg.brassMeltList.Value.Split(',');
num = 0;
array7 = new string[2 + array6.Length];
readOnlySpan = new ReadOnlySpan<string>(array6);
readOnlySpan.CopyTo(new Span<string>(array7).Slice(num, readOnlySpan.Length));
num += readOnlySpan.Length;
array7[num] = "Bell";
num++;
array7[num] = "Cash register";
string[] array13 = array7;
string[] array14 = MelanieCraftCfg.copperMeltList.Value.Split(',');
foreach (Item items in __instance.allItemsList.itemsList)
{
string[] array15 = array;
foreach (string text in array15)
{
if (items.itemName == text)
{
AddTool(items, 0);
}
}
string[] array16 = array2;
foreach (string text2 in array16)
{
if (items.itemName == text2)
{
AddTool(items, 1);
}
}
string[] array17 = array3;
foreach (string text3 in array17)
{
if (items.itemName == text3)
{
AddTool(items, 2);
}
}
if (items.itemName == "Zap gun")
{
AddIngredient(items, 49);
}
else if (items.itemName == "Radar-booster")
{
AddIngredient(items, 50);
}
string[] array18 = array4;
foreach (string text4 in array18)
{
if (items.itemName == text4)
{
AddIngredient(items, 19);
}
}
string[] array19 = array5;
foreach (string text5 in array19)
{
if (items.itemName == text5)
{
AddIngredient(items, 20);
}
}
string[] array20 = array8;
foreach (string text6 in array20)
{
if (items.itemName == text6)
{
AddIngredient(items, 27);
}
}
string[] array21 = array9;
foreach (string text7 in array21)
{
if (items.itemName == text7)
{
AddIngredient(items, 30);
}
}
string[] array22 = array10;
foreach (string text8 in array22)
{
if (items.itemName == text8)
{
AddIngredient(items, 41);
}
}
string[] array23 = array11;
foreach (string text9 in array23)
{
if (items.itemName == text9)
{
AddIngredient(items, 31);
}
}
string[] array24 = array12;
foreach (string text10 in array24)
{
if (items.itemName == text10)
{
AddIngredient(items, 33);
}
}
string[] array25 = array13;
foreach (string text11 in array25)
{
if (items.itemName == text11)
{
AddIngredient(items, 35);
}
}
string[] array26 = array14;
foreach (string text12 in array26)
{
if (items.itemName == text12)
{
AddIngredient(items, 37);
}
}
}
Item val2 = null;
foreach (Item items2 in __instance.allItemsList.itemsList)
{
if (items2.itemName == "Gold bar")
{
val2 = items2;
break;
}
}
Item val3 = null;
foreach (Item items3 in __instance.allItemsList.itemsList)
{
if (items3.itemName == "Key")
{
val3 = items3;
break;
}
}
if ((Object)(object)val2 != (Object)null)
{
Plugin.RegisterRecipe(Plugin.crucible, val2, new short[1][] { new short[2] { 41, 1 } }, Array.Empty<short>(), 1, 1, 1, 5);
Plugin.RegisterRecipe(Plugin.crucible, val2, new short[1][] { new short[2] { 41, 2 } }, Array.Empty<short>(), 2, 2, 2, 5);
Plugin.RegisterRecipe(Plugin.crucible, val2, new short[1][] { new short[2] { 41, 3 } }, Array.Empty<short>(), 3, 3, 3, 5);
Plugin.RegisterRecipe(Plugin.crucible, val2, new short[1][] { new short[2] { 41, 4 } }, Array.Empty<short>(), 4, 4, 4, 5);
}
if ((Object)(object)val3 != (Object)null)
{
Plugin.RegisterRecipe(Plugin.workbench, val3, new short[1][] { new short[2] { 36, 1 } }, Array.Empty<short>(), 1, 1, 6, 5);
}
loadedIngredient = true;
}
if ((Object)(object)workbench != (Object)null)
{
workbench.recipeList = Plugin.workbench.ToArray();
}
if ((Object)(object)crucible != (Object)null)
{
crucible.recipeList = Plugin.crucible.ToArray();
}
GrabbableObject[] array27 = (GrabbableObject[])(object)Object.FindObjectsOfType(typeof(GrabbableObject));
GrabbableObject[] array28 = array27;
Ingredient ingredient = default(Ingredient);
foreach (GrabbableObject val4 in array28)
{
if ((Object)(object)val4.itemProperties != (Object)null && (Object)(object)val4.itemProperties.spawnPrefab != (Object)null && val4.itemProperties.spawnPrefab.TryGetComponent<Ingredient>(ref ingredient))
{
Ingredient ingredient2 = ((Component)val4).gameObject.AddComponent<Ingredient>();
ingredient2.ingredient = ingredient.ingredient;
}
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(StartOfRound), "Start")]
private static void PreStart()
{
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Expected O, but got Unknown
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Expected O, but got Unknown
//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
//IL_02c7: Expected O, but got Unknown
if (loadedHazard)
{
return;
}
if (MelanieCraftCfg.rakeEnable.Value)
{
SpawnableOutsideObject val = 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(val, AnimationCurve.Constant(0f, 1f, (float)value))));
extendedLevel.SelectableLevel.spawnableOutsideObjects = list.ToArray();
}
foreach (ContentTag contentTag in ((ExtendedContent)extendedLevel).ContentTags)
{
string[] array = MelanieCraftCfg.rakeSpawn1.Value.Split(',');
foreach (string text in array)
{
if (text == string.Empty)
{
continue;
}
try
{
string[] array2 = text.Split(':');
if (array2.Length == 3)
{
array2 = new string[2]
{
array2[1],
array2[2]
};
}
if (contentTag.contentTagName.ToLower() == array2[0].ToLower())
{
list.Clear();
list.AddRange(CollectionExtensions.AddItem<SpawnableOutsideObjectWithRarity>((IEnumerable<SpawnableOutsideObjectWithRarity>)extendedLevel.SelectableLevel.spawnableOutsideObjects, new SpawnableOutsideObjectWithRarity(val, AnimationCurve.Constant(0f, 1f, (float)short.Parse(array2[1])))));
extendedLevel.SelectableLevel.spawnableOutsideObjects = list.ToArray();
break;
}
}
catch
{
Plugin.mls.LogError((object)"Invalid config input for rake trap by tag. Skipping this iteration");
}
}
}
string[] array3 = MelanieCraftCfg.rakeSpawn2.Value.Split(',');
foreach (string text2 in array3)
{
if (text2 == string.Empty)
{
continue;
}
try
{
string[] array4 = text2.Split(':');
if (array4.Length == 3)
{
array4 = new string[2]
{
array4[1],
array4[2]
};
}
if (extendedLevel.NumberlessPlanetName.ToLower() == array4[0].ToLower())
{
list.Clear();
list.AddRange(CollectionExtensions.AddItem<SpawnableOutsideObjectWithRarity>((IEnumerable<SpawnableOutsideObjectWithRarity>)extendedLevel.SelectableLevel.spawnableOutsideObjects, new SpawnableOutsideObjectWithRarity(val, AnimationCurve.Constant(0f, 1f, (float)short.Parse(array4[1])))));
extendedLevel.SelectableLevel.spawnableOutsideObjects = list.ToArray();
break;
}
}
catch
{
Plugin.mls.LogError((object)"Invalid config input for rake trap by tag. Skipping this iteration");
}
}
}
}
if (GameNetworkManager.Instance.isHostingGame)
{
workbench = null;
}
}
[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(LungProp), "Start")]
private static void PostLungProp(LungProp __instance)
{
((Component)__instance).gameObject.AddComponent<Ingredient>().ingredient.Add(48);
}
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 class InteractItem : GrabbableObject
{
[CompilerGenerated]
private sealed class <DrunkTime>d__9 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public int time;
public InteractItem <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DrunkTime>d__9(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(2f * Time.deltaTime);
<>1__state = 1;
return true;
case 1:
{
<>1__state = -1;
PlayerControllerB playerHeldBy4 = ((GrabbableObject)<>4__this).playerHeldBy;
playerHeldBy4.drunkness += 1f;
PlayerControllerB playerHeldBy5 = ((GrabbableObject)<>4__this).playerHeldBy;
playerHeldBy5.drunknessInertia += 1f;
PlayerControllerB playerHeldBy6 = ((GrabbableObject)<>4__this).playerHeldBy;
playerHeldBy6.drunknessSpeed += 1f;
<>2__current = (object)new WaitForSeconds((float)time * Time.deltaTime);
<>1__state = 2;
return true;
}
case 2:
{
<>1__state = -1;
PlayerControllerB playerHeldBy = ((GrabbableObject)<>4__this).playerHeldBy;
playerHeldBy.drunkness -= 1f;
PlayerControllerB playerHeldBy2 = ((GrabbableObject)<>4__this).playerHeldBy;
playerHeldBy2.drunknessInertia -= 1f;
PlayerControllerB playerHeldBy3 = ((GrabbableObject)<>4__this).playerHeldBy;
playerHeldBy3.drunknessSpeed -= 1f;
return false;
}
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public 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));
}
[IteratorStateMachine(typeof(<DrunkTime>d__9))]
private IEnumerator DrunkTime(int time)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DrunkTime>d__9(0)
{
<>4__this = this,
time = time
};
}
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.1.0")]
public class Plugin : BaseUnityPlugin
{
private const string GUID = "MelanieMelicious.CraftCore";
private const string NAME = "MelanieMelicious - Crafting Progression Core";
private const string VERSION = "1.1.0";
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<Recipe> workbench = new List<Recipe>();
public static List<Recipe> crucible = 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]);
Item(itemList[13]);
Item(itemList[14]);
Item(itemList[15]);
RegisterRecipe(workbench, itemList[4], new short[1][] { new short[2] { 19, 1 } }, new short[1] { 1 }, 1, 1, 1, 5);
RegisterRecipe(workbench, itemList[5], new short[1][] { new short[2] { 20, 1 } }, new short[1] { 1 }, 1, 1, 2, 5);
RegisterRecipe(workbench, itemList[2], new short[1][] { new short[2] { 27, 2 } }, Array.Empty<short>(), 2, 2, 1, 5);
RegisterRecipe(workbench, itemList[7], new short[2][]
{
new short[2] { 27, 2 },
new short[2] { 25, 1 }
}, Array.Empty<short>(), 3, 3, 1, 5);
RegisterRecipe(workbench, itemList[1], new short[2][]
{
new short[2] { 30, 1 },
new short[2] { 25, 1 }
}, Array.Empty<short>(), 2, 2, 1, 5);
RegisterRecipe(workbench, itemList[13], new short[1][] { new short[2] { 32, 5 } }, new short[1], 5, 5, 1, 5);
RegisterRecipe(workbench, itemList[14], new short[1][] { new short[2] { 32, 1 } }, new short[2] { 0, 2 }, 1, 1, 1, 5);
RegisterRecipe(workbench, itemList[15], new short[1][] { new short[2] { 34, 1 } }, new short[2] { 0, 2 }, 1, 1, 1, 5);
RegisterRecipe(crucible, itemList[9], new short[1][] { new short[2] { 31, 1 } }, Array.Empty<short>(), 1, 1, 1, 5);
RegisterRecipe(crucible, itemList[9], new short[1][] { new short[2] { 31, 2 } }, Array.Empty<short>(), 2, 2, 2, 5);
RegisterRecipe(crucible, itemList[9], new short[1][] { new short[2] { 31, 3 } }, Array.Empty<short>(), 3, 3, 3, 5);
RegisterRecipe(crucible, itemList[9], new short[1][] { new short[2] { 31, 4 } }, Array.Empty<short>(), 4, 4, 4, 5);
RegisterRecipe(crucible, itemList[10], new short[1][] { new short[2] { 33, 1 } }, Array.Empty<short>(), 1, 1, 1, 5);
RegisterRecipe(crucible, itemList[10], new short[1][] { new short[2] { 33, 2 } }, Array.Empty<short>(), 2, 2, 2, 5);
RegisterRecipe(crucible, itemList[10], new short[1][] { new short[2] { 33, 3 } }, Array.Empty<short>(), 3, 3, 3, 5);
RegisterRecipe(crucible, itemList[10], new short[1][] { new short[2] { 33, 4 } }, Array.Empty<short>(), 4, 4, 4, 5);
RegisterRecipe(crucible, itemList[11], new short[1][] { new short[2] { 35, 1 } }, Array.Empty<short>(), 1, 1, 1, 5);
RegisterRecipe(crucible, itemList[11], new short[1][] { new short[2] { 35, 2 } }, Array.Empty<short>(), 2, 2, 2, 5);
RegisterRecipe(crucible, itemList[11], new short[1][] { new short[2] { 35, 3 } }, Array.Empty<short>(), 3, 3, 3, 5);
RegisterRecipe(crucible, itemList[11], new short[1][] { new short[2] { 35, 4 } }, Array.Empty<short>(), 4, 4, 4, 5);
RegisterRecipe(crucible, itemList[12], new short[1][] { new short[2] { 37, 1 } }, Array.Empty<short>(), 1, 1, 1, 5);
RegisterRecipe(crucible, itemList[12], new short[1][] { new short[2] { 37, 2 } }, Array.Empty<short>(), 2, 2, 2, 5);
RegisterRecipe(crucible, itemList[12], new short[1][] { new short[2] { 37, 3 } }, Array.Empty<short>(), 3, 3, 3, 5);
RegisterRecipe(crucible, itemList[12], new short[1][] { new short[2] { 37, 4 } }, Array.Empty<short>(), 4, 4, 4, 5);
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)
{
addToCookerRecipes.Add(new Recipe
{
ingredients = ingredientsAndCount,
min = min,
max = max,
product = product,
quantity = productQuantity,
priority = priority,
tools = tools
});
}
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);
});
});
}
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 val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2237943435u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref state, default(ForPrimitives));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2237943435u, val, (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 val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3834622412u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref state, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3834622412u, val, (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 val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3820099073u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3820099073u, val, (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;
}
public class Refine : NetworkBehaviour
{
public Transform spawnPos;
public Recipe[] recipeList;
public float refineMin;
public float refineMax;
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;
}
Recipe[] array = recipeList;
foreach (Recipe recipe in array)
{
if (ingredient.ingredient.Contains(recipe.ingredients[0][0]))
{
for (int j = 0; j < recipe.quantity; j++)
{
SpawnItemServerRpc(Array.IndexOf(recipeList, recipe), (int)((float)currentlyHeldObjectServer.scrapValue + Random.Range(refineMin, refineMax)) / 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_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(891307308u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, itemList);
BytePacker.WriteValueBitPacked(val2, dishValue);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 891307308u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
GameObject val3 = Object.Instantiate<GameObject>(recipeList[itemList].product.spawnPrefab, spawnPos.position, spawnPos.rotation, spawnPos);
val3.GetComponent<NetworkObject>().Spawn(false);
SpawnItemClientRpc(NetworkObjectReference.op_Implicit(val3.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 val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1707190453u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable));
BytePacker.WriteValueBitPacked(val2, value);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1707190453u, val, (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);
}
}
}
public override void OnNetworkSpawn()
{
((NetworkBehaviour)this).OnNetworkSpawn();
refineMin = MelanieCraftCfg.refineMin.Value;
refineMax = MelanieCraftCfg.refineMax.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 val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3300359901u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, tool);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3300359901u, val, (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 val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2782130414u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, tool);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2782130414u, val, (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 val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3574493460u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3574493460u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
SyncToolClientRpc(tools.ToArray());
}
}
}
[ClientRpc]
private void SyncToolClientRpc(short[] addedTools)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2960638172u, val, (RpcDelivery)0);
bool flag = addedTools != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe<short>(addedTools, default(ForPrimitives));
}
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2960638172u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
if (!synced)
{
foreach (short item in addedTools)
{
tools.Add(item);
upgrades[canAddTools.IndexOf(item)].SetActive(true);
}
synced = true;
}
}
public void LoadTools()
{
foreach (short tool in tools)
{
upgrades[canAddTools.IndexOf(tool)].SetActive(true);
}
}
public override void OnNetworkSpawn()
{
((NetworkBehaviour)this).OnNetworkSpawn();
if (!((NetworkBehaviour)this).IsHost)
{
SyncToolServerRpc();
}
}
protected override void __initializeVariables()
{
base.__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(3300359901u, new RpcReceiveHandler(__rpc_handler_3300359901), "AddToolServerRpc");
((NetworkBehaviour)this).__registerRpc(2782130414u, new RpcReceiveHandler(__rpc_handler_2782130414), "AddToolClientRpc");
((NetworkBehaviour)this).__registerRpc(3574493460u, new RpcReceiveHandler(__rpc_handler_3574493460), "SyncToolServerRpc");
((NetworkBehaviour)this).__registerRpc(2960638172u, new RpcReceiveHandler(__rpc_handler_2960638172), "SyncToolClientRpc");
base.__initializeRpcs();
}
private static void __rpc_handler_3300359901(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
short tool = default(short);
ByteUnpacker.ReadValueBitPacked(reader, ref tool);
target.__rpc_exec_stage = (__RpcExecStage)1;
((SaveCrafter)(object)target).AddToolServerRpc(tool);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2782130414(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
short tool = default(short);
ByteUnpacker.ReadValueBitPacked(reader, ref tool);
target.__rpc_exec_stage = (__RpcExecStage)1;
((SaveCrafter)(object)target).AddToolClientRpc(tool);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3574493460(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((SaveCrafter)(object)target).SyncToolServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2960638172(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
short[] addedTools = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe<short>(ref addedTools, default(ForPrimitives));
}
target.__rpc_exec_stage = (__RpcExecStage)1;
((SaveCrafter)(object)target).SyncToolClientRpc(addedTools);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "SaveCrafter";
}
}
public class SavePatches
{
private const string versionSaveKey = "MelanieMeliciousCraftVersion";
private const string workbenchSaveKey = "MelanieMeliciousCraftWorkbench";
[HarmonyPrefix]
[HarmonyPatch(typeof(GameNetworkManager), "SaveGameValues")]
private static void SaveCrafters()
{
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Expected O, but got Unknown
if (!((NetworkBehaviour)StartOfRound.Instance).IsServer)
{
return;
}
try
{
string currentSaveFileName = GameNetworkManager.Instance.currentSaveFileName;
ES3.Save<short>("MelanieMeliciousCraftVersion", (short)0, currentSaveFileName);
if ((Object)(object)HarmonyPatches.workbench == (Object)null)
{
ES3.DeleteKey("MelanieMeliciousCraftWorkbench", currentSaveFileName);
return;
}
ES3.Save<string>("MelanieMeliciousCraftWorkbench", JsonConvert.SerializeObject((object)HarmonyPatches.workbench.tools.ToArray()), currentSaveFileName, new ES3Settings(new Enum[1] { (Enum)(object)(ReferenceMode)0 }));
}
catch
{
Plugin.mls.LogError((object)"Issue while saving Melanie Crafting Progression Core custom info. Aborting to prevent save break.");
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(StartOfRound), "LoadAttachedVehicle")]
private static void LoadCrafters(StartOfRound __instance)
{
if (!((NetworkBehaviour)__instance).IsServer)
{
return;
}
try
{
string currentSaveFileName = GameNetworkManager.Instance.currentSaveFileName;
if (ES3.KeyExists("MelanieMeliciousCraftWorkbench", currentSaveFileName) && (Object)(object)HarmonyPatches.workbench != (Object)null)
{
Workbench workbench = HarmonyPatches.workbench;
workbench.tools.AddRange(JsonConvert.DeserializeObject<short[]>(ES3.Load<string>("MelanieMeliciousCraftWorkbench", currentSaveFileName)).ToArray());
workbench.LoadTools();
}
}
catch
{
Plugin.mls.LogError((object)"Issue while loading Melanie Crafting Progression Core custom info. Aborting to prevent save break.");
}
}
}
public class TreeHit : MonoBehaviour, IHittable
{
bool IHittable.Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit, bool playHitSFX, int hitID = -1)
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
Ingredient ingredient = default(Ingredient);
if (playerWhoHit.isHoldingObject && ((Component)playerWhoHit.currentlyHeldObjectServer).TryGetComponent<Ingredient>(ref ingredient) && ingredient.tool == 2)
{
RoundManager.Instance.DestroyTreeOnLocalClient(((Component)this).transform.position);
if (Random.Range(0, 2) == 0)
{
GlobalSpawner.Instance.SpawnItemServerRpc(3, ((Component)this).transform.position.x, ((Component)this).transform.position.y + 3f, ((Component)this).transform.position.z);
}
return true;
}
return false;
}
}
public class Workbench : SaveCrafter
{
public override void OnNetworkSpawn()
{
base.OnNetworkSpawn();
recipeList = Plugin.workbench.ToArray();
HarmonyPatches.workbench = this;
craftMin = MelanieCraftCfg.craftMin.Value;
craftMax = MelanieCraftCfg.craftMax.Value;
}
protected override void __initializeVariables()
{
base.__initializeVariables();
}
protected override void __initializeRpcs()
{
base.__initializeRpcs();
}
protected internal override string __getTypeName()
{
return "Workbench";
}
}
}
namespace __GEN
{
internal class NetworkVariableSerializationHelper
{
[RuntimeInitializeOnLoadMethod]
internal static void InitializeSerialization()
{
}
}
}
namespace MelanieMeliciousCraft.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}