Decompiled source of FireSpreads v2.0.5
plugins\FireSpreads.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("FireSpreads")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("FireSpreads")] [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 FireSpreads { public static class CodeMatcherExtensions { public static CodeMatcher GetPosition(this CodeMatcher codeMatcher, out int position) { position = codeMatcher.Pos; return codeMatcher; } public static CodeMatcher AddLabel(this CodeMatcher codeMatcher, out Label label) { label = default(Label); codeMatcher.AddLabels((IEnumerable<Label>)new Label[1] { label }); return codeMatcher; } public static CodeMatcher GetOperand(this CodeMatcher codeMatcher, out object operand) { operand = codeMatcher.Operand; return codeMatcher; } public static bool IsCall(this CodeInstruction i, string declaringType, string name) { if ((i.opcode == OpCodes.Callvirt || i.opcode == OpCodes.Call) && i.operand is MethodInfo methodInfo && methodInfo.DeclaringType?.Name == declaringType) { return methodInfo.Name == name; } return false; } public static bool CallReturns(this CodeInstruction i, Type returnType) { if ((i.opcode == OpCodes.Callvirt || i.opcode == OpCodes.Call) && i.operand is MethodInfo methodInfo) { return methodInfo.ReturnType == returnType; } return false; } public static CodeMatcher SaveInstruction(this CodeMatcher matcher, int offset, out CodeInstruction instruction) { instruction = matcher.InstructionAt(offset); return matcher; } public static CodeMatcher SaveInstructions(this CodeMatcher matcher, int offset, out List<CodeInstruction> instructions) { instructions = matcher.InstructionsInRange(0, offset - 1); return matcher; } } public class ScalerDestructible : Scaler { public ScalerDestructible(GameObject go, PrefabBounds bounds) : base(go, bounds) { } public override void ApplyScale(Transform transform, Vector3 scale) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_0071: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_00c3: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0203: 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_0160: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) Vector3 one = Vector3.one; Vector3 localPosition = transform.localPosition; ParticleSystem component = ((Component)transform).GetComponent<ParticleSystem>(); if ((Object)(object)component != (Object)null) { MainModule main = component.main; one.x *= scale.x; one.z *= scale.y; one.y *= scale.z; MinMaxCurve val = ((MainModule)(ref main)).startSizeX; ((MainModule)(ref main)).startSizeX = MinMaxCurve.op_Implicit(2f * (((MinMaxCurve)(ref val)).constant / scale.x)); val = ((MainModule)(ref main)).startSizeY; ((MainModule)(ref main)).startSizeY = MinMaxCurve.op_Implicit(2f * (((MinMaxCurve)(ref val)).constant / scale.z)); val = ((MainModule)(ref main)).startSizeZ; ((MainModule)(ref main)).startSizeZ = MinMaxCurve.op_Implicit(2f * (((MinMaxCurve)(ref val)).constant / scale.y)); EmissionModule emission = component.emission; if (((Object)transform).name.Equals("flames (1)")) { ((MainModule)(ref main)).simulationSpeed = ((MainModule)(ref main)).simulationSpeed * 0.1f; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(50f); } if (((Object)transform).name.Equals("sparcs (1)")) { ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).simulationSpeed = ((MainModule)(ref main)).simulationSpeed * 1.5f; } if (Utils.GetPrefabName(m_go).EndsWith("Stub")) { ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(10f); if (((Object)transform).name.Equals("sparcs (1)")) { val = ((EmissionModule)(ref emission)).rateOverTime; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(((MinMaxCurve)(ref val)).constant / 2f); } } if (Utils.GetPrefabName(m_go).Equals("stubbe")) { ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(70f); } } else { one.x *= scale.x; one.y *= scale.y; one.z *= scale.z; } transform.localScale = one; transform.localPosition = localPosition; } } public class ScalerTreeLogHalf : Scaler { public ScalerTreeLogHalf(GameObject go, PrefabBounds bounds) : base(go, bounds) { } public override void ApplyScale(Transform transform, Vector3 scale) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_0025: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_0062: 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_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_0167: 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) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) Vector3 one = Vector3.one; Vector3 localPosition = transform.localPosition; ParticleSystem component = ((Component)transform).GetComponent<ParticleSystem>(); Quaternion rotation = m_go.transform.rotation; float x = ((Quaternion)(ref rotation)).eulerAngles.x; rotation = m_go.transform.rotation; float y = ((Quaternion)(ref rotation)).eulerAngles.y; rotation = m_go.transform.rotation; transform.localRotation = Quaternion.Euler(x, y, ((Quaternion)(ref rotation)).eulerAngles.z + 90f); if ((Object)(object)component != (Object)null) { ShapeModule shape = component.shape; MainModule main = component.main; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)8; float num = Mathf.Max(new float[3] { scale.x, scale.y, scale.z }); float num2 = Mathf.Min(new float[3] { scale.x, scale.y, scale.z }); one.x *= num; one.y *= num2; one.z *= num2; localPosition.z = (0f - num2) / 2f; MinMaxCurve val; if (((Object)transform).name.Equals("flames (1)")) { ((MainModule)(ref main)).simulationSpeed = ((MainModule)(ref main)).simulationSpeed * 0.5f; EmissionModule emission = component.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(100f); val = ((MainModule)(ref main)).startSizeX; ((MainModule)(ref main)).startSizeX = MinMaxCurve.op_Implicit(((MinMaxCurve)(ref val)).constant / num * 2f); val = ((MainModule)(ref main)).startSizeY; ((MainModule)(ref main)).startSizeY = MinMaxCurve.op_Implicit(((MinMaxCurve)(ref val)).constant / num2 * 2f); val = ((MainModule)(ref main)).startSizeZ; ((MainModule)(ref main)).startSizeZ = MinMaxCurve.op_Implicit(((MinMaxCurve)(ref val)).constant / num2 * 2f); if (((Object)m_go).name.StartsWith("beech") || ((Object)m_go).name.StartsWith("yggashoot")) { ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).startSizeX = MinMaxCurve.op_Implicit(1f); ((MainModule)(ref main)).startSizeY = MinMaxCurve.op_Implicit(2f); ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(200f); } } if (((Object)transform).name.Equals("sparcs (1)")) { ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).simulationSpeed = ((MainModule)(ref main)).simulationSpeed * 2f; EmissionModule emission2 = component.emission; val = ((EmissionModule)(ref emission2)).rateOverTime; ((EmissionModule)(ref emission2)).rateOverTime = MinMaxCurve.op_Implicit(((MinMaxCurve)(ref val)).constant * 0.5f); } } transform.localScale = one; transform.localPosition = localPosition; } } public class ScalerWNT : Scaler { public ScalerWNT(GameObject go, PrefabBounds bounds) : base(go, bounds) { } public override Vector3 GetRefScale() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0046: 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_0078: 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) Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(((Bounds)(ref m_bounds.m_bounds)).size.x, ((Bounds)(ref m_bounds.m_bounds)).size.y, ((Bounds)(ref m_bounds.m_bounds)).size.z); if (val.x < 1f) { val.x = 1f; } if (val.y < 1f) { val.y = 1f; } if (val.z < 1f) { val.z = 1f; } val.x *= 1.2f; val.y *= 1.2f; val.z *= 1.2f; return val; } public override void ApplyScale(Transform transform, Vector3 scale) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_018d: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_0159: Unknown result type (might be due to invalid IL or missing references) Vector3 localScale = transform.localScale; ParticleSystem component = ((Component)transform).GetComponent<ParticleSystem>(); if ((Object)(object)component != (Object)null) { ShapeModule shape = component.shape; if (scale.y > 6f) { MainModule main = component.main; ((MainModule)(ref main)).simulationSpeed = ((MainModule)(ref main)).simulationSpeed * (localScale.y / scale.y); localScale.x *= scale.x; localScale.z *= scale.z; localScale.y *= scale.y; } else if ((double)scale.x >= 1.5 || (double)scale.z >= 1.5) { if ((Object)(object)component != (Object)null) { Vector3 scale2 = ((ShapeModule)(ref shape)).scale; scale2.x *= scale.x; scale2.y *= scale.z; ((ShapeModule)(ref shape)).scale = scale2; } } else if (scale.y >= 2f && (Object)(object)component != (Object)null) { MainModule main2 = component.main; MinMaxCurve startLifetime = ((MainModule)(ref main2)).startLifetime; ((MinMaxCurve)(ref startLifetime)).constantMax = ((MinMaxCurve)(ref startLifetime)).constantMax * scale.y; ((MainModule)(ref main2)).startLifetime = startLifetime; Vector3 scale3 = ((ShapeModule)(ref shape)).scale; scale3.z *= scale.y; ((ShapeModule)(ref shape)).scale = scale3; } } else { localScale.x *= scale.x; localScale.z *= scale.z; localScale.y *= scale.y; } transform.localScale = localScale; } } public class ScalerTreeLog : Scaler { public ScalerTreeLog(GameObject go, PrefabBounds bounds) : base(go, bounds) { } public override void ScalePrefab() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) base.ScalePrefab(); Vector3 one = Vector3.one; ((Component)m_fire).transform.localScale = one; } public override void ApplyScale(Transform transform, Vector3 scale) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) Vector3 one = Vector3.one; Vector3 localPosition = transform.localPosition; ParticleSystem component = ((Component)transform).GetComponent<ParticleSystem>(); if ((Object)(object)component != (Object)null) { ShapeModule shape = component.shape; MainModule main = component.main; RotationOverLifetimeModule rotationOverLifetime = component.rotationOverLifetime; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)8; float num = Mathf.Max(new float[3] { scale.x, scale.y, scale.z }); float num2 = Mathf.Min(new float[3] { scale.x, scale.y, scale.z }); one.x *= num2; one.y *= num2; one.z *= 2f * num / 3f; localPosition.y = (0f - num) / 2f; EmissionModule emission = component.emission; ((MainModule)(ref main)).simulationSpeed = ((MainModule)(ref main)).simulationSpeed * 0.1f; if (((Object)transform).name.Equals("sparcs (1)")) { ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).simulationSpeed = ((MainModule)(ref main)).simulationSpeed * 20f; } if (((Object)transform).name.Equals("flames (1)")) { ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(100f); if (((Object)m_go).name.StartsWith("beech") || ((Object)m_go).name.StartsWith("yggashoot")) { ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(200f); ((RotationOverLifetimeModule)(ref rotationOverLifetime)).enabled = true; ((RotationOverLifetimeModule)(ref rotationOverLifetime)).x = MinMaxCurve.op_Implicit(10f); ((RotationOverLifetimeModule)(ref rotationOverLifetime)).y = MinMaxCurve.op_Implicit(10f); ((RotationOverLifetimeModule)(ref rotationOverLifetime)).z = MinMaxCurve.op_Implicit(10f); ((MainModule)(ref main)).startSizeX = MinMaxCurve.op_Implicit(0.7f); } MinMaxCurve startSizeX = ((MainModule)(ref main)).startSizeX; ((MainModule)(ref main)).startSizeX = MinMaxCurve.op_Implicit(Mathf.Clamp(((MinMaxCurve)(ref startSizeX)).constant, 0.1f, 1.5f)); } } transform.localScale = one; transform.localPosition = localPosition; } } public class ScalerTreeBase : Scaler { public ScalerTreeBase(GameObject go, PrefabBounds bounds) : base(go, bounds) { } public override void ScalePrefab() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_0082: Unknown result type (might be due to invalid IL or missing references) base.ScalePrefab(); Vector3 localPosition = ((Component)m_smoke).transform.localPosition; localPosition.y += ((Bounds)(ref m_bounds.m_bounds)).size.y * 1.5f; ((Component)m_smoke).transform.localPosition = localPosition; m_burn.localScale = Vector3.Scale(m_burn.localScale, new Vector3(FireSpreads.TreeBurnRadiusFactorConfig.Value, FireSpreads.TreeBurnRadiusFactorConfig.Value, FireSpreads.TreeBurnRadiusFactorConfig.Value)); } public override void ApplyScale(Transform transform, Vector3 scale) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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) Vector3 one = Vector3.one; Vector3 localPosition = transform.localPosition; ParticleSystem component = ((Component)transform).GetComponent<ParticleSystem>(); if ((Object)(object)component != (Object)null) { MainModule main = component.main; one.x *= scale.x; one.z *= scale.y; one.y *= scale.z; EmissionModule emission = component.emission; if (((Object)transform).name.Equals("flames (1)") && one.z >= 15f) { ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(50f); } if (((Object)transform).name.Equals("flames (1)")) { ((MainModule)(ref main)).simulationSpeed = ((MainModule)(ref main)).simulationSpeed * 0.03f; } } else { one.x *= scale.x; one.z *= scale.z; one.y *= scale.y; } transform.localScale = one; transform.localPosition = localPosition; } } public abstract class Scaler { protected GameObject m_go; protected Transform m_fire; protected PrefabBounds m_bounds; protected Transform m_particles; protected Transform m_flames; protected Transform m_sparcs; protected Transform m_smokeSpawner; protected Transform m_warmth; protected Transform m_burn; protected Transform m_smoke; public Scaler(GameObject go, PrefabBounds prefabBounds) { m_go = go; m_fire = go.transform.Find("bid_fire"); m_bounds = prefabBounds; m_particles = ((Component)m_fire).transform.Find("Particles"); m_flames = ((Component)m_particles).transform.Find("flames (1)"); m_sparcs = ((Component)m_particles).transform.Find("sparcs (1)"); m_smokeSpawner = ((Component)m_fire).transform.Find("SmokeSpawner"); m_warmth = ((Component)m_fire).transform.Find("FireWarmth"); m_burn = ((Component)m_fire).transform.Find("FireBurn"); m_smoke = ((Component)m_particles).transform.Find("smoke (1)"); } public abstract void ApplyScale(Transform transform, Vector3 scale); public virtual void ApplyScaleRuntime(Transform transform, Vector3 scale) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_001f: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_006b: 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) //IL_0086: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) ParticleSystem component = ((Component)transform).GetComponent<ParticleSystem>(); Vector3 one = Vector3.one; if ((Object)(object)component != (Object)null) { MainModule main = component.main; one.x *= scale.x; one.y *= scale.y; one.z *= scale.z; MinMaxCurve val = ((MainModule)(ref main)).startSizeX; ((MainModule)(ref main)).startSizeX = MinMaxCurve.op_Implicit(((MinMaxCurve)(ref val)).constant / scale.x); val = ((MainModule)(ref main)).startSizeY; ((MainModule)(ref main)).startSizeY = MinMaxCurve.op_Implicit(((MinMaxCurve)(ref val)).constant / scale.y); val = ((MainModule)(ref main)).startSizeZ; ((MainModule)(ref main)).startSizeZ = MinMaxCurve.op_Implicit(((MinMaxCurve)(ref val)).constant / scale.z); } } public virtual Vector3 GetRefScale() { //IL_000b: 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_0035: 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) return new Vector3(((Bounds)(ref m_bounds.m_bounds)).size.x, ((Bounds)(ref m_bounds.m_bounds)).size.y, ((Bounds)(ref m_bounds.m_bounds)).size.z); } public static Texture2D ScaleTexture(Texture texture, int width, int height) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown RenderTexture val = (RenderTexture.active = RenderTexture.GetTemporary(texture.width, texture.height)); Graphics.Blit(texture, val); Texture2D val2 = new Texture2D(texture.width, texture.height); val2.ReadPixels(new Rect(0f, 0f, (float)texture.width, (float)texture.height), 0, 0); val2.Apply(); Texture2D result = ScaleTextureInt(val2, width, height); RenderTexture.ReleaseTemporary(val); return result; } private static Texture2D ScaleTextureInt(Texture2D source, int targetWidth, int targetHeight) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(targetWidth, targetHeight, source.format, true); Color[] pixels = val.GetPixels(0); float num = 1f / (float)targetWidth; float num2 = 1f / (float)targetHeight; for (int i = 0; i < pixels.Length; i++) { pixels[i] = source.GetPixelBilinear(num * ((float)i % (float)targetWidth), num2 * Mathf.Floor((float)(i / targetWidth))); } val.SetPixels(pixels, 0); val.Apply(); return val; } public static Scaler GetScaler(GameObject go, PrefabBounds bounds) { if ((Object)(object)go.GetComponent<TreeLog>() != (Object)null) { if ((Object)(object)go.GetComponent<TreeLog>().m_subLogPrefab != (Object)null) { return new ScalerTreeLog(go, bounds); } return new ScalerTreeLogHalf(go, bounds); } if ((Object)(object)go.GetComponent<TreeBase>() != (Object)null) { return new ScalerTreeBase(go, bounds); } if ((Object)(object)go.GetComponent<WearNTear>() != (Object)null) { return new ScalerWNT(go, bounds); } if (((Object)go).name.ToUpper().Contains("LOG")) { return new ScalerTreeLog(go, bounds); } return new ScalerDestructible(go, bounds); } public virtual void ScalePrefab() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) Vector3 refScale = GetRefScale(); m_bounds.m_firescale = refScale; float num = Mathf.Min(refScale.x, Mathf.Min(refScale.x, refScale.z)); Vector3 scale = default(Vector3); ((Vector3)(ref scale))..ctor(num, num, num); ApplyScale(m_flames, refScale); m_bounds.m_firescale = ((Component)m_flames).transform.localScale; ApplyScale(m_smokeSpawner, refScale); ((Component)m_burn).GetComponent<Aoe>().m_damageSelf = 0f; ApplyScale(m_burn, scale); ApplyScale(m_smoke, refScale); ApplyScale(m_sparcs, refScale); ParticleSystem[] componentsInChildren = ((Component)m_sparcs).GetComponentsInChildren<ParticleSystem>(); for (int i = 0; i < componentsInChildren.Length; i++) { ParticleSystemRenderer component = ((Component)componentsInChildren[i]).GetComponent<ParticleSystemRenderer>(); ((Renderer)component).material.SetColor("_EmissionColor", FireController.s_burningColor); ((Renderer)component).material.SetColor("_Color", FireController.s_burningColor); ((Renderer)component).material.SetColor("_MainTex", FireController.s_burningColor); } } } public class Debug { public static void DrawWireframeCube(GameObject go, Bounds cubeBounds, Quaternion rotation, string name) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0078: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_0099: 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_00a5: 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_00b4: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0113: 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_0122: 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_012e: 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_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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_0151: 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_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: 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_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: 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_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("DebugLineRenderer" + name); val.transform.parent = go.transform; Color blue = Color.blue; LineRenderer val2 = val.AddComponent<LineRenderer>(); ((Renderer)val2).material = new Material(Shader.Find("Sprites/Default")); Color startColor = (val2.endColor = blue); val2.startColor = startColor; float startWidth = (val2.endWidth = 0.05f); val2.startWidth = startWidth; Vector3[] array = (Vector3[])(object)new Vector3[8]; Vector3 center = ((Bounds)(ref cubeBounds)).center; Vector3 extents = ((Bounds)(ref cubeBounds)).extents; array[0] = new Vector3(extents.x, extents.y, extents.z); array[1] = new Vector3(0f - extents.x, extents.y, extents.z); array[2] = new Vector3(0f - extents.x, 0f - extents.y, extents.z); array[3] = new Vector3(extents.x, 0f - extents.y, extents.z); array[4] = new Vector3(extents.x, extents.y, 0f - extents.z); array[5] = new Vector3(0f - extents.x, extents.y, 0f - extents.z); array[6] = new Vector3(0f - extents.x, 0f - extents.y, 0f - extents.z); array[7] = new Vector3(extents.x, 0f - extents.y, 0f - extents.z); for (int i = 0; i < array.Length; i++) { array[i] = rotation * array[i] + center; } val2.positionCount = array.Length; val2.SetPositions(array); val2.loop = true; } public static void SaveSpriteAsImage(Sprite sprite, string filePath) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown Texture2D texture = sprite.texture; Texture2D val = new Texture2D(((Texture)texture).width, ((Texture)texture).height); val.SetPixels(texture.GetPixels()); val.Apply(); byte[] bytes = ImageConversion.EncodeToPNG(val); File.WriteAllBytes(filePath, bytes); } } public class FireController : MonoBehaviour { public class FireStateDestructible : FireState { public Destructible m_destructible { get; private set; } public override bool InitComponent(MonoBehaviour component) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown if (!IsBurnable(((Component)component).gameObject)) { return false; } m_gameObject = ((Component)component).gameObject; m_destructible = (Destructible)component; base.m_nview = m_destructible.m_nview; if (!Init(((Component)m_destructible).gameObject)) { return false; } return true; } public override void ApplyDamage(float damage) { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown if (!((Object)(object)base.m_nview == (Object)null) && base.m_nview.IsValid()) { float @float = base.m_nview.GetZDO().GetFloat(ZDOVars.s_health, m_destructible.m_health); damage = Instance.ApplyEnvironmentModifier(damage); if ((@float - damage) / m_destructible.m_health <= FireSpreads.StopBurningConfig.Value) { float num = m_destructible.m_health * FireSpreads.StopBurningConfig.Value; damage = @float - num; } HitData val = new HitData(); val.m_damage.m_chop = damage; val.m_toolTier = 10; m_destructible.Damage(val); } } public override void SetFire(float damage) { Instance.SetFire(base.m_nview, damage); if (Instance.IsBurning(base.m_nview) && Instance.GetFireState(m_gameObject) == null) { Instance.AddFireStateTo((MonoBehaviour)(object)m_destructible); } } public override float GetHealthPercentage() { if ((Object)(object)base.m_nview == (Object)null || !base.m_nview.IsValid() || base.m_nview.GetZDO() == null) { return 1f; } return base.m_nview.GetZDO().GetFloat(ZDOVars.s_health, m_destructible.m_health) / m_destructible.m_health; } protected override void SetQuality() { m_quality = Mathf.Clamp(m_quality, 0, 5); ((Component)m_PointLight).gameObject.SetActive(m_quality < 1); ((Component)m_SmokeSpawner).gameObject.SetActive(m_quality < 2); ((Component)m_SFX).gameObject.SetActive(m_quality < 2); ((Component)m_Smoke).gameObject.SetActive(m_quality < 3); ((Component)m_Sparks).gameObject.SetActive(m_quality < 4); ((Component)m_Flare).gameObject.SetActive(false); } } public class FireStateTreeLog : FireState { public TreeLog m_treeLog { get; private set; } public override bool InitComponent(MonoBehaviour component) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown if (!IsBurnable(((Component)component).gameObject)) { return false; } m_gameObject = ((Component)component).gameObject; m_treeLog = (TreeLog)component; base.m_nview = m_treeLog.m_nview; if (!Init(((Component)m_treeLog).gameObject)) { return false; } m_burnStartHealth = 999999f; return true; } protected override void SetQuality() { m_quality = Mathf.Clamp(m_quality, 0, 5); ((Component)m_PointLight).gameObject.SetActive(m_quality < 1); ((Component)m_SmokeSpawner).gameObject.SetActive(m_quality < 2); ((Component)m_SFX).gameObject.SetActive(m_quality < 2); ((Component)m_Smoke).gameObject.SetActive(false); ((Component)m_Sparks).gameObject.SetActive(m_quality < 4); ((Component)m_Flare).gameObject.SetActive(false); } public override void ApplyDamage(float damage) { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown if (!((Object)(object)base.m_nview == (Object)null) && base.m_nview.IsValid()) { float @float = base.m_nview.GetZDO().GetFloat(ZDOVars.s_health, m_treeLog.m_health); damage = Instance.ApplyEnvironmentModifier(damage); if ((@float - damage) / m_treeLog.m_health <= FireSpreads.StopBurningConfig.Value) { float num = m_treeLog.m_health * FireSpreads.StopBurningConfig.Value; damage = @float - num; } HitData val = new HitData(); val.m_damage.m_chop = damage; val.m_toolTier = 10; m_treeLog.Damage(val); } } public override void SetFire(float damage) { Instance.SetFire<TreeLog>(m_treeLog, m_treeLog.m_nview, damage, eternalFlame: false); if (Instance.IsBurning(base.m_nview) && Instance.GetFireState(m_gameObject) == null) { Instance.AddFireStateTo((MonoBehaviour)(object)m_treeLog); } } public override float GetHealthPercentage() { if ((Object)(object)base.m_nview == (Object)null || base.m_nview.GetZDO() == null) { return 1f; } return base.m_nview.GetZDO().GetFloat(ZDOVars.s_health, m_treeLog.m_health) / m_treeLog.m_health; } } public class FireStateTreeBase : FireState { public TreeBase m_treeBase { get; private set; } public override bool InitComponent(MonoBehaviour component) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown if (!IsBurnable(((Component)component).gameObject)) { return false; } m_gameObject = ((Component)component).gameObject; m_treeBase = (TreeBase)component; base.m_nview = m_treeBase.m_nview; if (!Init(((Component)m_treeBase).gameObject)) { return false; } return true; } public override void ApplyDamage(float damage) { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown if (!((Object)(object)base.m_nview == (Object)null) && base.m_nview.IsValid()) { float @float = base.m_nview.GetZDO().GetFloat(ZDOVars.s_health, m_treeBase.m_health); damage = Instance.ApplyEnvironmentModifier(damage); if ((@float - damage) / m_treeBase.m_health <= FireSpreads.StopBurningConfig.Value) { float num = m_treeBase.m_health * FireSpreads.StopBurningConfig.Value; damage = @float - num; } HitData val = new HitData(); val.m_damage.m_chop = damage; val.m_toolTier = 10; m_treeBase.Damage(val); } } public override void SetFire(float damage) { Instance.SetFire(base.m_nview, damage); if (Instance.IsBurning(base.m_nview) && Instance.GetFireState(m_gameObject) == null) { Instance.AddFireStateTo((MonoBehaviour)(object)m_treeBase); } } public override float GetHealthPercentage() { if ((Object)(object)base.m_nview == (Object)null || base.m_nview.GetZDO() == null) { return 1f; } return base.m_nview.GetZDO().GetFloat(ZDOVars.s_health, m_treeBase.m_health) / m_treeBase.m_health; } public override void SetupBoundsForBurning() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) PrefabBounds pi = m_allBounds[Utils.GetPrefabName(m_gameObject)]; m_bounds = CalculateBurningBounds(pi); DrawDebugWireframe("Burning", pi); } } public class FireStateWNT : FireState { public WearNTear m_wnt { get; private set; } public override bool InitComponent(MonoBehaviour component) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown if (!IsBurnable(((Component)component).gameObject)) { return false; } m_gameObject = ((Component)component).gameObject; m_wnt = (WearNTear)component; base.m_nview = m_wnt.m_nview; return Init(((Component)m_wnt).gameObject); } public override float GetHealthPercentage() { return m_wnt.GetHealthPercentage(); } public override void ApplyDamage(float damage) { if (!base.m_nview.IsValid()) { return; } float @float = base.m_nview.GetZDO().GetFloat(ZDOVars.s_health, m_wnt.m_health); damage = Instance.ApplyEnvironmentModifier(damage); float num = @float - damage; if (num <= 0f) { m_wnt.Destroy(); return; } if (num / m_wnt.m_health <= FireSpreads.StopBurningConfig.Value) { float num2 = m_wnt.m_health * FireSpreads.StopBurningConfig.Value; damage = @float - num2; } m_wnt.ApplyDamage(damage); } public override void SetFire(float damage) { Instance.SetFire<WearNTear>(m_wnt, m_wnt.m_nview, damage, eternalFlame: false); if (Instance.IsBurning(base.m_nview) && Instance.GetFireState(m_gameObject) == null) { Instance.AddFireStateTo((MonoBehaviour)(object)m_wnt); } } public override bool CheckExtinguish() { if (GetHealthPercentage() <= FireSpreads.StopBurningConfig.Value) { ExtinguishFire(); return true; } if (IsBurning() && Instance.m_WeatherState.m_IsRaining) { if (m_wnt.HaveRoof() && Random.value >= 1f - FireSpreads.RainExtinguishesCoveredProbabilityConfig.Value) { ExtinguishFire(); return true; } if (Random.value >= 1f - FireSpreads.RainExtinguishesProbabilityConfig.Value) { ExtinguishFire(); return true; } } return false; } } public abstract class FireState { public class ConnectedInfo { public FireState m_fs; public Vector3 m_direction; } public GameObject m_gameObject; public int m_list_index; public float m_burnStartHealth = 1f; public Bounds m_bounds; public Quaternion m_bounds_rotation; public Transform m_PointLight; public Transform m_SmokeSpawner; public Transform m_Smoke; public Transform m_Sparks; public Transform m_Flare; public Transform m_SFX; public Transform m_flames1; public Transform m_burn; public Transform m_warmth; protected Collider[] t_collider = (Collider[])(object)new Collider[128]; public Dictionary<GameObject, ConnectedInfo> m_connected = new Dictionary<GameObject, ConnectedInfo>(); public List<Renderer> m_renderers = new List<Renderer>(); private MaterialPropertyBlock m_matBlock = new MaterialPropertyBlock(); protected int m_quality = 5; public ZNetView m_nview { get; protected set; } public Transform m_fireTransform { get; private set; } public float m_lastTime { get; set; } public abstract bool InitComponent(MonoBehaviour component); public void SetupBoundsConnected() { SetupBounds(); SetupConnected(); } public void SetFire() { if (m_burnStartHealth <= 1f) { m_burnStartHealth = GetHealthPercentage(); } UpdateVisuals(); } public virtual float GetHealthPercentage() { return 1f; } public void UpdateMaterialBlock() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp01(GetHealthPercentage()); float num2 = (m_burnStartHealth + FireSpreads.StopBurningConfig.Value) / 2f; if (IsBurning()) { float num3 = ((num <= num2) ? 1f : (1f - Mathf.InverseLerp(num2, m_burnStartHealth, num))); m_matBlock.SetColor("_EmissionColor", s_burningColor * num3); AddMaterialBlock(); } } public void AddMaterialBlock() { if (m_renderers == null) { return; } foreach (Renderer renderer in m_renderers) { renderer.material.EnableKeyword("_EMISSION"); renderer.SetPropertyBlock(m_matBlock); } } public void RemoveMaterialBlock() { foreach (Renderer renderer in m_renderers) { if ((Object)(object)renderer != (Object)null && renderer.HasPropertyBlock()) { renderer.SetPropertyBlock((MaterialPropertyBlock)null); } } } public void DrawDebugWireframe(string label, PrefabBounds pi) { //IL_0013: 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_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) if (FireSpreads.VisualDebugConfig.Value) { Debug.DrawWireframeCube(m_gameObject, m_bounds, m_gameObject.transform.rotation * pi.m_rotation, label); } } public void RemoveDebugLineRenderers() { if (!FireSpreads.VisualDebugConfig.Value) { return; } LineRenderer[] componentsInChildren = m_gameObject.GetComponentsInChildren<LineRenderer>(); if (componentsInChildren == null) { return; } foreach (LineRenderer item in componentsInChildren.Where((LineRenderer lr) => ((Object)((Component)lr).transform).name.StartsWith("DebugLineRenderer"))) { Object.Destroy((Object)(object)((Component)item).gameObject); } } public Bounds CalculateBurningBounds(PrefabBounds pi) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) Bounds bounds = pi.m_bounds; Vector3 size = ((Bounds)(ref bounds)).size + new Vector3(FireSpreads.FireSpreadDistanceConfig.Value, FireSpreads.FireSpreadDistanceConfig.Value, FireSpreads.FireSpreadDistanceConfig.Value); size.x *= m_gameObject.transform.localScale.x; size.y *= m_gameObject.transform.localScale.y; size.z *= m_gameObject.transform.localScale.z; ((Bounds)(ref bounds)).size = size; ((Bounds)(ref bounds)).center = m_gameObject.transform.position - m_gameObject.transform.rotation * pi.m_offset; m_bounds_rotation = m_gameObject.transform.rotation * pi.m_rotation; return bounds; } public virtual void SetupBoundsForBurning() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) PrefabBounds pi = m_allBounds[Utils.GetPrefabName(m_gameObject)]; m_bounds = CalculateBurningBounds(pi); DrawDebugWireframe("Burning", pi); } public void SetupBoundsForFireSource() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) PrefabBounds prefabBounds = m_allBounds[Utils.GetPrefabName(m_gameObject)]; if (prefabBounds.m_firesource != null) { prefabBounds = prefabBounds.m_firesource; } m_bounds = CalculateFireSourceBounds(prefabBounds); DrawDebugWireframe("ContainsFire", prefabBounds); } private Bounds CalculateFireSourceBounds(PrefabBounds pi) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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) Bounds bounds = pi.m_bounds; ((Bounds)(ref bounds)).center = m_gameObject.transform.position - m_gameObject.transform.rotation * pi.m_offset; m_bounds_rotation = m_gameObject.transform.rotation * pi.m_rotation; return bounds; } public void SetupBounds() { RemoveDebugLineRenderers(); if (IsBurning()) { SetupBoundsForBurning(); } else if (ContainsFireSource(m_gameObject)) { SetupBoundsForFireSource(); } } public virtual void SetupConnected() { //IL_0011: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) m_connected.Clear(); int num = Physics.OverlapBoxNonAlloc(((Bounds)(ref m_bounds)).center, ((Bounds)(ref m_bounds)).size * 0.5f, t_collider, m_bounds_rotation, s_raymask); for (int i = 0; i < num; i++) { Collider val = t_collider[i]; if ((Object)(object)val == (Object)null) { continue; } ConnectedInfo connectedInfo = new ConnectedInfo(); Transform topmostTransform = GetTopmostTransform(((Component)val).transform); if ((Object)(object)((Component)topmostTransform).gameObject == (Object)(object)m_gameObject || m_connected.ContainsKey(((Component)topmostTransform).gameObject)) { continue; } FireState fireState = CreateFireState(((Component)topmostTransform).gameObject); if (fireState == null) { continue; } connectedInfo.m_fs = fireState; Bounds bounds = val.bounds; if (((Bounds)(ref bounds)).max.y > ((Bounds)(ref m_bounds)).max.y) { connectedInfo.m_direction = Vector3.up; } else { bounds = val.bounds; if (((Bounds)(ref bounds)).max.y < ((Bounds)(ref m_bounds)).max.y) { connectedInfo.m_direction = Vector3.down; } else { connectedInfo.m_direction = Vector3.zero; } } m_connected.Add(((Component)topmostTransform).gameObject, connectedInfo); } } protected bool Init(GameObject go) { //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: 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_0151: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_nview != (Object)null && !m_nview.IsValid()) { return false; } m_lastTime = Time.fixedTime; m_fireTransform = go.transform.Find("bid_fire"); if ((Object)(object)m_fireTransform != (Object)null) { m_PointLight = m_fireTransform.Find("Point light"); m_SmokeSpawner = m_fireTransform.Find("SmokeSpawner"); m_SFX = m_fireTransform.Find("SFX"); Transform val = m_fireTransform.Find("Particles"); m_Smoke = val.Find("smoke (1)"); m_Sparks = val.Find("sparcs (1)"); m_Flare = val.Find("flare"); m_flames1 = val.Find("flames (1)"); PrefabBounds prefabBounds = m_allBounds[Utils.GetPrefabName(m_gameObject)]; if (prefabBounds != null) { m_flames1.localScale = Vector3.Scale(prefabBounds.m_firescale, m_gameObject.transform.localScale); m_Flare.localScale = m_gameObject.transform.localScale; m_Smoke.localScale = m_gameObject.transform.localScale; } } m_renderers = Instance.GetTintRenderer(go); SetupBounds(); return true; } public void AddToList() { Instance.m_allInstanceKeys.Add(m_gameObject); m_list_index = Instance.m_allInstanceKeys.Count - 1; Instance.m_allInstances.Add(m_gameObject, this); SetupConnected(); } public void RemoveFromList() { if (m_nview.IsValid() && m_nview.IsOwner()) { ChangeFireResistsNetwork(s_zdoTintOffset); } Instance.m_allInstanceKeys[m_list_index] = Instance.m_allInstanceKeys[Instance.m_allInstanceKeys.Count - 1]; Instance.GetFireState(Instance.m_allInstanceKeys[m_list_index]).m_list_index = m_list_index; Instance.m_allInstanceKeys.RemoveAt(Instance.m_allInstanceKeys.Count - 1); Instance.m_allInstances.Remove(m_gameObject); RemoveDebugLineRenderers(); } public abstract void SetFire(float damage); public static void ChangeFireResistsNetwork(ZNetView nview, float fireresists) { nview.InvokeRPC(ZNetView.Everybody, "FireResistsChanged", new object[1] { fireresists }); } public void ChangeFireResistsNetwork(float fireresists) { ChangeFireResistsNetwork(m_nview, fireresists); } public static void FireresistsChanged<T>(T instance, long sender, float fireresists, Func<T, object> m_nviewAccessor) where T : MonoBehaviour { //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (m_nviewAccessor(instance) == null || ((ZNetView)m_nviewAccessor(instance)).IsOwner()) { return; } if (fireresists <= 0f && Instance.GetFireState(((Component)(object)instance).gameObject) == null) { Instance.AddFireStateTo((MonoBehaviour)(object)instance, doRPC: false).UpdateVisuals(forceburn: true); } if (fireresists > 0f) { FireState fireState = Instance.GetFireState(((Component)(object)instance).gameObject); if (fireState != null) { Instance.RemoveFireStateIfNotFireplace(fireState.m_gameObject); fireState.UpdateVisuals(forceburn: false, forceextinguish: true); } RemoveVisualTinted(((Component)(object)instance).gameObject); } if (fireresists >= s_zdoTintOffset) { SetVisualTinted(((Component)(object)instance).gameObject); } } public bool IsBurning() { return Instance.IsBurning(m_nview); } protected virtual void SetQuality() { m_quality = Mathf.Clamp(m_quality, 0, 5); ((Component)m_PointLight).gameObject.SetActive(m_quality < 1); ((Component)m_SmokeSpawner).gameObject.SetActive(m_quality < 2); ((Component)m_SFX).gameObject.SetActive(m_quality < 2); ((Component)m_Smoke).gameObject.SetActive(m_quality < 3); ((Component)m_Sparks).gameObject.SetActive(m_quality < 4); ((Component)m_Flare).gameObject.SetActive(m_quality < 5); } public void IncreaseQuality() { m_quality--; SetQuality(); } public void DecreaseQuality() { m_quality++; SetQuality(); } public abstract void ApplyDamage(float damage); public virtual void ExtinguishFire() { if ((Object)(object)m_nview == (Object)null || !m_nview.IsValid()) { return; } m_nview.ClaimOwnership(); if (m_nview.GetZDO() != null) { if (Instance.IsBurning(m_nview)) { Instance.SetFireResist(m_nview, FireSpreads.MaxFireHealthConfig.Value + s_zdoTintOffset, ignoreOffset: true); } else { Instance.SetFireResist(m_nview, FireSpreads.MaxFireHealthConfig.Value, ignoreOffset: true); } Instance.RemoveFireStateIfNotFireplace(m_gameObject); UpdateVisuals(); } } public virtual bool CheckExtinguish() { if (GetHealthPercentage() <= FireSpreads.StopBurningConfig.Value) { ExtinguishFire(); return true; } if (IsBurning() && Instance.m_WeatherState.m_IsRaining && Random.value >= 1f - FireSpreads.RainExtinguishesProbabilityConfig.Value) { ExtinguishFire(); return true; } return false; } public void UpdateLogic() { //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) if (!m_nview.IsValid() || !m_nview.IsOwner()) { return; } float fixedTime = Time.fixedTime; if (m_lastTime == 0f) { m_lastTime = fixedTime; } float num = fixedTime - m_lastTime; m_lastTime = fixedTime; if (CheckExtinguish()) { return; } if (IsBurning()) { ApplyDamage(FireSpreads.FireDamageConfig.Value * num); } if (!FireSpreads.FireSpreadsConfig.Value) { return; } if (s_hasRigidBody[Utils.GetPrefabName(m_gameObject)]) { SetupBoundsConnected(); } if (m_connected.Count <= 0) { return; } s_fireplaces.TryGetValue(m_gameObject, out var value); if (!IsBurning() && (Object)(object)value != (Object)null && (!value.m_nview.IsValid() || !value.IsBurning())) { return; } foreach (KeyValuePair<GameObject, ConnectedInfo> item in m_connected) { GameObject key = item.Key; ConnectedInfo value2 = item.Value; Vector3 direction = value2.m_direction; if ((Object)(object)value2.m_fs.m_nview == (Object)null || !value2.m_fs.m_nview.IsValid()) { continue; } FireState fireState = Instance.GetFireState(key); float num2 = FireSpreads.ConnectedNonBurnableDamageConfig.Value * num; float num3 = FireSpreads.FireSpreadDamageConfig.Value * num; if (direction == Vector3.up) { num2 *= FireSpreads.UpwardSpreadMultiplierConfig.Value; num3 *= FireSpreads.UpwardSpreadMultiplierConfig.Value; } else if (direction == Vector3.down) { num2 *= 1f / FireSpreads.UpwardSpreadMultiplierConfig.Value; num3 *= 1f / FireSpreads.UpwardSpreadMultiplierConfig.Value; } if ((Object)(object)value != (Object)null && value.m_nview.IsValid() && !IsBurning() && NeedsFireSource(key)) { continue; } if (fireState == null || !fireState.IsBurning()) { if (!IsBurnable(key)) { value2.m_fs.ApplyDamage(num2); } else { value2.m_fs.SetFire(num3); } } else { value2.m_fs.ApplyDamage(num2); } } } public void UpdateVisuals(bool forceburn = false, bool forceextinguish = false) { if ((Object)(object)m_fireTransform == (Object)null) { return; } if (Time.fixedTime - Instance.m_lastQualityUpdate > 1f) { Instance.m_lastQualityUpdate = Time.fixedTime; Instance.m_numberQualityUpdates = 0; } if (Instance.m_numberQualityUpdates++ <= 5 && FireSpreads.m_lastFramerate > (float)(FireSpreads.TargetFPSConfig.Value + 5)) { IncreaseQuality(); } if (FireSpreads.m_lastFramerate < (float)(FireSpreads.TargetFPSConfig.Value - 5)) { DecreaseQuality(); } UpdateMaterialBlock(); bool flag = IsBurning(); if ((flag && !forceextinguish) || forceburn) { if (((Component)m_fireTransform).gameObject.activeSelf) { return; } ((Component)m_fireTransform).gameObject.SetActive(true); AddMaterialBlock(); } if (((!flag && !forceburn) || forceextinguish) && ((Component)m_fireTransform).gameObject.activeSelf) { ((Component)m_fireTransform).gameObject.SetActive(false); if (Instance.HasBurnTint(m_nview)) { SetVisualTinted(m_gameObject); } else { RemoveMaterialBlock(); } } } } private class WeatherState { public bool m_IsRaining; public bool m_IsWet; public bool m_IsWind; } private class LateInitInfo { public MonoBehaviour m_mono; public float m_init_ts; public bool m_is_newly_placed; } private static FireController _instance; private static readonly Dictionary<string, bool> s_burnables = new Dictionary<string, bool>(); private static readonly HashSet<string> s_woodItems = new HashSet<string>(); private static readonly Dictionary<string, bool> s_needsFireSource = new Dictionary<string, bool>(); public static readonly Dictionary<string, bool> s_hasRigidBody = new Dictionary<string, bool>(); private static readonly Dictionary<string, bool> s_containsFireSoure = new Dictionary<string, bool>(); public static readonly Dictionary<string, PrefabBounds> m_allBounds = new Dictionary<string, PrefabBounds>(); private static readonly LinkedList<LateInitInfo> m_late_init_list = new LinkedList<LateInitInfo>(); private readonly Dictionary<GameObject, FireState> m_allInstances = new Dictionary<GameObject, FireState>(); private readonly List<GameObject> m_allInstanceKeys = new List<GameObject>(); private readonly Dictionary<GameObject, List<Renderer>> m_tintRenderers = new Dictionary<GameObject, List<Renderer>>(); private readonly HashSet<GameObject> m_tintedGameObjects = new HashSet<GameObject>(); public static readonly Dictionary<GameObject, Fireplace> s_fireplaces = new Dictionary<GameObject, Fireplace>(); public static MaterialPropertyBlock s_matBlockBurnt = new MaterialPropertyBlock(); public static readonly Color s_burningColor = new Color(0.5f, 0.1f, 0.1f); private static readonly Color s_burntColor = new Color(0.1f, 0.1f, 0.1f); private float m_lastQualityUpdate; private int m_numberQualityUpdates; public float m_sleepUntil; private int currentIndex; private static readonly int s_zdoHash = StringExtensionMethods.GetStableHashCode("bid_fireresist"); public static readonly float s_zdoTintOffset = 100000f; private static readonly int s_raymask = LayerMask.GetMask(new string[5] { "piece", "Default", "static_solid", "Default_small", "piece_nonsolid" }); private static HashSet<string> s_RainEnv = new HashSet<string> { "Rain", "ThunderStorm", "SnowStrom", "MistlandsRain" }; private WeatherState m_WeatherState = new WeatherState(); private float m_LastWeatherUpdate; public static FireController Instance => _instance ?? (_instance = new FireController()); private void Awake() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) _instance = this; s_matBlockBurnt.Clear(); s_matBlockBurnt.SetColor("_Color", s_burntColor); m_LastWeatherUpdate = Time.fixedTime; } public void AddLateInit(MonoBehaviour mono, ZNetView nview, float timeoffset = 10f, bool newPiece = false) { if (newPiece || IsBurning(nview) || (FireSpreads.SpreadFromFireplaceConfig.Value && ContainsFireSource(((Component)mono).gameObject))) { LateInitInfo lateInitInfo = new LateInitInfo(); lateInitInfo.m_mono = mono; lateInitInfo.m_init_ts = Time.fixedTime + timeoffset; lateInitInfo.m_is_newly_placed = newPiece; m_late_init_list.AddLast(lateInitInfo); } } public static FireState CreateFireState(GameObject obj) { WearNTear componentInParent = obj.GetComponentInParent<WearNTear>(); if ((Object)(object)componentInParent != (Object)null) { FireStateWNT fireStateWNT = new FireStateWNT(); fireStateWNT.InitComponent((MonoBehaviour)(object)componentInParent); return fireStateWNT; } TreeBase componentInParent2 = obj.GetComponentInParent<TreeBase>(); if ((Object)(object)componentInParent2 != (Object)null) { FireStateTreeBase fireStateTreeBase = new FireStateTreeBase(); fireStateTreeBase.InitComponent((MonoBehaviour)(object)componentInParent2); return fireStateTreeBase; } TreeLog componentInParent3 = obj.GetComponentInParent<TreeLog>(); if ((Object)(object)componentInParent3 != (Object)null) { FireStateTreeLog fireStateTreeLog = new FireStateTreeLog(); fireStateTreeLog.InitComponent((MonoBehaviour)(object)componentInParent3); return fireStateTreeLog; } Destructible componentInParent4 = obj.GetComponentInParent<Destructible>(); if ((Object)(object)componentInParent4 != (Object)null) { FireStateDestructible fireStateDestructible = new FireStateDestructible(); fireStateDestructible.InitComponent((MonoBehaviour)(object)componentInParent4); return fireStateDestructible; } return null; } public FireState AddFireStateTo(MonoBehaviour targetObject, bool doRPC = true) { FireState fireState = GetFireState(((Component)targetObject).gameObject); if (fireState != null) { fireState.SetupBoundsConnected(); } else { if (targetObject is TreeBase) { fireState = new FireStateTreeBase(); if (!((FireStateTreeBase)fireState).InitComponent((targetObject is TreeBase) ? targetObject : null)) { return null; } } else if (targetObject is Destructible) { fireState = new FireStateDestructible(); if (!((FireStateDestructible)fireState).InitComponent((targetObject is Destructible) ? targetObject : null)) { return null; } } else if (targetObject is TreeLog) { fireState = new FireStateTreeLog(); if (!((FireStateTreeLog)fireState).InitComponent((targetObject is TreeLog) ? targetObject : null)) { return null; } } else if (targetObject is WearNTear) { fireState = new FireStateWNT(); if (!((FireStateWNT)fireState).InitComponent((targetObject is WearNTear) ? targetObject : null)) { return null; } } if (fireState != null) { fireState.AddToList(); } else { MonoBehaviour.print((object)("firestate could not be created for " + (object)targetObject)); } } if (fireState != null && IsBurning(fireState.m_nview)) { fireState.SetFire(); if (doRPC && IsBurning(fireState.m_nview) && fireState.m_nview.IsValid() && fireState.m_nview.IsOwner()) { fireState.ChangeFireResistsNetwork(0f); } } return fireState; } public void RemoveFireState(GameObject go) { if (m_allInstances.TryGetValue(go, out var value)) { value.RemoveFromList(); } } public void RemoveFireStateIfNotFireplace(GameObject go) { if (FireSpreads.SpreadFromFireplaceConfig.Value && ContainsFireSource(go)) { FireState fireState = Instance.GetFireState(go); if (fireState != null) { fireState.UpdateMaterialBlock(); fireState.SetupBounds(); fireState.SetupConnected(); } } else { Instance.RemoveFireState(go); } } public int GetBurningCount() { return m_allInstanceKeys.Count; } public void Update() { ProcessLateInit(); if (Time.fixedTime - m_LastWeatherUpdate > 10f) { UpdateWeahter(); m_LastWeatherUpdate = Time.fixedTime; } int num = GetBurningCount(); int num2 = Math.Min(currentIndex + FireSpreads.CalculationBatchSizeConfig.Value, num); while (currentIndex < num2) { GameObject val = m_allInstanceKeys[currentIndex]; FireState fireState = m_allInstances[val]; if (!Object.op_Implicit((Object)(object)val)) { fireState.RemoveFromList(); } else { if (Time.fixedTime - fireState.m_lastTime >= Random.Range(5f, 10f)) { fireState.UpdateLogic(); fireState.UpdateVisuals(); } if (currentIndex + 1 >= GetBurningCount()) { num = 0; currentIndex = 0; break; } } currentIndex++; } if (currentIndex >= num) { currentIndex = 0; } } public void ProcessLateInit() { if (m_late_init_list.First == null) { return; } LateInitInfo value = m_late_init_list.First.Value; if (!(value.m_init_ts < Time.fixedTime)) { return; } m_late_init_list.RemoveFirst(); if ((Object)(object)value.m_mono == (Object)null || (Object)(object)((Component)value.m_mono).gameObject == (Object)null) { return; } FireState fireState = GetFireState(((Component)value.m_mono).gameObject); if (fireState == null) { fireState = CreateFireState(((Component)value.m_mono).gameObject); } ZNetView nview = fireState.m_nview; if (!((Object)(object)nview != (Object)null)) { return; } if (value.m_is_newly_placed) { fireState.SetupBoundsForBurning(); fireState.SetupConnected(); foreach (KeyValuePair<GameObject, FireState.ConnectedInfo> item in fireState.m_connected) { GameObject key = item.Key; FireState fireState2 = Instance.GetFireState(key); if (fireState2 != null && (fireState2.IsBurning() || ContainsFireSource(fireState2.m_gameObject))) { fireState2.SetupConnected(); } } fireState.m_connected.Clear(); fireState.RemoveDebugLineRenderers(); if (fireState is FireStateWNT && ContainsFireSource(((Component)((FireStateWNT)fireState).m_wnt).gameObject) && FireSpreads.SpreadFromFireplaceConfig.Value) { AddFireStateTo((MonoBehaviour)(object)((FireStateWNT)fireState).m_wnt, doRPC: false); } } else if (Instance.IsBurning(nview)) { Instance.AddFireStateTo(value.m_mono, doRPC: false); } else if (FireSpreads.SpreadFromFireplaceConfig.Value && ContainsFireSource(((Component)value.m_mono).gameObject)) { Instance.AddFireStateTo(value.m_mono, doRPC: false); } } public bool IsBurning(ZNetView nview) { if ((Object)(object)nview == (Object)null || (Object)(object)((Component)nview).gameObject == (Object)null || !IsBurnable(((Component)nview).gameObject)) { return false; } return GetFireResist(nview) <= 0f; } public bool HasBurnTint(ZNetView nview) { if ((Object)(object)nview == (Object)null || !nview.IsValid()) { return false; } ZDO zDO = nview.GetZDO(); if (zDO == null) { return false; } return zDO.GetFloat(s_zdoHash, FireSpreads.MaxFireHealthConfig.Value) > s_zdoTintOffset; } public List<Renderer> GetTintRenderer(GameObject go) { if ((Object)(object)go == (Object)null) { return null; } Instance.m_tintRenderers.TryGetValue(go, out var value); if (value == null) { WearNTear component = go.GetComponent<WearNTear>(); if ((Object)(object)component != (Object)null) { value = component.GetHighlightRenderers(); Instance.m_tintRenderers[go] = value; } else { value = go.GetComponentsInChildren<Renderer>().ToList(); Instance.m_tintRenderers[go] = value; } } return value; } public float GetFireResist(ZNetView nview) { if ((Object)(object)nview == (Object)null || !nview.IsValid()) { return FireSpreads.MaxFireHealthConfig.Value; } ZDO zDO = nview.GetZDO(); if (zDO == null) { return FireSpreads.MaxFireHealthConfig.Value; } float num = zDO.GetFloat(s_zdoHash, FireSpreads.MaxFireHealthConfig.Value); if (num >= s_zdoTintOffset) { num -= s_zdoTintOffset; } return num; } public void SetFireResist(ZNetView nview, float newResistance, bool ignoreOffset = false) { if ((Object)(object)nview == (Object)null || !nview.IsValid()) { return; } ZDO zDO = nview.GetZDO(); if (zDO != null) { if (ignoreOffset) { zDO.Set(s_zdoHash, newResistance); } else if (zDO.GetFloat(s_zdoHash, FireSpreads.MaxFireHealthConfig.Value) >= s_zdoTintOffset) { zDO.Set(s_zdoHash, newResistance + s_zdoTintOffset); } else { zDO.Set(s_zdoHash, newResistance); } } } public FireState SetFire<T>(T target, ZNetView nview, float firedamage, bool eternalFlame = false) where T : MonoBehaviour { if ((Object)(object)target == (Object)null || (Object)(object)nview == (Object)null || !nview.IsValid()) { return null; } if (GetBurningCount() >= FireSpreads.MaxBurningPiecesConfig.Value) { return null; } SetFire(nview, firedamage, eternalFlame); if (IsBurning(nview)) { return Instance.AddFireStateTo((MonoBehaviour)(object)target); } return null; } private void SetFire(ZNetView nview, float firedamage, bool eternalFlame = false) { if ((Object)(object)nview == (Object)null || !nview.IsValid() || !IsBurnable(((Component)nview).gameObject) || nview.GetZDO() == null || GetBurningCount() >= FireSpreads.MaxBurningPiecesConfig.Value) { return; } firedamage = ApplyEnvironmentModifier(firedamage); float fireResist = GetFireResist(nview); if (fireResist <= 0f) { return; } if (eternalFlame) { fireResist = 0f; } else { fireResist -= firedamage; if (fireResist < 0f) { fireResist = 0f; } } nview.ClaimOwnership(); SetFireResist(nview, fireResist); } private void UpdateWeahter() { m_WeatherState.m_IsRaining = IsRaining(); m_WeatherState.m_IsWet = EnvMan.instance.IsWet() || EnvMan.instance.GetCurrentEnvironment().m_psystems.Any((GameObject go) => ((Object)go).name.IndexOf("snow", StringComparison.OrdinalIgnoreCase) >= 0); m_WeatherState.m_IsWind = EnvMan.instance.GetWindIntensity() > 1f; } private bool IsRaining() { return EnvMan.instance.GetCurrentEnvironment().m_psystems.Any((GameObject go) => s_RainEnv.Contains(((Object)go).name)); } private float ApplyEnvironmentModifier(float damage) { if (m_WeatherState.m_IsWet) { damage *= FireSpreads.ReducedWetFactorConfig.Value; } else if (m_WeatherState.m_IsWind) { damage *= FireSpreads.IncreasedWindFactorConfig.Value; } return damage; } public static bool UseController() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 return (int)SystemInfo.graphicsDeviceType != 4; } public void ApplyFireDamage(ZNetView nview, HitData hit) { m_allInstances.TryGetValue(((Component)nview).gameObject, out var value); if (value != null && value.IsBurning() && (hit.m_damage.m_frost > 0f || hit.m_toolTier == -FireSpreads.FireToolTier)) { value.ExtinguishFire(); } else if (IsBurnable(((Component)nview).gameObject)) { if (hit.m_toolTier == FireSpreads.FireToolTier) { SetFire(nview, hit.m_damage.m_fire, eternalFlame: true); } else if (RandEventSystem.m_instance.m_activeEvent != null && FireSpreads.Parse2List(FireSpreads.EventImmediateFireConfig.Value).Contains(RandEventSystem.m_instance.m_activeEvent.m_name) && (hit.m_damage.m_fire > 0f || hit.m_damage.m_lightning > 0f)) { SetFire(nview, Math.Max(hit.m_damage.m_fire, hit.m_damage.m_lightning), eternalFlame: true); } else if (FireSpreads.FireDamageCausesBurningConfig.Value && hit.m_damage.m_fire > 0f) { SetFire(nview, hit.m_damage.m_fire); } else if (FireSpreads.LightningDamageCausesBurningConfig.Value && hit.m_damage.m_lightning > 0f) { SetFire(nview, hit.m_damage.m_lightning); } } } public FireState GetFireState(GameObject go) { m_allInstances.TryGetValue(go, out var value); return value; } public static bool NeedsFireSource(GameObject go) { if (!s_needsFireSource.ContainsKey(Utils.GetPrefabName(go))) { Fireplace val = default(Fireplace); CookingStation val2 = default(CookingStation); CraftingStation val3 = default(CraftingStation); s_needsFireSource[Utils.GetPrefabName(go)] = go.TryGetComponent<Fireplace>(ref val) || (go.TryGetComponent<CookingStation>(ref val2) && val2.m_requireFire) || (go.TryGetComponent<CraftingStation>(ref val3) && Object.op_Implicit((Object)(object)val3.m_haveFireObject)); } return s_needsFireSource[Utils.GetPrefabName(go)]; } private static bool IsWoodMaterial(string itemName) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Invalid comparison between Unknown and I4 if (s_woodItems.Count == 0) { s_woodItems.Add("Wood"); ItemDrop val = default(ItemDrop); foreach (GameObject item in ObjectDB.instance.m_items) { item.TryGetComponent<ItemDrop>(ref val); if (!((Object)(object)val == (Object)null) && (int)val.m_itemData.m_shared.m_itemType == 1 && (((Object)item).name.IndexOf("wood", StringComparison.OrdinalIgnoreCase) > 0 || ((Object)item).name.IndexOf("log", StringComparison.OrdinalIgnoreCase) > 0 || ((Object)item).name.IndexOf("bark", StringComparison.OrdinalIgnoreCase) > 0)) { s_woodItems.Add(((Object)item).name); } } } return s_woodItems.Contains(itemName); } public static bool ContainsFireSource(GameObject go) { string prefabName = Utils.GetPrefabName(go); if (s_containsFireSoure.ContainsKey(Utils.GetPrefabName(go))) { return s_containsFireSoure[prefabName]; } Fireplace val = default(Fireplace); s_containsFireSoure[prefabName] = go.TryGetComponent<Fireplace>(ref val); return s_containsFireSoure[prefabName]; } public static void AddNonBurnable(string prefab) { if (!s_burnables.ContainsKey(prefab)) { s_burnables.Add(prefab, value: false); } else { s_burnables[prefab] = false; } } public static string GetPrefName(IDestructible destructible) { //IL_0009: 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) if (destructible is WearNTear) { return ((Object)(WearNTear)destructible).name.Replace("(Clone)", ""); } if (destructible is TreeBase) { return ((Object)(TreeBase)destructible).name; } return ((object)destructible).ToString(); } public static bool IsBurnable(GameObject go) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Invalid comparison between Unknown and I4 if ((Object)(object)go == (Object)null) { return false; } string prefabName = Utils.GetPrefabName(go); if (((Object)go).name == null) { return false; } if (s_burnables.ContainsKey(prefabName)) { return s_burnables[prefabName]; } WearNTear component = go.GetComponent<WearNTear>(); TreeBase component2 = go.GetComponent<TreeBase>(); TreeLog component3 = go.GetComponent<TreeLog>(); DropOnDestroyed component4 = go.GetComponent<DropOnDestroyed>(); if ((Object)(object)component != (Object)null && FireSpreads.WntBurningConfig.Value) { if ((int)component.m_materialType == 0 || (int)component.m_materialType == 3) { s_burnables[prefabName] = true; return true; } Piece component5 = ((Component)component).GetComponent<Piece>(); if ((Object)(object)component5 != (Object)null && component5.m_resources != null && component5.m_resources.Any((Requirement req) => IsWoodMaterial(((Object)req.m_resItem).name))) { s_burnables[prefabName] = true; return true; } DropOnDestroyed component6 = ((Component)component).GetComponent<DropOnDestroyed>(); if ((Object)(object)component6 != (Object)null && component6.m_dropWhenDestroyed != null && component6.m_dropWhenDestroyed.m_drops.Any((DropData drop) => IsWoodMaterial(((Object)drop.m_item).name))) { s_burnables[prefabName] = true; return true; } s_burnables[prefabName] = false; return false; } if ((Object)(object)component2 != (Object)null && FireSpreads.VegBurningConfig.Value) { s_burnables[prefabName] = component2.m_dropWhenDestroyed.m_drops.Any((DropData drop) => IsWoodMaterial(((Object)drop.m_item).name)); if (!s_burnables[prefabName]) { TreeLog component7 = component2.m_logPrefab.GetComponent<TreeLog>(); if (component7.m_dropWhenDestroyed.m_drops.Any((DropData drop) => IsWoodMaterial(((Object)drop.m_item).name))) { s_burnables[prefabName] = true; } else { s_burnables[prefabName] = IsBurnable(((Component)component7).gameObject); } } } else if ((Object)(object)component3 != (Object)null && FireSpreads.VegBurningConfig.Value) { s_burnables[prefabName] = component3.m_dropWhenDestroyed.m_drops.Any((DropData drop) => IsWoodMaterial(((Object)drop.m_item).name)); if (!s_burnables[prefabName] && (Object)(object)component3.m_subLogPrefab != (Object)null) { TreeLog component8 = component3.m_subLogPrefab.GetComponent<TreeLog>(); if ((Object)(object)component8 != (Object)null && component8.m_dropWhenDestroyed.m_drops.Any((DropData drop) => IsWoodMaterial(((Object)drop.m_item).name))) { s_burnables[prefabName] = true; } else { s_burnables[prefabName] = IsBurnable(((Component)component8).gameObject); } } } else if ((Object)(object)component4 != (Object)null && FireSpreads.VegBurningConfig.Value) { s_burnables[prefabName] = component4.m_dropWhenDestroyed.m_drops.Any((DropData drop) => IsWoodMaterial(((Object)drop.m_item).name)); } else { s_burnables[prefabName] = false; } return s_burnables[prefabName]; } public static void DestroyFire(GameObject go) { s_fireplaces.Remove(go); Instance?.RemoveFireState(go); if (IsVisualTinted(go)) { RemoveVisualTinted(go); } Instance?.m_tintRenderers.Remove(go); } public static bool IsVisualTinted(GameObject go) { return Instance.m_tintedGameObjects.Contains(go); } public static void SetVisualTinted(GameObject go) { Instance.m_tintedGameObjects.Add(go); foreach (Renderer item in Instance.GetTintRenderer(go)) { item.SetPropertyBlock(s_matBlockBurnt); } } public static void RemoveVisualTinted(GameObject go) { Instance.m_tintedGameObjects.Remove(go); foreach (Renderer item in Instance.GetTintRenderer(go)) { if ((Object)(object)item != (Object)null && item.HasPropertyBlock()) { item.SetPropertyBlock((MaterialPropertyBlock)null); } } } public static Transform GetTopmostTransform(Transform obj) { Transform val = obj; while ((Object)(object)val.parent != (Object)null) { val = val.parent; } return val; } } [HarmonyPatch(typeof(SpawnSystem), "IsSpawnPointGood")] internal class SpawnSystemIsSpawnPointGood_patch { private static bool Prefix(SpawnData spawn, ref Vector3 spawnPoint, ref SpawnSystem __instance, ref bool __result) { if (((Object)spawn.m_prefab).name == "fire_lightning" || ((Object)spawn.m_prefab).name == "Thor") { __result = true; return false; } return true; } } [HarmonyPatch(typeof(SpawnSystem), "FindBaseSpawnPoint")] internal class SpawnSystemFindBaseSpawnPoint_patch { private static bool Prefix(SpawnData spawn, ref Vector3 spawnCenter, ref SpawnSystem __instance, ref bool __result) { //IL_0025: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //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_007c: 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_0090: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) if (((Object)spawn.m_prefab).name == "fire_lightning") { spawnCenter = RandEventSystem.instance.m_randomEvent.m_pos; float spawnRadiusMin = spawn.m_spawnRadiusMin; float spawnRadiusMax = spawn.m_spawnRadiusMax; Vector3 val = Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f) * Vector3.forward; Vector3 val2 = spawnCenter + val * Random.Range(spawnRadiusMin, spawnRadiusMax); float y = default(float); Heightmap.GetHeight(val2, ref y); val2.y = y; spawnCenter = val2; __result = true; return false; } if (((Object)spawn.m_prefab).name == "Th