Decompiled source of KikisFog v0.10.0
plugins/KikisFog.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Peak; using Peak.Afflictions; 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 = ".NET Standard 2.1")] [assembly: AssemblyCompany("KikisFog")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.10.0.0")] [assembly: AssemblyInformationalVersion("0.10.0")] [assembly: AssemblyProduct("KikisFog")] [assembly: AssemblyTitle("KikisFog")] [assembly: AssemblyVersion("0.10.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [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 KFOG { [BepInPlugin("kikisfog.peak.kfog", "Kikis Fog", "0.10.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string GUID = "kikisfog.peak.kfog"; public const string NAME = "Kikis Fog"; public const string VERSION = "0.10.0"; internal static Plugin I; internal static ManualLogSource L; private static readonly CultureInfo Inv = CultureInfo.InvariantCulture; internal static ConfigEntry<float> FogDelay; internal static ConfigEntry<float> FogSpeed; internal static ConfigEntry<bool> DeadlyFog; internal static ConfigEntry<float> FogTolerance; internal static ConfigEntry<float> CampfireSafeRadius; internal static ConfigEntry<float> GloomDelay; internal static ConfigEntry<float> GloomSpeed; internal static ConfigEntry<bool> DeadlyGloom; internal static ConfigEntry<float> GloomTolerance; internal static ConfigEntry<float> LavaDelay; internal static ConfigEntry<float> LavaSpeed; internal static ConfigEntry<bool> CalderaNeverLowers; internal static ConfigEntry<float> SoulsDelay; internal static ConfigEntry<float> SoulsSpeed; internal static ConfigEntry<bool> AutoRevive; internal static ConfigEntry<float> WaitRevive; internal static ConfigEntry<float> ForcedRevive; internal static ConfigEntry<float> DayLength; internal static ConfigEntry<float> NightLength; internal static ConfigEntry<bool> EternalNight; private const float SYNC_INTERVAL = 0.18f; private const float SYNC_MIN_DELTA = 0.35f; private const float PAUSED_SYNC_INTERVAL = 0.5f; private const float QUIET_AFTER_ORIGIN = 3f; private const float QUIET_AFTER_JOIN = 8f; private const float TRANSITION_TIMEOUT = 90f; private const float KILL_RESEND = 10f; private const float STATUE_SKIP_WINDOW = 2f; private const float HEALTHY_WINDOW = 2f; private const float STALL_RESUME = 3f; private const float PAUSE_HOLD = 0.5f; private const float REVIVE_TICK = 0.25f; private const float REVIVE_RESEND = 5f; private const float REVIVE_HEIGHT = 2.5f; private const float REVIVE_GROUND_RAY = 8f; private const float REVIVE_FOG_MARGIN = 5f; private const float REVIVE_GROUND_HOLD = 1f; private static readonly float[] SpotRadii = new float[3] { 1.1f, 1.6f, 2.2f }; private const int SPOT_DIRECTIONS = 12; private const float SPOT_CHEST_UP = 0.2f; private const float SPOT_PROBE_RADIUS = 0.3f; private const float SPOT_BODY_RADIUS = 0.35f; private const float SPOT_EDGE = 0.7f; private const float SPOT_MAX_STEP = 0.6f; private const float SPOT_SLOPE_PER_UNIT = 0.4f; private const float SPOT_BODY_FLOOR = 0.35f; private const float SPOT_MIN_NORMAL_Y = 0.77f; private const float SPOT_HEAD_EXTRA = 0.4f; private const float SPOT_LIFT = 0.25f; private const float SPOT_PERSON_GAP = 0.9f; internal static bool InTransition; private static float _transitionStartedAt; private float _quietUntil; private OrbFogHandler _fog; private FogSphere _sphere; private static OrbFogHandler _originsOwner; private static FogSphereOrigin[] _origins; private bool _stageControlled; private float _lastHealthyTick = -999f; private int _stageId = -1; private float _delayElapsed; private bool _delayDone; private float _stalledSince = -1f; private bool _paused; private bool _campfireResolved; private bool _campfireFound; private Vector3 _campfirePos; private float _nextCampfireTry; private float _nextSync; private float _nextPausedSync; private float _lastSentSize = float.NaN; private bool _lastSentMoving; private int _lastPlayerCount; private readonly Dictionary<int, float> _insideSince = new Dictionary<int, float>(); private readonly Dictionary<int, float> _killSentAt = new Dictionary<int, float>(); private readonly Dictionary<int, float> _flagNotedAt = new Dictionary<int, float>(); private readonly Dictionary<int, float> _petrifySentAt = new Dictionary<int, float>(); private readonly List<Character> _victims = new List<Character>(); private float _nextDeadly; private const float GSPEED_WINDOW = 10f; private const float GSPEED_MIN_SPAN = 6f; private const float GSPEED_GAP = 1f; private readonly Queue<Vector2> _gSamples = new Queue<Vector2>(); private int _gOrigin = int.MinValue; private float _gLastSample = -999f; private RectTransform _hudRoot; private TextMeshProUGUI _hudText; private string _hudLast; private float _nextHud; private readonly Dictionary<int, float> _deadSince = new Dictionary<int, float>(); private readonly Dictionary<int, Vector3> _lastAlivePos = new Dictionary<int, Vector3>(); private readonly Dictionary<int, float> _reviveSentAt = new Dictionary<int, float>(); private readonly Dictionary<int, float> _noAnchorNotedAt = new Dictionary<int, float>(); private readonly Dictionary<int, float> _groundedSince = new Dictionary<int, float>(); private readonly List<Character> _toRevive = new List<Character>(); private float _nextRevive; private int _spreadIndex; private float _spreadResetAt; private int _spotAngleIndex; private readonly List<Vector3> _recentSpots = new List<Vector3>(); private readonly Dictionary<string, float> _errLogged = new Dictionary<string, float>(); private readonly Dictionary<LavaRising, float> _riserNextSync = new Dictionary<LavaRising, float>(); private readonly Dictionary<LavaRising, StatusFieldGloom[]> _gloomFields = new Dictionary<LavaRising, StatusFieldGloom[]>(); private readonly HashSet<LavaRising> _riserStartLogged = new HashSet<LavaRising>(); private readonly Dictionary<int, float> _gloomInsideSince = new Dictionary<int, float>(); private float _nextDeadlyGloom; private const float CALDERA_TOP = 0.7f; private readonly List<Animator> _calderaAnims = new List<Animator>(); private readonly List<PhotonView> _calderaViews = new List<PhotonView>(); private float _nextCalderaScan; private float _nextCalderaSync; private bool _calderaLogged; internal static bool IsAuthority { get { if (PhotonNetwork.InRoom) { return PhotonNetwork.IsMasterClient; } return true; } } private void Awake() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Expected O, but got Unknown //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Expected O, but got Unknown //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Expected O, but got Unknown //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Expected O, but got Unknown //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Expected O, but got Unknown //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Expected O, but got Unknown //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Expected O, but got Unknown //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Expected O, but got Unknown //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Expected O, but got Unknown //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_0439: Expected O, but got Unknown //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Expected O, but got Unknown //IL_04ab: Unknown result type (might be due to invalid IL or missing references) I = this; L = ((BaseUnityPlugin)this).Logger; FogDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Fog", "Fog Delay (s)", 360f, new ConfigDescription("Seconds the fog waits in each fog stage before it starts rising.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1800f), Array.Empty<object>())); FogSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Fog", "Fog Speed", 1f, new ConfigDescription("How fast the fog rises.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 20f), Array.Empty<object>())); DeadlyFog = ((BaseUnityPlugin)this).Config.Bind<bool>("Fog", "Deadly Fog", false, "Whoever stands in the fog turns to stone."); FogTolerance = ((BaseUnityPlugin)this).Config.Bind<float>("Fog", "Deadly Fog Tolerance (s)", 1f, new ConfigDescription("How long someone can stand in the fog before it kills.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); CampfireSafeRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Fog", "Campfire Safe Radius (m)", 50f, new ConfigDescription("The fog stops this far away from the campfire.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 200f), Array.Empty<object>())); GloomDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Gloom", "Gloom Delay (s)", 150f, new ConfigDescription("Seconds the gloom in the Citadel waits before it starts rising.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1800f), Array.Empty<object>())); GloomSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Gloom", "Gloom Speed", 1f, new ConfigDescription("How fast the gloom rises. 1 = normal.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 20f), Array.Empty<object>())); DeadlyGloom = ((BaseUnityPlugin)this).Config.Bind<bool>("Gloom", "Deadly Gloom", false, "Whoever stands in the rising gloom turns to stone. Lit candles and fires still protect."); GloomTolerance = ((BaseUnityPlugin)this).Config.Bind<float>("Gloom", "Deadly Gloom Tolerance (s)", 1f, new ConfigDescription("How long someone can stand in the gloom before it kills.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); LavaDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Lava", "Kiln Lava Delay (s)", 180f, new ConfigDescription("Seconds the lava in the Kiln waits before it starts rising.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1800f), Array.Empty<object>())); LavaSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Lava", "Kiln Lava Speed", 1f, new ConfigDescription("How fast the lava in the Kiln rises. 1 = normal.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 20f), Array.Empty<object>())); CalderaNeverLowers = ((BaseUnityPlugin)this).Config.Bind<bool>("Lava", "Caldera Lava Never Lowers", false, "The lava in the Caldera stays up."); SoulsDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Nadir", "Souls Delay (s)", 0f, new ConfigDescription("Seconds the rising souls wait after a soul was freed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1800f), Array.Empty<object>())); SoulsSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Nadir", "Souls Speed", 1f, new ConfigDescription("How fast the souls rise. 1 = normal.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 20f), Array.Empty<object>())); AutoRevive = ((BaseUnityPlugin)this).Config.Bind<bool>("Auto Revive", "Auto Revive", false, "Dead players come back to life next to a teammate."); WaitRevive = ((BaseUnityPlugin)this).Config.Bind<float>("Auto Revive", "Wait Revive (s)", 30f, new ConfigDescription("Seconds a player stays dead before coming back.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 500f), Array.Empty<object>())); ForcedRevive = ((BaseUnityPlugin)this).Config.Bind<float>("Auto Revive", "Forced Revive (s)", 60f, new ConfigDescription("Seconds a player stays dead before coming back even without a safe spot. Never below Wait Revive.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 500f), Array.Empty<object>())); KeepForcedAtLeastWait(); WaitRevive.SettingChanged += delegate { KeepForcedAtLeastWait(); }; ForcedRevive.SettingChanged += delegate { KeepForcedAtLeastWait(); }; DayLength = ((BaseUnityPlugin)this).Config.Bind<float>("Day & Night", "Day Length (x)", 1f, new ConfigDescription("How long the day lasts. 2 = twice as long, 0.5 = half as long.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.25f, 10f), Array.Empty<object>())); NightLength = ((BaseUnityPlugin)this).Config.Bind<float>("Day & Night", "Night Length (x)", 1f, new ConfigDescription("How long the night lasts. 2 = twice as long, 0.5 = half as long.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.25f, 10f), Array.Empty<object>())); EternalNight = ((BaseUnityPlugin)this).Config.Bind<bool>("Day & Night", "Eternal Night", false, "After midnight it stays deep night."); Weather.Bind(((BaseUnityPlugin)this).Config); try { new Harmony("kikisfog.peak.kfog").PatchAll(typeof(Plugin).Assembly); int ok = 0; List<string> list = new List<string>(); Check(AccessTools.Method(typeof(OrbFogHandler), "WaitToMove", (Type[])null, (Type[])null), prefix: true, "OrbFogHandler.WaitToMove", ref ok, list); Check(AccessTools.Method(typeof(OrbFogHandler), "Start", (Type[])null, (Type[])null), prefix: false, "OrbFogHandler.Start", ref ok, list); Check(AccessTools.Method(typeof(OrbFogHandler), "SetFogOrigin", (Type[])null, (Type[])null), prefix: false, "OrbFogHandler.SetFogOrigin", ref ok, list); Check(AccessTools.Method(typeof(MapHandler), "GoToSegment", (Type[])null, (Type[])null), prefix: true, "MapHandler.GoToSegment", ref ok, list); Check(AccessTools.Method(typeof(Character), "SpawnStatue", (Type[])null, (Type[])null), prefix: true, "Character.SpawnStatue", ref ok, list); Check(AccessTools.Method(typeof(DayNightManager), "Update", (Type[])null, (Type[])null), prefix: true, "DayNightManager.Update", ref ok, list); Check(AccessTools.Method(typeof(WindChillZone), "HandleTime", (Type[])null, (Type[])null), prefix: true, "WindChillZone.HandleTime", ref ok, list); string text = " | Fog: delay " + FogDelay.Value.ToString("0", Inv) + "s, speed " + FogSpeed.Value.ToString("0.00", Inv) + ", deadly " + (DeadlyFog.Value ? "ON" : "OFF") + " (tolerance " + FogTolerance.Value.ToString("0.0", Inv) + "s), no stone statues, campfire safe radius " + CampfireSafeRadius.Value.ToString("0", Inv) + " m | Gloom: delay " + GloomDelay.Value.ToString("0", Inv) + "s, speed x" + GloomSpeed.Value.ToString("0.00", Inv) + ", deadly " + (DeadlyGloom.Value ? "ON" : "OFF") + " (tolerance " + GloomTolerance.Value.ToString("0.0", Inv) + "s) | Lava: delay " + LavaDelay.Value.ToString("0", Inv) + "s, speed x" + LavaSpeed.Value.ToString("0.00", Inv) + ", caldera never lowers " + (CalderaNeverLowers.Value ? "ON" : "OFF") + " | Nadir: souls delay " + SoulsDelay.Value.ToString("0", Inv) + "s, speed x" + SoulsSpeed.Value.ToString("0.00", Inv) + " | Auto Revive: " + (AutoRevive.Value ? "ON" : "OFF") + " (wait " + WaitRevive.Value.ToString("0", Inv) + "s, forced " + ForcedRevive.Value.ToString("0", Inv) + "s) | Day & Night: day x" + DayLength.Value.ToString("0.00", Inv) + ", night x" + NightLength.Value.ToString("0.00", Inv) + ", eternal night " + (EternalNight.Value ? "ON" : "OFF") + " | " + Weather.Describe(); if (list.Count == 0) { L.LogInfo((object)("[KFOG] Kikis Fog 0.10.0 loaded - " + ok + " of 7 hooks ok" + text)); return; } L.LogError((object)("[KFOG] Kikis Fog 0.10.0 loaded - hook MISSING: " + string.Join(", ", list.ToArray()) + " - " + ok + " of 7 ok" + text)); } catch (Exception ex) { L.LogError((object)("[KFOG] Kikis Fog 0.10.0 failed to patch: " + ex.Message)); } } private static void KeepForcedAtLeastWait() { try { if (ForcedRevive != null && WaitRevive != null && ForcedRevive.Value < WaitRevive.Value) { ForcedRevive.Value = WaitRevive.Value; } } catch { } } private static void Check(MethodBase m, bool prefix, string name, ref int ok, List<string> missing) { bool flag = false; if (m != null) { Patches patchInfo = Harmony.GetPatchInfo(m); if (patchInfo != null) { IList<Patch> list; if (!prefix) { IList<Patch> postfixes = patchInfo.Postfixes; list = postfixes; } else { IList<Patch> postfixes = patchInfo.Prefixes; list = postfixes; } foreach (Patch item in list) { if (item.owner == "kikisfog.peak.kfog") { flag = true; break; } } } } if (flag) { ok++; } else { missing.Add(name); } } internal static bool DayNightActive() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (DayLength == null || !IsAuthority) { return false; } Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == "Airport") { return false; } if (!(Mathf.Abs(DayLength.Value - 1f) > 0.001f) && !(Mathf.Abs(NightLength.Value - 1f) > 0.001f)) { return EternalNight.Value; } return true; } internal static void DayNightStep(DayNightManager dn) { if (!((Object)(object)dn == (Object)null) && DayNightActive()) { float num = 1f / (dn.dayLengthInMinutes * 60f) * Time.deltaTime * 24f; float num2 = Mathf.Max(0.01f, (dn.isDay > 0.5f) ? DayLength.Value : NightLength.Value); float num3 = dn.timeOfDay + num / num2 - num; if (EternalNight.Value && num3 + num < 2f) { num3 = 1f - num; } dn.timeOfDay = Mathf.Max(0f, num3); if (dn.syncTimer >= 1f) { dn.syncTimer = 5.01f; } } } private void Update() { float unscaledTime = Time.unscaledTime; OrbFogHandler val = null; try { val = Singleton<OrbFogHandler>.Instance; if ((Object)(object)val != (Object)(object)_fog) { ResetForHandler(val); } if (InTransition && unscaledTime - _transitionStartedAt > 90f) { InTransition = false; } if ((Object)(object)val != (Object)null && IsAuthority) { FogAuthority(val, unscaledTime); SyncGuests(val, unscaledTime); DeadlyFogTick(val, unscaledTime); _lastHealthyTick = unscaledTime; } else { _stageControlled = false; } } catch (Exception e) { LogErr("update", e); } try { if (IsAuthority) { RiserAuthority(unscaledTime); CalderaAuthority(unscaledTime); DeadlyGloomTick(unscaledTime); } } catch (Exception e2) { LogErr("hazards", e2); } try { if (IsAuthority) { AutoReviveTick(val, unscaledTime); } } catch (Exception e3) { LogErr("revive", e3); } try { Weather.Tick(); } catch (Exception e4) { LogErr("weather", e4); } try { HudTick(val, unscaledTime); } catch (Exception e5) { LogErr("hud", e5); } } private void ResetForHandler(OrbFogHandler fog) { _fog = fog; _sphere = null; _stageControlled = false; _stageId = -1; _delayDone = false; _delayElapsed = 0f; _paused = false; _campfireResolved = false; _campfireFound = false; _lastSentSize = float.NaN; _lastPlayerCount = 0; InTransition = false; _insideSince.Clear(); _killSentAt.Clear(); _flagNotedAt.Clear(); } private static bool StageActive(OrbFogHandler fog) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 if ((Object)(object)fog == (Object)null || InTransition || LoadingScreenHandler.loading) { return false; } if (!Ascents.fogEnabled) { return false; } MapHandler instance = Singleton<MapHandler>.Instance; if ((Object)(object)instance == (Object)null) { return false; } if ((int)instance.GetCurrentSegment() >= 4) { return false; } FogSphereOrigin[] array = OriginsFor(fog); int currentID = fog.currentID; if (array == null || currentID < 0 || currentID >= array.Length || (Object)(object)array[currentID] == (Object)null) { return false; } return !array[currentID].disableFog; } internal static void CacheOrigins(OrbFogHandler fog) { _originsOwner = fog; _origins = (((Object)(object)fog != (Object)null) ? ((Component)((Component)fog).transform.root).GetComponentsInChildren<FogSphereOrigin>() : null); } private static FogSphereOrigin[] OriginsFor(OrbFogHandler fog) { if ((Object)(object)_originsOwner != (Object)(object)fog || _origins == null) { CacheOrigins(fog); } return _origins; } private FogSphere SphereFor(OrbFogHandler fog) { if ((Object)(object)_sphere == (Object)null && (Object)(object)fog != (Object)null) { _sphere = ((Component)fog).GetComponentInChildren<FogSphere>(true); } return _sphere; } private void FogAuthority(OrbFogHandler fog, float now) { if (!(_stageControlled = StageActive(fog))) { _paused = false; _insideSince.Clear(); return; } if (fog.currentID != _stageId) { BeginStage(fog); } if (!_delayDone) { if (fog.isMoving || fog.hasArrived) { _delayDone = true; L.LogWarning((object)("[KFOG] fog stage " + StageName(fog.currentID) + " was started by something else after " + _delayElapsed.ToString("0", Inv) + "s of " + FogDelay.Value.ToString("0", Inv) + "s")); } else { _delayElapsed += Time.deltaTime; if (_delayElapsed >= FogDelay.Value) { StartFog(fog); } } } else if (!fog.isMoving && !fog.hasArrived) { if (_stalledSince < 0f) { _stalledSince = now; } else if (now - _stalledSince > 3f) { _stalledSince = -1f; L.LogWarning((object)("[KFOG] fog stage " + StageName(fog.currentID) + ": fog was stopped from outside - started again")); StartFog(fog); } } else { _stalledSince = -1f; } float value = FogSpeed.Value; float num = MinSizeForCampfire(fog, now); if (!float.IsNaN(num) && fog.isMoving && (_paused ? (fog.currentSize <= num + 0.5f) : (fog.currentSize - value * Time.deltaTime * 1.5f <= num))) { if (!_paused) { _paused = true; _nextPausedSync = 0f; L.LogInfo((object)("[KFOG] fog stage " + StageName(fog.currentID) + ": fog stopped " + CampfireSafeRadius.Value.ToString("0", Inv) + " m before the campfire")); } if (fog.speed != 0f) { fog.speed = 0f; } if (fog.currentSize != num) { fog.currentSize = num; } } else { if (_paused && fog.isMoving) { L.LogInfo((object)("[KFOG] fog stage " + StageName(fog.currentID) + ": campfire safe radius lowered - fog moves on")); } _paused = false; if (fog.speed != value) { fog.speed = value; } } } private void BeginStage(OrbFogHandler fog) { //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) _stageId = fog.currentID; _delayElapsed = 0f; _stalledSince = -1f; _delayDone = fog.isMoving || fog.hasArrived; _paused = false; _campfireResolved = false; _campfireFound = false; _nextCampfireTry = 0f; _insideSince.Clear(); string text = "[KFOG] fog stage " + StageName(_stageId) + ": " + (_delayDone ? "already rising, no delay" : ("waiting " + FogDelay.Value.ToString("0", Inv) + "s")) + ", speed " + FogSpeed.Value.ToString("0.00", Inv) + ", deadly " + (DeadlyFog.Value ? "ON" : "OFF"); ResolveCampfire(fog); float unitsToMeters = CharacterStats.unitsToMeters; Vector3 val = FogCentre(fog); if (_campfireFound) { float num = Vector3.Distance(val, _campfirePos); float num2 = num + CampfireSafeRadius.Value / unitsToMeters; text = text + " | campfire " + (num * unitsToMeters).ToString("0", Inv) + " m from the fog centre, fog stops at " + (num2 * unitsToMeters).ToString("0", Inv) + " m, starts at " + (fog.currentSize * unitsToMeters).ToString("0", Inv) + " m"; if (num2 >= fog.currentSize) { text += " - ⚠ safe radius covers the whole stage, the fog will not move"; } } else { text += " | ⚠ campfire not found yet - no safe radius until it is"; } L.LogInfo((object)text); } private void StartFog(OrbFogHandler fog) { _delayDone = true; fog.speed = FogSpeed.Value; PhotonView component = ((Component)fog).GetComponent<PhotonView>(); if ((Object)(object)component != (Object)null && PhotonNetwork.InRoom) { component.RPC("StartMovingRPC", (RpcTarget)0, Array.Empty<object>()); } else { fog.StartMovingRPC(); } _lastSentSize = float.NaN; L.LogInfo((object)("[KFOG] fog stage " + StageName(fog.currentID) + ": waited " + FogDelay.Value.ToString("0", Inv) + "s - the fog rises now (speed " + FogSpeed.Value.ToString("0.00", Inv) + ")")); } private void ResolveCampfire(OrbFogHandler fog) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) _campfireResolved = true; _campfireFound = false; try { GameObject campfireRoot = MapHandler.GetCampfireRoot(fog.currentID); Campfire val = (((Object)(object)campfireRoot != (Object)null) ? campfireRoot.GetComponentInChildren<Campfire>(true) : null); if ((Object)(object)val != (Object)null) { _campfirePos = ((Component)val).transform.position; _campfireFound = true; } } catch (Exception e) { LogErr("campfire", e); } } private Vector3 FogCentre(OrbFogHandler fog) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) FogSphereOrigin[] array = OriginsFor(fog); int currentID = fog.currentID; if (array != null && currentID >= 0 && currentID < array.Length && (Object)(object)array[currentID] != (Object)null) { return ((Component)array[currentID]).transform.position; } FogSphere val = SphereFor(fog); if (!((Object)(object)val != (Object)null)) { return Vector3.zero; } return val.fogPoint; } private float MinSizeForCampfire(OrbFogHandler fog, float now) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) if (!_campfireFound) { if (_campfireResolved && now < _nextCampfireTry) { return float.NaN; } _nextCampfireTry = now + 1f; ResolveCampfire(fog); if (!_campfireFound) { return float.NaN; } L.LogInfo((object)("[KFOG] fog stage " + StageName(fog.currentID) + ": campfire found - safe radius active")); } float num = Mathf.Max(0f, CampfireSafeRadius.Value) / CharacterStats.unitsToMeters; if (num <= 0f) { return float.NaN; } return Vector3.Distance(FogCentre(fog), _campfirePos) + num; } private void SyncGuests(OrbFogHandler fog, float now) { if (!PhotonNetwork.InRoom || PhotonNetwork.OfflineMode || !PhotonNetwork.IsMasterClient || PhotonNetwork.CurrentRoom == null) { return; } int playerCount = PhotonNetwork.CurrentRoom.PlayerCount; if (playerCount > _lastPlayerCount) { _quietUntil = Mathf.Max(_quietUntil, now + 8f); } _lastPlayerCount = playerCount; if (playerCount <= 1 || !_stageControlled) { _lastSentSize = float.NaN; } else { if (now < _quietUntil || now < _nextSync) { return; } _nextSync = now + 0.18f; if (!float.IsNaN(_lastSentSize) && fog.isMoving == _lastSentMoving && !(Mathf.Abs(fog.currentSize - _lastSentSize) >= 0.35f) && (!_paused || !(now >= _nextPausedSync))) { return; } PhotonView component = ((Component)fog).GetComponent<PhotonView>(); if (!((Object)(object)component == (Object)null)) { component.RPC("RPCA_SyncFog", (RpcTarget)1, new object[2] { fog.currentSize, fog.isMoving }); _lastSentSize = fog.currentSize; _lastSentMoving = fog.isMoving; if (_paused) { _nextPausedSync = now + 0.5f; } } } } private void DeadlyFogTick(OrbFogHandler fog, float now) { //IL_00fc: 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) if (!DeadlyFog.Value || !_stageControlled) { _insideSince.Clear(); } else { if (now < _nextDeadly) { return; } _nextDeadly = now + 0.1f; FogSphere val = SphereFor(fog); if ((Object)(object)val == (Object)null || !((Component)val).gameObject.activeInHierarchy || !Mathf.Approximately(val.ENABLE, 1f)) { _insideSince.Clear(); return; } float num = Mathf.Max(0f, FogTolerance.Value); _victims.Clear(); List<Character> allCharacters = Character.AllCharacters; for (int i = 0; i < allCharacters.Count; i++) { Character val2 = allCharacters[i]; try { if ((Object)(object)val2 == (Object)null || (Object)(object)val2.data == (Object)null || !val2.IsPlayerControlled || val2.data.dead || (Object)(object)((MonoBehaviourPun)val2).photonView == (Object)null) { continue; } int viewID = ((MonoBehaviourPun)val2).photonView.ViewID; if (!(Vector3.Distance(val.fogPoint, val2.Center) > val.currentSize)) { _insideSince.Remove(viewID); continue; } if (!_insideSince.TryGetValue(viewID, out var value)) { value = now; _insideSince[viewID] = now; } if (!(now - value < num) && (!_killSentAt.TryGetValue(viewID, out var value2) || !(now - value2 < 10f))) { _victims.Add(val2); } } catch (Exception e) { LogErr("deadly-check", e); } } for (int j = 0; j < _victims.Count; j++) { Character val3 = _victims[j]; try { int viewID2 = ((MonoBehaviourPun)val3).photonView.ViewID; if (Petrify(val3, "fog", now - _insideSince[viewID2], now)) { _insideSince.Remove(viewID2); } } catch (Exception e2) { LogErr("deadly-kill", e2); } } _victims.Clear(); } } private bool Petrify(Character c, string what, float stood, float now) { int viewID = ((MonoBehaviourPun)c).photonView.ViewID; if (HasCheckpointFlag(c)) { if (!_flagNotedAt.TryGetValue(viewID, out var value) || now - value > 30f) { _flagNotedAt[viewID] = now; L.LogInfo((object)("[KFOG] deadly " + what + ": '" + Who(c) + "' is in the " + what + " but has a checkpoint flag - not turned to stone, the game decides")); } return false; } _petrifySentAt[viewID] = now; ((MonoBehaviourPun)c.refs.afflictions).photonView.RPC("RPC_PetrifyInstantly", (RpcTarget)0, new object[1] { false }); _killSentAt[viewID] = now; L.LogWarning((object)("[KFOG] deadly " + what + ": '" + Who(c) + "' stood in the " + what + " for " + stood.ToString("0.0", Inv) + "s - turned to stone")); return true; } internal static bool SkipStatue(Character c, bool killedByDagger) { if ((Object)(object)I == (Object)null) { return false; } if (killedByDagger || (Object)(object)c == (Object)null || (Object)(object)((MonoBehaviourPun)c).photonView == (Object)null || !PhotonNetwork.IsMasterClient) { return false; } if (!I._petrifySentAt.TryGetValue(((MonoBehaviourPun)c).photonView.ViewID, out var value)) { return false; } if (Time.unscaledTime - value > 2f) { return false; } L.LogInfo((object)("[KFOG] no statue for '" + Who(c) + "' (killed by us)")); return true; } private static bool IsHandledRiser(LavaRising r) { return (Object)(object)r != (Object)null; } private static float RiserDelay(LavaRising r) { //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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 RisingFieldType risingFieldType = r.risingFieldType; if ((int)risingFieldType != 1) { if ((int)risingFieldType == 2) { return SoulsDelay.Value; } return LavaDelay.Value; } return GloomDelay.Value; } private static float RiserSpeed(LavaRising r) { //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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 RisingFieldType risingFieldType = r.risingFieldType; if ((int)risingFieldType != 1) { if ((int)risingFieldType == 2) { return SoulsSpeed.Value; } return LavaSpeed.Value; } return GloomSpeed.Value; } private static LavaRising CurrentRiser() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_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) List<LavaRising> aLL_LAVA = LavaRising.ALL_LAVA; MapHandler instance = Singleton<MapHandler>.Instance; if (aLL_LAVA == null || (Object)(object)instance == (Object)null) { return null; } Segment currentSegment = instance.GetCurrentSegment(); for (int i = 0; i < aLL_LAVA.Count; i++) { LavaRising val = aLL_LAVA[i]; if (IsHandledRiser(val) && val.requiredSegment == currentSegment) { return val; } } return null; } private void RiserAuthority(float now) { List<LavaRising> aLL_LAVA = LavaRising.ALL_LAVA; if (aLL_LAVA == null || aLL_LAVA.Count == 0) { return; } LavaRising val = CurrentRiser(); bool flag = PhotonNetwork.InRoom && !PhotonNetwork.OfflineMode && PhotonNetwork.CurrentRoom != null && PhotonNetwork.CurrentRoom.PlayerCount > 1; for (int i = 0; i < aLL_LAVA.Count; i++) { LavaRising val2 = aLL_LAVA[i]; if (!IsHandledRiser(val2)) { continue; } float num = RiserDelay(val2); if (val2.initialWaitTime != num) { val2.initialWaitTime = num; } if ((Object)(object)val2 != (Object)(object)val || !val2.started || val2.ended) { continue; } if (_riserStartLogged.Add(val2)) { L.LogInfo((object)("[KFOG] " + RiserName(val2) + " rises now (waited " + val2.secondsWaitedToStart.ToString("0", Inv) + "s, speed x" + RiserSpeed(val2).ToString("0.00", Inv) + ")")); } float num2 = RiserSpeed(val2); if (!Mathf.Approximately(num2, 1f)) { float num3 = val2.timeTraveled + Time.deltaTime * (num2 - 1f); val2.timeTraveled = Mathf.Max(0f, num3); if (flag && (!_riserNextSync.TryGetValue(val2, out var value) || !(now < value))) { _riserNextSync[val2] = now + 0.25f; ((MonoBehaviourPun)val2).photonView.RPC("RPC_SyncLava", (RpcTarget)1, new object[4] { val2.started, val2.ended, val2.timeTraveled, val2.secondsWaitedToStart }); } } } } private static string RiserName(LavaRising r) { //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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 RisingFieldType risingFieldType = r.risingFieldType; if ((int)risingFieldType != 1) { if ((int)risingFieldType == 2) { return "souls (Nadir)"; } return "lava (Kiln)"; } return "gloom (Citadel)"; } private StatusFieldGloom[] GloomFieldsOf(LavaRising r) { if (!_gloomFields.TryGetValue(r, out var value) || value == null) { value = ((Component)r).GetComponentsInChildren<StatusFieldGloom>(true); _gloomFields[r] = value; } return value; } private bool InRisingGloom(Character c, Vector3 point) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 //IL_004b: Unknown result type (might be due to invalid IL or missing references) LavaRising val = CurrentRiser(); if ((Object)(object)val == (Object)null || (int)val.risingFieldType != 1 || !val.started) { return false; } StatusFieldGloom[] array = GloomFieldsOf(val); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] != (Object)null && ((Component)array[i]).gameObject.activeInHierarchy && ((StatusFieldBounds)array[i]).PointInField(point)) { return true; } } return false; } private void DeadlyGloomTick(float now) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Invalid comparison between Unknown and I4 //IL_00e8: Unknown result type (might be due to invalid IL or missing references) if (!DeadlyGloom.Value) { _gloomInsideSince.Clear(); } else { if (now < _nextDeadlyGloom) { return; } _nextDeadlyGloom = now + 0.1f; LavaRising val = CurrentRiser(); if ((Object)(object)val == (Object)null || (int)val.risingFieldType != 1 || !val.started) { _gloomInsideSince.Clear(); return; } float num = Mathf.Max(0f, GloomTolerance.Value); _victims.Clear(); List<Character> allCharacters = Character.AllCharacters; for (int i = 0; i < allCharacters.Count; i++) { Character val2 = allCharacters[i]; try { if ((Object)(object)val2 == (Object)null || (Object)(object)val2.data == (Object)null || !val2.IsPlayerControlled || val2.data.dead || (Object)(object)((MonoBehaviourPun)val2).photonView == (Object)null) { continue; } int viewID = ((MonoBehaviourPun)val2).photonView.ViewID; if (!InRisingGloom(val2, val2.Head)) { _gloomInsideSince.Remove(viewID); continue; } if (!_gloomInsideSince.TryGetValue(viewID, out var value)) { value = now; _gloomInsideSince[viewID] = now; } if (!(now - value < num) && (!_killSentAt.TryGetValue(viewID, out var value2) || !(now - value2 < 10f))) { _victims.Add(val2); } } catch (Exception e) { LogErr("gloom-check", e); } } for (int j = 0; j < _victims.Count; j++) { Character val3 = _victims[j]; try { int viewID2 = ((MonoBehaviourPun)val3).photonView.ViewID; if (Petrify(val3, "gloom", now - _gloomInsideSince[viewID2], now)) { _gloomInsideSince.Remove(viewID2); } } catch (Exception e2) { LogErr("gloom-kill", e2); } } _victims.Clear(); } } private static bool BelowRisingLava(Character c) { //IL_0010: 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_0045: Unknown result type (might be due to invalid IL or missing references) LavaRising val = CurrentRiser(); if ((Object)(object)val == (Object)null || (int)val.risingFieldType != 0 || !val.started || (Object)(object)val.lava == (Object)null) { return false; } return c.Center.y < ((Component)val.lava).transform.position.y + 3f; } private void CalderaAuthority(float now) { //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) if (!CalderaNeverLowers.Value) { _calderaLogged = false; return; } float num = 0.7f; if (now >= _nextCalderaScan) { _nextCalderaScan = now + 2f; _calderaAnims.Clear(); _calderaViews.Clear(); SyncedAnimation[] array = Object.FindObjectsByType<SyncedAnimation>((FindObjectsSortMode)0); for (int i = 0; i < array.Length; i++) { if (!((Object)(object)array[i] == (Object)null)) { Lava component = ((Component)array[i]).GetComponent<Lava>(); Animator component2 = ((Component)array[i]).GetComponent<Animator>(); if (!((Object)(object)component == (Object)null) && !component.isKiln && !((Object)(object)component2 == (Object)null)) { _calderaAnims.Add(component2); _calderaViews.Add(((Component)array[i]).GetComponent<PhotonView>()); } } } } if (_calderaAnims.Count == 0) { return; } if (!_calderaLogged) { _calderaLogged = true; L.LogInfo((object)("[KFOG] caldera lava: held at the top (" + _calderaAnims.Count + " lava animator(s))")); } for (int j = 0; j < _calderaAnims.Count; j++) { Animator val = _calderaAnims[j]; if (!((Object)(object)val == (Object)null) && ((Behaviour)val).isActiveAndEnabled) { AnimatorStateInfo currentAnimatorStateInfo = val.GetCurrentAnimatorStateInfo(0); val.Play(((AnimatorStateInfo)(ref currentAnimatorStateInfo)).shortNameHash, 0, num); } } if (!PhotonNetwork.InRoom || PhotonNetwork.OfflineMode || now < _nextCalderaSync || PhotonNetwork.CurrentRoom == null || PhotonNetwork.CurrentRoom.PlayerCount <= 1) { return; } _nextCalderaSync = now + 0.5f; for (int k = 0; k < _calderaViews.Count; k++) { PhotonView val2 = _calderaViews[k]; if ((Object)(object)val2 != (Object)null && (Object)(object)_calderaAnims[k] != (Object)null && ((Behaviour)_calderaAnims[k]).isActiveAndEnabled) { val2.RPC("RPCA_SyncAnim", (RpcTarget)1, new object[1] { num }); } } } private static bool HasCheckpointFlag(Character c) { int ownerActorNr = ((MonoBehaviourPun)c).photonView.OwnerActorNr; CheckpointFlag[] array = Object.FindObjectsByType<CheckpointFlag>((FindObjectsSortMode)0); for (int i = 0; i < array.Length; i++) { if (!((Object)(object)array[i] == (Object)null)) { PhotonView component = ((Component)array[i]).GetComponent<PhotonView>(); if ((Object)(object)component != (Object)null && component.OwnerActorNr == ownerActorNr) { return true; } } } return false; } private static string Who(Character c) { try { string text = ((((MonoBehaviourPun)c).photonView.Owner != null) ? ((MonoBehaviourPun)c).photonView.Owner.NickName : null); return string.IsNullOrEmpty(text) ? c.characterName : text; } catch { return "?"; } } private void AutoReviveTick(OrbFogHandler fog, float now) { //IL_00f9: Unknown result type (might be due to invalid IL or missing references) if (now < _nextRevive) { return; } _nextRevive = now + 0.25f; Character localCharacter = Character.localCharacter; if (!AutoRevive.Value || !((Object)(object)localCharacter != (Object)null) || LoadingScreenHandler.loading || localCharacter.inAirport || localCharacter.gameOver) { _deadSince.Clear(); return; } _toRevive.Clear(); List<Character> allCharacters = Character.AllCharacters; for (int i = 0; i < allCharacters.Count; i++) { Character val = allCharacters[i]; try { if ((Object)(object)val == (Object)null || (Object)(object)val.data == (Object)null || !val.IsPlayerControlled || (Object)(object)((MonoBehaviourPun)val).photonView == (Object)null) { continue; } int viewID = ((MonoBehaviourPun)val).photonView.ViewID; if (!val.data.dead) { _deadSince.Remove(viewID); if (!val.data.fullyPassedOut && (Object)(object)val.Ghost == (Object)null) { _lastAlivePos[viewID] = val.Center; } if (OnSolidGround(val)) { if (!_groundedSince.ContainsKey(viewID)) { _groundedSince[viewID] = now; } } else { _groundedSince.Remove(viewID); } } else { _groundedSince.Remove(viewID); float value2; if (!_deadSince.TryGetValue(viewID, out var value)) { _deadSince[viewID] = now; } else if (!(now - value < WaitRevive.Value) && (!_reviveSentAt.TryGetValue(viewID, out value2) || !(now - value2 < 5f))) { _toRevive.Add(val); } } } catch (Exception e) { LogErr("revive-check", e); } } for (int j = 0; j < _toRevive.Count; j++) { try { TryAutoRevive(_toRevive[j], fog, now); } catch (Exception e2) { LogErr("revive-send", e2); } } _toRevive.Clear(); } private void TryAutoRevive(Character dead, OrbFogHandler fog, float now) { //IL_0051: 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_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) int viewID = ((MonoBehaviourPun)dead).photonView.ViewID; Vector3 value; bool flag = _lastAlivePos.TryGetValue(viewID, out value); Character val = null; float num = float.MaxValue; List<Character> allCharacters = Character.AllCharacters; for (int i = 0; i < allCharacters.Count; i++) { Character val2 = allCharacters[i]; if (IsAnchorCandidate(val2, dead, fog)) { float num2 = (flag ? Vector3.Distance(value, val2.Center) : 0f); if (!((Object)(object)val != (Object)null) || !(num2 >= num)) { val = val2; num = num2; } } } float num3 = now - _deadSince[viewID]; if ((Object)(object)val == (Object)null) { NoteWaiting(viewID, now, "[KFOG] auto revive: '" + Who(dead) + "' is dead for " + num3.ToString("0", Inv) + "s, but no teammate is alive, awake and out of the fog right now - trying again"); return; } if (!_groundedSince.TryGetValue(((MonoBehaviourPun)val).photonView.ViewID, out var value2) || !(now - value2 >= 1f) || !Physics.Raycast(val.Center + Vector3.up * 2.5f, Vector3.down, 8f, LayerMask.op_Implicit(HelperFunctions.AllPhysicalExceptCharacter))) { NoteWaiting(viewID, now, "[KFOG] auto revive: '" + Who(dead) + "' is ready, waiting for '" + Who(val) + "' to stand on solid ground for " + 1f.ToString("0", Inv) + "s"); return; } if (now > _spreadResetAt) { _spreadIndex = 0; _recentSpots.Clear(); } bool flag2 = false; if (!FindReviveSpot(val, dead, out var pos)) { float num4 = Mathf.Max(WaitRevive.Value, ForcedRevive.Value); if (num3 < num4) { NoteWaiting(viewID, now, "[KFOG] auto revive: '" + Who(dead) + "' is ready, but there is no safe spot next to '" + Who(val) + "' - trying again, forced revive at " + num4.ToString("0", Inv) + "s dead"); return; } pos = ForcedSpot(val); flag2 = true; } _spreadResetAt = now + 3f; _recentSpots.Add(pos); ((MonoBehaviourPun)dead).photonView.RPC("RPCA_ReviveAtPosition", (RpcTarget)0, new object[3] { pos, false, -1 }); _reviveSentAt[viewID] = now; _deadSince.Remove(viewID); _noAnchorNotedAt.Remove(viewID); L.LogInfo((object)("[KFOG] auto revive: '" + Who(dead) + "' was dead for " + num3.ToString("0", Inv) + "s - revived next to '" + Who(val) + "'" + (flag2 ? " - FORCED, no safe spot found (above them, under any ceiling)" : " on a free spot") + (flag ? (" (" + (num * CharacterStats.unitsToMeters).ToString("0", Inv) + " m from where they last stood)") : ""))); } private bool FindReviveSpot(Character anchor, Character dead, out Vector3 pos) { //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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_0083: 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_0099: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: 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) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: 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_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) pos = Vector3.zero; int num = LayerMask.op_Implicit(HelperFunctions.AllPhysicalExceptCharacter); Vector3 center = anchor.Center; RaycastHit val = default(RaycastHit); if (!Physics.Raycast(center, Vector3.down, ref val, 8f, num, (QueryTriggerInteraction)1)) { return false; } float y = ((RaycastHit)(ref val)).point.y; float num2 = Mathf.Clamp(center.y - y, 0.5f, 2.5f); float num3 = Mathf.Clamp(anchor.Head.y - y, num2 + 0.2f, 3.5f) + 0.4f; Vector3 val2 = center + Vector3.up * 0.2f; bool flag = !Physics.CheckSphere(val2, 0.3f, num, (QueryTriggerInteraction)1); float num4 = MathF.PI / 6f; float num5 = (float)_spotAngleIndex++ * 2.3999631f; Vector3 val3 = default(Vector3); RaycastHit val4 = default(RaycastHit); for (int i = 0; i < SpotRadii.Length; i++) { float num6 = SpotRadii[i]; for (int j = 0; j < 12; j++) { float num7 = num5 + (float)j * num4; ((Vector3)(ref val3))..ctor(Mathf.Cos(num7), 0f, Mathf.Sin(num7)); float num8 = num6 + 0.7f; if (Physics.Raycast(val2, val3, num8, num, (QueryTriggerInteraction)1) || (flag && Physics.SphereCast(val2, 0.3f, val3, ref val4, num8, num, (QueryTriggerInteraction)1)) || !GroundAt(val2 + val3 * num6, y, num2, num6, out var hit) || !GroundAt(val2 + val3 * num8, y, num2, num8, out var _)) { continue; } Vector3 point = ((RaycastHit)(ref hit)).point; if (Physics.Raycast(point + Vector3.up * 0.1f, Vector3.up, num3, num, (QueryTriggerInteraction)1)) { continue; } Vector3 val5 = point + Vector3.up * 0.7f; Vector3 val6 = point + Vector3.up * Mathf.Max(num3 - 0.35f, 0.8f); if (!Physics.CheckCapsule(val5, val6, 0.35f, num, (QueryTriggerInteraction)1)) { Vector3 val7 = point + Vector3.up * (num2 + 0.25f); if (!Occupied(val7, dead)) { pos = val7; return true; } } } } return false; } private static bool GroundAt(Vector3 top, float groundY, float torsoH, float dist, out RaycastHit hit) { //IL_001e: 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_0027: 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_0055: Unknown result type (might be due to invalid IL or missing references) float num = 0.6f + dist * 0.4f; float num2 = torsoH + 0.2f + num + 0.3f; if (!Physics.Raycast(top, Vector3.down, ref hit, num2, LayerMask.op_Implicit(HelperFunctions.AllPhysicalExceptCharacter), (QueryTriggerInteraction)1)) { return false; } if (Mathf.Abs(((RaycastHit)(ref hit)).point.y - groundY) > num) { return false; } return ((RaycastHit)(ref hit)).normal.y >= 0.77f; } private bool Occupied(Vector3 target, Character dead) { //IL_0077: 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_0042: 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) List<Character> allCharacters = Character.AllCharacters; for (int i = 0; i < allCharacters.Count; i++) { Character val = allCharacters[i]; try { if ((Object)(object)val == (Object)null || (Object)(object)val == (Object)(object)dead || (Object)(object)val.data == (Object)null || val.data.dead || !(Vector3.Distance(val.Center, target) < 0.9f)) { continue; } return true; } catch { } } for (int j = 0; j < _recentSpots.Count; j++) { if (Vector3.Distance(_recentSpots[j], target) < 0.9f) { return true; } } return false; } private Vector3 ForcedSpot(Character anchor) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_007d: 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_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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) int num = LayerMask.op_Implicit(HelperFunctions.AllPhysicalExceptCharacter); Vector3 center = anchor.Center; float num2 = Mathf.Max(anchor.Head.y - center.y, 0.3f) + 0.4f; float num3 = 2.5f; RaycastHit val = default(RaycastHit); if (Physics.Raycast(anchor.Head, Vector3.up, ref val, 2.5f + num2, num, (QueryTriggerInteraction)1)) { num3 = Mathf.Clamp(((RaycastHit)(ref val)).point.y - num2 - center.y, 0f, 2.5f); } Vector3 val2 = center + Vector3.up * num3; Vector3 val3 = SpreadOffset(); if (val3 != Vector3.zero && !Physics.Raycast(val2, ((Vector3)(ref val3)).normalized, ((Vector3)(ref val3)).magnitude + 0.3f, num, (QueryTriggerInteraction)1)) { val2 += val3; } return val2; } private bool IsAnchorCandidate(Character a, Character dead, OrbFogHandler fog) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)a == (Object)null || (Object)(object)a == (Object)(object)dead || (Object)(object)a.data == (Object)null || !a.IsPlayerControlled || (Object)(object)((MonoBehaviourPun)a).photonView == (Object)null) { return false; } if (a.data.dead || a.data.passedOut || a.data.fullyPassedOut || (Object)(object)a.Ghost != (Object)null) { return false; } if (InFogNow(a, fog)) { return false; } if (InRisingGloom(a, a.Head) || InRisingGloom(a, a.Head + Vector3.up * 2f)) { return false; } return !BelowRisingLava(a); } catch { return false; } } private static bool OnSolidGround(Character c) { CharacterData data = c.data; if (data.isGrounded && !data.isClimbing && !data.isRopeClimbing && !data.isVineClimbing) { return !data.isCarried; } return false; } private void NoteWaiting(int id, float now, string line) { if (!_noAnchorNotedAt.TryGetValue(id, out var value) || !(now - value <= 30f)) { _noAnchorNotedAt[id] = now; L.LogInfo((object)line); } } private bool InFogNow(Character a, OrbFogHandler fog) { //IL_0041: 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) if ((Object)(object)fog == (Object)null || !StageActive(fog)) { return false; } FogSphere val = SphereFor(fog); if ((Object)(object)val == (Object)null || !((Component)val).gameObject.activeInHierarchy || val.ENABLE < 0.5f) { return false; } return Vector3.Distance(val.fogPoint, a.Center) > val.currentSize - 5f; } private Vector3 SpreadOffset() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) int num = _spreadIndex++; if (num == 0) { return Vector3.zero; } float num2 = (float)num * 2.3999631f; return new Vector3(Mathf.Cos(num2), 0f, Mathf.Sin(num2)) * 1.2f; } internal static void OnTransitionStart() { InTransition = true; _transitionStartedAt = Time.unscaledTime; if ((Object)(object)I != (Object)null) { I._paused = false; I._stageControlled = false; I._insideSince.Clear(); } } internal static void OnOriginSet(OrbFogHandler fog, int id) { InTransition = false; if ((Object)(object)I == (Object)null || (Object)(object)fog == (Object)null) { return; } I._quietUntil = Mathf.Max(I._quietUntil, Time.unscaledTime + 3f); I._stageId = -1; I._lastSentSize = float.NaN; if (!IsAuthority || !Ascents.fogEnabled) { return; } FogSphereOrigin[] array = OriginsFor(fog); if (array != null && id >= 0 && id < array.Length && !((Object)(object)array[id] == (Object)null) && !array[id].disableFog) { if (fog.isMoving) { fog.isMoving = false; L.LogInfo((object)("[KFOG] fog stage " + StageName(id) + ": the game carried 'moving' over from the last stage - reset, the delay counts")); } fog.currentWaitTime = 0f; } } internal static bool HoldsVanillaWait(OrbFogHandler fog) { if ((Object)(object)I != (Object)null && IsAuthority && Time.unscaledTime - I._lastHealthyTick < 2f) { return StageActive(fog); } return false; } private void HudTick(OrbFogHandler fog, float now) { if (now < _nextHud) { return; } _nextHud = now + 0.25f; GUIManager instance = GUIManager.instance; Canvas val = (((Object)(object)instance != (Object)null) ? instance.hudCanvas : null); bool flag = !IsAuthority; if (!((Object)(object)val != (Object)null) || !((Behaviour)val).isActiveAndEnabled || !((Object)(object)fog != (Object)null) || LoadingScreenHandler.loading || !((Object)(object)Character.localCharacter != (Object)null)) { if ((Object)(object)_hudRoot != (Object)null && ((Component)_hudRoot).gameObject.activeSelf) { ((Component)_hudRoot).gameObject.SetActive(false); } return; } if ((Object)(object)_hudRoot == (Object)null || (Object)(object)_hudText == (Object)null || (Object)(object)((Transform)_hudRoot).parent != (Object)(object)((Component)val).transform) { BuildHud(val, instance); } if (!((Object)(object)_hudRoot == (Object)null)) { if (!((Component)_hudRoot).gameObject.activeSelf) { ((Component)_hudRoot).gameObject.SetActive(true); } string text = (flag ? GuestHudLine(fog, now) : HudLine(fog)); if (!string.Equals(text, _hudLast, StringComparison.Ordinal)) { _hudLast = text; ((TMP_Text)_hudText).text = text; } } } private void BuildHud(Canvas canvas, GUIManager g) { //IL_004b: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_hudRoot != (Object)null) { Object.Destroy((Object)(object)((Component)_hudRoot).gameObject); } _hudRoot = null; _hudText = null; _hudLast = null; RectTransform component = new GameObject("KikisFogHUD", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>(); ((Transform)component).SetParent(((Component)canvas).transform, false); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.zero; component.pivot = Vector2.zero; component.sizeDelta = new Vector2(1180f, 38f); ((Transform)component).localScale = Vector3.one * 0.9f; component.anchoredPosition = new Vector2(60f, 0f); ((Transform)component).SetAsLastSibling(); GameObject val = new GameObject("Text", new Type[1] { typeof(RectTransform) }); RectTransform component2 = val.GetComponent<RectTransform>(); ((Transform)component2).SetParent((Transform)(object)component, false); component2.anchorMin = Vector2.zero; component2.anchorMax = Vector2.one; component2.offsetMin = Vector2.zero; component2.offsetMax = Vector2.zero; TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>(); TextMeshProUGUI val3 = StyleSource(g); if ((Object)(object)val3 != (Object)null) { ((TMP_Text)val2).font = ((TMP_Text)val3).font; ((TMP_Text)val2).fontSharedMaterial = ((TMP_Text)val3).fontSharedMaterial; } ((Graphic)val2).raycastTarget = false; ((TMP_Text)val2).richText = true; ((TMP_Text)val2).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)val2).overflowMode = (TextOverflowModes)0; ((TMP_Text)val2).alignment = (TextAlignmentOptions)4097; ((TMP_Text)val2).margin = new Vector4(10f, 0f, 10f, 0f); ((TMP_Text)val2).fontSize = 16f; ((TMP_Text)val2).fontWeight = (FontWeight)700; ((Graphic)val2).color = Color.white; ((TMP_Text)val2).outlineColor = new Color32((byte)0, (byte)0, (byte)0, (byte)220); ((TMP_Text)val2).outlineWidth = 0.045f; _hudRoot = component; _hudText = val2; } private static TextMeshProUGUI StyleSource(GUIManager g) { if ((Object)(object)g == (Object)null) { return null; } if ((Object)(object)g.itemPromptMain != (Object)null && (Object)(object)((TMP_Text)g.itemPromptMain).font != (Object)null) { return g.itemPromptMain; } if ((Object)(object)g.interactNameText != (Object)null && (Object)(object)((TMP_Text)g.interactNameText).font != (Object)null) { return g.interactNameText; } if ((Object)(object)g.interactPromptText != (Object)null && (Object)(object)((TMP_Text)g.interactPromptText).font != (Object)null) { return g.interactPromptText; } return null; } private string HudLine(OrbFogHandler fog) { //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Invalid comparison between Unknown and I4 //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Invalid comparison between Unknown and I4 StringBuilder stringBuilder = new StringBuilder(220); RunTimer(stringBuilder); if (_stageControlled) { string value; string color; if (_paused) { value = "PAUSED"; color = "#FFA64D"; } else if (fog.isMoving) { value = "RISING"; color = "#B5FFB8"; } else if (fog.hasArrived) { value = "STOPPED"; color = "#7BD4FF"; } else if (!_delayDone) { value = "WAITING " + Clock(FogDelay.Value - _delayElapsed); color = "#FFE08A"; } else { value = "WAITING"; color = "#FFE08A"; } Badge(stringBuilder, "FOG", value, color); Badge(stringBuilder, "SPEED", FogSpeed.Value.ToString("0.00", Inv), "#D6F1FF"); Badge(stringBuilder, "DELAY", FogDelay.Value.ToString("0", Inv) + "s", "#F2C75C"); if (DeadlyFog.Value) { Badge(stringBuilder, null, "DEADLY", "#FF5A4D"); } } else { LavaRising val = CurrentRiser(); if ((Object)(object)val != (Object)null) { bool flag = (int)val.risingFieldType == 1; bool flag2 = (int)val.risingFieldType == 2; float num = RiserDelay(val); string value2; string color2; if (val.ended) { value2 = "TOP"; color2 = "#7BD4FF"; } else if (val.started) { value2 = "RISING"; color2 = "#B5FFB8"; } else if (val.secondsWaitedToStart > 0f) { value2 = "WAITING " + Clock(num - val.secondsWaitedToStart); color2 = "#FFE08A"; } else { value2 = "WAITING"; color2 = "#FFE08A"; } Badge(stringBuilder, flag ? "GLOOM" : (flag2 ? "SOULS" : "LAVA"), value2, color2); Badge(stringBuilder, "SPEED", "x" + RiserSpeed(val).ToString("0.00", Inv), "#D6F1FF"); Badge(stringBuilder, "DELAY", num.ToString("0", Inv) + "s", "#F2C75C"); if (flag && DeadlyGloom.Value) { Badge(stringBuilder, null, "DEADLY", "#FF5A4D"); } } else if (CalderaNeverLowers.Value && _calderaAnims.Count > 0) { Badge(stringBuilder, "LAVA", "NEVER LOWERS", "#FFA64D"); } } DayNight(stringBuilder); return stringBuilder.ToString(); } private string GuestHudLine(OrbFogHandler fog, float now) { StringBuilder stringBuilder = new StringBuilder(100); RunTimer(stringBuilder); if (GuestFogSpeed(fog, now, out var speed)) { Badge(stringBuilder, "SPEED", "~" + (Mathf.Round(speed * 20f) / 20f).ToString("0.00", Inv), "#D6F1FF"); } DayNight(stringBuilder); return stringBuilder.ToString(); } private bool GuestFogSpeed(OrbFogHandler fog, float now, out float speed) { //IL_006a: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_00de: Unknown result type (might be due to invalid IL or missing references) speed = 0f; int num; if (fog.isMoving) { num = ((!fog.hasArrived) ? 1 : 0); if (num != 0 && fog.currentID == _gOrigin && !(now - _gLastSample > 1f)) { goto IL_0052; } } else { num = 0; } _gSamples.Clear(); _gOrigin = fog.currentID; goto IL_0052; IL_0052: _gLastSample = now; if (num == 0) { return false; } _gSamples.Enqueue(new Vector2(now, fog.currentSize)); while (_gSamples.Count > 0 && now - _gSamples.Peek().x > 10f) { _gSamples.Dequeue(); } if (_gSamples.Count < 2) { return false; } Vector2 val = _gSamples.Peek(); float num2 = now - val.x; if (num2 < 6f) { return false; } speed = Mathf.Max(0f, (val.y - fog.currentSize) / num2); return true; } private static void RunTimer(StringBuilder sb) { RunManager instance = RunManager.Instance; if (!((Object)(object)instance == (Object)null)) { float timeSinceRunStarted = instance.TimeSinceRunStarted; if (!(timeSinceRunStarted <= 0.05f)) { int num = Mathf.FloorToInt(timeSinceRunStarted); Badge(sb, "RUN", (num / 60).ToString("00", Inv) + ":" + (num % 60).ToString("00", Inv), "#E2EAF3"); } } } private static void DayNight(StringBuilder sb) { DayNightManager instance = DayNightManager.instance; if (!((Object)(object)instance == (Object)null)) { float num = (instance.timeOfDay % 24f + 24f) % 24f; float dayStart = instance.dayStart; float dayEnd = instance.dayEnd; float num2 = dayEnd - dayStart; if (!(num2 <= 0.01f) && !(num2 >= 23.99f)) { bool flag = num >= dayStart && num < dayEnd; float num3 = (flag ? ((num - dayStart) / num2) : (((num - dayEnd) % 24f + 24f) % 24f / (24f - num2))); Badge(sb, flag ? "DAY" : "NIGHT", Mathf.RoundToInt(Mathf.Clamp01(num3) * 100f).ToString(Inv) + "%", flag ? "#FFE38A" : "#AFC6FF"); } } } private static void Badge(StringBuilder sb, string label, string value, string color) { if (sb.Length > 0) { sb.Append(" "); } if (label != null) { sb.Append("<color=#9AA7B4>").Append(label).Append("</color> "); } sb.Append("<color=").Append(color).Append('>') .Append(value) .Append("</color>"); } private static string Clock(float seconds) { int num = Mathf.CeilToInt(Mathf.Max(0f, seconds)); return (num / 60).ToString(Inv) + ":" + (num % 60).ToString("00", Inv); } private static string StageName(int id) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) try { return ((object)(Segment)(byte)id/*cast due to .constrained prefix*/).ToString() + " (" + id + ")"; } catch { return id.ToString(); } } private void LogErr(string where, Exception e) { float unscaledTime = Time.unscaledTime; if (!_errLogged.TryGetValue(where, out var value) || !(unscaledTime - value < 10f)) { _errLogged[where] = unscaledTime; L.LogError((object)("[KFOG] " + where + " failed: " + e.GetType().Name + ": " + e.Message)); } } } [HarmonyPatch(typeof(OrbFogHandler), "WaitToMove")] internal static class WaitToMovePatch { private static bool Prefix(OrbFogHandler __instance) { try { return !Plugin.HoldsVanillaWait(__instance); } catch { return true; } } } [HarmonyPatch(typeof(OrbFogHandler), "Start")] internal static class FogStartPatch { private static void Postfix(OrbFogHandler __instance) { try { Plugin.CacheOrigins(__instance); } catch { } } } [HarmonyPatch(typeof(OrbFogHandler), "SetFogOrigin")] internal static class SetFogOriginPatch { private static void Postfix(OrbFogHandler __instance, int id) { try { Plugin.OnOriginSet(__instance, id); } catch { } } } [HarmonyPatch(typeof(Character), "SpawnStatue")] internal static class SpawnStatuePatch { private static bool Prefix(Character __instance, bool killedByDagger) { try { return !Plugin.SkipStatue(__instance, killedByDagger); } catch { return true; } } } [HarmonyPatch(typeof(DayNightManager), "Update")] internal static class DayNightPatch { private static void Prefix(DayNightManager __instance) { try { Plugin.DayNightStep(__instance); } catch { } } } [HarmonyPatch(typeof(MapHandler), "GoToSegment")] internal static class GoToSegmentPatch { private static void Prefix(MapHandler __instance, Segment s) { //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) try { if (s > __instance.GetCurrentSegment()) { Plugin.OnTransitionStart(); } } catch { } } } internal static class Weather { private class Storm { public bool On; public float Since; public int Scouts; public int Pushes; public int Gusts; public int Status; } private static readonly CultureInfo Inv = CultureInfo.InvariantCulture; internal static ConfigEntry<bool> WrEnabled; internal static ConfigEntry<bool> WrInfinite; internal static ConfigEntry<bool> WrAnyDir; internal static ConfigEntry<bool> WrGusts; internal static ConfigEntry<float> WrStrength; internal static ConfigEntry<float> WrLength; internal static ConfigEntry<float> WrGustPower; internal static ConfigEntry<float> WrGustChance; internal static ConfigEntry<float> WrGustFall; internal static ConfigEntry<float> WrStatusPerSec; internal static ConfigEntry<STATUSTYPE> WrStatus; internal static ConfigEntry<bool> WaEnabled; internal static ConfigEntry<bool> WaInfinite; internal static ConfigEntry<bool> WaAnyDir; internal static ConfigEntry<bool> WaGusts; internal static ConfigEntry<float> WaStrength; internal static ConfigEntry<float> WaCold; internal static ConfigEntry<float> WaLength; internal static ConfigEntry<float> WaGustPower; internal static ConfigEntry<float> WaGustChance; internal static ConfigEntry<float> WaGustFall; internal static ConfigEntry<float> WaStatusPerSec; internal static ConfigEntry<STATUSTYPE> WaStatus; internal static ConfigEntry<bool> WtEnabled; internal static ConfigEntry<bool> WtInfinite; internal static ConfigEntry<bool> WtPushDown; internal static ConfigEntry<float> WtLength; internal static ConfigEntry<float> WtPushPower; internal static ConfigEntry<float> WtStatusPerSec; internal static ConfigEntry<STATUSTYPE> WtStatus; internal static ConfigEntry<bool> WmEnabled; internal static ConfigEntry<float> WmSunHeat; internal static ConfigEntry<float> WmStatusPerSec; internal static ConfigEntry<STATUSTYPE> WmStatus; internal static readonly List<string> Missing = new List<string>(); private static readonly FieldRef<WindChillZone, float> UntilSwitch = Field<float>("untilSwitch"); private static readonly FieldRef<WindChillZone, Vector3> WindDir = Field<Vector3>("currentWindDirection"); private static readonly FieldRef<WindChillZone, float> ActiveFor = Field<float>("hasBeenActiveFor"); private static readonly FieldRef<WindChillZone, float> ForceMult = Field<float>("currentForceMult"); private static readonly MethodInfo NextTime = Method("GetNextWindTime"); private static readonly MethodInfo RandomDir = Method("RandomWindDirection"); private static readonly MethodInfo IntensityAt = Method("GetWindIntensityAtPoint"); private const float WIND_TICK = 0.125f; private const float SUN_TICK = 0.5f; private static float _windAt; private static float _sunAt; private static WindChillZone[] _zones = (WindChillZone[])(object)new WindChillZone[0]; private static HotSun[] _suns = (HotSun[])(object)new HotSun[0]; private static readonly List<Vector3> _campfires = new List<Vector3>(); private static int _cacheSeg = -99; private static string _cacheScene; private static float _cacheUntil; private static readonly Dictionary<int, Storm> _storms = new Dictionary<int, Storm>(); private const float MAX_DV = 45f; private const float STEP = 0.025f; private static readonly Dictionary<long, float> _acc = new Dictionary<long, float>(); private static readonly Dictionary<string, float> _errAt = new Dictionary<string, float>(); internal static bool Host { get { if (PhotonNetwork.InRoom) { return PhotonNetwork.IsMasterClient; } return false; } } private static ConfigDescription Rf(string text, float min, float max) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown return new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange<float>(min, max), Array.Empty<object>()); } internal static void Bind(ConfigFile c) { string text = "Weather Roots"; WrEnabled = c.Bind<bool>(text, "Enabled", false, "Turns the settings below on for the wind in the Roots. Off = the game's own wind."); WrStrength = c.Bind<float>(text, "Wind Strength", 1f, Rf("How hard the wind pushes. 1 = normal.", 1f, 10f)); WrLength = c.Bind<float>(text, "Wind Length", 1f, Rf("How long a wind lasts. 2 = twice as long.", 0.1f, 10f)); WrInfinite = c.Bind<bool>(text, "Infinite Wind", false, "The wind never stops."); WrAnyDir = c.Bind<bool>(text, "Any Wind Direction", false, "The wind can blow from any direction, also up and down."); WrGusts = c.Bind<bool>(text, "Big Gusts", false, "Now and then a big gust knocks scouts over."); WrGustPower = c.Bind<float>(text, "Gust Power", 5f, Rf("How hard a big gust hits.", 0f, 20f)); WrGustChance = c.Bind<float>(text, "Gust Chance (%)", 0.1f, Rf("Chance of a big gust, 10 rolls per second.", 0f, 10f)); WrGustFall = c.Bind<float>(text, "Gust Fall Time (s)", 1f, Rf("How long a gust knocks a scout over.", 0f, 5f)); WrStatus = c.Bind<STATUSTYPE>(text, "Wind Status", (STATUSTYPE)10, "Status the wind gives."); WrStatusPerSec = c.Bind<float>(text, "Wind Status per Second (%)", 0f, Rf("How much of that status per second in the wind.", 0f, 20f)); text = "Weather Alpine"; WaEnabled = c.Bind<bool>(text, "Enabled", false, "Turns the settings below on for the snowstorm in the Alpine. Off = the game's own snowstorm."); WaStrength = c.Bind<float>(text, "Snowstorm Strength", 1f, Rf("How hard the snowstorm pushes. 1 = normal.", 1f, 10f)); WaCold = c.Bind<float>(text, "Snowstorm Cold", 2f, Rf("How cold the snowstorm makes scouts. 1 = normal.", 1f, 10f)); WaLength = c.Bind<float>(text, "Snowstorm Length", 1f, Rf("How long a snowstorm lasts. 2 = twice as long.", 0.1f, 10f)); WaInfinite = c.Bind<bool>(text, "Infinite Snowstorm", false, "The snowstorm never stops."); WaAnyDir = c.Bind<bool>(text, "Any Snowstorm Direction", false, "The snowstorm can blow from any direction, also up and down."); WaGusts = c.Bind<bool>(text, "Big Gusts", false, "Now and then a big gust knocks scouts over."); WaGustPower = c.Bind<float>(text, "Gust Power", 5f, Rf("How hard a big gust hits.", 0f, 20f)); WaGustChance = c.Bind<float>(text, "Gust Chance (%)", 0.1f, Rf("Chance of a big gust, 10 rolls per second.", 0f, 10f)); WaGustFall = c.Bind<float>(text, "Gust Fall Time (s)", 1f, Rf("How long a gust knocks a scout over.", 0f, 5f)); WaStatus = c.Bind<STATUSTYPE>(text, "Snowstorm Status", (STATUSTYPE)2, "Status the snowstorm gives."); WaStatusPerSec = c.Bind<float>(text, "Snowstorm Status per Second (%)", 0f, Rf("How much of that status per second in the snowstorm.", 0f, 20f)); text = "Weather Tropics"; WtEnabled = c.Bind<bool>(text, "Enabled", false, "Turns the settings below on for the rain in the Tropics. Off = the game's own rain."); WtLength = c.Bind<float>(text, "Rain Length", 1f, Rf("How long a rain lasts. 2 = twice as long.", 0.1f, 10f)); WtInfinite = c.Bind<bool>(text, "Infinite Rain", false, "The rain never stops."); WtPushDown = c.Bind<bool>(text, "Rain Pushes Down", false, "The rain pushes scouts under open sky down."); WtPushPower = c.Bind<float>(text, "Rain Push Power", 10f, Rf("How hard the rain pushes down.", 0f, 100f)); WtStatus = c.Bind<STATUSTYPE>(text, "Rain Status", (STATUSTYPE)3, "Status the rain gives."); WtStatusPerSec = c.Bind<float>(text, "Rain Status per Second (%)", 0f, Rf("How much of that status per second in the rain.", 0f, 20f)); text = "Weather Mesa"; WmEnabled = c.Bind<bool>(text, "Enabled", false, "Turns the settings below on for the sun in the Mesa. Off = the game's own sun."); WmSunHeat = c.Bind<float>(text, "Sun Heat", 2f, Rf("How hot the sun makes scouts. 1 = normal.", 1f, 10f)); WmStatus = c.Bind<STATUSTYPE>(text, "Sun Status", (STATUSTYPE)8, "Status the sun gives."); WmStatusPerSec = c.Bind<float>(text, "Sun Status per Second (%)", 0f, Rf("How much of that status per second in the sun.", 0f, 20f)); } internal static string Describe() { return "Weather: Roots " + (WrEnabled.Value ? "ON" : "OFF") + ", Alpine " + (WaEnabled.Value ? "ON" : "OFF") + ", Tropics " + (WtEnabled.Value ? "ON" : "OFF") + ", Mesa " + (WmEnabled.Value ? "ON" : "OFF") + ((Missing.Count > 0) ? (" (game member MISSING: " + string.Join(", ", Missing.ToArray()) + ")") : ""); } private static FieldRef<WindChillZone, F> Field<F>(string name) { try { return AccessTools.FieldRefAccess<WindChillZone, F>(name); } catch { Missing.Add("WindChillZone." + name); return null; } } private static MethodInfo Method(string name) { MethodInfo methodInfo = null; try { methodInfo = AccessTools.Method(typeof(WindChillZone), name, (Type[])null, (Type[])null); } catch { } if (methodInfo == null) { Missing.Add("WindChillZone." + name + "()"); } return methodInfo; } private static float Intensity(WindChillZone z, Vector3 p) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) try { if (IntensityAt == null) { return 1f; } return (float)IntensityAt.Invoke(null, new object[3] { p, z.lightVolumeSampleThreshold_lower, z.lightVolumeSampleThreshold_margin }); } catch (Exception e) { Err("wind intensity", e); return 1f; } } private static bool InAirport() { //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(); return ((Scene)(ref activeScene)).name == "Airport"; } private static bool AnyOn() { if (!WrEnabled.Value && !WaEnabled.Value && !WtEnabled.Value) { return WmEnabled.Value; } return true; } internal static void Tick() { if (Host && AnyOn() && !InAirport()) { float time = Time.time; RefreshIfNeeded(time); if (time >= _windAt) { _windAt = time + 0.125f; Safe("weather wind", Wind); } if (time >= _sunAt) { _sunAt = time + 0.5f; Safe("weather sun", Sun); } } } private static void RefreshIfNeeded(float now) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected I4, but got Unknown //IL_0113: Unknown result type (might be due to invalid IL or missing references) int num = -1; try { MapHandler instance = Singleton<MapHandler>.Instance; if ((Object)(object)instance != (Object)null) { num = (int)instance.GetCurrentSegment(); } } catch { } Scene activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; if (num == _cacheSeg && name == _cacheScene && now < _cacheUntil) { return; } _cacheSeg = num; _cacheScene = name; _cacheUntil = now + 10f; try { _zones = Object.FindObjectsByType<WindChillZone>((FindObjectsInactive)1, (FindObjectsSortMode)0); } catch { _zones = (WindChillZone[])(object)new WindChillZone[0]; } try { _suns = Object.FindObjectsByType<HotSun>((FindObjectsInactive)1, (FindObjectsSortMode)0); } catch { _suns = (HotSun[])(object)new HotSun[0]; } _campfires.Clear(); for (int i = num - 1; i <= num; i++) { try { MapHandler instance2 = Singleton<MapHandler>.Instance; if (!((Object)(object)instance2 == (Object)null) && i >= 0 && instance2.segments != null && i < instance2.segments.Length) { GameObject campfireRoot = MapHandler.GetCampfireRoot(i); Campfire val = (((Object)(object)campfireRoot != (Object)null) ? campfireRoot.GetComponentInChildren<Campfire>(true) : null); if ((Object)(object)val != (Object)null) { _campfires.Add(((Component)val).transform.position); } } } catch (Exception e) { Err("weather campfire " + i, e); } } } private static bool InSafezone(Vector3 p) { //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) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(0f, Plugin.CampfireSafeRadius.Value) / CharacterStats.unitsToMeters; if (num <= 0f) { return false; } foreach (Vector3 campfire in _campfires) { if (Vector3.Distance(p, campfire) < num) { return true; } } return false; } private static bool Target(Character c) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)c == (Object)null || c.isBot || c.isZombie || c.isScoutmaster) { return false; } if ((Object)(object)((MonoBehaviourPun)c).photonView == (Object)null || ((MonoBehaviourPun)c).photonView.Owner == null || c.data.dead) { return false; } return !InSafezone(c.Center); } catch { return false; } } private static void Wind() { //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(0.001f, Time.fixedDeltaTime); WindChillZone[] zones = _zones; foreach (WindChillZone val in zones) { if ((Object)(object)val == (Object)null) { continue; } string name = ((Object)val).name; bool flag = name == "WindStorm"; bool flag2 = name == "SnowStorm"; bool flag3 = name == "RainStorm"; if ((flag && !WrEnabled.Value) || (flag2 && !WaEnabled.Value) || (flag3 && !WtEnabled.Value) || (!flag && !flag2 && !flag3)) { continue; } bool flag4 = ((Behaviour)val).isActiveAndEnabled && val.windActive; StormState(val, flag4); if (!flag4) { continue; } int num2 = 0; int num3 = 0; int num4 = 0; int num5 = 0; Vector3 val2 = ((WindDir != null) ? WindDir.Invoke(val) : Vector3.right); float num6 = ((ForceMult != null) ? ForceMult.Invoke(val) : 1f); float num7 = ((ActiveFor != null) ? ActiveFor.Invoke(val) : 10f); foreach (Character allCharacter in Character.AllCharacters) { if (!Target(allCharacter) || !((Bounds)(ref val.windZoneBounds)).Contains(allCharacter.Center)) { continue; } float num8 = Intensity(val, allCharacter.Center); num2++; if (flag3) { if (WtPushDown.Value && Exposed(allCharacter)) { Impulse(allCharacter, new Vector3(0f, 0f - WtPushPower.Value, 0f), allCharacter.Center, val.forceRadius); num3++; } if (WtStatusPerSec.Value > 0f) { AddStatus(allCharacter, WtStatus.Value, WtStatusPerSec.Value / 100f * 0.125f); num5++; } continue; } float num9 = (flag ? WrStrength.Value : WaStrength.Value); bool num10 = (flag ? WrGusts.Value : WaGusts.Value); float num11 = WindNum(val, allCharacter) * num6; if (num9 > 1f && (Object)(object)allCharacter.data.currentClimbHandle == (Object)null) { Vector3 impulse = val2 * (val.windForce * num8 * num11) * (num9 - 1f) * (0.125f / num); Impulse(allCharacter, impulse, allCharacter.Center, val.forceRadius); num3++; } if (num10 && allCharacter.data.fallSeconds <= 0f && val.windIntensity > 0.5f) { float num12 = (flag ? WrGustChance.Value : WaGustChance.Value) / 100f; float num13 = 1f - Mathf.Pow(1f - Mathf.Clamp01(num12), 1.25f); if (Random.value < num13) { float num14 = (flag ? WrGustPower.Value : WaGustPower.Value); WholeBody(allCharacter, val2 * val.windForce * num8 * num11 * num14 * Mathf.Max(num9, 1f) * 1.75f, (BodypartType)4); Fall(allCharacter, flag ? WrGustFall.Value : WaGustFall.Value); num4++; } } float num15 = (flag ? WrStatusPerSec.Value : WaStatusPerSec.Value); if (num15 > 0f) { AddStatus(allCharacter, flag ? WrStatus.Value : WaStatus.Value, num15 / 100f * num8 * 0.125f); num5++; } if (flag2 && WaCold.Value > 1f && val.statusApplicationPerSecond > 0f) { float num16 = num8 * val.statusApplicationPerSecond * Mathf.Clamp01(num7 * 0.2f) * 0.125f; AddStatus(allCharacter, val.statusType, num16 * (WaCold.Value - 1f)); num5++; } } StormAdd(val, num2, num3, num4, num5); } } private static float WindNum(WindChillZone z, Character c) { float num = (z.useIntensityCurve ? (Mathf.Clamp01(z.windIntensity - 0.5f) * 2f) : 1f); bool flag = false; try { Parasol val = default(Parasol); if ((Object)(object)c.data.currentItem != (Object)null && ((Component)c.data.currentItem).TryGetComponent<Parasol>(ref val) && val.isOpen) { num *= 10f; flag = true; } int currentBalloonCount = c.refs.balloons.currentBalloonCount; if (currentBalloonCount > 0) { num *= (float)(((!flag) ? 2 : 0) + currentBalloonCount); } Affliction val2 = default(Affliction); if (c.refs.afflictions.HasAfflictionType((AfflictionType)17, ref val2)) { num = 0f; } if (c.data.fallSeconds >= 0.01f) { num *= z.ragdolledWindForceMult; } } catch (Exception e) { Err("wind factors", e); } return num; } private static bool Exposed(Character c) { //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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) try { return HelperFunctions.GetGroundPos(c.Center + Vector3.up * 500f, (LayerType)1, 0f).y < c.Center.y; } catch (Exception e) { Err("rain roof check", e); return true; } } private static void Sun() { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_01a9