Decompiled source of Rarity Edit Mod v1.0.0

ChestChance.dll

Decompiled 8 months ago
using System;
using System.CodeDom.Compiler;
using System.Configuration;
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 ChestChance;
using HarmonyLib;
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("ChestChance")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("ChestChance")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0")]
[assembly: AssemblyProduct("ChestChance")]
[assembly: AssemblyTitle("ChestChance")]
[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("ChestChance", "ChestChance", "1.0")]
public class Plugin : BaseUnityPlugin
{
	public static ConfigEntry<int> commond;

	public static ConfigEntry<int> rared;

	public static ConfigEntry<int> Uniqed;

	public static ConfigEntry<int> Legeno;

	public static ConfigEntry<bool> isRandom;

	public static ConfigEntry<bool> isReverseRandom;

	private void Awake()
	{
		commond = ((BaseUnityPlugin)this).Config.Bind<int>("General", "일반", 25, "0부터 100사이의 확율을 지정해주세요");
		rared = ((BaseUnityPlugin)this).Config.Bind<int>("General", "레어", 25, "0부터 100사이의 확율을 지정해주세요");
		Uniqed = ((BaseUnityPlugin)this).Config.Bind<int>("General", "유니크", 25, "0부터 100사이의 확율을 지정해주세요");
		Legeno = ((BaseUnityPlugin)this).Config.Bind<int>("General", "레전드", 25, "0부터 100사이의 확율을 지정해주세요");
		isRandom = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "확율 정상화", false, "확율을 정상적으로 되돌립니다.");
		isReverseRandom = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "확율역전화", false, "확율을 역전시킵니다.");
		Harmony.CreateAndPatchAll(typeof(ChestChanced), (string)null);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Mod ChestChance is loaded!");
	}

	private void Update()
	{
		((BaseUnityPlugin)this).Config.Reload();
	}
}
namespace ChestChance
{
	public class ChestChanced
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(RarityPossibilities), "Evaluate", new Type[]
		{
			typeof(Random),
			typeof(int[])
		})]
		private static void Rarye(ref Rarity __result)
		{
			if (!Plugin.isRandom.Value)
			{
				int num = new Random().Next(1, Plugin.commond.Value + Plugin.rared.Value + Plugin.Uniqed.Value + Plugin.Legeno.Value + 1);
				if (num <= Plugin.commond.Value)
				{
					Debug.LogError((object)"기본!");
					__result = (Rarity)0;
				}
				else if (num > Plugin.commond.Value && num <= Plugin.commond.Value + Plugin.rared.Value)
				{
					Debug.LogError((object)"레어!");
					__result = (Rarity)1;
				}
				else if (num > Plugin.commond.Value + Plugin.rared.Value && num <= Plugin.commond.Value + Plugin.rared.Value + Plugin.Uniqed.Value)
				{
					Debug.LogError((object)"유니크!");
					__result = (Rarity)2;
				}
				else if (num > Plugin.commond.Value + Plugin.rared.Value + Plugin.Uniqed.Value && num <= Plugin.commond.Value + Plugin.rared.Value + Plugin.Uniqed.Value + Plugin.Legeno.Value)
				{
					Debug.LogError((object)"레전드!");
					__result = (Rarity)3;
				}
			}
			else if (Plugin.isReverseRandom.Value)
			{
				if ((int)__result == 3)
				{
					Debug.LogError((object)"기본!");
					__result = (Rarity)0;
				}
				else if ((int)__result == 2)
				{
					Debug.LogError((object)"레어!");
					__result = (Rarity)1;
				}
				else if ((int)__result == 1)
				{
					Debug.LogError((object)"유니크!");
					__result = (Rarity)2;
				}
				else if ((int)__result == 0)
				{
					Debug.LogError((object)"레전드!");
					__result = (Rarity)3;
				}
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "ChestChance";

		public const string PLUGIN_NAME = "ChestChance";

		public const string PLUGIN_VERSION = "1.0";
	}
}
namespace ChestChance.Properties
{
	[CompilerGenerated]
	[GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.7.0.0")]
	internal sealed class Settings : ApplicationSettingsBase
	{
		private static Settings defaultInstance = (Settings)(object)SettingsBase.Synchronized((SettingsBase)(object)new Settings());

		public static Settings Default => defaultInstance;
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}