Decompiled source of BestSoloBuff v2.0.0

BestSoloBuff.dll

Decompiled a day ago
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using ProjectM;
using ProjectM.Network;
using ProjectM.Scripting;
using ProjectM.Shared;
using SoloBuff.Patches;
using SoloBuff.Services;
using SoloBuff.Utils;
using Stunlock.Core;
using Stunlock.Network;
using Unity.Collections;
using Unity.Entities;
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("Irozer")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Only the best of the best")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+c7f65969ab5e9f76f6187b9567c34fc603025eec")]
[assembly: AssemblyProduct("BestSoloBuff")]
[assembly: AssemblyTitle("BestSoloBuff")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 BestSoloBuff
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "aa.BestSoloBuff";

		public const string PLUGIN_NAME = "BestSoloBuff";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace SoloBuff
{
	public static class Core
	{
		public static World Server { get; } = GetWorld("Server") ?? throw new Exception("Server World not found. Did you install the mod on the server?");


		public static EntityManager EntityManager => Server.EntityManager;

		public static ServerGameManager ServerGameManager => Server.GetExistingSystemManaged<ServerScriptMapper>()._ServerGameManager;

		public static PrefabCollectionSystem PrefabCollection => Server.GetExistingSystemManaged<PrefabCollectionSystem>();

		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 static void LogException(Exception e, [CallerMemberName] string caller = null)
		{
			Debug.LogError(Object.op_Implicit($"[SoloBuff] Exception in {caller}: {e.Message}\n{e.StackTrace}"));
		}
	}
	[BepInPlugin("com.tonpseudo.solobuff", "SoloBuff", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BasePlugin
	{
		public static ManualLogSource Logger;

		private Harmony _harmony;

		public static Plugin Instance { get; private set; }

		public override void Load()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			Instance = this;
			Logger = ((BasePlugin)this).Log;
			SoloBuffSettings.Init(((BasePlugin)this).Config);
			CommandRegistry.RegisterAll();
			_harmony = new Harmony("com.tonpseudo.solobuff");
			_harmony.PatchAll();
			((BasePlugin)this).Log.LogInfo((object)"SoloBuff loaded and ready!");
		}

		public override bool Unload()
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			return ((BasePlugin)this).Unload();
		}
	}
	public static class SoloBuffSettings
	{
		private static readonly string ConfigFolder = Path.Combine(Paths.ConfigPath, "BestSoloBuff");

		public static ConfigEntry<int> InactivityMinutes;

		public static ConfigEntry<float> DamageReductionBonus;

		public static ConfigEntry<float> HealthRecoveryBonus;

		public static ConfigEntry<float> HealingReceivedBonus;

		public static ConfigEntry<float> BonusPhysicalPowerBonus;

		public static ConfigEntry<float> PhysicalCritChanceBonus;

		public static ConfigEntry<float> PhysicalCritDamageBonus;

		public static ConfigEntry<float> WeaponSkillPowerBonus;

		public static ConfigEntry<float> BonusSpellPowerBonus;

		public static ConfigEntry<float> SpellCritChanceBonus;

		public static ConfigEntry<float> SpellCritDamageBonus;

		public static ConfigEntry<float> UltimateEfficiencyBonus;

		public static ConfigEntry<float> IncreasedShieldEfficiencyBonus;

		public static ConfigEntry<float> BonusMovementSpeedBonus;

		public static ConfigEntry<float> BonusShapeshiftMovementSpeedBonus;

		public static ConfigEntry<float> BonusMaxHealthBonus;

		public static ConfigEntry<float> ResourceYieldModifierBonus;

		public static ConfigEntry<float> PrimaryLeechFactorBonus;

		public static ConfigEntry<float> PhysicalLifeLeechFactorBonus;

		public static ConfigEntry<float> SpellLifeLeechFactorBonus;

		public static ConfigEntry<float> PrimaryAttackSpeedBonus;

		public static void Init(ConfigFile config)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: 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_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			if (!Directory.Exists(ConfigFolder))
			{
				Directory.CreateDirectory(ConfigFolder);
			}
			ConfigFile val = new ConfigFile(Path.Combine(ConfigFolder, "SoloBuff.cfg"), true);
			InactivityMinutes = val.Bind<int>("General", "InactivityMinutes", 30, "Minutes offline before a clan member is considered inactive.");
			DamageReductionBonus = val.Bind<float>("UnitStats", "DamageReduction", 0.05f, "Damage reduction bonus (+5%).");
			HealthRecoveryBonus = val.Bind<float>("UnitStats", "HealthRecovery", 0.1f, "Health recovery bonus (+10%).");
			HealingReceivedBonus = val.Bind<float>("UnitStats", "HealingReceived", 0.1f, "Healing received bonus (+10%).");
			BonusPhysicalPowerBonus = val.Bind<float>("VampireAttributes", "BonusPhysicalPower", 5f, "Bonus physical power (+5%).");
			PhysicalCritChanceBonus = val.Bind<float>("VampireAttributes", "PhysicalCritChance", 0.05f, "Physical critical strike chance bonus (+5%).");
			PhysicalCritDamageBonus = val.Bind<float>("VampireAttributes", "PhysicalCritDamage", 0.1f, "Physical critical strike damage bonus (+10%).");
			WeaponSkillPowerBonus = val.Bind<float>("VampireAttributes", "WeaponSkillPower", 0.05f, "Weapon skill power bonus (+5%).");
			BonusSpellPowerBonus = val.Bind<float>("VampireAttributes", "BonusSpellPower", 5f, "Bonus spell power (+5%).");
			SpellCritChanceBonus = val.Bind<float>("VampireAttributes", "SpellCritChance", 0.05f, "Spell critical strike chance bonus (+5%).");
			SpellCritDamageBonus = val.Bind<float>("VampireAttributes", "SpellCritDamage", 0.1f, "Spell critical strike damage bonus (+10%).");
			UltimateEfficiencyBonus = val.Bind<float>("VampireAttributes", "UltimateEfficiency", 0.1f, "Ultimate efficiency bonus (+10%).");
			IncreasedShieldEfficiencyBonus = val.Bind<float>("VampireAttributes", "IncreasedShieldEfficiency", 0.1f, "Shield efficiency bonus (+10%).");
			BonusMovementSpeedBonus = val.Bind<float>("VampireAttributes", "BonusMovementSpeed", 0.05f, "Movement speed bonus (+5%).");
			BonusShapeshiftMovementSpeedBonus = val.Bind<float>("VampireAttributes", "BonusShapeshiftMovementSpeed", 0.05f, "Shapeshift movement speed bonus (+5%).");
			BonusMaxHealthBonus = val.Bind<float>("VampireAttributes", "BonusMaxHealth", 0.05f, "Max health bonus (+5%).");
			ResourceYieldModifierBonus = val.Bind<float>("VampireAttributes", "ResourceYieldModifier", 0.1f, "Resource yield bonus (+10%).");
			PrimaryLeechFactorBonus = val.Bind<float>("LifeLeech", "PrimaryLeechFactor", 0.05f, "Primary attack life leech bonus (+5%).");
			PhysicalLifeLeechFactorBonus = val.Bind<float>("LifeLeech", "PhysicalLifeLeechFactor", 0.05f, "Physical life leech bonus (+5%).");
			SpellLifeLeechFactorBonus = val.Bind<float>("LifeLeech", "SpellLifeLeechFactor", 0.05f, "Spell life leech bonus (+5%).");
			PrimaryAttackSpeedBonus = val.Bind<float>("AbilityBar", "PrimaryAttackSpeed", 0.1f, "Primary attack speed bonus (+10%).");
		}
	}
}
namespace SoloBuff.Utils
{
	public static class VWorld
	{
		public static World Server
		{
			get
			{
				Enumerator<World> enumerator = World.s_AllWorlds.GetEnumerator();
				while (enumerator.MoveNext())
				{
					World current = enumerator.Current;
					if (current.Name == "Server")
					{
						return current;
					}
				}
				return null;
			}
		}

