using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace EcologicalEnableControl
{
[BepInPlugin("com.github.Thanks.EcologicalEnableControl", "PEAK Ecology Director", "1.2.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public sealed class Plugin : BaseUnityPlugin, IInRoomCallbacks
{
internal enum ConfigKey
{
WindStormTiming,
WindForceApplication,
FogStateUpdate,
FogMovement,
LavaStartWaiting,
LavaRiseUpdate,
TornadoUpdateLoop,
TornadoSpawnCall,
BeehiveBeeSpawn,
MushroomSpawnerObject,
MushroomSpawnCall,
NetworkedSpawnerUpdateLoop,
NetworkedSpawnCall
}
[CompilerGenerated]
private sealed class <GetAliasDefinitions>d__84 : IEnumerable<ConfigDefinition>, IEnumerable, IEnumerator<ConfigDefinition>, IDisposable, IEnumerator
{
private int <>1__state;
private ConfigDefinition <>2__current;
private int <>l__initialThreadId;
private ConfigKey configKey;
public ConfigKey <>3__configKey;
private string <englishSection>5__2;
private string <chineseSection>5__3;
private string <englishKey>5__4;
private string <chineseKey>5__5;
private IEnumerator<string> <>7__wrap5;
private string <legacyKey>5__7;
ConfigDefinition IEnumerator<ConfigDefinition>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <GetAliasDefinitions>d__84(int <>1__state)
{
this.<>1__state = <>1__state;
<>l__initialThreadId = Environment.CurrentManagedThreadId;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
int num = <>1__state;
if (num == -3 || (uint)(num - 5) <= 1u)
{
try
{
}
finally
{
<>m__Finally1();
}
}
<englishSection>5__2 = null;
<chineseSection>5__3 = null;
<englishKey>5__4 = null;
<chineseKey>5__5 = null;
<>7__wrap5 = null;
<legacyKey>5__7 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Expected O, but got Unknown
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Expected O, but got Unknown
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Expected O, but got Unknown
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Expected O, but got Unknown
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Expected O, but got Unknown
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Expected O, but got Unknown
try
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<englishSection>5__2 = GetSectionName(isChineseLanguage: false);
<chineseSection>5__3 = GetSectionName(isChineseLanguage: true);
<englishKey>5__4 = GetKeyName(configKey, isChineseLanguage: false);
<chineseKey>5__5 = GetKeyName(configKey, isChineseLanguage: true);
<>2__current = new ConfigDefinition(<englishSection>5__2, <englishKey>5__4);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>2__current = new ConfigDefinition(<englishSection>5__2, <chineseKey>5__5);
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
<>2__current = new ConfigDefinition(<chineseSection>5__3, <englishKey>5__4);
<>1__state = 3;
return true;
case 3:
<>1__state = -1;
<>2__current = new ConfigDefinition(<chineseSection>5__3, <chineseKey>5__5);
<>1__state = 4;
return true;
case 4:
<>1__state = -1;
<>7__wrap5 = GetLegacyKeyAliases(configKey).GetEnumerator();
<>1__state = -3;
break;
case 5:
<>1__state = -3;
<>2__current = new ConfigDefinition(<chineseSection>5__3, <legacyKey>5__7);
<>1__state = 6;
return true;
case 6:
<>1__state = -3;
<legacyKey>5__7 = null;
break;
}
if (<>7__wrap5.MoveNext())
{
<legacyKey>5__7 = <>7__wrap5.Current;
<>2__current = new ConfigDefinition(<englishSection>5__2, <legacyKey>5__7);
<>1__state = 5;
return true;
}
<>m__Finally1();
<>7__wrap5 = null;
return false;
}
catch
{
//try-fault
((IDisposable)this).Dispose();
throw;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
private void <>m__Finally1()
{
<>1__state = -1;
if (<>7__wrap5 != null)
{
<>7__wrap5.Dispose();
}
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
[DebuggerHidden]
IEnumerator<ConfigDefinition> IEnumerable<ConfigDefinition>.GetEnumerator()
{
<GetAliasDefinitions>d__84 <GetAliasDefinitions>d__;
if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
{
<>1__state = 0;
<GetAliasDefinitions>d__ = this;
}
else
{
<GetAliasDefinitions>d__ = new <GetAliasDefinitions>d__84(0);
}
<GetAliasDefinitions>d__.configKey = <>3__configKey;
return <GetAliasDefinitions>d__;
}
[DebuggerHidden]
IEnumerator IEnumerable.GetEnumerator()
{
return ((IEnumerable<ConfigDefinition>)this).GetEnumerator();
}
}
[CompilerGenerated]
private sealed class <GetAllConfigEntries>d__72 : IEnumerable<ConfigEntry<bool>>, IEnumerable, IEnumerator<ConfigEntry<bool>>, IDisposable, IEnumerator
{
private int <>1__state;
private ConfigEntry<bool> <>2__current;
private int <>l__initialThreadId;
ConfigEntry<bool> IEnumerator<ConfigEntry<bool>>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <GetAllConfigEntries>d__72(int <>1__state)
{
this.<>1__state = <>1__state;
<>l__initialThreadId = Environment.CurrentManagedThreadId;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = EnableWindStormTiming;
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>2__current = EnableWindForceApplication;
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
<>2__current = EnableFogStateUpdate;
<>1__state = 3;
return true;
case 3:
<>1__state = -1;
<>2__current = EnableFogMovement;
<>1__state = 4;
return true;
case 4:
<>1__state = -1;
<>2__current = EnableLavaStartWaiting;
<>1__state = 5;
return true;
case 5:
<>1__state = -1;
<>2__current = EnableLavaRiseUpdate;
<>1__state = 6;
return true;
case 6:
<>1__state = -1;
<>2__current = EnableTornadoUpdateLoop;
<>1__state = 7;
return true;
case 7:
<>1__state = -1;
<>2__current = EnableTornadoSpawnCall;
<>1__state = 8;
return true;
case 8:
<>1__state = -1;
<>2__current = EnableBeehiveBeeSpawn;
<>1__state = 9;
return true;
case 9:
<>1__state = -1;
<>2__current = EnableMushroomSpawnerObject;
<>1__state = 10;
return true;
case 10:
<>1__state = -1;
<>2__current = EnableMushroomSpawnCall;
<>1__state = 11;
return true;
case 11:
<>1__state = -1;
<>2__current = EnableNetworkedSpawnerUpdateLoop;
<>1__state = 12;
return true;
case 12:
<>1__state = -1;
<>2__current = EnableNetworkedSpawnCall;
<>1__state = 13;
return true;
case 13:
<>1__state = -1;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
[DebuggerHidden]
IEnumerator<ConfigEntry<bool>> IEnumerable<ConfigEntry<bool>>.GetEnumerator()
{
if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
{
<>1__state = 0;
return this;
}
return new <GetAllConfigEntries>d__72(0);
}
[DebuggerHidden]
IEnumerator IEnumerable.GetEnumerator()
{
return ((IEnumerable<ConfigEntry<bool>>)this).GetEnumerator();
}
}
[CompilerGenerated]
private sealed class <GetLegacyKeyAliases>d__85 : IEnumerable<string>, IEnumerable, IEnumerator<string>, IDisposable, IEnumerator
{
private int <>1__state;
private string <>2__current;
private int <>l__initialThreadId;
private ConfigKey configKey;
public ConfigKey <>3__configKey;
string IEnumerator<string>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <GetLegacyKeyAliases>d__85(int <>1__state)
{
this.<>1__state = <>1__state;
<>l__initialThreadId = Environment.CurrentManagedThreadId;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
switch (configKey)
{
case ConfigKey.WindStormTiming:
case ConfigKey.WindForceApplication:
<>2__current = "Wind Storm Timing";
<>1__state = 1;
return true;
case ConfigKey.FogStateUpdate:
case ConfigKey.FogMovement:
<>2__current = "Fog State Update";
<>1__state = 7;
return true;
case ConfigKey.LavaStartWaiting:
case ConfigKey.LavaRiseUpdate:
<>2__current = "Lava Start Waiting";
<>1__state = 13;
return true;
case ConfigKey.TornadoUpdateLoop:
case ConfigKey.TornadoSpawnCall:
<>2__current = "Tornado Update Loop";
<>1__state = 19;
return true;
case ConfigKey.BeehiveBeeSpawn:
<>2__current = "Beehive Bee Spawn";
<>1__state = 27;
return true;
case ConfigKey.MushroomSpawnerObject:
case ConfigKey.MushroomSpawnCall:
<>2__current = "Mushroom Spawner Object";
<>1__state = 31;
return true;
case ConfigKey.NetworkedSpawnerUpdateLoop:
case ConfigKey.NetworkedSpawnCall:
<>2__current = "Networked Spawner Update Loop";
<>1__state = 37;
return true;
}
break;
case 1:
<>1__state = -1;
<>2__current = "Wind Force Application";
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
<>2__current = "风暴计时逻辑";
<>1__state = 3;
return true;
case 3:
<>1__state = -1;
<>2__current = "风力效果应用";
<>1__state = 4;
return true;
case 4:
<>1__state = -1;
<>2__current = "Wind Chill Zone";
<>1__state = 5;
return true;
case 5:
<>1__state = -1;
<>2__current = "风暴风区";
<>1__state = 6;
return true;
case 6:
<>1__state = -1;
break;
case 7:
<>1__state = -1;
<>2__current = "Fog Movement";
<>1__state = 8;
return true;
case 8:
<>1__state = -1;
<>2__current = "迷雾状态更新";
<>1__state = 9;
return true;
case 9:
<>1__state = -1;
<>2__current = "迷雾移动逻辑";
<>1__state = 10;
return true;
case 10:
<>1__state = -1;
<>2__current = "Orb Fog Handler";
<>1__state = 11;
return true;
case 11:
<>1__state = -1;
<>2__current = "迷雾推进";
<>1__state = 12;
return true;
case 12:
<>1__state = -1;
break;
case 13:
<>1__state = -1;
<>2__current = "Lava Rise Update";
<>1__state = 14;
return true;
case 14:
<>1__state = -1;
<>2__current = "熔岩启动等待";
<>1__state = 15;
return true;
case 15:
<>1__state = -1;
<>2__current = "熔岩上升更新";
<>1__state = 16;
return true;
case 16:
<>1__state = -1;
<>2__current = "Lava Rising";
<>1__state = 17;
return true;
case 17:
<>1__state = -1;
<>2__current = "熔岩上升";
<>1__state = 18;
return true;
case 18:
<>1__state = -1;
break;
case 19:
<>1__state = -1;
<>2__current = "Tornado Spawn Call";
<>1__state = 20;
return true;
case 20:
<>1__state = -1;
<>2__current = "龙卷风更新循环";
<>1__state = 21;
return true;
case 21:
<>1__state = -1;
<>2__current = "龙卷风生成调用";
<>1__state = 22;
return true;
case 22:
<>1__state = -1;
<>2__current = "Tornado Spawner";
<>1__state = 23;
return true;
case 23:
<>1__state = -1;
<>2__current = "Tornado Enable";
<>1__state = 24;
return true;
case 24:
<>1__state = -1;
<>2__current = "龙卷风生成器";
<>1__state = 25;
return true;
case 25:
<>1__state = -1;
<>2__current = "龙卷风开关";
<>1__state = 26;
return true;
case 26:
<>1__state = -1;
break;
case 27:
<>1__state = -1;
<>2__current = "蜂巢蜂群生成";
<>1__state = 28;
return true;
case 28:
<>1__state = -1;
<>2__current = "Beehive";
<>1__state = 29;
return true;
case 29:
<>1__state = -1;
<>2__current = "蜂巢蜂群";
<>1__state = 30;
return true;
case 30:
<>1__state = -1;
break;
case 31:
<>1__state = -1;
<>2__current = "Mushroom Spawn Call";
<>1__state = 32;
return true;
case 32:
<>1__state = -1;
<>2__current = "蘑菇僵尸刷怪点对象";
<>1__state = 33;
return true;
case 33:
<>1__state = -1;
<>2__current = "蘑菇僵尸生成调用";
<>1__state = 34;
return true;
case 34:
<>1__state = -1;
<>2__current = "Mushroom Zombie Spawner";
<>1__state = 35;
return true;
case 35:
<>1__state = -1;
<>2__current = "蘑菇僵尸刷怪点";
<>1__state = 36;
return true;
case 36:
<>1__state = -1;
break;
case 37:
<>1__state = -1;
<>2__current = "Networked Spawn Call";
<>1__state = 38;
return true;
case 38:
<>1__state = -1;
<>2__current = "网络对象更新循环";
<>1__state = 39;
return true;
case 39:
<>1__state = -1;
<>2__current = "网络对象生成调用";
<>1__state = 40;
return true;
case 40:
<>1__state = -1;
<>2__current = "Networked Object Spawner";
<>1__state = 41;
return true;
case 41:
<>1__state = -1;
<>2__current = "网络对象生成器";
<>1__state = 42;
return true;
case 42:
<>1__state = -1;
break;
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
[DebuggerHidden]
IEnumerator<string> IEnumerable<string>.GetEnumerator()
{
<GetLegacyKeyAliases>d__85 <GetLegacyKeyAliases>d__;
if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
{
<>1__state = 0;
<GetLegacyKeyAliases>d__ = this;
}
else
{
<GetLegacyKeyAliases>d__ = new <GetLegacyKeyAliases>d__85(0);
}
<GetLegacyKeyAliases>d__.configKey = <>3__configKey;
return <GetLegacyKeyAliases>d__;
}
[DebuggerHidden]
IEnumerator IEnumerable.GetEnumerator()
{
return ((IEnumerable<string>)this).GetEnumerator();
}
}
public const string PluginGuid = "com.github.Thanks.EcologicalEnableControl";
public const string PluginName = "PEAK Ecology Director";
public const string PluginVersion = "1.2.0";
private const int SimplifiedChineseLanguageIndex = 9;
private const string SyncedFeatureMaskRoomProperty = "EED.FeatureMask";
private static readonly BindingFlags InstanceBindingFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
private static Plugin _instance;
private Harmony _harmony;
private bool _roomConfigDirty = true;
private float _runtimeSyncTimer;
private int? _cachedRoomFeatureMask;
internal static ConfigEntry<bool> EnableWindStormTiming { get; private set; }
internal static ConfigEntry<bool> EnableWindForceApplication { get; private set; }
internal static ConfigEntry<bool> EnableFogStateUpdate { get; private set; }
internal static ConfigEntry<bool> EnableFogMovement { get; private set; }
internal static ConfigEntry<bool> EnableLavaStartWaiting { get; private set; }
internal static ConfigEntry<bool> EnableLavaRiseUpdate { get; private set; }
internal static ConfigEntry<bool> EnableTornadoUpdateLoop { get; private set; }
internal static ConfigEntry<bool> EnableTornadoSpawnCall { get; private set; }
internal static ConfigEntry<bool> EnableBeehiveBeeSpawn { get; private set; }
internal static ConfigEntry<bool> EnableMushroomSpawnerObject { get; private set; }
internal static ConfigEntry<bool> EnableMushroomSpawnCall { get; private set; }
internal static ConfigEntry<bool> EnableNetworkedSpawnerUpdateLoop { get; private set; }
internal static ConfigEntry<bool> EnableNetworkedSpawnCall { get; private set; }
private void Awake()
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
_instance = this;
bool isChineseLanguage = DetectChineseLanguage();
InitializeConfig(isChineseLanguage);
RegisterConfigChangeHandlers();
_harmony = new Harmony("com.github.Thanks.EcologicalEnableControl");
_harmony.PatchAll();
PhotonNetwork.AddCallbackTarget((object)this);
RefreshRoomFeatureMask();
ModConfigBridge.TryRegister(((BaseUnityPlugin)this).Config, ((BaseUnityPlugin)this).Logger, BuildModConfigUiLocalizationMap(isChineseLanguage));
((BaseUnityPlugin)this).Logger.LogInfo((object)"[PEAK Ecology Director] 1.2.0 loaded.");
}
private void Update()
{
if (PhotonNetwork.InRoom && !_cachedRoomFeatureMask.HasValue)
{
RefreshRoomFeatureMask();
}
if (PhotonNetwork.InRoom && PhotonNetwork.IsMasterClient)
{
if (_roomConfigDirty)
{
PublishRoomConfig();
}
_runtimeSyncTimer += Time.deltaTime;
if (!(_runtimeSyncTimer < 1f))
{
_runtimeSyncTimer = 0f;
RuntimeSyncRoomState();
}
}
}
private void OnDestroy()
{
PhotonNetwork.RemoveCallbackTarget((object)this);
UnregisterConfigChangeHandlers();
Harmony harmony = _harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
if ((Object)(object)_instance == (Object)(object)this)
{
_instance = null;
}
}
private void InitializeConfig(bool isChineseLanguage)
{
string sectionName = GetSectionName(isChineseLanguage);
EnableWindStormTiming = BindToggle(sectionName, ConfigKey.WindStormTiming, isChineseLanguage);
EnableWindForceApplication = BindToggle(sectionName, ConfigKey.WindForceApplication, isChineseLanguage);
EnableFogStateUpdate = BindToggle(sectionName, ConfigKey.FogStateUpdate, isChineseLanguage);
EnableFogMovement = BindToggle(sectionName, ConfigKey.FogMovement, isChineseLanguage);
EnableLavaStartWaiting = BindToggle(sectionName, ConfigKey.LavaStartWaiting, isChineseLanguage);
EnableLavaRiseUpdate = BindToggle(sectionName, ConfigKey.LavaRiseUpdate, isChineseLanguage);
EnableTornadoUpdateLoop = BindToggle(sectionName, ConfigKey.TornadoUpdateLoop, isChineseLanguage);
EnableTornadoSpawnCall = BindToggle(sectionName, ConfigKey.TornadoSpawnCall, isChineseLanguage);
EnableBeehiveBeeSpawn = BindToggle(sectionName, ConfigKey.BeehiveBeeSpawn, isChineseLanguage);
EnableMushroomSpawnerObject = BindToggle(sectionName, ConfigKey.MushroomSpawnerObject, isChineseLanguage);
EnableMushroomSpawnCall = BindToggle(sectionName, ConfigKey.MushroomSpawnCall, isChineseLanguage);
EnableNetworkedSpawnerUpdateLoop = BindToggle(sectionName, ConfigKey.NetworkedSpawnerUpdateLoop, isChineseLanguage);
EnableNetworkedSpawnCall = BindToggle(sectionName, ConfigKey.NetworkedSpawnCall, isChineseLanguage);
MigrateLocalizedConfigEntries();
}
private ConfigEntry<bool> BindToggle(string sectionName, ConfigKey configKey, bool isChineseLanguage)
{
return ((BaseUnityPlugin)this).Config.Bind<bool>(sectionName, GetKeyName(configKey, isChineseLanguage), true, GetLocalizedDescription(configKey, isChineseLanguage));
}
private void RegisterConfigChangeHandlers()
{
foreach (ConfigEntry<bool> allConfigEntry in GetAllConfigEntries())
{
allConfigEntry.SettingChanged += OnFeatureConfigChanged;
}
}
private void UnregisterConfigChangeHandlers()
{
foreach (ConfigEntry<bool> allConfigEntry in GetAllConfigEntries())
{
if (allConfigEntry != null)
{
allConfigEntry.SettingChanged -= OnFeatureConfigChanged;
}
}
}
private void OnFeatureConfigChanged(object sender, EventArgs args)
{
_roomConfigDirty = true;
RuntimeSyncRoomState();
}
[IteratorStateMachine(typeof(<GetAllConfigEntries>d__72))]
private IEnumerable<ConfigEntry<bool>> GetAllConfigEntries()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <GetAllConfigEntries>d__72(-2);
}
private void PublishRoomConfig()
{
//IL_001d: 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_0036: Expected O, but got Unknown
if (PhotonNetwork.InRoom && PhotonNetwork.CurrentRoom != null && PhotonNetwork.IsMasterClient)
{
int num = BuildLocalFeatureMask();
Hashtable val = new Hashtable { [(object)"EED.FeatureMask"] = num };
if (PhotonNetwork.CurrentRoom.SetCustomProperties(val, (Hashtable)null, (WebFlags)null))
{
_cachedRoomFeatureMask = num;
_roomConfigDirty = false;
}
}
}
private int BuildLocalFeatureMask()
{
int num = 0;
foreach (ConfigKey value in Enum.GetValues(typeof(ConfigKey)))
{
if (GetLocalConfigEntry(value).Value)
{
num |= 1 << (int)value;
}
}
return num;
}
private static ConfigEntry<bool> GetLocalConfigEntry(ConfigKey configKey)
{
return (ConfigEntry<bool>)(configKey switch
{
ConfigKey.WindStormTiming => EnableWindStormTiming,
ConfigKey.WindForceApplication => EnableWindForceApplication,
ConfigKey.FogStateUpdate => EnableFogStateUpdate,
ConfigKey.FogMovement => EnableFogMovement,
ConfigKey.LavaStartWaiting => EnableLavaStartWaiting,
ConfigKey.LavaRiseUpdate => EnableLavaRiseUpdate,
ConfigKey.TornadoUpdateLoop => EnableTornadoUpdateLoop,
ConfigKey.TornadoSpawnCall => EnableTornadoSpawnCall,
ConfigKey.BeehiveBeeSpawn => EnableBeehiveBeeSpawn,
ConfigKey.MushroomSpawnerObject => EnableMushroomSpawnerObject,
ConfigKey.MushroomSpawnCall => EnableMushroomSpawnCall,
ConfigKey.NetworkedSpawnerUpdateLoop => EnableNetworkedSpawnerUpdateLoop,
ConfigKey.NetworkedSpawnCall => EnableNetworkedSpawnCall,
_ => null,
});
}
private void RefreshRoomFeatureMask()
{
object value;
if (PhotonNetwork.CurrentRoom == null || ((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties == null)
{
_cachedRoomFeatureMask = null;
}
else if (((Dictionary<object, object>)(object)((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties).TryGetValue((object)"EED.FeatureMask", out value))
{
_cachedRoomFeatureMask = Convert.ToInt32(value, CultureInfo.InvariantCulture);
}
else
{
_cachedRoomFeatureMask = null;
}
}
private bool TryGetRoomFeatureMask(out int featureMask)
{
if (_cachedRoomFeatureMask.HasValue)
{
featureMask = _cachedRoomFeatureMask.Value;
return true;
}
featureMask = 0;
return false;
}
private static void RuntimeSyncRoomState()
{
if (PhotonNetwork.InRoom && PhotonNetwork.IsMasterClient)
{
SyncWindState();
SyncFogState();
SyncLavaState();
}
}
private static void SyncWindState()
{
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
if (EnableWindStormTiming.Value && EnableWindForceApplication.Value)
{
return;
}
WindChillZone instance = WindChillZone.instance;
if (!((Object)(object)instance == (Object)null))
{
instance.windActive = false;
instance.StormProgress = 0f;
instance.timeUntilStorm = 0f;
instance.windPlayerFactor = 0f;
Traverse obj = Traverse.Create((object)instance);
obj.Field("hasBeenActiveFor").SetValue((object)0f);
obj.Field("currentForceMult").SetValue((object)0f);
PhotonView component = ((Component)instance).GetComponent<PhotonView>();
if (component != null)
{
component.RPC("RPCA_ToggleWind", (RpcTarget)0, new object[3]
{
false,
Vector3.zero,
9999f
});
}
}
}
private static void SyncFogState()
{
if (EnableFogStateUpdate.Value && EnableFogMovement.Value)
{
return;
}
OrbFogHandler val = Object.FindAnyObjectByType<OrbFogHandler>();
if (!((Object)(object)val == (Object)null))
{
float num = (val.currentSize = (EnableFogStateUpdate.Value ? val.currentSize : 800f));
val.isMoving = false;
val.hasArrived = true;
PhotonView component = ((Component)val).GetComponent<PhotonView>();
if (component != null)
{
component.RPC("RPC_InitFog", (RpcTarget)0, new object[4] { val.currentID, num, true, false });
}
}
}
private static void SyncLavaState()
{
if (!EnableLavaStartWaiting.Value || !EnableLavaRiseUpdate.Value)
{
LavaRising val = Object.FindAnyObjectByType<LavaRising>();
if ((Object)(object)val != (Object)null)
{
val.started = false;
val.ended = false;
val.secondsWaitedToStart = 0f;
val.timeTraveled = 0f;
}
GameUtils instance = GameUtils.instance;
if (instance != null)
{
instance.SyncLava(false, false, 0f, 0f);
}
}
}
private void MigrateLocalizedConfigEntries()
{
IDictionary orphanedEntries = GetOrphanedEntries(((BaseUnityPlugin)this).Config);
if (orphanedEntries == null || orphanedEntries.Count == 0)
{
return;
}
bool flag = false;
foreach (ConfigKey value in Enum.GetValues(typeof(ConfigKey)))
{
flag |= TryMigrateLocalizedConfigValue((ConfigEntryBase)(object)GetLocalConfigEntry(value), value, orphanedEntries);
}
if (flag)
{
((BaseUnityPlugin)this).Config.Save();
}
}
private static bool TryMigrateLocalizedConfigValue(ConfigEntryBase entry, ConfigKey configKey, IDictionary orphanedEntries)
{
if (((entry != null) ? entry.Definition : null) == (ConfigDefinition)null || orphanedEntries == null)
{
return false;
}
foreach (ConfigDefinition aliasDefinition in GetAliasDefinitions(configKey))
{
if (!DefinitionsEqual(aliasDefinition, entry.Definition) && orphanedEntries.Contains(aliasDefinition))
{
object obj = orphanedEntries[aliasDefinition];
if (obj != null)
{
entry.SetSerializedValue(obj.ToString());
}
orphanedEntries.Remove(aliasDefinition);
return true;
}
}
return false;
}
[IteratorStateMachine(typeof(<GetAliasDefinitions>d__84))]
private static IEnumerable<ConfigDefinition> GetAliasDefinitions(ConfigKey configKey)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <GetAliasDefinitions>d__84(-2)
{
<>3__configKey = configKey
};
}
[IteratorStateMachine(typeof(<GetLegacyKeyAliases>d__85))]
private static IEnumerable<string> GetLegacyKeyAliases(ConfigKey configKey)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <GetLegacyKeyAliases>d__85(-2)
{
<>3__configKey = configKey
};
}
private static IDictionary GetOrphanedEntries(ConfigFile configFile)
{
return ((object)configFile)?.GetType().GetProperty("OrphanedEntries", InstanceBindingFlags)?.GetValue(configFile) as IDictionary;
}
private static bool DefinitionsEqual(ConfigDefinition left, ConfigDefinition right)
{
if (string.Equals((left != null) ? left.Section : null, (right != null) ? right.Section : null, StringComparison.Ordinal))
{
return string.Equals((left != null) ? left.Key : null, (right != null) ? right.Key : null, StringComparison.Ordinal);
}
return false;
}
internal static bool IsHost()
{
if (!PhotonNetwork.InRoom)
{
return true;
}
return PhotonNetwork.IsMasterClient;
}
internal static bool IsFeatureEnabled(ConfigEntry<bool> configEntry, ConfigKey configKey)
{
if (!PhotonNetwork.InRoom || IsHost())
{
return configEntry?.Value ?? true;
}
if ((Object)(object)_instance != (Object)null && _instance.TryGetRoomFeatureMask(out var featureMask))
{
return (featureMask & (1 << (int)configKey)) != 0;
}
return configEntry?.Value ?? true;
}
internal static void LogDebug(string message)
{
Plugin instance = _instance;
if (instance != null)
{
((BaseUnityPlugin)instance).Logger.LogDebug((object)message);
}
}
internal static void LogInfo(string message)
{
Plugin instance = _instance;
if (instance != null)
{
((BaseUnityPlugin)instance).Logger.LogInfo((object)message);
}
}
private static bool DetectChineseLanguage()
{
if (TryGetConfiguredGameLanguage(out var isChineseLanguage))
{
return isChineseLanguage;
}
if (TryGetLocalizedTextLanguageName(out var languageName))
{
return IsChineseLanguageName(languageName);
}
return false;
}
private static bool TryGetConfiguredGameLanguage(out bool isChineseLanguage)
{
isChineseLanguage = false;
try
{
if (!PlayerPrefs.HasKey("LanguageSetting"))
{
return false;
}
int result = PlayerPrefs.GetInt("LanguageSetting", int.MinValue);
if (result != int.MinValue)
{
isChineseLanguage = result == 9;
return true;
}
string @string = PlayerPrefs.GetString("LanguageSetting", string.Empty);
if (string.IsNullOrWhiteSpace(@string))
{
return false;
}
if (int.TryParse(@string, NumberStyles.Integer, CultureInfo.InvariantCulture, out result))
{
isChineseLanguage = result == 9;
return true;
}
isChineseLanguage = IsChineseLanguageName(@string);
return true;
}
catch
{
return false;
}
}
private static bool TryGetLocalizedTextLanguageName(out string languageName)
{
languageName = string.Empty;
try
{
languageName = ((object)(Language)(ref LocalizedText.CURRENT_LANGUAGE)).ToString();
return !string.IsNullOrWhiteSpace(languageName);
}
catch
{
return false;
}
}
private static bool IsChineseLanguageName(string languageName)
{
if (string.IsNullOrWhiteSpace(languageName))
{
return false;
}
if (languageName.IndexOf("Chinese", StringComparison.OrdinalIgnoreCase) < 0 && languageName.IndexOf("中文", StringComparison.OrdinalIgnoreCase) < 0)
{
return languageName.StartsWith("zh", StringComparison.OrdinalIgnoreCase);
}
return true;
}
private static string GetSectionName(bool isChineseLanguage)
{
if (!isChineseLanguage)
{
return "Ecology Control";
}
return "生态控制";
}
internal static string GetLocalizedModDisplayName(bool isChineseLanguage)
{
if (!isChineseLanguage)
{
return "PEAK Ecology Director";
}
return "PEAK生态总控";
}
private static string GetKeyName(ConfigKey configKey, bool isChineseLanguage)
{
return configKey switch
{
ConfigKey.WindStormTiming => isChineseLanguage ? "允许风暴来袭" : "Allow Storm Cycles",
ConfigKey.WindForceApplication => isChineseLanguage ? "允许强风吹动玩家和物品" : "Allow Strong Wind Force",
ConfigKey.FogStateUpdate => isChineseLanguage ? "允许迷雾继续逼近" : "Allow Fog Pressure",
ConfigKey.FogMovement => isChineseLanguage ? "允许迷雾开始移动" : "Allow Fog Movement",
ConfigKey.LavaStartWaiting => isChineseLanguage ? "允许熔岩倒计时开始" : "Allow Lava Countdown",
ConfigKey.LavaRiseUpdate => isChineseLanguage ? "允许熔岩持续上升" : "Allow Lava Rise",
ConfigKey.TornadoUpdateLoop => isChineseLanguage ? "允许龙卷风进入刷新检查" : "Allow Tornado Checks",
ConfigKey.TornadoSpawnCall => isChineseLanguage ? "允许生成龙卷风" : "Allow Tornado Spawns",
ConfigKey.BeehiveBeeSpawn => isChineseLanguage ? "允许蜂巢放出蜂群" : "Allow Bee Swarms",
ConfigKey.MushroomSpawnerObject => isChineseLanguage ? "保留蘑菇僵尸刷怪点" : "Keep Mushroom Zombie Spawners",
ConfigKey.MushroomSpawnCall => isChineseLanguage ? "允许蘑菇僵尸实际刷出" : "Allow Mushroom Zombie Spawns",
ConfigKey.NetworkedSpawnerUpdateLoop => isChineseLanguage ? "允许环境物体进行刷新检查" : "Allow World Spawn Checks",
ConfigKey.NetworkedSpawnCall => isChineseLanguage ? "允许环境物体实际生成" : "Allow World Object Spawns",
_ => string.Empty,
};
}
private static string GetLocalizedDescription(ConfigKey configKey, bool isChineseLanguage)
{
return configKey switch
{
ConfigKey.WindStormTiming => isChineseLanguage ? "决定这张地图里会不会正常进入风暴循环。关闭后,风暴不会开始蓄势、不会进入爆发阶段,界面上相关进度也会停住。适合想保留地图本身、但不想被风暴节奏打断的时候。" : "Decides whether storm cycles can happen at all. Turn this off to stop storms from charging up, triggering, or progressing.",
ConfigKey.WindForceApplication => isChineseLanguage ? "决定强风会不会真的把人和物品吹动。关闭后,就算地图里还有风暴区域,也不会再把玩家吹偏、推走,地上的物品也不会因为强风乱飞。适合只想关掉烦人的物理影响。" : "Decides whether strong wind actually pushes players and loose items around. Turn this off to remove the annoying physics effect while keeping the rest of the area intact.",
ConfigKey.FogStateUpdate => isChineseLanguage ? "决定迷雾压迫机制是否继续推进。关闭后,迷雾会被强制停在一个安全状态,不再继续把地图后方吞掉。适合想保留场景氛围,但不想被迷雾逼着赶路。" : "Decides whether the fog pressure system keeps advancing. Turn this off to freeze fog in a safe state so it stops swallowing older parts of the map.",
ConfigKey.FogMovement => isChineseLanguage ? "决定迷雾会不会真正开始移动。关闭后,即使迷雾系统已经存在,也不会触发前推、追赶玩家或继续扩散。这个开关更适合想彻底锁住迷雾位置。" : "Decides whether the fog is allowed to start moving. Turn this off to lock the fog in place even if the system still exists in the level.",
ConfigKey.LavaStartWaiting => isChineseLanguage ? "决定熔岩事件会不会开始读秒。关闭后,熔岩不会进入准备阶段,也就不会走到后面的上升流程。适合想完全取消这一整段危险事件。" : "Decides whether the lava event is allowed to start its countdown. Turn this off if you want to cancel the whole event before it even begins.",
ConfigKey.LavaRiseUpdate => isChineseLanguage ? "决定熔岩会不会继续往上升。关闭后,已经开始的熔岩也会被重置,不再持续抬高地形危险区。适合中途把局势拉回安全状态。" : "Decides whether lava is allowed to keep rising. Turn this off to reset an active lava event and stop it from climbing higher.",
ConfigKey.TornadoUpdateLoop => isChineseLanguage ? "决定龙卷风系统会不会继续做刷新检查。关闭后,地图不会再周期性考虑要不要刷出新的龙卷风。适合长期关闭龙卷风机制。" : "Decides whether the tornado system keeps checking for new spawns. Turn this off to stop the map from periodically preparing tornado events.",
ConfigKey.TornadoSpawnCall => isChineseLanguage ? "决定龙卷风会不会真的刷出来。关闭后,即使前面的检查还在跑,也不会把龙卷风实体生出来。适合只拦截最终结果。" : "Decides whether a tornado is actually created. Turn this off if you only want to block the final spawn result.",
ConfigKey.BeehiveBeeSpawn => isChineseLanguage ? "决定蜂巢被初始化时,会不会放出会追人的蜂群。关闭后,蜂巢还能留在场景里,但不会再变成主动威胁。适合保留地图元素、去掉烦人的追击。" : "Decides whether beehives release hostile bee swarms when they initialize. Turn this off to keep the hive in the scene without the chase threat.",
ConfigKey.MushroomSpawnerObject => isChineseLanguage ? "决定蘑菇僵尸刷怪点本身要不要留在地图里。关闭后,刷怪点会在开局直接移除,相当于从源头上把这类威胁删掉。适合想要最干净的处理方式。" : "Decides whether mushroom zombie spawner objects stay in the map at all. Turn this off to remove the spawners at the source.",
ConfigKey.MushroomSpawnCall => isChineseLanguage ? "决定蘑菇僵尸会不会实际刷出来。关闭后,就算刷怪点对象还在,也不会真的生成怪物。适合想保留布景,但不想看到僵尸。" : "Decides whether mushroom zombies actually spawn. Turn this off if you want to keep the scenery but stop the enemies themselves.",
ConfigKey.NetworkedSpawnerUpdateLoop => isChineseLanguage ? "决定地图里的联网环境生成器会不会继续检查刷新时机。关闭后,这类生成器不会再定时准备生成新的环境物体或危险物。" : "Decides whether networked world spawners keep checking for spawn timing. Turn this off to stop periodic spawn preparation.",
ConfigKey.NetworkedSpawnCall => isChineseLanguage ? "决定联网环境物体会不会真的生成出来。关闭后,就算前面的检查仍然存在,也会把最终生成拦住。适合只屏蔽结果,不动前置流程。" : "Decides whether networked world objects actually appear. Turn this off if you only want to block the final spawn result.",
_ => string.Empty,
};
}
private static Dictionary<string, string> BuildModConfigUiLocalizationMap(bool isChineseLanguage)
{
Dictionary<string, string> dictionary = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
AddUiLocalizationPair(dictionary, GetSectionName(isChineseLanguage: false), GetSectionName(isChineseLanguage));
AddUiLocalizationPair(dictionary, GetSectionName(isChineseLanguage: true), GetSectionName(isChineseLanguage));
foreach (ConfigKey value in Enum.GetValues(typeof(ConfigKey)))
{
AddUiLocalizationPair(dictionary, GetKeyName(value, isChineseLanguage: false), GetKeyName(value, isChineseLanguage));
AddUiLocalizationPair(dictionary, GetKeyName(value, isChineseLanguage: true), GetKeyName(value, isChineseLanguage));
AddUiLocalizationPair(dictionary, GetLocalizedDescription(value, isChineseLanguage: false), GetLocalizedDescription(value, isChineseLanguage));
AddUiLocalizationPair(dictionary, GetLocalizedDescription(value, isChineseLanguage: true), GetLocalizedDescription(value, isChineseLanguage));
}
return dictionary;
}
private static void AddUiLocalizationPair(Dictionary<string, string> map, string englishText, string localizedText)
{
if (!string.IsNullOrWhiteSpace(englishText) && !string.IsNullOrWhiteSpace(localizedText))
{
map[englishText] = localizedText;
}
}
public void OnPlayerEnteredRoom(Player newPlayer)
{
if (PhotonNetwork.IsMasterClient)
{
_roomConfigDirty = true;
}
}
public void OnPlayerLeftRoom(Player otherPlayer)
{
}
public void OnRoomPropertiesUpdate(Hashtable propertiesThatChanged)
{
if (propertiesThatChanged != null && ((Dictionary<object, object>)(object)propertiesThatChanged).ContainsKey((object)"EED.FeatureMask"))
{
RefreshRoomFeatureMask();
}
}
public void OnPlayerPropertiesUpdate(Player targetPlayer, Hashtable changedProps)
{
}
public void OnMasterClientSwitched(Player newMasterClient)
{
RefreshRoomFeatureMask();
_roomConfigDirty = PhotonNetwork.IsMasterClient;
}
}
internal static class ModConfigBridge
{
public static void TryRegister(ConfigFile config, ManualLogSource logger, Dictionary<string, string> localizationMap)
{
try
{
Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "com.github.PEAKModding.PEAKLib.ModConfig");
if (assembly == null)
{
logger.LogInfo((object)"PEAKLib.ModConfig 未加载,保留 BepInEx 本地配置。");
return;
}
Type type = assembly.GetType("PEAKLib.ModConfig.ModConfigPlugin");
if (type == null)
{
logger.LogWarning((object)"未找到 ModConfigPlugin 类型,跳过 ModConfig 集成。");
return;
}
MethodInfo methodInfo = type.GetMethods(BindingFlags.Static | BindingFlags.Public).FirstOrDefault(delegate(MethodInfo method)
{
if (method.Name != "AddToSettingsMenu")
{
return false;
}
ParameterInfo[] parameters2 = method.GetParameters();
return parameters2.Length >= 1 && typeof(ConfigFile).IsAssignableFrom(parameters2[0].ParameterType);
});
if (methodInfo == null)
{
logger.LogWarning((object)"未找到兼容的 AddToSettingsMenu(ConfigFile, ...) 方法,跳过 ModConfig 集成。");
return;
}
ParameterInfo[] parameters = methodInfo.GetParameters();
object[] array = new object[parameters.Length];
array[0] = config;
for (int i = 1; i < parameters.Length; i++)
{
Type parameterType = parameters[i].ParameterType;
if (parameterType == typeof(string))
{
array[i] = "PEAK Ecology Director";
}
else if (parameterType == typeof(bool))
{
array[i] = false;
}
else if (parameterType == typeof(Dictionary<string, string>))
{
array[i] = localizationMap;
}
else if (parameterType.IsValueType)
{
array[i] = Activator.CreateInstance(parameterType);
}
else
{
array[i] = null;
}
}
methodInfo.Invoke(null, array);
logger.LogInfo((object)"已注册到 ModConfig 菜单。");
}
catch (Exception ex)
{
logger.LogWarning((object)("ModConfig 集成失败,继续使用本地配置: " + ex.Message));
}
}
}
internal static class FeatureControl
{
public static bool IsWindStormTimingEnabled => Plugin.IsFeatureEnabled(Plugin.EnableWindStormTiming, Plugin.ConfigKey.WindStormTiming);
public static bool IsWindForceApplicationEnabled => Plugin.IsFeatureEnabled(Plugin.EnableWindForceApplication, Plugin.ConfigKey.WindForceApplication);
public static bool IsFogStateUpdateEnabled => Plugin.IsFeatureEnabled(Plugin.EnableFogStateUpdate, Plugin.ConfigKey.FogStateUpdate);
public static bool IsFogMovementEnabled => Plugin.IsFeatureEnabled(Plugin.EnableFogMovement, Plugin.ConfigKey.FogMovement);
public static bool IsLavaStartWaitingEnabled => Plugin.IsFeatureEnabled(Plugin.EnableLavaStartWaiting, Plugin.ConfigKey.LavaStartWaiting);
public static bool IsLavaRiseUpdateEnabled => Plugin.IsFeatureEnabled(Plugin.EnableLavaRiseUpdate, Plugin.ConfigKey.LavaRiseUpdate);
public static bool IsTornadoUpdateLoopEnabled => Plugin.IsFeatureEnabled(Plugin.EnableTornadoUpdateLoop, Plugin.ConfigKey.TornadoUpdateLoop);
public static bool IsTornadoSpawnCallEnabled => Plugin.IsFeatureEnabled(Plugin.EnableTornadoSpawnCall, Plugin.ConfigKey.TornadoSpawnCall);
public static bool IsBeehiveBeeSpawnEnabled => Plugin.IsFeatureEnabled(Plugin.EnableBeehiveBeeSpawn, Plugin.ConfigKey.BeehiveBeeSpawn);
public static bool IsMushroomSpawnerObjectEnabled => Plugin.IsFeatureEnabled(Plugin.EnableMushroomSpawnerObject, Plugin.ConfigKey.MushroomSpawnerObject);
public static bool IsMushroomSpawnCallEnabled => Plugin.IsFeatureEnabled(Plugin.EnableMushroomSpawnCall, Plugin.ConfigKey.MushroomSpawnCall);
public static bool IsNetworkedSpawnerUpdateLoopEnabled => Plugin.IsFeatureEnabled(Plugin.EnableNetworkedSpawnerUpdateLoop, Plugin.ConfigKey.NetworkedSpawnerUpdateLoop);
public static bool IsNetworkedSpawnCallEnabled => Plugin.IsFeatureEnabled(Plugin.EnableNetworkedSpawnCall, Plugin.ConfigKey.NetworkedSpawnCall);
}
[HarmonyPatch(typeof(WindChillZone), "HandleTime")]
internal static class WindChillZone_HandleTime_Patch
{
private static bool Prefix(WindChillZone __instance)
{
if (FeatureControl.IsWindStormTimingEnabled)
{
return true;
}
__instance.windActive = false;
__instance.StormProgress = 0f;
__instance.timeUntilStorm = 0f;
return false;
}
}
[HarmonyPatch(typeof(WindChillZone), "Update")]
internal static class WindChillZone_Update_Patch
{
private static bool Prefix(WindChillZone __instance)
{
bool isWindStormTimingEnabled = FeatureControl.IsWindStormTimingEnabled;
bool isWindForceApplicationEnabled = FeatureControl.IsWindForceApplicationEnabled;
if (isWindStormTimingEnabled && isWindForceApplicationEnabled)
{
return true;
}
if (!isWindStormTimingEnabled)
{
__instance.windActive = false;
__instance.StormProgress = 0f;
__instance.timeUntilStorm = 0f;
Traverse.Create((object)__instance).Field("hasBeenActiveFor").SetValue((object)0f);
}
if (!isWindForceApplicationEnabled)
{
__instance.windActive = false;
__instance.windPlayerFactor = 0f;
}
return false;
}
}
[HarmonyPatch(typeof(WindChillZone), "FixedUpdate")]
internal static class WindChillZone_FixedUpdate_Patch
{
private static bool Prefix(WindChillZone __instance)
{
if (FeatureControl.IsWindForceApplicationEnabled)
{
return true;
}
Traverse.Create((object)__instance).Field("currentForceMult").SetValue((object)0f);
return false;
}
}
[HarmonyPatch(typeof(OrbFogHandler), "Update")]
internal static class OrbFogHandler_Update_Patch
{
private static bool Prefix(OrbFogHandler __instance)
{
if (FeatureControl.IsFogStateUpdateEnabled)
{
return true;
}
__instance.currentSize = 800f;
__instance.isMoving = false;
__instance.hasArrived = true;
return false;
}
}
[HarmonyPatch(typeof(OrbFogHandler), "WaitToMove")]
internal static class OrbFogHandler_WaitToMove_Patch
{
private static bool Prefix()
{
return FeatureControl.IsFogMovementEnabled;
}
}
[HarmonyPatch(typeof(OrbFogHandler), "Move")]
internal static class OrbFogHandler_Move_Patch
{
private static bool Prefix()
{
return FeatureControl.IsFogMovementEnabled;
}
}
[HarmonyPatch(typeof(OrbFogHandler), "StartMovingRPC")]
internal static class OrbFogHandler_StartMovingRPC_Patch
{
private static bool Prefix()
{
return FeatureControl.IsFogMovementEnabled;
}
}
[HarmonyPatch(typeof(LavaRising), "Update")]
internal static class LavaRising_Update_Patch
{
private static bool Prefix(LavaRising __instance)
{
if (FeatureControl.IsLavaRiseUpdateEnabled)
{
return true;
}
__instance.started = false;
__instance.ended = false;
__instance.secondsWaitedToStart = 0f;
__instance.timeTraveled = 0f;
return false;
}
}
[HarmonyPatch(typeof(LavaRising), "StartWaiting")]
internal static class LavaRising_StartWaiting_Patch
{
private static bool Prefix()
{
return FeatureControl.IsLavaStartWaitingEnabled;
}
}
[HarmonyPatch(typeof(TornadoSpawner), "Update")]
internal static class TornadoSpawner_Update_Patch
{
private static bool Prefix()
{
return FeatureControl.IsTornadoUpdateLoopEnabled;
}
}
[HarmonyPatch(typeof(TornadoSpawner), "SpawnTornado")]
internal static class TornadoSpawner_SpawnTornado_Patch
{
private static bool Prefix()
{
return FeatureControl.IsTornadoSpawnCallEnabled;
}
}
[HarmonyPatch(typeof(MushroomZombieSpawner), "Start")]
internal static class MushroomZombieSpawner_Start_Patch
{
private static bool Prefix(MushroomZombieSpawner __instance)
{
if (FeatureControl.IsMushroomSpawnerObjectEnabled)
{
return true;
}
Object.Destroy((Object)(object)((Component)__instance).gameObject);
return false;
}
}
[HarmonyPatch(typeof(MushroomZombieSpawner), "Spawn")]
internal static class MushroomZombieSpawner_Spawn_Patch
{
private static bool Prefix()
{
return FeatureControl.IsMushroomSpawnCallEnabled;
}
}
[HarmonyPatch(typeof(NetworkedObjectSpawner), "Update")]
internal static class NetworkedObjectSpawner_Update_Patch
{
private static bool Prefix()
{
return FeatureControl.IsNetworkedSpawnerUpdateLoopEnabled;
}
}
[HarmonyPatch(typeof(NetworkedObjectSpawner), "SpawnObject")]
internal static class NetworkedObjectSpawner_SpawnObject_Patch
{
private static bool Prefix()
{
return FeatureControl.IsNetworkedSpawnCallEnabled;
}
}
[HarmonyPatch(typeof(Beehive), "Init")]
internal static class Beehive_Init_Patch
{
private static void Postfix(Beehive __instance)
{
if (!FeatureControl.IsBeehiveBeeSpawnEnabled)
{
__instance.spawnBees = false;
}
}
}
}