Decompiled source of TrophyHuntMod v0.8.7

plugins/TrophyHuntMod.dll

Decompiled 5 days 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 System.Xml.Serialization;
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.5")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.7.5.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.8.7")]
public 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,
		CulinarySaga,
		CasualSaga,
		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(Game), "SavePlayerProfile")]
	public class Game_SavePlayerProfile_Patch
	{
		private static void Prefix(PlayerProfile __instance, bool setLogoutPoint)
		{
			SavePersistentData();
		}
	}

	public class THMSaveData
	{
		public class THMSaveDataDropInfo
		{
			public string m_name;

			public DropInfo m_dropInfo;
		}

		public class THMSaveDataSpecialSagaDropCount
		{
			public string m_name;

			public int m_dropCount;
		}

		public List<THMSaveDataDropInfo> m_playerTrophyDropInfos;

		public List<THMSaveDataDropInfo> m_allTrophyDropInfos;

		public List<Vector3> m_playerPathData;

		public long m_gameTimerElapsedSeconds;

		public bool m_gameTimerActive;

		public bool m_gameTimerVisible;

		public bool m_gameTimerCountdown;

		public int m_slashDieCount;

		public int m_logoutCount;

		public List<THMSaveDataSpecialSagaDropCount> m_specialSagaDropCounts;

		public long m_storedPlayerID;

		public TrophyGameMode m_storedGameMode;

		public string m_storedWorldSeed;

		public List<string> m_cookedFoods;
	}

	[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 (IsSagaMode() && __result.m_level < 20f)
				{
					__result.m_level = 20f;
					__result.m_accumulator = 0f;
				}
			}
		}

		[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))
				{
					return;
				}
				FlashTrophy(name);
				__m_trophyCache = __instance.GetTrophies();
				if (GetGameMode() == TrophyGameMode.TrophyRush)
				{
					if (UpdateBiomeBonusTrophies(name))
					{
						MessageHud.instance.ShowBiomeFoundMsg("Biome Bonus", true);
						FlashBiomeTrophies(name);
					}
				}
				else if (GetGameMode() == TrophyGameMode.TrophySaga && __m_trophyCache.Count == __m_trophyHuntData.Length)
				{
					MessageHud.instance.ShowBiomeFoundMsg("Odin is Pleased", true);
				}
				UpdateModUI(__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++;
					if ((Object)(object)Game.instance != (Object)null)
					{
						Game.instance.SavePlayerProfile(true);
					}
				}
			}
		}

		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 TrophyGameMode m_onlyInMode;

			public int m_numDropped;

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

		[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 || (IsSagaMode() && GetGameMode() != TrophyGameMode.CasualSaga))
						{
							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 (!IsSagaMode() || !__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];
					Debug.LogWarning((object)$"{value.m_itemName} {value.m_onlyInMode.ToString()} ({GetGameMode()}");
					if (value.m_onlyInMode != TrophyGameMode.Max && GetGameMode() != value.m_onlyInMode)
					{
						Debug.LogWarning((object)(value.m_itemName + " Ignored"));
						continue;
					}
					bool flag2 = false;
					if (value.m_dropOnlyOne)
					{
						flag2 = HasAnyoneDropped(value.m_itemName);
					}
					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)
			{
				if (GetGameMode() == TrophyGameMode.CulinarySaga)
				{
					return;
				}
				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 (!IsSagaMode())
				{
					return true;
				}
				if (__instance == null)
				{
					return true;
				}
				if ((Object)(object)__instance.m_dropPrefab == (Object)null)
				{
					return true;
				}
				if (__m_oreNameToBarPrefabName.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 (!IsSagaMode())
				{
					return true;
				}
				if (__instance == null)
				{
					return true;
				}
				if ((Object)(object)__instance.m_dropPrefab == (Object)null)
				{
					return true;
				}
				if (__m_oreNameToBarPrefabName.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() || !IsSagaMode())
				{
					return;
				}
				if (__m_instaSmelt)
				{
					ConvertMetal(ref item);
				}
				if (GetGameMode() != TrophyGameMode.CulinarySaga)
				{
					return;
				}
				bool flag = false;
				ConsumableData[] _m_cookedFoodData = __m_cookedFoodData;
				for (int i = 0; i < _m_cookedFoodData.Length; i++)
				{
					if (_m_cookedFoodData[i].m_prefabName == ((Object)item.m_dropPrefab).name)
					{
						flag = true;
						break;
					}
				}
				if (flag && !__m_cookedFoods.Contains(((Object)item.m_dropPrefab).name))
				{
					FlashTrophy(((Object)item.m_dropPrefab).name);
					__m_cookedFoods.Add(((Object)item.m_dropPrefab).name);
					if (__m_cookedFoods.Count == __m_cookedFoodData.Length)
					{
						MessageHud.instance.ShowBiomeFoundMsg("Odin is Sated", true);
					}
				}
				UpdateModUI(Player.m_localPlayer);
			}
		}

		[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() && IsSagaMode() && __m_instaSmelt && item != null && (Object)(object)item.m_dropPrefab != (Object)null)
				{
					string name = ((Object)item.m_dropPrefab).name;
					if (__m_oreNameToBarItemName.TryGetValue(name, out var value))
					{
						if (stack <= 0)
						{
							stack = item.m_stack;
						}
						__result = __instance.FindFreeStackSpace(value, 0f) + (__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) && IsSagaMode() && __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) && GetGameMode() != TrophyGameMode.CulinarySaga)
				{
					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 (IsSagaMode())
					{
						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_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				if (IsSagaMode())
				{
					__result *= __m_sagaSailingSpeedMultiplier;
				}
			}
		}

		[HarmonyPatch(typeof(Ship), "Awake")]
		public class Ship_Awake_Patch
		{
			private static void Postfix(Ship __instance)
			{
				if (IsSagaMode())
				{
					__instance.m_backwardForce *= __m_sagaPaddlingSpeedMultiplier;
				}
			}
		}

		[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 && IsSagaMode())
				{
					__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 && IsSagaMode())
				{
					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 && IsSagaMode())
				{
					__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 && IsSagaMode())
				{
					if (__instance.m_name.Contains("eitr"))
					{
						__instance.m_secPerProduct = 1f;
					}
					else if (!__instance.m_name.Contains("bathtub") && !__instance.m_name.Contains("batteringram"))
					{
						__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 && IsSagaMode() && __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 && IsSagaMode())
				{
					__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 && IsSagaMode())
				{
					__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;
					if (GetGameMode() == TrophyGameMode.CulinarySaga)
					{
						__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 lands beyond death…\n\n\n\nRagnarok looms and the tenth world remains only for a few scant hours. You are reborn with one purpose: cook a whole bunch of delicious meals to appease Odin's insatiable hunger?\n\n\n\nYes. Somehow. Bring Odin what he desires or be forced to repeat the cycle for eternity…\n\n\n\n…in VALHEIM!";
					}
					else
					{
						__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 lands 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 this cycle ends…\n\n\n\nOdin will cast these heads into the well of Mimir where his lost eye still resides. With knowledge of the Forsaken he can finally banish them forever…\n\n\nBring Odin what he desires or be forced to repeat the cycle 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 && IsSagaMode())
				{
					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;
					}
				}
			}
		}

		[HarmonyPatch(typeof(EggGrow), "Start")]
		public static class EggGrow_Start_Patch
		{
			private static void Postfix(EggGrow __instance)
			{
				if ((Object)(object)__instance != (Object)null && IsSagaMode())
				{
					__instance.m_growTime = 2f;
				}
			}
		}

		[HarmonyPatch(typeof(Growup), "Start")]
		public static class Growup_Start_Patch
		{
			private static void Postfix(Growup __instance)
			{
				if ((Object)(object)__instance != (Object)null && IsSagaMode())
				{
					__instance.m_growTime = 1f;
				}
			}
		}

		[HarmonyPatch(typeof(Procreation), "Awake")]
		public static class Procreation_Awake_Patch
		{
			private static void Postfix(Procreation __instance)
			{
				if ((Object)(object)__instance != (Object)null && IsSagaMode() && ((Object)__instance).name.Contains("Hen"))
				{
					Debug.LogWarning((object)("Procreation.Start: " + ((Object)__instance).name + " " + ((Object)__instance.m_character).name));
					__instance.m_pregnancyDuration = 0.1f;
					__instance.m_pregnancyChance = 0f;
					__instance.m_updateInterval = 1f;
				}
			}
		}

		public class ConsumableData
		{
			public string m_prefabName;

			public string m_itemName;

			public string m_displayName;

			public Biome m_biome;

			public int m_points;

			public float m_health;

			public float m_stamina;

			public float m_eitr;

			public float m_regen;

			public ConsumableData(string prefab, string item, string display, Biome biome, int points, float health, float stamina, float eitr, float regen)
			{
				m_prefabName = prefab;
				m_itemName = item;
				m_displayName = display;
				m_biome = biome;
				m_points = points;
				m_health = health;
				m_stamina = stamina;
				m_eitr = eitr;
				m_regen = regen;
			}
		}

		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_scoreTooltipTextOffset = new Vector2(5f, 2f);

		private static Dictionary<TrophyGameMode, Vector2> __toolTipSizes = new Dictionary<TrophyGameMode, Vector2>
		{
			{
				TrophyGameMode.TrophyHunt,
				new Vector2(240f, 215f)
			},
			{
				TrophyGameMode.TrophyRush,
				new Vector2(290f, 380f)
			},
			{
				TrophyGameMode.CasualSaga,
				new Vector2(300f, 170f)
			},
			{
				TrophyGameMode.TrophySaga,
				new Vector2(290f, 215f)
			},
			{
				TrophyGameMode.CulinarySaga,
				new Vector2(240f, 215f)
			},
			{
				TrophyGameMode.TrophyFiesta,
				new Vector2(240f, 215f)
			}
		};

		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),
					new SpecialSagaDrop("Coal", 2f, 1, 2),
					new SpecialSagaDrop("TrophyDeer", 5f, 1, 1),
					new SpecialSagaDrop("RoundLog", 10f, 2, 7),
					new SpecialSagaDrop("ArrowFlint", 5f, 2, 4),
					new SpecialSagaDrop("BoneFragments", 8f, 1, 3),
					new SpecialSagaDrop("Flint", 8f, 1, 3),
					new SpecialSagaDrop("LeatherScraps", 10f, 2, 3),
					new SpecialSagaDrop("DeerHide", 4f, 1, 3),
					new SpecialSagaDrop("Feathers", 6f, 1, 2),
					new SpecialSagaDrop("Acorn", 3f, 1, 2),
					new SpecialSagaDrop("CarrotSeeds", 4f, 1, 3),
					new SpecialSagaDrop("QueenBee", 6f, 1, 1),
					new SpecialSagaDrop("Honey", 8f, 1, 2),
					new SpecialSagaDrop("Blueberries", 7f, 2, 4),
					new SpecialSagaDrop("BeltStrength", 15f, 1, 1, dropOnlyOne: true)
				}
			},
			{
				"$enemy_neck",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("FishingBait", 25f, 1, 5, dropOnlyOne: false, TrophyGameMode.CulinarySaga)
				}
			},
			{
				"$enemy_greydwarfbrute",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("CryptKey", 100f, 1, 1, dropOnlyOne: true),
					new SpecialSagaDrop("FishingRod", 100f, 1, 1, dropOnlyOne: true, TrophyGameMode.CulinarySaga)
				}
			},
			{
				"$enemy_troll",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("BeltStrength", 100f, 1, 1, dropOnlyOne: true),
					new SpecialSagaDrop("TrollHide", 100f, 5, 5),
					new SpecialSagaDrop("FishingBaitForest", 50f, 1, 5, dropOnlyOne: true, TrophyGameMode.CulinarySaga)
				}
			},
			{
				"$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),
					new SpecialSagaDrop("FishingRod", 100f, 1, 1, dropOnlyOne: true, TrophyGameMode.CulinarySaga)
				}
			},
			{
				"$enemy_blob",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("Ooze", 100f, 2, 5)
				}
			},
			{
				"$enemy_abomination",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("FishingBaitSwamp", 25f, 1, 5, dropOnlyOne: false, TrophyGameMode.CulinarySaga)
				}
			},
			{
				"$enemy_drake",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("DragonTear", 100f, 1, 2),
					new SpecialSagaDrop("FishingRod", 100f, 1, 1, dropOnlyOne: true, TrophyGameMode.CulinarySaga),
					new SpecialSagaDrop("FishingBaitDeepNorth", 15f, 1, 5, dropOnlyOne: false, TrophyGameMode.CulinarySaga)
				}
			},
			{
				"$enemy_fenringcultist_hildir",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("DragonTear", 100f, 2, 3, dropOnlyOne: true)
				}
			},
			{
				"$enemy_fenring",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("FishingBaitCave", 25f, 1, 10, dropOnlyOne: false, TrophyGameMode.CulinarySaga)
				}
			},
			{
				"$enemy_goblin",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("FishingBaitPlains", 15f, 1, 5, dropOnlyOne: false, TrophyGameMode.CulinarySaga)
				}
			},
			{
				"$enemy_goblinshaman",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("YagluthDrop", 100f, 1, 1, dropOnlyOne: true),
					new SpecialSagaDrop("FishingRod", 100f, 1, 1, dropOnlyOne: true, TrophyGameMode.CulinarySaga)
				}
			},
			{
				"$enemy_goblinbrute",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("YagluthDrop", 100f, 1, 1, dropOnlyOne: true),
					new SpecialSagaDrop("FishingRod", 100f, 1, 1, dropOnlyOne: true, TrophyGameMode.CulinarySaga)
				}
			},
			{
				"$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_lox",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("FishingBaitMistlands", 45f, 1, 5, dropOnlyOne: false, TrophyGameMode.CulinarySaga)
				}
			},
			{
				"$enemy_seekerbrute",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("QueenDrop", 100f, 1, 1),
					new SpecialSagaDrop("FishingRod", 100f, 1, 1, dropOnlyOne: true, TrophyGameMode.CulinarySaga)
				}
			},
			{
				"$enemy_dvergr",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("YggdrasilWood", 100f, 10, 20)
				}
			},
			{
				"$enemy_dvergr_mage",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("YggdrasilWood", 100f, 10, 20)
				}
			},
			{
				"$enemy_serpent",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("FishingBaitOcean", 100f, 20, 20, dropOnlyOne: false, TrophyGameMode.CulinarySaga)
				}
			},
			{
				"$enemy_charred_melee",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("FishingBaitAshlands", 25f, 1, 5, dropOnlyOne: false, TrophyGameMode.CulinarySaga)
				}
			},
			{
				"$enemy_gdking",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("YmirRemains", 100f, 10, 10, dropOnlyOne: true)
				}
			},
			{
				"$enemy_bonemass",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("YmirRemains", 100f, 10, 10, dropOnlyOne: true)
				}
			},
			{
				"$enemy_dragon",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("YmirRemains", 100f, 10, 10, dropOnlyOne: true)
				}
			},
			{
				"$enemy_seekerqueen",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("YmirRemains", 100f, 10, 10, dropOnlyOne: true)
				}
			},
			{
				"$enemy_fader",
				new List<SpecialSagaDrop>
				{
					new SpecialSagaDrop("YmirRemains", 100f, 10, 10, dropOnlyOne: true)
				}
			}
		};

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

		public static Dictionary<string, string> __m_oreNameToBarItemName = new Dictionary<string, string>
		{
			{ "CopperOre", "$item_copper" },
			{ "TinOre", "$item_tin" },
			{ "IronScrap", "$item_iron" },
			{ "SilverOre", "$item_silver" },
			{ "BlackMetalScrap", "$item_blackmetal" },
			{ "FlametalOreNew", "$item_flametal" },
			{ "BronzeScrap", "$item_bronze" },
			{ "CopperScrap", "$item_copper" }
		};

		public static List<string> __m_cookedFoods = new List<string>();

		public static ConsumableData[] __m_rawFoodData = new ConsumableData[18]
		{
			new ConsumableData("Blueberries", "$item_blueberries", "Blueberries", Biome.Meadows, 0, 8f, 25f, 0f, 1f),
			new ConsumableData("Carrot", "$item_carrot", "Carrot", Biome.Meadows, 0, 10f, 32f, 0f, 1f),
			new ConsumableData("Cloudberry", "$item_cloudberries", "Cloudberries", Biome.Meadows, 0, 13f, 40f, 0f, 1f),
			new ConsumableData("Fiddleheadfern", "$item_fiddleheadfern", "Fiddlehead", Biome.Meadows, 0, 30f, 30f, 0f, 1f),
			new ConsumableData("Mushroom", "$item_mushroomcommon", "Mushroom", Biome.Meadows, 0, 15f, 15f, 0f, 1f),
			new ConsumableData("MushroomBlue", "$item_mushroomblue", "Blue Mushroom", Biome.Meadows, 0, 20f, 20f, 0f, 1f),
			new ConsumableData("MushroomBzerker", "$item_mushroom_bzerker", "Toadstool", Biome.Meadows, 0, 0f, 0f, 0f, 1f),
			new ConsumableData("MushroomJotunPuffs", "$item_jotunpuffs", "Jotun Puffs", Biome.Meadows, 0, 25f, 25f, 0f, 1f),
			new ConsumableData("MushroomMagecap", "$item_magecap", "Magecap", Biome.Meadows, 0, 25f, 25f, 25f, 1f),
			new ConsumableData("MushroomSmokePuff", "$item_smokepuff", "Smoke Puff", Biome.Meadows, 0, 15f, 15f, 0f, 1f),
			new ConsumableData("MushroomYellow", "$item_mushroomyellow", "Yellow Mushroom", Biome.Meadows, 0, 10f, 30f, 0f, 1f),
			new ConsumableData("Honey", "$item_honey", "Honey", Biome.Meadows, 0, 8f, 35f, 0f, 1f),
			new ConsumableData("Onion", "$item_onion", "Onion", Biome.Meadows, 0, 13f, 40f, 0f, 1f),
			new ConsumableData("Pukeberries", "$item_pukeberries", "Bukeperries", Biome.Meadows, 0, 0f, 0f, 0f, 1f),
			new ConsumableData("Raspberry", "$item_raspberries", "Raspberries", Biome.Meadows, 0, 7f, 20f, 0f, 1f),
			new ConsumableData("RottenMeat", "$item_meat_rotten", "Rotten Meat", Biome.Meadows, 0, 0f, 0f, 0f, 1f),
			new ConsumableData("RoyalJelly", "$item_royaljelly", "Royal Jelly", Biome.Meadows, 0, 15f, 15f, 0f, 1f),
			new ConsumableData("Vineberry", "$item_vineberry", "Vineberry Cluster", Biome.Meadows, 0, 30f, 30f, 30f, 1f)
		};

		public static ConsumableData[] __m_drinkData = new ConsumableData[21]
		{
			new ConsumableData("BarleyWine", "$item_barleywine", "Fire Resistance Barley Wine", Biome.Meadows, 0, 0f, 0f, 0f, 0f),
			new ConsumableData("MeadBugRepellent", "$item_mead_bugrepellent", "Anti-Sting Concoction", Biome.Meadows, 0, 0f, 0f, 0f, 0f),
			new ConsumableData("MeadBzerker", "$item_mead_bzerker", "Berserkir Mead", Biome.Meadows, 0, 0f, 0f, 0f, 0f),
			new ConsumableData("MeadEitrLingering", "$item_mead_eitr_lingering", "Lingering Eitr Mead", Biome.Meadows, 0, 0f, 0f, 0f, 0f),
			new ConsumableData("MeadEitrMinor", "$item_mead_eitr_minor", "Minor Eitr Mead", Biome.Meadows, 0, 0f, 0f, 0f, 0f),
			new ConsumableData("MeadFrostResist", "$item_mead_frostres", "Frost Resistance Mead", Biome.Meadows, 0, 0f, 0f, 0f, 0f),
			new ConsumableData("MeadHasty", "$item_mead_hasty", "Tonic of Ratatosk", Biome.Meadows, 0, 0f, 0f, 0f, 0f),
			new ConsumableData("MeadHealthLingering", "$item_mead_hp_lingering", "Lingering Healing Mead", Biome.Meadows, 0, 0f, 0f, 0f, 0f),
			new ConsumableData("MeadHealthMajor", "$item_mead_hp_major", "Major Healing Mead", Biome.Meadows, 0, 0f, 0f, 0f, 0f),
			new ConsumableData("MeadHealthMedium", "$item_mead_hp_medium", "Medium Healing Mead", Biome.Meadows, 0, 0f, 0f, 0f, 0f),
			new ConsumableData("MeadHealthMinor", "$item_mead_hp_minor", "Minor Healing Mead", Biome.Meadows, 0, 0f, 0f, 0f, 0f),
			new ConsumableData("MeadLightfoot", "$item_mead_lightfoot", "Lightfoot Mead", Biome.Meadows, 0, 0f, 0f, 0f, 0f),
			new ConsumableData("MeadPoisonResist", "$item_mead_poisonres", "Poison Resistance Mead", Biome.Meadows, 0, 0f, 0f, 0f, 0f),
			new ConsumableData("MeadStaminaLingering", "$item_mead_stamina_lingering", "Lingering Stamina Mead", Biome.Meadows, 0, 0f, 0f, 0f, 0f),
			new ConsumableData("MeadStaminaMedium", "$item_mead_stamina_medium", "Medium Stamina Mead", Biome.Meadows, 0, 0f, 0f, 0f, 0f),
			new ConsumableData("MeadStaminaMinor", "$item_mead_stamina_minor", "Minor Stamina Mead", Biome.Meadows, 0, 0f, 0f, 0f, 0f),
			new ConsumableData("MeadStrength", "$item_mead_strength", "Mead of Troll Endurance", Biome.Meadows, 0, 0f, 0f, 0f, 0f),
			new ConsumableData("MeadSwimmer", "$item_mead_swimmer", "Draught of Vananidir", Biome.Meadows, 0, 0f, 0f, 0f, 0f),
			new ConsumableData("MeadTamer", "$item_mead_tamer", "Brew of Animal Whispers", Biome.Meadows, 0, 0f, 0f, 0f, 0f),
			new ConsumableData("MeadTasty", "$item_mead_tasty", "Tasty Mead", Biome.Meadows, 0, 0f, 0f, 0f, 0f),
			new ConsumableData("MeadTrollPheromones", "$item_mead_trollpheromones", "Love Potion", Biome.Meadows, 0, 0f, 0f, 0f, 0f)
		};

		public static ConsumableData[] __m_feastData = new ConsumableData[8]
		{
			new ConsumableData("FeastAshlands", "$item_feastashlands", "Ashlands Gourmet Bowl", Biome.Meadows, 0, 75f, 75f, 38f, 6f),
			new ConsumableData("FeastBlackforest", "$item_feastblackforest", "Black Forest Buffet Platter", Biome.Meadows, 0, 35f, 35f, 0f, 3f),
			new ConsumableData("FeastMeadows", "$item_feastmeadows", "Whole Roasted Meadow Boar", Biome.Meadows, 0, 35f, 35f, 0f, 2f),
			new ConsumableData("FeastMistlands", "$item_feastmistlands", "Mushrooms Galore á la Mistlands", Biome.Meadows, 0, 65f, 65f, 33f, 5f),
			new ConsumableData("FeastMountains", "$item_feastmountains", "Hearty Mountain Logger's Stew", Biome.Meadows, 0, 45f, 45f, 0f, 3f),
			new ConsumableData("FeastOceans", "$item_feastoceans", "Sailor's Bounty", Biome.Meadows, 0, 45f, 45f, 0f, 3f),
			new ConsumableData("FeastPlains", "$item_feastplains", "Plains Pie Picnic", Biome.Meadows, 0, 55f, 55f, 0f, 4f),
			new ConsumableData("FeastSwamps", "$item_feastswamps", "Swamp Dweller's Delight", Biome.Meadows, 0, 35f, 35f, 0f, 3f)
		};

		public static ConsumableData[] __m_cookedFoodData = new ConsumableData[50]
		{
			new ConsumableData("NeckTailGrilled", "$item_necktailgrilled", "Grilled Neck Tail", Biome.Meadows, 10, 25f, 8f, 0f, 2f),
			new ConsumableData("CookedMeat", "$item_boar_meat_cooked", "Cooked Boar Meat", Biome.Meadows, 10, 30f, 10f, 0f, 2f),
			new ConsumableData("CookedDeerMeat", "$item_deer_meat_cooked", "Cooked Deer Meat", Biome.Meadows, 10, 35f, 12f, 0f, 2f),
			new ConsumableData("QueensJam", "$item_queensjam", "Queen's Jam", Biome.Meadows, 10, 14f, 40f, 0f, 2f),
			new ConsumableData("BoarJerky", "$item_boarjerky", "Boar Jerky", Biome.Forest, 20, 23f, 23f, 0f, 2f),
			new ConsumableData("DeerStew", "$item_deerstew", "Deer Stew", Biome.Forest, 20, 45f, 15f, 0f, 3f),
			new ConsumableData("CarrotSoup", "$item_carrotsoup", "Carrot Soup", Biome.Forest, 20, 15f, 45f, 0f, 2f),
			new ConsumableData("MinceMeatSauce", "$item_mincemeatsauce", "Minced Meat Sauce", Biome.Forest, 20, 40f, 13f, 0f, 3f),
			new ConsumableData("Sausages", "$item_sausages", "Sausages", Biome.Swamp, 30, 55f, 18f, 0f, 3f),
			new ConsumableData("ShocklateSmoothie", "$item_shocklatesmoothie", "Muckshake", Biome.Swamp, 30, 16f, 50f, 0f, 1f),
			new ConsumableData("TurnipStew", "$item_turnipstew", "Turnip Stew", Biome.Swamp, 30, 18f, 55f, 0f, 2f),
			new ConsumableData("BlackSoup", "$item_blacksoup", "Black Soup", Biome.Swamp, 30, 50f, 17f, 0f, 3f),
			new ConsumableData("OnionSoup", "$item_onionsoup", "Onion Soup", Biome.Mountains, 30, 20f, 60f, 0f, 1f),
			new ConsumableData("CookedWolfMeat", "$item_wolf_meat_cooked", "Cooked Wolf Meat", Biome.Mountains, 30, 45f, 15f, 0f, 3f),
			new ConsumableData("WolfJerky", "$item_wolfjerky", "Wolf Jerky", Biome.Mountains, 30, 33f, 33f, 0f, 3f),
			new ConsumableData("WolfMeatSkewer", "$item_wolf_skewer", "Wolf Skewer", Biome.Mountains, 30, 65f, 21f, 0f, 3f),
			new ConsumableData("Eyescream", "$item_eyescream", "Eyescream", Biome.Mountains, 30, 21f, 65f, 0f, 1f),
			new ConsumableData("FishCooked", "$item_fish_cooked", "Cooked Fish", Biome.Ocean, 40, 45f, 15f, 0f, 2f),
			new ConsumableData("SerpentMeatCooked", "$item_serpentmeatcooked", "Cooked Serpent Meat", Biome.Ocean, 40, 70f, 23f, 0f, 3f),
			new ConsumableData("SerpentStew", "$item_serpentstew", "Serpent Stew", Biome.Ocean, 40, 80f, 26f, 0f, 4f),
			new ConsumableData("CookedLoxMeat", "$item_loxmeat_cooked", "Cooked Lox Meat", Biome.Plains, 40, 50f, 16f, 0f, 4f),
			new ConsumableData("FishWraps", "$item_fishwraps", "Fish Wraps", Biome.Plains, 40, 70f, 23f, 0f, 4f),
			new ConsumableData("LoxPie", "$item_loxpie", "Lox Meat Pie", Biome.Plains, 40, 75f, 24f, 0f, 4f),
			new ConsumableData("BloodPudding", "$item_bloodpudding", "Blood Pudding", Biome.Plains, 40, 25f, 75f, 0f, 2f),
			new ConsumableData("Bread", "$item_bread", "Bread", Biome.Plains, 40, 23f, 70f, 0f, 2f),
			new ConsumableData("CookedEgg", "$item_egg_cooked", "Cooked Egg", Biome.Plains, 40, 35f, 12f, 0f, 2f),
			new ConsumableData("CookedChickenMeat", "$item_chicken_meat_cooked", "Cooked Chicken Meat", Biome.Plains, 40, 60f, 20f, 0f, 5f),
			new ConsumableData("CookedHareMeat", "$item_hare_meat_cooked", "Cooked Hare Meat", Biome.Mistlands, 50, 60f, 20f, 0f, 5f),
			new ConsumableData("CookedBugMeat", "$item_bug_meat_cooked", "Cooked Seeker Meat", Biome.Mistlands, 50, 60f, 20f, 0f, 5f),
			new ConsumableData("MeatPlatter", "$item_meatplatter", "Meat Platter", Biome.Mistlands, 50, 80f, 26f, 0f, 5f),
			new ConsumableData("HoneyGlazedChicken", "$item_honeyglazedchicken", "Honey Glazed Chicken", Biome.Mistlands, 50, 80f, 26f, 0f, 5f),
			new ConsumableData("MisthareSupreme", "$item_mistharesupreme", "Misthare Supreme", Biome.Mistlands, 50, 85f, 28f, 0f, 5f),
			new ConsumableData("Salad", "$item_salad", "Salad", Biome.Mistlands, 50, 26f, 80f, 0f, 3f),
			new ConsumableData("MushroomOmelette", "$item_mushroomomelette", "Mushroom Omelette", Biome.Mistlands, 50, 28f, 85f, 0f, 3f),
			new ConsumableData("FishAndBread", "$item_fishandbread", "Fish 'n' Bread", Biome.Mistlands, 50, 30f, 90f, 0f, 3f),
			new ConsumableData("MagicallyStuffedShroom", "$item_magicallystuffedmushroom", "Stuffed Mushroom", Biome.Mistlands, 50, 25f, 12f, 75f, 3f),
			new ConsumableData("YggdrasilPorridge", "$item_yggdrasilporridge", "Yggdrasil Porridge", Biome.Mistlands, 50, 27f, 13f, 80f, 3f),
			new ConsumableData("SeekerAspic", "$item_seekeraspic", "Seeker Aspic", Biome.Mistlands, 50, 28f, 14f, 85f, 3f),
			new ConsumableData("CookedAsksvinMeat", "$item_asksvin_meat_cooked", "Cooked Asksvin Tail", Biome.Ashlands, 60, 70f, 24f, 0f, 6f),
			new ConsumableData("CookedVoltureMeat", "$item_volture_meat_cooked", "Cooked Volture Meat", Biome.Ashlands, 60, 70f, 24f, 0f, 6f),
			new ConsumableData("CookedBoneMawSerpentMeat", "$item_bonemawmeat_cooked", "Cooked Bonemaw Meat", Biome.Ashlands, 60, 90f, 30f, 0f, 6f),
			new ConsumableData("FierySvinstew", "$item_fierysvinstew", "Fiery Svinstew", Biome.Ashlands, 60, 95f, 32f, 0f, 6f),
			new ConsumableData("MashedMeat", "$item_mashedmeat", "Mashed Meat", Biome.Ashlands, 60, 100f, 34f, 0f, 6f),
			new ConsumableData("PiquantPie", "$item_piquantpie", "Piquant Pie", Biome.Ashlands, 60, 105f, 35f, 0f, 6f),
			new ConsumableData("SpicyMarmalade", "$item_spicymarmalade", "Spicy Marmalade", Biome.Ashlands, 60, 30f, 90f, 0f, 4f),
			new ConsumableData("ScorchingMedley", "$item_scorchingmedley", "Scorching Medley", Biome.Ashlands, 60, 32f, 95f, 0f, 4f),
			new ConsumableData("RoastedCrustPie", "$item_roastedcrustpie", "Roasted Crust Pie", Biome.Ashlands, 60, 34f, 100f, 0f, 4f),
			new ConsumableData("SizzlingBerryBroth", "$item_sizzlingberrybroth", "Sizzling Berry Broth", Biome.Ashlands, 60, 28f, 14f, 85f, 4f),
			new ConsumableData("SparklingShroomshake", "$item_sparklingshroomshake", "Sparkling Shroomshake", Biome.Ashlands, 60, 30f, 15f, 90f, 4f),
			new ConsumableData("MarinatedGreens", "$item_marinatedgreens", "Marinated Greens", Biome.Ashlands, 60, 32f, 16f, 95f, 4f)
		};

		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 || GetGameMode() == TrophyGameMode.CulinarySaga || GetGameMode() == TrophyGameMode.CasualSaga)
				{
					__m_invalidForTournamentPlay = true;
				}
				__m_fiestaFlashing = false;
				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()));
				__m_storedPlayerID = Player.m_localPlayer.GetPlayerID();
				__m_storedGameMode = __m_trophyGameMode;
				__m_storedWorldSeed = WorldGenerator.instance.m_world.m_seedName;
				if (!IsSagaMode())
				{
					__m_gameTimerVisible = false;
				}
				else
				{
					__m_gameTimerVisible = false;
				}
				LoadPersistentData();
				UpdateModUI(Player.m_localPlayer);
				ShowPlayerPath(showPlayerPath: false);
				StopCollectingPlayerPath();
				StartCollectingPlayerPath();
				if (GetGameMode() == TrophyGameMode.TrophyFiesta)
				{
					TrophyFiesta.Initialize();
				}
			}
		}

		public static void RaiseAllPlayerSkills(float skillLevel)
		{
			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)
				{
					skillDatum.Value.m_level = skillLevel;
				}
			}
		}

		public static void InitializeTrackedDataForNewPlayer()
		{
			if (IsSagaMode())
			{
				InitializeSagaDrops();
				RaiseAllPlayerSkills(20f);
				if (GetGameMode() == TrophyGameMode.CulinarySaga)
				{
					__m_cookedFoods.Clear();
				}
			}
			__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 CalculateCookingPoints(bool displayToLog = false)
		{
			int num = 0;
			ConsumableData[] _m_cookedFoodData = __m_cookedFoodData;
			foreach (ConsumableData consumableData in _m_cookedFoodData)
			{
				if (__m_cookedFoods.Contains(consumableData.m_prefabName))
				{
					if (displayToLog)
					{
						PrintToConsole($"  {consumableData.m_prefabName}: Score: {consumableData.m_points} Biome: {consumableData.m_biome.ToString()}");
					}
					num += consumableData.m_points;
				}
			}
			return num;
		}

		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;
			}
			else if (GetGameMode() == TrophyGameMode.CulinarySaga)
			{
				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;
			}
			else if (GetGameMode() == TrophyGameMode.CulinarySaga)
			{
				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);
				}
				__m_iconList = new List<GameObject>();
				if (GetGameMode() != TrophyGameMode.CasualSaga)
				{
					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);
					}
					if (GetGameMode() == TrophyGameMode.CulinarySaga)
					{
						CreateCookingIconElements(val, __m_cookedFoodData, __m_iconList);
						CreateTrophyTooltip();
					}
					else
					{
						CreateTrophyIconElements(val, __m_trophyHuntData, __m_iconList);
						CreateTrophyTooltip();
						CreateLuckTooltip();
						__m_luckOMeterElement = 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.6f, 0.6f);
								((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_001a: Expected O, but got Unknown
			//IL_003f: 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_006d: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: 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)
			//IL_00ce: 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_00f1: 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_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Expected O, but got Unknown
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			Sprite trophySprite = GetTrophySprite("RoundLog");
			__m_relogsIconElement = new GameObject("RelogsIcon");
			__m_relogsIconElement.transform.SetParent(parentTransform);
			RectTransform obj = __m_relogsIconElement.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 = __m_relogsIconElement.AddComponent<Image>();
			obj2.sprite = trophySprite;
			((Graphic)obj2).color = Color.white;
			GameObject val = new GameObject("RelogsElement");
			val.transform.SetParent(parentTransform);
			RectTransform obj3 = val.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 val2 = val.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val2).text = $"{__m_logoutCount}";
			((TMP_Text)val2).fontSize = 24f;
			((Graphic)val2).color = Color.yellow;
			((TMP_Text)val2).alignment = (TextAlignmentOptions)514;
			((Graphic)val2).raycastTarget = false;
			((TMP_Text)val2).fontMaterial.EnableKeyword("OUTLINE_ON");
			((TMP_Text)val2).outlineColor = Color32.op_Implicit(Color.black);
			((TMP_Text)val2).outlineWidth = 0.1f;
			if (__m_ignoreLogouts)
			{
				((Graphic)val2).color = Color.gray;
			}
			return val;
		}

		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 GameObject CreateCookingIconElement(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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected O, but got Unknown
			//IL_00bf: Expected O, but got Unknown
			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 obj2 = val.AddComponent<Image>();
			obj2.sprite = iconSprite;
			((Graphic)obj2).color = new Color(0.2f, 0.2f, 0.7f, 0.7f);
			((Graphic)obj2).raycastTarget = true;
			AddTooltipTriggersToTrophyIcon(val);
			return val;
		}

		private static void CreateCookingIconElements(Transform parentTransform, ConsumableData[] cookedFoodData, List<GameObject> iconList)
		{
			foreach (ConsumableData consumableData in cookedFoodData)
			{
				string prefabName = consumableData.m_prefabName;
				Sprite trophySprite = GetTrophySprite(prefabName);
				if ((Object)(object)trophySprite == (Object)null)
				{
					Debug.LogError((object)("Unable to find cooked food sprite for " + prefabName));
					continue;
				}
				GameObject val = CreateCookingIconElement(parentTransform, trophySprite, prefabName, consumableData.m_biome, iconList.Count);
				((Object)val).name = prefabName;
				iconList.Add(val);
			}
		}

		private static int CalculateCookingScore(Player player)
		{
			int num = 0;
			foreach (string foodName in __m_cookedFoods)
			{
				ConsumableData consumableData = Array.Find(__m_cookedFoodData, (ConsumableData element) => element.m_prefabName == foodName);
				if (consumableData != null && consumableData.m_prefabName == foodName)
				{
					num += consumableData.m_points;
				}
			}
			return num;
		}

		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);
			}
		}

		public static void EnableCookingIcons(Player player)
		{
			foreach (string _m_cookedFood in __m_cookedFoods)
			{
				EnableTrophyHuntIcon(_m_cookedFood);
			}
		}

		public static void UpdateModUI(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;
			}
			int num = 0;
			if (GetGameMode() == TrophyGameMode.CulinarySaga)
			{
				EnableCookingIcons(player);
				num = CalculateCookingScore(player);
			}
			else if (GetGameMode() != TrophyGameMode.CasualSaga)
			{
				EnableTrophyHuntIcons(player);
				EnableBiomes(player);
				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();
					if (Object.op_Implicit((Object)(object)__m_deathsTextElement))
					{
						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);
			}
			if (Object.op_Implicit((Object)(object)__m_scoreTextElement))
			{
				if (GetGameMode() == TrophyGameMode.CasualSaga)
				{
					((TMP_Text)__m_scoreTextElement.GetComponent<TextMeshProUGUI>()).text = "Saga";
				}
				else
				{
					((TMP_Text)__m_scoreTextElement.GetComponent<TextMeshProUGUI>()).text = num.ToString();
				}
			}
			if (Object.op_Implicit((Object)(object)__m_relogsTextElement))
			{
				((TMP_Text)__m_relogsTextElement.GetComponent<TextMeshProUGUI>()).text = __m_logoutCount.ToString();
			}
			if (GetGameMode() != TrophyGameMode.CasualSaga)
			{
				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;
			}
		}

		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().ToString()
			};
			((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_005c: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			__m_scoreTooltipBackground = new GameObject("Score Tooltip Background");
			Vector2 val = __m_trophyHuntScoreTooltipWindowSize;
			if (__toolTipSizes.ContainsKey(GetGameMode()))
			{
				val = __toolTipSizes[GetGameMode()];
			}
			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 gameModeNameText = GetGameModeNameText();
			text = "<size=20><b><color=#FFB75B>" + gameModeNameText + "</color><b></size>\n";
			if (GetGameMode() == TrophyGameMode.CasualSaga)
			{
				text = text + "<color=white>" + GetSagaRulesText() + "</color>";
			}
			else
			{
				int count = __m_trophyCache.Count;
				int num = 0;
				num = ((GetGameMode() != TrophyGameMode.CulinarySaga) ? CalculateTrophyPoints() : CalculateCookingPoints());
				int num2 = CalculateLogoutPenalty() + CalculateDeathPenalty();
				text += "<size=14><color=white>\n";
				text = ((GetGameMode() != TrophyGameMode.CulinarySaga) ? (text + $"  Trophies:\n    Num: <color=orange>{count}</color> <color=yellow>({CalculateTrophyPoints().ToString()} Points)</color>\n") : (text + $"  Dishes Prepared:\n    Num: <color=orange>{__m_cookedFoods.Count}</color> <color=yellow>({num} 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;
					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(Gam