		public static EntityManager ServerEntityManager => Server.EntityManager;
	}
}
namespace SoloBuff.Services
{
	public static class SoloBuffService
	{
		private static readonly PrefabGUID SoloBuffPrefab = new PrefabGUID(636817215);

		private static readonly Dictionary<ulong, DateTime> _disconnectTimes = new Dictionary<ulong, DateTime>();

		private static readonly Dictionary<ulong, bool> _soloBuffActive = new Dictionary<ulong, bool>();

		private static readonly Dictionary<ulong, bool> _manuallyDisabled = new Dictionary<ulong, bool>();

		private static readonly Dictionary<ulong, Timer> _inactivityTimers = new Dictionary<ulong, Timer>();

		private static readonly ConcurrentQueue<Action> _mainThreadQueue = new ConcurrentQueue<Action>();

		private static readonly HashSet<ulong> _reconnecting = new HashSet<ulong>();

		private static int _modIdCounter = 1000;

		public static void DrainMainThreadQueue()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			Action result;
			bool flag = default(bool);
			while (_mainThreadQueue.TryDequeue(out result))
			{
				try
				{
					result();
				}
				catch (Exception ex)
				{
					ManualLogSource logger = Plugin.Logger;
					BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(24, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[SoloBuff] Queue error: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
					}
					logger.LogError(val);
				}
			}
		}

		public static void OnPlayerConnected(Entity userEntity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			EntityManager serverEntityManager = VWorld.ServerEntityManager;
			if (((EntityManager)(ref serverEntityManager)).HasComponent<User>(userEntity))
			{
				User componentData = ((EntityManager)(ref serverEntityManager)).GetComponentData<User>(userEntity);
				ulong platformId = componentData.PlatformId;
				_disconnectTimes.Remove(platformId);
				if (((FixedString64Bytes)(ref componentData.CharacterName)).IsEmpty)
				{
					_reconnecting.Remove(platformId);
					_soloBuffActive.Remove(platformId);
					return;
				}
				_soloBuffActive.Remove(platformId);
				_reconnecting.Add(platformId);
				ReevaluateClanmates(userEntity, serverEntityManager, componentData);
				PlayerReadyPatch.PendingSpawns.Enqueue(userEntity);
			}
		}

		public static void OnPlayerDisconnected(Entity userEntity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			EntityManager serverEntityManager = VWorld.ServerEntityManager;
			if (((EntityManager)(ref serverEntityManager)).HasComponent<User>(userEntity))
			{
				User componentData = ((EntityManager)(ref serverEntityManager)).GetComponentData<User>(userEntity);
				ulong platformId = componentData.PlatformId;
				_disconnectTimes[platformId] = DateTime.UtcNow;
				RemoveSoloBuff(userEntity, serverEntityManager, componentData);
				NotifyClanmatesAndStartTimers(userEntity, serverEntityManager, componentData);
			}
		}

		public static void OnPlayerSpawned(Entity userEntity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			EntityManager serverEntityManager = VWorld.ServerEntityManager;
			if (!((EntityManager)(ref serverEntityManager)).HasComponent<User>(userEntity))
			{
				return;
			}
			User componentData = ((EntityManager)(ref serverEntityManager)).GetComponentData<User>(userEntity);
			if (((FixedString64Bytes)(ref componentData.CharacterName)).IsEmpty)
			{
				return;
			}
			ulong platformId = componentData.PlatformId;
			if (!_soloBuffActive.ContainsKey(platformId))
			{
				_soloBuffActive[platformId] = false;
				ManualLogSource logger = Plugin.Logger;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(31, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[SoloBuff] Player fully ready: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<FixedString64Bytes>(componentData.CharacterName);
				}
				logger.LogInfo(val);
				ReevaluateClanmates(userEntity, serverEntityManager, componentData);
				bool num = IsSoloEligible(userEntity, serverEntityManager);
				bool value;
				bool flag2 = _manuallyDisabled.TryGetValue(platformId, out value) && value;
				if (num && !flag2)
				{
					ApplySoloBuff(userEntity, serverEntityManager, componentData);
					SendMessage(serverEntityManager, componentData, "<color=#00ff88>✔ Solo buff <color=#ffffff>automatically enabled</color> — no active clan member.</color>");
				}
			}
		}

		public static void ToggleManual(Entity userEntity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			EntityManager serverEntityManager = VWorld.ServerEntityManager;
			if (((EntityManager)(ref serverEntityManager)).HasComponent<User>(userEntity))
			{
				User componentData = ((EntityManager)(ref serverEntityManager)).GetComponentData<User>(userEntity);
				ulong platformId = componentData.PlatformId;
				bool value;
				if (!IsSoloEligible(userEntity, serverEntityManager))
				{
					SendMessage(serverEntityManager, componentData, "<color=#ff4444>Solo buff unavailable: a clan member is currently active.</color>");
				}
				else if (_manuallyDisabled.TryGetValue(platformId, out value) && value)
				{
					_manuallyDisabled[platformId] = false;
					ApplySoloBuff(userEntity, serverEntityManager, componentData);
					SendMessage(serverEntityManager, componentData, "<color=#00ff88>✔ Solo buff <color=#ffffff>enabled</color>.</color>");
				}
				else
				{
					_manuallyDisabled[platformId] = true;
					RemoveSoloBuff(userEntity, serverEntityManager, componentData);
					SendMessage(serverEntityManager, componentData, "<color=#ffaa00>✖ Solo buff <color=#ffffff>disabled</color>.</color>");
				}
			}
		}

