Decompiled source of SoulForge v2.0.1

SoulForge.dll

Decompiled 4 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using ProjectM;
using ProjectM.Network;
using ProjectM.Shared;
using SoulForge.Utils;
using Stunlock.Core;
using Unity.Collections;
using Unity.Entities;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Darrean(inility)")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Allows you to manage shard stashing and provided the abilities to add glows to shard holders.")]
[assembly: AssemblyFileVersion("0.1.10.0")]
[assembly: AssemblyInformationalVersion("0.1.10+1.Branch.main.Sha.c33d0879382e1a0da34861ec55914ba7e637a80e")]
[assembly: AssemblyProduct("SoulForge")]
[assembly: AssemblyTitle("SoulForge")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.10.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SoulForge
{
	public static class Data
	{
		public static PrefabGUID SolarusContainer = new PrefabGUID(-824445631);

		public static PrefabGUID MonsterContainer = new PrefabGUID(-1996942061);

		public static PrefabGUID ManticoreContainer = new PrefabGUID(653759442);

		public static PrefabGUID DraculaContainer = new PrefabGUID(1495743889);

		public static PrefabGUID MorganaContainer = new PrefabGUID(1724128982);

		public static HashSet<PrefabGUID> BlockedContainers = new HashSet<PrefabGUID> { SolarusContainer, MonsterContainer, ManticoreContainer, DraculaContainer, MorganaContainer };

		public static PrefabGUID DraculaShardItem = new PrefabGUID(666638454);

		public static PrefabGUID DraculaGlowBuff = new PrefabGUID(662242066);

		public static PrefabGUID AdamShardItem = new PrefabGUID(-1581189572);

		public static PrefabGUID AdamGlowBuff = new PrefabGUID(1237097606);

		public static PrefabGUID HorrorShardItem = new PrefabGUID(-1260254082);

		public static PrefabGUID HorrorGlowBuff = new PrefabGUID(1670636401);

		public static PrefabGUID SolarusShardItem = new PrefabGUID(-1559874083);

		public static PrefabGUID SolarusGlowBuff = new PrefabGUID(1688799287);

		public static PrefabGUID MorganaShardItem = new PrefabGUID(1286615355);

		public static PrefabGUID MorganaGlowBuff = new PrefabGUID(-1841976861);

		public static Dictionary<PrefabGUID, PrefabGUID> ShardNecklacesToVisualBuffs = new Dictionary<PrefabGUID, PrefabGUID>
		{
			{ DraculaShardItem, DraculaGlowBuff },
			{ AdamShardItem, AdamGlowBuff },
			{ HorrorShardItem, HorrorGlowBuff },
			{ SolarusShardItem, SolarusGlowBuff },
			{ MorganaShardItem, MorganaGlowBuff }
		};
	}
	public static class Helpers
	{
		private static bool TryGetBuffEntity(Entity character, PrefabGUID buffGuid, out Entity buffEntity)
		{
			//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_0014: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_003e: 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_0046: 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_004d: 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_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)
			EntityManager entityManager = VWorld.EntityManager;
			buffEntity = Entity.Null;
			if (!((EntityManager)(ref entityManager)).HasComponent<BuffBuffer>(character))
			{
				return false;
			}
			Enumerator<BuffBuffer> enumerator = ((EntityManager)(ref entityManager)).GetBuffer<BuffBuffer>(character, false).GetEnumerator();
			while (enumerator.MoveNext())
			{
				BuffBuffer current = enumerator.Current;
				PrefabGUID prefabGuid = current.PrefabGuid;
				if (((PrefabGUID)(ref prefabGuid)).Equals(buffGuid))
				{
					buffEntity = current.Entity;
					return true;
				}
			}
			return false;
		}

		public static bool BuffPlayer(Entity character, Entity user, PrefabGUID buffPrefab, int duration = -1, bool persistsThroughDeath = false)
		{
			//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_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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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_0042: 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_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_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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: 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_00ab: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			if (TryGetBuffEntity(character, buffPrefab, out var _))
			{
				return false;
			}
			EntityManager entityManager = VWorld.EntityManager;
			DebugEventsSystem existingSystemManaged = VWorld.Server.GetExistingSystemManaged<DebugEventsSystem>();
			FromCharacter val = default(FromCharacter);
			val.User = user;
			val.Character = character;
			FromCharacter val2 = val;
			existingSystemManaged.ApplyBuff(val2, new ApplyBuffDebugEvent
			{
				BuffPrefabGUID = buffPrefab
			});
			if (TryGetBuffEntity(character, buffPrefab, out var buffEntity2))
			{
				if (((EntityManager)(ref entityManager)).HasComponent<CreateGameplayEventsOnSpawn>(buffEntity2))
				{
					((EntityManager)(ref entityManager)).RemoveComponent<CreateGameplayEventsOnSpawn>(buffEntity2);
				}
				if (((EntityManager)(ref entityManager)).HasComponent<GameplayEventListeners>(buffEntity2))
				{
					((EntityManager)(ref entityManager)).RemoveComponent<GameplayEventListeners>(buffEntity2);
				}
				if (persistsThroughDeath)
				{
					((EntityManager)(ref entityManager)).AddComponent<Buff_Persists_Through_Death>(buffEntity2);
				}
				if (((EntityManager)(ref entityManager)).HasComponent<LifeTime>(buffEntity2))
				{
					LifeTime componentData = ((EntityManager)(ref entityManager)).GetComponentData<LifeTime>(buffEntity2);
					if (duration == 0)
					{
						componentData.Duration = -1f;
						componentData.EndAction = (LifeTimeEndAction)0;
					}
					else if (duration > 0)
					{
						componentData.Duration = duration;
					}
					((EntityManager)(ref entityManager)).SetComponentData<LifeTime>(buffEntity2, componentData);
				}
				return true;
			}
			return false;
		}

		public static void Unbuff(Entity character, PrefabGUID buffPrefab)
		{
			//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)
			//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)
			EntityManager entityManager = VWorld.EntityManager;
			if (TryGetBuffEntity(character, buffPrefab, out var buffEntity))
			{
				DestroyUtility.Destroy(entityManager, buffEntity, (DestroyDebugReason)13, (string)null, 0);
			}
		}
	}
	[BepInPlugin("SoulForge", "SoulForge", "2.0.1")]
	public class Plugin : BasePlugin
	{
		private Harmony _harmony;

		public static Plugin Instance { get; private set; }

		public bool StartupCheckDone { get; set; } = false;


		public static ConfigEntry<bool> AllowSolarusContainer { get; private set; }

		public static ConfigEntry<bool> AllowMonsterContainer { get; private set; }

		public static ConfigEntry<bool> AllowManticoreContainer { get; private set; }

		public static ConfigEntry<bool> AllowDraculaContainer { get; private set; }

		public static ConfigEntry<bool> AllowMorganaContainer { get; private set; }

		public static ConfigEntry<bool> EnableGlowDracula { get; private set; }

		public static ConfigEntry<bool> EnableGlowAdam { get; private set; }

		public static ConfigEntry<bool> EnableGlowHorror { get; private set; }

		public static ConfigEntry<bool> EnableGlowSolarus { get; private set; }

		public static ConfigEntry<bool> EnableGlowMorgana { get; private set; }

		public override void Load()
		{
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Expected O, but got Unknown
			Instance = this;
			AllowSolarusContainer = ((BasePlugin)this).Config.Bind<bool>("Containers", "Allow_Solarus", true, "Allow the Solarus container?");
			AllowMonsterContainer = ((BasePlugin)this).Config.Bind<bool>("Containers", "Allow_Monster", true, "Allow the Adam(Monster) container?");
			AllowManticoreContainer = ((BasePlugin)this).Config.Bind<bool>("Containers", "Allow_Manticore", true, "Allow the Winged Horror(Manticore) container?");
			AllowDraculaContainer = ((BasePlugin)this).Config.Bind<bool>("Containers", "Allow_Dracula", true, "Allow the Dracula container?");
			AllowMorganaContainer = ((BasePlugin)this).Config.Bind<bool>("Containers", "Allow_Morgana", true, "Allow the Morgana container?");
			EnableGlowDracula = ((BasePlugin)this).Config.Bind<bool>("Glows", "Enable_Dracula_Glow", true, "Enable glow for Dracula Shard?");
			EnableGlowAdam = ((BasePlugin)this).Config.Bind<bool>("Glows", "Enable_Adam_Glow", true, "Enable glow for Adam Shard?");
			EnableGlowHorror = ((BasePlugin)this).Config.Bind<bool>("Glows", "Enable_Horror_Glow", true, "Enable glow for Winged Horror Shard?");
			EnableGlowSolarus = ((BasePlugin)this).Config.Bind<bool>("Glows", "Enable_Solarus_Glow", true, "Enable glow for Solarus Shard?");
			EnableGlowMorgana = ((BasePlugin)this).Config.Bind<bool>("Glows", "Enable_Morgana_Glow", true, "Enable glow for Morgana Shard?");
			_harmony = new Harmony("SoulForge");
			_harmony.PatchAll();
			((BasePlugin)this).Log.LogInfo((object)"Plugin SoulForge is loaded.");
		}

		public override bool Unload()
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			return true;
		}

		public bool IsGlowEnabled(PrefabGUID shardItem)
		{
			//IL_0003: 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_003d: 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_0079: Unknown result type (might be due to invalid IL or missing references)
			if (((PrefabGUID)(ref shardItem)).Equals(Data.DraculaShardItem))
			{
				return EnableGlowDracula.Value;
			}
			if (((PrefabGUID)(ref shardItem)).Equals(Data.AdamShardItem))
			{
				return EnableGlowAdam.Value;
			}
			if (((PrefabGUID)(ref shardItem)).Equals(Data.HorrorShardItem))
			{
				return EnableGlowHorror.Value;
			}
			if (((PrefabGUID)(ref shardItem)).Equals(Data.SolarusShardItem))
			{
				return EnableGlowSolarus.Value;
			}
			if (((PrefabGUID)(ref shardItem)).Equals(Data.MorganaShardItem))
			{
				return EnableGlowMorgana.Value;
			}
			return true;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "SoulForge";

		public const string PLUGIN_NAME = "SoulForge";

		public const string PLUGIN_VERSION = "0.1.10";
	}
}
namespace SoulForge.Utils
{
	public static class VWorld
	{
		private static World _serverWorld;

		private static EntityManager _entityManager;

		public static World Server
		{
			get
			{
				//IL_0052: 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)
				if (_serverWorld != null && _serverWorld.IsCreated)
				{
					return _serverWorld;
				}
				_serverWorld = GetWorld("Server");
				if (_serverWorld != null)
				{
					_entityManager = _serverWorld.EntityManager;
				}
				else
				{
					_entityManager = default(EntityManager);
				}
				return _serverWorld;
			}
		}

		public static EntityManager EntityManager
		{
			get
			{
				//IL_0001: 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_000e: 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_0046: 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_0039: 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_0077: 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_006d: 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)
				if (_entityManager != default(EntityManager) && (_serverWorld == null || !_serverWorld.IsCreated))
				{
					_entityManager = default(EntityManager);
				}
				if (_entityManager == default(EntityManager) && Server != null)
				{
					_entityManager = Server.EntityManager;
				}
				return _entityManager;
			}
		}

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

		public static bool IsServerReady()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			return Server != null && Server.IsCreated && EntityManager != default(EntityManager);
		}
	}
}
namespace SoulForge.Patches
{
	[HarmonyPatch(typeof(Equipment), "SetEquipped")]
	public static class OnItemEquippedPatch
	{
		public static void Postfix(EntityManager entityManager, Entity target, PrefabGUID statItemId)
		{
			//IL_0003: 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_0029: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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_0044: 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)
			if (((EntityManager)(ref entityManager)).HasComponent<PlayerCharacter>(target) && Data.ShardNecklacesToVisualBuffs.TryGetValue(statItemId, out var value) && Plugin.Instance.IsGlowEnabled(statItemId))
			{
				Entity userEntity = ((EntityManager)(ref entityManager)).GetComponentData<PlayerCharacter>(target).UserEntity;
				Helpers.BuffPlayer(target, userEntity, value, 0);
			}
		}
	}
	[HarmonyPatch(typeof(Equipment), "UnequipItem", new Type[]
	{
		typeof(EntityManager),
		typeof(Entity),
		typeof(EquipmentType)
	})]
	public static class OnItemUnequippedPatch
	{
		public static void Prefix(ref Equipment __instance, Entity target, EquipmentType equipmentType)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: 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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			PrefabGUID equipmentItemId = ((Equipment)(ref __instance)).GetEquipmentItemId(equipmentType);
			if (!((PrefabGUID)(ref equipmentItemId)).IsEmpty() && Data.ShardNecklacesToVisualBuffs.TryGetValue(equipmentItemId, out var value))
			{
				Helpers.Unbuff(target, value);
			}
		}
	}
	[HarmonyPatch(typeof(ServerTimeSystem_Server), "OnUpdate")]
	public static class ServerTimeSystem_Patch
	{
		public static void Postfix()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_0062: 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_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_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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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_00b0: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: 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_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Expected O, but got Unknown
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.Instance.StartupCheckDone || !VWorld.IsServerReady())
			{
				return;
			}
			((BasePlugin)Plugin.Instance).Log.LogInfo((object)"Server is ready. Performing one-time check for equipped shards...");
			EntityManager entityManager = VWorld.EntityManager;
			EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[2]
			{
				ComponentType.ReadOnly<PlayerCharacter>(),
				ComponentType.ReadOnly<Equipment>()
			});
			NativeArray<Entity> val2 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
			Enumerator<Entity> enumerator = val2.GetEnumerator();
			NativeList<Entity> val3 = default(NativeList<Entity>);
			bool flag = default(bool);
			while (enumerator.MoveNext())
			{
				Entity current = enumerator.Current;
				Equipment componentData = ((EntityManager)(ref entityManager)).GetComponentData<Equipment>(current);
				val3..ctor(AllocatorHandle.op_Implicit((Allocator)2));
				((Equipment)(ref componentData)).GetAllEquipmentEntities(val3, false);
				Enumerator<Entity> enumerator2 = val3.GetEnumerator();
				while (enumerator2.MoveNext())
				{
					Entity current2 = enumerator2.Current;
					if (!((EntityManager)(ref entityManager)).HasComponent<PrefabGUID>(current2))
					{
						continue;
					}
					PrefabGUID componentData2 = ((EntityManager)(ref entityManager)).GetComponentData<PrefabGUID>(current2);
					if (Data.ShardNecklacesToVisualBuffs.TryGetValue(componentData2, out var value) && Plugin.Instance.IsGlowEnabled(componentData2))
					{
						ManualLogSource log = ((BasePlugin)Plugin.Instance).Log;
						BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(61, 1, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("Found player with shard [");
							((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<int>(((PrefabGUID)(ref componentData2)).GuidHash);
							((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("] on startup. Re-applying glow buff.");
						}
						log.LogInfo(val4);
						Entity userEntity = ((EntityManager)(ref entityManager)).GetComponentData<PlayerCharacter>(current).UserEntity;
						Helpers.BuffPlayer(current, userEntity, value, 0);
					}
				}
				val3.Dispose();
			}
			val2.Dispose();
			((BasePlugin)Plugin.Instance).Log.LogInfo((object)"Shard check complete.");
			Plugin.Instance.StartupCheckDone = true;
		}
	}
}