The current BepInExPack is broken due to the Oakveil update, and mods installed through a mod manager may not work. Join the modding Discord for more information.
Decompiled source of Bloodcraft v1.8.6
Bloodcraft.dll
Decompiled 16 hours 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.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using System.Text.Json; using System.Text.Json.Serialization; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BepInEx.Unity.IL2CPP.Hook; using BepInEx.Unity.IL2CPP.Utils.Collections; using Bloodcraft.Commands; using Bloodcraft.Interfaces; using Bloodcraft.Patches; using Bloodcraft.Resources; using Bloodcraft.Services; using Bloodcraft.Systems.Expertise; using Bloodcraft.Systems.Familiars; using Bloodcraft.Systems.Legacies; using Bloodcraft.Systems.Leveling; using Bloodcraft.Systems.Professions; using Bloodcraft.Systems.Quests; using Bloodcraft.Utilities; using HarmonyLib; using Iced.Intel; using Il2CppInterop.Common; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppInterop.Runtime.Runtime; using Il2CppInterop.Runtime.Runtime.VersionSpecific.MethodInfo; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Il2CppSystem.Text; using Microsoft.CodeAnalysis; using ProjectM; using ProjectM.AimPreviewSplines.Component; using ProjectM.Audio; using ProjectM.Behaviours; using ProjectM.CastleBuilding; using ProjectM.CastleBuilding.AssetSwapping; using ProjectM.CastleBuilding.Items; using ProjectM.CastleBuilding.Placement; using ProjectM.CastleBuilding.Rebuilding; using ProjectM.Community; using ProjectM.Debugging; using ProjectM.Gameplay; using ProjectM.Gameplay.Clan; using ProjectM.Gameplay.Scripting; using ProjectM.Gameplay.Systems; using ProjectM.Gameplay.WarEvents; using ProjectM.HUD; using ProjectM.Haptics; using ProjectM.Hybrid; using ProjectM.LightningStorm; using ProjectM.Network; using ProjectM.Pathfinding; using ProjectM.Physics; using ProjectM.Presentation; using ProjectM.Replays; using ProjectM.Roofs; using ProjectM.Scripting; using ProjectM.Sequencer; using ProjectM.Sequencer.Debugging; using ProjectM.Shared; using ProjectM.Shared.Systems; using ProjectM.Shared.WarEvents; using ProjectM.Shared.WorldEvents; using ProjectM.SunBlocker; using ProjectM.Terrain; using ProjectM.Terrain.Editor; using ProjectM.Tiles; using ProjectM.Transmog; using ProjectM.UI; using ProjectM.Wind; using Stunlock.Core; using Stunlock.Core.Authoring; using Stunlock.Network; using Stunlock.Sequencer; using Terrain.Systems; using Tests; using Unity.Collections; using Unity.Deformations; using Unity.Entities; using Unity.Entities.Graphics; using Unity.Entities.Graphics.Extension; using Unity.Entities.Hybrid.Baking; using Unity.Entities.Serialization; using Unity.Jobs; using Unity.Mathematics; using Unity.Physics; using Unity.Physics.Authoring; using Unity.Physics.GraphicsIntegration; using Unity.Physics.Systems; using Unity.Rendering; using Unity.Scenes; using Unity.Transforms; using UnityEngine; using VampireCommandFramework; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("Bloodcraft")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.8.6.0")] [assembly: AssemblyInformationalVersion("1.8.6")] [assembly: AssemblyProduct("Bloodcraft")] [assembly: AssemblyTitle("Bloodcraft")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.8.6.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] internal sealed class IsUnmanagedAttribute : Attribute { } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Bloodcraft { internal static class Core { private static MonoBehaviour _monoBehaviour; private static readonly List<PrefabGUID> _returnBuffs = new List<PrefabGUID> { PrefabGUIDs.Buff_Shared_Return, PrefabGUIDs.Buff_Shared_Return_NoInvulernable, PrefabGUIDs.Buff_Vampire_BloodKnight_Return, PrefabGUIDs.Buff_Vampire_Dracula_Return, PrefabGUIDs.Buff_Dracula_Return, PrefabGUIDs.Buff_WerewolfChieftain_Return, PrefabGUIDs.Buff_Werewolf_Return, PrefabGUIDs.Buff_Monster_Return, PrefabGUIDs.Buff_Purifier_Return, PrefabGUIDs.Buff_Blackfang_Morgana_Return, PrefabGUIDs.Buff_ChurchOfLight_Paladin_Return, PrefabGUIDs.Buff_Gloomrot_Voltage_Return, PrefabGUIDs.Buff_Militia_Fabian_Return }; private static readonly List<PrefabGUID> _shardNecklaces = new List<PrefabGUID> { PrefabGUIDs.Item_MagicSource_SoulShard_Manticore, PrefabGUIDs.Item_MagicSource_SoulShard_Solarus, PrefabGUIDs.Item_MagicSource_SoulShard_Dracula, PrefabGUIDs.Item_MagicSource_SoulShard_Monster, PrefabGUIDs.Item_MagicSource_SoulShard_Morgana }; private static readonly List<PrefabGUID> _bearFormBuffs = new List<PrefabGUID> { PrefabGUIDs.AB_Shapeshift_Bear_Buff, PrefabGUIDs.AB_Shapeshift_Bear_Skin01_Buff }; private static readonly List<PrefabGUID> _shardBearerDropTables = new List<PrefabGUID> { PrefabGUIDs.DT_Unit_Relic_Manticore_Unique, PrefabGUIDs.DT_Unit_Relic_Paladin_Unique, PrefabGUIDs.DT_Unit_Relic_Monster_Unique, PrefabGUIDs.DT_Unit_Relic_Dracula_Unique, PrefabGUIDs.DT_Unit_Relic_Morgana_Unique }; private static readonly bool _legacies = ConfigService.LegacySystem; private static readonly bool _expertise = ConfigService.ExpertiseSystem; private static readonly bool _classes = ConfigService.ClassSystem; private static readonly bool _familiars = ConfigService.FamiliarSystem; private static readonly bool _shouldApplyBonusStats = _legacies || _expertise || _classes || _familiars; private static HashSet<WeaponType> _bleedingEdge = new HashSet<WeaponType>(); private const int SECONDARY_SKILL_SLOT = 4; private const int BLEED_STACKS = 3; public static bool _initialized = false; public static World Server { get; } = GetServerWorld() ?? throw new Exception("There is no Server world!"); public static EntityManager EntityManager => Server.EntityManager; public static ServerGameManager ServerGameManager => SystemService.ServerScriptMapper.GetServerGameManager(); public static SystemService SystemService { get; } = new SystemService(Server); public static ServerGameBalanceSettings ServerGameBalanceSettings { get; set; } public static double ServerTime => ServerGameManager.ServerTime; public static double DeltaTime => ServerGameManager.DeltaTime; public static ManualLogSource Log => Plugin.LogInstance; public static IReadOnlySet<WeaponType> BleedingEdge => _bleedingEdge; public static byte[] NEW_SHARED_KEY { get; internal set; } public static void Initialize() { //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Expected O, but got Unknown //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: 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_0187: Unknown result type (might be due to invalid IL or missing references) if (_initialized) { return; } NEW_SHARED_KEY = Convert.FromBase64String(SecretManager.GetNewSharedKey()); if (!ComponentRegistry._initialized) { ComponentRegistry.Initialize(); } new PlayerService(); new LocalizationService(); if (ConfigService.Eclipse) { new EclipseService(); } if (ConfigService.ExtraRecipes) { Recipes.ModifyRecipes(); } if (ConfigService.StarterKit) { Configuration.GetStarterKitItems(); } if (ConfigService.PrestigeSystem) { Buffs.GetPrestigeBuffs(); } if (ConfigService.ClassSystem) { Configuration.GetClassSpellCooldowns(); Classes.GetAbilityJewels(); } if (ConfigService.LevelingSystem) { DeathEventListenerSystemPatch.OnDeathEventHandler += LevelingSystem.OnUpdate; } if (ConfigService.ExpertiseSystem) { DeathEventListenerSystemPatch.OnDeathEventHandler += WeaponSystem.OnUpdate; } if (ConfigService.QuestSystem) { new QuestService(); DeathEventListenerSystemPatch.OnDeathEventHandler += QuestSystem.OnUpdate; } if (ConfigService.FamiliarSystem) { Configuration.GetExcludedFamiliars(); if (!ConfigService.LevelingSystem) { DeathEventListenerSystemPatch.OnDeathEventHandler += FamiliarLevelingSystem.OnUpdate; } DeathEventListenerSystemPatch.OnDeathEventHandler += FamiliarUnlockSystem.OnUpdate; new BattleService(); new FamiliarService(); } if (ConfigService.ProfessionSystem) { Misc.GetStatModPrefabs(); } GetWeaponTypes(); ModifyPrefabs(); Buffs.GetStackableBuffs(); try { ServerGameBalanceSettings = ServerGameBalanceSettings.Get(SystemService.ServerGameSettingsSystem._ServerBalanceSettings); Progression.GetAttributeCaps(); } catch (Exception ex) { ManualLogSource log = Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(35, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Error getting attribute soft caps: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } log.LogWarning(val); } _initialized = true; DebugLoggerPatch._initialized = true; } private static World GetServerWorld() { return ((IEnumerable<World>)World.s_AllWorlds.ToArray()).FirstOrDefault((Func<World, bool>)((World world) => world.Name == "Server")); } public static void StartCoroutine(IEnumerator routine) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_monoBehaviour == (Object)null) { _monoBehaviour = (MonoBehaviour)(object)new GameObject("Bloodcraft").AddComponent<IgnorePhysicsDebugSystem>(); Object.DontDestroyOnLoad((Object)(object)((Component)_monoBehaviour).gameObject); } _monoBehaviour.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(routine)); } public static AddItemSettings GetAddItemSettings() { //IL_0002: 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_000f: 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_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_0038: Unknown result type (might be due to invalid IL or missing references) AddItemSettings result = default(AddItemSettings); result.EntityManager = EntityManager; result.DropRemainder = true; ServerGameManager serverGameManager = ServerGameManager; result.ItemDataMap = ((ServerGameManager)(ref serverGameManager)).ItemLookupMap; result.EquipIfPossible = true; return result; } private static void GetWeaponTypes() { HashSet<WeaponType> hashSet = new HashSet<WeaponType>(); foreach (WeaponType item in Configuration.ParseEnumsFromString<WeaponType>(ConfigService.BleedingEdge)) { hashSet.Add(item); } _bleedingEdge = hashSet; } private static void ModifyPrefabs() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: 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_01d6: 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_01de: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_0400: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: 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_03b1: 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_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: 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_0262: 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_026d: 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_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0200: 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_020d: 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_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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0119: 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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014d: 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_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) if (ConfigService.LevelingSystem) { Entity entity = default(Entity); if (SystemService.PrefabCollectionSystem._PrefabGuidToEntityMap.TryGetValue(PrefabGUIDs.Item_EquipBuff_Shared_General, ref entity)) { entity.Add<ScriptSpawn>(); } if (SystemService.PrefabCollectionSystem._PrefabGuidToEntityMap.TryGetValue(PrefabGUIDs.Item_EquipBuff_MagicSource_BloodKey_T01, ref entity)) { entity.Add<ScriptSpawn>(); } } if (ConfigService.FamiliarSystem) { Entity @null = Entity.Null; foreach (PrefabGUID returnBuff in _returnBuffs) { if (SystemService.PrefabCollectionSystem._PrefabGuidToEntityMap.TryGetValue(returnBuff, ref @null) && @null.TryGetBuffer<HealOnGameplayEvent>(out DynamicBuffer<HealOnGameplayEvent> dynamicBuffer)) { HealOnGameplayEvent val = dynamicBuffer[0]; val.showSCT = false; dynamicBuffer[0] = val; } } foreach (PrefabGUID shardNecklace in _shardNecklaces) { NativeParallelHashMap<PrefabGUID, ItemData> itemHashLookupMap = SystemService.GameDataSystem.ItemHashLookupMap; if (SystemService.PrefabCollectionSystem._PrefabGuidToEntityMap.TryGetValue(shardNecklace, ref @null)) { ItemData val2 = @null.Read<ItemData>(); ref ItemCategory itemCategory = ref val2.ItemCategory; itemCategory = (ItemCategory)((ulong)itemCategory & 0xFFFFFFFFBFFFFFFFuL); ref ItemCategory itemCategory2 = ref val2.ItemCategory; itemCategory2 = (ItemCategory)((ulong)itemCategory2 | 0x10000008uL); @null.Write<ItemData>(val2); itemHashLookupMap[shardNecklace] = val2; } } } Entity entity2 = default(Entity); if (_shouldApplyBonusStats && SystemService.PrefabCollectionSystem._PrefabGuidToEntityMap.TryGetValue(Buffs.BonusStatsBuff, ref entity2)) { entity2.Add<ScriptSpawn>(); if (entity2.TryGetBuffer<ModifyUnitStatBuff_DOTS>(out DynamicBuffer<ModifyUnitStatBuff_DOTS> dynamicBuffer2)) { dynamicBuffer2.Clear(); } } if (ConfigService.BearFormDash) { Entity entity3 = default(Entity); foreach (PrefabGUID bearFormBuff in _bearFormBuffs) { if (SystemService.PrefabCollectionSystem._PrefabGuidToEntityMap.TryGetValue(bearFormBuff, ref entity3) && entity3.TryGetBuffer<ReplaceAbilityOnSlotBuff>(out DynamicBuffer<ReplaceAbilityOnSlotBuff> dynamicBuffer3)) { ReplaceAbilityOnSlotBuff val3 = dynamicBuffer3[4]; val3.NewGroupId = PrefabGUIDs.AB_Shapeshift_Bear_Dash_Group; dynamicBuffer3[4] = val3; } } } if (ConfigService.EliteShardBearers) { Entity entity4 = default(Entity); foreach (PrefabGUID shardBearerDropTable in _shardBearerDropTables) { if (SystemService.PrefabCollectionSystem._PrefabGuidToEntityMap.TryGetValue(shardBearerDropTable, ref entity4) && entity4.TryGetBuffer<DropTableDataBuffer>(out DynamicBuffer<DropTableDataBuffer> dynamicBuffer4) && !dynamicBuffer4.IsEmpty) { DropTableDataBuffer val4 = dynamicBuffer4[0]; val4.DropRate = 0.6f; dynamicBuffer4.Add(val4); val4.DropRate = 0.45f; dynamicBuffer4.Add(val4); val4.DropRate = 0.3f; dynamicBuffer4.Add(val4); } } } if (BleedingEdge.Any()) { Entity entity5 = default(Entity); if (BleedingEdge.Contains(WeaponType.Slashers) && SystemService.PrefabCollectionSystem._PrefabGuidToEntityMap.TryGetValue(Buffs.VargulfBleedBuff, ref entity5)) { entity5.With<Buff>((ECSExtensions.WithRefHandler<Buff>)delegate(ref Buff buff) { buff.MaxStacks = 3; buff.IncreaseStacks = true; }); } if (BleedingEdge.Contains(WeaponType.Crossbow) || BleedingEdge.Contains(WeaponType.Pistols)) { ComponentType[] allTypes = (ComponentType[])(object)new ComponentType[4] { ComponentType.ReadOnly(Il2CppType.Of<PrefabGUID>()), ComponentType.ReadOnly(Il2CppType.Of<Projectile>()), ComponentType.ReadOnly(Il2CppType.Of<LifeTime>()), ComponentType.ReadOnly(Il2CppType.Of<Velocity>()) }; BleedingEdgePrimaryProjectileRoutine(EntityManager.CreateQueryDesc(allTypes, null, null, new int[1], (EntityQueryOptions)195)).Start(); } } Entity entity6 = default(Entity); if (ConfigService.TwilightArsenal && SystemService.PrefabCollectionSystem._PrefabGuidToEntityMap.TryGetValue(PrefabGUIDs.Item_Weapon_Axe_T09_ShadowMatter, ref entity6)) { entity6.With<EquippableData>((ECSExtensions.WithRefHandler<EquippableData>)delegate(ref EquippableData equippableData) { //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) equippableData.BuffGuid = PrefabGUIDs.EquipBuff_Weapon_DualHammers_Ability03; }); } } private static IEnumerator BleedingEdgePrimaryProjectileRoutine(EntityQueries.QueryDesc projectileQueryDesc) { bool pistols = BleedingEdge.Contains(WeaponType.Pistols); bool crossbow = BleedingEdge.Contains(WeaponType.Crossbow); yield return EntityQueries.QueryResultStreamAsync(projectileQueryDesc, delegate(EntityQueries.QueryResultStream stream) { //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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) try { using (stream) { foreach (EntityQueries.QueryResult result in stream.GetResults()) { Entity entity = result.Entity; string prefabName = result.ResolveComponentData<PrefabGUID>().GetPrefabName(); if (pistols && IsWeaponPrimaryProjectile(prefabName, WeaponType.Pistols)) { entity.With<Projectile>((ECSExtensions.WithRefHandler<Projectile>)delegate(ref Projectile projectile) { projectile.Range *= 1.25f; }); entity.HasWith<LifeTime>((ECSExtensions.WithRefHandler<LifeTime>)delegate(ref LifeTime lifeTime) { lifeTime.Duration *= 1.25f; }); } else if (crossbow && IsWeaponPrimaryProjectile(prefabName, WeaponType.Crossbow)) { entity.With<Projectile>((ECSExtensions.WithRefHandler<Projectile>)delegate(ref Projectile projectile) { projectile.Speed = 100f; }); } } } } catch (Exception ex) { ManualLogSource log = Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(41, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[BleedingEdgePrimaryProjectileRoutine] - "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } log.LogWarning(val); } }); } private static bool IsWeaponPrimaryProjectile(string prefabName, WeaponType weaponType) { return prefabName.ContainsAll(new List<string> { weaponType.ToString(), "Primary", "Projectile" }); } public static void LogEntity(World world, Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_0007: 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_001f: Expected O, but got Unknown StringBuilder val = new StringBuilder(); bool flag = default(bool); try { EntityDebuggingUtility.DumpEntity(world, entity, true, val); ManualLogSource log = Log; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(13, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Entity Dump:\n"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((Object)val).ToString()); } log.LogInfo(val2); } catch (Exception ex) { ManualLogSource log2 = Log; BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(22, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Error dumping entity: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message); } log2.LogWarning(val3); } } } public readonly struct NativeAccessor<T> : IDisposable where T : unmanaged { [CompilerGenerated] private readonly NativeArray<T> <array>P; private unsafe readonly T* _ptr; private readonly int _length; public unsafe T this[int index] { get { return _ptr[index]; } set { _ptr[index] = value; } } public int Length => _length; public unsafe NativeAccessor(NativeArray<T> array) { //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) <array>P = array; _ptr = (T*)<array>P.m_Buffer; _length = <array>P.Length; } public void Dispose() { //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) <array>P.Dispose(); } } public readonly struct BufferAccessor<T> where T : unmanaged { private unsafe readonly T* _ptr; private readonly int _length; public unsafe T this[int index] { get { return _ptr[index]; } set { _ptr[index] = value; } } public int Length => _length; public unsafe BufferAccessor(DynamicBuffer<T> buffer) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) _ptr = (T*)buffer.m_Buffer; _length = buffer.Length; } } internal static class ECSExtensions { public delegate void WithRefHandler<T>(ref T item); private const string EMPTY_KEY = "LocalizationKey.Empty"; private const string PREFIX = "Entity("; private const int LENGTH = 7; private static EntityManager EntityManager => Core.EntityManager; private static ServerGameManager ServerGameManager => Core.ServerGameManager; private static SystemService SystemService => Core.SystemService; private static DebugEventsSystem DebugEventsSystem => SystemService.DebugEventsSystem; private static PrefabCollectionSystem PrefabCollectionSystem => SystemService.PrefabCollectionSystem; public static void With<T>(this Entity entity, WithRefHandler<T> action) where T : struct { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) T item = entity.Read<T>(); action(ref item); EntityManager entityManager = EntityManager; ((EntityManager)(ref entityManager)).SetComponentData<T>(entity, item); } public static void AddWith<T>(this Entity entity, WithRefHandler<T> action) where T : struct { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (!entity.Has<T>()) { entity.Add<T>(); } entity.With(action); } public static void HasWith<T>(this Entity entity, WithRefHandler<T> action) where T : struct { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (entity.Has<T>()) { entity.With(action); } } public static void Write<T>(this Entity entity, T componentData) where T : struct { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = EntityManager; ((EntityManager)(ref entityManager)).SetComponentData<T>(entity, componentData); } public static T Read<T>(this Entity entity) where T : struct { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = EntityManager; return ((EntityManager)(ref entityManager)).GetComponentData<T>(entity); } public static DynamicBuffer<T> ReadBuffer<T>(this Entity entity) where T : struct { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = EntityManager; return ((EntityManager)(ref entityManager)).GetBuffer<T>(entity, false); } public static DynamicBuffer<T> AddBuffer<T>(this Entity entity) where T : struct { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = EntityManager; return ((EntityManager)(ref entityManager)).AddBuffer<T>(entity); } public static bool TryGetComponent<T>(this Entity entity, out T componentData) where T : struct { //IL_0007: 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) componentData = default(T); if (entity.Has<T>()) { componentData = entity.Read<T>(); return true; } return false; } public static bool TryRemove<T>(this Entity entity) where T : struct { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (entity.Has<T>()) { entity.Remove<T>(); return true; } return false; } public static bool Has<T>(this Entity entity) where T : struct { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = EntityManager; return ((EntityManager)(ref entityManager)).HasComponent(entity, new ComponentType(Il2CppType.Of<T>(), (AccessMode)0)); } public static string GetPrefabName(this PrefabGUID prefabGuid) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (!LocalizationService.PrefabGuidNames.TryGetValue(prefabGuid, out var value)) { return "LocalizationKey.Empty"; } return $"{value} {prefabGuid}"; } public static string GetLocalizedName(this PrefabGUID prefabGuid) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) string nameFromPrefabGuid = LocalizationService.GetNameFromPrefabGuid(prefabGuid); if (!string.IsNullOrEmpty(nameFromPrefabGuid)) { return nameFromPrefabGuid; } return "LocalizationKey.Empty"; } public static void TryAdd<T>(this Entity entity) where T : struct { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (!entity.Has<T>()) { entity.Add<T>(); } } public static void Add<T>(this Entity entity) where T : struct { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = EntityManager; ((EntityManager)(ref entityManager)).AddComponent(entity, new ComponentType(Il2CppType.Of<T>(), (AccessMode)0)); } public static void Remove<T>(this Entity entity) where T : struct { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = EntityManager; ((EntityManager)(ref entityManager)).RemoveComponent(entity, new ComponentType(Il2CppType.Of<T>(), (AccessMode)0)); } public static bool TryGetFollowedPlayer(this Entity entity, out Entity player) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) player = Entity.Null; if (entity.TryGetComponent<Follower>(out Follower componentData) && componentData.Followed._Value.TryGetPlayer(out player)) { return true; } return false; } public static bool TryGetPlayer(this Entity entity, out Entity player) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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) player = Entity.Null; if (entity.Has<PlayerCharacter>()) { player = entity; return true; } return false; } public static bool IsPlayer(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (entity.Has<PlayerCharacter>()) { return true; } return false; } public static bool IsFamiliar(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (entity.Has<BlockFeedBuff>()) { return true; } return false; } public static bool IsFollowingPlayer(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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) if (entity.Has<BlockFeedBuff>() && !entity.Has<Buff>() && !entity.Has<ServantEquipment>()) { return true; } if (entity.TryGetComponent<Follower>(out Follower componentData) && componentData.Followed._Value.IsPlayer()) { return true; } return false; } public static bool TryGetAttached(this Entity entity, out Entity attached) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) attached = Entity.Null; if (entity.TryGetComponent<Attach>(out Attach componentData) && componentData.Parent.Exists()) { attached = componentData.Parent; return true; } return false; } public static Entity GetBuffTarget(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return CreateGameplayEventServerUtility.GetBuffTarget(EntityManager, entity); } public static Entity GetPrefabEntity(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) ServerGameManager serverGameManager = ServerGameManager; return ((ServerGameManager)(ref serverGameManager)).GetPrefabEntity(entity.GetPrefabGuid()); } public static bool TryGetPrefabEntity(this PrefabGUID prefabGuid, out Entity prefabEntity) { //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_0009: 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_000f: 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) ServerGameManager serverGameManager = ServerGameManager; prefabEntity = ((ServerGameManager)(ref serverGameManager)).GetPrefabEntity(prefabGuid); return prefabEntity.Exists(); } public static Entity GetSpellTarget(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return CreateGameplayEventServerUtility.GetSpellTarget(EntityManager, entity); } public static bool TryGetTeamEntity(this Entity entity, out Entity teamEntity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) teamEntity = Entity.Null; if (entity.TryGetComponent<TeamReference>(out TeamReference componentData)) { Entity value = componentData.Value._Value; if (value.Exists()) { teamEntity = value; return true; } } return false; } public static bool Exists(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_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_0018: Unknown result type (might be due to invalid IL or missing references) if (entity.HasValue() && entity.IndexWithinCapacity()) { EntityManager entityManager = EntityManager; return ((EntityManager)(ref entityManager)).Exists(entity); } return false; } public static bool HasValue(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) return entity != Entity.Null; } public static bool IndexWithinCapacity(this Entity entity) { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) ReadOnlySpan<char> span = ((object)(Entity)(ref entity)).ToString().AsSpan(); if (!span.StartsWith("Entity(")) { return false; } ref ReadOnlySpan<char> reference = ref span; span = reference.Slice(7, reference.Length - 7); int num = span.IndexOf(':'); if (num <= 0) { return false; } reference = ref span; int result = num + 1; ReadOnlySpan<char> span2 = reference.Slice(result, reference.Length - result); int num2 = span2.IndexOf(')'); if (num2 <= 0) { return false; } if (!int.TryParse(span.Slice(0, num), out var result2)) { return false; } if (!int.TryParse(span2.Slice(0, num2), out result)) { return false; } EntityManager entityManager = EntityManager; int entityCapacity = ((EntityManager)(ref entityManager)).EntityCapacity; return (uint)result2 < (uint)entityCapacity; } public static bool IsDisabled(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return entity.Has<Disabled>(); } public static bool IsVBlood(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return entity.Has<VBloodConsumeSource>(); } public static bool IsGateBoss(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (entity.Has<VBloodUnit>()) { return !entity.Has<VBloodConsumeSource>(); } return false; } public static bool IsVBloodOrGateBoss(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return entity.Has<VBloodUnit>(); } public static bool IsLegendary(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return entity.Has<LegendaryItemInstance>(); } public static bool HasSpellLevel(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return entity.Has<SpellLevel>(); } public static bool IsAncestralWeapon(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (entity.Has<LegendaryItemInstance>()) { return !entity.IsMagicSource(); } return false; } public static bool IsShardNecklace(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (entity.Has<LegendaryItemInstance>()) { return entity.IsMagicSource(); } return false; } public static bool IsMagicSource(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (entity.TryGetComponent<EquippableData>(out EquippableData componentData)) { return ((object)(EquipmentType)(ref componentData.EquipmentType)).Equals((object)(EquipmentType)3); } return false; } public static ulong GetSteamId(this Entity entity) { //IL_0000: 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_000a: 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_0025: Unknown result type (might be due to invalid IL or missing references) if (entity.TryGetComponent<PlayerCharacter>(out PlayerCharacter componentData)) { return componentData.UserEntity.GetUser().PlatformId; } if (entity.TryGetComponent<User>(out User componentData2)) { return componentData2.PlatformId; } return 0uL; } public static NetworkId GetNetworkId(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (entity.TryGetComponent<NetworkId>(out NetworkId componentData)) { return componentData; } return NetworkId.Empty; } public static bool TryGetPlayerInfo(this ulong steamId, out PlayerService.PlayerInfo playerInfo) { if (PlayerService.SteamIdPlayerInfoCache.TryGetValue(steamId, out playerInfo)) { return true; } if (PlayerService.SteamIdOnlinePlayerInfoCache.TryGetValue(steamId, out playerInfo)) { return true; } return false; } public static PrefabGUID GetPrefabGuid(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (entity.TryGetComponent<PrefabGUID>(out PrefabGUID componentData)) { return componentData; } return PrefabGUID.Empty; } public static int GetGuidHash(this Entity entity) { //IL_0000: 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) if (entity.TryGetComponent<PrefabGUID>(out PrefabGUID componentData)) { return ((PrefabGUID)(ref componentData)).GuidHash; } PrefabGUID empty = PrefabGUID.Empty; return ((PrefabGUID)(ref empty)).GuidHash; } public static Entity GetUserEntity(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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_001b: 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) if (entity.TryGetComponent<PlayerCharacter>(out PlayerCharacter componentData)) { return componentData.UserEntity; } if (entity.Has<User>()) { return entity; } return Entity.Null; } public static Entity GetOwner(this Entity entity) { //IL_0000: 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_000a: 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (entity.TryGetComponent<EntityOwner>(out EntityOwner componentData) && componentData.Owner.Exists()) { return componentData.Owner; } return Entity.Null; } public static User GetUser(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_0025: Unknown result type (might be due to invalid IL or missing references) if (entity.TryGetComponent<User>(out User componentData)) { return componentData; } if (entity.TryGetComponent<PlayerCharacter>(out PlayerCharacter componentData2) && componentData2.UserEntity.TryGetComponent<User>(out componentData)) { return componentData; } return User.Empty; } public static bool HasBuff(this Entity entity, PrefabGUID buffPrefabGuid) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) ServerGameManager serverGameManager = ServerGameManager; return ((ServerGameManager)(ref serverGameManager)).HasBuff(entity, ((PrefabGUID)(ref buffPrefabGuid)).ToIdentifier()); } public static bool TryGetBuffer<T>(this Entity entity, out DynamicBuffer<T> dynamicBuffer) where T : struct { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) ServerGameManager serverGameManager = ServerGameManager; if (((ServerGameManager)(ref serverGameManager)).TryGetBuffer<T>(entity, ref dynamicBuffer)) { return true; } dynamicBuffer = default(DynamicBuffer<T>); return false; } public static float3 GetAimPosition(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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) if (entity.TryGetComponent<EntityInput>(out EntityInput componentData)) { return componentData.AimPosition; } return float3.zero; } public static float3 GetPosition(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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) if (entity.TryGetComponent<Translation>(out Translation componentData)) { return componentData.Value; } return float3.zero; } public static int2 GetTileCoord(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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) if (entity.TryGetComponent<TilePosition>(out TilePosition componentData)) { return componentData.Tile; } return int2.zero; } public static int GetUnitLevel(this Entity entity) { //IL_0000: 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_000b: Unknown result type (might be due to invalid IL or missing references) if (entity.TryGetComponent<UnitLevel>(out UnitLevel componentData)) { return componentData.Level._Value; } return 0; } public static float GetMaxDurability(this Entity entity) { //IL_0000: 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) if (entity.TryGetComponent<Durability>(out Durability componentData)) { return componentData.Value; } return 0f; } public static float GetMaxHealth(this Entity entity) { //IL_0000: 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_000b: Unknown result type (might be due to invalid IL or missing references) if (entity.TryGetComponent<Health>(out Health componentData)) { return componentData.MaxHealth._Value; } return 0f; } public static Blood GetBlood(this Entity entity) { //IL_0000: 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) if (entity.TryGetComponent<Blood>(out Blood componentData)) { return componentData; } throw new InvalidOperationException("Entity does not have Blood!"); } public static (float physicalPower, float spellPower) GetPowerTuple(this Entity entity) { //IL_0000: 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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (entity.TryGetComponent<UnitStats>(out UnitStats componentData)) { return (componentData.PhysicalPower._Value, componentData.SpellPower._Value); } return (0f, 0f); } public static bool IsUnitSpawnerSpawned(this Entity entity) { //IL_0000: 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) if (entity.TryGetComponent<IsMinion>(out IsMinion componentData) && componentData.Value) { return true; } return false; } public static bool IsStackableBuff(this Entity entity, out int maxStacks) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) maxStacks = 1; if (entity.TryGetComponent<Buff>(out Buff componentData)) { maxStacks = componentData.MaxStacks; return componentData.IncreaseStacks; } return false; } public static void TryDestroyImmediate(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (entity.Exists()) { EntityManager entityManager = EntityManager; ((EntityManager)(ref entityManager)).DestroyEntity(entity); } } public static void TryDestroy(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) if (entity.Exists()) { DestroyUtility.Destroy(EntityManager, entity, (DestroyDebugReason)0, (string)null, 0); } } public static void TryDestroyBuff(this Entity buffEntity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) if (buffEntity.Exists()) { DestroyUtility.Destroy(EntityManager, buffEntity, (DestroyDebugReason)13, (string)null, 0); } } public static void SetTeam(this Entity entity, Entity teamSource) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) if (entity.Has<Team>() && entity.Has<TeamReference>() && teamSource.TryGetComponent<Team>(out Team componentData) && teamSource.TryGetComponent<TeamReference>(out TeamReference componentData2)) { Entity teamRefEntity = componentData2.Value._Value; int teamId = componentData.Value; entity.With<TeamReference>((WithRefHandler<TeamReference>)delegate(ref TeamReference teamReference) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) teamReference.Value._Value = teamRefEntity; }); entity.With<Team>((WithRefHandler<Team>)delegate(ref Team team) { team.Value = teamId; }); } } public static void SetPosition(this Entity entity, float3 position) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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) if (entity.Has<Translation>()) { entity.With<Translation>((WithRefHandler<Translation>)delegate(ref Translation translation) { //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) translation.Value = position; }); } if (entity.Has<LastTranslation>()) { entity.With<LastTranslation>((WithRefHandler<LastTranslation>)delegate(ref LastTranslation lastTranslation) { //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) lastTranslation.Value = position; }); } } public static void SetFaction(this Entity entity, PrefabGUID factionPrefabGuid) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (entity.Has<FactionReference>()) { entity.With<FactionReference>((WithRefHandler<FactionReference>)delegate(ref FactionReference factionReference) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) factionReference.FactionGuid._Value = factionPrefabGuid; }); } } public static bool IsAllies(this Entity entity, Entity player) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) ServerGameManager serverGameManager = ServerGameManager; return ((ServerGameManager)(ref serverGameManager)).IsAllies(entity, player); } public static bool IsPlayerOwned(this Entity entity) { //IL_0000: 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_000b: Unknown result type (might be due to invalid IL or missing references) if (entity.TryGetComponent<EntityOwner>(out EntityOwner componentData)) { return componentData.Owner.IsPlayer(); } return false; } public static void CastAbility(this Entity entity, PrefabGUID abilityGroup) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0026: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) bool flag = entity.IsPlayer(); CastAbilityServerDebugEvent val = default(CastAbilityServerDebugEvent); val.AbilityGroup = abilityGroup; val.Who = entity.GetNetworkId(); CastAbilityServerDebugEvent val2 = val; FromCharacter val3 = default(FromCharacter); val3.Character = entity; val3.User = (flag ? entity.GetUserEntity() : entity); FromCharacter val4 = val3; int num = (flag ? entity.GetUser().Index : 0); DebugEventsSystem.CastAbilityServerDebugEvent(num, ref val2, ref val4); } public static bool IsIndexWithinRange<T>(this DynamicBuffer<T> buffer, int index) where T : struct { if (index >= 0) { return index < buffer.Length; } return false; } public static NativeAccessor<Entity> ToEntityArrayAccessor(this EntityQuery entityQuery, Allocator allocator = 2) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return new NativeAccessor<Entity>(((EntityQuery)(ref entityQuery)).ToEntityArray(AllocatorHandle.op_Implicit(allocator))); } public static NativeAccessor<TKey> GetKeyAccessor<TKey, TValue>(this NativeParallelHashMap<TKey, TValue> nativeParallelHashMap, Allocator allocator = 2) where TKey : unmanaged where TValue : unmanaged { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return new NativeAccessor<TKey>(nativeParallelHashMap.GetKeyArray(AllocatorHandle.op_Implicit(allocator))); } public static NativeAccessor<TValue> GetValueAccessor<TKey, TValue>(this NativeParallelHashMap<TKey, TValue> nativeParallelHashMap, Allocator allocator = 2) where TKey : unmanaged where TValue : unmanaged { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return new NativeAccessor<TValue>(nativeParallelHashMap.GetValueArray(AllocatorHandle.op_Implicit(allocator))); } public static NativeAccessor<T> ToComponentDataArrayAccessor<T>(this EntityQuery entityQuery) where T : unmanaged { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return new NativeAccessor<T>(((EntityQuery)(ref entityQuery)).ToComponentDataArray<T>(AllocatorHandle.op_Implicit((Allocator)2))); } public static bool TryGetBufferAccessor<T>(this Entity entity, out BufferAccessor<T> accessor) where T : unmanaged { //IL_0000: 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) if (entity.TryGetBuffer<T>(out var dynamicBuffer)) { accessor = new BufferAccessor<T>(dynamicBuffer); return true; } accessor = default(BufferAccessor<T>); return false; } } internal static class GenerateREADME { private static readonly Regex _commandGroupRegex = new Regex("\\[CommandGroup\\((?<args>.*?)\\)\\]", RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Singleline); private static readonly Regex _commandAttributeRegex = new Regex("\\[Command\\((?<args>.*?)\\)\\]", RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Singleline); private static readonly Regex _argPairRegex = new Regex("\\b(?<key>\\w+)\\s*:\\s*(?<value>\\\"[^\\\"]*\\\"|[^,\\)\\r\\n]+)", RegexOptions.IgnoreCase | RegexOptions.Compiled); private const string COMMANDS_HEADER = "## Commands"; private const string CONFIG_HEADER = "## Configuration"; private static readonly Dictionary<(string groupName, string groupShort), List<(string name, string shortHand, bool adminOnly, string usage, string description)>> _commandsByGroup = new Dictionary<(string, string), List<(string, string, bool, string, string)>>(); private static string CommandsPath { get; set; } private static string ReadMePath { get; set; } public static void Main(string[] args) { if (Environment.GetEnvironmentVariable("GITHUB_ACTIONS") == "true") { Console.WriteLine("GenerateREADME skipped during GitHub Actions build."); return; } if (args.Length < 2) { Console.WriteLine("Usage: GenerateREADME <CommandsPath> <ReadMePath>"); return; } CommandsPath = args[0]; ReadMePath = args[1]; try { Generate(); Console.WriteLine("README generated successfully."); } catch (Exception ex) { Console.WriteLine("Error generating README: " + ex.Message); } } private static void Generate() { CollectCommands(); string commandsSection = BuildCommandsSection(); string configSection = BuildConfigSection(); UpdateReadme(commandsSection, configSection); } private static void CollectCommands() { string[] files = Directory.GetFiles(CommandsPath, "*.cs"); for (int i = 0; i < files.Length; i++) { string input = File.ReadAllText(files[i]); Match match = _commandGroupRegex.Match(input); string args = (match.Success ? match.Groups["args"].Value : string.Empty); string text = GetStringArg(args, "name"); string stringArg = GetStringArg(args, "short"); if (string.IsNullOrEmpty(stringArg)) { stringArg = GetStringArg(args, "shortHand"); } if (string.IsNullOrEmpty(text)) { text = "misc"; } if (!_commandsByGroup.TryGetValue((text, stringArg), out List<(string, string, bool, string, string)> value)) { value = new List<(string, string, bool, string, string)>(); _commandsByGroup[(text, stringArg)] = value; } foreach (Match item in _commandAttributeRegex.Matches(input)) { string value2 = item.Groups["args"].Value; string stringArg2 = GetStringArg(value2, "name"); string stringArg3 = GetStringArg(value2, "shortHand"); bool boolArg = GetBoolArg(value2, "adminOnly"); string stringArg4 = GetStringArg(value2, "usage"); string stringArg5 = GetStringArg(value2, "description"); value.Add((stringArg2, stringArg3, boolArg, stringArg4, stringArg5)); } } foreach (var item2 in _commandsByGroup.Keys.ToList()) { (string, string) key = item2; List<(string, string, bool, string, string)> list = new List<(string, string, bool, string, string)>(); foreach (var item3 in _commandsByGroup[item2].OrderBy<(string, string, bool, string, string), string>(((string name, string shortHand, bool adminOnly, string usage, string description) c) => c.name, StringComparer.OrdinalIgnoreCase)) { list.Add(item3); } _commandsByGroup[key] = list; } } private static string BuildCommandsSection() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("## Commands").AppendLine(); foreach (var item8 in _commandsByGroup.Keys.OrderBy(((string groupName, string groupShort) g) => g.groupName)) { string item = item8.groupName; string item2 = item8.groupShort; StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder3 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(13, 1, stringBuilder2); handler.AppendLiteral("### "); handler.AppendFormatted(Capitalize(item)); handler.AppendLiteral(" Commands"); stringBuilder3.AppendLine(ref handler); foreach (var item9 in _commandsByGroup[(item, item2)]) { string item3 = item9.name; string item4 = item9.shortHand; bool item5 = item9.adminOnly; string item6 = item9.usage; string item7 = item9.description; bool flag = !string.IsNullOrEmpty(item4); string text = (string.IsNullOrEmpty(item6) ? ("." + (string.IsNullOrEmpty(item2) ? item : item2) + " " + (flag ? item4 : item3)) : item6); string text2 = string.Empty; string[] array = text.Split(' ', 3, StringSplitOptions.RemoveEmptyEntries); if (array.Length >= 3) { text2 = array[2]; } else if (array.Length == 2 && array[1].StartsWith("[")) { text2 = array[1]; } string value = (item5 ? " \ud83d\udd12" : string.Empty); string value2 = ((text2.Length > 0) ? $"- `.{item} {item3} {text2}`{value}" : $"- `.{item} {item3}`{value}"); stringBuilder.AppendLine(value2); if (!string.IsNullOrEmpty(item7)) { stringBuilder2 = stringBuilder; StringBuilder stringBuilder4 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(4, 1, stringBuilder2); handler.AppendLiteral(" - "); handler.AppendFormatted(item7); stringBuilder4.AppendLine(ref handler); } stringBuilder2 = stringBuilder; StringBuilder stringBuilder5 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(16, 1, stringBuilder2); handler.AppendLiteral(" - Shortcut: *"); handler.AppendFormatted(text); handler.AppendLiteral("*"); stringBuilder5.AppendLine(ref handler); } stringBuilder.AppendLine(); } return stringBuilder.ToString(); } private static string BuildConfigSection() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("## Configuration"); stringBuilder.AppendLine(); List<IGrouping<string, ConfigService.ConfigInitialization.ConfigEntryDefinition>> list = (from entry in ConfigService.ConfigInitialization.ConfigEntries group entry by entry.Section into @group orderby ConfigService.ConfigInitialization.SectionOrder.IndexOf(@group.Key) select @group).ToList(); foreach (IGrouping<string, ConfigService.ConfigInitialization.ConfigEntryDefinition> item in list) { StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder3 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(4, 1, stringBuilder2); handler.AppendLiteral("### "); handler.AppendFormatted(item.Key); stringBuilder3.AppendLine(ref handler); foreach (ConfigService.ConfigInitialization.ConfigEntryDefinition item2 in item) { string value = ((item2.DefaultValue is string text) ? ("\"" + text + "\"") : item2.DefaultValue.ToString()); string text2 = item2.DefaultValue.GetType().Name.ToLower(); switch (text2) { case "boolean": text2 = "bool"; break; case "single": text2 = "float"; break; case "int32": text2 = "int"; break; } stringBuilder2 = stringBuilder; StringBuilder stringBuilder4 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(24, 4, stringBuilder2); handler.AppendLiteral("- **"); handler.AppendFormatted(AddSpacesToCamelCase(item2.Key)); handler.AppendLiteral("**: `"); handler.AppendFormatted(item2.Key); handler.AppendLiteral("` ("); handler.AppendFormatted(text2); handler.AppendLiteral(", default: "); handler.AppendFormatted(value); handler.AppendLiteral(")"); stringBuilder4.AppendLine(ref handler); if (!string.IsNullOrEmpty(item2.Description)) { stringBuilder2 = stringBuilder; StringBuilder stringBuilder5 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(2, 1, stringBuilder2); handler.AppendLiteral(" "); handler.AppendFormatted(item2.Description); stringBuilder5.AppendLine(ref handler); } } if (list.IndexOf(item) < list.Count - 1) { stringBuilder.AppendLine(); } } return stringBuilder.ToString(); } private static string AddSpacesToCamelCase(string input) { if (string.IsNullOrEmpty(input)) { return input; } StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < input.Length; i++) { char c = input[i]; bool flag = char.IsUpper(c); bool num = i > 0; bool flag2 = num && char.IsLower(input[i - 1]); bool flag3 = i < input.Length - 1 && char.IsLower(input[i + 1]); if (num && flag && (flag2 || flag3)) { stringBuilder.Append(' '); } stringBuilder.Append(c); } return stringBuilder.ToString(); } private static void UpdateReadme(string commandsSection, string configSection) { bool flag = false; bool flag2 = false; bool flag3 = false; bool flag4 = false; List<string> list = new List<string>(); try { foreach (string item in File.ReadLines(ReadMePath)) { if (item.Trim().Equals("## Commands", StringComparison.OrdinalIgnoreCase)) { flag = true; flag3 = true; list.Add(commandsSection); continue; } if (item.Trim().Equals("## Configuration", StringComparison.OrdinalIgnoreCase)) { flag2 = true; flag4 = true; list.Add(configSection); continue; } if (flag && item.Trim().StartsWith("## ", StringComparison.OrdinalIgnoreCase) && !item.Trim().Equals("## Commands", StringComparison.OrdinalIgnoreCase)) { flag = false; } if (flag2 && item.Trim().StartsWith("## ", StringComparison.OrdinalIgnoreCase) && !item.Trim().Equals("## Configuration", StringComparison.OrdinalIgnoreCase)) { flag2 = false; } if (!flag && !flag2) { list.Add(item); } } if (flag2) { list.Add(configSection); flag2 = false; } if (!flag3) { list.Add("## Commands"); list.Add(commandsSection); } if (!flag4) { list.Add("## Configuration"); list.Add(configSection); } File.WriteAllLines(ReadMePath, list); } catch (Exception ex) { Console.Error.WriteLine("Error updating the readme: " + ex.Message); throw; } } private static string GetStringArg(string args, string key) { foreach (Match item in _argPairRegex.Matches(args)) { if (!item.Groups["key"].Value.Equals(key, StringComparison.OrdinalIgnoreCase)) { continue; } string text = item.Groups["value"].Value.Trim(); string result; if (text.Length > 1 && text[0] == '"') { if (text[text.Length - 1] == '"') { string text2 = text; result = text2.Substring(1, text2.Length - 1 - 1); goto IL_0097; } } result = text; goto IL_0097; IL_0097: return result; } return string.Empty; } private static bool GetBoolArg(string args, string key) { foreach (Match item in _argPairRegex.Matches(args)) { bool result; if (string.Equals(item.Groups["key"].Value, key, StringComparison.OrdinalIgnoreCase)) { return bool.TryParse(item.Groups["value"].Value, out result) && result; } } return false; } private static string Capitalize(string input) { if (!string.IsNullOrEmpty(input)) { return char.ToUpper(input[0]) + input.Substring(1, input.Length - 1); } return input; } } internal static class IExtensions { public static Dictionary<TValue, TKey> Reverse<TKey, TValue>(this IDictionary<TKey, TValue> source) { Dictionary<TValue, TKey> dictionary = new Dictionary<TValue, TKey>(); foreach (KeyValuePair<TKey, TValue> item in source) { dictionary[item.Value] = item.Key; } return dictionary; } public static Dictionary<TValue, TKey> ReverseIl2CppDictionary<TKey, TValue>(this Dictionary<TKey, TValue> source) { Dictionary<TValue, TKey> dictionary = new Dictionary<TValue, TKey>(); if (source == null) { return dictionary; } Enumerator<TKey, TValue> enumerator = source.GetEnumerator(); while (enumerator.MoveNext()) { KeyValuePair<TKey, TValue> current = enumerator.Current; if (!dictionary.ContainsKey(current.Value)) { dictionary[current.Value] = current.Key; } } return dictionary; } public static void ForEach<T>(this IEnumerable<T> collection, Action<T> action) { foreach (T item in collection) { action(item); } } public static bool IsIndexWithinRange<T>(this IList<T> list, int index) { if (index >= 0) { return index < list.Count; } return false; } public static bool ContainsAll(this string stringChars, List<string> strings) { foreach (string @string in strings) { if (!stringChars.Contains(@string, StringComparison.OrdinalIgnoreCase)) { return false; } } return true; } public static bool ContainsAny(this string stringChars, List<string> strings) { foreach (string @string in strings) { if (stringChars.Contains(@string, StringComparison.OrdinalIgnoreCase)) { return true; } } return false; } public static void Start(this IEnumerator routine) { Core.StartCoroutine(routine); } } [BepInPlugin("io.zfolmt.Bloodcraft", "Bloodcraft", "1.8.6")] internal class Plugin : BasePlugin { private Harmony _harmony; internal static Plugin Instance { get; set; } public static Harmony Harmony => Instance._harmony; internal static ManualLogSource LogInstance => ((BasePlugin)Instance).Log; public override void Load() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown Instance = this; if (Application.productName != "VRisingServer") { LogInstance.LogInfo((object)"Bloodcraft is a server mod and will not continue loading on the client."); return; } _harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); ConfigService.ConfigInitialization.InitializeConfig(); DataService.PlayerDataInitialization.LoadPlayerData(); CommandRegistry.RegisterAll(); ManualLogSource log = Core.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(10, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("Bloodcraft"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.8.6"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] loaded!"); } log.LogInfo(val); } public override bool Unload() { ((BasePlugin)this).Config.Clear(); _harmony.UnpatchSelf(); return true; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "io.zfolmt.Bloodcraft"; public const string PLUGIN_NAME = "Bloodcraft"; public const string PLUGIN_VERSION = "1.8.6"; } } namespace Bloodcraft.Utilities { internal static class Battles { private const string SANGUIS = "Sanguis"; private const string SANGUIS_DATA_CLASS = "Sanguis.Core+DataStructures"; private const string SANGUIS_DATA_PROPERTY = "PlayerTokens"; private const string SANGUIS_CONFIG_CLASS = "Sanguis.Plugin"; private const string SANGUIS_CONFIG_PROPERTY = "TokensPerMinute"; private const string SANGUIS_SAVE_METHOD = "SavePlayerTokens"; public static bool TryGetMatch(this HashSet<(ulong, ulong)> hashSet, ulong value, out (ulong, ulong) matchingPair) { matchingPair = default((ulong, ulong)); foreach (var item in hashSet) { if (item.Item1 == value || item.Item2 == value) { matchingPair = item; return true; } } return false; } public static bool TryGetMatchPairInfo(this (ulong, ulong) matchPair, out (PlayerService.PlayerInfo, PlayerService.PlayerInfo) matchPairInfo) { matchPairInfo = default((PlayerService.PlayerInfo, PlayerService.PlayerInfo)); var (steamId, steamId2) = matchPair; if (steamId.TryGetPlayerInfo(out var playerInfo) && steamId2.TryGetPlayerInfo(out var playerInfo2)) { matchPairInfo = (playerInfo, playerInfo2); return true; } return false; } public static void BuildBattleGroupDetailsReply(ulong steamId, DataService.FamiliarPersistence.FamiliarBuffsManager.FamiliarBuffsData buffsData, DataService.FamiliarPersistence.FamiliarPrestigeManager.FamiliarPrestigeData prestigeData, List<int> battleGroup, ref List<string> familiars) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) foreach (int item in battleGroup) { if (item != 0) { string localizedName = ECSExtensions.GetLocalizedName(new PrefabGUID(item)); string text = "<color=#FF69B4>"; int key = FamiliarLevelingSystem.GetFamiliarExperience(steamId, item).Key; int value = 0; if (buffsData.FamiliarBuffs.ContainsKey(item) && FamiliarUnlockSystem.ShinyBuffColorHexes.TryGetValue(new PrefabGUID(buffsData.FamiliarBuffs[item][0]), out var value2)) { text = "<color=" + value2 + ">"; } if (!prestigeData.FamiliarPrestige.ContainsKey(item)) { prestigeData.FamiliarPrestige[item] = 0; DataService.FamiliarPersistence.FamiliarPrestigeManager.SaveFamiliarPrestigeData(steamId, prestigeData); } else { value = prestigeData.FamiliarPrestige[item]; } familiars.Add($"<color=white>{battleGroup.IndexOf(item) + 1}</color>: <color=green>{localizedName}</color>{(buffsData.FamiliarBuffs.ContainsKey(item) ? (text + "*</color>") : "")} [<color=white>{key}</color>][<color=#90EE90>{value}</color>]"); } } } private static void DetectSanguis() { //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Expected O, but got Unknown //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Expected O, but got Unknown //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Expected O, but got Unknown //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Expected O, but got Unknown //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Expected O, but got Unknown //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Expected O, but got Unknown bool flag = default(bool); try { Assembly assembly2 = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly assembly) => assembly.GetName().Name == "Sanguis"); if (assembly2 != null) { Type type = assembly2.GetType("Sanguis.Plugin"); Type type2 = assembly2.GetType("Sanguis.Core+DataStructures"); if (type != null && type2 != null) { PropertyInfo property = type.GetProperty("TokensPerMinute", BindingFlags.Static | BindingFlags.Public); PropertyInfo property2 = type2.GetProperty("PlayerTokens", BindingFlags.Static | BindingFlags.Public); if (property != null && property2 != null) { MethodInfo method = type2.GetMethod("SavePlayerTokens", BindingFlags.Static | BindingFlags.Public); Dictionary<ulong, (int, (DateTime, DateTime))> dictionary = (Dictionary<ulong, (int, (DateTime, DateTime))>)(property2?.GetValue(null) ?? new object()); int num = (int)(property?.GetValue(null) ?? ((object)0)); if (method != null && dictionary.Any() && num > 0) { BattleService._awardSanguis = true; BattleService._tokensProperty = property2; BattleService._tokensTransferred = num; BattleService._saveTokens = method; BattleService._playerTokens = dictionary; ManualLogSource log = Core.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(40, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("Sanguis"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" registered for familiar battle rewards!"); } log.LogInfo(val); } else { ManualLogSource log2 = Core.Log; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(23, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Couldn't get "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("SavePlayerTokens"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" | "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("TokensPerMinute"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" from "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("Sanguis"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("!"); } log2.LogWarning(val2); } } else { ManualLogSource log3 = Core.Log; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(23, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Couldn't get "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("PlayerTokens"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" | "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("TokensPerMinute"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" from "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("Sanguis"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("!"); } log3.LogWarning(val2); } } else { ManualLogSource log4 = Core.Log; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(23, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Couldn't get "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("Sanguis.Core+DataStructures"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" | "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("Sanguis.Plugin"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" from "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("Sanguis"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("!"); } log4.LogWarning(val2); } } else { ManualLogSource log5 = Core.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(44, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("Sanguis"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" not registered for familiar battle rewards!"); } log5.LogInfo(val); } } catch (Exception ex) { ManualLogSource log6 = Core.Log; BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(28, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Error during "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>("Sanguis"); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" registration: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message); } log6.LogError(val3); } } public static void HandleBattleGroupDetailsReply(ChatCommandContext ctx, ulong steamId, DataService.FamiliarPersistence.FamiliarBattleGroupsManager.FamiliarBattleGroup battleGroup) { if (battleGroup.Familiars.Any((int x) => x != 0)) { DataService.FamiliarPersistence.FamiliarBuffsManager.FamiliarBuffsData buffsData = DataService.FamiliarPersistence.FamiliarBuffsManager.LoadFamiliarBuffsData(steamId); DataService.FamiliarPersistence.FamiliarPrestigeManager.FamiliarPrestigeData prestigeData = DataService.FamiliarPersistence.FamiliarPrestigeManager.LoadFamiliarPrestigeData(steamId); List<string> familiars = new List<string>(); BuildBattleGroupDetailsReply(steamId, buffsData, prestigeData, battleGroup.Familiars, ref familiars); string text = string.Join(", ", familiars); LocalizationService.HandleReply(ctx, "Battle Group - " + text); } else { LocalizationService.HandleReply(ctx, "No familiars in battle group!"); } } } internal static class Buffs { public static readonly PrefabGUID HighlordDeadBuff = PrefabGUIDs.AB_HighLordSword_SelfStun_DeadBuff; public static readonly PrefabGUID CastleManCombatBuff = PrefabGUIDs.Buff_InCombat_Npc_CastleMan; public static readonly PrefabGUID StandardWerewolfBuff = PrefabGUIDs.Buff_General_Shapeshift_Werewolf_Standard; public static readonly PrefabGUID VBloodWerewolfBuff = PrefabGUIDs.Buff_General_Shapeshift_Werewolf_VBlood; public static readonly PrefabGUID DisableAggroBuff = PrefabGUIDs.Buff_Illusion_Mosquito_DisableAggro; public static readonly PrefabGUID InteractModeBuff = PrefabGUIDs.AB_Militia_HoundMaster_QuickShot_Buff; public static readonly PrefabGUID AdminInvulnerableBuff = PrefabGUIDs.Admin_Invulnerable_Buff; public static readonly PrefabGUID InvisibleAndImmaterialBuff = PrefabGUIDs.AB_InvisibilityAndImmaterial_Buff; public static readonly PrefabGUID DraculaBloodCurseBuff = PrefabGUIDs.Buff_Vampire_Dracula_BloodCurse; public static readonly PrefabGUID PvECombatBuff = PrefabGUIDs.Buff_InCombat; public static readonly PrefabGUID PvPCombatBuff = PrefabGUIDs.Buff_InCombat_PvPVampire; public static readonly PrefabGUID VBloodAbilityReplaceBuff = PrefabGUIDs.Buff_VBlood_Ability_Replace; public static readonly PrefabGUID VargulfBleedBuff = PrefabGUIDs.AB_Legion_Vargulf_SlicingArm_BleedBuff; public static readonly PrefabGUID DefaultEmoteBuff = PrefabGUIDs.AB_Emote_Buff_Default_NoAnimation; public static readonly PrefabGUID TauntEmoteBuff = PrefabGUIDs.AB_Emote_Vampire_Taunt_Buff; public static readonly PrefabGUID ShroudBuff = PrefabGUIDs.EquipBuff_ShroudOfTheForest; public static readonly PrefabGUID DominateBuff = PrefabGUIDs.AB_Shapeshift_DominatingPresence_PsychicForm_Buff; public static readonly PrefabGUID VanishBuff = PrefabGUIDs.AB_Bandit_Thief_Rush_Buff; public static readonly PrefabGUID HolyBubbleBuff = PrefabGUIDs.AB_ChurchOfLight_Paladin_HolyBubble_InvulnerableBuff; public static readonly PrefabGUID GateBossFeedCompleteBuff = PrefabGUIDs.AB_FeedGateBoss_04_Complete_AreaTriggerBuff; public static readonly PrefabGUID HolyBeamPowerBuff = PrefabGUIDs.AB_CastleMan_HolyBeam_PowerBuff_01; public static readonly PrefabGUID PvPProtectedBuff = PrefabGUIDs.Buff_General_PvPProtected; public static readonly PrefabGUID PhasingBuff = PrefabGUIDs.Buff_General_Phasing; public static readonly PrefabGUID WitchPigTransformationBuff = PrefabGUIDs.Witch_PigTransformation_Buff; public static readonly PrefabGUID WranglerPotionBuff = PrefabGUIDs.AB_Consumable_WranglerPotion_T01_Buff; public static readonly PrefabGUID HighlordGroundSwordBossBuff = PrefabGUIDs.AB_HighLord_GroundSword_PermaBuff_Boss; public static readonly PrefabGUID HighlordGroundSwordSpawnBuff = PrefabGUIDs.AB_HighLord_GroundSword_SilenceBuff_Boss; public static readonly PrefabGUID InkCrawlerDeathBuff = PrefabGUIDs.Buff_InkCrawler_Timer; public static readonly PrefabGUID TargetSwallowedBuff = PrefabGUIDs.AB_Cursed_ToadKing_Swallow_TargetSwallowedBuff; public static readonly PrefabGUID CombatStanceBuff = PrefabGUIDs.Buff_CombatStance; public static readonly PrefabGUID DraculaReturnHideBuff = PrefabGUIDs.Buff_Vampire_Dracula_ReturnHide; public static readonly PrefabGUID ActiveCharmedHumanBuff = PrefabGUIDs.AB_Charm_Active_Human_Buff; public static readonly PrefabGUID StormShieldTertiaryBuff = PrefabGUIDs.AB_Storm_Discharge_StormShield_Buff_03; public static readonly PrefabGUID StormShieldSecondaryBuff = PrefabGUIDs.AB_Storm_Discharge_StormShield_Buff_02; public static readonly PrefabGUID StormShieldPrimaryBuff = PrefabGUIDs.AB_Storm_Discharge_StormShield_Buff_01; public static readonly PrefabGUID TakeFlightBuff = PrefabGUIDs.AB_Shapeshift_Bat_TakeFlight_Buff; public static readonly PrefabGUID GarlicDebuff = PrefabGUIDs.Buff_General_Garlic_Area_Inside; public static readonly PrefabGUID SilverDebuff = PrefabGUIDs.Buff_General_Silver_Sickness_Burn_Debuff; public static readonly PrefabGUID HolyDebuff = PrefabGUIDs.Buff_General_Holy_Area_T01; public static readonly PrefabGUID DivineDebuff = PrefabGUIDs.Buff_General_Holy_Area_T02; public static readonly PrefabGUID VampireLeechDebuff = PrefabGUIDs.Blood_Vampire_Buff_Leech; public static readonly PrefabGUID VampireCondemnDebuff = PrefabGUIDs.Unholy