using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using Explosives.Mono;
using FireSpreads;
using HarmonyLib;
using Jotunn;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Explosives")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Explosives")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.0")]
namespace Explosives
{
[BepInPlugin("org.bepinex.plugins.bid.Explosives", "Explosives", "0.1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
internal class Explosives : BaseUnityPlugin
{
public const string PluginGUID = "org.bepinex.plugins.bid.Explosives";
public const string PluginName = "Explosives";
public const string PluginVersion = "0.1.0";
private readonly Harmony harmony = new Harmony("org.bepinex.plugins.bid.Explosives");
public static HashSet<string> s_explosives = new HashSet<string>();
public static readonly string s_explosionPrefab = "bid_explosion";
public static readonly string s_explosionFxPrefab = "bid_explosion_fx";
public static readonly string s_explosionDigPrefab = "bid_explosion_dig";
public static ConfigEntry<string> ExplosivesConfig;
public static ConfigEntry<float> MaxChopDamageConfig;
public static ConfigEntry<float> MaxPickaxeDamageConfig;
public static ConfigEntry<float> MaxFireDamageConfig;
public static ConfigEntry<float> MaxExplosionRangeConfig;
public static ConfigEntry<float> MaxHeatWaveRangeConfig;
public static ConfigEntry<float> TinderBarrelHealthConfig;
public static GameObject[] s_explosions = (GameObject[])(object)new GameObject[5];
public static GameObject s_explosionSpawner = null;
public static Piece m_barrelPiece = null;
public static Piece m_barrelTrapPiece = null;
private void Awake()
{
Logger.LogInfo((object)"Explosives has landed");
CreateConfigValues();
PrefabManager.OnVanillaPrefabsAvailable += AddClonedItems;
PieceManager.OnPiecesRegistered += MakeIcons;
harmony.PatchAll();
}
private void OnDestroy()
{
harmony.UnpatchSelf();
}
private void MakeIcons()
{
((MonoBehaviour)this).StartCoroutine(RenderSprites());
}
private static IEnumerator RenderSprites()
{
yield return null;
m_barrelPiece.m_icon = RenderManager.Instance.Render(new RenderRequest(((Component)m_barrelPiece).gameObject)
{
Width = 64,
Height = 64,
Rotation = RenderManager.IsometricRotation * Quaternion.Euler(0f, -180f, 0f),
ParticleSimulationTime = 10f
});
m_barrelTrapPiece.m_icon = RenderManager.Instance.Render(new RenderRequest(((Component)m_barrelTrapPiece).gameObject)
{
Width = 64,
Height = 64,
Rotation = RenderManager.IsometricRotation * Quaternion.Euler(0f, -180f, 0f),
ParticleSimulationTime = 10f
});
}
private void CreateConfigValues()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Expected O, but got Unknown
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected O, but got Unknown
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Expected O, but got Unknown
//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_00ba: Expected O, but got Unknown
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Expected O, but got Unknown
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Expected O, but got Unknown
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Expected O, but got Unknown
//IL_012b: 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_0138: Expected O, but got Unknown
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Expected O, but got Unknown
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Expected O, but got Unknown
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Expected O, but got Unknown
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Expected O, but got Unknown
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Expected O, but got Unknown
((BaseUnityPlugin)this).Config.SaveOnConfigSet = true;
ExplosivesConfig = ((BaseUnityPlugin)this).Config.Bind<string>("1 - General", "Explosives", "Resin,SurtlingCore,SulfurStone,BlackCore,MoltenCore", new ConfigDescription("itemdrops that count as explosives", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} }));
MaxChopDamageConfig = ((BaseUnityPlugin)this).Config.Bind<float>("1 - General", "MaxChopDamage", 250f, new ConfigDescription("max chop damage caused by explosion per stack. damage calculated: (max damage * (stack/maxStackSize))", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} }));
MaxPickaxeDamageConfig = ((BaseUnityPlugin)this).Config.Bind<float>("1 - General", "MaxPickaxeDamage", 250f, new ConfigDescription("max pickaxe damage caused by explosion per stack. damage calculated: (max damage * (stack/maxStackSize))", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} }));
MaxFireDamageConfig = ((BaseUnityPlugin)this).Config.Bind<float>("1 - General", "MaxFireDamage", 250f, new ConfigDescription("max fire damage caused by explosion per stack. damage calculated: (max damage * (stack/maxStackSize))", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} }));
MaxExplosionRangeConfig = ((BaseUnityPlugin)this).Config.Bind<float>("1 - General", "MaxExplosionRange", 4f, new ConfigDescription("maximum range of the explosion calculated: (max range * (stack/maxStackSize))", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} }));
MaxHeatWaveRangeConfig = ((BaseUnityPlugin)this).Config.Bind<float>("1 - General", "MaxHeatWaveRange", 6f, new ConfigDescription("maximum range of the heat wave calculated: (max range * (stack/maxStackSize))", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} }));
TinderBarrelHealthConfig = ((BaseUnityPlugin)this).Config.Bind<float>("1 - General", "TinderBarrelhealth", 20f, new ConfigDescription("health of tinder barrel", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} }));
ParseExplosivesConfig();
SynchronizationManager.OnConfigurationSynchronized += delegate
{
ParseExplosivesConfig();
};
}
public void ParseExplosivesConfig()
{
s_explosives.Clear();
string[] array = ExplosivesConfig.Value.Split(new char[1] { ',' });
foreach (string text in array)
{
s_explosives.Add(text.Trim());
}
}
public static void SetLayerRecursively(GameObject obj, int layer)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)obj == (Object)null)
{
return;
}
obj.layer = layer;
foreach (Transform item in obj.transform)
{
SetLayerRecursively(((Component)item).gameObject, layer);
}
}
private void AddBarrel()
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ef: Expected O, but got Unknown
//IL_020e: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Unknown result type (might be due to invalid IL or missing references)
//IL_021e: Unknown result type (might be due to invalid IL or missing references)
//IL_0225: Unknown result type (might be due to invalid IL or missing references)
//IL_022e: Expected O, but got Unknown
//IL_0230: Unknown result type (might be due to invalid IL or missing references)
//IL_0235: Unknown result type (might be due to invalid IL or missing references)
//IL_0240: Unknown result type (might be due to invalid IL or missing references)
//IL_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_024f: Expected O, but got Unknown
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_0256: Unknown result type (might be due to invalid IL or missing references)
//IL_0261: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Unknown result type (might be due to invalid IL or missing references)
//IL_0270: Expected O, but got Unknown
//IL_0276: Unknown result type (might be due to invalid IL or missing references)
//IL_0280: Expected O, but got Unknown
GameObject val = PrefabManager.Instance.CreateClonedPrefab("bid_piece_flammable_barrel", "piece_chest_barrel");
SetLayerRecursively(val, 0);
MeshRenderer[] componentsInChildren = val.GetComponentsInChildren<MeshRenderer>();
for (int i = 0; i < componentsInChildren.Length; i++)
{
((Renderer)componentsInChildren[i]).sharedMaterial.SetColor("_EmissionColor", FireController.s_burningColor * 0.3f);
}
WearNTear component = val.GetComponent<WearNTear>();
component.m_supports = false;
component.m_noSupportWear = false;
component.m_health = TinderBarrelHealthConfig.Value;
m_barrelPiece = val.GetComponent<Piece>();
m_barrelPiece.m_name = "$piece_barrel_flammable";
m_barrelPiece.m_description = "$piece_barrel_flammable_description";
val.AddComponent<Rigidbody>();
ZSyncTransform obj = val.AddComponent<ZSyncTransform>();
obj.m_syncPosition = true;
obj.m_syncRotation = true;
obj.m_syncBodyVelocity = true;
Floating obj2 = val.AddComponent<Floating>();
obj2.m_waterLevelOffset = 0.65f;
obj2.m_forceDistance = 1f;
obj2.m_force = 0.5f;
obj2.m_balanceForceFraction = 0.02f;
obj2.m_damping = 0.05f;
val.AddComponent<Flammable>();
ImpactEffect obj3 = val.AddComponent<ImpactEffect>();
obj3.m_minVelocity = 1f;
obj3.m_maxVelocity = 5f;
obj3.m_damagePlayers = true;
obj3.m_damageToSelf = true;
obj3.m_damageFish = true;
obj3.m_damages.m_fire = 3f;
obj3.m_damages.m_blunt = 1f;
obj3.m_damages.m_chop = 1f;
obj3.m_damages.m_pickaxe = 0f;
obj3.m_interval = 0.25f;
obj3.m_toolTier = 0;
obj3.m_hitType = (HitType)13;
obj3.m_triggerMask = LayerMask.op_Implicit(LayerMask.GetMask(new string[8] { "Default", "character", "piece", "terrain", "static_solid", "Default_small", "character_net", "vehicle" }));
PieceManager instance = PieceManager.Instance;
PieceConfig val2 = new PieceConfig();
val2.PieceTable = "Hammer";
val2.Category = PieceCategories.Misc;
val2.Requirements = (RequirementConfig[])(object)new RequirementConfig[3]
{
new RequirementConfig
{
Item = "Wood",
Recover = true,
Amount = 10
},
new RequirementConfig
{
Item = "BarrelRings",
Recover = true,
Amount = 1
},
new RequirementConfig
{
Item = "Resin",
Recover = true,
Amount = 1
}
};
instance.AddPiece(new CustomPiece(val, true, val2));
}
private void AddBarrelTrap()
{
//IL_002d: 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_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Expected O, but got Unknown
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: 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)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Expected O, but got Unknown
//IL_00e4: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Expected O, but got Unknown
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: 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_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Expected O, but got Unknown
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Expected O, but got Unknown
GameObject val = PrefabManager.Instance.CreateClonedPrefab("bid_piece_flammable_barreltrap", "bid_piece_flammable_barrel");
MeshRenderer[] componentsInChildren = val.GetComponentsInChildren<MeshRenderer>();
for (int i = 0; i < componentsInChildren.Length; i++)
{
((Renderer)componentsInChildren[i]).sharedMaterial.SetColor("_EmissionColor", FireController.s_burningColor * 0.5f);
}
val.GetComponent<WearNTear>().m_health = 1f;
Object.Destroy((Object)(object)val.GetComponent<ImpactEffect>());
m_barrelTrapPiece = val.GetComponent<Piece>();
m_barrelTrapPiece.m_name = "$piece_barrel_trap";
m_barrelTrapPiece.m_description = "$piece_barrel_trap_description";
val.AddComponent<IgniteAndDestroyOnMove>();
PieceManager instance = PieceManager.Instance;
PieceConfig val2 = new PieceConfig();
val2.PieceTable = "Hammer";
val2.Category = PieceCategories.Misc;
val2.Requirements = (RequirementConfig[])(object)new RequirementConfig[3]
{
new RequirementConfig
{
Item = "Wood",
Recover = true,
Amount = 10
},
new RequirementConfig
{
Item = "BarrelRings",
Recover = true,
Amount = 1
},
new RequirementConfig
{
Item = "Resin",
Recover = true,
Amount = 2
}
};
instance.AddPiece(new CustomPiece(val, true, val2));
}
private void AddClonedItems()
{
AddBarrel();
AddBarrelTrap();
s_explosions[4] = CreateScaledPrefab(1f);
s_explosions[3] = CreateScaledPrefab(0.79f);
s_explosions[2] = CreateScaledPrefab(0.59f);
s_explosions[1] = CreateScaledPrefab(0.39f);
s_explosions[0] = CreateScaledPrefab(0.19f);
s_explosionSpawner = PrefabManager.Instance.CreateClonedPrefab("bid_explosion_spawner", "Spawner_Blob");
Object.Destroy((Object)(object)s_explosionSpawner.GetComponent<CreatureSpawner>());
s_explosionSpawner.AddComponent<Spawner>().m_prefab = s_explosions[4];
PrefabManager.Instance.AddPrefab(s_explosionSpawner);
PrefabManager.OnVanillaPrefabsAvailable -= AddClonedItems;
}
public float GetScaleIndex(float scale)
{
return (int)Mathf.Clamp(scale * 5f, 0f, 4f);
}
public string GetScaledName(float scale)
{
return s_explosionPrefab + "_" + GetScaleIndex(scale);
}
public string GetScaledFxName(float scale)
{
return s_explosionFxPrefab + "_" + GetScaleIndex(scale);
}
public string GetScaledDigName(float scale)
{
return s_explosionDigPrefab + "_" + GetScaleIndex(scale);
}
public GameObject CreateScaledFxPrefab(float scale)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
GameObject val = PrefabManager.Instance.CreateClonedPrefab(GetScaledFxName(scale), "fx_unstablelavarock_explosion");
ParticleSystem[] componentsInChildren = val.GetComponentsInChildren<ParticleSystem>();
foreach (ParticleSystem obj in componentsInChildren)
{
MainModule main = obj.main;
((MainModule)(ref main)).startSizeMultiplier = ((MainModule)(ref main)).startSizeMultiplier * scale;
((MainModule)(ref main)).startSpeedMultiplier = ((MainModule)(ref main)).startSpeedMultiplier * scale;
((MainModule)(ref main)).startLifetimeMultiplier = ((MainModule)(ref main)).startLifetimeMultiplier * scale;
ShapeModule shape = obj.shape;
((ShapeModule)(ref shape)).scale = ((ShapeModule)(ref shape)).scale * scale;
EmissionModule emission = obj.emission;
((EmissionModule)(ref emission)).rateOverTimeMultiplier = ((EmissionModule)(ref emission)).rateOverTimeMultiplier * scale;
((EmissionModule)(ref emission)).rateOverDistanceMultiplier = ((EmissionModule)(ref emission)).rateOverDistanceMultiplier * scale;
SizeOverLifetimeModule sizeOverLifetime = obj.sizeOverLifetime;
if (((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled)
{
((SizeOverLifetimeModule)(ref sizeOverLifetime)).sizeMultiplier = ((SizeOverLifetimeModule)(ref sizeOverLifetime)).sizeMultiplier * scale;
}
VelocityOverLifetimeModule velocityOverLifetime = obj.velocityOverLifetime;
if (((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled)
{
((VelocityOverLifetimeModule)(ref velocityOverLifetime)).xMultiplier = ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).xMultiplier * scale;
((VelocityOverLifetimeModule)(ref velocityOverLifetime)).yMultiplier = ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).yMultiplier * scale;
((VelocityOverLifetimeModule)(ref velocityOverLifetime)).zMultiplier = ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).zMultiplier * scale;
}
}
PrefabManager.Instance.AddPrefab(val);
return val;
}
public GameObject CreateScaledPrefab(float scale)
{
GameObject val = PrefabManager.Instance.CreateClonedPrefab(GetScaledName(scale), "UnstableLavaRock_explosion");
Aoe component = val.GetComponent<Aoe>();
component.m_damage.m_fire = MaxFireDamageConfig.Value;
component.m_damage.m_chop = MaxChopDamageConfig.Value;
component.m_damage.m_pickaxe = MaxPickaxeDamageConfig.Value;
component.m_radius = MaxExplosionRangeConfig.Value;
component.m_damage.m_damage = 0f;
Aoe obj = val.AddComponent<Aoe>();
obj.m_damage.m_fire = 0f;
obj.m_toolTier = FireSpreads.FireToolTier;
obj.m_damage.m_damage = 1f;
obj.m_radius = MaxHeatWaveRangeConfig.Value;
obj.m_hitCharacters = true;
obj.m_hitEnemy = true;
obj.m_hitProps = true;
CamShaker obj2 = val.AddComponent<CamShaker>();
obj2.m_strength = 1f;
obj2.m_range = 50f;
obj2.m_continous = true;
obj2.m_delay = 0f;
obj2.m_continousDuration = 0.8f;
component.m_initiateEffect.m_effectPrefabs[0].m_prefab = CreateScaledFxPrefab(scale);
component.m_spawnOnHitTerrain = CreateScaledDigPrefab(scale);
PrefabManager.Instance.AddPrefab(val);
return val;
}
public GameObject CreateScaledDigPrefab(float scale)
{
GameObject val = PrefabManager.Instance.CreateClonedPrefab(GetScaledDigName(scale), "digg_UnstableLavaRock");
TerrainOp component = val.GetComponent<TerrainOp>();
Settings settings = component.m_settings;
settings.m_levelRadius *= scale;
Settings settings2 = component.m_settings;
settings2.m_raiseRadius *= scale;
Settings settings3 = component.m_settings;
settings3.m_raisePower *= scale;
Settings settings4 = component.m_settings;
settings4.m_raiseDelta *= scale;
Settings settings5 = component.m_settings;
settings5.m_smoothRadius *= scale;
Settings settings6 = component.m_settings;
settings6.m_smoothPower *= scale;
Settings settings7 = component.m_settings;
settings7.m_paintRadius *= scale;
component.m_chanceToSpawn *= scale;
PrefabManager.Instance.AddPrefab(val);
return val;
}
}
}
namespace Explosives.Patches
{
[HarmonyPatch(typeof(Container), "OnDestroyed", new Type[] { })]
internal class Container_OnDestroyed_patch
{
private static void Prefix(ref Container __instance)
{
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: 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)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: 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)
if (!FireController.Instance.IsBurning(__instance.m_nview))
{
return;
}
bool flag = true;
List<ItemData> list = new List<ItemData>();
foreach (ItemData item in __instance.m_inventory.m_inventory)
{
if (!Explosives.s_explosives.Any((string name) => ((Object)item.m_dropPrefab).name == name))
{
continue;
}
list.Add(item);
Vector3 val = ((Component)__instance).transform.position;
FireState fireState = FireController.Instance.GetFireState(((Component)__instance).gameObject);
if (fireState != null)
{
if (FireController.s_hasRigidBody.TryGetValue(Utils.GetPrefabName(((Component)__instance).gameObject), out var value) && value)
{
fireState.SetupBoundsConnected();
}
val = GetRandomPosition(fireState.m_bounds, fireState.m_bounds_rotation);
}
Spawner component = Object.Instantiate<GameObject>(Explosives.s_explosionSpawner, val, Quaternion.identity).GetComponent<Spawner>();
component.m_damageMulitplier = (float)item.m_stack / (float)item.m_shared.m_maxStackSize;
component.m_prefab = Explosives.s_explosions[(int)Math.Floor(Mathf.Clamp(component.m_damageMulitplier * 5f, 0f, 4f))];
if (flag)
{
component.m_time = 0f;
flag = false;
}
}
foreach (ItemData item2 in list)
{
__instance.m_inventory.RemoveItem(item2);
}
}
public static Vector3 GetRandomPosition(Bounds bounds, Quaternion rotation)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: 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_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
float num = Random.Range(((Bounds)(ref bounds)).min.x, ((Bounds)(ref bounds)).max.x);
float num2 = Random.Range(((Bounds)(ref bounds)).min.y, ((Bounds)(ref bounds)).max.y);
float num3 = Random.Range(((Bounds)(ref bounds)).min.z, ((Bounds)(ref bounds)).max.z);
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(num, num2, num3);
return rotation * (val - ((Bounds)(ref bounds)).center) + ((Bounds)(ref bounds)).center;
}
}
}
namespace Explosives.Mono
{
public class IgniteAndDestroyOnMove : MonoBehaviour
{
public float m_movementThreshold = 0.1f;
public float m_rotationThreshold = 5f;
private Rigidbody m_rb;
private ZNetView m_nview;
private IDestructible m_destructible;
private float m_time;
public void Awake()
{
m_rb = ((Component)this).GetComponent<Rigidbody>();
m_nview = ((Component)this).GetComponent<ZNetView>();
m_destructible = ((Component)this).GetComponent<IDestructible>();
m_time = Time.realtimeSinceStartup;
}
private void Update()
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
if (!((Object)(object)m_nview == (Object)null) && m_nview.IsOwner() && !(Time.realtimeSinceStartup - m_time < 1f) && IsMovingSlightly())
{
HitData val = new HitData();
val.m_damage.m_fire = 1f;
val.m_toolTier = (short)FireSpreads.FireToolTier;
m_destructible.Damage(val);
}
}
private bool IsMovingSlightly()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: 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)
if ((Object)(object)m_rb == (Object)null)
{
return false;
}
Vector3 val = m_rb.velocity;
if (!(((Vector3)(ref val)).magnitude > m_movementThreshold))
{
val = m_rb.angularVelocity;
return ((Vector3)(ref val)).magnitude > m_rotationThreshold;
}
return true;
}
}
public class Spawner : MonoBehaviour
{
public GameObject m_prefab;
public ZNetView m_nview;
public float m_damageMulitplier = 1f;
public float m_time = 0.5f;
public void Awake()
{
m_nview = ((Component)this).GetComponent<ZNetView>();
((MonoBehaviour)this).InvokeRepeating("UpdateSpawner", Random.Range(0f, m_time), 1f);
}
public void UpdateSpawner()
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)m_nview == (Object)null || !m_nview.IsOwner() || (Object)(object)m_prefab == (Object)null)
{
return;
}
int num = 0;
GameObject val = Object.Instantiate<GameObject>(m_prefab, ((Component)this).transform.position, Quaternion.identity);
Aoe[] components = val.GetComponents<Aoe>();
foreach (Aoe val2 in components)
{
num++;
val2.m_damage.m_pickaxe = Explosives.MaxPickaxeDamageConfig.Value * m_damageMulitplier;
val2.m_damage.m_chop = Explosives.MaxChopDamageConfig.Value * m_damageMulitplier;
if (num == 1)
{
val2.m_radius = Explosives.MaxExplosionRangeConfig.Value * m_damageMulitplier;
val2.m_damage.m_fire = Explosives.MaxFireDamageConfig.Value * m_damageMulitplier;
}
else
{
val2.m_radius = Mathf.Max(Explosives.MaxHeatWaveRangeConfig.Value * m_damageMulitplier, 1f);
val2.m_damage.m_fire = 0f;
val2.m_damage.m_chop = 0f;
val2.m_damage.m_pickaxe = 0f;
}
val.GetComponent<CamShaker>().m_range = 150f * m_damageMulitplier;
}
val.transform.localScale = new Vector3(m_damageMulitplier, m_damageMulitplier, m_damageMulitplier);
ZNetScene.instance.Destroy(((Component)this).gameObject);
}
}
}
namespace FireSpreads
{
public class Flammable : MonoBehaviour
{
public float m_fireresists = 1f;
public void Awake()
{
ZNetView component = ((Component)this).GetComponent<ZNetView>();
if (!((Object)(object)component == (Object)null) && component.IsValid() && component.IsOwner())
{
FireController.Instance.SetFireResist(component, m_fireresists, true);
Object.Destroy((Object)(object)this);
}
}
}
}