Decompiled source of PvPBiomeDominions v1.6.6

PvPBiomeDominions.dll

Decompiled 19 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using Groups;
using Guilds;
using HarmonyLib;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis;
using PvPBiomeDominions.Helpers;
using PvPBiomeDominions.Helpers.WardIsLove;
using PvPBiomeDominions.PositionManagement;
using PvPBiomeDominions.PositionManagement.UI;
using PvPBiomeDominions.PvPManagement;
using PvPBiomeDominions.RPC;
using PvPBiomeDominions.RulesManagement;
using PvPBiomeDominions.TombstoneManagement;
using ServerSync;
using Splatform;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("PvPBiomeDominions")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PvPBiomeDominions")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("11065244-3969-420d-b128-c28acbaa0aa9")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
[PublicAPI]
public static class Marketplace_API
{
	[Flags]
	public enum TerritoryFlags
	{
		None = 0,
		PushAway = 1,
		NoBuild = 2,
		NoPickaxe = 4,
		NoInteract = 8,
		NoAttack = 0x10,
		PvpOnly = 0x20,
		PveOnly = 0x40,
		PeriodicHeal = 0x80,
		PeriodicDamage = 0x100,
		IncreasedPlayerDamage = 0x200,
		IncreasedMonsterDamage = 0x400,
		NoMonsters = 0x800,
		CustomEnvironment = 0x1000,
		MoveSpeedMultiplier = 0x2000,
		NoDeathPenalty = 0x4000,
		NoPortals = 0x8000,
		PeriodicHealALL = 0x10000,
		ForceGroundHeight = 0x20000,
		ForceBiome = 0x40000,
		AddGroundHeight = 0x80000,
		NoBuildDamage = 0x100000,
		MonstersAddStars = 0x200000,
		InfiniteFuel = 0x400000,
		NoInteractItems = 0x800000,
		NoInteractCraftingStation = 0x1000000,
		NoInteractItemStands = 0x2000000,
		NoInteractChests = 0x4000000,
		NoInteractDoors = 0x8000000,
		NoStructureSupport = 0x10000000,
		NoInteractPortals = 0x20000000,
		CustomPaint = 0x40000000,
		LimitZoneHeight = int.MinValue
	}

	[Flags]
	public enum AdditionalTerritoryFlags
	{
		None = 0,
		NoItemLoss = 1,
		SnowMask = 2,
		NoMist = 4,
		InfiniteEitr = 8,
		InfiniteStamina = 0x10,
		DropMultiplier = 0x20,
		ForceWind = 0x40,
		GodMode = 0x80
	}

	public enum API_NPCType
	{
		None,
		Trader,
		Info,
		Teleporter,
		Feedback,
		Banker,
		Gambler,
		Quests,
		Buffer,
		Transmog,
		Marketplace
	}

	private static readonly bool _IsInstalled;

	private static readonly MethodInfo MI_IsPlayerInsideTerritory;

	private static readonly MethodInfo MI_IsObjectInsideTerritoryWithFlag;

	private static readonly MethodInfo MI_IsObjectInsideTerritoryWithFlag_Additional;

	private static readonly MethodInfo MI_ResetTraderItems;

	private static readonly MethodInfo MI_OpenQuestJournal;

	public static bool IsInstalled()
	{
		return _IsInstalled;
	}

	public static bool IsPlayerInsideTerritory(out string name, out TerritoryFlags flags, out AdditionalTerritoryFlags additionalFlags)
	{
		flags = TerritoryFlags.None;
		additionalFlags = AdditionalTerritoryFlags.None;
		name = "";
		if (!_IsInstalled || MI_IsPlayerInsideTerritory == null)
		{
			return false;
		}
		object[] array = new object[3] { "", 0, 0 };
		bool result = (bool)MI_IsPlayerInsideTerritory.Invoke(null, array);
		name = (string)array[0];
		flags = (TerritoryFlags)array[1];
		additionalFlags = (AdditionalTerritoryFlags)array[2];
		return result;
	}

	public static bool IsObjectInsideTerritoryWithFlag(GameObject go, TerritoryFlags flag, out string name, out TerritoryFlags flags, out AdditionalTerritoryFlags additionalFlags)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		return IsPointInsideTerritoryWithFlag(go.transform.position, flag, out name, out flags, out additionalFlags);
	}

	public static bool IsObjectInsideTerritoryWithFlag(GameObject go, AdditionalTerritoryFlags flag, out string name, out TerritoryFlags flags, out AdditionalTerritoryFlags additionalFlags)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		return IsPointInsideTerritoryWithFlag(go.transform.position, flag, out name, out flags, out additionalFlags);
	}

	public static bool IsPointInsideTerritoryWithFlag(Vector3 pos, TerritoryFlags flag, out string name, out TerritoryFlags flags, out AdditionalTerritoryFlags additionalFlags)
	{
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		name = "";
		flags = TerritoryFlags.None;
		additionalFlags = AdditionalTerritoryFlags.None;
		if (!_IsInstalled || MI_IsObjectInsideTerritoryWithFlag == null)
		{
			return false;
		}
		object[] array = new object[5]
		{
			pos,
			(int)flag,
			"",
			0,
			0
		};
		bool result = (bool)MI_IsObjectInsideTerritoryWithFlag.Invoke(null, array);
		name = (string)array[2];
		flags = (TerritoryFlags)array[3];
		additionalFlags = (AdditionalTerritoryFlags)array[4];
		return result;
	}

	public static bool IsPointInsideTerritoryWithFlag(Vector3 pos, AdditionalTerritoryFlags flag, out string name, out TerritoryFlags flags, out AdditionalTerritoryFlags additionalFlags)
	{
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		name = "";
		flags = TerritoryFlags.None;
		additionalFlags = AdditionalTerritoryFlags.None;
		if (!_IsInstalled || MI_IsObjectInsideTerritoryWithFlag_Additional == null)
		{
			return false;
		}
		object[] array = new object[5]
		{
			pos,
			(int)flag,
			"",
			0,
			0
		};
		bool result = (bool)MI_IsObjectInsideTerritoryWithFlag_Additional.Invoke(null, array);
		name = (string)array[2];
		flags = (TerritoryFlags)array[3];
		additionalFlags = (AdditionalTerritoryFlags)array[4];
		return result;
	}

	public static void ResetTraderItems()
	{
		if (_IsInstalled && !(MI_ResetTraderItems == null))
		{
			MI_ResetTraderItems.Invoke(null, null);
		}
	}

	public static void OpenQuestJournal()
	{
		if (_IsInstalled && !(MI_OpenQuestJournal == null))
		{
			MI_OpenQuestJournal.Invoke(null, null);
		}
	}

	public static void SET_NPC_Type(this ZDO zdo, API_NPCType type)
	{
		zdo.Set("KGmarketNPC", (int)type);
	}

	public static void SET_NPC_Profile(this ZDO zdo, string profile)
	{
		zdo.Set("KGnpcProfile", profile);
	}

	public static void SET_NPC_Model(this ZDO zdo, string prefab)
	{
		zdo.Set("KGnpcModelOverride", prefab);
	}

	public static void SET_NPC_Name(this ZDO zdo, string name)
	{
		zdo.Set("KGnpcNameOverride", name);
	}

	public static void SET_NPC_Dialogue(this ZDO zdo, string dialogue)
	{
		zdo.Set("KGnpcDialogue", dialogue);
	}

	public static void SET_NPC_PatrolData(this ZDO zdo, string patrolData)
	{
		zdo.Set("KGmarket PatrolData", patrolData);
	}

	public static void SET_NPC_LeftItem(this ZDO zdo, string prefab)
	{
		zdo.Set("KGleftItem", prefab);
	}

	public static void SET_NPC_RightItem(this ZDO zdo, string prefab)
	{
		zdo.Set("KGrightItem", prefab);
	}

	public static void SET_NPC_HelmetItem(this ZDO zdo, string prefab)
	{
		zdo.Set("KGhelmetItem", prefab);
	}

	public static void SET_NPC_ChestItem(this ZDO zdo, string prefab)
	{
		zdo.Set("KGchestItem", prefab);
	}

	public static void SET_NPC_LegsItem(this ZDO zdo, string prefab)
	{
		zdo.Set("KGlegsItem", prefab);
	}

	public static void SET_NPC_CapeItem(this ZDO zdo, string prefab)
	{
		zdo.Set("KGcapeItem", prefab);
	}

	public static void SET_NPC_HairItem(this ZDO zdo, string prefab)
	{
		zdo.Set("KGhairItem", prefab);
	}

	public static void SET_NPC_HairColor(this ZDO zdo, string color)
	{
		zdo.Set("KGhairItemColor", color);
	}

	public static void SET_NPC_LeftItemBack(this ZDO zdo, string prefab)
	{
		zdo.Set("KGLeftItemBack", prefab);
	}

	public static void SET_NPC_RightItemBack(this ZDO zdo, string prefab)
	{
		zdo.Set("KGRightItemBack", prefab);
	}

	public static void SET_NPC_InteractAnimation(this ZDO zdo, string animation)
	{
		zdo.Set("KGinteractAnimation", animation);
	}

	public static void SET_NPC_GreetingAnimation(this ZDO zdo, string animation)
	{
		zdo.Set("KGgreetingAnimation", animation);
	}

	public static void SET_NPC_ByeAnimation(this ZDO zdo, string animation)
	{
		zdo.Set("KGbyeAnimation", animation);
	}

	public static void SET_NPC_GreetingText(this ZDO zdo, string text)
	{
		zdo.Set("KGgreetingText", text);
	}

	public static void SET_NPC_ByeText(this ZDO zdo, string text)
	{
		zdo.Set("KGbyeText", text);
	}

	public static void SET_NPC_SkinColor(this ZDO zdo, string color)
	{
		zdo.Set("KGskinColor", color);
	}

	public static void SET_NPC_CraftingAnimation(this ZDO zdo, string animation)
	{
		zdo.Set("KGcraftingAnimation", animation);
	}

	public static void SET_NPC_BeardItem(this ZDO zdo, string prefab)
	{
		zdo.Set("KGbeardItem", prefab);
	}

	public static void SET_NPC_BeardColor(this ZDO zdo, string color)
	{
		zdo.Set("KGbeardColor", color);
	}

	public static void SET_NPC_InteractSound(this ZDO zdo, string sound)
	{
		zdo.Set("KGinteractSound", sound);
	}

	public static void SET_NPC_TextSize(this ZDO zdo, string size)
	{
		zdo.Set("KGtextSize", float.TryParse(size, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var result) ? result : 3f);
	}

	public static void SET_NPC_TextHeight(this ZDO zdo, string height)
	{
		zdo.Set("KGtextHeight", float.TryParse(height, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var result) ? result : 0f);
	}

	public static void SET_NPC_PeriodicAnimation(this ZDO zdo, string animation)
	{
		zdo.Set("KGperiodicAnimation", animation);
	}

	public static void SET_NPC_PeriodicAnimationTime(this ZDO zdo, string time)
	{
		zdo.Set("KGperiodicAnimationTime", float.TryParse(time, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var result) ? result : 0f);
	}

	public static void SET_NPC_PeriodicSound(this ZDO zdo, string sound)
	{
		zdo.Set("KGperiodicSound", sound);
	}

	public static void SET_NPC_PeriodicSoundTime(this ZDO zdo, string time)
	{
		zdo.Set("KGperiodicSoundTime", float.TryParse(time, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var result) ? result : 0f);
	}

	public static void SET_NPC_NPCScale(this ZDO zdo, string scale)
	{
		zdo.Set("KGnpcScale", float.TryParse(scale, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var result) ? result : 1f);
	}

	public static void SET_NPC_IsPinned(this ZDO zdo, bool pinned)
	{
		zdo.Set("KGmarketPinned", pinned);
	}

	public static void SET_NPC_PinIcon(this ZDO zdo, string pinIcon)
	{
		zdo.Set("KGmarketPinIcon", string.IsNullOrWhiteSpace(pinIcon) ? "" : pinIcon);
	}

	public static API_NPCType GET_NPC_Type(this ZDO zdo)
	{
		return (API_NPCType)zdo.GetInt("KGmarketNPC", 0);
	}

	public static string GET_NPC_Profile(this ZDO zdo)
	{
		return zdo.GetString("KGnpcProfile", "default");
	}

	public static string GET_NPC_Model(this ZDO zdo)
	{
		return zdo.GetString("KGnpcModelOverride", "");
	}

	public static string GET_NPC_Name(this ZDO zdo)
	{
		return zdo.GetString("KGnpcNameOverride", "");
	}

	public static string GET_NPC_Dialogue(this ZDO zdo)
	{
		return zdo.GetString("KGnpcDialogue", "");
	}

	public static string GET_NPC_PatrolData(this ZDO zdo)
	{
		return zdo.GetString("KGmarket PatrolData", "");
	}

	public static bool GET_NPC_IsPinned(this ZDO zdo)
	{
		return zdo.GetBool("KGmarketPinned", false);
	}

	public static string GET_NPC_PinIcon(this ZDO zdo)
	{
		return zdo.GetString("KGmarketPinIcon", "");
	}

	public static string GET_NPC_LeftItem(this ZDO zdo)
	{
		return zdo.GetString("KGleftItem", "");
	}

	public static string GET_NPC_RightItem(this ZDO zdo)
	{
		return zdo.GetString("KGrightItem", "");
	}

	public static string GET_NPC_HelmetItem(this ZDO zdo)
	{
		return zdo.GetString("KGhelmetItem", "");
	}

	public static string GET_NPC_ChestItem(this ZDO zdo)
	{
		return zdo.GetString("KGchestItem", "");
	}

	public static string GET_NPC_LegsItem(this ZDO zdo)
	{
		return zdo.GetString("KGlegsItem", "");
	}

	public static string GET_NPC_CapeItem(this ZDO zdo)
	{
		return zdo.GetString("KGcapeItem", "");
	}

	public static string GET_NPC_HairItem(this ZDO zdo)
	{
		return zdo.GetString("KGhairItem", "");
	}

	public static string GET_NPC_HairColor(this ZDO zdo)
	{
		return zdo.GetString("KGhairItemColor", "");
	}

	public static string GET_NPC_LeftItemBack(this ZDO zdo)
	{
		return zdo.GetString("KGLeftItemBack", "");
	}

	public static string GET_NPC_RightItemBack(this ZDO zdo)
	{
		return zdo.GetString("KGRightItemBack", "");
	}

	public static string GET_NPC_InteractAnimation(this ZDO zdo)
	{
		return zdo.GetString("KGinteractAnimation", "");
	}

	public static string GET_NPC_GreetingAnimation(this ZDO zdo)
	{
		return zdo.GetString("KGgreetingAnimation", "");
	}

	public static string GET_NPC_ByeAnimation(this ZDO zdo)
	{
		return zdo.GetString("KGbyeAnimation", "");
	}

	public static string GET_NPC_GreetingText(this ZDO zdo)
	{
		return zdo.GetString("KGgreetingText", "");
	}

	public static string GET_NPC_ByeText(this ZDO zdo)
	{
		return zdo.GetString("KGbyeText", "");
	}

	public static string GET_NPC_SkinColor(this ZDO zdo)
	{
		return zdo.GetString("KGskinColor", "");
	}

	public static string GET_NPC_CraftingAnimation(this ZDO zdo)
	{
		return zdo.GetString("KGcraftingAnimation", "");
	}

	public static string GET_NPC_BeardItem(this ZDO zdo)
	{
		return zdo.GetString("KGbeardItem", "");
	}

	public static string GET_NPC_BeardColor(this ZDO zdo)
	{
		return zdo.GetString("KGbeardColor", "");
	}

	public static string GET_NPC_InteractSound(this ZDO zdo)
	{
		return zdo.GetString("KGinteractSound", "");
	}

	public static float GET_NPC_TextSize(this ZDO zdo)
	{
		return zdo.GetFloat("KGtextSize", 3f);
	}

	public static float GET_NPC_TextHeight(this ZDO zdo)
	{
		return zdo.GetFloat("KGtextHeight", 0f);
	}

	public static string GET_NPC_PeriodicAnimation(this ZDO zdo)
	{
		return zdo.GetString("KGperiodicAnimation", "");
	}

	public static float GET_NPC_PeriodicAnimationTime(this ZDO zdo)
	{
		return zdo.GetFloat("KGperiodicAnimationTime", 0f);
	}

	public static string GET_NPC_PeriodicSound(this ZDO zdo)
	{
		return zdo.GetString("KGperiodicSound", "");
	}

	public static float GET_NPC_PeriodicSoundTime(this ZDO zdo)
	{
		return zdo.GetFloat("KGperiodicSoundTime", 0f);
	}

	public static float GET_NPC_NPCScale(this ZDO zdo)
	{
		return zdo.GetFloat("KGnpcScale", 1f);
	}

	static Marketplace_API()
	{
		Type type = Type.GetType("API.ClientSide, kg.Marketplace");
		if ((object)type == null)
		{
			_IsInstalled = false;
			return;
		}
		_IsInstalled = true;
		MI_IsPlayerInsideTerritory = type.GetMethod("IsPlayerInsideTerritory", BindingFlags.Static | BindingFlags.Public);
		MI_IsObjectInsideTerritoryWithFlag = type.GetMethod("IsObjectInsideTerritoryWithFlag", BindingFlags.Static | BindingFlags.Public);
		MI_IsObjectInsideTerritoryWithFlag_Additional = type.GetMethod("IsObjectInsideTerritoryWithFlag_Additional", BindingFlags.Static | BindingFlags.Public);
		MI_ResetTraderItems = type.GetMethod("ResetTraderItems", BindingFlags.Static | BindingFlags.Public);
		MI_OpenQuestJournal = type.GetMethod("OpenQuestJournal", BindingFlags.Static | BindingFlags.Public);
	}
}
namespace PvPBiomeDominions
{
	internal class ConfigurationFile
	{
		public enum Toggle
		{
			On = 1,
			Off = 0
		}

