Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of LethalLegends v1.0.0
BepInEx\plugins\LethalLegends\LethalLegends.dll
Decompiled 5 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyInputUtils.Api; using LethalLegends.Achievements; using LethalLegends.Achievements.Catalog; using LethalLegends.Input; using LethalLegends.Localization; using LethalLegends.Network; using LethalLegends.Patches; using LethalLegends.Persistence; using LethalLegends.Titles; using LethalLegends.Tracking; using LethalLegends.UI; using Microsoft.CodeAnalysis; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LethalLegends")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+4968cbab8245c25da4cd86dbb6c7a14c44d23f9e")] [assembly: AssemblyProduct("LethalLegends")] [assembly: AssemblyTitle("LethalLegends")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LethalLegends { [BepInPlugin("com.lethallegends.mod", "Lethal Legends", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class LethalLegendsPlugin : BaseUnityPlugin { internal static ManualLogSource Log = null; private LethalLegendsKeybinds? keybinds; private const float TitleScanInterval = 1f; private float nextTitleScanTime; private const float SaveInterval = 10f; private float nextSaveTime; private bool achievementsMenuOpen; private readonly List<InputAction> disabledGameplayActions = new List<InputAction>(); private PlayerControllerB? menuPlayer; private bool previousDisableLookInput; private static readonly string[] GameplayActions = new string[15] { "Move", "Sprint", "Jump", "Crouch", "Interact", "ActivateItem", "ItemSecondaryUse", "ItemTertiaryUse", "Discard", "SwitchItem", "InspectItem", "Emote1", "Emote2", "UseUtilitySlot", "OpenMenu" }; private readonly Dictionary<ulong, PlayerTitleDisplay> playerTitleDisplays = new Dictionary<ulong, PlayerTitleDisplay>(); private NetworkManager? activeNetworkManager; private void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; GameObject gameObject = ((Component)this).gameObject; ((Object)gameObject).hideFlags = (HideFlags)(((Object)gameObject).hideFlags | 0x3D); Log.LogInfo((object)"Lethal Legends v1.0.0 chargé !"); AchievementStorage.Initialize(((BaseUnityPlugin)this).Config); LocalizationManager.Initialize(((BaseUnityPlugin)this).Config); AchievementManager.Initialize(); TitleManager.Initialize(((BaseUnityPlugin)this).Config); string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); AchievementIcons.Initialize(directoryName); AchievementSounds.Initialize(((BaseUnityPlugin)this).Config, directoryName); SafePatchLoader.ApplyAll(new Harmony("com.lethallegends.mod")); keybinds = new LethalLegendsKeybinds(); keybinds.ToggleAchievementsMenu.performed += OnToggleAchievementsMenu; AchievementMenu.OnClose = CloseAchievementsMenu; Log.LogInfo((object)"InputUtils : raccourcis enregistrés !"); } private void Update() { if (Time.unscaledTime >= nextSaveTime) { nextSaveTime = Time.unscaledTime + 10f; AchievementStorage.Flush(); } NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null || !singleton.IsListening) { if (achievementsMenuOpen) { CloseAchievementsMenu(); } if ((Object)(object)activeNetworkManager != (Object)null) { TitleNetworkSync.Shutdown(); activeNetworkManager = null; playerTitleDisplays.Clear(); nextTitleScanTime = 0f; AchievementStorage.Flush(); } return; } if ((Object)(object)activeNetworkManager != (Object)(object)singleton) { TitleNetworkSync.Initialize(singleton); activeNetworkManager = singleton; Log.LogInfo((object)"Réseau Lethal Legends initialisé !"); if (singleton.IsConnectedClient) { TitleNetworkSync.SendLocalTitle(); } } if (Time.unscaledTime < nextTitleScanTime) { return; } nextTitleScanTime = Time.unscaledTime + 1f; if ((Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.allPlayerScripts == null) { return; } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)val == (Object)null) { continue; } ulong actualClientId = val.actualClientId; if (!val.isPlayerControlled) { continue; } if (playerTitleDisplays.TryGetValue(actualClientId, out PlayerTitleDisplay value)) { if ((Object)(object)value != (Object)null && (Object)(object)((Component)value).gameObject == (Object)(object)((Component)val).gameObject) { continue; } playerTitleDisplays.Remove(actualClientId); } PlayerTitleDisplay playerTitleDisplay = ((Component)val).GetComponent<PlayerTitleDisplay>(); if ((Object)(object)playerTitleDisplay == (Object)null) { playerTitleDisplay = ((Component)val).gameObject.AddComponent<PlayerTitleDisplay>(); } playerTitleDisplay.Initialize(val); playerTitleDisplays[actualClientId] = playerTitleDisplay; Log.LogInfo((object)$"Affichage du titre initialisé pour le joueur {actualClientId}"); } } private void LockGameplayInput() { disabledGameplayActions.Clear(); menuPlayer = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)menuPlayer != (Object)null) { previousDisableLookInput = menuPlayer.disableLookInput; menuPlayer.disableLookInput = true; } string[] gameplayActions = GameplayActions; foreach (string text in gameplayActions) { InputActionAsset actions = InputSystem.actions; InputAction val = ((actions != null) ? actions.FindAction(text, false) : null); if (val != null && val.enabled) { val.Disable(); disabledGameplayActions.Add(val); } } } private void UnlockGameplayInput() { foreach (InputAction disabledGameplayAction in disabledGameplayActions) { disabledGameplayAction.Enable(); } disabledGameplayActions.Clear(); if ((Object)(object)menuPlayer != (Object)null) { menuPlayer.disableLookInput = previousDisableLookInput; } menuPlayer = null; } private bool CanOpenAchievementsMenu() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 if ((Object)(object)GameNetworkManager.Instance == (Object)null) { return false; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController == (Object)null) { return false; } if (localPlayerController.inTerminalMenu) { return false; } if (localPlayerController.isTypingChat) { return false; } if ((int)Cursor.lockState != 1) { return false; } if (Cursor.visible) { return false; } return true; } private void OnToggleAchievementsMenu(CallbackContext context) { if (achievementsMenuOpen) { CloseAchievementsMenu(); } else if (CanOpenAchievementsMenu()) { achievementsMenuOpen = true; LockGameplayInput(); Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } } private void LateUpdate() { DeathResolver.Tick(); if (achievementsMenuOpen) { if ((Object)(object)menuPlayer == (Object)null || (Object)(object)menuPlayer != (Object)(object)GameNetworkManager.Instance?.localPlayerController) { CloseAchievementsMenu(); return; } Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; menuPlayer.disableLookInput = true; } } private void CloseAchievementsMenu() { if (achievementsMenuOpen) { achievementsMenuOpen = false; UnlockGameplayInput(); Cursor.lockState = (CursorLockMode)1; Cursor.visible = false; } } private void OnGUI() { AchievementNotification.Draw(); if (achievementsMenuOpen) { AchievementMenu.Draw(); } } private void OnDestroy() { if (achievementsMenuOpen) { CloseAchievementsMenu(); } DeathResolver.ResolvePendingDeath(); AchievementStorage.Flush(); if (keybinds != null) { keybinds.ToggleAchievementsMenu.performed -= OnToggleAchievementsMenu; } AchievementMenu.OnClose = null; TitleNetworkSync.Shutdown(); activeNetworkManager = null; playerTitleDisplays.Clear(); nextTitleScanTime = 0f; } private void OnApplicationQuit() { AchievementStorage.Flush(); } } } namespace LethalLegends.UI { public static class AchievementIcons { private static readonly Dictionary<string, Texture2D> icons = new Dictionary<string, Texture2D>(); public static void Initialize(string pluginDirectory) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown foreach (Texture2D value in icons.Values) { Object.Destroy((Object)(object)value); } icons.Clear(); string text = Path.Combine(pluginDirectory, "Icons"); if (!Directory.Exists(text)) { LethalLegendsPlugin.Log.LogWarning((object)("Icons directory not found: " + text)); return; } string[] files = Directory.GetFiles(text, "*.png"); foreach (string path in files) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(path); byte[] array = File.ReadAllBytes(path); Texture2D val = new Texture2D(2, 2); if (ImageConversion.LoadImage(val, array, true)) { ((Texture)val).filterMode = (FilterMode)1; icons[fileNameWithoutExtension] = val; } else { Object.Destroy((Object)(object)val); } } LethalLegendsPlugin.Log.LogInfo((object)$"{icons.Count} achievement icons loaded."); } public static Texture2D? Get(string achievementId) { if (!icons.TryGetValue(achievementId, out Texture2D value)) { return null; } return value; } } public static class AchievementMenu { private static Vector2 scrollPosition = Vector2.zero; private static int selectedTab = 0; private static int selectedFilter = 0; private static int selectedCategory = 0; public static Action? OnClose; private static readonly string[] CategoryLabelsFr = new string[7] { "TOUTES", "MORTS", "KILLS", "EXPLORATION", "SCRAP & ÉCONOMIE", "FUN & SECRETS", "DÉFIS LÉGENDAIRES" }; private static readonly string[] CategoryLabelsEn = new string[7] { "ALL", "DEATHS", "KILLS", "EXPLORATION", "SCRAP & ECONOMY", "FUN & SECRETS", "LEGENDARY CHALLENGES" }; private static readonly string[] FiltersFr = new string[3] { "TOUS", "DÉBLOQUÉS", "VERROUILLÉS" }; private static readonly string[] FiltersEn = new string[3] { "ALL", "UNLOCKED", "LOCKED" }; private static readonly AchievementCategory[] Categories = new AchievementCategory[6] { AchievementCategory.Deaths, AchievementCategory.Kills, AchievementCategory.Exploration, AchievementCategory.ScrapEconomy, AchievementCategory.FunSecrets, AchievementCategory.LegendaryChallenges }; private static readonly Color Background = new Color(0.09f, 0.11f, 0.16f, 1f); private static readonly Color Sidebar = new Color(0.12f, 0.15f, 0.21f, 1f); private static readonly Color CardBackground = new Color(0.16f, 0.2f, 0.28f, 1f); private static readonly Color Gold = new Color(0.97f, 0.78f, 0.41f); private static readonly Color Muted = new Color(0.7f, 0.75f, 0.84f); private static readonly Color Green = new Color(0.53f, 0.85f, 0.64f); private static readonly Color ButtonBackground = new Color(0.22f, 0.27f, 0.36f); private static GUIStyle? titleStyle; private static GUIStyle? headingStyle; private static GUIStyle? textStyle; private static GUIStyle? mutedStyle; private static GUIStyle? goldStyle; private static GUIStyle? buttonStyle; private static GUIStyle? iconStyle; private static GUIStyle? statusStyle; private static GUIStyle? cardNameStyle; private static GUIStyle? cardDescriptionStyle; private static GUIStyle? cardTitleStyle; private static GUIStyle? cardStatusStyle; private static GUIStyle? rarityStyle; private static string[] CategoryLabels { get { if (!LocalizationManager.IsFrench) { return CategoryLabelsEn; } return CategoryLabelsFr; } } private static void InitializeStyles() { //IL_0009: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_00c6: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) if (titleStyle == null) { titleStyle = MakeStyle(30, Gold, bold: true, wrap: false, (TextAnchor)3); } if (headingStyle == null) { headingStyle = MakeStyle(21, Color.white, bold: true, wrap: false, (TextAnchor)3); } if (textStyle == null) { textStyle = MakeStyle(17, Color.white, bold: true, wrap: false, (TextAnchor)3); } if (mutedStyle == null) { mutedStyle = MakeStyle(14, Muted, bold: false, wrap: true, (TextAnchor)3); } if (goldStyle == null) { goldStyle = MakeStyle(15, Gold, bold: false, wrap: false, (TextAnchor)3); } if (buttonStyle == null) { buttonStyle = MakeStyle(15, Color.white, bold: true, wrap: false, (TextAnchor)4); } if (iconStyle == null) { iconStyle = MakeStyle(30, Gold, bold: false, wrap: false, (TextAnchor)4); } if (statusStyle == null) { statusStyle = MakeStyle(13, Green, bold: true, wrap: false, (TextAnchor)4); } if (cardNameStyle == null) { cardNameStyle = MakeStyle(18, Color.white, bold: true, wrap: true, (TextAnchor)4); } if (cardDescriptionStyle == null) { cardDescriptionStyle = MakeStyle(14, Muted, bold: false, wrap: true, (TextAnchor)4); } if (cardTitleStyle == null) { cardTitleStyle = MakeStyle(13, Gold, bold: false, wrap: true, (TextAnchor)4); } if (cardStatusStyle == null) { cardStatusStyle = MakeStyle(12, Green, bold: true, wrap: false, (TextAnchor)4); } if (rarityStyle == null) { rarityStyle = MakeStyle(12, Color.white, bold: true, wrap: false, (TextAnchor)4); } } private static GUIStyle MakeStyle(int size, Color color, bool bold = false, bool wrap = false, TextAnchor alignment = (TextAnchor)3) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = size, fontStyle = (FontStyle)(bold ? 1 : 0), wordWrap = wrap, alignment = alignment }; val.normal.textColor = color; return val; } private static bool RoundedButton(Rect rect, string label, bool selected = false) { //IL_0000: 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_0004: 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_003b: 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_0045: 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_0061: Unknown result type (might be due to invalid IL or missing references) CartoonUI.DrawRoundedRect(rect, selected ? Gold : ButtonBackground, 12); Color textColor = buttonStyle.normal.textColor; buttonStyle.normal.textColor = (selected ? Background : Color.white); GUI.Label(rect, label, buttonStyle); buttonStyle.normal.textColor = textColor; return GUI.Button(rect, GUIContent.none, GUIStyle.none); } public static void Draw() { //IL_02b1: 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_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_0066: 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_0095: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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_019c: 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) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) InitializeStyles(); float num = Mathf.Min((float)Screen.width / 1440f, (float)Screen.height / 810f); if (num <= 0f) { return; } float num2 = (float)Screen.width / num; float num3 = (float)Screen.height / num; Matrix4x4 matrix = GUI.matrix; GUI.matrix = Matrix4x4.Scale(new Vector3(num, num, 1f)); try { CartoonUI.DrawRoundedRect(new Rect(0f, 0f, num2, num3), Background, 0); float num4 = 32f; float num5 = 156f; GUI.Label(new Rect(num4, 22f, 500f, 48f), "LETHAL LEGENDS", titleStyle); GUI.Label(new Rect(num4, 69f, 600f, 24f), T("TA COLLECTION DE SUCCÈS", "YOUR ACHIEVEMENT COLLECTION"), mutedStyle); if (RoundedButton(new Rect(num2 - 212f, 30f, 56f, 42f), "EN", !LocalizationManager.IsFrench)) { LocalizationManager.SetLanguage("en"); } if (RoundedButton(new Rect(num2 - 146f, 30f, 56f, 42f), "FR", LocalizationManager.IsFrench)) { LocalizationManager.SetLanguage("fr"); } if (RoundedButton(new Rect(num2 - 76f, 30f, 44f, 42f), "X")) { OnClose?.Invoke(); return; } float num6 = 103f; if (RoundedButton(new Rect(num4, num6, 205f, 43f), T("SUCCÈS", "ACHIEVEMENTS"), selectedTab == 0)) { selectedTab = 0; scrollPosition = Vector2.zero; } if (RoundedButton(new Rect(num4 + 219f, num6, 205f, 43f), T("TITRES", "TITLES"), selectedTab == 1)) { selectedTab = 1; scrollPosition = Vector2.zero; } float num7 = num3 - 28f; float num8 = Mathf.Max(150f, num7 - num5); float num9 = Mathf.Clamp(num2 * 0.225f, 260f, 345f); float num10 = num4 + num9 + 20f; float num11 = Mathf.Max(350f, num2 - num10 - num4); if (selectedTab == 0) { DrawSidebar(new Rect(num4, num5, num9, num8)); DrawAchievements(new Rect(num10, num5, num11, num8)); } else { DrawTitles(new Rect(num4, num5, num2 - 2f * num4, num8)); } } finally { GUI.matrix = matrix; } } private static void DrawSidebar(Rect area) { //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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) CartoonUI.DrawRoundedRect(area, Sidebar, 20); GUI.Label(new Rect(((Rect)(ref area)).x + 22f, ((Rect)(ref area)).y + 20f, ((Rect)(ref area)).width - 44f, 35f), T("CATÉGORIES", "CATEGORIES"), headingStyle); for (int i = 0; i < CategoryLabels.Length; i++) { if (RoundedButton(new Rect(((Rect)(ref area)).x + 16f, ((Rect)(ref area)).y + 75f + (float)i * 58f, ((Rect)(ref area)).width - 32f, 45f), CategoryLabels[i], selectedCategory == i)) { selectedCategory = i; scrollPosition = Vector2.zero; } } } private static void DrawAchievements(Rect area) { //IL_0052: 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_008f: 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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) List<AchievementDefinition> list = AchievementManager.GetAll().ToList(); int count = list.Count; int num = list.Count((AchievementDefinition a) => AchievementManager.IsUnlocked(a.Id)); CartoonUI.DrawRoundedRect(new Rect(((Rect)(ref area)).x, ((Rect)(ref area)).y, ((Rect)(ref area)).width, 125f), Sidebar, 18); GUI.Label(new Rect(((Rect)(ref area)).x + 22f, ((Rect)(ref area)).y + 13f, ((Rect)(ref area)).width - 44f, 34f), T("PROGRESSION", "PROGRESS"), headingStyle); GUI.Label(new Rect(((Rect)(ref area)).x + 22f, ((Rect)(ref area)).y + 48f, ((Rect)(ref area)).width - 44f, 24f), string.Format("{0} / {1} {2}", num, count, T("succès débloqués", "achievements unlocked")), goldStyle); Rect rect = default(Rect); ((Rect)(ref rect))..ctor(((Rect)(ref area)).x + 22f, ((Rect)(ref area)).y + 87f, ((Rect)(ref area)).width - 44f, 12f); CartoonUI.DrawRoundedRect(rect, ButtonBackground, 6); float num2 = ((count == 0) ? 0f : ((float)num / (float)count)); if (num2 > 0f) { CartoonUI.DrawRoundedRect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width * num2, ((Rect)(ref rect)).height), Gold, 6); } float num3 = ((Rect)(ref area)).y + 144f; float num4 = Mathf.Min(152f, (((Rect)(ref area)).width - 24f) / 3f); string[] array = (LocalizationManager.IsFrench ? FiltersFr : FiltersEn); for (int num5 = 0; num5 < array.Length; num5++) { if (RoundedButton(new Rect(((Rect)(ref area)).x + (float)num5 * (num4 + 10f), num3, num4, 39f), array[num5], selectedFilter == num5)) { selectedFilter = num5; scrollPosition = Vector2.zero; } } List<AchievementDefinition> list2 = list.Where(delegate(AchievementDefinition a) { bool flag = AchievementManager.IsUnlocked(a.Id); bool num14 = selectedFilter == 0 || (selectedFilter == 1 && flag) || (selectedFilter == 2 && !flag); bool flag2 = selectedCategory == 0 || a.Category == Categories[selectedCategory - 1]; return num14 && flag2; }).ToList(); GUI.Label(new Rect(((Rect)(ref area)).x + 2f, ((Rect)(ref area)).y + 193f, ((Rect)(ref area)).width - 4f, 28f), string.Format("{0} {1}", list2.Count, T("SUCCÈS", "ACHIEVEMENTS")), goldStyle); Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref area)).x, ((Rect)(ref area)).y + 225f, ((Rect)(ref area)).width, Mathf.Max(0f, ((Rect)(ref area)).height - 225f)); float num6 = ((Rect)(ref val)).width - 22f; int num7 = Mathf.Clamp(Mathf.FloorToInt((num6 + 14f) / 234f), 1, 4); float num8 = (num6 - (float)(num7 - 1) * 14f) / (float)num7; int num9 = Mathf.CeilToInt((float)list2.Count / (float)num7); float num10 = Mathf.Max(((Rect)(ref val)).height - 1f, (float)num9 * 280f); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(0f, 0f, num6, num10); scrollPosition = GUI.BeginScrollView(val, scrollPosition, val2, false, true); if (list2.Count == 0) { GUI.Label(new Rect(0f, 0f, num6, 40f), T("Aucun succès pour ces filtres.", "No achievements match these filters."), mutedStyle); } Rect card = default(Rect); for (int num11 = 0; num11 < list2.Count; num11++) { int num12 = num11 % num7; int num13 = num11 / num7; ((Rect)(ref card))..ctor((float)num12 * (num8 + 14f), (float)num13 * 280f, num8, 266f); DrawAchievementCard(list2[num11], card); } GUI.EndScrollView(); } private static void DrawAchievementCard(AchievementDefinition achievement, Rect card) { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: 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_0192: 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_0217: 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_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) bool flag = AchievementManager.IsUnlocked(achievement.Id); bool flag2 = !flag && achievement.Visibility == AchievementVisibility.Secret; string text = (flag2 ? "???" : achievement.LocalizedName); string description = (flag2 ? T("Succès secret", "Secret achievement") : ((!flag && achievement.Visibility == AchievementVisibility.Hint) ? (T("Indice : ", "Hint: ") + achievement.LocalizedHint) : achievement.LocalizedDescription)); string text2 = (flag ? (T("Titre : ", "Title: ") + achievement.LocalizedTitle) : T("Titre : ???", "Title: ???")); string text3 = (flag ? "*" : "?"); Color background = (flag ? CardBackground : Sidebar); Color val = AchievementRarityUI.GetColor(achievement.Rarity); if (flag2) { val = Muted; } Color borderColor = (flag ? val : Color.Lerp(val, Background, 0.65f)); CartoonUI.DrawRoundedBorder(card, background, borderColor); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(((Rect)(ref card)).center.x - 43f, ((Rect)(ref card)).y + 14f, 86f, 86f); CartoonUI.DrawRoundedBorder(val2, ButtonBackground, borderColor, 14); Texture2D val3 = (flag ? AchievementIcons.Get(achievement.Id) : null); if ((Object)(object)val3 != (Object)null) { GUI.DrawTexture(new Rect(((Rect)(ref val2)).x + 4f, ((Rect)(ref val2)).y + 4f, ((Rect)(ref val2)).width - 8f, ((Rect)(ref val2)).height - 8f), (Texture)(object)val3, (ScaleMode)2); } else { GUI.Label(val2, text3, iconStyle); } GUI.Label(new Rect(((Rect)(ref card)).x + 10f, ((Rect)(ref card)).y + 106f, ((Rect)(ref card)).width - 20f, 34f), text, cardNameStyle); DrawAdaptiveDescription(new Rect(((Rect)(ref card)).x + 12f, ((Rect)(ref card)).y + 140f, ((Rect)(ref card)).width - 24f, 54f), description); GUI.Label(new Rect(((Rect)(ref card)).x + 10f, ((Rect)(ref card)).y + 194f, ((Rect)(ref card)).width - 20f, 22f), text2, cardTitleStyle); if (!flag && achievement.HasVisibleProgress) { DrawAchievementProgress(achievement, card, val); } else { Color textColor = cardStatusStyle.normal.textColor; cardStatusStyle.normal.textColor = (flag ? Green : Muted); GUI.Label(new Rect(((Rect)(ref card)).x + 10f, ((Rect)(ref card)).y + 216f, ((Rect)(ref card)).width - 20f, 20f), flag ? T("OBTENU", "UNLOCKED") : T("VERROUILLÉ", "LOCKED"), cardStatusStyle); cardStatusStyle.normal.textColor = textColor; } rarityStyle.normal.textColor = val; GUI.Label(new Rect(((Rect)(ref card)).x + 10f, ((Rect)(ref card)).y + 238f, ((Rect)(ref card)).width - 20f, 20f), flag2 ? "???" : AchievementRarityUI.GetLabel(achievement.Rarity), rarityStyle); } private static void DrawAdaptiveDescription(Rect rect, string description) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) GUIStyle val = cardDescriptionStyle; int fontSize = val.fontSize; GUIContent val2 = new GUIContent(description); while (val.fontSize > 11 && val.CalcHeight(val2, ((Rect)(ref rect)).width) > ((Rect)(ref rect)).height) { int fontSize2 = val.fontSize; val.fontSize = fontSize2 - 1; } GUI.Label(rect, val2, val); val.fontSize = fontSize; } private static void DrawAchievementProgress(AchievementDefinition achievement, Rect card, Color rarityColor) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0049: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_014b: 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_00e1: Unknown result type (might be due to invalid IL or missing references) long progressTarget = achievement.ProgressTarget; long num = Math.Max(0L, Math.Min(progressTarget, AchievementProgressManager.GetCounter(achievement.ProgressKey))); float num2 = (float)((double)num / (double)progressTarget); string text = $"{num} / {progressTarget}"; float num3 = cardStatusStyle.CalcSize(new GUIContent(text)).x + 8f; Rect rect = default(Rect); ((Rect)(ref rect))..ctor(((Rect)(ref card)).x + 14f, ((Rect)(ref card)).y + 222f, Mathf.Max(0f, ((Rect)(ref card)).width - 34f - num3), 8f); CartoonUI.DrawRoundedRect(rect, ButtonBackground, 4); if (num2 > 0f && ((Rect)(ref rect)).width > 0f) { CartoonUI.DrawRoundedRect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width * num2, ((Rect)(ref rect)).height), rarityColor, 4); } Color textColor = cardStatusStyle.normal.textColor; cardStatusStyle.normal.textColor = Color.white; GUI.Label(new Rect(((Rect)(ref card)).xMax - 14f - num3, ((Rect)(ref card)).y + 216f, num3, 20f), text, cardStatusStyle); cardStatusStyle.normal.textColor = textColor; } private static void DrawTitles(Rect area) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) CartoonUI.DrawRoundedRect(new Rect(((Rect)(ref area)).x, ((Rect)(ref area)).y, ((Rect)(ref area)).width, 116f), Sidebar, 18); GUI.Label(new Rect(((Rect)(ref area)).x + 24f, ((Rect)(ref area)).y + 15f, ((Rect)(ref area)).width - 230f, 35f), T("MES TITRES", "MY TITLES"), headingStyle); string selectedTitle = TitleManager.GetSelectedTitle(); GUI.Label(new Rect(((Rect)(ref area)).x + 24f, ((Rect)(ref area)).y + 58f, ((Rect)(ref area)).width - 230f, 27f), T("TITRE ACTUEL : ", "CURRENT TITLE: ") + (string.IsNullOrEmpty(selectedTitle) ? T("AUCUN", "NONE") : TitleManager.GetLocalizedTitle(selectedTitle)), goldStyle); if (RoundedButton(new Rect(((Rect)(ref area)).xMax - 198f, ((Rect)(ref area)).y + 39f, 173f, 39f), T("RETIRER LE TITRE", "UNEQUIP TITLE"))) { TitleManager.UnequipTitle(); } List<string> unlockedTitles = TitleManager.GetUnlockedTitles(); GUILayout.BeginArea(new Rect(((Rect)(ref area)).x, ((Rect)(ref area)).y + 140f, ((Rect)(ref area)).width, Mathf.Max(0f, ((Rect)(ref area)).height - 140f))); scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, true, Array.Empty<GUILayoutOption>()); if (unlockedTitles.Count == 0) { GUILayout.Label(T("Aucun titre débloqué pour le moment.", "No titles unlocked yet."), mutedStyle, Array.Empty<GUILayoutOption>()); } foreach (string item in unlockedTitles) { bool flag = item == selectedTitle; Rect rect = GUILayoutUtility.GetRect(100f, 78f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); CartoonUI.DrawRoundedRect(rect, CardBackground); GUI.Label(new Rect(((Rect)(ref rect)).x + 24f, ((Rect)(ref rect)).y + 23f, ((Rect)(ref rect)).width - 215f, 30f), TitleManager.GetLocalizedTitle(item), textStyle); if (RoundedButton(new Rect(((Rect)(ref rect)).xMax - 175f, ((Rect)(ref rect)).y + 19f, 148f, 40f), flag ? T("ÉQUIPÉ", "EQUIPPED") : T("ÉQUIPER", "EQUIP"), flag) && !flag) { TitleManager.EquipTitle(item); } GUILayout.Space(12f); } GUILayout.EndScrollView(); GUILayout.EndArea(); } private static string T(string french, string english) { return LocalizationManager.Translate(french, english); } } public static class AchievementNotification { private static bool soundPlayed; private static readonly Queue<AchievementDefinition> queue = new Queue<AchievementDefinition>(); private static AchievementDefinition? currentAchievement; private static float startedAt; private static GUIStyle? headingStyle; private static GUIStyle? nameStyle; private static GUIStyle? descriptionStyle; private static GUIStyle? titleStyle; private static GUIStyle? fallbackStyle; private static Texture2D? frameMask; private static readonly Color IconBackground = new Color(0.12f, 0.15f, 0.21f, 0.96f); public static void Show(AchievementDefinition achievement) { queue.Enqueue(achievement); } private static float Duration(AchievementRarity rarity) { return rarity switch { AchievementRarity.Easy => 3.5f, AchievementRarity.Medium => 4f, AchievementRarity.Hard => 4.5f, AchievementRarity.Impossible => 5f, AchievementRarity.Ultimate => 6.5f, _ => 4f, }; } private static int ParticleCount(AchievementRarity rarity) { return rarity switch { AchievementRarity.Medium => 12, AchievementRarity.Hard => 24, AchievementRarity.Impossible => 64, AchievementRarity.Ultimate => 120, _ => 0, }; } private static bool IsRainbow(AchievementRarity rarity) { return rarity == AchievementRarity.Ultimate; } private static GUIStyle MakeStyle(int size, bool bold) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_002a: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = size, fontStyle = (FontStyle)(bold ? 1 : 0), alignment = (TextAnchor)4, wordWrap = true }; val.normal.textColor = Color.white; return val; } private static void InitializeStyles() { //IL_007d: Unknown result type (might be due to invalid IL or missing references) if (headingStyle == null) { headingStyle = MakeStyle(15, bold: true); } if (nameStyle == null) { nameStyle = MakeStyle(27, bold: true); } if (descriptionStyle == null) { descriptionStyle = MakeStyle(17, bold: false); } if (titleStyle == null) { titleStyle = MakeStyle(15, bold: true); } if (fallbackStyle == null) { fallbackStyle = MakeStyle(48, bold: true); } if ((Object)(object)frameMask == (Object)null) { frameMask = CartoonUI.CreateRoundedTexture(128, 128, 20, Color.white); } } public static void Draw() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0158: 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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_021e: 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_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0232: 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_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) if ((int)Event.current.type != 7) { return; } float realtimeSinceStartup = Time.realtimeSinceStartup; if (currentAchievement != null && realtimeSinceStartup - startedAt >= Duration(currentAchievement.Rarity)) { currentAchievement = null; } if (currentAchievement == null) { if (queue.Count == 0) { return; } currentAchievement = queue.Dequeue(); startedAt = realtimeSinceStartup; soundPlayed = false; } InitializeStyles(); AchievementDefinition achievementDefinition = currentAchievement; float num = realtimeSinceStartup - startedAt; if (!soundPlayed && num >= 0.35f) { soundPlayed = true; AchievementSounds.Play(achievementDefinition.Rarity); } float num2 = Duration(achievementDefinition.Rarity); float num3 = Smooth(num / 0.22f) * Smooth((num2 - num) / 0.55f); float num4 = Smooth((num - 0.35f) / 0.4f); float num5 = num3 * Smooth((num - 0.85f) / 0.4f); float num6 = Mathf.Lerp(0.72f, 1f, Smooth(num / 0.35f)); float num7 = Mathf.Min((float)Screen.width / 1440f, (float)Screen.height / 810f); if (num7 <= 0f) { return; } Color color = ((achievementDefinition.Rarity == AchievementRarity.Easy) ? Color.white : AchievementRarityUI.GetColor(achievementDefinition.Rarity)); Matrix4x4 matrix = GUI.matrix; Color color2 = GUI.color; int depth = GUI.depth; try { GUI.matrix = Matrix4x4.Scale(new Vector3(num7, num7, 1f)); GUI.depth = -100; float num8 = (float)Screen.width / num7 * 0.5f; float num9 = (float)Screen.height / num7 * 0.25f; float num10 = 108f * num6; Rect rect = default(Rect); ((Rect)(ref rect))..ctor(num8 - num10 / 2f, num9 - num10 / 2f, num10, num10); DrawParticles(((Rect)(ref rect)).center, achievementDefinition.Rarity, color, num, num3 * num4); DrawFrame(rect, achievementDefinition.Rarity, color, num, num3, num4); Texture2D val = AchievementIcons.Get(achievementDefinition.Id); GUI.color = new Color(1f, 1f, 1f, num3); if ((Object)(object)val != (Object)null) { GUI.DrawTexture(Inset(rect, 9f), (Texture)(object)val, (ScaleMode)2); } else { DrawLabel(rect, "★", fallbackStyle, Color.white, num3); } if (num5 > 0f) { float num11 = num9 + 59f + (1f - Smooth((num - 0.85f) / 0.4f)) * 8f; float num12 = Mathf.Min(520f, (float)Screen.width / num7 - 24f); float num13 = num8 - num12 / 2f; DrawLabel(new Rect(num13, num11, num12, 23f), LocalizationManager.Translate("SUCCÈS DÉBLOQUÉ !", "ACHIEVEMENT UNLOCKED!"), headingStyle, color, num5); DrawLabel(new Rect(num13, num11 + 23f, num12, 37f), achievementDefinition.LocalizedName, nameStyle, Color.white, num5); DrawLabel(new Rect(num13, num11 + 60f, num12, 44f), achievementDefinition.LocalizedDescription, descriptionStyle, Color.white, num5); DrawLabel(new Rect(num13, num11 + 104f, num12, 25f), LocalizationManager.Translate("Titre : ", "Title: ") + achievementDefinition.LocalizedTitle, titleStyle, color, num5); } } finally { GUI.matrix = matrix; GUI.color = color2; GUI.depth = depth; } } private static void DrawFrame(Rect rect, AchievementRarity rarity, Color color, float elapsed, float alpha, float reveal) { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) bool flag = IsRainbow(rarity); bool num = rarity != AchievementRarity.Easy && rarity != AchievementRarity.Medium; float num2 = 0.5f + 0.5f * Mathf.Sin(elapsed * 5f); if (num) { for (int num3 = 3; num3 >= 1; num3--) { Color color2 = (flag ? Color.HSVToRGB(Mathf.Repeat(elapsed * 0.45f + (float)num3 * 0.12f, 1f), 0.8f, 1f) : color); DrawMask(Inset(rect, (float)(-num3) * 3f), color2, alpha * reveal * (0.07f + num2 * 0.06f)); } } Color color3 = (flag ? Color.HSVToRGB(Mathf.Repeat(elapsed * 0.55f, 1f), 0.8f, 1f) : color); DrawMask(rect, color3, alpha); DrawMask(Inset(rect, flag ? 4f : 3f), IconBackground, alpha); } private static void DrawMask(Rect rect, Color color, float alpha) { //IL_0000: 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_000c: 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_001a: 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) GUI.color = new Color(color.r, color.g, color.b, color.a * alpha); GUI.DrawTexture(rect, (Texture)(object)frameMask); } private static void DrawParticles(Vector2 center, AchievementRarity rarity, Color color, float elapsed, float alpha) { //IL_0076: 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_00b4: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) int num = ParticleCount(rarity); if (num != 0 && !(alpha <= 0f)) { bool flag = IsRainbow(rarity); for (int i = 0; i < num; i++) { float num2 = Mathf.Repeat(elapsed * (0.55f + (float)(i % 5) * 0.08f) + (float)i * 0.618f, 1f); float num3 = (float)i * 2.399963f + elapsed * 0.3f; float num4 = Mathf.Lerp(54f, flag ? 105f : 80f, num2); float num5 = center.x + Mathf.Cos(num3) * num4; float num6 = center.y + Mathf.Sin(num3) * num4; float num7 = (2f + (float)(i % 4)) * (1f - num2 * 0.6f); GUI.color = new Color(color.r, color.g, color.b, alpha * Mathf.Sin(num2 * MathF.PI)); GUI.DrawTexture(new Rect(num5 - num7 / 2f, num6 - num7 / 2f, num7, num7), (Texture)(object)Texture2D.whiteTexture); } } } private static float Smooth(float t) { t = Mathf.Clamp01(t); return t * t * (3f - 2f * t); } private static Rect Inset(Rect rect, float amount) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) return new Rect(((Rect)(ref rect)).x + amount, ((Rect)(ref rect)).y + amount, ((Rect)(ref rect)).width - amount * 2f, ((Rect)(ref rect)).height - amount * 2f); } private static void DrawLabel(Rect rect, string text, GUIStyle style, Color color, float alpha) { //IL_0011: 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_0053: 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_006b: Unknown result type (might be due to invalid IL or missing references) GUI.color = new Color(1f, 1f, 1f, alpha); style.normal.textColor = Color.black; GUI.Label(new Rect(((Rect)(ref rect)).x + 1f, ((Rect)(ref rect)).y + 2f, ((Rect)(ref rect)).width, ((Rect)(ref rect)).height), text, style); style.normal.textColor = color; GUI.Label(rect, text, style); } } public static class AchievementRarityUI { public static Color GetColor(AchievementRarity rarity) { //IL_001f: 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_003b: 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_0045: 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_005b: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_00a0: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) return (Color)(rarity switch { AchievementRarity.Easy => Color.white, AchievementRarity.Medium => Color32.op_Implicit(new Color32((byte)87, (byte)158, byte.MaxValue, byte.MaxValue)), AchievementRarity.Hard => Color32.op_Implicit(new Color32(byte.MaxValue, (byte)77, (byte)77, byte.MaxValue)), AchievementRarity.Impossible => Color32.op_Implicit(new Color32(byte.MaxValue, (byte)198, (byte)92, byte.MaxValue)), AchievementRarity.Ultimate => Color.HSVToRGB(Mathf.Repeat(Time.realtimeSinceStartup * 0.35f, 1f), 0.8f, 1f), _ => Color.white, }); } public static string GetLabel(AchievementRarity rarity) { return rarity switch { AchievementRarity.Easy => LocalizationManager.Translate("FACILE", "EASY"), AchievementRarity.Medium => LocalizationManager.Translate("MOYEN", "MEDIUM"), AchievementRarity.Hard => LocalizationManager.Translate("DIFFICILE", "HARD"), AchievementRarity.Impossible => LocalizationManager.Translate("IMPOSSIBLE", "IMPOSSIBLE"), AchievementRarity.Ultimate => LocalizationManager.Translate("LÉGENDAIRE", "LEGENDARY"), _ => rarity.ToString().ToUpperInvariant(), }; } } public static class AchievementSounds { private static readonly Dictionary<AchievementRarity, AudioClip> clips = new Dictionary<AchievementRarity, AudioClip>(); private static AudioSource? source; private static ConfigEntry<float>? volume; public static void Initialize(ConfigFile config, string pluginDirectory) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown volume = config.Bind<float>("Audio", "AchievementVolume", 0.5f, new ConfigDescription("Volume des sons de succes", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); string text = Path.Combine(pluginDirectory, "Sounds"); if (!Directory.Exists(text)) { LethalLegendsPlugin.Log.LogWarning((object)("Sounds directory not found: " + text)); return; } foreach (AchievementRarity value in Enum.GetValues(typeof(AchievementRarity))) { try { string path = Path.Combine(text, value.ToString().ToLowerInvariant() + ".wav"); if (File.Exists(path)) { clips[value] = LoadWav(path, value.ToString()); } } catch (Exception ex) { LethalLegendsPlugin.Log.LogWarning((object)$"Achievement audio {value}: {ex.Message}"); } } LethalLegendsPlugin.Log.LogInfo((object)$"{clips.Count} achievement sounds loaded."); } private static AudioClip LoadWav(string path, string name) { using BinaryReader binaryReader = new BinaryReader(File.OpenRead(path)); if (new string(binaryReader.ReadChars(4)) != "RIFF") { throw new InvalidDataException("Invalid RIFF header"); } binaryReader.ReadUInt32(); if (new string(binaryReader.ReadChars(4)) != "WAVE") { throw new InvalidDataException("Invalid WAVE header"); } int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; byte[] array = null; while (binaryReader.BaseStream.Position + 8 <= binaryReader.BaseStream.Length) { string text = new string(binaryReader.ReadChars(4)); uint num5 = binaryReader.ReadUInt32(); long num6 = binaryReader.BaseStream.Position + num5; if (num6 > binaryReader.BaseStream.Length) { throw new InvalidDataException("Invalid WAV chunk"); } if (text == "fmt ") { if (num5 < 16) { throw new InvalidDataException("Invalid WAV format"); } num = binaryReader.ReadUInt16(); num2 = binaryReader.ReadUInt16(); num3 = binaryReader.ReadInt32(); binaryReader.ReadUInt32(); binaryReader.ReadUInt16(); num4 = binaryReader.ReadUInt16(); } else if (text == "data") { array = binaryReader.ReadBytes(checked((int)num5)); } binaryReader.BaseStream.Position = num6 + num5 % 2; } bool flag = num == 1 && num4 == 16; bool flag2 = num == 3 && num4 == 32; if ((!flag && !flag2) || (num2 != 1 && num2 != 2) || num3 <= 0 || array == null || array.Length == 0) { throw new InvalidDataException($"Unsupported WAV: format={num}, channels={num2}, bits={num4}"); } int num7 = num4 / 8; if (array.Length % (num2 * num7) != 0) { throw new InvalidDataException("Invalid WAV data length"); } float[] array2 = new float[array.Length / num7]; for (int i = 0; i < array2.Length; i++) { int startIndex = i * num7; float num8 = (flag ? ((float)BitConverter.ToInt16(array, startIndex) / 32768f) : BitConverter.ToSingle(array, startIndex)); array2[i] = ((float.IsNaN(num8) || float.IsInfinity(num8)) ? 0f : Mathf.Clamp(num8, -1f, 1f)); } AudioClip val = AudioClip.Create(name, array2.Length / num2, num2, num3, false); if (!val.SetData(array2, 0)) { Object.Destroy((Object)(object)val); throw new InvalidDataException("Unable to load audio samples"); } return val; } public static void Play(AchievementRarity rarity) { //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) //IL_002d: Expected O, but got Unknown if (clips.TryGetValue(rarity, out AudioClip value)) { if ((Object)(object)source == (Object)null) { GameObject val = new GameObject("LethalLegendsAchievementAudio"); Object.DontDestroyOnLoad((Object)val); source = val.AddComponent<AudioSource>(); source.playOnAwake = false; source.spatialBlend = 0f; source.ignoreListenerPause = true; } source.Stop(); source.volume = Mathf.Clamp01(volume?.Value ?? 0.5f); source.clip = value; source.Play(); } } } public static class CartoonUI { private static readonly Dictionary<(int, int, int), Texture2D> cache = new Dictionary<(int, int, int), Texture2D>(); public static Texture2D CreateRoundedTexture(int width, int height, int radius, Color color) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(width, height, (TextureFormat)4, false); ((Texture)val).filterMode = (FilterMode)1; ((Texture)val).wrapMode = (TextureWrapMode)1; radius = Mathf.Clamp(radius, 0, Mathf.Min(width, height) / 2); Color32[] array = (Color32[])(object)new Color32[width * height]; for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { float num = Mathf.Clamp((float)j + 0.5f, (float)radius, (float)(width - radius)); float num2 = Mathf.Clamp((float)i + 0.5f, (float)radius, (float)(height - radius)); float num3 = (float)j + 0.5f - num; float num4 = (float)i + 0.5f - num2; float num5 = Mathf.Sqrt(num3 * num3 + num4 * num4); float num6 = ((radius == 0) ? 1f : Mathf.Clamp01((float)radius - num5 + 0.5f)); Color val2 = color; val2.a *= num6; array[i * width + j] = Color32.op_Implicit(val2); } } val.SetPixels32(array); val.Apply(false, true); return val; } public static void DrawRoundedBorder(Rect rect, Color background, Color borderColor, int radius = 16, int thickness = 2) { //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) DrawRoundedRect(rect, borderColor, radius); DrawRoundedRect(new Rect(((Rect)(ref rect)).x + (float)thickness, ((Rect)(ref rect)).y + (float)thickness, ((Rect)(ref rect)).width - (float)(thickness * 2), ((Rect)(ref rect)).height - (float)(thickness * 2)), background, Mathf.Max(0, radius - thickness)); } public static void DrawRoundedRect(Rect rect, Color color, int radius = 16) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_0073: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_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) if ((int)Event.current.type != 7 || ((Rect)(ref rect)).width <= 0f || ((Rect)(ref rect)).height <= 0f) { return; } int width = Mathf.Max(1, Mathf.CeilToInt(((Rect)(ref rect)).width)); int height = Mathf.Max(1, Mathf.CeilToInt(((Rect)(ref rect)).height)); Texture2D cachedTexture = GetCachedTexture(width, height, radius); Color color2 = GUI.color; try { GUI.color = color2 * color; GUI.DrawTexture(rect, (Texture)(object)cachedTexture); } finally { GUI.color = color2; } } private static Texture2D GetCachedTexture(int width, int height, int radius) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) radius = Mathf.Clamp(radius, 0, Mathf.Min(width, height) / 2); (int, int, int) key = (width, height, radius); if (!cache.TryGetValue(key, out Texture2D value) || (Object)(object)value == (Object)null) { value = CreateRoundedTexture(width, height, radius, Color.white); cache[key] = value; } return value; } } } namespace LethalLegends.Tracking { public static class DeathResolver { private static bool pendingDeath; private static string? specificDeathType; private static string genericDeathType = ""; private static int deathFrame; private static int specificDeathPriority; public const int GenericPriority = 10; public const int SpecificPriority = 100; public unsafe static void RegisterDeath(CauseOfDeath causeOfDeath) { ResolvePendingDeath(); pendingDeath = true; specificDeathType = null; specificDeathPriority = 0; genericDeathType = ((object)(*(CauseOfDeath*)(&causeOfDeath))/*cast due to .constrained prefix*/).ToString(); deathFrame = Time.frameCount; } public static void ReportDeathType(string deathType, int priority = 100) { if (!pendingDeath) { return; } if (specificDeathType == deathType) { if (priority > specificDeathPriority) { specificDeathPriority = priority; } } else if (specificDeathType == null || priority > specificDeathPriority) { specificDeathType = deathType; specificDeathPriority = priority; } } public static void Tick() { if (pendingDeath && Time.frameCount > deathFrame) { ResolvePendingDeath(); } } public static void ResolvePendingDeath() { if (pendingDeath) { bool isSpecific = specificDeathType != null; string? deathType = specificDeathType ?? ("unknown." + genericDeathType); pendingDeath = false; specificDeathType = null; specificDeathPriority = 0; DeathTracker.RecordDeath(deathType, isSpecific); } } } public static class DeathTracker { public static void RecordDeath(string deathType, bool isSpecific = true) { AchievementProgressManager.Increment("deaths.total", 1L); AchievementProgressManager.Increment(ProgressKeys.DeathsByType(deathType), 1L); CheckAchievements(isSpecific ? UpdateDeathStreak(deathType) : ResetDeathStreak()); } private static long UpdateDeathStreak(string deathType) { if (AchievementProgressManager.GetValue("deaths.last_type") == deathType) { return AchievementProgressManager.Increment("deaths.streak", 1L); } AchievementProgressManager.SetValue("deaths.last_type", deathType); AchievementProgressManager.SetCounter("deaths.streak", 1L); return 1L; } private static long ResetDeathStreak() { AchievementProgressManager.ResetCounter("deaths.streak"); AchievementProgressManager.SetValue("deaths.last_type", ""); return 0L; } private static void CheckAchievements(long streak) { if (streak >= 3) { AchievementManager.Unlock("death_jamais_2_sans_3"); } if (streak >= 10) { AchievementManager.Unlock("death_darwin_award"); } } } public static class EnemyCombatTracker { private static readonly HashSet<EnemyAI> EnemiesThatDamagedTeammate = new HashSet<EnemyAI>(); private static readonly HashSet<EnemyAI> EnemiesThatKilledTeammate = new HashSet<EnemyAI>(); public static void ResetRound() { EnemiesThatDamagedTeammate.Clear(); EnemiesThatKilledTeammate.Clear(); } private static bool IsTeammate(PlayerControllerB? player) { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)val != (Object)null && (Object)(object)player != (Object)null) { return (Object)(object)player != (Object)(object)val; } return false; } public static void RecordTeammateDamage(EnemyAI enemy, PlayerControllerB player) { if (!((Object)(object)enemy == (Object)null) && IsTeammate(player)) { EnemiesThatDamagedTeammate.Add(enemy); } } public static void RecordTeammateDeath(EnemyAI enemy, PlayerControllerB player) { if (!((Object)(object)enemy == (Object)null) && IsTeammate(player)) { EnemiesThatKilledTeammate.Add(enemy); } } public static void ConfirmKill(EnemyAI enemy) { if (EnemiesThatDamagedTeammate.Remove(enemy)) { AchievementManager.Unlock("kill_bodyguard"); } if (EnemiesThatKilledTeammate.Remove(enemy)) { AchievementManager.Unlock("kill_vengeance"); if (enemy is FlowermanAI) { AchievementManager.Unlock("kill_john_wick"); } } } } public static class ExplorationCollectionTracker { private const string SaveKey = "LethalLegends_ExplorationCollections"; private static readonly HashSet<string> RunScrapMoons = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private static readonly HashSet<string> ScrapMoonsWithoutDeath = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private static readonly HashSet<string> RunVisitedMoons = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private static string? activeSaveFile; private static bool sessionInitialized; private static bool isDirty; private static int completedQuotas; public static void InitializeSession() { Clear(); sessionInitialized = true; StartOfRound instance = StartOfRound.Instance; GameNetworkManager instance2 = GameNetworkManager.Instance; if ((Object)(object)instance != (Object)null && (Object)(object)instance2 != (Object)null && ((NetworkBehaviour)instance).IsHost && !instance.isChallengeFile && !string.IsNullOrWhiteSpace(instance2.currentSaveFileName)) { activeSaveFile = instance2.currentSaveFileName; try { string[] array = ES3.Load<string[]>("LethalLegends_ExplorationCollections", activeSaveFile, Array.Empty<string>()); if (array.Length != 0) { if (array.Length != 4 || !int.TryParse(array[3], out completedQuotas) || completedQuotas < 0) { throw new FormatException("Invalid exploration collection save data."); } LoadMoons(RunScrapMoons, array[0]); LoadMoons(ScrapMoonsWithoutDeath, array[1]); LoadMoons(RunVisitedMoons, array[2]); } } catch (Exception arg) { RunScrapMoons.Clear(); ScrapMoonsWithoutDeath.Clear(); RunVisitedMoons.Clear(); completedQuotas = 0; activeSaveFile = null; LethalLegendsPlugin.Log.LogWarning((object)$"[EXPLORATION][COLLECTION] Load failed: {arg}"); } } UpdateProgress(); CheckAchievements(); } private static void LoadMoons(HashSet<string> destination, string value) { string[] array = value.Split(','); foreach (string text in array) { if (MoonCatalog.IsVanilla(text)) { destination.Add(text); } } } public static void RecordScrapMoon(string moon) { if (sessionInitialized && MoonCatalog.IsVanilla(moon) && (RunScrapMoons.Add(moon) | ScrapMoonsWithoutDeath.Add(moon))) { isDirty = true; UpdateProgress(); CheckAchievements(); } } public static void RecordVisitedMoon(string moon) { if (sessionInitialized && MoonCatalog.IsVanilla(moon) && RunVisitedMoons.Add(moon)) { isDirty = true; } } public static void RecordDeath() { if (sessionInitialized && ScrapMoonsWithoutDeath.Count != 0) { ScrapMoonsWithoutDeath.Clear(); isDirty = true; AchievementProgressManager.ResetCounter("exploration.scrap_moons_without_death"); } } public static void RecordCompletedQuota() { if (sessionInitialized) { completedQuotas++; isDirty = true; UpdateProgress(); CheckAchievements(); SaveRun(); } } private static void UpdateProgress() { AchievementProgressManager.SetCounter("exploration.scrap_moons_without_death", ScrapMoonsWithoutDeath.Count); AchievementProgressManager.SetCounter("exploration.run_scrap_moons_count", RunScrapMoons.Count); AchievementProgressManager.SetCounter("exploration.run_completed_quotas", completedQuotas); } private static void CheckAchievements() { if (ScrapMoonsWithoutDeath.Count >= 3) { AchievementManager.Unlock("exploration_lara_croft"); } if (MoonCatalog.ContainsAll(RunScrapMoons)) { AchievementManager.Unlock("exploration_galactic_collector"); } if (completedQuotas >= 10 && RunVisitedMoons.Count >= 10) { AchievementManager.Unlock("exploration_the_goat"); } } public static void CommitDay() { if (sessionInitialized) { UpdateProgress(); CheckAchievements(); SaveRun(); } } private static void SaveRun() { if (!isDirty || !sessionInitialized || string.IsNullOrWhiteSpace(activeSaveFile)) { return; } StartOfRound instance = StartOfRound.Instance; GameNetworkManager instance2 = GameNetworkManager.Instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance2 == (Object)null || !((NetworkBehaviour)instance).IsHost || instance2.currentSaveFileName != activeSaveFile) { return; } try { ES3.Save<string[]>("LethalLegends_ExplorationCollections", new string[4] { string.Join(",", RunScrapMoons), string.Join(",", ScrapMoonsWithoutDeath), string.Join(",", RunVisitedMoons), completedQuotas.ToString() }, activeSaveFile); isDirty = false; } catch (Exception arg) { LethalLegendsPlugin.Log.LogWarning((object)$"[EXPLORATION][COLLECTION] Save failed: {arg}"); } } public static void ResetRun() { if (sessionInitialized) { isDirty = true; RunScrapMoons.Clear(); ScrapMoonsWithoutDeath.Clear(); RunVisitedMoons.Clear(); completedQuotas = 0; UpdateProgress(); SaveRun(); } } public static void EndSession() { Clear(); UpdateProgress(); } private static void Clear() { isDirty = false; RunScrapMoons.Clear(); ScrapMoonsWithoutDeath.Clear(); RunVisitedMoons.Clear(); completedQuotas = 0; activeSaveFile = null; sessionInitialized = false; } } public static class ExplorationDurationTracker { private const float LocataireDuration = 300f; private const float AirbnbDuration = 600f; private const float RandonneurDuration = 600f; private const float LateReturnThreshold = 0.9f; private static float? facilityEntryTime; private static float? shipExitTime; private static bool dayActive; public static void BeginDay(SelectableLevel level) { ResetDay(); if (!((Object)(object)level == (Object)null) && level.spawnEnemiesAndScrap && level.planetHasTime) { dayActive = true; } } public static void RecordFacilityEntry() { if (dayActive) { facilityEntryTime = Time.realtimeSinceStartup; } } public static void RecordFacilityExit() { if (dayActive && facilityEntryTime.HasValue) { float num = Time.realtimeSinceStartup - facilityEntryTime.Value; facilityEntryTime = null; if (num >= 300f) { AchievementManager.Unlock("exploration_locataire"); } if (num >= 600f) { AchievementManager.Unlock("exploration_airbnb"); } } } public static void RecordShipPosition(bool inElevator) { if (!dayActive) { return; } if (!inElevator) { if (!shipExitTime.HasValue) { shipExitTime = Time.realtimeSinceStartup; } } else if (shipExitTime.HasValue) { float num = Time.realtimeSinceStartup - shipExitTime.Value; shipExitTime = null; if (num >= 600f) { AchievementManager.Unlock("exploration_randonneur"); } CheckLateReturn(); } } private static void CheckLateReturn() { TimeOfDay instance = TimeOfDay.Instance; StartOfRound instance2 = StartOfRound.Instance; if (!((Object)(object)instance == (Object)null) && !((Object)(object)instance2 == (Object)null) && !instance2.shipIsLeaving && !instance2.inShipPhase) { float normalizedTimeOfDay = instance.normalizedTimeOfDay; if (normalizedTimeOfDay >= 0.9f && normalizedTimeOfDay < instance.shipLeaveAutomaticallyTime) { AchievementManager.Unlock("exploration_mission_impossible"); } } } public static void ResetFacilityVisit() { facilityEntryTime = null; } public static void RecordDeath() { facilityEntryTime = null; shipExitTime = null; } public static void ResetDay() { facilityEntryTime = null; shipExitTime = null; dayActive = false; } } public static class ExplorationEquipmentTracker { private static bool dayActive; private static bool firstEntryDone; private static bool equipmentUsed; private static bool outsideShip; private static bool pickedUpScrap; private static bool exploredFacility; private static bool insideFacility; private static bool flashlightUsed; public static void BeginDay(SelectableLevel level) { ResetDay(); if (!((Object)(object)level == (Object)null) && level.spawnEnemiesAndScrap && level.planetHasTime) { dayActive = true; PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)val != (Object)null) { equipmentUsed = HasActiveEquipment(val); } } } public static void RecordShipPosition(bool inElevator) { if (!dayActive) { return; } if (!inElevator) { if (!outsideShip) { outsideShip = true; pickedUpScrap = false; exploredFacility = false; } } else if (outsideShip) { if (exploredFacility && !pickedUpScrap) { AchievementManager.Unlock("exploration_reperage"); } outsideShip = false; pickedUpScrap = false; exploredFacility = false; ResetFacilityVisit(); } } public static void RecordFacilityEntry() { if (!dayActive) { return; } PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)val == (Object)null || val.isPlayerDead) { return; } if (!firstEntryDone) { firstEntryDone = true; if (!equipmentUsed && !HasActiveEquipment(val)) { AchievementManager.Unlock("exploration_naturiste"); } } insideFacility = true; flashlightUsed = HasActiveFlashlight(val); } public static void RecordFacilityExit() { if (dayActive && insideFacility) { if (!flashlightUsed) { AchievementManager.Unlock("exploration_dardevil"); } if (outsideShip) { exploredFacility = true; } ResetFacilityVisit(); } } public static void RecordScrapPickup() { if (dayActive && outsideShip) { pickedUpScrap = true; } } public static void RecordEquipmentUse() { if (dayActive && !firstEntryDone) { equipmentUsed = true; } } public static void RecordFlashlightUse() { if (dayActive) { RecordEquipmentUse(); if (insideFacility) { flashlightUsed = true; } } } private static bool HasActiveEquipment(PlayerControllerB player) { GrabbableObject[] itemSlots = player.ItemSlots; foreach (GrabbableObject val in itemSlots) { if ((Object)(object)val != (Object)null && val.isBeingUsed) { return true; } } if ((Object)(object)player.ItemOnlySlot != (Object)null) { return player.ItemOnlySlot.isBeingUsed; } return false; } private static bool HasActiveFlashlight(PlayerControllerB player) { GrabbableObject[] itemSlots = player.ItemSlots; foreach (GrabbableObject obj in itemSlots) { FlashlightItem val = (FlashlightItem)(object)((obj is FlashlightItem) ? obj : null); if (val != null && ((GrabbableObject)val).isBeingUsed) { return true; } } GrabbableObject itemOnlySlot = player.ItemOnlySlot; return ((itemOnlySlot is FlashlightItem) ? itemOnlySlot : null)?.isBeingUsed ?? false; } public static void ResetFacilityVisit() { insideFacility = false; flashlightUsed = false; } public static void RecordDeath() { outsideShip = false; pickedUpScrap = false; exploredFacility = false; firstEntryDone = true; ResetFacilityVisit(); } public static void ResetDay() { dayActive = false; firstEntryDone = false; equipmentUsed = false; outsideShip = false; pickedUpScrap = false; exploredFacility = false; ResetFacilityVisit(); } } public static class ExplorationFacilityTracker { private static int? entryEntranceId; private static bool tookDamageInside; public static void RecordTeleport(int entranceId, bool entering) { if (entranceId != 0) { RecordFireExitUse(); } if (entering) { RecordEntry(entranceId); } else { RecordExit(entranceId); } } private static void RecordEntry(int entranceId) { LegendaryDayTracker.RecordFacilityEntry(); ExplorationDurationTracker.RecordFacilityEntry(); ExplorationEquipmentTracker.RecordFacilityEntry(); entryEntranceId = entranceId; tookDamageInside = false; long num = AchievementProgressManager.Increment("exploration.total_facility_entries", 1L); if (num >= 1) { AchievementManager.Unlock("exploration_visiteur"); } if (num >= 50) { AchievementManager.Unlock("exploration_explorateur_aguerri"); } if (num >= 500) { AchievementManager.Unlock("exploration_company_enjoyer"); } if (entranceId == 0) { AchievementManager.Unlock("exploration_premier_jour"); } else { AchievementManager.Unlock("exploration_habitue"); } } private static void RecordExit(int entranceId) { ExplorationDurationTracker.RecordFacilityExit(); ExplorationEquipmentTracker.RecordFacilityExit(); LegendaryDayTracker.RecordFacilityExit(); if (entryEntranceId.HasValue) { if (entryEntranceId.Value != entranceId) { AchievementManager.Unlock("exploration_passe_partout"); } if (entryEntranceId.Value != 0 && entranceId == 0 && !tookDamageInside) { AchievementManager.Unlock("exploration_par_derriere"); } } ResetVisit(); } private static void RecordFireExitUse() { long num = AchievementProgressManager.Increment("exploration.total_fire_exit_uses", 1L); if (num >= 1) { AchievementManager.Unlock("exploration_prudent"); } if (num >= 25) { AchievementManager.Unlock("exploration_pompier"); } if (num >= 100) { AchievementManager.Unlock("exploration_magicien"); } } public static void RecordDamage() { if (entryEntranceId.HasValue) { tookDamageInside = true; } } public static void ResetVisit() { entryEntranceId = null; tookDamageInside = false; ExplorationDurationTracker.ResetFacilityVisit(); ExplorationEquipmentTracker.ResetFacilityVisit(); } } public static class ExplorationRunTracker { private static readonly HashSet<string> RunMoons = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private static readonly HashSet<string> RunFreeMoons = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private static readonly HashSet<string> MoonsWithoutDeath = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private const string RunMoonsSaveKey = "LethalLegends_RunMoons"; private const string MoonsWithoutDeathSaveKey = "LethalLegends_MoonsWithoutDeath"; private static string? activeSaveFile; private static bool sessionInitialized; private static bool isDirty; private const string EclipsedDaysSaveKey = "LethalLegends_EclipsedDaysWithoutDeath"; private static long eclipsedDaysWithoutDeath; public static void RecordLanding(string moonName) { if (!sessionInitialized) { InitializeSession(); } bool flag = MoonCatalog.IsFree(moonName); bool flag2 = MoonCatalog.IsPaid(moonName); if (flag || flag2) { if (flag2) { AchievementManager.Unlock("exploration_premium"); } bool flag3 = RunMoons.Add(moonName); if (flag) { flag3 |= RunFreeMoons.Add(moonName); } if (flag3 | MoonsWithoutDeath.Add(moonName)) { isDirty = true; UpdateProgress(); } } } private static void UpdateProgress() { AchievementProgressManager.SetCounter("exploration.run_unique_moons_count", RunMoons.Count); AchievementProgressManager.SetCounter("exploration.run_free_moons_count", RunFreeMoons.Count); AchievementProgressManager.SetCounter("exploration.moons_without_death_count", MoonsWithoutDeath.Count); AchievementProgressManager.SetCounter("exploration.eclipsed_days_without_death", eclipsedDaysWithoutDeath); } private static void CheckAchievements() { if (RunMoons.Count >= 5) { AchievementManager.Unlock("exploration_tour_du_monde"); } if (RunFreeMoons.Count >= 6) { AchievementManager.Unlock("exploration_sale_pauvre"); } if (RunMoons.Count >= 11) { AchievementManager.Unlock("exploration_vers_l_infini"); } if (MoonsWithoutDeath.Count >= 3) { AchievementManager.Unlock("exploration_quota_parfait"); } if (MoonsWithoutDeath.Count >= 5) { AchievementManager.Unlock("exploration_the_mandalorian"); } if (MoonsWithoutDeath.Count >= 11) { AchievementManager.Unlock("exploration_star_lord"); } if (eclipsedDaysWithoutDeath >= 5) { AchievementManager.Unlock("exploration_eclipse_lord"); } } public static void RecordDeath() { ExplorationWeatherTracker.RecordDeath(); if (sessionInitialized && (MoonsWithoutDeath.Count != 0 || eclipsedDaysWithoutDeath != 0L)) { MoonsWithoutDeath.Clear(); eclipsedDaysWithoutDeath = 0L; isDirty = true; AchievementProgressManager.ResetCounter("exploration.moons_without_death_count"); AchievementProgressManager.ResetCounter("exploration.eclipsed_days_without_death"); } } public static void ResetRun() { if (sessionInitialized) { isDirty = true; RunMoons.Clear(); RunFreeMoons.Clear(); MoonsWithoutDeath.Clear(); eclipsedDaysWithoutDeath = 0L; ExplorationWeatherTracker.ResetDay(); UpdateProgress(); SaveRun(); } } public static void InitializeSession() { isDirty = false; RunMoons.Clear(); RunFreeMoons.Clear(); MoonsWithoutDeath.Clear(); eclipsedDaysWithoutDeath = 0L; ExplorationWeatherTracker.ResetDay(); activeSaveFile = null; sessionInitialized = true; StartOfRound instance = StartOfRound.Instance; GameNetworkManager instance2 = GameNetworkManager.Instance; if ((Object)(object)instance != (Object)null && (Object)(object)instance2 != (Object)null && ((NetworkBehaviour)instance).IsHost && !instance.isChallengeFile && !string.IsNullOrWhiteSpace(instance2.currentSaveFileName)) { activeSaveFile = instance2.currentSaveFileName; try { RunMoons.UnionWith(ES3.Load<string[]>("LethalLegends_RunMoons", activeSaveFile, Array.Empty<string>())); MoonsWithoutDeath.UnionWith(ES3.Load<string[]>("LethalLegends_MoonsWithoutDeath", activeSaveFile, Array.Empty<string>())); eclipsedDaysWithoutDeath = ES3.Load<long>("LethalLegends_EclipsedDaysWithoutDeath", activeSaveFile, 0L); foreach (string runMoon in RunMoons) { if (MoonCatalog.IsFree(runMoon)) { RunFreeMoons.Add(runMoon); } } } catch (Exception ex) { RunMoons.Clear(); RunFreeMoons.Clear(); MoonsWithoutDeath.Clear(); eclipsedDaysWithoutDeath = 0L; activeSaveFile = null; LethalLegendsPlugin.Log.LogWarning((object)("[EXPLORATION][RUN] Load failed: " + ex.Message)); } } UpdateProgress(); CheckAchievements(); } public static void SaveRun() { if (!isDirty || !sessionInitialized || activeSaveFile == null) { return; } StartOfRound instance = StartOfRound.Instance; GameNetworkManager instance2 = GameNetworkManager.Instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance2 == (Object)null || !((NetworkBehaviour)instance).IsHost || instance2.currentSaveFileName != activeSaveFile) { return; } try { ES3.Save<string[]>("LethalLegends_RunMoons", RunMoons.ToArray(), activeSaveFile); ES3.Save<string[]>("LethalLegends_MoonsWithoutDeath", MoonsWithoutDeath.ToArray(), activeSaveFile); ES3.Save<long>("LethalLegends_EclipsedDaysWithoutDeath", eclipsedDaysWithoutDeath, activeSaveFile); isDirty = false; } catch (Exception ex) { LethalLegendsPlugin.Log.LogWarning((object)("[EXPLORATION][RUN] Save failed: " + ex.Message)); } } public static void EndSession() { isDirty = false; sessionInitialized = false; activeSaveFile = null; RunMoons.Clear(); RunFreeMoons.Clear(); MoonsWithoutDeath.Clear(); eclipsedDaysWithoutDeath = 0L; ExplorationWeatherTracker.ResetDay(); UpdateProgress(); } public static void CommitDay() { if (!sessionInitialized) { return; } ExplorationWeatherTracker.CommitDay(); foreach (string runMoon in RunMoons) { ExplorationCollectionTracker.RecordVisitedMoon(runMoon); } CheckAchievements(); SaveRun(); } public static void RecordEclipseSurvived() { if (sessionInitialized) { eclipsedDaysWithoutDeath++; isDirty = true; AchievementProgressManager.SetCounter("exploration.eclipsed_days_without_death", eclipsedDaysWithoutDeath); } } } public static class ExplorationScrapTracker { private static readonly Dictionary<ulong, GrabbableObject> deliveredScrap = new Dictionary<ulong, GrabbableObject>(); private static string? currentMoon; private static bool dayActive; private static bool diedDuringDay; private static bool dayEnded; private static bool survivedDay; private static long deliveredValue; private static int deliveredCount; public static void BeginDay(SelectableLevel level) { ResetDay(); if (!((Object)(object)level == (Object)null) && level.spawnEnemiesAndScrap && level.planetHasTime) { currentMoon = MoonCatalog.Normalize(level.PlanetName); dayActive = true; } } public static void RecordDelivery(GrabbableObject item) { if (dayActive && !dayEnded && !((Object)(object)item == (Object)null) && item.itemProperties.isScrap && !item.scrapPersistedThroughRounds) { deliveredScrap[((NetworkBehaviour)item).NetworkObjectId] = item; PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)val != (Object)null && !val.isPlayerDead) { ScrapDeliveryTracker.RecordDelivery(val.health); } } } public static void RecordRemoval(GrabbableObject item) { if (dayActive && !dayEnded && !((Object)(object)item == (Object)null)) { deliveredScrap.Remove(((NetworkBehaviour)item).NetworkObjectId); } } public static void RecordDeath() { if (dayActive) { diedDuringDay = true; } } public static void CaptureDayResult() { if (!dayActive || dayEnded) { return; } dayEnded = true; PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; survivedDay = (Object)(object)val != (Object)null && !val.isPlayerDead && !diedDuringDay; foreach (GrabbableObject value in deliveredScrap.Values) { if (!((Object)(object)value == (Object)null) && value.isInShipRoom) { deliveredCount++; deliveredValue += Math.Max(0, value.scrapValue); } } } public static void CommitDay() { if (!dayActive || !dayEnded) { return; } ScrapDeliveryTracker.CommitDay(deliveredValue, survivedDay); if (survivedDay && deliveredCount > 0 && currentMoon != null) { ExplorationCollectionTracker.RecordScrapMoon(currentMoon); if (deliveredValue >= 500) { if (string.Equals(currentMoon, "Titan", StringComparison.OrdinalIgnoreCase)) { AchievementManager.Unlock("exploration_ackerman"); } if (string.Equals(currentMoon, "Artifice", StringComparison.OrdinalIgnoreCase)) { AchievementManager.Unlock("exploration_rambo"); } } } LegendaryDayTracker.CommitDay(deliveredCount, deliveredValue, survivedDay); ResetDay(); } public static void ResetDay() { deliveredScrap.Clear(); currentMoon = null; dayActive = false; dayEnded = false; diedDuringDay = false; deliveredValue = 0L; deliveredCount = 0; survivedDay = false; ScrapDeliveryTracker.ResetDay(); } } public static class ExplorationTracker { private static readonly Dictionary<string, string> MoonAchievements = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { { "Experimentation", "exploration_rat_de_laboratoire" }, { "Assurance", "exploration_assurance_tous_risques" }, { "Vow", "exploration_junggler" }, { "Offense", "exploration_offense" }, { "March", "exploration_martien" }, { "Adamance", "exploration_intransigeant" }, { "Rend", "exploration_rends_l_argent" }, { "Dine", "exploration_amateur_de_manoirs" }, { "Titan", "exploration_gout_de_luxe" }, { "Artifice", "exploration_14_juillet" }, { "Embrion", "exploration_baby_boss" } }; private static HashSet<string>? visitedMoons; public static void RecordLanding(SelectableLevel level) { if ((Object)(object)level == (Object)null || !level.spawnEnemiesAndScrap || !level.planetHasTime) { return; } string text = MoonCatalog.Normalize(level.PlanetName); if (!string.IsNullOrEmpty(text)) { CheckLandingAchievements(AchievementProgressManager.Increment("exploration.total_landings", 1L)); ExplorationRunTracker.RecordLanding(text); if (MoonAchievements.TryGetValue(text, out string value)) { AchievementManager.Unlock(value); RecordUniqueMoon(text); } } } private static void CheckLandingAchievements(long total) { if (total >= 1) { AchievementManager.Unlock("exploration_astronaute"); } if (total >= 10) { AchievementManager.Unlock("exploration_voyageur_spatial"); } if (total >= 100) { AchievementManager.Unlock("exploration_neil_armstrong"); } } private static void RecordUniqueMoon(string moonName) { if (visitedMoons == null) { visitedMoons = new HashSet<string>(AchievementProgressManager.GetCollection("exploration.unique_moons"), StringComparer.OrdinalIgnoreCase); } if (visitedMoons.Add(moonName)) { AchievementProgressManager.SetValue("exploration.unique_moons", string.Join(",", visitedMoons)); AchievementProgressManager.SetCounter("exploration.unique_moons_count", visitedMoons.Count); } if (MoonCatalog.ContainsAll(visitedMoons)) { AchievementManager.Unlock("exploration_globe_trotter"); } } } public static class ExplorationWeatherTracker { private static HashSet<string>? survivedPaidMoons; private static string? currentMoon; private static bool dayActive; private static bool isEclipsed; private static bool leftShip; private static bool diedDuringDay; private static bool survivedDay; private static bool dayEnded; public static void BeginDay(SelectableLevel level) { ResetDay(); if (!((Object)(object)level == (Object)null) && level.spawnEnemiesAndScrap && level.planetHasTime) { currentMoon = MoonCatalog.Normalize(level.PlanetName); dayActive = true; } } public static void RecordWeather(LevelWeatherType weather) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected I4, but got Unknown if (dayActive) { isEclipsed = (int)weather == 5; switch (weather - 1) { case 0: AchievementManager.Unlock("exploration_impermeable"); break; case 2: AchievementManager.Unlock("exploration_la_tete_dans_les_nuages"); break; case 1: AchievementManager.Unlock("exploration_pikachu"); break; case 4: AchievementManager.Unlock("exploration_soleil_noir"); break; case 3: AchievementManager.Unlock("exploration_tsunami"); break; } } } public static void RecordShipExit() { if (dayActive && !dayEnded && !leftShip) { leftShip = true; } } public static void RecordDeath() { if (dayActive) { diedDuringDay = true; } } public static void CaptureDayResult() { if (dayActive && !dayEnded) { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; dayEnded = true; survivedDay = (Object)(object)val != (Object)null && !val.isPlayerDead && !diedDuringDay; } } public static void CommitDay() { if (!dayActive || !dayEnded) { return; } if (survivedDay) { if (isEclipsed) { RecordEclipseSurvived(); if (leftShip) { AchievementManager.Unlock("exploration_fearless"); } } if (currentMoon != null && MoonCatalog.IsPaid(currentMoon)) { RecordPaidMoonSurvived(currentMoon); } } ResetDay(); } private static void RecordEclipseSurvived() { if (AchievementProgressManager.Increment("exploration.eclipsed_days_survived", 1L) >= 3) { AchievementManager.Unlock("exploration_shadow_walker"); } ExplorationRunTracker.RecordEclipseSurvived(); } private static void RecordPaidMoonSurvived(string moon) { if (survivedPaidMoons == null) { survivedPaidMoons = new HashSet<string>(AchievementProgressManager.GetCollection("exploration.paid_moons_survived"), StringComparer.OrdinalIgnoreCase); } if (survivedPaidMoons.Add(moon)) { AchievementProgressManager.SetValue("exploration.paid_moons_survived", string.Join(",", survivedPaidMoons)); AchievementProgressManager.SetCounter("exploration.paid_moons_survived_count", survivedPaidMoons.Count); if (MoonCatalog.ContainsAllPaid(survivedPaidMoons)) { AchievementManager.Unlock("exploration_touriste_de_luxe"); } } } public static void ResetDay() { currentMoon = null; dayActive = false; isEclipsed = false; leftShip = false; diedDuringDay = false; survivedDay = false; dayEnded = false; } } internal static class FunBoomboxTracker { private const float RequiredDuration = 300f; private static readonly Dictionary<BoomboxItem, Coroutine> ActiveBoomboxes = new Dictionary<BoomboxItem, Coroutine>(); private static readonly WaitForSeconds MusicDuration = new WaitForSeconds(300f); public static void RecordStart(BoomboxItem boombox) { if (!AchievementManager.IsUnlocked("fun_just_dance")) { AchievementManager.Unlock("fun_just_dance"); } if (!AchievementManager.IsUnlocked("fun_spotify") && !((Object)(object)boombox == (Object)null) && !((Object)(object)StartOfRound.Instance == (Object)null)) { RecordStop(boombox