using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LethalLib.Modules;
using ReservedItemSlotCore.Data;
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("LCEliteFlashlight")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+3e327b6f0385a1b198d2c74b7afe8e12194ed4f2")]
[assembly: AssemblyProduct("LCEliteFlashlight")]
[assembly: AssemblyTitle("LCEliteFlashlight")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LCEliteFlashlight;
internal class EliteFlashlightConfig
{
public readonly ConfigEntry<int> EliteFlashlightPrice;
public EliteFlashlightConfig(ConfigFile cfg)
{
cfg.SaveOnConfigSet = false;
EliteFlashlightPrice = cfg.Bind<int>("General", "Elite-flashlight Price", 50, "What value you want the Elite-flashlight to cost in the shop.");
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();
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Missile.LCEliteFlashlight", "LCEliteFlashlight", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class EliteFlashlightBase : BaseUnityPlugin
{
private const string modGUID = "Missile.LCEliteFlashlight";
private const string modName = "LCEliteFlashlight";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("Missile.LCEliteFlashlight");
private static EliteFlashlightBase Instance;
internal ManualLogSource mls;
private AssetBundle EliteFlashlightAsset;
internal static EliteFlashlightConfig BoundConfig { get; private set; }
private void Awake()
{
mls = Logger.CreateLogSource("Missile.LCEliteFlashlight");
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
BoundConfig = new EliteFlashlightConfig(((BaseUnityPlugin)this).Config);
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
EliteFlashlightAsset = AssetBundle.LoadFromFile(Path.Combine(directoryName, "eliteflashlightbundle"));
if ((Object)(object)EliteFlashlightAsset == (Object)null)
{
mls.LogError((object)"Failed to load EliteFlashlight assets");
return;
}
Item val = EliteFlashlightAsset.LoadAsset<Item>("assets/EliteFlashlightItem.asset");
if ((Object)(object)val == (Object)null)
{
mls.LogError((object)"Failed to load Elite-flashlight item");
return;
}
NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
Items.RegisterItem(val);
int num = 50;
if (BoundConfig.EliteFlashlightPrice.Value > 0)
{
num = BoundConfig.EliteFlashlightPrice.Value;
}
mls.LogInfo((object)("Elite Flashlight set to " + num + " credits"));
TerminalNode val2 = EliteFlashlightAsset.LoadAsset<TerminalNode>("assets/iTerminalNode.asset");
Items.RegisterShopItem(val, (TerminalNode)null, (TerminalNode)null, val2, num);
if (Chainloader.PluginInfos.ContainsKey("FlipMods.ReservedFlashlightSlot"))
{
ReservedItemSlotsCompat.AddItemsToReservedItemSlots();
mls.LogInfo((object)"Elite Flashlight and Flashlight slot compat loaded");
}
mls.LogInfo((object)"Elite Flashlight has fully loaded");
harmony.PatchAll();
}
}
public static class ReservedItemSlotsCompat
{
public static void AddItemsToReservedItemSlots()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
ReservedItemData val = new ReservedItemData("Elite-flashlight", (PlayerBone)4, new Vector3(0.2f, 0.25f, 0f), new Vector3(90f, 0f, 0f));
ReservedItemSlotData.TryAddItemDataToReservedItemSlot(val, "flashlight");
}
}