		private static ConfigEntry<bool> _serverConfigLocked = null;

		public static ConfigEntry<bool> debug;

		public static ConfigEntry<Vector2> mapPlayersListPosition;

		public static ConfigEntry<Vector2> mapPlayersListSize;

		public static ConfigEntry<bool> mapPinColoring;

		public static ConfigEntry<int> maxPlayerNamesCharactersInList;

		public static ConfigEntry<Toggle> showMessageWhenLootingYourTombstone;

		public static ConfigEntry<DeathPinMapRule> pveDeathPinMapRule;

		public static ConfigEntry<DeathPinMapRule> pvpDeathPinMapRule;

		public static ConfigFile configFile;

		private static readonly string ConfigFileName = "Turbero.PvPBiomeDominions.cfg";

		private static readonly string ConfigFileFullPath;

		public static readonly ConfigSync ConfigSync;

		public static ConfigEntry<Toggle> pvpAdminExempt;

		public static ConfigEntry<PvPWardRule> pvpRuleInWards;

		public static ConfigEntry<PvPBiomeRule> pvpRuleInMeadows;

		public static ConfigEntry<PvPBiomeRule> pvpRuleInBlackForest;

		public static ConfigEntry<PvPBiomeRule> pvpRuleInSwamp;

		public static ConfigEntry<PvPBiomeRule> pvpRuleInMountain;

		public static ConfigEntry<PvPBiomeRule> pvpRuleInPlains;

		public static ConfigEntry<PvPBiomeRule> pvpRuleInMistlands;

		public static ConfigEntry<PvPBiomeRule> pvpRuleInAshlands;

		public static ConfigEntry<PvPBiomeRule> pvpRuleInDeepNorth;

		public static ConfigEntry<PvPBiomeRule> pvpRuleInOcean;

		public static ConfigEntry<float> waitingTimeBeforeUpdatingBiomePvPStatus;

		public static ConfigEntry<float> waitingTimeAfterDyingToFightPlayersAgain;

		public static ConfigEntry<string> tombstoneLootAlertMessage;

		public static ConfigEntry<string> tombstoneDestroyAlertMessage;

		public static ConfigEntry<string> forbidLootOtherTombstonesMessage;

		public static ConfigEntry<int> pvpMinimapPlayersListRefresh;

		public static ConfigEntry<Toggle> dayMessageOff;

		public static ConfigEntry<Toggle> positionAdminExempt;

		public static ConfigEntry<PositionSharingWardRule> positionRuleInWards;

		public static ConfigEntry<PositionSharingBiomeRule> positionRuleInMeadows;

		public static ConfigEntry<PositionSharingBiomeRule> positionRuleInBlackForest;

		public static ConfigEntry<PositionSharingBiomeRule> positionRuleInSwamp;

		public static ConfigEntry<PositionSharingBiomeRule> positionRuleInMountain;

		public static ConfigEntry<PositionSharingBiomeRule> positionRuleInPlains;

		public static ConfigEntry<PositionSharingBiomeRule> positionRuleInMistlands;

		public static ConfigEntry<PositionSharingBiomeRule> positionRuleInAshlands;

		public static ConfigEntry<PositionSharingBiomeRule> positionRuleInDeepNorth;

		public static ConfigEntry<PositionSharingBiomeRule> positionRuleInOcean;

		public static ConfigEntry<Toggle> pvpWackyEpicMMOLevelDifferenceLimitEnabled;

		public static ConfigEntry<int> pvpWackyEpicMMOLevelDifferenceLimitValue;

		public static ConfigEntry<string> pvpRuleInCustomBiomes;

		public static ConfigEntry<string> positionRuleInCustomBiomes;

		public static ConfigEntry<string> wardCreationForbiddenInCustomBiomes;

		public static ConfigEntry<string> playersListPanelButtonText;

		public static ConfigEntry<string> playersMapListTitle;

		public static ConfigEntry<string> wardCreationNotAllowed;

		public static ConfigEntry<string> pvpSpawnProtection;

		public static ConfigEntry<string> pvpSpawnProtectionDescription;

		public static ConfigEntry<string> greenSkullPlayersMapList;

		public static ConfigEntry<string> redSkullPlayersMapList;

		public static ConfigEntry<Toggle> wardCreationInMeadows;

		public static ConfigEntry<Toggle> wardCreationInBlackForest;

		public static ConfigEntry<Toggle> wardCreationInSwamp;

		public static ConfigEntry<Toggle> wardCreationInMountain;

		public static ConfigEntry<Toggle> wardCreationInPlains;

		public static ConfigEntry<Toggle> wardCreationInMistlands;

		public static ConfigEntry<Toggle> wardCreationInAshlands;

		public static ConfigEntry<Toggle> wardCreationInDeepNorth;

		public static ConfigEntry<Toggle> wardCreationInOcean;

		public static ConfigEntry<string> wardModsPrefabIds;

		public static ConfigEntry<Toggle> pveAllowLootOtherTombstones;

		public static ConfigEntry<Toggle> pveNoItemLoss;

		public static ConfigEntry<Toggle> pveKeepEquipped;

		public static ConfigEntry<Toggle> pveKeepHotbar;

		public static ConfigEntry<string> pveExceptionPrefabIds;

		public static ConfigEntry<Toggle> pvpAllowLootOtherTombstones;

		public static ConfigEntry<Toggle> pvpNoItemLoss;

		public static ConfigEntry<Toggle> pvpKeepEquipped;

		public static ConfigEntry<Toggle> pvpKeepHotbar;

		public static ConfigEntry<string> pvpExceptionPrefabIds;

