Decompiled source of CoinsYCurius v1.0.3

CoinyCurius.dll

Decompiled 6 months ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using System.Text.RegularExpressions;
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.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("CoinyCurius")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CoinyCurius")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.0")]
namespace CoinyCurius;

internal class CoinyCuriusConfig
{
	public static ConfigFile cfg;

	public static ConfigEntry<bool> EnableDebugMode;

	public CoinyCuriusConfig(ConfigFile Config)
	{
		cfg = Config;
		cfg.SaveOnConfigSet = true;
		CreateConfigValues(Config);
	}

	private void CreateConfigValues(ConfigFile Config)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Expected O, but got Unknown
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Expected O, but got Unknown
		Config.SaveOnConfigSet = true;
		EnableDebugMode = Config.Bind<bool>("Client config", "EnableDebugMode", false, new ConfigDescription("Enables Debug logging for Shogun Era.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
		{
			IsAdvanced = true
		} }));
	}

	public static ConfigEntry<bool> BindServerConfig(string catagory, string key, bool value, string description, bool advanced = false)
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Expected O, but got Unknown
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Expected O, but got Unknown
		return cfg.Bind<bool>(catagory, key, value, new ConfigDescription(description, (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
		{
			IsAdminOnly = true,
			IsAdvanced = advanced
		} }));
	}

	public static ConfigEntry<int> BindServerConfig(string catagory, string key, int value, string description, bool advanced = false, int valmin = 0, int valmax = 150)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Expected O, but got Unknown
		return cfg.Bind<int>(catagory, key, value, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<int>(valmin, valmax), new object[1] { (object)new ConfigurationManagerAttributes
		{
			IsAdminOnly = true,
			IsAdvanced = advanced
		} }));
	}

	public static ConfigEntry<float> BindServerConfig(string catagory, string key, float value, string description, bool advanced = false, float valmin = 0f, float valmax = 150f)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Expected O, but got Unknown
		return cfg.Bind<float>(catagory, key, value, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<float>(valmin, valmax), new object[1] { (object)new ConfigurationManagerAttributes
		{
			IsAdminOnly = true,
			IsAdvanced = advanced
		} }));
	}

	public static ConfigEntry<string> BindServerConfig(string catagory, string key, string value, string description, bool advanced = false)
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Expected O, but got Unknown
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Expected O, but got Unknown
		return cfg.Bind<string>(catagory, key, value, new ConfigDescription(description, (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
		{
			IsAdminOnly = true,
			IsAdvanced = advanced
		} }));
	}
}
[BepInPlugin("Azathoth18.CoinyCurius", "CoinyCurius", "1.0.2")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
internal class CoinyCurius : BaseUnityPlugin
{
	public const string PluginGUID = "Azathoth18.CoinyCurius";

	public const string PluginName = "CoinyCurius";

	public const string PluginVersion = "1.0.2";

	internal static AssetBundle EmbeddedResourceBundle;

	private CustomLocalization Localization;

	private void Awake()
	{
		new CoinyCuriusConfig(((BaseUnityPlugin)this).Config);
		LoadAssets();
		new CoinyCuriusItems(EmbeddedResourceBundle);
		AddLocalizations();
	}

	private void Start()
	{
	}

	private void AddLocalizations()
	{
		Localization = LocalizationManager.Instance.GetLocalization();
		string[] manifestResourceNames = typeof(CoinyCurius).Assembly.GetManifestResourceNames();
		foreach (string text in manifestResourceNames)
		{
			if (text.Contains("localizations"))
			{
				if (CoinyCuriusConfig.EnableDebugMode.Value)
				{
					((BaseUnityPlugin)this).Logger.LogInfo((object)("Reading " + text));
				}
				string input = ReadEmbeddedResourceFile(text);
				string text2 = Regex.Replace(input, "\\/\\/.*", "");
				string[] array = text.Split(new char[1] { '.' });
				if (CoinyCuriusConfig.EnableDebugMode.Value)
				{
					((BaseUnityPlugin)this).Logger.LogInfo((object)("Adding localization: '" + array[2] + "'"));
				}
				Localization.AddJsonFile(array[2], text2);
			}
		}
	}

	private void LoadAssets()
	{
		if (CoinyCuriusConfig.EnableDebugMode.Value)
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Embedded resources: " + string.Join(",", typeof(CoinyCurius).Assembly.GetManifestResourceNames())));
		}
		EmbeddedResourceBundle = AssetUtils.LoadAssetBundleFromResources("CoinyCurius.AssetsEmbedded.penningar", typeof(CoinyCurius).Assembly);
		if (CoinyCuriusConfig.EnableDebugMode.Value)
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Asset Names: " + string.Join(",", EmbeddedResourceBundle.GetAllAssetNames())));
		}
	}

	private void UnloadAssets()
	{
		EmbeddedResourceBundle.Unload(false);
	}

	private string ReadEmbeddedResourceFile(string filename)
	{
		using Stream stream = typeof(CoinyCurius).Assembly.GetManifestResourceStream(filename);
		using StreamReader streamReader = new StreamReader(stream);
		return streamReader.ReadToEnd();
	}
}
internal class CoinyCuriusItems
{
	public CoinyCuriusItems(AssetBundle EmbeddedResourceBundle)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Expected O, but got Unknown
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Expected O, but got Unknown
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Expected O, but got Unknown
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Expected O, but got Unknown
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Expected O, but got Unknown
		//IL_011f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: Expected O, but got Unknown
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: Expected O, but got Unknown
		//IL_018e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01aa: Expected O, but got Unknown
		//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01be: Expected O, but got Unknown
		//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0212: Unknown result type (might be due to invalid IL or missing references)
		//IL_0219: Expected O, but got Unknown
		//IL_0226: Unknown result type (might be due to invalid IL or missing references)
		//IL_022d: Expected O, but got Unknown
		//IL_026c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0281: Unknown result type (might be due to invalid IL or missing references)
		//IL_0288: Expected O, but got Unknown
		//IL_0295: Unknown result type (might be due to invalid IL or missing references)
		//IL_029c: Expected O, but got Unknown
		//IL_02db: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f7: Expected O, but got Unknown
		//IL_0304: Unknown result type (might be due to invalid IL or missing references)
		//IL_030b: Expected O, but got Unknown
		//IL_034a: Unknown result type (might be due to invalid IL or missing references)
		//IL_035f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0366: Expected O, but got Unknown
		//IL_0373: Unknown result type (might be due to invalid IL or missing references)
		//IL_037a: Expected O, but got Unknown
		//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d5: Expected O, but got Unknown
		//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e9: Expected O, but got Unknown
		//IL_0428: Unknown result type (might be due to invalid IL or missing references)
		//IL_043d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0444: Expected O, but got Unknown
		ItemConfig val = new ItemConfig();
		val.Amount = CoinyCuriusConfig.BindServerConfig("Penningar", "craftamount", 1, "the number of items crafted from this recipe", advanced: true, 1, 999).Value;
		GameObject val2 = EmbeddedResourceBundle.LoadAsset<GameObject>("Penningar.prefab");
		val.Icon = RenderManager.Instance.Render(val2, RenderManager.IsometricRotation);
		CustomItem val3 = new CustomItem(val2, true, val);
		ItemManager.Instance.AddItem(val3);
		ItemConfig val4 = new ItemConfig();
		val4.Amount = CoinyCuriusConfig.BindServerConfig("MercenaryCoin", "craftamount", 1, "the number of items crafted from this recipe", advanced: true, 1, 999).Value;
		GameObject val5 = EmbeddedResourceBundle.LoadAsset<GameObject>("MercenaryCoin.prefab");
		val4.Icon = RenderManager.Instance.Render(val5, RenderManager.IsometricRotation);
		CustomItem val6 = new CustomItem(val5, true, val4);
		ItemManager.Instance.AddItem(val6);
		ItemConfig val7 = new ItemConfig();
		val7.Amount = CoinyCuriusConfig.BindServerConfig("PirateCoin", "craftamount", 1, "the number of items crafted from this recipe", advanced: true, 1, 999).Value;
		GameObject val8 = EmbeddedResourceBundle.LoadAsset<GameObject>("PirateCoin.prefab");
		val7.Icon = RenderManager.Instance.Render(val8, RenderManager.IsometricRotation);
		CustomItem val9 = new CustomItem(val8, true, val7);
		ItemManager.Instance.AddItem(val9);
		ItemConfig val10 = new ItemConfig();
		val10.Amount = CoinyCuriusConfig.BindServerConfig("CalaveraExtraña1", "craftamount", 1, "the number of items crafted from this recipe", advanced: true, 1, 999).Value;
		GameObject val11 = EmbeddedResourceBundle.LoadAsset<GameObject>("CalaveraExtraña1.prefab");
		val10.Icon = RenderManager.Instance.Render(val11, RenderManager.IsometricRotation);
		CustomItem val12 = new CustomItem(val11, true, val10);
		ItemManager.Instance.AddItem(val12);
		ItemConfig val13 = new ItemConfig();
		val13.Amount = CoinyCuriusConfig.BindServerConfig("CerebroHumano", "craftamount", 1, "the number of items crafted from this recipe", advanced: true, 1, 999).Value;
		GameObject val14 = EmbeddedResourceBundle.LoadAsset<GameObject>("CerebroHumano.prefab");
		val13.Icon = RenderManager.Instance.Render(val14, RenderManager.IsometricRotation);
		CustomItem val15 = new CustomItem(val14, true, val13);
		ItemManager.Instance.AddItem(val15);
		ItemConfig val16 = new ItemConfig();
		val16.Amount = CoinyCuriusConfig.BindServerConfig("Fertilizantes", "craftamount", 1, "the number of items crafted from this recipe", advanced: true, 1, 999).Value;
		GameObject val17 = EmbeddedResourceBundle.LoadAsset<GameObject>("Fertilizantes.prefab");
		val16.Icon = RenderManager.Instance.Render(val17, RenderManager.IsometricRotation);
		CustomItem val18 = new CustomItem(val17, true, val16);
		ItemManager.Instance.AddItem(val18);
		ItemConfig val19 = new ItemConfig();
		val19.Amount = CoinyCuriusConfig.BindServerConfig("LLaveCalavera", "craftamount", 1, "the number of items crafted from this recipe", advanced: true, 1, 999).Value;
		GameObject val20 = EmbeddedResourceBundle.LoadAsset<GameObject>("LLaveCalavera.prefab");
		val19.Icon = RenderManager.Instance.Render(val20, RenderManager.IsometricRotation);
		CustomItem val21 = new CustomItem(val20, true, val19);
		ItemManager.Instance.AddItem(val21);
		ItemConfig val22 = new ItemConfig();
		val22.Amount = CoinyCuriusConfig.BindServerConfig("LLaveDungeonQueen", "craftamount", 1, "the number of items crafted from this recipe", advanced: true, 1, 999).Value;
		GameObject val23 = EmbeddedResourceBundle.LoadAsset<GameObject>("LLaveDungeonQueen.prefab");
		val22.Icon = RenderManager.Instance.Render(val23, RenderManager.IsometricRotation);
		CustomItem val24 = new CustomItem(val23, true, val22);
		ItemManager.Instance.AddItem(val24);
		ItemConfig val25 = new ItemConfig();
		val25.Amount = CoinyCuriusConfig.BindServerConfig("Esenciademonstruo", "craftamount", 1, "the number of items crafted from this recipe", advanced: true, 1, 999).Value;
		GameObject val26 = EmbeddedResourceBundle.LoadAsset<GameObject>("Esenciademonstruo.prefab");
		val25.Icon = RenderManager.Instance.Render(val26, RenderManager.IsometricRotation);
		CustomItem val27 = new CustomItem(val26, true, val25);
		ItemManager.Instance.AddItem(val27);
		ItemConfig val28 = new ItemConfig();
		val28.Amount = CoinyCuriusConfig.BindServerConfig("Monedaantigua", "craftamount", 1, "the number of items crafted from this recipe", advanced: true, 1, 999).Value;
		GameObject val29 = EmbeddedResourceBundle.LoadAsset<GameObject>("Monedaantigua.prefab");
		val28.Icon = RenderManager.Instance.Render(val29, RenderManager.IsometricRotation);
		CustomItem val30 = new CustomItem(val29, true, val28);
		ItemManager.Instance.AddItem(val30);
		GameObject val31 = EmbeddedResourceBundle.LoadAsset<GameObject>("bane_projectile.prefab");
		GameObject val32 = EmbeddedResourceBundle.LoadAsset<GameObject>("fx_magickcirclearcano.prefab");
		GameObject val33 = EmbeddedResourceBundle.LoadAsset<GameObject>("fx_magickcirclefire.prefab");
		GameObject val34 = EmbeddedResourceBundle.LoadAsset<GameObject>("fx_magickcirclegreen.prefab");
		GameObject val35 = EmbeddedResourceBundle.LoadAsset<GameObject>("fx_magickcirclepurple.prefab");
		GameObject val36 = EmbeddedResourceBundle.LoadAsset<GameObject>("fx_magickcirclevampire.prefab");
		GameObject val37 = EmbeddedResourceBundle.LoadAsset<GameObject>("vfx_baneimpact.prefab");
		GameObject val38 = EmbeddedResourceBundle.LoadAsset<GameObject>("fx_magickhielo.prefab");
		GameObject val39 = EmbeddedResourceBundle.LoadAsset<GameObject>("fx_magickcircleblue.prefab");
		PrefabManager.Instance.AddPrefab(val31);
		PrefabManager.Instance.AddPrefab(val32);
		PrefabManager.Instance.AddPrefab(val33);
		PrefabManager.Instance.AddPrefab(val34);
		PrefabManager.Instance.AddPrefab(val35);
		PrefabManager.Instance.AddPrefab(val36);
		PrefabManager.Instance.AddPrefab(val37);
		PrefabManager.Instance.AddPrefab(val38);
		PrefabManager.Instance.AddPrefab(val39);
	}
}