Decompiled source of RPGMod v3.7.0

RPGMod.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using On.RoR2;
using RPGMod.Extensions;
using RPGMod.Questing;
using RPGMod.SoftDependencies;
using RPGMod.UI;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.ConVar;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]
[assembly: AssemblyCompany("com.ghasttear1.rpgmod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A Risk of Rain 2 mod.")]
[assembly: AssemblyFileVersion("3.7.0.0")]
[assembly: AssemblyInformationalVersion("3.7.0+8c5e9911f96a8137ea4fe0ccf6c1979ef7067b6b")]
[assembly: AssemblyProduct("RPGMod")]
[assembly: AssemblyTitle("RPGMod")]
[assembly: AssemblyVersion("3.7.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace RPGMod
{
	internal static class ConfigurationManager
	{
		[StructLayout(LayoutKind.Sequential, Size = 1)]
		public struct Questing
		{
			public static ConfigEntry<int> Cooldown;

			public static ConfigEntry<float> RewardChanceCommon;

			public static ConfigEntry<float> RewardChanceUncommon;

			public static ConfigEntry<float> RewardChanceRare;

			public static ConfigEntry<float> RewardChanceAdjustmentPercent;

			public static ConfigEntry<int> TimerBase;

			public static ConfigEntry<int> TimerExtra;

			public static ConfigEntry<string> RewardBlacklist;

			public static ConfigEntry<string> EnemyTypeBlacklist;

			public static ConfigEntry<string> EliteBuffBlacklist;

			public static ConfigEntry<bool> MissionKillAnyEnabled;

			public static ConfigEntry<int> MissionKillAnyMin;

			public static ConfigEntry<int> MissionKillAnyMax;

			public static ConfigEntry<bool> MissionKillCommonEnabled;

			public static ConfigEntry<int> MissionKillCommonMin;

			public static ConfigEntry<int> MissionKillCommonMax;

			public static ConfigEntry<bool> MissionKillEliteEnabled;

			public static ConfigEntry<int> MissionKillEliteMin;

			public static ConfigEntry<int> MissionKillEliteMax;

			public static ConfigEntry<bool> MissionKillChampionEnabled;

			public static ConfigEntry<int> MissionKillChampionMin;

			public static ConfigEntry<int> MissionKillChampionMax;

			public static ConfigEntry<bool> MissionKillFlyingEnabled;

			public static ConfigEntry<int> MissionKillFlyingMin;

			public static ConfigEntry<int> MissionKillFlyingMax;

			public static ConfigEntry<bool> MissionKillSpecificTypeEnabled;

			public static ConfigEntry<int> MissionKillSpecificTypeMin;

			public static ConfigEntry<int> MissionKillSpecificTypeMax;

			public static ConfigEntry<bool> MissionKillSpecificBuffEnabled;

			public static ConfigEntry<int> MissionKillSpecificBuffMin;

			public static ConfigEntry<int> MissionKillSpecificBuffMax;

			public static ConfigEntry<bool> MissionCollectGoldEnabled;

			public static ConfigEntry<int> MissionCollectGoldMin;

			public static ConfigEntry<int> MissionCollectGoldMax;

			public static ConfigEntry<int> NumMissionsCommonMin;

			public static ConfigEntry<int> NumMissionsCommonMax;

			public static ConfigEntry<int> NumMissionsUncommonMin;

			public static ConfigEntry<int> NumMissionsUncommonMax;

			public static ConfigEntry<int> NumMissionsRareMin;

			public static ConfigEntry<int> NumMissionsRareMax;
		}

		[StructLayout(LayoutKind.Sequential, Size = 1)]
		public struct Networking
		{
			public static ConfigEntry<short> MsgType;

			public static ConfigEntry<short> UpdateRate;
		}

		[StructLayout(LayoutKind.Sequential, Size = 1)]
		public struct UI
		{
			public static ConfigEntry<bool> UseHUDScale;

			public static ConfigEntry<float> HUDScaleOverride;

			public static ConfigEntry<float> QuestPositionX;

			public static ConfigEntry<float> QuestPositionY;

			public static ConfigEntry<float> AnnouncerScaleX;

			public static ConfigEntry<float> AnnouncerPositionY;

			public static ConfigEntry<bool> SendNewQuestAnnouncement;

			public static ConfigEntry<bool> SendQuestCompleteAnnouncement;

			public static ConfigEntry<bool> SendQuestFailedAnnouncement;
		}

		public static void Init(ConfigFile configFile)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_0046: 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_006c: Expected O, but got Unknown
			//IL_006c: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected O, but got Unknown
			//IL_00af: Expected O, but got Unknown
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Expected O, but got Unknown
			//IL_00f2: Expected O, but got Unknown
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Expected O, but got Unknown
			//IL_0135: Expected O, but got Unknown
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Expected O, but got Unknown
			//IL_0178: Expected O, but got Unknown
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Expected O, but got Unknown
			//IL_01ad: Expected O, but got Unknown
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Expected O, but got Unknown
			//IL_0215: Expected O, but got Unknown
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Expected O, but got Unknown
			//IL_024e: Expected O, but got Unknown
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Expected O, but got Unknown
			//IL_027f: Expected O, but got Unknown
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Expected O, but got Unknown
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Expected O, but got Unknown
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Expected O, but got Unknown
			//IL_02f6: Expected O, but got Unknown
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Expected O, but got Unknown
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Expected O, but got Unknown
			//IL_034d: Expected O, but got Unknown
			//IL_038c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0398: Expected O, but got Unknown
			//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c9: Expected O, but got Unknown
			//IL_03c9: Expected O, but got Unknown
			//IL_03df: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Expected O, but got Unknown
			//IL_0401: Unknown result type (might be due to invalid IL or missing references)
			//IL_040e: Expected O, but got Unknown
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_043f: Expected O, but got Unknown
			//IL_043f: Expected O, but got Unknown
			//IL_0455: Unknown result type (might be due to invalid IL or missing references)
			//IL_0461: Expected O, but got Unknown
			//IL_0477: Unknown result type (might be due to invalid IL or missing references)
			//IL_0483: Expected O, but got Unknown
			//IL_0499: Unknown result type (might be due to invalid IL or missing references)
			//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b4: Expected O, but got Unknown
			//IL_04b4: Expected O, but got Unknown
			//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d6: Expected O, but got Unknown
			//IL_04ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f8: Expected O, but got Unknown
			//IL_050e: Unknown result type (might be due to invalid IL or missing references)
			//IL_051f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0529: Expected O, but got Unknown
			//IL_0529: Expected O, but got Unknown
			//IL_053f: Unknown result type (might be due to invalid IL or missing references)
			//IL_054b: Expected O, but got Unknown
			//IL_0561: Unknown result type (might be due to invalid IL or missing references)
			//IL_056d: Expected O, but got Unknown
			//IL_0583: Unknown result type (might be due to invalid IL or missing references)
			//IL_0594: Unknown result type (might be due to invalid IL or missing references)
			//IL_059e: Expected O, but got Unknown
			//IL_059e: Expected O, but got Unknown
			//IL_05b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c0: Expected O, but got Unknown
			//IL_05d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e2: Expected O, but got Unknown
			//IL_05f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_060d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0617: Expected O, but got Unknown
			//IL_0617: Expected O, but got Unknown
			//IL_0656: Unknown result type (might be due to invalid IL or missing references)
			//IL_0667: Unknown result type (might be due to invalid IL or missing references)
			//IL_0671: Expected O, but got Unknown
			//IL_0671: Expected O, but got Unknown
			//IL_0687: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06aa: Expected O, but got Unknown
			//IL_06aa: Expected O, but got Unknown
			//IL_06c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e3: Expected O, but got Unknown
			//IL_06e3: Expected O, but got Unknown
			//IL_06f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0711: Unknown result type (might be due to invalid IL or missing references)
			//IL_071b: Expected O, but got Unknown
			//IL_071b: Expected O, but got Unknown
			//IL_0731: Unknown result type (might be due to invalid IL or missing references)
			//IL_0749: Unknown result type (might be due to invalid IL or missing references)
			//IL_0753: Expected O, but got Unknown
			//IL_0753: Expected O, but got Unknown
			//IL_0769: Unknown result type (might be due to invalid IL or missing references)
			//IL_0781: Unknown result type (might be due to invalid IL or missing references)
			//IL_078b: Expected O, but got Unknown
			//IL_078b: Expected O, but got Unknown
			//IL_07a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c3: Expected O, but got Unknown
			//IL_07c3: Expected O, but got Unknown
			//IL_07d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_07fb: Expected O, but got Unknown
			//IL_07fb: Expected O, but got Unknown
			//IL_0811: Unknown result type (might be due to invalid IL or missing references)
			//IL_0829: Unknown result type (might be due to invalid IL or missing references)
			//IL_0833: Expected O, but got Unknown
			//IL_0833: Expected O, but got Unknown
			//IL_0849: Unknown result type (might be due to invalid IL or missing references)
			//IL_085e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0868: Expected O, but got Unknown
			//IL_0868: Expected O, but got Unknown
			//IL_0878: Unknown result type (might be due to invalid IL or missing references)
			//IL_088a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0894: Expected O, but got Unknown
			//IL_0894: Expected O, but got Unknown
			//IL_08a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08bf: Expected O, but got Unknown
			//IL_08bf: Expected O, but got Unknown
			//IL_08fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_091d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0927: Expected O, but got Unknown
			//IL_0927: Expected O, but got Unknown
			//IL_0962: Unknown result type (might be due to invalid IL or missing references)
			//IL_0985: Unknown result type (might be due to invalid IL or missing references)
			//IL_098f: Expected O, but got Unknown
			//IL_098f: Expected O, but got Unknown
			//IL_09ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f7: Expected O, but got Unknown
			//IL_09f7: Expected O, but got Unknown
			//IL_0a32: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a55: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a5f: Expected O, but got Unknown
			//IL_0a5f: Expected O, but got Unknown
			//IL_0a9a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0abd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac7: Expected O, but got Unknown
			//IL_0ac7: Expected O, but got Unknown
			//IL_0b02: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b13: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b1d: Expected O, but got Unknown
			//IL_0b1d: Expected O, but got Unknown
			//IL_0b33: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b44: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b4e: Expected O, but got Unknown
			//IL_0b4e: Expected O, but got Unknown
			//IL_0b64: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b75: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b7f: Expected O, but got Unknown
			//IL_0b7f: Expected O, but got Unknown
			ConfigDescription val = new ConfigDescription("The minimum amount for the range of the kill goal", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>());
			ConfigDescription val2 = new ConfigDescription("The maximum amount for the range of the kill goal", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>());
			RiskOfOptionsHelper.RegisterModInfo("Options for RPG Mod");
			Questing.Cooldown = configFile.Bind<int>(new ConfigDefinition("Questing", "Cooldown"), 45, new ConfigDescription("Cooldown period between each quest in seconds", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 600), Array.Empty<object>())).AddOptionSlider();
			Questing.RewardChanceCommon = configFile.Bind<float>(new ConfigDefinition("Questing", "RewardChanceCommon"), 76f, new ConfigDescription("Percentage chance to roll for a common reward", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>())).AddOptionSlider();
			Questing.RewardChanceUncommon = configFile.Bind<float>(new ConfigDefinition("Questing", "RewardChanceUncommon"), 16f, new ConfigDescription("Percentage chance to roll for an uncommon reward", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>())).AddOptionSlider();
			Questing.RewardChanceRare = configFile.Bind<float>(new ConfigDefinition("Questing", "RewardChanceRare"), 8f, new ConfigDescription("Percentage chance to roll for a rare reward", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>())).AddOptionSlider();
			Questing.RewardChanceAdjustmentPercent = configFile.Bind<float>(new ConfigDefinition("Questing", "RewardChanceAdjustmentPercentage"), 2f, new ConfigDescription("Percentage multiplier to increase the chance of uncommon and rare rewards per successful quest", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>())).AddOptionSlider();
			Questing.RewardBlacklist = configFile.Bind<string>(new ConfigDefinition("Questing", "RewardBlacklist"), string.Empty, new ConfigDescription("Items ID to blacklist as quest reward. Separated with a comma.", (AcceptableValueBase)null, Array.Empty<object>())).AddOptionString();
			Questing.RewardBlacklist.SettingChanged += delegate
			{
				Blacklist.ClearCache();
			};
			Questing.TimerBase = configFile.Bind<int>(new ConfigDefinition("Questing", "TimerBase"), 180, new ConfigDescription("Number of seconds to complete a quest", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 600), Array.Empty<object>())).AddOptionSlider();
			Questing.TimerExtra = configFile.Bind<int>(new ConfigDefinition("Questing", "TimerExtra"), 30, new ConfigDescription("Extra seconds to complete the quest per extra mission", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 120), Array.Empty<object>())).AddOptionSlider();
			Questing.MissionKillAnyEnabled = configFile.Bind<bool>(new ConfigDefinition("Questing", "MissionKillAnyEnabled"), true, new ConfigDescription("Enable Kill any enemies mission", (AcceptableValueBase)null, Array.Empty<object>())).AddOptionBool();
			Questing.MissionKillAnyMin = configFile.Bind<int>(new ConfigDefinition("Questing", "MissionKillAnyMin"), 10, val).AddOptionSlider();
			Questing.MissionKillAnyMax = configFile.Bind<int>(new ConfigDefinition("Questing", "MissionKillAnyMax"), 15, val2).AddOptionSlider();
			Questing.MissionKillSpecificTypeEnabled = configFile.Bind<bool>(new ConfigDefinition("Questing", "MissionKillSpecificTypeEnabled"), true, new ConfigDescription("Enable Kill specific enemies mission", (AcceptableValueBase)null, Array.Empty<object>())).AddOptionBool();
			Questing.MissionKillSpecificTypeMin = configFile.Bind<int>(new ConfigDefinition("Questing", "MissionKillSpecificTypeMin"), 2, val).AddOptionSlider();
			Questing.EnemyTypeBlacklist = configFile.Bind<string>(new ConfigDefinition("Questing", "EnemyTypeBlacklist"), string.Empty, new ConfigDescription("Enemy types (CharacterBody.baseNameToken) to blacklist as quest specification. Separated with a comma.", (AcceptableValueBase)null, Array.Empty<object>())).AddOptionString();
			Questing.EnemyTypeBlacklist.SettingChanged += delegate
			{
				string[] enemyTypeBlacklist = ConfigValues.Questing.EnemyTypeBlacklist;
				foreach (string item2 in enemyTypeBlacklist)
				{
					Server.AllowedMonsterTypes.Remove(item2);
				}
				if (Server.AllowedMonsterTypes.Count == 0)
				{
					Server.AllowedMissionTypes.Remove(MissionType.KillSpecificName);
				}
			};
			Questing.MissionKillSpecificTypeMax = configFile.Bind<int>(new ConfigDefinition("Questing", "MissionKillSpecificTypeMax"), 5, val2).AddOptionSlider();
			Questing.MissionKillCommonEnabled = configFile.Bind<bool>(new ConfigDefinition("Questing", "MissionKillCommonEnabled"), true, new ConfigDescription("Enable Kill common enemies mission", (AcceptableValueBase)null, Array.Empty<object>())).AddOptionBool();
			Questing.MissionKillCommonMin = configFile.Bind<int>(new ConfigDefinition("Questing", "MissionKillCommonMin"), 5, val).AddOptionSlider();
			Questing.MissionKillCommonMax = configFile.Bind<int>(new ConfigDefinition("Questing", "MissionKillCommonMax"), 9, val2).AddOptionSlider();
			Questing.MissionKillEliteEnabled = configFile.Bind<bool>(new ConfigDefinition("Questing", "MissionKillEliteEnabled"), true, new ConfigDescription("Enable Kill elite enemies mission", (AcceptableValueBase)null, Array.Empty<object>())).AddOptionBool();
			Questing.MissionKillEliteMin = configFile.Bind<int>(new ConfigDefinition("Questing", "MissionKillEliteMin"), 3, val).AddOptionSlider();
			Questing.MissionKillEliteMax = configFile.Bind<int>(new ConfigDefinition("Questing", "MissionKillEliteMax"), 7, val2).AddOptionSlider();
			Questing.MissionKillChampionEnabled = configFile.Bind<bool>(new ConfigDefinition("Questing", "KillChampionMissionEnabled"), true, new ConfigDescription("Enable Kill champion enemies mission", (AcceptableValueBase)null, Array.Empty<object>())).AddOptionBool();
			Questing.MissionKillChampionMin = configFile.Bind<int>(new ConfigDefinition("Questing", "MissionKillChampionMin"), 1, val).AddOptionSlider();
			Questing.MissionKillChampionMax = configFile.Bind<int>(new ConfigDefinition("Questing", "MissionKillChampionMax"), 2, val2).AddOptionSlider();
			Questing.MissionKillFlyingEnabled = configFile.Bind<bool>(new ConfigDefinition("Questing", "MissionKillFlyingEnabled"), true, new ConfigDescription("Enable Kill flying enemies mission", (AcceptableValueBase)null, Array.Empty<object>())).AddOptionBool();
			Questing.MissionKillFlyingMin = configFile.Bind<int>(new ConfigDefinition("Questing", "MissionKillFlyingMin"), 2, val).AddOptionSlider();
			Questing.MissionKillFlyingMax = configFile.Bind<int>(new ConfigDefinition("Questing", "MissionKillFlyingMax"), 5, val2).AddOptionSlider();
			Questing.MissionKillSpecificBuffEnabled = configFile.Bind<bool>(new ConfigDefinition("Questing", "MissionKillSpecificBuffEnabled"), true, new ConfigDescription("Enable Kill enemies with specific buff mission", (AcceptableValueBase)null, Array.Empty<object>())).AddOptionBool();
			Questing.MissionKillSpecificBuffMin = configFile.Bind<int>(new ConfigDefinition("Questing", "MissionKillSpecificBuffMin"), 1, val).AddOptionSlider();
			Questing.MissionKillSpecificBuffMax = configFile.Bind<int>(new ConfigDefinition("Questing", "MissionKillSpecificBuffMax"), 2, val2).AddOptionSlider();
			Questing.EliteBuffBlacklist = configFile.Bind<string>(new ConfigDefinition("Questing", "EliteBuffBlacklist"), string.Empty, new ConfigDescription("Elite buff name (BuffDef.name) to blacklist as mission specification. Separated with a comma.", (AcceptableValueBase)null, Array.Empty<object>())).AddOptionString();
			Questing.EnemyTypeBlacklist.SettingChanged += delegate
			{
				string[] eliteBuffBlacklist = ConfigValues.Questing.EliteBuffBlacklist;
				foreach (string item in eliteBuffBlacklist)
				{
					Server.AllowedBuffTypes.Remove(item);
				}
				if (Server.AllowedBuffTypes.Count == 0)
				{
					Server.AllowedMissionTypes.Remove(MissionType.KillSpecificBuff);
				}
			};
			Questing.MissionCollectGoldEnabled = configFile.Bind<bool>(new ConfigDefinition("Questing", "MissionCollectGoldEnabled"), true, new ConfigDescription("Enable Collect gold mission", (AcceptableValueBase)null, Array.Empty<object>())).AddOptionBool();
			Questing.MissionCollectGoldMin = configFile.Bind<int>(new ConfigDefinition("Questing", "MissionCollectGoldMin"), 12, new ConfigDescription("The minimum amount for the collect gold mission", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>())).AddOptionSlider();
			Questing.MissionCollectGoldMax = configFile.Bind<int>(new ConfigDefinition("Questing", "MissionCollectGoldMax"), 31, new ConfigDescription("The maximum amount for the collect gold mission", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>())).AddOptionSlider();
			Questing.NumMissionsCommonMin = configFile.Bind<int>(new ConfigDefinition("Questing", "NumMissionsCommonMin"), 1, new ConfigDescription("The minimum amount of missions to generate for Tier 1 items", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>())).AddOptionSlider();
			Questing.NumMissionsCommonMax = configFile.Bind<int>(new ConfigDefinition("Questing", "NumMissionsCommonMax"), 1, new ConfigDescription("The maximum amount of missions to generate for common items", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>())).AddOptionSlider();
			Questing.NumMissionsUncommonMin = configFile.Bind<int>(new ConfigDefinition("Questing", "NumMissionsUncommonMin"), 2, new ConfigDescription("The minimum amount of missions to generate for uncommon items", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>())).AddOptionSlider();
			Questing.NumMissionsUncommonMax = configFile.Bind<int>(new ConfigDefinition("Questing", "NumMissionsUncommonMax"), 2, new ConfigDescription("The maximum amount of missions to generate for uncommon items", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>())).AddOptionSlider();
			Questing.NumMissionsRareMin = configFile.Bind<int>(new ConfigDefinition("Questing", "NumMissionsRareMin"), 3, new ConfigDescription("The minimum amount of missions to generate for rare items", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>())).AddOptionSlider();
			Questing.NumMissionsRareMax = configFile.Bind<int>(new ConfigDefinition("Questing", "NumMissionsRareMax"), 4, new ConfigDescription("The maximum amount of missions to generate for rare items", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>())).AddOptionSlider();
			Networking.MsgType = configFile.Bind<short>(new ConfigDefinition("Networking", "MessageType"), (short)1337, new ConfigDescription("The starting number used for identification of messages sent between the client and server (both clients and server must be the same)", (AcceptableValueBase)null, Array.Empty<object>()));
			Networking.UpdateRate = configFile.Bind<short>(new ConfigDefinition("Networking", "UpdateRate"), (short)100, new ConfigDescription("How frequently clients are synced to the server (in ms)", (AcceptableValueBase)null, Array.Empty<object>()));
			UI.UseHUDScale = configFile.Bind<bool>(new ConfigDefinition("UI", "UseHUDScale"), true, new ConfigDescription("Determines whether or not the in-game HUD Scale setting is used", (AcceptableValueBase)null, Array.Empty<object>())).AddOptionBool();
			UI.UseHUDScale.SettingChanged += RefreshUI;
			UI.HUDScaleOverride = configFile.Bind<float>(new ConfigDefinition("UI", "HUDScaleOverride"), 1f, new ConfigDescription("If useHUDScale is false, this value is used to determine scale instead", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>())).AddOptionSlider();
			UI.HUDScaleOverride.SettingChanged += RefreshUI;
			UI.QuestPositionX = configFile.Bind<float>(new ConfigDefinition("UI", "QuestPositionX"), 87f, new ConfigDescription("Location of the quest on the screen (x axis), represented by screen width percentage", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>())).AddOptionSlider();
			UI.QuestPositionX.SettingChanged += RefreshUI;
			UI.QuestPositionY = configFile.Bind<float>(new ConfigDefinition("UI", "QuestPositionY"), 70f, new ConfigDescription("Location of the quest on the screen (y axis), represented by screen height percentage", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>())).AddOptionSlider();
			UI.QuestPositionY.SettingChanged += RefreshUI;
			UI.AnnouncerScaleX = configFile.Bind<float>(new ConfigDefinition("UI", "AnnouncerScaleX"), 30f, new ConfigDescription("Percentage of screen width (x axis) used for the announcer box", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>())).AddOptionSlider();
			UI.AnnouncerScaleX.SettingChanged += RefreshUI;
			UI.AnnouncerPositionY = configFile.Bind<float>(new ConfigDefinition("UI", "AnnouncerPositionY"), 3f, new ConfigDescription("Location of the announcer on the screen (y axis), represented by screen height percentage", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>())).AddOptionSlider();
			UI.AnnouncerPositionY.SettingChanged += RefreshUI;
			UI.SendNewQuestAnnouncement = configFile.Bind<bool>(new ConfigDefinition("UI", "SendNewQuestAnnouncement"), true, new ConfigDescription("Send new quest announcement", (AcceptableValueBase)null, Array.Empty<object>())).AddOptionBool();
			UI.SendQuestCompleteAnnouncement = configFile.Bind<bool>(new ConfigDefinition("UI", "SendQuestCompleteAnnouncement"), true, new ConfigDescription("Send quest complete announcement", (AcceptableValueBase)null, Array.Empty<object>())).AddOptionBool();
			UI.SendQuestFailedAnnouncement = configFile.Bind<bool>(new ConfigDefinition("UI", "SendQuestFailedAnnouncement"), true, new ConfigDescription("Send quest failed announcement", (AcceptableValueBase)null, Array.Empty<object>())).AddOptionBool();
		}

		private static void RefreshUI(object sender, EventArgs e)
		{
			if (!((Object)(object)RpgMod.Instance == (Object)null) && RpgMod.Instance.ModState == ModState.Started)
			{
				RpgMod.Instance.RefreshUI();
			}
		}
	}
	public static class ConfigValues
	{
		[StructLayout(LayoutKind.Sequential, Size = 1)]
		public struct Questing
		{
			public static int Cooldown => ConfigurationManager.Questing.Cooldown.Value;

			public static float RewardChanceCommon => ConfigurationManager.Questing.RewardChanceCommon.Value / 100f;

			public static float RewardChanceUncommon => ConfigurationManager.Questing.RewardChanceUncommon.Value / 100f;

			public static float RewardChanceRare => ConfigurationManager.Questing.RewardChanceRare.Value / 100f;

			public static float RewardChanceAdjustmentPercent => ConfigurationManager.Questing.RewardChanceAdjustmentPercent.Value / 100f;

			public static float TimerBase => ConfigurationManager.Questing.TimerBase.Value;

			public static float TimerExtra => ConfigurationManager.Questing.TimerExtra.Value;

			public static string[] RewardBlacklist => ConfigurationManager.Questing.RewardBlacklist.Value.Split(new char[1] { ',' });

			public static bool MissionKillAnyEnabled => ConfigurationManager.Questing.MissionKillAnyEnabled.Value;

			public static int MissionKillAnyMin => ConfigurationManager.Questing.MissionKillAnyMin.Value;

			public static int MissionKillAnyMax => ConfigurationManager.Questing.MissionKillAnyMax.Value;

			public static bool KillSpecificTypeEnabled => ConfigurationManager.Questing.MissionKillSpecificTypeEnabled.Value;

			public static int KillSpecificNameMin => ConfigurationManager.Questing.MissionKillSpecificTypeMin.Value;

			public static int KillSpecificNameMax => ConfigurationManager.Questing.MissionKillSpecificTypeMax.Value;

			public static string[] EnemyTypeBlacklist => ConfigurationManager.Questing.EnemyTypeBlacklist.Value.Split(new char[1] { ',' });

			public static bool MissionKillCommonEnabled => ConfigurationManager.Questing.MissionKillCommonEnabled.Value;

			public static int MissionKillCommonMin => ConfigurationManager.Questing.MissionKillCommonMin.Value;

			public static int MissionKillCommonMax => ConfigurationManager.Questing.MissionKillCommonMax.Value;

			public static bool MissionKillEliteEnabled => ConfigurationManager.Questing.MissionKillEliteEnabled.Value;

			public static int MissionKillEliteMin => ConfigurationManager.Questing.MissionKillEliteMin.Value;

			public static int MissionKillEliteMax => ConfigurationManager.Questing.MissionKillEliteMax.Value;

			public static bool MissionKillChampionEnabled => ConfigurationManager.Questing.MissionKillChampionEnabled.Value;

			public static int MissionKillChampionMin => ConfigurationManager.Questing.MissionKillChampionMin.Value;

			public static int MissionKillChampionMax => ConfigurationManager.Questing.MissionKillChampionMax.Value;

			public static bool MissionKillFlyingEnabled => ConfigurationManager.Questing.MissionKillFlyingEnabled.Value;

			public static int MissionKillFlyingMin => ConfigurationManager.Questing.MissionKillFlyingMin.Value;

			public static int MissionKillFlyingMax => ConfigurationManager.Questing.MissionKillFlyingMax.Value;

			public static bool MissionKillSpecificBuffEnabled => ConfigurationManager.Questing.MissionKillSpecificBuffEnabled.Value;

			public static int MissionKillSpecificBuffMin => ConfigurationManager.Questing.MissionKillSpecificBuffMin.Value;

			public static int MissionKillSpecificBuffMax => ConfigurationManager.Questing.MissionKillSpecificBuffMax.Value;

			public static string[] EliteBuffBlacklist => ConfigurationManager.Questing.EliteBuffBlacklist.Value.Split(new char[1] { ',' });

			public static bool MissionCollectGoldEnabled => ConfigurationManager.Questing.MissionCollectGoldEnabled.Value;

			public static int MissionCollectGoldMin => ConfigurationManager.Questing.MissionCollectGoldMin.Value;

			public static int MissionCollectGoldMax => ConfigurationManager.Questing.MissionCollectGoldMax.Value;

			public static int NumMissionsCommonMin => ConfigurationManager.Questing.NumMissionsCommonMin.Value;

			public static int NumMissionsCommonMax => ConfigurationManager.Questing.NumMissionsCommonMax.Value;

			public static int NumMissionsUncommonMin => ConfigurationManager.Questing.NumMissionsUncommonMin.Value;

			public static int NumMissionsUncommonMax => ConfigurationManager.Questing.NumMissionsUncommonMax.Value;

			public static int NumMissionsRareMin => ConfigurationManager.Questing.NumMissionsRareMin.Value;

			public static int NumMissionsRareMax => ConfigurationManager.Questing.NumMissionsRareMax.Value;
		}

		[StructLayout(LayoutKind.Sequential, Size = 1)]
		public struct Networking
		{
			public static short MsgType => ConfigurationManager.Networking.MsgType.Value;

			public static short UpdateRate => ConfigurationManager.Networking.UpdateRate.Value;
		}

		[StructLayout(LayoutKind.Sequential, Size = 1)]
		public struct UI
		{
			public static bool UseHUDScale => ConfigurationManager.UI.UseHUDScale.Value;

			public static float HUDScaleOverride => ConfigurationManager.UI.HUDScaleOverride.Value / 100f;

			public static float QuestPositionX => ConfigurationManager.UI.QuestPositionX.Value / 100f;

			public static float QuestPositionY => ConfigurationManager.UI.QuestPositionY.Value / 100f;

			public static float AnnouncerScaleX => ConfigurationManager.UI.AnnouncerScaleX.Value / 100f;

			public static float AnnouncerPositionY => ConfigurationManager.UI.AnnouncerPositionY.Value / 100f;

			public static bool SendNewQuestAnnouncement => ConfigurationManager.UI.SendNewQuestAnnouncement.Value;

			public static bool SendQuestCompleteAnnouncement => ConfigurationManager.UI.SendQuestCompleteAnnouncement.Value;

			public static bool SendQuestFailedAnnouncement => ConfigurationManager.UI.SendQuestFailedAnnouncement.Value;
		}
	}
	public static class Networking
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static NetworkMessageDelegate <0>__Handler;

			public static NetworkMessageDelegate <1>__Handler;

			public static NetworkMessageDelegate <2>__Handler;
		}

		private static float _lastUpdate;

		private static void RegisterHandlers()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			NetworkClient client = NetworkManager.singleton.client;
			short msgType = ConfigValues.Networking.MsgType;
			object obj = <>O.<0>__Handler;
			if (obj == null)
			{
				NetworkMessageDelegate val = QuestData.Handler;
				<>O.<0>__Handler = val;
				obj = (object)val;
			}
			client.RegisterHandler(msgType, (NetworkMessageDelegate)obj);
			short num = (short)(ConfigValues.Networking.MsgType + 1);
			object obj2 = <>O.<1>__Handler;
			if (obj2 == null)
			{
				NetworkMessageDelegate val2 = Announcement.Handler;
				<>O.<1>__Handler = val2;
				obj2 = (object)val2;
			}
			client.RegisterHandler(num, (NetworkMessageDelegate)obj2);
			short num2 = (short)(ConfigValues.Networking.MsgType + 2);
			object obj3 = <>O.<2>__Handler;
			if (obj3 == null)
			{
				NetworkMessageDelegate val3 = ItemReceived.Handler;
				<>O.<2>__Handler = val3;
				obj3 = (object)val3;
			}
			client.RegisterHandler(num2, (NetworkMessageDelegate)obj3);
		}

		public static void Setup()
		{
			_lastUpdate = 0f;
			RegisterHandlers();
		}

		public static void Sync()
		{
			if (ConfigValues.Networking.UpdateRate != 0 && !(Run.instance.GetRunStopwatch() - _lastUpdate >= (float)ConfigValues.Networking.UpdateRate / 1000f))
			{
				return;
			}
			foreach (ClientData clientData in Server.ClientDatas)
			{
				NetworkServer.SendToClient(((NetworkBehaviour)clientData.NetworkUser).connectionToClient.connectionId, ConfigValues.Networking.MsgType, (MessageBase)(object)clientData.QuestData);
			}
			_lastUpdate = Run.instance.GetRunStopwatch();
		}

		public static void Write(this NetworkWriter writer, MissionType missionType)
		{
			writer.Write((int)missionType);
		}

		public static void Write(this NetworkWriter writer, Mission mission)
		{
			writer.Write(mission.MissionType);
			writer.Write(mission.MissionSpecification);
			writer.Write(mission.IsCompleted);
			writer.Write(mission.Progress);
			writer.Write(mission.Objective);
		}

		public static void SendAnnouncement(Announcement message, int connectionId)
		{
			NetworkServer.SendToClient(connectionId, (short)(ConfigValues.Networking.MsgType + 1), (MessageBase)(object)message);
		}

		public static void SendItemReceivedMessage(ItemReceived itemReceived, int connectionId)
		{
			NetworkServer.SendToClient(connectionId, (short)(ConfigValues.Networking.MsgType + 2), (MessageBase)(object)itemReceived);
		}

		public static Mission ReadMission(this NetworkReader reader)
		{
			return new Mission(reader.ReadMissionType(), reader.ReadString(), reader.ReadBoolean(), reader.ReadInt32(), reader.ReadInt32());
		}

		public static MissionType ReadMissionType(this NetworkReader reader)
		{
			return (MissionType)reader.ReadInt32();
		}
	}
	internal enum ModState
	{
		Awaiting,
		Starting,
		Started,
		Ending
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("RPGMod", "RPGMod", "3.7.0")]
	public class RpgMod : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_GiveMoney <>9__5_2;

			public static Func<BuffDef, bool> <>9__5_5;

			public static hook_OnCharacterDeath <>9__5_3;

			public static hook_OnServerSceneChanged <>9__5_4;

			internal void <Awake>b__5_2(orig_GiveMoney orig, CharacterMaster self, uint amount)
			{
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				if (ConfigValues.Questing.MissionCollectGoldEnabled && NetworkServer.active && self != null)
				{
					PlayerCharacterMasterController component = ((Component)self).GetComponent<PlayerCharacterMasterController>();
					NetworkInstanceId? obj;
					if (component == null)
					{
						obj = null;
					}
					else
					{
						NetworkUser networkUser = component.networkUser;
						obj = ((networkUser != null) ? new NetworkInstanceId?(((NetworkBehaviour)networkUser).netId) : null);
					}
					NetworkInstanceId? val = obj;
					if (val.HasValue)
					{
						Server.UnlockMissionType(MissionType.CollectGold);
						((UnityEvent<int, string, NetworkUser>)Events.GoldCollected).Invoke((int)amount, (string)null, ((Component)self).GetComponent<PlayerCharacterMasterController>().networkUser);
					}
				}
				orig.Invoke(self, amount);
			}

			internal void <Awake>b__5_3(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport)
			{
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				CharacterBody victimBody = damageReport.victimBody;
				DamageInfo damageInfo = damageReport.damageInfo;
				object obj;
				if (damageInfo == null)
				{
					obj = null;
				}
				else
				{
					GameObject attacker = damageInfo.attacker;
					obj = ((attacker != null) ? attacker.GetComponent<CharacterBody>() : null);
				}
				CharacterBody val = (CharacterBody)obj;
				object master;
				if (val == null)
				{
					master = null;
				}
				else
				{
					GameObject masterObject = val.masterObject;
					master = ((masterObject != null) ? masterObject.GetComponent<CharacterMaster>() : null);
				}
				NetworkUser killerNetworkUser = GetKillerNetworkUser((CharacterMaster)master);
				if ((Object)(object)victimBody != (Object)null && (Object)(object)val != (Object)null && killerNetworkUser != null)
				{
					_ = ((NetworkBehaviour)killerNetworkUser).netId;
					if (ConfigValues.Questing.MissionKillAnyEnabled)
					{
						Server.UnlockMissionType(MissionType.KillAny);
						((UnityEvent<int, string, NetworkUser>)Events.AnyKilled).Invoke(1, (string)null, killerNetworkUser);
					}
					if (victimBody.isFlying && ConfigValues.Questing.MissionKillFlyingEnabled)
					{
						Server.UnlockMissionType(MissionType.KillFlying);
						((UnityEvent<int, string, NetworkUser>)Events.FlyingKilled).Invoke(1, (string)null, killerNetworkUser);
					}
					if (!victimBody.isBoss && ConfigValues.Questing.KillSpecificTypeEnabled)
					{
						Server.UnlockMissionType(MissionType.KillSpecificName);
						Server.UnlockMonsterType(victimBody);
						((UnityEvent<int, string, NetworkUser>)Events.SpecificNameKilled).Invoke(1, victimBody.baseNameToken, killerNetworkUser);
					}
					if (victimBody.isElite && ConfigValues.Questing.MissionKillSpecificBuffEnabled)
					{
						Server.UnlockMissionType(MissionType.KillSpecificBuff);
						foreach (BuffDef item in from x in ((IEnumerable<BuffIndex>)victimBody.ActiveBuffsList()).Select((Func<BuffIndex, BuffDef>)BuffCatalog.GetBuffDef)
							where x.isElite
							select x)
						{
							Server.UnlockBuffType(item);
							((UnityEvent<int, string, NetworkUser>)Events.SpecificBuffKilled).Invoke(1, item.eliteDef.modifierToken, killerNetworkUser);
						}
					}
					if (victimBody.isChampion && ConfigValues.Questing.MissionKillChampionEnabled)
					{
						Server.UnlockMissionType(MissionType.KillChampion);
						((UnityEvent<int, string, NetworkUser>)Events.ChampionKilled).Invoke(1, (string)null, killerNetworkUser);
					}
					else if (victimBody.isElite && ConfigValues.Questing.MissionKillEliteEnabled)
					{
						Server.UnlockMissionType(MissionType.KillElite);
						((UnityEvent<int, string, NetworkUser>)Events.EliteKilled).Invoke(1, (string)null, killerNetworkUser);
					}
					else if (ConfigValues.Questing.MissionKillCommonEnabled)
					{
						Server.UnlockMissionType(MissionType.KillCommon);
						((UnityEvent<int, string, NetworkUser>)Events.CommonKilled).Invoke(1, (string)null, killerNetworkUser);
					}
				}
				orig.Invoke(self, damageReport);
			}

			internal bool <Awake>b__5_5(BuffDef x)
			{
				return x.isElite;
			}

			internal void <Awake>b__5_4(orig_OnServerSceneChanged orig, Run self, string interactor)
			{
				Manager.CleanUp();
				orig.Invoke(self, interactor);
			}
		}

		private ModState _modState;

		public static ManualLogSource Log;

		public static RpgMod Instance;

		internal ModState ModState => _modState;

		private void Awake()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Expected O, but got Unknown
			//IL_00a3: 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_00ae: Expected O, but got Unknown
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Expected O, but got Unknown
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			_modState = ModState.Awaiting;
			Utils.AssetBundle = AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("RPGMod.rpgmodbundle"));
			if (Utils.AssetBundle == null)
			{
				return;
			}
			DependenciesManager.CheckForDependencies();
			ConfigurationManager.Init(((BaseUnityPlugin)this).Config);
			Run.Start += (hook_Start)delegate(orig_Start orig, Run self)
			{
				_modState = ModState.Starting;
				orig.Invoke(self);
			};
			Run.OnDisable += (hook_OnDisable)delegate(orig_OnDisable orig, Run self)
			{
				_modState = ModState.Ending;
				orig.Invoke(self);
			};
			object obj = <>c.<>9__5_2;
			if (obj == null)
			{
				hook_GiveMoney val = delegate(orig_GiveMoney orig, CharacterMaster self, uint amount)
				{
					//IL_003a: Unknown result type (might be due to invalid IL or missing references)
					if (ConfigValues.Questing.MissionCollectGoldEnabled && NetworkServer.active && self != null)
					{
						PlayerCharacterMasterController component = ((Component)self).GetComponent<PlayerCharacterMasterController>();
						NetworkInstanceId? obj5;
						if (component == null)
						{
							obj5 = null;
						}
						else
						{
							NetworkUser networkUser = component.networkUser;
							obj5 = ((networkUser != null) ? new NetworkInstanceId?(((NetworkBehaviour)networkUser).netId) : null);
						}
						NetworkInstanceId? val5 = obj5;
						if (val5.HasValue)
						{
							Server.UnlockMissionType(MissionType.CollectGold);
							((UnityEvent<int, string, NetworkUser>)Events.GoldCollected).Invoke((int)amount, (string)null, ((Component)self).GetComponent<PlayerCharacterMasterController>().networkUser);
						}
					}
					orig.Invoke(self, amount);
				};
				<>c.<>9__5_2 = val;
				obj = (object)val;
			}
			CharacterMaster.GiveMoney += (hook_GiveMoney)obj;
			object obj2 = <>c.<>9__5_3;
			if (obj2 == null)
			{
				hook_OnCharacterDeath val2 = delegate(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport)
				{
					//IL_0063: Unknown result type (might be due to invalid IL or missing references)
					CharacterBody victimBody = damageReport.victimBody;
					DamageInfo damageInfo = damageReport.damageInfo;
					object obj4;
					if (damageInfo == null)
					{
						obj4 = null;
					}
					else
					{
						GameObject attacker = damageInfo.attacker;
						obj4 = ((attacker != null) ? attacker.GetComponent<CharacterBody>() : null);
					}
					CharacterBody val4 = (CharacterBody)obj4;
					object master;
					if (val4 == null)
					{
						master = null;
					}
					else
					{
						GameObject masterObject = val4.masterObject;
						master = ((masterObject != null) ? masterObject.GetComponent<CharacterMaster>() : null);
					}
					NetworkUser killerNetworkUser = GetKillerNetworkUser((CharacterMaster)master);
					if ((Object)(object)victimBody != (Object)null && (Object)(object)val4 != (Object)null && killerNetworkUser != null)
					{
						_ = ((NetworkBehaviour)killerNetworkUser).netId;
						if (ConfigValues.Questing.MissionKillAnyEnabled)
						{
							Server.UnlockMissionType(MissionType.KillAny);
							((UnityEvent<int, string, NetworkUser>)Events.AnyKilled).Invoke(1, (string)null, killerNetworkUser);
						}
						if (victimBody.isFlying && ConfigValues.Questing.MissionKillFlyingEnabled)
						{
							Server.UnlockMissionType(MissionType.KillFlying);
							((UnityEvent<int, string, NetworkUser>)Events.FlyingKilled).Invoke(1, (string)null, killerNetworkUser);
						}
						if (!victimBody.isBoss && ConfigValues.Questing.KillSpecificTypeEnabled)
						{
							Server.UnlockMissionType(MissionType.KillSpecificName);
							Server.UnlockMonsterType(victimBody);
							((UnityEvent<int, string, NetworkUser>)Events.SpecificNameKilled).Invoke(1, victimBody.baseNameToken, killerNetworkUser);
						}
						if (victimBody.isElite && ConfigValues.Questing.MissionKillSpecificBuffEnabled)
						{
							Server.UnlockMissionType(MissionType.KillSpecificBuff);
							foreach (BuffDef item in from x in ((IEnumerable<BuffIndex>)victimBody.ActiveBuffsList()).Select((Func<BuffIndex, BuffDef>)BuffCatalog.GetBuffDef)
								where x.isElite
								select x)
							{
								Server.UnlockBuffType(item);
								((UnityEvent<int, string, NetworkUser>)Events.SpecificBuffKilled).Invoke(1, item.eliteDef.modifierToken, killerNetworkUser);
							}
						}
						if (victimBody.isChampion && ConfigValues.Questing.MissionKillChampionEnabled)
						{
							Server.UnlockMissionType(MissionType.KillChampion);
							((UnityEvent<int, string, NetworkUser>)Events.ChampionKilled).Invoke(1, (string)null, killerNetworkUser);
						}
						else if (victimBody.isElite && ConfigValues.Questing.MissionKillEliteEnabled)
						{
							Server.UnlockMissionType(MissionType.KillElite);
							((UnityEvent<int, string, NetworkUser>)Events.EliteKilled).Invoke(1, (string)null, killerNetworkUser);
						}
						else if (ConfigValues.Questing.MissionKillCommonEnabled)
						{
							Server.UnlockMissionType(MissionType.KillCommon);
							((UnityEvent<int, string, NetworkUser>)Events.CommonKilled).Invoke(1, (string)null, killerNetworkUser);
						}
					}
					orig.Invoke(self, damageReport);
				};
				<>c.<>9__5_3 = val2;
				obj2 = (object)val2;
			}
			GlobalEventManager.OnCharacterDeath += (hook_OnCharacterDeath)obj2;
			object obj3 = <>c.<>9__5_4;
			if (obj3 == null)
			{
				hook_OnServerSceneChanged val3 = delegate(orig_OnServerSceneChanged orig, Run self, string interactor)
				{
					Manager.CleanUp();
					orig.Invoke(self, interactor);
				};
				<>c.<>9__5_4 = val3;
				obj3 = (object)val3;
			}
			Run.OnServerSceneChanged += (hook_OnServerSceneChanged)obj3;
		}

		private void Update()
		{
			switch (_modState)
			{
			case ModState.Starting:
				Setup();
				_modState = ModState.Started;
				break;
			case ModState.Started:
				if (Utils.IsReady)
				{
					Client.Update();
					if (NetworkServer.active)
					{
						Manager.Update();
						Networking.Sync();
					}
				}
				break;
			case ModState.Ending:
				CleanUp();
				_modState = ModState.Awaiting;
				break;
			}
		}

		private void Setup()
		{
			Networking.Setup();
			RefreshUI();
		}

		private static void CleanUp()
		{
			Manager.CleanUp();
		}

		internal void RefreshUI()
		{
			((MonoBehaviour)this).StartCoroutine(Utils.Setup());
		}

		private static NetworkUser GetKillerNetworkUser(CharacterMaster master)
		{
			object obj;
			if (master == null)
			{
				obj = null;
			}
			else
			{
				PlayerCharacterMasterController playerCharacterMasterController = master.playerCharacterMasterController;
				obj = ((playerCharacterMasterController != null) ? playerCharacterMasterController.networkUser : null);
			}
			if (Object.op_Implicit((Object)obj))
			{
				if (master == null)
				{
					return null;
				}
				PlayerCharacterMasterController playerCharacterMasterController2 = master.playerCharacterMasterController;
				if (playerCharacterMasterController2 == null)
				{
					return null;
				}
				return playerCharacterMasterController2.networkUser;
			}
			object obj2;
			if (master == null)
			{
				obj2 = null;
			}
			else
			{
				MinionOwnership minionOwnership = master.minionOwnership;
				if (minionOwnership == null)
				{
					obj2 = null;
				}
				else
				{
					CharacterMaster ownerMaster = minionOwnership.ownerMaster;
					if (ownerMaster == null)
					{
						obj2 = null;
					}
					else
					{
						PlayerCharacterMasterController playerCharacterMasterController3 = ownerMaster.playerCharacterMasterController;
						obj2 = ((playerCharacterMasterController3 != null) ? playerCharacterMasterController3.networkUser : null);
					}
				}
			}
			if (!Object.op_Implicit((Object)obj2))
			{
				return null;
			}
			if (master == null)
			{
				return null;
			}
			MinionOwnership minionOwnership2 = master.minionOwnership;
			if (minionOwnership2 == null)
			{
				return null;
			}
			CharacterMaster ownerMaster2 = minionOwnership2.ownerMaster;
			if (ownerMaster2 == null)
			{
				return null;
			}
			PlayerCharacterMasterController playerCharacterMasterController4 = ownerMaster2.playerCharacterMasterController;
			if (playerCharacterMasterController4 == null)
			{
				return null;
			}
			return playerCharacterMasterController4.networkUser;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "RPGMod";

		public const string PLUGIN_NAME = "RPGMod";

		public const string PLUGIN_VERSION = "3.7.0";
	}
}
namespace RPGMod.UI
{
	public class Announcer : MonoBehaviour
	{
		private readonly GameObject _announcerUI;