		internal static void LoadConfig(BaseUnityPlugin plugin)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Expected O, but got Unknown
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Expected O, but got Unknown
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Expected O, but got Unknown
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Expected O, but got Unknown
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Expected O, but got Unknown
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Expected O, but got Unknown
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Expected O, but got Unknown
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Expected O, but got Unknown
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Expected O, but got Unknown
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Expected O, but got Unknown
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Expected O, but got Unknown
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Expected O, but got Unknown
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Expected O, but got Unknown
			//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Expected O, but got Unknown
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Expected O, but got Unknown
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Expected O, but got Unknown
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Expected O, but got Unknown
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: Expected O, but got Unknown
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a8: Expected O, but got Unknown
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ce: Expected O, but got Unknown
			//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f4: Expected O, but got Unknown
			//IL_040f: Unknown result type (might be due to invalid IL or missing references)
			//IL_041a: Expected O, but got Unknown
			//IL_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_0440: Expected O, but got Unknown
			//IL_045b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0466: Expected O, but got Unknown
			//IL_0481: Unknown result type (might be due to invalid IL or missing references)
			//IL_048c: Expected O, but got Unknown
			//IL_04a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b2: Expected O, but got Unknown
			//IL_04cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d8: Expected O, but got Unknown
			//IL_04f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fe: Expected O, but got Unknown
			//IL_0519: Unknown result type (might be due to invalid IL or missing references)
			//IL_0524: Expected O, but got Unknown
			//IL_0540: Unknown result type (might be due to invalid IL or missing references)
			//IL_054b: Expected O, but got Unknown
			//IL_056a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0575: Expected O, but got Unknown
			//IL_0594: Unknown result type (might be due to invalid IL or missing references)
			//IL_059f: Expected O, but got Unknown
			//IL_05be: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c9: Expected O, but got Unknown
			//IL_05e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f3: Expected O, but got Unknown
			//IL_0612: Unknown result type (might be due to invalid IL or missing references)
			//IL_061d: Expected O, but got Unknown
			//IL_063c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0647: Expected O, but got Unknown
			//IL_0666: Unknown result type (might be due to invalid IL or missing references)
			//IL_0671: Expected O, but got Unknown
			//IL_0690: Unknown result type (might be due to invalid IL or missing references)
			//IL_069b: Expected O, but got Unknown
			//IL_06ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c5: Expected O, but got Unknown
			//IL_06e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ef: Expected O, but got Unknown
			//IL_070e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0719: Expected O, but got Unknown
			//IL_0738: Unknown result type (might be due to invalid IL or missing references)
			//IL_0743: Expected O, but got Unknown
			//IL_0762: Unknown result type (might be due to invalid IL or missing references)
			//IL_076d: Expected O, but got Unknown
			//IL_0788: Unknown result type (might be due to invalid IL or missing references)
			//IL_0793: Expected O, but got Unknown
			//IL_07ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b9: Expected O, but got Unknown
			//IL_07d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07df: Expected O, but got Unknown
			//IL_07fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0805: Expected O, but got Unknown
			//IL_0820: Unknown result type (might be due to invalid IL or missing references)
			//IL_082b: Expected O, but got Unknown
			//IL_0846: Unknown result type (might be due to invalid IL or missing references)
			//IL_0851: Expected O, but got Unknown
			//IL_086c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0877: Expected O, but got Unknown
			//IL_0892: Unknown result type (might be due to invalid IL or missing references)
			//IL_089d: Expected O, but got Unknown
			//IL_08b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c3: Expected O, but got Unknown
			//IL_08e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ed: Expected O, but got Unknown
			//IL_0908: Unknown result type (might be due to invalid IL or missing references)
			//IL_0913: Expected O, but got Unknown
			//IL_092e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0939: Expected O, but got Unknown
			//IL_0954: Unknown result type (might be due to invalid IL or missing references)
			//IL_095f: Expected O, but got Unknown
			//IL_097a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0985: Expected O, but got Unknown
			//IL_09a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ab: Expected O, but got Unknown
			//IL_09ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d5: Expected O, but got Unknown
			//IL_09f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_09fb: Expected O, but got Unknown
			//IL_0a16: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a21: Expected O, but got Unknown
			//IL_0a3c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a47: Expected O, but got Unknown
			//IL_0a62: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a6d: Expected O, but got Unknown
			//IL_0a88: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a93: Expected O, but got Unknown
			//IL_0ab2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0abd: Expected O, but got Unknown
			//IL_0ad8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ae3: Expected O, but got Unknown
			configFile = plugin.Config;
			_serverConfigLocked = config("1 - General", "Lock Configuration", value: true, new ConfigDescription("If on, the configuration is locked and can be changed by server admins only.", (AcceptableValueBase)null, Array.Empty<object>()));
			ConfigSync.AddLockingConfigEntry<bool>(_serverConfigLocked);
			debug = config("1 - General", "DebugMode", value: false, new ConfigDescription("Enabling/Disabling the debugging in the console (default = false)", (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting: false);
			mapPlayersListPosition = config<Vector2>("1 - General", "Map Players List Position", new Vector2(-563f, 100f), new ConfigDescription("Left corner position for the map players list (default: x=-568, y=100)", (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting: false);
			mapPlayersListSize = config<Vector2>("1 - General", "Map Players List Size", new Vector2(440f, 620f), new ConfigDescription("Width/Height for the map players list size (default: x=420, y=620)", (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting: false);
			mapPinColoring = config("1 - General", "Map Pins PvP Coloring", value: true, new ConfigDescription("Enable/disable the pins coloring in the player maps according to their pvp status", (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting: false);
			maxPlayerNamesCharactersInList = config("1 - General", "Max Player Names Number of Characters In List", 15, new ConfigDescription("Limits the player name shown in the map players list and replace by '...' when too long to avoid overlap with other elements", (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting: false);
			pvpMinimapPlayersListRefresh = config("1 - General", "Map Players List Refresh", 10, new ConfigDescription("Time in seconds to refresh the players list in the map.", (AcceptableValueBase)null, Array.Empty<object>()));
			dayMessageOff = config("1 - General", "Turn off Day Message", Toggle.Off, new ConfigDescription("If on, the mod will disable the day count message when attempting to display it on the player's screen.", (AcceptableValueBase)null, Array.Empty<object>()));
			pvpAdminExempt = config("2 - PvP Settings", "Admin Exempt", Toggle.On, new ConfigDescription("If on, server admins can bypass the pvp biomes rules.", (AcceptableValueBase)null, Array.Empty<object>()));
			pvpRuleInWards = config("2 - PvP Settings", "PvP Rule In Wards (override biome)", PvPWardRule.FollowBiomeRule, new ConfigDescription("Set up the pvp rule inside wards, overriding biome rules if it's needed. Possible values: Pvp,Pve,PlayerChoice,FollowBiomeRule", (AcceptableValueBase)null, Array.Empty<object>()));
			pvpRuleInMeadows = config("2 - PvP Settings", "Biome 1 - Meadows Rule", PvPBiomeRule.Pvp, new ConfigDescription("Set up the pvp rule in Meadows. Possible values: Pvp,Pve,PlayerChoice.", (AcceptableValueBase)null, Array.Empty<object>()));
			pvpRuleInBlackForest = config("2 - PvP Settings", "Biome 2 - Black Forest Rule", PvPBiomeRule.Pvp, new ConfigDescription("Set up the pvp rule in Black Forest. Possible values: Pvp,Pve,PlayerChoice.", (AcceptableValueBase)null, Array.Empty<object>()));
			pvpRuleInSwamp = config("2 - PvP Settings", "Biome 3 - Swamp Rule", PvPBiomeRule.Pvp, new ConfigDescription("Set up the pvp rule in Swamp. Possible values: Pvp,Pve,PlayerChoice.", (AcceptableValueBase)null, Array.Empty<object>()));
			pvpRuleInMountain = config("2 - PvP Settings", "Biome 4 - Mountain Rule", PvPBiomeRule.Pvp, new ConfigDescription("Set up the pvp rule in Mountain. Possible values: Pvp,Pve,PlayerChoice.", (AcceptableValueBase)null, Array.Empty<object>()));
			pvpRuleInPlains = config("2 - PvP Settings", "Biome 5 - Plains Rule", PvPBiomeRule.Pvp, new ConfigDescription("Set up the pvp rule in Plains. Possible values: Pvp,Pve,PlayerChoice.", (AcceptableValueBase)null, Array.Empty<object>()));
			pvpRuleInMistlands = config("2 - PvP Settings", "Biome 6 - Mistlands Rule", PvPBiomeRule.Pvp, new ConfigDescription("Set up the pvp rule in Mistlands. Possible values: Pvp,Pve,PlayerChoice.", (AcceptableValueBase)null, Array.Empty<object>()));
			pvpRuleInAshlands = config("2 - PvP Settings", "Biome 7 - Ashlands Rule", PvPBiomeRule.Pvp, new ConfigDescription("Set up the pvp rule in Ashlands. Possible values: Pvp,Pve,PlayerChoice.", (AcceptableValueBase)null, Array.Empty<object>()));
			pvpRuleInDeepNorth = config("2 - PvP Settings", "Biome 8 - Deep North Rule", PvPBiomeRule.Pvp, new ConfigDescription("Set up the pvp rule in Deep North. Possible values: Pvp,Pve,PlayerChoice.", (AcceptableValueBase)null, Array.Empty<object>()));
			pvpRuleInOcean = config("2 - PvP Settings", "Biome 9 - Ocean Rule", PvPBiomeRule.Pvp, new ConfigDescription("Set up the pvp rule in Ocean. Possible values: Pvp,Pve,PlayerChoice.", (AcceptableValueBase)null, Array.Empty<object>()));
			waitingTimeBeforeUpdatingBiomePvPStatus = config("2 - PvP Settings", "Waiting Time Before Updating Biome PvP Status (seconds)", 0f, new ConfigDescription("Set up the waiting time before swapping to PvE or PvP area and take effect", (AcceptableValueBase)null, Array.Empty<object>()));
			waitingTimeAfterDyingToFightPlayersAgain = config("2 - PvP Settings", "Waiting Time After Dying To Fight Players Again (minutes)", 5f, new ConfigDescription("Grant a grace period before people can kill you or you can kill them again", (AcceptableValueBase)null, Array.Empty<object>()));
			positionAdminExempt = config("3 - Map Position", "Admin Exempt", Toggle.On, new ConfigDescription("If on, server admins can bypass the 'Position Always On' rule.", (AcceptableValueBase)null, Array.Empty<object>()));
			positionRuleInWards = config("3 - Map Position", "Position Rule In Wards (override biome)", PositionSharingWardRule.FollowBiomeRule, new ConfigDescription("Set up the position sharing in wards, overriding biome rules if it's needed. Possible values: HidePlayer,ShowPlayer,PlayerChoice,FollowBiomeRule", (AcceptableValueBase)null, Array.Empty<object>()));
			positionRuleInMeadows = config("3 - Map Position", "Biome 1 - Meadows Rule", PositionSharingBiomeRule.ShowPlayer, new ConfigDescription("Set up the position sharing rule in Meadows. Possible values: HidePlayer,ShowPlayer,PlayerChoice.", (AcceptableValueBase)null, Array.Empty<object>()));
			positionRuleInBlackForest = config("3 - Map Position", "Biome 2 - Black Forest Rule", PositionSharingBiomeRule.ShowPlayer, new ConfigDescription("Set up the position sharing in Black Forest. Possible values: HidePlayer,ShowPlayer,PlayerChoice.", (AcceptableValueBase)null, Array.Empty<object>()));
			positionRuleInSwamp = config("3 - Map Position", "Biome 3 - Swamp Rule", PositionSharingBiomeRule.ShowPlayer, new ConfigDescription("Set up the position sharing in Swamp. Possible values: HidePlayer,ShowPlayer,PlayerChoice.", (AcceptableValueBase)null, Array.Empty<object>()));
			positionRuleInMountain = config("3 - Map Position", "Biome 4 - Mountain Rule", PositionSharingBiomeRule.ShowPlayer, new ConfigDescription("Set up the position sharing in Mountain. Possible values: HidePlayer,ShowPlayer,PlayerChoice.", (AcceptableValueBase)null, Array.Empty<object>()));
			positionRuleInPlains = config("3 - Map Position", "Biome 5 - Plains Rule", PositionSharingBiomeRule.ShowPlayer, new ConfigDescription("Set up the position sharing in Plains. Possible values: HidePlayer,ShowPlayer,PlayerChoice.", (AcceptableValueBase)null, Array.Empty<object>()));
			positionRuleInMistlands = config("3 - Map Position", "Biome 6 - Mistlands Rule", PositionSharingBiomeRule.ShowPlayer, new ConfigDescription("Set up the position sharing in Mistlands. Possible values: HidePlayer,ShowPlayer,PlayerChoice.", (AcceptableValueBase)null, Array.Empty<object>()));
			positionRuleInAshlands = config("3 - Map Position", "Biome 7 - Ashlands Rule", PositionSharingBiomeRule.ShowPlayer, new ConfigDescription("Set up the position sharing in Ashlands. Possible values: HidePlayer,ShowPlayer,PlayerChoice.", (AcceptableValueBase)null, Array.Empty<object>()));
			positionRuleInDeepNorth = config("3 - Map Position", "Biome 8 - Deep North Rule", PositionSharingBiomeRule.ShowPlayer, new ConfigDescription("Set up the position sharing in Deep North. Possible values: HidePlayer,ShowPlayer,PlayerChoice.", (AcceptableValueBase)null, Array.Empty<object>()));
			positionRuleInOcean = config("3 - Map Position", "Biome 9 - Ocean Rule", PositionSharingBiomeRule.ShowPlayer, new ConfigDescription("Set up the position sharing in Ocean. Possible values: HidePlayer,ShowPlayer,PlayerChoice.", (AcceptableValueBase)null, Array.Empty<object>()));
			pvpWackyEpicMMOLevelDifferenceLimitEnabled = config("4 - Mods integration", "Max Level Difference to damage in PvP areas - Activation", Toggle.Off, new ConfigDescription("Activate the limits the difference of levels between players to damage each other in pvp areas.", (AcceptableValueBase)null, Array.Empty<object>()));
			pvpWackyEpicMMOLevelDifferenceLimitValue = config("4 - Mods integration", "Max Level Difference to damage in PvP areas - Value", 100, new ConfigDescription("Limits the difference of levels between players to damage each other in pvp areas (default = 100).", (AcceptableValueBase)null, Array.Empty<object>()));
			pvpRuleInCustomBiomes = config("4 - Mods integration", "Custom Biomes - PvP Rules", "", new ConfigDescription("Semicolon-separated list of custom biome pvp rules. Use colon to indicate the rule. Examples: Wonderland:Pve;Warland:Pvp;Doubtland:PlayerChoose", (AcceptableValueBase)null, Array.Empty<object>()));
			positionRuleInCustomBiomes = config("4 - Mods integration", "Custom Biomes - Position Sharing Rules", "", new ConfigDescription("Semicolon-separated list of position sharing custom biome rules. Use colon to indicate the rule. Examples: Wonderland:ShowPlayer;Warland:HidePlayer;Doubtland:PlayerChoice", (AcceptableValueBase)null, Array.Empty<object>()));
			wardCreationForbiddenInCustomBiomes = config("4 - Mods integration", "Custom Biomes - Ward forbidden", "", new ConfigDescription("Comma-separated list of custom biomes where wards are forbidden. Example: Warland,AmazoniaLand", (AcceptableValueBase)null, Array.Empty<object>()));
			playersListPanelButtonText = config("5 - Translations", "Players List Panel Button Text", "Show/Hide list", new ConfigDescription("Button name used to show/hide the players panel list in the minimap.", (AcceptableValueBase)null, Array.Empty<object>()));
			playersMapListTitle = config("5 - Translations", "Players Map List Title", "Players", new ConfigDescription("Title of the map players list with connected count.", (AcceptableValueBase)null, Array.Empty<object>()));
			wardCreationNotAllowed = config("5 - Translations", "Ward Creation Not Allowed", "Ward Creation is not allowed in this biome", new ConfigDescription("Title of the map players list with connected count.", (AcceptableValueBase)null, Array.Empty<object>()));
			pvpSpawnProtection = config("5 - Translations", "PvP Spawn Protection", "PvP Spawn Protection", new ConfigDescription("Title of the pvp protection buff text after dying by a player.", (AcceptableValueBase)null, Array.Empty<object>()));
			pvpSpawnProtectionDescription = config("5 - Translations", "PvP Spawn Protection Description", "You are temporarily immune to PvP damage.", new ConfigDescription("Description of the pvp protection buff text after dying by a player.", (AcceptableValueBase)null, Array.Empty<object>()));
			greenSkullPlayersMapList = config("5 - Translations", "Players Map List Green Skull Tooltip", "Number of times you killed this player.", new ConfigDescription("Tooltip text of the green skull icon in the map players list.", (AcceptableValueBase)null, Array.Empty<object>()));
			redSkullPlayersMapList = config("5 - Translations", "Players Map List Red Skull Tooltip", "Number of times you were killed by this player.", new ConfigDescription("Tooltip text of the red skull icon in the map players list.", (AcceptableValueBase)null, Array.Empty<object>()));
			tombstoneLootAlertMessage = config("5 - Translations", "Tombstone Looting Alert Message", "<color=red>{0} is looting your tombstone!</color>", new ConfigDescription("Shows alert on tombstone owner screen when being looted by a different player", (AcceptableValueBase)null, Array.Empty<object>()));
			tombstoneDestroyAlertMessage = config("5 - Translations", "Tombstone Destroy Alert Message", "<color=red>{0} sacked and destroyed your tombstone!</color>", new ConfigDescription("Shows alert on tombstone owner screen when destroyed by a different player", (AcceptableValueBase)null, Array.Empty<object>()));
			forbidLootOtherTombstonesMessage = config("5 - Translations", "Forbid Loot Other Tombstones Message", "Looting other tombstones is <color=red>FORBIDDEN</color> in this biome!", new ConfigDescription("Message to show when tombstones cannot be looted in the current biome.", (AcceptableValueBase)null, Array.Empty<object>()));
			wardCreationInMeadows = config("6 - Ward Creation", "Ward Creation 1 - Meadows Rule", Toggle.On, new ConfigDescription("Enable/disable if the player can place wards in Meadows.", (AcceptableValueBase)null, Array.Empty<object>()));
			wardCreationInBlackForest = config("6 - Ward Creation", "Ward Creation 2 - Black Forest Rule", Toggle.On, new ConfigDescription("Enable/disable if the player can place wards in Black Forest.", (AcceptableValueBase)null, Array.Empty<object>()));
			wardCreationInSwamp = config("6 - Ward Creation", "Ward Creation 3 - Swamp Rule", Toggle.On, new ConfigDescription("Enable/disable if the player can place wards in Swamp.", (AcceptableValueBase)null, Array.Empty<object>()));
			wardCreationInMountain = config("6 - Ward Creation", "Ward Creation 4 - Mountain Rule", Toggle.On, new ConfigDescription("Enable/disable if the player can place wards in Mountains.", (AcceptableValueBase)null, Array.Empty<object>()));
			wardCreationInPlains = config("6 - Ward Creation", "Ward Creation 5 - Plains Rule", Toggle.On, new ConfigDescription("Enable/disable if the player can place wards in Plains.", (AcceptableValueBase)null, Array.Empty<object>()));
			wardCreationInMistlands = config("6 - Ward Creation", "Ward Creation 6 - Mistlands Rule", Toggle.On, new ConfigDescription("Enable/disable if the player can place wards in Mistlands.", (AcceptableValueBase)null, Array.Empty<object>()));
			wardCreationInAshlands = config("6 - Ward Creation", "Ward Creation 7 - Ashlands Rule", Toggle.On, new ConfigDescription("Enable/disable if the player can place wards in Ashlands.", (AcceptableValueBase)null, Array.Empty<object>()));
			wardCreationInDeepNorth = config("6 - Ward Creation", "Ward Creation 8 - Deep North Rule", Toggle.On, new ConfigDescription("Enable/disable if the player can place wards in Deep North.", (AcceptableValueBase)null, Array.Empty<object>()));
			wardCreationInOcean = config("6 - Ward Creation", "Ward Creation 9 - Ocean Rule", Toggle.On, new ConfigDescription("Enable/disable if the player can place wards in Ocean.", (AcceptableValueBase)null, Array.Empty<object>()));
			wardModsPrefabIds = config("6 - Ward Creation", "Ward Creation Mods PrefabIds", "Thorward", new ConfigDescription("Comma-separated list of extra ward pieces from other mods to include in the ward creation check (default = Thorward).", (AcceptableValueBase)null, Array.Empty<object>()));
			showMessageWhenLootingYourTombstone = config("7 - Tombstones", "Show Message When Looting Your Tombstone", Toggle.On, new ConfigDescription("Enable/disable showing alert in your screen when your tombstone is being looted.", (AcceptableValueBase)null, Array.Empty<object>()));
			pveAllowLootOtherTombstones = config("7.1 - Tombstones PvE", "PvE - Allow Loot Other Tombstones", Toggle.On, new ConfigDescription("If on, in PvE areas all tombstones can be looted.", (AcceptableValueBase)null, Array.Empty<object>()));
			pveNoItemLoss = config("7.1 - Tombstones PvE", "PvE - No Items Loss On Death", Toggle.Off, new ConfigDescription("If on, in PvE areas no items will be lost upon death by all means whatsoever and hence tombstone won't be created.", (AcceptableValueBase)null, Array.Empty<object>()));
			pveKeepEquipped = config("7.1 - Tombstones PvE", "PvE - Keep Equipped Items On Death", Toggle.Off, new ConfigDescription("If on, in PvE areas equipped items such as armors, weapons, utilities... will keep with the dead player and won't go to the tombstone.", (AcceptableValueBase)null, Array.Empty<object>()));
			pveKeepHotbar = config("7.1 - Tombstones PvE", "PvE - Keep Hotbar Items On Death", Toggle.Off, new ConfigDescription("If on, in PvE areas items in the hotbar from slot 1 to 8 will keep with the dead player and won't go to the tombstone.", (AcceptableValueBase)null, Array.Empty<object>()));
			pveExceptionPrefabIds = config("7.1 - Tombstones PvE", "PvE - Exception PrefabIds", "", new ConfigDescription("Comma-separated list with prefab ids of items that will still go to the tombstone despite the set rules in PvE areas.", (AcceptableValueBase)null, Array.Empty<object>()));
			pveDeathPinMapRule = config("7.1 - Tombstones PvE", "Death Pin Map Rule in PvE", DeathPinMapRule.Default, new ConfigDescription("Enable/disable how to remove your death pin in the map automatically in pve biomes.", (AcceptableValueBase)null, Array.Empty<object>()));
			pvpAllowLootOtherTombstones = config("7.2 - Tombstones PvP", "PvP - Allow Loot Other Tombstones", Toggle.On, new ConfigDescription("If on, in PvP areas all tombstones can be looted.", (AcceptableValueBase)null, Array.Empty<object>()));
			pvpNoItemLoss = config("7.2 - Tombstones PvP", "PvP - No Items Loss On Death", Toggle.Off, new ConfigDescription("If on, in PvP areas no items will be lost upon death by all means whatsoever and hence tombstone won't be created.", (AcceptableValueBase)null, Array.Empty<object>()));
			pvpKeepEquipped = config("7.2 - Tombstones PvP", "PvP - Keep Equipped Items On Death", Toggle.Off, new ConfigDescription("If on, in PvP areas equipped items such as armors, weapons, utilities... will keep with the dead player and won't go to the tombstone.", (AcceptableValueBase)null, Array.Empty<object>()));
			pvpKeepHotbar = config("7.2 - Tombstones PvP", "PvP - Keep Hotbar Items On Death", Toggle.Off, new ConfigDescription("If on, in PvP areas items in the hotbar from slot 1 to 8 will keep with the dead player and won't go to the tombstone.", (AcceptableValueBase)null, Array.Empty<object>()));
			pvpExceptionPrefabIds = config("7.2 - Tombstones PvP", "PvP - Exception PrefabIds", "", new ConfigDescription("Comma-separated list with prefab ids of items that will still go to the tombstone despite the set rules in PvP areas.", (AcceptableValueBase)null, Array.Empty<object>()));
			pvpDeathPinMapRule = config("7.2 - Tombstones PvP", "Death Pin Map Rule in PvP", DeathPinMapRule.Default, new ConfigDescription("Enable/disable how to remove your death pin in the map automatically in pvp biomes.", (AcceptableValueBase)null, Array.Empty<object>()));
			SetupWatcher();
		}

		private static void SetupWatcher()
		{
			FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Paths.ConfigPath, ConfigFileName);
			fileSystemWatcher.Changed += ReadConfigValues;
			fileSystemWatcher.Created += ReadConfigValues;
			fileSystemWatcher.Renamed += ReadConfigValues;
			fileSystemWatcher.IncludeSubdirectories = true;
			fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject;
			fileSystemWatcher.EnableRaisingEvents = true;
		}

		private static void ReadConfigValues(object sender, FileSystemEventArgs e)
		{
			if (!File.Exists(ConfigFileFullPath))
			{
				return;
			}
			try
			{
				Logger.Log("Attempting to reload configuration...");
				configFile.Reload();
				SettingsChanged(null, null);
			}
			catch
			{
				Logger.LogError("There was an issue loading " + ConfigFileName);
			}
		}

		private static void SettingsChanged(object sender, EventArgs e)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			if (MinimapUpdatePatch.panel != null)
			{
				((TMP_Text)((Component)MinimapUpdatePatch.panel.showHidePanelButton).GetComponentInChildren<TextMeshProUGUI>()).text = playersListPanelButtonText.Value;
				MinimapUpdatePatch.panel.panelRT.anchoredPosition = mapPlayersListPosition.Value;
				MinimapUpdatePatch.panel.panelRT.sizeDelta = mapPlayersListSize.Value;
			}
			if (!((Object)(object)Player.m_localPlayer != (Object)null))
			{
				return;
			}
			if (waitingTimeAfterDyingToFightPlayersAgain.Value > 0f)
			{
				foreach (StatusEffect statusEffect in ((Character)Player.m_localPlayer).GetSEMan().GetStatusEffects())
				{
					if (((Object)statusEffect).name.Equals("SE_PvPSpawnImmunity"))
					{
						statusEffect.m_name = pvpSpawnProtection.Value;
						statusEffect.m_tooltip = pvpSpawnProtectionDescription.Value;
						statusEffect.m_ttl = Math.Max(0.01f, waitingTimeAfterDyingToFightPlayersAgain.Value * 60f);
					}
				}
				return;
			}
			foreach (StatusEffect statusEffect2 in ((Character)Player.m_localPlayer).GetSEMan().GetStatusEffects())
			{
				if (((Object)statusEffect2).name.Equals("SE_PvPSpawnImmunity"))
				{
					statusEffect2.m_ttl = 0.01f;
				}
			}
		}

		private static ConfigEntry<T> config<T>(string group, string name, T value, string description, bool synchronizedSetting = true)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			return config(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting);
		}

		private static ConfigEntry<T> config<T>(string group, string name, T value, ConfigDescription description, bool synchronizedSetting = true)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			ConfigDescription val = new ConfigDescription(description.Description + (synchronizedSetting ? " [Synced with Server]" : " [Not Synced with Server]"), description.AcceptableValues, description.Tags);
			ConfigEntry<T> val2 = configFile.Bind<T>(group, name, value, val);
			SyncedConfigEntry<T> syncedConfigEntry = ConfigSync.AddConfigEntry<T>(val2);
			syncedConfigEntry.SynchronizedConfig = synchronizedSetting;
			return val2;
		}

		static ConfigurationFile()
		{
			string configPath = Paths.ConfigPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			ConfigFileFullPath = configPath + directorySeparatorChar + ConfigFileName;
			ConfigSync = new ConfigSync("Turbero.PvPBiomeDominions")
			{
				DisplayName = "PvP Biome Dominions",
				CurrentVersion = "1.6.6",
				MinimumRequiredVersion = "1.6.6"
			};
		}
	}
	public static class Logger
	{
		public static ManualLogSource logger = Logger.CreateLogSource("PvP Biome Dominions");

		internal static void Log(object s)
		{
			if (ConfigurationFile.debug.Value)
			{
				logger.LogInfo((object)s?.ToString());
			}
		}

		internal static void LogInfo(object s)
		{
			logger.LogInfo((object)s?.ToString());
		}

		internal static void LogWarning(object s)
		{
			string text = "PvP Biome Dominions 1.6.6: " + ((s != null) ? s.ToString() : "null");
			Debug.LogWarning((object)text);
		}

		internal static void LogError(object s)
		{
			string text = "PvP Biome Dominions 1.6.6: " + ((s != null) ? s.ToString() : "null");
			Debug.LogError((object)text);
		}
	}
	[BepInPlugin("Turbero.PvPBiomeDominions", "PvP Biome Dominions", "1.6.6")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class PvPBiomeDominions : BaseUnityPlugin
	{
		public const string GUID = "Turbero.PvPBiomeDominions";

		public const string NAME = "PvP Biome Dominions";

		public const string VERSION = "1.6.6";

		private readonly Harmony harmony = new Harmony("Turbero.PvPBiomeDominions");

		private void Awake()
		{
			ConfigurationFile.LoadConfig((BaseUnityPlugin)(object)this);
			harmony.PatchAll();
		}

		private void onDestroy()
		{
			harmony.UnpatchSelf();
		}
	}
	[HarmonyPatch]
	public class NoWarnings
	{
		[HarmonyPatch(typeof(Debug), "LogWarning", new Type[]
		{
			typeof(object),
			typeof(Object)
		})]
		[HarmonyPrefix]
		private static bool LogWarning(object message, Object context)
		{
			if (message.ToString().Contains("The LiberationSans SDF Font Asset was not found") || message.ToString().Contains("The character used for Ellipsis is not available in font asset"))
			{
				return false;
			}
			return true;
		}
	}
}
namespace PvPBiomeDominions.TombstoneManagement
{
	[HarmonyPatch(typeof(Player), "CreateTombStone")]
	internal static class TombstoneRulesPatch
	{
		[HarmonyPriority(700)]
		private static void Prefix(Player __instance, out Dictionary<ItemData, bool> __state)
		{
			List<ItemData> list = new List<ItemData>();
			__state = new Dictionary<ItemData, bool>();
			object privateValue = GameManager.GetPrivateValue(__instance, "m_inventory");
			Inventory obj = (Inventory)((privateValue is Inventory) ? privateValue : null);
			List<ItemData> list2 = GameManager.GetPrivateValue(obj, "m_inventory") as List<ItemData>;
			List<string> list3 = (((Character)__instance).IsPVPEnabled() ? (from x in ConfigurationFile.pvpExceptionPrefabIds.Value.Split(new char[1] { ',' })
				select (x)).ToList() : (from x in ConfigurationFile.pveExceptionPrefabIds.Value.Split(new char[1] { ',' })
				select (x)).ToList());
			if (list3.Count > 0)
			{
				Logger.Log("This list will be excluded: " + list3);
			}
			foreach (ItemData item in list2)
			{
				string prefabName = Utils.GetPrefabName(item.m_dropPrefab);
				bool flag = item.m_gridPos.y == 0;
				string text = (flag ? "hotbar" : "inventory");
				bool flagByPvPStatus = getFlagByPvPStatus("noItemLoss", __instance);
				bool flag2 = item.m_equipped && getFlagByPvPStatus("keepEquipped", __instance);
				bool flag3 = flag && getFlagByPvPStatus("keepHotbar", __instance);
				bool flag4 = list3.Contains(prefabName);
				if ((flagByPvPStatus || flag2 || flag3) && !flag4)
				{
					__state.Add(item, item.m_equipped);
					string reason = getReason(flagByPvPStatus, flag2);
					Logger.Log("Keeping " + prefabName + " in " + text + " due to the " + reason + ".");
				}
				else
				{
					list.Add(item);
					Logger.Log("Dropping " + prefabName + " from " + text + (flag4 ? " (excluded)" : "") + ".");
				}
			}
			GameManager.SetPrivateValue(obj, "m_inventory", list);
		}

		private static bool getFlagByPvPStatus(string configName, Player player)
		{
			if (((Character)player).IsPVPEnabled())
			{
				if (configName.Equals("noItemLoss"))
				{
					return ConfigurationFile.pvpNoItemLoss.Value == ConfigurationFile.Toggle.On;
				}
				if (configName.Equals("keepEquipped"))
				{
					return ConfigurationFile.pvpKeepEquipped.Value == ConfigurationFile.Toggle.On;
				}
				if (configName.Equals("keepHotbar"))
				{
					return ConfigurationFile.pvpKeepHotbar.Value == ConfigurationFile.Toggle.On;
				}
			}
			else
			{
				if (configName.Equals("noItemLoss"))
				{
					return ConfigurationFile.pveNoItemLoss.Value == ConfigurationFile.Toggle.On;
				}
				if (configName.Equals("keepEquipped"))
				{
					return ConfigurationFile.pveKeepEquipped.Value == ConfigurationFile.Toggle.On;
				}
				if (configName.Equals("keepHotbar"))
				{
					return ConfigurationFile.pveKeepHotbar.Value == ConfigurationFile.Toggle.On;
				}
			}
			return false;
		}

		private static string getReason(bool itemLossFlag, bool keepEquippedFlag)
		{
			return itemLossFlag ? "noItemLoss setting" : (keepEquippedFlag ? "keepEquipped setting" : "keepHotbar setting");
		}

		[HarmonyPriority(100)]
		private static void Postfix(Player __instance, Dictionary<ItemData, bool> __state)
		{
			object privateValue = GameManager.GetPrivateValue(__instance, "m_inventory");
			Inventory obj = (Inventory)((privateValue is Inventory) ? privateValue : null);
			List<ItemData> list = GameManager.GetPrivateValue(obj, "m_inventory") as List<ItemData>;
			foreach (KeyValuePair<ItemData, bool> item in __state)
			{
				string name = ((Object)item.Key.m_dropPrefab).name;
				Logger.Log("Adding " + name + " back to inventory.");
				list?.Add(item.Key);
				Logger.Log($"Item {name} was equipped: {item.Value}");
				if (item.Value && (!name.StartsWith("BBH") || !name.EndsWith("Quiver")))
				{
					Logger.Log("REequipping item " + name);
					((Humanoid)__instance).UnequipItem(item.Key, false);
					((Humanoid)__instance).EquipItem(item.Key, false);
				}
			}
			typeof(Inventory).GetMethod("Changed", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(obj, null);
		}
	}
	public enum DeathPinMapRule
	{
		Default,
		RemoveWhenLootingOrEmpty,
		NoPins
	}
	internal class PinManagement
	{
		public static DeathPinMapRule GetCurrentDeathPinMapRule()
		{
			switch (PvPRuleManagement.getCurrentBiomeRulePvPRule())
			{
			case PvPBiomeRule.Pvp:
				return ConfigurationFile.pvpDeathPinMapRule.Value;
			case PvPBiomeRule.Pve:
				return ConfigurationFile.pveDeathPinMapRule.Value;
			default:
				if ((Object)(object)Player.m_localPlayer == (Object)null)
				{
					Logger.Log("Local player null! Default...");
					return DeathPinMapRule.Default;
				}
				return ((Character)Player.m_localPlayer).IsPVPEnabled() ? ConfigurationFile.pvpDeathPinMapRule.Value : ConfigurationFile.pveDeathPinMapRule.Value;
			}
		}

		public static void RemovePlayerPin(Component __instance)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Invalid comparison between Unknown and I4
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			PinData val = FindPlayerPin(__instance.transform.position, 10f);
			if (val == null || (int)val.m_type != 4)
			{
				val = FindPlayerPin(__instance.transform.position, 5f);
			}
			if (val != null)
			{
				Logger.Log("Removing pin '" + val.m_name + "'");
				bool flag = ((Object)(object)Chat.instance == (Object)null || !Chat.instance.HasFocus()) && !Console.IsVisible() && !TextInput.IsVisible() && !Menu.IsVisible() && !InventoryGui.IsVisible();
				float deltaTime = Time.deltaTime;
				Minimap.instance.SetMapMode((MapMode)2);
				Minimap.instance.RemovePin(val);
				GameManager.RunPrivateMethod(Minimap.instance, "UpdateMap", new object[3]
				{
					Player.m_localPlayer,
					deltaTime,
					flag
				});
				GameManager.RunPrivateMethod(Minimap.instance, "UpdateDynamicPins", new object[1] { deltaTime });
				GameManager.RunPrivateMethod(Minimap.instance, "UpdatePins");
				GameManager.RunPrivateMethod(Minimap.instance, "UpdateBiome", new object[1] { Player.m_localPlayer });
				GameManager.RunPrivateMethod(Minimap.instance, "UpdateNameInput");
				GameManager.RunPrivateMethod(Minimap.instance, "UpdatePlayerPins", new object[1] { deltaTime });
				Minimap.instance.SetMapMode((MapMode)0);
			}
		}

		private static PinData FindPlayerPin(Vector3 pos, float radius)
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			PinData val = null;
			float num = 999999f;
			List<PinData> list = (List<PinData>)GameManager.GetPrivateValue(Minimap.instance, "m_pins");
			foreach (PinData item in list)
			{
				if (item.m_save && (Object)(object)item.m_uiElement != (Object)null)
				{
					float num2 = Utils.DistanceXZ(pos, item.m_pos);
					if (num2 < radius && (num2 < num || val == null))
					{
						val = item;
						num = num2;
					}
				}
			}
			return val;
		}
	}
	[HarmonyPatch(typeof(Player), "OnDeath")]
	public class PlayerOnDeathPatch
	{
		private static void Postfix(Player __instance)
		{
			if (PlayerCreateTombStonePatch.playerInventoryWasEmpty && PinManagement.GetCurrentDeathPinMapRule() == DeathPinMapRule.RemoveWhenLootingOrEmpty)
			{
				Logger.Log("No pin when player inventory is empty. Will remove asap.");
				PinManagement.RemovePlayerPin((Component)(object)__instance);
				PlayerCreateTombStonePatch.playerInventoryWasEmpty = false;
			}
		}
	}
	[HarmonyPatch(typeof(Player), "CreateTombStone")]
	public class PlayerCreateTombStonePatch
	{
		public static bool playerInventoryWasEmpty;

		private static void Prefix(Player __instance)
		{
			if (((Humanoid)__instance).GetInventory() != null && (Object)(object)__instance == (Object)(object)Player.m_localPlayer)
			{
				playerInventoryWasEmpty = ((Humanoid)__instance).GetInventory().NrOfItems() == 0;
			}
		}
	}
	[HarmonyPatch(typeof(Minimap), "AddPin")]
	internal static class MinimapAddPinPatch
	{
		private static bool Prefix(Minimap __instance, Vector3 pos, PinType type, string name, bool save, bool isChecked, long ownerID = 0L)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Invalid comparison between Unknown and I4
			if (PinManagement.GetCurrentDeathPinMapRule() == DeathPinMapRule.NoPins)
			{
				return (int)type != 4;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(TombStone), "GiveBoost")]
	public class TombstoneGiveBoostPatch
	{
		private static void Prefix(TombStone __instance)
		{
			if (PinManagement.GetCurrentDeathPinMapRule() != 0)
			{
				PinManagement.RemovePlayerPin((Component)(object)__instance);
			}
		}
	}
	public class TombStoneAlertsPatch
	{
		[HarmonyPatch(typeof(Container), "Interact")]
		public class Container_Interact_Patch
		{
			private static bool Prefix(Container __instance, Humanoid character, bool hold, bool alt)
			{
				if (ConfigurationFile.showMessageWhenLootingYourTombstone.Value == ConfigurationFile.Toggle.Off || ConfigurationFile.tombstoneLootAlertMessage.Value == string.Empty)
				{
					return true;
				}
				TombStone componentInParent = ((Component)__instance).GetComponentInParent<TombStone>();
				if ((Object)(object)componentInParent != (Object)null)
				{
					Player val = (Player)(object)((character is Player) ? character : null);
					if (val != null)
					{
						string ownerName = componentInParent.GetOwnerName();
						Logger.Log("Container.Interact | Prefix | owner " + ownerName + " vs localPlayer " + val.GetPlayerName());
						if (ownerName != val.GetPlayerName() && !(((Character)val).IsPVPEnabled() ? (ConfigurationFile.pvpAllowLootOtherTombstones.Value == ConfigurationFile.Toggle.On) : (ConfigurationFile.pveAllowLootOtherTombstones.Value == ConfigurationFile.Toggle.On)))
						{
							Logger.Log("cannot loot that!");
							MessageHud.instance.ShowMessage((MessageType)2, ConfigurationFile.forbidLootOtherTombstonesMessage.Value, 0, (Sprite)null, false);
							return false;
						}
					}
				}
				return true;
			}

			private static void Postfix(Container __instance, Humanoid character, bool hold, bool alt, ref bool __result)
			{
				if (ConfigurationFile.showMessageWhenLootingYourTombstone.Value == ConfigurationFile.Toggle.Off || ConfigurationFile.tombstoneLootAlertMessage.Value == string.Empty || !__result)
				{
					return;
				}
				TombStone componentInParent = ((Component)__instance).GetComponentInParent<TombStone>();
				if (!((Object)(object)componentInParent == (Object)null))
				{
					string ownerName = componentInParent.GetOwnerName();
					Player localPlayer = Player.m_localPlayer;
					Logger.Log("Container.Interact | Postfix | owner " + ownerName + " vs localPlayer " + localPlayer.GetPlayerName());
					if (ownerName != localPlayer.GetPlayerName() && __instance.GetInventory().GetAllItems().Count > 0)
					{
						Logger.Log("Checking tombstone interact alert...");
						sendAlertToTombstoneOwner(componentInParent.GetOwnerName(), isInteractAlert: true);
					}
				}
			}
		}

		[HarmonyPatch(typeof(Container), "TakeAll")]
		public class Container_TakeAll_Patch
		{
			private static void Postfix(Container __instance, Humanoid character, ref bool __result)
			{
				if (ConfigurationFile.showMessageWhenLootingYourTombstone.Value == ConfigurationFile.Toggle.Off || ConfigurationFile.tombstoneDestroyAlertMessage.Value == string.Empty || !__result)
				{
					return;
				}
				TombStone componentInParent = ((Component)__instance).GetComponentInParent<TombStone>();
				if (!((Object)(object)componentInParent == (Object)null))
				{
					Logger.Log("Container.TakeAll | Checking tombstone alert...");
					string ownerName = componentInParent.GetOwnerName();
					Player localPlayer = Player.m_localPlayer;
					Logger.Log("Container.TakeAll | owner " + ownerName + " vs localPlayer " + localPlayer.GetPlayerName());
					if (ownerName != localPlayer.GetPlayerName())
					{
						sendAlertToTombstoneOwner(ownerName, isInteractAlert: false);
					}
				}
			}
		}

		private static void sendAlertToTombstoneOwner(string owner, bool isInteractAlert)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			PlayerInfo val = ((IEnumerable<PlayerInfo>)ZNet.instance.GetPlayerList()).FirstOrDefault((Func<PlayerInfo, bool>)((PlayerInfo p) => p.m_name.Equals(owner)));
			long userID = ((ZDOID)(ref val.m_characterID)).UserID;
			if (userID == 0)
			{
				Logger.Log("Not found (probably disconnected)");
				return;
			}
			Logger.Log($"Sending alert message to tombStone owner {owner} with ID {userID}...");
			ZRoutedRpc.instance.InvokeRoutedRPC(userID, "RPC_TombStoneAlertPlayer", new object[1] { isInteractAlert });
		}

		public static void RPC_TombStoneAlertPlayer(long sender, bool isInteractAlert)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: 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)
			Logger.Log("[RPC_TombStoneAlertPlayer] entered");
			PlayerInfo val = ((IEnumerable<PlayerInfo>)ZNet.instance.GetPlayerList()).FirstOrDefault((Func<PlayerInfo, bool>)((PlayerInfo p) => ((ZDOID)(ref p.m_characterID)).UserID == sender));
			Player localPlayer = Player.m_localPlayer;
			Logger.Log("[RPC_TombStoneAlertPlayer] RPC sent to " + Player.m_localPlayer.GetPlayerName() + " from " + val.m_name);
			if (isInteractAlert)
			{
				((Character)localPlayer).Message((MessageType)2, ConfigurationFile.tombstoneLootAlertMessage.Value.Replace("{0}", val.m_name), 0, (Sprite)null);
			}
			else
			{
				((Character)localPlayer).Message((MessageType)2, ConfigurationFile.tombstoneDestroyAlertMessage.Value.Replace("{0}", val.m_name), 0, (Sprite)null);
			}
		}
	}
}
namespace PvPBiomeDominions.RulesManagement
{
	public enum PositionSharingBiomeRule
	{
		HidePlayer,
		ShowPlayer,
		PlayerChoice
	}
	public enum PositionSharingWardRule
	{
		HidePlayer,
		ShowPlayer,
		PlayerChoice,
		FollowBiomeRule
	}
	public class PositionRuleManagement
	{
		public static PositionSharingBiomeRule getCurrentBiomeRulePosition()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)EnvMan.instance))
			{
				return PositionSharingBiomeRule.PlayerChoice;
			}
			return getBiomeRulePosition(EnvMan.instance.GetCurrentBiome());
		}

		public static PositionSharingBiomeRule getBiomeRulePosition(Biome biome)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Invalid comparison between Unknown and I4
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Invalid comparison between Unknown and I4
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected I4, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Invalid comparison between Unknown and I4
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Invalid comparison between Unknown and I4
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Invalid comparison between Unknown and I4
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Invalid comparison between Unknown and I4
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Invalid comparison between Unknown and I4
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Invalid comparison between Unknown and I4
			if (!Object.op_Implicit((Object)(object)EnvMan.instance))
			{
				return PositionSharingBiomeRule.PlayerChoice;
			}
			if ((int)biome <= 16)
			{
				switch (biome - 1)
				{
				default:
					if ((int)biome != 8)
					{
						if ((int)biome != 16)
						{
							break;
						}
						return ConfigurationFile.positionRuleInPlains.Value;
					}
					return ConfigurationFile.positionRuleInBlackForest.Value;
				case 0:
					return ConfigurationFile.positionRuleInMeadows.Value;
				case 1:
					return ConfigurationFile.positionRuleInSwamp.Value;
				case 3:
					return ConfigurationFile.positionRuleInMountain.Value;
				case 2:
					break;
				}
			}
			else if ((int)biome <= 64)
			{
				if ((int)biome == 32)
				{
					return ConfigurationFile.positionRuleInAshlands.Value;
				}
				if ((int)biome == 64)
				{
					return ConfigurationFile.positionRuleInDeepNorth.Value;
				}
			}
			else
			{
				if ((int)biome == 256)
				{
					return ConfigurationFile.positionRuleInOcean.Value;
				}
				if ((int)biome == 512)
				{
					return ConfigurationFile.positionRuleInMistlands.Value;
				}
			}
			return getCustomBiomeRulePosition();
		}

		private static PositionSharingBiomeRule getCustomBiomeRulePosition()
		{
			if (string.IsNullOrEmpty(ConfigurationFile.positionRuleInCustomBiomes.Value) || (Object)(object)Minimap.instance == (Object)null)
			{
				return PositionSharingBiomeRule.PlayerChoice;
			}
			Transform obj = ((Component)Minimap.instance).transform.Find("small/small_biome");
			object obj2;
			if (obj == null)
			{
				obj2 = null;
			}
			else
			{
				TextMeshProUGUI component = ((Component)obj).GetComponent<TextMeshProUGUI>();
				obj2 = ((component != null) ? ((TMP_Text)component).text : null);
			}
			string text = (string)obj2;
			if (text == null)
			{
				return PositionSharingBiomeRule.PlayerChoice;
			}
			foreach (string item in ConfigurationFile.positionRuleInCustomBiomes.Value.Split(new char[1] { ';' }).ToList())
			{
				if (!item.Contains(":"))
				{
					continue;
				}
				string[] array = item.Split(new char[1] { ':' });
				string text2 = array[0];
				if (!text2.Equals(text))
				{
					continue;
				}
				PositionSharingBiomeRule result;
				bool flag = Enum.TryParse<PositionSharingBiomeRule>(array[1], out result);
				Logger.Log($"{flag} {result}");
				if (flag)
				{
					return result;
				}
				return PositionSharingBiomeRule.PlayerChoice;
			}
			return PositionSharingBiomeRule.PlayerChoice;
		}
	}
	public enum PvPBiomeRule
	{
		Pve,
		Pvp,
		PlayerChoose
	}
	public enum PvPWardRule
	{
		Pve,
		Pvp,
		PlayerChoose,
		FollowBiomeRule
	}
	public class PvPRuleManagement
	{
		public static PvPBiomeRule getCurrentBiomeRulePvPRule()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Invalid comparison between Unknown and I4
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Invalid comparison between Unknown and I4
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected I4, but got Unknown
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Invalid comparison between Unknown and I4
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Invalid comparison between Unknown and I4
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Invalid comparison between Unknown and I4
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Invalid comparison between Unknown and I4
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Invalid comparison between Unknown and I4
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Invalid comparison between Unknown and I4
			if (!Object.op_Implicit((Object)(object)EnvMan.instance))
			{
				return PvPBiomeRule.PlayerChoose;
			}
			Biome currentBiome = EnvMan.instance.GetCurrentBiome();
			Biome val = currentBiome;
			Biome val2 = val;
			if ((int)val2 <= 16)
			{
				switch (val2 - 1)
				{
				default:
					if ((int)val2 != 8)
					{
						if ((int)val2 != 16)
						{
							break;
						}
						return ConfigurationFile.pvpRuleInPlains.Value;
					}
					return ConfigurationFile.pvpRuleInBlackForest.Value;
				case 0:
					return ConfigurationFile.pvpRuleInMeadows.Value;
				case 1:
					return ConfigurationFile.pvpRuleInSwamp.Value;
				case 3:
					return ConfigurationFile.pvpRuleInMountain.Value;
				case 2:
					break;
				}
			}
			else if ((int)val2 <= 64)
			{
				if ((int)val2 == 32)
				{
					return ConfigurationFile.pvpRuleInAshlands.Value;
				}
				if ((int)val2 == 64)
				{
					return ConfigurationFile.pvpRuleInDeepNorth.Value;
				}
			}
			else
			{
				if ((int)val2 == 256)
				{
					return ConfigurationFile.pvpRuleInOcean.Value;
				}
				if ((int)val2 == 512)
				{
					return ConfigurationFile.pvpRuleInMistlands.Value;
				}
			}
			return GetCurrentCustomBiome();
		}

		private static PvPBiomeRule GetCurrentCustomBiome()
		{
			if (string.IsNullOrEmpty(ConfigurationFile.pvpRuleInCustomBiomes.Value) || (Object)(object)Minimap.instance == (Object)null)
			{
				return PvPBiomeRule.PlayerChoose;
			}
			Transform obj = ((Component)Minimap.instance).transform.Find("small/small_biome");
			object obj2;
			if (obj == null)
			{
				obj2 = null;
			}
			else
			{
				TextMeshProUGUI component = ((Component)obj).GetComponent<TextMeshProUGUI>();
				obj2 = ((component != null) ? ((TMP_Text)component).text : null);
			}
			string text = (string)obj2;
			if (text == null)
			{
				return PvPBiomeRule.PlayerChoose;
			}
			foreach (string item in ConfigurationFile.pvpRuleInCustomBiomes.Value.Split(new char[1] { ';' }).ToList())
			{
				if (!item.Contains(":"))
				{
					continue;
				}
				string[] array = item.Split(new char[1] { ':' });
				string text2 = array[0];
				if (!text2.Equals(text))
				{
					continue;
				}
				if (Enum.TryParse<PvPBiomeRule>(array[1], out var result))
				{
					return result;
				}
				return PvPBiomeRule.PlayerChoose;
			}
			return PvPBiomeRule.PlayerChoose;
		}
	}
	public class WardRuleManagement
	{
		public static bool IsWardCreationAllowedInCurrentBiomeRule()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Invalid comparison between Unknown and I4
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Invalid comparison between Unknown and I4
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected I4, but got Unknown
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Invalid comparison between Unknown and I4
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Invalid comparison between Unknown and I4
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Invalid comparison between Unknown and I4
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Invalid comparison between Unknown and I4
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Invalid comparison between Unknown and I4
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Invalid comparison between Unknown and I4
			Logger.Log("IsWardCreationAllowedInCurrentBiomeRule");
			if (!Object.op_Implicit((Object)(object)EnvMan.instance))
			{
				return true;
			}
			Biome currentBiome = EnvMan.instance.GetCurrentBiome();
			Biome val = currentBiome;
			Biome val2 = val;
			if ((int)val2 <= 16)
			{
				switch (val2 - 1)
				{
				default:
					if ((int)val2 != 8)
					{
						if ((int)val2 != 16)
						{
							break;
						}
						return ConfigurationFile.wardCreationInPlains.Value == ConfigurationFile.Toggle.On;
					}
					return ConfigurationFile.wardCreationInBlackForest.Value == ConfigurationFile.Toggle.On;
				case 0:
					return ConfigurationFile.wardCreationInMeadows.Value == ConfigurationFile.Toggle.On;
				case 1:
					return ConfigurationFile.wardCreationInSwamp.Value == ConfigurationFile.Toggle.On;
				case 3:
					return ConfigurationFile.wardCreationInMountain.Value == ConfigurationFile.Toggle.On;
				case 2:
					break;
				}
			}
			else if ((int)val2 <= 64)
			{
				if ((int)val2 == 32)
				{
					return ConfigurationFile.wardCreationInAshlands.Value == ConfigurationFile.Toggle.On;
				}
				if ((int)val2 == 64)
				{
					return ConfigurationFile.wardCreationInDeepNorth.Value == ConfigurationFile.Toggle.On;
				}
			}
			else
			{
				if ((int)val2 == 256)
				{
					return ConfigurationFile.wardCreationInOcean.Value == ConfigurationFile.Toggle.On;
				}
				if ((int)val2 == 512)
				{
					return ConfigurationFile.wardCreationInMistlands.Value == ConfigurationFile.Toggle.On;
				}
			}
			return getWardCreationInCustomBiome();
		}

		private static bool getWardCreationInCustomBiome()
		{
			Logger.Log("getWardCreationInCustomBiome");
			if (string.IsNullOrEmpty(ConfigurationFile.wardCreationForbiddenInCustomBiomes.Value) || (Object)(object)Minimap.instance == (Object)null)
			{
				return true;
			}
			Transform obj = ((Component)Minimap.instance).transform.Find("small/small_biome");
			object obj2;
			if (obj == null)
			{
				obj2 = null;
			}
			else
			{
				TextMeshProUGUI component = ((Component)obj).GetComponent<TextMeshProUGUI>();
				obj2 = ((component != null) ? ((TMP_Text)component).text : null);
			}
			string text = (string)obj2;
			if (text == null)
			{
				return true;
			}
			foreach (string item in ConfigurationFile.wardCreationForbiddenInCustomBiomes.Value.Split(new char[1] { ',' }).ToList())
			{
				if (item.Equals(text))
				{
					return false;
				}
			}
			return true;
		}
	}
}
namespace PvPBiomeDominions.RPC
{
	public class RPC_PlayerRelevantInfo
	{
		public string playerName;

