Decompiled source of PeakChallengeMod v1.0.3

PeakChallengeMod.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using PeakChallengeMod.Managers;
using PeakChallengeMod.Models;
using PeakChallengeMod.UI;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using Zorro.Core;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("PeakChallengeMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Mod de défis et malus (Permanents, Temporaires aux feux de camp, Principaux, Généraux, Alimentaires, RP) pour PEAK")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: AssemblyInformationalVersion("1.0.3")]
[assembly: AssemblyProduct("PeakChallengeMod")]
[assembly: AssemblyTitle("PeakChallengeMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.3.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace PeakChallengeMod
{
	[BepInPlugin("com.peak.challengemod", "PEAK Challenge & Malus Mod", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "com.peak.challengemod";

		public const string PluginName = "PEAK Challenge & Malus Mod";

		public const string PluginVersion = "1.0.0";

		private Harmony _harmony;

		private GameObject _uiRootObject;

		public static ManualLogSource Log { get; private set; }

		private void Awake()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"Chargement de PEAK Challenge & Malus Mod v1.0.0...");
			ChallengeCatalog.Initialize();
			NetworkSyncManager.Initialize();
			_harmony = new Harmony("com.peak.challengemod");
			_harmony.PatchAll();
			SakuraSanctuaryCompat.Initialize(_harmony);
			_uiRootObject = new GameObject("PeakChallengeMod_Manager");
			Object.DontDestroyOnLoad((Object)(object)_uiRootObject);
			((Object)_uiRootObject).hideFlags = (HideFlags)61;
			_uiRootObject.AddComponent<ChallengeModRunner>();
			_uiRootObject.AddComponent<ChallengeConfigUI>();
			_uiRootObject.AddComponent<ChallengeRevealAnimUI>();
			_uiRootObject.AddComponent<ActiveChallengesHudUI>();
			Log.LogInfo((object)"PEAK Challenge & Malus Mod chargé avec succès ! Appuyez sur F3 en jeu pour ouvrir le menu de configuration.");
		}
	}
	public class ChallengeModRunner : MonoBehaviour
	{
		private void Update()
		{
			NetworkSyncManager.EnsureRegistered();
			ActiveChallengeTracker.Update();
		}
	}
}
namespace PeakChallengeMod.UI
{
	public class ActiveChallengesHudUI : MonoBehaviour
	{
		private bool _hudVisible = true;

		private GUIStyle _boxTitleStyle;

		private GUIStyle _itemStyle;

		private GUIStyle _alertStyle;

		private Texture2D _hudBgTex;

		public static ActiveChallengesHudUI Instance { get; private set; }

		private void Awake()
		{
			Instance = this;
		}

		public void ShowHud()
		{
			_hudVisible = true;
		}

		private void Update()
		{
			if (Keyboard.current != null && ((ButtonControl)Keyboard.current.f7Key).wasPressedThisFrame)
			{
				_hudVisible = !_hudVisible;
			}
		}

		private void EnsureStyles()
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			//IL_00a6: 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_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_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Expected O, but got Unknown
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Expected O, but got Unknown
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			if ((Object)(object)_hudBgTex == (Object)null)
			{
				Color[] array = (Color[])(object)new Color[4];
				for (int i = 0; i < 4; i++)
				{
					array[i] = new Color(0.05f, 0.06f, 0.09f, 0.78f);
				}
				_hudBgTex = new Texture2D(2, 2);
				_hudBgTex.SetPixels(array);
				_hudBgTex.Apply();
			}
			if (_boxTitleStyle == null)
			{
				_boxTitleStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 21,
					fontStyle = (FontStyle)1,
					richText = true
				};
				_boxTitleStyle.normal.textColor = Color.white;
				_itemStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 18,
					richText = true,
					wordWrap = true
				};
				_itemStyle.normal.textColor = new Color(0.92f, 0.92f, 0.92f, 1f);
				_alertStyle = new GUIStyle(GUI.skin.label)
				{
					alignment = (TextAnchor)4,
					fontSize = 24,
					fontStyle = (FontStyle)1,
					richText = true
				};
				_alertStyle.normal.textColor = Color.white;
			}
		}

		private void OnGUI()
		{
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0492: Unknown result type (might be due to invalid IL or missing references)
			//IL_0499: Expected O, but got Unknown
			//IL_04fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0972: Unknown result type (might be due to invalid IL or missing references)
			//IL_099a: Unknown result type (might be due to invalid IL or missing references)
			//IL_056f: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a5b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0637: Unknown result type (might be due to invalid IL or missing references)
			//IL_063c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0648: Unknown result type (might be due to invalid IL or missing references)
			//IL_0901: Unknown result type (might be due to invalid IL or missing references)
			//IL_0911: Expected O, but got Unknown
			Character localCharacter = Character.localCharacter;
			if ((Object)(object)localCharacter == (Object)null || localCharacter.inAirport || !ActiveChallengeTracker.IsInActiveRun)
			{
				return;
			}
			EnsureStyles();
			if (ActiveChallengeTracker.ShowPickpocketIndicator)
			{
				DrawPickpocketIndicator(localCharacter);
			}
			float yamakasiRemainingSeconds = ActiveChallengeTracker.YamakasiRemainingSeconds;
			if (yamakasiRemainingSeconds > 0f && yamakasiRemainingSeconds <= 10f)
			{
				int num = Mathf.CeilToInt(yamakasiRemainingSeconds);
				float num2 = 0.75f + 0.25f * Mathf.Sin(Time.time * 10f);
				Color color = GUI.color;
				GUI.color = new Color(1f, 1f, 1f, num2);
				Rect val = new Rect(((float)Screen.width - 420f) * 0.5f, 24f, 420f, 52f);
				GUI.DrawTexture(val, (Texture)(object)_hudBgTex);
				string arg = ((num <= 3) ? "FF4444" : "FFBB33");
				GUI.Label(val, $"<color=#{arg}>YAMAKASI — Salto dans {num}s !</color>", _alertStyle);
				GUI.color = color;
			}
			float num3 = (float)Screen.height - 150f;
			float num4 = Mathf.Max(ActiveChallengeTracker.MissingBingBongPenalty, Mathf.Max(ActiveChallengeTracker.MissingBuglePenalty, ActiveChallengeTracker.MissingUltimatePenalty));
			if (num4 > 0.01f)
			{
				Rect val2 = new Rect(((float)Screen.width - 720f) * 0.5f, num3, 720f, 51f);
				GUI.DrawTexture(val2, (Texture)(object)_hudBgTex);
				string arg2 = ((ActiveChallengeTracker.MissingBingBongPenalty >= ActiveChallengeTracker.MissingBuglePenalty && ActiveChallengeTracker.MissingBingBongPenalty >= ActiveChallengeTracker.MissingUltimatePenalty) ? "BING BONG MANQUANT" : ((!(ActiveChallengeTracker.MissingBuglePenalty >= ActiveChallengeTracker.MissingUltimatePenalty)) ? "FRISBEE / NOIX DE COCO MANQUANT" : "CLAIRON (BUGLE) MANQUANT"));
				int num5 = Mathf.RoundToInt(num4 * 100f);
				GUI.Label(val2, $"<color=#FF5555>[!] {arg2} — Malus Vitesse : -{num5}%</color>", _alertStyle);
				num3 -= 60f;
			}
			if (ActiveChallengeTracker.IsHoldingCursedItem)
			{
				float num6 = 0.75f + 0.25f * Mathf.Sin(Time.time * 9f);
				Color color2 = GUI.color;
				GUI.color = new Color(1f, 1f, 1f, num6);
				Rect val3 = new Rect(((float)Screen.width - 680f) * 0.5f, num3, 680f, 51f);
				GUI.DrawTexture(val3, (Texture)(object)_hudBgTex);
				GUI.Label(val3, "<color=#FF4444>[!] OBJET MAUDIT EN MAIN (" + ActiveChallengeTracker.ActiveCursedItemName + ") — +" + ActiveChallengeTracker.ActiveCursedEffectName + " !</color>", _alertStyle);
				GUI.color = color2;
				num3 -= 60f;
			}
			if (ActiveChallengeTracker.IsNearPlaguePlayer)
			{
				float num7 = 0.75f + 0.25f * Mathf.Sin(Time.time * 9f);
				Color color3 = GUI.color;
				GUI.color = new Color(1f, 1f, 1f, num7);
				string text = ActiveChallengeTracker.ActivePesteDistance.ToString("0.#", CultureInfo.InvariantCulture);
				Rect val4 = new Rect(((float)Screen.width - 740f) * 0.5f, num3, 740f, 51f);
				GUI.DrawTexture(val4, (Texture)(object)_hudBgTex);
				GUI.Label(val4, "<color=#66FF66>[!] PESTE PROCHE (moins de " + text + "m) — Vous subissez du Poison !</color>", _alertStyle);
				GUI.color = color3;
				num3 -= 60f;
			}
			if (ActiveChallengeTracker.IsDependanceAffectiveAlone)
			{
				float num8 = 0.75f + 0.25f * Mathf.Sin(Time.time * 9f);
				Color color4 = GUI.color;
				GUI.color = new Color(1f, 1f, 1f, num8);
				string text2 = ActiveChallengeTracker.ActiveDependanceAffectiveDistance.ToString("0.#", CultureInfo.InvariantCulture);
				Rect val5 = new Rect(((float)Screen.width - 790f) * 0.5f, num3, 790f, 51f);
				GUI.DrawTexture(val5, (Texture)(object)_hudBgTex);
				GUI.Label(val5, "<color=#FF77CC>[!] DÉPENDANCE AFFECTIVE — Rapprochez-vous d'un joueur (moins de " + text2 + "m) !</color>", _alertStyle);
				GUI.color = color4;
				num3 -= 60f;
			}
			if (!_hudVisible || ActiveChallengeTracker.LocalActiveChallenges.Count == 0 || ((Object)(object)ChallengeRevealAnimUI.Instance != (Object)null && ChallengeRevealAnimUI.Instance.IsPlayingOrDelayed))
			{
				return;
			}
			float num9 = 435f;
			float num10 = (float)Screen.width - num9 - 20f;
			float num11 = 24f;
			float contentW = num9 - 30f;
			string text3 = (ChallengeConfigUI.CanLocalPlayerOpenConfig() ? "(F3: Config | F7: Masquer)" : "(F7: Masquer)");
			GUIContent val6 = new GUIContent("<color=#FFDD44>DÉFIS ACTIFS</color> <size=15><color=#AAAAAA>" + text3 + "</color></size>");
			float num12 = Mathf.Max(33f, _boxTitleStyle.CalcHeight(val6, contentW));
			List<(string text, float height)> itemLines = new List<(string, float)>();
			float totalH = 16f + num12 + 8f;
			foreach (AssignedChallenge localActiveChallenge in ActiveChallengeTracker.LocalActiveChallenges)
			{
				Color categoryColor = ChallengeRevealAnimUI.GetCategoryColor(localActiveChallenge.Category);
				string badge = (localActiveChallenge.IsTemporary ? "<color=#FFAA44>[TEMP]</color>" : "<color=#66CCFF>[PERM]</color>");
				string targetPlayerName = ((localActiveChallenge.RequiresTargetPlayer && !string.IsNullOrEmpty(localActiveChallenge.TargetPlayerName)) ? localActiveChallenge.TargetPlayerName : null);
				string text4 = localActiveChallenge.Name;
				if (localActiveChallenge.ChallengeId == "main_adorateur_scoutmaster" && ActiveChallengeTracker.HasScoutmasterSpeedBoost)
				{
					text4 += " <color=#44FF88>(+15% Vitesse)</color>";
				}
				AddHudChallengeEntry(badge, categoryColor, text4, localActiveChallenge.Description, localActiveChallenge.IsCancelled, targetPlayerName, localActiveChallenge.ChallengeId == "gen_jumeau_a_vie", localActiveChallenge.IsCompleted);
				if (!string.IsNullOrEmpty(localActiveChallenge.BonusSubChallengeId))
				{
					ChallengeDefinition byId = ChallengeCatalog.GetById(localActiveChallenge.BonusSubChallengeId);
					string name = ((!string.IsNullOrEmpty(localActiveChallenge.BonusSubChallengeName)) ? localActiveChallenge.BonusSubChallengeName : (byId?.Name ?? localActiveChallenge.BonusSubChallengeId));
					string description = ((!string.IsNullOrEmpty(localActiveChallenge.BonusSubChallengeDescription)) ? localActiveChallenge.BonusSubChallengeDescription : (byId?.Description ?? ""));
					Color categoryColor2 = ChallengeRevealAnimUI.GetCategoryColor(byId?.Category ?? localActiveChallenge.BonusSubChallengeCategory);
					string badge2 = "<color=#FF5555>[SACRIFICIEL]</color>";
					AddHudChallengeEntry(badge2, categoryColor2, name, description, localActiveChallenge.IsCancelled, null);
				}
			}
			List<(string, float)> list = new List<(string, float)>();
			if (ChallengeCatalog.Config.ShowOtherPlayersChallengesInHud && ActiveChallengeTracker.AllPlayerAssignments.Count > 1)
			{
				int localActorNumber = ActiveChallengeTracker.GetLocalActorNumber();
				foreach (KeyValuePair<int, List<AssignedChallenge>> allPlayerAssignment in ActiveChallengeTracker.AllPlayerAssignments)
				{
					if (allPlayerAssignment.Key == localActorNumber)
					{
						continue;
					}
					string value;
					string text5 = (ActiveChallengeTracker.PlayerNamesByActor.TryGetValue(allPlayerAssignment.Key, out value) ? value : $"Scout #{allPlayerAssignment.Key}");
					List<string> list2 = new List<string>();
					foreach (AssignedChallenge item in allPlayerAssignment.Value)
					{
						string text6 = item.Name;
						if (item.ChallengeId == "gen_objet_maudit" && !string.IsNullOrEmpty(item.CursedItemName))
						{
							text6 = text6 + " (" + item.CursedItemName + " → " + item.AssignedEffectName + ")";
						}
						else if (item.ChallengeId == "gen_masochiste" && !string.IsNullOrEmpty(item.AssignedEffectName))
						{
							text6 = text6 + " (" + item.AssignedEffectName + ")";
						}
						list2.Add(text6);
						if (!string.IsNullOrEmpty(item.BonusSubChallengeName))
						{
							string text7 = item.BonusSubChallengeName;
							if (item.BonusSubChallengeId == "gen_objet_maudit" && !string.IsNullOrEmpty(item.CursedItemName))
							{
								text7 = text7 + " (" + item.CursedItemName + " → " + item.AssignedEffectName + ")";
							}
							else if (item.BonusSubChallengeId == "gen_masochiste" && !string.IsNullOrEmpty(item.AssignedEffectName))
							{
								text7 = text7 + " (" + item.AssignedEffectName + ")";
							}
							list2.Add(text7 + " (Sacrificiel)");
						}
					}
					string text8 = string.Join(", ", list2);
					string text9 = "<color=#AAD4FF><b>" + text5 + " :</b></color> <size=16>" + text8 + "</size>";
					float num13 = Mathf.Max(54f, _itemStyle.CalcHeight(new GUIContent(text9), contentW) + 4f);
					list.Add((text9, num13));
					totalH += num13 + 6f;
				}
			}
			GUI.DrawTexture(new Rect(num10, num11, num9, totalH + 6f), (Texture)(object)_hudBgTex);
			GUI.Label(new Rect(num10 + 15f, num11 + 10f, contentW, num12), val6, _boxTitleStyle);
			float num14 = num11 + 14f + num12 + 6f;
			foreach (var item2 in itemLines)
			{
				GUI.Label(new Rect(num10 + 15f, num14, contentW, item2.height), item2.text, _itemStyle);
				num14 += item2.height + 6f;
			}
			foreach (var item3 in list)
			{
				GUI.Label(new Rect(num10 + 15f, num14, contentW, item3.Item2), item3.Item1, _itemStyle);
				num14 += item3.Item2 + 6f;
			}
			void AddHudChallengeEntry(string text14, Color catColor, string text15, string text19, bool isCancelled, string text16, bool isTwin = false, bool isCompleted = false)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_0101: Expected O, but got Unknown
				string text10 = ColorUtility.ToHtmlStringRGB(catColor);
				string text11 = (isCancelled ? "<s><color=#777777>" : "");
				string text12 = (isCancelled ? "</color></s> <color=#44FF44>(ANNULÉ)</color>" : (isCompleted ? " <color=#44FF44>(VALIDÉ)</color>" : ""));
				string text13 = text14 + " " + text11 + "<color=#" + text10 + "><b>" + text15 + "</b></color>" + text12;
				if (!string.IsNullOrEmpty(text16))
				{
					string text17 = (isTwin ? "Jumeau" : "Cible");
					text13 = text13 + " — <color=#00FF99>" + text17 + " : " + text16 + "</color>";
				}
				string text18 = (isCompleted ? "<color=#44FF44><b>Défi validé !</b></color>" : text19);
				text13 = text13 + "\n<size=16><color=#CCCCCC>" + text18 + "</color></size>";
				float num15 = Mathf.Max(78f, _itemStyle.CalcHeight(new GUIContent(text13), contentW) + 6f);
				itemLines.Add((text13, num15));
				totalH += num15 + 6f;
			}
		}

		private void DrawPickpocketIndicator(Character localChar)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			float num = 0.65f + 0.35f * Mathf.Sin(Time.time * 6f);
			Color color = GUI.color;
			GUI.color = new Color(1f, 1f, 1f, num);
			Rect val = new Rect(((float)Screen.width - 690f) * 0.5f, 90f, 690f, 54f);
			GUI.DrawTexture(val, (Texture)(object)_hudBgTex);
			GUI.Label(val, "<color=#FFCC00>[PICKPOCKET ACTIF] Vole un objet dans le sac d'un coéquipier !</color>", _alertStyle);
			if ((Object)(object)Camera.main != (Object)null && Character.AllCharacters != null)
			{
				Character val2 = null;
				float num2 = float.MaxValue;
				foreach (Character allCharacter in Character.AllCharacters)
				{
					if (!((Object)(object)allCharacter == (Object)null) && !((Object)(object)allCharacter == (Object)(object)localChar) && !allCharacter.isBot && !ActiveChallengeTracker.IsCharacterDeadOrDown(allCharacter))
					{
						float num3 = Vector3.Distance(localChar.Center, allCharacter.Center);
						if (num3 < num2)
						{
							num2 = num3;
							val2 = allCharacter;
						}
					}
				}
				if ((Object)(object)val2 != (Object)null)
				{
					Vector3 val3 = (((Object)(object)val2.refs?.backpackTransform != (Object)null) ? val2.refs.backpackTransform.position : (val2.Center + Vector3.up * 0.5f));
					Vector3 val4 = Camera.main.WorldToScreenPoint(val3);
					if (val4.z > 0f)
					{
						float num4 = val4.x - 105f;
						float num5 = (float)Screen.height - val4.y - 36f;
						Rect val5 = new Rect(num4, num5, 210f, 42f);
						GUI.DrawTexture(val5, (Texture)(object)_hudBgTex);
						GUI.Label(val5, $"<color=#FFDD00>[SAC] ({num2:0.0}m)</color>", _alertStyle);
					}
				}
			}
			GUI.color = color;
		}
	}
	public class ChallengeConfigUI : MonoBehaviour
	{
		private ChallengeCategory _selectedTab;

		private Vector2 _scrollPos = Vector2.zero;

		private string _newRpName = "";

		private string _newRpDesc = "";

		private ChallengeDurationMode _newRpDuration = ChallengeDurationMode.Temporary;

		private bool _newRpUnique = true;

		private bool _newRpRequiresTarget;

		private string _wheelResultText = "";

		private float _wheelSpinEndTime;

		private string _openCategoryDropdownId;

		private bool _openMasochisteEffectDropdown;

		private GUIStyle _centeredRichLabelStyle;

		private bool _isEditingCursedBlacklist;

		private string _cursedItemSearchFilter = "";

		private string _customBlacklistItemInput = "";

		private Vector2 _cursedItemScrollPos = Vector2.zero;

		private bool _isEditingPickpocketBlacklist;

		private string _pickpocketItemSearchFilter = "";

		private string _customPickpocketBlacklistInput = "";

		private Vector2 _pickpocketItemScrollPos = Vector2.zero;

		private Rect _windowRect = new Rect(30f, 15f, 880f, 700f);

		private const float UI_SCALE = 2f;

		private bool _cursorAcquired;

		private CursorLockMode _previousCursorLock = (CursorLockMode)1;

		private bool _previousCursorVisible;

		public static ChallengeConfigUI Instance { get; private set; }

		public bool IsOpen { get; private set; }

		private void Awake()
		{
			Instance = this;
		}

		private void OnDisable()
		{
			Close();
		}

		private void OnDestroy()
		{
			Close();
			if ((Object)(object)Instance == (Object)(object)this)
			{
				Instance = null;
			}
		}

		public static bool CanLocalPlayerOpenConfig()
		{
			if (PhotonNetwork.InRoom)
			{
				return PhotonNetwork.IsMasterClient;
			}
			return true;
		}

		public void Open()
		{
			if (!IsOpen)
			{
				IsOpen = true;
				AcquireCursor();
			}
		}

		public void Close()
		{
			if (IsOpen)
			{
				IsOpen = false;
				ReleaseCursor();
			}
		}

		private void AcquireCursor()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (!_cursorAcquired)
			{
				_previousCursorLock = Cursor.lockState;
				_previousCursorVisible = Cursor.visible;
				_cursorAcquired = true;
			}
			Cursor.lockState = (CursorLockMode)0;
			Cursor.visible = true;
		}

		private void ReleaseCursor()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			if (_cursorAcquired)
			{
				_cursorAcquired = false;
				if (!((Object)(object)GUIManager.instance != (Object)null) || !GUIManager.instance.windowShowingCursor)
				{
					Cursor.lockState = _previousCursorLock;
					Cursor.visible = _previousCursorVisible;
				}
			}
		}

		private void Update()
		{
			if (!CanLocalPlayerOpenConfig())
			{
				if (IsOpen)
				{
					Close();
				}
			}
			else if (Keyboard.current != null && ((ButtonControl)Keyboard.current.f3Key).wasPressedThisFrame)
			{
				if (IsOpen)
				{
					Close();
				}
				else
				{
					Open();
				}
			}
		}

		private void OnGUI()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Expected O, but got Unknown
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			if (IsOpen)
			{
				Matrix4x4 matrix = GUI.matrix;
				float num = ((float)Screen.width - 20f) / 880f;
				float num2 = ((float)Screen.height - 20f) / 700f;
				float num3 = Mathf.Min(new float[3] { 2f, num, num2 });
				if (num3 < 1f)
				{
					num3 = 1f;
				}
				GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(num3, num3, 1f));
				GUI.backgroundColor = new Color(0.12f, 0.13f, 0.18f, 0.98f);
				_windowRect = GUI.Window(94821, _windowRect, new WindowFunction(DrawConfigWindow), "PEAK — CONFIGURATION DES DÉFIS & MALUS (F3 pour fermer)");
				GUI.matrix = matrix;
			}
		}

		private void DrawConfigWindow(int windowID)
		{
			//IL_0029: 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_0539: Unknown result type (might be due to invalid IL or missing references)
			//IL_0557: Unknown result type (might be due to invalid IL or missing references)
			//IL_055c: Unknown result type (might be due to invalid IL or missing references)
			//IL_186f: Unknown result type (might be due to invalid IL or missing references)
			//IL_078b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0790: Unknown result type (might be due to invalid IL or missing references)
			//IL_0797: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a3: Expected O, but got Unknown
			//IL_07e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_07fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_098e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b09: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a66: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a6b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a81: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ba9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bc4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b91: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b96: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b9d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ba9: Expected O, but got Unknown
			//IL_0ac4: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d10: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d15: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d2b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cf8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cfd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d04: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d10: Expected O, but got Unknown
			//IL_0b61: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a38: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e7f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e84: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e9a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e67: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e6c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e73: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e7f: Expected O, but got Unknown
			//IL_0cc8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e37: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fa6: Unknown result type (might be due to invalid IL or missing references)
			//IL_11c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_11ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_11eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_1239: Unknown result type (might be due to invalid IL or missing references)
			//IL_10c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_10c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_10e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_1123: Unknown result type (might be due to invalid IL or missing references)
			RunChallengeConfig config = ChallengeCatalog.Config;
			if (_isEditingCursedBlacklist)
			{
				DrawCursedItemBlacklistEditor(config);
				GUI.DragWindow(new Rect(0f, 0f, 10000f, 24f));
				return;
			}
			if (_isEditingPickpocketBlacklist)
			{
				DrawPickpocketBlacklistEditor(config);
				GUI.DragWindow(new Rect(0f, 0f, 10000f, 24f));
				return;
			}
			GUILayout.Space(6f);
			GUILayout.BeginVertical(GUIStyle.op_Implicit("box"), Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("<b>PARAMÈTRES GÉNÉRAUX DE LA RUN</b>", Array.Empty<GUILayoutOption>());
			GUILayout.Space(20f);
			if (GUILayout.Button(config.DrawByCategory ? "Mode de Tirage : <b>PAR CATÉGORIE (4 Catégories)</b>" : "Mode de Tirage : <b>GLOBAL (Toutes catégories)</b>", (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(330f),
				GUILayout.Height(24f)
			}))
			{
				config.DrawByCategory = !config.DrawByCategory;
				ChallengeCatalog.SaveConfig();
			}
			GUILayout.FlexibleSpace();
			bool flag = GUILayout.Toggle(config.ShowOtherPlayersChallengesInHud, " Voir les défis des alliés dans le HUD", Array.Empty<GUILayoutOption>());
			if (flag != config.ShowOtherPlayersChallengesInHud)
			{
				config.ShowOtherPlayersChallengesInHud = flag;
				ChallengeCatalog.SaveConfig();
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(4f);
			if (!config.DrawByCategory)
			{
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label($"Défis PERMANENTS par joueur : <b>{config.PermanentChallengesPerPlayer}</b>", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(250f) });
				if (GUILayout.Button("-", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(32f) }))
				{
					config.PermanentChallengesPerPlayer = Mathf.Max(0, config.PermanentChallengesPerPlayer - 1);
					ChallengeCatalog.SaveConfig();
				}
				if (GUILayout.Button("+", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(32f) }))
				{
					config.PermanentChallengesPerPlayer = Mathf.Min(10, config.PermanentChallengesPerPlayer + 1);
					ChallengeCatalog.SaveConfig();
				}
				GUILayout.Space(40f);
				GUILayout.Label($"Défis TEMPORAIRES (Feu de camp) : <b>{config.TemporaryChallengesPerPlayer}</b>", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(270f) });
				if (GUILayout.Button("-", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(32f) }))
				{
					config.TemporaryChallengesPerPlayer = Mathf.Max(0, config.TemporaryChallengesPerPlayer - 1);
					ChallengeCatalog.SaveConfig();
				}
				if (GUILayout.Button("+", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(32f) }))
				{
					config.TemporaryChallengesPerPlayer = Mathf.Min(10, config.TemporaryChallengesPerPlayer + 1);
					ChallengeCatalog.SaveConfig();
				}
				GUILayout.FlexibleSpace();
				GUILayout.EndHorizontal();
			}
			else
			{
				DrawCategoryCountRow(config, isTemporary: false, "PERMANENTS par catégorie :");
				DrawCategoryCountRow(config, isTemporary: true, "TEMPORAIRES (Feu) par cat. :");
			}
			GUILayout.EndVertical();
			GUILayout.Space(6f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			DrawTabButton(ChallengeCategory.Main, "[1] Défis Principaux");
			DrawTabButton(ChallengeCategory.General, "[2] Défis Généraux");
			DrawTabButton(ChallengeCategory.Food, "[3] Régime Alimentaire");
			DrawTabButton(ChallengeCategory.RP, "[4] Défis R.P.");
			GUILayout.EndHorizontal();
			GUILayout.Space(4f);
			List<ChallengeDefinition> list = config.Challenges.Where((ChallengeDefinition c) => c.Category == _selectedTab).ToList();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label($"<b>Liste : {GetShortCategoryLabel(_selectedTab)} ({list.Count((ChallengeDefinition c) => c.Enabled)}/{list.Count} actifs)</b>", Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			if (GUILayout.Button("Tirer 1 Permanent (" + GetShortCategoryLabel(_selectedTab) + ")", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(195f) }))
			{
				if ((Object)(object)Character.localCharacter != (Object)null && Character.localCharacter.inAirport)
				{
					_wheelResultText = "[!] Impossible dans l'aéroport (les défis s'activent sur l'île !)";
				}
				else
				{
					NetworkSyncManager.BroadcastSingleCategoryChallenges(_selectedTab, asTemporary: false);
				}
			}
			if (GUILayout.Button("Tirer 1 Temporaire (" + GetShortCategoryLabel(_selectedTab) + ")", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(195f) }))
			{
				if ((Object)(object)Character.localCharacter != (Object)null && Character.localCharacter.inAirport)
				{
					_wheelResultText = "[!] Impossible dans l'aéroport (les défis s'activent sur l'île !)";
				}
				else
				{
					NetworkSyncManager.BroadcastSingleCategoryChallenges(_selectedTab, asTemporary: true);
				}
			}
			if (GUILayout.Button("Tout activer", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(105f) }))
			{
				foreach (ChallengeDefinition item in list)
				{
					item.Enabled = true;
				}
				ChallengeCatalog.SaveConfig();
			}
			if (GUILayout.Button("Tout désactiver", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(115f) }))
			{
				foreach (ChallengeDefinition item2 in list)
				{
					item2.Enabled = false;
				}
				ChallengeCatalog.SaveConfig();
			}
			GUILayout.EndHorizontal();
			float num = ((_selectedTab != ChallengeCategory.RP) ? (config.DrawByCategory ? 360f : 380f) : (config.DrawByCategory ? 255f : 275f));
			_scrollPos = GUILayout.BeginScrollView(_scrollPos, GUIStyle.op_Implicit("box"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(num) });
			foreach (ChallengeDefinition item3 in list)
			{
				GUILayout.BeginVertical(GUIStyle.op_Implicit("box"), Array.Empty<GUILayoutOption>());
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				bool flag2 = GUILayout.Toggle(item3.Enabled, " <b>" + item3.Name + "</b>", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(195f) });
				if (flag2 != item3.Enabled)
				{
					item3.Enabled = flag2;
					ChallengeCatalog.SaveConfig();
				}
				bool flag3 = _openCategoryDropdownId == item3.Id;
				if (GUILayout.Button("Cat : " + GetShortCategoryLabel(item3.Category) + " " + (flag3 ? "▲" : "▼"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(145f) }))
				{
					_openCategoryDropdownId = (flag3 ? null : item3.Id);
				}
				if (GUILayout.Button((item3.DurationMode == ChallengeDurationMode.Permanent) ? "Durée : PERMANENT" : ((item3.DurationMode == ChallengeDurationMode.Temporary) ? "Durée : TEMPORAIRE" : "Durée : LES DEUX"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) }))
				{
					item3.DurationMode = (ChallengeDurationMode)((int)(item3.DurationMode + 1) % 3);
					ChallengeCatalog.SaveConfig();
				}
				if (GUILayout.Button(item3.IsUnique ? "UNIQUE" : "MULTI-JOUEURS", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) }))
				{
					item3.IsUnique = !item3.IsUnique;
					ChallengeCatalog.SaveConfig();
				}
				if (item3.IsBaseOrCustomRP && GUILayout.Button(item3.RequiresTargetPlayer ? "Cible : OUI" : "Cible : NON", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(125f) }))
				{
					item3.RequiresTargetPlayer = !item3.RequiresTargetPlayer;
					ChallengeCatalog.SaveConfig();
				}
				if (item3.Id == "main_fardeau_sacre" || item3.Id == "main_barde" || item3.Id == "main_ultimate")
				{
					if (_centeredRichLabelStyle == null)
					{
						_centeredRichLabelStyle = new GUIStyle(GUI.skin.label)
						{
							alignment = (TextAnchor)4,
							richText = true
						};
					}
					float num2 = ((item3.Id == "main_fardeau_sacre") ? config.FardeauSacreSpeedPenalty : ((item3.Id == "main_barde") ? config.BardeSpeedPenalty : config.UltimateSpeedPenalty));
					Color backgroundColor = GUI.backgroundColor;
					GUI.backgroundColor = new Color(0.88f, 0.42f, 0.32f, 1f);
					if (GUILayout.Button("-", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(28f) }))
					{
						float num3 = Mathf.Max(0f, Mathf.Round((num2 - 0.05f) * 100f) / 100f);
						if (item3.Id == "main_fardeau_sacre")
						{
							config.FardeauSacreSpeedPenalty = num3;
							ActiveChallengeTracker.SetFardeauSacreSpeedPenalty(num3);
						}
						else if (item3.Id == "main_barde")
						{
							config.BardeSpeedPenalty = num3;
							ActiveChallengeTracker.SetBardeSpeedPenalty(num3);
						}
						else
						{
							config.UltimateSpeedPenalty = num3;
							ActiveChallengeTracker.SetUltimateSpeedPenalty(num3);
						}
						ChallengeCatalog.SaveConfig();
						num2 = num3;
					}
					int num4 = Mathf.RoundToInt(num2 * 100f);
					GUILayout.Label($"<b>Malus : -{num4}%</b>", _centeredRichLabelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) });
					if (GUILayout.Button("+", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(28f) }))
					{
						float num5 = Mathf.Min(0.8f, Mathf.Round((num2 + 0.05f) * 100f) / 100f);
						if (item3.Id == "main_fardeau_sacre")
						{
							config.FardeauSacreSpeedPenalty = num5;
							ActiveChallengeTracker.SetFardeauSacreSpeedPenalty(num5);
						}
						else if (item3.Id == "main_barde")
						{
							config.BardeSpeedPenalty = num5;
							ActiveChallengeTracker.SetBardeSpeedPenalty(num5);
						}
						else
						{
							config.UltimateSpeedPenalty = num5;
							ActiveChallengeTracker.SetUltimateSpeedPenalty(num5);
						}
						ChallengeCatalog.SaveConfig();
					}
					GUI.backgroundColor = backgroundColor;
				}
				if (item3.Id == "gen_objet_maudit")
				{
					int num6 = config.CursedItemBlacklist?.Count ?? 0;
					int num7 = config.CursedEffectBlacklist?.Count ?? 0;
					Color backgroundColor2 = GUI.backgroundColor;
					GUI.backgroundColor = new Color(0.75f, 0.35f, 0.9f, 1f);
					if (GUILayout.Button($"Blacklist ({num6} obj, {num7} eff)", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(185f) }))
					{
						_isEditingCursedBlacklist = true;
						CursedItemAndEffectHelper.GetAllCatalogItems(forceRefresh: true);
					}
					GUI.backgroundColor = backgroundColor2;
				}
				if (item3.Id == "gen_pickpocket")
				{
					int num8 = config.PickpocketItemBlacklist?.Count ?? 0;
					Color backgroundColor3 = GUI.backgroundColor;
					GUI.backgroundColor = new Color(0.9f, 0.65f, 0.2f, 1f);
					if (GUILayout.Button($"Blacklist ({num8} obj)", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(185f) }))
					{
						_isEditingPickpocketBlacklist = true;
						CursedItemAndEffectHelper.GetAllCatalogItems(forceRefresh: true);
					}
					GUI.backgroundColor = backgroundColor3;
				}
				if (item3.Id == "gen_masochiste")
				{
					string effectDisplayName = CursedItemAndEffectHelper.GetEffectDisplayName(config.MasochisteEffect);
					Color backgroundColor4 = GUI.backgroundColor;
					GUI.backgroundColor = new Color(0.85f, 0.35f, 0.35f, 1f);
					if (GUILayout.Button("Effet : " + effectDisplayName + " " + (_openMasochisteEffectDropdown ? "▲" : "▼"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(185f) }))
					{
						_openMasochisteEffectDropdown = !_openMasochisteEffectDropdown;
					}
					GUI.backgroundColor = backgroundColor4;
				}
				if (item3.Id == "gen_narcoleptique")
				{
					if (_centeredRichLabelStyle == null)
					{
						_centeredRichLabelStyle = new GUIStyle(GUI.skin.label)
						{
							alignment = (TextAnchor)4,
							richText = true
						};
					}
					Color backgroundColor5 = GUI.backgroundColor;
					GUI.backgroundColor = new Color(0.58f, 0.42f, 0.92f, 1f);
					if (GUILayout.Button("-", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(28f) }))
					{
						config.NarcoleptiqueDrowsyAmount = Mathf.Max(0.05f, Mathf.Round((config.NarcoleptiqueDrowsyAmount - 0.05f) * 100f) / 100f);
						ActiveChallengeTracker.SetNarcoleptiqueDrowsyAmount(config.NarcoleptiqueDrowsyAmount);
						ChallengeCatalog.SaveConfig();
					}
					int num9 = Mathf.RoundToInt(config.NarcoleptiqueDrowsyAmount * 100f);
					GUILayout.Label($"<b>Drowsy : {num9}%</b>", _centeredRichLabelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) });
					if (GUILayout.Button("+", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(28f) }))
					{
						config.NarcoleptiqueDrowsyAmount = Mathf.Min(1f, Mathf.Round((config.NarcoleptiqueDrowsyAmount + 0.05f) * 100f) / 100f);
						ActiveChallengeTracker.SetNarcoleptiqueDrowsyAmount(config.NarcoleptiqueDrowsyAmount);
						ChallengeCatalog.SaveConfig();
					}
					GUI.backgroundColor = backgroundColor5;
				}
				if (item3.Id == "gen_peste")
				{
					if (_centeredRichLabelStyle == null)
					{
						_centeredRichLabelStyle = new GUIStyle(GUI.skin.label)
						{
							alignment = (TextAnchor)4,
							richText = true
						};
					}
					Color backgroundColor6 = GUI.backgroundColor;
					GUI.backgroundColor = new Color(0.25f, 0.75f, 0.35f, 1f);
					if (GUILayout.Button("-", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(28f) }))
					{
						config.PesteDistance = Mathf.Max(0.5f, Mathf.Round((config.PesteDistance - 0.5f) * 10f) / 10f);
						ActiveChallengeTracker.SetPesteDistance(config.PesteDistance);
						ChallengeCatalog.SaveConfig();
					}
					string text = config.PesteDistance.ToString("0.#", CultureInfo.InvariantCulture);
					GUILayout.Label("<b>Dist : " + text + "m</b>", _centeredRichLabelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(95f) });
					if (GUILayout.Button("+", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(28f) }))
					{
						config.PesteDistance = Mathf.Min(15f, Mathf.Round((config.PesteDistance + 0.5f) * 10f) / 10f);
						ActiveChallengeTracker.SetPesteDistance(config.PesteDistance);
						ChallengeCatalog.SaveConfig();
					}
					GUI.backgroundColor = backgroundColor6;
				}
				if (item3.Id == "gen_dependance_affective")
				{
					if (_centeredRichLabelStyle == null)
					{
						_centeredRichLabelStyle = new GUIStyle(GUI.skin.label)
						{
							alignment = (TextAnchor)4,
							richText = true
						};
					}
					Color backgroundColor7 = GUI.backgroundColor;
					GUI.backgroundColor = new Color(0.9f, 0.4f, 0.72f, 1f);
					if (GUILayout.Button("-", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(28f) }))
					{
						config.DependanceAffectiveDistance = Mathf.Max(0.5f, Mathf.Round((config.DependanceAffectiveDistance - 0.5f) * 10f) / 10f);
						ActiveChallengeTracker.SetDependanceAffectiveDistance(config.DependanceAffectiveDistance);
						ChallengeCatalog.SaveConfig();
					}
					string text2 = config.DependanceAffectiveDistance.ToString("0.#", CultureInfo.InvariantCulture);
					GUILayout.Label("<b>Dist : " + text2 + "m</b>", _centeredRichLabelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(95f) });
					if (GUILayout.Button("+", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(28f) }))
					{
						config.DependanceAffectiveDistance = Mathf.Min(30f, Mathf.Round((config.DependanceAffectiveDistance + 0.5f) * 10f) / 10f);
						ActiveChallengeTracker.SetDependanceAffectiveDistance(config.DependanceAffectiveDistance);
						ChallengeCatalog.SaveConfig();
					}
					GUI.backgroundColor = backgroundColor7;
				}
				if (item3.IsCustomRP && GUILayout.Button("X", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(32f) }))
				{
					ChallengeCatalog.RemoveCustomRPChallenge(item3.Id);
					GUILayout.EndHorizontal();
					GUILayout.EndVertical();
					break;
				}
				GUILayout.EndHorizontal();
				if (item3.Id == "gen_masochiste" && _openMasochisteEffectDropdown)
				{
					GUILayout.BeginVertical(GUIStyle.op_Implicit("box"), Array.Empty<GUILayoutOption>());
					GUILayout.Label("<b>Choisir l'effet reçu à la place de la Brûlure quand vos blessures sont soignées :</b>", Array.Empty<GUILayoutOption>());
					List<StatusEffectOption> masochisteEffectChoices = CursedItemAndEffectHelper.GetMasochisteEffectChoices();
					int num10 = 4;
					int num11 = masochisteEffectChoices.Count + 1;
					for (int num12 = 0; num12 < num11; num12 += num10)
					{
						GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
						for (int num13 = 0; num13 < num10 && num12 + num13 < num11; num13++)
						{
							int num14 = num12 + num13;
							string text3 = ((num14 < masochisteEffectChoices.Count) ? masochisteEffectChoices[num14].Id : "Random");
							string text4 = ((num14 < masochisteEffectChoices.Count) ? masochisteEffectChoices[num14].DisplayName : "\ud83c\udfb2 Aléatoire (Tiré au sort)");
							bool num15 = string.Equals(config.MasochisteEffect, text3, StringComparison.OrdinalIgnoreCase);
							Color backgroundColor8 = GUI.backgroundColor;
							if (num15)
							{
								GUI.backgroundColor = new Color(0.25f, 0.75f, 0.4f, 1f);
							}
							if (GUILayout.Button(num15 ? ("✓ " + text4) : text4, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(190f) }))
							{
								config.MasochisteEffect = text3;
								ChallengeCatalog.SaveConfig();
							}
							GUI.backgroundColor = backgroundColor8;
						}
						GUILayout.FlexibleSpace();
						GUILayout.EndHorizontal();
					}
					GUILayout.EndVertical();
				}
				if (flag3)
				{
					GUILayout.BeginHorizontal(GUIStyle.op_Implicit("box"), Array.Empty<GUILayoutOption>());
					GUILayout.Label("<b>Choisir la catégorie :</b>", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(145f) });
					bool flag4 = false;
					foreach (ChallengeCategory value in Enum.GetValues(typeof(ChallengeCategory)))
					{
						Color backgroundColor9 = GUI.backgroundColor;
						if (item3.Category == value)
						{
							GUI.backgroundColor = new Color(0.28f, 0.55f, 0.9f, 1f);
						}
						if (GUILayout.Button(GetShortCategoryLabel(value), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(115f) }))
						{
							_openCategoryDropdownId = null;
							if (item3.Category != value)
							{
								item3.Category = value;
								ChallengeCatalog.SaveConfig();
								flag4 = true;
							}
						}
						GUI.backgroundColor = backgroundColor9;
					}
					GUILayout.FlexibleSpace();
					GUILayout.EndHorizontal();
					if (flag4)
					{
						GUILayout.EndVertical();
						break;
					}
				}
				string text5 = item3.Description;
				if (item3.Id == "gen_peste")
				{
					string text6 = config.PesteDistance.ToString("0.#", CultureInfo.InvariantCulture);
					text5 = "Inflige du Poison sur la durée aux autres joueurs à moins de " + text6 + "m de vous, et du Poison à chaque fois qu'ils vous touchent.";
				}
				else if (item3.Id == "gen_dependance_affective")
				{
					string text7 = config.DependanceAffectiveDistance.ToString("0.#", CultureInfo.InvariantCulture);
					text5 = "Vous subissez du Poison sur la durée s'il n'y a aucun autre joueur à moins de " + text7 + "m de vous.";
				}
				else if (item3.Id == "gen_narcoleptique")
				{
					int num16 = Mathf.RoundToInt(config.NarcoleptiqueDrowsyAmount * 100f);
					text5 = $"Toutes les 2 à 4 minutes, vous subissez une vague de somnolence (+{num16}% Drowsy).";
				}
				else if (item3.Id == "main_fardeau_sacre")
				{
					int num17 = Mathf.RoundToInt(config.FardeauSacreSpeedPenalty * 100f);
					string text8 = ((num17 > 0) ? $"si on n'a pas de Bing Bong, malus de vitesse progressif jusqu'à -{num17}%" : "sans malus de vitesse");
					text5 = "Tu dois obligatoirement ramasser Bing Bong (et l'échanger contre le Bing Bong Sacré si disponible) et finir l'ascension avec lui (" + text8 + ").";
				}
				else if (item3.Id == "main_barde")
				{
					int num18 = Mathf.RoundToInt(config.BardeSpeedPenalty * 100f);
					string text9 = ((num18 > 0) ? $"si on n'a pas de Bugle, malus de vitesse progressif jusqu'à -{num18}%" : "sans malus de vitesse");
					text5 = "Tu dois conserver le Bugle (clairon) dans ton inventaire tout au long de la partie (" + text9 + ").";
				}
				else if (item3.Id == "main_ultimate")
				{
					int num19 = Mathf.RoundToInt(config.UltimateSpeedPenalty * 100f);
					string text10 = ((num19 > 0) ? $"si tu n'en as pas pendant 10s, malus de vitesse progressif jusqu'à -{num19}%" : "sans malus de vitesse");
					text5 = "Doit conserver le frisbee, et faire tomber ses camarades à la moindre occasion (variante possible avec les noix de coco ; " + text10 + ").";
				}
				GUILayout.Label("<size=11><color=#CCCCCC>" + text5 + "</color></size>", Array.Empty<GUILayoutOption>());
				GUILayout.EndVertical();
			}
			GUILayout.EndScrollView();
			if (_selectedTab == ChallengeCategory.RP)
			{
				GUILayout.BeginVertical(GUIStyle.op_Implicit("box"), Array.Empty<GUILayoutOption>());
				GUILayout.Label("<b>+ AJOUTER UN NOUVEAU DÉFI R.P. PERSONNALISÉ</b>", Array.Empty<GUILayoutOption>());
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label("Titre :", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(55f) });
				_newRpName = GUILayout.TextField(_newRpName, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(210f) });
				GUILayout.Space(10f);
				GUILayout.Label("Règle :", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
				_newRpDesc = GUILayout.TextField(_newRpDesc, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(480f) });
				GUILayout.EndHorizontal();
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				if (GUILayout.Button((_newRpDuration == ChallengeDurationMode.Permanent) ? "Durée : Permanent" : ((_newRpDuration == ChallengeDurationMode.Temporary) ? "Durée : Temporaire (Feu)" : "Durée : Les deux"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(175f) }))
				{
					_newRpDuration = (ChallengeDurationMode)((int)(_newRpDuration + 1) % 3);
				}
				_newRpUnique = GUILayout.Toggle(_newRpUnique, " Unique (1 joueur)", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) });
				_newRpRequiresTarget = GUILayout.Toggle(_newRpRequiresTarget, " Choisir un joueur aléatoirement", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(240f) });
				GUILayout.FlexibleSpace();
				if (GUILayout.Button("+ Ajouter à la liste RP", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) }) && !string.IsNullOrWhiteSpace(_newRpName))
				{
					ChallengeCatalog.AddCustomRPChallenge(_newRpName, string.IsNullOrWhiteSpace(_newRpDesc) ? "Défi RP personnalisé." : _newRpDesc, _newRpDuration, _newRpUnique, _newRpRequiresTarget);
					_newRpName = "";
					_newRpDesc = "";
				}
				GUILayout.EndHorizontal();
				GUILayout.EndVertical();
			}
			GUILayout.Space(4f);
			GUILayout.BeginHorizontal(GUIStyle.op_Implicit("box"), Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Tirer les défis de Run maintenant", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }))
			{
				if ((Object)(object)Character.localCharacter != (Object)null && Character.localCharacter.inAirport)
				{
					_wheelResultText = "[!] Impossible dans l'aéroport (les défis s'activent sur l'île !)";
				}
				else
				{
					NetworkSyncManager.BroadcastRunStartChallenges(skipRevealDelay: true);
				}
			}
			if (GUILayout.Button("Tirer nouveaux défis Temporaires (Feu)", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }) && (Object)(object)Character.localCharacter != (Object)null && !Character.localCharacter.inAirport)
			{
				NetworkSyncManager.BroadcastCampfireRefreshChallenges();
			}
			if (GUILayout.Button("Tourner la Roue d'un Joueur", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }))
			{
				List<ChallengeAssigner.SimplePlayerInfo> activePlayerList = ChallengeAssigner.GetActivePlayerList();
				if (activePlayerList.Count > 0)
				{
					ChallengeAssigner.SimplePlayerInfo simplePlayerInfo = activePlayerList[Random.Range(0, activePlayerList.Count)];
					_wheelResultText = ">> Joueur tiré : " + simplePlayerInfo.Name;
					_wheelSpinEndTime = Time.time + 1.2f;
				}
			}
			if (GUILayout.Button("Effacer tous les défis", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }))
			{
				NetworkSyncManager.BroadcastClearAllChallenges();
			}
			GUILayout.EndHorizontal();
			if (!string.IsNullOrEmpty(_wheelResultText))
			{
				if (Time.time < _wheelSpinEndTime)
				{
					List<ChallengeAssigner.SimplePlayerInfo> activePlayerList2 = ChallengeAssigner.GetActivePlayerList();
					string name = activePlayerList2[Mathf.FloorToInt(Time.time * 16f) % activePlayerList2.Count].Name;
					GUILayout.Label("<b><color=#FFCC00>>> La roue tourne : " + name + "...</color></b>", Array.Empty<GUILayoutOption>());
				}
				else
				{
					GUILayout.Label("<b><color=#00FF99>" + _wheelResultText + "</color></b>", Array.Empty<GUILayoutOption>());
				}
			}
			GUI.DragWindow(new Rect(0f, 0f, 10000f, 24f));
		}

		private void DrawTabButton(ChallengeCategory cat, string title)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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)
			Color backgroundColor = GUI.backgroundColor;
			if (_selectedTab == cat)
			{
				GUI.backgroundColor = new Color(0.28f, 0.55f, 0.9f, 1f);
			}
			if (GUILayout.Button(title, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
			{
				_selectedTab = cat;
				_openCategoryDropdownId = null;
			}
			GUI.backgroundColor = backgroundColor;
		}

		private void DrawCategoryCountRow(RunChallengeConfig cfg, bool isTemporary, string rowTitle)
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("<b>" + rowTitle + "</b>", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(195f) });
			ChallengeCategory[] array = new ChallengeCategory[4]
			{
				ChallengeCategory.Main,
				ChallengeCategory.General,
				ChallengeCategory.Food,
				ChallengeCategory.RP
			};
			foreach (ChallengeCategory cat in array)
			{
				int num = (isTemporary ? cfg.GetTemporaryForCategory(cat) : cfg.GetPermanentForCategory(cat));
				GUILayout.Label($"{GetShortCategoryLabel(cat)}: <b>{num}</b>", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(86f) });
				if (GUILayout.Button("-", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(24f) }))
				{
					int count = Mathf.Max(0, num - 1);
					if (isTemporary)
					{
						cfg.SetTemporaryForCategory(cat, count);
					}
					else
					{
						cfg.SetPermanentForCategory(cat, count);
					}
					ChallengeCatalog.SaveConfig();
				}
				if (GUILayout.Button("+", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(24f) }))
				{
					int count2 = Mathf.Min(10, num + 1);
					if (isTemporary)
					{
						cfg.SetTemporaryForCategory(cat, count2);
					}
					else
					{
						cfg.SetPermanentForCategory(cat, count2);
					}
					ChallengeCatalog.SaveConfig();
				}
				GUILayout.Space(12f);
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
		}

		private void DrawCursedItemBlacklistEditor(RunChallengeConfig cfg)
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_0893: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_092c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0931: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b00: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b05: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b1b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0966: Unknown result type (might be due to invalid IL or missing references)
			//IL_094b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b7a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a47: Unknown result type (might be due to invalid IL or missing references)
			if (cfg.CursedItemBlacklist == null)
			{
				cfg.CursedItemBlacklist = new List<string>();
			}
			if (cfg.CursedEffectBlacklist == null)
			{
				cfg.CursedEffectBlacklist = new List<string>();
			}
			GUILayout.Space(6f);
			GUILayout.BeginHorizontal(GUIStyle.op_Implicit("box"), Array.Empty<GUILayoutOption>());
			Color backgroundColor = GUI.backgroundColor;
			GUI.backgroundColor = new Color(0.28f, 0.55f, 0.9f, 1f);
			if (GUILayout.Button("← Retour aux défis", (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(175f),
				GUILayout.Height(28f)
			}))
			{
				_isEditingCursedBlacklist = false;
			}
			GUI.backgroundColor = backgroundColor;
			GUILayout.Space(16f);
			GUILayout.Label("<b>CONFIGURATION « OBJET MAUDIT » — BLACKLIST OBJETS & EFFETS</b>", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) });
			GUILayout.FlexibleSpace();
			int num = Mathf.RoundToInt(cfg.CursedItemEffectPerSecond * 100f);
			GUILayout.Label($"Intensité en main : <b>{num}% / sec</b>", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(185f) });
			if (GUILayout.Button("-", (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(28f),
				GUILayout.Height(24f)
			}))
			{
				cfg.CursedItemEffectPerSecond = Mathf.Max(0.01f, Mathf.Round((cfg.CursedItemEffectPerSecond - 0.01f) * 100f) / 100f);
				ChallengeCatalog.SaveConfig();
			}
			if (GUILayout.Button("+", (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(28f),
				GUILayout.Height(24f)
			}))
			{
				cfg.CursedItemEffectPerSecond = Mathf.Min(0.5f, Mathf.Round((cfg.CursedItemEffectPerSecond + 0.01f) * 100f) / 100f);
				ChallengeCatalog.SaveConfig();
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(6f);
			GUILayout.BeginVertical(GUIStyle.op_Implicit("box"), Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			int num2 = CursedItemAndEffectHelper.AllEffects.Count((StatusEffectOption e) => !cfg.CursedEffectBlacklist.Any((string b) => b.Equals(e.Id, StringComparison.OrdinalIgnoreCase)));
			GUILayout.Label($"<b>1. EFFETS ({num2}/{CursedItemAndEffectHelper.AllEffects.Count} autorisés — Vert = Autorisé, Rouge = Blacklisté)</b>", Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			if (GUILayout.Button("Par défaut", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }))
			{
				cfg.CursedEffectBlacklist = new List<string>(CursedItemAndEffectHelper.DefaultEffectBlacklist);
				ChallengeCatalog.SaveConfig();
			}
			if (GUILayout.Button("Tout autoriser", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(115f) }))
			{
				cfg.CursedEffectBlacklist.Clear();
				ChallengeCatalog.SaveConfig();
			}
			if (GUILayout.Button("Tout blacklister", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }))
			{
				cfg.CursedEffectBlacklist = CursedItemAndEffectHelper.AllEffects.Select((StatusEffectOption e) => e.Id).ToList();
				ChallengeCatalog.SaveConfig();
			}
			GUILayout.EndHorizontal();
			int num3 = 4;
			List<StatusEffectOption> allEffects = CursedItemAndEffectHelper.AllEffects;
			for (int num4 = 0; num4 < allEffects.Count; num4 += num3)
			{
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				for (int num5 = 0; num5 < num3 && num4 + num5 < allEffects.Count; num5++)
				{
					StatusEffectOption eff = allEffects[num4 + num5];
					bool flag = cfg.CursedEffectBlacklist.Any((string b) => b.Equals(eff.Id, StringComparison.OrdinalIgnoreCase));
					Color backgroundColor2 = GUI.backgroundColor;
					GUI.backgroundColor = (flag ? new Color(0.82f, 0.25f, 0.25f, 1f) : new Color(0.22f, 0.72f, 0.36f, 1f));
					if (GUILayout.Button(flag ? ("✗ " + eff.DisplayName + " (Banni)") : ("✓ " + eff.DisplayName), (GUILayoutOption[])(object)new GUILayoutOption[2]
					{
						GUILayout.Width(205f),
						GUILayout.Height(25f)
					}))
					{
						if (flag)
						{
							cfg.CursedEffectBlacklist.RemoveAll((string b) => b.Equals(eff.Id, StringComparison.OrdinalIgnoreCase));
						}
						else
						{
							cfg.CursedEffectBlacklist.Add(eff.Id);
						}
						ChallengeCatalog.SaveConfig();
					}
					GUI.backgroundColor = backgroundColor2;
				}
				GUILayout.FlexibleSpace();
				GUILayout.EndHorizontal();
			}
			GUILayout.EndVertical();
			GUILayout.Space(6f);
			List<CatalogItemOption> catalogItems = CursedItemAndEffectHelper.GetAllCatalogItems();
			List<CatalogItemOption> list = (string.IsNullOrWhiteSpace(_cursedItemSearchFilter) ? catalogItems : catalogItems.Where((CatalogItemOption catalogItemOption) => catalogItemOption.DisplayName.IndexOf(_cursedItemSearchFilter.Trim(), StringComparison.OrdinalIgnoreCase) >= 0 || catalogItemOption.Id.IndexOf(_cursedItemSearchFilter.Trim(), StringComparison.OrdinalIgnoreCase) >= 0).ToList());
			int num6 = catalogItems.Count((CatalogItemOption item) => !CursedItemAndEffectHelper.IsItemBlacklisted(item, cfg.CursedItemBlacklist));
			GUILayout.BeginVertical(GUIStyle.op_Implicit("box"), Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label($"<b>2. OBJETS DU JEU ({num6}/{catalogItems.Count} autorisés | {cfg.CursedItemBlacklist.Count} bannis)</b>", Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			if (GUILayout.Button("Par défaut", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(95f) }))
			{
				cfg.CursedItemBlacklist = new List<string>(CursedItemAndEffectHelper.DefaultItemBlacklist);
				ChallengeCatalog.SaveConfig();
			}
			if (GUILayout.Button("Rafraîchir", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) }))
			{
				catalogItems = CursedItemAndEffectHelper.GetAllCatalogItems(forceRefresh: true);
			}
			if (GUILayout.Button("Autoriser (filtre)", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }))
			{
				foreach (CatalogItemOption it in list)
				{
					cfg.CursedItemBlacklist.RemoveAll((string b) => b.Equals(it.Id, StringComparison.OrdinalIgnoreCase) || b.Equals(it.DisplayName, StringComparison.OrdinalIgnoreCase));
				}
				ChallengeCatalog.SaveConfig();
			}
			if (GUILayout.Button("Blacklister (filtre)", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(125f) }))
			{
				foreach (CatalogItemOption item in list)
				{
					if (!CursedItemAndEffectHelper.IsItemBlacklisted(item, cfg.CursedItemBlacklist))
					{
						cfg.CursedItemBlacklist.Add(item.Id);
					}
				}
				ChallengeCatalog.SaveConfig();
			}
			if (GUILayout.Button("Tout autoriser", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(105f) }))
			{
				cfg.CursedItemBlacklist.Clear();
				ChallengeCatalog.SaveConfig();
			}
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Rechercher :", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(85f) });
			_cursedItemSearchFilter = GUILayout.TextField(_cursedItemSearchFilter, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(240f) });
			if (GUILayout.Button("Effacer", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(65f) }))
			{
				_cursedItemSearchFilter = "";
			}
			GUILayout.Space(20f);
			GUILayout.Label("Blacklister un nom manuel :", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(175f) });
			_customBlacklistItemInput = GUILayout.TextField(_customBlacklistItemInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) });
			if (GUILayout.Button("+ Bannir", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }))
			{
				string trimmed = _customBlacklistItemInput?.Trim();
				if (!string.IsNullOrEmpty(trimmed) && !cfg.CursedItemBlacklist.Any((string b) => b.Equals(trimmed, StringComparison.OrdinalIgnoreCase)))
				{
					cfg.CursedItemBlacklist.Add(trimmed);
					ChallengeCatalog.SaveConfig();
					_customBlacklistItemInput = "";
				}
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.Space(4f);
			_cursedItemScrollPos = GUILayout.BeginScrollView(_cursedItemScrollPos, GUIStyle.op_Implicit("box"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(400f) });
			if (list.Count == 0)
			{
				GUILayout.Label("<color=#CCCCCC>Aucun objet ne correspond au filtre (ou la base d'objets n'est pas encore chargée).</color>", Array.Empty<GUILayoutOption>());
			}
			else
			{
				int num7 = 3;
				for (int num8 = 0; num8 < list.Count; num8 += num7)
				{
					GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
					for (int num9 = 0; num9 < num7 && num8 + num9 < list.Count; num9++)
					{
						CatalogItemOption itemOpt = list[num8 + num9];
						bool flag2 = CursedItemAndEffectHelper.IsItemBlacklisted(itemOpt, cfg.CursedItemBlacklist);
						Color backgroundColor3 = GUI.backgroundColor;
						GUI.backgroundColor = (flag2 ? new Color(0.82f, 0.25f, 0.25f, 1f) : new Color(0.22f, 0.72f, 0.36f, 1f));
						string text = itemOpt.DisplayName;
						if (!itemOpt.DisplayName.Equals(itemOpt.Id, StringComparison.OrdinalIgnoreCase))
						{
							text = text + " <size=10>(" + itemOpt.Id + ")</size>";
						}
						if (GUILayout.Button(flag2 ? ("✗ " + text) : ("✓ " + text), (GUILayoutOption[])(object)new GUILayoutOption[2]
						{
							GUILayout.Width(265f),
							GUILayout.Height(26f)
						}))
						{
							if (flag2)
							{
								cfg.CursedItemBlacklist.RemoveAll((string b) => b.Equals(itemOpt.Id, StringComparison.OrdinalIgnoreCase) || b.Equals(itemOpt.DisplayName, StringComparison.OrdinalIgnoreCase));
							}
							else
							{
								cfg.CursedItemBlacklist.Add(itemOpt.Id);
							}
							ChallengeCatalog.SaveConfig();
						}
						GUI.backgroundColor = backgroundColor3;
					}
					GUILayout.FlexibleSpace();
					GUILayout.EndHorizontal();
				}
			}
			List<string> list2 = cfg.CursedItemBlacklist.Where((string b) => !string.IsNullOrWhiteSpace(b) && !catalogItems.Any((CatalogItemOption catalogItemOption) => catalogItemOption.Id.Equals(b, StringComparison.OrdinalIgnoreCase) || catalogItemOption.DisplayName.Equals(b, StringComparison.OrdinalIgnoreCase))).ToList();
			if (list2.Count > 0)
			{
				GUILayout.Space(8f);
				GUILayout.Label("<b>Entrées manuelles blacklistées (cliquer pour retirer) :</b>", Array.Empty<GUILayoutOption>());
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				foreach (string manual in list2)
				{
					Color backgroundColor4 = GUI.backgroundColor;
					GUI.backgroundColor = new Color(0.82f, 0.25f, 0.25f, 1f);
					if (GUILayout.Button("✗ " + manual + " [Retirer]", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(190f) }))
					{
						cfg.CursedItemBlacklist.RemoveAll((string b) => b.Equals(manual, StringComparison.OrdinalIgnoreCase));
						ChallengeCatalog.SaveConfig();
						break;
					}
					GUI.backgroundColor = backgroundColor4;
				}
				GUILayout.FlexibleSpace();
				GUILayout.EndHorizontal();
			}
			GUILayout.EndScrollView();
			GUILayout.EndVertical();
		}

		private void DrawPickpocketBlacklistEditor(RunChallengeConfig cfg)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_050f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0514: Unknown result type (might be due to invalid IL or missing references)
			//IL_0584: Unknown result type (might be due to invalid IL or missing references)
			//IL_0589: Unknown result type (might be due to invalid IL or missing references)
			//IL_0766: Unknown result type (might be due to invalid IL or missing references)
			//IL_076b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0781: Unknown result type (might be due to invalid IL or missing references)
			//IL_05be: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06af: Unknown result type (might be due to invalid IL or missing references)
			if (cfg.PickpocketItemBlacklist == null)
			{
				cfg.PickpocketItemBlacklist = new List<string>();
			}
			GUILayout.Space(6f);
			GUILayout.BeginHorizontal(GUIStyle.op_Implicit("box"), Array.Empty<GUILayoutOption>());
			Color backgroundColor = GUI.backgroundColor;
			GUI.backgroundColor = new Color(0.28f, 0.55f, 0.9f, 1f);
			if (GUILayout.Button("← Retour aux défis", (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(175f),
				GUILayout.Height(28f)
			}))
			{
				_isEditingPickpocketBlacklist = false;
			}
			GUI.backgroundColor = backgroundColor;
			GUILayout.Space(16f);
			GUILayout.Label("<b>CONFIGURATION « PICKPOCKET » — BLACKLIST OBJETS (NE PAS VOLER)</b>", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) });
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.Space(6f);
			List<CatalogItemOption> catalogItems = CursedItemAndEffectHelper.GetAllCatalogItems();
			List<CatalogItemOption> list = (string.IsNullOrWhiteSpace(_pickpocketItemSearchFilter) ? catalogItems : catalogItems.Where((CatalogItemOption catalogItemOption) => catalogItemOption.DisplayName.IndexOf(_pickpocketItemSearchFilter.Trim(), StringComparison.OrdinalIgnoreCase) >= 0 || catalogItemOption.Id.IndexOf(_pickpocketItemSearchFilter.Trim(), StringComparison.OrdinalIgnoreCase) >= 0).ToList());
			int num = catalogItems.Count((CatalogItemOption item) => !CursedItemAndEffectHelper.IsItemBlacklisted(item, cfg.PickpocketItemBlacklist));
			GUILayout.BeginVertical(GUIStyle.op_Implicit("box"), Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label($"<b>OBJETS DU JEU ({num}/{catalogItems.Count} volables | {cfg.PickpocketItemBlacklist.Count} protégés)</b>", Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			if (GUILayout.Button("Par défaut", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(95f) }))
			{
				cfg.PickpocketItemBlacklist = new List<string>(CursedItemAndEffectHelper.DefaultPickpocketItemBlacklist);
				ActiveChallengeTracker.SetPickpocketItemBlacklist(cfg.PickpocketItemBlacklist);
				ChallengeCatalog.SaveConfig();
			}
			if (GUILayout.Button("Rafraîchir", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) }))
			{
				catalogItems = CursedItemAndEffectHelper.GetAllCatalogItems(forceRefresh: true);
			}
			if (GUILayout.Button("Autoriser (filtre)", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }))
			{
				foreach (CatalogItemOption it in list)
				{
					cfg.PickpocketItemBlacklist.RemoveAll((string b) => b.Equals(it.Id, StringComparison.OrdinalIgnoreCase) || b.Equals(it.DisplayName, StringComparison.OrdinalIgnoreCase));
				}
				ActiveChallengeTracker.SetPickpocketItemBlacklist(cfg.PickpocketItemBlacklist);
				ChallengeCatalog.SaveConfig();
			}
			if (GUILayout.Button("Blacklister (filtre)", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(125f) }))
			{
				foreach (CatalogItemOption item in list)
				{
					if (!CursedItemAndEffectHelper.IsItemBlacklisted(item, cfg.PickpocketItemBlacklist))
					{
						cfg.PickpocketItemBlacklist.Add(item.Id);
					}
				}
				ActiveChallengeTracker.SetPickpocketItemBlacklist(cfg.PickpocketItemBlacklist);
				ChallengeCatalog.SaveConfig();
			}
			if (GUILayout.Button("Tout autoriser", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(105f) }))
			{
				cfg.PickpocketItemBlacklist.Clear();
				ActiveChallengeTracker.SetPickpocketItemBlacklist(cfg.PickpocketItemBlacklist);
				ChallengeCatalog.SaveConfig();
			}
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Rechercher :", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(85f) });
			_pickpocketItemSearchFilter = GUILayout.TextField(_pickpocketItemSearchFilter, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(240f) });
			if (GUILayout.Button("Effacer", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(65f) }))
			{
				_pickpocketItemSearchFilter = "";
			}
			GUILayout.Space(20f);
			GUILayout.Label("Blacklister un nom manuel :", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(175f) });
			_customPickpocketBlacklistInput = GUILayout.TextField(_customPickpocketBlacklistInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) });
			if (GUILayout.Button("+ Bannir", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }))
			{
				string trimmed = _customPickpocketBlacklistInput?.Trim();
				if (!string.IsNullOrEmpty(trimmed) && !cfg.PickpocketItemBlacklist.Any((string b) => b.Equals(trimmed, StringComparison.OrdinalIgnoreCase)))
				{
					cfg.PickpocketItemBlacklist.Add(trimmed);
					ActiveChallengeTracker.SetPickpocketItemBlacklist(cfg.PickpocketItemBlacklist);
					ChallengeCatalog.SaveConfig();
					_customPickpocketBlacklistInput = "";
				}
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.Space(4f);
			_pickpocketItemScrollPos = GUILayout.BeginScrollView(_pickpocketItemScrollPos, GUIStyle.op_Implicit("box"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(520f) });
			if (list.Count == 0)
			{
				GUILayout.Label("<color=#CCCCCC>Aucun objet ne correspond au filtre (ou la base d'objets n'est pas encore chargée).</color>", Array.Empty<GUILayoutOption>());
			}
			else
			{
				int num2 = 3;
				for (int num3 = 0; num3 < list.Count; num3 += num2)
				{
					GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
					for (int num4 = 0; num4 < num2 && num3 + num4 < list.Count; num4++)
					{
						CatalogItemOption itemOpt = list[num3 + num4];
						bool flag = CursedItemAndEffectHelper.IsItemBlacklisted(itemOpt, cfg.PickpocketItemBlacklist);
						Color backgroundColor2 = GUI.backgroundColor;
						GUI.backgroundColor = (flag ? new Color(0.82f, 0.25f, 0.25f, 1f) : new Color(0.22f, 0.72f, 0.36f, 1f));
						string text = itemOpt.DisplayName;
						if (!itemOpt.DisplayName.Equals(itemOpt.Id, StringComparison.OrdinalIgnoreCase))
						{
							text = text + " <size=10>(" + itemOpt.Id + ")</size>";
						}
						if (GUILayout.Button(flag ? ("✗ " + text) : ("✓ " + text), (GUILayoutOption[])(object)new GUILayoutOption[2]
						{
							GUILayout.Width(265f),
							GUILayout.Height(26f)
						}))
						{
							if (flag)
							{
								cfg.PickpocketItemBlacklist.RemoveAll((string b) => b.Equals(itemOpt.Id, StringComparison.OrdinalIgnoreCase) || b.Equals(itemOpt.DisplayName, StringComparison.OrdinalIgnoreCase));
							}
							else
							{
								cfg.PickpocketItemBlacklist.Add(itemOpt.Id);
							}
							ActiveChallengeTracker.SetPickpocketItemBlacklist(cfg.PickpocketItemBlacklist);
							ChallengeCatalog.SaveConfig();
						}
						GUI.backgroundColor = backgroundColor2;
					}
					GUILayout.FlexibleSpace();
					GUILayout.EndHorizontal();
				}
			}
			List<string> list2 = cfg.PickpocketItemBlacklist.Where((string b) => !string.IsNullOrWhiteSpace(b) && !catalogItems.Any((CatalogItemOption catalogItemOption) => catalogItemOption.Id.Equals(b, StringComparison.OrdinalIgnoreCase) || catalogItemOption.DisplayName.Equals(b, StringComparison.OrdinalIgnoreCase))).ToList();
			if (list2.Count > 0)
			{
				GUILayout.Space(8f);
				GUILayout.Label("<b>Entrées manuelles blacklistées (cliquer pour retirer) :</b>", Array.Empty<GUILayoutOption>());
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				foreach (string manual in list2)
				{
					Color backgroundColor3 = GUI.backgroundColor;
					GUI.backgroundColor = new Color(0.82f, 0.25f, 0.25f, 1f);
					if (GUILayout.Button("✗ " + manual + " [Retirer]", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(190f) }))
					{
						cfg.PickpocketItemBlacklist.RemoveAll((string b) => b.Equals(manual, StringComparison.OrdinalIgnoreCase));
						ActiveChallengeTracker.SetPickpocketItemBlacklist(cfg.PickpocketItemBlacklist);
						ChallengeCatalog.SaveConfig();
						break;
					}
					GUI.backgroundColor = backgroundColor3;
				}
				GUILayout.FlexibleSpace();
				GUILayout.EndHorizontal();
			}
			GUILayout.EndScrollView();
			GUILayout.EndVertical();
		}

		private static string GetShortCategoryLabel(ChallengeCategory cat)
		{
			return cat switch
			{
				ChallengeCategory.Main => "Principal", 
				ChallengeCategory.General => "Général", 
				ChallengeCategory.Food => "Alimentaire", 
				ChallengeCategory.RP => "R.P.", 
				_ => cat.ToString(), 
			};
		}
	}
	public class ChallengeRevealAnimUI : MonoBehaviour
	{
		private bool _isPlaying;

		private float _animTime;

		private float _delayRemaining;

		private const float RUN_START_DELAY = 5f;

		private const float ROULETTE_DURATION = 2.4f;

		private const float WHEEL_TARGET_DURATION = 1.8f;

		private const float HOLD_DURATION = 4.2f;

		private bool _isCampfireRefresh;

		private List<AssignedChallenge> _challengesToReveal = new List<AssignedChallenge>();

		private List<string> _playerNamesPool = new List<string>();

		private List<string> _allChallengeNamesPool = new List<string>();

		private Dictionary<ChallengeCategory, List<string>> _categoryChallengeNamesPool = new Dictionary<ChallengeCategory, List<string>>();

		private bool _hasAnyTargetWheel;

		private bool _hasAnyReciprocalTwin;

		private GUIStyle _bannerStyle;

		private GUIStyle _cardTitleStyle;

		private GUIStyle _cardDescStyle;

		private GUIStyle _badgeStyle;

		private GUIStyle _wheelStyle;

		private Texture2D _darkBgTex;

		private Texture2D _cardBgTex;

		public static ChallengeRevealAnimUI Instance { get; private set; }

		public bool IsPlayingOrDelayed => _isPlaying;

		private void Awake()
		{
			Instance = this;
		}

		public void PlayRevealAnimation(List<AssignedChallenge> challenges, bool isCampfireRefresh, List<string> allPlayerNames, bool skipDelay = false)
		{
			if (challenges == null || challenges.Count == 0)
			{
				return;
			}
			_challengesToReveal = new List<AssignedChallenge>();
			foreach (AssignedChallenge challenge in challenges)
			{
				_challengesToReveal.Add(challenge);
				if (!string.IsNullOrEmpty(challenge.BonusSubChallengeId))
				{
					ChallengeDefinition byId = ChallengeCatalog.GetById(challenge.BonusSubChallengeId);
					string name = ((!string.IsNullOrEmpty(challenge.BonusSubChallengeName)) ? challenge.BonusSubChallengeName : (byId?.Name ?? challenge.BonusSubChallengeId));
					string description = ((!string.IsNullOrEmpty(challenge.BonusSubChallengeDescription)) ? challenge.BonusSubChallengeDescription : (byId?.Description ?? ""));
					ChallengeCategory category = byId?.Category ?? challenge.BonusSubChallengeCategory;
					_challengesToReveal.Add(new AssignedChallenge
					{
						ChallengeId = challenge.BonusSubChallengeId,
						Name = name,
						Description = description,
						Category = category,
						IsTemporary = challenge.IsTemporary,
						RequiresTargetPlayer = false,
						IsBonusOfSacrificiel = true,
						IsCancelled = challenge.IsCancelled
					});
				}
			}
			_isCampfireRefresh = isCampfireRefresh;
			_playerNamesPool = ((allPlayerNames != null && allPlayerNames.Count > 0) ? new List<string>(allPlayerNames) : new List<string> { "Scout #1", "Scout #2", "Scout #3", "Scout #4" });
			_allChallengeNamesPool = (from c in ChallengeCatalog.Config.Challenges
				where c.Enabled
				select c.Name).ToList();
			if (_allChallengeNamesPool.Count == 0)
			{
				_allChallengeNamesPool.Add("Malus Mystère");
			}
			_categoryChallengeNamesPool.Clear();
			foreach (ChallengeCategory cat in Enum.GetValues(typeof(ChallengeCategory)))
			{
				List<string> list = (from c in ChallengeCatalog.Config.Challenges
					where c.Enabled && c.Category == cat
					select c.Name).ToList();
				if (list.Count == 0)
				{
					list = new List<string>(_allChallengeNamesPool);
				}
				_categoryChallengeNamesPool[cat] = list;
			}
			_hasAnyTargetWheel = _challengesToReveal.Any((AssignedChallenge c) => c.RequiresTargetPlayer && !string.IsNullOrEmpty(c.TargetPlayerName));
			_hasAnyReciprocalTwin = _challengesToReveal.Any((AssignedChallenge c) => c.IsReciprocalTwin && !string.IsNullOrEmpty(c.ReplacedChallengeName));
			_delayRemaining = ((isCampfireRefresh || skipDelay) ? 0f : 5f);
			_animTime = 0f;
			_isPlaying = true;
		}

		private float GetTotalDuration()
		{
			return 2.4f + ((_hasAnyTargetWheel || _hasAnyReciprocalTwin) ? 1.8f : 0f) + 4.2f + (_hasAnyReciprocalTwin ? 1f : 0f);
		}

		public void HideImmediately()
		{
			_isPlaying = false;
			_delayRemaining = 0f;
			_challengesToReveal.Clear();
		}

		private void Update()
		{
			if (!_isPlaying)
			{
				return;
			}
			Character localCharacter = Character.localCharacter;
			if (LoadingScreenHandler.loading || ((Object)(object)localCharacter != (Object)null && (Object)(object)localCharacter.data != (Object)null && localCharacter.data.passedOutOnTheBeach > 0f))
			{
				return;
			}
			if (_delayRemaining > 0f)
			{
				_delayRemaining -= Time.deltaTime;
				return;
			}
			_animTime += Time.deltaTime;
			float totalDuration = GetTotalDuration();
			if (_animTime >= totalDuration)
			{
				_isPlaying = false;
				ActiveChallengesHudUI.Instance?.ShowHud();
			}
		}

		private void EnsureStyles()
		{
			//IL_0025: 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_0070: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Expected O, but got Unknown
			//IL_00a2: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Expected O, but got Unknown
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: 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_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Expected O, but got Unknown
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Expected O, but got Unknown
			if ((Object)(object)_darkBgTex == (Object)null)
			{
				_darkBgTex = MakeTex(2, 2, new Color(0.06f, 0.06f, 0.09f, 0.92f));
				_cardBgTex = MakeTex(2, 2, new Color(0.13f, 0.14f, 0.19f, 0.96f));
			}
			if (_bannerStyle == null)
			{
				_bannerStyle = new GUIStyle(GUI.skin.label)
				{
					alignment = (TextAnchor)4,
					fontSize = 24,
					fontStyle = (FontStyle)1,
					richText = true
				};
				_bannerStyle.normal.textColor = Color.white;
				_cardTitleStyle = new GUIStyle(GUI.skin.label)
				{
					alignment = (TextAnchor)4,
					fontSize = 20,
					fontStyle = (FontStyle)1,
					richText = true,
					wordWrap = true
				};
				_cardTitleStyle.normal.textColor = Color.white;
				_cardDescStyle = new GUIStyle(GUI.skin.label)
				{
					alignment = (TextAnchor)1,
					fontSize = 14,
					richText = true,
					wordWrap = true
				};
				_cardDescStyle.normal.textColor = new Color(0.9f, 0.9f, 0.9f, 1f);
				_badgeStyle = new GUIStyle(GUI.skin.label)
				{
					alignment = (TextAnchor)4,
					fontSize = 12,
					fontStyle = (FontStyle)1,
					richText = true
				};
				_wheelStyle = new GUIStyle(GUI.skin.label)
				{
					alignment = (TextAnchor)4,
					fontSize = 15,
					fontStyle = (FontStyle)1,
					richText = true
				};
			}
		}

		private void OnGUI()
		{
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b55: Unknown result type (might be due to invalid IL or missing references)
			//IL_0397: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0402: Unknown result type (might be due to invalid IL or missing references)
			//IL_0407: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_043a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0441: Unknown result type (might be due to invalid IL or missing references)
			//IL_0446: Unknown result type (might be due to invalid IL or missing references)
			//IL_0468: Unknown result type (might be due to invalid IL or missing references)
			//IL_046a: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0599: Unknown result type (might be due to invalid IL or missing references)
			//IL_092a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0998: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_082a: Unknown result type (might be due to invalid IL or missing references)
			//IL_087c: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_08cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_072a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0643: Unknown result type (might be due to invalid IL or missing references)
			//IL_077c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0781: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a45: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b07: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aaa: Unknown result type (might be due to invalid IL or missing references)
			if (!_isPlaying || _delayRemaining > 0f || _challengesToReveal.Count == 0)
			{
				return;
			}
			Character localCharacter = Character.localCharacter;
			if (LoadingScreenHandler.loading || ((Object)(object)localCharacter != (Object)null && (Object)(object)localCharacter.data != (Object)null && localCharacter.data.passedOutOnTheBeach > 0f))
			{
				return;
			}
			if ((Object)(object)localCharacter != (Object)null && localCharacter.inAirport)
			{
				HideImmediately();
				return;
			}
			EnsureStyles();
			float totalDuration = GetTotalDuration();
			float num = 1f;
			if (_animTime < 0.35f)
			{
				num = Mathf.Clamp01(_animTime / 0.35f);
			}
			else if (_animTime > totalDuration - 0.65f)
			{
				num = Mathf.Clamp01((totalDuration - _animTime) / 0.65f);
			}
			Color color = GUI.color;
			GUI.color = new Color(1f, 1f, 1f, num);
			float num2 = Screen.width;
			float num3 = Screen.height;
			int count = _challengesToReveal.Count;
			float num4 = Mathf.Min(330f, (num2 - 120f) / (float)Mathf.Max(1, count) - 16f);
			float num5 = 235f;
			float num6 = (float)count * num4 + (float)(count - 1) * 18f;
			float num7 = (num2 - num6) * 0.5f;
			float num8 = num3 * 0.14f;
			Rect val = new Rect((num2 - Mathf.Max(num6 + 40f, 560f)) * 0.5f, num8 - 64f, Mathf.Max(num6 + 40f, 560f), 50f);
			GUI.DrawTexture(val, (Texture)(object)_darkBgTex);
			string text = (_isCampfireRefresh ? "<color=#FF9933>--- FEU DE CAMP ALLUMÉ : NOUVEAUX MALUS TEMPORAIRES ---</color>" : "<color=#FFDD44>--- DÉBUT D'ASCENSION : ATTRIBUTION DES DÉFIS ---</color>");
			GUI.Label(val, text, _bannerStyle);
			Rect val2 = default(Rect);
			Rect val3 = default(Rect);
			Rect val8 = default(Rect);
			for (int i = 0; i < count; i++)
			{
				AssignedChallenge assignedChallenge = _challengesToReveal[i];
				float num9 = 2.4f * (0.65f + 0.35f * ((float)(i + 1) / (float)count));
				bool flag = _animTime >= num9;
				bool flag2 = assignedChallenge.IsReciprocalTwin && !string.IsNullOrEmpty(assignedChallenge.ReplacedChallengeName);
				float num10 = num9 + 1.8f;
				bool flag3 = !flag2 || _animTime >= num10;
				bool flag4 = flag2 && flag && !flag3 && _animTime >= num10 - 0.45f;
				bool flag5 = flag2 && flag3 && _animTime - num10 < 0.55f;
				float num11 = 0f;
				float num12 = 0f;
				if (flag && _animTime - num9 < 0.25f)
				{
					num12 = (0f - Mathf.Sin((_animTime - num9) / 0.25f * MathF.PI)) * 12f;
				}
				if (flag4)
				{
					float num13 = (_animTime - (num10 - 0.45f)) / 0.45f;
					num11 = Mathf.Sin(_animTime * 70f) * (5f * num13);
					num12 += Mathf.Cos(_animTime * 60f) * (2.5f * num13);
				}
				else if (flag5)
				{
					float num14 = (_animTime - num10) / 0.55f;
					float num15 = 1f - num14;
					num11 = Mathf.Sin(num14 * MathF.PI * 6f) * 10f * num15;
					num12 = (0f - Mathf.Sin(num14 * MathF.PI)) * 16f;
				}
				((Rect)(ref val2))..ctor(num7 + (float)i * (num4 + 18f) + num11, num8 + num12, num4, num5);
				GUI.DrawTexture(val2, (Texture)(object)_cardBgTex);
				ChallengeCategory challengeCategory = ((flag2 && !flag3) ? assignedChallenge.ReplacedChallengeCategory : assignedChallenge.Category);
				Color categoryColor = GetCategoryColor(challengeCategory);
				Color c = categoryColor;
				if (flag4)
				{
					c = Color.Lerp(categoryColor, new Color(1f, 0.35f, 0.85f), 0.5f + 0.5f * Mathf.Sin(_animTime * 40f));
				}
				else if (flag5)
				{
					float num16 = 1f - (_animTime - num10) / 0.55f;
					c = Color.Lerp(new Color(1f, 0.4f, 0.85f), Color.white, num16);
				}
				else if (flag2 && flag3)
				{
					((Color)(ref c))..ctor(1f, 0.42f, 0.85f);
				}
				DrawBorder(val2, c, flag ? 3f : 1.5f);
				string text2 = (assignedChallenge.IsBonusOfSacrificiel ? "MALUS SACRIFICIEL" : GetCategoryLabel(challengeCategory));
				string text3 = (assignedChallenge.IsTemporary ? "TEMPORAIRE (FEU)" : "PERMANENT");
				string text4 = ColorUtility.ToHtmlStringRGB(categoryColor);
				((Rect)(ref val3))..ctor(((Rect)(ref val2)).x + 8f, ((Rect)(ref val2)).y + 8f, ((Rect)(ref val2)).width - 16f, 22f);
				string text5 = ((flag2 && flag3) ? ("<color=#FF66CC>[JUMELAGE — REMPLACÉ]</color> • <color=#CCCCCC>" + text3 + "</color>") : ((!assignedChallenge.IsBonusOfSacrificiel) ? ("<color=#" + text4 + ">[" + text2 + "]</color> • <color=#CCCCCC>" + text3 + "</color>") : ("<color=#FF5555>[" + text2 + "]</color> • <color=#" + text4 + ">" + GetCategoryLabel(assignedChallenge.Category) + "</color>")));
				GUI.Label(val3, text5, _badgeStyle);
				if (!flag)
				{
					List<string> value;
					List<string> list = ((ChallengeCatalog.Config.DrawByCategory && !assignedChallenge.IsBonusOfSacrificiel && _categoryChallengeNamesPool.TryGetValue(challengeCategory, out value) && value.Count > 0) ? value : _allChallengeNamesPool);
					int index = Mathf.FloorToInt(_animTime * 18f + (float)(i * 3)) % list.Count;
					string text6 = list[index];
					Rect val4 = new Rect(((Rect)(ref val2)).x + 12f, ((Rect)(ref val2)).y + 55f, ((Rect)(ref val2)).width - 24f, 60f);
					string text7 = (assignedChallenge.IsBonusOfSacrificiel ? "Malus : " : ">> ");
					GUI.Label(val4, "<color=#AAAAAA>" + text7 + text6 + "...</color>", _cardTitleStyle);
					continue;
				}
				if (flag2 && !flag3)
				{
					GUI.Label(new Rect(((Rect)(ref val2)).x + 10f, ((Rect)(ref val2)).y + 32f, ((Rect)(ref val2)).width - 20f, 36f), "<color=#" + text4 + ">" + assignedChallenge.ReplacedChallengeName + "</color>", _cardTitleStyle);
					GUI.Label(new Rect(((Rect)(ref val2)).x + 12f, ((Rect)(ref val2)).y + 70f, ((Rect)(ref val2)).width - 24f, 110f), assignedChallenge.ReplacedChallengeDescription, _cardDescStyle);
					if (flag4)
					{
						Rect val5 = new Rect(((Rect)(ref val2)).x + 10f, ((Rect)(ref val2)).y + ((Rect)(ref val2)).height - 46f, ((Rect)(ref val2)).width - 20f, 36f);
						GUI.DrawTexture(val5, (Texture)(object)_darkBgTex);
						GUI.Label(val5, "<color=#FF66CC>>> J