Decompiled source of ShardExtraLife v0.2.7
ShardExtraLife.dll
Decompiled 5 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.Immutable; 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 BepInEx; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BepInEx.Unity.IL2CPP.Utils.Collections; using HarmonyLib; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Il2CppSystem.Text; using Microsoft.CodeAnalysis; using ProjectM; using ProjectM.Network; using ProjectM.Shared; using ShardExtraLife.Configs; using ShardExtraLife.Databases; using ShardExtraLife.Utils; using Stunlock.Core; using Unity.Collections; using Unity.Entities; using UnityEngine; using VampireCommandFramework; [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("ShardExtraLife")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Control Shards params.")] [assembly: AssemblyFileVersion("0.2.7.0")] [assembly: AssemblyInformationalVersion("0.2.7+6615df5b0d5957993685d421d289b2b5df7d82e3")] [assembly: AssemblyProduct("ShardExtraLife")] [assembly: AssemblyTitle("ShardExtraLife")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.2.7.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ShardExtraLife { [BepInPlugin("ShardExtraLife", "ShardExtraLife", "0.2.7")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BasePlugin { public static ManualLogSource Logger; internal static Plugin Instance; private Harmony _harmony; public override void Load() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown Instance = this; Logger = ((BasePlugin)this).Log; ManualLogSource log = ((BasePlugin)this).Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(27, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ShardExtraLife"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" version "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("0.2.7"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!"); } log.LogInfo(val); MainConfig.ConfigInit(); _harmony = new Harmony("ShardExtraLife"); _harmony.PatchAll(Assembly.GetExecutingAssembly()); CommandRegistry.RegisterAll(Assembly.GetExecutingAssembly()); } public static void GameDataInit() { //IL_0032: 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_0070: 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) BaseLoop.Initialize(); ShardDropper.ClearDropTable(); ShardUtils.ChangeLifeTime(); DB.ShardSpellPrefabs.Clear(); DB.ShardSpellPrefabs.Add(Helper.PrefabCollectionSystem.NameToPrefabGuidDictionary["AB_Blood_BloodStorm_AbilityGroup"]); DB.ShardSpellPrefabs.Add(Helper.PrefabCollectionSystem.NameToPrefabGuidDictionary["AB_Storm_EyeOfTheStorm_AbilityGroup"]); DB.ShardSpellPrefabs.Add(Helper.PrefabCollectionSystem.NameToPrefabGuidDictionary["AB_Chaos_Voidquake_AbilityGroup"]); DB.ShardSpellPrefabs.Add(Helper.PrefabCollectionSystem.NameToPrefabGuidDictionary["AB_Unholy_SummonFallenAngel_AbilityGroup"]); } public override bool Unload() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } return true; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "ShardExtraLife"; public const string PLUGIN_NAME = "ShardExtraLife"; public const string PLUGIN_VERSION = "0.2.7"; } } namespace ShardExtraLife.Utils { public class BaseLoop : MonoBehaviour { private static BaseLoop _instance; public static DateTime lastRepair = DateTime.Now; public static DateTime LastUpdate = DateTime.Now; internal static bool NeedUpdateShardList = true; private void Update() { } private void Start() { ((MonoBehaviour)this).StartCoroutine(CollectionExtensions.WrapToIl2Cpp(UpdateDurabilityInSpecialStorage())); ((MonoBehaviour)this).StartCoroutine(CollectionExtensions.WrapToIl2Cpp(UpdateShardsList())); } private IEnumerator UpdateShardsList() { while (true) { if ((DateTime.Now - LastUpdate).TotalSeconds > 300.0) { NeedUpdateShardList = true; } if (NeedUpdateShardList) { ShardUtils.UpdateShardslist(); LastUpdate = DateTime.Now; NeedUpdateShardList = false; } else { ShardUtils.updateStatus(); } yield return (object)new WaitForSeconds(15f); } } private IEnumerator UpdateDurabilityInSpecialStorage() { while (true) { if (DB.EnabledRepairInAltar) { EntityManager entityManager = Helper.Server.EntityManager; EntityQueryDesc[] array = new EntityQueryDesc[1]; EntityQueryDesc val = new EntityQueryDesc(); val.All = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[2] { ComponentType.ReadOnly<Relic>(), ComponentType.ReadOnly<EquippableData>() }); val.Options = (EntityQueryOptions)2; array[0] = val; EntityQuery query = ((EntityManager)(ref entityManager)).CreateEntityQuery((EntityQueryDesc[])(object)array); NativeArray<Entity> relicEntities = ((EntityQuery)(ref query)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); List<Entity> ListSoulShardRepair = new List<Entity>(); Enumerator<Entity> enumerator = relicEntities.GetEnumerator(); while (enumerator.MoveNext()) { Entity entity = enumerator.Current; entityManager = Helper.EntityManager; Entity container = ((EntityManager)(ref entityManager)).GetComponentData<InventoryItem>(entity).ContainerEntity; if (!(container != Entity.Null)) { continue; } entityManager = Helper.EntityManager; PrefabGUID guid = ((EntityManager)(ref entityManager)).GetComponentData<PrefabGUID>(container); if (!(guid == Helper.PrefabCollectionSystem.NameToPrefabGuidDictionary["External_Inventory"])) { continue; } entityManager = Helper.EntityManager; Entity attachParent = ((EntityManager)(ref entityManager)).GetComponentData<Attach>(container).Parent; if (attachParent != Entity.Null) { entityManager = Helper.EntityManager; PrefabGUID guidParent = ((EntityManager)(ref entityManager)).GetComponentData<PrefabGUID>(attachParent); string containerName = Helper.PrefabCollectionSystem.PrefabGuidToNameDictionary[guidParent]; if (DB.NewRelicBuildingName.Contains(containerName)) { ListSoulShardRepair.Add(entity); } } } TimeSpan timeSpan = DateTime.Now - lastRepair; lastRepair = DateTime.Now; foreach (Entity entity2 in ListSoulShardRepair) { entityManager = Helper.EntityManager; Durability durability = ((EntityManager)(ref entityManager)).GetComponentData<Durability>(entity2); entityManager = Helper.EntityManager; LoseDurabilityOverTime losedurability = ((EntityManager)(ref entityManager)).GetComponentData<LoseDurabilityOverTime>(entity2); float repairValue = durability.MaxDurability / losedurability.TimeUntilBroken * (float)timeSpan.TotalSeconds; durability.Value += repairValue * DB.RepairMultiplier + DB.AdditionalRepairPoints; if (durability.Value > durability.MaxDurability) { durability.Value = durability.MaxDurability; } entityManager = Helper.EntityManager; ((EntityManager)(ref entityManager)).SetComponentData<Durability>(entity2, durability); } query = default(EntityQuery); } yield return (object)new WaitForSeconds(60f); } } private void LateUpdate() { } public static void Initialize() { if (!ClassInjector.IsTypeRegisteredInIl2Cpp<BaseLoop>()) { ClassInjector.RegisterTypeInIl2Cpp<BaseLoop>(); } ((BasePlugin)Plugin.Instance).AddComponent<BaseLoop>(); } public static void Uninitialize() { Object.Destroy((Object)(object)_instance); _instance = null; } } internal class Helper { private static World? _serverWorld; public static EntityManager EntityManager => Server.EntityManager; public static ServerGameSettingsSystem serverGameSettings => Server.GetExistingSystemManaged<ServerGameSettingsSystem>(); public static PrefabCollectionSystem PrefabCollectionSystem => Server.GetExistingSystemManaged<PrefabCollectionSystem>(); public static World Server { get { if (_serverWorld != null) { return _serverWorld; } _serverWorld = GetWorld("Server") ?? throw new Exception("There is no Server world (yet). Did you install a server mod on the client?"); return _serverWorld; } } public static bool IsServer => Application.productName == "VRisingServer"; private static World GetWorld(string name) { Enumerator<World> enumerator = World.s_AllWorlds.GetEnumerator(); while (enumerator.MoveNext()) { World current = enumerator.Current; if (current.Name == name) { return current; } } return null; } } internal class ShardDropper { internal static Random random = new Random(); public static void DropShard(Entity dropperEntity, PrefabGUID prefabGUID, int amount) { //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_000b: 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) InventoryUtilitiesServer.CreateDropItem(Helper.EntityManager, dropperEntity, prefabGUID, amount, default(Entity)); } public static void Randomizer(float chance1, float chance2, out bool drop1, out bool drop2, out double chance) { drop1 = false; drop2 = false; chance = random.NextDouble(); if (chance < (double)chance1) { drop1 = true; } else if (chance < (double)(chance1 + chance2)) { drop2 = true; } } public static void ChoiceDropSystem(RelicTypeMod relicTypeMod, DeathEvent deathEvent) { //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_000a: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Invalid comparison between Unknown and I4 //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_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_005b: 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_0179: 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_01e9: 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_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_025a: 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_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: 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_0424: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_0474: Unknown result type (might be due to invalid IL or missing references) Entity died = deathEvent.Died; User val = default(User); bool flag = false; EntityManager entityManager = Helper.EntityManager; if (((EntityManager)(ref entityManager)).HasComponent<PlayerCharacter>(deathEvent.Killer) && DB.EnableSendMessages) { entityManager = Helper.EntityManager; Entity userEntity = ((EntityManager)(ref entityManager)).GetComponentData<PlayerCharacter>(deathEvent.Killer).UserEntity; entityManager = Helper.EntityManager; val = ((EntityManager)(ref entityManager)).GetComponentData<User>(userEntity); flag = true; } Dictionary<string, PrefabGUID> nameToPrefabGuidDictionary = Helper.PrefabCollectionSystem.NameToPrefabGuidDictionary; PrefabGUID prefabGUID = default(PrefabGUID); ((PrefabGUID)(ref prefabGUID))..ctor(0); PrefabGUID prefabGUID2 = default(PrefabGUID); ((PrefabGUID)(ref prefabGUID2))..ctor(0); bool flag2 = false; bool flag3 = false; bool drop = false; bool drop2 = false; bool flag4 = false; if ((int)Helper.serverGameSettings.Settings.RelicSpawnType == 1) { flag4 = true; } if (DB.UseDropChanceForNewShard && DB.UseDropChanceForOldShard) { Randomizer(DB.ChanceDropOldShard, DB.ChanceDropNewShard, out drop, out drop2, out var _); } else if (!DB.UseDropChanceForNewShard && DB.UseDropChanceForOldShard) { Randomizer(DB.ChanceDropOldShard, DB.ChanceDropNewShard, out drop, out drop2, out var _); drop2 = true; } else if (DB.UseDropChanceForNewShard && !DB.UseDropChanceForOldShard) { Randomizer(DB.ChanceDropOldShard, DB.ChanceDropNewShard, out drop, out drop2, out var _); drop = true; } else { Randomizer(0.5f, 0.5f, out drop, out drop2, out var _); } if (relicTypeMod == RelicTypeMod.Dracula || relicTypeMod == RelicTypeMod.Solarus) { prefabGUID = nameToPrefabGuidDictionary[DB.RelicModShards[relicTypeMod]]; flag2 = flag4 || DB.ShardsData[relicTypeMod].canDrop(); if (flag2 && (drop || drop2) && DB.DropNewShards) { DropShard(died, prefabGUID, 1); } return; } switch (relicTypeMod) { case RelicTypeMod.OldBehemoth: prefabGUID2 = nameToPrefabGuidDictionary[DB.RelicModShards[relicTypeMod]]; flag3 = flag4 || DB.ShardsData[relicTypeMod].canDrop(); if (flag3 && (drop || drop2) && DB.DropOldShards) { DropShard(died, prefabGUID2, 1); } return; case RelicTypeMod.TheMonster: prefabGUID = nameToPrefabGuidDictionary[DB.RelicModShards[RelicTypeMod.TheMonster]]; prefabGUID2 = nameToPrefabGuidDictionary[DB.RelicModShards[RelicTypeMod.OldTheMonster]]; if (flag4) { flag2 = true; flag3 = true; } else { flag2 = DB.ShardsData[RelicTypeMod.TheMonster].canDrop(); flag3 = DB.ShardsData[RelicTypeMod.OldTheMonster].canDrop(); } break; default: prefabGUID = nameToPrefabGuidDictionary[DB.RelicModShards[RelicTypeMod.WingedHorror]]; prefabGUID2 = nameToPrefabGuidDictionary[DB.RelicModShards[RelicTypeMod.OldWingedHorror]]; if (flag4) { flag2 = true; flag3 = true; } else { flag2 = DB.ShardsData[RelicTypeMod.WingedHorror].canDrop(); flag3 = DB.ShardsData[RelicTypeMod.OldWingedHorror].canDrop(); } break; } if (DB.DropNewAndOldShardTogether) { if (flag3) { DropShard(died, prefabGUID2, 1); } if (flag2) { DropShard(died, prefabGUID, 1); } return; } if (!DB.DropNewShards) { flag2 = false; } if (!DB.DropOldShards) { flag3 = false; } if (drop && flag3) { DropShard(died, prefabGUID2, 1); } else if (drop2 && flag2) { DropShard(died, prefabGUID, 1); } else if (drop && !flag3 && flag2) { DropShard(died, prefabGUID, 1); } else if (drop2 && !flag2 && flag3) { DropShard(died, prefabGUID2, 1); } else if (!flag2 && !flag3) { if (flag) { ServerChatUtils.SendSystemMessageToClient(Helper.EntityManager, val, DB.ReachShardLimit.Replace("{relicTypeMod}", relicTypeMod.ToString()) ?? ""); } } else if (!drop && !drop2 && flag) { ServerChatUtils.SendSystemMessageToClient(Helper.EntityManager, val, DB.NoDropLucky ?? ""); } } internal static void AdminDropShards(ChatCommandContext ctx, int amount, RelicTypeMod relicType) { //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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) Dictionary<string, PrefabGUID> nameToPrefabGuidDictionary = Helper.PrefabCollectionSystem.NameToPrefabGuidDictionary; PrefabGUID prefabGUID = nameToPrefabGuidDictionary[DB.RelicModShards[relicType]]; DropShard(ctx.Event.SenderCharacterEntity, prefabGUID, amount); } public static void ClearDropTable() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //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_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_004a: 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_0051: 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_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_006d: Invalid comparison between Unknown and I4 //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0179: 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_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) bool flag = default(bool); foreach (string key in DB.BossNames.Keys) { NativeParallelHashMap<PrefabGUID, Entity> prefabGuidToEntityMap = Helper.PrefabCollectionSystem._PrefabGuidToEntityMap; Dictionary<string, PrefabGUID> nameToPrefabGuidDictionary = Helper.PrefabCollectionSystem.NameToPrefabGuidDictionary; Entity val = prefabGuidToEntityMap[nameToPrefabGuidDictionary[key]]; EntityManager entityManager = Helper.EntityManager; DynamicBuffer<DropTableBuffer> buffer = ((EntityManager)(ref entityManager)).GetBuffer<DropTableBuffer>(val, false); for (int i = 0; i < buffer.Length; i++) { if ((int)buffer[i].RelicType > 0) { buffer.RemoveAt(i); i = 0; } } if (buffer.Length == 0) { ManualLogSource logger = Plugin.Logger; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(54, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Drop List ["); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(key.Replace("CHAR_", "").Replace("_VBlood", "").Replace("_", " ")); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("] is empty . Add standart loot table for ["); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(key.Replace("CHAR_", "").Replace("_VBlood", "").Replace("_", " ")); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("]"); } logger.LogWarning(val2); buffer.Add(new DropTableBuffer { DropTableGuid = nameToPrefabGuidDictionary["DT_Shared_Unit_VBlood_T06_ShardBoss"], DropTrigger = (DropTriggerType)1, RelicType = (RelicType)0 }); } } } } internal class ShardInventory { internal static bool SearchShard(ChatCommandContext ctx, string where, out List<Entity> shardlist) { shardlist = new List<Entity>(); if (where.ToLower() == "inventory") { List<Entity> shardlistInventory; bool result = SearchShardInInventory(ctx, out shardlistInventory); shardlist = shardlistInventory; return result; } if (where.ToLower() == "equipment") { List<Entity> shardlistEquip; bool result2 = SearchShardInEquipment(ctx, out shardlistEquip); shardlist = shardlistEquip; return result2; } if (where.ToLower() == "all") { List<Entity> shardlistInventory2; bool flag = SearchShardInInventory(ctx, out shardlistInventory2); shardlist = shardlistInventory2; List<Entity> shardlistEquip2; bool flag2 = SearchShardInEquipment(ctx, out shardlistEquip2); shardlist.AddRange(shardlistEquip2); return flag || flag2; } return false; } internal static bool SearchShardInInventory(ChatCommandContext ctx, out List<Entity> shardlistInventory) { //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_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_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_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_004f: 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_0057: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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) Dictionary<PrefabGUID, string> prefabGuidToNameDictionary = Helper.PrefabCollectionSystem.PrefabGuidToNameDictionary; DynamicBuffer<InventoryBuffer> val = default(DynamicBuffer<InventoryBuffer>); GetInventoryResponse val2 = InventoryUtilitiesServer.TryGetInventoryBuffer(Helper.EntityManager, ctx.Event.SenderCharacterEntity, ref val); shardlistInventory = new List<Entity>(); if (val2.Success) { Enumerator<InventoryBuffer> enumerator = val.GetEnumerator(); while (enumerator.MoveNext()) { InventoryBuffer current = enumerator.Current; if (current.ItemType != new PrefabGUID(0)) { string item = prefabGuidToNameDictionary[current.ItemType]; if (DB.NewShardNames.Contains(item) || DB.OldShardName.Contains(item)) { shardlistInventory.Add(current.ItemEntity._Entity); } } } if (shardlistInventory.Count > 0) { return true; } return false; } return false; } internal static bool SearchShardInEquipment(ChatCommandContext ctx, out List<Entity> shardlistEquip) { //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_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_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_0044: 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_007c: 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) Dictionary<PrefabGUID, string> prefabGuidToNameDictionary = Helper.PrefabCollectionSystem.PrefabGuidToNameDictionary; DynamicBuffer<InventoryBuffer> val = default(DynamicBuffer<InventoryBuffer>); GetInventoryResponse val2 = InventoryUtilitiesServer.TryGetInventoryBuffer(Helper.EntityManager, ctx.Event.SenderCharacterEntity, ref val); shardlistEquip = new List<Entity>(); EntityManager entityManager = Helper.EntityManager; Equipment componentData = ((EntityManager)(ref entityManager)).GetComponentData<Equipment>(ctx.Event.SenderCharacterEntity); if (((Equipment)(ref componentData)).IsEquipped((EquipmentType)3)) { string item = prefabGuidToNameDictionary[((Equipment)(ref componentData)).GetEquipmentItemId((EquipmentType)3)]; if (DB.NewShardNames.Contains(item)) { shardlistEquip.Add(((Equipment)(ref componentData)).GetEquipmentEntity((EquipmentType)3)._Entity); return true; } return false; } return false; } } internal class ShardUtils { public static void UpdateShardslist() { //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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0025: 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_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_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_00b5: 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_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_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_00d3: 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_00da: 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_00e4: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Invalid comparison between Unknown and I4 //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Invalid comparison between Unknown and I4 //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Invalid comparison between Unknown and I4 //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Invalid comparison between Unknown and I4 //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Invalid comparison between Unknown and I4 //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Invalid comparison between Unknown and I4 //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Invalid comparison between Unknown and I4 //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = Helper.Server.EntityManager; EntityQueryDesc[] array = new EntityQueryDesc[1]; EntityQueryDesc val = new EntityQueryDesc(); val.All = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<Relic>() }); val.Options = (EntityQueryOptions)2; array[0] = val; EntityQuery val2 = ((EntityManager)(ref entityManager)).CreateEntityQuery((EntityQueryDesc[])(object)array); NativeArray<Entity> val3 = ((EntityQuery)(ref val2)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); RelicTypeMod relicTypeMod = RelicTypeMod.TheMonster; while ((int)relicTypeMod <= 7) { ItemsData value = DB.ShardsData[relicTypeMod]; value.Entities.Clear(); value.Count = value.Entities.Count; DB.ShardsData[relicTypeMod] = value; relicTypeMod++; } Enumerator<Entity> enumerator = val3.GetEnumerator(); while (enumerator.MoveNext()) { Entity current = enumerator.Current; entityManager = Helper.EntityManager; RelicType relicType = ((EntityManager)(ref entityManager)).GetComponentData<Relic>(current).RelicType; RelicTypeMod key = RelicTypeMod.None; entityManager = Helper.EntityManager; if (!((EntityManager)(ref entityManager)).HasComponent<Age>(current)) { entityManager = Helper.EntityManager; if (!((EntityManager)(ref entityManager)).HasComponent<DismantleDestroyData>(current)) { if ((int)relicType == 2) { key = RelicTypeMod.Solarus; } else if ((int)relicType == 3) { key = RelicTypeMod.WingedHorror; } else if ((int)relicType == 1) { key = RelicTypeMod.TheMonster; } else if ((int)relicType == 4) { key = RelicTypeMod.Dracula; } DB.ShardsData.TryGetValue(key, out var value2); if (!value2.Entities.Contains(current)) { value2.Entities.Add(current); } value2.Count = value2.Entities.Count; DB.ShardsData[key] = value2; continue; } } if ((int)relicType == 2) { key = RelicTypeMod.OldBehemoth; } else if ((int)relicType == 3) { key = RelicTypeMod.OldWingedHorror; } else if ((int)relicType == 1) { key = RelicTypeMod.OldTheMonster; } DB.ShardsData.TryGetValue(key, out var value3); if (!value3.Entities.Contains(current)) { value3.Entities.Add(current); } value3.Count = value3.Entities.Count; DB.ShardsData[key] = value3; } updateStatus(); } public static void ChangeLifeTime() { //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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_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_0079: 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_008c: 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_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_00bf: 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_00c6: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_01de: 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_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Expected O, but got Unknown //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: 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_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: 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_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0232: 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_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_0393: 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_031a: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: 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_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_044f: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Unknown result type (might be due to invalid IL or missing references) NativeParallelHashMap<PrefabGUID, Entity> prefabGuidToEntityMap = Helper.PrefabCollectionSystem._PrefabGuidToEntityMap; Dictionary<string, PrefabGUID> nameToPrefabGuidDictionary = Helper.PrefabCollectionSystem.NameToPrefabGuidDictionary; PrefabGUID val = default(PrefabGUID); Entity val2 = default(Entity); EntityManager entityManager; foreach (string newShardName in DB.NewShardNames) { if (nameToPrefabGuidDictionary.TryGetValue(newShardName, ref val) && prefabGuidToEntityMap.TryGetValue(val, ref val2)) { entityManager = Helper.EntityManager; if (((EntityManager)(ref entityManager)).HasComponent<EquippableData>(val2)) { entityManager = Helper.EntityManager; PrefabGUID componentData = ((EntityManager)(ref entityManager)).GetComponentData<PrefabGUID>(val2); string key = Helper.PrefabCollectionSystem.PrefabGuidToNameDictionary[componentData]; string text = DB.ShardNameBuff[key]; componentData = Helper.PrefabCollectionSystem.NameToPrefabGuidDictionary[text]; entityManager = Helper.EntityManager; EquippableData componentData2 = ((EntityManager)(ref entityManager)).GetComponentData<EquippableData>(val2); componentData2.BuffGuid = componentData; entityManager = Helper.EntityManager; ((EntityManager)(ref entityManager)).SetComponentData<EquippableData>(val2, componentData2); } entityManager = Helper.EntityManager; if (((EntityManager)(ref entityManager)).HasComponent<LoseDurabilityOverTime>(val2)) { entityManager = Helper.EntityManager; LoseDurabilityOverTime componentData3 = ((EntityManager)(ref entityManager)).GetComponentData<LoseDurabilityOverTime>(val2); componentData3.TimeUntilBroken = DB.TimeUntilBroken; entityManager = Helper.EntityManager; ((EntityManager)(ref entityManager)).SetComponentData<LoseDurabilityOverTime>(val2, componentData3); } entityManager = Helper.EntityManager; if (((EntityManager)(ref entityManager)).HasComponent<Durability>(val2)) { entityManager = Helper.EntityManager; Durability componentData4 = ((EntityManager)(ref entityManager)).GetComponentData<Durability>(val2); componentData4.Value = DB.MaxDurability; componentData4.MaxDurability = DB.MaxDurability; componentData4.DestroyItemWhenBroken = DB.DestroyNewWhenBroken; entityManager = Helper.EntityManager; ((EntityManager)(ref entityManager)).SetComponentData<Durability>(val2, componentData4); } } } PrefabGUID val3 = default(PrefabGUID); Entity val4 = default(Entity); foreach (string item in DB.OldShardName) { if (!nameToPrefabGuidDictionary.TryGetValue(item, ref val3) || !prefabGuidToEntityMap.TryGetValue(val3, ref val4)) { continue; } entityManager = Helper.EntityManager; if (((EntityManager)(ref entityManager)).HasComponent<LifeTime>(val4)) { entityManager = Helper.EntityManager; LifeTime componentData5 = ((EntityManager)(ref entityManager)).GetComponentData<LifeTime>(val4); if (DB.DestroyOldWhenBroken) { componentData5.EndAction = (LifeTimeEndAction)2; } else { componentData5.EndAction = (LifeTimeEndAction)0; } componentData5.Duration = DB.LifeTimeOldShard; entityManager = Helper.EntityManager; ((EntityManager)(ref entityManager)).SetComponentData<LifeTime>(val4, componentData5); } } if (!DB.UpdateExistingShards) { return; } entityManager = Helper.Server.EntityManager; EntityQueryDesc[] array = new EntityQueryDesc[1]; EntityQueryDesc val5 = new EntityQueryDesc(); val5.All = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<Relic>() }); val5.Options = (EntityQueryOptions)2; array[0] = val5; EntityQuery val6 = ((EntityManager)(ref entityManager)).CreateEntityQuery((EntityQueryDesc[])(object)array); NativeArray<Entity> val7 = ((EntityQuery)(ref val6)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); Enumerator<Entity> enumerator3 = val7.GetEnumerator(); while (enumerator3.MoveNext()) { Entity current3 = enumerator3.Current; entityManager = Helper.EntityManager; if (((EntityManager)(ref entityManager)).HasComponent<EquippableData>(current3)) { entityManager = Helper.EntityManager; PrefabGUID componentData6 = ((EntityManager)(ref entityManager)).GetComponentData<PrefabGUID>(current3); string key2 = Helper.PrefabCollectionSystem.PrefabGuidToNameDictionary[componentData6]; string text2 = DB.ShardNameBuff[key2]; componentData6 = Helper.PrefabCollectionSystem.NameToPrefabGuidDictionary[text2]; entityManager = Helper.EntityManager; EquippableData componentData7 = ((EntityManager)(ref entityManager)).GetComponentData<EquippableData>(current3); componentData7.BuffGuid = componentData6; entityManager = Helper.EntityManager; ((EntityManager)(ref entityManager)).SetComponentData<EquippableData>(current3, componentData7); } entityManager = Helper.EntityManager; if (((EntityManager)(ref entityManager)).HasComponent<LoseDurabilityOverTime>(current3)) { entityManager = Helper.EntityManager; LoseDurabilityOverTime componentData8 = ((EntityManager)(ref entityManager)).GetComponentData<LoseDurabilityOverTime>(current3); componentData8.TimeUntilBroken = DB.TimeUntilBroken; entityManager = Helper.EntityManager; ((EntityManager)(ref entityManager)).SetComponentData<LoseDurabilityOverTime>(current3, componentData8); } entityManager = Helper.EntityManager; if (((EntityManager)(ref entityManager)).HasComponent<Durability>(current3)) { entityManager = Helper.EntityManager; Durability componentData9 = ((EntityManager)(ref entityManager)).GetComponentData<Durability>(current3); if (componentData9.Value == 0f) { componentData9.Value = 15f; } componentData9.MaxDurability = DB.MaxDurability; componentData9.DestroyItemWhenBroken = DB.DestroyNewWhenBroken; entityManager = Helper.EntityManager; ((EntityManager)(ref entityManager)).SetComponentData<Durability>(current3, componentData9); } entityManager = Helper.EntityManager; if (((EntityManager)(ref entityManager)).HasComponent<LifeTime>(current3)) { entityManager = Helper.EntityManager; LifeTime componentData10 = ((EntityManager)(ref entityManager)).GetComponentData<LifeTime>(current3); if (DB.DestroyOldWhenBroken) { componentData10.EndAction = (LifeTimeEndAction)2; } else { componentData10.EndAction = (LifeTimeEndAction)0; } componentData10.Duration = DB.LifeTimeOldShard; entityManager = Helper.EntityManager; ((EntityManager)(ref entityManager)).SetComponentData<LifeTime>(current3, componentData10); } } val7.Dispose(); } public static void updateStatus() { //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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0025: 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_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_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_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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Invalid comparison between Unknown and I4 //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Invalid comparison between Unknown and I4 //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Invalid comparison between Unknown and I4 //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Expected I4, but got Unknown //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Invalid comparison between Unknown and I4 //IL_01f9: 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_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Expected I4, but got Unknown //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Expected I4, but got Unknown //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = Helper.Server.EntityManager; EntityQueryDesc[] array = new EntityQueryDesc[1]; EntityQueryDesc val = new EntityQueryDesc(); val.All = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<RelicDropped>() }); val.Options = (EntityQueryOptions)2; array[0] = val; EntityQuery val2 = ((EntityManager)(ref entityManager)).CreateEntityQuery((EntityQueryDesc[])(object)array); Entity val3 = ((EntityQuery)(ref val2)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2))[0]; RelicType val4 = (RelicType)1; while ((int)val4 <= 4) { ItemsData itemsData = new ItemsData(0, -1); ItemsData itemsData2 = new ItemsData(0, -1); if ((int)val4 == 2) { itemsData = DB.ShardsData[RelicTypeMod.Solarus]; } else if ((int)val4 == 3) { itemsData = DB.ShardsData[RelicTypeMod.WingedHorror]; itemsData2 = DB.ShardsData[RelicTypeMod.OldWingedHorror]; } else if ((int)val4 == 1) { itemsData = DB.ShardsData[RelicTypeMod.TheMonster]; itemsData2 = DB.ShardsData[RelicTypeMod.OldTheMonster]; } else if ((int)val4 == 4) { itemsData = DB.ShardsData[RelicTypeMod.Dracula]; } bool flag = true; flag = ((DB.DropNewShards && DB.DropOldShards) ? (itemsData.Count < itemsData.MaxCount || itemsData2.Count < itemsData2.MaxCount) : ((!DB.DropNewShards && DB.DropOldShards) ? (itemsData2.Count < itemsData2.MaxCount) : (DB.DropNewShards && !DB.DropOldShards && itemsData.Count < itemsData.MaxCount))); entityManager = Helper.EntityManager; DynamicBuffer<RelicDropped> buffer = ((EntityManager)(ref entityManager)).GetBuffer<RelicDropped>(val3, false); RelicDropped val5 = buffer[(int)val4]; if ((int)Helper.serverGameSettings.Settings.RelicSpawnType == 1) { buffer[(int)val4] = new RelicDropped { Value = true }; } else if (val5.Value == flag) { buffer[(int)val4] = new RelicDropped { Value = !flag }; } val4 = (RelicType)(byte)(val4 + 1); } } internal static void UpdateMaxAmountAll(int amount, ConcurrentDictionary<RelicTypeMod, ItemsData> ShardData) { foreach (RelicTypeMod key in ShardData.Keys) { if (ShardData.TryGetValue(key, out var value)) { ItemsData itemsData = new ItemsData(value.Count, amount); itemsData.Entities = value.Entities; ItemsData newValue = itemsData; ShardData.TryUpdate(key, newValue, value); } } } internal static void UpdateMaxAmount(int amount, ConcurrentDictionary<RelicTypeMod, ItemsData> ShardData, RelicTypeMod type) { if (ShardData.TryGetValue(type, out var value)) { ItemsData itemsData = new ItemsData(value.Count, amount); itemsData.Entities = value.Entities; ItemsData newValue = itemsData; ShardData.TryUpdate(type, newValue, value); } } internal static bool RelicTypeCheck(string type, out RelicTypeMod relicType) { if (type.ToLower() == "dracula") { relicType = RelicTypeMod.Dracula; return true; } if (type.ToLower() == "solarus") { relicType = RelicTypeMod.Solarus; return true; } if (type.ToLower() == "wingedhorror") { relicType = RelicTypeMod.WingedHorror; return true; } if (type.ToLower() == "oldwingedhorror") { relicType = RelicTypeMod.OldWingedHorror; return true; } if (type.ToLower() == "themonster") { relicType = RelicTypeMod.TheMonster; return true; } if (type.ToLower() == "oldthemonster") { relicType = RelicTypeMod.OldTheMonster; return true; } if (type.ToLower() == "behemoth") { relicType = RelicTypeMod.OldBehemoth; return true; } relicType = RelicTypeMod.None; return false; } } } namespace ShardExtraLife.Hooks { [HarmonyPatch(typeof(DeathEventListenerSystem), "OnUpdate")] public class DeathEventListenerSystem_patch { [HarmonyPostfix] public static void postfix(DeathEventListenerSystem __instance) { //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_000b: 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_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_0026: 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_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_0037: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_0064: 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_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_0084: 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_008d: 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_00ad: 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) EntityQuery deathEventQuery = __instance._DeathEventQuery; NativeArray<DeathEvent> val = ((EntityQuery)(ref deathEventQuery)).ToComponentDataArray<DeathEvent>(AllocatorHandle.op_Implicit((Allocator)2)); Enumerator<DeathEvent> enumerator = val.GetEnumerator(); while (enumerator.MoveNext()) { DeathEvent current = enumerator.Current; EntityManager entityManager = ((ComponentSystemBase)__instance).EntityManager; if (!((EntityManager)(ref entityManager)).HasComponent<PlayerCharacter>(current.Killer)) { continue; } entityManager = ((ComponentSystemBase)__instance).EntityManager; if (!((EntityManager)(ref entityManager)).HasComponent<Movement>(current.Died)) { continue; } entityManager = ((ComponentSystemBase)__instance).EntityManager; if (((EntityManager)(ref entityManager)).HasComponent<UnitLevel>(current.Died)) { entityManager = ((ComponentSystemBase)__instance).EntityManager; PrefabGUID componentData = ((EntityManager)(ref entityManager)).GetComponentData<PrefabGUID>(current.Died); Dictionary<PrefabGUID, string> prefabGuidToNameDictionary = Helper.PrefabCollectionSystem.PrefabGuidToNameDictionary; if (DB.BossNames.TryGetValue(prefabGuidToNameDictionary[componentData], out var value)) { ShardDropper.ChoiceDropSystem(value, current); } } } val.Dispose(); } } [HarmonyPatch(typeof(DropItemThrowSystem), "OnUpdate")] public class DropItemSystem_patch { [HarmonyPrefix] public static void postfix(DropItemThrowSystem __instance) { //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_000b: 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_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_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_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_0040: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0058: 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) EntityQuery _query_2070481711_ = __instance.__query_2070481711_0; NativeArray<Entity> val = ((EntityQuery)(ref _query_2070481711_)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); Enumerator<Entity> enumerator = val.GetEnumerator(); while (enumerator.MoveNext()) { Entity current = enumerator.Current; EntityManager entityManager = Helper.EntityManager; if (((EntityManager)(ref entityManager)).HasComponent<DropItemAroundPosition>(current)) { entityManager = Helper.EntityManager; DropItemAroundPosition componentData = ((EntityManager)(ref entityManager)).GetComponentData<DropItemAroundPosition>(current); PrefabGUID itemHash = componentData.ItemHash; string item = Helper.PrefabCollectionSystem.PrefabGuidToNameDictionary[itemHash]; if (DB.NewShardNames.Contains(item) || DB.OldShardName.Contains(item)) { BaseLoop.NeedUpdateShardList = true; } } } val.Dispose(); } } [HarmonyPatch(typeof(RelicDestroySystem), "OnUpdate")] public class RelicDestroySystem_patch { [HarmonyPostfix] public static void postfix(RelicDestroySystem __instance) { //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_000b: 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_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_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_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) EntityQuery relicsQuery = __instance._RelicsQuery; NativeArray<Entity> val = ((EntityQuery)(ref relicsQuery)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); Enumerator<Entity> enumerator = val.GetEnumerator(); while (enumerator.MoveNext()) { Entity current = enumerator.Current; EntityManager entityManager = Helper.EntityManager; if (((EntityManager)(ref entityManager)).HasComponent<Relic>(current)) { BaseLoop.NeedUpdateShardList = true; } } val.Dispose(); } } [HarmonyPatch(typeof(LoadPersistenceSystemV2), "SetLoadState")] public class LoadPersistenceSystem_Patch { public static void Prefix(State loadState, LoadPersistenceSystemV2 __instance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 if ((int)loadState == 4) { Plugin.GameDataInit(); } } } [HarmonyPatch(typeof(ReplaceAbilityOnSlotSystem), "OnUpdate")] public class ReplaceAbilityOnSlotSystem_Patch { [HarmonyPrefix] public static void Prefix(ReplaceAbilityOnSlotSystem __instance) { //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_000b: 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_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_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_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_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_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_004d: 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_005e: 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) EntityQuery _query_1482480545_ = __instance.__query_1482480545_0; NativeArray<Entity> val = ((EntityQuery)(ref _query_1482480545_)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); Enumerator<Entity> enumerator = val.GetEnumerator(); while (enumerator.MoveNext()) { Entity current = enumerator.Current; EntityManager entityManager = Helper.EntityManager; DynamicBuffer<ReplaceAbilityOnSlotBuff> buffer = ((EntityManager)(ref entityManager)).GetBuffer<ReplaceAbilityOnSlotBuff>(current, false); for (int i = 0; i < buffer.Length; i++) { ReplaceAbilityOnSlotBuff val2 = buffer[i]; if (val2.Slot == 7 && DB.ShardSpellPrefabs.Contains(val2.NewGroupId)) { val2.Priority = 1; buffer[i] = val2; } } } val.Dispose(); } } } namespace ShardExtraLife.Databases { internal interface IItemsData { ItemsData SetMaxAmount(int amount); } internal struct ItemsData : IItemsData { public int Count { get; set; } public int MaxCount { get; set; } public List<Entity> Entities { get; set; } public bool canDrop() { return Count < MaxCount; } public ItemsData(int count = 0, int maxcount = 5) { Count = count; MaxCount = maxcount; Entities = new List<Entity>(); } public ItemsData SetMaxAmount(int amount) { ItemsData result = new ItemsData(Count, amount); result.Entities = Entities; return result; } } public enum RelicTypeMod : byte { None, TheMonster, Solarus, WingedHorror, Dracula, OldTheMonster, OldWingedHorror, OldBehemoth } internal class DB { internal static float ChanceDropNewShard = 0.5f; internal static float ChanceDropOldShard = 0.5f; internal static bool UseDropChanceForNewShard = true; internal static bool UseDropChanceForOldShard = true; internal static bool DropNewAndOldShardTogether = true; internal static float TimeUntilBroken = 129600f; internal static float MaxDurability = 2500f; internal static float LifeTimeOldShard = 5400f; internal static float RepairMultiplier = 1.01f; internal static bool EnabledRepairInAltar = true; internal static float AdditionalRepairPoints = 1f; internal static bool EnabledEditAmountCommand = true; internal static bool EnabledEditChanceCommand = true; internal static bool EnabledShardDropCommand = true; internal static bool PlayerCommandEnabled = true; internal static bool UpdateExistingShards = true; internal static bool DropNewShards = true; internal static bool DropOldShards = true; internal static bool DestroyNewWhenBroken = true; internal static bool DestroyOldWhenBroken = true; internal static bool EnableSendMessages = true; internal static string ReachShardLimit = ""; internal static string NoDropLucky = ""; internal static ConcurrentDictionary<RelicTypeMod, ItemsData> ShardsData = new ConcurrentDictionary<RelicTypeMod, ItemsData>(); internal static List<PrefabGUID> ShardSpellPrefabs = new List<PrefabGUID>(); internal static List<string> NewRelicBuildingName = new List<string> { "TM_Castle_Container_Specialized_Soulshards_Solarus", "TM_Castle_Container_Specialized_Soulshards_Monster", "TM_Castle_Container_Specialized_Soulshards_Manticore", "TM_Castle_Container_Specialized_Soulshards_Dracula" }; internal static List<string> OldShardName = new List<string> { "Item_Building_Relic_Manticore", "Item_Building_Relic_Monster", "Item_Building_Relic_Paladin", "Item_Building_Relic_Behemoth" }; internal static List<string> NewShardNames = new List<string> { "Item_MagicSource_SoulShard_Dracula", "Item_MagicSource_SoulShard_Manticore", "Item_MagicSource_SoulShard_Monster", "Item_MagicSource_SoulShard_Solarus" }; internal static ImmutableDictionary<string, string> ShardNameBuff = ImmutableDictionary.Create<string, string>().Add("Item_MagicSource_SoulShard_Dracula", "Item_EquipBuff_MagicSource_Soulshard_Dracula").Add("Item_MagicSource_SoulShard_Manticore", "Item_EquipBuff_MagicSource_Soulshard_Manticore") .Add("Item_MagicSource_SoulShard_Monster", "Item_EquipBuff_MagicSource_Soulshard_TheMonster") .Add("Item_MagicSource_SoulShard_Solarus", "Item_EquipBuff_MagicSource_Soulshard_Solarus"); internal static ImmutableDictionary<string, RelicTypeMod> BossNames = ImmutableDictionary.Create<string, RelicTypeMod>().Add("CHAR_ChurchOfLight_Paladin_VBlood", RelicTypeMod.Solarus).Add("CHAR_Gloomrot_Monster_VBlood", RelicTypeMod.TheMonster) .Add("CHAR_Manticore_VBlood", RelicTypeMod.WingedHorror) .Add("CHAR_Vampire_Dracula_VBlood", RelicTypeMod.Dracula) .Add("CHAR_Cursed_MountainBeast_VBlood", RelicTypeMod.OldBehemoth); internal static ImmutableDictionary<RelicTypeMod, string> RelicModShards = ImmutableDictionary.Create<RelicTypeMod, string>().Add(RelicTypeMod.Solarus, "Item_MagicSource_SoulShard_Solarus").Add(RelicTypeMod.TheMonster, "Item_MagicSource_SoulShard_Monster") .Add(RelicTypeMod.WingedHorror, "Item_MagicSource_SoulShard_Manticore") .Add(RelicTypeMod.Dracula, "Item_MagicSource_SoulShard_Dracula") .Add(RelicTypeMod.OldTheMonster, "Item_Building_Relic_Monster") .Add(RelicTypeMod.OldWingedHorror, "Item_Building_Relic_Manticore") .Add(RelicTypeMod.OldBehemoth, "Item_Building_Relic_Behemoth"); } } namespace ShardExtraLife.Configs { internal class MainConfig { private static readonly string FileDirectory = Path.Combine("BepInEx", "config"); private static readonly string FileName = "ShardExtraLife.cfg"; private static readonly string fullPath = Path.Combine(FileDirectory, FileName); private static readonly ConfigFile Conf = new ConfigFile(fullPath, true); public static ConfigEntry<float> ChanceDropNewShard; public static ConfigEntry<float> ChanceDropOldShard; public static ConfigEntry<bool> UpdateExistingShards; public static ConfigEntry<bool> DropNewShards; public static ConfigEntry<bool> DropOldShards; public static ConfigEntry<bool> UseDropChanceForNewShard; public static ConfigEntry<bool> UseDropChanceForOldShard; public static ConfigEntry<bool> DropNewAndOldShardTogether; public static ConfigEntry<float> TimeUntilBroken; public static ConfigEntry<float> MaxDurability; public static ConfigEntry<float> LifeTimeOldShard; public static ConfigEntry<float> RepairMultiplier; public static ConfigEntry<float> AdditionalRepairPoints; public static ConfigEntry<bool> DestroyNewWhenBroken; public static ConfigEntry<bool> DestroyOldWhenBroken; public static ConfigEntry<bool> EnabledRepairInAltar; public static ConfigEntry<int> MaxNewShardAmountDracula; public static ConfigEntry<int> MaxNewShardAmountSolarus; public static ConfigEntry<int> MaxNewShardAmountTheMonster; public static ConfigEntry<int> MaxNewShardAmountWingedHorror; public static ConfigEntry<int> MaxOldShardAmountBehemoth; public static ConfigEntry<int> MaxOldShardAmountTheMonster; public static ConfigEntry<int> MaxOldShardAmountWingedHorror; public static ConfigEntry<bool> EnabledEditAmountCommand; public static ConfigEntry<bool> EnabledEditChanceCommand; public static ConfigEntry<bool> EnabledShardDropCommand; public static ConfigEntry<bool> PlayerCommandEnabled; public static ConfigEntry<bool> EnableSendMessages; public static ConfigEntry<string> ReachShardLimit; public static ConfigEntry<string> NoDropLucky; public static void ConfigInit() { MaxNewShardAmountDracula = Conf.Bind<int>("ShardAmount", "MaxShardAmountDracula", 1, "Maximum new \"Dracula\" shard amount if drop new shards \"True\"."); MaxNewShardAmountSolarus = Conf.Bind<int>("ShardAmount", "MaxShardAmountSolarus", 1, "Maximum new \"Solarus\" shard amount if drop new shards \"True\"."); MaxNewShardAmountTheMonster = Conf.Bind<int>("ShardAmount", "MaxShardAmountTheMonster", 1, "Maximum new \"TheMonster\" shard amount if drop new shards \"True\"."); MaxNewShardAmountWingedHorror = Conf.Bind<int>("ShardAmount", "MaxShardAmountWingedHorror", 1, "Maximum new \"Winged Horror\" shard amount if drop new shards \"True\"."); MaxOldShardAmountBehemoth = Conf.Bind<int>("ShardAmount", "MaxOldShardAmountBehemoth", 1, "Maximum old \"Behemoth\" shard amount if drop old shards \"True\"."); MaxOldShardAmountTheMonster = Conf.Bind<int>("ShardAmount", "MaxOldShardAmountTheMonster", 1, "Maximum old \"TheMonster\" shard amount if drop old shards \"True\"."); MaxOldShardAmountWingedHorror = Conf.Bind<int>("ShardAmount", "MaxOldShardAmountWingedHorror", 1, "Maximum old \"Winged Horror\" shard amount if drop old shards \"True\"."); MaxDurability = Conf.Bind<float>("ShardExtraLife", "MaxDurability", 2500f, "Max durability for new shards."); LifeTimeOldShard = Conf.Bind<float>("ShardExtraLife", "LifeTimeOldShard", 4200f, "Max lifetime for old shard."); TimeUntilBroken = Conf.Bind<float>("ShardExtraLife", "TimeUntilBroken", 1296000f, "Shard time before destroy."); RepairMultiplier = Conf.Bind<float>("ShardExtraLife", "RepairMultiplier", 1f, "Shard recovery multiplier. Currently the timer runs every 60 seconds."); AdditionalRepairPoints = Conf.Bind<float>("ShardExtraLife", "AdditionalRepairPoints", 1f, "Additional durability points for shards during repairs. Currently the timer runs every 60 seconds."); EnabledRepairInAltar = Conf.Bind<bool>("ShardExtraLife", "EnabledRepairInAltar", true, "Enable repair shard in special pedestal."); DestroyNewWhenBroken = Conf.Bind<bool>("ShardExtraLife", "DestroyNewWhenBroken", true, "Enable destroy new shard when broken."); DestroyOldWhenBroken = Conf.Bind<bool>("ShardExtraLife", "DestroyOldWhenBroken", true, "Enable destroy old shard when broken."); ChanceDropNewShard = Conf.Bind<float>("ShardChanceDrop", "ChanceDropNewShard", 0.5f, "Chance drop new shard."); ChanceDropOldShard = Conf.Bind<float>("ShardChanceDrop", "ChanceDropOldShard", 0.5f, "Chance drop old shard."); UseDropChanceForNewShard = Conf.Bind<bool>("ShardChanceDrop", "UseDropChanceForNewShard", true, "Enable drop chance for new shard drop. Work if drop new shard on."); UseDropChanceForOldShard = Conf.Bind<bool>("ShardChanceDrop", "UseDropChanceForOldShard", true, "Enable drop chance for Old shard drop. Work If drop old shard on."); DropNewAndOldShardTogether = Conf.Bind<bool>("ShardChanceDrop", "DropNewAndOldShardTogether", false, "Enable Drop New and Old Shard together. Work if active a both drop."); EnabledEditAmountCommand = Conf.Bind<bool>("Commands", "EnabledEditAmountCommand", true, "Enable edit amount command. Admins only."); EnabledEditChanceCommand = Conf.Bind<bool>("Commands", "EnabledEditChanceCommand", true, "Enable edit chance command. Admins only"); EnabledShardDropCommand = Conf.Bind<bool>("Commands", "EnabledAdminShardDropCommand", true, "Enable shard drop command. Admins only"); PlayerCommandEnabled = Conf.Bind<bool>("Commands", "PlayerCommandEnabled", true, "Enable player commands. All players."); UpdateExistingShards = Conf.Bind<bool>("Params", "UpdateExistingShards", true, "Enable update existing shards."); DropNewShards = Conf.Bind<bool>("Params", "DropNewShards", true, "Enable Drop new shard."); DropOldShards = Conf.Bind<bool>("Params", "DropOldShards", true, "Enable drop old shard."); EnableSendMessages = Conf.Bind<bool>("Message", "EnableSendMessages", true, "Enable send messages from mod."); ReachShardLimit = Conf.Bind<string>("Message", "ReachShardLimit", "The relic did not fall out. The limit on the number of relics [{relicTypeMod}] has been reached.", "No drop because reach limit."); NoDropLucky = Conf.Bind<string>("Message", "NoDropLucky", "You're out of luck this time. The relic did not fall out. Try once more.", "No lucky drop."); ConfigBind(); } public static void ConfigBind() { //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown InitData(); DB.TimeUntilBroken = TimeUntilBroken.Value; DB.MaxDurability = MaxDurability.Value; DB.LifeTimeOldShard = LifeTimeOldShard.Value; DB.EnabledRepairInAltar = EnabledRepairInAltar.Value; DB.RepairMultiplier = RepairMultiplier.Value; DB.AdditionalRepairPoints = AdditionalRepairPoints.Value; if (ChanceDropNewShard.Value + ChanceDropOldShard.Value > 1f && DropOldShards.Value && DropNewShards.Value) { ChanceDropNewShard.Value = 0.5f; ChanceDropOldShard.Value = 0.5f; ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(52, 0, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Incorrect drop chance. setup default setting (50%). "); } logger.LogWarning(val); } DB.DropOldShards = DropOldShards.Value; DB.DropNewShards = DropNewShards.Value; DB.EnabledEditAmountCommand = EnabledEditAmountCommand.Value; DB.EnabledEditChanceCommand = EnabledEditChanceCommand.Value; DB.EnabledShardDropCommand = EnabledShardDropCommand.Value; DB.PlayerCommandEnabled = PlayerCommandEnabled.Value; DB.ChanceDropNewShard = ChanceDropNewShard.Value; DB.ChanceDropOldShard = ChanceDropOldShard.Value; DB.DestroyNewWhenBroken = DestroyNewWhenBroken.Value; DB.DestroyOldWhenBroken = DestroyOldWhenBroken.Value; DB.UpdateExistingShards = UpdateExistingShards.Value; DB.UseDropChanceForNewShard = UseDropChanceForNewShard.Value; DB.UseDropChanceForOldShard = UseDropChanceForOldShard.Value; DB.DropNewAndOldShardTogether = DropNewAndOldShardTogether.Value; DB.EnableSendMessages = EnableSendMessages.Value; DB.ReachShardLimit = ReachShardLimit.Value; DB.NoDropLucky = NoDropLucky.Value; } internal static void Save() { ReadData(); TimeUntilBroken.Value = DB.TimeUntilBroken; MaxDurability.Value = DB.MaxDurability; LifeTimeOldShard.Value = DB.LifeTimeOldShard; AdditionalRepairPoints.Value = DB.AdditionalRepairPoints; EnabledRepairInAltar.Value = DB.EnabledRepairInAltar; RepairMultiplier.Value = DB.RepairMultiplier; ChanceDropNewShard.Value = DB.ChanceDropNewShard; ChanceDropOldShard.Value = DB.ChanceDropOldShard; DestroyOldWhenBroken.Value = DB.DestroyOldWhenBroken; DestroyNewWhenBroken.Value = DB.DestroyNewWhenBroken; UpdateExistingShards.Value = DB.UpdateExistingShards; UseDropChanceForNewShard.Value = DB.UseDropChanceForNewShard; UseDropChanceForOldShard.Value = DB.UseDropChanceForOldShard; DropNewAndOldShardTogether.Value = DB.DropNewAndOldShardTogether; EnableSendMessages.Value = DB.EnableSendMessages; ReachShardLimit.Value = DB.ReachShardLimit; NoDropLucky.Value = DB.NoDropLucky; EnabledEditAmountCommand.Value = DB.EnabledEditAmountCommand; EnabledEditChanceCommand.Value = DB.EnabledEditChanceCommand; EnabledShardDropCommand.Value = DB.EnabledShardDropCommand; PlayerCommandEnabled.Value = DB.PlayerCommandEnabled; Conf.Save(); } public static void InitData() { int maxcount = 0; RelicTypeMod relicTypeMod = RelicTypeMod.TheMonster; while ((int)relicTypeMod <= 7) { if (relicTypeMod == RelicTypeMod.TheMonster) { maxcount = MaxNewShardAmountTheMonster.Value; } if (relicTypeMod == RelicTypeMod.Solarus) { maxcount = MaxNewShardAmountSolarus.Value; } if (relicTypeMod == RelicTypeMod.Dracula) { maxcount = MaxNewShardAmountDracula.Value; } if (relicTypeMod == RelicTypeMod.WingedHorror) { maxcount = MaxNewShardAmountWingedHorror.Value; } if (relicTypeMod == RelicTypeMod.OldBehemoth) { maxcount = MaxOldShardAmountBehemoth.Value; } if (relicTypeMod == RelicTypeMod.OldTheMonster) { maxcount = MaxOldShardAmountTheMonster.Value; } if (relicTypeMod == RelicTypeMod.OldWingedHorror) { maxcount = MaxOldShardAmountWingedHorror.Value; } DB.ShardsData.TryAdd(relicTypeMod, new ItemsData(0, maxcount)); maxcount = 0; relicTypeMod++; } } public static void ReadData() { int num = 0; RelicTypeMod relicTypeMod = RelicTypeMod.TheMonster; while ((int)relicTypeMod <= 7) { num = DB.ShardsData[relicTypeMod].MaxCount; if (relicTypeMod == RelicTypeMod.TheMonster) { MaxNewShardAmountTheMonster.Value = num; } if (relicTypeMod == RelicTypeMod.Solarus) { MaxNewShardAmountSolarus.Value = num; } if (relicTypeMod == RelicTypeMod.Dracula) { MaxNewShardAmountDracula.Value = num; } if (relicTypeMod == RelicTypeMod.WingedHorror) { MaxNewShardAmountWingedHorror.Value = num; } if (relicTypeMod == RelicTypeMod.OldTheMonster) { MaxOldShardAmountTheMonster.Value = num; } if (relicTypeMod == RelicTypeMod.OldBehemoth) { MaxOldShardAmountBehemoth.Value = num; } if (relicTypeMod == RelicTypeMod.OldWingedHorror) { MaxOldShardAmountWingedHorror.Value = num; } relicTypeMod++; } } } } namespace ShardExtraLife.Commands { internal class AdminCommands { [CommandGroup("shardextralife", "sel")] internal class ShardStatCommand { [Command("editamount", "ea", "[.sel ea ?]", "Edit shard amount drop.", null, true)] public static void EditAmountCommand(ChatCommandContext ctx, string ShardName = "?", int amount = 1) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown if (DB.EnabledEditAmountCommand) { StringBuilder val = new StringBuilder(); RelicTypeMod relicType; if (ShardName.ToLower() == "?" || ShardName.ToLower() == "help" || ShardName.ToLower() == "h") { val.Clear(); val.AppendLine("[Dracula||Solarus||TheMonster||WingedHorror||OldTheMonster||OldWingedHorror||Behemoth||All] [amount]"); val.AppendLine("This command is for changing the number of shards on the server."); val.AppendLine("The first parameter is the name of the shard or \"All\" for all of them together."); val.AppendLine("The second parameter is the maximum number of shards."); ctx.Reply(((Object)val).ToString()); } else if (ShardUtils.RelicTypeCheck(ShardName, out relicType)) { ShardUtils.UpdateMaxAmount(amount, DB.ShardsData, relicType); ctx.Reply($"Max amount [{ShardName}] shard changed and now [{amount}]."); } else if (ShardName.ToLower() == "all") { ShardUtils.UpdateMaxAmountAll(amount, DB.ShardsData); ctx.Reply($"Max amount [All] shards changed and now [{amount}]."); } else { ctx.Reply("Incorrect argument. Use [Dracula||Solarus||TheMonster||WingedHorror||OldTheMonster||OldWingedHorror||Behemoth||All]."); } MainConfig.Save(); } else { ctx.Reply("Command disable. Report to server admins."); } } [Command("editchance", "ec", "[.sel ec ?]", "Edit shard chance drop.", null, true)] public static void EditChanceCommand(ChatCommandContext ctx, string action = "?", float NewChance = 1f, float OldChance = 1f) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown if (DB.EnabledEditChanceCommand) { StringBuilder val = new StringBuilder(); if (action.ToLower() == "?" || action.ToLower() == "help" || action.ToLower() == "h") { val.Clear(); val.AppendLine("[Set||Check] [NewShardChance] [OldShardChance]"); val.AppendLine("This command is for changing the number of shards on the server."); val.AppendLine("The first parameter is: \"Set\" for setup chance or \"check\" for check chance."); val.AppendLine("The second parameter is a number from 0 to 100 reflecting percentages for new shard."); val.AppendLine("The third parameter is a number from 0 to 100 reflecting percentages for old shard."); val.AppendLine("Attention, if both types of shards are included, then the sum of their drop chances cannot exceed 100."); ctx.Reply(((Object)val).ToString()); } else if (action.ToLower() == "set") { if (NewChance >= 0f && NewChance <= 100f && OldChance >= 0f && OldChance <= 100f) { if (DB.DropNewShards && DB.DropOldShards) { if (NewChance + OldChance <= 100f) { DB.ChanceDropNewShard = NewChance / 100f; DB.ChanceDropOldShard = OldChance / 100f; ctx.Reply("Drop chance setup successful"); MainConfig.Save(); } else { ctx.Reply("Incorrect argument. Sum drop chances cannot exceed 100."); } } else { DB.ChanceDropNewShard = NewChance / 100f; DB.ChanceDropOldShard = OldChance / 100f; ctx.Reply("Drop chance setup successful"); MainConfig.Save(); } } else { ctx.Reply("Incorrect argument. Drop chance must be between 0 and 100 inclusive."); } } else if (action.ToLower() == "check") { val.Clear(); val.AppendLine("Drop chance:"); val.AppendLine($"New shard: [{DB.ChanceDropNewShard * 100f:F2}%], Drop enable [{DB.DropNewShards}]"); val.AppendLine($"Old shard: [{DB.ChanceDropOldShard * 100f:F2}%], Drop enable [{DB.DropOldShards}]"); ctx.Reply(((Object)val).ToString()); } else { ctx.Reply("Incorrect argument. Use one of these: [Set||Check]. Use [?||help||h] for help"); } } else { ctx.Reply("Command disable. Report to server admins."); } } [Command("adminsharddrop", "asd", "[.sel asd ?]", "Manual drop shard.", null, true)] public static void AdminShardDropCommand(ChatCommandContext ctx, string name = "?", int amount = 1) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown if (DB.EnabledShardDropCommand) { StringBuilder val = new StringBuilder(); RelicTypeMod relicTypeMod = RelicTypeMod.None; if (name.ToLower() == "?") { val.Clear(); val.AppendLine("[.sela asd] [Dracula||Solarus||TheMonster||WingedHorror||OldTheMonster||OldWingedHorror||Behemoth] [amount]"); val.AppendLine("This admin only command create shard drop despite the limits."); val.AppendLine("This command was created because the console command for issuing an item cannot bypass my created limit. And yes, I know this is a bug. I will fix it..."); ctx.Reply(((Object)val).ToString()); return; } if (name.ToLower() == "dracula") { relicTypeMod = RelicTypeMod.Dracula; } else if (name.ToLower() == "solarus") { relicTypeMod = RelicTypeMod.Solarus; } else if (name.ToLower() == "wingedhorror") { relicTypeMod = RelicTypeMod.WingedHorror; } else if (name.ToLower() == "themonster") { relicTypeMod = RelicTypeMod.TheMonster; } else if (name.ToLower() == "behemoth") { relicTypeMod = RelicTypeMod.OldBehemoth; } else if (name.ToLower() == "oldwingedhorror") { relicTypeMod = RelicTypeMod.OldWingedHorror; } else { if (!(name.ToLower() == "oldthemonster")) { ctx.Reply("Incorrect argument. Use one of these: [Dracula||Solarus||TheMonster||WingedHorror||OldTheMonster||OldWingedHorror||Behemoth]."); return; } relicTypeMod = RelicTypeMod.OldTheMonster; } ShardDropper.AdminDropShards(ctx, amount, relicTypeMod); } else { ctx.Reply("Command disable. Report to server admins."); } } } } internal class ShardStatusPlayerCommands { [CommandGroup("shardextralife", "sel")] internal class ShardStatCommand { [Command("shardstatus", "ss", "[.sel ss ?]", "Check Shards status.", null, false)] public static void ShardStatusCommand(ChatCommandContext ctx, string where = "!") { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_009a: 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_00a1: 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_00aa: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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_02f4: Invalid comparison between Unknown and I4 //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_0493: Invalid comparison between Unknown and I4 //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0164: 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_016d: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due