Decompiled source of TrophyHuntMod v0.7.1

plugins/TrophyHuntMod.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using HarmonyLib;
using Steamworks;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("TrophyHuntMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TrophyHuntMod")]
[assembly: AssemblyCopyright("Copyright © oathorse 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")]
[assembly: AssemblyFileVersion("0.7.1")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.7.1.0")]
namespace TrophyHuntMod;

internal class TrophyConsoleCommands
{
}
internal class TrophyFiesta
{
	private static GameObject customBomb;

	private static void AddItemToObjectDB(GameObject item)
	{
		Debug.LogWarning((object)"AddItemToObjectDB()");
		if (!ObjectDB.instance.m_items.Contains(item))
		{
			ObjectDB.instance.m_items.Add(item);
		}
	}

	private static void SetupBoarTrophy()
	{
		//IL_0084: 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)
		Debug.LogWarning((object)"SetupBoarTrophy()");
		GameObject itemPrefab = ObjectDB.instance.GetItemPrefab("TrophyBoar");
		if ((Object)(object)itemPrefab == (Object)null)
		{
			Debug.LogError((object)"boarTrophy is null");
			return;
		}
		GameObject itemPrefab2 = ObjectDB.instance.GetItemPrefab("SpearFlint");
		if ((Object)(object)itemPrefab2 == (Object)null)
		{
			Debug.LogError((object)"flintSpear is null");
			return;
		}
		ItemDrop component = itemPrefab2.GetComponent<ItemDrop>();
		ItemDrop component2 = itemPrefab.GetComponent<ItemDrop>();
		if ((Object)(object)component2 != (Object)null)
		{
			SharedData shared = component2.m_itemData.m_shared;
			SharedData shared2 = component.m_itemData.m_shared;
			shared.m_itemType = shared2.m_itemType;
			shared.m_attack = shared2.m_secondaryAttack;
			shared.m_attack.m_attackProjectile.GetComponent<Projectile>().m_visual = itemPrefab;
			shared.m_spawnOnHit = shared2.m_spawnOnHit;
			shared.m_spawnOnHitTerrain = shared2.m_spawnOnHitTerrain;
			shared.m_projectileToolTip = shared2.m_projectileToolTip;
		}
		if (!Object.op_Implicit((Object)(object)Resources.Load<GameObject>("impact_sfx")))
		{
			Debug.LogError((object)"hitEffect is null");
		}
	}

	public static void Initialize()
	{
		SetupBoarTrophy();
	}
}
public class BoarTrophyBombBehavior : MonoBehaviour
{
	public GameObject explosionEffect;

	private void Start()
	{
		Debug.LogWarning((object)"BoarTrophyBombBehavior.Start");
		GameObject itemPrefab = ObjectDB.instance.GetItemPrefab("Troll");
		if ((Object)(object)itemPrefab != (Object)null)
		{
			EffectList hitEffects = itemPrefab.GetComponent<Character>().m_hitEffects;
			explosionEffect = hitEffects.m_effectPrefabs[0].m_prefab;
		}
	}

	private void OnCollisionEnter(Collision collision)
	{
		Debug.LogWarning((object)"BoarTrophyBombBehavior.OnCollisionEnter");
		Explode();
	}

	private void Explode()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		Debug.LogWarning((object)"BoarTrophyBombBehavior.Explode");
		if ((Object)(object)explosionEffect != (Object)null)
		{
			Object.Instantiate<GameObject>(explosionEffect, ((Component)this).transform.position, Quaternion.identity);
		}
		Object.Destroy((Object)(object)((Component)this).gameObject);
	}
}
[BepInPlugin("com.oathorse.TrophyHuntMod", "TrophyHuntMod", "0.7.1")]
internal class TrophyHuntMod : BaseUnityPlugin
{
	public enum Biome
	{
		Meadows,
		Forest,
		Swamp,
		Mountains,
		Plains,
		Mistlands,
		Ashlands,
		Ocean,
		Hildir,
		Bogwitch
	}

	public struct TrophyHuntData
	{
		public string m_name;

		public string m_prettyName;

		public Biome m_biome;

		public int m_value;

		public float m_dropPercent;

		public List<string> m_enemies;

		public TrophyHuntData(string name, string prettyName, Biome biome, int value, float dropPercent, List<string> enemies)
		{
			m_name = name;
			m_prettyName = prettyName;
			m_biome = biome;
			m_value = value;
			m_dropPercent = dropPercent;
			m_enemies = enemies;
		}
	}

	public struct BiomeBonus
	{
		public Biome m_biome;

		public string m_biomeName;

		public int m_bonus;

		public List<string> m_trophies;

		public BiomeBonus(Biome biome, string biomeName, int bonus, List<string> trophies)
		{
			m_biome = biome;
			m_biomeName = biomeName;
			m_bonus = bonus;
			m_trophies = trophies;
		}
	}

	public enum TrophyGameMode
	{
		TrophyHunt,
		TrophyRush,
		TrophySaga,
		TrophyFiesta,
		Max
	}

	public struct DropInfo
	{
		public int m_numKilled;

		public int m_trophies;

		public DropInfo()
		{
			m_numKilled = 0;
			m_trophies = 0;
			m_numKilled = 0;
			m_trophies = 0;
		}
	}

	[HarmonyPatch(typeof(Player), "OnSpawned")]
	public class Player_OnSpawned_Patch
	{
		[HarmonyPatch(typeof(Skills), "GetSkill")]
		public class Skills_Learn_Patch
		{
			private static void Postfix(Skill __instance, SkillType skillType, ref Skill __result)
			{
				if (GetGameMode() == TrophyGameMode.TrophySaga && __result.m_level < 20f)
				{
					__result.m_level = 20f;
					__result.m_accumulator = 0f;
					Debug.Log((object)$"Setting skill {((object)(SkillType)(ref __result.m_info.m_skill)).ToString()} to {20f}");
				}
			}
		}

		[HarmonyPatch(typeof(Player), "AddTrophy", new Type[] { typeof(ItemData) })]
		public static class Player_AddTrophy_Patch
		{
			public static void Postfix(Player __instance, ItemData item)
			{
				if (!((Object)(object)__instance != (Object)null) || item == null)
				{
					return;
				}
				string name = ((Object)item.m_dropPrefab).name;
				if (__m_trophyCache.Find((string trophyName) => trophyName == name) != name)
				{
					FlashTrophy(name);
					__m_trophyCache = __instance.GetTrophies();
					if (GetGameMode() == TrophyGameMode.TrophyRush && UpdateBiomeBonusTrophies(name))
					{
						MessageHud.instance.ShowBiomeFoundMsg("Biome Bonus", true);
						FlashBiomeTrophies(name);
					}
					UpdateTrophyHuntUI(__instance);
				}
			}
		}

		[Serializable]
		public class LeaderboardData
		{
			public string player_name;

			public int current_score;

			public string session_id;

			public string player_location;

			public string trophies;

			public int deaths;

			public int logouts;

			public string gamemode;
		}

		[HarmonyPatch(typeof(Game), "Logout", new Type[]
		{
			typeof(bool),
			typeof(bool)
		})]
		public static class Game_Logout_Patch
		{
			public static void Postfix(Game __instance, bool save, bool changeToStartScene)
			{
				float totalOnFootDistance = GetTotalOnFootDistance(__instance);
				if ((__m_logoutCount >= 1 || !(totalOnFootDistance < 50f)) && !__m_ignoreLogouts)
				{
					__m_logoutCount++;
				}
			}
		}

		public struct LuckRating
		{
			public float m_percent;

			public string m_luckString;

			public string m_colorString;

			public LuckRating(float percent, string luckString, string colorStr)
			{
				m_percent = 0f;
				m_luckString = "<n/a>";
				m_colorString = "white";
				m_percent = percent;
				m_luckString = luckString;
				m_colorString = colorStr;
			}
		}

		public struct SpecialSagaDrop
		{
			public string m_itemName;

			public float m_dropPercent;

			public int m_dropAmountMin;

			public int m_dropAmountMax;

			public bool m_dropOnlyOne;

			public int m_numDropped;

			public SpecialSagaDrop(string itemName, float dropPercent, int dropAmountMin, int dropAmountMax, bool dropOnlyOne)
			{
				m_itemName = itemName;
				m_dropPercent = dropPercent;
				m_dropAmountMin = dropAmountMin;
				m_dropAmountMax = dropAmountMax;
				m_dropOnlyOne = dropOnlyOne;
				m_numDropped = 0;
			}
		}

		[HarmonyPatch(typeof(CharacterDrop), "GenerateDropList")]
		private class CharacterDrop_GenerateDropList_Patch
		{
			private static void Postfix(CharacterDrop __instance, ref List<KeyValuePair<GameObject, int>> __result)
			{
				if (!((Object)(object)__instance != (Object)null))
				{
					return;
				}
				string name = ((Component)__instance).GetComponent<Character>().m_name;
				if (CharacterCanDropTrophies(name))
				{
					RecordTrophyCapableKill(name, killedByPlayer: false);
					bool flag = false;
					if (__result != null)
					{
						foreach (KeyValuePair<GameObject, int> item3 in __result)
						{
							string name2 = ((Object)item3.Key).name;
							if (name2.Contains("Trophy"))
							{
								RecordDroppedTrophy(name, name2);
								flag = true;
								break;
							}
						}
					}
					else
					{
						Debug.Log((object)("Trophy-capable character " + name + " had null drop list"));
					}
					if (!flag)
					{
						float num = 0f;
						if (GetGameMode() == TrophyGameMode.TrophyRush || GetGameMode() == TrophyGameMode.TrophySaga)
						{
							string text = EnemyNameToTrophyName(name);
							if (!__m_trophyCache.Contains(text) || text == "TrophyDeer")
							{
								num = 100f;
							}
						}
						if ((float)new Random().NextDouble() * 100f < num)
						{
							string trophyName = EnemyNameToTrophyName(name);
							Drop val = __instance.m_drops.Find((Drop theDrop) => ((Object)theDrop.m_prefab).name == trophyName);
							if (val != null)
							{
								KeyValuePair<GameObject, int> item = new KeyValuePair<GameObject, int>(val.m_prefab, 1);
								if (__result == null)
								{
									__result = new List<KeyValuePair<GameObject, int>>();
								}
								__result.Add(item);
								RecordDroppedTrophy(name, trophyName);
							}
						}
					}
				}
				if (GetGameMode() != TrophyGameMode.TrophySaga || !__m_specialSagaDrops.ContainsKey(name))
				{
					return;
				}
				List<SpecialSagaDrop> list = __m_specialSagaDrops[name];
				Random random = new Random(Guid.NewGuid().GetHashCode());
				for (int i = 0; i < list.Count; i++)
				{
					SpecialSagaDrop value = list[i];
					bool flag2 = false;
					if (value.m_dropOnlyOne)
					{
						flag2 = value.m_numDropped > 0;
						if (!flag2 && value.m_itemName == "BeltStrength")
						{
							List<SpecialSagaDrop> list2 = __m_specialSagaDrops["$enemy_greyling"];
							List<SpecialSagaDrop> list3 = __m_specialSagaDrops["$enemy_troll"];
							SpecialSagaDrop specialSagaDrop = list2.Find((SpecialSagaDrop x) => x.m_itemName == "BeltStrength");
							SpecialSagaDrop specialSagaDrop2 = list3.Find((SpecialSagaDrop x) => x.m_itemName == "BeltStrength");
							if (specialSagaDrop.m_numDropped > 0 || specialSagaDrop2.m_numDropped > 0)
							{
								flag2 = true;
							}
						}
					}
					if (flag2 || !((float)random.NextDouble() * 100f < value.m_dropPercent))
					{
						continue;
					}
					GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(value.m_itemName);
					if ((Object)(object)itemPrefab != (Object)null)
					{
						int num2 = random.Next(value.m_dropAmountMin, value.m_dropAmountMax);
						KeyValuePair<GameObject, int> item2 = new KeyValuePair<GameObject, int>(itemPrefab, num2);
						if (__result != null)
						{
							__result.Add(item2);
							Debug.LogWarning((object)$"{name} dropping {num2} {value.m_itemName}");
							value.m_numDropped += num2;
							list[i] = value;
						}
					}
				}
			}
		}

