Decompiled source of MachineSon v1.0.5

MachineChance.dll

Decompiled 2 years ago
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 Characters.Gear;
using GameResources;
using Hardmode.Darktech;
using HarmonyLib;
using MachineChance;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("MachineChance")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("MachineChance")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0")]
[assembly: AssemblyProduct("MachineChance")]
[assembly: AssemblyTitle("MachineChance")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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;
		}
	}
}
[BepInPlugin("MachineChance", "MachineChance", "1.0")]
public class Plugin : BaseUnityPlugin
{
	public enum Rarity
	{
		commond = 1,
		rare = 2,
		uniqe = 3,
		Legend = 4,
		Omen = 5,
		ALL = 999
	}

	public static ConfigEntry<Rarity> Rare;

	private void Awake()
	{
		Rare = ((BaseUnityPlugin)this).Config.Bind<Rarity>("General", "나올 레어도", Rarity.ALL, "원하시는걸 선택해주세요.");
		Harmony.CreateAndPatchAll(typeof(MachineChanced), (string)null);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Mod MachineChance is loaded!");
	}

	private void Update()
	{
		((BaseUnityPlugin)this).Config.Reload();
	}
}
namespace MachineChance
{
	public class MachineChanced : MonoBehaviour
	{
		private static MachineChanced instancese;

		private static ICollection<GearReference> Common_Item = new List<GearReference>();

		private static ICollection<GearReference> Rare_Item = new List<GearReference>();

		private static ICollection<GearReference> Unique_Item = new List<GearReference>();

		private static ICollection<GearReference> Legendary_Item = new List<GearReference>();

		private static ICollection<GearReference> Omen_Item = new List<GearReference>();

		private static ICollection<GearReference> Common_weapon = new List<GearReference>();

		private static ICollection<GearReference> Rare_weapon = new List<GearReference>();

		private static ICollection<GearReference> Unique_weapon = new List<GearReference>();

		private static ICollection<GearReference> Legendary_weapon = new List<GearReference>();

		private MethodInfo HideDisplay = typeof(ManufacturingMachineInteractive).GetMethod("HideDisplay", BindingFlags.Instance | BindingFlags.NonPublic);

		private MethodInfo Down = typeof(ManufacturingMachineInteractive).GetMethod("Down", BindingFlags.Instance | BindingFlags.NonPublic);

