using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using Microsoft.CodeAnalysis;
using On.RoR2;
using RoR2;
using UnityEngine;
using UnityEngine.Networking;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Boss Drop Reward Delay")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Boss Drop Reward Delay")]
[assembly: AssemblyTitle("Boss Drop Reward Delay")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
namespace BossDropRewardDelay
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.YourName.BossDropDelay", "Boss Drop Reward Delay", "1.0.8")]
public class BossDropDelayPlugin : BaseUnityPlugin
{
private ConfigEntry<float> configDelaySeconds;
private ConfigEntry<int> configBatchSize;
public void Awake()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
CreateConfig();
BossGroup.DropRewards += new hook_DropRewards(DropRewardsWithDelay);
}
private void CreateConfig()
{
configDelaySeconds = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Delay Seconds", 0.3f, "The time in seconds to wait between dropping batches of items.");
configBatchSize = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Batch Size", 1, "How many items should drop at once before waiting for the delay.");
}
private void DropRewardsWithDelay(orig_DropRewards orig, BossGroup self)
{
if (NetworkServer.active)
{
SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene();
switch ((sceneDefForCurrentScene != null) ? sceneDefForCurrentScene.baseSceneName : null)
{
case "artifactworld":
case "limbo":
case "voidraid":
case "shipgraveyard":
case "arena":
orig.Invoke(self);
break;
default:
((MonoBehaviour)self).StartCoroutine(DropRewardsCoroutine(self));
break;
}
}
}
private IEnumerator DropRewardsCoroutine(BossGroup bossGroup)
{
if (!Object.op_Implicit((Object)(object)bossGroup.dropPosition) || !Object.op_Implicit((Object)(object)bossGroup.dropTable))
{
yield break;
}
Xoroshiro128Plus treasureRng = Run.instance.treasureRng;
int totalItems = (1 + bossGroup.bonusRewardCount) * Run.instance.participatingPlayerCount;
Transform dropTransform = bossGroup.dropPosition;
PickupDropTable dropTable = bossGroup.dropTable;
PickupIndex dropToUse = PickupIndex.none;
SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene();
if (((sceneDefForCurrentScene != null) ? sceneDefForCurrentScene.baseSceneName : null) == "goldshores")
{
ItemIndex itemIndex = Items.TitanGoldDuringTP.itemIndex;
dropToUse = PickupCatalog.FindPickupIndex(itemIndex);
((BaseUnityPlugin)this).Logger.LogInfo((object)"[BossDropDelay] Gilded Coast detected. Forcing Halcyon Seed drop.");
}
else
{
try
{
dropToUse = dropTable.GenerateDrop(treasureRng);
}
catch (NotImplementedException)
{
if (Run.instance.availableTier2DropList.Count > 0)
{
dropToUse = Run.instance.availableTier2DropList[treasureRng.RangeInt(0, Run.instance.availableTier2DropList.Count)];
}
}
catch (Exception ex2)
{
((BaseUnityPlugin)this).Logger.LogError((object)("[BossDropDelay] Error generating drop: " + ex2.Message));
}
}
if (dropToUse == PickupIndex.none && Run.instance.availableTier2DropList.Count > 0)
{
dropToUse = Run.instance.availableTier2DropList[treasureRng.RangeInt(0, Run.instance.availableTier2DropList.Count)];
}
int currentBatchCount = 0;
for (int i = 0; i < totalItems; i++)
{
if (dropToUse != PickupIndex.none)
{
float num = Random.Range(0f, 360f);
Vector3 val = Quaternion.Euler(0f, num, 0f) * Vector3.forward;
float num2 = 12f;
float num3 = 25f;
Vector3 val2 = val * num2 + Vector3.up * num3;
PickupDropletController.CreatePickupDroplet(dropToUse, dropTransform.position, val2);
}
currentBatchCount++;
if (currentBatchCount >= configBatchSize.Value)
{
currentBatchCount = 0;
yield return (object)new WaitForSeconds(configDelaySeconds.Value);
}
}
}
}
}