BepInEx/plugins/Exil.dll

Decompiled 20 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.Encodings.Web;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Exil.Coeur;
using Exil.Interface;
using Exil.Jeu;
using FMOD;
using FMOD.Studio;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using ProjectM;
using ProjectM.Audio;
using ProjectM.Network;
using ProjectM.Scripting;
using ProjectM.UI;
using Stunlock.Core;
using Stunlock.Fmod;
using Stunlock.Localization;
using TMPro;
using Unity.Entities;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.InputSystem.Utilities;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Exil")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Exil : liste noire du butin (mod client V Rising)")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Exil")]
[assembly: AssemblyTitle("Exil")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NativeIntegerAttribute : Attribute
	{
		public readonly bool[] TransformFlags;

		public NativeIntegerAttribute()
		{
			TransformFlags = new bool[1] { true };
		}

		public NativeIntegerAttribute(bool[] P_0)
		{
			TransformFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Exil
{
	internal static class Noyau
	{
		private sealed class Partie
		{
			public int EchecsDeSuite;

			public int EchecsTotal;

			public bool Coupee;

			public readonly HashSet<string> Vus = new HashSet<string>();
		}

		public static ListeNoire Liste = new ListeNoire();

		public static readonly Ordonnanceur Ordo = new Ordonnanceur();

		public static readonly Dictionary<int, long> JetesSession = new Dictionary<int, long>();

		public static long TotalJetes;

		private const double PasLecture = 0.033;

		private static int versionEnregistree;

		private static double changementListe = -1.0;

		private static double prochaineLecture;

		private static readonly List<Case> cases = new List<Case>();

		private static readonly List<int> aJeter = new List<int>();

		private static bool arrete;

		private static int generationVue = -1;

		private static readonly Dictionary<string, Partie> parties = new Dictionary<string, Partie>();

		public static string CheminListe => Path.Combine(Paths.ConfigPath, "Exil", "liste_noire.json");

		private static void Essayer(string nom, Action action)
		{
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Expected O, but got Unknown
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Expected O, but got Unknown
			if (!parties.TryGetValue(nom, out Partie value))
			{
				value = (parties[nom] = new Partie());
			}
			if (value.Coupee)
			{
				return;
			}
			try
			{
				action();
				value.EchecsDeSuite = 0;
			}
			catch (Exception ex)
			{
				value.EchecsDeSuite++;
				value.EchecsTotal++;
				string item = ex.GetType().Name + ex.Message;
				bool flag = default(bool);
				if (value.Vus.Count < 20 && value.Vus.Add(item))
				{
					ManualLogSource log_ = Plugin.Log_;
					BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(7, 4, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(nom);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.GetType().Name);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" : ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\n");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.StackTrace);
					}
					log_.LogWarning(val);
				}
				if (value.EchecsDeSuite < 120)
				{
					return;
				}
				value.Coupee = true;
				ManualLogSource log_2 = Plugin.Log_;
				BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(48, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(nom);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("] coupé pour la session après ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(value.EchecsDeSuite);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" échecs de suite.");
				}
				log_2.LogError(val2);
				if (nom == "menu")
				{
					try
					{
						Menu.FermerTout();
					}
					catch
					{
					}
					try
					{
						Entrees.BloquerJeu(oui: false);
						return;
					}
					catch
					{
						return;
					}
				}
			}
		}

		public static void ChargerListe()
		{
			Liste = ListeNoire.Charger(CheminListe, out string erreur);
			if (erreur != null)
			{
				Plugin.Log_.LogWarning((object)("Liste noire illisible (" + erreur + ") : gardée à côté, nouvelle liste vide."));
			}
			versionEnregistree = Liste.Version;
			CatalogueJeu.ChargerVus();
		}

		public static void Image()
		{
			if (arrete)
			{
				return;
			}
			TenueUnity.NoterFilPrincipal();
			float dt = Math.Clamp(Time.unscaledDeltaTime, 0f, 0.1f);
			double t = Time.realtimeSinceStartupAsDouble;
			Essayer("monde", Monde.Rafraichir);
			if (Monde.Generation != generationVue)
			{
				generationVue = Monde.Generation;
				Ordo.Reinitialiser();
				Essayer("changement_monde", delegate
				{
					Menu.FermerTout();
					Entrees.BloquerJeu(oui: false);
					CatalogueJeu.Reinitialiser();
				});
			}
			Essayer("langue", delegate
			{
				LangueJeu.Image(t);
			});
			Essayer("entrees", delegate
			{
				Entrees.Debut(t);
			});
			Essayer("touches", delegate
			{
				Touches(t);
			});
			Essayer("catalogue", delegate
			{
				CatalogueJeu.Avancer(t);
			});
			Essayer("jets", delegate
			{
				Jets(t);
			});
			Essayer("menu", delegate
			{
				Menu.Image(t, dt);
			});
			Essayer("hud", delegate
			{
				Hud.Image(t, dt);
			});
			Essayer("sauvegarde", delegate
			{
				Sauvegarder(t, force: false);
			});
		}

		private static void Touches(double t)
		{
			if (Menu.CaptureEnCours)
			{
				return;
			}
			bool saisieJeu = Entrees.SaisieTexteDuJeu();
			Raccourci toucheMenu = Reglages.ToucheMenu;
			Raccourci toucheActiver = Reglages.ToucheActiver;
			if (Entrees.Appuye(toucheMenu) && Libre(toucheMenu))
			{
				if (Monde.EnJeu)
				{
					Menu.Basculer();
				}
				else
				{
					Hud.Annoncer("EXIL", Langue.T("hors_partie"), Hud.Ton.Neutre);
				}
			}
			if (Entrees.Appuye(toucheActiver) && Libre(toucheActiver))
			{
				BasculerActif();
			}
			bool Libre(Raccourci r)
			{
				if (NomsTouches.ProduitTexte(r.Touche) && !r.Ctrl && !r.Alt)
				{
					if (!saisieJeu)
					{
						return !Menu.Ouvert;
					}
					return false;
				}
				return true;
			}
		}

		public static void BasculerActif()
		{
			Reglages.Actif = !Reglages.Actif;
			Ordo.Reinitialiser();
			prochaineLecture = 0.0;
			if (Reglages.Actif)
			{
				int count = Liste.Count;
				Hud.Annoncer(Langue.T("exil_active"), (count == 0) ? Langue.T("annonce_vide") : Langue.T("annonce_active", Langue.Nombre(count)), Hud.Ton.Rouge);
				SonsJeu.Jouer(SonMenu.Activer);
			}
			else
			{
				Hud.Annoncer(Langue.T("exil_desactive"), Langue.T("annonce_inactive"), Hud.Ton.Neutre);
				SonsJeu.Jouer(SonMenu.Desactiver);
			}
			Plugin.Log_.LogInfo((object)("Mode Exil " + (Reglages.Actif ? "activé" : "désactivé") + "."));
		}

		private static void Jets(double t)
		{
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Expected O, but got Unknown
			if (!Reglages.Actif || !Monde.EnJeu || Liste.Count == 0 || t < prochaineLecture)
			{
				return;
			}
			prochaineLecture = t + 0.033;
			Ordo.Delai = Reglages.Delai;
			if (!Inventaire.Lire(cases, Reglages.ProtegerBarre, Liste.Contient))
			{
				return;
			}
			Ordo.Observer(t, cases);
			foreach (var (num, num2) in Ordo.Confirmes)
			{
				JetesSession.TryGetValue(num, out var value);
				JetesSession[num] = value + num2;
				TotalJetes += num2;
				Hud.NoterJet(num, num2);
			}
			bool flag = default(bool);
			foreach (int boucle in Ordo.Boucles)
			{
				string text = CatalogueJeu.Nom(boucle);
				Hud.Annoncer(Langue.T("boucle_titre"), Langue.T("boucle_texte", text, (int)Ordo.BoucleAttente), Hud.Ton.Orange);
				ManualLogSource log_ = Plugin.Log_;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(38, 3, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Boucle de ramassage : ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(boucle);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") en pause ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<double>(Ordo.BoucleAttente);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" s.");
				}
				log_.LogInfo(val);
			}
			Ordo.Choisir(t, cases, Liste.Contient, CatalogueJeu.EstJetable, aJeter);
			foreach (int item in aJeter)
			{
				foreach (Case @case in cases)
				{
					if (@case.Index == item)
					{
						if (Inventaire.Jeter(item))
						{
							Ordo.Envoye(t, @case);
						}
						break;
					}
				}
			}
		}

		public static void ListeChangee(double t)
		{
			changementListe = t;
		}

		public static void Basculer(Objet o, double t)
		{
			if (!Liste.Basculer(o.Guid, o.Nom, o.Interne))
			{
				Ordo.Oublier(o.Guid);
			}
			ListeChangee(t);
		}

		private static void Sauvegarder(double t, bool force)
		{
			if (Liste.Version == versionEnregistree || (!force && (changementListe < 0.0 || t - changementListe < 0.8)))
			{
				return;
			}
			try
			{
				Liste.Enregistrer(CheminListe);
				versionEnregistree = Liste.Version;
			}
			catch (Exception ex)
			{
				versionEnregistree = Liste.Version;
				Plugin.Log_.LogWarning((object)("Liste noire non enregistrée : " + ex.Message));
			}
		}

		public static void Arreter()
		{
			if (arrete)
			{
				return;
			}
			arrete = true;
			try
			{
				Sauvegarder(0.0, force: true);
			}
			catch
			{
			}
			try
			{
				Entrees.BloquerJeu(oui: false);
			}
			catch
			{
			}
			try
			{
				Entrees.AbonnerTexte(oui: false);
			}
			catch
			{
			}
		}
	}
	[BepInPlugin("fumzou.exil", "Exil", "1.0.0")]
	public sealed class Plugin : BasePlugin
	{
		public const string Guid = "fumzou.exil";

		public const string Nom = "Exil";

		public const string Version = "1.0.0";

		internal static ManualLogSource Log_;

		private Moteur? moteur;

		public override void Load()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			Log_ = ((BasePlugin)this).Log;
			if (Application.productName == "VRisingServer")
			{
				((BasePlugin)this).Log.LogWarning((object)"Exil est un mod CLIENT : rien à faire sur un serveur.");
				return;
			}
			Reglages.Lier(((BasePlugin)this).Config);
			LangueJeu.Charger();
			Noyau.ChargerListe();
			moteur = ((BasePlugin)this).AddComponent<Moteur>();
			ManualLogSource log = ((BasePlugin)this).Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(142, 10, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("Exil");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.0");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" chargé. Menu : ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Raccourci>(Reglages.ToucheMenu);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", activer / désactiver : ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Raccourci>(Reglages.ToucheActiver);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", délai ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(Reglages.Delai);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" s. ");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Mode ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(Reglages.Actif ? "ACTIVÉ" : "désactivé");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(Noyau.Liste.Count);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" objet(s) dans la liste noire (");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(Noyau.CheminListe);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("), ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(ObjetsVerifies.Verdicts.Count);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" objets jugés par la base RE, ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(Langue.Cles);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" textes traduits.");
			}
			log.LogInfo(val);
		}

		public override bool Unload()
		{
			try
			{
				Noyau.Arreter();
			}
			catch
			{
			}
			if ((Object)(object)moteur != (Object)null)
			{
				Object.Destroy((Object)(object)moteur);
			}
			return true;
		}
	}
	public sealed class Moteur : MonoBehaviour
	{
		public Moteur(IntPtr pointeur)
			: base(pointeur)
		{
		}

		public void Update()
		{
			Noyau.Image();
		}

		public void OnApplicationQuit()
		{
			try
			{
				Noyau.Arreter();
			}
			catch
			{
			}
		}

		public void OnDestroy()
		{
			try
			{
				Noyau.Arreter();
			}
			catch
			{
			}
		}
	}
	internal static class Reglages
	{
		private static ConfigEntry<string> toucheMenu;

		private static ConfigEntry<string> toucheActiver;

		private static ConfigEntry<string> langue;

		private static ConfigEntry<bool> actif;

		private static ConfigEntry<bool> notifications;

		private static ConfigEntry<bool> pastille;

		private static ConfigEntry<bool> protegerBarre;

		private static ConfigEntry<bool> sons;

		private static ConfigEntry<float> echelle;

		private static ConfigEntry<float> delai;

		public static Raccourci ToucheMenu { get; private set; }

		public static Raccourci ToucheActiver { get; private set; }

		public static bool Actif
		{
			get
			{
				return actif.Value;
			}
			set
			{
				actif.Value = value;
			}
		}

		public static bool Notifications
		{
			get
			{
				return notifications.Value;
			}
			set
			{
				notifications.Value = value;
			}
		}

		public static bool Pastille
		{
			get
			{
				return pastille.Value;
			}
			set
			{
				pastille.Value = value;
			}
		}

		public static bool Sons
		{
			get
			{
				return sons.Value;
			}
			set
			{
				sons.Value = value;
			}
		}

		public static bool ProtegerBarre
		{
			get
			{
				return protegerBarre.Value;
			}
			set
			{
				protegerBarre.Value = value;
			}
		}

		public static float Echelle => Math.Clamp(echelle.Value, 0.6f, 1.6f);

		public static float Delai
		{
			get
			{
				return Math.Clamp(delai.Value, 0f, 5f);
			}
			set
			{
				delai.Value = Math.Clamp(value, 0f, 5f);
			}
		}

		public static string? LangueForcee
		{
			get
			{
				string text = langue.Value?.Trim() ?? "";
				if (text.Length != 0 && !text.Equals("auto", StringComparison.OrdinalIgnoreCase))
				{
					return text;
				}
				return null;
			}
		}

		public static void Lier(ConfigFile cfg)
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Expected O, but got Unknown
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Expected O, but got Unknown
			toucheMenu = cfg.Bind<string>("Touches", "OuvrirMenu", "F3", "Ouvre ou ferme le menu d'Exil. Se change dans le menu (clic sur la touche). Exemples : F3, Insert, Numpad7, Mouse4, Ctrl+F3.");
			toucheActiver = cfg.Bind<string>("Touches", "ActiverDesactiver", "F4", "Active ou désactive le jet automatique des objets de la liste noire. Se change dans le menu.");
			actif = cfg.Bind<bool>("General", "Actif", false, "Vrai : les objets de la liste noire qui arrivent dans l'inventaire sont jetés au sol automatiquement.");
			delai = cfg.Bind<float>("General", "DelaiSecondes", 0f, new ConfigDescription("Temps qu'un objet de la liste noire reste dans l'inventaire avant d'être jeté (0 = immédiat). Se règle dans le menu.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f), Array.Empty<object>()));
			notifications = cfg.Bind<bool>("Affichage", "Notifications", true, "Petites notifications à droite de l'écran pour chaque objet jeté.");
			pastille = cfg.Bind<bool>("Affichage", "Pastille", true, "Pastille « EXIL » en haut à gauche de l'écran quand le mode est activé.");
			sons = cfg.Bind<bool>("Affichage", "Sons", true, "Sons du menu (sons d'interface du jeu).");
			echelle = cfg.Bind<float>("Affichage", "Echelle", 1f, new ConfigDescription("Taille du menu (1 = normale).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.6f, 1.6f), Array.Empty<object>()));
			langue = cfg.Bind<string>("Affichage", "Langue", "auto", "Langue du menu : « auto » = celle du jeu. Sinon : fr, en, de, es, pt, it, pl, ru, uk, tr, hu, ca, ja, ko, zhs, zht, th, vi.");
			protegerBarre = cfg.Bind<bool>("Securite", "ProtegerBarreAction", false, "Vrai : les 8 premières cases de l'inventaire (barre d'action) ne sont jamais vidées. Les objets PORTÉS ne sont jamais jetés, quel que soit ce réglage.");
			ToucheMenu = Valider(toucheMenu, "F3");
			ToucheActiver = Valider(toucheActiver, "F4");
			if (ToucheMenu.MemeQue(ToucheActiver))
			{
				ManualLogSource log_ = Plugin.Log_;
				bool flag = default(bool);
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(74, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Les deux touches sont identiques (");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Raccourci>(ToucheMenu);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") : la touche d'activation revient à F4.");
				}
				log_.LogWarning(val);
				ToucheActiver = Raccourci.Analyser((ToucheMenu.Touche == "F4") ? "F5" : "F4");
				toucheActiver.Value = ToucheActiver.ToString();
			}
		}

		private static Raccourci Valider(ConfigEntry<string> e, string defaut)
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			Raccourci result = Raccourci.Analyser(e.Value);
			if (result.Vide || NomsTouches.Interdite(result.Touche) || (!result.Souris && !Entrees.ToucheConnue(result.Touche)))
			{
				ManualLogSource log_ = Plugin.Log_;
				bool flag = default(bool);
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(55, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Touche « ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.Value);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" » refusée (inconnue ou réservée) : ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(defaut);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" utilisée.");
				}
				log_.LogWarning(val);
				result = Raccourci.Analyser(defaut);
				e.Value = defaut;
			}
			return result;
		}

		public static void ChangerToucheMenu(Raccourci r)
		{
			ToucheMenu = r;
			toucheMenu.Value = r.ToString();
		}

		public static void ChangerToucheActiver(Raccourci r)
		{
			ToucheActiver = r;
			toucheActiver.Value = r.ToString();
		}
	}
}
namespace Exil.Jeu
{
	internal static class CatalogueJeu
	{
		public static readonly List<Objet> Objets = new List<Objet>();