		private readonly GameObject _announcerText;

		private bool _finished;

		private float _startTime;

		private float _vel;

		private float _vel2;

		private float _targetY;

		private float _targetAlpha;

		private readonly float _fadeTime;

		private Announcer()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Expected O, but got Unknown
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			_finished = false;
			_vel = 0f;
			_vel2 = 0f;
			_targetY = Utils.ScreenSize.y * ConfigValues.UI.AnnouncerPositionY;
			_targetAlpha = 1f;
			_fadeTime = 0.7f;
			_announcerUI = new GameObject();
			_announcerUI.AddComponent<RectTransform>();
			_announcerUI.AddComponent<Image>();
			_announcerUI.AddComponent<CanvasGroup>();
			_announcerUI.GetComponent<RectTransform>().anchorMin = new Vector2(0.5f, 0f);
			_announcerUI.GetComponent<RectTransform>().anchorMax = new Vector2(0.5f, 0f);
			_announcerUI.GetComponent<RectTransform>().pivot = new Vector2(0.5f, 0f);
			_announcerUI.GetComponent<RectTransform>().sizeDelta = new Vector2(Utils.ScreenSize.x * ConfigValues.UI.AnnouncerScaleX, 100f);
			((Graphic)_announcerUI.GetComponent<Image>()).color = new Color(0.16f, 0.16f, 0.16f, 0.9f);
			_announcerUI.GetComponent<CanvasGroup>().alpha = 0f;
			Utils.AddBorder(_announcerUI);
			_announcerText = new GameObject();
			_announcerText.AddComponent<RectTransform>();
			_announcerText.AddComponent<TextMeshProUGUI>();
			_announcerText.transform.SetParent(_announcerUI.transform);
			_announcerText.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
			_announcerText.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
			_announcerText.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
			_announcerText.GetComponent<RectTransform>().sizeDelta = _announcerUI.GetComponent<RectTransform>().sizeDelta;
			_announcerText.GetComponent<RectTransform>().anchoredPosition = Vector2.op_Implicit(new Vector3(0f, 0f, 0f));
			((TMP_Text)_announcerText.GetComponent<TextMeshProUGUI>()).alignment = (TextAlignmentOptions)257;
			((TMP_Text)_announcerText.GetComponent<TextMeshProUGUI>()).font = HGTextMeshProUGUI.defaultLanguageFont;
			((TMP_Text)_announcerText.GetComponent<TextMeshProUGUI>()).fontSize = 24f;
			((TMP_Text)_announcerText.GetComponent<TextMeshProUGUI>()).margin = new Vector4(10f, 10f, 10f, 10f);
			((TMP_Text)_announcerText.GetComponent<TextMeshProUGUI>()).text = "";
			_announcerUI.transform.SetParent(((Component)this).transform);
			((Transform)_announcerUI.GetComponent<RectTransform>()).localPosition = new Vector3(0f, 0f, 0f);
			_announcerUI.GetComponent<RectTransform>().anchoredPosition = Vector2.op_Implicit(new Vector3(0f, (0f - Utils.ScreenSize.y) * 0.03f, 0f));
			((Transform)_announcerUI.GetComponent<RectTransform>()).localScale = new Vector3(Utils.HudScale, Utils.HudScale, Utils.HudScale);
		}

