using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using LethalLib.Modules;
using Newtonsoft.Json;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("SillyScrap")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SillyScrap")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7003e003-9638-4c88-9828-d8c60a039d18")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace SillyScrap;
[BepInPlugin("DeziorsSillyScrap", "SillyScrap", "0.5.0")]
public class SillyScraps : BaseUnityPlugin
{
public class Config
{
public List<string> item { get; set; }
public List<int> weight { get; set; }
public List<int> minValue { get; set; }
public List<int> maxValue { get; set; }
}
private bool debug = false;
private const string modGUID = "DeziorsSillyScrap";
private const string modName = "SillyScrap";
private const string modVersion = "0.5.0";
private static SillyScraps instance;
private void Awake()
{
string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "config.json");
string text = File.ReadAllText(path);
Config config = JsonConvert.DeserializeObject<Config>(text);
instance = this;
string[] array = new string[7] { "Assets/sillyScrap/divingBell/DivingBell.asset", "Assets/sillyScrap/Bodypillow/BodyPillowItem.asset", "Assets/sillyScrap/WingedHorseSpinningtop/WingedHorseSpinningTopItem.asset", "Assets/sillyScrap/ThaHando/ZaHAndoItem.asset", "Assets/sillyScrap/Mogussuit/MogussuitItem.asset", "Assets/sillyScrap/Dumbbell/DumbbellItem.asset", "Assets/sillyScrap/Inline3/inline3item.asset" };
for (int i = 0; i < config.item.Count; i++)
{
string text2 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), config.item[i]);
AssetBundle val = AssetBundle.LoadFromFile(text2);
Item val2 = val.LoadAsset<Item>(array[i]);
val2.minValue = config.minValue[i] * 100 / 40;
val2.maxValue = config.maxValue[i] * 100 / 40;
val2.isScrap = true;
Items.RegisterScrap(val2, config.weight[i], (LevelTypes)(-1));
Utilities.FixMixerGroups(val2.spawnPrefab);
NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
if (debug)
{
TerminalNode val3 = ScriptableObject.CreateInstance<TerminalNode>();
val3.clearPreviousText = true;
val3.displayText = "This is for developent\n\n";
Items.RegisterShopItem(val2, (TerminalNode)null, (TerminalNode)null, val3, 1);
}
((BaseUnityPlugin)this).Logger.LogInfo((object)("Loaded Item SillyScrap " + config.item[i]));
}
}
}