using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
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: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("0.0.0.0")]
[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 MoreShardsAndCoins
{
[HarmonyPatch(typeof(LootTable), "InitLootTable")]
public class LootTable_InitLootTable_Patch
{
private static void Postfix(LootTable __instance)
{
Stats component = ((Component)__instance).GetComponent<Stats>();
if (!((Object)(object)component == (Object)null) && component.Level >= 16)
{
float normalizedChance = Plugin.GetNormalizedChance(Plugin.PlanarShardDropChancePercent);
float normalizedChance2 = Plugin.GetNormalizedChance(Plugin.SivakruxDropChancePercent);
if (!__instance.ActualDrops.Contains(GameData.GM.PlanarShard) && Random.value < normalizedChance)
{
__instance.ActualDrops.Add(GameData.GM.PlanarShard);
__instance.special = true;
}
if (!__instance.ActualDrops.Contains(GameData.GM.Sivak) && Random.value < normalizedChance2)
{
__instance.ActualDrops.Add(GameData.GM.Sivak);
__instance.special = true;
}
}
}
}
[BepInPlugin("et508.erenshor.moreshardsandcoins", "More Shards and Coins", "1.0.3")]
public class Plugin : BaseUnityPlugin
{
public static ConfigEntry<float> PlanarShardDropChancePercent;
public static ConfigEntry<float> SivakruxDropChancePercent;
private void Awake()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Expected O, but got Unknown
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Expected O, but got Unknown
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Expected O, but got Unknown
PlanarShardDropChancePercent = ((BaseUnityPlugin)this).Config.Bind<float>("Drop Chance", "PlanarShardDropChancePercent", 0.1f, new ConfigDescription("Chance to drop Planar Stone Shards (0.0–100.0%). Default: 0.1. Reload scene or wait for new respawns for changes to apply.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
SivakruxDropChancePercent = ((BaseUnityPlugin)this).Config.Bind<float>("Drop Chance", "SivakruxDropChancePercent", 0.01f, new ConfigDescription("Chance to drop Sivakrux (0.0–100.0%). Default: 0.01. Reload scene or wait for new respawns for changes to apply.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
Harmony val = new Harmony("et508.erenshor.moreshardsandcoins");
val.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"More Shards and Coins loaded.");
}
public static float GetNormalizedChance(ConfigEntry<float> entry)
{
return Mathf.Clamp01(entry.Value / 100f);
}
}
}