		public void SetMessage(string message)
		{
			((MonoBehaviour)this).StartCoroutine(PlayText(message));
		}

		private void Update()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			_announcerUI.GetComponent<RectTransform>().anchoredPosition = Vector2.op_Implicit(new Vector3(0f, Mathf.SmoothDamp(_announcerUI.GetComponent<RectTransform>().anchoredPosition.y, _targetY, ref _vel, _fadeTime), 0f));
			_announcerUI.GetComponent<CanvasGroup>().alpha = Mathf.SmoothDamp(_announcerUI.GetComponent<CanvasGroup>().alpha, _targetAlpha, ref _vel2, _fadeTime);
			if (_finished && Run.instance.GetRunStopwatch() - _startTime >= _fadeTime + 0.5f)
			{
				Destroy();
			}
		}

		private IEnumerator PlayText(string text)
		{
			for (int i = 0; i < text.Length; i++)
			{
				if (text[i] == '<')
				{
					for (; text[i] != '>' && i < text.Length - 1; i++)
					{
						TextMeshProUGUI component = _announcerText.GetComponent<TextMeshProUGUI>();
						((TMP_Text)component).text = ((TMP_Text)component).text + text[i];
					}
				}
				Util.PlaySound("Play_UI_ChatMessage", ((Component)RoR2Application.instance).gameObject);
				TextMeshProUGUI component2 = _announcerText.GetComponent<TextMeshProUGUI>();
				((TMP_Text)component2).text = ((TMP_Text)component2).text + text[i];
				if (i < text.Length - 1 && (text[i + 1] == ' ' || text[i + 1] == '.' || text[i + 1] == ','))
				{
					i++;
					TextMeshProUGUI component3 = _announcerText.GetComponent<TextMeshProUGUI>();
					((TMP_Text)component3).text = ((TMP_Text)component3).text + text[i];
					yield return (object)new WaitForSeconds(0.085f);
				}
				else
				{
					yield return (object)new WaitForSeconds(0.035f);
				}
			}
			yield return (object)new WaitForSeconds(5f);
			_startTime = Run.instance.GetRunStopwatch();
			_targetAlpha = 0f;
			_targetY = -30f;
			_finished = true;
		}

		public void Destroy()
		{
			Object.Destroy((Object)(object)_announcerUI);
			Object.Destroy((Object)(object)this);
		}
	}
	public class MissionComponent : MonoBehaviour
	{
		private float _progressVel;

		private readonly GameObject _missionUI;

		private Mission _mission;

		public int Index;

		private MissionComponent()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0053: 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_0091: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Expected O, but got Unknown
			//IL_00ff: 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_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Expected O, but got Unknown
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Unknown result type (might be due to invalid IL or missing references)
			//IL_0367: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03df: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0403: Unknown result type (might be due to invalid IL or missing references)
			//IL_040f: Unknown result type (might be due to invalid IL or missing references)
			//IL_042d: Unknown result type (might be due to invalid IL or missing references)
			_progressVel = 0f;
			_missionUI = new GameObject();
			_missionUI.AddComponent<RectTransform>();
			_missionUI.transform.SetParent(((Component)this).transform);
			_missionUI.GetComponent<RectTransform>().anchorMin = new Vector2(0.5f, 0f);
			_missionUI.GetComponent<RectTransform>().anchorMax = new Vector2(0.5f, 0f);
			_missionUI.GetComponent<RectTransform>().pivot = new Vector2(0.5f, 1f);
			_missionUI.GetComponent<RectTransform>().sizeDelta = new Vector2(300f, 60f);
			GameObject val = new GameObject
			{
				name = "description"
			};
			val.AddComponent<RectTransform>();
			val.AddComponent<TextMeshProUGUI>();
			val.transform.SetParent(_missionUI.transform);
			val.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
			val.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
			val.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
			val.GetComponent<RectTransform>().anchoredPosition = Vector2.op_Implicit(new Vector3(10f, -10f, 0f));
			((TMP_Text)val.GetComponent<TextMeshProUGUI>()).alignment = (TextAlignmentOptions)1025;
			((TMP_Text)val.GetComponent<TextMeshProUGUI>()).font = HGTextMeshProUGUI.defaultLanguageFont;
			((TMP_Text)val.GetComponent<TextMeshProUGUI>()).fontSize = 16.5f;
			GameObject val2 = new GameObject
			{
				name = "progress"
			};
			val2.AddComponent<RectTransform>();
			val2.AddComponent<TextMeshProUGUI>();
			val2.transform.SetParent(_missionUI.transform);
			val2.GetComponent<RectTransform>().anchorMin = new Vector2(1f, 1f);
			val2.GetComponent<RectTransform>().anchorMax = new Vector2(1f, 1f);
			val2.GetComponent<RectTransform>().pivot = new Vector2(1f, 1f);
			val2.GetComponent<RectTransform>().anchoredPosition = Vector2.op_Implicit(new Vector3(-10f, -10f, 0f));
			((TMP_Text)val2.GetComponent<TextMeshProUGUI>()).alignment = (TextAlignmentOptions)1028;
			((TMP_Text)val2.GetComponent<TextMeshProUGUI>()).font = HGTextMeshProUGUI.defaultLanguageFont;
			((TMP_Text)val2.GetComponent<TextMeshProUGUI>()).fontSize = 16.5f;
			GameObject val3 = new GameObject
			{
				name = "progressBarBackground"
			};
			val3.AddComponent<RectTransform>();
			val3.AddComponent<Image>();
			val3.transform.SetParent(val.transform);
			val3.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 0f);
			val3.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 0f);
			val3.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
			val3.GetComponent<RectTransform>().anchoredPosition = Vector2.op_Implicit(new Vector3(0f, -5f, 0f));
			val3.GetComponent<RectTransform>().sizeDelta = new Vector2(_missionUI.GetComponent<RectTransform>().sizeDelta.x - 20f, 8f);
			((Graphic)val3.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0.7f);
			Utils.AddBorder(val3);
			GameObject val4 = new GameObject
			{
				name = "progressBar"
			};
			val4.AddComponent<RectTransform>();
			val4.AddComponent<Image>();
			val4.transform.SetParent(val3.transform);
			val4.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
			val4.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
			val4.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
			val4.GetComponent<RectTransform>().anchoredPosition = Vector2.op_Implicit(new Vector3(0f, 0f, 0f));
			val4.GetComponent<RectTransform>().sizeDelta = val3.GetComponent<RectTransform>().sizeDelta;
			((Transform)val4.GetComponent<RectTransform>()).localScale = new Vector3(0f, 1f, 1f);
		}

		public void UpdateData(Mission mission, int i)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			_mission = mission;
			_missionUI.GetComponent<RectTransform>().anchoredPosition = Vector2.op_Implicit(new Vector3(0f, (float)(-55 * i), 0f));
		}

		private void Update()
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			((TMP_Text)((Component)_missionUI.transform.Find("description")).GetComponent<TextMeshProUGUI>()).text = string.Format(Quest.QuestTypeDict[_mission.MissionType], Language.GetString(_mission.MissionSpecification).RemoveReplacementTokens());
			((Component)_missionUI.transform.Find("description")).GetComponent<RectTransform>().sizeDelta = ((TMP_Text)((Component)_missionUI.transform.Find("description")).GetComponent<TextMeshProUGUI>()).GetPreferredValues();
			((TMP_Text)((Component)_missionUI.transform.Find("progress")).GetComponent<TextMeshProUGUI>()).text = $"{_mission.Progress}/{_mission.Objective}";
			((Component)_missionUI.transform.Find("progress")).GetComponent<RectTransform>().sizeDelta = ((TMP_Text)((Component)_missionUI.transform.Find("progress")).GetComponent<TextMeshProUGUI>()).GetPreferredValues();
			((Component)_missionUI.transform.Find("description").Find("progressBarBackground").Find("progressBar")).transform.localScale = new Vector3(Mathf.SmoothDamp(((Component)_missionUI.transform.Find("description").Find("progressBarBackground").Find("progressBar")).transform.localScale.x, (float)_mission.Progress / (float)_mission.Objective, ref _progressVel, 0.7f), 1f, 1f);
		}

		public void Destroy()
		{
			Object.Destroy((Object)(object)_missionUI);
		}
	}
	public class Quest : MonoBehaviour
	{
		public static readonly Dictionary<MissionType, string> QuestTypeDict = new Dictionary<MissionType, string>
		{
			{
				MissionType.KillAny,
				"Kill any enemies"
			},
			{
				MissionType.KillCommon,
				"Kill common enemies"
			},
			{
				MissionType.KillElite,
				"Kill elite enemies"
			},
			{
				MissionType.KillChampion,
				"Kill champion enemies"
			},
			{
				MissionType.KillFlying,
				"Kill flying enemies"
			},
			{
				MissionType.CollectGold,
				"Collect gold"
			},
			{
				MissionType.KillSpecificName,
				"Kill {0}"
			},
			{
				MissionType.KillSpecificBuff,
				"Kill {0} enemies"
			}
		};

		private readonly GameObject _questUI;

		private readonly GameObject _questTitle;

		private readonly GameObject _rewardBacking;

		private readonly GameObject _rewardText;

		private readonly GameObject _reward;

		private readonly GameObject _timer;

		private float _backgroundVel;

		private readonly float _fadeTime;

		private float _startTime;

		private float _moveVel;

		private float _alphaVel;

		private float _targetX;

		private float _targetAlpha;

		private List<MissionComponent> _missionComponents;

		private bool _finished;

		private UIState _state;

		private QuestData _clientData;

		private Quest()
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Expected O, but got Unknown
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Expected O, but got Unknown
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0323: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_039c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Expected O, but got Unknown
			//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: Unknown result type (might be due to invalid IL or missing references)
			//IL_0437: Unknown result type (might be due to invalid IL or missing references)
			//IL_045b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0460: Unknown result type (might be due to invalid IL or missing references)
			//IL_047f: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b8: Expected O, but got Unknown
			//IL_04ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0506: Unknown result type (might be due to invalid IL or missing references)
			//IL_0520: Unknown result type (might be due to invalid IL or missing references)
			//IL_053f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0544: Unknown result type (might be due to invalid IL or missing references)
			//IL_055e: Unknown result type (might be due to invalid IL or missing references)
			//IL_057d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0588: Unknown result type (might be due to invalid IL or missing references)
			//IL_0592: Expected O, but got Unknown
			//IL_05d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0613: Unknown result type (might be due to invalid IL or missing references)
			//IL_0637: Unknown result type (might be due to invalid IL or missing references)
			//IL_063c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0657: Unknown result type (might be due to invalid IL or missing references)
			//IL_066d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0677: Expected O, but got Unknown
			//IL_06bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_06de: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0721: Unknown result type (might be due to invalid IL or missing references)
			//IL_0726: Unknown result type (might be due to invalid IL or missing references)
			_targetX = Utils.ScreenSize.x * ConfigValues.UI.QuestPositionX;
			_backgroundVel = 0f;
			_fadeTime = 0.7f;
			_finished = false;
			_moveVel = 0f;
			_alphaVel = 0f;
			_targetAlpha = 1f;
			_state = UIState.Creating;
			_questUI = new GameObject();
			_questUI.AddComponent<RectTransform>();
			_questUI.AddComponent<Image>();
			_questUI.AddComponent<CanvasGroup>();
			_questUI.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 0f);
			_questUI.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 0f);
			_questUI.GetComponent<RectTransform>().pivot = new Vector2(0.5f, 1f);
			((Graphic)_questUI.GetComponent<Image>()).color = new Color(0.16f, 0.16f, 0.16f, 0.9f);
			_questUI.GetComponent<CanvasGroup>().alpha = 0f;
			Utils.AddBorder(_questUI);
			_questTitle = new GameObject();
			_questTitle.AddComponent<RectTransform>();
			_questTitle.AddComponent<TextMeshProUGUI>();
			_questTitle.transform.SetParent(_questUI.transform);
			_questTitle.GetComponent<RectTransform>().anchorMin = new Vector2(0.5f, 1f);
			_questTitle.GetComponent<RectTransform>().anchorMax = new Vector2(0.5f, 1f);
			_questTitle.GetComponent<RectTransform>().pivot = new Vector2(0.5f, 1f);
			_questTitle.GetComponent<RectTransform>().anchoredPosition = Vector2.op_Implicit(new Vector3(0f, 0f, 0f));
			((TMP_Text)_questTitle.GetComponent<TextMeshProUGUI>()).alignment = (TextAlignmentOptions)514;
			((TMP_Text)_questTitle.GetComponent<TextMeshProUGUI>()).font = HGTextMeshProUGUI.defaultLanguageFont;
			((TMP_Text)_questTitle.GetComponent<TextMeshProUGUI>()).fontSize = 38f;
			((TMP_Text)_questTitle.GetComponent<TextMeshProUGUI>()).text = "QUEST";
			_questTitle.GetComponent<RectTransform>().sizeDelta = ((TMP_Text)_questTitle.GetComponent<TextMeshProUGUI>()).GetPreferredValues();
			_timer = new GameObject();
			_timer.AddComponent<RectTransform>();
			_timer.AddComponent<TextMeshProUGUI>();
			_timer.transform.SetParent(_questTitle.transform);
			_timer.GetComponent<RectTransform>().anchorMin = new Vector2(0.5f, 0f);
			_timer.GetComponent<RectTransform>().anchorMax = new Vector2(0.5f, 0f);
			_timer.GetComponent<RectTransform>().pivot = new Vector2(0.5f, 1f);
			_timer.GetComponent<RectTransform>().anchoredPosition = Vector2.op_Implicit(new Vector3(0f, 0f, 0f));
			((TMP_Text)_timer.GetComponent<TextMeshProUGUI>()).alignment = (TextAlignmentOptions)514;
			((TMP_Text)_timer.GetComponent<TextMeshProUGUI>()).font = HGTextMeshProUGUI.defaultLanguageFont;
			((TMP_Text)_timer.GetComponent<TextMeshProUGUI>()).fontSize = 20f;
			((TMP_Text)_timer.GetComponent<TextMeshProUGUI>()).text = "Remaining time: 00:00";
			_timer.GetComponent<RectTransform>().sizeDelta = ((TMP_Text)_timer.GetComponent<TextMeshProUGUI>()).GetPreferredValues();
			_rewardBacking = new GameObject();
			_rewardBacking.AddComponent<RectTransform>();
			_rewardBacking.AddComponent<Image>();
			_rewardBacking.transform.SetParent(_timer.transform);
			_rewardBacking.GetComponent<RectTransform>().anchorMin = new Vector2(0.5f, 0f);
			_rewardBacking.GetComponent<RectTransform>().anchorMax = new Vector2(0.5f, 0f);
			_rewardBacking.GetComponent<RectTransform>().pivot = new Vector2(0.5f, 1f);
			_rewardBacking.GetComponent<RectTransform>().anchoredPosition = Vector2.op_Implicit(new Vector3(0f, -10f, 0f));
			_rewardBacking.GetComponent<RectTransform>().sizeDelta = new Vector2(240f, 65f);
			((Graphic)_rewardBacking.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0.5f);
			GameObject val = new GameObject();
			val.AddComponent<RectTransform>();
			val.AddComponent<Image>();
			val.transform.SetParent(_rewardBacking.transform);
			val.GetComponent<RectTransform>().anchorMin = new Vector2(0.5f, 0.5f);
			val.GetComponent<RectTransform>().anchorMax = new Vector2(0.5f, 0.5f);
			val.GetComponent<RectTransform>().pivot = new Vector2(0.5f, 0.5f);
			val.GetComponent<RectTransform>().anchoredPosition = Vector2.op_Implicit(new Vector3(0f, 0f, 0f));
			val.GetComponent<RectTransform>().sizeDelta = new Vector2(72f, 72f);
			((Graphic)val.GetComponent<Image>()).color = new Color(0.16f, 0.16f, 0.16f);
			_reward = new GameObject();
			_reward.AddComponent<RectTransform>();
			_reward.AddComponent<RawImage>();
			_reward.transform.SetParent(val.transform);
			_reward.GetComponent<RectTransform>().anchorMin = new Vector2(0.5f, 0.5f);
			_reward.GetComponent<RectTransform>().anchorMax = new Vector2(0.5f, 0.5f);
			_reward.GetComponent<RectTransform>().pivot = new Vector2(0.5f, 0.5f);
			_reward.GetComponent<RectTransform>().anchoredPosition = Vector2.op_Implicit(new Vector3(0f, 0f, 0f));
			_reward.GetComponent<RectTransform>().sizeDelta = val.GetComponent<RectTransform>().sizeDelta;
			Utils.AddBorder(_reward);
			_rewardText = new GameObject();
			_rewardText.AddComponent<RectTransform>();
			_rewardText.AddComponent<TextMeshProUGUI>();
			_rewardText.transform.SetParent(_reward.transform);
			_rewardText.GetComponent<RectTransform>().anchorMin = new Vector2(0.5f, 0f);
			_rewardText.GetComponent<RectTransform>().anchorMax = new Vector2(0.5f, 0f);
			_rewardText.GetComponent<RectTransform>().pivot = new Vector2(0.5f, 1f);
			_rewardText.GetComponent<RectTransform>().anchoredPosition = Vector2.op_Implicit(new Vector3(0f, -5f, 0f));
			((TMP_Text)_rewardText.GetComponent<TextMeshProUGUI>()).alignment = (TextAlignmentOptions)514;
			((TMP_Text)_rewardText.GetComponent<TextMeshProUGUI>()).font = HGTextMeshProUGUI.defaultLanguageFont;
			((TMP_Text)_rewardText.GetComponent<TextMeshProUGUI>()).fontSize = 20f;
		}

		public void UpdateData(QuestData newQuestData)
		{
			_clientData = newQuestData;
		}

		private void Update()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0486: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0509: Unknown result type (might be due to invalid IL or missing references)
			//IL_051e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0533: Unknown result type (might be due to invalid IL or missing references)
			//IL_054f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0575: Unknown result type (might be due to invalid IL or missing references)
			//IL_0590: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0464: Unknown result type (might be due to invalid IL or missing references)
			if (_clientData == null)
			{
				return;
			}
			switch (_state)
			{
			case UIState.Creating:
			{
				PickupDef pickupDef = PickupCatalog.GetPickupDef(_clientData.Reward);
				if (pickupDef == null)
				{
					RpgMod.Log.LogWarning((object)$"PickupDef {_clientData.Reward} is null.");
					return;
				}
				((TMP_Text)_rewardText.GetComponent<TextMeshProUGUI>()).text = Language.GetString(pickupDef.nameToken);
				_rewardText.GetComponent<RectTransform>().sizeDelta = ((TMP_Text)_rewardText.GetComponent<TextMeshProUGUI>()).GetPreferredValues();
				((Graphic)_rewardText.GetComponent<TextMeshProUGUI>()).color = pickupDef.baseColor;
				_reward.GetComponent<RawImage>().texture = pickupDef.iconTexture;
				_missionComponents = new List<MissionComponent>();
				for (int i = 0; i < _clientData.Missions.Count; i++)
				{
					MissionComponent missionComponent = _rewardText.AddComponent<MissionComponent>();
					missionComponent.Index = i;
					_missionComponents.Add(missionComponent);
				}
				_questUI.transform.SetParent(((Component)this).transform);
				_questUI.GetComponent<RectTransform>().sizeDelta = new Vector2(300f, _timer.GetComponent<RectTransform>().sizeDelta.y + _questTitle.GetComponent<RectTransform>().sizeDelta.y + 27f + _rewardBacking.GetComponent<RectTransform>().sizeDelta.y + (float)(55 * _clientData.Missions.Count) + _rewardText.GetComponent<RectTransform>().sizeDelta.y);
				((Transform)_questUI.GetComponent<RectTransform>()).localPosition = new Vector3(0f, 0f, 0f);
				_questUI.GetComponent<RectTransform>().anchoredPosition = new Vector2(Utils.ScreenSize.x * ConfigValues.UI.QuestPositionX + 60f, Utils.ScreenSize.y * ConfigValues.UI.QuestPositionY);
				((Transform)_questUI.GetComponent<RectTransform>()).localScale = new Vector3(Utils.HudScale, Utils.HudScale, Utils.HudScale);
				((TMP_Text)_timer.GetComponent<TextMeshProUGUI>()).text = "Time limit: 00:00";
				((Graphic)_timer.GetComponent<TextMeshProUGUI>()).color = Color.white;
				_state = UIState.Updating;
				break;
			}
			case UIState.Updating:
			{
				if ((_clientData.Complete || _clientData.Failed) && !_finished)
				{
					_startTime = Run.instance.GetRunStopwatch();
					_targetAlpha = 0f;
					_targetX = Utils.ScreenSize.x * ConfigValues.UI.QuestPositionX + 60f;
					_finished = true;
				}
				float num = Math.Max(0f, _clientData.LimitTime - Run.instance.GetRunStopwatch());
				if (_clientData.Failed || num == 0f)
				{
					((TMP_Text)_timer.GetComponent<TextMeshProUGUI>()).text = "QUEST FAILED";
					((Graphic)_timer.GetComponent<TextMeshProUGUI>()).color = Color.red;
					for (int num2 = _missionComponents.Count - 1; num2 >= 0; num2--)
					{
						_missionComponents[num2].Destroy();
						Object.Destroy((Object)(object)_missionComponents[num2]);
						_missionComponents.RemoveAt(num2);
					}
				}
				else
				{
					for (int num3 = _missionComponents.Count - 1; num3 >= 0; num3--)
					{
						_missionComponents[num3].UpdateData(_clientData.Missions[_missionComponents[num3].Index], num3);
						if (_clientData.Missions[_missionComponents[num3].Index].IsCompleted)
						{
							_missionComponents[num3].Destroy();
							Object.Destroy((Object)(object)_missionComponents[num3]);
							_missionComponents.RemoveAt(num3);
						}
					}
					((TMP_Text)_timer.GetComponent<TextMeshProUGUI>()).text = $"Time limit: {TimeSpan.FromSeconds(num):mm':'ss}";
					if (num < 60f)
					{
						((Graphic)_timer.GetComponent<TextMeshProUGUI>()).color = Color.red;
					}
				}
				RectTransform component = _questUI.GetComponent<RectTransform>();
				_questUI.GetComponent<RectTransform>().anchoredPosition = new Vector2(Mathf.SmoothDamp(component.anchoredPosition.x, _targetX, ref _moveVel, _fadeTime), Utils.ScreenSize.y * ConfigValues.UI.QuestPositionY);
				_questUI.GetComponent<CanvasGroup>().alpha = Mathf.SmoothDamp(_questUI.GetComponent<CanvasGroup>().alpha, _targetAlpha, ref _alphaVel, _fadeTime);
				_questUI.GetComponent<RectTransform>().sizeDelta = new Vector2(300f, Mathf.SmoothDamp(component.sizeDelta.y, _timer.GetComponent<RectTransform>().sizeDelta.y + _questTitle.GetComponent<RectTransform>().sizeDelta.y + 27f + _rewardBacking.GetComponent<RectTransform>().sizeDelta.y + (float)(55 * _missionComponents.Count) + _rewardText.GetComponent<RectTransform>().sizeDelta.y, ref _backgroundVel, 0.7f));
				((Component)_questUI.transform.Find("border")).GetComponent<RectTransform>().sizeDelta = new Vector2(component.sizeDelta.x + 2f, component.sizeDelta.y + 2f);
				break;
			}
			}
			if (_finished && Run.instance.GetRunStopwatch() - _startTime >= _fadeTime + 0.5f)
			{
				Destroy();
			}
		}

		public void Destroy()
		{
			Object.Destroy((Object)(object)_questUI);
			Object.Destroy((Object)(object)this);
		}
	}
	internal enum UIState
	{
		Creating,
		Updating
	}
	public static class Utils
	{
		public static AssetBundle AssetBundle;

		public static Vector2 ScreenSize;

		public static bool IsReady;

		public static float HudScale { get; private set; }

		public static IEnumerator Setup()
		{
			IsReady = false;
			BaseConVar val = Console.instance.FindConVar("hud_scale");
			if (ConfigValues.UI.UseHUDScale)
			{
				float num = default(float);
				if (val != null && TextSerialization.TryParseInvariant(val.GetString(), ref num))
				{
					HudScale = num / 100f;
				}
			}
			else
			{
				HudScale = ConfigValues.UI.HUDScaleOverride;
			}
			while (!IsReady)
			{
				yield return (object)new WaitForSeconds(0.1f);
				if (LocalUserManager.GetFirstLocalUser() == null)
				{
					continue;
				}
				LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
				object obj;
				if (firstLocalUser == null)
				{
					obj = null;
				}
				else
				{
					CameraRigController cameraRigController = firstLocalUser.cameraRigController;
					obj = ((cameraRigController != null) ? cameraRigController.hud : null);
				}
				if (!((Object)obj == (Object)null))
				{
					LocalUser firstLocalUser2 = LocalUserManager.GetFirstLocalUser();
					Vector2? obj2;
					if (firstLocalUser2 == null)
					{
						obj2 = null;
					}
					else
					{
						CameraRigController cameraRigController2 = firstLocalUser2.cameraRigController;
						obj2 = ((cameraRigController2 != null) ? new Vector2?(((Component)cameraRigController2.hud).GetComponent<RectTransform>().sizeDelta) : null);
					}
					ScreenSize = (Vector2)(((??)obj2) ?? new Vector2(0f, 0f));
					if (!(ScreenSize.x <= 1f) && !(ScreenSize.y <= 1f))
					{
						IsReady = true;
					}
				}
			}
		}

		public static void AddBorder(GameObject element)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_00af: 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_00d3: 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)
			GameObject val = new GameObject
			{
				name = "border"
			};
			val.AddComponent<RectTransform>();
			val.AddComponent<Image>();
			val.transform.SetParent(element.transform);
			val.GetComponent<RectTransform>().anchorMin = new Vector2(0.5f, 0.5f);
			val.GetComponent<RectTransform>().anchorMax = new Vector2(0.5f, 0.5f);
			val.GetComponent<RectTransform>().pivot = new Vector2(0.5f, 0.5f);
			val.GetComponent<RectTransform>().sizeDelta = new Vector2(element.GetComponent<RectTransform>().sizeDelta.x + 2f, element.GetComponent<RectTransform>().sizeDelta.y + 2f);
			val.GetComponent<RectTransform>().anchoredPosition = Vector2.op_Implicit(new Vector3(0f, 0f, 0f));
			val.GetComponent<Image>().sprite = Object.Instantiate<Sprite>(AssetBundle.LoadAsset<Sprite>("Assets/UIBorder.png"));
			val.GetComponent<Image>().type = (Type)1;
		}
	}
}
namespace RPGMod.SoftDependencies
{
	internal static class DependenciesManager
	{
		public const string RiskOfOptionsGuid = "com.rune580.riskofoptions";

