using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Zorro.Core;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("KilnLavaControl")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+822407addd9afe3fdcd194a45e05410c683942fe")]
[assembly: AssemblyProduct("KilnLavaControl")]
[assembly: AssemblyTitle("Kiln Lava Control")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
[BepInPlugin("KilnLavaControl", "Kiln Lava Control", "2.0.0")]
public class Plugin : BaseUnityPlugin
{
[HarmonyPatch(typeof(LavaRising), "Update")]
internal static class LavaSpeedPatch
{
internal static float cachedWaitTime;
internal static int cachedSegment = -1;
internal static ConfigEntry<float>? WaitTime;
internal static ConfigEntry<float>? SpeedMultiplier;
internal static ConfigEntry<float>? UpdateRate;
internal static void Prefix(LavaRising __instance)
{
//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_0031: 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_0034: 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_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Invalid comparison between Unknown and I4
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Invalid comparison between Unknown and I4
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Invalid comparison between Unknown and I4
int currentSegment = Singleton<MapHandler>.Instance.currentSegment;
if (cachedSegment != currentSegment)
{
BiomeType biome = Singleton<MapHandler>.Instance.segments[currentSegment].biome;
BiomeType val = biome;
BiomeType val2 = val;
if ((int)val2 != 3)
{
if ((int)val2 != 8)
{
if ((int)val2 == 17)
{
WaitTime = NadirSoulWaitTime;
SpeedMultiplier = NadirSoulSpeedMultiplier;
UpdateRate = NadirSoulUpdateRate;
}
}
else
{
WaitTime = CitadelGloomWaitTime;
SpeedMultiplier = CitadelGloomSpeedMultiplier;
UpdateRate = CitadelGloomUpdateRate;
}
}
else
{
WaitTime = KilnLavaWaitTime;
SpeedMultiplier = KilnLavaSpeedMultiplier;
UpdateRate = KilnLavaUpdateRate;
}
cachedSegment = currentSegment;
}
__instance.initialWaitTime = WaitTime?.Value ?? 180f;
cachedWaitTime = __instance.timeTraveled;
}
internal static void Postfix(LavaRising __instance)
{
if (!PhotonNetwork.IsMasterClient)
{
return;
}
if ((SpeedMultiplier?.Value ?? 1f) < 0f)
{
__instance.ended = false;
}
if (__instance.started && !__instance.ended)
{
float num = __instance.timeTraveled - cachedWaitTime;
__instance.timeTraveled += num * ((-1f + SpeedMultiplier?.Value) ?? 1f);
if (__instance.timeTraveled < 0f)
{
__instance.timeTraveled = 0f;
}
if (UpdateRate != null && __instance.syncTime > UpdateRate.Value)
{
__instance.syncTime = 0f;
((MonoBehaviourPun)__instance).photonView.RPC("RPC_SyncLava", (RpcTarget)1, new object[4] { __instance.started, __instance.ended, __instance.timeTraveled, __instance.secondsWaitedToStart });
}
}
}
}
internal static ManualLogSource? Log;
internal static ConfigEntry<float>? KilnLavaWaitTime;
internal static ConfigEntry<float>? KilnLavaSpeedMultiplier;
internal static ConfigEntry<float>? KilnLavaUpdateRate;
internal static ConfigEntry<float>? CitadelGloomWaitTime;
internal static ConfigEntry<float>? CitadelGloomSpeedMultiplier;
internal static ConfigEntry<float>? CitadelGloomUpdateRate;
internal static ConfigEntry<float>? NadirSoulWaitTime;
internal static ConfigEntry<float>? NadirSoulSpeedMultiplier;
internal static ConfigEntry<float>? NadirSoulUpdateRate;
private void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Expected O, but got Unknown
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Expected O, but got Unknown
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Expected O, but got Unknown
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Expected O, but got Unknown
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Expected O, but got Unknown
//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Expected O, but got Unknown
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Expected O, but got Unknown
//IL_024a: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Expected O, but got Unknown
Harmony val = new Harmony("KilnLavaControl");
val.PatchAll();
Log = ((BaseUnityPlugin)this).Logger;
ManualLogSource? log = Log;
if (log != null)
{
log.LogInfo((object)"Plugin KilnLavaControl is loaded!");
}
KilnLavaWaitTime = ((BaseUnityPlugin)this).Config.Bind<float>("Kiln Lava", "KilnLavaWaitTime", 90f, new ConfigDescription("How long the lava waits when the Kiln loads before starting to rise.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3600f), Array.Empty<object>()));
KilnLavaSpeedMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Kiln Lava", "KilnLavaSpeedMultiplier", 2f, new ConfigDescription("Multiplies the speed of the Kiln lava. 1.0 is normal speed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-10f, 10f), Array.Empty<object>()));
KilnLavaUpdateRate = ((BaseUnityPlugin)this).Config.Bind<float>("Kiln Lava", "KilnLavaUpdateRate", 0.1f, new ConfigDescription("Seconds between updating kiln lava speed to clients. 15 seconds is the vanilla rate. Lower values cause more lag.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 15f), Array.Empty<object>()));
CitadelGloomWaitTime = ((BaseUnityPlugin)this).Config.Bind<float>("Citadel", "CitadelGloomWaitTime", 90f, new ConfigDescription("How long the gloom fog waits when the Citadel loads before starting to rise.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3600f), Array.Empty<object>()));
CitadelGloomSpeedMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Citadel", "CitadelGloomSpeedMultiplier", 2f, new ConfigDescription("Multiplies the speed of the Citadel fog. 1.0 is normal speed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-10f, 10f), Array.Empty<object>()));
CitadelGloomUpdateRate = ((BaseUnityPlugin)this).Config.Bind<float>("Citadel", "CitadelGloomUpdateRate", 0.1f, new ConfigDescription("Seconds between updating Citadel fog speed to clients. 15 seconds is the vanilla rate. Lower values cause more lag.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 15f), Array.Empty<object>()));
NadirSoulWaitTime = ((BaseUnityPlugin)this).Config.Bind<float>("Nadir", "NadirSoulWaitTime", 90f, new ConfigDescription("How long the souls wait when Nadir loads before starting to rise.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3600f), Array.Empty<object>()));
NadirSoulSpeedMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Nadir", "NadirSoulSpeedMultiplier", 2f, new ConfigDescription("Multiplies the speed of the rising souls. 1.0 is normal speed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-10f, 10f), Array.Empty<object>()));
NadirSoulUpdateRate = ((BaseUnityPlugin)this).Config.Bind<float>("Nadir", "NadirSoulUpdateRate", 0.1f, new ConfigDescription("Seconds between updating rising souls speed to clients. 15 seconds is the vanilla rate. Lower values cause more lag.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 15f), Array.Empty<object>()));
}
}
namespace BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}