		[HarmonyPatch(typeof(Character), "OnDeath")]
		public class Character_OnDeath_Patch
		{
			private static void Postfix(Character __instance)
			{
				bool flag = false;
				if ((Object)(object)Player.m_localPlayer != (Object)null && __instance.m_lastHit != null && (Object)(object)__instance.m_lastHit.GetAttacker() == (Object)(object)Player.m_localPlayer)
				{
					flag = true;
				}
				if (flag)
				{
					string name = __instance.m_name;
					if (CharacterCanDropTrophies(name))
					{
						RecordTrophyCapableKill(name, killedByPlayer: true);
					}
				}
			}
		}

		[HarmonyPatch(typeof(ItemData), "GetWeight")]
		public class Humanoid_ItemDrop_ItemData_GetWeight_Patch
		{
			private static bool Prefix(ItemData __instance, ref float __result)
			{
				if (GetGameMode() != TrophyGameMode.TrophySaga)
				{
					return true;
				}
				if (__instance == null)
				{
					return true;
				}
				if ((Object)(object)__instance.m_dropPrefab == (Object)null)
				{
					return true;
				}
				if (__m_metalConversions.TryGetValue(((Object)__instance.m_dropPrefab).name, out var value))
				{
					ItemData itemData = ZNetScene.instance.GetPrefab(value).GetComponent<ItemDrop>().m_itemData;
					if (itemData != null)
					{
						__result = itemData.m_shared.m_weight * (float)__instance.m_stack;
					}
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(ItemData), "GetNonStackedWeight")]
		public class Humanoid_ItemDrop_ItemData_GetNonStackedWeight_Patch
		{
			private static bool Prefix(ItemData __instance, ref float __result)
			{
				if (GetGameMode() != TrophyGameMode.TrophySaga)
				{
					return true;
				}
				if (__instance == null)
				{
					return true;
				}
				if ((Object)(object)__instance.m_dropPrefab == (Object)null)
				{
					return true;
				}
				if (__m_metalConversions.TryGetValue(((Object)__instance.m_dropPrefab).name, out var value))
				{
					ItemData itemData = ZNetScene.instance.GetPrefab(value).GetComponent<ItemDrop>().m_itemData;
					if (itemData != null)
					{
						__result = itemData.m_shared.m_weight;
					}
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(Inventory), "AddItem", new Type[] { typeof(ItemData) })]
		public static class Inventory_AddItem_Patch
		{
			private static void Prefix(Inventory __instance, ref ItemData item, bool __result)
			{
				if (__instance != null && (Object)(object)Player.m_localPlayer != (Object)null && __instance == ((Humanoid)Player.m_localPlayer).GetInventory() && GetGameMode() == TrophyGameMode.TrophySaga && __m_instaSmelt)
				{
					ConvertMetal(ref item);
				}
			}
		}

		[HarmonyPatch(typeof(Inventory), "CanAddItem", new Type[]
		{
			typeof(ItemData),
			typeof(int)
		})]
		public static class Inventory_CanAddItem_Patch
		{
			private static bool Prefix(Inventory __instance, ref ItemData item, int stack, ref bool __result)
			{
				if (__instance != null && (Object)(object)Player.m_localPlayer != (Object)null && __instance == ((Humanoid)Player.m_localPlayer).GetInventory() && GetGameMode() == TrophyGameMode.TrophySaga && __m_instaSmelt && item != null && (Object)(object)item.m_dropPrefab != (Object)null && __m_metalConversions.TryGetValue(((Object)item.m_dropPrefab).name, out var value))
				{
					GameObject val = Object.Instantiate<GameObject>(ZNetScene.instance.GetPrefab(value));
					if (Object.op_Implicit((Object)(object)val))
					{
						ItemDrop component = val.GetComponent<ItemDrop>();
						if (stack <= 0)
						{
							stack = item.m_stack;
						}
						__result = __instance.FindFreeStackSpace(component.m_itemData.m_shared.m_name, (float)item.m_worldLevel) + (__instance.m_width * __instance.m_height - __instance.m_inventory.Count) * item.m_shared.m_maxStackSize >= stack;
						return false;
					}
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(Humanoid), "Pickup")]
		public class Humanoid_Pickup_Patch
		{
			private static void Prefix(Humanoid __instance, GameObject go, bool autoequip, bool autoPickupDelay, bool __result)
			{
				if (!((Object)(object)__instance == (Object)null) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer) && GetGameMode() == TrophyGameMode.TrophySaga && __m_instaSmelt)
				{
					ItemDrop component = go.GetComponent<ItemDrop>();
					if ((Object)(object)component != (Object)null)
					{
						ConvertMetal(ref component.m_itemData);
					}
				}
			}

			private static void Postfix(Humanoid __instance, GameObject go, bool autoequip, bool autoPickupDelay, bool __result)
			{
				if (!((Object)(object)__instance == (Object)null) && !((Object)(object)go == (Object)null))
				{
					ItemData itemData = go.GetComponent<ItemDrop>().m_itemData;
					if (__result && itemData != null && (Object)(object)itemData.m_dropPrefab != (Object)null)
					{
						RecordPlayerPickedUpTrophy(((Object)itemData.m_dropPrefab).name);
					}
				}
			}
		}

		[HarmonyPatch(typeof(FejdStartup), "Start")]
		public class FejdStartup_Start_Patch
		{
			private static void Postfix()
			{
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_0095: 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)
				//IL_00be: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_0119: Unknown result type (might be due to invalid IL or missing references)
				//IL_011e: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = GameObject.Find("Menu");
				if ((Object)(object)val != (Object)null)
				{
					Transform val2 = val.transform.Find("Logo");
					if ((Object)(object)val2 != (Object)null)
					{
						GameObject val3 = new GameObject("TrophyHuntModLogoText");
						val3.transform.SetParent(val2.parent);
						RectTransform obj = val3.AddComponent<RectTransform>();
						((Transform)obj).localScale = Vector3.one;
						obj.anchorMin = new Vector2(0.5f, 0.6f);
						obj.anchorMax = new Vector2(1f, 0.6f);
						obj.pivot = new Vector2(1f, 1f);
						obj.anchoredPosition = new Vector2(-20f, 20f);
						obj.sizeDelta = new Vector2(-650f, 185f);
						__m_trophyHuntMainMenuText = val3.AddComponent<TextMeshProUGUI>();
						((TMP_Text)__m_trophyHuntMainMenuText).text = GetTrophyHuntMainMenuText();
						((TMP_Text)__m_trophyHuntMainMenuText).alignment = (TextAlignmentOptions)513;
						((TMP_Text)__m_trophyHuntMainMenuText).fontMaterial.EnableKeyword("OUTLINE_ON");
						((TMP_Text)__m_trophyHuntMainMenuText).lineSpacingAdjustment = -5f;
						((TMP_Text)__m_trophyHuntMainMenuText).outlineColor = Color32.op_Implicit(Color.black);
						((TMP_Text)__m_trophyHuntMainMenuText).outlineWidth = 0.05f;
						((TMP_Text)__m_trophyHuntMainMenuText).font = Resources.Load<TMP_FontAsset>("Valheim-AveriaSerifLibre");
						((TMP_Text)__m_trophyHuntMainMenuText).fontStyle = (FontStyles)1;
						AddToggleGameModeButton(val3.transform);
					}
					else
					{
						Debug.LogWarning((object)"Valheim logo not found!");
					}
				}
				else
				{
					Debug.LogWarning((object)"Main menu not found!");
				}
			}
		}

		[HarmonyPatch(typeof(FejdStartup), "OnNewWorldDone", new Type[] { typeof(bool) })]
		public class FejdStartup_OnNewWorldDone_Patch
		{
			private static void Postfix(FejdStartup __instance, bool forceLocal)
			{
				if (FejdStartup.m_instance.m_world != null)
				{
					if (GetGameMode() == TrophyGameMode.TrophyRush)
					{
						FejdStartup.m_instance.m_world.m_startingGlobalKeys.Clear();
						FejdStartup.m_instance.m_world.m_startingGlobalKeys.Add("playerdamage 70");
						FejdStartup.m_instance.m_world.m_startingGlobalKeys.Add("enemydamage 200");
						FejdStartup.m_instance.m_world.m_startingGlobalKeys.Add("enemyspeedsize 120");
						FejdStartup.m_instance.m_world.m_startingGlobalKeys.Add("enemyleveluprate 140");
						FejdStartup.m_instance.m_world.m_startingGlobalKeys.Add("resourcerate 200");
						FejdStartup.m_instance.m_world.m_startingGlobalKeys.Add("preset combat_veryhard:deathpenalty_default: resources_muchmore: raids_default: portals_default");
						FejdStartup.m_instance.m_world.SaveWorldMetaData(DateTime.Now);
						__instance.UpdateWorldList(true);
					}
					else if (GetGameMode() == TrophyGameMode.TrophySaga)
					{
						FejdStartup.m_instance.m_world.m_startingGlobalKeys.Clear();
						FejdStartup.m_instance.m_world.m_startingGlobalKeys.Add("resourcerate 200");
						FejdStartup.m_instance.m_world.m_startingGlobalKeys.Add("eventrate 0");
						FejdStartup.m_instance.m_world.m_startingGlobalKeys.Add("teleportall");
						FejdStartup.m_instance.m_world.m_startingGlobalKeys.Add("preset combat_default:deathpenalty_default:resources_muchmore:raids_none:portals_casual");
						FejdStartup.m_instance.m_world.SaveWorldMetaData(DateTime.Now);
						__instance.UpdateWorldList(true);
					}
					else if (GetGameMode() == TrophyGameMode.TrophyFiesta)
					{
						FejdStartup.m_instance.m_world.m_startingGlobalKeys.Clear();
						FejdStartup.m_instance.m_world.m_startingGlobalKeys.Add("enemyspeedsize 200");
						FejdStartup.m_instance.m_world.m_startingGlobalKeys.Add("enemyleveluprate 300");
						FejdStartup.m_instance.m_world.SaveWorldMetaData(DateTime.Now);
						__instance.UpdateWorldList(true);
					}
				}
			}
		}

		[HarmonyPatch(typeof(ConsoleCommand), "RunAction", new Type[] { typeof(ConsoleEventArgs) })]
		public static class ConsoleCommand_RunAction_Patch
		{
			private static void Postfix(Inventory __instance, ConsoleEventArgs args)
			{
				if (__instance != null && args.Length > 0 && args[0] == "die")
				{
					__m_slashDieCount++;
				}
			}
		}

		[HarmonyPatch(typeof(Ship), "GetSailForce")]
		public class Ship_GetSailForce_Patch
		{
			private static void Postfix(ref Vector3 __result)
			{
				//IL_000a: 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_0019: Unknown result type (might be due to invalid IL or missing references)
				if (GetGameMode() == TrophyGameMode.TrophySaga)
				{
					__result *= 2.25f;
				}
			}
		}

		[HarmonyPatch(typeof(TreeBase), "Damage")]
		public static class TreeBase_Damage_Patch
		{
			private static void Prefix(TreeBase __instance, ref HitData hit)
			{
				if (__m_elderPowerCutsAllTrees)
				{
					Player localPlayer = Player.m_localPlayer;
					if ((Object)(object)localPlayer != (Object)null && localPlayer.GetGuardianPowerName() == "GP_TheElder" && localPlayer.m_guardianPowerCooldown > 0f)
					{
						hit.m_toolTier = (short)__instance.m_minToolTier;
					}
				}
			}
		}