		public static bool IsSoloEligible(Entity userEntity, EntityManager em)
		{
			//IL_0002: 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_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			if (!((EntityManager)(ref em)).HasComponent<User>(userEntity))
			{
				return false;
			}
			Entity entity = ((EntityManager)(ref em)).GetComponentData<User>(userEntity).ClanEntity._Entity;
			if (entity == Entity.Null || !((EntityManager)(ref em)).Exists(entity))
			{
				return true;
			}
			EntityQuery val = ((EntityManager)(ref em)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<User>() });
			NativeArray<Entity> val2 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
			try
			{
				Enumerator<Entity> enumerator = val2.GetEnumerator();
				while (enumerator.MoveNext())
				{
					Entity current = enumerator.Current;
					if (current == userEntity)
					{
						continue;
					}
					User componentData = ((EntityManager)(ref em)).GetComponentData<User>(current);
					if (!(componentData.ClanEntity._Entity != entity))
					{
						if (componentData.IsConnected)
						{
							return false;
						}
						if (_disconnectTimes.TryGetValue(componentData.PlatformId, out var value) && (DateTime.UtcNow - value).TotalMinutes < (double)SoloBuffSettings.InactivityMinutes.Value)
						{
							return false;
						}
					}
				}
			}
			finally
			{
				val2.Dispose();
			}
			return true;
		}

		public static void ReevaluateSingle(Entity userEntity, EntityManager em)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			if (!((EntityManager)(ref em)).HasComponent<User>(userEntity))
			{
				return;
			}
			User componentData = ((EntityManager)(ref em)).GetComponentData<User>(userEntity);
			if (!componentData.IsConnected || ((FixedString64Bytes)(ref componentData.CharacterName)).IsEmpty)
			{
				return;
			}
			ulong platformId = componentData.PlatformId;
			if (!_soloBuffActive.ContainsKey(platformId))
			{
				return;
			}
			bool value;
			bool flag = _manuallyDisabled.TryGetValue(platformId, out value) && value;
			bool flag2 = IsSoloEligible(userEntity, em);
			bool flag3 = _soloBuffActive[platformId];
			if (flag2 && !flag && !flag3)
			{
				ApplySoloBuff(userEntity, em, componentData);
				SendMessage(em, componentData, "<color=#00ff88>✔ Solo buff <color=#ffffff>automatically enabled</color> — no active clan member.</color>");
			}
			else if ((!flag2 || flag) && flag3)
			{
				RemoveSoloBuff(userEntity, em, componentData);
				if (!flag)
				{
					SendMessage(em, componentData, "<color=#ffaa00>✖ Solo buff <color=#ffffff>removed</color> — a clan member is back online.</color>");
				}
			}
		}

		private static void ReevaluateClanmates(Entity userEntity, EntityManager em, User user)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: 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_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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_0061: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			Entity entity = user.ClanEntity._Entity;
			if (entity == Entity.Null || !((EntityManager)(ref em)).Exists(entity))
			{
				return;
			}
			EntityQuery val = ((EntityManager)(ref em)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<User>() });
			NativeArray<Entity> val2 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
			try
			{
				Enumerator<Entity> enumerator = val2.GetEnumerator();
				while (enumerator.MoveNext())
				{
					Entity current = enumerator.Current;
					if (!(current == userEntity))
					{
						User componentData = ((EntityManager)(ref em)).GetComponentData<User>(current);
						if (!(componentData.ClanEntity._Entity != entity) && componentData.IsConnected)
						{
							ReevaluateSingle(current, em);
						}
					}
				}
			}
			finally
			{
				val2.Dispose();
			}
		}

		private static void NotifyClanmatesAndStartTimers(Entity disconnectedEntity, EntityManager em, User disconnectedUser)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			Entity entity = disconnectedUser.ClanEntity._Entity;
			if (entity == Entity.Null || !((EntityManager)(ref em)).Exists(entity))
			{
				return;
			}
			string disconnectedName = ((object)(FixedString64Bytes)(ref disconnectedUser.CharacterName)).ToString();
			int value = SoloBuffSettings.InactivityMinutes.Value;
			EntityQuery val = ((EntityManager)(ref em)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<User>() });
			NativeArray<Entity> val2 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
			try
			{
				Enumerator<Entity> enumerator = val2.GetEnumerator();
				while (enumerator.MoveNext())
				{
					Entity current = enumerator.Current;
					if (current == disconnectedEntity)
					{
						continue;
					}
					User componentData = ((EntityManager)(ref em)).GetComponentData<User>(current);
					if (componentData.ClanEntity._Entity != entity || !componentData.IsConnected)
					{
						continue;
					}
					ulong clanmateSteamId = componentData.PlatformId;
					Entity clanmateEntity = current;
					SendMessage(em, componentData, $"<color=#ffaa00>Your clanmate <color=#ffffff>{disconnectedName}</color><color=#ffaa00> just went offline. Solo buff available in <color=#ffffff>{value} minute{((value > 1) ? "s" : "")}</color><color=#ffaa00>.</color>");
					if (_inactivityTimers.TryGetValue(clanmateSteamId, out var value2))
					{
						value2.Dispose();
						_inactivityTimers.Remove(clanmateSteamId);
					}
					Timer value3 = new Timer(delegate
					{
						_mainThreadQueue.Enqueue(delegate
						{
							//IL_0000: Unknown result type (might be due to invalid IL or missing references)
							//IL_0005: Unknown result type (might be due to invalid IL or missing references)
							//IL_0009: Unknown result type (might be due to invalid IL or missing references)
							//IL_0018: Unknown result type (might be due to invalid IL or missing references)
							//IL_0028: Unknown result type (might be due to invalid IL or missing references)
							//IL_002d: Unknown result type (might be due to invalid IL or missing references)
							//IL_0032: Unknown result type (might be due to invalid IL or missing references)
							//IL_0033: Unknown result type (might be due to invalid IL or missing references)
							//IL_0069: Unknown result type (might be due to invalid IL or missing references)
							//IL_006e: Unknown result type (might be due to invalid IL or missing references)
							//IL_007e: Unknown result type (might be due to invalid IL or missing references)
							//IL_0083: Unknown result type (might be due to invalid IL or missing references)
							//IL_0084: Unknown result type (might be due to invalid IL or missing references)
							//IL_008a: Unknown result type (might be due to invalid IL or missing references)
							//IL_008b: Unknown result type (might be due to invalid IL or missing references)
							EntityManager serverEntityManager = VWorld.ServerEntityManager;
							if (((EntityManager)(ref serverEntityManager)).Exists(clanmateEntity) && ((EntityManager)(ref serverEntityManager)).HasComponent<User>(clanmateEntity))
							{
								User componentData2 = ((EntityManager)(ref serverEntityManager)).GetComponentData<User>(clanmateEntity);
								if (componentData2.IsConnected)
								{
									bool value4;
									bool flag = _manuallyDisabled.TryGetValue(clanmateSteamId, out value4) && value4;
									bool value5;
									bool flag2 = _soloBuffActive.TryGetValue(clanmateSteamId, out value5) && value5;
									if (IsSoloEligible(clanmateEntity, serverEntityManager) && !flag && !flag2)
									{
										ApplySoloBuff(clanmateEntity, serverEntityManager, componentData2);
										SendMessage(serverEntityManager, componentData2, "<color=#00ff88>✔ Solo buff <color=#ffffff>automatically enabled</color> — <color=#ffffff>" + disconnectedName + "</color><color=#00ff88> is now inactive.</color>");
									}
									_inactivityTimers.Remove(clanmateSteamId);
								}
							}
						});
					}, null, TimeSpan.FromMinutes(value), Timeout.InfiniteTimeSpan);
					_inactivityTimers[clanmateSteamId] = value3;
				}
			}
			finally
			{
				val2.Dispose();
			}
		}

		private static void ApplySoloBuff(Entity userEntity, EntityManager em, User user)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: 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_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Expected O, but got Unknown
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			Entity entity = user.LocalCharacter._Entity;
			if (entity == Entity.Null || !((EntityManager)(ref em)).Exists(entity))
			{
				return;
			}
			RemoveBuffIfExists(em, entity);
			DebugEventsSystem existingSystemManaged = VWorld.Server.GetExistingSystemManaged<DebugEventsSystem>();
			ApplyBuffDebugEvent val = new ApplyBuffDebugEvent
			{
				BuffPrefabGUID = SoloBuffPrefab
			};
			FromCharacter val2 = new FromCharacter
			{
				Character = entity,
				User = userEntity
			};
			existingSystemManaged.ApplyBuff(val2, val);
			Entity val3 = default(Entity);
			bool flag = default(bool);
			if (BuffUtility.TryGetBuff<EntityManager>(em, entity, PrefabIdentifier.op_Implicit(SoloBuffPrefab), ref val3))
			{
				if (((EntityManager)(ref em)).HasComponent<LifeTime>(val3))
				{
					((EntityManager)(ref em)).RemoveComponent<LifeTime>(val3);
				}
				if (((EntityManager)(ref em)).HasComponent<RemoveBuffOnGameplayEvent>(val3))
				{
					((EntityManager)(ref em)).RemoveComponent<RemoveBuffOnGameplayEvent>(val3);
				}
				if (((EntityManager)(ref em)).HasComponent<RemoveBuffOnGameplayEventEntry>(val3))
				{
					((EntityManager)(ref em)).RemoveComponent<RemoveBuffOnGameplayEventEntry>(val3);
				}
				if (((EntityManager)(ref em)).HasComponent<BuffModificationFlagData>(val3))
				{
					((EntityManager)(ref em)).RemoveComponent<BuffModificationFlagData>(val3);
				}
				if (!((EntityManager)(ref em)).HasBuffer<ModifyUnitStatBuff_DOTS>(val3))
				{
					((EntityManager)(ref em)).AddBuffer<ModifyUnitStatBuff_DOTS>(val3);
				}
				DynamicBuffer<ModifyUnitStatBuff_DOTS> buffer = ((EntityManager)(ref em)).GetBuffer<ModifyUnitStatBuff_DOTS>(val3, false);
				buffer.Clear();
				AddMod(buffer, (UnitStatType)74, SoloBuffSettings.DamageReductionBonus.Value);
				AddMod(buffer, (UnitStatType)62, SoloBuffSettings.HealthRecoveryBonus.Value);
				AddMod(buffer, (UnitStatType)75, SoloBuffSettings.HealingReceivedBonus.Value);
				AddMod(buffer, (UnitStatType)67, SoloBuffSettings.BonusPhysicalPowerBonus.Value);
				AddMod(buffer, (UnitStatType)29, SoloBuffSettings.PhysicalCritChanceBonus.Value);
				AddMod(buffer, (UnitStatType)30, SoloBuffSettings.PhysicalCritDamageBonus.Value);
				AddMod(buffer, (UnitStatType)90, SoloBuffSettings.WeaponSkillPowerBonus.Value);
				AddMod(buffer, (UnitStatType)68, SoloBuffSettings.BonusSpellPowerBonus.Value);
				AddMod(buffer, (UnitStatType)31, SoloBuffSettings.SpellCritChanceBonus.Value);
				AddMod(buffer, (UnitStatType)32, SoloBuffSettings.SpellCritDamageBonus.Value);
				AddMod(buffer, (UnitStatType)72, SoloBuffSettings.UltimateEfficiencyBonus.Value);
				AddMod(buffer, (UnitStatType)76, SoloBuffSettings.IncreasedShieldEfficiencyBonus.Value);
				AddMod(buffer, (UnitStatType)83, SoloBuffSettings.BonusMovementSpeedBonus.Value);
				AddMod(buffer, (UnitStatType)84, SoloBuffSettings.BonusShapeshiftMovementSpeedBonus.Value);
				AddMod(buffer, (UnitStatType)82, SoloBuffSettings.BonusMaxHealthBonus.Value);
				AddMod(buffer, (UnitStatType)3, SoloBuffSettings.ResourceYieldModifierBonus.Value);
				AddMod(buffer, (UnitStatType)61, SoloBuffSettings.PrimaryLeechFactorBonus.Value);
				AddMod(buffer, (UnitStatType)27, SoloBuffSettings.PhysicalLifeLeechFactorBonus.Value);
				AddMod(buffer, (UnitStatType)28, SoloBuffSettings.SpellLifeLeechFactorBonus.Value);
				AddMod(buffer, (UnitStatType)59, SoloBuffSettings.PrimaryAttackSpeedBonus.Value);
				ManualLogSource logger = Plugin.Logger;
				BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(36, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[SoloBuff] Applied to ");
					((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<FixedString64Bytes>(user.CharacterName);
					((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" (");
					((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<int>(buffer.Length);
					((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" stat mods).");
				}
				logger.LogInfo(val4);
			}
			else
			{
				ManualLogSource logger2 = Plugin.Logger;
				BepInExWarningLogInterpolatedStringHandler val5 = new BepInExWarningLogInterpolatedStringHandler(42, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("[SoloBuff] Failed to get buff entity for ");
					((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<FixedString64Bytes>(user.CharacterName);
					((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(".");
				}
				logger2.LogWarning(val5);
			}
			_soloBuffActive[user.PlatformId] = true;
		}

		private static void RemoveSoloBuff(Entity userEntity, EntityManager em, User user)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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_004c: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			_soloBuffActive[user.PlatformId] = false;
			Entity entity = user.LocalCharacter._Entity;
			if (!(entity == Entity.Null) && ((EntityManager)(ref em)).Exists(entity))
			{
				RemoveBuffIfExists(em, entity);
				ManualLogSource logger = Plugin.Logger;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(25, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[SoloBuff] Removed from ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<FixedString64Bytes>(user.CharacterName);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(".");
				}
				logger.LogInfo(val);
			}
		}

		private static void RemoveBuffIfExists(EntityManager em, Entity charEntity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			Entity val = default(Entity);
			if (BuffUtility.TryGetBuff<EntityManager>(em, charEntity, PrefabIdentifier.op_Implicit(SoloBuffPrefab), ref val) && ((EntityManager)(ref em)).Exists(val))
			{
				DestroyUtility.Destroy(em, val, (DestroyDebugReason)0, (string)null, 0);
			}
		}

		private static void AddMod(DynamicBuffer<ModifyUnitStatBuff_DOTS> buffer, UnitStatType statType, float value)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			if (value != 0f)
			{
				buffer.Add(new ModifyUnitStatBuff_DOTS
				{
					StatType = statType,
					ModificationType = (ModificationType)6,
					Value = value,
					Modifier = 1f,
					IncreaseByStacks = false,
					ValueByStacks = 0f,
					Priority = 0,
					Id = ModificationId.NewId(_modIdCounter++)
				});
			}
		}

		public static void SendMessage(EntityManager em, User user, string message)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			FixedString512Bytes val = FixedString512Bytes.op_Implicit(message);
			ServerChatUtils.SendSystemMessageToClient(em, user, ref val);
		}

		public static bool IsReconnecting(ulong steamId)
		{
			bool result = _reconnecting.Contains(steamId);
			_reconnecting.Remove(steamId);
			return result;
		}

		public static bool TryGetDisconnectTime(ulong steamId, out DateTime disconnectTime)
		{
			return _disconnectTimes.TryGetValue(steamId, out disconnectTime);
		}

		public static bool IsBuffActive(ulong steamId)
		{
			bool value;
			return _soloBuffActive.TryGetValue(steamId, out value) && value;
		}
	}
}
namespace SoloBuff.Patches
{
	[HarmonyPatch(typeof(ServerBootstrapSystem), "OnUserConnected")]
	public static class PlayerConnectPatch
	{
		public static void Postfix(ServerBootstrapSystem __instance, NetConnectionId netConnectionId)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				EntityManager entityManager = ((ComponentSystemBase)__instance).EntityManager;
				int num = __instance._NetEndPointToApprovedUserIndex[netConnectionId];
				Entity userEntity = ((Il2CppArrayBase<ServerClient>)(object)__instance._ApprovedUsersLookup)[num].UserEntity;
				User componentData = ((EntityManager)(ref entityManager)).GetComponentData<User>(userEntity);
				if (!((FixedString64Bytes)(ref componentData.CharacterName)).IsEmpty)
				{
					Debug.Log(Object.op_Implicit($"[SoloBuff] Player connected: {componentData.CharacterName}"));
				}
				SoloBuffService.OnPlayerConnected(userEntity);
			}
			catch (Exception ex)
			{
				Debug.LogError(Object.op_Implicit("[SoloBuff] PlayerConnectPatch error: " + ex.Message + "\n" + ex.StackTrace));
			}
		}
	}
	[HarmonyPatch(typeof(ServerBootstrapSystem), "OnUserDisconnected")]
	public static class PlayerDisconnectPatch
	{
		public static void Prefix(ServerBootstrapSystem __instance, NetConnectionId netConnectionId, ConnectionStatusChangeReason connectionStatusReason, string extraData)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				int num = __instance._NetEndPointToApprovedUserIndex[netConnectionId];
				Entity userEntity = ((Il2CppArrayBase<ServerClient>)(object)__instance._ApprovedUsersLookup)[num].UserEntity;
				EntityManager entityManager = ((ComponentSystemBase)__instance).EntityManager;
				User componentData = ((EntityManager)(ref entityManager)).GetComponentData<User>(userEntity);
				if (!((FixedString64Bytes)(ref componentData.CharacterName)).IsEmpty)
				{
					Debug.Log(Object.op_Implicit($"[SoloBuff] Player disconnected: {componentData.CharacterName}"));
					SoloBuffService.OnPlayerDisconnected(userEntity);
				}
			}
			catch (Exception ex)
			{
				Debug.LogError(Object.op_Implicit("[SoloBuff] PlayerDisconnectPatch error: " + ex.Message + "\n" + ex.StackTrace));
			}
		}
	}
	[HarmonyPatch(typeof(BuffSystem_Spawn_Server), "OnUpdate")]
	public static class PlayerReadyPatch
	{
		private static readonly int OutOfCombatBuffGuid = 897325455;

		private static readonly Dictionary<ulong, DateTime> _lastReady = new Dictionary<ulong, DateTime>();

		private static readonly TimeSpan ReadyCooldown = TimeSpan.FromSeconds(10.0);

		internal static readonly ConcurrentQueue<Entity> PendingSpawns = new ConcurrentQueue<Entity>();

		public static void Postfix(BuffSystem_Spawn_Server __instance)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				EntityManager entityManager = ((ComponentSystemBase)__instance).EntityManager;
				EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[3]
				{
					ComponentType.ReadOnly<Buff>(),
					ComponentType.ReadOnly<PrefabGUID>(),
					ComponentType.ReadOnly<SpawnTag>()
				});
				NativeArray<Entity> val2 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
				try
				{
					Enumerator<Entity> enumerator = val2.GetEnumerator();
					while (enumerator.MoveNext())
					{
						Entity current = enumerator.Current;
						PrefabGUID componentData = ((EntityManager)(ref entityManager)).GetComponentData<PrefabGUID>(current);
						if (((PrefabGUID)(ref componentData)).GuidHash != OutOfCombatBuffGuid)
						{
							continue;
						}
						Entity target = ((EntityManager)(ref entityManager)).GetComponentData<Buff>(current).Target;
						if (target == Entity.Null || !((EntityManager)(ref entityManager)).Exists(target) || !((EntityManager)(ref entityManager)).HasComponent<PlayerCharacter>(target))
						{
							continue;
						}
						Entity userEntity = ((EntityManager)(ref entityManager)).GetComponentData<PlayerCharacter>(target).UserEntity;
						if (((EntityManager)(ref entityManager)).HasComponent<User>(userEntity))
						{
							User componentData2 = ((EntityManager)(ref entityManager)).GetComponentData<User>(userEntity);
							ulong platformId = componentData2.PlatformId;
							if (!((FixedString64Bytes)(ref componentData2.CharacterName)).IsEmpty && (!_lastReady.TryGetValue(platformId, out var value) || !(DateTime.UtcNow - value < ReadyCooldown)))
							{
								_lastReady[platformId] = DateTime.UtcNow;
								Debug.Log(Object.op_Implicit($"[SoloBuff] Player ready (reconnect): {componentData2.CharacterName}"));
								PendingSpawns.Enqueue(userEntity);
							}
						}
					}
				}
				finally
				{
					val2.Dispose();
				}
			}
			catch (Exception ex)
			{
				Debug.LogError(Object.op_Implicit("[SoloBuff] PlayerReadyPatch error: " + ex.Message + "\n" + ex.StackTrace));
			}
		}
	}
	[HarmonyPatch(typeof(Destroy_TravelBuffSystem), "OnUpdate")]
	public static class PlayerSpawnPatch
	{
		private static readonly int CoffinBuffGuid = 722466953;

		private static readonly Dictionary<ulong, DateTime> _lastSpawn = new Dictionary<ulong, DateTime>();

		private static readonly TimeSpan SpawnCooldown = TimeSpan.FromSeconds(10.0);

		public static void Postfix(Destroy_TravelBuffSystem __instance)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				EntityManager entityManager = ((ComponentSystemBase)__instance).EntityManager;
				EntityQuery _query_615927226_ = __instance.__query_615927226_0;
				NativeArray<Entity> val = ((EntityQuery)(ref _query_615927226_)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
				try
				{
					Enumerator<Entity> enumerator = val.GetEnumerator();
					while (enumerator.MoveNext())
					{
						Entity current = enumerator.Current;
						PrefabGUID componentData = ((EntityManager)(ref entityManager)).GetComponentData<PrefabGUID>(current);
						if (((PrefabGUID)(ref componentData)).GuidHash != CoffinBuffGuid || !((EntityManager)(ref entityManager)).HasComponent<EntityOwner>(current))
						{
							continue;
						}
						Entity owner = ((EntityManager)(ref entityManager)).GetComponentData<EntityOwner>(current).Owner;
						if (!((EntityManager)(ref entityManager)).HasComponent<PlayerCharacter>(owner))
						{
							continue;
						}
						Entity userEntity = ((EntityManager)(ref entityManager)).GetComponentData<PlayerCharacter>(owner).UserEntity;
						if (((EntityManager)(ref entityManager)).HasComponent<User>(userEntity))
						{
							User componentData2 = ((EntityManager)(ref entityManager)).GetComponentData<User>(userEntity);
							ulong platformId = componentData2.PlatformId;
							if (!((FixedString64Bytes)(ref componentData2.CharacterName)).IsEmpty && (!_lastSpawn.TryGetValue(platformId, out var value) || !(DateTime.UtcNow - value < SpawnCooldown)))
							{
								_lastSpawn[platformId] = DateTime.UtcNow;
								Debug.Log(Object.op_Implicit($"[SoloBuff] New character spawned: {componentData2.CharacterName}"));
								PlayerReadyPatch.PendingSpawns.Enqueue(userEntity);
							}
						}
					}
				}
				finally
				{
					val.Dispose();
				}
			}
			catch (Exception ex)
			{
				Debug.LogError(Object.op_Implicit("[SoloBuff] PlayerSpawnPatch error: " + ex.Message + "\n" + ex.StackTrace));
			}
		}
	}
	[HarmonyPatch(typeof(ServerBootstrapSystem), "OnUpdate")]
	public static class PeriodicReevaluationPatch
	{
		private static int _tickCount;

		private const int TickInterval = 60;

		public static void Postfix()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Entity result;
				while (PlayerReadyPatch.PendingSpawns.TryDequeue(out result))
				{
					try
					{
						SoloBuffService.OnPlayerSpawned(result);
					}
					catch (Exception ex)
					{
						Debug.LogError(Object.op_Implicit("[SoloBuff] PendingSpawn error: " + ex.Message));
					}
				}
				SoloBuffService.DrainMainThreadQueue();
				_tickCount++;
				if (_tickCount < 60)
				{
					return;
				}
				_tickCount = 0;
				EntityManager serverEntityManager = VWorld.ServerEntityManager;
				EntityQuery val = ((EntityManager)(ref serverEntityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<User>() });
				NativeArray<Entity> val2 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
				try
				{
					Enumerator<Entity> enumerator = val2.GetEnumerator();
					while (enumerator.MoveNext())
					{
						Entity current = enumerator.Current;
						if (((EntityManager)(ref serverEntityManager)).GetComponentData<User>(current).IsConnected)
						{
							SoloBuffService.ReevaluateSingle(current, serverEntityManager);
						}
					}
				}
				finally
				{
					val2.Dispose();
				}
			}
			catch (Exception ex2)
			{
				Debug.LogError(Object.op_Implicit("[SoloBuff] PeriodicReevaluationPatch error: " + ex2.Message + "\n" + ex2.StackTrace));
			}
		}
	}
}
namespace SoloBuff.Commands
{
	internal class DumpCommand
	{
		private static readonly string DumpFolder = Path.Combine(Paths.ConfigPath, "BestSoloBuff", "Dumps");

