Decompiled source of Scraptopia v1.0.1

scraptopia.dll

Decompiled 3 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LethalLib.Modules;
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("scraptopia")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("scraptopia")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("482e497d-a94a-4a11-b6e2-ee1a1d13054f")]
[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 scraptopia;

public class Configuration
{
	public static ConfigEntry<int> configCommonRarity;

	public static ConfigEntry<int> configRareRarity;

	public static ConfigEntry<int> configVeryRareRarity;

	public static ConfigEntry<int> configAngrySquibbleDamage;

	public Configuration(ConfigFile config)
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Expected O, but got Unknown
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Expected O, but got Unknown
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Expected O, but got Unknown
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Expected O, but got Unknown
		configCommonRarity = config.Bind<int>("Item Rarity", "Common Rarity Weight", 50, new ConfigDescription("The spawn weight/rarity of common scrap such as banana and donuts. Recommended to use a number between 0 - 100. The higher the number the more likely the scrap is to spawn.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1000), Array.Empty<object>()));
		configRareRarity = config.Bind<int>("Item Rarity", "Rare Rarity Weight", 30, new ConfigDescription("The spawn weight/rarity of rare scrap such as SQUIBBLES. Recommended to use a number between 0 - 100. The higher the number the more likely the scrap is to spawn.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1000), Array.Empty<object>()));
		configVeryRareRarity = config.Bind<int>("Item Rarity", "Very Rare Rarity Weight", 10, new ConfigDescription("The spawn weight/rarity of very rare scrap such as crystals. Recommended to use a number between 0 - 100. The higher the number the more likely the scrap is to spawn.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1000), Array.Empty<object>()));
		configAngrySquibbleDamage = config.Bind<int>("Misc", "Angry Squibble Damage", 1, new ConfigDescription("The damage that ANGRY SQUIBBLE does. Recommended to use a number between 1 - 3. The higher the number the more damage squibble does.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>()));
	}
}
[BepInPlugin("Trial.scraptopia", "Scraptopia", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class ScraptopiaBase : BaseUnityPlugin
{
	private const string modGUID = "Trial.scraptopia";

	private const string modName = "Scraptopia";

	private const string modVersion = "1.0.0";

	private readonly Harmony harmony = new Harmony("Trial.scraptopia");

	private static ScraptopiaBase Instance;

	internal ManualLogSource mls;

	public static Configuration configuration { get; internal set; }

	private void Awake()
	{
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_025c: Unknown result type (might be due to invalid IL or missing references)
		//IL_019c: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)Instance == (Object)null)
		{
			Instance = this;
		}
		configuration = new Configuration(((BaseUnityPlugin)this).Config);
		string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "scraptopiaassets");
		AssetBundle val = AssetBundle.LoadFromFile(text);
		AudioClip val2 = val.LoadAsset<AudioClip>("Assets/Unity/Native/anger.mp3");
		int num = 2000;
		int value = Configuration.configCommonRarity.Value;
		Item val3 = val.LoadAsset<Item>("Assets/Unity/Native/BananaItem.asset");
		Item val4 = val.LoadAsset<Item>("Assets/Unity/Native/StrawberryDonut.asset");
		Item val5 = val.LoadAsset<Item>("Assets/Unity/Native/Blueberry Donut.asset");
		Item val6 = val.LoadAsset<Item>("Assets/Unity/Native/Matcha Donut.asset");
		int value2 = Configuration.configRareRarity.Value;
		Item item2 = val.LoadAsset<Item>("Assets/Unity/Native/Squibble.asset");
		Item val7 = val.LoadAsset<Item>("Assets/Unity/Native/Angry Squibble.asset");
		int value3 = Configuration.configVeryRareRarity.Value;
		Item val8 = val.LoadAsset<Item>("Assets/Unity/Native/CrystalItem.asset");
		Item val9 = val.LoadAsset<Item>("Assets/Unity/Native/BlueCrystal.asset");
		Item val10 = val.LoadAsset<Item>("Assets/Unity/Native/Golden Donut.asset");
		if ((Object)(object)val3.spawnPrefab != (Object)null)
		{
			val3.spawnPrefab.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
		}
		if ((Object)(object)val8.spawnPrefab != (Object)null)
		{
			val8.spawnPrefab.transform.localScale = new Vector3(0.25f, 0.25f, 0.25f);
		}
		if ((Object)(object)val9.spawnPrefab != (Object)null)
		{
			val9.spawnPrefab.transform.localScale = new Vector3(0.25f, 0.25f, 0.25f);
		}
		tweakDonut(val4);
		tweakDonut(val5);
		tweakDonut(val6);
		tweakDonut(val10);
		setupScrapItem(val3, value);
		setupScrapItem(val8, value3);
		setupScrapItem(val9, value3);
		setupScrapItem(item2, value2);
		setupScrapItem(val4, value);
		setupScrapItem(val5, value);
		setupScrapItem(val6, value);
		setupScrapItem(val10, value3);
		Shovel component = val7.spawnPrefab.GetComponent<Shovel>();
		component.shovelHitForce = Configuration.configAngrySquibbleDamage.Value;
		val7.spawnPrefab.transform.localScale = new Vector3(0.15f, 0.15f, 0.15f);
		setupScrapItem(val7, value2);
		mls = Logger.CreateLogSource("Trial.scraptopia");
		mls.LogInfo((object)"hey buddy");
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Trial.scraptopia is loaded! HEY BUDDY");
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Trial.scraptopia has loaded assets...");
		void setupScrapItem(Item item, int rarity)
		{
			if ((Object)(object)item != (Object)null && rarity > 0)
			{
				NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab);
				Utilities.FixMixerGroups(item.spawnPrefab);
				Items.RegisterScrap(item, rarity, (LevelTypes)(-1));
				((BaseUnityPlugin)this).Logger.LogInfo((object)$"{item} has been loaded!");
			}
		}
		static void tweakDonut(Item donut)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)donut.spawnPrefab != (Object)null)
			{
				donut.spawnPrefab.transform.localScale = new Vector3(0.25f, 0.25f, 0.25f);
				donut.weight = 1.009524f;
			}
		}
	}
}