using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using On.RoR2;
using RoR2;
using UnityEngine;
using UnityEngine.Networking;
[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.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("Pillars")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Pillars")]
[assembly: AssemblyTitle("Pillars")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace BenPillarSpace;
[BepInPlugin("com.Ben.PillarsDropItems", "Moon Pillars Drop Items", "1.1.0")]
public class PillarsDropItems : BaseUnityPlugin
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static hook_OnBatteryCharged <>9__42_0;
internal void <MoonPillars>b__42_0(orig_OnBatteryCharged orig, MoonBatteryMissionController self, HoldoutZoneController holdoutZone)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: 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_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, holdoutZone);
if (!NetworkServer.active)
{
return;
}
PickupIndex val = SelectItem();
ItemTier itemTier = PickupCatalog.GetPickupDef(val).itemTier;
if (!(val != PickupIndex.none))
{
return;
}
int participatingPlayerCount = Run.instance.participatingPlayerCount;
if (participatingPlayerCount == 0 || !Object.op_Implicit((Object)(object)((Component)holdoutZone).transform))
{
return;
}
int num = participatingPlayerCount * RewardMultiplier.Value;
float num2 = 360f / (float)num;
Vector3 val2 = Quaternion.AngleAxis((float)Random.Range(0, 360), Vector3.up) * (Vector3.up * 40f + Vector3.forward * 5f);
Quaternion val3 = Quaternion.AngleAxis(num2, Vector3.up);
int num3 = 0;
while (num3 < num)
{
bool flag = true;
PickupIndex val4 = PickupIndex.none;
if (Run.instance.bossRewardRng.RangeFloat(0f, 100f) < OverrideChance.Value)
{
val4 = ((!RandomOverride.Value) ? SelectSpecificItem() : SelectItem());
}
if (val4 == PickupIndex.none)
{
flag = false;
}
PickupDropletController.CreatePickupDroplet(flag ? val4 : val, ((Component)holdoutZone).transform.position + rewardPositionOffset, val2);
num3++;
val2 = val3 * val2;
}
}
}
private static Vector3 rewardPositionOffset = new Vector3(0f, 3f, 0f);
public static ConfigEntry<float> WhiteChance { get; set; }
public static ConfigEntry<float> GreenChance { get; set; }
public static ConfigEntry<float> RedChance { get; set; }
public static ConfigEntry<float> BlueChance { get; set; }
public static ConfigEntry<float> PearlChance { get; set; }
public static ConfigEntry<float> YellowChance { get; set; }
public static ConfigEntry<float> OverrideChance { get; set; }
public static ConfigEntry<bool> RandomOverride { get; set; }
public static ConfigEntry<int> RewardMultiplier { get; set; }
public static ConfigEntry<int> SpecificTierOverride { get; set; }
public void Awake()
{
((BaseUnityPlugin)this).Logger.LogMessage((object)"Execute Order 67");
WhiteChance = ((BaseUnityPlugin)this).Config.Bind<float>("PillarsDropItems", "WhiteChance", 0f, "Relative chance a white item is dropped. Total chance is the sum of all chances i.e. a 50 white chance and having all other chancess (including white) add up to 100, then their is a 50% chance that white is dropped. Total chance does NOT need to add up to 100.");
GreenChance = ((BaseUnityPlugin)this).Config.Bind<float>("PillarsDropItems", "GreenChance", 80f, "Relative chance a green item is dropped. ");
RedChance = ((BaseUnityPlugin)this).Config.Bind<float>("PillarsDropItems", "RedChance", 0f, "Relative chance a red item is dropped. ");
BlueChance = ((BaseUnityPlugin)this).Config.Bind<float>("PillarsDropItems", "BlueChance", 0f, "Relative chance a lunar item is dropped. ");
PearlChance = ((BaseUnityPlugin)this).Config.Bind<float>("PillarsDropItems", "PearlChance", 0f, "Relative chance a pearl (regular or irrradiant) item is dropped. ");
YellowChance = ((BaseUnityPlugin)this).Config.Bind<float>("PillarsDropItems", "PearlChance", 20f, "Relative chance a boss (non-peral) item is dropped. ");
RewardMultiplier = ((BaseUnityPlugin)this).Config.Bind<int>("PillarsDropItems", "RewardMultiplier", 2, "Multiplies Number of Items per player.");
OverrideChance = ((BaseUnityPlugin)this).Config.Bind<float>("PillarsDropItems", "OverrideChance", 10f, "Chance for an item to Be rerolled after the above set chance determined. Must be float between 0 and 100.");
RandomOverride = ((BaseUnityPlugin)this).Config.Bind<bool>("PillarsDropItems", "randomOveride", false, "Rerolls the overiding item from the same chance as above. This gives you basically the same spread of item rarity but this time they will be different. ");
SpecificTierOverride = ((BaseUnityPlugin)this).Config.Bind<int>("PillarsDropItems", "SpecificTierOverride", 3, "Limits the Override to a specifc Tier. RandomOverride takes precedence if true. 1 is white, 2 is green, 3 is red, 4 is blue, 5 is boss/yellow, 6 is pearls. Overwise will not overright if int not one of these.");
MoonPillars();
}
private void MoonPillars()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
object obj = <>c.<>9__42_0;
if (obj == null)
{
hook_OnBatteryCharged val = delegate(orig_OnBatteryCharged orig, MoonBatteryMissionController self, HoldoutZoneController holdoutZone)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: 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_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, holdoutZone);
if (NetworkServer.active)
{
PickupIndex val2 = SelectItem();
ItemTier itemTier = PickupCatalog.GetPickupDef(val2).itemTier;
if (val2 != PickupIndex.none)
{
int participatingPlayerCount = Run.instance.participatingPlayerCount;
if (participatingPlayerCount != 0 && Object.op_Implicit((Object)(object)((Component)holdoutZone).transform))
{
int num = participatingPlayerCount * RewardMultiplier.Value;
float num2 = 360f / (float)num;
Vector3 val3 = Quaternion.AngleAxis((float)Random.Range(0, 360), Vector3.up) * (Vector3.up * 40f + Vector3.forward * 5f);
Quaternion val4 = Quaternion.AngleAxis(num2, Vector3.up);
int num3 = 0;
while (num3 < num)
{
bool flag = true;
PickupIndex val5 = PickupIndex.none;
if (Run.instance.bossRewardRng.RangeFloat(0f, 100f) < OverrideChance.Value)
{
val5 = ((!RandomOverride.Value) ? SelectSpecificItem() : SelectItem());
}
if (val5 == PickupIndex.none)
{
flag = false;
}
PickupDropletController.CreatePickupDroplet(flag ? val5 : val2, ((Component)holdoutZone).transform.position + rewardPositionOffset, val3);
num3++;
val3 = val4 * val3;
}
}
}
}
};
<>c.<>9__42_0 = val;
obj = (object)val;
}
MoonBatteryMissionController.OnBatteryCharged += (hook_OnBatteryCharged)obj;
}
private static PickupIndex SelectItem()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: 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_0238: Unknown result type (might be due to invalid IL or missing references)
//IL_0239: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_023d: 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_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_0230: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
Xoroshiro128Plus bossRewardRng = Run.instance.bossRewardRng;
PickupIndex result = PickupIndex.none;
float num = WhiteChance.Value + GreenChance.Value + RedChance.Value + BlueChance.Value + YellowChance.Value + PearlChance.Value;
if (bossRewardRng.RangeFloat(0f, num) <= WhiteChance.Value)
{
List<PickupIndex> availableTier1DropList = Run.instance.availableTier1DropList;
result = bossRewardRng.NextElementUniform<PickupIndex>(availableTier1DropList);
}
else
{
num -= WhiteChance.Value;
if (bossRewardRng.RangeFloat(0f, num) <= GreenChance.Value)
{
List<PickupIndex> availableTier1DropList = Run.instance.availableTier2DropList;
result = bossRewardRng.NextElementUniform<PickupIndex>(availableTier1DropList);
}
else
{
num -= GreenChance.Value;
if (bossRewardRng.RangeFloat(0f, num) <= BlueChance.Value)
{
List<PickupIndex> availableTier1DropList = Run.instance.availableLunarCombinedDropList;
result = bossRewardRng.NextElementUniform<PickupIndex>(availableTier1DropList);
}
else
{
num -= BlueChance.Value;
if (bossRewardRng.RangeFloat(0f, num) <= RedChance.Value)
{
List<PickupIndex> availableTier1DropList = Run.instance.availableTier3DropList;
result = bossRewardRng.NextElementUniform<PickupIndex>(availableTier1DropList);
}
else
{
num -= RedChance.Value;
if (bossRewardRng.RangeFloat(0f, num) <= YellowChance.Value)
{
List<PickupIndex> availableTier1DropList = Run.instance.availableBossDropList;
result = bossRewardRng.NextElementUniform<PickupIndex>(availableTier1DropList);
}
else
{
num -= YellowChance.Value;
if (bossRewardRng.RangeFloat(0f, num) <= PearlChance.Value)
{
result = ((!(Run.instance.bossRewardRng.RangeFloat(0f, 100f) <= 20f)) ? PickupCatalog.FindPickupIndex(Items.Pearl.itemIndex) : PickupCatalog.FindPickupIndex(Items.ShinyPearl.itemIndex));
}
}
}
}
}
}
return result;
}
private static PickupIndex SelectSpecificItem()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: 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_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
Xoroshiro128Plus bossRewardRng = Run.instance.bossRewardRng;
PickupIndex result = PickupIndex.none;
if (SpecificTierOverride.Value == 1)
{
List<PickupIndex> availableTier1DropList = Run.instance.availableTier1DropList;
result = bossRewardRng.NextElementUniform<PickupIndex>(availableTier1DropList);
}
else if (SpecificTierOverride.Value == 2)
{
List<PickupIndex> availableTier1DropList = Run.instance.availableTier2DropList;
result = bossRewardRng.NextElementUniform<PickupIndex>(availableTier1DropList);
}
else if (SpecificTierOverride.Value == 4)
{
List<PickupIndex> availableTier1DropList = Run.instance.availableLunarCombinedDropList;
result = bossRewardRng.NextElementUniform<PickupIndex>(availableTier1DropList);
}
else if (SpecificTierOverride.Value == 3)
{
List<PickupIndex> availableTier1DropList = Run.instance.availableTier3DropList;
result = bossRewardRng.NextElementUniform<PickupIndex>(availableTier1DropList);
}
else if (SpecificTierOverride.Value == 5)
{
List<PickupIndex> availableTier1DropList = Run.instance.availableBossDropList;
result = bossRewardRng.NextElementUniform<PickupIndex>(availableTier1DropList);
}
else if (SpecificTierOverride.Value == 6)
{
result = ((!(Run.instance.bossRewardRng.RangeFloat(0f, 100f) <= 20f)) ? PickupCatalog.FindPickupIndex(Items.Pearl.itemIndex) : PickupCatalog.FindPickupIndex(Items.ShinyPearl.itemIndex));
}
return result;
}
}