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 = "")]
[assembly: AssemblyCompany("EllenaLethalScraps")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("EllenaLethalScraps")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("EllenaLethalScraps")]
[assembly: AssemblyTitle("EllenaLethalScraps")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace EllenaLethalScraps;
[BepInPlugin("EllenaLethalScraps", "EllenaLethalScraps", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
private enum SpawnRate
{
Legendary = 5,
Rarest = 10,
Rare = 20,
Common = 30,
Very_common = 40,
Super_common = 50,
Way_too_common = 75,
Abusive = 100
}
public static AssetBundle LethalScrapAssetBundle;
private string BundlePath_LethalScraps = "Assets/Ellena/LethalScraps/";
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin EllenaLethalScraps is being loaded!");
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
LethalScrapAssetBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "ellenalethalscraps"));
Log("[AssetBundle] Loaded : " + ((Object)LethalScrapAssetBundle).name + ".");
Log("Registering items...");
RegisterItems();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin EllenaLethalScraps has been loaded!");
}
private void RegisterItems()
{
AddGlobalScrap(BundlePath_LethalScraps, "MusicBox", SpawnRate.Rarest);
AddGlobalScrap(BundlePath_LethalScraps, "BallOfSteel", SpawnRate.Legendary);
AddShopItem(BundlePath_LethalScraps, "GlowingOrb", 20);
}
private void AddGlobalScrap(string bundlePath, string itemName, SpawnRate spawnRate)
{
Item val = LethalScrapAssetBundle.LoadAsset<Item>(bundlePath + itemName + ".asset");
NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
Items.RegisterScrap(val, (int)spawnRate, (LevelTypes)(-1));
Log($"{val.itemName} has been added to the loot table with a spawnrate of : {(int)spawnRate}");
}
private void AddShopItem(string bundlePath, string itemName, int price)
{
Item val = LethalScrapAssetBundle.LoadAsset<Item>(bundlePath + itemName + ".asset");
NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
Items.RegisterShopItem(val, price);
Log($"{val.itemName} has been added to the terminal's shop for {price} credits.");
}
private void Log(string message)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)(" >>> " + message));
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "EllenaLethalScraps";
public const string PLUGIN_NAME = "EllenaLethalScraps";
public const string PLUGIN_VERSION = "1.0.0";
}