		private static readonly Dictionary<int, Objet> parGuid = new Dictionary<int, Objet>();

		private static readonly Dictionary<int, Objet> caches = new Dictionary<int, Objet>();

		private static readonly Dictionary<int, Sprite> icones = new Dictionary<int, Sprite>();

		private static readonly Dictionary<int, bool> jetableDirect = new Dictionary<int, bool>();

		private static readonly HashSet<int> vus = new HashSet<int>();

		private static readonly List<Case> casesDecouverte = new List<Case>();

		private static List<(string nom, int guid)>? aFaire;

		private static int curseur;

		private static int sansDonnees;

		private static int sansNom;

		private static int sansIcone;

		private static int exclus;

		private static int nonVerifies;

		private static double prochainEssai;

		private static double prochaineDecouverte;

		private static int essais;

		private static readonly Stopwatch chrono = new Stopwatch();

		private static PrefabCollectionSystem? prefabsEnCours;

		private static ManagedDataRegistry? registreEnCours;

		public static bool Pret { get; private set; }

		public static bool EnCours
		{
			get
			{
				if (aFaire != null)
				{
					return !Pret;
				}
				return false;
			}
		}

		public static int Version { get; private set; }

		public static int Caches => caches.Count;

		public static float Progression
		{
			get
			{
				if (aFaire != null && aFaire.Count != 0)
				{
					return (float)curseur / (float)aFaire.Count;
				}
				return 0f;
			}
		}

		private static string CheminVus => Path.Combine(Paths.ConfigPath, "Exil", "objets_vus.json");

		public static void ChargerVus()
		{
			try
			{
				if (!File.Exists(CheminVus))
				{
					return;
				}
				List<int> list = JsonSerializer.Deserialize<List<int>>(File.ReadAllText(CheminVus));
				if (list == null)
				{
					return;
				}
				foreach (int item in list)
				{
					vus.Add(item);
				}
			}
			catch (Exception ex)
			{
				Plugin.Log_.LogWarning((object)("objets_vus.json illisible : " + ex.Message));
			}
		}

		private static void SauverVus()
		{
			try
			{
				Directory.CreateDirectory(Path.GetDirectoryName(CheminVus));
				File.WriteAllText(CheminVus, JsonSerializer.Serialize(vus.OrderBy((int x) => x).ToList()));
			}
			catch (Exception ex)
			{
				Plugin.Log_.LogWarning((object)("objets_vus.json non enregistré : " + ex.Message));
			}
		}

		public static void Reinitialiser()
		{
			Objets.Clear();
			parGuid.Clear();
			caches.Clear();
			icones.Clear();
			jetableDirect.Clear();
			Pret = false;
			aFaire = null;
			curseur = 0;
			essais = 0;
			prochainEssai = 0.0;
			sansDonnees = (sansNom = (sansIcone = (exclus = (nonVerifies = 0))));
			Version++;
		}

		public static void Avancer(double t)
		{
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Expected O, but got Unknown
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Expected O, but got Unknown
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Expected O, but got Unknown
			if (!Monde.EnJeu)
			{
				return;
			}
			if (Pret)
			{
				if (t >= prochaineDecouverte)
				{
					prochaineDecouverte = t + 1.5;
					DecouvrirInventaire();
				}
				return;
			}
			if (aFaire == null)
			{
				if (t < prochainEssai)
				{
					return;
				}
				prochainEssai = t + 3.0;
				if (!Preparer())
				{
					return;
				}
			}
			chrono.Restart();
			prefabsEnCours = null;
			registreEnCours = null;
			bool flag = default(bool);
			while (curseur < aFaire.Count && chrono.Elapsed.TotalMilliseconds < 3.0)
			{
				var (text, guid) = aFaire[curseur++];
				try
				{
					Traiter(text, guid);
				}
				catch (Exception ex)
				{
					sansDonnees++;
					if (sansDonnees <= 3)
					{
						ManualLogSource log_ = Plugin.Log_;
						BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(29, 3, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Catalogue : ");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" illisible (");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.GetType().Name);
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" : ");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral(").");
						}
						log_.LogWarning(val);
					}
				}
			}
			if (curseur < aFaire.Count)
			{
				return;
			}
			BepInExInfoLogInterpolatedStringHandler val2;
			if (Objets.Count < 50 && essais < 10)
			{
				essais++;
				ManualLogSource log_2 = Plugin.Log_;
				val2 = new BepInExInfoLogInterpolatedStringHandler(54, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Catalogue incomplet (");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(Objets.Count);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" objets) : nouvel essai dans 5 s.");
				}
				log_2.LogInfo(val2);
				int num = essais;
				Reinitialiser();
				essais = num;
				prochainEssai = t + 5.0;
				return;
			}
			Classement.Ranger(Objets);
			foreach (Objet value in parGuid.Values)
			{
				Noyau.Liste.Renommer(value.Guid, value.Nom);
			}
			Pret = true;
			Version++;
			ManualLogSource log_3 = Plugin.Log_;
			val2 = new BepInExInfoLogInterpolatedStringHandler(206, 6, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Catalogue prêt : ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(Objets.Count);
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" objets montrés, ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(caches.Count);
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" cachés (jamais produits ni demandés par le jeu, ");
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("montrés dès qu'ils apparaissent dans l'inventaire) ; écartés : ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(exclus);
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" faux objets, ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(sansDonnees);
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" sans données, ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(sansIcone);
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" sans icône ; ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(sansNom);
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" sans traduction.");
			}
			log_3.LogInfo(val2);
		}

