using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using LethalExpansionCore.Utils;
using Microsoft.CodeAnalysis;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LCConductivityRework")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Allows you to change specific item(s) to be conductive (struck-able by lightning) or not.")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2")]
[assembly: AssemblyProduct("LCConductivityRework")]
[assembly: AssemblyTitle("LCConductivityRework")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace LCConductivityRework
{
[BepInPlugin("Froze.LCConductivityRework", "LCConductivityRework", "1.0.2")]
public class Plugin : BaseUnityPlugin
{
public static ConfigFile config;
private Dictionary<string, bool> newConductivities = new Dictionary<string, bool>();
public static ConfigEntry<string> conductiveItemsList { get; private set; }
private void InitConfig()
{
conductiveItemsList = config.Bind<string>("Conductive Items", "List of Conductive Items", "ClownHornfalse,Flaskfalse,MoldPantrue,WhoopieCushionfalse", "Enter a comma-separated list of items with 'true' or 'false' at the end of the string.\nIf it's 'true' then the item will be conductive and vice versa. Case-sensitive!\nSee the mod's website for a list of configurable items.\n");
string[] array = conductiveItemsList.Value.Split(',');
string[] array2 = array;
foreach (string text in array2)
{
if (text.EndsWith("true", StringComparison.OrdinalIgnoreCase))
{
newConductivities[text.Substring(0, text.Length - 4)] = true;
}
else if (text.EndsWith("false", StringComparison.OrdinalIgnoreCase))
{
newConductivities[text.Substring(0, text.Length - 5)] = false;
}
else
{
newConductivities[text] = false;
}
}
}
private void Awake()
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Expected O, but got Unknown
config = ((BaseUnityPlugin)this).Config;
InitConfig();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LCConductivityRework is loaded!");
SceneManager.sceneLoaded += OnSceneLoaded;
Harmony val = new Harmony("Froze.LCConductivityRework");
val.PatchAll();
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
modItemConductivity();
}
private void modItemConductivity()
{
foreach (KeyValuePair<string, bool> newConductivity in newConductivities)
{
string key = newConductivity.Key;
if (AssetGather.Instance.scraps.ContainsKey(key))
{
AssetGather.Instance.scraps[key].isConductiveMetal = newConductivity.Value;
((BaseUnityPlugin)this).Logger.LogInfo((object)$"Customized scrap item: {key}, Conductive: {newConductivity.Value}");
}
}
}
}
[HarmonyPatch(typeof(StormyWeather))]
public class StormyWeatherPatch
{
[HarmonyPatch("Update")]
[HarmonyPrefix]
private static bool UpdatePatch(StormyWeather __instance)
{
if ((Object)(object)__instance == (Object)null)
{
return false;
}
return true;
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "LCConductivityRework";
public const string PLUGIN_NAME = "LCConductivityRework";
public const string PLUGIN_VERSION = "1.0.2";
}
}