		public static bool IsRiskOfOptionsPresent;

		public static void CheckForDependencies()
		{
			IsRiskOfOptionsPresent = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");
		}
	}
	internal static class RiskOfOptionsHelper
	{
		private const string GUID = "RPGMod";

		private const string ModName = "RPGMod";

		public static void RegisterModInfo(string description, Sprite iconSprite = null)
		{
			if (DependenciesManager.IsRiskOfOptionsPresent)
			{
				ModSettingsManager.SetModDescription(description, "RPGMod", "RPGMod");
				if ((Object)(object)iconSprite != (Object)null)
				{
					ModSettingsManager.SetModIcon(iconSprite, "RPGMod", "RPGMod");
				}
			}
		}

		public static ConfigEntry<int> AddOptionSlider(this ConfigEntry<int> configEntry, bool restartRequired = false)
		{
			int min = int.MinValue;
			int max = int.MaxValue;
			if (((ConfigEntryBase)configEntry).Description.AcceptableValues != null && ((object)((ConfigEntryBase)configEntry).Description.AcceptableValues).GetType() == typeof(AcceptableValueRange<int>))
			{
				AcceptableValueRange<int> obj = ((ConfigEntryBase)configEntry).Description.AcceptableValues as AcceptableValueRange<int>;
				min = obj.MinValue;
				max = obj.MaxValue;
			}
			return AddOptionSlider(configEntry, min, max, restartRequired);
		}

