using System;
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("CustomVegvisirs")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CustomVegvisirs")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("43948d84-ba78-4fdd-a6c2-8e3a35488dec")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CustomVegvisirs;
[BepInPlugin("elric.CustomVegvisirs", "Custom Vegvisirs", "1.0.3")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
internal class Custom_Vegvisirs : BaseUnityPlugin
{
public enum Biomes
{
Meadows,
BlackForest,
Swamp,
Mountain,
Plains,
Mistlands,
AshLands,
DeepNorth
}
public enum MapPins
{
Icon0,
Icon1,
Icon2,
Icon3,
Icon4,
Boss,
None
}
public const string PluginGUID = "elric.CustomVegvisirs";
public const string PluginName = "Custom Vegvisirs";
public const string PluginVersion = "1.0.3";
public static bool isModded = true;
public AssetBundle CustomVegvisirAssets;
private ConfigEntry<bool>[] Enabled = new ConfigEntry<bool>[6];
private ConfigEntry<Biomes>[] Biome = new ConfigEntry<Biomes>[6];
private ConfigEntry<int>[] Quantity = new ConfigEntry<int>[6];
private ConfigEntry<int>[] MinAltitude = new ConfigEntry<int>[6];
private ConfigEntry<int>[] MinDistanceFromSimilar = new ConfigEntry<int>[6];
private ConfigEntry<string>[] Name = new ConfigEntry<string>[6];
private ConfigEntry<string>[] PinName = new ConfigEntry<string>[6];
private ConfigEntry<MapPins>[] PinType = new ConfigEntry<MapPins>[6];
private ConfigEntry<string>[] Text = new ConfigEntry<string>[6];
private ConfigEntry<bool>[] ShowMap = new ConfigEntry<bool>[6];
private ConfigEntry<string>[] LocationName = new ConfigEntry<string>[6];
private string[] Colors = new string[6] { "Green", "Blue", "Red", "Cyan", "Purple", "Pink" };
private string[] VegPrefabs = new string[6] { "cv_green_vegvisir", "cv_blue_vegvisir", "cv_red_vegvisir", "cv_cyan_vegvisir", "cv_purple_vegvisir", "cv_pink_vegvisir" };
private void Awake()
{
ZoneManager.OnVanillaLocationsAvailable += LoadAssets;
ZoneManager.OnVanillaLocationsAvailable += SetRunestones;
CreateConfig();
LoadBundle();
}
private void CreateConfig()
{
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Expected O, but got Unknown
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Expected O, but got Unknown
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Expected O, but got Unknown
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Expected O, but got Unknown
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_01a5: Expected O, but got Unknown
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Expected O, but got Unknown
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
//IL_020b: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Expected O, but got Unknown
//IL_0213: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Expected O, but got Unknown
//IL_0281: Unknown result type (might be due to invalid IL or missing references)
//IL_0286: Unknown result type (might be due to invalid IL or missing references)
//IL_028e: Expected O, but got Unknown
//IL_028e: Unknown result type (might be due to invalid IL or missing references)
//IL_0298: Expected O, but got Unknown
//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0301: Unknown result type (might be due to invalid IL or missing references)
//IL_0309: Expected O, but got Unknown
//IL_0309: Unknown result type (might be due to invalid IL or missing references)
//IL_0313: Expected O, but got Unknown
//IL_0366: Unknown result type (might be due to invalid IL or missing references)
//IL_036b: Unknown result type (might be due to invalid IL or missing references)
//IL_0373: Expected O, but got Unknown
//IL_0373: Unknown result type (might be due to invalid IL or missing references)
//IL_037d: Expected O, but got Unknown
//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
//IL_03ee: Expected O, but got Unknown
//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
//IL_03f8: Expected O, but got Unknown
//IL_044b: Unknown result type (might be due to invalid IL or missing references)
//IL_0450: Unknown result type (might be due to invalid IL or missing references)
//IL_0458: Expected O, but got Unknown
//IL_0458: Unknown result type (might be due to invalid IL or missing references)
//IL_0462: Expected O, but got Unknown
//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
//IL_04be: Unknown result type (might be due to invalid IL or missing references)
//IL_04c6: Expected O, but got Unknown
//IL_04c6: Unknown result type (might be due to invalid IL or missing references)
//IL_04d0: Expected O, but got Unknown
for (int i = 0; i < 6; i++)
{
Enabled[i] = ((BaseUnityPlugin)this).Config.Bind<bool>(Colors[i] + " Vegvisir", Colors[i] + "Enabled", false, new ConfigDescription("Should the " + Colors[i] + " vegvisir be enabled?", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} }));
Biome[i] = ((BaseUnityPlugin)this).Config.Bind<Biomes>(Colors[i] + " Vegvisir", Colors[i] + "Biome", Biomes.Meadows, new ConfigDescription("What biome should the " + Colors[i] + " vegvisir spawn?", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} }));
Quantity[i] = ((BaseUnityPlugin)this).Config.Bind<int>(Colors[i] + " Vegvisir", Colors[i] + "Quantity", 50, new ConfigDescription("How many " + Colors[i] + " vegvisir should attempt to spawn?", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} }));
MinAltitude[i] = ((BaseUnityPlugin)this).Config.Bind<int>(Colors[i] + " Vegvisir", Colors[i] + "Altitude", 1, new ConfigDescription("What is the minimum altitude to spawn the " + Colors[i] + " vegvisir? This should be higher (100) for Mountains and Mistlands", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} }));
MinDistanceFromSimilar[i] = ((BaseUnityPlugin)this).Config.Bind<int>(Colors[i] + " Vegvisir", Colors[i] + "Distance", 200, new ConfigDescription("How far apart should the " + Colors[i] + " vegvisirs spawn?", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} }));
Name[i] = ((BaseUnityPlugin)this).Config.Bind<string>(Colors[i] + " Vegvisir", Colors[i] + "Name", Colors[i] + " Runestone", new ConfigDescription("What is the name of the " + Colors[i] + " vegvisir? This is what shows when you hover over it.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} }));
PinName[i] = ((BaseUnityPlugin)this).Config.Bind<string>(Colors[i] + " Vegvisir", Colors[i] + "PinName", Colors[i] + " Pin", new ConfigDescription("What is the label on the map pin for the " + Colors[i] + " vegvisir?", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} }));
PinType[i] = ((BaseUnityPlugin)this).Config.Bind<MapPins>(Colors[i] + " Vegvisir", Colors[i] + "PinSymbol", MapPins.Boss, new ConfigDescription("What symbol should the map pin use for the " + Colors[i] + " vegvisir?", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} }));
Text[i] = ((BaseUnityPlugin)this).Config.Bind<string>(Colors[i] + " Vegvisir", Colors[i] + "Text", Colors[i] + "s Text Description", new ConfigDescription("What text should the " + Colors[i] + " vegvisir show when read?", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} }));
ShowMap[i] = ((BaseUnityPlugin)this).Config.Bind<bool>(Colors[i] + " Vegvisir", Colors[i] + "Map", true, new ConfigDescription("Should the map show when you read the " + Colors[i] + " vegvisir?", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} }));
LocationName[i] = ((BaseUnityPlugin)this).Config.Bind<string>(Colors[i] + " Vegvisir", Colors[i] + "Location", "StartTemple", new ConfigDescription("What location should the map pin targer for the " + Colors[i] + " vegvisir? It will always show the nearest instance of that location. You can leave this entry blank for no location.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} }));
}
}
private void LoadBundle()
{
try
{
CustomVegvisirAssets = AssetUtils.LoadAssetBundleFromResources("custom_vegvisirs", Assembly.GetExecutingAssembly());
}
catch (Exception arg)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)$"Exception caught while loading bundle: {arg}");
}
}
private void LoadAssets()
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Expected O, but got Unknown
try
{
for (int i = 0; i < 6; i++)
{
if (Enabled[i].Value)
{
GameObject val = CustomVegvisirAssets.LoadAsset<GameObject>(VegPrefabs[i]);
LocationConfig val2 = new LocationConfig();
if (Biome[i].Value == Biomes.Meadows)
{
val2.Biome = (Biome)1;
}
else if (Biome[i].Value == Biomes.BlackForest)
{
val2.Biome = (Biome)8;
}
else if (Biome[i].Value == Biomes.Swamp)
{
val2.Biome = (Biome)2;
}
else if (Biome[i].Value == Biomes.Mountain)
{
val2.Biome = (Biome)4;
}
else if (Biome[i].Value == Biomes.Plains)
{
val2.Biome = (Biome)16;
}
else if (Biome[i].Value == Biomes.Mistlands)
{
val2.Biome = (Biome)512;
}
else if (Biome[i].Value == Biomes.AshLands)
{
val2.Biome = (Biome)32;
}
else if (Biome[i].Value == Biomes.DeepNorth)
{
val2.Biome = (Biome)64;
}
val2.BiomeArea = (BiomeArea)2;
val2.Quantity = Quantity[i].Value;
val2.MinAltitude = MinAltitude[i].Value;
val2.Priotized = true;
val2.MinDistanceFromSimilar = MinDistanceFromSimilar[i].Value;
val2.RandomRotation = true;
ZoneManager.Instance.AddCustomLocation(new CustomLocation(val, true, val2));
}
}
}
catch (Exception arg)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)$"Exception caught while loading assets: {arg}");
}
finally
{
ZoneManager.OnVanillaClutterAvailable -= LoadAssets;
}
}
private void SetRunestones()
{
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < 6; i++)
{
if (Enabled[i].Value)
{
RuneStone prefab = Cache.GetPrefab<RuneStone>(VegPrefabs[i]);
prefab.m_label = Colors[i] + " Runestone";
prefab.m_name = Name[i].Value;
prefab.m_pinName = PinName[i].Value;
prefab.m_text = Text[i].Value;
prefab.m_showMap = ShowMap[i].Value;
prefab.m_locationName = LocationName[i].Value;
if (PinType[i].Value == MapPins.Icon0)
{
prefab.m_pinType = (PinType)0;
}
else if (PinType[i].Value == MapPins.Icon1)
{
prefab.m_pinType = (PinType)1;
}
else if (PinType[i].Value == MapPins.Icon2)
{
prefab.m_pinType = (PinType)2;
}
else if (PinType[i].Value == MapPins.Icon3)
{
prefab.m_pinType = (PinType)3;
}
else if (PinType[i].Value == MapPins.Icon4)
{
prefab.m_pinType = (PinType)6;
}
else if (PinType[i].Value == MapPins.Boss)
{
prefab.m_pinType = (PinType)9;
}
else if (PinType[i].Value == MapPins.None)
{
prefab.m_pinType = (PinType)8;
}
}
}
}
}