using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
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;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("BuyableShells")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BuyableShells")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f1098099-7d96-4f78-bd10-8cf743e1f445")]
[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 BuyableShells;
[BepInPlugin("SalakStudios.BetterShotgunShells", "BetterShotgunShells", "1.0.2")]
public class Plugin : BaseUnityPlugin
{
private const string modGUID = "SalakStudios.BetterShotgunShells";
private const string modName = "BetterShotgunShells";
private const string modVersion = "1.0.2";
private readonly Harmony harmony = new Harmony("SalakStudios.BetterShotgunShells");
internal static Plugin Instance;
public static ManualLogSource mls;
public bool added;
public static ConfigEntry<int> ShellPrice;
public static ConfigEntry<int> ItemRarityRend;
public static ConfigEntry<int> ItemRarityDine;
public static ConfigEntry<int> ItemRarityTitan;
public List<Item> AllItems => Resources.FindObjectsOfTypeAll<Item>().Concat(Object.FindObjectsByType<Item>((FindObjectsInactive)1, (FindObjectsSortMode)1)).ToList();
public Item ShotgunShell => ((IEnumerable<Item>)AllItems).FirstOrDefault((Func<Item, bool>)((Item item) => ((Object)item).name == "GunAmmo"));
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
harmony.PatchAll(typeof(Plugin));
mls = Logger.CreateLogSource("SalakStudios.BetterShotgunShells");
mls.LogInfo((object)"BetterShotgunShells Enabled");
SceneManager.sceneLoaded += OnSceneLoaded;
ShellPrice = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Shell Price", 80, "How many credits the shotgun shell costs");
ItemRarityRend = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Shell Rarity Rend", 2, "How rare the shell is to find on Rend (Lower = Rarer, Higher = More Common)");
ItemRarityDine = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Shell Rarity Dine", 3, "How rare the shell is to find on Dine (Lower = Rarer, Higher = More Common)");
ItemRarityTitan = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Shell Rarity Titan", 5, "How rare the shell is to find on Titan (Lower = Rarer, Higher = More Common)");
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
if (!added && ((Scene)(ref scene)).name == "MainMenu")
{
added = true;
ShotgunShell.itemName = "Shells";
ShotgunShell.creditsWorth = 0;
Items.RegisterShopItem(ShotgunShell, ShellPrice.Value);
Items.RegisterScrap(ShotgunShell, ItemRarityRend.Value, (LevelTypes)128);
Items.RegisterScrap(ShotgunShell, ItemRarityDine.Value, (LevelTypes)256);
Items.RegisterScrap(ShotgunShell, ItemRarityTitan.Value, (LevelTypes)512);
}
}
}