		public static ConfigEntry<int> AddOptionSlider(ConfigEntry<int> configEntry, int min, int max, bool restartRequired = false)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			if (!DependenciesManager.IsRiskOfOptionsPresent)
			{
				return configEntry;
			}
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(configEntry, new IntSliderConfig
			{
				min = min,
				max = max,
				restartRequired = restartRequired
			}), "RPGMod", "RPGMod");
			return configEntry;
		}

		public static ConfigEntry<float> AddOptionSlider(this ConfigEntry<float> configEntry, bool restartRequired = false)
		{
			float min = float.MinValue;
			float max = float.MaxValue;
			if (((ConfigEntryBase)configEntry).Description.AcceptableValues != null && ((object)((ConfigEntryBase)configEntry).Description.AcceptableValues).GetType() == typeof(AcceptableValueRange<float>))
			{
				AcceptableValueRange<float> obj = ((ConfigEntryBase)configEntry).Description.AcceptableValues as AcceptableValueRange<float>;
				min = obj.MinValue;
				max = obj.MaxValue;
			}
			return AddOptionSlider(configEntry, min, max, restartRequired);
		}

		public static ConfigEntry<float> AddOptionSlider(ConfigEntry<float> configEntry, float min, float max, bool restartRequired = false)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			if (!DependenciesManager.IsRiskOfOptionsPresent)
			{
				return configEntry;
			}
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(configEntry, new StepSliderConfig
			{
				min = min,
				max = max,
				increment = 0.1f,
				restartRequired = restartRequired
			}), "RPGMod", "RPGMod");
			return configEntry;
		}

		public static ConfigEntry<bool> AddOptionBool(this ConfigEntry<bool> configEntry, bool restartRequired = false)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			if (!DependenciesManager.IsRiskOfOptionsPresent)
			{
				return configEntry;
			}
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(configEntry, restartRequired), "RPGMod", "RPGMod");
			return configEntry;
		}

		public static ConfigEntry<string> AddOptionString(this ConfigEntry<string> configEntry, bool restartRequired = false)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_0022: Expected O, but got Unknown
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			if (!DependenciesManager.IsRiskOfOptionsPresent)
			{
				return configEntry;
			}
			ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(configEntry, new InputFieldConfig
			{
				submitOn = (SubmitEnum)6,
				restartRequired = restartRequired
			}), "RPGMod", "RPGMod");
			return configEntry;
		}
	}
}
namespace RPGMod.Questing
{
	public class Announcement : MessageBase
	{
		public string Message { get; private set; }