		private void Start()
		{
			if ((Object)(object)instancese == (Object)null)
			{
				instancese = this;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(ManufacturingMachineInteractive), "ActivateMachine")]
		private static void Rarye(ref List<GearReference> ____gearList, ref Type ____type)
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Invalid comparison between Unknown and I4
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Invalid comparison between Unknown and I4
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Invalid comparison between Unknown and I4
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Invalid comparison between Unknown and I4
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Invalid comparison between Unknown and I4
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Invalid comparison between Unknown and I4
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Invalid comparison between Unknown and I4
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Invalid comparison between Unknown and I4
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Invalid comparison between Unknown and I4
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Invalid comparison between Unknown and I4
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Invalid comparison between Unknown and I4
			//IL_01b6: 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_00ea: Invalid comparison between Unknown and I4
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Invalid comparison between Unknown and I4
			____gearList = new List<GearReference>();
			if ((int)____type == 1)
			{
				Common_Item.Clear();
				Rare_Item.Clear();
				Unique_Item.Clear();
				Legendary_Item.Clear();
				Omen_Item.Clear();
				foreach (ItemReference item in GearResource.instance.items)
				{
					if ((int)((GearReference)item).rarity == 0 && (int)((GearReference)item).type == 1)
					{
						Common_Item.Add((GearReference)(object)item);
					}
					if ((int)((GearReference)item).rarity == 1 && (int)((GearReference)item).type == 1)
					{
						Rare_Item.Add((GearReference)(object)item);
					}
					if ((int)((GearReference)item).rarity == 2 && (int)((GearReference)item).type == 1)
					{
						Unique_Item.Add((GearReference)(object)item);
					}
					if ((int)((GearReference)item).rarity == 3 && (int)((GearReference)item).type == 1)
					{
						Legendary_Item.Add((GearReference)(object)item);
					}
					if (((int)((GearReference)item).gearTag == 8 || (int)((GearReference)item).gearTag == 16) && (int)((GearReference)item).type == 1)
					{
						Omen_Item.Add((GearReference)(object)item);
					}
				}
			}
			else if ((int)____type == 0)
			{
				Common_weapon.Clear();
				Rare_weapon.Clear();
				Unique_weapon.Clear();
				Legendary_weapon.Clear();
				foreach (WeaponReference weapon in GearResource.instance.weapons)
				{
					if ((int)((GearReference)weapon).rarity == 0 && (int)((GearReference)weapon).type == 0)
					{
						Common_weapon.Add((GearReference)(object)weapon);
					}
					if ((int)((GearReference)weapon).rarity == 1 && (int)((GearReference)weapon).type == 0)
					{
						Rare_weapon.Add((GearReference)(object)weapon);
					}
					if ((int)((GearReference)weapon).rarity == 2 && (int)((GearReference)weapon).type == 0)
					{
						Unique_weapon.Add((GearReference)(object)weapon);
					}
					if ((int)((GearReference)weapon).rarity == 3 && (int)((GearReference)weapon).type == 0)
					{
						Legendary_weapon.Add((GearReference)(object)weapon);
					}
				}
			}
			switch (Plugin.Rare.Value)
			{
			case Plugin.Rarity.commond:
				if ((int)____type == 1)
				{
					____gearList.AddRange(Common_Item);
				}
				else if ((int)____type == 0)
				{
					____gearList.AddRange(Common_weapon);
				}
				return;
			case Plugin.Rarity.rare:
				if ((int)____type == 1)
				{
					____gearList.AddRange(Rare_Item);
				}
				else if ((int)____type == 0)
				{
					____gearList.AddRange(Rare_weapon);
				}
				return;
			case Plugin.Rarity.uniqe:
				if ((int)____type == 1)
				{
					____gearList.AddRange(Unique_Item);
				}
				else if ((int)____type == 0)
				{
					____gearList.AddRange(Unique_weapon);
				}
				return;
			case Plugin.Rarity.Legend:
				if ((int)____type == 1)
				{
					____gearList.AddRange(Legendary_Item);
				}
				else if ((int)____type == 0)
				{
					____gearList.AddRange(Legendary_weapon);
				}
				return;
			case Plugin.Rarity.Omen:
				if ((int)____type == 1)
				{
					____gearList.AddRange(Omen_Item);
				}
				else if ((int)____type == 0)
				{
					____gearList.AddRange(Common_weapon);
				}
				return;
			}
			if ((int)____type == 1)
			{
				____gearList.AddRange(Common_Item);
				____gearList.AddRange(Rare_Item);
				____gearList.AddRange(Unique_Item);
				____gearList.AddRange(Legendary_Item);
				____gearList.AddRange(Omen_Item);
			}
			else if ((int)____type == 0)
			{
				____gearList.AddRange(Common_weapon);
				____gearList.AddRange(Rare_weapon);
				____gearList.AddRange(Unique_weapon);
				____gearList.AddRange(Legendary_weapon);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(ManufacturingMachineInteractive), "Select")]
		private static void RarSelectye(ref int ____selectCount, ref int ____remainSelectCount, ref List<GearReference> ____gearList, ref Type ____type)
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Invalid comparison between Unknown and I4
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Invalid comparison between Unknown and I4
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Invalid comparison between Unknown and I4
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Invalid comparison between Unknown and I4
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Invalid comparison between Unknown and I4
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Invalid comparison between Unknown and I4
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Invalid comparison between Unknown and I4
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Invalid comparison between Unknown and I4
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Invalid comparison between Unknown and I4
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Invalid comparison between Unknown and I4
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Invalid comparison between Unknown and I4
			____remainSelectCount = ____selectCount;
			____gearList.Clear();
			if ((int)____type == 1)
			{
				Common_Item.Clear();
				Rare_Item.Clear();
				Unique_Item.Clear();
				Legendary_Item.Clear();
				Omen_Item.Clear();
				foreach (ItemReference item in GearResource.instance.items)
				{
					if ((int)((GearReference)item).rarity == 0 && (int)((GearReference)item).type == 1)
					{
						Common_Item.Add((GearReference)(object)item);
					}
					if ((int)((GearReference)item).rarity == 1 && (int)((GearReference)item).type == 1)
					{
						Rare_Item.Add((GearReference)(object)item);
					}
					if ((int)((GearReference)item).rarity == 2 && (int)((GearReference)item).type == 1)
					{
						Unique_Item.Add((GearReference)(object)item);
					}
					if ((int)((GearReference)item).rarity == 3 && (int)((GearReference)item).type == 1)
					{
						Legendary_Item.Add((GearReference)(object)item);
					}
					if (((int)((GearReference)item).gearTag == 8 || (int)((GearReference)item).gearTag == 16) && (int)((GearReference)item).type == 1)
					{
						Omen_Item.Add((GearReference)(object)item);
					}
				}
			}
			else if ((int)____type == 0)
			{
				Common_weapon.Clear();
				Rare_weapon.Clear();
				Unique_weapon.Clear();
				Legendary_weapon.Clear();
				foreach (WeaponReference weapon in GearResource.instance.weapons)
				{
					if ((int)((GearReference)weapon).rarity == 0 && (int)((GearReference)weapon).type == 0)
					{
						Common_weapon.Add((GearReference)(object)weapon);
					}
					if ((int)((GearReference)weapon).rarity == 1 && (int)((GearReference)weapon).type == 0)
					{
						Rare_weapon.Add((GearReference)(object)weapon);
					}
					if ((int)((GearReference)weapon).rarity == 2 && (int)((GearReference)weapon).type == 0)
					{
						Unique_weapon.Add((GearReference)(object)weapon);
					}
					if ((int)((GearReference)weapon).rarity == 3 && (int)((GearReference)weapon).type == 0)
					{
						Legendary_weapon.Add((GearReference)(object)weapon);
					}
				}
			}
			switch (Plugin.Rare.Value)
			{
			case Plugin.Rarity.commond:
				if ((int)____type == 1)
				{
					____gearList.AddRange(Common_Item);
				}
				else if ((int)____type == 0)
				{
					____gearList.AddRange(Common_weapon);
				}
				return;
			case Plugin.Rarity.rare:
				if ((int)____type == 1)
				{
					____gearList.AddRange(Rare_Item);
				}
				else if ((int)____type == 0)
				{
					____gearList.AddRange(Rare_weapon);
				}
				return;
			case Plugin.Rarity.uniqe:
				if ((int)____type == 1)
				{
					____gearList.AddRange(Unique_Item);
				}
				else if ((int)____type == 0)
				{
					____gearList.AddRange(Unique_weapon);
				}
				return;
			case Plugin.Rarity.Legend:
				if ((int)____type == 1)
				{
					____gearList.AddRange(Legendary_Item);
				}
				else if ((int)____type == 0)
				{
					____gearList.AddRange(Legendary_weapon);
				}
				return;
			case Plugin.Rarity.Omen:
				if ((int)____type == 1)
				{
					____gearList.AddRange(Omen_Item);
				}
				else if ((int)____type == 0)
				{
					____gearList.AddRange(Common_weapon);
				}
				return;
			}
			if ((int)____type == 1)
			{
				____gearList.AddRange(Common_Item);
				____gearList.AddRange(Rare_Item);
				____gearList.AddRange(Unique_Item);
				____gearList.AddRange(Legendary_Item);
				____gearList.AddRange(Omen_Item);
			}
			else if ((int)____type == 0)
			{
				____gearList.AddRange(Common_weapon);
				____gearList.AddRange(Rare_weapon);
				____gearList.AddRange(Unique_weapon);
				____gearList.AddRange(Legendary_weapon);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(ManufacturingMachineInteractive), "HideDisplay")]
		private static bool Hiding()
		{
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(ManufacturingMachineInteractive), "Down")]
		private static bool Dowing()
		{
			return true;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "MachineChance";

		public const string PLUGIN_NAME = "MachineChance";

		public const string PLUGIN_VERSION = "1.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}