Decompiled source of ValGazette v0.1.2

ValGazette.dll

Decompiled 10 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("assembly_valheim")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("ValGazette")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("ValGazette")]
[assembly: AssemblyTitle("ValGazette")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ValGazette
{
	[BepInPlugin("ghoosty.valgazette", "ValGazette", "0.1.2")]
	[BepInProcess("valheim.exe")]
	public class ValGazettePlugin : BaseUnityPlugin
	{
		private enum BarPos
		{
			Libre,
			SousMinimap,
			BasCentre
		}

		private enum Corner
		{
			TopLeft,
			TopRight,
			BottomLeft,
			BottomRight
		}

		private sealed class Popup
		{
			public SkillType Type;

			public string Text = "";

			public float Pct;

			public float Expire;

			public int Level;

			public bool Wrap;

			public bool Milestone;

			public float Disp;

			public float Alpha;

			public float Y = float.NaN;
		}

		[HarmonyPatch(typeof(Menu), "Show")]
		private static class MenuShowPatch
		{
			private static bool Prefix()
			{
				if ((Object)(object)_inst == (Object)null || !_inst._journalVisible)
				{
					return true;
				}
				_inst.SetJournal(open: false);
				return false;
			}
		}

		[HarmonyPatch(typeof(GameCamera), "UpdateMouseCapture")]
		private static class MouseCapturePatch
		{
			private static void Postfix()
			{
				if (!((Object)(object)_inst == (Object)null) && _inst._journalVisible && !Menu.IsVisible())
				{
					ZCursor.LockState = (CursorLockMode)0;
					ZCursor.Show();
				}
			}
		}

		[HarmonyPatch(typeof(PlayerController), "InInventoryEtc")]
		private static class JournalBlocksInputPatch
		{
			private static void Postfix(ref bool __result)
			{
				if ((Object)(object)_inst != (Object)null && _inst._journalVisible)
				{
					__result = true;
				}
			}
		}

		[HarmonyPatch(typeof(Skills), "RaiseSkill")]
		private static class RaiseSkillPatch
		{
			private static bool _patchFailed;

			private static void Postfix(Skills __instance, SkillType skillType)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_012e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0193: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_016c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0171: Unknown result type (might be due to invalid IL or missing references)
				//IL_017f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0185: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					Player localPlayer = Player.m_localPlayer;
					if (!Object.op_Implicit((Object)(object)localPlayer) || (int)skillType == 0 || (Object)(object)((Character)localPlayer).GetSkills() != (Object)(object)__instance)
					{
						return;
					}
					Skill skill = __instance.GetSkill(skillType);
					Popup popup = Popups.Find((Popup p) => p.Type == skillType);
					if (popup == null)
					{
						if (Popups.FindAll((Popup p) => p.Expire > Time.unscaledTime).Count >= 3)
						{
							Popups.Find((Popup p) => p.Expire > Time.unscaledTime).Expire = 0f;
						}
						Popups.Add(popup = new Popup
						{
							Type = skillType,
							Level = (int)skill.m_level,
							Disp = skill.GetLevelPercentage()
						});
					}
					else if ((int)skill.m_level > popup.Level)
					{
						popup.Wrap = true;
						popup.Level = (int)skill.m_level;
					}
					int num = (int)skill.m_level;
					if (LastLevel.TryGetValue(skillType, out var value) && num > value && num % 10 == 0)
					{
						popup.Milestone = true;
						if (Object.op_Implicit((Object)(object)StoreGui.instance))
						{
							StoreGui.instance.m_buyEffects.Create(((Component)localPlayer).transform.position, Quaternion.identity, (Transform)null, 1f, -1, default(ZDOID));
						}
					}
					LastLevel[skillType] = num;
					popup.Text = (popup.Milestone ? string.Format("{0} {1} - {2}", SkillName(skillType), num, T("Palier !", "Milestone!")) : Line(SkillName(skillType), skill));
					popup.Pct = skill.GetLevelPercentage();
					popup.Expire = Time.unscaledTime + _popupSeconds.Value * (popup.Milestone ? 2f : 1f);
				}
				catch (Exception ex)
				{
					if (!_patchFailed)
					{
						_patchFailed = true;
						Debug.LogError((object)("[ValGazette] RaiseSkill : " + ex.Message));
					}
				}
			}
		}

		internal const string ModName = "ValGazette";

		internal const string ModVersion = "0.1.2";

		private const string Author = "Ghoosty";

		private const string ModGUID = "ghoosty.valgazette";

		private const string Section = "Affichage";

		private const int MaxPopups = 3;

		private const float ListRefresh = 0.5f;

		private static ConfigEntry<bool> _showBars = null;

		private static ConfigEntry<bool> _showList = null;

		private static ConfigEntry<float> _popupSeconds = null;

		private static ConfigEntry<Corner> _corner = null;

		private static ConfigEntry<int> _listCount = null;

		private static ConfigEntry<KeyCode> _toggleKey = null;

		private static ConfigEntry<float> _scale = null;

		private static ConfigEntry<float> _popupX = null;

		private static ConfigEntry<float> _popupY = null;

		private static ConfigEntry<float> _barLength = null;

		private static ConfigEntry<float> _barHeight = null;

		private static ConfigEntry<BarPos> _barPos = null;

		private static ConfigEntry<float> _bottomOffset = null;

		private static ConfigEntry<float> _journalScale = null;

		private static ConfigEntry<KeyCode> _journalKey = null;

		private static ConfigEntry<bool> _journalSound = null;

		private static readonly List<Popup> Popups = new List<Popup>();

		private static readonly Dictionary<SkillType, string> Names = new Dictionary<SkillType, string>();

		private static readonly Dictionary<SkillType, int> LastLevel = new Dictionary<SkillType, int>();

		private bool _listVisible = true;

		private bool _broken;

		private float _nextListRefresh;

		private string _listText = "";

		private int _listLines;

		private GUIStyle? _style;

		private int _order = 100;

		private static ValGazettePlugin? _inst;

		private bool _journalVisible;

		private float _journalAlpha;

		private float _nextJournalRefresh;

		private readonly List<(char Kind, string Text, float Pct, Sprite? Icon)> _rows = new List<(char, string, float, Sprite)>();

		private GUIStyle? _titleStyle;

		private GUIStyle? _headStyle;

		private GUIStyle? _lineStyle;

		private GUIStyle? _effStyle;

		private Dictionary<string, Sprite>? _sprites;

		private Texture2D? _bookTex;

		private Material? _bgMat;

		private static readonly Color Orange = new Color(1f, 0.71f, 0.25f);

		private static readonly Color Gold = new Color(1f, 0.84f, 0.1f);

		private static readonly Color Grey = new Color(0.75f, 0.75f, 0.75f);

		private List<(string Name, string Key, Sprite? Icon)>? _bosses;

		private const int PageCount = 2;

		private const int IconsPerRow = 9;

		private int _page;

		private float _page1H;

		private Rect _prevArrow;

		private Rect _nextArrow;

		private readonly List<(Sprite? Icon, string Name, bool Got)[]> _iconRows = new List<(Sprite, string, bool)[]>();

		private List<(Biome Biome, List<(string Id, Sprite? Icon, string Name)> Items)>? _trophyGroups;

		private static readonly Biome[] BiomeOrder;

		private static readonly (Biome Biome, string Ids)[] TrophyBiomes;

		private AudioSource? _sfx;

		private AudioClip? _openClip;

		private AudioClip? _closeClip;

		private static readonly string[] MainBossKeys;

		private static readonly Dictionary<string, (string Prefab, int Qty)> Altars;

		private const int MaxLockedRecipes = 3;

		private static readonly Vector3[] Corners;

		private static Sprite? _barFillSpr;

		private static Sprite? _barBgSpr;

		private static Color _barBgCol;

		private static bool IsFr
		{
			get
			{
				if (Localization.instance != null)
				{
					return Localization.instance.GetSelectedLanguage() == "French";
				}
				return false;
			}
		}

		private void Row(char kind, string text = "", float pct = 0f, Sprite? icon = null)
		{
			_rows.Add((kind, text, pct, icon));
		}

		private void Awake()
		{
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Expected O, but got Unknown
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
			_showBars = Cfg("Barres de gain", value: true, "Show a bar on each skill gain. / Affiche une barre à chaque gain de compétence.");
			_showList = Cfg("Liste des compétences", value: true, "Show the fixed list of your top skills (K hides it). / Affiche la liste fixe de vos meilleures compétences (K la masque).");
			_popupSeconds = Cfg("Durée de la fenêtre", 4f, "How long the gain line stays, in seconds (3 different skills at most at once). / Durée d'affichage de la ligne de gain, en secondes (3 compétences différentes au maximum en même temps).", (AcceptableValueBase?)(object)new AcceptableValueRange<float>(1f, 15f));
			_corner = Cfg("Coin de la liste", Corner.BottomRight, "Screen corner of the list. / Coin de l'écran où se place la liste.");
			_listCount = Cfg("Nombre de compétences listées", 6, "Number of skills in the list (highest first). / Nombre de compétences affichées dans la liste (les plus hautes).", (AcceptableValueBase?)(object)new AcceptableValueRange<int>(1, 20));
			_toggleKey = Cfg<KeyCode>("Touche de la liste", (KeyCode)107, "Key that hides or shows the list. / Touche qui masque ou affiche la liste.");
			_scale = Cfg("Échelle du texte", 1f, "Text scale. / Échelle du texte.", (AcceptableValueBase?)(object)new AcceptableValueRange<float>(0.5f, 3f));
			_popupX = Cfg("Position horizontale de la barre", 0.5f, "Center of the gain bar, 0 = left edge, 1 = right edge. / Centre de la barre des gains, 0 = bord gauche, 1 = bord droit.", (AcceptableValueBase?)(object)new AcceptableValueRange<float>(0f, 1f));
			_popupY = Cfg("Position verticale de la barre", 0.6f, "Top of the gain bar, 0 = top of the screen, 1 = bottom. / Haut de la barre des gains, 0 = haut de l'écran, 1 = bas.", (AcceptableValueBase?)(object)new AcceptableValueRange<float>(0f, 1f));
			_barLength = Cfg("Longueur de la barre", 260f, "Gain bar length, in pixels at scale 1. / Longueur de la barre des gains, en pixels à l'échelle 1.", (AcceptableValueBase?)(object)new AcceptableValueRange<float>(100f, 800f));
			_barHeight = Cfg("Hauteur de la barre", 10f, "Gain bar height, in pixels at scale 1. / Hauteur de la barre des gains, en pixels à l'échelle 1.", (AcceptableValueBase?)(object)new AcceptableValueRange<float>(6f, 40f));
			_barPos = Cfg("Position de la barre", BarPos.Libre, "Libre = free, uses the X/Y positions. SousMinimap = under the minimap, at its width (X/Y if it is hidden). BasCentre = bottom of the screen, bars side by side and centered (see Hauteur depuis le bas). / Libre : positions X/Y. SousMinimap : sous la minimap, à sa largeur (X/Y si elle est cachée). BasCentre : en bas de l'écran, barres côte à côte et centrées (voir Hauteur depuis le bas).");
			_bottomOffset = Cfg("Hauteur depuis le bas", 60f, "BasCentre mode only: distance from the screen bottom to the bars, in pixels at scale 1. / Mode BasCentre seulement : distance entre le bas de l'écran et le bas des barres, en pixels à l'échelle 1.", (AcceptableValueBase?)(object)new AcceptableValueRange<float>(0f, 600f));
			_journalScale = Cfg("Échelle du Journal", 1.25f, "Journal size, independent of the bar scale. / Taille du Journal, indépendante de l'échelle des barres.", (AcceptableValueBase?)(object)new AcceptableValueRange<float>(0.5f, 3f));
			string path = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "journal.png");
			if (File.Exists(path))
			{
				Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
				byte[] array = File.ReadAllBytes(path);
				try
				{
					if ((bool)typeof(ImageConversion).GetMethod("LoadImage", new Type[2]
					{
						typeof(Texture2D),
						typeof(byte[])
					}).Invoke(null, new object[2] { val, array }))
					{
						_bookTex = val;
					}
				}
				catch (Exception ex)
				{
					((BaseUnityPlugin)this).Logger.LogWarning((object)T("journal.png ignoré : " + ex.Message, "journal.png ignored: " + ex.Message));
				}
			}
			string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			_openClip = LoadWav(Path.Combine(directoryName, "livre_ouvre.wav"));
			_closeClip = LoadWav(Path.Combine(directoryName, "livre_ferme.wav"));
			if (Object.op_Implicit((Object)(object)_openClip) || Object.op_Implicit((Object)(object)_closeClip))
			{
				_sfx = ((Component)this).gameObject.AddComponent<AudioSource>();
			}
			EventHandler eventHandler = delegate
			{
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				Popup popup = Popups.Find((Popup q) => (int)q.Type == 0);
				if (popup == null)
				{
					List<Popup> popups = Popups;
					Popup obj = new Popup
					{
						Type = (SkillType)0,
						Text = T("Aperçu 10 - 60 %", "Preview 10 - 60 %"),
						Pct = 0.6f,
						Disp = 0.6f
					};
					popup = obj;
					popups.Add(obj);
				}
				popup.Expire = Time.unscaledTime + 3f;
			};
			_popupX.SettingChanged += eventHandler;
			_popupY.SettingChanged += eventHandler;
			_scale.SettingChanged += eventHandler;
			_barLength.SettingChanged += eventHandler;
			_barHeight.SettingChanged += eventHandler;
			_barPos.SettingChanged += eventHandler;
			_bottomOffset.SettingChanged += eventHandler;
			_journalKey = Cfg<KeyCode>("Touche du journal", (KeyCode)106, "Key that opens or closes the journal. / Touche qui ouvre ou ferme le journal.");
			_journalSound = Cfg("Son du journal", value: true, "Page sound when the journal opens or closes. / Son de page à l'ouverture et à la fermeture du journal.");
			_inst = this;
			Harmony val2 = new Harmony("ghoosty.valgazette");
			val2.PatchAll(typeof(RaiseSkillPatch));
			val2.PatchAll(typeof(MenuShowPatch));
			val2.PatchAll(typeof(MouseCapturePatch));
			val2.PatchAll(typeof(JournalBlocksInputPatch));
		}

		private void Update()
		{
			//IL_0005: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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)
			if (Input.GetKeyDown(_toggleKey.Value) && !TypingInChat())
			{
				_listVisible = !_listVisible;
			}
			if (Input.GetKeyDown(_journalKey.Value) && !TypingInChat())
			{
				SetJournal(!_journalVisible);
			}
			if (!_journalVisible || TypingInChat())
			{
				return;
			}
			if (Input.GetKeyDown((KeyCode)276))
			{
				SetPage(_page - 1);
			}
			if (Input.GetKeyDown((KeyCode)275))
			{
				SetPage(_page + 1);
			}
			if (Input.GetMouseButtonDown(0))
			{
				Vector2 val = default(Vector2);
				((Vector2)(ref val))..ctor(Input.mousePosition.x, (float)Screen.height - Input.mousePosition.y);
				if (((Rect)(ref _prevArrow)).Contains(val))
				{
					SetPage(_page - 1);
				}
				else if (((Rect)(ref _nextArrow)).Contains(val))
				{
					SetPage(_page + 1);
				}
			}
		}

		private static AudioClip? LoadWav(string path)
		{
			if (!File.Exists(path))
			{
				return null;
			}
			byte[] array = File.ReadAllBytes(path);
			if (array.Length < 44 || BitConverter.ToInt16(array, 20) != 1 || BitConverter.ToInt16(array, 34) != 16)
			{
				return null;
			}
			int num = BitConverter.ToInt16(array, 22);
			int num2 = BitConverter.ToInt32(array, 24);
			int num3;
			for (int i = 12; i + 8 <= array.Length; i += 8 + num3 + (num3 & 1))
			{
				num3 = BitConverter.ToInt32(array, i + 4);
				if (array[i] == 100 && array[i + 1] == 97 && array[i + 2] == 116 && array[i + 3] == 97)
				{
					int num4 = Math.Min(num3, array.Length - i - 8) / 2;
					float[] array2 = new float[num4];
					for (int j = 0; j < num4; j++)
					{
						array2[j] = (float)BitConverter.ToInt16(array, i + 8 + 2 * j) / 32768f * 1.4f;
					}
					AudioClip val = AudioClip.Create(Path.GetFileNameWithoutExtension(path), num4 / num, num, num2, false);
					typeof(AudioClip).GetMethod("SetData", new Type[2]
					{
						typeof(float[]),
						typeof(int)
					}).Invoke(val, new object[2] { array2, 0 });
					return val;
				}
			}
			return null;
		}

		private void SetJournal(bool open)
		{
			if (_journalVisible != open)
			{
				_journalVisible = open;
				_nextJournalRefresh = 0f;
				if (open)
				{
					_page = 0;
				}
				PlayBookSound(open);
			}
		}

		private void SetPage(int page)
		{
			page = Mathf.Clamp(page, 0, 1);
			if (page != _page)
			{
				_page = page;
				_nextJournalRefresh = 0f;
				PlayBookSound(open: true);
			}
		}

		private void PlayBookSound(bool open)
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			if (!_journalSound.Value)
			{
				return;
			}
			AudioClip val = (open ? _openClip : _closeClip);
			if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)_sfx))
			{
				_sfx.PlayOneShot(val);
				return;
			}
			Player localPlayer = Player.m_localPlayer;
			InventoryGui instance = InventoryGui.instance;
			if (Object.op_Implicit((Object)(object)localPlayer) && Object.op_Implicit((Object)(object)instance))
			{
				(open ? instance.m_openInventoryEffects : instance.m_closeInventoryEffects).Create(((Component)localPlayer).transform.position, Quaternion.identity, (Transform)null, 1f, -1, default(ZDOID));
			}
		}

		private static string T(string fr, string en)
		{
			if (!IsFr)
			{
				return en;
			}
			return fr;
		}

		private static string Loc(string s)
		{
			return Localization.instance.Localize(s);
		}

		private static int MainRank(string key)
		{
			int num = Array.IndexOf(MainBossKeys, key);
			if (num >= 0)
			{
				return num;
			}
			return 99;
		}

		private static bool BiomeKnown(Player player, Biome b)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return player.m_knownBiome.Contains(Loc(BiomeSector.GetBiomeName(b)));
		}

		private void RefreshJournal(Player player)
		{
			//IL_0c94: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d25: Unknown result type (might be due to invalid IL or missing references)
			if (_page == 1)
			{
				RefreshTrophies(player);
				return;
			}
			if (_bosses == null)
			{
				_bosses = (from b in (from g in ZNetScene.instance.m_prefabs
						select g.GetComponent<Character>() into c
						where Object.op_Implicit((Object)(object)c) && c.m_boss && !string.IsNullOrEmpty(c.m_defeatSetGlobalKey)
						group c by c.m_defeatSetGlobalKey).Select(delegate(IGrouping<string, Character> g)
					{
						string item = Regex.Replace(Loc(g.First().m_name), "<[^>]*>", "");
						string key = g.Key;
						ItemDrop? obj = (from d in (from c in g
								select ((Component)c).GetComponent<CharacterDrop>() into d
								where Object.op_Implicit((Object)(object)d)
								select d).SelectMany((CharacterDrop d) => d.m_drops)
							select (!Object.op_Implicit((Object)(object)d.m_prefab)) ? null : d.m_prefab.GetComponent<ItemDrop>()).FirstOrDefault((Func<ItemDrop, bool>)((ItemDrop i) => Object.op_Implicit((Object)(object)i) && (int)i.m_itemData.m_shared.m_itemType == 13));
						return (Name: item, Key: key, Icon: (obj != null) ? obj.m_itemData.GetIcon() : null);
					})
					orderby MainRank(b.Key)
					select b).ToList();
			}
			_rows.Clear();
			Row('T', T("Le Val'Gazette", "The Val'Gazette"));
			Row('H', T("Prochaine étape", "Next step"));
			(string, string, Sprite)? tuple = _bosses.Where<(string, string, Sprite)>(((string Name, string Key, Sprite Icon) b) => MainRank(b.Key) < 99).Cast<(string, string, Sprite)?>().FirstOrDefault<(string, string, Sprite)?>(((string Name, string Key, Sprite Icon)? b) => !ZoneSystem.instance.GetGlobalKey(b.Value.Key));
			if (!tuple.HasValue)
			{
				Row('L', T("Tous les boss sont vaincus.", "All bosses are defeated."));
			}
			else
			{
				Row('L', T("Prochain boss : ", "Next boss: ") + tuple.Value.Item1);
				if (Altars.TryGetValue(tuple.Value.Item2, out (string, int) value))
				{
					GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(value.Item1);
					ItemDrop val = ((itemPrefab != null) ? itemPrefab.GetComponent<ItemDrop>() : null);
					if (val != null)
					{
						ItemData itemData = val.m_itemData;
						Inventory inventory = ((Humanoid)player).GetInventory();
						int num = inventory.CountItems(itemData.m_shared.m_name, -1, true);
						Row('V', T($"Invocation : {Loc(itemData.m_shared.m_name)} x{value.Item2}\t(tu en as {num})", $"Summon: {Loc(itemData.m_shared.m_name)} x{value.Item2}\t(you have {num})"), (num >= value.Item2) ? 1f : 0f, itemData.GetIcon());
						Recipe recipe = ObjectDB.instance.GetRecipe(itemData);
						if ((Object)(object)recipe != (Object)null)
						{
							Requirement[] resources = recipe.m_resources;
							foreach (Requirement val2 in resources)
							{
								Row('L', $"    {Loc(val2.m_resItem.m_itemData.m_shared.m_name)} : {inventory.CountItems(val2.m_resItem.m_itemData.m_shared.m_name, -1, true)} / {val2.m_amount}", 0f, val2.m_resItem.m_itemData.GetIcon());
							}
						}
					}
				}
			}
			Row('S');
			List<(string, string, Sprite)> list = (from b in _bosses
				where MainRank(b.Key) == 99 && !b.Name.StartsWith("[") && !_bosses.Any<(string, string, Sprite)>(((string Name, string Key, Sprite Icon) m) => MainRank(m.Key) < 99 && m.Name == b.Name)
				group b by b.Name into g
				select g.First()).ToList();
			int num3 = _bosses.Where<(string, string, Sprite)>(((string Name, string Key, Sprite Icon) b) => MainRank(b.Key) < 99).Concat(list).Count<(string, string, Sprite)>(((string Name, string Key, Sprite Icon) b) => ZoneSystem.instance.GetGlobalKey(b.Key));
			Row('H', $"Boss  {num3} / {_bosses.Count<(string, string, Sprite)>(((string Name, string Key, Sprite Icon) b) => MainRank(b.Key) < 99) + list.Count}");
			foreach (var (text, text2, icon) in _bosses.Where<(string, string, Sprite)>(((string Name, string Key, Sprite Icon) b) => MainRank(b.Key) < 99))
			{
				Row('G', text, ZoneSystem.instance.GetGlobalKey(text2) ? 1f : 0f, icon);
			}
			if (list.Count > 0)
			{
				Row('S');
				Row('H', T("Autres boss", "Other bosses"));
			}
			foreach (var (text3, text4, icon2) in list)
			{
				Row('G', text3, ZoneSystem.instance.GetGlobalKey(text4) ? 1f : 0f, icon2);
			}
			Row('S');
			Row('H', "Exploration");
			List<Biome> list2 = (from Biome b in Enum.GetValues(typeof(Biome))
				where (int)b != 0 && (b & (b - 1)) == 0
				orderby Array.IndexOf(BiomeOrder, b)
				select b).ToList();
			int num4 = list2.Count((Biome b) => BiomeKnown(player, b));
			Row('B', T($"Biomes découverts : {num4} / {list2.Count}", $"Biomes discovered: {num4} / {list2.Count}"), (float)num4 / (float)list2.Count);
			for (int num5 = 0; num5 < list2.Count; num5 += 3)
			{
				Row('W', string.Join("\t", from b in list2.Skip(num5).Take(3)
					select (!BiomeKnown(player, b)) ? "???" : Loc(BiomeSector.GetBiomeName(b))));
			}
			Minimap instance = Minimap.instance;
			int textureSize = instance.m_textureSize;
			float num6 = 100000000f;
			int num7 = 0;
			int num8 = 0;
			for (int num9 = 0; num9 < textureSize; num9++)
			{
				for (int num10 = 0; num10 < textureSize; num10++)
				{
					float num11 = (float)(num10 - textureSize / 2) * instance.m_pixelSize;
					float num12 = (float)(num9 - textureSize / 2) * instance.m_pixelSize;
					if (!(num11 * num11 + num12 * num12 > num6))
					{
						num7++;
						if (instance.m_explored[num9 * textureSize + num10])
						{
							num8++;
						}
					}
				}
			}
			float num13 = ((num7 == 0) ? 0f : (100f * (float)num8 / (float)num7));
			Row('B', T("Carte explorée : " + Fr(num13, "0.00") + " %", "Map explored: " + Fr(num13, "0.00") + "%"), num13 / 100f);
			int num14 = ObjectDB.instance.m_items.Count(delegate(GameObject g)
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: Invalid comparison between Unknown and I4
				ItemDrop component = g.GetComponent<ItemDrop>();
				return component != null && (int)component.m_itemData.m_shared.m_itemType == 13;
			});
			int count = player.GetTrophies().Count;
			Row('B', T($"Trophées : {count} / {num14}", $"Trophies: {count} / {num14}"), (num14 == 0) ? 0f : ((float)count / (float)num14));
			List<IGrouping<string, Recipe>> list3 = (from r in ObjectDB.instance.m_recipes
				where r.m_enabled && Object.op_Implicit((Object)(object)r.m_item) && (r.m_item.m_itemData.m_shared.m_dlc.Length == 0 || DLCMan.instance.IsDLCInstalled(r.m_item.m_itemData.m_shared.m_dlc))
				group r by r.m_item.m_itemData.m_shared.m_name).ToList();
			List<(Recipe Recipe, List<string> Missing)> list4 = (from g in list3
				where !player.IsRecipeKnown(g.Key)
				select ((Recipe Recipe, List<string> Missing))(from r in g
					select (Recipe: r, Missing: MissingFor(player, r)) into m
					orderby m.Missing.Count
					select m).First() into m
				where m.Missing.Count > 0
				orderby m.Missing.Count
				select m).Take(3).ToList();
			Row('S');
			Row('H', T("Recettes", "Recipes"));
			int num15 = list3.Count((IGrouping<string, Recipe> g) => player.IsRecipeKnown(g.Key));
			Row('B', T($"Connues : {num15} / {list3.Count}", $"Known: {num15} / {list3.Count}"), (list3.Count == 0) ? 0f : ((float)num15 / (float)list3.Count));
			foreach (var (val3, list5) in list4)
			{
				Row('G', Loc(val3.m_item.m_itemData.m_shared.m_name) + " — " + T("manque", "missing") + " : " + Loc(list5[0]) + ((list5.Count > 1) ? $" +{list5.Count - 1}" : ""));
			}
			Row('L');
			Row('C');
			Row('H', T("Compétences", "Skills"));
			Row('E', T("(−x) = perte si tu meurs maintenant", "(−x) = loss if you die now"));
			Skills skills = ((Character)player).GetSkills();
			List<Skill> skillList = skills.GetSkillList();
			skillList.RemoveAll((Skill k) => k.m_level < 1f && k.m_accumulator <= 0f);
			skillList.Sort((Skill a, Skill b) => b.m_level.CompareTo(a.m_level));
			bool globalKey = ZoneSystem.instance.GetGlobalKey((GlobalKeys)22);
			foreach (Skill item2 in skillList)
			{
				int num16 = (int)item2.m_level;
				float num17 = (globalKey ? 1f : (skills.m_DeathLowerFactor * Game.m_skillReductionRate));
				float num18 = item2.m_level * num17;
				string text5 = Fr(num18, "0.0");
				string text6 = ((!globalKey && !player.HardDeath()) ? T("(protégé)", "(protected)") : ((Mathf.Round(num18 * 10f) == 0f) ? "" : ("(−" + text5 + ")")));
				Row('K', $"{SkillName(item2.m_info.m_skill)} {num16}\t" + ((num16 >= 100) ? "max" : (T("palier ", "tier ") + (num16 / 10 + 1) * 10)) + "\t" + text6, (num16 >= 100) ? 1f : (((float)(num16 % 10) + item2.GetLevelPercentage()) / 10f), item2.m_info.m_icon);
				string text7 = Effect(skills, item2.m_info.m_skill, player);
				if (text7 != null)
				{
					Row('E', "– " + text7);
				}
			}
		}

		private void RefreshTrophies(Player player)
		{
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			if (_trophyGroups == null)
			{
				_trophyGroups = BuildTrophyGroups();
			}
			List<string> trophies = player.GetTrophies();
			HashSet<string> got = new HashSet<string>(trophies);
			List<(Biome, List<(string, Sprite, string)>)> list = _trophyGroups.Where<(Biome, List<(string, Sprite, string)>)>(((Biome Biome, List<(string Id, Sprite Icon, string Name)> Items) g) => g.Items.Count > 0).ToList();
			_rows.Clear();
			_iconRows.Clear();
			Row('T', T($"Trophées {trophies.Count} / {_trophyGroups.Sum<(Biome, List<(string, Sprite, string)>)>(((Biome Biome, List<(string Id, Sprite Icon, string Name)> Items) g) => g.Items.Count)}", $"Trophies {trophies.Count} / {_trophyGroups.Sum<(Biome, List<(string, Sprite, string)>)>(((Biome Biome, List<(string Id, Sprite Icon, string Name)> Items) g) => g.Items.Count)}"));
			for (int num = 0; num < list.Count; num++)
			{
				if (num == (list.Count + 1) / 2)
				{
					Row('C');
				}
				Row('H', ((int)list[num].Item1 == 0) ? T("Autres", "Other") : (BiomeKnown(player, list[num].Item1) ? Loc(BiomeSector.GetBiomeName(list[num].Item1)) : "???"));
				for (int num2 = 0; num2 < list[num].Item2.Count; num2 += 9)
				{
					_iconRows.Add((from t in list[num].Item2.Skip(num2).Take(9)
						select (Icon: t.Icon, Name: t.Name, got.Contains(t.Id))).ToArray());
					Row('R', "", _iconRows.Count - 1);
				}
			}
		}

		private List<(Biome Biome, List<(string Id, Sprite? Icon, string Name)> Items)> BuildTrophyGroups()
		{
			List<(string Id, Sprite Icon, string Name, Biome Biome)> items = (from g in ObjectDB.instance.m_items
				select g.GetComponent<ItemDrop>() into i
				where Object.op_Implicit((Object)(object)i) && (int)i.m_itemData.m_shared.m_itemType == 13
				select (Id: ((Object)i).name, Icon: i.m_itemData.GetIcon(), Name: Loc(i.m_itemData.m_shared.m_name), Biome: TrophyBiomes.FirstOrDefault(((Biome Biome, string Ids) t) => t.Ids.Split(new char[1] { ' ' }).Contains(((Object)i).name)).Biome)).ToList();
			return (from b in BiomeOrder.Append((Biome)0)
				select (Biome: b, Items: (from t in items
					where t.Biome == b
					select (Id: t.Id, Icon: t.Icon, Name: t.Name)).ToList())).ToList();
		}

		private static string Fr(float v, string fmt)
		{
			return v.ToString(fmt, IsFr ? CultureInfo.GetCultureInfo("fr-FR") : CultureInfo.InvariantCulture);
		}

		private static List<string> MissingFor(Player player, Recipe r)
		{
			bool atStation = (Object)(object)player.GetCurrentCraftingStation() != (Object)null;
			List<string> list = (from q in r.m_resources
				where Object.op_Implicit((Object)(object)q.m_resItem) && q.m_amount > 0 && (atStation || !q.m_upgraderResource)
				select q.m_resItem.m_itemData.m_shared.m_name).ToList();
			List<string> list2 = list.Where((string n) => !player.IsMaterialKnown(n)).ToList();
			if (r.m_requireOnlyOneIngredient && list2.Count < list.Count)
			{
				list2.Clear();
			}
			if (Object.op_Implicit((Object)(object)r.m_craftingStation) && !player.KnowStationLevel(r.m_craftingStation.m_name, r.m_minStationLevel))
			{
				list2.Add(r.m_craftingStation.m_name + " $msg_level " + Mathf.Max(1, r.m_minStationLevel));
			}
			return list2;
		}

		private static string? Effect(Skills sk, SkillType type, Player player)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: 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_000d: Invalid comparison between Unknown and I4
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Invalid comparison between Unknown and I4
			//IL_0012: 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_0047: Expected I4, but got Unknown
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Invalid comparison between Unknown and I4
			float skillFactor = sk.GetSkillFactor(type);
			if (type - 12 > 1)
			{
				switch (type - 100)
				{
				case 2:
					return T("Course : −" + Fr(50f * skillFactor, "0.#") + " % d'endurance, +" + Fr(25f * skillFactor, "0.#") + " % de vitesse", "Run: −" + Fr(50f * skillFactor, "0.#") + "% stamina, +" + Fr(25f * skillFactor, "0.#") + "% speed");
				case 0:
					return T("Saut : +" + Fr(40f * skillFactor, "0.#") + " % de force", "Jump: +" + Fr(40f * skillFactor, "0.#") + "% force");
				case 3:
					return T("Nage : " + Fr(Mathf.Lerp(player.m_swimStaminaDrainMinSkill, player.m_swimStaminaDrainMaxSkill, skillFactor) * Game.m_moveStaminaRate, "0.##") + " d'endurance/s", "Swim: " + Fr(Mathf.Lerp(player.m_swimStaminaDrainMinSkill, player.m_swimStaminaDrainMaxSkill, skillFactor) * Game.m_moveStaminaRate, "0.##") + " stamina/s");
				case 1:
					return T("Discrétion : −" + Fr(75f * Mathf.Sqrt(skillFactor), "0.#") + " % d'endurance accroupi", "Sneak: −" + Fr(75f * Mathf.Sqrt(skillFactor), "0.#") + "% stamina while crouched");
				case 4:
				{
					FishingFloat val = ((IEnumerable<GameObject>)ObjectDB.instance?.m_items).Select((Func<GameObject, FishingFloat>)delegate(GameObject i)
					{
						ItemDrop component = i.GetComponent<ItemDrop>();
						if (component == null)
						{
							return (FishingFloat)null;
						}
						Attack attack = component.m_itemData.m_shared.m_attack;
						if (attack == null)
						{
							return (FishingFloat)null;
						}
						GameObject attackProjectile = attack.m_attackProjectile;
						return (attackProjectile == null) ? null : attackProjectile.GetComponent<FishingFloat>();
					}).FirstOrDefault((Func<FishingFloat, bool>)((FishingFloat x) => Object.op_Implicit((Object)(object)x)));
					if (!Object.op_Implicit((Object)(object)val))
					{
						return null;
					}
					return T("Pêche : −" + Fr((1f - val.m_pullStaminaUseMaxSkillMultiplier) * 100f * skillFactor, "0.#") + " % d'endurance, ligne ×" + Fr(Mathf.Lerp(val.m_pullLineSpeed, val.m_pullLineSpeedMaxSkill, skillFactor), "0.##"), "Fishing: −" + Fr((1f - val.m_pullStaminaUseMaxSkillMultiplier) * 100f * skillFactor, "0.#") + "% stamina, line ×" + Fr(Mathf.Lerp(val.m_pullLineSpeed, val.m_pullLineSpeedMaxSkill, skillFactor), "0.##"));
				}
				case 5:
					if (!Object.op_Implicit((Object)(object)InventoryGui.instance))
					{
						return null;
					}
					return T(string.Format("Cuisine : {0} % de chance de +{1}", Fr(InventoryGui.instance.m_craftBonusChance * 100f * skillFactor, "0.#"), InventoryGui.instance.m_craftBonusAmount), string.Format("Cooking: {0}% chance of +{1}", Fr(InventoryGui.instance.m_craftBonusChance * 100f * skillFactor, "0.#"), InventoryGui.instance.m_craftBonusAmount));
				case 7:
					if (!Object.op_Implicit((Object)(object)InventoryGui.instance))
					{
						return null;
					}
					return T("Artisanat : −" + Fr(InventoryGui.instance.m_craftDurationSkillMaxDecrease * 100f * skillFactor, "0.#") + " % de durée, " + Fr(InventoryGui.instance.m_craftBonusChance * 100f * skillFactor, "0.#") + " % de bonus", "Crafting: −" + Fr(InventoryGui.instance.m_craftDurationSkillMaxDecrease * 100f * skillFactor, "0.#") + "% time, " + Fr(InventoryGui.instance.m_craftBonusChance * 100f * skillFactor, "0.#") + "% bonus");
				case 10:
					return T("Équitation : −" + Fr(50f * skillFactor, "0.#") + " % d'endurance, +" + Fr(25f * skillFactor, "0.#") + " % de vitesse", "Riding: −" + Fr(50f * skillFactor, "0.#") + "% stamina, +" + Fr(25f * skillFactor, "0.#") + "% speed");
				default:
					return null;
				}
			}
			float num = default(float);
			float num2 = default(float);
			sk.GetRandomSkillRange(ref num, ref num2, type);
			return T((((int)type == 13) ? "Coupe" : "Minage") + " : dégâts à " + Fr(num * 100f, "0") + "-" + Fr(num2 * 100f, "0") + " % de l'outil", (((int)type == 13) ? "Woodcutting" : "Mining") + ": damage at " + Fr(num * 100f, "0") + "-" + Fr(num2 * 100f, "0") + "% of the tool");
		}

		private static bool TypingInChat()
		{
			if ((!Object.op_Implicit((Object)(object)Chat.instance) || !Chat.instance.HasFocus()) && !Console.IsVisible())
			{
				return TextInput.IsVisible();
			}
			return true;
		}

		private unsafe static string SkillName(SkillType type)
		{
			//IL_0005: 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)
			if (!Names.TryGetValue(type, out string value))
			{
				value = (Names[type] = Localization.instance.Localize("$skill_" + ((object)(*(SkillType*)(&type))/*cast due to .constrained prefix*/).ToString().ToLower()));
			}
			return value;
		}

		private static string Line(string name, Skill skill)
		{
			return $"{name} {(int)skill.m_level} - {(int)(skill.GetLevelPercentage() * 100f)} %";
		}

		private void RefreshList(Skills skills)
		{
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			List<Skill> skillList = skills.GetSkillList();
			skillList.RemoveAll((Skill s) => s.m_level < 1f && s.m_accumulator <= 0f);
			skillList.Sort((Skill a, Skill b) => b.m_level.CompareTo(a.m_level));
			int num = Math.Min(_listCount.Value, skillList.Count);
			StringBuilder stringBuilder = new StringBuilder();
			for (int num2 = 0; num2 < num; num2++)
			{
				stringBuilder.Append((num2 > 0) ? "\n" : "").Append(Line(SkillName(skillList[num2].m_info.m_skill), skillList[num2]));
			}
			_listText = stringBuilder.ToString();
			_listLines = num;
		}

		private void OnGUI()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Invalid comparison between Unknown and I4
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0405: Unknown result type (might be due to invalid IL or missing references)
			//IL_041f: Unknown result type (might be due to invalid IL or missing references)
			//IL_044a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0443: Unknown result type (might be due to invalid IL or missing references)
			if (_broken)
			{
				return;
			}
			Player localPlayer = Player.m_localPlayer;
			if (!Object.op_Implicit((Object)(object)localPlayer) || !Object.op_Implicit((Object)(object)Hud.instance) || Hud.IsUserHidden() || Menu.IsVisible() || (int)Event.current.type != 7)
			{
				return;
			}
			try
			{
				if (_style == null)
				{
					_style = new GUIStyle(GUI.skin.label)
					{
						fontStyle = (FontStyle)1,
						wordWrap = false,
						clipping = (TextClipping)0
					};
				}
				float value = _scale.Value;
				_style.fontSize = Mathf.RoundToInt(16f * value);
				float num = 24f * value;
				float num2 = 260f * value;
				float unscaledDeltaTime;
				float now;
				float num3;
				float num4;
				float num5;
				float num6;
				float num7;
				float num8;
				if (_showBars.Value)
				{
					unscaledDeltaTime = Time.unscaledDeltaTime;
					now = Time.unscaledTime;
					Popups.RemoveAll((Popup p) => now > p.Expire && p.Alpha <= 0f);
					num3 = _barLength.Value * value;
					num4 = _barHeight.Value * value;
					num5 = Mathf.Clamp((float)Screen.width * _popupX.Value - num3 / 2f, 0f, (float)Screen.width - num3);
					num6 = (float)Screen.height * _popupY.Value;
					num7 = 1f;
					num8 = 0f;
					if (_barPos.Value == BarPos.SousMinimap)
					{
						Rect? val = MapRect();
						if (val.HasValue)
						{
							Rect valueOrDefault = val.GetValueOrDefault();
							num5 = ((Rect)(ref valueOrDefault)).x;
							num3 = ((Rect)(ref valueOrDefault)).width;
							num6 = ((Rect)(ref valueOrDefault)).yMax + 4f * value;
							goto IL_0289;
						}
					}
					if (_barPos.Value == BarPos.BasCentre)
					{
						int num9 = Math.Max(1, Popups.FindAll((Popup q) => now <= q.Expire).Count);
						float num10 = 16f * value;
						if ((float)num9 * num3 + (float)(num9 - 1) * num10 > (float)Screen.width)
						{
							num10 = Mathf.Max(0f, ((float)Screen.width - (float)num9 * num3) / (float)Math.Max(1, num9 - 1));
						}
						if ((float)num9 * num3 + (float)(num9 - 1) * num10 > (float)Screen.width)
						{
							num3 = (float)Screen.width / (float)num9;
							num10 = 0f;
						}
						num8 = num3 + num10;
						num5 = ((float)Screen.width - ((float)num9 * num3 + (float)(num9 - 1) * num10)) / 2f;
						num6 = (float)Screen.height - _bottomOffset.Value * value - num4 - num;
						num7 = 0f;
					}
					goto IL_0289;
				}
				goto IL_0478;
				IL_0289:
				foreach (Popup popup in Popups)
				{
					bool flag = now <= popup.Expire;
					popup.Alpha = Mathf.MoveTowards(popup.Alpha, flag ? 1f : 0f, unscaledDeltaTime / 0.25f);
					if (popup.Wrap && popup.Disp >= 1f)
					{
						popup.Wrap = false;
						popup.Disp = 0f;
					}
					popup.Disp = Mathf.MoveTowards(popup.Disp, popup.Wrap ? 1f : popup.Pct, unscaledDeltaTime / 0.3f);
					if (float.IsNaN(popup.Y))
					{
						popup.Y = num6;
					}
					else
					{
						popup.Y = Mathf.Lerp(popup.Y, num6, 1f - Mathf.Exp((0f - unscaledDeltaTime) * 15f));
					}
					if (flag)
					{
						num6 += num7 * (num + 16f * value);
						num5 += num8;
					}
					float num11 = popup.Y + (1f - popup.Alpha) * 12f * value;
					float num12 = num5 - (flag ? num8 : 0f);
					DrawText(new Rect(num12, num11, num3, num), popup.Text, _style, (TextAnchor)1, popup.Alpha, popup.Milestone ? new Color?(Gold) : ((Color?)null));
					DrawBar(new Rect(num12, num11 + num, num3, num4), popup.Disp, (Color)(popup.Milestone ? Gold : new Color(0.5f, 0.8f, 0.3f)), popup.Alpha, value);
				}
				goto IL_0478;
				IL_0478:
				_journalAlpha = Mathf.MoveTowards(_journalAlpha, _journalVisible ? 1f : 0f, Time.unscaledDeltaTime / 0.2f);
				if (_journalVisible && Time.unscaledTime >= _nextJournalRefresh)
				{
					_nextJournalRefresh = Time.unscaledTime + 1f;
					RefreshJournal(localPlayer);
				}
				if (_journalAlpha > 0f)
				{
					DrawJournal(_journalScale.Value, 24f * _journalScale.Value, _journalAlpha);
				}
				if (_showList.Value && _listVisible)
				{
					if (Time.unscaledTime >= _nextListRefresh)
					{
						_nextListRefresh = Time.unscaledTime + 0.5f;
						RefreshList(((Character)localPlayer).GetSkills());
					}
					if (_listLines != 0)
					{
						float num13 = num * (float)_listLines;
						Corner value2 = _corner.Value;
						float num14 = 12f * value;
						bool flag2 = value2 == Corner.TopRight || value2 == Corner.BottomRight;
						bool flag3 = value2 == Corner.BottomLeft || value2 == Corner.BottomRight;
						DrawText(new Rect(flag2 ? ((float)Screen.width - num2 - num14) : num14, flag3 ? ((float)Screen.height - num13 - num14 - 80f * value) : num14, num2, num13), _listText, _style, (TextAnchor)(flag2 ? 2 : 0));
					}
				}
			}
			catch (Exception ex)
			{
				_broken = true;
				((BaseUnityPlugin)this).Logger.LogError((object)T("Affichage désactivé après une erreur : " + ex.Message, "Display disabled after an error: " + ex.Message));
			}
		}

		private static Rect? MapRect()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			Minimap instance = Minimap.instance;
			if (!Object.op_Implicit((Object)(object)instance) || !instance.m_smallRoot.activeInHierarchy)
			{
				return null;
			}
			return ScreenRect(((Graphic)instance.m_mapImageSmall).rectTransform);
		}

		private static Rect ScreenRect(RectTransform rt)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_0096: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
			rt.GetWorldCorners(Corners);
			Canvas componentInParent = ((Component)rt).GetComponentInParent<Canvas>();
			Canvas val = ((componentInParent != null) ? componentInParent.rootCanvas : null);
			if (val == null)
			{
				return new Rect(0f, (float)Screen.height * 0.82f, 0f, 0f);
			}
			Camera obj = (((int)val.renderMode == 0) ? null : val.worldCamera);
			Vector2 val2 = RectTransformUtility.WorldToScreenPoint(obj, Corners[0]);
			Vector2 val3 = RectTransformUtility.WorldToScreenPoint(obj, Corners[2]);
			return new Rect(val2.x, (float)Screen.height - val3.y, val3.x - val2.x, val3.y - val2.y);
		}

		private void DrawJournal(float s, float lineH, float a)
		{
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Expected O, but got Unknown
			//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_052a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0534: Unknown result type (might be due to invalid IL or missing references)
			//IL_0540: Unknown result type (might be due to invalid IL or missing references)
			//IL_0586: Unknown result type (might be due to invalid IL or missing references)
			//IL_0590: Unknown result type (might be due to invalid IL or missing references)
			//IL_0595: Unknown result type (might be due to invalid IL or missing references)
			//IL_062c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0647: Unknown result type (might be due to invalid IL or missing references)
			//IL_0459: Unknown result type (might be due to invalid IL or missing references)
			//IL_045f: Invalid comparison between Unknown and I4
			//IL_0442: Unknown result type (might be due to invalid IL or missing references)
			//IL_0479: Unknown result type (might be due to invalid IL or missing references)
			//IL_047e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0487: Unknown result type (might be due to invalid IL or missing references)
			//IL_0492: Unknown result type (might be due to invalid IL or missing references)
			//IL_0497: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0506: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e58: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e5d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e5e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e60: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e65: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e67: Unknown result type (might be due to invalid IL or missing references)
			//IL_0741: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c01: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c10: Unknown result type (might be due to invalid IL or missing references)
			//IL_0891: Unknown result type (might be due to invalid IL or missing references)
			//IL_08bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_08fb: Expected O, but got Unknown
			//IL_08f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0914: Unknown result type (might be due to invalid IL or missing references)
			//IL_0925: Unknown result type (might be due to invalid IL or missing references)
			//IL_0954: Unknown result type (might be due to invalid IL or missing references)
			//IL_095b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0960: Unknown result type (might be due to invalid IL or missing references)
			//IL_0844: Unknown result type (might be due to invalid IL or missing references)
			//IL_071a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f30: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f35: Unknown result type (might be due to invalid IL or missing references)
			//IL_0795: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f9d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fa2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fa8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bc6: Unknown result type (might be due to invalid IL or missing references)
			//IL_1036: Unknown result type (might be due to invalid IL or missing references)
			//IL_1068: Unknown result type (might be due to invalid IL or missing references)
			//IL_106d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aa9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aa2: Unknown result type (might be due to invalid IL or missing references)
			//IL_119e: Unknown result type (might be due to invalid IL or missing references)
			//IL_10d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_10dc: Expected O, but got Unknown
			//IL_10d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_10dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_10de: Unknown result type (might be due to invalid IL or missing references)
			//IL_10f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_1112: Unknown result type (might be due to invalid IL or missing references)
			//IL_1126: Unknown result type (might be due to invalid IL or missing references)
			//IL_113a: Unknown result type (might be due to invalid IL or missing references)
			//IL_114e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1169: Unknown result type (might be due to invalid IL or missing references)
			//IL_1173: Unknown result type (might be due to invalid IL or missing references)
			//IL_117e: Unknown result type (might be due to invalid IL or missing references)
			//IL_118e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fcb: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_1096: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fd8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ae7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b37: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b46: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_10a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b82: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b6f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cbb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c85: Unknown result type (might be due to invalid IL or missing references)
			//IL_09fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a08: Expected O, but got Unknown
			//IL_0a03: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d2e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d5c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d8f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d99: Expected O, but got Unknown
			//IL_0d94: Unknown result type (might be due to invalid IL or missing references)
			//IL_0da5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d4c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e16: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e00: Unknown result type (might be due to invalid IL or missing references)
			//IL_0de7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dd1: Unknown result type (might be due to invalid IL or missing references)
			Color val = default(Color);
			((Color)(ref val))..ctor(1f, 1f, 1f, a);
			Font[] fonts;
			if (_titleStyle == null)
			{
				fonts = Resources.FindObjectsOfTypeAll<Font>();
				_titleStyle = Make("Norsebold");
				_headStyle = Make("Norsebold");
				_lineStyle = Make("AveriaSerifLibre-Regular");
				_effStyle = new GUIStyle(_lineStyle)
				{
					fontStyle = (FontStyle)2
				};
			}
			int split = _rows.FindIndex(((char Kind, string Text, float Pct, Sprite? Icon) tuple2) => tuple2.Kind == 'C');
			if (split < 0)
			{
				split = _rows.Count;
			}
			bool flag = (Object)(object)_bookTex != (Object)null;
			float num = Mathf.Max(RowH('T') + Sum(1, split), Sum(split + 1, _rows.Count));
			if (_page == 0)
			{
				_page1H = num;
			}
			else
			{
				num = Mathf.Max(num, _page1H);
			}
			float num2 = (flag ? Mathf.Max((num + lineH + 56f * s) / 0.84472656f, 436f * s / (85f / 128f)) : 0f);
			float num3 = (flag ? Mathf.Min(new float[3]
			{
				1f,
				0.9f * (float)Screen.height / num2,
				0.9f * (float)Screen.width / (1.5f * num2)
			}) : Mathf.Min(new float[3]
			{
				1f,
				0.9f * (float)Screen.width / (840f * s),
				0.9f * (float)Screen.height / (RowH('T') + Body() + lineH + 56f * s)
			}));
			s *= num3;
			lineH *= num3;
			num2 *= num3;
			_titleStyle.fontSize = Mathf.RoundToInt(30f * s);
			_headStyle.fontSize = Mathf.RoundToInt(20f * s);
			_lineStyle.fontSize = Mathf.RoundToInt(16f * s);
			_effStyle.fontSize = Mathf.RoundToInt(13.6f * s);
			string text = (((Object)(object)_lineStyle.font != (Object)null && _lineStyle.font.HasCharacter('✓')) ? "✓" : "•");
			float num4 = 380f * s;
			float num5 = 24f * s;
			float num6 = 28f * s;
			float num7 = 2f * num4 + num5;
			float num8 = RowH('T') + Body() + lineH;
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(((float)Screen.width - num7) / 2f - num6, ((float)Screen.height - num8) / 2f - num6, num7 + 2f * num6, num8 + 2f * num6);
			if (flag)
			{
				((Rect)(ref val2))..ctor(((float)Screen.width - 1.5f * num2) / 2f, ((float)Screen.height - num2) / 2f, 1.5f * num2, num2);
			}
			GUI.color = val;
			if (flag)
			{
				GUI.DrawTexture(val2, (Texture)(object)_bookTex, (ScaleMode)0, true);
			}
			else
			{
				Sprite bg = Spr("woodpanel_playerinventory");
				if (bg != null)
				{
					if (_bgMat == null)
					{
						Image? obj = ((IEnumerable<Image>)Resources.FindObjectsOfTypeAll<Image>()).FirstOrDefault((Func<Image, bool>)((Image im) => (Object)(object)im.sprite == (Object)(object)bg));
						_bgMat = ((obj != null) ? ((Graphic)obj).material : null);
					}
					if ((Object)(object)_bgMat == (Object)null)
					{
						DrawSprite(bg, val2, s);
					}
					else if ((int)Event.current.type == 7)
					{
						Texture texture = (Texture)(object)bg.texture;
						Rect textureRect = bg.textureRect;
						Vector4 val3 = bg.border * s;
						Rect val4 = default(Rect);
						((Rect)(ref val4))..ctor(((Rect)(ref textureRect)).x / (float)texture.width, ((Rect)(ref textureRect)).y / (float)texture.height, ((Rect)(ref textureRect)).width / (float)texture.width, ((Rect)(ref textureRect)).height / (float)texture.height);
						Graphics.DrawTexture(val2, texture, val4, (int)val3.x, (int)val3.z, (int)val3.w, (int)val3.y, val, _bgMat);
					}
				}
				else
				{
					GUI.color = new Color(0f, 0f, 0f, 0.75f * a);
					GUI.DrawTexture(val2, (Texture)(object)Texture2D.whiteTexture);
					GUI.color = val;
				}
			}
			float num9 = ((Rect)(ref val2)).x + num6;
			float num10 = ((Rect)(ref val2)).y + num6;
			float num11 = num9;
			float num12 = num10;
			float num13 = num7;
			float num14 = num9 + num4 + num5;
			float num15 = num10 + RowH('T');
			Color? val5 = null;
			Color? color = Orange;
			Color grey = Grey;
			if (flag)
			{
				num4 = 85f / 192f * ((Rect)(ref val2)).width - 2f * num6 - 16f * s;
				num13 = num4;
				num9 = ((Rect)(ref val2)).x + 0.042317707f * ((Rect)(ref val2)).width + num6;
				float num16 = ((Rect)(ref val2)).y + 0.068359375f * ((Rect)(ref val2)).height + num6;
				num11 = num9;
				num12 = num16;
				num14 = ((Rect)(ref val2)).x + 0.51432294f * ((Rect)(ref val2)).width + num6;
				num15 = num16;
				val5 = new Color(0.231f, 0.141f, 0.071f);
				color = new Color(0.16f, 0.09f, 0.04f);
				((Color)(ref grey))..ctor(0.55f, 0.5f, 0.42f);
			}
			string text2 = null;
			Rect r = default(Rect);
			foreach (var (c, text3, num17, val6) in _rows)
			{
				if (c == 'C')
				{
					num11 = num14;
					num12 = num15;
					continue;
				}
				float num18 = RowH(c);
				switch (c)
				{
				case 'T':
					DrawText(new Rect(num11, num12, num13, num18), text3, _titleStyle, (TextAnchor)1, a, color, !flag);
					break;
				case 'H':
					DrawText(new Rect(num11, num12, num13, num18), text3, _headStyle, (TextAnchor)0, a, color, !flag);
					break;
				case 'S':
				{
					Sprite val7 = Spr("panel_separator");
					if (val7 != null)
					{
						DrawSprite(val7, new Rect(num11, num12 + 5f * s, num13, 4f * s), s);
					}
					break;
				}
				case 'B':
					DrawText(new Rect(num11, num12, num13, lineH), text3, _lineStyle, (TextAnchor)0, a, val5, !flag);
					DrawBar(new Rect(num11, num12 + lineH, num13, 10f * s), num17, Orange, val.a, s);
					break;
				case 'K':
				{
					float num22 = num11;
					if (Object.op_Implicit((Object)(object)val6))
					{
						DrawSprite(val6, new Rect(num11, num12, lineH - 2f * s, lineH - 2f * s), 0f);
						num22 += lineH + 2f * s;
					}
					string[] array3 = text3.Split(new char[1] { '\t' });
					DrawText(new Rect(num22, num12, num13 - (num22 - num11), lineH), array3[0], _lineStyle, (TextAnchor)0, a, val5, !flag);
					DrawText(new Rect(num22, num12, num13 - (num22 - num11), lineH), array3[1], _lineStyle, (TextAnchor)2, a, val5, !flag);
					DrawText(new Rect(num22, num12, num13 - (num22 - num11) - _lineStyle.CalcSize(new GUIContent(array3[1])).x - 8f * s, lineH), array3[2], _lineStyle, (TextAnchor)2, a, grey, !flag);
					DrawBar(new Rect(num22, num12 + lineH, num13 - (num22 - num11), 10f * s), num17, Orange, val.a, s);
					break;
				}
				case 'W':
				{
					float num20 = num11;
					string[] array2 = text3.Split(new char[1] { '\t' });
					for (int num21 = 0; num21 < array2.Length; num21++)
					{
						string text4 = ((num21 < array2.Length - 1) ? (array2[num21] + "  ·") : array2[num21]);
						DrawText(new Rect(num20, num12, num13, num18), text4, _lineStyle, (TextAnchor)0, a, (array2[num21] == "???") ? new Color?(grey) : val5, !flag);
						num20 += _lineStyle.CalcSize(new GUIContent(text4)).x + 10f * s;
					}
					break;
				}
				case 'R':
				{
					(Sprite, string, bool)[] array4 = _iconRows[(int)num17];
					for (int num23 = 0; num23 < array4.Length; num23++)
					{
						float num24 = 1.6f * lineH;
						((Rect)(ref r))..ctor(num11 + (float)num23 * (num24 + 4f * s), num12, num24, num24);
						GUI.color = (Color)(array4[num23].Item3 ? val : new Color(0f, 0f, 0f, 0.55f * a));
						if (array4[num23].Item3)
						{
							GUI.color = new Color(Gold.r, Gold.g, Gold.b, 0.35f * a);
							GUI.DrawTexture(new Rect(((Rect)(ref r)).x - 2f * s, ((Rect)(ref r)).y - 2f * s, num24 + 4f * s, num24 + 4f * s), (Texture)(object)Texture2D.whiteTexture);
							GUI.color = val;
						}
						if (Object.op_Implicit((Object)(object)array4[num23].Item1))
						{
							DrawSprite(array4[num23].Item1, r, 0f);
						}
						if (((Rect)(ref r)).Contains(Event.current.mousePosition))
						{
							text2 = (array4[num23].Item3 ? array4[num23].Item2 : "???");
						}
					}
					GUI.color = val;
					break;
				}
				case 'E':
					DrawText(new Rect(num11 + lineH + 2f * s, num12, num13 - lineH - 2f * s, num18), text3, _effStyle, (TextAnchor)0, a, grey, !flag);
					break;
				default:
				{
					bool flag2 = c == 'G' && num17 <= 0f;
					float num19 = num11 + (text3.StartsWith(" ") ? (16f * s) : 0f);
					if (Object.op_Implicit((Object)(object)val6))
					{
						if (flag2)
						{
							GUI.color = new Color(0.65f, 0.65f, 0.65f, 0.9f * a);
						}
						DrawSprite(val6, new Rect(num19, num12, lineH - 2f * s, lineH - 2f * s), 0f);
						GUI.color = val;
						num19 += lineH + 2f * s;
					}
					string[] array = ((c == 'G' && !flag2) ? (text + " " + text3) : text3).TrimStart(Array.Empty<char>()).Split(new char[1] { '\t' });
					DrawText(new Rect(num19, num12, num13 - (num19 - num11), num18), array[0], _lineStyle, (TextAnchor)0, a, (c != 'G') ? val5 : (flag2 ? new Color?(grey) : (flag ? val5 : new Color?(Gold))), !flag);
					if (c == 'V')
					{
						DrawText(new Rect(num19 + _lineStyle.CalcSize(new GUIContent(array[0] + " ")).x, num12, num13, num18), array[1], _lineStyle, (TextAnchor)0, a, (Color?)((!(num17 > 0f)) ? (flag ? new Color(0.6f, 0.15f, 0.1f) : new Color(1f, 0.45f, 0.4f)) : (flag ? new Color(0.13f, 0.38f, 0.13f) : new Color(0.5f, 0.9f, 0.4f))), !flag);
					}
					break;
				}
				}
				num12 += num18;
				if (c == 'T')
				{
					num13 = num4;
				}
			}
			_prevArrow = (_nextArrow = Rect.zero);
			float num25 = (flag ? (((Rect)(ref val2)).y + 0.91308594f * ((Rect)(ref val2)).height) : ((Rect)(ref val2)).yMax) - num6 - lineH;
			float num26 = num9 + num4 / 2f;
			float num27 = num14 + num4 / 2f;
			float num28 = 40f * s;
			float num29 = 70f * s;
			float num30 = 4f * s;
			float num31 = num28 + num30 + num29;
			bool flag3 = (Object)(object)_lineStyle.font != (Object)null && _lineStyle.font.HasCharacter('◄') && _lineStyle.font.HasCharacter('►');
			Vector2 mousePosition = Event.current.mousePosition;
			int fontSize = _lineStyle.fontSize;
			_lineStyle.fontSize = Mathf.RoundToInt(22f * s);
			string text5 = $"{_page + 1} / {2}";
			if (_page > 0)
			{
				_prevArrow = new Rect(num26 - num31 / 2f, num25, num28, num6);
				DrawText(_prevArrow, flag3 ? "◄" : "<", _lineStyle, (TextAnchor)4, a, ((Rect)(ref _prevArrow)).Contains(mousePosition) ? new Color?(Orange) : val5, !flag);
				DrawText(new Rect(((Rect)(ref _prevArrow)).xMax + num30, num25, num29, num6), text5, _lineStyle, (TextAnchor)3, a, val5, !flag);
			}
			if (_page < 1)
			{
				DrawText(new Rect(num27 - num31 / 2f, num25, num29, num6), text5, _lineStyle, (TextAnchor)5, a, val5, !flag);
				_nextArrow = new Rect(num27 - num31 / 2f + num29 + num30, num25, num28, num6);
				DrawText(_nextArrow, flag3 ? "►" : ">", _lineStyle, (TextAnchor)4, a, ((Rect)(ref _nextArrow)).Contains(mousePosition) ? new Color?(Orange) : val5, !flag);
			}
			_lineStyle.fontSize = fontSize;
			if (text2 != null)
			{
				Vector2 val8 = _lineStyle.CalcSize(new GUIContent(text2));
				Rect val9 = new Rect(Mathf.Min(mousePosition.x + 14f * s, (float)Screen.width - val8.x - 10f * s), mousePosition.y + 14f * s, val8.x + 10f * s, val8.y + 4f * s);
				GUI.color = new Color(0f, 0f, 0f, 0.85f * a);
				GUI.DrawTexture(val9, (Texture)(object)Texture2D.whiteTexture);
				GUI.color = val;
				DrawText(val9, text2, _lineStyle, (TextAnchor)4, a, Color.white, shadow: false);
			}
			GUI.color = Color.white;
			float Body()
			{
				return Mathf.Max(Sum(1, split), Sum(split + 1, _rows.Count));
			}
			GUIStyle Make(string font)
			{
				//IL_0018: 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_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Expected O, but got Unknown
				return new GUIStyle(_style)
				{
					font = ((IEnumerable<Font>)fonts).FirstOrDefault((Func<Font, bool>)((Font f) => ((Object)f).name == font)),
					fontStyle = (FontStyle)0
				};
			}
			float RowH(char k)
			{
				return k switch
				{
					'T' => 42f * s, 
					'H' => 28f * s, 
					'S' => 14f * s, 
					'B' => lineH + 16f * s, 
					'K' => lineH + 10f * s, 
					'R' => 1.6f * lineH + 8f * s, 
					_ => lineH, 
				};
			}
			float Sum(int from, int to)
			{
				return _rows.Skip(from).Take(to - from).Sum<(char, string, float, Sprite)>(((char Kind, string Text, float Pct, Sprite Icon) tuple2) => RowH(tuple2.Kind));
			}
		}

		private Sprite? Spr(string name)
		{
			if (!(_sprites ?? (_sprites = (from sp in Resources.FindObjectsOfTypeAll<Sprite>()
				group sp by ((Object)sp).name).ToDictionary((IGrouping<string, Sprite> g) => g.Key, (IGrouping<string, Sprite> g) => g.First()))).TryGetValue(name, out Sprite value))
			{
				return null;
			}
			return value;
		}

		private static void FindBarSprites()
		{
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_barFillSpr != (Object)null || !Object.op_Implicit((Object)(object)Hud.instance))
			{
				return;
			}
			GuiBar staminaBar2Fast = Hud.instance.m_staminaBar2Fast;
			Image val = ((Object.op_Implicit((Object)(object)staminaBar2Fast) && Object.op_Implicit((Object)(object)staminaBar2Fast.m_bar)) ? ((Component)staminaBar2Fast.m_bar).GetComponent<Image>() : null);
			_barFillSpr = (Object.op_Implicit((Object)(object)val) ? val.sprite : null);
			RectTransform staminaBar2Root = Hud.instance.m_staminaBar2Root;
			if (!Object.op_Implicit((Object)(object)staminaBar2Root))
			{
				return;
			}
			Image val2 = ((Object.op_Implicit((Object)(object)Hud.instance.m_staminaBar2Slow) && Object.op_Implicit((Object)(object)Hud.instance.m_staminaBar2Slow.m_bar)) ? ((Component)Hud.instance.m_staminaBar2Slow.m_bar).GetComponent<Image>() : null);
			Image[] componentsInChildren = ((Component)staminaBar2Root).GetComponentsInChildren<Image>(true);
			foreach (Image val3 in componentsInChildren)
			{
				if ((Object)(object)val3 != (Object)(object)val && (Object)(object)val3 != (Object)(object)val2 && (Object)(object)val3.sprite != (Object)null)
				{
					_barBgSpr = val3.sprite;
					_barBgCol = ((Graphic)val3).color;
					break;
				}
			}
		}

		private static void DrawBar(Rect r, float pct, Color fill, float alpha, float s)
		{
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: 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_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			FindBarSprites();
			((Rect)(ref r))..ctor(Mathf.Round(((Rect)(ref r)).x), Mathf.Round(((Rect)(ref r)).y), Mathf.Round(((Rect)(ref r)).width), Mathf.Round(((Rect)(ref r)).height));
			if ((Object)(object)_barFillSpr != (Object)null && (Object)(object)_barBgSpr != (Object)null)
			{
				Color val = (Color)((_barBgCol.r > 0.9f && _barBgCol.g > 0.9f && _barBgCol.b > 0.9f) ? new Color(0.12f, 0.09f, 0.06f, 0.85f) : _barBgCol);
				GUI.color = new Color(val.r, val.g, val.b, val.a * alpha);
				DrawSprite(_barBgSpr, r, s);
				if (pct > 0f)
				{
					GUI.color = new Color(fill.r, fill.g, fill.b, alpha);
					DrawSprite(_barFillSpr, new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, Mathf.Round(((Rect)(ref r)).width * Mathf.Clamp01(pct)), ((Rect)(ref r)).height), s);
				}
				GUI.color = Color.white;
				return;
			}
			Texture whiteTexture = (Texture)(object)Texture2D.whiteTexture;
			float num = Mathf.Max(1f, s);
			GUI.color = new Color(0.08f, 0.06f, 0.04f, 0.9f * alpha);
			GUI.DrawTexture(r, whiteTexture);
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(((Rect)(ref r)).x + num, ((Rect)(ref r)).y + num, ((Rect)(ref r)).width - 2f * num, ((Rect)(ref r)).height - 2f * num);
			GUI.color = new Color(0.22f, 0.21f, 0.2f, alpha);
			GUI.DrawTexture(val2, whiteTexture);
			Rect val3 = default(Rect);
			((Rect)(ref val3))..ctor(((Rect)(ref val2)).x, ((Rect)(ref val2)).y, ((Rect)(ref val2)).width * Mathf.Clamp01(pct), ((Rect)(ref val2)).height);
			if (((Rect)(ref val3)).width > 0f)
			{
				GUI.color = new Color(fill.r, fill.g, fill.b, alpha);
				GUI.DrawTexture(val3, whiteTexture);
				if (((Rect)(ref val3)).height >= 6f * s)
				{
					GUI.color = new Color(1f, 1f, 1f, 0.12f * alpha);
					GUI.DrawTexture(new Rect(((Rect)(ref val3)).x, ((Rect)(ref val3)).y, ((Rect)(ref val3)).width, ((Rect)(ref val3)).height * 0.4f), whiteTexture);
				}
			}
			GUI.color = Color.white;
		}

		private static void DrawSprite(Sprite sp, Rect r, float k)
		{
			//IL_0008: 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_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: 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_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: 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_004a: 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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			Texture texture = (Texture)(object)sp.texture;
			Rect textureRect = sp.textureRect;
			Vector4 val = ((k > 0f) ? sp.border : Vector4.zero);
			if (k > 0f)
			{
				k = Mathf.Min(new float[3]
				{
					k,
					((Rect)(ref r)).height / Mathf.Max(1f, val.y + val.w),
					((Rect)(ref r)).width / Mathf.Max(1f, val.x + val.z)
				});
			}
			float[] array = new float[4]
			{
				0f,
				val.x,
				((Rect)(ref textureRect)).width - val.z,
				((Rect)(ref textureRect)).width
			};
			float[] array2 = new float[4]
			{
				0f,
				val.y,
				((Rect)(ref textureRect)).height - val.w,
				((Rect)(ref textureRect)).height
			};
			float[] array3 = new float[4]
			{
				((Rect)(ref r)).x,
				((Rect)(ref r)).x + val.x * k,
				((Rect)(ref r)).xMax - val.z * k,
				((Rect)(ref r)).xMax
			};
			float[] array4 = new float[4]
			{
				((Rect)(ref r)).yMax,
				((Rect)(ref r)).yMax - val.y * k,
				((Rect)(ref r)).y + val.w * k,
				((Rect)(ref r)).y
			};
			for (int i = 0; i < 3; i++)
			{
				for (int j = 0; j < 3; j++)
				{
					if (!(array[i + 1] <= array[i]) && !(array2[j + 1] <= array2[j]))
					{
						GUI.DrawTextureWithTexCoords(new Rect(array3[i], array4[j + 1], array3[i + 1] - array3[i], array4[j] - array4[j + 1]), texture, new Rect((((Rect)(ref textureRect)).x + array[i]) / (float)texture.width, (((Rect)(ref textureRect)).y + array2[j]) / (float)texture.height, (array[i + 1] - array[i]) / (float)texture.width, (array2[j + 1] - array2[j]) / (float)texture.height));
					}
				}
			}
		}

		private static void DrawText(Rect r, string text, GUIStyle style, TextAnchor anchor, float alpha = 1f, Color? color = null, bool shadow = true)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			style.alignment = anchor;
			if (shadow)
			{
				style.normal.textColor = new Color(0f, 0f, 0f, alpha);
				GUI.Label(new Rect(((Rect)(ref r)).x + 1f, ((Rect)(ref r)).y + 1f, ((Rect)(ref r)).width, ((Rect)(ref r)).height), text, style);
			}
			Color val = (Color)(((??)color) ?? new Color(1f, 0.9f, 0.6f));
			style.normal.textColor = new Color(val.r, val.g, val.b, alpha);
			GUI.Label(r, text, style);
		}

		private ConfigEntry<T> Cfg<T>(string name, T value, string description, AcceptableValueBase? range = null)
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			return ((BaseUnityPlugin)this).Config.Bind<T>("Affichage", name, value, new ConfigDescription(description + " [Local setting / Réglage local]", range, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = _order--
				}
			}));
		}

		static ValGazettePlugin()
		{
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			Biome[] array = new Biome[9];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			BiomeOrder = (Biome[])(object)array;
			TrophyBiomes = new(Biome, string)[9]
			{
				((Biome)1, "TrophyBoar TrophyDeer TrophyNeck TrophyEikthyr"),
				((Biome)8, "TrophyGreydwarf TrophyGreydwarfBrute TrophyGreydwarfShaman TrophySkeletonPoison TrophySkeleton TrophyGhost TrophyFrostTroll TrophyBjorn TrophySkeletonHildir TrophyTheElder"),
				((Biome)2, "TrophyWrithan TrophyAbomination TrophyBlob TrophyDraugr TrophyDraugrFem TrophyDraugrElite TrophyLeech TrophySurtling TrophyWraith TrophyKvastur TrophyBonemass"),
				((Biome)4, "TrophyCultist TrophyHatchling TrophyFenring TrophySGolem TrophyUlv TrophyWolf TrophyCultist_Hildir TrophyDragonQueen"),
				((Biome)16, "TrophyDeathsquito TrophyGoblin TrophyGoblinBrute TrophyGoblinShaman TrophyGrowth TrophyLox TrophyBjornUndead TrophyGoblinBruteBrosShaman TrophyGoblinBruteBrosBrute TrophyGoblinKing"),
				((Biome)256, "TrophySerpent"),
				((Biome)512, "TrophyDvergr TrophyHare TrophyGjall TrophySeeker TrophySeekerBrute TrophyTick TrophySeekerQueen"),
				((Biome)32, "TrophyAsksvin TrophyBonemawSerpent TrophyFallenValkyrie TrophyCharredArcher TrophyCharredMage TrophyCharredMelee TrophyMorgen TrophyVolture TrophyBlob_Lava TrophyFader"),
				((Biome)64, "TrophyMoose TrophySeal TrophyBarka TrophyElaking TrophyJotunWarrior TrophyJotunWitch")
			};
			MainBossKeys = new string[8] { "defeated_eikthyr", "defeated_gdking", "defeated_bonemass", "defeated_dragon", "defeated_goblinking", "defeated_queen", "defeated_fader", "defeated_frozenking" };
			Altars = new Dictionary<string, (string, int)>
			{
				["defeated_eikthyr"] = ("TrophyDeer", 2),
				["defeated_gdking"] = ("AncientSeed", 3),
				["defeated_bonemass"] = ("WitheredBone", 10),
				["defeated_goblinking"] = ("GoblinTotem", 3),
				["defeated_fader"] = ("Bell", 3),
				["defeated_frozenking"] = ("HatefulBlood", 3)
			};
			Corners = (Vector3[])(object)new Vector3[4];
			_barBgCol = Color.white;
		}
	}
	internal sealed class ConfigurationManagerAttributes
	{
		public int? Order;
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}