		public Announcement()
		{
			Message = null;
		}

		public Announcement(string message)
		{
			Message = message;
		}

		public override void Serialize(NetworkWriter writer)
		{
			writer.Write(Message);
		}

		public override void Deserialize(NetworkReader reader)
		{
			Message = reader.ReadString();
		}

		public static void Handler(NetworkMessage networkMessage)
		{
			Client.Announcements.Add(networkMessage.ReadMessage<Announcement>());
		}
	}
	public static class Blacklist
	{
		private static ItemMask _cachedAvailableItems = new ItemMask();

		private static ItemMask _blacklistedItems = new ItemMask();

		private static readonly List<PickupIndex> _availableTier1DropList = new List<PickupIndex>();

		private static readonly List<PickupIndex> _availableTier2DropList = new List<PickupIndex>();

		private static readonly List<PickupIndex> _availableTier3DropList = new List<PickupIndex>();

		public static List<PickupIndex> AvailableTier1DropList => Get(_availableTier1DropList);

		public static List<PickupIndex> AvailableTier2DropList => Get(_availableTier2DropList);

		public static List<PickupIndex> AvailableTier3DropList => Get(_availableTier3DropList);

		public static void ClearCache()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Expected O, but got Unknown
			_cachedAvailableItems = new ItemMask();
		}

		private static void LoadBlackListItems()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Expected O, but got Unknown
			//IL_0017: Unknown result type