using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BoneLib.BoneMenu; using FordRoyale; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSLZ.Bonelab; using Il2CppSLZ.Marrow; using Il2CppSLZ.Marrow.Data; using Il2CppSLZ.Marrow.Pool; using Il2CppSLZ.Marrow.Warehouse; using Il2CppSystem; using Il2CppTMPro; using LabFusion.Data; using LabFusion.Entities; using LabFusion.Marrow.Integration; using LabFusion.Marrow.Pool; using LabFusion.Menu.Data; using LabFusion.Network; using LabFusion.Network.Serialization; using LabFusion.Player; using LabFusion.RPC; using LabFusion.SDK.Gamemodes; using LabFusion.SDK.Modules; using LabFusion.SDK.Triggers; using LabFusion.Scene; using LabFusion.Senders; using LabFusion.UI.Popups; using LabFusion.Utilities; using MelonLoader; using MelonLoader.Utils; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(FordRoyaleMod), "FordRoyale", "0.2.3", "JonLandonMods", null)] [assembly: MelonGame("Stress Level Zero", "BONELAB")] [assembly: MelonAdditionalDependencies(new string[] { "LabFusion" })] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("FordRoyale")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0")] [assembly: AssemblyProduct("FordRoyale")] [assembly: AssemblyTitle("FordRoyale")] [assembly: AssemblyVersion("0.1.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 FordRoyale { public static class FordRoyaleConfig { public enum GameMode { Solos, Duos } public enum LootSpawning { Auto, Random, SpawnersOnly } public enum StormSize { Small, Medium, Big } public const string MapLevelBarcode = "Schoold.TiltedTowersBONELAB.Level.TiltedTowers"; public static readonly Vector3 MapCenter = new Vector3(0f, 0f, 0f); public const float LootScatterRadius = 80f; public static bool FortniteGunsRequired = true; public static bool FortnitePropsRequired = true; public static bool TiltedTowersMapRequired = false; public static GameMode ModeSetting = GameMode.Solos; public static bool HealthRegenEnabled = false; public static bool UseMapSpawnPoints = false; public static LootSpawning LootSpawningSetting = LootSpawning.Auto; public const float VanillaWeaponMultiplier = 1.8f; public const float RareWeaponChance = 0.3f; public const float EpicWeaponChance = 0.1f; public static readonly string[] CommonWeapons = new string[10] { "Blurgert.FortniteGunPack.Spawnable.SemiAutoPistol", "Blurgert.FortniteGunPack.Spawnable.SidearmPistol", "Blurgert.FortniteGunPack.Spawnable.RangerPistol", "Blurgert.FortniteGunPack.Spawnable.CombatPistol", "Blurgert.FortniteGunPack.Spawnable.TacticalPistol", "Blurgert.FortniteGunPack.Spawnable.SubmachineGun", "Blurgert.FortniteGunPack.Spawnable.CompactSMG", "Blurgert.FortniteGunPack.Spawnable.MicroSMG", "Blurgert.FortniteGunPack.Spawnable.HuntingRifle", "Blurgert.FortniteGunPack.Spawnable.PumpShotgunRare" }; public static readonly string[] RareWeapons = new string[15] { "Blurgert.FortniteGunPack.Spawnable.AssaultRifle", "Blurgert.FortniteGunPack.Spawnable.Scar", "Blurgert.FortniteGunPack.Spawnable.TacticalAssaultRifle", "Blurgert.FortniteGunPack.Spawnable.CombatAssaultRifle", "Blurgert.FortniteGunPack.Spawnable.RedeyeAssaultRifle", "Blurgert.FortniteGunPack.Spawnable.TwinMagAssaultRifle", "Blurgert.FortniteGunPack.Spawnable.HammerAssaultRifle", "Blurgert.FortniteGunPack.Spawnable.PumpShotgunEpic", "Blurgert.FortniteGunPack.Spawnable.TacticalShotgun", "Blurgert.FortniteGunPack.Spawnable.CombatShotgun", "Blurgert.FortniteGunPack.Spawnable.CombatSMG", "Blurgert.FortniteGunPack.Spawnable.DrumGun", "Blurgert.FortniteGunPack.Spawnable.SuppressedScar", "Blurgert.FortniteGunPack.Spawnable.FlapjackRifle", "Blurgert.FortniteGunPack.Spawnable.LeverActionRifle" }; public static readonly string[] EpicWeapons = new string[9] { "Blurgert.FortniteGunPack.Spawnable.BoltActionSniperRifle", "Blurgert.FortniteGunPack.Spawnable.SemiAutoSniperRifle", "Blurgert.FortniteGunPack.Spawnable.HeavySniperRifle", "Blurgert.FortniteGunPack.Spawnable.DeadeyeDMR", "Blurgert.FortniteGunPack.Spawnable.HandCannon", "Blurgert.FortniteGunPack.Spawnable.MidasDrumGun", "Blurgert.FortniteGunPack.Spawnable.MysticsAssaultRifle", "Blurgert.FortniteGunPack.Spawnable.MysticsHandCannon", "Blurgert.FortniteGunPack.Spawnable.MysticsFrenzyAutoShotgun" }; public static readonly string[] PropBarcodes = new string[6] { "Blurgert.FortnitePropPack.Spawnable.Chest", "Blurgert.FortnitePropPack.Spawnable.Chest", "Blurgert.FortnitePropPack.Spawnable.AmmoBox", "Blurgert.FortnitePropPack.Spawnable.AmmoBox", "Blurgert.FortnitePropPack.Spawnable.RareChest", "Blurgert.FortnitePropPack.Spawnable.LaunchPadStatic" }; public static readonly string[] VanillaCommonWeapons = new string[8] { "c1534c5a-2a4f-481f-8542-cc9545646572", "c1534c5a-aade-4fa1-8f4b-d4c547756e4d", "c1534c5a-bcb7-4f02-a4f5-da9550333530", "c1534c5a-50cf-4500-83d5-c0b447756e50", "c1534c5a-fcfc-4f43-8fb0-d29531393131", "c1534c5a-9f55-4c56-ae23-d33b47727562", "c1534c5a-8d03-42de-93c7-f595534d4755", "c1534c5a-9f54-4f32-b8b9-f295534d474d" }; public static readonly string[] VanillaRareWeapons = new string[9] { "c1534c5a-d00c-4aa8-adfd-3495534d474d", "c1534c5a-4c47-428d-b5a5-b05747756e56", "c1534c5a-04d7-41a0-b7b8-5a95534d4750", "c1534c5a-40e5-40e0-8139-194347756e55", "c1534c5a-a6b5-4177-beb8-04d947756e41", "c1534c5a-9112-49e5-b022-9c955269666c", "c1534c5a-2774-48db-84fd-778447756e46", "c1534c5a-7f05-402f-9320-609647756e35", "c1534c5a-e0b5-4d4b-9df3-567147756e4d" }; public static readonly string[] VanillaEpicWeapons = new string[5] { "c1534c5a-ea97-495d-b0bf-ac955269666c", "c1534c5a-cc53-4aac-b842-46955269666c", "c1534c5a-c061-4c5c-a5e2-3d955269666c", "c1534c5a-ec8e-418a-a545-cf955269666c", "SLZ.BONELAB.Content.Spawnable.RifleM1Garand" }; public static readonly string[] VanillaMeleeWeapons = new string[14] { "c1534c5a-6441-40aa-a070-909542617365", "c1534c5a-0c8a-4b82-9f8b-7a9543726f77", "c1534c5a-a767-4a58-b3ef-26064d616368", "c1534c5a-282b-4430-b009-58954b617461", "c1534c5a-d605-4f85-870d-f68848617463", "c1534c5a-d0e9-4d53-9218-e76446727969", "c1534c5a-8597-4ffe-892e-b995476f6c66", "c1534c5a-f6f9-4c96-b88e-91d74c656164", "c1534c5a-1f5a-4993-bbc1-03be4d656c65", "c1534c5a-1fb8-477c-afbe-2a95436f6d62", "c1534c5a-a97f-4bff-b512-e44d53706561", "c1534c5a-e75f-4ded-aa5a-a27b4178655f", "c1534c5a-d086-4e27-918d-ee9542617374", "fa534c5a868247138f50c62e424c4144.Spawnable.Baton" }; public const float PlayerVitality = 1.5f; public const int StartingAmmo = 150; public const int MaxAmmo = 999999; public const float StormGraceTime = 90f; public const float StormStartRadius = 120f; public const float StormMinStartRadius = 40f; public const float StormMaxStartRadius = 250f; public static StormSize StormSizeSetting = StormSize.Medium; public const float SpectatorBoxHeight = 300f; public const float SpectatorBoxSize = 8f; public const int MaxSpectatorCameras = 4; public const float SpectatorCycleInterval = 6f; public static readonly float[] StormPhaseFractions = new float[4] { 0.6f, 0.35f, 0.18f, 0.08f }; public const float StormHoldTime = 45f; public const float StormShrinkTime = 30f; public static readonly int[] StormCountdownWarnings = new int[3] { 30, 10, 5 }; public const float StormDamagePerSecond = 0.25f; public const float StormTickInterval = 1f; public static bool IsQuest => (int)Application.platform == 11; public static int WeaponSpawnCount { get { if (!IsQuest) { return 70; } return 40; } } public static int PropSpawnCount { get { if (!IsQuest) { return 36; } return 20; } } public static int MeleeSpawnCount { get { if (!IsQuest) { return 10; } return 6; } } public static int AmmoBoxSpawnCount { get { if (!IsQuest) { return 12; } return 6; } } public static float StormSizeMultiplier => StormSizeSetting switch { StormSize.Small => 0.6f, StormSize.Big => 1.5f, _ => 1f, }; } public class FordRoyaleDeathData : INetSerializable { public byte SmallId; public void Serialize(INetSerializer serializer) { serializer.SerializeValue(ref SmallId); } public static FordRoyaleDeathData Create(byte smallId) { return new FordRoyaleDeathData { SmallId = smallId }; } } public class FordRoyaleDeathMessage : ModuleMessageHandler { protected override void OnHandleMessage(ReceivedMessage received) { FordRoyaleDeathData fordRoyaleDeathData = ((ReceivedMessage)(ref received)).ReadData(); if (NetworkInfo.IsHost) { FordRoyaleGamemode.Instance?.ReportPlayerDead(fordRoyaleDeathData.SmallId); } } } public class FordRoyaleGamemode : Gamemode { private readonly TeamManager _teamManager = new TeamManager(); private readonly Team _aliveTeam = new Team("Alive"); private readonly Team _eliminatedTeam = new Team("Eliminated"); private readonly Storm _storm = new Storm(); public const string StormPhasesKey = "FordRoyale.StormPhases"; public const string ModeKey = "FordRoyale.Mode"; private const string DuoKeyPrefix = "FordRoyale.Duo."; private const string KillsKeyPrefix = "FordRoyale.Kills."; private const string WinsKeyPrefix = "FordRoyale.Wins."; private const string RegenKey = "FordRoyale.Regen"; private const string MapSpawnsKey = "FordRoyale.MapSpawns"; private FordRoyaleConfig.GameMode _mode; private bool _regenEnabled; private bool _useMapSpawnPoints; private readonly Dictionary _duos = new Dictionary(); private readonly HashSet _hostEliminated = new HashSet(); private const string SpawnsKey = "FordRoyale.Spawns"; private static readonly Random _rng = new Random(); private List _spawnPoints; private bool _spectatorBoxBuilt; private float _victoryCheckTimer; private bool _localReportedDead; private bool _localConfirmedAlive; private float _roundTime; private readonly HashSet _confirmedAlive = new HashSet(); private readonly HashSet _eliminationHandled = new HashSet(); private bool _victoryDeclared; private bool _victoryShown; public override string Title => "Ford Royale"; public override string Author => "JonLandonMods"; public override string Description => "A mini battle royale! Weapons and chests are scattered around the map. Stay inside the storm circle and be the last player standing to claim the Victory Royale! Requires the Fortnite weapon/prop mods and the map from mod.io."; public override bool DisableDevTools => true; public override bool DisableSpawnGun => true; public override bool DisableManualUnragdoll => true; public override bool AutoHolsterOnDeath => true; public static FordRoyaleGamemode Instance { get; private set; } public TeamManager TeamManager => _teamManager; public Team AliveTeam => _aliveTeam; public Team EliminatedTeam => _eliminatedTeam; public Storm Storm => _storm; public TriggerEvent VictoryEvent { get; set; } public TriggerEvent EliminationEvent { get; set; } public int MinimumPlayers { get; set; } = 2; public bool IsDuos => _mode == FordRoyaleConfig.GameMode.Duos; public bool UseMapSpawnPoints => _useMapSpawnPoints; public TriggerEvent DeathTrigger { get; set; } private void ApplyRegen() { LocalHealth.RegenerationOverride = (_regenEnabled ? ((bool?)null) : new bool?(false)); } public int GetDuo(byte smallId) { if (!_duos.TryGetValue(smallId, out var value)) { return -1; } return value; } public bool SameDuo(PlayerID a, PlayerID b) { if (a == null || b == null) { return false; } int duo = GetDuo(a.SmallID); if (duo != -1) { return duo == GetDuo(b.SmallID); } return false; } public int GetLobbyKills(byte smallId) { return ReadCount("FordRoyale.Kills." + smallId); } public int GetLobbyWins(byte smallId) { return ReadCount("FordRoyale.Wins." + smallId); } private int ReadCount(string key) { try { string text = default(string); int result; return int.TryParse(((Gamemode)this).Metadata.TryGetMetadata(key, ref text) ? text : null, out result) ? result : 0; } catch { return 0; } } private void HostAddKill(PlayerID killer) { if (NetworkInfo.IsHost && killer != null) { string text = "FordRoyale.Kills." + killer.SmallID; ((Gamemode)this).Metadata.TrySetMetadata(text, (ReadCount(text) + 1).ToString()); } } private void HostAddWin(PlayerID winner) { if (NetworkInfo.IsHost && winner != null) { string text = "FordRoyale.Wins." + winner.SmallID; ((Gamemode)this).Metadata.TrySetMetadata(text, (ReadCount(text) + 1).ToString()); } } public override bool CanAttack(PlayerID player) { if (!((Gamemode)this).IsStarted) { return true; } if (IsDuos && SameDuo(player, PlayerIDManager.LocalID)) { return false; } return true; } public override GroupElementData CreateSettingsGroup() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_0119: 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_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Expected O, but got Unknown //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: 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_017a: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Expected O, but got Unknown //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Expected O, but got Unknown //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Expected O, but got Unknown //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Expected O, but got Unknown //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Expected O, but got Unknown GroupElementData obj = ((Gamemode)this).CreateSettingsGroup(); GroupElementData val = new GroupElementData("General"); obj.AddElement(val); val.AddElement(new IntElementData { Title = "Minimum Players", Value = MinimumPlayers, Increment = 1, MinValue = 2, MaxValue = 20, OnValueChanged = delegate(int v) { MinimumPlayers = v; } }); val.AddElement(new EnumElementData { Title = "Mode", Value = FordRoyaleConfig.ModeSetting, EnumType = typeof(FordRoyaleConfig.GameMode), OnValueChanged = delegate(Enum v) { FordRoyaleConfig.ModeSetting = (FordRoyaleConfig.GameMode)(object)v; } }); val.AddElement(new EnumElementData { Title = "Storm Size", Value = FordRoyaleConfig.StormSizeSetting, EnumType = typeof(FordRoyaleConfig.StormSize), OnValueChanged = delegate(Enum v) { FordRoyaleConfig.StormSizeSetting = (FordRoyaleConfig.StormSize)(object)v; } }); val.AddElement(new BoolElementData { Title = "Health Regeneration", Value = FordRoyaleConfig.HealthRegenEnabled, OnValueChanged = delegate(bool v) { FordRoyaleConfig.HealthRegenEnabled = v; } }); val.AddElement(new BoolElementData { Title = "Use Map Spawn Points", Value = FordRoyaleConfig.UseMapSpawnPoints, OnValueChanged = delegate(bool v) { FordRoyaleConfig.UseMapSpawnPoints = v; } }); GroupElementData val2 = new GroupElementData("Required Mods"); obj.AddElement(val2); val2.AddElement(new BoolElementData { Title = "Fortnite Gun Mod Required", Value = FordRoyaleConfig.FortniteGunsRequired, OnValueChanged = delegate(bool v) { FordRoyaleConfig.FortniteGunsRequired = v; } }); val2.AddElement(new BoolElementData { Title = "Fortnite Prop Mod Required", Value = FordRoyaleConfig.FortnitePropsRequired, OnValueChanged = delegate(bool v) { FordRoyaleConfig.FortnitePropsRequired = v; } }); val2.AddElement(new BoolElementData { Title = "Tilted Towers Map Required", Value = FordRoyaleConfig.TiltedTowersMapRequired, OnValueChanged = delegate(bool v) { FordRoyaleConfig.TiltedTowersMapRequired = v; } }); return obj; } public override bool CheckReadyConditions() { if (PlayerIDManager.PlayerCount < MinimumPlayers) { return false; } if (FordRoyaleConfig.TiltedTowersMapRequired && FusionSceneManager.Barcode != "Schoold.TiltedTowersBONELAB.Level.TiltedTowers") { return false; } return true; } public override void OnGamemodeRegistered() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown Instance = this; MultiplayerHooking.OnPlayerAction += new PlayerAction(OnPlayerAction); FusionOverrides.OnValidateNametag += new UserOverride(OnValidateNametag); TeamManager.Register((Gamemode)(object)this); TeamManager.AddTeam(AliveTeam); TeamManager.AddTeam(EliminatedTeam); VictoryEvent = new TriggerEvent("VictoryRoyale", ((Gamemode)this).Relay, false); VictoryEvent.OnTriggeredWithValue += OnVictory; EliminationEvent = new TriggerEvent("Elimination", ((Gamemode)this).Relay, false); EliminationEvent.OnTriggeredWithValue += OnElimination; DeathTrigger = new TriggerEvent("FordRoyaleDied", ((Gamemode)this).Relay, false); DeathTrigger.OnTriggeredWithValue += OnDeathReported; } private void OnDeathReported(string value) { if (NetworkInfo.IsHost && byte.TryParse(value, out var result)) { PlayerID playerID = PlayerIDManager.GetPlayerID(result); if (playerID != null) { EliminateOnHost(playerID); } } } public override void OnGamemodeUnregistered() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown if (Instance == this) { Instance = null; } MultiplayerHooking.OnPlayerAction -= new PlayerAction(OnPlayerAction); FusionOverrides.OnValidateNametag -= new UserOverride(OnValidateNametag); TeamManager.Unregister(); VictoryEvent.UnregisterEvent(); VictoryEvent = null; EliminationEvent.UnregisterEvent(); EliminationEvent = null; DeathTrigger.UnregisterEvent(); DeathTrigger = null; } public override void OnGamemodeStarted() { //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022a: 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) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0247: 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_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Expected O, but got Unknown //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: 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_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) ((Gamemode)this).OnGamemodeStarted(); LocalHealth.MortalityOverride = true; LocalHealth.VitalityOverride = 1.5f; LocalControls.DisableSlowMo = true; if (NetworkInfo.IsHost) { _regenEnabled = FordRoyaleConfig.HealthRegenEnabled; _useMapSpawnPoints = FordRoyaleConfig.UseMapSpawnPoints; } ApplyRegen(); LocalHealth.SetFullHealth(); RoundReset.Run(); Storm.Start(); WristHealthDisplay.Show(); MapDisplay.AddMenuItem(); _spectatorBoxBuilt = false; _spawnPoints = null; _hostEliminated.Clear(); _eliminationHandled.Clear(); _confirmedAlive.Clear(); _roundTime = 0f; _victoryDeclared = false; _victoryShown = false; _victoryCheckTimer = 0f; _localReportedDead = false; _localConfirmedAlive = false; if (NetworkInfo.IsHost) { _mode = FordRoyaleConfig.ModeSetting; ((Gamemode)this).Metadata.TrySetMetadata("FordRoyale.Mode", _mode.ToString()); ((Gamemode)this).Metadata.TrySetMetadata("FordRoyale.Regen", _regenEnabled.ToString()); ((Gamemode)this).Metadata.TrySetMetadata("FordRoyale.MapSpawns", _useMapSpawnPoints.ToString()); foreach (PlayerID playerID in PlayerIDManager.PlayerIDs) { TeamManager.TryAssignTeam(playerID, AliveTeam); } AssignDuos(); Vector3 val = (Vector3)(((??)GetLocalPlayerPosition()) ?? FordRoyaleConfig.MapCenter); Bounds bounds = MapBounds.Compute(val); float num = MapBounds.GetStartRadius(bounds) * FordRoyaleConfig.StormSizeMultiplier; num = Mathf.Clamp(num, 40f, 375f); List phases = Storm.GeneratePhases(val, num); ((Gamemode)this).Metadata.TrySetMetadata("FordRoyale.StormPhases", Storm.SerializePhases(phases)); Storm.ApplyPhases(phases); LootSpawner.CleanupLoot(); LootSpawner.SpawnAllLoot(val, bounds, num * 1.1f); if (!_useMapSpawnPoints) { PublishSpawnPoints(val, num); } } MelonCoroutines.Start(SpreadSpawnRoutine()); FusionOverrides.ForceUpdateOverrides(); Notifier.Send(new Notification { ShowPopup = true, Title = NotificationText.op_Implicit("Ford Royale"), Message = NotificationText.op_Implicit("The round has started! Find a weapon, stay out of the storm, and be the last one standing!"), PopupLength = 5f, Type = (NotificationType)0 }); } public override void OnGamemodeStopped() { ((Gamemode)this).OnGamemodeStopped(); Storm.Stop(); WristHealthDisplay.Hide(); MapDisplay.HideMap(); MapDisplay.RemoveMenuItem(); SpectatorBox.Cleanup(); _spectatorBoxBuilt = false; LocalHealth.MortalityOverride = null; LocalHealth.RegenerationOverride = null; LocalHealth.VitalityOverride = null; LocalControls.DisableSlowMo = false; if (NetworkInfo.IsHost) { TeamManager.UnassignAllPlayers(); LootSpawner.CleanupLoot(); } MelonCoroutines.Start(ReviveAndRespawn()); FusionOverrides.ForceUpdateOverrides(); } private static IEnumerator ReviveAndRespawn() { yield return null; yield return null; if (RigData.HasPlayer) { LocalHealth.MortalityOverride = null; LocalHealth.SetFullHealth(); LocalRagdoll.ToggleRagdoll(false); } GamemodeHelper.TeleportToSpawnPoint(); } private void AssignDuos() { _duos.Clear(); if (!IsDuos) { return; } List list = new List(PlayerIDManager.PlayerIDs); for (int num = list.Count - 1; num > 0; num--) { int num2 = _rng.Next(num + 1); List list2 = list; int index = num; int index2 = num2; PlayerID value = list[num2]; PlayerID value2 = list[num]; list2[index] = value; list[index2] = value2; } int num3 = 0; for (int i = 0; i < list.Count; i += 2) { AssignDuo(list[i].SmallID, num3); if (i + 1 < list.Count) { AssignDuo(list[i + 1].SmallID, num3); } num3++; } } private void AssignDuo(byte smallId, int duoId) { ((Gamemode)this).Metadata.TrySetMetadata("FordRoyale.Duo." + smallId, duoId.ToString()); _duos[smallId] = duoId; } private void PublishSpawnPoints(Vector3 center, float startRadius) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0117: 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_006f: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) List list = new List(); float num = startRadius * 0.5f; int num2 = Mathf.Max(PlayerIDManager.PlayerCount, 8); Bounds bounds = MapBounds.Compute(center); float ceilingHeight = MapBounds.GetCeilingHeight(center, bounds); RaycastHit val3 = default(RaycastHit); for (int i = 0; i < num2 * 4; i++) { if (list.Count >= num2) { break; } float num3 = (float)(_rng.NextDouble() * 3.1415927410125732 * 2.0); float num4 = (float)Math.Sqrt(_rng.NextDouble()) * num; Vector3 val = center + new Vector3(Mathf.Cos(num3) * num4, 0f, Mathf.Sin(num3) * num4); Vector3 val2 = new Vector3(val.x, ceilingHeight, val.z); float num5 = ceilingHeight - ((Bounds)(ref bounds)).min.y + 80f; if (Physics.Raycast(val2, Vector3.down, ref val3, num5, -1, (QueryTriggerInteraction)1)) { list.Add(((RaycastHit)(ref val3)).point + Vector3.up * 0.5f); } } if (list.Count == 0) { list.Add(center + Vector3.up * 0.5f); } _spawnPoints = list; CultureInfo inv = CultureInfo.InvariantCulture; IEnumerable values = list.Select((Vector3 p) => $"{p.x.ToString(inv)};{p.y.ToString(inv)};{p.z.ToString(inv)}"); ((Gamemode)this).Metadata.TrySetMetadata("FordRoyale.Spawns", string.Join("|", values)); } private IEnumerator SpreadSpawnRoutine() { yield return null; yield return null; if (_useMapSpawnPoints) { IReadOnlyList readOnlyList = GamemodeMarker.FilterMarkers((BoneTagReference)null); List list = new List(); if (readOnlyList != null) { foreach (GamemodeMarker item in readOnlyList) { if ((Object)(object)item != (Object)null) { list.Add(((Component)item).transform.position); } } } list = (from p in list orderby p.x, p.z, p.y select p).ToList(); if (list.Count == 0 || !RigData.HasPlayer) { GamemodeHelper.TeleportToSpawnPoint(); yield break; } GetSpawnSelection(out var index, out var offset); LocalPlayer.TeleportToPosition(list[index % list.Count] + offset + Vector3.up * 0.5f, Vector3.forward); yield break; } List list2 = _spawnPoints; if (list2 == null || list2.Count == 0) { float wait = 0f; string text = default(string); while (wait < 2f && !((Gamemode)this).Metadata.TryGetMetadata("FordRoyale.Spawns", ref text)) { wait += Time.deltaTime; yield return null; } string text2 = default(string); list2 = ParseSpawns(((Gamemode)this).Metadata.TryGetMetadata("FordRoyale.Spawns", ref text2) ? text2 : null); } if (list2 != null && list2.Count != 0 && RigData.HasPlayer) { GetSpawnSelection(out var index2, out var offset2); LocalPlayer.TeleportToPosition(list2[index2 % list2.Count] + offset2 + Vector3.up * 0.5f, Vector3.forward); } } private void GetSpawnSelection(out int index, out Vector3 offset) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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) offset = Vector3.zero; int localDuo = GetDuo(PlayerIDManager.LocalSmallID); if (IsDuos && localDuo != -1) { index = localDuo; List list = (from p in PlayerIDManager.PlayerIDs select p.SmallID into s where GetDuo(s) == localDuo orderby s select s).ToList(); if (list.Count > 1 && list.IndexOf(PlayerIDManager.LocalSmallID) == 1) { offset = new Vector3(1.5f, 0f, 0f); } } else { List list2 = (from p in PlayerIDManager.PlayerIDs select p.SmallID into s orderby s select s).ToList(); index = list2.IndexOf(PlayerIDManager.LocalSmallID); if (index < 0) { index = 0; } } } private static List ParseSpawns(string raw) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) List list = new List(); if (string.IsNullOrEmpty(raw)) { return list; } CultureInfo invariantCulture = CultureInfo.InvariantCulture; string[] array = raw.Split('|'); for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split(';'); if (array2.Length == 3 && float.TryParse(array2[0], NumberStyles.Float, invariantCulture, out var result) && float.TryParse(array2[1], NumberStyles.Float, invariantCulture, out var result2) && float.TryParse(array2[2], NumberStyles.Float, invariantCulture, out var result3)) { list.Add(new Vector3(result, result2, result3)); } } return list; } private void EnterSpectatorBox() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (!_spectatorBoxBuilt) { SpectatorBox.Build(Storm.Center); _spectatorBoxBuilt = true; } SpectatorBox.SendLocalPlayerIn(); } protected override void OnUpdate() { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) if (!((Gamemode)this).IsStarted) { return; } Storm.Update(); WristHealthDisplay.Update(); MapDisplay.Update(Storm); if (!_localReportedDead && RigData.HasPlayer) { Health health = RigData.Refs.RigManager.health; if ((Object)(object)health != (Object)null && health.max_Health > 0f) { if (health.curr_Health > 0.5f) { _localConfirmedAlive = true; } else if (_localConfirmedAlive) { _localReportedDead = true; StormAudio.PlayDeathSound(); EnterSpectatorBox(); if (NetworkInfo.IsHost) { ReportPlayerDead(PlayerIDManager.LocalSmallID); } else { MessageRelay.RelayModule(FordRoyaleDeathData.Create(PlayerIDManager.LocalSmallID), CommonMessageRoutes.ReliableToServer); } } } } if (NetworkInfo.IsHost) { PollPlayerDeaths(); } if (SpectatorBox.IsLocalInside) { SpectatorBox.Update(AliveTeam.Players); SpectatorBox.KeepLocalInside(); } if (NetworkInfo.IsHost) { _victoryCheckTimer += TimeReferences.DeltaTime; if (_victoryCheckTimer >= 1f) { _victoryCheckTimer = 0f; CheckForVictory(); } } } protected override void OnPlayerJoined(PlayerID playerId) { if (NetworkInfo.IsHost) { TeamManager.TryAssignTeam(playerId, EliminatedTeam); } } protected override void OnPlayerLeft(PlayerID playerId) { if (NetworkInfo.IsHost) { _hostEliminated.Add(playerId.SmallID); CheckForVictory(); } } protected bool OnValidateNametag(PlayerID id) { if (!((Gamemode)this).IsStarted) { return true; } if (IsDuos && SameDuo(id, PlayerIDManager.LocalID)) { return true; } return false; } private void OnPlayerAction(PlayerID player, PlayerActionType type, PlayerID otherPlayer = null) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 if (!((Gamemode)this).IsStarted) { return; } if ((int)type == 5 && otherPlayer != null && otherPlayer != player) { HostAddKill(otherPlayer); if (otherPlayer.IsMe) { FordRoyaleStats.RecordPersonalKill(); } } if ((int)type != 2 && (int)type != 7) { return; } if (player.IsMe) { EnterSpectatorBox(); TriggerEvent deathTrigger = DeathTrigger; if (deathTrigger != null) { deathTrigger.TryInvoke(PlayerIDManager.LocalSmallID.ToString()); } } if (NetworkInfo.IsHost) { EliminateOnHost(player); } } private void PollPlayerDeaths() { _roundTime += TimeReferences.DeltaTime; if (_roundTime < 3f) { return; } NetworkPlayer val2 = default(NetworkPlayer); foreach (PlayerID playerID in PlayerIDManager.PlayerIDs) { if (_hostEliminated.Contains(playerID.SmallID)) { continue; } Health val = null; if (playerID.IsMe) { if (RigData.HasPlayer) { val = RigData.Refs.RigManager.health; } } else if (NetworkPlayerManager.TryGetPlayer(playerID.SmallID, ref val2) && val2.HasRig) { val = val2.RigRefs.RigManager.health; } if (!((Object)(object)val == (Object)null) && !(val.max_Health <= 0f)) { if (val.curr_Health > 0.5f) { _confirmedAlive.Add(playerID.SmallID); } else if (_confirmedAlive.Contains(playerID.SmallID)) { EliminateOnHost(playerID); } } } } public void ReportPlayerDead(byte smallId) { if (NetworkInfo.IsHost && ((Gamemode)this).IsStarted) { PlayerID playerID = PlayerIDManager.GetPlayerID(smallId); if (playerID != null) { EliminateOnHost(playerID); } } } private void EliminateOnHost(PlayerID player) { if (player != null && !_hostEliminated.Contains(player.SmallID)) { _hostEliminated.Add(player.SmallID); TeamManager.TryAssignTeam(player, EliminatedTeam); string text = default(string); MetadataHelper.TryGetDisplayName(player, ref text); EliminationEvent.TryInvoke(player.SmallID.ToString()); HandleElimination(player.SmallID); int value = CountAlive(); MelonLogger.Msg($"FordRoyale: {text ?? "A player"} eliminated - {value} player(s) / side(s) remain"); CheckForVictory(); } } private void HandleElimination(byte smallId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown if (_eliminationHandled.Add(smallId)) { PlayerID playerID = PlayerIDManager.GetPlayerID(smallId); string text = null; if (playerID != null) { MetadataHelper.TryGetDisplayName(playerID, ref text); } Notifier.Send(new Notification { ShowPopup = true, Title = NotificationText.op_Implicit("Elimination"), Message = NotificationText.op_Implicit((string.IsNullOrWhiteSpace(text) ? "A player" : text) + " has been eliminated!"), PopupLength = 3f, Type = (NotificationType)0 }); if (IsDuos && playerID != null && !playerID.IsMe && SameDuo(playerID, PlayerIDManager.LocalID)) { StormAudio.PlayDeathSound(); } } } private int CountAlive() { return (from p in PlayerIDManager.PlayerIDs select p.SmallID into s where !_hostEliminated.Contains(s) select s).Select(GroupKey).Distinct().Count(); } protected override void OnMetadataChanged(string key, string value) { if (key == "FordRoyale.StormPhases" && !NetworkInfo.IsHost) { List list = Storm.ParsePhases(value); if (list.Count >= 2) { Storm.ApplyPhases(list); } return; } switch (key) { case "FordRoyale.Mode": Enum.TryParse(value, out _mode); return; case "FordRoyale.Regen": _regenEnabled = value == bool.TrueString; ApplyRegen(); return; case "FordRoyale.MapSpawns": _useMapSpawnPoints = value == bool.TrueString; return; } if (key.StartsWith("FordRoyale.Duo.") && byte.TryParse(key.Substring("FordRoyale.Duo.".Length), out var result) && int.TryParse(value, out var result2)) { _duos[result] = result2; FusionOverrides.ForceUpdateOverrides(); } } private static Vector3? GetLocalPlayerPosition() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (!RigData.HasPlayer) { return null; } return RigData.Refs.RigManager.physicsRig.feet.transform.position; } private static string FormatVector(Vector3 v) { CultureInfo invariantCulture = CultureInfo.InvariantCulture; return $"{v.x.ToString(invariantCulture)};{v.y.ToString(invariantCulture)};{v.z.ToString(invariantCulture)}"; } private static bool TryParseVector(string value, out Vector3 result) { //IL_0001: 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_0061: Unknown result type (might be due to invalid IL or missing references) result = default(Vector3); string[] array = value.Split(';'); if (array.Length != 3) { return false; } CultureInfo invariantCulture = CultureInfo.InvariantCulture; if (!float.TryParse(array[0], NumberStyles.Float, invariantCulture, out var result2) || !float.TryParse(array[1], NumberStyles.Float, invariantCulture, out var result3) || !float.TryParse(array[2], NumberStyles.Float, invariantCulture, out var result4)) { return false; } result = new Vector3(result2, result3, result4); return true; } private void CheckForVictory() { if (!((Gamemode)this).IsStarted || _victoryDeclared || !NetworkInfo.IsHost || _hostEliminated.Count == 0) { return; } List source = (from p in PlayerIDManager.PlayerIDs select p.SmallID into smallId where !_hostEliminated.Contains(smallId) select smallId).ToList(); if (source.Select(GroupKey).Distinct().Count() > 1) { return; } List list = (from p in ((IEnumerable)source).Select((Func)PlayerIDManager.GetPlayerID) where p != null select p).ToList(); _victoryDeclared = true; foreach (PlayerID item in list) { HostAddWin(item); } string text = string.Join(",", list.Select((PlayerID w) => w.SmallID)); MelonLogger.Msg($"FordRoyale: round over - {list.Count} winner(s)"); VictoryEvent.TryInvoke(text); ShowVictory(text); GamemodeManager.StopGamemode(); } private string GroupKey(byte smallId) { if (IsDuos) { int duo = GetDuo(smallId); if (duo != -1) { return "duo" + duo; } } return "solo" + smallId; } private void OnElimination(string value) { if (byte.TryParse(value, out var result)) { HandleElimination(result); } } private void OnVictory(string winnerPlatformIds) { ShowVictory(winnerPlatformIds); } private void ShowVictory(string winnerPlatformIds) { //IL_00dc: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0104: 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_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown if (_victoryShown) { return; } _victoryShown = true; List list = (from s in winnerPlatformIds.Split(',') where !string.IsNullOrWhiteSpace(s) select s).ToList(); List list2 = new List(); bool flag = false; string text = default(string); foreach (PlayerID playerID in PlayerIDManager.PlayerIDs) { if (list.Contains(playerID.SmallID.ToString())) { MetadataHelper.TryGetDisplayName(playerID, ref text); list2.Add(string.IsNullOrWhiteSpace(text) ? "Player" : text); if (playerID.IsMe) { flag = true; } } } string text2 = ((list2.Count > 0) ? string.Join(" & ", list2) : "Nobody"); Notifier.Send(new Notification { ShowPopup = true, Title = NotificationText.op_Implicit("VICTORY ROYALE"), Message = NotificationText.op_Implicit(text2 + " wins the Ford Royale!"), PopupLength = 6f, Type = (NotificationType)3 }); MelonLogger.Msg("FordRoyale: VICTORY ROYALE shown - winner(s): " + text2); if (flag) { StormAudio.PlayVictorySound(); FordRoyaleStats.RecordPersonalWin(); } } } public static class FordRoyaleMenu { private static Page _lobbyPage; private static Page _globalPage; public static void Setup() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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) try { Page obj = Page.Root.CreatePage("Ford Royale", Color.cyan, 0, true).CreatePage("Leaderboard", Color.yellow, 0, true); _lobbyPage = obj.CreatePage("In Lobby", Color.white, 0, true); _globalPage = obj.CreatePage("Global", Color.green, 0, true); Menu.OnPageOpened += OnPageOpened; BuildLobby(); BuildGlobal(); MelonLogger.Msg("FordRoyale: leaderboard menu created in BoneMenu (Ford Royale > Leaderboard)"); } catch (Exception ex) { MelonLogger.Warning("FordRoyale: failed to build leaderboard menu (is BoneLib installed?): " + ex.Message); } } private static void OnPageOpened(Page page) { try { if (page == _lobbyPage) { BuildLobby(); } else if (page == _globalPage) { BuildGlobal(); } } catch (Exception ex) { MelonLogger.Warning("FordRoyale: leaderboard refresh failed: " + ex.Message); } } private static void BuildLobby() { //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) if (_lobbyPage == null) { return; } _lobbyPage.RemoveAll(); int num = 0; try { List list = new List(); foreach (PlayerID playerID in PlayerIDManager.PlayerIDs) { list.Add(playerID); } if (PlayerIDManager.LocalID != null && !list.Contains(PlayerIDManager.LocalID)) { list.Add(PlayerIDManager.LocalID); } MelonLogger.Msg($"FordRoyale: building lobby leaderboard for {list.Count} player(s)"); FordRoyaleGamemode instance = FordRoyaleGamemode.Instance; foreach (PlayerID item in list) { string value = null; try { MetadataHelper.TryGetDisplayName(item, ref value); } catch { } if (string.IsNullOrWhiteSpace(value)) { value = "Player"; } int value2 = 0; int value3 = 0; if (instance != null) { try { value2 = instance.GetLobbyKills(item.SmallID); } catch { } try { value3 = instance.GetLobbyWins(item.SmallID); } catch { } } _lobbyPage.CreateFunction($"{value}: {value2} kills, {value3} wins", Color.white, (Action)delegate { }); num++; } } catch (Exception ex) { MelonLogger.Warning("FordRoyale: lobby leaderboard build error: " + ex.Message); } if (num == 0) { _lobbyPage.CreateFunction("Not connected to a lobby", Color.gray, (Action)delegate { }); } } private static void BuildGlobal() { //IL_003f: 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_00cb: Unknown result type (might be due to invalid IL or missing references) if (_globalPage != null) { _globalPage.RemoveAll(); _globalPage.CreateFunction($"Kills: {FordRoyaleStats.PersonalKills}", Color.white, (Action)delegate { }); _globalPage.CreateFunction($"Victory Royales: {FordRoyaleStats.PersonalWins}", Color.green, (Action)delegate { }); _globalPage.CreateFunction("(saved on your device)", Color.gray, (Action)delegate { }); } } } public class FordRoyaleModule : Module { public override string Name => "FordRoyale"; public override string Author => "JonLandonMods"; public override Version Version => new Version(0, 1, 0); public override ConsoleColor Color => ConsoleColor.Cyan; protected override void OnModuleRegistered() { GamemodeRegistration.LoadGamemodes(Assembly.GetExecutingAssembly()); ModuleMessageManager.LoadHandlers(Assembly.GetExecutingAssembly()); ((Module)this).LoggerInstance.Log("FordRoyale gamemode registered with Fusion!", ConsoleColor.White); } } public static class FordRoyaleStats { private static string SavePath => Path.Combine(MelonEnvironment.UserDataDirectory, "FordRoyale", "stats.cfg"); public static int PersonalKills { get; private set; } public static int PersonalWins { get; private set; } public static void Load() { try { if (!File.Exists(SavePath)) { return; } string[] array = File.ReadAllLines(SavePath); for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split('='); if (array2.Length == 2) { int result2; if (array2[0] == "kills" && int.TryParse(array2[1], out var result)) { PersonalKills = result; } else if (array2[0] == "wins" && int.TryParse(array2[1], out result2)) { PersonalWins = result2; } } } } catch (Exception ex) { MelonLogger.Warning("FordRoyale: failed to load stats: " + ex.Message); } } private static void Save() { try { Directory.CreateDirectory(Path.GetDirectoryName(SavePath)); File.WriteAllLines(SavePath, new string[2] { "kills=" + PersonalKills.ToString(CultureInfo.InvariantCulture), "wins=" + PersonalWins.ToString(CultureInfo.InvariantCulture) }); } catch (Exception ex) { MelonLogger.Warning("FordRoyale: failed to save stats: " + ex.Message); } } public static void RecordPersonalKill() { PersonalKills++; Save(); } public static void RecordPersonalWin() { PersonalWins++; Save(); } } public static class LootSpawner { private static readonly Random _random = new Random(); private static readonly List _spawnedEntities = new List(); private static Vector3 _center = FordRoyaleConfig.MapCenter; private static Bounds _bounds = new Bounds(FordRoyaleConfig.MapCenter, Vector3.one * 100f); private static float _scatterRadius = 80f; private static float _ceilingY = 200f; private static readonly List _lootPoints = new List(); public static IReadOnlyList LootPoints => _lootPoints; public static bool MapHasPlacedSpawners() { try { Il2CppArrayBase val = Object.FindObjectsOfType(); return val != null && val.Length > 0; } catch { return false; } } public static void SpawnAllLoot(Vector3 center, Bounds bounds, float scatterRadius) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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_0012: 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) _center = center; _bounds = bounds; _scatterRadius = scatterRadius; _ceilingY = MapBounds.GetCeilingHeight(center, bounds); _lootPoints.Clear(); if (FordRoyaleConfig.UseMapSpawnPoints || MapHasPlacedSpawners()) { MelonLogger.Msg("FordRoyale: using the map's crate spawners - skipping random loot"); for (int i = 0; i < 12; i++) { TryGetGroundPoint(out var _); } return; } MelonLogger.Msg("FordRoyale: no gamemode crate spawners - scattering random loot"); int num = (FordRoyaleConfig.FortniteGunsRequired ? FordRoyaleConfig.WeaponSpawnCount : Mathf.RoundToInt((float)FordRoyaleConfig.WeaponSpawnCount * 1.8f)); for (int j = 0; j < num; j++) { SpawnOne(RollWeaponBarcode()); } if (FordRoyaleConfig.FortnitePropsRequired) { for (int k = 0; k < FordRoyaleConfig.PropSpawnCount; k++) { string[] propBarcodes = FordRoyaleConfig.PropBarcodes; SpawnOne(propBarcodes[_random.Next(propBarcodes.Length)]); } } if (!FordRoyaleConfig.FortniteGunsRequired) { string[] vanillaMeleeWeapons = FordRoyaleConfig.VanillaMeleeWeapons; for (int l = 0; l < FordRoyaleConfig.MeleeSpawnCount; l++) { SpawnOne(vanillaMeleeWeapons[_random.Next(vanillaMeleeWeapons.Length)]); } } } private static string RollWeaponBarcode() { double num = _random.NextDouble(); bool fortniteGunsRequired = FordRoyaleConfig.FortniteGunsRequired; string[] array = ((num < 0.10000000149011612) ? (fortniteGunsRequired ? FordRoyaleConfig.EpicWeapons : FordRoyaleConfig.VanillaEpicWeapons) : ((!(num < 0.4000000059604645)) ? (fortniteGunsRequired ? FordRoyaleConfig.CommonWeapons : FordRoyaleConfig.VanillaCommonWeapons) : (fortniteGunsRequired ? FordRoyaleConfig.RareWeapons : FordRoyaleConfig.VanillaRareWeapons))); return array[_random.Next(array.Length)]; } private static void SpawnOne(string barcode) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_004a: 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) if (!TryGetGroundPoint(out var position)) { return; } Spawnable spawnable = LocalAssetSpawner.CreateSpawnable(barcode); NetworkAssetSpawner.Spawn(new SpawnRequestInfo { Spawnable = spawnable, Position = position, Rotation = Quaternion.Euler(0f, (float)_random.Next(360), 0f), SpawnEffect = false, SpawnCallback = delegate(SpawnCallbackInfo info) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) if (info.Entity != null) { _spawnedEntities.Add(info.Entity.ID); } } }); } public static void CleanupLoot() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) foreach (ushort spawnedEntity in _spawnedEntities) { NetworkAssetSpawner.Despawn(new DespawnRequestInfo { EntityID = spawnedEntity, DespawnEffect = false }); } _spawnedEntities.Clear(); } private static bool TryGetGroundPoint(out Vector3 position) { //IL_000c: 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_0093: 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_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0237: 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) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: 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_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: 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_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: 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_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) float ceilingY = _ceilingY; float num = ceilingY - ((Bounds)(ref _bounds)).min.y + 80f; for (int i = 0; i < 24; i++) { float num2 = (float)(_random.NextDouble() * 3.1415927410125732 * 2.0); float num3 = (float)Math.Sqrt(_random.NextDouble()) * _scatterRadius; float num4 = _center.x + Mathf.Cos(num2) * num3; float num5 = _center.z + Mathf.Sin(num2) * num3; Il2CppStructArray val = Physics.RaycastAll(new Vector3(num4, ceilingY, num5), Vector3.down, num, -1, (QueryTriggerInteraction)1); if (val == null || ((Il2CppArrayBase)(object)val).Length == 0) { continue; } List list = new List(); foreach (RaycastHit item in (Il2CppArrayBase)(object)val) { RaycastHit current = item; if (((RaycastHit)(ref current)).normal.y > 0.3f) { list.Add(current); } } if (list.Count > 0) { RaycastHit val2 = list[_random.Next(list.Count)]; position = ((RaycastHit)(ref val2)).point + Vector3.up * 0.3f; _lootPoints.Add(position); return true; } RaycastHit val3 = ((Il2CppArrayBase)(object)val)[0]; for (int j = 1; j < ((Il2CppArrayBase)(object)val).Length; j++) { RaycastHit val4 = ((Il2CppArrayBase)(object)val)[j]; if (((RaycastHit)(ref val4)).point.y > ((RaycastHit)(ref val3)).point.y) { val3 = ((Il2CppArrayBase)(object)val)[j]; } } position = ((RaycastHit)(ref val3)).point + Vector3.up * 0.3f; _lootPoints.Add(position); return true; } position = _center + new Vector3(((float)_random.NextDouble() - 0.5f) * 6f, 0.5f, ((float)_random.NextDouble() - 0.5f) * 6f); _lootPoints.Add(position); return true; } private static float RandomRange(float min, float max) { return min + (float)_random.NextDouble() * (max - min); } } public class FordRoyaleMod : MelonMod { public override void OnInitializeMelon() { ModuleManager.LoadModules(Assembly.GetExecutingAssembly()); StormAudio.OnInitializeMelon(); FordRoyaleStats.Load(); try { FordRoyaleMenu.Setup(); } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Warning("FordRoyale: leaderboard menu disabled (BoneLib missing?): " + ex.Message); } ((MelonBase)this).LoggerInstance.Msg("FordRoyale loaded! Drop in and win that Victory Royale."); } } public static class MapBounds { public static Bounds Compute(Vector3 focus) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0095: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) Bounds bounds = default(Bounds); ((Bounds)(ref bounds))..ctor(focus, Vector3.zero); bool flag = false; foreach (Renderer item in Object.FindObjectsOfType()) { if ((Object)(object)item == (Object)null || !item.enabled) { continue; } Bounds bounds2 = item.bounds; Vector3 size = ((Bounds)(ref bounds2)).size; float num = Mathf.Max(new float[3] { size.x, size.y, size.z }); if (num < 0.1f || num > 600f) { continue; } bounds2 = item.bounds; if (!(Vector3.Distance(((Bounds)(ref bounds2)).center, focus) > 500f)) { if (!flag) { bounds = item.bounds; flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(item.bounds); } } } return bounds; } public static float GetStartRadius(Bounds bounds) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) return Mathf.Clamp(Mathf.Max(((Bounds)(ref bounds)).extents.x, ((Bounds)(ref bounds)).extents.z) * 0.9f, 40f, 250f); } public static float GetWallHeight(Bounds bounds) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return Mathf.Clamp(((Bounds)(ref bounds)).size.y + 100f, 100f, 500f); } public static float GetCeilingHeight(Vector3 center, Bounds bounds) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: 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_0010: 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_0021: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = center + Vector3.up * 2f; float num = Mathf.Max(((Bounds)(ref bounds)).max.y - center.y, 0f) + 100f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Vector3.up, ref val2, num, -1, (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref val2)).point.y - 1f; } return ((Bounds)(ref bounds)).max.y + 20f; } } public static class MapDisplay { private const string PageName = "Ford Royale Map"; private static PageItem _mapPage; private static bool _visible; private static RenderTexture _renderTexture; private static GameObject _cameraObject; private static Camera _camera; private static GameObject _panel; private static GameObject _playerMarker; private static GameObject _nextCircleRing; private static GameObject _currentCircleRing; private static Material _ringMaterial; private static Material _currentRingMaterial; public static void AddMenuItem() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown RemoveMenuItem(); PopUpMenuView popUpMenu = UIRig.Instance.popUpMenu; Page homePage = popUpMenu.radialPageView.m_HomePage; _mapPage = new PageItem("Ford Royale Map", (Directions)5, Action.op_Implicit((Action)delegate { //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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_0051: Expected O, but got Unknown popUpMenu.Deactivate(); Toggle(); Notifier.Send(new Notification { ShowPopup = true, SaveToMenu = false, Message = NotificationText.op_Implicit(_visible ? "Map Shown" : "Map Hidden"), PopupLength = 1f }); })); homePage.items.Add(_mapPage); } public static void RemoveMenuItem() { if (_mapPage != null) { PopUpMenuView popUpMenu = UIRig.Instance.popUpMenu; Page homePage = popUpMenu.radialPageView.m_HomePage; homePage.items.RemoveAll(Predicate.op_Implicit((Func)((PageItem i) => i.name == "Ford Royale Map"))); popUpMenu.radialPageView.Render(homePage); _mapPage = null; } } public static void Toggle() { if (_visible) { HideMap(); } else { ShowMap(); } } public static void ShowMap() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Expected O, but got Unknown //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Expected O, but got Unknown //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Expected O, but got Unknown HideMap(); _renderTexture = new RenderTexture(512, 512, 16) { antiAliasing = 2, filterMode = (FilterMode)1 }; _cameraObject = new GameObject("FordRoyale Map Camera"); _camera = _cameraObject.AddComponent(); _camera.orthographic = true; _camera.farClipPlane = 500f; _camera.targetTexture = _renderTexture; _cameraObject.transform.rotation = Quaternion.Euler(90f, 0f, 0f); _panel = GameObject.CreatePrimitive((PrimitiveType)5); ((Object)_panel).name = "FordRoyale Map Panel"; Collider component = _panel.GetComponent(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } Material material = new Material(Shader.Find("Sprites/Default")) { mainTexture = (Texture)(object)_renderTexture, color = Color.white }; ((Renderer)_panel.GetComponent()).material = material; _panel.transform.localScale = new Vector3(0.4f, 0.4f, 0.4f); _playerMarker = GameObject.CreatePrimitive((PrimitiveType)0); ((Object)_playerMarker).name = "FordRoyale Map Player Marker"; Collider component2 = _playerMarker.GetComponent(); if ((Object)(object)component2 != (Object)null) { Object.Destroy((Object)(object)component2); } ((Renderer)_playerMarker.GetComponent()).material = new Material(Shader.Find("Sprites/Default")) { color = Color.red }; _nextCircleRing = GameObject.CreatePrimitive((PrimitiveType)2); ((Object)_nextCircleRing).name = "FordRoyale Map Next Circle"; Collider component3 = _nextCircleRing.GetComponent(); if ((Object)(object)component3 != (Object)null) { Object.Destroy((Object)(object)component3); } _ringMaterial = new Material(Shader.Find("Sprites/Default")) { color = new Color(1f, 1f, 1f, 0.35f) }; ((Renderer)_nextCircleRing.GetComponent()).material = _ringMaterial; _currentCircleRing = GameObject.CreatePrimitive((PrimitiveType)2); ((Object)_currentCircleRing).name = "FordRoyale Map Current Circle"; Collider component4 = _currentCircleRing.GetComponent(); if ((Object)(object)component4 != (Object)null) { Object.Destroy((Object)(object)component4); } _currentRingMaterial = new Material(Shader.Find("Sprites/Default")) { color = new Color(0.55f, 0.2f, 0.85f, 0.4f) }; ((Renderer)_currentCircleRing.GetComponent()).material = _currentRingMaterial; _visible = true; } public static void HideMap() { _visible = false; GameObject[] array = (GameObject[])(object)new GameObject[5] { _cameraObject, _panel, _playerMarker, _nextCircleRing, _currentCircleRing }; foreach (GameObject val in array) { if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } } _cameraObject = null; _camera = null; _panel = null; _playerMarker = null; _nextCircleRing = null; _currentCircleRing = null; _ringMaterial = null; _currentRingMaterial = null; if ((Object)(object)_renderTexture != (Object)null) { _renderTexture.Release(); Object.Destroy((Object)(object)_renderTexture); _renderTexture = null; } } public static void Update(Storm storm) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_0059: 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_0094: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: 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_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) if (_visible && storm != null && RigData.HasPlayer) { RigManager rigManager = RigData.Refs.RigManager; Vector3 position = rigManager.physicsRig.feet.transform.position; Transform head = ((Rig)rigManager.physicsRig).m_head; float num = 150f; Vector3 val = storm.Center + Vector3.up * num; _cameraObject.transform.position = val; _camera.orthographicSize = Mathf.Max(storm.CurrentRadius * 1.5f, 40f); _playerMarker.transform.position = new Vector3(position.x, val.y - 30f, position.z); float num2 = _camera.orthographicSize * 0.05f; _playerMarker.transform.localScale = Vector3.one * num2; _currentCircleRing.transform.position = new Vector3(storm.Center.x, val.y - 45f, storm.Center.z); _currentCircleRing.transform.localScale = new Vector3(storm.CurrentRadius * 2f, 0.25f, storm.CurrentRadius * 2f); if (storm.NextPhase.HasValue) { StormPhase value = storm.NextPhase.Value; _nextCircleRing.SetActive(true); _nextCircleRing.transform.position = new Vector3(value.Center.x, val.y - 40f, value.Center.z); _nextCircleRing.transform.localScale = new Vector3(value.Radius * 2f, 0.25f, value.Radius * 2f); } else { _nextCircleRing.SetActive(false); } if ((Object)(object)head != (Object)null) { Vector3 forward = head.forward; forward.y = 0f; ((Vector3)(ref forward)).Normalize(); Vector3 val2 = head.position + forward * 0.6f; _panel.transform.position = val2; _panel.transform.rotation = Quaternion.LookRotation(val2 - head.position, Vector3.up); } } } } public static class RoundReset { public static void Run() { MelonCoroutines.Start(ResetRoutine()); } private static IEnumerator ResetRoutine() { float timeout = 0f; while (!RigData.HasPlayer && timeout < 5f) { timeout += Time.deltaTime; yield return null; } if (RigData.HasPlayer) { ClearInventory(); } float ammoTimeout = 0f; while (ammoTimeout < 5f) { if ((Object)(object)AmmoInventory.Instance != (Object)null) { LocalInventory.SetAmmo(150); break; } ammoTimeout += Time.deltaTime; yield return null; } } public static void ClearInventory() { try { LocalPlayer.ReleaseGrips(); } catch { } InventorySlotReceiver[] rigSlots = RigData.Refs.RigSlots; if (rigSlots == null) { return; } InventorySlotReceiver[] array = rigSlots; foreach (InventorySlotReceiver val in array) { if ((Object)(object)val == (Object)null || (Object)(object)val._slottedWeapon == (Object)null) { continue; } try { GameObject gameObject = ((Component)val._slottedWeapon).gameObject; val.DropWeapon(); Poolee componentInParent = gameObject.GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { componentInParent.Despawn(); } else { Object.Destroy((Object)(object)gameObject); } } catch { } } } } public static class SpectatorBox { private static GameObject _box; private static bool _localInside; private static readonly List _cameras = new List(); private static readonly List _screens = new List(); private static readonly List _textures = new List(); private static readonly List _labels = new List(); private static float _cycleTimer; private static int _cycleOffset; private static float _enterTime; public static Vector3 Center { get; private set; } public static bool IsLocalInside => _localInside; public static void Build(Vector3 mapCenter) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_000d: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) Cleanup(); Bounds bounds = MapBounds.Compute(mapCenter); float ceilingHeight = MapBounds.GetCeilingHeight(mapCenter, bounds); float num = ((!(ceilingHeight < ((Bounds)(ref bounds)).max.y + 19f)) ? Mathf.Min(50f, ((Bounds)(ref bounds)).max.y - mapCenter.y + 12f) : (ceilingHeight - mapCenter.y - 4f - 2f)); num = Mathf.Max(num, 20f); Center = mapCenter + Vector3.up * num; _box = new GameObject("FordRoyale Spectator Box"); _box.transform.position = Center; float num2 = 4f; Color color = default(Color); ((Color)(ref color))..ctor(0.42f, 0.45f, 0.5f); Color color2 = default(Color); ((Color)(ref color2))..ctor(0.22f, 0.24f, 0.28f); CreateSurface("Floor", new Vector3(0f, 0f - num2, 0f), new Vector3(8f, 0.5f, 8f), color2); CreateSurface("Ceiling", new Vector3(0f, num2, 0f), new Vector3(8f, 0.5f, 8f), color); CreateSurface("Wall+X", new Vector3(num2, 0f, 0f), new Vector3(0.5f, 8f, 8f), color); CreateSurface("Wall-X", new Vector3(0f - num2, 0f, 0f), new Vector3(0.5f, 8f, 8f), color); CreateSurface("Wall+Z", new Vector3(0f, 0f, num2), new Vector3(8f, 8f, 0.5f), color); CreateSurface("Wall-Z", new Vector3(0f, 0f, 0f - num2), new Vector3(8f, 8f, 0.5f), color); GameObject val = new GameObject("Spectator Light"); val.transform.parent = _box.transform; val.transform.localPosition = new Vector3(0f, num2 - 1f, 0f); Light obj = val.AddComponent(); obj.type = (LightType)2; obj.range = 16f; obj.intensity = 3f; obj.color = Color.white; for (int i = 0; i < 4; i++) { CreateScreen(i, num2); } } private static void CreateSurface(string name, Vector3 localPos, Vector3 size, Color color) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) GameObject obj = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)obj).name = name; obj.transform.parent = _box.transform; obj.transform.localPosition = localPos; obj.transform.localScale = size; Shader val = Shader.Find("Universal Render Pipeline/Lit"); Material val2; if ((Object)(object)val != (Object)null) { val2 = new Material(val); val2.SetColor("_BaseColor", color); val2.SetFloat("_Metallic", 0.85f); val2.SetFloat("_Smoothness", 0.45f); } else { val2 = new Material(Shader.Find("Sprites/Default")) { color = color }; } ((Renderer)obj.GetComponent()).material = val2; } private static void CreateScreen(int index, float half) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_013e: 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_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Expected O, but got Unknown //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_021a: 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_0239: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) RenderTexture val = new RenderTexture(256, 256, 16); _textures.Add(val); Camera val2 = new GameObject($"FordRoyale Spectator Camera {index}").AddComponent(); val2.targetTexture = val; val2.clearFlags = (CameraClearFlags)2; val2.backgroundColor = new Color(0.05f, 0.05f, 0.08f); ((Behaviour)val2).enabled = false; _cameras.Add(val2); GameObject val3 = GameObject.CreatePrimitive((PrimitiveType)5); ((Object)val3).name = $"FordRoyale Spectator Screen {index}"; val3.transform.parent = _box.transform; Collider component = val3.GetComponent(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } int num = 4; float num2 = 8f / (float)num; float num3 = 0f - half + 1f + 1.6f; val3.transform.localPosition = new Vector3(0f - half + num2 * ((float)index + 0.5f), num3, half - 0.4f); val3.transform.localRotation = Quaternion.Euler(0f, 180f, 0f); val3.transform.localScale = new Vector3(0f - num2 * 0.85f, num2 * 0.85f, num2 * 0.85f); ((Renderer)val3.GetComponent()).material = new Material(Shader.Find("Sprites/Default")) { mainTexture = (Texture)(object)val, color = Color.white }; _screens.Add(val3); GameObject val4 = new GameObject($"FordRoyale Spectator Label {index}"); val4.transform.parent = _box.transform; val4.transform.localPosition = val3.transform.localPosition + new Vector3(0f, 0f - num2 * 0.55f, -0.05f); val4.transform.localRotation = Quaternion.Euler(0f, 180f, 0f); val4.transform.localScale = new Vector3(-0.012f, 0.012f, 0.012f); TextMesh val5 = val4.AddComponent(); val5.text = ""; val5.fontSize = 48; val5.characterSize = 1f; val5.anchor = (TextAnchor)4; val5.alignment = (TextAlignment)1; val5.color = Color.white; _labels.Add(val5); } public static void SendLocalPlayerIn() { if (!((Object)(object)_box == (Object)null)) { LocalHealth.MortalityOverride = false; MelonCoroutines.Start(ReviveAndTeleport()); } } private static IEnumerator ReviveAndTeleport() { float wait = 0f; while (wait < 0.6f) { wait += Time.deltaTime; yield return null; } if (RigData.HasPlayer) { LocalHealth.SetFullHealth(); LocalRagdoll.ToggleRagdoll(false); TeleportToFloor(); _localInside = true; _enterTime = Time.time; Notifier.Send(new Notification { ShowPopup = true, Title = NotificationText.op_Implicit("Eliminated"), Message = NotificationText.op_Implicit("You're out! Watch the survivors from the spectator box until the round ends."), PopupLength = 4f, Type = (NotificationType)0 }); } } private static void TeleportToFloor() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_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_0027: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_box == (Object)null)) { LocalPlayer.TeleportToPosition(Center + Vector3.down * 2.5f, Vector3.forward); } } public static void KeepLocalInside() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) if (!_localInside || (Object)(object)_box == (Object)null || !RigData.HasPlayer) { return; } float num = 4f; if (Time.time - _enterTime < 2.5f) { TeleportToFloor(); return; } Vector3 position = RigData.Refs.RigManager.physicsRig.feet.transform.position; Vector3 val = _box.transform.InverseTransformPoint(position); if (Mathf.Abs(val.x) > num - 0.3f || Mathf.Abs(val.z) > num - 0.3f || val.y < 0f - num - 1f || val.y > num) { TeleportToFloor(); } } public static void Cleanup() { _localInside = false; foreach (Camera camera in _cameras) { if ((Object)(object)camera != (Object)null) { Object.Destroy((Object)(object)((Component)camera).gameObject); } } _cameras.Clear(); foreach (RenderTexture texture in _textures) { if ((Object)(object)texture != (Object)null) { texture.Release(); Object.Destroy((Object)(object)texture); } } _textures.Clear(); _screens.Clear(); _labels.Clear(); if ((Object)(object)_box != (Object)null) { Object.Destroy((Object)(object)_box); _box = null; } } public static void Update(IEnumerable aliveSmallIds) { //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: 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_01fd: Unknown result type (might be due to invalid IL or missing references) if (!_localInside || (Object)(object)_box == (Object)null) { return; } byte localSmallID = PlayerIDManager.LocalSmallID; List list = new List(); List list2 = new List(); NetworkPlayer val = default(NetworkPlayer); foreach (byte aliveSmallId in aliveSmallIds) { if (aliveSmallId == localSmallID || !NetworkPlayerManager.TryGetPlayer(aliveSmallId, ref val) || !val.HasRig) { continue; } Transform head = ((Rig)val.RigRefs.RigManager.physicsRig).m_head; if (!((Object)(object)head == (Object)null)) { list.Add(head); PlayerID playerID = PlayerIDManager.GetPlayerID(aliveSmallId); string text = null; if (playerID != null) { MetadataHelper.TryGetDisplayName(playerID, ref text); } list2.Add(string.IsNullOrWhiteSpace(text) ? "Player" : text); } } if (list.Count == 0) { foreach (Camera camera in _cameras) { ((Behaviour)camera).enabled = false; } { foreach (TextMesh label in _labels) { label.text = ""; } return; } } _cycleTimer += TimeReferences.DeltaTime; if (_cycleTimer >= 6f) { _cycleTimer = 0f; _cycleOffset += _cameras.Count; if (_cycleOffset >= list.Count) { _cycleOffset = 0; } } for (int i = 0; i < _cameras.Count; i++) { Camera val2 = _cameras[i]; if (i < list.Count) { int index = (_cycleOffset + i) % list.Count; Transform val3 = list[index]; ((Behaviour)val2).enabled = true; ((Component)val2).transform.position = val3.position + val3.forward * 0.1f; ((Component)val2).transform.rotation = val3.rotation; if (i < _labels.Count) { _labels[i].text = list2[index]; } } else { ((Behaviour)val2).enabled = false; if (i < _labels.Count) { _labels[i].text = ""; } } } } } public struct StormPhase { public Vector3 Center; public float Radius; } public class Storm { private readonly List _phases = new List(); private float _elapsed; private float _tickTimer; private bool _inStormLastTick; private bool _wasShrinking; private float _previousSecondsUntilShrink = float.MaxValue; private GameObject _wallVisual; private Material _wallMaterial; private float _wallHeight = 200f; public bool Active { get; private set; } public bool InGracePeriod => _elapsed < 90f; public Vector3 Center { get; private set; } = FordRoyaleConfig.MapCenter; public float CurrentRadius { get; private set; } = 120f; public StormPhase? NextPhase { get; private set; } public static List GeneratePhases(Vector3 start, float startRadius) { //IL_0010: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) List list = new List { new StormPhase { Center = start, Radius = startRadius } }; Random random = new Random(); float[] stormPhaseFractions = FordRoyaleConfig.StormPhaseFractions; foreach (float num in stormPhaseFractions) { StormPhase stormPhase = list[list.Count - 1]; float num2 = startRadius * num; float num3 = Mathf.Max(stormPhase.Radius - num2, 0f); float num4 = (float)random.NextDouble() * num3 * 0.85f; float num5 = (float)(random.NextDouble() * 3.1415927410125732 * 2.0); Vector3 center = stormPhase.Center + new Vector3(Mathf.Cos(num5) * num4, 0f, Mathf.Sin(num5) * num4); list.Add(new StormPhase { Center = center, Radius = num2 }); } return list; } public static string SerializePhases(List phases) { CultureInfo inv = CultureInfo.InvariantCulture; IEnumerable values = phases.Select((StormPhase p) => $"{p.Center.x.ToString(inv)};{p.Center.y.ToString(inv)};{p.Center.z.ToString(inv)};{p.Radius.ToString(inv)}"); return string.Join("|", values); } public static List ParsePhases(string value) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) CultureInfo invariantCulture = CultureInfo.InvariantCulture; List list = new List(); string[] array = value.Split('|'); for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split(';'); if (array2.Length == 4 && float.TryParse(array2[0], NumberStyles.Float, invariantCulture, out var result) && float.TryParse(array2[1], NumberStyles.Float, invariantCulture, out var result2) && float.TryParse(array2[2], NumberStyles.Float, invariantCulture, out var result3) && float.TryParse(array2[3], NumberStyles.Float, invariantCulture, out var result4)) { list.Add(new StormPhase { Center = new Vector3(result, result2, result3), Radius = result4 }); } } return list; } public void ApplyPhases(List phases) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) _phases.Clear(); _phases.AddRange(phases); if (_phases.Count > 0) { Center = _phases[0].Center; CurrentRadius = _phases[0].Radius; } } public void Start() { //IL_0037: 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_0043: Unknown result type (might be due to invalid IL or missing references) _elapsed = 0f; _tickTimer = 0f; _inStormLastTick = false; _wasShrinking = false; _previousSecondsUntilShrink = float.MaxValue; Active = true; Bounds bounds = MapBounds.Compute(Center); _wallHeight = MapBounds.GetWallHeight(bounds); CreateWallVisual(); } public void Stop() { Active = false; _phases.Clear(); NextPhase = null; DestroyWallVisual(); } public void Update() { if (!Active) { return; } _elapsed += TimeReferences.DeltaTime; UpdateTimeline(); UpdateWallVisual(); if (!InGracePeriod) { _tickTimer += TimeReferences.DeltaTime; if (_tickTimer >= 1f) { _tickTimer -= 1f; TickDamage(); } } } private void UpdateTimeline() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_008e: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown if (_phases.Count < 2) { return; } ComputeState(_elapsed, out var center, out var radius, out var next, out var secondsUntilShrink, out var shrinking); Center = center; CurrentRadius = radius; NextPhase = next; if (shrinking && !_wasShrinking) { StormAudio.PlayShrinkSound(); Notifier.Send(new Notification { ShowPopup = true, Title = NotificationText.op_Implicit("Storm"), Message = NotificationText.op_Implicit("The storm is shrinking! Get to the next circle!"), PopupLength = 3f, Type = (NotificationType)1 }); } _wasShrinking = shrinking; if (!shrinking && next.HasValue) { int[] stormCountdownWarnings = FordRoyaleConfig.StormCountdownWarnings; foreach (int num in stormCountdownWarnings) { if (_previousSecondsUntilShrink > (float)num && secondsUntilShrink <= (float)num) { Notifier.Send(new Notification { ShowPopup = true, Title = NotificationText.op_Implicit("Storm"), Message = NotificationText.op_Implicit($"Storm Shrinking in {num} Seconds"), PopupLength = 2.5f, Type = (NotificationType)1 }); } } _previousSecondsUntilShrink = secondsUntilShrink; } else { _previousSecondsUntilShrink = float.MaxValue; } } private void ComputeState(float elapsed, out Vector3 center, out float radius, out StormPhase? next, out float secondsUntilShrink, out bool shrinking) { //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_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_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_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) float num = elapsed - 90f; if (num < 0f) { center = _phases[0].Center; radius = _phases[0].Radius; next = _phases[1]; secondsUntilShrink = 0f - num; shrinking = false; return; } float num2 = 75f; int num3 = Mathf.FloorToInt(num / num2); float num4 = num - (float)num3 * num2; if (num3 >= _phases.Count - 1) { List phases = _phases; center = phases[phases.Count - 1].Center; List phases2 = _phases; radius = phases2[phases2.Count - 1].Radius; next = null; secondsUntilShrink = float.MaxValue; shrinking = false; return; } StormPhase stormPhase = _phases[num3]; StormPhase value = _phases[num3 + 1]; if (num4 < 30f) { float num5 = num4 / 30f; center = Vector3.Lerp(stormPhase.Center, value.Center, num5); radius = Mathf.Lerp(stormPhase.Radius, value.Radius, num5); next = value; secondsUntilShrink = float.MaxValue; shrinking = true; } else { bool flag = num3 + 2 <= _phases.Count - 1; center = value.Center; radius = value.Radius; next = (flag ? new StormPhase?(_phases[num3 + 2]) : ((StormPhase?)null)); secondsUntilShrink = num2 - num4; shrinking = false; } } private void TickDamage() { //IL_0021: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_009b: 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_00b2: Expected O, but got Unknown if (!RigData.HasPlayer) { return; } Vector3 val = RigData.Refs.RigManager.physicsRig.feet.transform.position - Center; val.y = 0f; bool flag = ((Vector3)(ref val)).magnitude > CurrentRadius; if (flag) { float num = 0.25f; ((Health)RigData.Refs.Health).TAKEDAMAGE(num); if (!_inStormLastTick) { Notifier.Send(new Notification { ShowPopup = true, Title = NotificationText.op_Implicit("Storm"), Message = NotificationText.op_Implicit("You're in the storm! Get back inside the circle!"), PopupLength = 2f, Type = (NotificationType)1 }); } } _inStormLastTick = flag; } private void CreateWallVisual() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown DestroyWallVisual(); _wallVisual = GameObject.CreatePrimitive((PrimitiveType)2); ((Object)_wallVisual).name = "FordRoyale Storm Wall"; Collider component = _wallVisual.GetComponent(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } Shader val = Shader.Find("Sprites/Default"); _wallMaterial = new Material(val) { color = new Color(0.55f, 0.2f, 0.85f, 0.3f) }; MeshRenderer component2 = _wallVisual.GetComponent(); ((Renderer)component2).material = _wallMaterial; ((Renderer)component2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)component2).receiveShadows = false; } private void UpdateWallVisual() { //IL_001b: 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) if (!((Object)(object)_wallVisual == (Object)null)) { _wallVisual.transform.position = Center; _wallVisual.transform.localScale = new Vector3(CurrentRadius * 2f, _wallHeight / 2f, CurrentRadius * 2f); } } private void DestroyWallVisual() { if ((Object)(object)_wallVisual != (Object)null) { Object.Destroy((Object)(object)_wallVisual); _wallVisual = null; } if ((Object)(object)_wallMaterial != (Object)null) { Object.Destroy((Object)(object)_wallMaterial); _wallMaterial = null; } } } public static class StormAudio { private static AudioClip _shrinkClip; private static AudioClip _victoryClip; private static AudioClip _deathClip; private static GameObject _audioObject; public static void OnInitializeMelon() { _shrinkClip = LoadEmbedded("stormshrinksound.wav"); _victoryClip = LoadEmbedded("victoryroyale.wav"); _deathClip = LoadEmbedded("fortnitedeathsound.wav"); } private static AudioClip LoadEmbedded(string fileName) { try { string name = "FordRoyale.Resources." + fileName; using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name); if (stream == null) { MelonLogger.Warning("FordRoyale: embedded sound " + fileName + " not found!"); return null; } using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); AudioClip val = WavLoader.Load(memoryStream.ToArray(), Path.GetFileNameWithoutExtension(fileName)); if ((Object)(object)val != (Object)null) { MelonLogger.Msg($"FordRoyale: loaded {fileName} ({val.length:0.0}s)"); } return val; } catch (Exception ex) { MelonLogger.Warning("FordRoyale: failed to load " + fileName + ": " + ex.Message); return null; } } private static void Play(AudioClip clip, float volume) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown if (!((Object)(object)clip == (Object)null)) { if ((Object)(object)_audioObject == (Object)null) { _audioObject = new GameObject("FordRoyale Audio"); Object.DontDestroyOnLoad((Object)(object)_audioObject); _audioObject.AddComponent(); } AudioSource component = _audioObject.GetComponent(); component.spatialBlend = 0f; component.volume = volume; component.PlayOneShot(clip); } } public static void PlayShrinkSound() { Play(_shrinkClip, 0.8f); } public static void PlayVictorySound() { Play(_victoryClip, 1f); } public static void PlayDeathSound() { Play(_deathClip, 1f); } } public static class WavLoader { public static AudioClip Load(byte[] data, string name) { try { return Parse(data, name); } catch (Exception ex) { MelonLogger.Warning("FordRoyale: failed to decode WAV " + name + ": " + ex.Message); return null; } } private static AudioClip Parse(byte[] data, string name) { if (data.Length < 12 || data[0] != 82 || data[1] != 73 || data[2] != 70 || data[3] != 70 || data[8] != 87 || data[9] != 65 || data[10] != 86 || data[11] != 69) { MelonLogger.Warning("FordRoyale: " + name + " is not a valid WAV file"); return null; } int num = 2; int num2 = 44100; int num3 = 16; int num4 = 1; int num5 = -1; int num6 = 0; int num7 = 12; while (num7 + 8 <= data.Length) { string text = $"{data[num7]}{data[num7 + 1]}{data[num7 + 2]}{data[num7 + 3]}"; int num8 = BitConverter.ToInt32(data, num7 + 4); int num9 = num7 + 8; if (text == "fmt ") { num4 = BitConverter.ToInt16(data, num9); num = BitConverter.ToInt16(data, num9 + 2); num2 = BitConverter.ToInt32(data, num9 + 4); num3 = BitConverter.ToInt16(data, num9 + 14); } else if (text == "data") { num5 = num9; num6 = num8; } num7 = num9 + num8 + (num8 & 1); } if (num5 < 0 || num <= 0) { MelonLogger.Warning("FordRoyale: " + name + " missing data/fmt chunk"); return null; } if (num5 + num6 > data.Length) { num6 = data.Length - num5; } int num10 = num3 / 8; int num11 = num6 / num10; float[] array = new float[num11]; for (int i = 0; i < num11; i++) { int num12 = num5 + i * num10; switch (num3) { case 8: array[i] = (float)(data[num12] - 128) / 128f; break; case 16: array[i] = (float)BitConverter.ToInt16(data, num12) / 32768f; break; case 24: { int num13 = data[num12] | (data[num12 + 1] << 8) | ((sbyte)data[num12 + 2] << 16); array[i] = (float)num13 / 8388608f; break; } case 32: array[i] = ((num4 == 3) ? BitConverter.ToSingle(data, num12) : ((float)BitConverter.ToInt32(data, num12) / 2.1474836E+09f)); break; default: return null; } } AudioClip val = AudioClip.Create(name, num11 / num, num, num2, false); Il2CppStructArray val2 = new Il2CppStructArray((long)num11); for (int j = 0; j < num11; j++) { ((Il2CppArrayBase)(object)val2)[j] = array[j]; } val.SetData(val2, 0); ((Object)val).hideFlags = (HideFlags)32; return val; } } public static class WristHealthDisplay { private static GameObject _root; private static TextMeshPro _text; private static TMP_FontAsset _fusionFont; private static TMP_FontAsset GetFusionFont() { if ((Object)(object)_fusionFont != (Object)null) { return _fusionFont; } Il2CppArrayBase val = Resources.FindObjectsOfTypeAll(); foreach (TMP_FontAsset item in val) { if ((Object)(object)item != (Object)null && ((Object)item).name != null && ((Object)item).name.ToLower().Contains("arlon")) { _fusionFont = item; break; } } if ((Object)(object)_fusionFont == (Object)null && val != null && val.Length > 0) { _fusionFont = val[0]; } return _fusionFont; } public static void Show() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) Hide(); if (!RigData.HasPlayer) { return; } Transform handLf = ((Rig)RigData.Refs.RigManager.physicsRig).m_handLf; if (!((Object)(object)handLf == (Object)null)) { _root = new GameObject("FordRoyale Wrist Health"); _root.transform.parent = handLf; _root.transform.localPosition = new Vector3(0f, 0.05f, -0.08f); _root.transform.localRotation = Quaternion.Euler(0f, 90f, 180f); _root.transform.localScale = Vector3.one * 0.02f; _text = _root.AddComponent(); TMP_FontAsset fusionFont = GetFusionFont(); if ((Object)(object)fusionFont != (Object)null) { ((TMP_Text)_text).font = fusionFont; } ((TMP_Text)_text).text = "HP"; ((TMP_Text)_text).fontSize = 4f; ((TMP_Text)_text).alignment = (TextAlignmentOptions)514; ((Graphic)_text).color = Color.green; ((TMP_Text)_text).enableWordWrapping = false; ((TMP_Text)_text).outlineWidth = 0.2f; ((TMP_Text)_text).outlineColor = new Color32((byte)0, (byte)0, (byte)0, byte.MaxValue); ((TMP_Text)_text).rectTransform.sizeDelta = new Vector2(20f, 6f); } } public static void Hide() { if ((Object)(object)_root != (Object)null) { Object.Destroy((Object)(object)_root); _root = null; _text = null; } } public static void Update() { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_text == (Object)null) && RigData.HasPlayer) { Player_Health health = RigData.Refs.Health; float num = Mathf.Max(((Health)health).curr_Health, 0f); float num2 = Mathf.Max(((Health)health).max_Health, 0.01f); float num3 = Mathf.Clamp01(num / num2); ((TMP_Text)_text).text = $"{Mathf.RoundToInt(num3 * 100f)} HP"; ((Graphic)_text).color = ((num3 > 0.5f) ? Color.Lerp(Color.yellow, Color.green, (num3 - 0.5f) * 2f) : Color.Lerp(Color.red, Color.yellow, num3 * 2f)); } } } }