using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[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;
}
}
}
public class HarmonyPatches
{
private static int hiveIndex;
[HarmonyPostfix]
[HarmonyPatch(typeof(StartOfRound), "Start")]
private static void StartPatch()
{
try
{
foreach (Item items in StartOfRound.Instance.allItemsList.itemsList)
{
if (items.itemName == "Hive")
{
hiveIndex = StartOfRound.Instance.allItemsList.itemsList.IndexOf(items);
break;
}
}
}
catch
{
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
private static void PreLevelPatch()
{
try
{
GameObject.Find("EntranceTeleportShip0").transform.parent.SetParent(GameObject.Find("Environment/Teleports").transform);
}
catch
{
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(TimeOfDay), "OnHourChanged")]
private static void HourPatch()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Expected O, but got Unknown
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
if (!GameNetworkManager.Instance.isHostingGame)
{
return;
}
try
{
foreach (Transform item in GameObject.Find("Tree0ItemSpawn").transform)
{
Transform val = item;
if (Random.Range(0, 99) < MelanieUtilFurnitureConfig.treeLootChance.Value)
{
GameObject val2 = Object.Instantiate<GameObject>(StartOfRound.Instance.allItemsList.itemsList[hiveIndex].spawnPrefab, val.position, val.rotation);
val2.GetComponent<NetworkObject>().Spawn(false);
val2.GetComponent<GrabbableObject>().SetScrapValue(Random.Range(10, 40));
}
}
foreach (Transform item2 in GameObject.Find("Tree1ItemSpawn").transform)
{
Transform val3 = item2;
if (Random.Range(0, 99) < MelanieUtilFurnitureConfig.treeLootChance.Value)
{
GameObject val4 = Object.Instantiate<GameObject>(StartOfRound.Instance.allItemsList.itemsList[hiveIndex].spawnPrefab, val3.position, val3.rotation);
val4.GetComponent<NetworkObject>().Spawn(false);
val4.GetComponent<GrabbableObject>().SetScrapValue(Random.Range(10, 40));
}
}
}
catch
{
}
}
}
public static class MelanieUtilFurnitureConfig
{
public static ConfigEntry<bool> alwaysStock;
public static ConfigEntry<bool> fireExit0Enable;
public static ConfigEntry<bool> wallEnable;
public static ConfigEntry<int> fireExit0Type;
public static ConfigEntry<int> workshop0Cost;
public static ConfigEntry<int> workTable0Cost;
public static ConfigEntry<int> cabinetWide0Cost;
public static ConfigEntry<int> gate0Cost;
public static ConfigEntry<int> door0Cost;
public static ConfigEntry<int> wall0Cost;
public static ConfigEntry<int> fireExit0Cost;
public static ConfigEntry<int> bedTwin0Cost;
public static ConfigEntry<int> treeBig0Cost;
public static ConfigEntry<int> benchTable0Cost;
public static ConfigEntry<int> fern0Cost;
public static ConfigEntry<int> treeLootChance;
public static void SetupConfig(ConfigFile config)
{
alwaysStock = config.Bind<bool>("Store Toggle", "Items Always In Stock", true, "Toggle if furniture is always in stock, or put into rotation.");
fireExit0Enable = config.Bind<bool>("Store Toggle", "Enable Fire Exit", true, "Toggle buyable fire exit.");
wallEnable = config.Bind<bool>("Store Toggle", "Enable Walls", true, "Toggle buyable walls.");
fireExit0Type = config.Bind<int>("Fire Exit", "Fire Exit Type", 0, "Toggle fire exit mode. 0 for both enter and exit, 1 for only enter, 2 for only exit.");
workshop0Cost = config.Bind<int>("Prices", "Workshop 1 Cost", 100, "Modify the price for Workshop 1.");
workTable0Cost = config.Bind<int>("Prices", "Work Table 1 Cost", 60, "Modify the price for Work Table 1.");
cabinetWide0Cost = config.Bind<int>("Prices", "Wide Cabinet Cost", 50, "Modify the price for Wide Cabinet.");
gate0Cost = config.Bind<int>("Prices", "Gate Costs", 50, "Modify the price for the gates.");
door0Cost = config.Bind<int>("Prices", "Door Costs", 50, "Modify the price for the doors.");
wall0Cost = config.Bind<int>("Prices", "Wall Costs", 35, "Modify the price for the walls.");
fireExit0Cost = config.Bind<int>("Prices", "Fire Exit Cost", 2000, "Modify the price for the fire exit.");
bedTwin0Cost = config.Bind<int>("Prices", "Twin Bed Cost", 150, "Modify the price for the twin bed.");
treeBig0Cost = config.Bind<int>("Prices", "Large Tree", 250, "Modify the price for large trees.");
benchTable0Cost = config.Bind<int>("Prices", "Bench Table", 70, "Modify the price for bench tables.");
fern0Cost = config.Bind<int>("Prices", "Fern", 40, "Modify the price for ferns.");
treeLootChance = config.Bind<int>("Loot", "Items From Trees Chance", 2, "Modify the percent chance for beehives to fall out of buyable trees.");
}
}
namespace MelanieMeliciousFurniturePack0
{
public class ParentItems : NetworkBehaviour
{
public Transform oldParent;
public Transform newParent;
public void ParentItem()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
foreach (Transform item in oldParent)
{
Transform val = item;
if (((Component)val).gameObject.layer != 26 && ((Object)val).name != "ObjectPlacements")
{
val.parent = newParent;
}
}
}
}
[BepInPlugin("MelanieMelicious.furniturePack0", "Melanie Melicious - Furniture Pack 1", "0.2.2")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
private const string GUID = "MelanieMelicious.furniturePack0";
private const string NAME = "Melanie Melicious - Furniture Pack 1";
private const string VERSION = "0.2.2";
private readonly Harmony harmony = new Harmony("MelanieMelicious.furniturePack0");
public static ManualLogSource mls;
public static AssetBundle bundle;
public static Plugin instance;
private void Awake()
{
instance = this;
MelanieUtilFurnitureConfig.SetupConfig(((BaseUnityPlugin)this).Config);
mls = Logger.CreateLogSource("MelanieMelicious - Utility Furniture");
mls = ((BaseUnityPlugin)this).Logger;
harmony.PatchAll(typeof(HarmonyPatches));
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "melaniemeliciousfurniturepack0");
bundle = AssetBundle.LoadFromFile(text);
UnlockablesList val = bundle.LoadAsset<UnlockablesList>("Assets/MelanieFurniture/Asset/Furniture.asset");
ushort num = 1;
if (!MelanieUtilFurnitureConfig.alwaysStock.Value)
{
num = 2;
}
NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[0].prefabObject);
Unlockables.RegisterUnlockable(val.unlockables[0], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.workshop0Cost.Value);
NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[1].prefabObject);
Unlockables.RegisterUnlockable(val.unlockables[1], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.workTable0Cost.Value);
NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[2].prefabObject);
Unlockables.RegisterUnlockable(val.unlockables[2], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.cabinetWide0Cost.Value);
NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[12].prefabObject);
Unlockables.RegisterUnlockable(val.unlockables[12], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.bedTwin0Cost.Value);
NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[13].prefabObject);
Unlockables.RegisterUnlockable(val.unlockables[13], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.treeBig0Cost.Value);
NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[14].prefabObject);
Unlockables.RegisterUnlockable(val.unlockables[14], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.treeBig0Cost.Value);
NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[15].prefabObject);
Unlockables.RegisterUnlockable(val.unlockables[15], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.benchTable0Cost.Value);
NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[16].prefabObject);
Unlockables.RegisterUnlockable(val.unlockables[16], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.fern0Cost.Value);
NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[17].prefabObject);
Unlockables.RegisterUnlockable(val.unlockables[17], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.fern0Cost.Value);
if (MelanieUtilFurnitureConfig.fireExit0Enable.Value)
{
switch (MelanieUtilFurnitureConfig.fireExit0Type.Value)
{
case 1:
val.unlockables[3].prefabObject = bundle.LoadAsset<GameObject>("Assets/MelanieFurniture/Prefab/FireExit0/Exit/FireExit0.prefab");
break;
case 2:
val.unlockables[3].prefabObject = bundle.LoadAsset<GameObject>("Assets/MelanieFurniture/Prefab/FireExit0/Entrance/FireExit0.prefab");
break;
}
NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[3].prefabObject);
Unlockables.RegisterUnlockable(val.unlockables[3], (StoreType)1, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.fireExit0Cost.Value);
}
if (MelanieUtilFurnitureConfig.wallEnable.Value)
{
NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[4].prefabObject);
Unlockables.RegisterUnlockable(val.unlockables[4], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.gate0Cost.Value);
NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[5].prefabObject);
Unlockables.RegisterUnlockable(val.unlockables[5], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.door0Cost.Value);
NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[6].prefabObject);
Unlockables.RegisterUnlockable(val.unlockables[6], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.door0Cost.Value);
NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[7].prefabObject);
Unlockables.RegisterUnlockable(val.unlockables[7], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.door0Cost.Value);
NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[8].prefabObject);
Unlockables.RegisterUnlockable(val.unlockables[8], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.wall0Cost.Value);
NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[9].prefabObject);
Unlockables.RegisterUnlockable(val.unlockables[9], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.wall0Cost.Value);
NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[10].prefabObject);
Unlockables.RegisterUnlockable(val.unlockables[10], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.wall0Cost.Value);
NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[11].prefabObject);
Unlockables.RegisterUnlockable(val.unlockables[11], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.wall0Cost.Value);
}
}
}
}