Decompiled source of FogRiseSpeedTweaks v1.4.2

youxia173.FogRiseSpeedTweaks.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Peak;
using Photon.Pun;
using Photon.Realtime;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using Zorro.Core;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("youxia173")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.4.2.0")]
[assembly: AssemblyInformationalVersion("1.4.2")]
[assembly: AssemblyProduct("FogRiseSpeedTweaks")]
[assembly: AssemblyTitle("youxia173.FogRiseSpeedTweaks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.4.2.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;
		}
	}
}
namespace FogRiseSpeedTweaks
{
	internal sealed class CampfireLocatorHud
	{
		private RectTransform? _root;

		private RectTransform? _dot;

		private float _dotX;

		private const float Width = 372f;

		private const float Height = 24f;

		private const float TopOffset = 54f;

		private const float LineWidth = 360f;

		private const float DotSize = 18f;

		public CampfireLocatorHud(Plugin plugin)
		{
		}

		public void Cleanup()
		{
			if ((Object)(object)_root != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)_root).gameObject);
			}
			_root = null;
			_dot = null;
			_dotX = 0f;
		}

		public void UpdateUi()
		{
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.FogUiEnabled.Value || !Plugin.CampfireLocatorUiEnabled.Value || !Plugin.ModEnabled.Value)
			{
				SetVisible(visible: false);
				return;
			}
			if (!HudUi.IsGameplayOrAirportScene() || LoadingScreenHandler.loading)
			{
				SetVisible(visible: false);
				return;
			}
			if (!TryGetTarget(out var target) || !IsLocalInFog())
			{
				SetVisible(visible: false);
				return;
			}
			Canvas val = HudUi.ResolveHudCanvas();
			if ((Object)(object)val == (Object)null)
			{
				Cleanup();
				return;
			}
			if ((Object)(object)_root == (Object)null || (Object)(object)((Transform)_root).parent != (Object)(object)((Component)val).transform)
			{
				Create(val);
			}
			if (!((Object)(object)_root == (Object)null) && !((Object)(object)_dot == (Object)null))
			{
				SetVisible(visible: true);
				Layout();
				UpdateDot(target);
			}
		}

		private void Create(Canvas canvas)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: 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_008c: 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_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Expected O, but got Unknown
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			Cleanup();
			GameObject val = new GameObject("FogRiseSpeedTweaks_CampfireLocator", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(((Component)canvas).transform, false);
			val.transform.SetAsLastSibling();
			_root = val.GetComponent<RectTransform>();
			GameObject val2 = new GameObject("Line", new Type[1] { typeof(RectTransform) });
			val2.transform.SetParent((Transform)(object)_root, false);
			val2.GetComponent<RectTransform>().sizeDelta = new Vector2(360f, 2f);
			Image obj = val2.AddComponent<Image>();
			obj.sprite = HudUi.WhiteSprite();
			((Graphic)obj).color = new Color(1f, 1f, 1f, 0.95f);
			((Graphic)obj).raycastTarget = false;
			GameObject val3 = new GameObject("Dot", new Type[1] { typeof(RectTransform) });
			val3.transform.SetParent((Transform)(object)_root, false);
			_dot = val3.GetComponent<RectTransform>();
			_dot.sizeDelta = new Vector2(18f, 18f);
			Image obj2 = val3.AddComponent<Image>();
			obj2.sprite = CreateDotSprite();
			((Graphic)obj2).color = new Color(1f, 0.2f, 0.2f, 1f);
			((Graphic)obj2).raycastTarget = false;
		}

		private void Layout()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_root == (Object)null))
			{
				_root.anchorMin = new Vector2(0.5f, 1f);
				_root.anchorMax = new Vector2(0.5f, 1f);
				_root.pivot = new Vector2(0.5f, 1f);
				_root.sizeDelta = new Vector2(372f, 24f);
				_root.anchoredPosition = new Vector2(0f, -54f);
			}
		}

		private void UpdateDot(Vector3 targetWorld)
		{
			//IL_0125: 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_0039: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: 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_0080: 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)
			//IL_008d: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_dot == (Object)null)
			{
				return;
			}
			float num = Mathf.Max(0f, 171f);
			float num2 = 0f;
			Camera val = ResolveActiveViewCamera();
			if ((Object)(object)val != (Object)null)
			{
				Vector3 val2 = val.WorldToViewportPoint(targetWorld);
				if (val2.z > 0.05f)
				{
					num2 = Mathf.Lerp(0f - num, num, Mathf.Clamp01(val2.x));
				}
				else
				{
					Vector3 val3 = Vector3.ProjectOnPlane(targetWorld - ((Component)val).transform.position, Vector3.up);
					Vector3 val4 = Vector3.ProjectOnPlane(((Component)val).transform.right, Vector3.up);
					float num3 = 0f;
					if (((Vector3)(ref val3)).sqrMagnitude >= 0.01f && ((Vector3)(ref val4)).sqrMagnitude >= 0.01f)
					{
						num3 = Vector3.Dot(((Vector3)(ref val3)).normalized, ((Vector3)(ref val4)).normalized);
					}
					num2 = ((num3 >= 0f) ? num : (0f - num));
				}
			}
			float num4 = 1f - Mathf.Exp(-12f * Mathf.Max(Time.unscaledDeltaTime, 0f));
			_dotX = Mathf.Lerp(_dotX, num2, num4);
			_dot.anchoredPosition = new Vector2(_dotX, 0f);
		}

		private static Camera? ResolveActiveViewCamera()
		{
			Camera main = Camera.main;
			if ((Object)(object)main != (Object)null && ((Behaviour)main).isActiveAndEnabled && ((Component)main).gameObject.activeInHierarchy)
			{
				return main;
			}
			return ((IEnumerable<Camera>)Object.FindObjectsByType<Camera>((FindObjectsSortMode)0)).FirstOrDefault((Func<Camera, bool>)((Camera c) => (Object)(object)c != (Object)null && ((Behaviour)c).isActiveAndEnabled && ((Component)c).gameObject.activeInHierarchy));
		}

		private void SetVisible(bool visible)
		{
			if ((Object)(object)_root != (Object)null)
			{
				((Component)_root).gameObject.SetActive(visible);
			}
		}

		private static bool IsLocalInFog()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Invalid comparison between Unknown and I4
			//IL_0068: 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_0065: Invalid comparison between Unknown and I4
			//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_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Invalid comparison between Unknown and I4
			//IL_00d0: 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_0050: Invalid comparison between Unknown and I4
			//IL_0099: 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)
			//IL_0112: 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)
			Character localCharacter = Character.localCharacter;
			if ((Object)(object)localCharacter == (Object)null || (Object)(object)localCharacter.data == (Object)null || localCharacter.data.dead)
			{
				return false;
			}
			Segment currentSegmentNumber = MapHandler.CurrentSegmentNumber;
			if ((int)currentSegmentNumber == 6)
			{
				return false;
			}
			try
			{
				MapHandler instance = Singleton<MapHandler>.Instance;
				if ((Object)(object)instance != (Object)null && (int)instance.GetCurrentBiome() == 17)
				{
					return false;
				}
			}
			catch
			{
			}
			if ((int)currentSegmentNumber == 3 || (int)currentSegmentNumber == 4)
			{
				LavaRising val = FindRisingPlane((RisingFieldType)0, currentSegmentNumber);
				if ((Object)(object)val?.lava != (Object)null && val.started && !val.ended)
				{
					return localCharacter.Center.y <= ((Component)val.lava).transform.position.y + 0.15f;
				}
			}
			if (IsGloomBiomeLocal())
			{
				LavaRising val2 = FindRisingPlane((RisingFieldType)1, currentSegmentNumber);
				if ((Object)(object)val2 == (Object)null)
				{
					val2 = FindAnyGloomRise();
				}
				if ((Object)(object)val2?.lava != (Object)null && val2.started && !val2.ended && localCharacter.Center.y <= ((Component)val2.lava).transform.position.y + 0.15f)
				{
					return true;
				}
				try
				{
					StatusFieldGloom[] array = Object.FindObjectsByType<StatusFieldGloom>((FindObjectsSortMode)0);
					foreach (StatusFieldGloom val3 in array)
					{
						if ((Object)(object)val3 != (Object)null && ((StatusFieldBase)val3).CharacterInField(localCharacter))
						{
							return true;
						}
					}
				}
				catch
				{
				}
			}
			OrbFogHandler instance2 = Singleton<OrbFogHandler>.Instance;
			if ((Object)(object)instance2 == (Object)null || (!instance2.isMoving && !instance2.hasArrived))
			{
				return false;
			}
			if (!instance2.isMoving)
			{
				return instance2.currentSize < 600f;
			}
			return true;
		}

		private static bool IsGloomBiomeLocal()
		{
			//IL_0014: 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_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Invalid comparison between Unknown and I4
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Invalid comparison between Unknown and I4
			try
			{
				MapHandler instance = Singleton<MapHandler>.Instance;
				if ((Object)(object)instance == (Object)null)
				{
					return false;
				}
				BiomeType currentBiome = instance.GetCurrentBiome();
				return (int)currentBiome == 8 || (int)currentBiome == 9;
			}
			catch
			{
				return false;
			}
		}

		private static LavaRising? FindRisingPlane(RisingFieldType type, Segment seg)
		{
			//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_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)
			List<LavaRising> aLL_LAVA = LavaRising.ALL_LAVA;
			if (aLL_LAVA == null)
			{
				return null;
			}
			for (int i = 0; i < aLL_LAVA.Count; i++)
			{
				LavaRising val = aLL_LAVA[i];
				if ((Object)(object)val != (Object)null && val.risingFieldType == type && val.requiredSegment == seg)
				{
					return val;
				}
			}
			return null;
		}

		private static LavaRising? FindAnyGloomRise()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Invalid comparison between Unknown and I4
			List<LavaRising> aLL_LAVA = LavaRising.ALL_LAVA;
			if (aLL_LAVA == null)
			{
				return null;
			}
			for (int i = 0; i < aLL_LAVA.Count; i++)
			{
				LavaRising val = aLL_LAVA[i];
				if ((Object)(object)val != (Object)null && (int)val.risingFieldType == 1)
				{
					return val;
				}
			}
			return null;
		}

		private static bool TryGetTarget(out Vector3 target)
		{
			//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_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected I4, but got Unknown
			//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)
			target = Vector3.zero;
			if (LoadingScreenHandler.loading)
			{
				return false;
			}
			MapHandler instance = Singleton<MapHandler>.Instance;
			if ((Object)(object)instance == (Object)null || instance.segments == null || instance.segments.Length == 0)
			{
				return false;
			}
			for (int i = Mathf.Clamp((int)MapHandler.CurrentSegmentNumber, 0, instance.segments.Length - 1); i < instance.segments.Length; i++)
			{
				MapSegment obj = instance.segments[i];
				GameObject val = ((obj != null) ? obj.segmentCampfire : null);
				if (!((Object)(object)val == (Object)null))
				{
					Campfire componentInChildren = val.GetComponentInChildren<Campfire>(true);
					if (!((Object)(object)componentInChildren == (Object)null) && !componentInChildren.Lit)
					{
						target = ((Component)componentInChildren).transform.position;
						return true;
					}
				}
			}
			return false;
		}

		private static Sprite CreateDotSprite()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(16, 16, (TextureFormat)4, false);
			for (int i = 0; i < 16; i++)
			{
				for (int j = 0; j < 16; j++)
				{
					float num = (float)j - 7.5f;
					float num2 = (float)i - 7.5f;
					val.SetPixel(j, i, (num * num + num2 * num2 <= 36f) ? Color.white : Color.clear);
				}
			}
			val.Apply();
			return Sprite.Create(val, new Rect(0f, 0f, 16f, 16f), new Vector2(0.5f, 0.5f), 16f);
		}
	}
	internal static class HudL10n
	{
		internal readonly struct LayoutMetrics
		{
			public readonly float PanelWidth;

			public readonly float LabelWidth;

			public readonly float Gap;

			public LayoutMetrics(float panelWidth, float labelWidth, float gap)
			{
				PanelWidth = panelWidth;
				LabelWidth = labelWidth;
				Gap = gap;
			}
		}

		private static readonly LayoutMetrics LayoutCjk = new LayoutMetrics(200f, 108f, 10f);

		private static readonly LayoutMetrics LayoutCjkWide = new LayoutMetrics(220f, 122f, 10f);

		private static readonly LayoutMetrics LayoutEn = new LayoutMetrics(210f, 118f, 10f);

		private static readonly LayoutMetrics LayoutLatin = new LayoutMetrics(236f, 136f, 10f);

		private static readonly LayoutMetrics LayoutWide = new LayoutMetrics(268f, 158f, 10f);

		private static readonly Dictionary<string, string> En = new Dictionary<string, string>(StringComparer.Ordinal)
		{
			["Status"] = "Status",
			["Off"] = "OFF",
			["Guest"] = "GUEST",
			["Host"] = "HOST",
			["ToNight"] = "To Night",
			["ToDay"] = "To Day",
			["CampDist"] = "Camp Dist",
			["ClimbDist"] = "Climb Dist",
			["RainStart"] = "Rain Start",
			["RainEnd"] = "Rain End",
			["BlizzStart"] = "Blizz Start",
			["BlizzEnd"] = "Blizz End",
			["WindStart"] = "Wind Start",
			["WindEnd"] = "Wind End",
			["Active"] = "ACTIVE",
			["Idle"] = "IDLE",
			["Tornado"] = "Tornado",
			["InFog"] = "IN FOG",
			["FogDist"] = "Fog Dist",
			["FogEta"] = "Fog ETA",
			["NoFog"] = "NO FOG",
			["Passed"] = "PASSED",
			["TrigDist"] = "Trig Dist",
			["TrigCount"] = "Trig Count",
			["Disabled"] = "DISABLED",
			["Done"] = "DONE",
			["Rising"] = "RISING",
			["FogSoon"] = "Fog Soon",
			["GloomDist"] = "Gloom Dist",
			["LavaDist"] = "Lava Dist",
			["GloomEta"] = "Gloom ETA",
			["LavaEta"] = "Lava ETA",
			["GloomSoon"] = "Gloom Soon",
			["LavaSoon"] = "Lava Soon",
			["InGloom"] = "IN GLOOM",
			["InLava"] = "IN LAVA",
			["Auto"] = "AUTO",
			["Waiting"] = "WAITING",
			["Field"] = "FIELD",
			["NoTimer"] = "NO TIMER",
			["TrigHeight"] = "Trig Height",
			["Drowsy"] = "Drowsy",
			["Ended"] = "DONE",
			["RisingNow"] = "RISING",
			["SegDone"] = "DONE"
		};

		private static readonly Dictionary<string, string> ZhCn = new Dictionary<string, string>(StringComparer.Ordinal)
		{
			["Status"] = "状态",
			["Off"] = "关闭",
			["Guest"] = "客机",
			["Host"] = "主机",
			["ToNight"] = "距黑夜",
			["ToDay"] = "距白天",
			["CampDist"] = "营火距离",
			["ClimbDist"] = "攀爬距离",
			["RainStart"] = "下雨开始",
			["RainEnd"] = "下雨结束",
			["BlizzStart"] = "寒风开始",
			["BlizzEnd"] = "寒风结束",
			["WindStart"] = "大风开始",
			["WindEnd"] = "大风结束",
			["Active"] = "进行中",
			["Idle"] = "未开始",
			["Tornado"] = "沙尘暴",
			["InFog"] = "已在雾中",
			["FogDist"] = "毒雾距离",
			["FogEta"] = "到达时间",
			["NoFog"] = "本段无雾",
			["Passed"] = "已越过",
			["TrigDist"] = "触发距离",
			["TrigCount"] = "触发人数",
			["Disabled"] = "本段关闭",
			["Done"] = "本段结束",
			["Rising"] = "已升起",
			["FogSoon"] = "毒雾来临",
			["GloomDist"] = "雾面距离",
			["LavaDist"] = "岩浆距离",
			["GloomEta"] = "淹没时间",
			["LavaEta"] = "淹没时间",
			["GloomSoon"] = "幽暗来临",
			["LavaSoon"] = "岩浆来临",
			["InGloom"] = "已在雾中",
			["InLava"] = "已在岩浆中",
			["Auto"] = "自动",
			["Waiting"] = "等待触发",
			["Field"] = "区域雾",
			["NoTimer"] = "无上涨计时",
			["TrigHeight"] = "触发高度",
			["Drowsy"] = "昏睡",
			["Ended"] = "已结束",
			["RisingNow"] = "上涨中",
			["SegDone"] = "本段结束"
		};

		private static readonly Dictionary<string, string> ZhTw = new Dictionary<string, string>(StringComparer.Ordinal)
		{
			["Status"] = "狀態",
			["Off"] = "關閉",
			["Guest"] = "客機",
			["Host"] = "主機",
			["ToNight"] = "距黑夜",
			["ToDay"] = "距白天",
			["CampDist"] = "營火距離",
			["ClimbDist"] = "攀爬距離",
			["RainStart"] = "下雨開始",
			["RainEnd"] = "下雨結束",
			["BlizzStart"] = "寒風開始",
			["BlizzEnd"] = "寒風結束",
			["WindStart"] = "大風開始",
			["WindEnd"] = "大風結束",
			["Active"] = "進行中",
			["Idle"] = "未開始",
			["Tornado"] = "沙塵暴",
			["InFog"] = "已在霧中",
			["FogDist"] = "毒霧距離",
			["FogEta"] = "到達時間",
			["NoFog"] = "本段無霧",
			["Passed"] = "已越過",
			["TrigDist"] = "觸發距離",
			["TrigCount"] = "觸發人數",
			["Disabled"] = "本段關閉",
			["Done"] = "本段結束",
			["Rising"] = "已升起",
			["FogSoon"] = "毒霧來臨",
			["GloomDist"] = "霧面距離",
			["LavaDist"] = "岩漿距離",
			["GloomEta"] = "淹沒時間",
			["LavaEta"] = "淹沒時間",
			["GloomSoon"] = "幽暗來臨",
			["LavaSoon"] = "岩漿來臨",
			["InGloom"] = "已在霧中",
			["InLava"] = "已在岩漿中",
			["Auto"] = "自動",
			["Waiting"] = "等待觸發",
			["Field"] = "區域霧",
			["NoTimer"] = "無上漲計時",
			["TrigHeight"] = "觸發高度",
			["Drowsy"] = "昏睡",
			["Ended"] = "已結束",
			["RisingNow"] = "上漲中",
			["SegDone"] = "本段結束"
		};

		private static readonly Dictionary<string, string> Ja = new Dictionary<string, string>(StringComparer.Ordinal)
		{
			["Status"] = "状態",
			["Off"] = "OFF",
			["Guest"] = "ゲスト",
			["Host"] = "ホスト",
			["ToNight"] = "夜まで",
			["ToDay"] = "昼まで",
			["CampDist"] = "焚火距離",
			["ClimbDist"] = "登攀距離",
			["RainStart"] = "雨開始",
			["RainEnd"] = "雨終了",
			["BlizzStart"] = "吹雪開始",
			["BlizzEnd"] = "吹雪終了",
			["WindStart"] = "強風開始",
			["WindEnd"] = "強風終了",
			["Active"] = "発生中",
			["Idle"] = "待機",
			["Tornado"] = "竜巻",
			["InFog"] = "霧の中",
			["FogDist"] = "毒霧距離",
			["FogEta"] = "到達まで",
			["NoFog"] = "霧なし",
			["Passed"] = "通過済",
			["TrigDist"] = "発動距離",
			["TrigCount"] = "発動人数",
			["Disabled"] = "無効",
			["Done"] = "終了",
			["Rising"] = "上昇中",
			["FogSoon"] = "毒霧まで",
			["GloomDist"] = "霧面距離",
			["LavaDist"] = "溶岩距離",
			["GloomEta"] = "没入まで",
			["LavaEta"] = "没入まで",
			["GloomSoon"] = "闇霧まで",
			["LavaSoon"] = "溶岩まで",
			["InGloom"] = "霧の中",
			["InLava"] = "溶岩の中",
			["Auto"] = "自動",
			["Waiting"] = "待機中",
			["Field"] = "区域霧",
			["NoTimer"] = "計時なし",
			["TrigHeight"] = "発動高度",
			["Drowsy"] = "眠気",
			["Ended"] = "終了",
			["RisingNow"] = "上昇中",
			["SegDone"] = "終了"
		};

		private static readonly Dictionary<string, string> Ko = new Dictionary<string, string>(StringComparer.Ordinal)
		{
			["Status"] = "상태",
			["Off"] = "OFF",
			["Guest"] = "게스트",
			["Host"] = "호스트",
			["ToNight"] = "밤까지",
			["ToDay"] = "낮까지",
			["CampDist"] = "모닥불",
			["ClimbDist"] = "등반거리",
			["RainStart"] = "비 시작",
			["RainEnd"] = "비 종료",
			["BlizzStart"] = "눈보라 시작",
			["BlizzEnd"] = "눈보라 종료",
			["WindStart"] = "강풍 시작",
			["WindEnd"] = "강풍 종료",
			["Active"] = "진행 중",
			["Idle"] = "대기",
			["Tornado"] = "토네이도",
			["InFog"] = "안개 안",
			["FogDist"] = "독안개",
			["FogEta"] = "도달까지",
			["NoFog"] = "안개 없음",
			["Passed"] = "통과함",
			["TrigDist"] = "발동 거리",
			["TrigCount"] = "발동 인원",
			["Disabled"] = "비활성",
			["Done"] = "종료",
			["Rising"] = "상승 중",
			["FogSoon"] = "독안개까지",
			["GloomDist"] = "안개면",
			["LavaDist"] = "용암 거리",
			["GloomEta"] = "잠김까지",
			["LavaEta"] = "잠김까지",
			["GloomSoon"] = "어둠까지",
			["LavaSoon"] = "용암까지",
			["InGloom"] = "안개 안",
			["InLava"] = "용암 안",
			["Auto"] = "자동",
			["Waiting"] = "대기 중",
			["Field"] = "지역 안개",
			["NoTimer"] = "타이머 없음",
			["TrigHeight"] = "발동 고도",
			["Drowsy"] = "졸음",
			["Ended"] = "종료",
			["RisingNow"] = "상승 중",
			["SegDone"] = "종료"
		};

		private static readonly Dictionary<string, string> Fr = new Dictionary<string, string>(StringComparer.Ordinal)
		{
			["Status"] = "État",
			["Off"] = "OFF",
			["Guest"] = "INVITÉ",
			["Host"] = "HÔTE",
			["ToNight"] = "Nuit dans",
			["ToDay"] = "Jour dans",
			["CampDist"] = "Feu",
			["ClimbDist"] = "Ascension",
			["RainStart"] = "Pluie début",
			["RainEnd"] = "Pluie fin",
			["BlizzStart"] = "Blizz. début",
			["BlizzEnd"] = "Blizz. fin",
			["WindStart"] = "Vent début",
			["WindEnd"] = "Vent fin",
			["Active"] = "ACTIF",
			["Idle"] = "INACTIF",
			["Tornado"] = "Tornade",
			["InFog"] = "DANS BRUME",
			["FogDist"] = "Dist. brume",
			["FogEta"] = "ETA brume",
			["NoFog"] = "SANS BRUME",
			["Passed"] = "PASSÉ",
			["TrigDist"] = "Dist. décl.",
			["TrigCount"] = "Nb décl.",
			["Disabled"] = "DÉSACTIVÉ",
			["Done"] = "FINI",
			["Rising"] = "MONTE",
			["FogSoon"] = "Brume bientôt",
			["GloomDist"] = "Dist. sombre",
			["LavaDist"] = "Dist. lave",
			["GloomEta"] = "Immersion",
			["LavaEta"] = "Immersion",
			["GloomSoon"] = "Sombre bientôt",
			["LavaSoon"] = "Lave bientôt",
			["InGloom"] = "DANS SOMBRE",
			["InLava"] = "DANS LAVE",
			["Auto"] = "AUTO",
			["Waiting"] = "ATTENTE",
			["Field"] = "ZONE",
			["NoTimer"] = "SANS TIMER",
			["TrigHeight"] = "Haut. décl.",
			["Drowsy"] = "Somnolence",
			["Ended"] = "FINI",
			["RisingNow"] = "MONTE",
			["SegDone"] = "FINI"
		};

		private static readonly Dictionary<string, string> De = new Dictionary<string, string>(StringComparer.Ordinal)
		{
			["Status"] = "Status",
			["Off"] = "AUS",
			["Guest"] = "GAST",
			["Host"] = "HOST",
			["ToNight"] = "Bis Nacht",
			["ToDay"] = "Bis Tag",
			["CampDist"] = "Lagerfeuer",
			["ClimbDist"] = "Kletterdist.",
			["RainStart"] = "Regen Start",
			["RainEnd"] = "Regen Ende",
			["BlizzStart"] = "Sturm Start",
			["BlizzEnd"] = "Sturm Ende",
			["WindStart"] = "Wind Start",
			["WindEnd"] = "Wind Ende",
			["Active"] = "AKTIV",
			["Idle"] = "IDLE",
			["Tornado"] = "Tornado",
			["InFog"] = "IM NEBEL",
			["FogDist"] = "Nebeldist.",
			["FogEta"] = "Nebel-ETA",
			["NoFog"] = "KEIN NEBEL",
			["Passed"] = "PASSIERT",
			["TrigDist"] = "Auslösedist.",
			["TrigCount"] = "Auslöser",
			["Disabled"] = "AUS",
			["Done"] = "FERTIG",
			["Rising"] = "STEIGT",
			["FogSoon"] = "Nebel bald",
			["GloomDist"] = "Düsterdist.",
			["LavaDist"] = "Lavaldist.",
			["GloomEta"] = "Eintauchen",
			["LavaEta"] = "Eintauchen",
			["GloomSoon"] = "Düster bald",
			["LavaSoon"] = "Lava bald",
			["InGloom"] = "IN DÜSTER",
			["InLava"] = "IN LAVA",
			["Auto"] = "AUTO",
			["Waiting"] = "WARTET",
			["Field"] = "FELD",
			["NoTimer"] = "KEIN TIMER",
			["TrigHeight"] = "Auslösehöhe",
			["Drowsy"] = "Schläfrig",
			["Ended"] = "FERTIG",
			["RisingNow"] = "STEIGT",
			["SegDone"] = "FERTIG"
		};

		private static readonly Dictionary<string, string> It = new Dictionary<string, string>(StringComparer.Ordinal)
		{
			["Status"] = "Stato",
			["Off"] = "OFF",
			["Guest"] = "OSPITE",
			["Host"] = "HOST",
			["ToNight"] = "A notte",
			["ToDay"] = "A giorno",
			["CampDist"] = "Falò",
			["ClimbDist"] = "Arrampicata",
			["RainStart"] = "Pioggia ini.",
			["RainEnd"] = "Pioggia fine",
			["BlizzStart"] = "Bufera ini.",
			["BlizzEnd"] = "Bufera fine",
			["WindStart"] = "Vento ini.",
			["WindEnd"] = "Vento fine",
			["Active"] = "ATTIVO",
			["Idle"] = "INATTIVO",
			["Tornado"] = "Tornado",
			["InFog"] = "NELLA NEBBIA",
			["FogDist"] = "Dist. nebbia",
			["FogEta"] = "ETA nebbia",
			["NoFog"] = "NO NEBBIA",
			["Passed"] = "PASSATO",
			["TrigDist"] = "Dist. trigger",
			["TrigCount"] = "N. trigger",
			["Disabled"] = "DISATTIVO",
			["Done"] = "FINE",
			["Rising"] = "SALE",
			["FogSoon"] = "Nebbia presto",
			["GloomDist"] = "Dist. cupo",
			["LavaDist"] = "Dist. lava",
			["GloomEta"] = "Immersione",
			["LavaEta"] = "Immersione",
			["GloomSoon"] = "Cupo presto",
			["LavaSoon"] = "Lava presto",
			["InGloom"] = "NEL CUPO",
			["InLava"] = "NELLA LAVA",
			["Auto"] = "AUTO",
			["Waiting"] = "IN ATTESA",
			["Field"] = "ZONA",
			["NoTimer"] = "NO TIMER",
			["TrigHeight"] = "Alt. trigger",
			["Drowsy"] = "Sonnolenza",
			["Ended"] = "FINE",
			["RisingNow"] = "SALE",
			["SegDone"] = "FINE"
		};

		private static readonly Dictionary<string, string> Es = new Dictionary<string, string>(StringComparer.Ordinal)
		{
			["Status"] = "Estado",
			["Off"] = "OFF",
			["Guest"] = "INVITADO",
			["Host"] = "ANFITRIÓN",
			["ToNight"] = "A noche",
			["ToDay"] = "A día",
			["CampDist"] = "Hoguera",
			["ClimbDist"] = "Escalada",
			["RainStart"] = "Lluvia ini.",
			["RainEnd"] = "Lluvia fin",
			["BlizzStart"] = "Ventisca ini.",
			["BlizzEnd"] = "Ventisca fin",
			["WindStart"] = "Viento ini.",
			["WindEnd"] = "Viento fin",
			["Active"] = "ACTIVO",
			["Idle"] = "INACTIVO",
			["Tornado"] = "Tornado",
			["InFog"] = "EN NIEBLA",
			["FogDist"] = "Dist. niebla",
			["FogEta"] = "ETA niebla",
			["NoFog"] = "SIN NIEBLA",
			["Passed"] = "PASADO",
			["TrigDist"] = "Dist. activ.",
			["TrigCount"] = "N.º activ.",
			["Disabled"] = "DESACTIVADO",
			["Done"] = "FIN",
			["Rising"] = "SUBE",
			["FogSoon"] = "Niebla pronto",
			["GloomDist"] = "Dist. penumbra",
			["LavaDist"] = "Dist. lava",
			["GloomEta"] = "Inmersión",
			["LavaEta"] = "Inmersión",
			["GloomSoon"] = "Penumbra pronto",
			["LavaSoon"] = "Lava pronto",
			["InGloom"] = "EN PENUMBRA",
			["InLava"] = "EN LAVA",
			["Auto"] = "AUTO",
			["Waiting"] = "ESPERA",
			["Field"] = "ZONA",
			["NoTimer"] = "SIN TIMER",
			["TrigHeight"] = "Alt. activ.",
			["Drowsy"] = "Somnolencia",
			["Ended"] = "FIN",
			["RisingNow"] = "SUBE",
			["SegDone"] = "FIN"
		};

		private static readonly Dictionary<string, string> EsLatam = new Dictionary<string, string>(StringComparer.Ordinal)
		{
			["Status"] = "Estado",
			["Off"] = "OFF",
			["Guest"] = "INVITADO",
			["Host"] = "ANFITRIÓN",
			["ToNight"] = "A noche",
			["ToDay"] = "A día",
			["CampDist"] = "Fogata",
			["ClimbDist"] = "Escalada",
			["RainStart"] = "Lluvia ini.",
			["RainEnd"] = "Lluvia fin",
			["BlizzStart"] = "Nevasca ini.",
			["BlizzEnd"] = "Nevasca fin",
			["WindStart"] = "Viento ini.",
			["WindEnd"] = "Viento fin",
			["Active"] = "ACTIVO",
			["Idle"] = "INACTIVO",
			["Tornado"] = "Tornado",
			["InFog"] = "EN NIEBLA",
			["FogDist"] = "Dist. niebla",
			["FogEta"] = "ETA niebla",
			["NoFog"] = "SIN NIEBLA",
			["Passed"] = "PASADO",
			["TrigDist"] = "Dist. activ.",
			["TrigCount"] = "N.º activ.",
			["Disabled"] = "DESACTIVADO",
			["Done"] = "FIN",
			["Rising"] = "SUBE",
			["FogSoon"] = "Niebla pronto",
			["GloomDist"] = "Dist. penumbra",
			["LavaDist"] = "Dist. lava",
			["GloomEta"] = "Inmersión",
			["LavaEta"] = "Inmersión",
			["GloomSoon"] = "Penumbra pronto",
			["LavaSoon"] = "Lava pronto",
			["InGloom"] = "EN PENUMBRA",
			["InLava"] = "EN LAVA",
			["Auto"] = "AUTO",
			["Waiting"] = "ESPERA",
			["Field"] = "ZONA",
			["NoTimer"] = "SIN TIMER",
			["TrigHeight"] = "Alt. activ.",
			["Drowsy"] = "Somnolencia",
			["Ended"] = "FIN",
			["RisingNow"] = "SUBE",
			["SegDone"] = "FIN"
		};

		private static readonly Dictionary<string, string> Pt = new Dictionary<string, string>(StringComparer.Ordinal)
		{
			["Status"] = "Estado",
			["Off"] = "OFF",
			["Guest"] = "CONVIDADO",
			["Host"] = "HOST",
			["ToNight"] = "Até noite",
			["ToDay"] = "Até dia",
			["CampDist"] = "Fogueira",
			["ClimbDist"] = "Escalada",
			["RainStart"] = "Chuva ini.",
			["RainEnd"] = "Chuva fim",
			["BlizzStart"] = "Nevasca ini.",
			["BlizzEnd"] = "Nevasca fim",
			["WindStart"] = "Vento ini.",
			["WindEnd"] = "Vento fim",
			["Active"] = "ATIVO",
			["Idle"] = "INATIVO",
			["Tornado"] = "Tornado",
			["InFog"] = "NA NÉVOA",
			["FogDist"] = "Dist. névoa",
			["FogEta"] = "ETA névoa",
			["NoFog"] = "SEM NÉVOA",
			["Passed"] = "PASSADO",
			["TrigDist"] = "Dist. ativ.",
			["TrigCount"] = "Nº ativ.",
			["Disabled"] = "DESATIVADO",
			["Done"] = "FIM",
			["Rising"] = "SOBE",
			["FogSoon"] = "Névoa em breve",
			["GloomDist"] = "Dist. sombria",
			["LavaDist"] = "Dist. lava",
			["GloomEta"] = "Imersão",
			["LavaEta"] = "Imersão",
			["GloomSoon"] = "Sombria breve",
			["LavaSoon"] = "Lava breve",
			["InGloom"] = "NA SOMBRA",
			["InLava"] = "NA LAVA",
			["Auto"] = "AUTO",
			["Waiting"] = "AGUARDA",
			["Field"] = "ZONA",
			["NoTimer"] = "SEM TIMER",
			["TrigHeight"] = "Alt. ativ.",
			["Drowsy"] = "Sonolência",
			["Ended"] = "FIM",
			["RisingNow"] = "SOBE",
			["SegDone"] = "FIM"
		};

		private static readonly Dictionary<string, string> Ru = new Dictionary<string, string>(StringComparer.Ordinal)
		{
			["Status"] = "Статус",
			["Off"] = "ВЫКЛ",
			["Guest"] = "ГОСТЬ",
			["Host"] = "ХОСТ",
			["ToNight"] = "До ночи",
			["ToDay"] = "До дня",
			["CampDist"] = "Костёр",
			["ClimbDist"] = "Подъём",
			["RainStart"] = "Дождь старт",
			["RainEnd"] = "Дождь конец",
			["BlizzStart"] = "Метель старт",
			["BlizzEnd"] = "Метель конец",
			["WindStart"] = "Ветер старт",
			["WindEnd"] = "Ветер конец",
			["Active"] = "ИДЁТ",
			["Idle"] = "ЖДЁТ",
			["Tornado"] = "Торнадо",
			["InFog"] = "В ТУМАНЕ",
			["FogDist"] = "До тумана",
			["FogEta"] = "ETA тумана",
			["NoFog"] = "НЕТ ТУМАНА",
			["Passed"] = "ПРОЙДЕНО",
			["TrigDist"] = "До триггера",
			["TrigCount"] = "Триггер",
			["Disabled"] = "ВЫКЛ",
			["Done"] = "ГОТОВО",
			["Rising"] = "РАСТЁТ",
			["FogSoon"] = "Туман скоро",
			["GloomDist"] = "До мглы",
			["LavaDist"] = "До лавы",
			["GloomEta"] = "Погружение",
			["LavaEta"] = "Погружение",
			["GloomSoon"] = "Мгла скоро",
			["LavaSoon"] = "Лава скоро",
			["InGloom"] = "В МГЛЕ",
			["InLava"] = "В ЛАВЕ",
			["Auto"] = "АВТО",
			["Waiting"] = "ОЖИДАНИЕ",
			["Field"] = "ЗОНА",
			["NoTimer"] = "НЕТ ТАЙМЕРА",
			["TrigHeight"] = "Выс. тригг.",
			["Drowsy"] = "Сонливость",
			["Ended"] = "ГОТОВО",
			["RisingNow"] = "РАСТЁТ",
			["SegDone"] = "ГОТОВО"
		};

		private static readonly Dictionary<string, string> Uk = new Dictionary<string, string>(StringComparer.Ordinal)
		{
			["Status"] = "Статус",
			["Off"] = "ВИМК",
			["Guest"] = "ГІСТЬ",
			["Host"] = "ХОСТ",
			["ToNight"] = "До ночі",
			["ToDay"] = "До дня",
			["CampDist"] = "Ватра",
			["ClimbDist"] = "Підйом",
			["RainStart"] = "Дощ старт",
			["RainEnd"] = "Дощ кінець",
			["BlizzStart"] = "Заметіль старт",
			["BlizzEnd"] = "Заметіль кінець",
			["WindStart"] = "Вітер старт",
			["WindEnd"] = "Вітер кінець",
			["Active"] = "ЙДЕ",
			["Idle"] = "ЧЕКАЄ",
			["Tornado"] = "Торнадо",
			["InFog"] = "У ТУМАНІ",
			["FogDist"] = "До туману",
			["FogEta"] = "ETA туману",
			["NoFog"] = "НЕМА ТУМАНУ",
			["Passed"] = "ПРОЙДЕНО",
			["TrigDist"] = "До тригера",
			["TrigCount"] = "Тригер",
			["Disabled"] = "ВИМК",
			["Done"] = "ГОТОВО",
			["Rising"] = "РОСТЕ",
			["FogSoon"] = "Туман скоро",
			["GloomDist"] = "До імли",
			["LavaDist"] = "До лави",
			["GloomEta"] = "Занурення",
			["LavaEta"] = "Занурення",
			["GloomSoon"] = "Імла скоро",
			["LavaSoon"] = "Лава скоро",
			["InGloom"] = "В ІМЛІ",
			["InLava"] = "В ЛАВІ",
			["Auto"] = "АВТО",
			["Waiting"] = "ОЧІКУВАННЯ",
			["Field"] = "ЗОНА",
			["NoTimer"] = "НЕМА ТАЙМЕРА",
			["TrigHeight"] = "Вис. триг.",
			["Drowsy"] = "Сонливість",
			["Ended"] = "ГОТОВО",
			["RisingNow"] = "РОСТЕ",
			["SegDone"] = "ГОТОВО"
		};

		private static readonly Dictionary<string, string> Pl = new Dictionary<string, string>(StringComparer.Ordinal)
		{
			["Status"] = "Status",
			["Off"] = "WYŁ.",
			["Guest"] = "GOŚĆ",
			["Host"] = "HOST",
			["ToNight"] = "Do nocy",
			["ToDay"] = "Do dnia",
			["CampDist"] = "Ognisko",
			["ClimbDist"] = "Wspinaczka",
			["RainStart"] = "Deszcz start",
			["RainEnd"] = "Deszcz koniec",
			["BlizzStart"] = "Zamieć start",
			["BlizzEnd"] = "Zamieć koniec",
			["WindStart"] = "Wiatr start",
			["WindEnd"] = "Wiatr koniec",
			["Active"] = "AKTYWNE",
			["Idle"] = "CZEKA",
			["Tornado"] = "Tornado",
			["InFog"] = "W MGLE",
			["FogDist"] = "Dyst. mgły",
			["FogEta"] = "ETA mgły",
			["NoFog"] = "BRAK MGŁY",
			["Passed"] = "MINIĘTO",
			["TrigDist"] = "Dyst. wyzw.",
			["TrigCount"] = "Liczba wyzw.",
			["Disabled"] = "WYŁĄCZONE",
			["Done"] = "KONIEC",
			["Rising"] = "ROŚNIE",
			["FogSoon"] = "Mgła wkrótce",
			["GloomDist"] = "Dyst. mroku",
			["LavaDist"] = "Dyst. lawy",
			["GloomEta"] = "Zanurzenie",
			["LavaEta"] = "Zanurzenie",
			["GloomSoon"] = "Mrok wkrótce",
			["LavaSoon"] = "Lawa wkrótce",
			["InGloom"] = "W MROKU",
			["InLava"] = "W LAWIE",
			["Auto"] = "AUTO",
			["Waiting"] = "OCZEKIWANIE",
			["Field"] = "STREFA",
			["NoTimer"] = "BRAK TIMERA",
			["TrigHeight"] = "Wys. wyzw.",
			["Drowsy"] = "Senność",
			["Ended"] = "KONIEC",
			["RisingNow"] = "ROŚNIE",
			["SegDone"] = "KONIEC"
		};

		private static readonly Dictionary<string, string> Tr = new Dictionary<string, string>(StringComparer.Ordinal)
		{
			["Status"] = "Durum",
			["Off"] = "KAPALI",
			["Guest"] = "MİSAFİR",
			["Host"] = "EV SAHİBİ",
			["ToNight"] = "Geceye",
			["ToDay"] = "Gündüze",
			["CampDist"] = "Kamp ateşi",
			["ClimbDist"] = "Tırmanış",
			["RainStart"] = "Yağmur baş",
			["RainEnd"] = "Yağmur bit",
			["BlizzStart"] = "Fırtına baş",
			["BlizzEnd"] = "Fırtına bit",
			["WindStart"] = "Rüzgar baş",
			["WindEnd"] = "Rüzgar bit",
			["Active"] = "AKTİF",
			["Idle"] = "BEKLİYOR",
			["Tornado"] = "Hortum",
			["InFog"] = "SİSTE",
			["FogDist"] = "Sis mesafe",
			["FogEta"] = "Sis ETA",
			["NoFog"] = "SİS YOK",
			["Passed"] = "GEÇİLDİ",
			["TrigDist"] = "Tetik mesafe",
			["TrigCount"] = "Tetik sayı",
			["Disabled"] = "KAPALI",
			["Done"] = "BİTTİ",
			["Rising"] = "YÜKSELİYOR",
			["FogSoon"] = "Sis yakında",
			["GloomDist"] = "Karanlık mes.",
			["LavaDist"] = "Lav mesafe",
			["GloomEta"] = "Batma",
			["LavaEta"] = "Batma",
			["GloomSoon"] = "Karanlık yakında",
			["LavaSoon"] = "Lav yakında",
			["InGloom"] = "KARANLIKTA",
			["InLava"] = "LAVDA",
			["Auto"] = "OTO",
			["Waiting"] = "BEKLİYOR",
			["Field"] = "ALAN",
			["NoTimer"] = "ZAMANLAYICI YOK",
			["TrigHeight"] = "Tetik yükseklik",
			["Drowsy"] = "Uyku",
			["Ended"] = "BİTTİ",
			["RisingNow"] = "YÜKSELİYOR",
			["SegDone"] = "BİTTİ"
		};

		internal static Language CurrentLanguage()
		{
			//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_0032: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				return LocalizedText.CURRENT_LANGUAGE;
			}
			catch
			{
			}
			try
			{
				if (PlayerPrefs.HasKey("LanguageSetting"))
				{
					return IndexToLanguage(PlayerPrefs.GetInt("LanguageSetting", 0));
				}
			}
			catch
			{
			}
			return (Language)0;
		}

		private static Language IndexToLanguage(int index)
		{
			//IL_0043: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: 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_0057: 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_005f: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: 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)
			return (Language)(index switch
			{
				1 => 1, 
				2 => 2, 
				3 => 3, 
				4 => 4, 
				5 => 5, 
				6 => 6, 
				7 => 7, 
				8 => 8, 
				9 => 9, 
				10 => 10, 
				11 => 11, 
				12 => 12, 
				13 => 13, 
				14 => 14, 
				_ => 0, 
			});
		}

		internal static bool PreferCjkFont()
		{
			//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_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_000b: Invalid comparison between Unknown and I4
			Language val = CurrentLanguage();
			if (val - 9 <= 3)
			{
				return true;
			}
			return false;
		}

		internal static LayoutMetrics Layout()
		{
			//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_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected I4, but got Unknown
			Language val = CurrentLanguage();
			return (val - 1) switch
			{
				8 => LayoutCjk, 
				9 => LayoutCjk, 
				10 => LayoutCjkWide, 
				11 => LayoutCjkWide, 
				2 => LayoutWide, 
				6 => LayoutWide, 
				7 => LayoutWide, 
				12 => LayoutWide, 
				0 => LayoutLatin, 
				1 => LayoutLatin, 
				3 => LayoutLatin, 
				4 => LayoutLatin, 
				5 => LayoutLatin, 
				13 => LayoutLatin, 
				_ => LayoutEn, 
			};
		}

		internal static string Dash()
		{
			if (!PreferCjkFont())
			{
				return "-";
			}
			return "—";
		}

		internal static string T(string key)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			if (TableFor(CurrentLanguage()).TryGetValue(key, out string value) && !string.IsNullOrEmpty(value))
			{
				return value;
			}
			if (!En.TryGetValue(key, out string value2))
			{
				return key;
			}
			return value2;
		}

		private static Dictionary<string, string> TableFor(Language lang)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected I4, but got Unknown
			return (lang - 1) switch
			{
				8 => ZhCn, 
				9 => ZhTw, 
				10 => Ja, 
				11 => Ko, 
				0 => Fr, 
				2 => De, 
				1 => It, 
				3 => Es, 
				4 => EsLatam, 
				5 => Pt, 
				6 => Ru, 
				7 => Uk, 
				12 => Pl, 
				13 => Tr, 
				_ => En, 
			};
		}
	}
	internal static class HudUi
	{
		private static Sprite? _whiteSprite;

		private static Canvas? _fallbackCanvas;

		public static bool IsGameplayOrAirportScene()
		{
			//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)
			Scene activeScene = SceneManager.GetActiveScene();
			if (!((Scene)(ref activeScene)).IsValid())
			{
				return false;
			}
			string text = ((Scene)(ref activeScene)).name ?? string.Empty;
			if (string.Equals(text, "Airport", StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (text.IndexOf("Island", StringComparison.OrdinalIgnoreCase) >= 0)
			{
				return true;
			}
			if (text.IndexOf("Level_", StringComparison.OrdinalIgnoreCase) >= 0)
			{
				return true;
			}
			try
			{
				return GameHandler.IsOnIsland;
			}
			catch
			{
				return false;
			}
		}

		public static Canvas? ResolveHudCanvas()
		{
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Invalid comparison between Unknown and I4
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
			if (!IsGameplayOrAirportScene())
			{
				return null;
			}
			if (LoadingScreenHandler.loading)
			{
				return null;
			}
			GUIManager instance = GUIManager.instance;
			if ((Object)(object)instance != (Object)null)
			{
				if (IsCanvasUsable(instance.hudCanvas))
				{
					return instance.hudCanvas;
				}
				TextMeshProUGUI val = (((Object)(object)instance.itemPromptMain != (Object)null) ? instance.itemPromptMain : instance.interactNameText);
				if ((Object)(object)val != (Object)null)
				{
					Canvas componentInParent = ((Component)val).GetComponentInParent<Canvas>();
					if (IsCanvasUsable(componentInParent))
					{
						return componentInParent;
					}
				}
			}
			Canvas val2 = null;
			int num = int.MinValue;
			float num2 = -1f;
			Canvas[] array = Object.FindObjectsByType<Canvas>((FindObjectsSortMode)0);
			foreach (Canvas val3 in array)
			{
				if (IsCanvasUsable(val3) && val3.isRootCanvas && (int)val3.renderMode != 2)
				{
					Transform transform = ((Component)val3).transform;
					RectTransform val4 = (RectTransform)(object)((transform is RectTransform) ? transform : null);
					float num3;
					if (!((Object)(object)val4 != (Object)null))
					{
						num3 = 0f;
					}
					else
					{
						Rect rect = val4.rect;
						float width = ((Rect)(ref rect)).width;
						rect = val4.rect;
						num3 = Mathf.Abs(width * ((Rect)(ref rect)).height);
					}
					float num4 = num3;
					if ((Object)(object)val2 == (Object)null || val3.sortingOrder > num || (val3.sortingOrder == num && num4 > num2))
					{
						val2 = val3;
						num = val3.sortingOrder;
						num2 = num4;
					}
				}
			}
			if ((Object)(object)val2 != (Object)null)
			{
				return val2;
			}
			return EnsureFallbackCanvas();
		}

		public static bool IsCanvasUsable(Canvas? canvas)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Invalid comparison between Unknown and I4
			if ((Object)(object)canvas != (Object)null && ((Behaviour)canvas).isActiveAndEnabled && ((Component)canvas).gameObject.activeInHierarchy)
			{
				return (int)canvas.renderMode != 2;
			}
			return false;
		}

		public static void ApplyGameTextStyle(TextMeshProUGUI target, Color color, float sizeMultiplier = 1f)
		{
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)target == (Object)null)
			{
				return;
			}
			TextMeshProUGUI val = ResolveStyleSource();
			if ((Object)(object)val != (Object)null && (Object)(object)((TMP_Text)val).font != (Object)null)
			{
				((TMP_Text)target).font = ((TMP_Text)val).font;
				if ((Object)(object)((TMP_Text)val).fontSharedMaterial != (Object)null)
				{
					((TMP_Text)target).fontSharedMaterial = ((TMP_Text)val).fontSharedMaterial;
				}
				((TMP_Text)target).fontStyle = ((TMP_Text)val).fontStyle;
				((TMP_Text)target).characterSpacing = ((TMP_Text)val).characterSpacing;
				((TMP_Text)target).wordSpacing = ((TMP_Text)val).wordSpacing;
				((TMP_Text)target).lineSpacing = ((TMP_Text)val).lineSpacing;
			}
			else if ((Object)(object)TMP_Settings.defaultFontAsset != (Object)null)
			{
				((TMP_Text)target).font = TMP_Settings.defaultFontAsset;
			}
			((TMP_Text)target).richText = true;
			((Graphic)target).raycastTarget = false;
			((TMP_Text)target).textWrappingMode = (TextWrappingModes)0;
			((TMP_Text)target).overflowMode = (TextOverflowModes)0;
			((TMP_Text)target).fontSize = 18f * sizeMultiplier;
			((Graphic)target).color = color;
			((TMP_Text)target).alignment = (TextAlignmentOptions)1025;
			((TMP_Text)target).enableVertexGradient = false;
		}

		public static Sprite WhiteSprite()
		{
			//IL_0017: 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_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_002f: 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_0051: 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_006f: Expected O, but got Unknown
			if ((Object)(object)_whiteSprite != (Object)null)
			{
				return _whiteSprite;
			}
			Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false);
			val.SetPixel(0, 0, Color.white);
			val.Apply();
			((Texture)val).wrapMode = (TextureWrapMode)1;
			((Texture)val).filterMode = (FilterMode)0;
			_whiteSprite = Sprite.Create(val, new Rect(0f, 0f, 1f, 1f), new Vector2(0.5f, 0.5f), 1f);
			return _whiteSprite;
		}

		public static void DestroyFallbackCanvasIfOrphan()
		{
			if ((Object)(object)_fallbackCanvas != (Object)null && (Object)(object)((Component)_fallbackCanvas).gameObject == (Object)null)
			{
				_fallbackCanvas = null;
			}
		}

		private static Canvas EnsureFallbackCanvas()
		{
			//IL_0024: 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_002f: Expected O, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_fallbackCanvas != (Object)null && Object.op_Implicit((Object)(object)_fallbackCanvas))
			{
				return _fallbackCanvas;
			}
			GameObject val = new GameObject("FogRiseSpeedTweaks_OverlayCanvas");
			Object.DontDestroyOnLoad((Object)val);
			_fallbackCanvas = val.AddComponent<Canvas>();
			_fallbackCanvas.renderMode = (RenderMode)0;
			_fallbackCanvas.sortingOrder = 5000;
			CanvasScaler obj = val.AddComponent<CanvasScaler>();
			obj.uiScaleMode = (ScaleMode)1;
			obj.referenceResolution = new Vector2(1920f, 1080f);
			obj.matchWidthOrHeight = 0.5f;
			val.AddComponent<GraphicRaycaster>();
			return _fallbackCanvas;
		}

		private static TextMeshProUGUI? ResolveStyleSource()
		{
			GUIManager instance = GUIManager.instance;
			TextMeshProUGUI[] array2;
			if ((Object)(object)instance != (Object)null)
			{
				TextMeshProUGUI[] array = (TextMeshProUGUI[])(object)new TextMeshProUGUI[3] { instance.itemPromptMain, instance.interactNameText, instance.interactPromptText };
				array2 = array;
				foreach (TextMeshProUGUI val in array2)
				{
					if ((Object)(object)val != (Object)null && (Object)(object)((TMP_Text)val).font != (Object)null && ((Behaviour)val).isActiveAndEnabled)
					{
						return val;
					}
				}
				array2 = array;
				foreach (TextMeshProUGUI val2 in array2)
				{
					if ((Object)(object)val2 != (Object)null && (Object)(object)((TMP_Text)val2).font != (Object)null)
					{
						return val2;
					}
				}
			}
			bool flag = HudL10n.PreferCjkFont();
			TextMeshProUGUI result = null;
			int num = -1;
			array2 = Object.FindObjectsByType<TextMeshProUGUI>((FindObjectsSortMode)0);
			foreach (TextMeshProUGUI val3 in array2)
			{
				if ((Object)(object)val3 == (Object)null || (Object)(object)((TMP_Text)val3).font == (Object)null || !((Behaviour)val3).isActiveAndEnabled)
				{
					continue;
				}
				int num2 = 1;
				if ((Object)(object)((TMP_Text)val3).fontSharedMaterial != (Object)null)
				{
					num2 += 2;
				}
				string text = ((TMP_Text)val3).text ?? string.Empty;
				bool flag2 = false;
				foreach (char c in text)
				{
					if ((c >= '一' && c <= '鿿') || (c >= '\u3040' && c <= 'ヿ') || (c >= '가' && c <= '\ud7af'))
					{
						flag2 = true;
						break;
					}
				}
				if (flag && flag2)
				{
					num2 += 10;
				}
				if (!flag && !flag2)
				{
					num2 += 3;
				}
				if (num2 > num)
				{
					num = num2;
					result = val3;
				}
			}
			return result;
		}
	}
	[BepInPlugin("youxia173.FogRiseSpeedTweaks", "FogRiseSpeedTweaks", "1.4.2")]
	public sealed class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Log;

		internal static Plugin Instance;

		public const float VanillaOrbFogSpeed = 0.3f;

		public const float VanillaLavaTravelTime = 60f;

		private const float FogStateSyncIntervalSeconds = 0.18f;

		private const float LavaSyncIntervalSeconds = 0.25f;

		private const float DrowsySyncIntervalSeconds = 0.35f;

		public static ConfigEntry<bool> ModEnabled;

		public static ConfigEntry<bool> FogUseAbsoluteSpeed;

		public static ConfigEntry<float> FogRiseSpeed;

		public static ConfigEntry<float> FogRiseSpeedPercent;

		public static ConfigEntry<float> LavaRiseSpeedPercent;

		public static ConfigEntry<float> GloomRiseSpeedPercent;

		public static ConfigEntry<float> GloomDrowsyPercent;

		public static ConfigEntry<bool> FogUiEnabled;

		public static ConfigEntry<bool> CampfireLocatorUiEnabled;

		public static ConfigEntry<float> FogUiX;

		public static ConfigEntry<float> FogUiY;

		public static ConfigEntry<float> FogUiScale;

		private readonly Dictionary<LavaRising, float> _baseTravelTime = new Dictionary<LavaRising, float>();

		private readonly Dictionary<StatusFieldGloom, float> _baseDrowsyPerSecond = new Dictionary<StatusFieldGloom, float>();

		private readonly Dictionary<int, float> _drowsyDebt = new Dictionary<int, float>();

		private StatusFieldGloom[] _gloomFields = Array.Empty<StatusFieldGloom>();

		private float _nextGloomScan;

		private float _lastFogSync = -999f;

		private float _lastLavaSync = -999f;

		private float _lastDrowsySync = -999f;

		private bool _lastHadAuthority = true;

		private SpeedHud? _hud;

		private CampfireLocatorHud? _locator;

		private void Awake()
		{
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Expected O, but got Unknown
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Expected O, but got Unknown
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Expected O, but got Unknown
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Expected O, but got Unknown
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Expected O, but got Unknown
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Expected O, but got Unknown
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			ModEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("1. General 常规", "Enable Mod 启用模组", true, "EN: Master switch. Host-only; guests need not install.\n中文:总开关。仅主机生效,客机可不装。");
			FogUseAbsoluteSpeed = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Fog 迷雾", "Use Absolute Speed 使用绝对速度", false, "EN: true = Rise Speed as an absolute value; false = Rise Speed Percent.\n中文:true = 用升起速度绝对值;false = 用升起速度百分比。");
			FogRiseSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("2. Fog 迷雾", "Rise Speed 升起速度", 0.3f, new ConfigDescription("EN: Absolute Orb Fog shrink speed (vanilla 0.3).\n中文:普通迷雾球收缩速度绝对值(原版 0.3)。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 30f), Array.Empty<object>()));
			FogRiseSpeedPercent = ((BaseUnityPlugin)this).Config.Bind<float>("2. Fog 迷雾", "Rise Speed Percent 升起速度百分比", 100f, new ConfigDescription("EN: Orb Fog rise speed %. 100 = vanilla.\n中文:普通迷雾升起速度 %:100=原版。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1000f), Array.Empty<object>()));
			LavaRiseSpeedPercent = ((BaseUnityPlugin)this).Config.Bind<float>("3. Lava 岩浆", "Rise Speed Percent 升起速度百分比", 100f, new ConfigDescription("EN: Kiln lava rise speed %. 100 = vanilla (~60s); higher is faster.\n中文:窑炉岩浆上升速度 %:100=原版(~60s),越大越快。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 1000f), Array.Empty<object>()));
			GloomRiseSpeedPercent = ((BaseUnityPlugin)this).Config.Bind<float>("4. Gloom 幽暗", "Rise Speed Percent 升起速度百分比", 100f, new ConfigDescription("EN: Gloom fog plane rise speed %.\n中文:幽暗迷雾升起平面速度 %。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 1000f), Array.Empty<object>()));
			GloomDrowsyPercent = ((BaseUnityPlugin)this).Config.Bind<float>("4. Gloom 幽暗", "Drowsy Per Second Percent 昏睡每秒百分比", 100f, new ConfigDescription("EN: Gloom drowsy accumulation %. Host syncs to clients via status RPC.\n中文:幽暗昏睡累积速度 %(主机通过状态 RPC 同步给客机)。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1000f), Array.Empty<object>()));
			FogUiEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("5. UI 界面", "Fog UI Enabled 启用迷雾界面", true, "EN: Right-side fog status HUD (vertical list).\n中文:右侧迷雾状态 HUD(竖列)。");
			CampfireLocatorUiEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("5. UI 界面", "Campfire Locator UI Enabled 启用篝火定位条", true, "EN: Top campfire locator bar (while inside fog).\n中文:顶部篝火定位条(在雾内时)。");
			FogUiX = ((BaseUnityPlugin)this).Config.Bind<float>("5. UI 界面", "Fog UI X 界面X", 12f, new ConfigDescription("EN: Right HUD inset from the right edge (smaller = farther right).\n中文:右侧 HUD 距右边缘缩进(越小越靠右)。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2000f), Array.Empty<object>()));
			FogUiY = ((BaseUnityPlugin)this).Config.Bind<float>("5. UI 界面", "Fog UI Y 界面Y", 0f, new ConfigDescription("EN: Right HUD vertical offset from screen midline.\n中文:右侧 HUD 相对屏幕中线的上下偏移。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1000f, 1000f), Array.Empty<object>()));
			FogUiScale = ((BaseUnityPlugin)this).Config.Bind<float>("5. UI 界面", "Fog UI Scale 界面缩放", 1f, new ConfigDescription("EN: Right HUD scale.\n中文:右侧 HUD 缩放。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 2.5f), Array.Empty<object>()));
			new Harmony("youxia173.FogRiseSpeedTweaks").PatchAll();
			_hud = new SpeedHud(this);
			_locator = new CampfireLocatorHud(this);
			WeatherCountdown.Ensure();
			Log.LogInfo((object)"FogRiseSpeedTweaks v1.4.2 loaded (host-authoritative)");
		}

		private void OnDestroy()
		{
			_hud?.Cleanup();
			_locator?.Cleanup();
		}

		private void OnEnable()
		{
			SceneManager.sceneLoaded += OnSceneLoaded;
		}

		private void OnDisable()
		{
			SceneManager.sceneLoaded -= OnSceneLoaded;
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			_baseTravelTime.Clear();
			_baseDrowsyPerSecond.Clear();
			_drowsyDebt.Clear();
			_gloomFields = Array.Empty<StatusFieldGloom>();
			_hud?.Cleanup();
			_locator?.Cleanup();
		}

		private void Update()
		{
			bool flag = HasFogAuthority();
			if (flag != _lastHadAuthority)
			{
				_lastHadAuthority = flag;
				if (!flag)
				{
					RestoreVanillaOnThisClient();
				}
			}
			if (!ModEnabled.Value)
			{
				if (flag)
				{
					RestoreVanillaOnThisClient();
				}
				_hud?.UpdateUi();
				_locator?.UpdateUi();
				return;
			}
			if (flag)
			{
				ApplyOrbFogHost();
				ApplyLavaRisingHost();
				ApplyGloomDrowsyHost();
				SyncFogStateToGuestsIfNeeded();
				SyncLavaToGuestsIfNeeded();
				SyncRemoteDrowsyIfNeeded();
			}
			_hud?.UpdateUi();
			_locator?.UpdateUi();
		}

		internal static bool HasFogAuthority()
		{
			if (PhotonNetwork.InRoom)
			{
				return PhotonNetwork.IsMasterClient;
			}
			return true;
		}

		internal static bool IsChinese()
		{
			//IL_0009: 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_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Invalid comparison between Unknown and I4
			bool flag = HudL10n.PreferCjkFont();
			if (flag)
			{
				Language val = HudL10n.CurrentLanguage();
				bool flag2 = val - 9 <= 1;
				flag = flag2;
			}
			return flag;
		}

		internal static float GetOrbFogSpeed()
		{
			if (FogUseAbsoluteSpeed.Value)
			{
				return Mathf.Max(0f, FogRiseSpeed.Value);
			}
			return 0.3f * Mathf.Max(0f, FogRiseSpeedPercent.Value) / 100f;
		}

		private void RestoreVanillaOnThisClient()
		{
			OrbFogHandler instance = Singleton<OrbFogHandler>.Instance;
			if ((Object)(object)instance != (Object)null)
			{
				instance.speed = 0.3f;
			}
			foreach (KeyValuePair<LavaRising, float> item in _baseTravelTime)
			{
				if ((Object)(object)item.Key != (Object)null)
				{
					item.Key.travelTime = item.Value;
				}
			}
			foreach (KeyValuePair<StatusFieldGloom, float> item2 in _baseDrowsyPerSecond)
			{
				if ((Object)(object)item2.Key != (Object)null)
				{
					((StatusFieldBase)item2.Key).statusAmountPerSecond = item2.Value;
				}
			}
		}

		private void ApplyOrbFogHost()
		{
			OrbFogHandler instance = Singleton<OrbFogHandler>.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				float orbFogSpeed = GetOrbFogSpeed();
				if (!Mathf.Approximately(instance.speed, orbFogSpeed))
				{
					instance.speed = orbFogSpeed;
				}
			}
		}

		private void ApplyLavaRisingHost()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Invalid comparison between Unknown and I4
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Invalid comparison between Unknown and I4
			List<LavaRising> aLL_LAVA = LavaRising.ALL_LAVA;
			if (aLL_LAVA == null || aLL_LAVA.Count == 0)
			{
				return;
			}
			foreach (LavaRising item in aLL_LAVA)
			{
				if (!((Object)(object)item == (Object)null) && (int)item.risingFieldType != 2)
				{
					if (!_baseTravelTime.ContainsKey(item))
					{
						_baseTravelTime[item] = Mathf.Max(0.01f, item.travelTime);
					}
					float num = (((int)item.risingFieldType == 1) ? GloomRiseSpeedPercent.Value : LavaRiseSpeedPercent.Value);
					float num2 = _baseTravelTime[item] / Mathf.Max(0.01f, num / 100f);
					if (!Mathf.Approximately(item.travelTime, num2))
					{
						item.travelTime = num2;
					}
				}
			}
		}

		private void ApplyGloomDrowsyHost()
		{
			if (Time.unscaledTime >= _nextGloomScan)
			{
				_nextGloomScan = Time.unscaledTime + 2f;
				_gloomFields = Object.FindObjectsByType<StatusFieldGloom>((FindObjectsSortMode)0) ?? Array.Empty<StatusFieldGloom>();
			}
			float num = Mathf.Max(0f, GloomDrowsyPercent.Value) / 100f;
			StatusFieldGloom[] gloomFields = _gloomFields;
			foreach (StatusFieldGloom val in gloomFields)
			{
				if (!((Object)(object)val == (Object)null))
				{
					if (!_baseDrowsyPerSecond.ContainsKey(val))
					{
						_baseDrowsyPerSecond[val] = ((StatusFieldBase)val).statusAmountPerSecond;
					}
					float num2 = _baseDrowsyPerSecond[val] * num;
					if (!Mathf.Approximately(((StatusFieldBase)val).statusAmountPerSecond, num2))
					{
						((StatusFieldBase)val).statusAmountPerSecond = num2;
					}
				}
			}
		}

		private void SyncFogStateToGuestsIfNeeded()
		{
			if (!PhotonNetwork.InRoom || PhotonNetwork.CurrentRoom == null || PhotonNetwork.CurrentRoom.PlayerCount <= 1)
			{
				return;
			}
			OrbFogHandler instance = Singleton<OrbFogHandler>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			float unscaledTime = Time.unscaledTime;
			if (unscaledTime - _lastFogSync < 0.18f)
			{
				return;
			}
			_lastFogSync = unscaledTime;
			PhotonView component = ((Component)instance).GetComponent<PhotonView>();
			if ((Object)(object)component == (Object)null)
			{
				return;
			}
			try
			{
				component.RPC("RPCA_SyncFog", (RpcTarget)1, new object[2] { instance.currentSize, instance.isMoving });
			}
			catch (Exception ex)
			{
				Log.LogDebug((object)("Fog sync skipped: " + ex.Message));
			}
		}

		private void SyncLavaToGuestsIfNeeded()
		{
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Invalid comparison between Unknown and I4
			if (!PhotonNetwork.InRoom || PhotonNetwork.CurrentRoom == null || PhotonNetwork.CurrentRoom.PlayerCount <= 1)
			{
				return;
			}
			float unscaledTime = Time.unscaledTime;
			if (unscaledTime - _lastLavaSync < 0.25f)
			{
				return;
			}
			_lastLavaSync = unscaledTime;
			List<LavaRising> aLL_LAVA = LavaRising.ALL_LAVA;
			if (aLL_LAVA == null)
			{
				return;
			}
			foreach (LavaRising item in aLL_LAVA)
			{
				if ((Object)(object)item == (Object)null || !item.started || item.ended || (int)item.risingFieldType == 2)
				{
					continue;
				}
				float value;
				float num = (_baseTravelTime.TryGetValue(item, out value) ? value : 60f);
				float num2 = ((item.travelTime > 0.01f) ? Mathf.Clamp01(item.timeTraveled / item.travelTime) : 0f) * num;
				PhotonView component = ((Component)item).GetComponent<PhotonView>();
				if (!((Object)(object)component == (Object)null))
				{
					try
					{
						component.RPC("RPC_SyncLava", (RpcTarget)1, new object[4] { item.started, item.ended, num2, item.secondsWaitedToStart });
					}
					catch (Exception ex)
					{
						Log.LogDebug((object)("Lava sync skipped: " + ex.Message));
					}
				}
			}
		}

		private void SyncRemoteDrowsyIfNeeded()
		{
			float num = Mathf.Max(0f, GloomDrowsyPercent.Value) / 100f;
			if (Mathf.Approximately(num, 1f))
			{
				_drowsyDebt.Clear();
			}
			else
			{
				if (!PhotonNetwork.InRoom || PhotonNetwork.CurrentRoom == null || PhotonNetwork.CurrentRoom.PlayerCount <= 1)
				{
					return;
				}
				float unscaledTime = Time.unscaledTime;
				float num2 = ((_lastDrowsySync < 0f) ? 0.35f : (unscaledTime - _lastDrowsySync));
				if (num2 < 0.35f)
				{
					return;
				}
				_lastDrowsySync = unscaledTime;
				foreach (Character allCharacter in Character.AllCharacters)
				{
					if ((Object)(object)allCharacter == (Object)null || (Object)(object)((MonoBehaviourPun)allCharacter).photonView == (Object)null || ((MonoBehaviourPun)allCharacter).photonView.IsMine || allCharacter.isBot || allCharacter.isZombie || (Object)(object)allCharacter.data == (Object)null || allCharacter.data.dead || (Object)(object)allCharacter.refs?.afflictions == (Object)null)
					{
						continue;
					}
					float num3 = 0f;
					bool flag = false;
					StatusFieldGloom[] gloomFields = _gloomFields;
					foreach (StatusFieldGloom val in gloomFields)
					{
						if (!((Object)(object)val == (Object)null) && ((StatusFieldBase)val).CharacterInField(allCharacter))
						{
							flag = true;
							num3 = ((!_baseDrowsyPerSecond.TryGetValue(val, out var value)) ? Mathf.Max(num3, ((StatusFieldBase)val).statusAmountPerSecond / Mathf.Max(num, 0.01f)) : Mathf.Max(num3, value));
						}
					}
					if (!flag || num3 <= 0f)
					{
						_drowsyDebt.Remove(((MonoBehaviourPun)allCharacter).photonView.ViewID);
						continue;
					}
					float num4 = num3 * (num - 1f);
					int viewID = ((MonoBehaviourPun)allCharacter).photonView.ViewID;
					float value2;
					float num5 = (_drowsyDebt.TryGetValue(viewID, out value2) ? value2 : 0f) + num4 * num2;
					float num6 = num5;
					num6 = Mathf.Clamp(num6, -0.15f, 0.15f);
					if (Mathf.Abs(num6) < 0.0005f)
					{
						_drowsyDebt[viewID] = num5;
						continue;
					}
					_drowsyDebt[viewID] = num5 - num6;
					int num7 = 6;
					float[] array = new float[16];
					if (num7 >= 0 && num7 < array.Length)
					{
						array[num7] = num6;
					}
					try
					{
						((MonoBehaviourPun)allCharacter).photonView.RPC("RPC_ApplyStatusesFromFloatArray", ((MonoBehaviourPun)allCharacter).photonView.Owner, new object[1] { array });
					}
					catch (Exception ex)
					{
						Log.LogDebug((object)("Drowsy sync skipped: " + ex.Message));
					}
				}
			}
		}
	}
	[HarmonyPatch(typeof(OrbFogHandler), "Move")]
	internal static class OrbFogMoveGuestPatch
	{
		private static void Prefix(OrbFogHandler __instance)
		{
			if (!((Object)(object)Plugin.Instance == (Object)null) && Plugin.ModEnabled.Value && !Plugin.HasFogAuthority())
			{
				__instance.speed = 0.3f;
			}
		}
	}
	internal sealed class SpeedHud
	{
		private enum HazardHudMode
		{
			None,
			OrbFog,
			Gloom,
			Lava
		}

		private sealed class HudRow
		{
			public GameObject Go;

			public RectTransform Rt;

			public TextMeshProUGUI Label;

			public TextMeshProUGUI Value;

			public string LastLabel = string.Empty;

			public string LastValue = string.Empty;

			public Color LastColor;
		}

		private const float RowHeight = 26f;

		private const float RowGap = 2f;

		private const int MaxRows = 12;

		private RectTransform? _root;

		private Canvas? _pinnedCanvas;

		private readonly List<HudRow> _rows = new List<HudRow>(12);

		private string _lastFingerprint = string.Empty;

		private float _nextContentRefresh;

		private float _appliedScale = float.NaN;

		private float _appliedX = float.NaN;

		private float _appliedY = float.NaN;

		private Language _appliedLang = (Language)(-1);

		private int _activeRows;

		public SpeedHud(Plugin plugin)
		{
		}//IL_003b: Unknown result type (might be due to invalid IL or missing references)


		public void Cleanup()
		{
			if ((Object)(object)_root != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)_root).gameObject);
			}
			_root = null;
			_pinnedCanvas = null;
			_rows.Clear();
			_lastFingerprint = string.Empty;
			_activeRows = 0;
			_appliedScale = float.NaN;
			HudUi.DestroyFallbackCanvasIfOrphan();
		}

		public void UpdateUi()
		{
			if (!Plugin.FogUiEnabled.Value)
			{
				if ((Object)(object)_root != (Object)null && ((Component)_root).gameObject.activeSelf)
				{
					((Component)_root).gameObject.SetActive(false);
				}
				return;
			}
			if (!HudUi.IsGameplayOrAirportScene() || LoadingScreenHandler.loading)
			{
				if ((Object)(object)_root != (Object)null && ((Component)_root).gameObject.activeSelf)
				{
					((Component)_root).gameObject.SetActive(false);
				}
				return;
			}
			if ((Object)(object)_root == (Object)null)
			{
				_rows.Clear();
				_pinnedCanvas = null;
			}
			if ((Object)(object)_root == (Object)null)
			{
				Canvas val = HudUi.ResolveHudCanvas();
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				Create(val);
			}
			else if ((Object)(object)_pinnedCanvas != (Object)null && !((Behaviour)_pinnedCanvas).isActiveAndEnabled)
			{
				if (((Component)_root).gameObject.activeSelf)
				{
					((Component)_root).gameObject.SetActive(false);
				}
				return;
			}
			if ((Object)(object)_root == (Object)null || _rows.Count == 0)
			{
				return;
			}
			if (!((Component)_root).gameObject.activeSelf)
			{
				((Component)_root).gameObject.SetActive(true);
			}
			MaybeApplyLayout();
			if (!(Time.unscaledTime < _nextContentRefresh))
			{
				_nextContentRefresh = Time.unscaledTime + 0.25f;
				BuildRows(out List<(string, string, Color)> rows, out string fingerprint);
				if (!string.Equals(_lastFingerprint, fingerprint, StringComparison.Ordinal))
				{
					_lastFingerprint = fingerprint;
					ApplyRows(rows);
				}
			}
		}

		private void Create(Canvas canvas)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0064: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			Cleanup();
			_pinnedCanvas = canvas;
			GameObject val = new GameObject("FogRiseSpeedTweaks_HUD", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(((Component)canvas).transform, false);
			val.transform.SetAsLastSibling();
			_root = val.GetComponent<RectTransform>();
			_root.anchorMin = new Vector2(1f, 0.5f);
			_root.anchorMax = new Vector2(1f, 0.5f);
			_root.pivot = new Vector2(1f, 0.5f);
			for (int i = 0; i < 12; i++)
			{
				_rows.Add(CreateRow(i));
			}
			_lastFingerprint = string.Empty;
			_nextContentRefresh = 0f;
			_appliedScale = float.NaN;
			MaybeApplyLayout();
		}

		private HudRow CreateRow(int index)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_004d: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject($"Row_{index}", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent((Transform)(object)_root, false);
			RectTransform component = val.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0f, 1f);
			component.anchorMax = new Vector2(1f, 1f);
			component.pivot = new Vector2(0.5f, 1f);
			TextMeshProUGUI label = CreateCell(component, "Label", (TextAlignmentOptions)4100);
			TextMeshProUGUI value = CreateCell(component, "Value", (TextAlignmentOptions)4097);
			val.SetActive(false);
			return new HudRow
			{
				Go = val,
				Rt = component,
				Label = label,
				Value = value
			};
		}

		private static TextMeshProUGUI CreateCell(RectTransform parent, string name, TextAlignmentOptions align)
		{
			//IL_0014: 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_002c: 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_004e: 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_006e: 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)
			GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
			val.transform.SetParent((Transform)(object)parent, false);
			TextMeshProUGUI obj = val.AddComponent<TextMeshProUGUI>();
			ApplyTextStyle(obj, Color.white);
			((TMP_Text)obj).alignment = align;
			RectTransform rectTransform = ((TMP_Text)obj).rectTransform;
			rectTransform.anchorMin = new Vector2(0f, 0f);
			rectTransform.anchorMax = new Vector2(1f, 1f);
			rectTransform.offsetMin = Vector2.zero;
			rectTransform.offsetMax = Vector2.zero;
			return obj;
		}

		private static void ApplyTextStyle(TextMeshProUGUI text, Color color)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			HudUi.ApplyGameTextStyle(text, color);
			((TMP_Text)text).textWrappingMode = (TextWrappingModes)0;
			((TMP_Text)text).overflowMode = (TextOverflowModes)0;
			((TMP_Text)text).richText = false;
			((TMP_Text)text).lineSpacing = 0f;
		}

		private void MaybeApplyLayout()
		{
			//IL_000f: 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_008d: 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_00cb: 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_00e1: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: 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_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_root == (Object)null)
			{
				return;
			}
			Language val = HudL10n.CurrentLanguage();
			float value = Plugin.FogUiScale.Value;
			float value2 = Plugin.FogUiX.Value;
			float value3 = Plugin.FogUiY.Value;
			if (float.IsNaN(_appliedScale) || !Mathf.Approximately(_appliedScale, value) || !Mathf.Approximately(_appliedX, value2) || !Mathf.Approximately(_appliedY, value3) || _appliedLang != val)
			{
				_appliedScale = value;
				_appliedX = value2;
				_appliedY = value3;
				_appliedLang = val;
				HudL10n.LayoutMetrics layoutMetrics = HudL10n.Layout();
				float num = (float)Mathf.Max(1, (_activeRows > 0) ? _activeRows : 12) * 28f;
				_root.sizeDelta = new Vector2(layoutMetrics.PanelWidth, num);
				((Transform)_root).localScale = Vector3.one * value;
				_root.anchoredPosition = new Vector2(0f - value2, value3);
				float gap = layoutMetrics.Gap;
				float labelWidth = layoutMetrics.LabelWidth;
				for (int i = 0; i < _rows.Count; i++)
				{
					HudRow hudRow = _rows[i];
					hudRow.Rt.anchoredPosition = new Vector2(0f, (float)(-i) * 28f);
					hudRow.Rt.sizeDelta = new Vector2(0f, 26f);
					((TMP_Text)hudRow.Label).rectTransform.anchorMin = new Vector2(0f, 0f);
					((TMP_Text)hudRow.Label).rectTransform.anchorMax = new Vector2(0f, 1f);
					((TMP_Text)hudRow.Label).rectTransform.pivot = new Vector2(1f, 0.5f);
					((TMP_Text)hudRow.Label).rectTransform.anchoredPosition = new Vector2(labelWidth, 0f);
					((TMP_Text)hudRow.Label).rectTransform.sizeDelta = new Vector2(labelWidth, 0f);
					((TMP_Text)hudRow.Value).rectTransform.anchorMin = new Vector2(0f, 0f);
					((TMP_Text)hudRow.Value).rectTransform.anchorMax = new Vector2(1f, 1f);
					((TMP_Text)hudRow.Value).rectTransform.offsetMin = new Vector2(labelWidth + gap, 0f);
					((TMP_Text)hudRow.Value).rectTransform.offsetMax = Vector2.zero;
				}
			}
		}

		private void ApplyRows(List<(string label, string value, Color color)> rows)
		{
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: 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_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			_activeRows = Mathf.Min(rows.Count, _rows.Count);
			for (int i = 0; i < _rows.Count; i++)
			{
				HudRow hudRow = _rows[i];
				if (i >= _activeRows)
				{
					if (hudRow.Go.activeSelf)
					{
						hudRow.Go.SetActive(false);
					}
					continue;
				}
				if (!hudRow.Go.activeSelf)
				{
					hudRow.Go.SetActive(true);
				}
				if (!string.Equals(hudRow.LastLabel, rows[i].label, StringComparison.Ordinal))
				{
					hudRow.LastLabel = rows[i].label;
					((TMP_Text)hudRow.Label).text = rows[i].label;
				}
				if (!string.Equals(hudRow.LastValue, rows[i].value, StringComparison.Ordinal) || hudRow.LastColor != rows[i].color)
				{
					hudRow.LastValue = rows[i].value;
					hudRow.LastColor = rows[i].color;
					((TMP_Text)hudRow.Value).text = rows[i].value;
					((Graphic)hudRow.Value).color = rows[i].color;
				}
			}
			if ((Object)(object)_root != (Object)null)
			{
				float num = (float)Mathf.Max(1, _activeRows) * 28f;
				Vector2 sizeDelta = _root.sizeDelta;
				if (!Mathf.Approximately(sizeDelta.y, num))
				{
					sizeDelta.y = num;
					_root.sizeDelta = sizeDelta;
				}
			}
		}

		private void BuildRows(out List<(string label, string value, Color color)> rows, out string fingerprint)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected I4, but got Unknown
			//IL_0078: 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)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: 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)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: 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_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: 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_01b9: Unknown result type (might be due to invalid IL or missing references)
			rows = new List<(string, string, Color)>(12);
			StringBuilder stringBuilder = new StringBuilder(256);
			stringBuilder.Append((int)HudL10n.CurrentLanguage()).Append('|');
			string value = ((!Plugin.ModEnabled.Value) ? HudL10n.T("Off") : (Plugin.HasFogAuthority() ? HudL10n.T("Host") : HudL10n.T("Guest")));
			string text = HudL10n.Dash();
			Add(rows, stringBuilder, HudL10n.T("Status"), value, Hex("#FFE08A"));
			if (!TryGetDayNightCountdown(out string label, out string value2, out Color color))
			{
				label = HudL10n.T("ToNight");
				value2 = text;
				color = Hex("#FFB86B");
			}
			Add(rows, stringBuilder, label, value2, color);
			Character localCharacter = Character.localCharacter;
			bool flag = (Object)(object)localCharacter != (Object)null && (Object)(object)localCharacter.data != (Object)null && !localCharacter.data.dead;
			Vector3 val = (flag ? localCharacter.Center : Vector3.zero);
			Vector3 position;
			bool num = TryGetReferencePoint(out position);
			Vector3 position2;
			bool flag2 = TryGetNextCampfirePosition(out position2);
			Add(value: (num && flag2) ? FormatMeters(Vector3.Distance(position, position2)) : text, rows: rows, fp: stringBuilder, label: HudL10n.T("CampDist"), color: Hex("#A8FFB0"));
			string value3 = ((num && flag) ? FormatMeters(Vector3.Distance(position, val)) : text);
			Add(rows, stringBuilder, HudL10n.T("ClimbDist"), value3, Color.white);
			HazardHudMode hazardHudMode = DetectHazardMode();
			switch (hazardHudMode)
			{
			case HazardHudMode.None:
				AppendInactiveHazardRows(rows, stringBuilder, text);
				break;
			case HazardHudMode.Gloom:
				AppendRisingRows(rows, stringBuilder, text, flag, val, localCharacter, gloom: true);
				break;
			case HazardHudMode.Lava:
				AppendRisingRows(rows, stringBuilder, text, flag, val, localCharacter, gloom: false);
				break;
			default:
				AppendOrbFogRows(rows, stringBuilder, text, flag, val);
				break;
			}
			if (hazardHudMode != HazardHudMode.None)
			{
				AppendBiomeWeatherRows(rows, stringBuilder, text);
			}
			fingerprint = stringBuilder.ToString();
		}

		private static void AppendInactiveHazardRows(List<(string label, string value, Color color)> rows, StringBuilder fp, string dash)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: 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)
			Add(rows, fp, HudL10n.T("FogDist"), dash, Hex("#7FD3FF"));
			Add(rows, fp, HudL10n.T("FogEta"), dash, Hex("#A8FFB0"));
			Add(rows, fp, HudL10n.T("TrigDist"), dash, Hex("#FFD27A"));
			Add(rows, fp, HudL10n.T("TrigCount"), dash, Hex("#FFD27A"));
			Add(rows, fp, HudL10n.T("FogSoon"), dash, Hex("#FFE566"));
		}

		private static void AppendBiomeWeatherRows(List<(string label, string value, Color color)> rows, StringBuilder fp, string dash)
		{
			//IL_0015: 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_0023: 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_0027: Invalid comparison between Unknown and I4
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Invalid comparison between Unknown and I4
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Invalid comparison between Unknown and I4
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Invalid comparison between Unknown and I4
			//IL_005f: 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_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Invalid comparison between Unknown and I4
			//IL_00b6: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: 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_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			BiomeType currentBiome;
			try
			{
				MapHandler instance = Singleton<MapHandler>.Instance;
				if ((Object)(object)instance == (Object)null)
				{
					return;
				}
				currentBiome = instance.GetCurrentBiome();
			}
			catch
			{
				return;
			}
			if ((currentBiome - 1 <= 1 || (int)currentBiome == 7) ? true : false)
			{
				string label;
				string label2;
				Color color;
				if ((int)currentBiome != 1)
				{
					if ((int)currentBiome == 2)
					{
						label = HudL10n.T("BlizzStart");
						label2 = HudL10n.T("BlizzEnd");
						color = Hex("#C8E7FF");
					}
					else
					{
						label = HudL10n.T("WindStart");
						label2 = HudL10n.T("WindEnd");
						color = Hex("#B8F0C8");
					}
				}
				else
				{
					label = HudL10n.T("RainStart");
					label2 = HudL10n.T("RainEnd");
					color = Hex("#7EC8FF");
				}
				string value = dash;
				string value2 = dash;
				if (WeatherCountdown.TryGetWindChillCountdown(currentBiome, out var stormActive, out var secondsRemaining, out var _))
				{
					if (stormActive)
					{
						value = HudL10n.T("Active");
						value2 = FormatSeconds(secondsRemaining);
					}
					else
					{
						value = FormatSeconds(secondsRemaining);
						value2 = HudL10n.T("Idle");
					}
				}
				Add(rows, fp, label, value, color);
				Add(rows, fp, label2, value2, color);
			}
			else if ((int)currentBiome == 6)
			{
				float secondsRemaining2;
				string value3 = (WeatherCountdown.TryGetTornadoCountdown(out secondsRemaining2) ? FormatSeconds(secondsRemaining2) : dash);
				Add(rows, fp, HudL10n.T("Tornado"), value3, Hex("#E8C07A"));
			}
		}

		private static HazardHudMode DetectHazardMode()
		{
			//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_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Invalid comparison between Unknown and I4
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Invalid comparison between Unknown and I4
			//IL_0029: 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)
			Segment currentSegmentNumber = MapHandler.CurrentSegmentNumber;
			if ((int)currentSegmentNumber == 6 || IsVoidBiome())
			{
				return HazardHudMode.None;
			}
			if (IsGloomBiome())
			{
				return HazardHudMode.Gloom;
			}
			if ((int)currentSegmentNumber == 4)
			{
				return HazardHudMode.Lava;
			}
			if ((int)currentSegmentNumber == 3)
			{
				return HazardHudMode.Lava;
			}
			LavaRising val = FindRisingForSegment((RisingFieldType)1, currentSegmentNumber);
			LavaRising val2 = FindRisingForSegment((RisingFieldType)0, currentSegmentNumber);
			if ((Object)(object)val != (Object)null && (val.started || !IsOrbFogRelevant()))
			{
				return HazardHudMode.Gloom;
			}
			if ((Object)(object)val2 != (Object)null && val2.started)
			{
				return HazardHudMode.Lava;
			}
			return HazardHudMode.OrbFog;
		}

		private static bool IsVoidBiome()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Invalid comparison between Unknown and I4
			try
			{
				MapHandler instance = Singleton<MapHandler>.Instance;
				if ((Object)(object)instance == (Object)null)
				{
					return false;
				}
				return (int)instance.GetCurrentBiome() == 17;
			}
			catch
			{
				return false;
			}
		}

		private static bool IsGloomBiome()
		{
			//IL_0014: 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_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Invalid comparison between Unknown and I4
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Invalid comparison between Unknown and I4
			try
			{
				MapHandler instance = Singleton<MapHandler>.Instance;
				if ((Object)(object)instance == (Object)null)
				{
					return false;
				}
				BiomeType currentBiome = instance.GetCurrentBiome();
				return (int)currentBiome == 8 || (int)currentBiome == 9;
			}
			catch
			{
				return false;
			}
		}

		private static bool IsOrbFogRelevant()
		{
			OrbFogHandler instance = Singleton<OrbFogHandler>.Instance;
			if ((Object)(object)instance == (Object)null || IsCurrentFogDisabled(instance) || !IsFogSphereActive(instance))
			{
				return false;
			}
			if (instance.hasArrived)
			{
				return instance.isMoving;
			}
			return true;
		}

		private static LavaRising? FindRisingForSegment(RisingFieldType type, Segment seg)
		{
			//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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			List<LavaRising> aLL_LAVA = LavaRising.ALL_LAVA;
			if (aLL_LAVA == null || aLL_LAVA.Count == 0)
			{
				return null;
			}
			LavaRising val = null;
			for (int i = 0; i < aLL_LAVA.Count; i++)
			{
				LavaRising val2 = aLL_LAVA[i];
				if (!((Object)(object)val2 == (Object)null) && val2.risingFieldType == type && val2.requiredSegment == seg)
				{
					if ((Object)(object)val == (Object)null)
					{
						val = val2;
					}
					else if (Score(val2) > Score(val))
					{
						val = val2;
					}
				}
			}
			return val;
			static int Score(LavaRising r)
			{
				if (r.started && !r.ended)
				{
					return 3;
				}
				if (!r.started && !r.ended)
				{
					return 2;
				}
				return 1;
			}
		}

		private static LavaRising? FindAnyRising(RisingFieldType type)
		{
			//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)
			List<LavaRising> aLL_LAVA = LavaRising.ALL_LAVA;
			if (aLL_LAVA == null || aLL_LAVA.Count == 0)
			{
				return null;
			}
			LavaRising val = null;
			for (int i = 0; i < aLL_LAVA.Count; i++)
			{
				LavaRising val2 = aLL_LAVA[i];
				if (!((Object)(object)val2 == (Object)null) && val2.risingFieldType == type)
				{
					if ((Object)(object)val == (Object)null)
					{
						val = val2;
					}
					else if (val2.started && !val2.ended && (!val.started || val.ended))
					{
						val = val2;
					}
				}
			}
			return val;
		}

		private static void AppendOrbFogRows(List<(string label, string value, Color color)> rows, StringBuilder fp, string dash, bool hasPlayer, Vector3 playerPos)
		{
			//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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: 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_003f: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: 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_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			OrbFogHandler instance = Singleton<OrbFogHandler>.Instance;
			Vector3 fogPoint = Vector3.zero;
			bool flag = (Object)(object)instance != (Object)null && TryGetFogPoint(instance, out fogPoint);
			string value = dash;
			if ((Object)(object)instance != (Object)null && hasPlayer && flag && IsFogSphereActive(instance))
			{
				float num = instance.currentSize - Vector3.Distance(fogPoint, playerPos);
				value = ((num <= 0.05f) ? HudL10n.T("InFog") : FormatMeters(num));
			}
			Add(rows, fp, HudL10n.T("FogDist"), value, Hex("#7FD3FF"));
			string value2 = dash;
			if ((Object)(object)instance != (Object)null && hasPlayer && flag && IsFogSphereActive(instance))
			{
				float num2 = instance.currentSize - Vector3.Distance(fogPoint, playerPos);
				if (num2 <= 0.05f)
				{
					value2 = HudL10n.T("InFog");
				}
				else
				{
					float num3 = Mathf.Max(instance.speed, 0.001f);
					value2 = FormatSeconds(num2 / num3);
				}
			}
			Add(rows, fp, HudL10n.T("FogEta"), value2, Hex("#A8FFB0"));
			string value3 = dash;
			bool flag2 = IsCurrentFogDisabled(instance);
			if (flag2)
			{
				value3 = HudL10n.T("NoFog");
			}
			else if ((Object)(object)instance != (Object)null && hasPlayer && IsFinite(instance.currentStartHeight) && IsFinite(instance.currentStartForward) && AreTriggerGatesSane(instance, playerPos))
			{
				float num4 = Mathf.Max(0f, instance.currentStartHeight - playerPos.y);
				float num5 = Mathf.Max(0f, instance.currentStartForward - playerPos.z);
				float num6 = Mathf.Sqrt(num4 * num4 + num5 * num5);
				value3 = ((num6 <= 0.05f) ? HudL10n.T("Passed") : FormatMeters(num6));
			}
			Add(rows, fp, HudL10n.T("TrigDist"), value3, Hex("#FFD27A"));
			string value4 = dash;
			if (!flag2 && TryGetTriggerProgress(instance, out var passed, out var total))
			{
				value4 = $"{passed}/{total}";
			}
			Add(rows, fp, HudL10n.T("TrigCount"), value4, Hex("#FFD27A"));
			string text = dash;
			Add(value: ((Object)(object)instance == (Object)null) ? dash : (flag2 ? HudL10n.T("Disabled") : (instance.hasArrived ? HudL10n.T("Done") : (instance.isMoving ? HudL10n.T("Rising") : ((Ascents.currentAscent >= 0) ? FormatSeconds(Mathf.Max(0f, instance.maxWaitTime - instance.currentWaitTime)) : dash)))), rows: rows, fp: fp, label: HudL10n.T("FogSoon"), color: Hex("#FFE566"));
		}

		private static void AppendRisingRows(List<(string label, string value, Color color)> rows, StringBuilder fp, string dash, bool hasPlayer, Vector3 playerPos, Character? local, bool gloom)
		{
			//IL_0397: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a8: Unknown result type (might be due to