Decompiled source of ConfigurableTrophies v1.0.2

7Nicc-ConfigurableTrophies.dll

Decompiled a day ago
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 HarmonyLib;
using Microsoft.CodeAnalysis;
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("7Nicc-ConfigurableTrophies")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("7Nicc-ConfigurableTrophies")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("25ace447-72ea-4f02-b721-669af206f888")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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;
		}
	}
}
namespace Nicc.ConfigurableTrophies
{
	[BepInPlugin("com.7nicc.configurabletrophies", "Configurable Trophies", "1.0.2")]
	public class ConfigurableTrophiesPlugin : BaseUnityPlugin
	{
		public static ConfigEntry<float> TrophyDropChance;

		private void Awake()
		{
			TrophyDropChance = ((BaseUnityPlugin)this).Config.Bind<float>("General", "TrophyDropChance", 0.5f, "The base drop chance for all trophies. 0.0 is 0%, 0.5 is 50%, 1.0 is 100%.");
			Harmony.CreateAndPatchAll(typeof(ConfigurableTrophiesPlugin), (string)null);
		}

		[HarmonyPatch(typeof(CharacterDrop), "GenerateDropList")]
		[HarmonyPrefix]
		private static void OverrideTrophyChance(CharacterDrop __instance)
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Invalid comparison between Unknown and I4
			if (__instance.m_drops == null)
			{
				return;
			}
			foreach (Drop drop in __instance.m_drops)
			{
				if ((Object)(object)drop.m_prefab != (Object)null)
				{
					ItemDrop component = drop.m_prefab.GetComponent<ItemDrop>();
					if ((Object)(object)component != (Object)null && component.m_itemData != null && component.m_itemData.m_shared != null && (int)component.m_itemData.m_shared.m_itemType == 13)
					{
						drop.m_chance = TrophyDropChance.Value;
					}
				}
			}
		}
	}
}