using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using LethalLevelLoader;
using UnityEngine;
using fiufkiscrap;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("fiufkiscrap")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("fiufkiscrap")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ca8f7fbb-d06c-4c77-ae33-e41a879ecdec")]
[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 fiufkisScrap
{
[BepInPlugin("fiufkiscrap", "fiufki's Scrap", "1.4.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
public static class PluginInfo
{
public const string PLUGIN_GUID = "fiufkiscrap";
public const string PLUGIN_NAME = "fiufki's Scrap";
public const string PLUGIN_VERSION = "1.4.0";
}
internal static ManualLogSource Logger;
public static GameObject GrenadePrefab;
public static ExtendedItem GrenadeExtended;
public static fiufkiscrapConfig ModConfig { get; private set; }
public void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
ModConfig = new fiufkiscrapConfig(((BaseUnityPlugin)this).Config);
AssetBundleLoader.AddOnLethalBundleLoadedListener((Action<AssetBundle>)OnLethalBundleLoaded, "fiufkiscrap.lethalbundle");
InitializeNetworkBehaviours();
Logger.LogInfo((object)"Plugin fiufkiscrap is loaded.");
}
private void InitializeNetworkBehaviours()
{
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
Type[] array = types;
foreach (Type type in array)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array2 = methods;
foreach (MethodInfo methodInfo in array2)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
}
internal static void OnLethalBundleLoaded(AssetBundle assetBundle)
{
if ((Object)(object)assetBundle == (Object)null)
{
return;
}
StunGrenadeItem component = GrenadePrefab.GetComponent<StunGrenadeItem>();
if (!((Object)(object)component == (Object)null))
{
Item itemProperties = ((GrabbableObject)GrenadePrefab.GetComponent<StunGrenadeItem>()).itemProperties;
if (!((Object)(object)itemProperties == (Object)null))
{
itemProperties.creditsWorth = fiufkiscrapConfig.ConfigGrenadePrice.Value;
Logger.LogInfo((object)$"Grenade price set to {itemProperties.creditsWorth}.");
component.TimeToExplode = fiufkiscrapConfig.ConfigGrenadeExplosionTime.Value;
Logger.LogInfo((object)$"Grenade explosion time set to {component.TimeToExplode}.");
}
}
}
}
}
namespace fiufkiscrap
{
public class fiufkiscrapConfig
{
internal ManualLogSource mls;
public static ConfigEntry<int> ConfigGrenadePrice { get; private set; }
public static ConfigEntry<float> ConfigGrenadeExplosionTime { get; private set; }
public fiufkiscrapConfig(ConfigFile configFile)
{
ConfigGrenadePrice = configFile.Bind<int>("Grenade", "Grenade Price", 30, "Configure the Grenade Price.");
ConfigGrenadeExplosionTime = configFile.Bind<float>("Grenade", "Grenade Explosion Time", 1.25f, "Configure the Grenade Explosion Time.");
}
private void ClearUnusedEntries(ConfigFile configFile)
{
PropertyInfo property = ((object)configFile).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic);
Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(configFile, null);
dictionary.Clear();
configFile.Save();
}
}
}