Decompiled source of Ore Runneth Evermore v1.0.1

ORE.dll

Decompiled 11 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("OreGalore")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OreGalore")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9a221fae-5d48-4b99-8ed4-f7de70ba73af")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ORE;

[BepInPlugin("elric.OreGalore", "Ores Runneth Evermore", "1.0.0")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class ORE : BaseUnityPlugin
{
	public const string PluginGUID = "elric.OreGalore";

	public const string PluginName = "Ores Runneth Evermore";

	public const string PluginVersion = "1.0.0";

	public static bool isModded = true;

	private ConfigEntry<int> silverQuantity;

	private ConfigEntry<int> tinQuantity;

	private ConfigEntry<int> ironQuantity;

	private ConfigEntry<int> copperQuantity;

	private ConfigEntry<float> silverMaxAltitude;

	private ConfigEntry<float> tinMaxAltitude;

	private ConfigEntry<float> ironMaxAltitude;

	private ConfigEntry<float> copperMaxAltitude;

	private ConfigEntry<float> silverMinAltitude;

	private ConfigEntry<float> tinMinAltitude;

	private ConfigEntry<float> ironMinAltitude;

	private ConfigEntry<float> copperMinAltitude;

	private ConfigEntry<int> silverMinDistance;

	private ConfigEntry<int> tinMinDistance;

	private ConfigEntry<int> ironMinDistance;

	private ConfigEntry<int> copperMinDistance;

	public void Awake()
	{
		ZoneManager.OnVanillaLocationsAvailable += RemoveResources;
		ZoneManager.OnVanillaLocationsAvailable += CreateAddResources;
		CreateConfig();
	}

	public void CreateConfig()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Expected O, but got Unknown
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Expected O, but got Unknown
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Expected O, but got Unknown
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Expected O, but got Unknown
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Expected O, but got Unknown
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Expected O, but got Unknown
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Expected O, but got Unknown
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Expected O, but got Unknown
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_012e: Expected O, but got Unknown
		//IL_012e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Expected O, but got Unknown
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_0166: Unknown result type (might be due to invalid IL or missing references)
		//IL_016e: Expected O, but got Unknown
		//IL_016e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Expected O, but got Unknown
		//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ae: Expected O, but got Unknown
		//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b8: Expected O, but got Unknown
		//IL_01de: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01eb: Expected O, but got Unknown
		//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f5: Expected O, but got Unknown
		//IL_021e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0223: Unknown result type (might be due to invalid IL or missing references)
		//IL_022b: Expected O, but got Unknown
		//IL_022b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0235: Expected O, but got Unknown
		//IL_025e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0263: Unknown result type (might be due to invalid IL or missing references)
		//IL_026b: Expected O, but got Unknown
		//IL_026b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0275: Expected O, but got Unknown
		//IL_029e: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ab: Expected O, but got Unknown
		//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b5: Expected O, but got Unknown
		//IL_02db: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e8: Expected O, but got Unknown
		//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f2: Expected O, but got Unknown
		//IL_031b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0320: Unknown result type (might be due to invalid IL or missing references)
		//IL_0328: Expected O, but got Unknown
		//IL_0328: Unknown result type (might be due to invalid IL or missing references)
		//IL_0332: Expected O, but got Unknown
		//IL_035b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0360: Unknown result type (might be due to invalid IL or missing references)
		//IL_0368: Expected O, but got Unknown
		//IL_0368: Unknown result type (might be due to invalid IL or missing references)
		//IL_0372: Expected O, but got Unknown
		//IL_039b: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a8: Expected O, but got Unknown
		//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b2: Expected O, but got Unknown
		//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e4: Expected O, but got Unknown
		//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ee: Expected O, but got Unknown
		silverQuantity = ((BaseUnityPlugin)this).Config.Bind<int>("Silver Veins", "SilverQuantity", 250, new ConfigDescription("How many silver vein locations should attempt to generate?", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
		{
			IsAdminOnly = true
		} }));
		silverMinAltitude = ((BaseUnityPlugin)this).Config.Bind<float>("Silver Veins", "SilverMinAlt", 100f, new ConfigDescription("Minimum altitude the silver vein should generate?", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
		{
			IsAdminOnly = true
		} }));
		silverMaxAltitude = ((BaseUnityPlugin)this).Config.Bind<float>("Silver Veins", "SilverMaxAlt", 1000f, new ConfigDescription("Maximum altitude the silver vein should generate?", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
		{
			IsAdminOnly = true
		} }));
		silverMinDistance = ((BaseUnityPlugin)this).Config.Bind<int>("Silver Veins", "SilverMinDistance", 32, new ConfigDescription("How far apart should the silver veins generate?", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
		{
			IsAdminOnly = true
		} }));
		copperQuantity = ((BaseUnityPlugin)this).Config.Bind<int>("Copper Veins", "CopperQuantity", 350, new ConfigDescription("How many copper vein locations should attempt to generate?", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
		{
			IsAdminOnly = true
		} }));
		copperMinAltitude = ((BaseUnityPlugin)this).Config.Bind<float>("Copper Veins", "CopperMinAlt", 4f, new ConfigDescription("Minimum altitude the copper vein should generate?", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
		{
			IsAdminOnly = true
		} }));
		copperMaxAltitude = ((BaseUnityPlugin)this).Config.Bind<float>("Copper Veins", "CopperMaxAlt", 1000f, new ConfigDescription("Maximum altitude the copper vein should generate?", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
		{
			IsAdminOnly = true
		} }));
		copperMinDistance = ((BaseUnityPlugin)this).Config.Bind<int>("Copper Veins", "CopperMinDistance", 16, new ConfigDescription("How far apart should the copper veins generate?", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
		{
			IsAdminOnly = true
		} }));
		ironQuantity = ((BaseUnityPlugin)this).Config.Bind<int>("Iron Veins", "IronQuantity", 250, new ConfigDescription("How many iron vein locations should attempt to generate?", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
		{
			IsAdminOnly = true
		} }));
		ironMinAltitude = ((BaseUnityPlugin)this).Config.Bind<float>("Iron Veins", "IronMinAlt", 0.5f, new ConfigDescription("Minimum altitude the iron vein should generate?", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
		{
			IsAdminOnly = true
		} }));
		ironMaxAltitude = ((BaseUnityPlugin)this).Config.Bind<float>("Iron Veins", "IronMaxAlt", 1000f, new ConfigDescription("Maximum altitude the iron vein should generate?", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
		{
			IsAdminOnly = true
		} }));
		ironMinDistance = ((BaseUnityPlugin)this).Config.Bind<int>("Iron Veins", "IronMinDistance", 32, new ConfigDescription("How far apart should the iron veins generate?", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
		{
			IsAdminOnly = true
		} }));
		tinQuantity = ((BaseUnityPlugin)this).Config.Bind<int>("Tin Veins", "TinQuantity", 2500, new ConfigDescription("How many tin vein locations should attempt to generate?", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
		{
			IsAdminOnly = true
		} }));
		tinMinAltitude = ((BaseUnityPlugin)this).Config.Bind<float>("Tin Veins", "TinMinAlt", -0.6f, new ConfigDescription("Minimum altitude the tin vein should generate?", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
		{
			IsAdminOnly = true
		} }));
		tinMaxAltitude = ((BaseUnityPlugin)this).Config.Bind<float>("Tin Veins", "TinMaxAlt", 1.2f, new ConfigDescription("Maximum altitude the tin vein should generate?", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
		{
			IsAdminOnly = true
		} }));
		tinMinDistance = ((BaseUnityPlugin)this).Config.Bind<int>("Tin Veins", "TinMinDistance", 2, new ConfigDescription("How far apart should the tin veins generate?", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
		{
			IsAdminOnly = true
		} }));
	}

	public void RemoveResources()
	{
		ZoneVegetation zoneVegetation = ZoneManager.Instance.GetZoneVegetation("rock4_copper");
		zoneVegetation.m_enable = false;
		zoneVegetation.m_max = 0f;
		ZoneVegetation zoneVegetation2 = ZoneManager.Instance.GetZoneVegetation("MineRock_Tin");
		zoneVegetation2.m_enable = false;
		zoneVegetation2.m_max = 0f;
		ZoneVegetation zoneVegetation3 = ZoneManager.Instance.GetZoneVegetation("mudpile_beacon");
		zoneVegetation3.m_enable = false;
		zoneVegetation3.m_max = 0f;
		ZoneVegetation zoneVegetation4 = ZoneManager.Instance.GetZoneVegetation("silvervein");
		zoneVegetation4.m_enable = false;
		zoneVegetation4.m_max = 0f;
		ZoneManager.OnVanillaLocationsAvailable -= RemoveResources;
	}

	public void CreateAddResources()
	{
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_015c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0163: Expected O, but got Unknown
		//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ef: Expected O, but got Unknown
		//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f7: Expected O, but got Unknown
		//IL_028d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0297: Expected O, but got Unknown
		//IL_0298: Unknown result type (might be due to invalid IL or missing references)
		//IL_029f: Expected O, but got Unknown
		//IL_032d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0337: Expected O, but got Unknown
		//IL_0338: Unknown result type (might be due to invalid IL or missing references)
		//IL_033f: Expected O, but got Unknown
		//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d7: Expected O, but got Unknown
		GameObject val = ZoneManager.Instance.CreateLocationContainer("silvervein_loc");
		val.AddComponent<Location>().m_noBuild = false;
		GameObject val2 = ZoneManager.Instance.CreateLocationContainer("coppervein_loc");
		val2.AddComponent<Location>().m_noBuild = false;
		GameObject val3 = ZoneManager.Instance.CreateLocationContainer("tinvein_loc");
		val3.AddComponent<Location>().m_noBuild = false;
		GameObject val4 = ZoneManager.Instance.CreateLocationContainer("ironvein_loc");
		val4.AddComponent<Location>().m_noBuild = false;
		GameObject prefab = PrefabManager.Instance.GetPrefab("silvervein");
		GameObject prefab2 = PrefabManager.Instance.GetPrefab("rock4_copper");
		GameObject prefab3 = PrefabManager.Instance.GetPrefab("MineRock_Tin");
		GameObject prefab4 = PrefabManager.Instance.GetPrefab("mudpile_beacon");
		Object.Instantiate<GameObject>(prefab, val.transform).transform.localPosition = new Vector3(0f, -4f, 0f);
		Object.Instantiate<GameObject>(prefab2, val2.transform).transform.localPosition = new Vector3(0f, -2f, 0f);
		Object.Instantiate<GameObject>(prefab3, val3.transform).transform.localPosition = new Vector3(0f, -0.5f, 0f);
		Object.Instantiate<GameObject>(prefab4, val4.transform).transform.localPosition = new Vector3(0f, -3f, 0f);
		LocationConfig val5 = new LocationConfig();
		val5.Biome = (Biome)4;
		val5.Quantity = silverQuantity.Value;
		val5.Priotized = true;
		val5.MaxTerrainDelta = 3f;
		val5.ExteriorRadius = 10f;
		val5.MinAltitude = silverMinAltitude.Value;
		val5.MaxAltitude = silverMaxAltitude.Value;
		val5.MinDistanceFromSimilar = silverMinDistance.Value;
		val5.ClearArea = false;
		ZoneManager.Instance.AddCustomLocation(new CustomLocation(val, false, val5));
		LocationConfig val6 = new LocationConfig();
		val6.Biome = (Biome)8;
		val6.Quantity = copperQuantity.Value;
		val6.Priotized = true;
		val6.MinTerrainDelta = 0f;
		val6.MaxTerrainDelta = 2f;
		val6.ExteriorRadius = 10f;
		val6.BiomeArea = (BiomeArea)2;
		val6.MinAltitude = copperMinAltitude.Value;
		val6.MaxAltitude = copperMaxAltitude.Value;
		val6.MinDistanceFromSimilar = copperMinDistance.Value;
		val6.ClearArea = false;
		ZoneManager.Instance.AddCustomLocation(new CustomLocation(val2, false, val6));
		LocationConfig val7 = new LocationConfig();
		val7.Biome = (Biome)8;
		val7.Quantity = tinQuantity.Value;
		val7.Priotized = true;
		val7.MinTerrainDelta = 0f;
		val7.MaxTerrainDelta = 2f;
		val7.ExteriorRadius = 2f;
		val7.MinAltitude = tinMinAltitude.Value;
		val7.MaxAltitude = tinMaxAltitude.Value;
		val7.MinDistanceFromSimilar = tinMinDistance.Value;
		val7.ClearArea = false;
		ZoneManager.Instance.AddCustomLocation(new CustomLocation(val3, false, val7));
		LocationConfig val8 = new LocationConfig();
		val8.Biome = (Biome)2;
		val8.Quantity = ironQuantity.Value;
		val8.Priotized = true;
		val8.MinTerrainDelta = 0f;
		val8.MaxTerrainDelta = 2f;
		val8.ExteriorRadius = 5f;
		val8.MinAltitude = ironMinAltitude.Value;
		val8.MaxAltitude = ironMaxAltitude.Value;
		val8.MinDistanceFromSimilar = ironMinDistance.Value;
		val8.ClearArea = false;
		ZoneManager.Instance.AddCustomLocation(new CustomLocation(val4, false, val8));
		ZoneManager.OnVanillaLocationsAvailable -= CreateAddResources;
	}
}