Decompiled source of RPGMods v1.8.1

RPGMods.dll

Decompiled 5 months ago
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
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.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.Json;
using System.Text.RegularExpressions;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Costura;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using ProjectM;
using ProjectM.Gameplay;
using ProjectM.Gameplay.Systems;
using ProjectM.Network;
using ProjectM.Scripting;
using ProjectM.Shared;
using RPGMods.Commands;
using RPGMods.Hooks;
using RPGMods.Systems;
using RPGMods.Utils;
using Stunlock.Core;
using Stunlock.Localization;
using Stunlock.Network;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Transforms;
using UnityEngine;
using VampireCommandFramework;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("RPGMods")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("RPG Mods combined with ChatCommands")]
[assembly: AssemblyFileVersion("1.7.0.0")]
[assembly: AssemblyInformationalVersion("1.7.0")]
[assembly: AssemblyProduct("RPGMods")]
[assembly: AssemblyTitle("RPGMods")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.7.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
internal class <Module>
{
	static <Module>()
	{
		AssemblyLoader.Attach();
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace RPGMods
{
	[BepInPlugin("RPGMods", "RPGMods - Gloomrot", "1.7.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BasePlugin
	{
		public static Harmony harmony;

		private static ConfigEntry<int> WaypointLimit;

		private static ConfigEntry<bool> EnableVIPSystem;

		private static ConfigEntry<bool> EnableVIPWhitelist;

		private static ConfigEntry<int> VIP_Permission;

		private static ConfigEntry<bool> ShouldAllowGearLevel;

		private static ConfigEntry<bool> EnableLevelRewards;

		private static ConfigEntry<bool> EasyLevel15;

		private static ConfigEntry<double> VIP_InCombat_ResYield;

		private static ConfigEntry<double> VIP_InCombat_DurabilityLoss;

		private static ConfigEntry<double> VIP_InCombat_MoveSpeed;

		private static ConfigEntry<double> VIP_InCombat_GarlicResistance;

		private static ConfigEntry<double> VIP_InCombat_SilverResistance;

		private static ConfigEntry<double> VIP_OutCombat_ResYield;

		private static ConfigEntry<double> VIP_OutCombat_DurabilityLoss;

		private static ConfigEntry<double> VIP_OutCombat_MoveSpeed;

		private static ConfigEntry<double> VIP_OutCombat_GarlicResistance;

		private static ConfigEntry<double> VIP_OutCombat_SilverResistance;

		private static ConfigEntry<bool> HunterHuntedEnabled;

		private static ConfigEntry<int> HeatCooldown;

		private static ConfigEntry<int> Ambush_Interval;

		private static ConfigEntry<int> Ambush_Chance;

		private static ConfigEntry<float> Ambush_Despawn_Unit_Timer;

		private static ConfigEntry<int> VBloodHeatMultiplier;

		private static ConfigEntry<bool> EnableExperienceSystem;

		private static ConfigEntry<int> MaxLevel;

		private static ConfigEntry<float> EXPMultiplier;

		private static ConfigEntry<float> VBloodEXPMultiplier;

		private static ConfigEntry<float> EXPFormula_1;

		private static ConfigEntry<double> EXPGroupModifier;

		private static ConfigEntry<float> EXPGroupMaxDistance;

		private static ConfigEntry<int> EXPGroupLevelScheme;

		private static ConfigEntry<float> pvpXPLoss;

		private static ConfigEntry<float> pvpXPLossPerLevel;

		private static ConfigEntry<float> pvpXPLossPercent;

		private static ConfigEntry<float> pvpXPLossPercentPerLevel;

		private static ConfigEntry<float> pvpXPLossMultPerLvlDiff;

		private static ConfigEntry<float> pvpXPLossMultPerLvlDiffSq;

		private static ConfigEntry<float> pveXPLoss;

		private static ConfigEntry<float> pveXPLossPerLevel;

		private static ConfigEntry<float> pveXPLossPercent;

		private static ConfigEntry<float> pveXPLossPercentPerLevel;

		private static ConfigEntry<float> pveXPLossMultPerLvlDiff;

		private static ConfigEntry<float> pveXPLossMultPerLvlDiffSq;

		private static ConfigEntry<bool> xpLossOnDown;

		private static ConfigEntry<bool> xpLossOnRelease;

		private static ConfigEntry<bool> EnableWeaponMaster;

		private static ConfigEntry<bool> EnableWeaponMasterDecay;

		private static ConfigEntry<double> WeaponMasterMultiplier;

		private static ConfigEntry<int> WeaponDecayInterval;

		private static ConfigEntry<double> WeaponMaxMastery;

		private static ConfigEntry<double> WeaponMastery_VBloodMultiplier;

		private static ConfigEntry<int> Offline_Weapon_MasteryDecayValue;

		private static ConfigEntry<int> MasteryCombatTick;

		private static ConfigEntry<int> MasteryMaxCombatTicks;

		private static ConfigEntry<bool> WeaponMasterySpellMasteryNeedsNoneToUse;

		private static ConfigEntry<bool> WeaponMasterySpellMasteryNeedsNoneToLearn;

		private static ConfigEntry<bool> WeaponLinearSpellMastery;

		private static ConfigEntry<bool> WeaponSpellMasteryCDRStacks;

		private static ConfigEntry<bool> DetailedMasteryInfo;

		private static ConfigEntry<string> UnarmedStats;

		private static ConfigEntry<string> UnarmedRates;

		private static ConfigEntry<string> SpearStats;

		private static ConfigEntry<string> SpearRates;

		private static ConfigEntry<string> SwordStats;

		private static ConfigEntry<string> SwordRates;

		private static ConfigEntry<string> ScytheStats;

		private static ConfigEntry<string> ScytheRates;

		private static ConfigEntry<string> CrossbowStats;

		private static ConfigEntry<string> CrossbowRates;

		private static ConfigEntry<string> MaceStats;

		private static ConfigEntry<string> MaceRates;

		private static ConfigEntry<string> SlasherStats;

		private static ConfigEntry<string> SlasherRates;

		private static ConfigEntry<string> AxeStats;

		private static ConfigEntry<string> AxeRates;

		private static ConfigEntry<string> FishingPoleStats;

		private static ConfigEntry<string> FishingPoleRates;

		private static ConfigEntry<string> SpellStats;

		private static ConfigEntry<string> SpellRates;

		private static ConfigEntry<string> RapierStats;

		private static ConfigEntry<string> RapierRates;

		private static ConfigEntry<string> PistolStats;

		private static ConfigEntry<string> PistolRates;

		private static ConfigEntry<string> GreatswordStats;

		private static ConfigEntry<string> GreatswordRates;

		private static ConfigEntry<bool> effectivenessSubSystemEnabled;

		private static ConfigEntry<bool> growthSubSystemEnabled;

		private static ConfigEntry<float> maxEffectiveness;

		private static ConfigEntry<float> minGrowth;

		private static ConfigEntry<float> maxGrowth;

		private static ConfigEntry<float> growthPerEfficency;

		private static ConfigEntry<string> draculaBloodlineStats;

		private static ConfigEntry<string> draculaBloodlineMinStrengths;

		private static ConfigEntry<string> draculaBloodlineRates;

		private static ConfigEntry<string> arwenBloodlineStats;

		private static ConfigEntry<string> arwenBloodlineMinStrengths;

		private static ConfigEntry<string> arwenBloodlineRates;

		private static ConfigEntry<string> ilvrisBloodlineStats;

		private static ConfigEntry<string> ilvrisBloodlineMinStrengths;

		private static ConfigEntry<string> ilvrisBloodlineRates;

		private static ConfigEntry<string> ayaBloodlineStats;

		private static ConfigEntry<string> ayaBloodlineMinStrengths;

		private static ConfigEntry<string> ayaBloodlineRates;

		private static ConfigEntry<string> nytheriaBloodlineStats;

		private static ConfigEntry<string> nytheriaBloodlineMinStrengths;

		private static ConfigEntry<string> nytheriaBloodlineRates;

		private static ConfigEntry<string> hadubertBloodlineStats;

		private static ConfigEntry<string> hadubertBloodlineMinStrengths;

		private static ConfigEntry<string> hadubertBloodlineRates;

		private static ConfigEntry<string> reiBloodlineStats;

		private static ConfigEntry<string> reiBloodlineMinStrengths;

		private static ConfigEntry<string> reiBloodlineRates;

		private static ConfigEntry<string> semikaBloodlineStats;

		private static ConfigEntry<string> semikaBloodlineMinStrengths;

		private static ConfigEntry<string> semikaBloodlineRates;

		private static ConfigEntry<bool> bloodlinesEnabled;

		private static ConfigEntry<bool> mercilessBloodlines;

		private static ConfigEntry<bool> draculaGetsAll;

		private static ConfigEntry<double> bloodlineGrowthMultiplier;

		private static ConfigEntry<double> bloodlineVBloodMultiplier;

		private static ConfigEntry<bool> bloodlineEfficencySubSystem;

		private static ConfigEntry<bool> bloodlineGrowthSubsystem;

		private static ConfigEntry<double> MaxBloodlineStrength;

		private static ConfigEntry<double> maxBloodlineEfficency;

		private static ConfigEntry<double> maxBloodlineGrowth;

		private static ConfigEntry<double> minBloodlineGrowth;

		private static ConfigEntry<double> bloodlineGrowthPerEfficency;

		private static ConfigEntry<string> bloodlineNames;

		private static ConfigEntry<bool> EnableWorldDynamics;

		private static ConfigEntry<bool> WDGrowOnKill;

		private static ConfigEntry<bool> buffLogging;

		private static ConfigEntry<bool> xpLogging;

		private static ConfigEntry<bool> deathLogging;

		private static ConfigEntry<bool> saveLogging;

		private static ConfigEntry<bool> factionLogging;

		private static ConfigEntry<bool> squadSpawnLogging;

		private static ConfigEntry<int> buffID;

		private static ConfigEntry<int> forbiddenBuffID;

		private static ConfigEntry<int> appliedBuff;

		private static ConfigEntry<bool> humanReadablePercentageStats;

		private static ConfigEntry<bool> inverseMultiplersDisplayReduction;

		public static bool isInitialized;

		public static ManualLogSource Logger;

		private static World _serverWorld;

		private static bool parseLogging;

		public static World Server
		{
			get
			{
				if (_serverWorld != null)
				{
					return _serverWorld;
				}
				_serverWorld = GetWorld("Server") ?? throw new Exception("There is no Server world (yet). Did you install a server mod on the client?");
				return _serverWorld;
			}
		}

		public static bool IsServer => Application.productName == "VRisingServer";

		private static World GetWorld(string name)
		{
			Enumerator<World> enumerator = World.s_AllWorlds.GetEnumerator();
			while (enumerator.MoveNext())
			{
				World current = enumerator.Current;
				if (current.Name == name)
				{
					return current;
				}
			}
			return null;
		}

		public void InitConfig()
		{
			WaypointLimit = ((BasePlugin)this).Config.Bind<int>("Config", "Waypoint Limit", 2, "Set a waypoint limit for non-admin users.");
			EnableVIPSystem = ((BasePlugin)this).Config.Bind<bool>("VIP", "Enable VIP System", false, "Enable the VIP System.");
			EnableVIPWhitelist = ((BasePlugin)this).Config.Bind<bool>("VIP", "Enable VIP Whitelist", false, "Enable the VIP user to ignore server capacity limit.");
			VIP_Permission = ((BasePlugin)this).Config.Bind<int>("VIP", "Minimum VIP Permission", 10, "The minimum permission level required for the user to be considered as VIP.");
			VIP_InCombat_DurabilityLoss = ((BasePlugin)this).Config.Bind<double>("VIP.InCombat", "Durability Loss Multiplier", 0.5, "Multiply durability loss when user is in combat. -1.0 to disable.\nDoes not affect durability loss on death.");
			VIP_InCombat_GarlicResistance = ((BasePlugin)this).Config.Bind<double>("VIP.InCombat", "Garlic Resistance Multiplier", -1.0, "Multiply garlic resistance when user is in combat. -1.0 to disable.");
			VIP_InCombat_SilverResistance = ((BasePlugin)this).Config.Bind<double>("VIP.InCombat", "Silver Resistance Multiplier", -1.0, "Multiply silver resistance when user is in combat. -1.0 to disable.");
			VIP_InCombat_MoveSpeed = ((BasePlugin)this).Config.Bind<double>("VIP.InCombat", "Move Speed Multiplier", -1.0, "Multiply move speed when user is in combat. -1.0 to disable.");
			VIP_InCombat_ResYield = ((BasePlugin)this).Config.Bind<double>("VIP.InCombat", "Resource Yield Multiplier", 2.0, "Multiply resource yield (not item drop) when user is in combat. -1.0 to disable.");
			VIP_OutCombat_DurabilityLoss = ((BasePlugin)this).Config.Bind<double>("VIP.OutCombat", "Durability Loss Multiplier", 0.5, "Multiply durability loss when user is out of combat. -1.0 to disable.\nDoes not affect durability loss on death.");
			VIP_OutCombat_GarlicResistance = ((BasePlugin)this).Config.Bind<double>("VIP.OutCombat", "Garlic Resistance Multiplier", 2.0, "Multiply garlic resistance when user is out of combat. -1.0 to disable.");
			VIP_OutCombat_SilverResistance = ((BasePlugin)this).Config.Bind<double>("VIP.OutCombat", "Silver Resistance Multiplier", 2.0, "Multiply silver resistance when user is out of combat. -1.0 to disable.");
			VIP_OutCombat_MoveSpeed = ((BasePlugin)this).Config.Bind<double>("VIP.OutCombat", "Move Speed Multiplier", 1.25, "Multiply move speed when user is out of combat. -1.0 to disable.");
			VIP_OutCombat_ResYield = ((BasePlugin)this).Config.Bind<double>("VIP.OutCombat", "Resource Yield Multiplier", 2.0, "Multiply resource yield (not item drop) when user is out of combat. -1.0 to disable.");
			HunterHuntedEnabled = ((BasePlugin)this).Config.Bind<bool>("HunterHunted", "Enable", true, "Enable/disable the HunterHunted system.");
			HeatCooldown = ((BasePlugin)this).Config.Bind<int>("HunterHunted", "Heat Cooldown", 10, "Set the reduction value for player heat per minute.");
			Ambush_Interval = ((BasePlugin)this).Config.Bind<int>("HunterHunted", "Ambush Interval", 60, "Set how many seconds player can be ambushed again since last ambush.");
			Ambush_Chance = ((BasePlugin)this).Config.Bind<int>("HunterHunted", "Ambush Chance", 50, "Set the percentage that an ambush may occur for every cooldown interval.");
			Ambush_Despawn_Unit_Timer = ((BasePlugin)this).Config.Bind<float>("HunterHunted", "Ambush Despawn Timer", 300f, "Despawn the ambush squad after this many second if they are still alive.\nMust be higher than 1.");
			VBloodHeatMultiplier = ((BasePlugin)this).Config.Bind<int>("HunterHunted", "VBlood Heat Multiplier", 20, "Multiply the heat generated by VBlood kills.");
			EnableExperienceSystem = ((BasePlugin)this).Config.Bind<bool>("Experience", "Enable", true, "Enable/disable the the Experience System.");
			ShouldAllowGearLevel = ((BasePlugin)this).Config.Bind<bool>("Experience", "Allow Gear Level", false, "Enable/disable gear level adjustment.");
			EnableLevelRewards = ((BasePlugin)this).Config.Bind<bool>("Experience", "Enable Level Rewards", false, "Enable rewards per level.");
			EasyLevel15 = ((BasePlugin)this).Config.Bind<bool>("Experience", "Easy lvl 15", true, "Makes level 15 much easier to reach so players dont get held up by the quest on it.");
			MaxLevel = ((BasePlugin)this).Config.Bind<int>("Experience", "Max Level", 80, "Configure the experience system max level.");
			EXPMultiplier = ((BasePlugin)this).Config.Bind<float>("Experience", "Multiplier", 1f, "Multiply the EXP gained by player.\nEx.: 0.7f -> Will reduce the EXP gained by 30%\nFormula: UnitKilledLevel * EXPMultiplier");
			VBloodEXPMultiplier = ((BasePlugin)this).Config.Bind<float>("Experience", "VBlood Multiplier", 15f, "Multiply EXP gained from VBlood kills.\nFormula: EXPGained * VBloodMultiplier * EXPMultiplier");
			EXPFormula_1 = ((BasePlugin)this).Config.Bind<float>("Experience", "Constant", 0.2f, "Increase or decrease the required EXP to level up.\nFormula: (level/constant)^2\nEXP Table & Formula: https://bit.ly/3npqdJw");
			EXPGroupModifier = ((BasePlugin)this).Config.Bind<double>("Experience", "Group Modifier", 0.75, "Set the modifier for EXP gained for each ally(player) in vicinity.\nExample if you have 2 ally nearby, EXPGained = ((EXPGained * Modifier)*Modifier)");
			EXPGroupMaxDistance = ((BasePlugin)this).Config.Bind<float>("Experience", "Group Range", 50f, "Set the maximum distance an ally(player) has to be from the player for them to share EXP with the player");
			EXPGroupLevelScheme = ((BasePlugin)this).Config.Bind<int>("Experience", "Group level Scheme", 3, "Configure the group levelling scheme. See documentation.");
			pvpXPLoss = ((BasePlugin)this).Config.Bind<float>("Rates, Experience", "PvP XP Loss", 0f, "Sets the flat XP Lost on a PvP death");
			pvpXPLossPerLevel = ((BasePlugin)this).Config.Bind<float>("Rates, Experience", "PvP XP Loss per Level", 0f, "Sets the XP Lost per level of the dying player on a PvP death");
			pvpXPLossPercent = ((BasePlugin)this).Config.Bind<float>("Rates, Experience", "PvP XP Loss Percent", 0f, "Sets the percentage of XP to the next level lost on a PvP death");
			pvpXPLossPercentPerLevel = ((BasePlugin)this).Config.Bind<float>("Rates, Experience", "PvP XP Loss Percent per Level", 0f, "Sets the percentage of XP to the next level lost per level of the dying player on a PvP death");
			pvpXPLossMultPerLvlDiff = ((BasePlugin)this).Config.Bind<float>("Rates, Experience", "PvP XP Loss Per lvl Diff", 0f, "Adds this times the number of levels higher than your killer you are as an additional percent to your xp lost on a PvP death.");
			pvpXPLossMultPerLvlDiffSq = ((BasePlugin)this).Config.Bind<float>("Rates, Experience", "PvP XP Loss Per lvl Diff squared", 0f, "Adds this times the square of the number of levels higher than your killer you are as an additional percent to your xp lost on a PvP death.");
			pveXPLoss = ((BasePlugin)this).Config.Bind<float>("Rates, Experience", "PvE XP Loss", 0f, "Sets the flat XP Lost on a PvE death");
			pveXPLossPerLevel = ((BasePlugin)this).Config.Bind<float>("Rates, Experience", "PvE XP Loss per Level", 0f, "Sets the XP Lost per level of the dying player on a PvE death");
			pveXPLossPercent = ((BasePlugin)this).Config.Bind<float>("Rates, Experience", "PvE XP Loss Percent", 10f, "Sets the percentage of XP to the next level lost on a PvE death");
			pveXPLossPercentPerLevel = ((BasePlugin)this).Config.Bind<float>("Rates, Experience", "PvE XP Loss Percent per Level", 0f, "Sets the percentage of XP to the next level lost per level of the dying player on a PvE death");
			pveXPLossMultPerLvlDiff = ((BasePlugin)this).Config.Bind<float>("Rates, Experience", "PvE XP Loss Mult Per lvl Diff", 0f, "Adds this times the number of levels higher than your killer you are as an additional percent to your xp lost on a PvE death.");
			pveXPLossMultPerLvlDiffSq = ((BasePlugin)this).Config.Bind<float>("Rates, Experience", "PvE XP Loss Per lvl Diff squared", 0f, "Adds this times the square of the number of levels higher than your killer you are as an additional percent to your xp lost on a PvE death.");
			xpLossOnDown = ((BasePlugin)this).Config.Bind<bool>("Rates, Experience", "XP Lost on Down", false, "Vampires are treated as dead for the XP system when they are downed.");
			xpLossOnRelease = ((BasePlugin)this).Config.Bind<bool>("Rates, Experience", "XP Lost on Release", true, "Vampires are treated as dead for the XP system when they release, incentivising saving allies.");
			EnableWeaponMaster = ((BasePlugin)this).Config.Bind<bool>("Mastery", "Enable Weapon Mastery", true, "Enable/disable the weapon mastery system.");
			EnableWeaponMasterDecay = ((BasePlugin)this).Config.Bind<bool>("Mastery", "Enable Mastery Decay", false, "Enable/disable the decay of weapon mastery when the user is offline.");
			WeaponMaxMastery = ((BasePlugin)this).Config.Bind<double>("Mastery", "Max Mastery Value", 100.0, "Configure the maximum mastery the user can atain. (100000 is 100%)");
			MasteryCombatTick = ((BasePlugin)this).Config.Bind<int>("Mastery", "Mastery Value/Combat Ticks", 5, "Configure the amount of mastery gained per combat ticks. (5 -> 0.005%)");
			MasteryMaxCombatTicks = ((BasePlugin)this).Config.Bind<int>("Mastery", "Max Combat Ticks", 12, "Mastery will no longer increase after this many ticks is reached in combat. (1 tick = 5 seconds)");
			WeaponMasterMultiplier = ((BasePlugin)this).Config.Bind<double>("Mastery", "Mastery Multiplier", 1.0, "Multiply the gained mastery value by this amount.");
			WeaponMastery_VBloodMultiplier = ((BasePlugin)this).Config.Bind<double>("Mastery", "VBlood Mastery Multiplier", 15.0, "Multiply Mastery gained from VBlood kill.");
			DetailedMasteryInfo = ((BasePlugin)this).Config.Bind<bool>("Mastery", "Detailed Mastery Info", false, "Shows all mastery benefits when you use the .mastery command.");
			UnarmedStats = ((BasePlugin)this).Config.Bind<string>("Rates, Mastery", "Unarmed Stats", " 0, 5 ", "The stat IDs for what this weapon should boost, should be able to handle any number of stats. See the readme for a list of stat IDs.");
			UnarmedRates = ((BasePlugin)this).Config.Bind<string>("Rates, Mastery", "Unarmed Rates", " 0.25, 0.01 ", "The amount per point of mastery the stat should be boosted by. Some stats, like crit, have 1 as 100%, and CDR is % mastery to reach 50% cdr, so configure appropriately.");
			SpearStats = ((BasePlugin)this).Config.Bind<string>("Rates, Mastery", "Spear Stats", " 0 ", "The stat IDs for what this weapon should boost, should be able to handle any number of stats. See the readme for a list of stat IDs.");
			SpearRates = ((BasePlugin)this).Config.Bind<string>("Rates, Mastery", "Spear Rates", " 0.25", "The amount per point of mastery the stat should be boosted by. Some stats, like crit, have 1 as 100%, and CDR is % mastery to reach 50% cdr, so configure appropriately.");
			SwordStats = ((BasePlugin)this).Config.Bind<string>("Rates, Mastery", "Sword Stats", " 0, 25 ", "The stat IDs for what this weapon should boost, should be able to handle any number of stats. See the readme for a list of stat IDs.");
			SwordRates = ((BasePlugin)this).Config.Bind<string>("Rates, Mastery", "Sword Rates", " 0.125, 0.125 ", "The amount per point of mastery the stat should be boosted by. Some stats, like crit, have 1 as 100%, and CDR is % mastery to reach 50% cdr, so configure appropriately.");
			ScytheStats = ((BasePlugin)this).Config.Bind<string>("Rates, Mastery", "Scythe Stats", " 0, 29 ", "The stat IDs for what this weapon should boost, should be able to handle any number of stats. See the readme for a list of stat IDs.");
			ScytheRates = ((BasePlugin)this).Config.Bind<string>("Rates, Mastery", "Scythe Rates", " 0.125, 0.00125 ", "The amount per point of mastery the stat should be boosted by. Some stats, like crit, have 1 as 100%, and CDR is % mastery to reach 50% cdr, so configure appropriately.");
			CrossbowStats = ((BasePlugin)this).Config.Bind<string>("Rates, Mastery", "Crossbow Stats", " 29 ", "The stat IDs for what this weapon should boost, should be able to handle any number of stats. See the readme for a list of stat IDs.");
			CrossbowRates = ((BasePlugin)this).Config.Bind<string>("Rates, Mastery", "Crossbow Rates", " 0.0025", "The amount per point of mastery the stat should be boosted by. Some stats, like crit, have 1 as 100%, and CDR is % mastery to reach 50% cdr, so configure appropriately.");
			MaceStats = ((BasePlugin)this).Config.Bind<string>("Rates, Mastery", "Mace Stats", " 4 ", "The stat IDs for what this weapon should boost, should be able to handle any number of stats. See the readme for a list of stat IDs.");
			MaceRates = ((BasePlugin)this).Config.Bind<string>("Rates, Mastery", "Mace Rates", " 1 ", "The amount per point of mastery the stat should be boosted by. Some stats, like crit, have 1 as 100%, and CDR is % mastery to reach 50% cdr, so configure appropriately.");
			SlasherStats = ((BasePlugin)this).Config.Bind<string>("Rates, Mastery", "Slasher Stats", " 29, 5 ", "The stat IDs for what this weapon should boost, should be able to handle any number of stats. See the readme for a list of stat IDs.");
			SlasherRates = ((BasePlugin)this).Config.Bind<string>("Rates, Mastery", "Slasher Rates", " 0.00125, 0.005 ", "The amount per point of mastery the stat should be boosted by. Some stats, like crit, have 1 as 100%, and CDR is % mastery to reach 50% cdr, so configure appropriately.");
			AxeStats = ((BasePlugin)this).Config.Bind<string>("Rates, Mastery", "Axe Stats", " 0, 4 ", "The stat IDs for what this weapon should boost, should be able to handle any number of stats. See the readme for a list of stat IDs.");
			AxeRates = ((BasePlugin)this).Config.Bind<string>("Rates, Mastery", "Axe Rates", " 0.125, 0.5 ", "The amount per point of mastery the stat should be boosted by. Some stats, like crit, have 1 as 100%, and CDR is % mastery to reach 50% cdr, so configure appropriately.");
			FishingPoleStats = ((BasePlugin)this).Config.Bind<string>("Rates, Mastery", "Fishing Pole Stats", " ", "The stat IDs for what this weapon should boost, should be able to handle any number of stats. See the readme for a list of stat IDs.");
			FishingPoleRates = ((BasePlugin)this).Config.Bind<string>("Rates, Mastery", "Fishing Pole Rates", " ", "The amount per point of mastery the stat should be boosted by. Some stats, like crit, have 1 as 100%, and CDR is % mastery to reach 50% cdr, so configure appropriately.");
			SpellStats = ((BasePlugin)this).Config.Bind<string>("Rates, Mastery", "Spell Stats", " 7 ", "The stat IDs for what this weapon should boost, should be able to handle any number of stats. See the readme for a list of stat IDs.");
			SpellRates = ((BasePlugin)this).Config.Bind<string>("Rates, Mastery", "Spell Rates", " 100 ", "The amount per point of mastery the stat should be boosted by. Some stats, like crit, have 1 as 100%, and CDR is % mastery to reach 50% cdr, so configure appropriately.");
			RapierStats = ((BasePlugin)this).Config.Bind<string>("Rates, Mastery", "Rapier Stats", " 29, 32 ", "The stat IDs for what this weapon should boost, should be able to handle any number of stats. See the readme for a list of stat IDs.");
			RapierRates = ((BasePlugin)this).Config.Bind<string>("Rates, Mastery", "Rapier Rates", " 0.00125, 0.00125 ", "The amount per point of mastery the stat should be boosted by. Some stats, like crit, have 1 as 100%, and CDR is % mastery to reach 50% cdr, so configure appropriately.");
			PistolStats = ((BasePlugin)this).Config.Bind<string>("Rates, Mastery", "Pistol Stats", " 29, 30 ", "The stat IDs for what this weapon should boost, should be able to handle any number of stats. See the readme for a list of stat IDs.");
			PistolRates = ((BasePlugin)this).Config.Bind<string>("Rates, Mastery", "Pistol Rates", " 0.00125, 0.0125 ", "The amount per point of mastery the stat should be boosted by. Some stats, like crit, have 1 as 100%, and CDR is % mastery to reach 50% cdr, so configure appropriately.");
			GreatswordStats = ((BasePlugin)this).Config.Bind<string>("Rates, Mastery", "Greatsword Stats", " 0, 30 ", "The stat IDs for what this weapon should boost, should be able to handle any number of stats. See the readme for a list of stat IDs.");
			GreatswordRates = ((BasePlugin)this).Config.Bind<string>("Rates, Mastery", "Greatsword Rates", " 0.125, 0.0125 ", "The amount per point of mastery the stat should be boosted by. Some stats, like crit, have 1 as 100%, and CDR is % mastery to reach 50% cdr, so configure appropriately.");
			effectivenessSubSystemEnabled = ((BasePlugin)this).Config.Bind<bool>("Mastery", "Enable Effectiveness Subsystem", true, "Enables the Effectiveness mastery subsystem, which lets you reset your mastery to gain a multiplier to the effects of the matching mastery.");
			maxEffectiveness = ((BasePlugin)this).Config.Bind<float>("Mastery", "Maximum Effectiveness", 5f, "The maximum mastery effectiveness where 1 is 100%.");
			growthSubSystemEnabled = ((BasePlugin)this).Config.Bind<bool>("Mastery", "Enable Growth Subsystem", true, "Enables the growth subsystem, when you reset mastery either increases or decreases your matching mastery growth rate, depending on config.");
			minGrowth = ((BasePlugin)this).Config.Bind<float>("Mastery", "Minimum Growth Rate", 0.1f, "The minimum growth rate, where 1 is 100%");
			maxGrowth = ((BasePlugin)this).Config.Bind<float>("Mastery", "Maximum Growth Rate", 10f, "the maximum growth rate where 1 is 100%");
			growthPerEfficency = ((BasePlugin)this).Config.Bind<float>("Mastery", "Growth per efficency", -1f, "The amount of growth gained per point of efficency gained, if negative will reduce accordingly (gaining 100% efficency with -1 here will halve your current growth)");
			WeaponDecayInterval = ((BasePlugin)this).Config.Bind<int>("Mastery", "Decay Interval", 60, "Every amount of seconds the user is offline by the configured value will translate as 1 decay tick.");
			Offline_Weapon_MasteryDecayValue = ((BasePlugin)this).Config.Bind<int>("Mastery", "Decay Value", 1, "Mastery will decay by this amount for every decay tick.(1 -> 0.001%)");
			WeaponMasterySpellMasteryNeedsNoneToUse = ((BasePlugin)this).Config.Bind<bool>("Mastery", "Unarmed Only Spell Mastery Use", false, "Gain the benefits of spell mastery only when you have no weapon equipped.");
			WeaponMasterySpellMasteryNeedsNoneToLearn = ((BasePlugin)this).Config.Bind<bool>("Mastery", "Unarmed Only Spell Mastery Learning", true, "Progress spell mastery only when you have no weapon equipped.");
			WeaponLinearSpellMastery = ((BasePlugin)this).Config.Bind<bool>("Mastery", "Linear Mastery CDR", true, "Changes CDR from mastery to provide a linear increase to spells able to be cast in a given time by making the cdr diminishing.");
			WeaponSpellMasteryCDRStacks = ((BasePlugin)this).Config.Bind<bool>("Mastery", "Mastery CDR stacks", true, "Allows mastery cdr to stack with that from other sources, the reduction is multiplicative. E.G. Mist signet (10% cdr) and 100% mastery (50% cdr) will result in 55% total cdr, or 120%ish faster cooldowns.");
			bloodlinesEnabled = ((BasePlugin)this).Config.Bind<bool>("Bloodlines", "Enable Bloodlines", true, "Enables the Effectiveness mastery subsystem, which lets you reset your mastery to gain a multiplier to the effects of the matching mastery.");
			mercilessBloodlines = ((BasePlugin)this).Config.Bind<bool>("Bloodlines", "Merciless Bloodlines", true, "Causes bloodlines to only grow when you kill something with a matching bloodline of higher strength, finally, a reward when you accidentally kill that 100% blood you found");
			draculaGetsAll = ((BasePlugin)this).Config.Bind<bool>("Bloodlines", "Dracula inherits all bloodlines", true, "Determines if Dracula (Frail) blood should inherit a portion of the other bloodlines.");
			bloodlineGrowthMultiplier = ((BasePlugin)this).Config.Bind<double>("Bloodlines", "Bloodline growth multiplier", 1.0, "The multiplier applied to all bloodline gains.");
			bloodlineVBloodMultiplier = ((BasePlugin)this).Config.Bind<double>("Bloodlines", "Bloodline VBlood Multiplier", 25.0, "The multiplier applied to the effective level of VBlood enemies for bloodline gains.");
			bloodlineEfficencySubSystem = ((BasePlugin)this).Config.Bind<bool>("Bloodlines", "Enable Effectiveness Subsystem", true, "Enables the Effectiveness bloodline subsystem, which lets you reset your bloodline to gain a multiplier to the effects of the matching bloodline.");
			bloodlineGrowthSubsystem = ((BasePlugin)this).Config.Bind<bool>("Bloodlines", "Enable Growth Subsystem", true, "Enables the Growth Bloodline subsystem, same as the one for mastery");
			MaxBloodlineStrength = ((BasePlugin)this).Config.Bind<double>("Bloodlines", "Maximum Strength", 100.0, "The maximum strength for a bloodline in percentage.");
			maxBloodlineEfficency = ((BasePlugin)this).Config.Bind<double>("Bloodlines", "Maximum Effectiveness", 5.0, "The maximum bloodline effectiveness where 1 is 100%.");
			minBloodlineGrowth = ((BasePlugin)this).Config.Bind<double>("Bloodlines", "Minimum Growth Rate", 0.1, "The minimum growth rate, where 1 is 100%");
			maxBloodlineGrowth = ((BasePlugin)this).Config.Bind<double>("Bloodlines", "Maximum Growth Rate", 10.0, "the maximum growth rate where 1 is 100%");
			bloodlineGrowthPerEfficency = ((BasePlugin)this).Config.Bind<double>("Bloodlines", "Growth per efficency", -1.0, "The amount of growth gained per point of efficency gained, if negative will reduce accordingly (gaining 100% efficency with -1 here will halve your current growth)");
			draculaBloodlineStats = ((BasePlugin)this).Config.Bind<string>("Rates, Bloodline", "Dracula Bloodline Stats", "", "The stat IDs for the frailed bloodline of Dracula the Progenitor, Active only with frailed blood.");
			draculaBloodlineMinStrengths = ((BasePlugin)this).Config.Bind<string>("Rates, Bloodline", "Dracula Bloodline Minimum Strengths", "", "The minimum bloodline strength to recieve the specified stat.");
			draculaBloodlineRates = ((BasePlugin)this).Config.Bind<string>("Rates, Bloodline", "Dracula Bloodline Rates", "", "The amount per bloodline strength % recieved once strength is met, Note that Dracula's Bloodline recieves a portion of all your other bloodlines.");
			arwenBloodlineStats = ((BasePlugin)this).Config.Bind<string>("Rates, Bloodline", "Arwen Bloodline Stats", "10, 5, 39", "The stat IDs for the bloodline of Arwen the Godeater, Active only with creature blood.");
			arwenBloodlineMinStrengths = ((BasePlugin)this).Config.Bind<string>("Rates, Bloodline", "Arwen Bloodline Minimum Strengths", "0, 50, 100", "The minimum bloodline strength to recieve the specified stat.");
			arwenBloodlineRates = ((BasePlugin)this).Config.Bind<string>("Rates, Bloodline", "Arwen Bloodline Rates", "0.25, 0.005, 0.0025", "The amount per bloodline strength % recieved once strength is met.");
			ilvrisBloodlineStats = ((BasePlugin)this).Config.Bind<string>("Rates, Bloodline", "Ilvris Bloodline Stats", "9, 0, 42", "The stat IDs for the bloodline of Ilvris Dragonblood, Active only with warrior blood.");
			ilvrisBloodlineMinStrengths = ((BasePlugin)this).Config.Bind<string>("Rates, Bloodline", "Ilvris Bloodline Minimum Strengths", "0, 50, 100 ", "The minimum bloodline strength to recieve the specified stat.");
			ilvrisBloodlineRates = ((BasePlugin)this).Config.Bind<string>("Rates, Bloodline", "Ilvris Bloodline Rates", "0.25, 0.1, 0.0025 ", "The amount per bloodline strength % recieved once strength is met.");
			ayaBloodlineStats = ((BasePlugin)this).Config.Bind<string>("Rates, Bloodline", "Aya Bloodline Stats", "19, 29, 44", "The stat IDs for the bloodline of Aya the Shadowlord, Active only with rogue blood.");
			ayaBloodlineMinStrengths = ((BasePlugin)this).Config.Bind<string>("Rates, Bloodline", "Aya Bloodline Minimum Strengths", "0, 50, 100 ", "The minimum bloodline strength to recieve the specified stat.");
			ayaBloodlineRates = ((BasePlugin)this).Config.Bind<string>("Rates, Bloodline", "Aya Bloodline Rates", "0.25, 0.001, 0.0025 ", "The amount per bloodline strength % recieved once strength is met.");
			nytheriaBloodlineStats = ((BasePlugin)this).Config.Bind<string>("Rates, Bloodline", "Nytheria Bloodline Stats", "11, 30, 38", "The stat IDs for the bloodline of Nytheria the Destroyer, Active only with brute blood.");
			nytheriaBloodlineMinStrengths = ((BasePlugin)this).Config.Bind<string>("Rates, Bloodline", "Nytheria Bloodline Minimum Strengths", "0, 50, 100 ", "The minimum bloodline strength to recieve the specified stat.");
			nytheriaBloodlineRates = ((BasePlugin)this).Config.Bind<string>("Rates, Bloodline", "Nytheria Bloodline Rates", "0.25, 0.01, 0.0025", "The amount per bloodline strength % recieved once strength is met.");
			hadubertBloodlineStats = ((BasePlugin)this).Config.Bind<string>("Rates, Bloodline", "Hadubert Bloodline Stats", "25, 7, 40", "The stat IDs for the bloodline of Hadubert the Inferno, Active only with scholar blood.");
			hadubertBloodlineMinStrengths = ((BasePlugin)this).Config.Bind<string>("Rates, Bloodline", "Hadubert Bloodline Minimum Strengths", "0, 50, 100 ", "The minimum bloodline strength to recieve the specified stat.");
			hadubertBloodlineRates = ((BasePlugin)this).Config.Bind<string>("Rates, Bloodline", "Hadubert Bloodline Rates", "0.1, 200, 0.0025", "The amount per bloodline strength % recieved once strength is met.");
			reiBloodlineStats = ((BasePlugin)this).Config.Bind<string>("Rates, Bloodline", "Rei Bloodline Stats", "20, 3, 52, 53, 54", "The stat IDs for the bloodline of Rei the Binder, Active only with worker blood.");
			reiBloodlineMinStrengths = ((BasePlugin)this).Config.Bind<string>("Rates, Bloodline", "Rei Bloodline Minimum Strengths", "0, 50, 100, 100, 100", "The minimum bloodline strength to recieve the specified stat.");
			reiBloodlineRates = ((BasePlugin)this).Config.Bind<string>("Rates, Bloodline", "Rei Bloodline Rates", "0.25, 0.01, 0.0025, 0.0025, 0.0025", "The amount per bloodline strength % recieved once strength is met.");
			semikaBloodlineStats = ((BasePlugin)this).Config.Bind<string>("Rates, Bloodline", "Semika Bloodline Stats", "31, 5, 39", "The stat IDs for the bloodline of Semika the Evershifting, Active only with mutant blood.");
			semikaBloodlineMinStrengths = ((BasePlugin)this).Config.Bind<string>("Rates, Bloodline", "Semika Bloodline Minimum Strengths", "0, 50, 100", "The minimum bloodline strength to recieve the specified stat.");
			semikaBloodlineRates = ((BasePlugin)this).Config.Bind<string>("Rates, Bloodline", "Semika Bloodline Rates", "0.005, 0.005, 0.0025", "The amount per bloodline strength % recieved once strength is met.");
			bloodlineNames = ((BasePlugin)this).Config.Bind<string>("Rates, Bloodline", "Bloodline Names", "Dracula the Progenitor, Arwen the Godeater, Ilvris Dragonblood, Aya the Shadowlord, Nytheria the Destroyer, Hadubert the Inferno, Rei the Binder, Semika the Evershifting", "Rename the bloodlines here, the starting names are from supporters, Seperate names with commas, must contain exactly 8 names.");
			buffID = ((BasePlugin)this).Config.Bind<int>("Buff System", "Buff GUID", 1444835872, "The GUID of the buff you want to hijack for the buffs from mastery, bloodlines, and everything else from this mod\nDefault is now boneguard set bonus 2, 1409441911 is cloak, but you can set anything else too");
			forbiddenBuffID = ((BasePlugin)this).Config.Bind<int>("Buff System", "Forbidden Buff GUID", -161632603, "The GUID of the buff that prohibits you from getting mastery buffs\nDefault is boneguard set bonus 1, so you cant double up.");
			appliedBuff = ((BasePlugin)this).Config.Bind<int>("Buff System", "Applied Buff", 1444835872, "The GUID of the buff that gets applied when mastery, bloodline, etc changes. Doesnt need to be the same as the Buff GUID.");
			humanReadablePercentageStats = ((BasePlugin)this).Config.Bind<bool>("Buff System", "Human Readable Percentage Stats", false, "Determines if rates for percentage stats should be read as out of 100 instead of 1, off by default for compatability.");
			inverseMultiplersDisplayReduction = ((BasePlugin)this).Config.Bind<bool>("Buff System", "Inverse Multipliers Display Reduction", true, "Determines if inverse multiplier stats dispay their reduction, or the final value.");
			EnableWorldDynamics = ((BasePlugin)this).Config.Bind<bool>("World Dynamics", "Enable Faction Dynamics", false, "All other faction dynamics data & config is withing /RPGMods/Saves/factionstats.json file.");
			WDGrowOnKill = ((BasePlugin)this).Config.Bind<bool>("World Dynamics", "Factions grow on kill", false, "Inverts the faction dynamic system, so that they grow stronger when killed and weaker over time.");
			xpLogging = ((BasePlugin)this).Config.Bind<bool>("Debug", "XP system logging", false, "Logs detailed information about the experience system in your console, enable before sending me any errors with the xp system!");
			buffLogging = ((BasePlugin)this).Config.Bind<bool>("Debug", "Buff system logging", false, "Logs detailed information about the buff system in your console, enable before sending me any errors with the buff system!");
			deathLogging = ((BasePlugin)this).Config.Bind<bool>("Debug", "Death logging", false, "Logs detailed information about death events in your console, enable before sending me any errors with the xp system!");
			saveLogging = ((BasePlugin)this).Config.Bind<bool>("Debug", "Save system logging", false, "Logs detailed information about the save system in your console, enable before sending me any errors with the buff system!");
			factionLogging = ((BasePlugin)this).Config.Bind<bool>("Debug", "Wanted system logging", false, "Logs detailed information about the wanted system in your console, enable before sending me any errors with the wanted system!");
			squadSpawnLogging = ((BasePlugin)this).Config.Bind<bool>("Debug", "Squad spawn logging", false, "Logs information about squads spawning into your console.");
			if (!Directory.Exists("BepInEx/config/RPGMods"))
			{
				Directory.CreateDirectory("BepInEx/config/RPGMods");
			}
			if (!Directory.Exists("BepInEx/config/RPGMods/Saves"))
			{
				Directory.CreateDirectory("BepInEx/config/RPGMods/Saves");
			}
			if (!Directory.Exists("BepInEx/config/RPGMods/Saves/Backup"))
			{
				Directory.CreateDirectory("BepInEx/config/RPGMods/Saves/Backup");
			}
			if (!File.Exists("BepInEx/config/RPGMods/kits.json"))
			{
				File.Create("BepInEx/config/RPGMods/kits.json").Dispose();
			}
		}

		public override void Load()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			if (!IsServer)
			{
				((BasePlugin)this).Log.LogWarning((object)"RPGMods is a server plugin. Not continuing to load on client.");
				return;
			}
			InitConfig();
			Logger = ((BasePlugin)this).Log;
			harmony = new Harmony("RPGMods");
			harmony.PatchAll(Assembly.GetExecutingAssembly());
			TaskRunner.Initialize();
			((BasePlugin)this).Log.LogInfo((object)"Plugin RPGMods is loaded!");
		}

		public override bool Unload()
		{
			AutoSaveSystem.SaveDatabase();
			((BasePlugin)this).Config.Clear();
			harmony.UnpatchSelf();
			TaskRunner.Destroy();
			return true;
		}

		public void OnGameInitialized()
		{
			Initialize();
		}

		public static void Initialize()
		{
			//IL_0c13: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c18: Unknown result type (might be due to invalid IL or missing references)
			Logger.LogInfo((object)("Trying to Initalize RPGMods, isInitalized already: " + isInitialized));
			if (!isInitialized)
			{
				Logger.LogInfo((object)"Initalizing RPGMods");
				Helper.CreatePlayerCache();
				Helper.GetServerGameSettings(out Helper.SGS);
				Helper.GetServerGameManager(out Helper.SGM);
				Helper.GetUserActivityGridSystem(out Helper.UAGS);
				AutoSaveSystem.LoadDatabase();
				Logger.LogInfo((object)"Registering commands");
				CommandRegistry.RegisterAll();
				Waypoint.WaypointLimit = WaypointLimit.Value;
				Logger.LogInfo((object)"Loading permission config");
				PermissionSystem.isVIPSystem = EnableVIPSystem.Value;
				PermissionSystem.isVIPWhitelist = EnableVIPWhitelist.Value;
				PermissionSystem.VIP_Permission = VIP_Permission.Value;
				PermissionSystem.VIP_InCombat_ResYield = VIP_InCombat_ResYield.Value;
				PermissionSystem.VIP_InCombat_DurabilityLoss = VIP_InCombat_DurabilityLoss.Value;
				PermissionSystem.VIP_InCombat_MoveSpeed = VIP_InCombat_MoveSpeed.Value;
				PermissionSystem.VIP_InCombat_GarlicResistance = VIP_InCombat_GarlicResistance.Value;
				PermissionSystem.VIP_InCombat_SilverResistance = VIP_InCombat_SilverResistance.Value;
				PermissionSystem.VIP_OutCombat_ResYield = VIP_OutCombat_ResYield.Value;
				PermissionSystem.VIP_OutCombat_DurabilityLoss = VIP_OutCombat_DurabilityLoss.Value;
				PermissionSystem.VIP_OutCombat_MoveSpeed = VIP_OutCombat_MoveSpeed.Value;
				PermissionSystem.VIP_OutCombat_GarlicResistance = VIP_OutCombat_GarlicResistance.Value;
				PermissionSystem.VIP_OutCombat_SilverResistance = VIP_OutCombat_SilverResistance.Value;
				Logger.LogInfo((object)"Loading HunterHunted config");
				HunterHuntedSystem.isActive = HunterHuntedEnabled.Value;
				HunterHuntedSystem.heat_cooldown = HeatCooldown.Value;
				HunterHuntedSystem.ambush_interval = Ambush_Interval.Value;
				HunterHuntedSystem.ambush_chance = Ambush_Chance.Value;
				HunterHuntedSystem.vBloodMultiplier = VBloodHeatMultiplier.Value;
				if (Ambush_Despawn_Unit_Timer.Value < 1f)
				{
					Ambush_Despawn_Unit_Timer.Value = 300f;
				}
				HunterHuntedSystem.ambush_despawn_timer = Ambush_Despawn_Unit_Timer.Value + 0.44444f;
				Logger.LogInfo((object)"Loading XP config");
				ExperienceSystem.isEXPActive = EnableExperienceSystem.Value;
				ExperienceSystem.ShouldAllowGearLevel = ShouldAllowGearLevel.Value;
				ExperienceSystem.LevelRewardsOn = EnableLevelRewards.Value;
				ExperienceSystem.MaxLevel = MaxLevel.Value;
				ExperienceSystem.EXPMultiplier = EXPMultiplier.Value;
				ExperienceSystem.VBloodMultiplier = VBloodEXPMultiplier.Value;
				ExperienceSystem.EXPConstant = EXPFormula_1.Value;
				ExperienceSystem.GroupModifier = EXPGroupModifier.Value;
				ExperienceSystem.GroupMaxDistance = EXPGroupMaxDistance.Value;
				ExperienceSystem.easyLvl15 = EasyLevel15.Value;
				ExperienceSystem.pvpXPLoss = pvpXPLoss.Value;
				ExperienceSystem.pvpXPLossPerLevel = pvpXPLossPerLevel.Value;
				ExperienceSystem.pvpXPLossPercent = pvpXPLossPercent.Value;
				ExperienceSystem.pvpXPLossPercentPerLevel = pvpXPLossPercentPerLevel.Value;
				ExperienceSystem.pvpXPLossMultPerLvlDiff = pvpXPLossMultPerLvlDiff.Value;
				ExperienceSystem.pvpXPLossMultPerLvlDiffSq = pvpXPLossMultPerLvlDiffSq.Value;
				ExperienceSystem.pveXPLoss = pveXPLoss.Value;
				ExperienceSystem.pveXPLossPerLevel = pveXPLossPerLevel.Value;
				ExperienceSystem.pveXPLossPercent = pveXPLossPercent.Value;
				ExperienceSystem.pveXPLossPercentPerLevel = pveXPLossPercentPerLevel.Value;
				ExperienceSystem.pveXPLossMultPerLvlDiff = pveXPLossMultPerLvlDiff.Value;
				ExperienceSystem.pveXPLossMultPerLvlDiffSq = pveXPLossMultPerLvlDiffSq.Value;
				ExperienceSystem.xpLostOnDown = xpLossOnDown.Value;
				ExperienceSystem.xpLostOnRelease = xpLossOnRelease.Value;
				if (Enum.IsDefined(typeof(ExperienceSystem.GroupLevelScheme), EXPGroupLevelScheme.Value))
				{
					ExperienceSystem.groupLevelScheme = (ExperienceSystem.GroupLevelScheme)EXPGroupLevelScheme.Value;
				}
				Logger.LogInfo((object)"Loading weapon mastery config");
				WeaponMasterSystem.isMasteryEnabled = EnableWeaponMaster.Value;
				WeaponMasterSystem.isDecaySystemEnabled = EnableWeaponMasterDecay.Value;
				WeaponMasterSystem.Offline_DecayValue = Offline_Weapon_MasteryDecayValue.Value;
				WeaponMasterSystem.DecayInterval = WeaponDecayInterval.Value;
				WeaponMasterSystem.VBloodMultiplier = WeaponMastery_VBloodMultiplier.Value;
				WeaponMasterSystem.MasteryMultiplier = WeaponMasterMultiplier.Value;
				WeaponMasterSystem.MaxMastery = WeaponMaxMastery.Value;
				WeaponMasterSystem.MasteryCombatTick = MasteryCombatTick.Value;
				WeaponMasterSystem.MaxCombatTick = MasteryMaxCombatTicks.Value;
				WeaponMasterSystem.spellMasteryNeedsNoneToUse = WeaponMasterySpellMasteryNeedsNoneToUse.Value;
				WeaponMasterSystem.spellMasteryNeedsNoneToLearn = WeaponMasterySpellMasteryNeedsNoneToLearn.Value;
				WeaponMasterSystem.linearCDR = WeaponLinearSpellMastery.Value;
				WeaponMasterSystem.CDRStacks = WeaponSpellMasteryCDRStacks.Value;
				WeaponMasterSystem.growthSubSystemEnabled = growthSubSystemEnabled.Value;
				Mastery.detailedStatements = DetailedMasteryInfo.Value;
				WeaponMasterSystem.UnarmedStats = parseIntArrayConifg(UnarmedStats.Value);
				WeaponMasterSystem.UnarmedRates = parseDoubleArrayConifg(UnarmedRates.Value);
				WeaponMasterSystem.SpearStats = parseIntArrayConifg(SpearStats.Value);
				WeaponMasterSystem.SpearRates = parseDoubleArrayConifg(SpearRates.Value);
				WeaponMasterSystem.SwordStats = parseIntArrayConifg(SwordStats.Value);
				WeaponMasterSystem.SwordRates = parseDoubleArrayConifg(SwordRates.Value);
				WeaponMasterSystem.ScytheStats = parseIntArrayConifg(ScytheStats.Value);
				WeaponMasterSystem.ScytheRates = parseDoubleArrayConifg(ScytheRates.Value);
				WeaponMasterSystem.CrossbowStats = parseIntArrayConifg(CrossbowStats.Value);
				WeaponMasterSystem.CrossbowRates = parseDoubleArrayConifg(CrossbowRates.Value);
				WeaponMasterSystem.SlasherStats = parseIntArrayConifg(SlasherStats.Value);
				WeaponMasterSystem.SlasherRates = parseDoubleArrayConifg(SlasherRates.Value);
				WeaponMasterSystem.MaceStats = parseIntArrayConifg(MaceStats.Value);
				WeaponMasterSystem.MaceRates = parseDoubleArrayConifg(MaceRates.Value);
				WeaponMasterSystem.AxeStats = parseIntArrayConifg(AxeStats.Value);
				WeaponMasterSystem.AxeRates = parseDoubleArrayConifg(AxeRates.Value);
				WeaponMasterSystem.FishingPoleStats = parseIntArrayConifg(FishingPoleStats.Value);
				WeaponMasterSystem.FishingPoleRates = parseDoubleArrayConifg(FishingPoleRates.Value);
				WeaponMasterSystem.SpellStats = parseIntArrayConifg(SpellStats.Value);
				WeaponMasterSystem.SpellRates = parseDoubleArrayConifg(SpellRates.Value);
				WeaponMasterSystem.RapierStats = parseIntArrayConifg(RapierStats.Value);
				WeaponMasterSystem.RapierRates = parseDoubleArrayConifg(RapierRates.Value);
				WeaponMasterSystem.PistolStats = parseIntArrayConifg(PistolStats.Value);
				WeaponMasterSystem.PistolRates = parseDoubleArrayConifg(PistolRates.Value);
				WeaponMasterSystem.GreatSwordStats = parseIntArrayConifg(GreatswordStats.Value);
				WeaponMasterSystem.GreatSwordRates = parseDoubleArrayConifg(GreatswordRates.Value);
				WeaponMasterSystem.masteryStats = new int[13][]
				{
					WeaponMasterSystem.SpellStats,
					WeaponMasterSystem.UnarmedStats,
					WeaponMasterSystem.SpearStats,
					WeaponMasterSystem.SwordStats,
					WeaponMasterSystem.ScytheStats,
					WeaponMasterSystem.CrossbowStats,
					WeaponMasterSystem.MaceStats,
					WeaponMasterSystem.SlasherStats,
					WeaponMasterSystem.AxeStats,
					WeaponMasterSystem.FishingPoleStats,
					WeaponMasterSystem.RapierStats,
					WeaponMasterSystem.PistolStats,
					WeaponMasterSystem.GreatSwordStats
				};
				WeaponMasterSystem.masteryRates = new double[13][]
				{
					WeaponMasterSystem.SpellRates,
					WeaponMasterSystem.UnarmedRates,
					WeaponMasterSystem.SpearRates,
					WeaponMasterSystem.SwordRates,
					WeaponMasterSystem.ScytheRates,
					WeaponMasterSystem.CrossbowRates,
					WeaponMasterSystem.MaceRates,
					WeaponMasterSystem.SlasherRates,
					WeaponMasterSystem.AxeRates,
					WeaponMasterSystem.FishingPoleRates,
					WeaponMasterSystem.RapierRates,
					WeaponMasterSystem.PistolRates,
					WeaponMasterSystem.GreatSwordRates
				};
				WeaponMasterSystem.effectivenessSubSystemEnabled = effectivenessSubSystemEnabled.Value;
				WeaponMasterSystem.maxEffectiveness = maxEffectiveness.Value;
				WeaponMasterSystem.growthSubSystemEnabled = effectivenessSubSystemEnabled.Value;
				WeaponMasterSystem.minGrowth = minGrowth.Value;
				WeaponMasterSystem.maxGrowth = maxGrowth.Value;
				WeaponMasterSystem.growthPerEfficency = growthPerEfficency.Value;
				Logger.LogInfo((object)"Loading bloodlines config");
				Bloodlines.draculaStats = parseIntArrayConifg(draculaBloodlineStats.Value);
				Bloodlines.draculaMinStrength = parseDoubleArrayConifg(draculaBloodlineMinStrengths.Value);
				Bloodlines.draculaRates = parseDoubleArrayConifg(draculaBloodlineRates.Value);
				Bloodlines.arwenStats = parseIntArrayConifg(arwenBloodlineStats.Value);
				Bloodlines.arwenMinStrength = parseDoubleArrayConifg(arwenBloodlineMinStrengths.Value);
				Bloodlines.arwenRates = parseDoubleArrayConifg(arwenBloodlineRates.Value);
				Bloodlines.ilvrisStats = parseIntArrayConifg(ilvrisBloodlineStats.Value);
				Bloodlines.ilvrisMinStrength = parseDoubleArrayConifg(ilvrisBloodlineMinStrengths.Value);
				Bloodlines.ilvrisRates = parseDoubleArrayConifg(ilvrisBloodlineRates.Value);
				Bloodlines.ayaStats = parseIntArrayConifg(ayaBloodlineStats.Value);
				Bloodlines.ayaMinStrength = parseDoubleArrayConifg(ayaBloodlineMinStrengths.Value);
				Bloodlines.ayaRates = parseDoubleArrayConifg(ayaBloodlineRates.Value);
				Bloodlines.nytheriaStats = parseIntArrayConifg(nytheriaBloodlineStats.Value);
				Bloodlines.nytheriaMinStrength = parseDoubleArrayConifg(nytheriaBloodlineMinStrengths.Value);
				Bloodlines.nytheriaRates = parseDoubleArrayConifg(nytheriaBloodlineRates.Value);
				Bloodlines.hadubertStats = parseIntArrayConifg(hadubertBloodlineStats.Value);
				Bloodlines.hadubertMinStrength = parseDoubleArrayConifg(hadubertBloodlineMinStrengths.Value);
				Bloodlines.hadubertRates = parseDoubleArrayConifg(hadubertBloodlineRates.Value);
				Bloodlines.reiStats = parseIntArrayConifg(reiBloodlineStats.Value);
				Bloodlines.reiMinStrength = parseDoubleArrayConifg(reiBloodlineMinStrengths.Value);
				Bloodlines.reiRates = parseDoubleArrayConifg(reiBloodlineRates.Value);
				Bloodlines.semikaStats = parseIntArrayConifg(semikaBloodlineStats.Value);
				Bloodlines.semikaMinStrength = parseDoubleArrayConifg(semikaBloodlineMinStrengths.Value);
				Bloodlines.semikaRates = parseDoubleArrayConifg(semikaBloodlineRates.Value);
				string[] array = (Bloodlines.names = parseStringArrayConifg(bloodlineNames.Value));
				for (int i = 0; i < array.Length; i++)
				{
					Bloodlines.nameMap.TryAdd(array[i].ToLower().Trim(), i);
				}
				Bloodlines.stats = new int[8][]
				{
					Bloodlines.draculaStats,
					Bloodlines.arwenStats,
					Bloodlines.ilvrisStats,
					Bloodlines.ayaStats,
					Bloodlines.nytheriaStats,
					Bloodlines.hadubertStats,
					Bloodlines.reiStats,
					Bloodlines.semikaStats
				};
				Bloodlines.minStrengths = new double[8][]
				{
					Bloodlines.draculaMinStrength,
					Bloodlines.arwenMinStrength,
					Bloodlines.ilvrisMinStrength,
					Bloodlines.ayaMinStrength,
					Bloodlines.nytheriaMinStrength,
					Bloodlines.hadubertMinStrength,
					Bloodlines.reiMinStrength,
					Bloodlines.semikaMinStrength
				};
				Bloodlines.rates = new double[8][]
				{
					Bloodlines.draculaRates,
					Bloodlines.arwenRates,
					Bloodlines.ilvrisRates,
					Bloodlines.ayaRates,
					Bloodlines.nytheriaRates,
					Bloodlines.hadubertRates,
					Bloodlines.reiRates,
					Bloodlines.semikaRates
				};
				Bloodlines.areBloodlinesEnabled = bloodlinesEnabled.Value;
				Bloodlines.mercilessBloodlines = mercilessBloodlines.Value;
				Bloodlines.draculaGetsAll = draculaGetsAll.Value;
				Bloodlines.effectivenessSubSystemEnabled = bloodlineEfficencySubSystem.Value;
				Bloodlines.growthSubsystemEnabled = bloodlineGrowthSubsystem.Value;
				Bloodlines.MaxBloodlineStrength = MaxBloodlineStrength.Value;
				Bloodlines.maxBloodlineEfficency = maxBloodlineEfficency.Value;
				Bloodlines.maxBloodlineGrowth = maxBloodlineGrowth.Value;
				Bloodlines.minBloodlineGrowth = minBloodlineGrowth.Value;
				Bloodlines.growthPerEfficency = bloodlineGrowthPerEfficency.Value;
				Bloodlines.VBloodMultiplier = bloodlineVBloodMultiplier.Value;
				Bloodlines.growthMultiplier = bloodlineGrowthMultiplier.Value;
				Logger.LogInfo((object)"Loading world dynamics config");
				WorldDynamicsSystem.isFactionDynamic = EnableWorldDynamics.Value;
				WorldDynamicsSystem.growOnKill = WDGrowOnKill.Value;
				ExperienceSystem.xpLogging = xpLogging.Value;
				Helper.buffLogging = buffLogging.Value;
				AutoSaveSystem.saveLogging = saveLogging.Value;
				Helper.deathLogging = deathLogging.Value;
				Helper.buffGUID = buffID.Value;
				Helper.appliedBuff = new PrefabGUID(appliedBuff.Value);
				Helper.forbiddenBuffGUID = forbiddenBuffID.Value;
				Helper.humanReadablePercentageStats = humanReadablePercentageStats.Value;
				Helper.inverseMultipersDisplayReduction = inverseMultiplersDisplayReduction.Value;
				HunterHuntedSystem.factionLogging = factionLogging.Value;
				SquadList.showDebugLogs = squadSpawnLogging.Value;
				Logger.LogInfo((object)"Finished initialising");
				isInitialized = true;
			}
		}

		public static int[] parseIntArrayConifg(string data)
		{
			if (parseLogging)
			{
				Logger.LogInfo((object)(">>>parsing int array: " + data));
			}
			Match match = Regex.Match(data, "([0-9]+)");
			List<int> list = new List<int>();
			while (match.Success)
			{
				try
				{
					if (parseLogging)
					{
						Logger.LogInfo((object)(">>>got int: " + match.Value));
					}
					int item = int.Parse(match.Value, CultureInfo.InvariantCulture);
					if (parseLogging)
					{
						Logger.LogInfo((object)(">>>int parsed into: " + item));
					}
					list.Add(item);
				}
				catch
				{
					if (parseLogging)
					{
						Logger.LogWarning((object)("Error interperting integer value: " + match.ToString()));
					}
				}
				match = match.NextMatch();
			}
			if (parseLogging)
			{
				Logger.LogInfo((object)">>>done parsing int array");
			}
			return list.ToArray();
		}

		public static float[] parseFloatArrayConifg(string data)
		{
			if (parseLogging)
			{
				Logger.LogInfo((object)(">>>parsing float array: " + data));
			}
			Match match = Regex.Match(data, "[-+]?[0-9]*\\.?[0-9]+");
			List<float> list = new List<float>();
			while (match.Success)
			{
				try
				{
					if (parseLogging)
					{
						Logger.LogInfo((object)(">>>got float: " + match.Value));
					}
					float item = float.Parse(match.Value, CultureInfo.InvariantCulture);
					if (parseLogging)
					{
						Logger.LogInfo((object)(">>>float parsed into: " + item));
					}
					list.Add(item);
				}
				catch
				{
					Logger.LogWarning((object)("Error interperting float value: " + match.ToString()));
				}
				match = match.NextMatch();
			}
			if (parseLogging)
			{
				Logger.LogInfo((object)">>>done parsing float array");
			}
			return list.ToArray();
		}

		public static double[] parseDoubleArrayConifg(string data)
		{
			if (parseLogging)
			{
				Logger.LogInfo((object)(">>>parsing double array: " + data));
			}
			Match match = Regex.Match(data, "[-+]?[0-9]*\\.?[0-9]+");
			List<double> list = new List<double>();
			while (match.Success)
			{
				try
				{
					if (parseLogging)
					{
						Logger.LogInfo((object)(">>>got double: " + match.Value));
					}
					double item = double.Parse(match.Value, CultureInfo.InvariantCulture);
					if (parseLogging)
					{
						Logger.LogInfo((object)(">>>double parsed into: " + item));
					}
					list.Add(item);
				}
				catch
				{
					Logger.LogWarning((object)("Error interperting double value: " + match.ToString()));
				}
				match = match.NextMatch();
			}
			if (parseLogging)
			{
				Logger.LogInfo((object)">>>done parsing double array");
			}
			return list.ToArray();
		}

		public static string[] parseStringArrayConifg(string data)
		{
			if (parseLogging)
			{
				Logger.LogInfo((object)(">>>parsing comma seperated String array: " + data));
			}
			List<string> list = new List<string>();
			while (data.IndexOf(",") > 0)
			{
				string text = data.Substring(0, data.IndexOf(","));
				text.Trim();
				list.Add(text);
				data = data.Substring(data.IndexOf(",") + 1);
			}
			data.Trim();
			list.Add(data);
			if (parseLogging)
			{
				Logger.LogInfo((object)">>>done parsing string array");
			}
			return list.ToArray();
		}
	}
}
namespace RPGMods.Utils
{
	public class Alliance
	{
		public struct CloseAlly
		{
			public Entity userEntity;

			public User userComponent;

			public int currentXp;

			public int playerLevel;

			public ulong steamID;

			public float3 position;

			public bool isTrigger;
		}

		private static readonly int CacheAgeLimit = 300;

		private static bool ConvertToAlly(Entity entity, float3 position, bool logging, out CloseAlly ally)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = Plugin.Server.EntityManager;
			PlayerCharacter val = default(PlayerCharacter);
			if (!((EntityManager)(ref entityManager)).TryGetComponentData<PlayerCharacter>(entity, ref val))
			{
				if (logging)
				{
					ManualLogSource logger = Plugin.Logger;
					string text = DateTime.Now.ToString();
					entityManager = Plugin.Server.EntityManager;
					logger.LogInfo((object)(text + ": Player Character Component unavailable, available components are: " + ((EntityManager)(ref entityManager)).Debug.GetEntityInfo(entity)));
				}
				ally = default(CloseAlly);
				return false;
			}
			Entity userEntity = val.UserEntity;
			entityManager = Plugin.Server.EntityManager;
			User val2 = default(User);
			if (!((EntityManager)(ref entityManager)).TryGetComponentData<User>(userEntity, ref val2))
			{
				if (logging)
				{
					ManualLogSource logger2 = Plugin.Logger;
					string text2 = DateTime.Now.ToString();
					entityManager = Plugin.Server.EntityManager;
					logger2.LogInfo((object)(text2 + ": User Component unavailable, available components from pc.UserEntity are: " + ((EntityManager)(ref entityManager)).Debug.GetEntityInfo(userEntity)));
				}
				ally = default(CloseAlly);
				return false;
			}
			ulong platformId = val2.PlatformId;
			int playerLevel = 0;
			if (Database.player_experience.TryGetValue(platformId, out var value))
			{
				playerLevel = ExperienceSystem.convertXpToLevel(value);
			}
			ally = new CloseAlly
			{
				currentXp = value,
				playerLevel = playerLevel,
				steamID = platformId,
				userEntity = userEntity,
				userComponent = val2,
				position = position
			};
			return true;
		}

		public static List<CloseAlly> GetCloseAllies(Entity closeToEntity, Entity triggerEntity, float groupMaxDistance, bool useGroup, bool logging)
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: 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_0094: Expected O, but got Unknown
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			float num = groupMaxDistance * groupMaxDistance;
			if (logging)
			{
				Plugin.Logger.LogInfo((object)(DateTime.Now.ToString() + ": Fetching allies..."));
			}
			List<CloseAlly> list = new List<CloseAlly>();
			EntityManager entityManager;
			LocalToWorld componentData;
			if (!useGroup)
			{
				entityManager = Plugin.Server.EntityManager;
				componentData = ((EntityManager)(ref entityManager)).GetComponentData<LocalToWorld>(triggerEntity);
				float3 position = ((LocalToWorld)(ref componentData)).Position;
				if (ConvertToAlly(triggerEntity, position, logging, out var ally))
				{
					ally.isTrigger = true;
					list.Add(ally);
				}
			}
			else
			{
				GetAllies(triggerEntity, logging, out var playerGroup);
				if (logging)
				{
					ManualLogSource logger = Plugin.Logger;
					bool flag = default(bool);
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(22, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<DateTime>(DateTime.Now);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": Getting close allies");
					}
					logger.LogInfo(val);
				}
				entityManager = Plugin.Server.EntityManager;
				LocalToWorld componentData2 = ((EntityManager)(ref entityManager)).GetComponentData<LocalToWorld>(closeToEntity);
				foreach (KeyValuePair<Entity, Entity> ally3 in playerGroup.Allies)
				{
					if (logging)
					{
						Plugin.Logger.LogInfo((object)(DateTime.Now.ToString() + ": Iterating over allies, entity is " + ally3.GetHashCode()));
					}
					bool flag2 = ((Entity)(ref triggerEntity)).Equals(ally3.Key);
					if (logging && flag2)
					{
						Plugin.Logger.LogInfo((object)(DateTime.Now.ToString() + ": Entity is trigger"));
					}
					entityManager = Plugin.Server.EntityManager;
					componentData = ((EntityManager)(ref entityManager)).GetComponentData<LocalToWorld>(ally3.Value);
					float3 position2 = ((LocalToWorld)(ref componentData)).Position;
					if (!flag2)
					{
						if (logging)
						{
							Plugin.Logger.LogInfo((object)(DateTime.Now.ToString() + ": Got entity Position"));
						}
						float3 position3 = ((LocalToWorld)(ref componentData2)).Position;
						float num2 = math.distancesq(((float3)(ref position3)).xz, ((float3)(ref position2)).xz);
						if (logging)
						{
							Plugin.Logger.LogInfo((object)(DateTime.Now.ToString() + ": DistanceSq is " + num2 + ", Max DistanceSq is " + num));
						}
						if (!(num2 <= num))
						{
							continue;
						}
					}
					if (logging)
					{
						Plugin.Logger.LogInfo((object)(DateTime.Now.ToString() + ": Converting entity to ally..."));
					}
					if (ConvertToAlly(ally3.Key, position2, logging, out var ally2))
					{
						ally2.isTrigger = flag2;
						list.Add(ally2);
					}
				}
			}
			if (logging)
			{
				Plugin.Logger.LogInfo((object)(DateTime.Now.ToString() + ": Allies Fetched, Total ally count of " + list.Count));
			}
			return list;
		}

		public static void GetAllies(Entity playerCharacter, bool logging, out PlayerGroup playerGroup)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0639: Unknown result type (might be due to invalid IL or missing references)
			//IL_0640: Expected O, but got Unknown
			//IL_0621: Unknown result type (might be due to invalid IL or missing references)
			//IL_0623: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e0: Expected O, but got Unknown
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Expected O, but got Unknown
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Expected O, but got Unknown
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Expected O, but got Unknown
			//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_065e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0672: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0612: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_035b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Expected O, but got Unknown
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Expected O, but got Unknown
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Expected O, but got Unknown
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0432: Unknown result type (might be due to invalid IL or missing references)
			//IL_0415: Unknown result type (might be due to invalid IL or missing references)
			//IL_0417: Unknown result type (might be due to invalid IL or missing references)
			//IL_0460: Unknown result type (might be due to invalid IL or missing references)
			//IL_0462: Unknown result type (might be due to invalid IL or missing references)
			//IL_049b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0582: Unknown result type (might be due to invalid IL or missing references)
			//IL_0589: Unknown result type (might be due to invalid IL or missing references)
			//IL_0527: Unknown result type (might be due to invalid IL or missing references)
			//IL_0529: Unknown result type (might be due to invalid IL or missing references)
			//IL_055f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0564: Unknown result type (might be due to invalid IL or missing references)
			//IL_056d: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = Plugin.Server.EntityManager;
			bool flag = default(bool);
			if (!((EntityManager)(ref entityManager)).HasComponent<PlayerCharacter>(playerCharacter))
			{
				if (logging)
				{
					ManualLogSource logger = Plugin.Logger;
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(22, 2, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<DateTime>(DateTime.Now);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": Entity is not user: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Entity>(playerCharacter);
					}
					logger.LogInfo(val);
					ManualLogSource logger2 = Plugin.Logger;
					val = new BepInExInfoLogInterpolatedStringHandler(39, 2, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<DateTime>(DateTime.Now);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": Components for Player Character are: ");
						BepInExInfoLogInterpolatedStringHandler obj = val;
						entityManager = Plugin.Server.EntityManager;
						((BepInExLogInterpolatedStringHandler)obj).AppendFormatted<string>(((EntityManager)(ref entityManager)).Debug.GetEntityInfo(playerCharacter));
					}
					logger2.LogInfo(val);
				}
				playerGroup = new PlayerGroup
				{
					Allies = new Dictionary<Entity, Entity>()
				};
				return;
			}
			if (logging)
			{
				ManualLogSource logger3 = Plugin.Logger;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(33, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<DateTime>(DateTime.Now);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": Beginning To Parse Player Group");
				}
				logger3.LogInfo(val);
			}
			if (Cache.PlayerAllies.TryGetValue(playerCharacter, out playerGroup))
			{
				if (logging)
				{
					ManualLogSource logger4 = Plugin.Logger;
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(38, 2, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<DateTime>(DateTime.Now);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": Allies Found in Cache, timestamp is ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<DateTime>(playerGroup.TimeStamp);
					}
					logger4.LogInfo(val);
				}
				if ((DateTime.Now - playerGroup.TimeStamp).TotalSeconds < (double)CacheAgeLimit)
				{
					return;
				}
				if (logging)
				{
					ManualLogSource logger5 = Plugin.Logger;
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(26, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<DateTime>(DateTime.Now);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": Refreshing cached allies");
					}
					logger5.LogInfo(val);
				}
			}
			entityManager = Plugin.Server.EntityManager;
			Team val2 = default(Team);
			if (!((EntityManager)(ref entityManager)).TryGetComponentData<Team>(playerCharacter, ref val2))
			{
				if (logging)
				{
					ManualLogSource logger6 = Plugin.Logger;
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(43, 2, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<DateTime>(DateTime.Now);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": Could not get team for Player Character: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Entity>(playerCharacter);
					}
					logger6.LogInfo(val);
					ManualLogSource logger7 = Plugin.Logger;
					val = new BepInExInfoLogInterpolatedStringHandler(39, 2, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<DateTime>(DateTime.Now);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": Components for Player Character are: ");
						BepInExInfoLogInterpolatedStringHandler obj2 = val;
						entityManager = Plugin.Server.EntityManager;
						((BepInExLogInterpolatedStringHandler)obj2).AppendFormatted<string>(((EntityManager)(ref entityManager)).Debug.GetEntityInfo(playerCharacter));
					}
					logger7.LogInfo(val);
				}
				playerGroup = new PlayerGroup
				{
					Allies = new Dictionary<Entity, Entity>()
				};
				return;
			}
			if (logging)
			{
				ManualLogSource logger8 = Plugin.Logger;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(50, 3, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<DateTime>(DateTime.Now);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": Player Character Found Value: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(val2.Value);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" - Faction Index: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(val2.FactionIndex);
				}
				logger8.LogInfo(val);
			}
			playerGroup.TimeStamp = DateTime.Now;
			Dictionary<Entity, Entity> dictionary = new Dictionary<Entity, Entity>();
			entityManager = Plugin.Server.EntityManager;
			EntityQueryDesc[] array = new EntityQueryDesc[1];
			EntityQueryDesc val3 = new EntityQueryDesc();
			val3.All = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[2]
			{
				ComponentType.ReadOnly<PlayerCharacter>(),
				ComponentType.ReadOnly<IsConnected>()
			});
			val3.Options = (EntityQueryOptions)2;
			array[0] = val3;
			EntityQuery val4 = ((EntityManager)(ref entityManager)).CreateEntityQuery((EntityQueryDesc[])(object)array);
			NativeArray<Entity> val5 = ((EntityQuery)(ref val4)).ToEntityArray((Allocator)2);
			if (logging)
			{
				ManualLogSource logger9 = Plugin.Logger;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(45, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<DateTime>(DateTime.Now);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": got connected PC entities buffer of length ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(val5.Length);
				}
				logger9.LogInfo(val);
			}
			Enumerator<Entity> enumerator = val5.GetEnumerator();
			Team val7 = default(Team);
			while (enumerator.MoveNext())
			{
				Entity current = enumerator.Current;
				Entity val6;
				if (logging)
				{
					ManualLogSource logger10 = Plugin.Logger;
					string text = DateTime.Now.ToString();
					val6 = current;
					logger10.LogInfo((object)(text + ": got Entity " + ((object)(Entity)(ref val6)).ToString()));
				}
				entityManager = Plugin.Server.EntityManager;
				if (((EntityManager)(ref entityManager)).HasComponent<PlayerCharacter>(current))
				{
					if (logging)
					{
						ManualLogSource logger11 = Plugin.Logger;
						string text2 = DateTime.Now.ToString();
						val6 = current;
						logger11.LogInfo((object)(text2 + ": Entity is User " + ((object)(Entity)(ref val6)).ToString()));
					}
					if (((Entity)(ref current)).Equals(playerCharacter))
					{
						if (logging)
						{
							Plugin.Logger.LogInfo((object)(DateTime.Now.ToString() + ": Entity is self"));
						}
						dictionary[current] = current;
						continue;
					}
					bool flag2 = false;
					try
					{
						if (logging)
						{
							Plugin.Logger.LogInfo((object)(DateTime.Now.ToString() + ": Trying to get teams "));
						}
						entityManager = Plugin.Server.EntityManager;
						bool flag3 = ((EntityManager)(ref entityManager)).TryGetComponentData<Team>(current, ref val7);
						if (logging)
						{
							if (flag3)
							{
								Plugin.Logger.LogInfo((object)(DateTime.Now.ToString() + ": Team Value:" + val7.Value + " - Faction Index: " + val7.FactionIndex));
							}
							else
							{
								ManualLogSource logger12 = Plugin.Logger;
								string text3 = DateTime.Now.ToString();
								val6 = current;
								logger12.LogInfo((object)(text3 + ": Could not get team for entity: " + ((object)(Entity)(ref val6)).ToString()));
								ManualLogSource logger13 = Plugin.Logger;
								string text4 = DateTime.Now.ToString();
								entityManager = Plugin.Server.EntityManager;
								logger13.LogInfo((object)(text4 + ": Components for entity are: " + ((EntityManager)(ref entityManager)).Debug.GetEntityInfo(current)));
							}
						}
						flag2 = flag3 && val7.Value == val2.Value;
					}
					catch (Exception ex)
					{
						if (logging)
						{
							Plugin.Logger.LogInfo((object)(DateTime.Now.ToString() + ": IsAllies Failed " + ex.Message));
						}
					}
					if (flag2)
					{
						if (logging)
						{
							ManualLogSource logger14 = Plugin.Logger;
							BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(13, 3, ref flag);
							if (flag)
							{
								((BepInExLogInterpolatedStringHandler)val).AppendFormatted<DateTime>(DateTime.Now);
								((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": Allies: ");
								((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Entity>(playerCharacter);
								((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" - ");
								((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Entity>(current);
							}
							logger14.LogInfo(val);
						}
						dictionary[current] = current;
					}
					else if (logging)
					{
						ManualLogSource logger15 = Plugin.Logger;
						BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(17, 3, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<DateTime>(DateTime.Now);
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": Not allies: ");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Entity>(playerCharacter);
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" - ");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Entity>(current);
						}
						logger15.LogInfo(val);
					}
				}
				else if (logging)
				{
					Plugin.Logger.LogInfo((object)(DateTime.Now.ToString() + ": No Associated User!"));
				}
			}
			playerGroup.Allies = dictionary;
			playerGroup.AllyCount = dictionary.Count;
			Cache.PlayerAllies[playerCharacter] = playerGroup;
		}
	}
	public static class AutoSaveSystem
	{
		public const string mainSaveFolder = "BepInEx/config/RPGMods/Saves/";

		public const string backupSaveFolder = "BepInEx/config/RPGMods/Saves/Backup/";

		private static int saveCount = 0;

		public static int backupFrequency = 5;

		public static bool saveLogging = false;

		public static void SaveDatabase()
		{
			saveCount++;
			string saveFolder = "BepInEx/config/RPGMods/Saves/";
			if (saveCount % backupFrequency == 0)
			{
				saveFolder = "BepInEx/config/RPGMods/Saves/Backup/";
			}
			GodMode.SaveGodMode(saveFolder);
			if (saveLogging)
			{
				Plugin.Logger.LogInfo((object)(DateTime.Now.ToString() + ": God Mode Saved."));
			}
			SunImmunity.SaveImmunity(saveFolder);
			if (saveLogging)
			{
				Plugin.Logger.LogInfo((object)(DateTime.Now.ToString() + ": Sun Immunity Saved."));
			}
			Waypoint.SaveWaypoints(saveFolder);
			if (saveLogging)
			{
				Plugin.Logger.LogInfo((object)(DateTime.Now.ToString() + ": Waypoints Saved."));
			}
			NoCooldown.SaveCooldown(saveFolder);
			if (saveLogging)
			{
				Plugin.Logger.LogInfo((object)(DateTime.Now.ToString() + ": No CD Saved."));
			}
			Speed.SaveSpeed(saveFolder);
			if (saveLogging)
			{
				Plugin.Logger.LogInfo((object)(DateTime.Now.ToString() + ": Speed Saved."));
			}
			AutoRespawn.SaveAutoRespawn(saveFolder);
			if (saveLogging)
			{
				Plugin.Logger.LogInfo((object)(DateTime.Now.ToString() + ": Auto Respawn Saved."));
			}
			PowerUp.SavePowerUp(saveFolder);
			if (saveLogging)
			{
				Plugin.Logger.LogInfo((object)(DateTime.Now.ToString() + ": Powerup Saved."));
			}
			ExperienceSystem.SaveEXPData(saveFolder);
			if (saveLogging)
			{
				Plugin.Logger.LogInfo((object)(DateTime.Now.ToString() + ": Experience Saved."));
			}
			WeaponMasterSystem.SaveWeaponMastery(saveFolder);
			if (saveLogging)
			{
				Plugin.Logger.LogInfo((object)(DateTime.Now.ToString() + ": Mastery Saved."));
			}
			Bloodlines.saveBloodlines(saveFolder);
			if (saveLogging)
			{
				Plugin.Logger.LogInfo((object)(DateTime.Now.ToString() + ": Bloodlines Saved."));
			}
			Plugin.Logger.LogInfo((object)(DateTime.Now.ToString() + ": All databases saved to JSON file."));
		}

		public static void LoadDatabase()
		{
			PermissionSystem.LoadPermissions();
			NoCooldown.LoadNoCooldown();
			GodMode.LoadGodMode();
			PowerUp.LoadPowerUp();
			SunImmunity.LoadSunImmunity();
			Speed.LoadSpeed();
			Waypoint.LoadWaypoints();
			AutoRespawn.LoadAutoRespawn();
			Kit.LoadKits();
			ExperienceSystem.LoadEXPData();
			WeaponMasterSystem.LoadWeaponMastery();
			Bloodlines.loadBloodlines();
			WorldDynamicsSystem.LoadFactionStats();
			WorldDynamicsSystem.LoadIgnoredMobs();
			VampireDownedServerEventSystem_Patch.loadKillMap();
			Plugin.Logger.LogInfo((object)"All database is now loaded.");
		}
	}
	public static class Color
	{
		private static string ColorText(string color, string text)
		{
			return "<color=" + color + ">" + text + "</color>";
		}

		public static string White(string text)
		{
			return ColorText("#fffffffe", text);
		}

		public static string Black(string text)
		{
			return ColorText("#000000", text);
		}

		public static string Gray(string text)
		{
			return ColorText("#404040", text);
		}

		public static string Orange(string text)
		{
			return ColorText("#c98332", text);
		}

		public static string Yellow(string text)
		{
			return ColorText("#cfc14a", text);
		}

		public static string Green(string text)
		{
			return ColorText("#56ad3b", text);
		}

		public static string Teal(string text)
		{
			return ColorText("#3b8dad", text);
		}

		public static string Blue(string text)
		{
			return ColorText("#3444a8", text);
		}

		public static string Purple(string text)
		{
			return ColorText("#8b3691", text);
		}

		public static string Pink(string text)
		{
			return ColorText("#b53c8ffe", text);
		}

		public static string Red(string text)
		{
			return ColorText("#ff0000", text);
		}

		public static string SoftRed(string text)
		{
			return ColorText("#b53c40", text);
		}
	}
	public static class Cache
	{
		public static Dictionary<FixedString64, PlayerData> NamePlayerCache = new Dictionary<FixedString64, PlayerData>();

		public static Dictionary<ulong, PlayerData> SteamPlayerCache = new Dictionary<ulong, PlayerData>();

		public static Dictionary<Entity, PlayerGroup> PlayerAllies = new Dictionary<Entity, PlayerGroup>();

		public static Dictionary<Entity, LocalToWorld> PlayerLocations = new Dictionary<Entity, LocalToWorld>();

		public static Dictionary<ulong, List<BuffData>> buffData = new Dictionary<ulong, List<BuffData>>();

		public static Dictionary<ulong, float> command_Cooldown = new Dictionary<ulong, float>();

		public static Dictionary<ulong, DateTime> playerCombatStart = new Dictionary<ulong, DateTime>();

		public static Dictionary<ulong, DateTime> playerCombatEnd = new Dictionary<ulong, DateTime>();

		public static Dictionary<ulong, PlayerHeatData> heatCache = new Dictionary<ulong, PlayerHeatData>();

		public static Dictionary<ulong, DateTime> player_last_combat = new Dictionary<ulong, DateTime>();

		public static Dictionary<ulong, int> player_combat_ticks = new Dictionary<ulong, int>();

		public static Dictionary<ulong, float> player_level = new Dictionary<ulong, float>();

		public static Dictionary<ulong, Dictionary<UnitStatType, float>> player_geartypedonned = new Dictionary<ulong, Dictionary<UnitStatType, float>>();

		public static Dictionary<Entity, LevelData> PlayerLevelCache = new Dictionary<Entity, LevelData>();

		public static Dictionary<ulong, PvPOffenseLog> OffenseLog = new Dictionary<ulong, PvPOffenseLog>();

		public static Dictionary<ulong, ReputationLog> ReputationLog = new Dictionary<ulong, ReputationLog>();

		public static Dictionary<Entity, StateData> HostilityState = new Dictionary<Entity, StateData>();

		public static SizedDictionaryAsync<float, SpawnNPCListen> spawnNPC_Listen = new SizedDictionaryAsync<float, SpawnNPCListen>(500);

		public static DateTime GetCombatStart(ulong steamID)
		{
			if (!playerCombatStart.TryGetValue(steamID, out var value))
			{
				return DateTime.MinValue;
			}
			return value;
		}

		public static DateTime GetCombatEnd(ulong steamID)
		{
			if (!playerCombatEnd.TryGetValue(steamID, out var value))
			{
				return DateTime.MinValue;
			}
			return value;
		}
	}
	public static class Database
	{
		public static class Buff
		{
			public static PrefabGUID EquipBuff = new PrefabGUID(343359674);

			public static PrefabGUID WolfStygian = new PrefabGUID(-1158884666);

			public static PrefabGUID WolfNormal = new PrefabGUID(-351718282);

			public static PrefabGUID BatForm = new PrefabGUID(1205505492);

			public static PrefabGUID NormalForm = new PrefabGUID(1352541204);

			public static PrefabGUID RatForm = new PrefabGUID(902394170);

			public static PrefabGUID DownedBuff = new PrefabGUID(-1992158531);

			public static PrefabGUID BloodSight = new PrefabGUID(1199823151);

			public static PrefabGUID InCombat = new PrefabGUID(581443919);

			public static PrefabGUID InCombat_PvP = new PrefabGUID(697095869);

			public static PrefabGUID OutofCombat = new PrefabGUID(897325455);

			public static PrefabGUID BloodMoon = new PrefabGUID(-560523291);

			public static PrefabGUID Severe_GarlicDebuff = new PrefabGUID(1582196539);

			public static PrefabGUID General_GarlicDebuff = new PrefabGUID(-1701323826);

			public static PrefabGUID Buff_4pT2 = new PrefabGUID(1444835872);

			public static PrefabGUID cloakBuff = new PrefabGUID(1409441911);

			public static PrefabGUID SiegeGolem_T01 = new PrefabGUID(-148535031);

			public static PrefabGUID SiegeGolem_T02 = new PrefabGUID(914043867);

			public static PrefabGUID AB_Interact_GetInside_Owner_Buff_Stone = new PrefabGUID(569692162);

			public static PrefabGUID AB_Interact_GetInside_Owner_Buff_Base = new PrefabGUID(381160212);

			public static PrefabGUID AB_ExitCoffin_Travel_Phase_Stone = new PrefabGUID(-162820429);

			public static PrefabGUID AB_ExitCoffin_Travel_Phase_Base = new PrefabGUID(-997204628);

			public static PrefabGUID AB_Interact_TombCoffinSpawn_Travel = new PrefabGUID(722466953);

			public static PrefabGUID AB_Interact_WaypointSpawn_Travel = new PrefabGUID(-66432447);

			public static PrefabGUID AB_Interact_WoodenCoffinSpawn_Travel = new PrefabGUID(-1705977973);

			public static PrefabGUID AB_Interact_StoneCoffinSpawn_Travel = new PrefabGUID(-1276482574);

			public static PrefabGUID LevelUp_Buff = new PrefabGUID(-1133938228);

			public static PrefabGUID AB_Undead_BishopOfShadows_ShadowSoldier_Minion_Buff = new PrefabGUID(450215391);

			public static PrefabGUID HolyNuke = new PrefabGUID(-1807398295);

			public static PrefabGUID AB_Manticore_Flame_Buff_UNUSED = new PrefabGUID(1502566434);

			public static PrefabGUID Pig_Transform_Debuff = new PrefabGUID(1356064917);

			public static PrefabGUID EquipBuff_Chest_Base = new PrefabGUID(1872694456);

			public static PrefabGUID Buff_VBlood_Perk_ProgTest = new PrefabGUID(1614409699);

			public static PrefabGUID AB_BloodBuff_VBlood_0 = new PrefabGUID(20081801);
		}

		public static JsonSerializerOptions JSON_options = new JsonSerializerOptions
		{
			WriteIndented = false,
			IncludeFields = false
		};

		public static JsonSerializerOptions Pretty_JSON_options = new JsonSerializerOptions
		{
			WriteIndented = true,
			IncludeFields = true
		};

		public static HashSet<ApplyBuffDebugEvent> playerBuffs = new HashSet<ApplyBuffDebugEvent>();

		public static bool ErrorOnLoadingExperienceClasses = false;

		public static Dictionary<ulong, SiegeData> SiegeState = new Dictionary<ulong, SiegeData>();

		public static Dictionary<ulong, bool> sunimmunity { get; set; }

		public static Dictionary<ulong, bool> nocooldownlist { get; set; }

		public static Dictionary<ulong, bool> godmode { get; set; }

		public static Dictionary<ulong, bool> speeding { get; set; }

		public static Dictionary<ulong, bool> autoRespawn { get; set; }

		public static Dictionary<string, Tuple<float, float, float>> waypointDBNew { get; set; }

		public static Dictionary<string, WaypointData> globalWaypoint { get; set; }

		public static Dictionary<string, WaypointData> waypoints { get; set; }

		public static Dictionary<ulong, int> waypoints_owned { get; set; }

		public static Dictionary<ulong, int> user_permission { get; set; }

		public static Dictionary<string, int> command_permission { get; set; }

		public static Dictionary<ulong, PowerUpData> PowerUpList { get; set; }

		public static Dictionary<ulong, int> player_experience { get; set; }

		public static Dictionary<ulong, int> player_abilityIncrease { get; set; }

		public static LazyDictionary<ulong, LazyDictionary<UnitStatType, float>> player_level_stats { get; set; }

		public static Dictionary<string, Dictionary<UnitStatType, float>> experience_class_stats { get; set; }

		public static Dictionary<ulong, bool> player_log_exp { get; set; }

		public static ConcurrentDictionary<ulong, PvPData> PvPStats { get; set; }

		public static Dictionary<Entity, Entity> killMap { get; set; }

		public static Dictionary<ulong, int> pvpkills { get; set; }

		public static Dictionary<ulong, int> pvpdeath { get; set; }

		public static Dictionary<ulong, double> pvpkd { get; set; }

		public static Dictionary<ulong, WeaponMasterData> player_weaponmastery { get; set; }

		public static Dictionary<ulong, DateTime> player_decaymastery_logout { get; set; }

		public static Dictionary<ulong, bool> player_log_mastery { get; set; }

		public static Dictionary<ulong, BloodlineData> playerBloodline { get; set; }

		public static Dictionary<ulong, DateTime> playerDecayBloodlineLogout { get; set; }

		public static Dictionary<ulong, bool> playerLogBloodline { get; set; }

		public static ConcurrentDictionary<int, FactionData> FactionStats { get; set; }

		public static HashSet<string> IgnoredMonsters { get; set; }

		public static HashSet<PrefabGUID> IgnoredMonstersGUID { get; set; }
	}
	public static class FactionHeat
	{
		public static readonly Prefabs.Faction[] ActiveFactions = new Prefabs.Faction[6]
		{
			Prefabs.Faction.Militia,
			Prefabs.Faction.Bandits,
			Prefabs.Faction.Undead,
			Prefabs.Faction.Gloomrot,
			Prefabs.Faction.Critters,
			Prefabs.Faction.Werewolf
		};

		private static readonly string[] ColourGradient = new string[6] { "fef001", "ffce03", "fd9a01", "fd6104", "ff2c05", "f00505" };

		public static readonly int[] HeatLevels = new int[6] { 150, 250, 500, 1000, 1500, 3000 };

		public static void GetActiveFactionHeatValue(Prefabs.Faction faction, bool isVBlood, out int heatValue, out Prefabs.Faction activeFaction)
		{
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Expected O, but got Unknown
			switch (faction)
			{
			case Prefabs.Faction.Traders_T01:
				heatValue = 200;
				activeFaction = Prefabs.Faction.Bandits;
				break;
			case Prefabs.Faction.Bandits:
				heatValue = 10;
				activeFaction = Prefabs.Faction.Bandits;
				break;
			case Prefabs.Faction.Militia:
				heatValue = 10;
				activeFaction = Prefabs.Faction.Militia;
				break;
			case Prefabs.Faction.ChurchOfLum_SpotShapeshiftVampire:
				heatValue = 25;
				activeFaction = Prefabs.Faction.Militia;
				break;
			case Prefabs.Faction.Traders_T02:
				heatValue = 200;
				activeFaction = Prefabs.Faction.Militia;
				break;
			case Prefabs.Faction.ChurchOfLum:
				heatValue = 15;
				activeFaction = Prefabs.Faction.Militia;
				break;
			case Prefabs.Faction.World_Prisoners:
				heatValue = 10;
				activeFaction = Prefabs.Faction.Militia;
				break;
			case Prefabs.Faction.Gloomrot:
				heatValue = 10;
				activeFaction = Prefabs.Faction.Gloomrot;
				break;
			case Prefabs.Faction.Wolves:
			case Prefabs.Faction.Critters:
			case Prefabs.Faction.Bear:
				heatValue = 10;
				activeFaction = Prefabs.Faction.Critters;
				break;
			case Prefabs.Faction.Undead:
				heatValue = 5;
				activeFaction = Prefabs.Faction.Undead;
				break;
			case Prefabs.Faction.Werewolf:
			case Prefabs.Faction.WerewolfHuman:
				heatValue = 20;
				activeFaction = Prefabs.Faction.Werewolf;
				break;
			case Prefabs.Faction.VampireHunters:
				heatValue = 3;
				activeFaction = Prefabs.Faction.VampireHunters;
				break;
			case Prefabs.Faction.Spiders:
			case Prefabs.Faction.Ignored:
			case Prefabs.Faction.Plants:
			case Prefabs.Faction.Players_Shapeshift_Human:
			case Prefabs.Faction.Wendigo:
			case Prefabs.Faction.Players_Castle_Prisoners:
			case Prefabs.Faction.Mutants:
			case Prefabs.Faction.Unknown:
			case Prefabs.Faction.ChurchOfLum_Slaves:
			case Prefabs.Faction.ChurchOfLum_Slaves_Rioters:
			case Prefabs.Faction.Players:
			case Prefabs.Faction.Elementals:
			case Prefabs.Faction.Cursed:
			case Prefabs.Faction.NatureSpirit:
			case Prefabs.Faction.Harpy:
			case Prefabs.Faction.Players_Mutant:
				heatValue = 0;
				activeFaction = Prefabs.Faction.Unknown;
				break;
			default:
			{
				ManualLogSource logger = Plugin.Logger;
				bool flag = default(bool);
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(40, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Faction not handled for active faction: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(Enum.GetName(fa