		[Command("solo-buff-dump", "sbd", null, "Dump solo buff stats for a player to a text file. Usage: .sbd <playerName>", null, true)]
		public static void DumpStats(ChatCommandContext ctx, string playerName)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c6f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c76: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			//IL_0378: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_041d: Unknown result type (might be due to invalid IL or missing references)
			//IL_041f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0454: Unknown result type (might be due to invalid IL or missing references)
			//IL_0456: Unknown result type (might be due to invalid IL or missing references)
			//IL_048b: Unknown result type (might be due to invalid IL or missing references)
			//IL_048d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0530: Unknown result type (might be due to invalid IL or missing references)
			//IL_0532: Unknown result type (might be due to invalid IL or missing references)
			//IL_0567: Unknown result type (might be due to invalid IL or missing references)
			//IL_0569: Unknown result type (might be due to invalid IL or missing references)
			//IL_059e: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f6: 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_0614: Unknown result type (might be due to invalid IL or missing references)
			//IL_0649: Unknown result type (might be due to invalid IL or missing references)
			//IL_064b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0680: Unknown result type (might be due to invalid IL or missing references)
			//IL_0682: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c23: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c2a: Expected O, but got Unknown
			EntityManager serverEntityManager = VWorld.ServerEntityManager;
			Entity val = Entity.Null;
			string text = playerName;
			EntityQuery val2 = ((EntityManager)(ref serverEntityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<User>() });
			NativeArray<Entity> val3 = ((EntityQuery)(ref val2)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
			try
			{
				Enumerator<Entity> enumerator = val3.GetEnumerator();
				while (enumerator.MoveNext())
				{
					Entity current = enumerator.Current;
					User componentData = ((EntityManager)(ref serverEntityManager)).GetComponentData<User>(current);
					if (((object)(FixedString64Bytes)(ref componentData.CharacterName)).ToString().Equals(playerName, StringComparison.OrdinalIgnoreCase))
					{
						text = ((object)(FixedString64Bytes)(ref componentData.CharacterName)).ToString();
						val = componentData.LocalCharacter._Entity;
						break;
					}
				}
			}
			finally
			{
				val3.Dispose();
			}
			if (val == Entity.Null || !((EntityManager)(ref serverEntityManager)).Exists(val))
			{
				ctx.Reply("<color=#ff5555>[SoloBuff]</color> Player '" + playerName + "' not found or offline.");
				return;
			}
			List<string> list = new List<string>();
			list.Add("=== SoloBuff Stats Dump ===");
			list.Add("Player   : " + text);
			list.Add($"Time     : {DateTime.Now:yyyy-MM-dd HH:mm:ss}");
			list.Add($"BuffActive: {SoloBuffService.IsBuffActive(((EntityManager)(ref serverEntityManager)).GetComponentData<User>(GetUserEntity(serverEntityManager, val)).PlatformId)}");
			list.Add("");
			list.Add("--- UnitStats ---");
			if (((EntityManager)(ref serverEntityManager)).HasComponent<UnitStats>(val))
			{
				UnitStats componentData2 = ((EntityManager)(ref serverEntityManager)).GetComponentData<UnitStats>(val);
				list.Add($"  PhysicalPower   : {componentData2.PhysicalPower._Value}");
				list.Add($"  SpellPower      : {componentData2.SpellPower._Value}");
				list.Add($"  DamageReduction : {componentData2.DamageReduction._Value}");
				list.Add($"  HealthRecovery  : {componentData2.HealthRecovery._Value}");
				list.Add($"  HealingReceived : {componentData2.HealingReceived._Value}");
			}
			else
			{
				list.Add("  (component missing)");
			}
			list.Add("");
			list.Add("--- VampireSpecificAttributes ---");
			if (((EntityManager)(ref serverEntityManager)).HasComponent<VampireSpecificAttributes>(val))
			{
				VampireSpecificAttributes componentData3 = ((EntityManager)(ref serverEntityManager)).GetComponentData<VampireSpecificAttributes>(val);
				list.Add($"  BonusPhysicalPower           : {componentData3.BonusPhysicalPower._Value}");
				list.Add($"  PhysicalCriticalStrikeChance : {componentData3.PhysicalCriticalStrikeChance._Value}");
				list.Add($"  PhysicalCriticalStrikeDamage : {componentData3.PhysicalCriticalStrikeDamage._Value}");
				list.Add($"  WeaponSkillPower             : {componentData3.WeaponSkillPower._Value}");
				list.Add($"  BonusSpellPower              : {componentData3.BonusSpellPower._Value}");
				list.Add($"  SpellCriticalStrikeChance    : {componentData3.SpellCriticalStrikeChance._Value}");
				list.Add($"  SpellCriticalStrikeDamage    : {componentData3.SpellCriticalStrikeDamage._Value}");
				list.Add($"  UltimateEfficiency           : {componentData3.UltimateEfficiency._Value}");
				list.Add($"  IncreasedShieldEfficiency    : {componentData3.IncreasedShieldEfficiency._Value}");
				list.Add($"  BonusMovementSpeed           : {componentData3.BonusMovementSpeed._Value}");
				list.Add($"  BonusShapeshiftMovementSpeed : {componentData3.BonusShapeshiftMovementSpeed._Value}");
				list.Add($"  BonusMaxHealth               : {componentData3.BonusMaxHealth._Value}");
				list.Add($"  ResourceYieldModifier        : {componentData3.ResourceYieldModifier._Value}");
			}
			else
			{
				list.Add("  (component missing)");
			}
			list.Add("");
			list.Add("--- LifeLeech ---");
			if (((EntityManager)(ref serverEntityManager)).HasComponent<LifeLeech>(val))
			{
				LifeLeech componentData4 = ((EntityManager)(ref serverEntityManager)).GetComponentData<LifeLeech>(val);
				list.Add($"  PrimaryLeechFactor      : {componentData4.PrimaryLeechFactor._Value}");
				list.Add($"  PhysicalLifeLeechFactor : {componentData4.PhysicalLifeLeechFactor._Value}");
				list.Add($"  SpellLifeLeechFactor    : {componentData4.SpellLifeLeechFactor._Value}");
			}
			else
			{
				list.Add("  (component missing)");
			}
			list.Add("");
			list.Add("--- AbilityBar_Shared ---");
			if (((EntityManager)(ref serverEntityManager)).HasComponent<AbilityBar_Shared>(val))
			{
				AbilityBar_Shared componentData5 = ((EntityManager)(ref serverEntityManager)).GetComponentData<AbilityBar_Shared>(val);
				list.Add($"  PrimaryAttackSpeed : {componentData5.PrimaryAttackSpeed._Value}");
			}
			else
			{
				list.Add("  (component missing)");
			}
			list.Add("");
			list.Add("--- SoloBuff Config ---");
			list.Add("  [UnitStats]");
			list.Add($"    DamageReduction +{SoloBuffSettings.DamageReductionBonus.Value}");
			list.Add($"    HealthRecovery  +{SoloBuffSettings.HealthRecoveryBonus.Value}");
			list.Add($"    HealingReceived +{SoloBuffSettings.HealingReceivedBonus.Value}");
			list.Add("  [VampireAttr]");
			list.Add($"    BonusPhysicalPower           +{SoloBuffSettings.BonusPhysicalPowerBonus.Value}");
			list.Add($"    PhysicalCritChance           +{SoloBuffSettings.PhysicalCritChanceBonus.Value}");
			list.Add($"    PhysicalCritDamage           +{SoloBuffSettings.PhysicalCritDamageBonus.Value}");
			list.Add($"    WeaponSkillPower             +{SoloBuffSettings.WeaponSkillPowerBonus.Value}");
			list.Add($"    BonusSpellPower              +{SoloBuffSettings.BonusSpellPowerBonus.Value}");
			list.Add($"    SpellCritChance              +{SoloBuffSettings.SpellCritChanceBonus.Value}");
			list.Add($"    SpellCritDamage              +{SoloBuffSettings.SpellCritDamageBonus.Value}");
			list.Add($"    UltimateEfficiency           +{SoloBuffSettings.UltimateEfficiencyBonus.Value}");
			list.Add($"    IncreasedShieldEfficiency    +{SoloBuffSettings.IncreasedShieldEfficiencyBonus.Value}");
			list.Add($"    BonusMovementSpeed           +{SoloBuffSettings.BonusMovementSpeedBonus.Value}");
			list.Add($"    BonusShapeshiftMovementSpeed +{SoloBuffSettings.BonusShapeshiftMovementSpeedBonus.Value}");
			list.Add($"    BonusMaxHealth               +{SoloBuffSettings.BonusMaxHealthBonus.Value}");
			list.Add($"    ResourceYieldModifier        +{SoloBuffSettings.ResourceYieldModifierBonus.Value}");
			list.Add("  [LifeLeech]");
			list.Add($"    PrimaryLeechFactor      +{SoloBuffSettings.PrimaryLeechFactorBonus.Value}");
			list.Add($"    PhysicalLifeLeechFactor +{SoloBuffSettings.PhysicalLifeLeechFactorBonus.Value}");
			list.Add($"    SpellLifeLeechFactor    +{SoloBuffSettings.SpellLifeLeechFactorBonus.Value}");
			list.Add("  [AbilityBar]");
			list.Add($"    PrimaryAttackSpeed +{SoloBuffSettings.PrimaryAttackSpeedBonus.Value}");
			bool flag = default(bool);
			try
			{
				if (!Directory.Exists(DumpFolder))
				{
					Directory.CreateDirectory(DumpFolder);
				}
				string text2 = Path.Combine(DumpFolder, $"dump_{text}_{DateTime.Now:yyyyMMdd_HHmmss}.txt");
				File.WriteAllLines(text2, list);
				ctx.Reply("<color=#00ff88>[SoloBuff]</color> Dump written to:\n<color=#ffffff>" + text2 + "</color>");
				ManualLogSource logger = Plugin.Logger;
				BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(27, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[SoloBuff] Dump written to ");
					((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(text2);
				}
				logger.LogInfo(val4);
			}
			catch (Exception ex)
			{
				ctx.Reply("<color=#ff5555>[SoloBuff]</color> Error writing dump: " + ex.Message);
				ManualLogSource logger2 = Plugin.Logger;
				BepInExErrorLogInterpolatedStringHandler val5 = new BepInExErrorLogInterpolatedStringHandler(24, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("[SoloBuff] Dump error: ");
					((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<string>(ex.Message);
					((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("\n");
					((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<string>(ex.StackTrace);
				}
				logger2.LogError(val5);
			}
		}

		private static Entity GetUserEntity(EntityManager em, Entity charEntity)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			if (((EntityManager)(ref em)).HasComponent<PlayerCharacter>(charEntity))
			{
				return ((EntityManager)(ref em)).GetComponentData<PlayerCharacter>(charEntity).UserEntity;
			}
			return Entity.Null;
		}
	}
	internal class SoloBuffCommand
	{
		[Command("solo-buff", "sb", null, "Toggle the solo buff on or off.", null, false)]
		public static void SoloToggle(ChatCommandContext ctx)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			SoloBuffService.ToggleManual(ctx.Event.SenderUserEntity);
		}

		[Command("solo-buff-status", "sbs", null, "Display your current solo buff status.", null, false)]
		public static void SoloStatus(ChatCommandContext ctx)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			EntityManager serverEntityManager = VWorld.ServerEntityManager;
			Entity senderUserEntity = ctx.Event.SenderUserEntity;
			User user = ctx.Event.User;
			bool num = SoloBuffService.IsSoloEligible(senderUserEntity, serverEntityManager);
			bool flag = SoloBuffService.IsBuffActive(user.PlatformId);
			string value = (num ? "<color=#00ff88>yes</color>" : "<color=#ff4444>no</color>");
			string value2 = (flag ? "<color=#00ff88>active</color>" : "<color=#ff5555>inactive</color>");
			ctx.Reply("<color=#ffaa00>--- Solo Buff ---</color>\n" + $"  Eligible: {value}  |  Status: {value2}\n" + $"  BonusPhysPower +{SoloBuffSettings.BonusPhysicalPowerBonus.Value}% | BonusSpellPower +{SoloBuffSettings.BonusSpellPowerBonus.Value}%\n" + $"  CritChance +{SoloBuffSettings.PhysicalCritChanceBonus.Value * 100f:0}% | MoveSpeed +{SoloBuffSettings.BonusMovementSpeedBonus.Value * 100f:0}%\n" + $"  Leech +{SoloBuffSettings.PhysicalLifeLeechFactorBonus.Value * 100f:0}% | AttackSpeed +{SoloBuffSettings.PrimaryAttackSpeedBonus.Value * 100f:0}%");
		}

		[Command("solo-buff-timer", "sbt", null, "Show how long until you are eligible for the solo buff.", null, false)]
		public static void SoloTimer(ChatCommandContext ctx)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			EntityManager serverEntityManager = VWorld.ServerEntityManager;
			Entity senderUserEntity = ctx.Event.SenderUserEntity;
			User user = ctx.Event.User;
			if (SoloBuffService.IsSoloEligible(senderUserEntity, serverEntityManager))
			{
				ctx.Reply("<color=#00ff88>You are already eligible! Type <color=#ffffff>.sb</color><color=#00ff88> to enable the buff.</color>");
				return;
			}
			Entity entity = user.ClanEntity._Entity;
			if (entity == Entity.Null || !((EntityManager)(ref serverEntityManager)).Exists(entity))
			{
				ctx.Reply("<color=#ff5555>No clan detected.</color>");
				return;
			}
			EntityQuery val = ((EntityManager)(ref serverEntityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<User>() });
			NativeArray<Entity> val2 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
			double num = 0.0;
			string text = null;
			try
			{
				Enumerator<Entity> enumerator = val2.GetEnumerator();
				while (enumerator.MoveNext())
				{
					Entity current = enumerator.Current;
					if (current == senderUserEntity)
					{
						continue;
					}
					User componentData = ((EntityManager)(ref serverEntityManager)).GetComponentData<User>(current);
					if (!(componentData.ClanEntity._Entity != entity))
					{
						if (componentData.IsConnected)
						{
							ctx.Reply($"<color=#ff4444><color=#ffffff>{componentData.CharacterName}</color> is online — solo buff unavailable while they are connected.</color>");
							return;
						}
						double num2 = SoloBuffSettings.InactivityMinutes.Value;
						if (SoloBuffService.TryGetDisconnectTime(componentData.PlatformId, out var disconnectTime))
						{
							double totalMinutes = (DateTime.UtcNow - disconnectTime).TotalMinutes;
							num2 = Math.Max(0.0, (double)SoloBuffSettings.InactivityMinutes.Value - totalMinutes);
						}
						if (num2 > num)
						{
							num = num2;
							text = ((object)(FixedString64Bytes)(ref componentData.CharacterName)).ToString();
						}
					}
				}
			}
			finally
			{
				val2.Dispose();
			}
			if (text != null && num > 0.0)
			{
				int num3 = (int)Math.Ceiling(num);
				ctx.Reply($"<color=#ffaa00>Solo buff available in <color=#ffffff>{num3} minute{((num3 > 1) ? "s" : "")}</color><color=#ffaa00> (waiting for <color=#ffffff>{text}</color><color=#ffaa00> to become inactive).</color>");
			}
			else
			{
				ctx.Reply("<color=#00ff88>You are eligible! Type <color=#ffffff>.sb</color><color=#00ff88> to enable the buff.</color>");
			}
		}

		[Command("solo-buff-reload", "sbr", null, "Re-evaluate the solo buff for all connected players.", null, true)]
		public static void SoloReload(ChatCommandContext ctx)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			EntityManager serverEntityManager = VWorld.ServerEntityManager;
			EntityQuery val = ((EntityManager)(ref serverEntityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<User>() });
			NativeArray<Entity> val2 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
			try
			{
				Enumerator<Entity> enumerator = val2.GetEnumerator();
				while (enumerator.MoveNext())
				{
					Entity current = enumerator.Current;
					if (((EntityManager)(ref serverEntityManager)).GetComponentData<User>(current).IsConnected)
					{
						SoloBuffService.ReevaluateSingle(current, serverEntityManager);
					}
				}
			}
			finally
			{
				val2.Dispose();
			}
			ctx.Reply("<color=#00ff88>[SoloBuff]</color> Buffs re-evaluated for all connected players.");
		}

		[Command("solo-buff-set", "sbset", null, "Modify a solo buff bonus on the fly. Usage: .sbset <stat> <value>", null, true)]
		public static void SoloSet(Ch