Decompiled source of HiddenGems v0.3.2

plugins/HiddenGems/HiddenGems.dll

Decompiled 10 months ago
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 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("HiddenGems")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HiddenGems")]
[assembly: AssemblyTitle("HiddenGems")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace AetharNet.Mods.LethalCompany.HiddenGems;

[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("AetharNet.Mods.LethalCompany.HiddenGems", "HiddenGems", "0.2.0")]
public class HiddenGemsPlugin : BaseUnityPlugin
{
	public const string PluginGUID = "AetharNet.Mods.LethalCompany.HiddenGems";

	public const string PluginName = "HiddenGems";

	public const string PluginVersion = "0.2.0";

	private static AssetBundle ModAssets;

	private const int ItemRarity = 25;

	private const int EnemyRarity = 100;

	private const string ScrapRootPath = "Assets/Scrap/";

	private const string EnemyRootPath = "Assets/Enemy/";

	private void Awake()
	{
		LoadAssetBundle();
		RegisterScrapItem("Frank/SoupyCollar");
		RegisterScrapItem("Alice/JudgementDay");
		RegisterScrapItem("Raava/CyborgGoggles");
		RegisterScrapItem("DoubleD/Jinx");
	}

	private static void LoadAssetBundle()
	{
		string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
		ModAssets = AssetBundle.LoadFromFile(Path.Combine(directoryName, "modassets"));
	}

	private static void RegisterScrapItem(string assetPath)
	{
		Item val = ModAssets.LoadAsset<Item>("Assets/Scrap/" + assetPath + "/Item.asset");
		Utilities.FixMixerGroups(val.spawnPrefab);
		NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
		Items.RegisterScrap(val, 25, (LevelTypes)(-1));
	}

	private static void RegisterEnemy(string assetPath)
	{
		EnemyType val = ModAssets.LoadAsset<EnemyType>("Assets/Enemy/" + assetPath + "/EnemyType.asset");
		TerminalNode val2 = ModAssets.LoadAsset<TerminalNode>("Assets/Enemy/" + assetPath + "/TerminalNode.asset");
		TerminalKeyword val3 = ModAssets.LoadAsset<TerminalKeyword>("Assets/Enemy/" + assetPath + "/TerminalKeyword.asset");
		NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
		Enemies.RegisterEnemy(val, 100, (LevelTypes)(-1), val2, val3);
	}
}