		public int level;

		public bool isPvP;

		public string guildName;

		public int guildIconId;

		public string GetLevelText()
		{
			return (level > 0) ? level.ToString() : "???";
		}

		public ZPackage GetPackage()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			ZPackage val = new ZPackage();
			val.Write(playerName);
			val.Write(level);
			val.Write(isPvP);
			val.Write(guildName);
			val.Write(guildIconId);
			return val;
		}

		public static RPC_PlayerRelevantInfo FromPackage(ZPackage pkg)
		{
			return new RPC_PlayerRelevantInfo
			{
				playerName = pkg.ReadString(),
				level = pkg.ReadInt(),
				isPvP = pkg.ReadBool(),
				guildName = pkg.ReadString(),
				guildIconId = pkg.ReadInt()
			};
		}
	}
	[HarmonyPatch(typeof(Game), "Start")]
	public class GameStartPatch
	{
		private static void Prefix()
		{
			ZRoutedRpc.instance.Register<bool>("RPC_TombStoneAlertPlayer", (Action<long, bool>)TombStoneAlertsPatch.RPC_TombStoneAlertPlayer);
			ZRoutedRpc.instance.Register("RPC_RequestPlayerRelevantInfo", (Action<long>)RPC_PlayersListPanel.RPC_RequestPlayerRelevantInfo);
			ZRoutedRpc.instance.Register<ZPackage>("RPC_ResponsePlayerRelevantInfo", (Action<long, ZPackage>)RPC_PlayersListPanel.RPC_ResponsePlayerRelevantInfo);
			ZRoutedRpc.instance.Register<string>("RPC_AddKillToKiller", (Action<long, string>)PvPKillCountPatch.RPC_AddKillToKiller);
		}
	}
}
namespace PvPBiomeDominions.PvPManagement
{
	[HarmonyPatch(typeof(Minimap), "UpdatePlayerPins")]
	[HarmonyPriority(0)]
	public static class Minimap_UpdatePlayerPins_Patch
	{
		private static void Postfix(Minimap __instance)
		{
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Invalid comparison between Unknown and I4
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			if (!ConfigurationFile.mapPinColoring.Value || MinimapUpdatePatch.panel == null)
			{
				return;
			}
			Dictionary<string, PlayerInfo> dictionary = (from p in ZNet.instance.GetPlayerList()
				group p by p.m_name).ToDictionary((IGrouping<string, PlayerInfo> p) => p.Key, (IGrouping<string, PlayerInfo> p) => p.First());
			List<PinData> source = (List<PinData>)GameManager.GetPrivateValue(__instance, "m_pins");
			List<PinData> list = source.Where((PinData p) => (int)p.m_type == 10).ToList();
			List<Groups.PlayerReference> list2 = new List<Groups.PlayerReference>();
			if (Groups.API.IsLoaded())
			{
				list2.AddRange(Groups.API.GroupPlayers());
			}
			foreach (PinData pin in list)
			{
				if ((int)pin.m_type != 10 || string.IsNullOrEmpty(pin.m_name) || pin.m_name == Player.m_localPlayer.GetPlayerName() || !dictionary.Keys.Contains(pin.m_name) || list2.FindIndex((Groups.PlayerReference pRef) => pRef.name == pin.m_name) >= 0)
				{
					continue;
				}
				RectTransform uiElement = pin.m_uiElement;
				Image val = ((uiElement != null) ? ((Component)uiElement).GetComponent<Image>() : null);
				if (!((Object)(object)val == (Object)null))
				{
					bool flag = MinimapUpdatePatch.panel.cachedPlayerEntries.Find((PlayerEntry cpe) => cpe.name.Equals(pin.m_name))?.isPvP ?? GameManager.isInfoPVP(GeneralExtensions.GetValueSafe<string, PlayerInfo>(dictionary, pin.m_name));
					val.sprite = (flag ? ImageManager.getSpriteIconVanillaImage() : ImageManager.getSpriteIconPVEImage());
				}
			}
		}
	}
	[HarmonyPatch(typeof(Player), "GetKnownTexts")]
	public class FixCompendium
	{
		public static void Postfix(ref List<KeyValuePair<string, string>> __result)
		{
			__result = __result.Where((KeyValuePair<string, string> p) => !p.Key.StartsWith("Turbero.PvPBiomeDominions")).ToList();
		}
	}
	[HarmonyPatch(typeof(Character), "ApplyDamage")]
	public class PvPKillCountPatch
	{
		[HarmonyPostfix]
		public static void ApplyReceivedDamageToCharacter(Character __instance, HitData hit)
		{
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			Logger.Log("[ApplyReceivedDamageToCharacter] Postfix. Damage received to character type: " + ((object)__instance).GetType());
			if (__instance.IsTamed() || __instance.GetHealth() > 0f || (Object)(object)__instance != (Object)(object)Player.m_localPlayer)
			{
				return;
			}
			Logger.Log("Player killed detected!");
			Player val = (Player)(object)((__instance is Player) ? __instance : null);
			if (hit == null || (Object)(object)hit.GetAttacker() == (Object)null)
			{
				Logger.Log("Unknown death (/die command?)");
				return;
			}
			Character attacker = hit.GetAttacker();
			if (!(((Object)((Component)attacker).gameObject).name != "Player(Clone)"))
			{
				Player val2 = (Player)(object)((attacker is Player) ? attacker : null);
				string playerName = val2.GetPlayerName();
				Logger.Log("Player killed by Player " + playerName + " detected!");
				int newCount = updateLocalPlayerKnownText(GameManager.PREFIX_KILLEDBY + playerName, "PvPKillCountPatch");
				if (MinimapUpdatePatch.panel != null)
				{
					MinimapUpdatePatch.panel.UpdatePlayerKilledByCount(playerName, newCount);
				}
				ZDOID zDOID = ((Character)val2).GetZDOID();
				Logger.Log($"Trying RPC with {((ZDOID)(ref zDOID)).UserID} and {val.GetPlayerName()}");
				ZRoutedRpc instance = ZRoutedRpc.instance;
				zDOID = ((Character)val2).GetZDOID();
				instance.InvokeRoutedRPC(((ZDOID)(ref zDOID)).UserID, "RPC_AddKillToKiller", new object[1] { val.GetPlayerName() });
			}
		}