		[HarmonyPatch(typeof(TreeLog), "Damage")]
		public static class TreeLog_Damage_Patch
		{
			private static void Prefix(TreeLog __instance, ref HitData hit)
			{
				if (__m_elderPowerCutsAllTrees)
				{
					Player localPlayer = Player.m_localPlayer;
					if ((Object)(object)localPlayer != (Object)null && localPlayer.GetGuardianPowerName() == "GP_TheElder" && localPlayer.m_guardianPowerCooldown > 0f)
					{
						hit.m_toolTier = (short)__instance.m_minToolTier;
					}
				}
			}
		}

		[HarmonyPatch(typeof(Fermenter), "Awake")]
		public static class Fermenter_AddItem_Patch
		{
			private static void Postfix(Fermenter __instance)
			{
				if ((Object)(object)__instance != (Object)null && GetGameMode() == TrophyGameMode.TrophySaga)
				{
					__instance.m_fermentationDuration = 10f;
				}
			}
		}

		[HarmonyPatch(typeof(Fermenter), "DelayedTap")]
		public static class Fermenter_DelayedTap_Patch
		{
			private static void Prefix(Fermenter __instance)
			{
				if ((Object)(object)__instance != (Object)null && GetGameMode() == TrophyGameMode.TrophySaga)
				{
					ItemConversion itemConversion = __instance.GetItemConversion(__instance.m_delayedTapItem);
					if (itemConversion != null)
					{
						itemConversion.m_producedItems = (int)((float)itemConversion.m_producedItems * 1.5f);
					}
				}
			}
		}

		[HarmonyPatch(typeof(Plant), "TimeSincePlanted")]
		public static class Plant_GetGrowTime_Patch
		{
			private static void Postfix(Plant __instance, ref double __result)
			{
				if ((Object)(object)__instance != (Object)null && GetGameMode() == TrophyGameMode.TrophySaga)
				{
					__result = (double)__instance.m_growTimeMax + 1.0;
				}
			}
		}

		[HarmonyPatch(typeof(Smelter), "Awake")]
		public static class Smelter_Awake_Patch
		{
			private static void Postfix(Smelter __instance)
			{
				if ((Object)(object)__instance != (Object)null && GetGameMode() == TrophyGameMode.TrophySaga)
				{
					if (__instance.m_name.Contains("eitr"))
					{
						__instance.m_secPerProduct = 1f;
					}
					else if (!__instance.m_name.Contains("bathtub"))
					{
						__instance.m_secPerProduct = 0.03f;
					}
				}
			}
		}

		[HarmonyPatch(typeof(Smelter), "OnAddFuel")]
		public static class Smelter_OnAddFuel_Patch
		{
			private static void Postfix(Smelter __instance, Switch sw, Humanoid user, ItemData item, bool __result)
			{
				if ((Object)(object)__instance != (Object)null && GetGameMode() == TrophyGameMode.TrophySaga && __instance.m_name.Contains("eitr") && __instance.GetQueueSize() < __instance.m_maxOre)
				{
					__instance.m_nview.InvokeRPC("RPC_AddOre", new object[1] { "Softtissue" });
				}
			}
		}

		[HarmonyPatch(typeof(SapCollector), "Awake")]
		public static class SapCollector_Awake_Patch
		{
			private static void Postfix(SapCollector __instance)
			{
				if ((Object)(object)__instance != (Object)null && GetGameMode() == TrophyGameMode.TrophySaga)
				{
					__instance.m_secPerUnit = 0.1f;
				}
			}
		}

		[HarmonyPatch(typeof(Beehive), "Awake")]
		public static class Beehive_Awake_Patch
		{
			private static void Postfix(Beehive __instance)
			{
				if ((Object)(object)__instance != (Object)null && GetGameMode() == TrophyGameMode.TrophySaga)
				{
					__instance.m_secPerUnit = 5f;
					__instance.m_maxHoney = 4;
				}
			}
		}

		[HarmonyPatch(typeof(Game), "ShowIntro")]
		public static class Game_ShowIntro_Patch
		{
			private static string m_originalText;

			private static void Prefix(Game __instance)
			{
				if ((Object)(object)__instance != (Object)null)
				{
					m_originalText = __instance.m_introText;
					__instance.m_introText = "You were once a great warrior, though your memory of deeds past has long grown dim, shrouded by eons slumbering in the land beyond death…\n\n\n\nRagnarok looms and the tenth world remains only for a few scant hours. You are reborn with one purpose: collect the heads of Odin's enemies before the cycle shatters Valheim forever…\n\n\n\nOdin will cast these heads into the well of Mimir where his lost eye still resides. He will then know how to banish them for all of time…\n\n\nBring Odin what he desires or be forced to stay for eternity…\n\n\n…in VALHEIM!";
				}
			}

			private static void Postfix(Game __instance)
			{
				if ((Object)(object)__instance != (Object)null)
				{
					__instance.m_introText = m_originalText;
				}
			}
		}

		[HarmonyPatch(typeof(MineRock5), "Awake")]
		public static class MineRock5_Awake_Patch
		{
			private static void Postfix(MineRock5 __instance)
			{
				if ((Object)(object)__instance != (Object)null && GetGameMode() == TrophyGameMode.TrophySaga)
				{
					DropTable dropItems = __instance.m_dropItems;
					dropItems.m_dropMin *= 2;
					DropTable dropItems2 = __instance.m_dropItems;
					dropItems2.m_dropMax *= 3;
				}
			}
		}

		[HarmonyPatch(typeof(LoadingIndicator), "Awake")]
		public static class LoadingIndicator_Awake_Patch
		{
			private static void Postfix(LoadingIndicator __instance)
			{
				//IL_0061: 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_00a3: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)__instance != (Object)null))
				{
					return;
				}
				foreach (AssetBundle allLoadedAssetBundle in AssetBundle.GetAllLoadedAssetBundles())
				{
					string text = "Assets/UI/textures/small/trophies.png";
					if (allLoadedAssetBundle.Contains(text))
					{
						Object obj = allLoadedAssetBundle.LoadAsset(text);
						Texture2D val = (Texture2D)(object)((obj is Texture2D) ? obj : null);
						if (val != null)
						{
							Sprite sprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
							__instance.m_spinner.sprite = sprite;
							((Graphic)__instance.m_spinner).color = new Color(1f, 43f / 51f, 0f, 1f);
							__instance.m_spinnerOriginalColor = ((Graphic)__instance.m_spinner).color;
						}
						break;
					}
				}
			}
		}

		private static GameObject __m_scoreTooltipObject = null;

		private static GameObject __m_scoreTooltipBackground = null;

		private static TextMeshProUGUI __m_scoreTooltipText;

		private static Vector2 __m_trophyHuntScoreTooltipWindowSize = new Vector2(240f, 215f);

		private static Vector2 __m_trophyRushScoreTooltipWindowSize = new Vector2(290f, 380f);

		private static Vector2 __m_trophySagaScoreTooltipWindowSize = new Vector2(290f, 215f);

		private static Vector2 __m_scoreTooltipTextOffset = new Vector2(5f, 2f);

		private static GameObject __m_luckTooltipObject = null;

		private static GameObject __m_luckTooltipBackground = null;

		private static TextMeshProUGUI __m_luckTooltip;

		private static Vector2 __m_luckTooltipWindowSize = new Vector2(220f, 135f);

		private static Vector2 __m_luckTooltipTextOffset = new Vector2(5f, 2f);

		public static LuckRating[] __m_luckRatingTable = new LuckRating[4]
		{
			new LuckRating(70f, "Bad", "#BF6000"),
			new LuckRating(100f, "Average", "#BFBF00"),
			new LuckRating(140f, "Good", "#00BF00"),
			new LuckRating(9999f, "Bonkers", "#6000BF")
		};

		private static GameObject __m_trophyTooltipObject = null;

		private static GameObject __m_trophyTooltipBackground = null;

		private static TextMeshProUGUI __m_trophyTooltip;

		private static Vector2 __m_trophyTooltipWindowSize = new Vector2(240f, 125f);

		private static Vector2 __m_trophyTooltipTextOffset = new Vector2(5f, 2f);

		private static Vector2 __m_trophyTooltipAllTrophyStatsWindowSize = new Vector2(240f, 195f);