		private static bool Preparer()
		{
			//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)
			PrefabCollectionSystem val = Monde.Systeme<PrefabCollectionSystem>();
			if (val == null)
			{
				return false;
			}
			Dictionary<string, PrefabGUID> spawnableNameToPrefabGuidDictionary = val.SpawnableNameToPrefabGuidDictionary;
			if (spawnableNameToPrefabGuidDictionary == null || spawnableNameToPrefabGuidDictionary.Count == 0)
			{
				return false;
			}
			List<(string, int)> list = new List<(string, int)>();
			Enumerator<string, PrefabGUID> enumerator = spawnableNameToPrefabGuidDictionary.Keys.GetEnumerator();
			while (enumerator.MoveNext())
			{
				string current = enumerator.Current;
				if (!string.IsNullOrEmpty(current) && current.StartsWith("Item_", StringComparison.Ordinal))
				{
					if (Classement.Exclure(current))
					{
						exclus++;
						continue;
					}
					PrefabGUID val2 = spawnableNameToPrefabGuidDictionary[current];
					list.Add((current, ((PrefabGUID)(ref val2)).GuidHash));
				}
			}
			if (list.Count == 0)
			{
				return false;
			}
			aFaire = list;
			curseur = 0;
			return true;
		}

		private static void Traiter(string interne, int guid)
		{
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Expected I8, but got Unknown
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Expected I4, but got Unknown
			//IL_01d2: 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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: 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_0106: Unknown result type (might be due to invalid IL or missing references)
			if (guid == 0 || parGuid.ContainsKey(guid))
			{
				return;
			}
			if (!ObjetsVerifies.Verdicts.TryGetValue(guid, out var value))
			{
				value = 2;
			}
			if (value == 3)
			{
				exclus++;
				return;
			}
			EntityManager em = Monde.Em;
			PrefabCollectionSystem val = prefabsEnCours ?? (prefabsEnCours = Monde.Systeme<PrefabCollectionSystem>());
			if (val == null)
			{
				return;
			}
			PrefabGUID val2 = default(PrefabGUID);
			((PrefabGUID)(ref val2))..ctor(guid);
			Entity val3 = default(Entity);
			if (!val._PrefabGuidToEntityMap.TryGetValue(val2, ref val3) || !((EntityManager)(ref em)).Exists(val3) || !((EntityManager)(ref em)).HasComponent<ItemData>(val3))
			{
				sansDonnees++;
				return;
			}
			ItemData componentData = ((EntityManager)(ref em)).GetComponentData<ItemData>(val3);
			ManagedDataRegistry? obj = registreEnCours;
			if (obj == null)
			{
				GameDataSystem? obj2 = Monde.Systeme<GameDataSystem>();
				obj = (registreEnCours = ((obj2 != null) ? obj2.ManagedDataRegistry : null));
			}
			ManagedItemData val4 = ((obj != null) ? obj.GetOrDefaultWithoutLogging<ManagedItemData>(val2, (ManagedItemData)null) : null);
			if (val4 == null)
			{
				sansDonnees++;
				return;
			}
			Sprite icon = val4.Icon;
			if ((Object)(object)icon == (Object)null)
			{
				sansIcone++;
				return;
			}
			string nom = "";
			try
			{
				nom = Localization.Get(val4.Name, false) ?? "";
			}
			catch
			{
			}
			nom = Classement.Nettoyer(nom);
			if (nom.Length == 0 || nom.StartsWith("[", StringComparison.Ordinal) || nom == interne)
			{
				sansNom++;
				nom = Classement.NomDeSecours(interne);
			}
			long cat = (long)componentData.ItemCategory;
			int type = (int)componentData.ItemType;
			string raison;
			bool jetable = Classement.Jetable(cat, out raison);
			Objet objet = new Objet
			{
				Guid = guid,
				Nom = nom,
				NomNorm = Recherche.Normaliser(nom),
				Interne = interne,
				InterneNorm = Recherche.Normaliser(interne),
				Categorie = Classement.Categoriser(type, cat),
				Jetable = jetable,
				RaisonNonJetable = raison,
				PileMax = Math.Max(1, componentData.MaxAmount)
			};
			parGuid[guid] = objet;
			icones[guid] = icon;
			if (value == 1 || vus.Contains(guid) || Noyau.Liste.Contient(guid))
			{
				Objets.Add(objet);
				return;
			}
			caches[guid] = objet;
			nonVerifies++;
		}

