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 BepInEx.Logging;
using BiggerExplosives.Patches;
using HarmonyLib;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("BiggerExplosives")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BiggerExplosives")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("99c879cd-f5b3-40bf-8dbf-a9159035a450")]
[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")]
namespace BiggerExplosives
{
[BepInPlugin("com.equinox.BiggerExplosives", "BiggerExplosives", "1.0.0")]
public class BiggerExplosivesPlugin : BaseUnityPlugin
{
private const string MyGUID = "com.equinox.BiggerExplosives";
private const string PluginName = "BiggerExplosives";
private const string VersionString = "1.0.0";
public static string ExplosionRadiusKey = "ExplosionRadius";
public static string ExplosionDepthKey = "ExplosionDepth";
public static ConfigEntry<int> ExplosionRadius;
public static ConfigEntry<int> ExplosionDepth;
private static readonly Harmony Harmony = new Harmony("com.equinox.BiggerExplosives");
public static ManualLogSource Log = new ManualLogSource("BiggerExplosives");
private void Awake()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected O, but got Unknown
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Expected O, but got Unknown
ExplosionRadius = ((BaseUnityPlugin)this).Config.Bind<int>("General", ExplosionRadiusKey, 11, new ConfigDescription("Resulting tunnel's width will be = (radius * )2 + 1", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 15), Array.Empty<object>()));
ExplosionDepth = ((BaseUnityPlugin)this).Config.Bind<int>("General", ExplosionDepthKey, 20, new ConfigDescription("Distance from the explosive to dig.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 30), Array.Empty<object>()));
((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: BiggerExplosives, VersionString: 1.0.0 is loading...");
Harmony.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: BiggerExplosives, VersionString: 1.0.0 is loaded.");
Log = ((BaseUnityPlugin)this).Logger;
Harmony.CreateAndPatchAll(typeof(ExplodeActionInfoPatch), (string)null);
}
}
}
namespace BiggerExplosives.Patches
{
public class ExplodeActionInfoPatch
{
[HarmonyPatch(typeof(ExplodeActionInfo), "Explode")]
[HarmonyPrefix]
private static bool setBiggerSize(ExplodeActionInfo __instance, out bool madeChanges, ref DigResultInfo digResultInfo)
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
madeChanges = false;
uint[] explosiveIDs = __instance.explosiveIDs;
MachineInstanceRef<ExplosiveInstance> val = default(MachineInstanceRef<ExplosiveInstance>);
IStreamedMachineInstance val3 = default(IStreamedMachineInstance);
foreach (uint num in explosiveIDs)
{
if (MachineManager.instance.GetRefFromId<ExplosiveInstance>(num, ref val))
{
ref ExplosiveInstance reference = ref val.Get();
GenericMachineInstanceRef val2 = val.AsGeneric();
if (((GenericMachineInstanceRef)(ref val2)).GetStreamedMachineInstance(ref val3))
{
((ExplosiveInstance)(ref reference)).myDef.TriggerDetonationFx(ref reference);
}
reference.detonated = true;
((ExplosiveInstance)(ref reference)).myDef.explosionRadius = BiggerExplosivesPlugin.ExplosionRadius.Value;
((ExplosiveInstance)(ref reference)).myDef.explosionDepth = BiggerExplosivesPlugin.ExplosionDepth.Value;
madeChanges = PlayerDigger.instance.ExplodeArea(((ExplosiveInstance)(ref reference)).myDef.shape, ((ExplosiveInstance)(ref reference)).myDef.explosionRadius, ((ExplosiveInstance)(ref reference)).myDef.explosionDepth, ((ExplosiveInstance)(ref reference)).myDef.maxHardness, -1, reference.blastDirection, ((GridInfo)(ref reference.gridInfo)).Center, reference.visualPositionOffset, ref digResultInfo);
return false;
}
}
return false;
}
}
}