		public static void RPC_AddKillToKiller(long sender, string killedPlayerName)
		{
			Logger.Log("[RPC_AddKillToKiller] RPC called.");
			int newCount = updateLocalPlayerKnownText(GameManager.PREFIX_KILLS + killedPlayerName, "RPC_AddKillToKiller");
			if (MinimapUpdatePatch.panel != null)
			{
				MinimapUpdatePatch.panel.UpdatePlayerKillsCount(killedPlayerName, newCount);
			}
		}

		private static int updateLocalPlayerKnownText(string knownTextToUpdate, string callerMethod)
		{
			Dictionary<string, string> dictionary = (Dictionary<string, string>)GameManager.GetPrivateValue(Player.m_localPlayer, "m_knownTexts");
			int result = 1;
			if (dictionary.ContainsKey(knownTextToUpdate))
			{
				string valueSafe = GeneralExtensions.GetValueSafe<string, string>(dictionary, knownTextToUpdate);
				if (int.TryParse(valueSafe, out var result2))
				{
					dictionary.Remove(knownTextToUpdate);
					dictionary.Add(knownTextToUpdate, (result2 + 1).ToString() ?? "");
					result = result2 + 1;
					Logger.Log("[" + callerMethod + "] New key value: " + result);
				}
				else
				{
					dictionary.Remove(knownTextToUpdate);
					dictionary.Add(knownTextToUpdate, result.ToString());
					Logger.Log("[" + callerMethod + "] Add new knownText: " + knownTextToUpdate + " with value=1");
				}
			}
			else
			{
				dictionary.Add(knownTextToUpdate, "1");
				Logger.Log("[" + callerMethod + "] Add new knownText: " + knownTextToUpdate + " with value=1");
			}
			return result;
		}
	}
	[HarmonyPatch(typeof(Character), "Damage")]
	[HarmonyPriority(700)]
	public class PvPDamageCheckWackyEpicMMOPatch
	{
		private static bool Prefix(HitData hit, Character __instance)
		{
			if (!EpicMMOSystem_API.IsLoaded() || ConfigurationFile.pvpWackyEpicMMOLevelDifferenceLimitEnabled.Value == ConfigurationFile.Toggle.Off)
			{
				return true;
			}
			if ((Object)(object)__instance != (Object)null && ((object)__instance).GetType() == typeof(Player))
			{
				Character attacker = hit.GetAttacker();
				if ((Object)(object)attacker != (Object)null && ((object)attacker).GetType() == typeof(Player))
				{
					if (((object)attacker).GetType() == typeof(Player))
					{
						Character obj = ((__instance is Player) ? __instance : null);
						string obj2 = ((obj != null) ? ((Player)obj).GetPlayerName() : null);
						Character obj3 = ((attacker is Player) ? attacker : null);
						if (obj2 == ((obj3 != null) ? ((Player)obj3).GetPlayerName() : null))
						{
							return true;
						}
					}
					Player obj4 = (Player)(object)((attacker is Player) ? attacker : null);
					Dictionary<string, string> dictionary = (Dictionary<string, string>)GameManager.GetPrivateValue(obj4, "m_knownTexts");
					string s = dictionary["EpicMMOSystem_LevelSystem_Level"];
					int result;
					bool flag = int.TryParse(s, out result);
					Player obj5 = (Player)(object)((__instance is Player) ? __instance : null);
					Dictionary<string, string> dictionary2 = (Dictionary<string, string>)GameManager.GetPrivateValue(obj5, "m_knownTexts");
					string s2 = dictionary2["EpicMMOSystem_LevelSystem_Level"];
					int result2;
					bool flag2 = int.TryParse(s2, out result2);
					if (flag && flag2 && result2 - result > ConfigurationFile.pvpWackyEpicMMOLevelDifferenceLimitValue.Value)
					{
						return false;
					}
				}
			}
			return true;
		}
	}
	[HarmonyPatch]
	public class PlayerUpdatePatch
	{
		[HarmonyPatch(typeof(Player), "Update")]
		[HarmonyPatch(typeof(InventoryGui), "UpdateCharacterStats")]
		[HarmonyPostfix]
		public static void Postfix(Player __instance)
		{
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)ZNetScene.instance) || (Object.op_Implicit((Object)(object)Game.instance) && !Object.op_Implicit((Object)(object)Player.m_localPlayer)) || !Object.op_Implicit((Object)(object)InventoryGui.instance) || (ConfigurationFile.pvpAdminExempt.Value == ConfigurationFile.Toggle.On && ConfigurationFile.ConfigSync.IsAdmin) || (Marketplace_API.IsInstalled() && Marketplace_API.IsPointInsideTerritoryWithFlag(((Component)Player.m_localPlayer).transform.position, Marketplace_API.TerritoryFlags.PveOnly, out var _, out var _, out var _)))
			{
				return;
			}
			bool flag = WardIsLovePlugin.IsInsideWard();
			PvPWardRule value = ConfigurationFile.pvpRuleInWards.Value;
			if (flag && value != PvPWardRule.FollowBiomeRule)
			{
				if (value == PvPWardRule.PlayerChoose)
				{
					((Selectable)InventoryGui.instance.m_pvp).interactable = true;
					return;
				}
				((Selectable)InventoryGui.instance.m_pvp).interactable = false;
				SetupPvP(InventoryGui.instance, value == PvPWardRule.Pvp);
				return;
			}
			PvPBiomeRule currentBiomeRulePvPRule = PvPRuleManagement.getCurrentBiomeRulePvPRule();
			if (currentBiomeRulePvPRule == PvPBiomeRule.PlayerChoose)
			{
				((Selectable)InventoryGui.instance.m_pvp).interactable = true;
				return;
			}
			((Selectable)InventoryGui.instance.m_pvp).interactable = false;
			WaitForSecondsAsync(InventoryGui.instance, currentBiomeRulePvPRule == PvPBiomeRule.Pvp);
		}

		private static async Task WaitForSecondsAsync(InventoryGui invGUI, bool isPvPOn)
		{
			await Task.Delay((int)(Math.Max(0f, ConfigurationFile.waitingTimeBeforeUpdatingBiomePvPStatus.Value) * 1000f));
			SetupPvP(invGUI, isPvPOn);
		}

		private static void SetupPvP(InventoryGui invGUI, bool isPvPOn)
		{
			Player.m_localPlayer.SetPVP(isPvPOn);
			invGUI.m_pvp.isOn = isPvPOn;
		}
	}
	public static class PvPSpawnProtectionTracker
	{
		private static readonly HashSet<long> _killedByPlayer = new HashSet<long>();

		private const string ZDO_KEY = "pvp_protection_until";

		public static void MarkKilledByPlayer(Player player)
		{
			_killedByPlayer.Add(player.GetPlayerID());
		}

		public static bool WasKilledByPlayer(Player player)
		{
			return _killedByPlayer.Remove(player.GetPlayerID());
		}

		public static void SetProtection(Player player, float seconds)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			ZNetView val = (ZNetView)GameManager.GetPrivateValue(player, "m_nview");
			if (!((Object)(object)val == (Object)null) && val.GetZDO() != null)
			{
				long num = ZNet.instance.GetTime().Ticks + (long)(seconds * 10000000f);
				val.GetZDO().Set("pvp_protection_until", num);
			}
		}

		public static bool HasProtection(Player player)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			ZNetView val = (ZNetView)GameManager.GetPrivateValue(player, "m_nview");
			if ((Object)(object)val == (Object)null || val.GetZDO() == null)
			{
				return false;
			}
			if (((val != null) ? val.GetZDO() : null) == null)
			{
				return false;
			}
			long @long = val.GetZDO().GetLong("pvp_protection_until", 0L);
			if (@long == 0)
			{
				return false;
			}
			return ZNet.instance.GetTime().Ticks < @long;
		}

		public static void ClearProtection(Player player)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			ZNetView val = (ZNetView)GameManager.GetPrivateValue(player, "m_nview");
			if (!((Object)(object)val == (Object)null) && val.GetZDO() != null && ((val != null) ? val.GetZDO() : null) != null)
			{
				val.GetZDO().Set("pvp_protection_until", 0L);
			}
		}
	}
	[HarmonyPatch(typeof(Player), "OnDeath")]
	public static class Player_OnDeath_Patch
	{
		public static void Prefix(Player __instance)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			HitData val = (HitData)typeof(Player).GetField("m_lastHit", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
			if (val != null)
			{
				Character attacker = val.GetAttacker();
				Player val2 = (Player)(object)((attacker is Player) ? attacker : null);
				if (val2 != null && (Object)(object)val2 != (Object)(object)__instance)
				{
					PvPSpawnProtectionTracker.MarkKilledByPlayer(__instance);
				}
			}
		}
	}
	[HarmonyPatch(typeof(Player), "OnSpawned")]
	public class SE_PvPSpawnProtectionPatch
	{
		public static void Postfix(Player __instance)
		{
			if (!(ConfigurationFile.waitingTimeAfterDyingToFightPlayersAgain.Value <= 0f) && PvPSpawnProtectionTracker.WasKilledByPlayer(__instance))
			{
				float num = ConfigurationFile.waitingTimeAfterDyingToFightPlayersAgain.Value * 60f;
				Logger.Log("Adding PvP ZDO protection to " + __instance.GetPlayerName());
				PvPSpawnProtectionTracker.SetProtection(__instance, num);
				SE_PvPSpawnImmunity sE_PvPSpawnImmunity = ScriptableObject.CreateInstance<SE_PvPSpawnImmunity>();
				((StatusEffect)sE_PvPSpawnImmunity).m_ttl = num;
				((Character)__instance).GetSEMan().AddStatusEffect((StatusEffect)(object)sE_PvPSpawnImmunity, false, 0, 0f);
			}
		}
	}
	[HarmonyPatch(typeof(Character), "ApplyDamage")]
	public class CheckPvPProtectionBuffPatch
	{
		[HarmonyPrefix]
		public static bool Prefix(Character __instance, HitData hit)
		{
			Player val = (Player)(object)((__instance is Player) ? __instance : null);
			if (val == null)
			{
				return true;
			}
			Character attacker = hit.GetAttacker();
			Player val2 = (Player)(object)((attacker is Player) ? attacker : null);
			if (val2 == null)
			{
				return true;
			}
			if (PvPSpawnProtectionTracker.HasProtection(val))
			{
				Logger.Log("Blocked PvP damage: victim protected");
				return false;
			}
			if (PvPSpawnProtectionTracker.HasProtection(val2))
			{
				Logger.Log("Blocked PvP damage: attacker protected");
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Player), "TryPlacePiece")]
	public static class PvPWardPatch
	{
		private static bool Prefix(Player __instance, Piece piece)
		{
			string text = ((Object)piece).name.Replace("(Clone)", "");
			if (text.ToLowerInvariant().Contains("guard_stone") || ConfigurationFile.wardModsPrefabIds.Value.ToLowerInvariant().Contains(text.ToLowerInvariant()))
			{
				Logger.Log("Ward creation detected. Checking...");
				if (!WardRuleManagement.IsWardCreationAllowedInCurrentBiomeRule())
				{
					Logger.Log("Not allowed in current biome.");
					((Character)__instance).Message((MessageType)2, ConfigurationFile.wardCreationNotAllowed.Value, 0, (Sprite)null);
					return false;
				}
			}
			Logger.Log("Allowed!");
			return true;
		}
	}
}
namespace PvPBiomeDominions.PositionManagement
{
	[HarmonyPatch(typeof(Player), "Message")]
	internal static class PlayerMessagePatch
	{
		[UsedImplicitly]
		private static bool Prefix(Player __instance, MessageType type, string msg, int amount = 0, Sprite icon = null)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			ZNetView val = (ZNetView)GameManager.GetPrivateValue(__instance, "m_nview");
			if ((Object)(object)val == (Object)null || !val.IsValid())
			{
				return false;
			}
			if ((Object)(object)Player.m_localPlayer == (Object)null)
			{
				return false;
			}
			if (msg == Localization.instance.Localize("$msg_newday", new string[1] { GameManager.GetCurrentDay().ToString() }) && ConfigurationFile.dayMessageOff.Value == ConfigurationFile.Toggle.On)
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(MessageHud), "ShowMessage")]
	internal static class MessageHudShowMessagePatch
	{
		[UsedImplicitly]
		private static bool Prefix(MessageHud __instance, MessageType type, string text, int amount = 0, Sprite icon = null)
		{
			if (Hud.IsUserHidden())
			{
				return false;
			}
			if (text == Localization.instance.Localize("$msg_newday", new string[1] { GameManager.GetCurrentDay().ToString() }) && ConfigurationFile.dayMessageOff.Value == ConfigurationFile.Toggle.On)
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Minimap), "AddPin")]
	internal static class MinimapAddPinPatch
	{
		[UsedImplicitly]
		private static void Postfix(Minimap __instance, Vector3 pos, PinType type, string name, bool save, bool isChecked, long ownerID = 0L)
		{
			if (ConfigurationFile.dayMessageOff.Value != ConfigurationFile.Toggle.On)
			{
				return;
			}
			List<PinData> list = (List<PinData>)GameManager.GetPrivateValue(__instance, "m_pins");
			foreach (PinData item in list)
			{
				if (item.m_name == $"$hud_mapday {EnvMan.instance.GetDay(ZNet.instance.GetTimeSeconds())}")
				{
					item.m_name = "";
				}
				else if (item.m_name.Contains("$hud_mapday"))
				{
					item.m_name = "";
				}
			}
		}
	}
	[HarmonyPatch(typeof(Minimap), "Update")]
	public static class MinimapUpdatePatch
	{
		private static bool created;

		private static float lastUpdateTime;

		public static PlayersListPanel panel;

		public static void Postfix(Minimap __instance)
		{
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)__instance) || (Object)(object)Player.m_localPlayer == (Object)null)
			{
				return;
			}
			ImageManager.getSpriteIconVanillaImage();
			HandlePlayersListPanel(__instance);
			if ((Object)(object)__instance.m_largeRoot != (Object)null && __instance.m_largeRoot.activeSelf && Time.time - lastUpdateTime >= (float)ConfigurationFile.pvpMinimapPlayersListRefresh.Value)
			{
				lastUpdateTime = Time.time;
				ConfigurationFile.configFile.Reload();
			}
			if (ConfigurationFile.positionAdminExempt.Value == ConfigurationFile.Toggle.On && ConfigurationFile.ConfigSync.IsAdmin)