		public static void Decouvrir(int guid)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			if (guid == 0)
			{
				return;
			}
			bool num = vus.Add(guid);
			if (caches.Remove(guid, out Objet value))
			{
				Objets.Add(value);
				Classement.Ranger(Objets);
				Version++;
				ManualLogSource log_ = Plugin.Log_;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(64, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Objet découvert dans l'inventaire : ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(value.Nom);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(value.Interne);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("), désormais dans le menu.");
				}
				log_.LogInfo(val);
			}
			if (num)
			{
				SauverVus();
			}
		}

		public static void DecouvrirInventaire()
		{
			if (!Pret || caches.Count == 0)
			{
				return;
			}
			try
			{
				if (!Inventaire.Lire(casesDecouverte, protegerBarre: false, (int _) => false))
				{
					return;
				}
				foreach (Case item in casesDecouverte)
				{
					if (caches.ContainsKey(item.Guid))
					{
						Decouvrir(item.Guid);
					}
				}
			}
			catch
			{
			}
		}

		public static Objet? Trouver(int guid)
		{
			if (!parGuid.TryGetValue(guid, out Objet value))
			{
				return null;
			}
			return value;
		}

		public static Sprite? Icone(int guid)
		{
			if (!icones.TryGetValue(guid, out Sprite value))
			{
				return null;
			}
			return value;
		}

		public static string Nom(int guid)
		{
			if (parGuid.TryGetValue(guid, out Objet value))
			{
				return value.Nom;
			}
			foreach (ListeNoire.Entree item in Noyau.Liste.Ordonnees())
			{
				if (item.Guid == guid)
				{
					return (item.Nom.Length > 0) ? item.Nom : item.Interne;
				}
			}
			return "#" + guid;
		}

		public static bool EstJetable(int guid)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected I8, but got Unknown
			if (parGuid.TryGetValue(guid, out Objet value))
			{
				return value.Jetable;
			}
			if (jetableDirect.TryGetValue(guid, out var value2))
			{
				return value2;
			}
			bool flag = true;
			try
			{
				PrefabCollectionSystem val = Monde.Systeme<PrefabCollectionSystem>();
				Entity val2 = default(Entity);
				if (val != null && val._PrefabGuidToEntityMap.TryGetValue(new PrefabGUID(guid), ref val2))
				{
					EntityManager em = Monde.Em;
					if (((EntityManager)(ref em)).HasComponent<ItemData>(val2))
					{
						em = Monde.Em;
						flag = Classement.Jetable((long)((EntityManager)(ref em)).GetComponentData<ItemData>(val2).ItemCategory, out string _);
						jetableDirect[guid] = flag;
					}
				}
			}
			catch
			{
			}
			return flag;
		}
	}
	internal static class Entrees
	{
		public static Vector2 Souris;

		public static float Molette;

		public static bool ClicG;

		public static bool ClicGTenu;

		public static bool ClicGLache;

		public static bool ClicD;

		public static bool Ctrl;

		public static bool Maj;

		public static bool Alt;

		public static bool SourisValide;

		private static Keyboard? clavier;

		private static Mouse? souris;

		private static readonly Dictionary<string, Key> cles = new Dictionary<string, Key>(StringComparer.OrdinalIgnoreCase);

		private static Key[]? toutes;

		private static readonly StringBuilder tampon = new StringBuilder();

		private static Action<char>? rappel;

		private static bool abonne;

		private static bool abonnementImpossible;

		private static ChatFocusedInputContext? ctxFocus;

		private static ChatHoveredInputContext? ctxSurvol;

		private static InputActionSystem? systemeEntrees;

		private static bool bloque;

		private static bool blocageImpossible;

		public static bool Bloque => bloque;

		public static void Debut(double t)
		{
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			clavier = Keyboard.current;
			souris = Mouse.current;
			Ctrl = Tenue((Key)55) || Tenue((Key)56);
			Maj = Tenue((Key)51) || Tenue((Key)52);
			Alt = Tenue((Key)53) || Tenue((Key)54);
			SourisValide = false;
			ClicG = (ClicGTenu = (ClicGLache = (ClicD = false)));
			Molette = 0f;
			if (souris != null)
			{
				try
				{
					Souris = ((InputControl<Vector2>)(object)((Pointer)souris).position).ReadValue();
					SourisValide = true;
					float y = ((InputControl<Vector2>)(object)souris.scroll).ReadValue().y;
					Molette = ((Math.Abs(y) >= 20f) ? (y / 120f) : ((float)Math.Sign(y) * Math.Min(1f, Math.Abs(y))));
					ClicG = souris.leftButton.wasPressedThisFrame;
					ClicGTenu = souris.leftButton.isPressed;
					ClicGLache = souris.leftButton.wasReleasedThisFrame;
					ClicD = souris.rightButton.wasPressedThisFrame;
				}
				catch
				{
					SourisValide = false;
				}
			}
			if (!SourisValide)
			{
				try
				{
					Vector3 mousePosition = Input.mousePosition;
					Souris = new Vector2(mousePosition.x, mousePosition.y);
					SourisValide = true;
					ClicG = Input.GetMouseButtonDown(0);
					ClicGTenu = Input.GetMouseButton(0);
					ClicGLache = Input.GetMouseButtonUp(0);
					Molette = Input.mouseScrollDelta.y;
				}
				catch
				{
				}
			}
		}

		private static Key? Cle(string nom)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			if (cles.TryGetValue(nom, out var value))
			{
				return value;
			}
			if (Enum.TryParse<Key>(nom, ignoreCase: true, out Key result) && (int)result != 0)
			{
				cles[nom] = result;
				return result;
			}
			return null;
		}

		public static bool ToucheConnue(string nom)
		{
			return Cle(nom).HasValue;
		}

		private static bool Tenue(Key k)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				return clavier != null && ((ButtonControl)clavier[k]).isPressed;
			}
			catch
			{
				return false;
			}
		}

		private static ButtonControl? BoutonSouris(string nom)
		{
			if (souris == null)
			{
				return null;
			}
			return (ButtonControl?)(nom switch
			{
				"Mouse3" => souris.middleButton, 
				"Mouse4" => souris.backButton, 
				"Mouse5" => souris.forwardButton, 
				_ => null, 
			});
		}

		public static bool ToucheAppuyee(string nom)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (nom.StartsWith("Mouse", StringComparison.Ordinal))
				{
					ButtonControl? obj = BoutonSouris(nom);
					return obj != null && obj.wasPressedThisFrame;
				}
				Key? val = Cle(nom);
				return val.HasValue && clavier != null && ((ButtonControl)clavier[val.Value]).wasPressedThisFrame;
			}
			catch
			{
				return false;
			}
		}

		public static bool ToucheTenue(string nom)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (nom.StartsWith("Mouse", StringComparison.Ordinal))
				{
					ButtonControl? obj = BoutonSouris(nom);
					return obj != null && obj.isPressed;
				}
				Key? val = Cle(nom);
				return val.HasValue && clavier != null && ((ButtonControl)clavier[val.Value]).isPressed;
			}
			catch
			{
				return false;
			}
		}

		public static bool Appuye(Raccourci r)
		{
			if (r.Vide || !ToucheAppuyee(r.Touche))
			{
				return false;
			}
			if (r.Ctrl != Ctrl || r.Alt != Alt)
			{
				return false;
			}
			if (r.Maj && !Maj)
			{
				return false;
			}
			return true;
		}

		public static string? NomLocal(string nom)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Key? val = Cle(nom);
				if (!val.HasValue || clavier == null)
				{
					return null;
				}
				string displayName = ((InputControl)clavier[val.Value]).displayName;
				return string.IsNullOrWhiteSpace(displayName) ? null : displayName;
			}
			catch
			{
				return null;
			}
		}

		public unsafe static string? Capturer()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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)
			if (clavier == null)
			{
				return null;
			}
			if (toutes == null)
			{
				List<Key> list = new List<Key>();
				foreach (Key value in Enum.GetValues(typeof(Key)))
				{
					if ((int)value != 0)
					{
						try
						{
							_ = clavier[value];
							list.Add(value);
						}
						catch
						{
						}
					}
				}
				toutes = list.ToArray();
			}
			Key[] array = toutes;
			for (int i = 0; i < array.Length; i++)
			{
				Key val2 = array[i];
				bool wasPressedThisFrame;
				try
				{
					wasPressedThisFrame = ((ButtonControl)clavier[val2]).wasPressedThisFrame;
				}
				catch
				{
					continue;
				}
				if (wasPressedThisFrame)
				{
					string text = ((object)(*(Key*)(&val2))/*cast due to .constrained prefix*/).ToString();
					if (!NomsTouches.EstModificateur(text))
					{
						return text;
					}
				}
			}
			string[] array2 = new string[3] { "Mouse3", "Mouse4", "Mouse5" };
			foreach (string text2 in array2)
			{
				ButtonControl? obj3 = BoutonSouris(text2);
				if (obj3 != null && obj3.wasPressedThisFrame)
				{
					return text2;
				}
			}
			return null;
		}

		private static void Recevoir(char c)
		{
			if (tampon.Length < 256)
			{
				tampon.Append(c);
			}
		}

		public static void AbonnerTexte(bool oui)
		{
			if (oui == abonne)
			{
				return;
			}
			try
			{
				Keyboard current = Keyboard.current;
				if (current == null)
				{
					return;
				}
				if (oui)
				{
					if (abonnementImpossible)
					{
						return;
					}
					if (rappel == null)
					{
						rappel = DelegateSupport.ConvertDelegate<Action<char>>((Delegate)new Action<char>(Recevoir));
					}
					current.onTextInput += rappel;
					abonne = true;
				}
				else
				{
					if ((Delegate)(object)rappel != (Delegate)null)
					{
						current.onTextInput -= rappel;
					}
					abonne = false;
				}
				tampon.Clear();
			}
			catch (Exception ex)
			{
				abonne = false;
				if (oui && !abonnementImpossible)
				{
					abonnementImpossible = true;
					Plugin.Log_.LogWarning((object)("Saisie de texte par le clavier du jeu impossible (" + ex.Message + ") : repli sur Input.inputString."));
				}
			}
		}

		public static string LireTexte()
		{
			string text;
			if (abonne)
			{
				text = tampon.ToString();
				tampon.Clear();
			}
			else
			{
				try
				{
					text = Input.inputString ?? "";
				}
				catch
				{
					text = "";
				}
			}
			if (text.Length == 0)
			{
				return text;
			}
			StringBuilder stringBuilder = new StringBuilder(text.Length);
			string text2 = text;
			foreach (char c in text2)
			{
				if (!char.IsControl(c))
				{
					stringBuilder.Append(c);
				}
			}
			return stringBuilder.ToString();
		}

		public static bool SaisieTexteDuJeu()
		{
			try
			{
				EventSystem current = EventSystem.current;
				if ((Object)(object)current == (Object)null)
				{
					return false;
				}
				GameObject currentSelectedGameObject = current.currentSelectedGameObject;
				if ((Object)(object)currentSelectedGameObject == (Object)null)
				{
					return false;
				}
				TMP_InputField component = currentSelectedGameObject.GetComponent<TMP_InputField>();
				if ((Object)(object)component != (Object)null && component.isFocused)
				{
					return true;
				}
				InputField component2 = currentSelectedGameObject.GetComponent<InputField>();
				return (Object)(object)component2 != (Object)null && component2.isFocused;
			}
			catch
			{
				return false;
			}
		}

		public static void Deselectionner()
		{
			try
			{
				EventSystem current = EventSystem.current;
				if (current != null)
				{
					current.SetSelectedGameObject((GameObject)null);
				}
			}
			catch
			{
			}
		}

		private static InputActionSystem? TrouverSystemeEntrees()
		{
			Enumerator<World> enumerator = World.s_AllWorlds.GetEnumerator();
			while (enumerator.MoveNext())
			{
				World current = enumerator.Current;
				if (current != null && current.IsCreated)
				{
					InputActionSystem existingSystemManaged = current.GetExistingSystemManaged<InputActionSystem>();
					if (existingSystemManaged != null)
					{
						return existingSystemManaged;
					}
				}
			}
			return null;
		}

		public static void BloquerJeu(bool oui)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			if (oui == bloque || (oui && blocageImpossible))
			{
				return;
			}
			try
			{
				if (oui)
				{
					systemeEntrees = TrouverSystemeEntrees();
					World w = Monde.W;
					if (systemeEntrees != null && w != null)
					{
						if (ctxFocus == null)
						{
							ctxFocus = new ChatFocusedInputContext();
						}
						if (ctxSurvol == null)
						{
							ctxSurvol = new ChatHoveredInputContext();
						}
						IInputContext val = ((Il2CppObjectBase)ctxFocus).Cast<IInputContext>();
						IInputContext val2 = ((Il2CppObjectBase)ctxSurvol).Cast<IInputContext>();
						if (!systemeEntrees.IsContextRegistered(val))
						{
							systemeEntrees.AddInputContext(val, w, 99);
						}
						if (!systemeEntrees.IsContextRegistered(val2))
						{
							systemeEntrees.AddInputContext(val2, w, 99);
						}
						bloque = true;
					}
					return;
				}
				bloque = false;
				InputActionSystem val3 = systemeEntrees ?? TrouverSystemeEntrees();
				if (val3 == null)
				{
					return;
				}
				if (ctxFocus != null)
				{
					IInputContext val4 = ((Il2CppObjectBase)ctxFocus).Cast<IInputContext>();
					if (val3.IsContextRegistered(val4))
					{
						val3.RemoveInputContext(val4);
					}
				}
				if (ctxSurvol != null)
				{
					IInputContext val5 = ((Il2CppObjectBase)ctxSurvol).Cast<IInputContext>();
					if (val3.IsContextRegistered(val5))
					{
						val3.RemoveInputContext(val5);
					}
				}
			}
			catch (Exception ex)
			{
				if (oui)
				{
					blocageImpossible = true;
					bloque = false;
					Plugin.Log_.LogWarning((object)("Blocage des commandes du personnage impossible (" + ex.GetType().Name + " : " + ex.Message + ") : le menu marche, mais les touches tapées peuvent aussi agir en jeu."));
				}
			}
		}

		public static string? ConflitJeu(Raccourci r)
		{
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			if (r.Vide || r.Ctrl || r.Alt)
			{
				return null;
			}
			string text = null;
			try
			{
				if (r.Souris)
				{
					text = r.Touche switch
					{
						"Mouse3" => "<mouse>/middlebutton", 
						"Mouse4" => "<mouse>/backbutton", 
						"Mouse5" => "<mouse>/forwardbutton", 
						_ => null, 
					};
				}
				else
				{
					Key? val = Cle(r.Touche);
					if (val.HasValue && clavier != null)
					{
						text = "<keyboard>/" + ((InputControl)clavier[val.Value]).name.ToLowerInvariant();
					}
				}
				if (text == null)
				{
					return null;
				}
				InputActionSystem? obj = TrouverSystemeEntrees();
				InputActionAsset val2 = ((obj != null) ? obj._LoadedInputActions : null);
				if ((Object)(object)val2 == (Object)null)
				{
					return null;
				}
				ReadOnlyArray<InputActionMap> actionMaps = val2.actionMaps;
				for (int i = 0; i < actionMaps.Count; i++)
				{
					InputActionMap val3 = actionMaps[i];
					string text2 = val3.name ?? "";
					if (text2.Contains("Debug", StringComparison.OrdinalIgnoreCase) || text2.Contains("Admin", StringComparison.OrdinalIgnoreCase))
					{
						continue;
					}
					ReadOnlyArray<InputAction> actions = val3.actions;
					for (int j = 0; j < actions.Count; j++)
					{
						ReadOnlyArray<InputBinding> bindings = actions[j].bindings;
						for (int k = 0; k < bindings.Count; k++)
						{
							string effectivePath = bindings[k].effectivePath;
							if (effectivePath != null && effectivePath.ToLowerInvariant() == text)
							{
								return actions[j].name;
							}
						}
					}
				}
			}
			catch
			{
			}
			return null;
		}
	}
	internal static class Inventaire
	{
		private static Entity inventaire = Entity.Null;

		private static readonly HashSet<long> equipes = new HashSet<long>();

		private static bool signaleSansReseau;

		private static bool signaleIntrouvable;

		private static long Cle(Entity e)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			return ((long)e.Index << 32) | (uint)e.Version;
		}

		public static bool Lire(List<Case> sortie, bool protegerBarre, Func<int, bool>? interesse = null)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			sortie.Clear();
			if (!Monde.EnJeu)
			{
				return false;
			}
			EntityManager em = Monde.Em;
			Entity personnage = Monde.Personnage;
			if (!((EntityManager)(ref em)).Exists(personnage) || ((EntityManager)(ref em)).HasComponent<Dead>(personnage))
			{
				return false;
			}
			if (!TrouverInventaire(personnage, out var inv))
			{
				if (!signaleIntrouvable)
				{
					signaleIntrouvable = true;
					Plugin.Log_.LogWarning((object)"Inventaire du personnage introuvable (encore en chargement ?).");
				}
				return false;
			}
			inventaire = inv;
			bool flag = false;
			DynamicBuffer<InventoryBuffer> buffer = ((EntityManager)(ref em)).GetBuffer<InventoryBuffer>(inv, true);
			int length = buffer.Length;
			for (int i = 0; i < length; i++)
			{
				InventoryBuffer val = buffer[i];
				int guidHash = ((PrefabGUID)(ref val.ItemType)).GuidHash;
				if (guidHash == 0 || val.Amount <= 0)
				{
					continue;
				}
				bool flag2 = protegerBarre && i < 8;
				if (!flag2 && (interesse == null || interesse(guidHash)))
				{
					if (!flag)
					{
						Equipes(personnage);
						flag = true;
					}
					Entity syncedEntityOrNull = ((NetworkedEntity)(ref val.ItemEntity)).GetSyncedEntityOrNull();
					flag2 = syncedEntityOrNull != Entity.Null && equipes.Contains(Cle(syncedEntityOrNull));
				}
				sortie.Add(new Case(i, guidHash, val.Amount, flag2));
			}
			return true;
		}

		private static bool TrouverInventaire(Entity perso, out Entity inv)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			inv = Entity.Null;
			EntityManager em = Monde.Em;
			if (((EntityManager)(ref em)).HasComponent<InventoryInstanceElement>(perso))
			{
				DynamicBuffer<InventoryInstanceElement> buffer = ((EntityManager)(ref em)).GetBuffer<InventoryInstanceElement>(perso, true);
				for (int i = 0; i < buffer.Length; i++)
				{
					InventoryInstanceElement val = buffer[i];
					if ((int)val.Category == 0)
					{
						Entity syncedEntityOrNull = ((NetworkedEntity)(ref val.ExternalInventoryEntity)).GetSyncedEntityOrNull();
						if (syncedEntityOrNull != Entity.Null && ((EntityManager)(ref em)).Exists(syncedEntityOrNull) && ((EntityManager)(ref em)).HasComponent<InventoryBuffer>(syncedEntityOrNull))
						{
							inv = syncedEntityOrNull;
							return true;
						}
					}
				}
			}
			if (((EntityManager)(ref em)).HasComponent<InventoryBuffer>(perso))
			{
				inv = perso;
				return true;
			}
			return false;
		}

		private static void Equipes(Entity perso)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			equipes.Clear();
			EntityManager em = Monde.Em;
			if (((EntityManager)(ref em)).HasComponent<Equipment>(perso))
			{
				Equipment componentData = ((EntityManager)(ref em)).GetComponentData<Equipment>(perso);
				Ajouter(componentData.WeaponSlot);
				Ajouter(componentData.GrimoireSlot);
				Ajouter(componentData.ArmorHeadgearSlot);
				Ajouter(componentData.ArmorChestSlot);
				Ajouter(componentData.ArmorGlovesSlot);
				Ajouter(componentData.ArmorLegsSlot);
				Ajouter(componentData.ArmorFootgearSlot);
				Ajouter(componentData.CloakSlot);
				Ajouter(componentData.BagSlot);
				Ajouter(componentData.ChestCosmeticSlot);
				Ajouter(componentData.LegsCosmeticSlot);
				Ajouter(componentData.FootgearCosmeticSlot);
				Ajouter(componentData.GlovesCosmeticSlot);
				Ajouter(componentData.CloakCosmeticSlot);
			}
		}

		private static void Ajouter(EquipmentSlot s)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			Entity syncedEntityOrNull = ((NetworkedEntity)(ref s.SlotEntity)).GetSyncedEntityOrNull();
			if (syncedEntityOrNull != Entity.Null)
			{
				equipes.Add(Cle(syncedEntityOrNull));
			}
		}

		public static bool Jeter(int index)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			EntityManager em = Monde.Em;
			if (inventaire == Entity.Null || !((EntityManager)(ref em)).Exists(inventaire))
			{
				return false;
			}
			if (!((EntityManager)(ref em)).HasComponent<NetworkId>(inventaire))
			{
				if (!signaleSansReseau)
				{
					signaleSansReseau = true;
					Plugin.Log_.LogWarning((object)"L'inventaire n'a pas de NetworkId : le serveur ne pourrait pas le reconnaître, aucun jet envoyé.");
				}
				return false;
			}
			EventHelper.TryDropInventoryItem(em, inventaire, index);
			return true;
		}
	}
	internal static class LangueJeu
	{
		private static double prochain;

		private static string dernier = "\u0001";

		private static int essaisPolices;

		public static void Charger()
		{
			using Stream stream = typeof(LangueJeu).Assembly.GetManifestResourceStream("Exil.langues.tsv");
			if (stream == null)
			{
				Plugin.Log_.LogWarning((object)"Table des langues absente : textes en anglais de secours.");
				return;
			}
			using StreamReader streamReader = new StreamReader(stream, Encoding.UTF8);
			Langue.Charger(streamReader.ReadToEnd());
			Langue.Choisir(Langue.CodeDepuisJeu(Reglages.LangueForcee ?? "en"));
		}

		private static string LireJeu()
		{
			try
			{
				return Localization.CurrentLanguage ?? "";
			}
			catch
			{
				return "";
			}
		}

		public static void Image(double t)
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			if (t < prochain)
			{
				return;
			}
			prochain = t + 2.0;
			string text = Reglages.LangueForcee ?? LireJeu();
			if (!string.IsNullOrWhiteSpace(text) && text != dernier)
			{
				dernier = text;
				if (Langue.Choisir(Langue.CodeDepuisJeu(text)))
				{
					ManualLogSource log_ = Plugin.Log_;
					bool flag = default(bool);
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(31, 2, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Langue du menu : ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(Langue.Code);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (jeu : « ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" »).");
					}
					log_.LogInfo(val);
					essaisPolices = 0;
					Polices.Charger(force: true);
					AppliquerPartout();
					if (CatalogueJeu.Pret || CatalogueJeu.EnCours)
					{
						CatalogueJeu.Reinitialiser();
					}
					return;
				}
			}
			bool chargeesUneFois = Polices.ChargeesUneFois;
			if (!Polices.Vivantes && Polices.Charger())
			{
				if (chargeesUneFois)
				{
					Plugin.Log_.LogInfo((object)"Polices du jeu remplacées : l'exemplaire utilisé venait d'être déchargé par le jeu.");
				}
				AppliquerPartout();
			}
			else if (!Polices.Completes && essaisPolices < 300)
			{
				essaisPolices++;
				if (Polices.Charger())
				{
					AppliquerPartout();
				}
			}
		}

		private static void AppliquerPartout()
		{
			F.RafraichirPolices();
			Menu.AppliquerLangue();
			Hud.AppliquerLangue();
		}
	}
	internal static class Monde
	{
		private static double prochainScan;

		private static double prochainPerso;

		public static World? W { get; private set; }

		public static EntityManager Em { get; private set; }

		public static bool EnJeu { get; private set; }

		public static Entity Personnage { get; private set; }

		public static int Generation { get; private set; }

		public static void Rafraichir()
		{
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Expected O, but got Unknown
			double realtimeSinceStartupAsDouble = Time.realtimeSinceStartupAsDouble;
			if (W != null)
			{
				bool flag;
				try
				{
					flag = W.IsCreated;
				}
				catch
				{
					flag = false;
				}
				if (!flag)
				{
					Perdre();
				}
			}
			if (W == null)
			{
				EnJeu = false;
				if (realtimeSinceStartupAsDouble < prochainScan)
				{
					return;
				}
				prochainScan = realtimeSinceStartupAsDouble + 1.0;
				Enumerator<World> enumerator = World.s_AllWorlds.GetEnumerator();
				bool flag2 = default(bool);
				while (enumerator.MoveNext())
				{
					World current = enumerator.Current;
					if (current != null && current.IsCreated && current.GetExistingSystemManaged<ClientScriptMapper>() != null)
					{
						W = current;
						Em = current.EntityManager;
						Generation++;
						prochainPerso = 0.0;
						ManualLogSource log_ = Plugin.Log_;
						BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(27, 1, ref flag2);
						if (flag2)
						{
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Monde client trouvé : « ");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(current.Name);
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ».");
						}
						log_.LogInfo(val);
						break;
					}
				}
				if (W == null)
				{
					return;
				}
			}
			EntityManager em;
			if (realtimeSinceStartupAsDouble >= prochainPerso || !EnJeu)
			{
				prochainPerso = realtimeSinceStartupAsDouble + 0.5;
				Entity val2 = default(Entity);
				if (ConsoleShared.TryGetLocalCharacterInCurrentWorld(ref val2, W))
				{
					em = Em;
					if (((EntityManager)(ref em)).Exists(val2))
					{
						Personnage = val2;
						EnJeu = true;
						return;
					}
				}
				EnJeu = false;
			}
			else
			{
				em = Em;
				if (!((EntityManager)(ref em)).Exists(Personnage))
				{
					EnJeu = false;
				}
			}
		}

		private static void Perdre()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			W = null;
			EnJeu = false;
			Personnage = Entity.Null;
			Generation++;
			Plugin.Log_.LogInfo((object)"Monde client fermé (déconnexion ou changement de serveur).");
		}

		public static T? Systeme<T>() where T : ComponentSystemBase
		{
			if (W == null)
			{
				return default(T);
			}
			return W.GetExistingSystemManaged<T>();
		}
	}
	internal static class ObjetsVerifies
	{
		public const int Verifie = 1;

		public const int NonVerifie = 2;

		public const int Exclu = 3;

		public static readonly Dictionary<int, byte> Verdicts = new Dictionary<int, byte>
		{
			[1328680870] = 3,
			[-786493143] = 3,
			[-1905547794] = 3,
			[269771183] = 3,
			[862477668] = 1,
			[271594022] = 1,
			[1566989408] = 1,
			[-2137364987] = 2,
			[711062517] = 1,
			[1241831522] = 1,
			[-1354920908] = 1,
			[-1359494169] = 1,
			[1101206623] = 1,
			[1204352435] = 1,
			[-15390086] = 1,
			[-1837769884] = 1,
			[-1329744719] = 1,
			[51576788] = 1,
			[138060378] = 1,
			[666433583] = 1,
			[560446510] = 1,
			[-1023762087] = 1,
			[-1921018689] = 1,
			[1469185034] = 1,
			[1395895315] = 1,
			[1400688919] = 1,
			[1646489863] = 1,
			[1855323424] = 1,
			[1531721602] = 1,
			[-382349289] = 1,
			[540608060] = 1,
			[-1214309698] = 1,
			[-14368032] = 1,
			[830032282] = 2,
			[-262414476] = 1,
			[-1447213995] = 1,
			[1779299585] = 1,
			[-1021407417] = 1,
			[-1463158090] = 1,
			[531984050] = 1,
			[-410008482] = 1,
			[-1289010178] = 1,
			[675013523] = 1,
			[1762839393] = 1,
			[-1681104075] = 1,
			[-1987586694] = 1,
			[-1386314668] = 1,
			[-1495639636] = 1,
			[1985892973] = 1,
			[-473351958] = 1,
			[-1370210913] = 1,
			[1915695899] = 1,
			[1247086852] = 1,
			[-222860772] = 1,
			[-1619308732] = 1,
			[2019195024] = 1,
			[-1897495615] = 1,
			[1226559814] = 1,
			[-2035190786] = 1,
			[1996361886] = 1,
			[2000981302] = 1,
			[1552240197] = 1,
			[1738392650] = 1,
			[1818351545] = 1,
			[-1043479168] = 1,
			[-1800289670] = 1,
			[-626353315] = 1,
			[1227483037] = 1,
			[858598154] = 1,
			[-1461326411] = 1,
			[-1723445833] = 2,
			[329301090] = 1,
			[-958936382] = 1,
			[-957963240] = 1,
			[-112921782] = 1,
			[763326246] = 1,
			[-2100321922] = 1,
			[1809631067] = 1,
			[-604941435] = 1,
			[-1641042717] = 1,
			[-69916288] = 1,
			[-2127687996] = 1,
			[-2102875089] = 1,
			[-930514044] = 1,
			[-1279475298] = 1,
			[1871735757] = 1,
			[-919709436] = 1,
			[750788905] = 1,
			[1055898174] = 1,
			[1033753207] = 1,
			[933057100] = 1,
			[114259912] = 1,
			[1392314162] = 1,
			[-247737453] = 1,
			[-511360389] = 1,
			[538326235] = 1,
			[1712262077] = 1,
			[896678280] = 1,
			[-1349059251] = 1,
			[-625033436] = 3,
			[1953885108] = 2,
			[1063517722] = 1,
			[-1819786494] = 1,
			[786585343] = 1,
			[-227965303] = 1,
			[-168044197] = 1,
			[1284160983] = 1,
			[-24337506] = 1,
			[1261174372] = 1,
			[-1514540144] = 1,
			[-766642494] = 1,
			[-305440546] = 1,
			[1335546377] = 1,
			[150621304] = 1,
			[-1768698241] = 1,
			[-1067360120] = 1,
			[1677983904] = 1,
			[-2091288477] = 1,
			[2147390246] = 1,
			[1275572025] = 1,
			[-1324340002] = 1,
			[-589858836] = 1,
			[1410262258] = 1,
			[-2081646636] = 1,
			[707710831] = 1,
			[239338934] = 1,
			[-1023114892] = 1,
			[-1755568324] = 1,
			[-1814109557] = 1,
			[379281083] = 1,
			[821609569] = 1,
			[136740861] = 1,
			[584164197] = 1,
			[1863126275] = 1,
			[-1177172544] = 1,
			[-82465606] = 1,
			[-1382451936] = 1,
			[-1823614190] = 1,
			[1128262258] = 1,
			[-869864524] = 1,
			[-437611596] = 1,
			[-810738866] = 1,
			[970650569] = 1,
			[423790753] = 1,
			[-2139183850] = 1,
			[800879747] = 1,
			[429052660] = 1,
			[947998050] = 1,
			[-204051056] = 1,
			[-1965958712] = 1,
			[-1413694594] = 2,
			[890484447] = 1,
			[639992282] = 1,
			[1851490036] = 1,
			[-269326085] = 1,
			[-1568756102] = 1,
			[828432508] = 1,
			[1223264867] = 1,
			[2063723255] = 1,
			[-1885959251] = 1,
			[272647158] = 1,
			[2107622409] = 1,
			[248289327] = 1,
			[1510182325] = 1,
			[-38051433] = 1,
			[-1566269773] = 1,
			[-1322000172] = 1,
			[541321301] = 1,
			[-1513937321] = 3,
			[2042311455] = 3,
			[213967097] = 3,
			[961990006] = 3,
			[-338333923] = 3,
			[1252366498] = 3,
			[1395316286] = 3,
			[215017089] = 3,
			[-2141642225] = 3,
			[-112151309] = 3,
			[886819019] = 3,
			[34841965] = 3,
			[-107137497] = 3,
			[1452779821] = 3,
			[-364321170] = 3,
			[-1199531707] = 3,
			[927039475] = 3,
			[2029158532] = 3,
			[930747930] = 3,
			[-836889492] = 3,
			[2015299972] = 3,
			[-2102469163] = 1,
			[98952351] = 1,
			[-978856806] = 1,
			[904226111] = 1,
			[1186268870] = 1,
			[-1561468105] = 1,
			[1646351394] = 1,
			[948466634] = 1,
			[-502657668] = 3,
			[1713274869] = 3,
			[-504120321] = 3,
			[1002452390] = 3,
			[-251408621] = 3,
			[329820611] = 3,
			[403228886] = 3,
			[-1913267809] = 3,
			[70790760] = 3,
			[-1966309638] = 3,
			[758351209] = 3,
			[-1294665102] = 3,
			[-1970668481] = 3,
			[-331907553] = 3,
			[-298146452] = 3,
			[537568578] = 3,
			[1623411847] = 3,
			[1466670454] = 3,
			[-1635653575] = 3,
			[343359674] = 3,
			[1216450741] = 2,
			[-2029933415] = 1,
			[1746537832] = 1,
			[-1183157751] = 1,
			[-258808647] = 1,
			[181112381] = 1,
			[-399521517] = 1,
			[-752418019] = 1,
			[-406808302] = 1,
			[-327754127] = 1,
			[322804535] = 1,
			[1247389106] = 1,
			[1067300584] = 1,
			[2055058719] = 1,
			[998240678] = 1,
			[-1752332712] = 1,
			[1508214166] = 1,
			[-1296203752] = 1,
			[-204401621] = 1,
			[1039083725] = 1,
			[-1826382550] = 1,
			[-1899539896] = 1,
			[1982551454] = 1,
			[-749828559] = 1,
			[-1522497513] = 1,
			[-745793193] = 2,
			[-2128818978] = 1,
			[-1988816037] = 1,
			[-1607893829] = 1,
			[714007172] = 1,
			[1729289046] = 1,
			[-2111388989] = 1,
			[-152150271] = 1,
			[1707139699] = 1,
			[238268650] = 1,
			[-353076115] = 1,
			[409678749] = 1,
			[-1818243335] = 1,
			[-1721887666] = 1,
			[-1460281233] = 1,
			[417648894] = 1,
			[607559019] = 1,
			[-2073081569] = 1,
			[1780339680] = 1,
			[-1071187362] = 1,
			[-262204844] = 1,
			[-548847761] = 1,
			[-1797796642] = 1,
			[1364460757] = 1,
			[764480170] = 2,
			[403967307] = 1,
			[1587354182] = 2,
			[-2125696865] = 2,
			[1375804543] = 1,
			[690259405] = 1,
			[974739126] = 1,
			[-1785271534] = 1,
			[-2020831626] = 2,
			[-1169471531] = 1,
			[1262845777] = 1,
			[-1886460367] = 1,
			[1270271716] = 1,
			[-412448857] = 1,
			[-1913156733] = 1,
			[1821405450] = 1,
			[362386181] = 1,
			[-383004511] = 1,
			[-1601304786] = 1,
			[-668460646] = 1,
			[1529216919] = 1,
			[762038154] = 1,
			[-1147510581] = 1,
			[-1788912715] = 1,
			[-534142437] = 1,
			[-706178162] = 1,
			[-1958602686] = 1,
			[1192629421] = 1,
			[1850873910] = 1,
			[-849449432] = 1,
			[2025615662] = 1,
			[1753801067] = 1,
			[626083889] = 1,
			[-1595316636] = 1,
			[-2066262923] = 1,
			[1561721357] = 1,
			[-1261118965] = 1,
			[502133568] = 1,
			[-1840162782] = 1,
			[-1161279574] = 1,
			[-764630320] = 1,
			[1014370193] = 1,
			[1840869087] = 1,
			[-1242910338] = 1,
			[-1344118299] = 1,
			[735880687] = 1,
			[-46006079] = 1,
			[-777417289] = 1,
			[2020764183] = 1,
			[1485993952] = 1,
			[-1512099553] = 1,
			[-196284663] = 1,
			[1172935197] = 1,
			[1364444719] = 1,
			[-117205517] = 1,
			[347441899] = 1,
			[1328323768] = 1,
			[1912738568] = 1,
			[-595456862] = 1,
			[-1718233147] = 1,
			[-996201260] = 1,
			[-1260890289] = 1,
			[-2049321404] = 1,
			[-2104396934] = 1,
			[-895015382] = 1,
			[2114304481] = 1,
			[791584738] = 1,
			[1556544548] = 1,
			[-2013887729] = 1,
			[-1269116849] = 1,
			[492964298] = 1,
			[-1563178470] = 1,
			[756555009] = 1,
			[-1242947472] = 1,
			[978074988] = 1,
			[-1233700610] = 1,
			[626118128] = 1,
			[-946177070] = 1,
			[1718353003] = 1,
			[-137886670] = 1,
			[1906638073] = 2,
			[1336896559] = 2,
			[-293419350] = 1,
			[-1542642288] = 1,
			[-1913800363] = 1,
			[1310923765] = 1,
			[350769859] = 1,
			[1458090717] = 1,
			[587164554] = 1,
			[-224716062] = 1,
			[759775881] = 1,
			[-1658630722] = 1,
			[1939500376] = 1,
			[1474515294] = 1,
			[1702347530] = 1,
			[-1063966176] = 1,
			[-1803818846] = 1,
			[-749171183] = 1,
			[-1424521314] = 1,
			[860383634] = 1,
			[-1221174479] = 1,
			[742900616] = 1,
			[835610037] = 1,
			[1341367867] = 1,
			[1383064284] = 1,
			[-96701352] = 1,
			[-1696677607] = 1,
			[389446538] = 1,
			[-1929817673] = 1,
			[285318201] = 1,
			[-840839363] = 1,
			[-1676748911] = 1,
			[879103343] = 2,
			[679755989] = 1,
			[-946597284] = 1,
			[1594270493] = 1,
			[-1171060793] = 1,
			[-1060453249] = 1,
			[776216743] = 1,
			[1307976528] = 1,
			[-1383718976] = 1,
			[-1645899934] = 1,
			[-452767162] = 1,
			[38319072] = 1,
			[2094602185] = 1,
			[-94650344] = 1,
			[-1321865795] = 1,
			[2053574378] = 1,
			[-449615886] = 1,
			[11798247] = 1,
			[-67943596] = 1,
			[207381334] = 1,
			[-130369231] = 1,
			[489001758] = 1,
			[-832387204] = 1,
			[-1624005683] = 1,
			[824237901] = 1,
			[-205820651] = 1,
			[1455590675] = 1,
			[1150376281] = 1,
			[-853559619] = 1,
			[473545520] = 1,
			[-1870194782] = 1,
			[-1394295910] = 1,
			[1823379076] = 1,
			[-513865346] = 1,
			[-1061940339] = 1,
			[1249076837] = 1,
			[686122001] = 2,
			[1519475093] = 2,
			[-651642571] = 1,
			[-999518496] = 1,
			[1691702273] = 1,
			[-1304625582] = 1,
			[-63123159] = 1,
			[-1564741377] = 1,
			[1040245278] = 1,
			[206151993] = 1,
			[-1236809045] = 1,
			[1428883363] = 1,
			[-1957642407] = 1,
			[1884115881] = 1,
			[-581757157] = 1,
			[-2086890414] = 1,
			[-2017255390] = 1,
			[-106224889] = 1,
			[-1205373095] = 1,
			[1905539368] = 1,
			[1413772406] = 1,
			[660670410] = 1,
			[-1596352033] = 1,
			[-1519267007] = 1,
			[574313564] = 1,
			[-213056154] = 1,
			[-192381912] = 1,
			[937375187] = 1,
			[1856338018] = 1,
			[1253216070] = 1,
			[1271236919] = 1,
			[1126901893] = 1,
			[730869315] = 1,
			[460843266] = 1,
			[-1793793429] = 1,
			[722498174] = 1,
			[-1003381140] = 1,
			[1526542305] = 1,
			[-567468235] = 1,
			[1370998844] = 1,
			[-349470582] = 1,
			[-977419819] = 1,
			[1350548439] = 1,
			[1942009728] = 1,
			[615301463] = 1,
			[-1690985210] = 1,
			[-1783670291] = 1,
			[-1396190808] = 1,
			[-1455124124] = 1,
			[1427084419] = 1,
			[1075465533] = 1,
			[-457986654] = 1,
			[1200302278] = 1,
			[710159072] = 1,
			[-1033721040] = 1,
			[1046366876] = 1,
			[960030104] = 1,
			[724428437] = 1,
			[-950839771] = 1,
			[551949280] = 1,
			[421203343] = 1,
			[-953253466] = 2,
			[317317590] = 1,
			[-1257026088] = 1,
			[-700774739] = 1,
			[-1932461974] = 1,
			[28625845] = 1,
			[-571562864] = 1,
			[-949672483] = 1,
			[-456161884] = 1,
			[2012771684] = 1,
			[444400639] = 1,
			[-257494203] = 1,
			[-77477508] = 1,
			[1334469825] = 2,
			[-1715039285] = 1,
			[-1578565561] = 1,
			[424158416] = 1,
			[-1779269313] = 1,
			[2069171407] = 1,
			[-1642545082] = 1,
			[447901086] = 1,
			[67930804] = 1,
			[-149778795] = 1,
			[736318803] = 1,
			[177845365] = 1,
			[176401052] = 1,
			[-570287766] = 1,
			[-242277891] = 1,
			[225530658] = 1,
			[-1962855117] = 1,
			[1705028227] = 1,
			[-106283194] = 1,
			[-656822228] = 3,
			[-237441421] = 1,
			[357608868] = 1,
			[1898237421] = 1,
			[1354115931] = 1,
			[-1129708579] = 1,
			[802050789] = 1,
			[-1963826510] = 1,
			[750542699] = 1,
			[287586809] = 1,
			[51046573] = 1,
			[74811721] = 1,
			[188653143] = 1,
			[552409457] = 1,
			[131015492] = 1,
			[-1147920398] = 1,
			[-2020212226] = 1,
			[867351268] = 1,
			[-2118441460] = 1,
			[-2051574178] = 1,
			[-1983566585] = 1,
			[820932258] = 1,
			[2115367516] = 2,
			[2106123809] = 1,
			[-1233716303] = 1,
			[-1749304196] = 1,
			[-608131642] = 1,
			[988417522] = 1,
			[1413130999] = 3,
			[-167936394] = 1,
			[-580716317] = 1,
			[-1838793646] = 1,
			[1488205677] = 1,
			[828271620] = 1,
			[-1907572080] = 1,
			[193249843] = 3,
			[889298519] = 3,
			[301051123] = 3,
			[968796494] = 3,
			[-1617671082] = 3,
			[-77555820] = 3,
			[-696770536] = 3,
			[-1237019921] = 1,
			[-1805325497] = 1,
			[-762000259] = 1,
			[-1748835106] = 1,
			[-1027710236] = 1,
			[660533034] = 2,
			[-1750550553] = 1,
			[1332980397] = 1,
			[-543524210] = 1,
			[-1583485601] = 1,
			[-1787563914] = 1,
			[1686577386] = 1,
			[880699252] = 1,
			[1501868129] = 1,
			[-1527315816] = 1,
			[-651878258] = 1,
			[1553481703] = 1,
			[806031638] = 1,
			[1561531999] = 1,
			[-1012087769] = 1,
			[-744023422] = 1,
			[1314569175] = 1,
			[759629166] = 1,
			[-295674777] = 1,
			[1532551951] = 1,
			[177536500] = 1,
			[201124833] = 1,
			[-1150810012] = 1,
			[-1645974345] = 1,
			[583764996] = 1,
			[-1289785922] = 1,
			[-1305686817] = 1,
			[1725419936] = 1,
			[-1361596609] = 1,
			[765693103] = 1,
			[-1402113736] = 1,
			[1913822231] = 1,
			[1703128595] = 1,
			[-1381982890] = 1,
			[-1034273124] = 1,
			[814603706] = 1,
			[-1017402979] = 1,
			[-135435342] = 1,
			[1726420644] = 1,
			[-926928101] = 1,
			[362941759] = 1,
			[455638025] = 1,
			[-164367832] = 1,
			[813370507] = 1,
			[-363718499] = 1,
			[1474643910] = 1,
			[-1409142667] = 1,
			[-182923609] = 1,
			[88009216] = 1,
			[106516056] = 1,
			[1105981714] = 1,
			[-598100816] = 1,
			[855691699] = 1,
			[-1190647720] = 1,
			[1658596502] = 1,
			[-2043983118] = 1,
			[2116142390] = 1,
			[-1397591435] = 1,
			[780044299] = 1,
			[2085163661] = 1,
			[2065714452] = 1,
			[-1629804427] = 2,
			[-1222725729] = 1,
			[-1979905169] = 1,
			[-1199259626] = 2,
			[1005440012] = 1,
			[-793913499] = 1,
			[-1458997116] = 1,
			[702067317] = 1,
			[-11246506] = 1,
			[-2130812821] = 1,
			[-1531666018] = 1,
			[689272399] = 1,
			[1788016417] = 1,
			[1388962120] = 1,
			[834864259] = 1,
			[-2047402903] = 1,
			[-305160765] = 1,
			[-1562867444] = 1,
			[-898917584] = 1,
			[1872733144] = 1,
			[805157024] = 1,
			[1252507075] = 1,
			[-223452038] = 2,
			[440780337] = 1,
			[608397239] = 1,
			[-1740500585] = 1,
			[-2014020548] = 1,
			[-1593377811] = 1,
			[-113436752] = 1,
			[-996555621] = 1,
			[-1624411159] = 1,
			[343217159] = 1,
			[-2059886133] = 1,
			[-585346267] = 1,
			[75934448] = 1,
			[918613164] = 1,
			[-1337809256] = 1,
			[-431964258] = 1,
			[-41686151] = 1,
			[-312598876] = 1,
			[-1952560879] = 1,
			[1881059081] = 1,
			[519281449] = 1,
			[1785926321] = 1,
			[738473666] = 1,
			[-2137054310] = 1,
			[-1302801575] = 1,
			[271061481] = 1,
			[1755478077] = 1,
			[662891042] = 1,
			[1799289635] = 1,
			[1499979825] = 1,
			[-562511117] = 1,
			[1279283644] = 1,
			[-1844141622] = 1,
			[1692133021] = 1,
			[2130810069] = 1,
			[1083105737] = 1,
			[1035334240] = 1,
			[1112619884] = 1,
			[1243967840] = 1,
			[1168555540] = 1,
			[-1674555897] = 1,
			[-2133879652] = 1,
			[157004582] = 1,
			[-1601295908] = 1,
			[685024499] = 1,
			[-209873380] = 1,
			[-1111771702] = 1,
			[-1090887222] = 1,
			[-322544495] = 1,
			[1613948207] = 1,
			[-2054797612] = 1,
			[-1796954295] = 1,
			[-651841188] = 1,
			[-374243736] = 1,
			[818069106] = 1,
			[-1166627007] = 1,
			[-443169356] = 1,
			[155899991] = 1,
			[666089763] = 1,
			[1908312304] = 1,
			[1030854657] = 1,
			[-441408420] = 1,
			[-390381611] = 1,
			[2134082866] = 1,
			[-309124704] = 1,
			[-269336230] = 1,
			[-535477182] = 1,
			[-710738056] = 1,
			[223899244] = 1,
			[55473000] = 1,
			[594180030] = 1,
			[1381699867] = 1,
			[-1530254765] = 1,
			[-16130732] = 1,
			[1123463900] = 1,
			[-1190496962] = 1,
			[-147757377] = 1,
			[-930352575] = 1,
			[-2117279191] = 1,
			[-483235215] = 1,
			[1793042384] = 1,
			[320961855] = 1,
			[1947940084] = 1,
			[1729390800] = 1,
			[1387124262] = 1,
			[437696083] = 1,
			[-1255119436] = 1,
			[101601247] = 1,
			[-928330249] = 1,
			[1123282909] = 1,
			[1520619383] = 1,
			[606339127] = 1,
			[665418354] = 1,
			[1540217782] = 1,
			[-1952374182] = 1,
			[-1513121786] = 1,
			[-826325611] = 1,
			[870884715] = 1,
			[455494178] = 1,
			[-1206629745] = 1,
			[998259069] = 1,
			[97169184] = 1,
			[130269272] = 1,
			[2075997018] = 1,
			[902426262] = 1,
			[-1766731531] = 1,
			[-1444759832] = 1,
			[-941913536] = 1,
			[-455117097] = 1,
			[-560146452] = 1,
			[876293388] = 1,
			[-1703746731] = 1,
			[994654794] = 1,
			[-313733383] = 1,
			[90716564] = 1,
			[394140527] = 1,
			[-944716649] = 1,
			[-1416449755] = 1,
			[189228039] = 1,
			[973763812] = 1,
			[-341717525] = 1,
			[1533847605] = 1,
			[-703021474] = 1,
			[-2134499162] = 1,
			[-844537086] = 1,
			[182214837] = 1,
			[2023809276] = 1,
			[-1927784576] = 1,
			[-1697520941] = 1,
			[1448686547] = 1,
			[1909654697] = 1,
			[-464466648] = 1,
			[-189270614] = 1,
			[-556391992] = 1,
			[1075994038] = 3,
			[803445709] = 1,
			[-860388090] = 1,
			[-178249605] = 1,
			[977816262] = 1,
			[-1183600395] = 1,
			[-173571027] = 1,
			[1277476884] = 1,
			[-1347054873] = 1,
			[-593608743] = 1,
			[-647547545] = 1,
			[1042817390] = 1,
			[-1123608041] = 1,
			[-1508992859] = 1,
			[-318118264] = 1,
			[282707515] = 1,
			[-1913987811] = 1,
			[665184248] = 1,
			[1412786604] = 1,
			[-2100613085] = 1,
			[-749764415] = 1,
			[140526202] = 1,
			[-340571020] = 1,
			[897635802] = 1,
			[-1180115034] = 1,
			[1479677538] = 1,
			[725607617] = 2,
			[1355823667] = 1,
			[-2036196416] = 1,
			[1925394440] = 1,
			[-2095610608] = 1,
			[-90702575] = 1,
			[1458279255] = 1,
			[-1993947781] = 1,
			[12127911] = 1,
			[680112231] = 1,
			[744344540] = 1,
			[-454576348] = 1,
			[206495029] = 1,
			[-1555051415] = 1,
			[-1385786654] = 1,
			[-262114802] = 1,
			[703230071] = 1,
			[-481041545] = 1,
			[125611165] = 1,
			[993033515] = 1,
			[-345596442] = 1,
			[1592149279] = 1,
			[205207385] = 1,
			[-1558814807] = 1,
			[213736942] = 1,
			[-1564372276] = 1,
			[-536717606] = 1,
			[1811913705] = 1,
			[1217578824] = 3,
			[1966590385] = 2,
			[1655869633] = 1,
			[1557814269] = 1,
			[-652069131] = 1,
			[-1588051702] = 1,
			[-809059551] = 1,
			[50824544] = 1,
			[336922685] = 1,
			[-886916793] = 1,
			[341837267] = 1,
			[-1184863500] = 1,
			[-650855520] = 1,
			[199425997] = 1,
			[-1046748791] = 1,
			[1012837641] = 1,
			[-425306671] = 1,
			[-651554566] = 1,
			[610958202] = 1,
			[991396285] = 1,
			[-104934480] = 1,
			[-175650376] = 1,
			[1380368392] = 1,
			[-1306155896] = 1,
			[-296161379] = 1,
			[-1004351840] = 1,
			[666638454] = 1,
			[-1260254082] = 1,
			[-1581189572] = 1,
			[1286615355] = 1,
			[-21943750] = 1,
			[2103989354] = 1,
			[576389135] = 1,
			[28358550] = 1,
			[-219760992] = 1,
			[-1991977825] = 1,
			[-261654929] = 1,
			[-1922998918] = 1,
			[1117281334] = 1,
			[-181179773] = 1,
			[-1209228232] = 1,
			[-1793846754] = 1,
			[-554782766] = 1,
			[-1270904319] = 1,
			[-1617973064] = 1,
			[-1051190225] = 1,
			[-1087318964] = 1,
			[1148284648] = 1,
			[2128629897] = 1,
			[1002732935] = 1,
			[163122449] = 3,
			[1570017693] = 3,
			[1259464735] = 1,
			[-2147445292] = 2,
			[-102830349] = 1,
			[442700150] = 2,
			[-1024626758] = 3,
			[-1958888844] = 1,
			[-1391446205] = 1,
			[1541522788] = 1,
			[518802008] = 1,
			[-491969324] = 1,
			[-1579575933] = 1,
			[198951695] = 1,
			[-1130238142] = 1,
			[-2044057823] = 1,
			[2100090213] = 1,
			[1239564213] = 1,
			[2099198078] = 1,
			[-444900575] = 3,
			[-1774269887] = 3,
			[-2060572315] = 1,
			[-1746159915] = 2,
			[-27238530] = 1,
			[-655493979] = 2,
			[1401940772] = 3,
			[-1333849822] = 1,
			[1748886117] = 1,
			[-1470260175] = 1,
			[-1777908217] = 1,
			[-996999913] = 1,
			[-1024379681] = 2,
			[1958482379] = 3,
			[1716435762] = 3,
			[-517906196] = 1,
			[572026243] = 2,
			[935392085] = 1,
			[2061238391] = 2,
			[517296275] = 3,
			[-20041991] = 1,
			[898159697] = 1,
			[-1277074895] = 1,
			[-1636801169] = 1,
			[836066667] = 1,
			[1221976097] = 1,
			[-814739263] = 1,
			[1389040540] = 1,
			[1957540013] = 1,
			[-1401104184] = 1,
			[781586362] = 1,
			[-816018167] = 3,
			[-1566606969] = 3,
			[-1276458869] = 1,
			[-1075670534] = 2,
			[140761255] = 1,
			[-2137269775] = 2,
			[1719144622] = 3,
			[1296724931] = 1,
			[703783407] = 1,
			[-211034148] = 1,
			[1031107636] = 1,
			[-1961050884] = 2,
			[-1873605364] = 1,
			[-1233207977] = 2,
			[-1766408331] = 3,
			[1302850112] = 1,
			[-437176953] = 3,
			[-256643998] = 3,
			[869276797] = 1,
			[747911021] = 2,
			[-1173681254] = 1,
			[-1638796801] = 2,
			[-1743584975] = 3,
			[-768054337] = 1,
			[82781195] = 1,
			[674704033] = 1,
			[147836723] = 1,
			[1322254792] = 1,
			[820408138] = 1,
			[1272855317] = 1,
			[-726074700] = 3,
			[288292636] = 3,
			[-1003309553] = 1,
			[649637190] = 2,
			[1177453385] = 1,
			[285875674] = 2,
			[19130904] = 3,
			[532033005] = 1,
			[352247730] = 1,
			[-1993708658] = 1,
			[1951565953] = 1,
			[-1830162796] = 1,
			[1860352606] = 1,
			[1283345494] = 1,
			[-557203874] = 1,
			[1102277512] = 2,
			[264593098] = 3,
			[-2048346225] = 3,
			[1177597629] = 1,
			[1963988265] = 2,
			[1994084762] = 1,
			[-1810734832] = 2,
			[-1845443712] = 3,
			[1588258447] = 1,
			[-1998017941] = 1,
			[-687294429] = 1,
			[-331345186] = 1,
			[343324920] = 1,
			[-1714012261] = 1,
			[-276593802] = 1,
			[-184713893] = 1,
			[-126076280] = 1,
			[160471982] = 1,
			[675187526] = 1,
			[-915028618] = 1,
			[1333624152] = 3,
			[-1843989041] = 3,
			[14297698] = 1,
			[-1038642372] = 2,
			[-944318126] = 1,
			[1040125618] = 2,
			[-1502177717] = 3,
			[769603740] = 1,
			[1850870666] = 1,
			[674407758] = 1,
			[1071656850] = 1,
			[-1265586439] = 1,
			[1759077469] = 1,
			[1630030026] = 1,
			[-576626587] = 3,
			[-383870009] = 3,
			[-922125625] = 1,
			[-413259500] = 2,
			[-105026635] = 1,
			[886814985] = 2,
			[-2136716453] = 3,
			[-152327780] = 1,
			[1402953369] = 1,
			[1522792650] = 1,
			[1048518929] = 1,
			[-2081286944] = 1,
			[1778128946] = 1,
			[1887724512] = 2,
			[6711686] = 1,
			[-2053917766] = 1,
			[-465491217] = 1,
			[-859437190] = 1,
			[1801132968] = 1,
			[658426701] = 3,
			[810808231] = 3,
			[1930526079] = 1,
			[3759455] = 2,
			[821410795] = 1,
			[1271087499] = 2,
			[-1390536751] = 3,
			[-588909332] = 1,
			[926722036] = 1,
			[1499160417] = 1,
			[-1042299347] = 1,
			[-314614708] = 1,
			[866934844] = 1,
			[633666898] = 1,
			[1322545846] = 1,
			[506082542] = 1,
			[-2068145306] = 1,
			[1954207008] = 1,
			[1570363331] = 1,
			[-1930402723] = 1,
			[-1854790299] = 3,
			[912809090] = 3,
			[2001389164] = 1,
			[2142983740] = 2,
			[-1931117134] = 1,
			[1717016192] = 2,
			[-958110636] = 3,
			[2038011836] = 1,
			[1244180446] = 1,
			[1370755976] = 1,
			[790210443] = 1,
			[1853029976] = 1,
			[1065194820] = 1,
			[-352704566] = 1,
			[-850142339] = 1,
			[1307774440] = 1,
			[-1674680373] = 1,
			[124616797] = 1,
			[1564801426] = 3,
			[1908755405] = 3,
			[1637216050] = 1,
			[-1421775051] = 2,
			[195858450] = 1,
			[1048769481] = 2,
			[-830893351] = 3,
			[-2085919458] = 1,
			[-796306296] = 1,
			[-2037272000] = 1,
			[-1219959051] = 1,
			[-903587404] = 1,
			[-435501075] = 1,
			[-1455388114] = 1,
			[-774462329] = 1,
			[-1215982687] = 1,
			[2106567892] = 1,
			[220001518] = 1,
			[1835208468] = 3,
			[2023500574] = 3,
			[-1634108038] = 1,
			[1579758125] = 2,
			[152014105] = 1,
			[1479621167] = 2,
			[-228881628] = 3,
			[-1122389049] = 1,
			[-1651990235] = 1,
			[-1595292245] = 1,
			[-297349982] = 1,
			[-699863795] = 2,
			[601169005] = 1,
			[-1397287045] = 2,
			[-882837429] = 3,
			[1838862498] = 3,
			[1705984031] = 1,
			[-1222824286] = 2,
			[429323760] = 1,
			[1490846791] = 2,
			[1340494453] = 3,
			[-847062445] = 1,
			[1393113320] = 1,
			[-960205578] = 1,
			[-655095317] = 1,
			[567413754] = 1,
			[-671246832] = 1,
			[950358400] = 1
		};
	}
	internal static class SonsJeu
	{
		private static readonly LimiteurSons limiteur = new LimiteurSons();

		private static readonly int N = Enum.GetValues(typeof(SonMenu)).Length;

		private static readonly UISoundType[] equivalents;

		private static bool prepare;

		private static bool fmodOk;

		private static bool jeuOk;

		private static bool fabriquesOk;

		private static bool vcaOk;

		private static System coeur;

		private static System studio;

		private static StudioManager? manager;

		private static ChannelGroup groupe;

		private static VCA vca;

		private static readonly GUID[] guids;

		private static readonly bool[] guidsOk;

		private static readonly Sound[] sons;

		private static readonly bool[] sonsOk;

		public static string Voie { get; private set; }

		public static void Jouer(SonMenu s)
		{
			try
			{
				if (!Reglages.Sons || limiteur.Coupe || !Application.isFocused)
				{
					return;
				}
				if (!prepare)
				{
					Preparer();
				}
				if (limiteur.Autoriser(s, Time.realtimeSinceStartupAsDouble))
				{
					int num = (int)s;
					bool flag = false;
					if (jeuOk && guidsOk[num])
					{
						flag = JouerJeu(num);
					}
					if (!flag && fabriquesOk && sonsOk[num])
					{
						flag = JouerFabrique(num);
					}
				}
			}
			catch (Exception ex)
			{
				Erreur("jouer " + s, ex.GetType().Name + " " + ex.Message);
			}
		}

		private static void Erreur(string ou, string texte)
		{
			limiteur.Erreur();
			Plugin.Log_.LogWarning((object)("Sons : " + ou + " : " + texte + (limiteur.Coupe ? " (sons coupés pour la session)" : "")));
		}

		private static void Preparer()
		{
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Expected O, but got Unknown
			prepare = true;
			try
			{
				fmodOk = PreparerFmod();
			}
			catch (Exception ex)
			{
				fmodOk = false;
				Plugin.Log_.LogWarning((object)("Sons : FMOD indisponible (" + ex.Message + ")."));
			}
			if (fmodOk)
			{
				try
				{
					jeuOk = ChargerSonsDuJeu();
				}
				catch (Exception ex2)
				{
					Plugin.Log_.LogWarning((object)("Sons du jeu illisibles : " + ex2.Message));
				}
				try
				{
					fabriquesOk = ChargerFabriques();
				}
				catch (Exception ex3)
				{
					Plugin.Log_.LogWarning((object)("Sons fabriqués illisibles : " + ex3.Message));
				}
			}
			Voie = (jeuOk ? "sons du jeu" : (fabriquesOk ? "sons fabriqués" : "silence"));
			ManualLogSource log_ = Plugin.Log_;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(43, 3, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Sons du menu : ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(Voie);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (FMOD ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(fmodOk ? "prêt" : "absent");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", volume interface ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(vcaOk ? "suivi" : "non trouvé");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(").");
			}
			log_.LogInfo(val);
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static bool PreparerFmod()
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: 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_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: 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_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			manager = null;
			Enumerator<World> enumerator = World.s_AllWorlds.GetEnumerator();
			while (enumerator.MoveNext())
			{
				World current = enumerator.Current;
				if (current == null || !current.IsCreated)
				{
					continue;
				}
				StudioManagerSystem existingSystemManaged = current.GetExistingSystemManaged<StudioManagerSystem>();
				if (existingSystemManaged != null)
				{
					StudioManager studioManager = existingSystemManaged.StudioManager;
					if (studioManager != null)
					{
						manager = studioManager;
						break;
					}
				}
			}
			if (manager == null || !manager.IsInitialized)
			{
				return false;
			}
			System coreSystem = manager.CoreSystem;
			System studioSystem = manager.StudioSystem;
			if (coreSystem.handle == IntPtr.Zero)
			{
				return fals