using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
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 Microsoft.CodeAnalysis;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MeteoMultiplier")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Multiplies loot value according to meteorigical conditions. An improved version of the other mod with a similar name")]
[assembly: AssemblyFileVersion("1.1.3.0")]
[assembly: AssemblyInformationalVersion("1.1.3+9ac6c74c13fd163aad4e01cf6c11e4dd7c3de1d8")]
[assembly: AssemblyProduct("MeteoMultiplier")]
[assembly: AssemblyTitle("MeteoMultiplier")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.3.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 MeteoMultiplier
{
[BepInPlugin("com.github.fredolx.meteomultiplier", "MeteoMultiplier", "1.1.3")]
public class Plugin : BaseUnityPlugin
{
public static Dictionary<LevelWeatherType, ConfigEntry<float>> Multipliers = new Dictionary<LevelWeatherType, ConfigEntry<float>>();
public static Dictionary<LevelWeatherType, ConfigEntry<float>> SpawnMultipliers = new Dictionary<LevelWeatherType, ConfigEntry<float>>();
public static ConfigEntry<bool> MultipliersEnabled;
public static ConfigEntry<bool> SpawnMultipliersEnabled;
public static ConfigEntry<bool> MultiplyApparatusEnabled;
public const LevelWeatherType DEFAULT_WEATHER = -1;
private void Awake()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin MeteoMultiplier is loaded!");
Harmony val = new Harmony("MeteoMultiplier");
SetConfig();
((BaseUnityPlugin)this).Logger.LogInfo((object)$"MultipliersEnabled: {MultipliersEnabled.Value}");
((BaseUnityPlugin)this).Logger.LogInfo((object)$"MultiplyApparatusEnabled: {MultiplyApparatusEnabled.Value}");
((BaseUnityPlugin)this).Logger.LogInfo((object)("Multipliers:\n" + string.Join("\n", Multipliers.Select((KeyValuePair<LevelWeatherType, ConfigEntry<float>> x) => $"{x.Key}:{x.Value.Value}"))));
((BaseUnityPlugin)this).Logger.LogInfo((object)$"SpawnMultipliersEnabled: {SpawnMultipliersEnabled.Value}");
((BaseUnityPlugin)this).Logger.LogInfo((object)("SpawnMultipliers:\n" + string.Join("\n", SpawnMultipliers.Select((KeyValuePair<LevelWeatherType, ConfigEntry<float>> x) => $"{x.Key}:{x.Value.Value}"))));
val.PatchAll();
}
private void SetConfig()
{
MultipliersEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Multipliers", "Enabled", true, "Enables multipliers (scrap value according to meteo)");
MultiplyApparatusEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Multipliers", "MultiplyApparatusEnabled", true, "Also multiply the value of the apparatus (power module) according to meteo");
SetMultipliers();
SpawnMultipliersEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Spawn Multipliers", "Enabled", false, "Enables spawn multipliers (amount of scrap in the map)");
SetSpawnMultipliers();
}
private void SetMultipliers()
{
Multipliers.Add((LevelWeatherType)(-1), ((BaseUnityPlugin)this).Config.Bind<float>("Multipliers", "None", 0.4f, "No weather event"));
Multipliers.Add((LevelWeatherType)0, ((BaseUnityPlugin)this).Config.Bind<float>("Multipliers", "DustClouds", 0.44f, "Dust Clouds"));
Multipliers.Add((LevelWeatherType)3, ((BaseUnityPlugin)this).Config.Bind<float>("Multipliers", "Foggy", 0.44f, "Foggy"));
Multipliers.Add((LevelWeatherType)1, ((BaseUnityPlugin)this).Config.Bind<float>("Multipliers", "Rainy", 0.44f, "Rainy"));
Multipliers.Add((LevelWeatherType)2, ((BaseUnityPlugin)this).Config.Bind<float>("Multipliers", "Stormy", 0.52f, "Stormy"));
Multipliers.Add((LevelWeatherType)4, ((BaseUnityPlugin)this).Config.Bind<float>("Multipliers", "Flooded", 0.56f, "Flooded"));
Multipliers.Add((LevelWeatherType)5, ((BaseUnityPlugin)this).Config.Bind<float>("Multipliers", "Eclipsed", 0.6f, "Eclipsed"));
}
private void SetSpawnMultipliers()
{
SpawnMultipliers.Add((LevelWeatherType)(-1), ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Multipliers", "None", 1f, "No weather event"));
SpawnMultipliers.Add((LevelWeatherType)0, ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Multipliers", "DustClouds", 1.25f, "Dust Clouds"));
SpawnMultipliers.Add((LevelWeatherType)3, ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Multipliers", "Foggy", 1.25f, "Foggy"));
SpawnMultipliers.Add((LevelWeatherType)1, ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Multipliers", "Rainy", 1.25f, "Rainy"));
SpawnMultipliers.Add((LevelWeatherType)2, ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Multipliers", "Stormy", 1.5f, "Stormy"));
SpawnMultipliers.Add((LevelWeatherType)4, ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Multipliers", "Flooded", 1.5f, "Flooded"));
SpawnMultipliers.Add((LevelWeatherType)5, ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Multipliers", "Eclipsed", 1.5f, "Eclipsed"));
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "MeteoMultiplier";
public const string PLUGIN_NAME = "MeteoMultiplier";
public const string PLUGIN_VERSION = "1.1.3";
}
}
namespace MeteoMultiplier.Patches
{
[HarmonyPatch(typeof(LungProp), "DisconnectFromMachinery")]
public class MultiplyApparatus
{
private static void Prefix(LungProp __instance)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
LevelWeatherType currentWeather = __instance.roundManager.currentLevel.currentWeather;
if (Plugin.MultiplyApparatusEnabled.Value && Plugin.Multipliers.ContainsKey(currentWeather))
{
((GrabbableObject)__instance).SetScrapValue((int)((float)((GrabbableObject)__instance).scrapValue * (Plugin.Multipliers[currentWeather].Value + 1f)));
}
}
}
[HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")]
public class SpawnScrapInLevelPatches
{
private static void Prefix(RoundManager __instance)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
LevelWeatherType currentWeather = __instance.currentLevel.currentWeather;
if (Plugin.MultipliersEnabled.Value)
{
if (Plugin.Multipliers.ContainsKey(currentWeather))
{
__instance.scrapValueMultiplier = Plugin.Multipliers[currentWeather].Value;
}
else
{
__instance.scrapValueMultiplier = Plugin.Multipliers[(LevelWeatherType)(-1)].Value;
}
}
if (Plugin.SpawnMultipliersEnabled.Value)
{
if (Plugin.SpawnMultipliers.ContainsKey(currentWeather))
{
__instance.scrapAmountMultiplier = Plugin.SpawnMultipliers[currentWeather].Value;
}
else
{
__instance.scrapAmountMultiplier = Plugin.SpawnMultipliers[(LevelWeatherType)(-1)].Value;
}
}
}
}
}