Decompiled source of BetterItemRewards v1.2.1

BetterItemRewards.dll

Decompiled 4 months 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 Microsoft.CodeAnalysis;
using RoR2;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("BetterItemRewards")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BetterItemRewards")]
[assembly: AssemblyTitle("BetterItemRewards")]
[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;
		}
	}
}
namespace BetterItemRewards
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("CaptainPudding.BetterItemRewards", "BetterItemRewards", "1.2.0")]
	public class BetterItemRewards : BaseUnityPlugin
	{
		public const string PluginGUID = "CaptainPudding.BetterItemRewards";

		public const string PluginAuthor = "CaptainPudding";

		public const string PluginName = "BetterItemRewards";

		public const string PluginVersion = "1.2.0";

		public static ConfigWrapper<int> equipmentTimeLimit { get; set; }

		public static ConfigWrapper<int> tierTwoTimeLimit { get; set; }

		public static ConfigWrapper<int> tierThreeTimeLimit { get; set; }

		public void Awake()
		{
			Chat.AddMessage("BetterItemRewards 1.2.0 Loaded");
			initConfig();
			GlobalEventManager.onTeamLevelUp += GlobalEventManager_onTeamLevelUp;
		}

		private void GlobalEventManager_onTeamLevelUp(TeamIndex teamIndex)
		{
			int count = PlayerCharacterMasterController.instances.Count;
			float time = Run.instance.time;
			for (int i = 0; i < count; i++)
			{
				CharacterMaster master = PlayerCharacterMasterController.instances[i].master;
				if (!master.IsDeadAndOutOfLivesServer())
				{
					int num = 0;
					if (time >= (float)tierThreeTimeLimit.Value * 60f)
					{
						num = Random.Range(0, 4);
					}
					else if (time >= (float)tierTwoTimeLimit.Value * 60f)
					{
						num = Random.Range(0, 3);
					}
					else if (time >= (float)equipmentTimeLimit.Value * 60f)
					{
						num = Random.Range(0, 2);
					}
					switch (num)
					{
					case 0:
						spawnTier1Item(1f, master.GetBodyObject().transform);
						break;
					case 1:
						spawnEquipment(0f, master.GetBodyObject().transform);
						break;
					case 2:
						spawnTier2Item(0f, master.GetBodyObject().transform);
						break;
					case 3:
						spawnTier3Item(0f, master.GetBodyObject().transform);
						break;
					default:
						spawnTier1Item(0f, master.GetBodyObject().transform);
						break;
					}
				}
			}
		}

		public void initConfig()
		{
			tierThreeTimeLimit = ((BaseUnityPlugin)this).Config.Wrap<int>("BetterItemRewards time limits", "Tier Three Time Limit", "Upto and including Tier three will start appearing after this time limit. IN MINUTES. (tier one, tier two, tier three, equipment)", 30);
			tierTwoTimeLimit = ((BaseUnityPlugin)this).Config.Wrap<int>("BetterItemRewards time limits", "Tier Two Time Limit", "Upto and including Tier two will start appearing after this time limit. IN MINUTES. (tier one, tier two, equipment)", 10);
			equipmentTimeLimit = ((BaseUnityPlugin)this).Config.Wrap<int>("BetterItemRewards time limits", "Equipment Time Limit", "Upto and including equipment will start appearing after this time limit. IN MINUTES. (tier one, equipment)", 5);
		}

		public void spawnTier1Item(float offSet, Transform transform)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			List<PickupIndex> availableTier1DropList = Run.instance.availableTier1DropList;
			int index = Run.instance.treasureRng.RangeInt(0, availableTier1DropList.Count);
			PickupDropletController.CreatePickupDroplet(availableTier1DropList[index], transform.position, transform.forward * (20f + offSet));
		}

		public void spawnTier2Item(float offSet, Transform transform)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			List<PickupIndex> availableTier2DropList = Run.instance.availableTier2DropList;
			int index = Run.instance.treasureRng.RangeInt(0, availableTier2DropList.Count);
			PickupDropletController.CreatePickupDroplet(availableTier2DropList[index], transform.position, transform.forward * (20f + offSet));
		}

		public void spawnTier3Item(float offSet, Transform transform)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			List<PickupIndex> availableTier3DropList = Run.instance.availableTier3DropList;
			int index = Run.instance.treasureRng.RangeInt(0, availableTier3DropList.Count);
			PickupDropletController.CreatePickupDroplet(availableTier3DropList[index], transform.position, transform.forward * (20f + offSet));
		}

		public void spawnEquipment(float offSet, Transform transform)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			List<PickupIndex> availableEquipmentDropList = Run.instance.availableEquipmentDropList;
			int index = Run.instance.treasureRng.RangeInt(0, availableEquipmentDropList.Count);
			PickupDropletController.CreatePickupDroplet(availableEquipmentDropList[index], transform.position, transform.forward * (20f + offSet));
		}

		public void Update()
		{
		}
	}
}