Decompiled source of Filly Scrap v1.0.4

Filly/FillyScrap.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
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 HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("FillyScrap")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("FillyScrap")]
[assembly: AssemblyTitle("FillyScrap")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.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;
		}
	}
}
namespace FillyScrap
{
	[BepInPlugin("FillyScrap", "PonyScrapReborn", "1.0.4")]
	public class Plugin : BaseUnityPlugin
	{
		private const string GUID = "FillyScrap";

		private const string NAME = "PonyScrapReborn";

		private const string VERSION = "1.0.4";

		public static Plugin instance;

		internal static ModConfig config { get; private set; }

		private void Awake()
		{
			instance = this;
			config = new ModConfig(((BaseUnityPlugin)this).Config);
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "FillyScrap");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			Item val2 = val.LoadAsset<Item>("Assets/Mods/AnonFilly/AnonFilly.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Items.RegisterScrap(val2, config.anonFillySpawnWeight.Value, (LevelTypes)(-1));
			Item val3 = val.LoadAsset<Item>("Assets/Mods/AnonFilly/SwagFilly.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab);
			Items.RegisterScrap(val3, config.coolFillySpawnWeight.Value, (LevelTypes)(-1));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin FillyScrap is loaded!");
		}
	}
	internal class ModConfig
	{
		public readonly ConfigEntry<int> anonFillySpawnWeight;

		public readonly ConfigEntry<int> coolFillySpawnWeight;

		public ModConfig(ConfigFile cfg)
		{
			cfg.SaveOnConfigSet = false;
			anonFillySpawnWeight = cfg.Bind<int>("Anon Filly", "Item Weight", 25, (ConfigDescription)null);
			coolFillySpawnWeight = cfg.Bind<int>("Cool Filly", "Item Weight", 10, (ConfigDescription)null);
			ClearOrphanedEntries(cfg);
			cfg.Save();
			cfg.SaveOnConfigSet = true;
		}

		private static void ClearOrphanedEntries(ConfigFile cfg)
		{
			PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries");
			Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)propertyInfo.GetValue(cfg);
			dictionary.Clear();
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "FillyScrap";

		public const string PLUGIN_NAME = "FillyScrap";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}