		public static Dictionary<string, List<SpecialSagaDrop>> __m_specialSagaDrops = new Dictionary<string, List<SpecialSagaDrop>>
		{
			{
				"$enemy_greyling",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("FineWood", 50f, 3, 10, dropOnlyOne: false),
					new SpecialSagaDrop("Coal", 2f, 1, 2, dropOnlyOne: false),
					new SpecialSagaDrop("TrophyDeer", 5f, 1, 1, dropOnlyOne: false),
					new SpecialSagaDrop("RoundLog", 10f, 2, 7, dropOnlyOne: false),
					new SpecialSagaDrop("ArrowFlint", 5f, 2, 4, dropOnlyOne: false),
					new SpecialSagaDrop("BoneFragments", 8f, 1, 3, dropOnlyOne: false),
					new SpecialSagaDrop("Flint", 8f, 1, 3, dropOnlyOne: false),
					new SpecialSagaDrop("LeatherScraps", 10f, 2, 3, dropOnlyOne: false),
					new SpecialSagaDrop("DeerHide", 4f, 1, 3, dropOnlyOne: false),
					new SpecialSagaDrop("Feathers", 6f, 1, 2, dropOnlyOne: false),
					new SpecialSagaDrop("CookedDeerMeat", 8f, 1, 2, dropOnlyOne: false),
					new SpecialSagaDrop("Acorn", 3f, 1, 2, dropOnlyOne: false),
					new SpecialSagaDrop("CarrotSeeds", 4f, 1, 3, dropOnlyOne: false),
					new SpecialSagaDrop("QueenBee", 6f, 1, 1, dropOnlyOne: false),
					new SpecialSagaDrop("Honey", 6f, 1, 2, dropOnlyOne: false),
					new SpecialSagaDrop("Blueberries", 7f, 2, 4, dropOnlyOne: false),
					new SpecialSagaDrop("BeltStrength", 15f, 1, 1, dropOnlyOne: true)
				}
			},
			{
				"$enemy_greydwarfbrute",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("CryptKey", 100f, 1, 1, dropOnlyOne: true)
				}
			},
			{
				"$enemy_troll",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("BeltStrength", 100f, 1, 1, dropOnlyOne: true),
					new SpecialSagaDrop("TrollHide", 100f, 5, 5, dropOnlyOne: false)
				}
			},
			{
				"$enemy_skeletonfire",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("CryptKey", 100f, 1, 1, dropOnlyOne: true)
				}
			},
			{
				"$enemy_skeletonpoison",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("MaceIron", 100f, 1, 1, dropOnlyOne: true)
				}
			},
			{
				"$enemy_blobelite",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("Wishbone", 100f, 1, 1, dropOnlyOne: true),
					new SpecialSagaDrop("Ooze", 100f, 2, 5, dropOnlyOne: false)
				}
			},
			{
				"$enemy_blob",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("Ooze", 100f, 2, 5, dropOnlyOne: false)
				}
			},
			{
				"$enemy_drake",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("DragonTear", 100f, 1, 2, dropOnlyOne: false)
				}
			},
			{
				"$enemy_fenringcultist_hildir",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("DragonTear", 100f, 2, 3, dropOnlyOne: true)
				}
			},
			{
				"$enemy_goblinshaman",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("YagluthDrop", 100f, 1, 1, dropOnlyOne: true)
				}
			},
			{
				"$enemy_goblinbrute",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("YagluthDrop", 100f, 1, 1, dropOnlyOne: true)
				}
			},
			{
				"$enemy_goblin_hildir",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("YagluthDrop", 100f, 1, 1, dropOnlyOne: true)
				}
			},
			{
				"$enemy_goblinbrute_hildircombined",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("YagluthDrop", 100f, 1, 1, dropOnlyOne: true)
				}
			},
			{
				"$enemy_seekerbrute",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("QueenDrop", 100f, 1, 1, dropOnlyOne: false)
				}
			},
			{
				"$enemy_dvergr",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("YggdrasilWood", 100f, 10, 20, dropOnlyOne: false)
				}
			},
			{
				"$enemy_dvergr_mage",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("YggdrasilWood", 100f, 10, 20, dropOnlyOne: false)
				}
			}
		};

		public static Dictionary<string, string> __m_metalConversions = new Dictionary<string, string>
		{
			{ "CopperOre", "Copper" },
			{ "TinOre", "Tin" },
			{ "IronScrap", "Iron" },
			{ "SilverOre", "Silver" },
			{ "BlackMetalScrap", "BlackMetal" },
			{ "FlametalOreNew", "FlametalNew" },
			{ "BronzeScrap", "Bronze" },
			{ "CopperScrap", "Copper" }
		};

		private static void Postfix(Player __instance)
		{
			if (!((Object)(object)__instance != (Object)(object)Player.m_localPlayer))
			{
				Array.Sort(__m_trophyHuntData, (TrophyHuntData x, TrophyHuntData y) => x.m_biome.CompareTo(y.m_biome) * 100000 + x.m_value.CompareTo(y.m_value) * 10000 + x.m_name.CompareTo(y.m_name));
				__m_trophyCache = Player.m_localPlayer.GetTrophies();
				if (__m_showAllTrophyStats || __m_ignoreLogouts || GetGameMode() == TrophyGameMode.TrophyFiesta)
				{
					__m_invalidForTournamentPlay = true;
				}
				BuildUIElements();
				if (GetTotalOnFootDistance(Game.instance) < 10f)
				{
					__m_logoutCount = 0;
				}
				if (__m_storedPlayerID != Player.m_localPlayer.GetPlayerID() || __m_storedGameMode != __m_trophyGameMode || __m_storedWorldSeed != WorldGenerator.instance.m_world.m_seedName)
				{
					InitializeTrackedDataForNewPlayer();
				}
				string currentDirectory = Directory.GetCurrentDirectory();
				Debug.Log((object)("Working Directory for Trophy Hunt Mod: " + currentDirectory));
				Debug.Log((object)("Steam username: " + SteamFriends.GetPersonaName()));
				UpdateTrophyHuntUI(Player.m_localPlayer);
				ShowPlayerPath(showPlayerPath: false);
				StopCollectingPlayerPath();
				StartCollectingPlayerPath();
				__m_storedPlayerID = Player.m_localPlayer.GetPlayerID();
				__m_storedGameMode = __m_trophyGameMode;
				__m_storedWorldSeed = WorldGenerator.instance.m_world.m_seedName;
				if (GetGameMode() == TrophyGameMode.TrophyFiesta)
				{
					TrophyFiesta.Initialize();
				}
				if (GetGameMode() != TrophyGameMode.TrophySaga)
				{
					__m_gameTimerVisible = false;
				}
				else
				{
					__m_gameTimerVisible = true;
				}
			}
		}

		public static void RaiseAllPlayerSkills(float skillLevel)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				return;
			}
			foreach (KeyValuePair<SkillType, Skill> skillDatum in ((Character)Player.m_localPlayer).GetSkills().m_skillData)
			{
				if (skillDatum.Value.m_level < skillLevel)
				{
					Debug.Log((object)$"Setting skill {skillDatum.Key} from level {skillDatum.Value.m_level} to level {skillLevel}");
					skillDatum.Value.m_level = skillLevel;
				}
			}
		}

		public static void InitializeTrackedDataForNewPlayer()
		{
			if (GetGameMode() == TrophyGameMode.TrophySaga)
			{
				InitializeSagaDrops();
				RaiseAllPlayerSkills(20f);
			}
			__m_gameTimerElapsedSeconds = 0L;
			TimerStart();
			__m_logoutCount = 0;
			__m_ignoreLogouts = false;
			__m_slashDieCount = 0;
			__m_showAllTrophyStats = false;
			__m_invalidForTournamentPlay = false;
			__m_playerPathData.Clear();
			InitializeTrophyDropInfo();
		}

		public static int CalculateTrophyPoints(bool displayToLog = false)
		{
			int num = 0;
			TrophyHuntData[] _m_trophyHuntData = __m_trophyHuntData;
			for (int i = 0; i < _m_trophyHuntData.Length; i++)
			{
				TrophyHuntData trophyHuntData = _m_trophyHuntData[i];
				if (__m_trophyCache.Contains(trophyHuntData.m_name))
				{
					if (displayToLog)
					{
						string name = trophyHuntData.m_name;
						object arg = trophyHuntData.m_value;
						Biome biome = trophyHuntData.m_biome;
						PrintToConsole($"  {name}: Score: {arg} Biome: {biome.ToString()}");
					}
					num += trophyHuntData.m_value;
				}
			}
			return num;
		}

		public static int GetDeathPointCost()
		{
			int result = -20;
			if (GetGameMode() == TrophyGameMode.TrophyRush)
			{
				result = -10;
			}
			else if (GetGameMode() == TrophyGameMode.TrophySaga)
			{
				result = -30;
			}
			return result;
		}

		public static int GetSlashDiePointCost()
		{
			int result = 0;
			if (GetGameMode() == TrophyGameMode.TrophyRush)
			{
				result = -10;
			}
			return result;
		}

		public static int CalculateDeathPenalty()
		{
			return __m_deaths * GetDeathPointCost() + __m_slashDieCount * GetSlashDiePointCost();
		}

		public static int GetLogoutPointCost()
		{
			int result = -10;
			if (GetGameMode() == TrophyGameMode.TrophyRush)
			{
				result = -5;
			}
			else if (GetGameMode() == TrophyGameMode.TrophySaga)
			{
				result = -10;
			}
			return result;
		}

		public static int CalculateLogoutPenalty()
		{
			return __m_logoutCount * GetLogoutPointCost();
		}

		private static void BuildUIElements()
		{
			if ((Object)(object)Hud.instance == (Object)null || (Object)(object)Hud.instance.m_rootObject == (Object)null)
			{
				Debug.LogError((object)"TrophyHuntMod: Hud.instance.m_rootObject is NOT valid");
			}
			else
			{
				if (!((Object)(object)__m_deathsTextElement == (Object)null) || !((Object)(object)__m_scoreTextElement == (Object)null))
				{
					return;
				}
				Transform val = ((Component)Hud.instance).transform.Find("hudroot/healthpanel");
				if ((Object)(object)val == (Object)null)
				{
					Debug.LogError((object)"Health panel transform not found.");
					return;
				}
				if ((Object)(object)__m_scoreTextElement == (Object)null)
				{
					__m_scoreTextElement = CreateScoreTextElement(val);
				}
				if ((Object)(object)__m_deathsTextElement == (Object)null)
				{
					__m_deathsTextElement = CreateDeathsElement(val);
				}
				if ((Object)(object)__m_relogsTextElement == (Object)null)
				{
					__m_relogsTextElement = CreateRelogsElements(val);
				}
				if ((Object)(object)__m_gameTimerTextElement == (Object)null)
				{
					__m_gameTimerTextElement = CreateTimerElements(val);
				}
				__m_iconList = new List<GameObject>();
				CreateTrophyIconElements(val, __m_trophyHuntData, __m_iconList);
				CreateTrophyTooltip();
				CreateLuckTooltip();
				CreateLuckOMeterElements(val);
				CreateScoreTooltip();
			}
		}

		private static IEnumerator TimerUpdate()
		{
			while (__m_gameTimerActive)
			{
				if (Object.op_Implicit((Object)(object)Game.instance))
				{
					if ((Object)(object)__m_gameTimerTextElement != (Object)null)
					{
						TextMeshProUGUI component = __m_gameTimerTextElement.GetComponent<TextMeshProUGUI>();
						long num = __m_gameTimerElapsedSeconds;
						if (__m_gameTimerCountdown)
						{
							num = 14400 - num;
						}
						TimeSpan timeSpan = TimeSpan.FromSeconds(num);
						if (__m_gameTimerVisible)
						{
							((TMP_Text)component).text = "<mspace=0.5em>" + timeSpan.ToString() + "</mspace>";
							if (!__m_gameTimerCountdown)
							{
								((Graphic)component).color = Color.yellow;
								((TMP_Text)component).outlineColor = Color32.op_Implicit(Color.black);
							}
							else
							{
								((Graphic)component).color = new Color(1f, 0.4f, 0.3f);
								((TMP_Text)component).outlineColor = Color32.op_Implicit(Color.black);
							}
						}
						else
						{
							((TMP_Text)component).text = "";
						}
					}
					__m_gameTimerElapsedSeconds++;
				}
				yield return (object)new WaitForSeconds(1f);
			}
		}

		public static void TimerStart()
		{
			if (!__m_gameTimerActive)
			{
				__m_gameTimerActive = true;
				((MonoBehaviour)__m_trophyHuntMod).StartCoroutine(TimerUpdate());
			}
		}

		public static void TimerStop()
		{
			__m_gameTimerActive = false;
		}

		public static void TimerReset()
		{
			__m_gameTimerElapsedSeconds = 0L;
		}

		public static void TimerSet(string timeStr)
		{
			__m_gameTimerElapsedSeconds = (long)TimeSpan.Parse(timeStr).TotalSeconds;
		}

		public static void TimerToggle()
		{
			__m_gameTimerCountdown = !__m_gameTimerCountdown;
		}

		private static GameObject CreateTimerElements(Transform parentTransform)
		{
			//IL_0005: 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)
			//IL_0016: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Expected O, but got Unknown
			GameObject val = new GameObject("Timer");
			val.transform.SetParent(parentTransform);
			RectTransform obj = val.AddComponent<RectTransform>();
			obj.sizeDelta = new Vector2(120f, 25f);
			obj.anchoredPosition = new Vector2(-45f, 85f);
			((Transform)obj).localScale = new Vector3(__m_userTextScale, __m_userTextScale, __m_userTextScale);
			TextMeshProUGUI obj2 = val.AddComponent<TextMeshProUGUI>();
			((TMP_Text)obj2).text = "<mspace=0.5em>00:00:00</mspace>";
			((TMP_Text)obj2).fontSize = 24f;
			((Graphic)obj2).color = Color.yellow;
			((TMP_Text)obj2).alignment = (TextAlignmentOptions)514;
			((Graphic)obj2).raycastTarget = false;
			((TMP_Text)obj2).fontMaterial.EnableKeyword("OUTLINE_ON");
			((TMP_Text)obj2).outlineColor = Color32.op_Implicit(Color.black);
			((TMP_Text)obj2).fontStyle = (FontStyles)1;
			((TMP_Text)obj2).outlineWidth = 0.125f;
			return val;
		}

		private static GameObject CreateRelogsElements(Transform parentTransform)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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_0047: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: 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_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Expected O, but got Unknown
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			Sprite trophySprite = GetTrophySprite("RoundLog");
			GameObject val = new GameObject("RelogsIcon");
			val.transform.SetParent(parentTransform);
			RectTransform obj = val.AddComponent<RectTransform>();
			obj.sizeDelta = new Vector2(40f, 40f);
			obj.anchoredPosition = new Vector2(-70f, -105f);
			((Transform)obj).localScale = new Vector3(__m_userIconScale, __m_userIconScale, __m_userIconScale);
			Image obj2 = val.AddComponent<Image>();
			obj2.sprite = trophySprite;
			((Graphic)obj2).color = Color.white;
			GameObject val2 = new GameObject("RelogsElement");
			val2.transform.SetParent(parentTransform);
			RectTransform obj3 = val2.AddComponent<RectTransform>();
			obj3.sizeDelta = new Vector2(60f, 20f);
			obj3.anchoredPosition = new Vector2(-70f, -105f);
			((Transform)obj3).localScale = new Vector3(__m_userTextScale, __m_userTextScale, __m_userTextScale);
			TextMeshProUGUI val3 = val2.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val3).text = $"{__m_logoutCount}";
			((TMP_Text)val3).fontSize = 24f;
			((Graphic)val3).color = Color.yellow;
			((TMP_Text)val3).alignment = (TextAlignmentOptions)514;
			((Graphic)val3).raycastTarget = false;
			((TMP_Text)val3).fontMaterial.EnableKeyword("OUTLINE_ON");
			((TMP_Text)val3).outlineColor = Color32.op_Implicit(Color.black);
			((TMP_Text)val3).outlineWidth = 0.1f;
			if (__m_ignoreLogouts)
			{
				((Graphic)val3).color = Color.gray;
			}
			return val2;
		}

		private static GameObject CreateLuckOMeterElements(Transform parentTransform)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			//IL_008f: Expected O, but got Unknown
			Sprite trophySprite = GetTrophySprite("HelmetMidsummerCrown");
			GameObject val = new GameObject("LuckImage");
			val.transform.SetParent(parentTransform);
			RectTransform obj = val.AddComponent<RectTransform>();
			obj.sizeDelta = new Vector2(40f, 40f);
			obj.anchoredPosition = new Vector2(-70f, -20f);
			((Transform)obj).localScale = new Vector3(__m_userIconScale, __m_userIconScale, __m_userIconScale);
			Image obj2 = val.AddComponent<Image>();
			obj2.sprite = trophySprite;
			((Graphic)obj2).color = Color.white;
			((Graphic)obj2).raycastTarget = true;
			AddTooltipTriggersToLuckObject(val);
			return val;
		}

		private static GameObject CreateDeathsElement(Transform parentTransform)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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_0048: 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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: 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_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: 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_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Expected O, but got Unknown
			Sprite trophySprite = GetTrophySprite("Charredskull");
			GameObject val = new GameObject("DeathsIcon");
			val.transform.SetParent(parentTransform);
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.sizeDelta = new Vector2(50f, 50f);
			val2.anchoredPosition = new Vector2(-70f, -65f);
			((Transform)val2).localScale = new Vector3(__m_userIconScale, __m_userIconScale, __m_userIconScale);
			Image obj = val.AddComponent<Image>();
			obj.sprite = trophySprite;
			((Graphic)obj).color = Color.white;
			((Graphic)obj).raycastTarget = false;
			GameObject val3 = new GameObject("DeathsText");
			val3.transform.SetParent(parentTransform);
			RectTransform obj2 = val3.AddComponent<RectTransform>();
			obj2.sizeDelta = new Vector2(40f, 40f);
			obj2.anchoredPosition = val2.anchoredPosition;
			((Transform)obj2).localScale = new Vector3(__m_userTextScale, __m_userTextScale, __m_userTextScale);
			TextMeshProUGUI obj3 = val3.AddComponent<TextMeshProUGUI>();
			((TMP_Text)obj3).text = $"{__m_deaths}";
			((TMP_Text)obj3).fontSize = 24f;
			((Graphic)obj3).color = Color.yellow;
			((TMP_Text)obj3).alignment = (TextAlignmentOptions)514;
			((Graphic)obj3).raycastTarget = false;
			((TMP_Text)obj3).fontMaterial.EnableKeyword("OUTLINE_ON");
			((TMP_Text)obj3).outlineColor = Color32.op_Implicit(Color.black);
			((TMP_Text)obj3).outlineWidth = 0.1f;
			return val3;
		}

		private static GameObject CreateScoreTextElement(Transform parentTransform)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_005b: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Expected O, but got Unknown
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Expected O, but got Unknown
			new GameObject("ScoreBG").transform.SetParent(parentTransform);
			Vector2 anchoredPosition = default(Vector2);
			((Vector2)(ref anchoredPosition))..ctor(-65f, -140f);
			Vector2 sizeDelta = default(Vector2);
			((Vector2)(ref sizeDelta))..ctor(70f, 42f);
			GameObject val = new GameObject("ScoreText");
			val.transform.SetParent(parentTransform);
			RectTransform obj = val.AddComponent<RectTransform>();
			obj.sizeDelta = sizeDelta;
			obj.anchoredPosition = anchoredPosition;
			((Transform)obj).localScale = new Vector3(__m_userTextScale, __m_userTextScale, __m_userTextScale);
			int num = 9999;
			TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val2).text = $"{num}";
			((TMP_Text)val2).fontSize = 25f;
			((TMP_Text)val2).fontStyle = (FontStyles)1;
			((Graphic)val2).color = Color.yellow;
			((TMP_Text)val2).alignment = (TextAlignmentOptions)514;
			((Graphic)val2).raycastTarget = true;
			((TMP_Text)val2).fontMaterial.EnableKeyword("OUTLINE_ON");
			((TMP_Text)val2).outlineColor = Color32.op_Implicit(Color.black);
			((TMP_Text)val2).outlineWidth = 0.125f;
			AddTooltipTriggersToScoreObject(val);
			if (!__m_onlyModRunning)
			{
				((Graphic)val2).color = Color.cyan;
			}
			if (__m_showAllTrophyStats || __m_invalidForTournamentPlay)
			{
				((Graphic)val2).color = Color.green;
			}
			return val;
		}

		private static GameObject CreateTrophyIconElement(Transform parentTransform, Sprite iconSprite, string iconName, Biome iconBiome, int index)
		{
			//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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_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_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Expected O, but got Unknown
			//IL_010d: Expected O, but got Unknown
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			int num = 33;
			int num2 = -1;
			int num3 = -20;
			int num4 = -140;
			_ = ref __m_biomeColors[(int)iconBiome];
			GameObject val = new GameObject(iconName);
			val.transform.SetParent(parentTransform);
			RectTransform obj = val.AddComponent<RectTransform>();
			obj.sizeDelta = new Vector2((float)num, (float)num);
			obj.anchoredPosition = new Vector2((float)num3 + (float)index * ((float)(num + num2) + __m_userTrophySpacing), (float)num4);
			((Transform)obj).localScale = new Vector3(__m_baseTrophyScale, __m_baseTrophyScale, __m_baseTrophyScale) * __m_userIconScale;
			Image val2 = val.AddComponent<Image>();
			val2.sprite = iconSprite;
			((Graphic)val2).color = new Color(0f, 0.2f, 0.1f, 0.95f);
			((Graphic)val2).raycastTarget = true;
			if (GetGameMode() == TrophyGameMode.TrophyRush)
			{
				((Graphic)val2).color = new Color(0.5f, 0f, 0f);
			}
			else if (GetGameMode() == TrophyGameMode.TrophySaga)
			{
				((Graphic)val2).color = new Color(0f, 0f, 0.5f);
			}
			AddTooltipTriggersToTrophyIcon(val);
			return val;
		}

		public static void DeleteTrophyIconElements(List<GameObject> iconList)
		{
			foreach (GameObject icon in iconList)
			{
				Object.Destroy((Object)(object)icon);
			}
			iconList.Clear();
		}

		public static void CreateTrophyIconElements(Transform parentTransform, TrophyHuntData[] trophies, List<GameObject> iconList)
		{
			for (int i = 0; i < trophies.Length; i++)
			{
				TrophyHuntData trophyHuntData = trophies[i];
				Sprite trophySprite = GetTrophySprite(trophyHuntData.m_name);
				if ((Object)(object)trophySprite == (Object)null)
				{
					Debug.LogError((object)("Unable to find trophy sprite for " + trophyHuntData.m_name));
					continue;
				}
				GameObject val = CreateTrophyIconElement(parentTransform, trophySprite, trophyHuntData.m_name, trophyHuntData.m_biome, iconList.Count);
				((Object)val).name = trophyHuntData.m_name;
				iconList.Add(val);
			}
			if (GetGameMode() == TrophyGameMode.TrophyFiesta)
			{
				__m_fiestaFlashing = true;
				((MonoBehaviour)__m_trophyHuntMod).StartCoroutine(FlashTrophyFiesta());
			}
		}

		private static Sprite GetTrophySprite(string trophyPrefabName)
		{
			if ((Object)(object)ObjectDB.instance == (Object)null)
			{
				Debug.LogError((object)"ObjectDB is not loaded.");
				return null;
			}
			GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(trophyPrefabName);
			if ((Object)(object)itemPrefab == (Object)null)
			{
				Debug.LogError((object)("Trophy prefab '" + trophyPrefabName + "' not found."));
				return null;
			}
			ItemDrop component = itemPrefab.GetComponent<ItemDrop>();
			if ((Object)(object)component == (Object)null)
			{
				Debug.LogError((object)("ItemDrop component not found on prefab '" + trophyPrefabName + "'."));
				return null;
			}
			return component.m_itemData.m_shared.m_icons[0];
		}

		private static void EnableTrophyHuntIcon(string trophyName)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			if (__m_iconList == null)
			{
				Debug.LogError((object)"__m_iconList is null in EnableTrophyHuntIcon()");
				return;
			}
			GameObject val = __m_iconList.Find((GameObject gameObject) => ((Object)gameObject).name == trophyName);
			if ((Object)(object)val != (Object)null)
			{
				Image component = val.GetComponent<Image>();
				if ((Object)(object)component != (Object)null)
				{
					((Graphic)component).color = Color.white;
				}
			}
			else
			{
				Debug.LogError((object)("Unable to find " + trophyName + " in __m_iconList"));
			}
		}

		private static int CalculateTrophyScore(Player player)
		{
			int num = 0;
			foreach (string trophyName in player.GetTrophies())
			{
				TrophyHuntData trophyHuntData = Array.Find(__m_trophyHuntData, (TrophyHuntData element) => element.m_name == trophyName);
				if (trophyHuntData.m_name == trophyName)
				{
					num += trophyHuntData.m_value;
				}
			}
			return num;
		}

		private static bool CalculateBiomeBonusStats(Biome biome, out int numCollected, out int numTotal, out int biomeScore)
		{
			BiomeBonus biomeBonus = Array.Find(__m_biomeBonuses, (BiomeBonus element) => element.m_biome == biome);
			try
			{
				numCollected = 0;
				numTotal = biomeBonus.m_trophies.Count;
				biomeScore = biomeBonus.m_bonus;
				foreach (string trophy in biomeBonus.m_trophies)
				{
					if (__m_trophyCache.Contains(trophy))
					{
						numCollected++;
					}
				}
			}
			catch (Exception)
			{
				numCollected = 0;
				numTotal = 0;
				biomeScore = 0;
				return false;
			}
			return true;
		}

		public static int CalculateBiomeBonusScore(Player player)
		{
			int num = 0;
			BiomeBonus[] _m_biomeBonuses = __m_biomeBonuses;
			for (int i = 0; i < _m_biomeBonuses.Length; i++)
			{
				BiomeBonus biomeBonus = _m_biomeBonuses[i];
				int numCollected = 0;
				int numTotal = 0;
				int biomeScore = 0;
				CalculateBiomeBonusStats(biomeBonus.m_biome, out numCollected, out numTotal, out biomeScore);
				if (numCollected == numTotal)
				{
					num += biomeScore;
				}
			}
			return num;
		}

		public static bool UpdateBiomeBonusTrophies(string trophyName)
		{
			TrophyHuntData trophyHuntData = Array.Find(__m_trophyHuntData, (TrophyHuntData element) => element.m_name == trophyName);
			int numCollected = 0;
			int numTotal = 0;
			int biomeScore = 0;
			if (!CalculateBiomeBonusStats(trophyHuntData.m_biome, out numCollected, out numTotal, out biomeScore))
			{
				return false;
			}
			if (numCollected == numTotal && !__m_completedBiomeBonuses.Contains(trophyHuntData.m_biome))
			{
				PrintToConsole("Biome Completed! " + trophyHuntData.m_biome);
				__m_completedBiomeBonuses.Add(trophyHuntData.m_biome);
				return true;
			}
			return false;
		}

		public static void EnableTrophyHuntIcons(Player player)
		{
			foreach (string trophy in player.GetTrophies())
			{
				EnableTrophyHuntIcon(trophy);
			}
		}

		public static void EnableBiomes(Player player)
		{
			foreach (string trophy in player.GetTrophies())
			{
				EnableTrophyHuntIcon(trophy);
			}
		}

		private static void UpdateTrophyHuntUI(Player player)
		{
			if ((Object)(object)Hud.instance == (Object)null)
			{
				Debug.LogError((object)"Hud.instance is null");
				return;
			}
			if ((Object)(object)Hud.instance.m_rootObject == (Object)null)
			{
				Debug.LogError((object)"Hud.instance.m_rootObject is null");
				return;
			}
			if ((Object)(object)player == (Object)null)
			{
				Debug.LogError((object)"Player.m_localPlayer is null");
				return;
			}
			if (player.m_trophies == null)
			{
				Debug.LogError((object)"Player.m_localPlayer.m_trophies is null");
				return;
			}
			EnableTrophyHuntIcons(player);
			EnableBiomes(player);
			int num = CalculateTrophyScore(player);
			PlayerProfile playerProfile = Game.instance.GetPlayerProfile();
			if (playerProfile != null)
			{
				PlayerStats playerStats = playerProfile.m_playerStats;
				if (playerStats != null)
				{
					__m_deaths = (int)playerStats[(PlayerStatType)0];
					num += CalculateDeathPenalty();
					TextMeshProUGUI component = __m_deathsTextElement.GetComponent<TextMeshProUGUI>();
					if ((Object)(object)component != (Object)null)
					{
						((TMP_Text)component).SetText(__m_deaths.ToString());
					}
				}
			}
			if (!__m_ignoreLogouts)
			{
				num += CalculateLogoutPenalty();
			}
			if (GetGameMode() == TrophyGameMode.TrophyRush)
			{
				num += CalculateBiomeBonusScore(player);
			}
			((TMP_Text)__m_scoreTextElement.GetComponent<TextMeshProUGUI>()).text = num.ToString();
			((TMP_Text)__m_relogsTextElement.GetComponent<TextMeshProUGUI>()).text = __m_logoutCount.ToString();
			SendScoreToLeaderboard(num);
		}

		private static IEnumerator FlashImage(Image targetImage, RectTransform imageRect)
		{
			float flashDuration = 0.809f;
			int numFlashes = 6;
			Vector2 originalAnchoredPosition = imageRect.anchoredPosition;
			Vector3 originalScale = ((Transform)imageRect).localScale;
			for (int i = 0; i < numFlashes; i++)
			{
				for (float t = 0f; t < flashDuration; t += Time.deltaTime)
				{
					float num = Math.Min(1f, t / flashDuration);
					if ((int)(num * 5f) % 2 == 0)
					{
						((Graphic)targetImage).color = Color.white;
					}
					else
					{
						((Graphic)targetImage).color = Color.green;
					}
					float num2 = 1f + 1.5f * num;
					((Transform)imageRect).localScale = new Vector3(__m_baseTrophyScale, __m_baseTrophyScale, __m_baseTrophyScale) * num2 * __m_userIconScale;
					imageRect.anchoredPosition = originalAnchoredPosition + new Vector2(0f, 150f) * (float)Math.Sin(num / 2f);
					yield return null;
				}
				imageRect.anchoredPosition = originalAnchoredPosition;
			}
			((Graphic)targetImage).color = Color.white;
			((Transform)imageRect).localScale = originalScale;
			imageRect.anchoredPosition = originalAnchoredPosition;
		}

		private static IEnumerator FlashImage2(Image targetImage, RectTransform imageRect)
		{
			float flashDuration = 0.5f;
			int numFlashes = 4;
			Vector2 originalAnchoredPosition = imageRect.anchoredPosition;
			Vector3 originalScale = ((Transform)imageRect).localScale;
			for (int i = 0; i < numFlashes; i++)
			{
				float curAccel = 10f;
				float curVelocity = 0f;
				float curPosition = 0f;
				float timeElapsed = 0f;
				while (curVelocity > 0.1f)
				{
					float deltaTime = Time.deltaTime;
					curAccel += -10f * deltaTime;
					curVelocity += curAccel * deltaTime;
					curPosition += curVelocity * deltaTime;
					float num = 1f + timeElapsed / flashDuration;
					((Transform)imageRect).localScale = new Vector3(__m_baseTrophyScale, __m_baseTrophyScale, __m_baseTrophyScale) * num * __m_userIconScale;
					imageRect.anchoredPosition = originalAnchoredPosition + new Vector2(0f, 200f) * curPosition;
					yield return null;
				}
			}
			((Graphic)targetImage).color = Color.white;
			((Transform)imageRect).localScale = originalScale;
			imageRect.anchoredPosition = originalAnchoredPosition;
		}

		private static IEnumerator FlashBiomeImage(Image targetImage, RectTransform imageRect)
		{
			float flashDuration = 6f;
			Quaternion originalRotation = ((Transform)imageRect).rotation;
			for (float t = 0f; t < flashDuration; t += Time.deltaTime)
			{
				((Transform)imageRect).localEulerAngles = ((Transform)imageRect).localEulerAngles + new Vector3(0f, 0f, t);
				yield return null;
			}
			((Transform)imageRect).rotation = originalRotation;
		}

		private static IEnumerator FlashTrophyFiesta()
		{
			int startingColorIndex = 0;
			float elapsedTime = 0f;
			float flashInterval = 0.6f;
			while (__m_fiestaFlashing)
			{
				elapsedTime += Time.deltaTime;
				if (elapsedTime > flashInterval)
				{
					elapsedTime = 0f;
					int num = 0;
					foreach (GameObject _m_icon in __m_iconList)
					{
						if ((Object)(object)_m_icon != (Object)null)
						{
							Image component = _m_icon.GetComponent<Image>();
							if ((Object)(object)component != (Object)null)
							{
								int num2 = (startingColorIndex + num) % __m_fiestaColors.Length;
								if (((Graphic)component).color != Color.white)
								{
									Color color = __m_fiestaColors[num2];
									color.a = 0.5f;
									((Graphic)component).color = color;
								}
							}
						}
						num++;
					}
					int num3 = startingColorIndex + 1;
					startingColorIndex = num3;
					if (num3 >= __m_fiestaColors.Length)
					{
						startingColorIndex = 0;
					}
				}
				yield return null;
			}
			foreach (GameObject _m_icon2 in __m_iconList)
			{
				if ((Object)(object)_m_icon2 != (Object)null)
				{
					Image component2 = _m_icon2.GetComponent<Image>();
					if ((Object)(object)component2 != (Object)null)
					{
						((Graphic)component2).color = Color.white;
					}
				}
			}
		}

		private static void FlashTrophy(string trophyName)
		{
			GameObject val = __m_iconList.Find((GameObject gameObject) => ((Object)gameObject).name == trophyName);
			if ((Object)(object)val != (Object)null)
			{
				Image component = val.GetComponent<Image>();
				if ((Object)(object)component != (Object)null)
				{
					RectTransform component2 = val.GetComponent<RectTransform>();
					if ((Object)(object)component2 != (Object)null)
					{
						((MonoBehaviour)__m_trophyHuntMod).StartCoroutine(FlashImage(component, component2));
					}
				}
			}
			else
			{
				Debug.LogError((object)("Unable to find " + trophyName + " in __m_iconList"));
			}
		}

		private static void FlashBiomeTrophies(string trophyName)
		{
			TrophyHuntData trophyHuntData = Array.Find(__m_trophyHuntData, (TrophyHuntData element) => element.m_name == trophyName);
			foreach (string biomeTrophyName in Array.Find(__m_biomeBonuses, (BiomeBonus element) => element.m_biome == trophyHuntData.m_biome).m_trophies)
			{
				GameObject val = __m_iconList.Find((GameObject gameObject) => ((Object)gameObject).name == biomeTrophyName);
				if (!((Object)(object)val != (Object)null))
				{
					continue;
				}
				Image component = val.GetComponent<Image>();
				if ((Object)(object)component != (Object)null)
				{
					RectTransform component2 = val.GetComponent<RectTransform>();
					if ((Object)(object)component2 != (Object)null)
					{
						((MonoBehaviour)__m_trophyHuntMod).StartCoroutine(FlashBiomeImage(component, component2));
					}
				}
			}
		}

		public static void StartCollectingPlayerPath()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (!__m_collectingPlayerPath)
			{
				__m_previousPlayerPos = ((Component)Player.m_localPlayer).transform.position;
				__m_collectingPlayerPath = true;
				((MonoBehaviour)__m_trophyHuntMod).StartCoroutine(CollectPlayerPath());
			}
		}

		public static void StopCollectingPlayerPath()
		{
			if (__m_collectingPlayerPath)
			{
				((MonoBehaviour)__m_trophyHuntMod).StopCoroutine(CollectPlayerPath());
				__m_collectingPlayerPath = false;
			}
		}

		public static IEnumerator CollectPlayerPath()
		{
			if (!((Object)(object)Player.m_localPlayer != (Object)null))
			{
				yield break;
			}
			while (__m_collectingPlayerPath && (Object)(object)Player.m_localPlayer != (Object)null)
			{
				Vector3 position = ((Component)Player.m_localPlayer).transform.position;
				if (Vector3.Distance(position, __m_previousPlayerPos) > __m_minPathPlayerMoveDistance)
				{
					__m_playerPathData.Add(position);
					__m_previousPlayerPos = position;
				}
				yield return (object)new WaitForSeconds(__m_playerPathCollectionInterval);
			}
		}

		private static void SendScoreToLeaderboard(int score)
		{
			//IL_0025: 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)
			string personaName = SteamFriends.GetPersonaName();
			string session_id = WorldGenerator.instance.m_world.m_seedName.ToString();
			Vector3 position = ((Component)Player.m_localPlayer).transform.position;
			string player_location = ((object)(Vector3)(ref position)).ToString();
			string trophies = string.Join(", ", __m_trophyCache);
			LeaderboardData data = new LeaderboardData
			{
				player_name = personaName,
				current_score = score,
				session_id = session_id,
				player_location = player_location,
				trophies = trophies,
				deaths = __m_deaths,
				logouts = __m_logoutCount,
				gamemode = ((GetGameMode() == TrophyGameMode.TrophyHunt) ? "TrophyHunt" : ((GetGameMode() == TrophyGameMode.TrophyRush) ? "TrophyRush" : ((GetGameMode() == TrophyGameMode.TrophySaga) ? "TrophySaga" : "TrophyFiesta")))
			};
			((MonoBehaviour)__m_trophyHuntMod).StartCoroutine(PostLeaderboardDataCoroutine("https://valheim.help/api/trackhunt", data));
		}

		private static IEnumerator PostLeaderboardDataCoroutine(string url, LeaderboardData data)
		{
			string text = JsonUtility.ToJson((object)data);
			Debug.Log((object)text);
			UnityWebRequest request = new UnityWebRequest(url, "POST");
			byte[] bytes = Encoding.UTF8.GetBytes(text);
			request.uploadHandler = (UploadHandler)new UploadHandlerRaw(bytes);
			request.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer();
			request.SetRequestHeader("Content-Type", "application/json");
			yield return request.SendWebRequest();
			if ((int)request.result == 1)
			{
				Debug.Log((object)("Leaderboard POST successful! Response: " + request.downloadHandler.text));
			}
			else
			{
				Debug.LogError((object)("Leaderboard POST failed: " + request.error));
			}
			Debug.Log((object)("Leaderboard Response: " + request.error));
			Debug.Log((object)request.downloadHandler.text);
		}

		private static float GetTotalOnFootDistance(Game game)
		{
			if ((Object)(object)game == (Object)null)
			{
				Debug.LogError((object)"No Game object found in GetTotalOnFootDistance");
				return 0f;
			}
			PlayerProfile playerProfile = game.GetPlayerProfile();
			if (playerProfile != null)
			{
				PlayerStats playerStats = playerProfile.m_playerStats;
				if (playerStats != null)
				{
					return playerStats[(PlayerStatType)17] + playerStats[(PlayerStatType)18];
				}
			}
			return 0f;
		}

		public static void CreateScoreTooltip()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			//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_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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)
			__m_scoreTooltipBackground = new GameObject("Score Tooltip Background");
			Vector2 val = __m_trophyHuntScoreTooltipWindowSize;
			if (GetGameMode() == TrophyGameMode.TrophyRush)
			{
				val = __m_trophyRushScoreTooltipWindowSize;
			}
			else if (GetGameMode() == TrophyGameMode.TrophySaga)
			{
				val = __m_trophySagaScoreTooltipWindowSize;
			}
			Transform transform = ((Component)Hud.instance).transform;
			__m_scoreTooltipBackground.transform.SetParent(transform, false);
			__m_scoreTooltipBackground.AddComponent<RectTransform>().sizeDelta = val;
			((Graphic)__m_scoreTooltipBackground.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.95f);
			__m_scoreTooltipBackground.SetActive(false);
			__m_scoreTooltipObject = new GameObject("Score Tooltip Text");
			__m_scoreTooltipObject.transform.SetParent(__m_scoreTooltipBackground.transform, false);
			__m_scoreTooltipObject.AddComponent<RectTransform>().sizeDelta = new Vector2(val.x - __m_scoreTooltipTextOffset.x, val.y - __m_scoreTooltipTextOffset.y);
			__m_scoreTooltipText = __m_scoreTooltipObject.AddComponent<TextMeshProUGUI>();
			((TMP_Text)__m_scoreTooltipText).fontSize = 14f;
			((TMP_Text)__m_scoreTooltipText).alignment = (TextAlignmentOptions)257;
			((Graphic)__m_scoreTooltipText).color = Color.yellow;
			__m_scoreTooltipObject.SetActive(false);
		}

		public static void AddTooltipTriggersToScoreObject(GameObject uiObject)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)uiObject.GetComponent<EventTrigger>() != (Object)null))
			{
				EventTrigger obj = uiObject.AddComponent<EventTrigger>();
				Entry val = new Entry();
				val.eventID = (EventTriggerType)0;
				((UnityEvent<BaseEventData>)(object)val.callback).AddListener((UnityAction<BaseEventData>)delegate
				{
					ShowScoreTooltip(uiObject);
				});
				obj.triggers.Add(val);
				Entry val2 = new Entry();
				val2.eventID = (EventTriggerType)1;
				((UnityEvent<BaseEventData>)(object)val2.callback).AddListener((UnityAction<BaseEventData>)delegate
				{
					HideScoreTooltip();
				});
				obj.triggers.Add(val2);
			}
		}

		public static string BuildScoreTooltipText(GameObject uiObject)
		{
			string text = "<n/a>";
			string text2 = "";
			switch (GetGameMode())
			{
			case TrophyGameMode.TrophyHunt:
				text2 = "Trophy Hunt";
				break;
			case TrophyGameMode.TrophyRush:
				text2 = "Trophy Rush";
				break;
			case TrophyGameMode.TrophySaga:
				text2 = "Trophy Saga";
				break;
			case TrophyGameMode.TrophyFiesta:
				text2 = "Trophy Fiesta";
				break;
			}
			int count = __m_trophyCache.Count;
			int num = CalculateTrophyPoints();
			int num2 = CalculateLogoutPenalty() + CalculateDeathPenalty();
			text = "<size=20><b><color=#FFB75B>" + text2 + "</color><b></size>\n";
			text += "<size=14><color=white>\n";
			text += $"  Trophies:\n    Num: <color=orange>{count}</color> <color=yellow>({CalculateTrophyPoints().ToString()} Points)</color>\n";
			text += $"  Logouts: (Penalty: <color=red>{GetLogoutPointCost()}</color>)\n    Num: <color=orange>{__m_logoutCount}</color> <color=yellow>({CalculateLogoutPenalty().ToString()} Points)</color>\n";
			text += $"  Deaths: (Penalty: <color=red>{GetDeathPointCost()}</color>)\n    Num: <color=orange>{__m_deaths}</color> <color=yellow>({CalculateDeathPenalty().ToString()} Points)</color>\n";
			if (GetGameMode() == TrophyGameMode.TrophyRush)
			{
				text += $"  /die's: (Penalty: <color=red>{-10}</color>)\n    Num: <color=orange>{__m_slashDieCount}</color> <color=yellow>({__m_slashDieCount * -10} Points)</color>\n";
				num2 += __m_slashDieCount * -10;
			}
			if (GetGameMode() == TrophyGameMode.TrophyRush)
			{
				text += "  Biome Bonuses:\n";
				BiomeBonus[] _m_biomeBonuses = __m_biomeBonuses;
				for (int i = 0; i < _m_biomeBonuses.Length; i++)
				{
					BiomeBonus biomeBonus = _m_biomeBonuses[i];
					CalculateBiomeBonusStats(biomeBonus.m_biome, out var numCollected, out var numTotal, out var biomeScore);
					int num3 = 0;
					if (numCollected == numTotal)
					{
						num3 = biomeScore;
					}
					text += $"    {biomeBonus.m_biomeName} (+{biomeBonus.m_bonus}): <color=orange>{numCollected}/{numTotal}</color> <color=yellow>(+{num3} Points)</color>\n";
					num += num3;
				}
			}
			text += $"\n<size=17>  Earned Points: <color=orange>{num}</color>\n  Penalties: <color=orange>{num2}</color></size>\n";
			return text + "</color></size>";
		}

		public static void ShowScoreTooltip(GameObject uiObject)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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_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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: 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_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)uiObject == (Object)null))
			{
				string text = BuildScoreTooltipText(uiObject);
				((TMP_Text)__m_scoreTooltipText).text = text;
				__m_scoreTooltipBackground.SetActive(true);
				__m_scoreTooltipObject.SetActive(true);
				Vector2 val = __m_trophyHuntScoreTooltipWindowSize;
				if (GetGameMode() == TrophyGameMode.TrophyRush)
				{
					val = __m_trophyRushScoreTooltipWindowSize;
				}
				else if (GetGameMode() == TrophyGameMode.TrophySaga)
				{
					val = __m_trophySagaScoreTooltipWindowSize;
				}
				Vector3 val2 = default(Vector3);
				((Vector3)(ref val2))..ctor(val.x / 2f, val.y, 0f);
				Vector3 val3 = Input.mousePosition + val2;
				if (val3.x < 200f)
				{
					val3.x = 200f;
				}
				if (val3.y < 200f)
				{
					val3.y = 200f;
				}
				if (val3.x > (float)Screen.width - val.x)
				{
					val3.x = (float)Screen.width - val.x;
				}
				if (val3.y > (float)Screen.height - val.y)
				{
					val3.y = (float)Screen.height - val.y;
				}
				__m_scoreTooltipBackground.transform.position = val3;
				__m_scoreTooltipObject.transform.position = new Vector3(val3.x + __m_scoreTooltipTextOffset.x, val3.y - __m_scoreTooltipTextOffset.y, 0f);
			}
		}

		public static void HideScoreTooltip()
		{
			__m_scoreTooltipBackground.SetActive(false);
			__m_scoreTooltipObject.SetActive(false);
		}

		public static void CreateLuckTooltip()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			//IL_0035: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected O, but got Unknown
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			__m_luckTooltipBackground = new GameObject("Luck Tooltip Background");
			Transform transform = ((Component)Hud.instance).transform;
			__m_luckTooltipBackground.transform.SetParent(transform, false);
			__m_luckTooltipBackground.AddComponent<RectTransform>().sizeDelta = __m_luckTooltipWindowSize;
			((Graphic)__m_luckTooltipBackground.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.85f);
			__m_luckTooltipBackground.SetActive(false);
			__m_luckTooltipObject = new GameObject("Luck Tooltip Text");
			__m_luckTooltipObject.transform.SetParent(__m_luckTooltipBackground.transform, false);
			__m_luckTooltipObject.AddComponent<RectTransform>().sizeDelta = new Vector2(__m_luckTooltipWindowSize.x - __m_luckTooltipTextOffset.x, __m_luckTooltipWindowSize.y - __m_luckTooltipTextOffset.y);
			__m_luckTooltip = __m_luckTooltipObject.AddComponent<TextMeshProUGUI>();
			((TMP_Text)__m_luckTooltip).fontSize = 14f;
			((TMP_Text)__m_luckTooltip).alignment = (TextAlignmentOptions)257;
			((Graphic)__m_luckTooltip).color = Color.yellow;
			__m_luckTooltipObject.SetActive(false);
		}

		public static void AddTooltipTriggersToLuckObject(GameObject uiObject)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)uiObject.GetComponent<EventTrigger>() != (Object)null))
			{
				EventTrigger obj = uiObject.AddComponent<EventTrigger>();
				Entry val = new Entry();
				val.eventID = (EventTriggerType)0;
				((UnityEvent<BaseEventData>)(object)val.callback).AddListener((UnityAction<BaseEventData>)delegate
				{
					ShowLuckTooltip(uiObject);
				});
				obj.triggers.Add(val);
				Entry val2 = new Entry();
				val2.eventID = (EventTriggerType)1;
				((UnityEvent<BaseEventData>)(object)val2.callback).AddListener((UnityAction<BaseEventData>)delegate
				{
					HideLuckTooltip();
				});
				obj.triggers.Add(val2);
			}
		}

		public static int GetLuckRatingIndex(float luckPercentage)
		{
			int num = 0;
			LuckRating[] _m_luckRatingTable = __m_luckRatingTable;
			for (int i = 0; i < _m_luckRatingTable.Length; i++)
			{
				LuckRating luckRating = _m_luckRatingTable[i];
				if (luckPercentage <= luckRating.m_percent)
				{
					return num;
				}
				num++;
			}
			return 0;
		}

		public static string GetLuckRatingUIString(float luckPercentage)
		{
			int luckRatingIndex = GetLuckRatingIndex(luckPercentage);
			LuckRating luckRating = __m_luckRatingTable[luckRatingIndex];
			return "<color=" + luckRating.m_colorString + ">" + luckRating.m_luckString + "</color>";
		}

		public static string BuildLuckTooltipText(GameObject uiObject)
		{
			if ((Object)(object)uiObject == (Object)null)
			{
				return "Invalid";
			}
			int num = 0;
			float num2 = 0f;
			float num3 = float.MinValue;
			string text = "<n/a>";
			float num4 = 0f;
			float num5 = 0f;
			float luckPercentage = 0f;
			float num6 = float.MaxValue;
			string text2 = "<n/a>";
			float num7 = 0f;
			float num8 = 0f;
			float luckPercentage2 = 0f;
			foreach (KeyValuePair<string, DropInfo> item in __m_allTrophyDropInfo)
			{
				DropInfo value = item.Value;
				if (value.m_numKilled == 0)
				{
					continue;
				}
				string trophyName = item.Key;
				TrophyHuntData trophyHuntData = Array.Find(__m_trophyHuntData, (TrophyHuntData element) => element.m_name == trophyName);
				if (!(trophyHuntData.m_dropPercent >= 100f) && value.m_trophies != 0 && !((float)value.m_numKilled < 100f / trophyHuntData.m_dropPercent))
				{
					float num9 = 100f * (float)value.m_trophies / (float)value.m_numKilled;
					float dropPercent = trophyHuntData.m_dropPercent;
					float num10 = num9 / dropPercent;
					if (num10 > num3)
					{
						num3 = num10;
						text = trophyHuntData.m_prettyName;
						num4 = num9;
						num5 = trophyHuntData.m_dropPercent;
						luckPercentage = num4 / num5 * 100f;
					}
					if (num10 < num6)
					{
						num6 = num10;
						text2 = trophyHuntData.m_prettyName;
						num7 = num9;
						num8 = trophyHuntData.m_dropPercent;
						luckPercentage2 = num7 / num8 * 100f;
					}
					num2 += num10;
					num++;
				}
			}
			string text3 = "<n/a>";
			string text4 = "<n/a>";
			float num11 = 0f;
			if (num > 0)
			{
				num11 = 100f * (num2 / (float)num);
				text3 = num11.ToString("0.0");
				text4 = GetLuckRatingUIString(num11);
			}
			string text5 = "<size=16><b><color=#FFB75B>Luck-O-Meter</color><b></size>\n<color=white>  Player Luck Score: </color><color=orange>" + text3 + "</color>\n<color=white>  Player Luck Rating: </color>" + text4 + "\n";
			string colorString = __m_luckRatingTable[GetLuckRatingIndex(luckPercentage)].m_colorString;
			string colorString2 = __m_luckRatingTable[GetLuckRatingIndex(luckPercentage2)].m_colorString;
			return string.Concat(string.Concat(string.Concat(text5 + "<color=white>  Luckiest:</color>\n", string.Format("    <color={0}>{1}</color> <color=orange>{2}%</color> (<color=yellow>{3}%)</color>\n", colorString, text, num4.ToString("0.0"), num5)), "<color=white>  Unluckiest:</color>\n"), string.Format("    <color={0}>{1}</color> <color=orange>{2}%</color> (<color=yellow>{3}%)</color>\n", colorString2, text2, num7.ToString("0.0"), num8));
		}

		public static void ShowLuckTooltip(GameObject uiObject)
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)uiObject == (Object)null))
			{
				string text = BuildLuckTooltipText(uiObject);
				((TMP_Text)__m_luckTooltip).text = text;
				__m_luckTooltipBackground.SetActive(true);
				__m_luckTooltipObject.SetActive(true);
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor(__m_luckTooltipWindowSize.x / 2f, __m_luckTooltipWindowSize.y, 0f);
				Vector3 val2 = Input.mousePosition + val;
				if (val2.x < 150f)
				{
					val2.x = 150f;
				}
				if (val2.y < 150f)
				{
					val2.y = 150f;
				}
				if (val2.x > (float)Screen.width - __m_luckTooltipWindowSize.x)
				{
					val2.x = (float)Screen.width - __m_luckTooltipWindowSize.x;
				}
				if (val2.y > (float)Screen.height - __m_luckTooltipWindowSize.y)
				{
					val2.y = (float)Screen.height - __m_luckTooltipWindowSize.y;
				}
				__m_luckTooltipBackground.transform.position = val2;
				__m_luckTooltipObject.transform.position = new Vector3(val2.x + __m_luckTooltipTextOffset.x, val2.y - __m_luckTooltipTextOffset.y, 0f);
			}
		}

		public static void HideLuckTooltip()
		{
			__m_luckTooltipBackground.SetActive(false);
			__m_luckTooltipObject.SetActive(false);
		}

		public static void CreateTrophyTooltip()
		{
			//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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0048: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			//IL_00b4: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: 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_0012: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = __m_trophyTooltipWindowSize;
			if (__m_showAllTrophyStats)
			{
				val = __m_trophyTooltipAllTrophyStatsWindowSize;
			}
			__m_trophyTooltipBackground = new GameObject("Tooltip Background");
			Transform transform = ((Component)Hud.instance).transform;
			__m_trophyTooltipBackground.transform.SetParent(transform, false);
			__m_trophyTooltipBackground.AddComponent<RectTransform>().sizeDelta = val;
			((Graphic)__m_trophyTooltipBackground.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.85f);
			__m_trophyTooltipBackground.SetActive(false);
			__m_trophyTooltipObject = new GameObject("Tooltip Text");
			__m_trophyTooltipObject.transform.SetParent(__m_trophyTooltipBackground.transform, false);
			__m_trophyTooltipObject.AddComponent<RectTransform>().sizeDelta = new Vector2(val.x - __m_trophyTooltipTextOffset.x, val.y - __m_trophyTooltipTextOffset.y);
			__m_trophyTooltip = __m_trophyTooltipObject.AddComponent<TextMeshProUGUI>();
			((TMP_Text)__m_trophyTooltip).fontSize = 14f;
			((TMP_Text)__m_trophyTooltip).alignment = (TextAlignmentOptions)257;
			((Graphic)__m_trophyTooltip).color = Color.yellow;
			__m_trophyTooltipObject.SetActive(false);
		}

		public static void DeleteTrophyTooltip()
		{
			if ((Object)(object)__m_trophyTooltipObject != (Object)null)
			{
				Object.DestroyImmediate((Object)(object)__m_trophyTooltipObject);
				__m_trophyTooltipObject = null;
			}
			if (Object.op_Implicit((Object)(object)__m_trophyTooltipBackground))
			{
				Object.DestroyImmediate((Object)(object)__m_trophyTooltipBackground);
				__m_trophyTooltipBackground = null;
			}
		}

		public static void AddTooltipTriggersToTrophyIcon(GameObject trophyIconObject)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)trophyIconObject.GetComponent<EventTrigger>() != (Object)null))
			{
				EventTrigger obj = trophyIconObject.AddComponent<EventTrigger>();
				Entry val = new Entry();
				val.eventID = (EventTriggerType)0;
				((UnityEvent<BaseEventData>)(object)val.callback).AddListener((UnityAction<BaseEventData>)delegate
				{
					ShowTrophyTooltip(trophyIconObject);
				});
				obj.triggers.Add(val);
				Entry val2 = new Entry();
				val2.eventID = (EventTriggerType)1;
				((UnityEvent<BaseEventData>)(object)val2.callback).AddListener((UnityAction<BaseEventData>)delegate
				{
					HideTrophyTooltip();
				});
				obj.triggers.Add(val2);
			}
		}

		public static void CalculateDropPercentAndRating(TrophyHuntData trophyHuntData, DropInfo dropInfo, out string dropPercentStr, out string dropRatingStr)
		{
			dropPercentStr = "0";
			dropRatingStr = "<n/a>";
			if (dropInfo.m_numKilled > 0)
			{
				float num = 0f;
				float dropPercent = trophyHuntData.m_dropPercent;
				num = 100f * ((float)dropInfo.m_trophies / (float)dropInfo.m_numKilled);
				dropPercentStr = num.ToString("0.0");
				if (trophyHuntData.m_dropPercent < 100f && dropInfo.m_trophies > 0 && (float)dropInfo.m_numKilled >= 100f / dropPercent)
				{
					float luckPercentage = 100f * (num / dropPercent);
					dropRatingStr = GetLuckRatingUIString(luckPercentage);
				}
			}
		}

		public static string BuildTrophyTooltipText(GameObject uiObject)
		{
			if ((Object)(object)uiObject == (Object)null)
			{
				return "Invalid";
			}
			string trophyName = ((Object)uiObject).name;
			TrophyHuntData trophyHuntData = Array.Find(__m_trophyHuntData, (TrophyHuntData element) => element.m_name == trophyName);
			DropInfo dropInfo = __m_allTrophyDropInfo[trophyName];
			DropInfo dropInfo2 = __m_playerTrophyDropInfo[trophyName];
			string dropPercentStr = "0";
			string dropRatingStr = "<n/a>";
			CalculateDropPercentAndRating(trophyHuntData, dropInfo2, out dropPercentStr, out dropRatingStr);
			string dropPercentStr2 = "0";
			string dropRatingStr2 = "<n/a>";
			CalculateDropPercentAndRating(trophyHuntData, dropInfo, out dropPercentStr2, out dropRatingStr2);
			string text = trophyHuntData.m_dropPercent.ToString();
			string text2 = "<size=16><b><color=#FFB75B>" + trophyHuntData.m_prettyName + "</color><b></size>\n" + $"<color=white>Point Value: </color><color=green>{trophyHuntData.m_value}</color>\n" + $"<color=white>Player Kills: </color><color=orange>{dropInfo2.m_numKilled}</color>\n" + $"<color=white>Trophies Picked Up: </color><color=orange>{dropInfo2.m_trophies}</color>\n" + "<color=white>Kill/Pickup Rate: </color><color=orange>" + dropPercentStr + "%</color>\n<color=white>Wiki Trophy Drop Rate: (<color=orange>" + text + "%)</color>\n<color=white>Player Luck Rating: <color=yellow>" + dropRatingStr + "</color>\n";
			if (__m_showAllTrophyStats)
			{
				text2 = text2 + $"<color=white>Actual Kills: </color><color=orange>{dropInfo.m_numKilled}</color>\n" + $"<color=white>Actual Trophies: </color><color=orange>{dropInfo.m_trophies}</color>\n" + "<color=white>Actual Drop Rate: </color><color=orange>" + dropPercentStr2 + "%</color> (<color=yellow>" + text + "%)</color>\n<color=white>Actual Luck Rating: <color=yellow>" + dropRatingStr2 + "</color>\n";
			}
			return text2;
		}

		public static void ShowTrophyTooltip(GameObject uiObject)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)uiObject == (Object)null))
			{
				string text = BuildTrophyTooltipText(uiObject);
				((TMP_Text)__m_trophyTooltip).text = text;
				__m_trophyTooltipBackground.SetActive(true);
				__m_trophyTooltipObject.SetActive(true);
				Vector2 val = __m_trophyTooltipWindowSize;
				if (__m_showAllTrophyStats)
				{
					val = __m_trophyTooltipAllTrophyStatsWindowSize;
				}
				Vector3 val2 = default(Vector3);
				((Vector3)(ref val2))..ctor(val.x / 2f, val.y, 0f);
				Vector3 val3 = Input.mousePosition + val2;
				if (val3.x < 0f)
				{
					val3.x = 0f;
				}
				if (val3.y < 0f)
				{
					val3.y = 0f;
				}
				if (val3.x > (float)Screen.width - val.x)
				{
					val3.x = (float)Screen.width - val.x;
				}
				if (val3.y > (float)Screen.height - val.y)
				{
					val3.y = (float)Screen.height - val.y;
				}
				__m_trophyTooltipBackground.transform.position = val3;
				__m_trophyTooltipObject.transform.position = new Vector3(val3.x + __m_trophyTooltipTextOffset.x, val3.y - __m_trophyTooltipTextOffset.y, 0f);
			}
		}

		public static void HideTrophyTooltip()
		{
			__m_trophyTooltipBackground.SetActive(false);
			__m_trophyTooltipObject.SetActive(false);
		}

		public static bool CharacterCanDropTrophies(string characterName)
		{
			if (Array.FindIndex(__m_trophyHuntData, (TrophyHuntData element) => element.m_enemies.Contains(characterName)) >= 0)
			{
				return true;
			}
			return false;
		}

		public static void RecordDroppedTrophy(string characterName, string trophyName)
		{
			DropInfo value = __m_allTrophyDropInfo[trophyName];
			value.m_trophies++;
			__m_allTrophyDropInfo[trophyName] = value;
		}

		public static string EnemyNameToTrophyName(string enemyName)
		{
			int num = Array.FindIndex(__m_trophyHuntData, (TrophyHuntData element) => element.m_enemies.Contains(enemyName));
			if (num < 0)
			{
				return "Not Found";
			}
			return __m_trophyHuntData[num].m_name;
		}

		public static bool RecordPlayerPickedUpTrophy(string trophyName)
		{
			if (__m_playerTrophyDropInfo.ContainsKey(trophyName))
			{
				DropInfo value = __m_playerTrophyDropInfo[trophyName];
				value.m_trophies++;
				__m_playerTrophyDropInfo[trophyName] = value;
				return true;
			}
			return false;
		}

		public static void RecordTrophyCapableKill(string characterName, bool killedByPlayer)
		{
			string key = EnemyNameToTrophyName(characterName);
			if (killedByPlayer)
			{
				DropInfo value = __m_playerTrophyDropInfo[key];
				value.m_numKilled++;
				__m_playerTrophyDropInfo[key] = value;
			}
			else
			{
				DropInfo value2 = __m_allTrophyDropInfo[key];
				value2.m_numKilled++;
				__m_allTrophyDropInfo[key] = value2;
			}
		}

		public static void I