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 SpiderKiller v1.6.0
SpiderKiller.dll
Decompiled 2 days agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using HarmonyLib; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem.Collections.Generic; using Microsoft.CodeAnalysis; using ProjectM; using ProjectM.Network; using ProjectM.Physics; using ProjectM.Scripting; using SemanticVersioning; using SpiderKiller.VCFCompat; using Stunlock.Core; using Stunlock.Network; using Unity.Collections; using Unity.Entities; using Unity.Mathematics; using Unity.Transforms; using UnityEngine; using VAMP; 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("SpiderKiller")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Mod that kills spiders in a range around you and your friends. So you don't have to fight those pesky things")] [assembly: AssemblyFileVersion("1.6.0.0")] [assembly: AssemblyInformationalVersion("1.6.0+2.Branch.main.Sha.62bb8fcf39ee2ebe62410e48ec8f8fdc72e85b10.f6b02bd520b0fc1acf690274ddffa5b7be2af1ae")] [assembly: AssemblyProduct("SpiderKiller")] [assembly: AssemblyTitle("SpiderKiller")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.6.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SpiderKiller { public class GiveDrop { private static ManualLogSource _log => Plugin.LogInstance; public static bool AddItemToInventory(Entity recipient, PrefabGUID guid, int amount) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) try { ServerGameManager serverGameManager = Core.Server.GetExistingSystemManaged<ServerScriptMapper>()._ServerGameManager; AddItemResponse val = ((ServerGameManager)(ref serverGameManager)).TryAddInventoryItem(recipient, guid, amount); return ((AddItemResponse)(ref val)).Success; } catch (Exception ex) { _log.LogError((object)ex); } return false; } } [BepInPlugin("SpiderKiller", "SpiderKiller", "1.6.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BasePlugin { public static Harmony Harmony; public static bool HasInitialized; public static ManualLogSource LogInstance { get; private set; } public override void Load() { LogInstance = ((BasePlugin)this).Log; Harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); Settings.Initialize(((BasePlugin)this).Config); if (Application.productName == "VRising") { ((BasePlugin)this).Log.LogWarning((object)"This plugin is a server-only plugin!"); } } public static void Initialize() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown if (!(Application.productName == "VRising") && !HasInitialized) { ManualLogSource logInstance = LogInstance; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("SpiderKiller"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!"); } logInstance.LogInfo(val); LogInstance.LogInfo((object)"Looking if VCF is installed:"); if (Commands.Enabled) { Commands.Register(); } else { LogInstance.LogInfo((object)"This mod has extra admin commands. Install VampireCommandFramework to use them."); } HasInitialized = true; } } public override bool Unload() { Harmony harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } return true; } } public static class Settings { public static ConfigEntry<bool> ENABLE_UNGORA_UNLOCK { get; private set; } public static ConfigEntry<bool> ENABLE_CULLING { get; private set; } public static ConfigEntry<bool> ENABLE_EXTRA_CULL_REWARD { get; private set; } public static ConfigEntry<bool> CULL_QUEEN { get; private set; } public static ConfigEntry<double> CULL_WAIT_TIME { get; private set; } public static ConfigEntry<float> CULL_RANGE { get; private set; } public static ConfigEntry<int> SILKWORM_GIVE_AMOUNT { get; private set; } public static ConfigEntry<bool> DISALLOW_SPIDERLING_VERMINNEST { get; private set; } internal static void Initialize(ConfigFile config) { ENABLE_UNGORA_UNLOCK = config.Bind<bool>("Server", "enableUngoraUnlock", true, "Enable automatically unlocking the ungora boss progression (no need to kill her to get the unlocks)"); ENABLE_CULLING = config.Bind<bool>("Server", "enableCulling", true, "Enable culling of spiders"); ENABLE_EXTRA_CULL_REWARD = config.Bind<bool>("Server", "enableExtraCullReward", false, "Enables the extra cull reward of silkworms"); CULL_QUEEN = config.Bind<bool>("Server", "enableQueenCull", false, "Enable culling of Ungora The Spider Queen VBlood boss (this will turn off her aggro and she will die in one hit))"); CULL_WAIT_TIME = config.Bind<double>("Server", "cullWaitTime", 2.0, "Time in seconds to wait before culling spiders again"); CULL_RANGE = config.Bind<float>("Server", "cullRange", 50f, "Range to check for spiders to cull (5=1tile)"); SILKWORM_GIVE_AMOUNT = config.Bind<int>("Server", "silkwormGiveAmount", 1, "Amount of silkworms to for each spider"); DISALLOW_SPIDERLING_VERMINNEST = config.Bind<bool>("Server", "disallowSpiderlingVerminNest", true, "Disallow spawning of spiderlings from vermin nests WARNING: this will still use up resources it will just not spawn them!"); } } internal static class SpiderUtil { private static NativeArray<Entity> GetSpiders() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = Core.Server.EntityManager; EntityQueryDesc[] array = new EntityQueryDesc[1]; EntityQueryDesc val = new EntityQueryDesc(); val.All = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[4] { ComponentType.ReadOnly<LocalToWorld>(), ComponentType.ReadOnly<Team>(), ComponentType.ReadOnly<AiMoveSpeeds>(), ComponentType.ReadOnly<AiMove_Server>() }); val.None = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[5] { ComponentType.ReadOnly<ServantConvertable>(), ComponentType.ReadOnly<BlueprintData>(), ComponentType.ReadOnly<PhysicsRubble>(), ComponentType.ReadOnly<Dead>(), ComponentType.ReadOnly<DestroyTag>() }); val.Options = (EntityQueryOptions)2; array[0] = val; EntityQuery val2 = ((EntityManager)(ref entityManager)).CreateEntityQuery((EntityQueryDesc[])(object)array); return ((EntityQuery)(ref val2)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); } internal static List<Entity> ClosestSpiders(Entity e, float radius, int team = 25) { //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_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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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) NativeArray<Entity> spiders = GetSpiders(); List<Entity> list = new List<Entity>(); EntityManager entityManager = Core.Server.EntityManager; LocalToWorld val = default(LocalToWorld); if (((EntityManager)(ref entityManager)).TryGetComponentData<LocalToWorld>(e, ref val)) { float3 position = ((LocalToWorld)(ref val)).Position; Enumerator<Entity> enumerator = spiders.GetEnumerator(); while (enumerator.MoveNext()) { Entity current = enumerator.Current; entityManager = Core.Server.EntityManager; LocalToWorld componentData = ((EntityManager)(ref entityManager)).GetComponentData<LocalToWorld>(current); float3 position2 = ((LocalToWorld)(ref componentData)).Position; float num = Vector3.Distance(float3.op_Implicit(position), float3.op_Implicit(position2)); EntityManager entityManager2 = Core.Server.EntityManager; if (((EntityManager)(ref entityManager2)).HasComponent<Team>(current) && num < radius && ((EntityManager)(ref entityManager2)).GetComponentData<Team>(current).FactionIndex == team) { list.Add(current); } } return list; } return new List<Entity>(); } internal static Entity GetQueen(ChatCommandContext ctx) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) PrefabGUID comparingvalue = default(PrefabGUID); ((PrefabGUID)(ref comparingvalue))..ctor(-548489519); List<Entity> list = ClosestSpiders(ctx.Event.SenderCharacterEntity, Settings.CULL_RANGE.Value); int count = list.Count; int remaining = count; foreach (Entity item in list.TakeWhile((Entity _) => remaining != 0)) { if (item.ComparePrefabGuidString(comparingvalue)) { return item; } remaining--; } return Entity.Null; } internal static Entity GetQueen(Entity player, float range) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) PrefabGUID comparingvalue = default(PrefabGUID); ((PrefabGUID)(ref comparingvalue))..ctor(-548489519); List<Entity> list = ClosestSpiders(player, range); int count = list.Count; int remaining = count; foreach (Entity item in list.TakeWhile((Entity _) => remaining != 0)) { if (item.ComparePrefabGuidString(comparingvalue)) { return item; } remaining--; } return Entity.Null; } internal static bool DownQueen(Entity queen) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) if (queen == Entity.Null) { return false; } queen.WithComponentDataC<Health>((VExtensionsSpider.ActionRefs<Health>)delegate(ref Health h) { h.Value = 0.1f; h.MaxRecoveryHealth = 0.1f; h.MaxHealth._Value = 0.1f; }); queen.WithComponentDataC<AggroConsumer>((VExtensionsSpider.ActionRefs<AggroConsumer>)delegate(ref AggroConsumer ac) { ac.Active._Value = false; }); queen.WithComponentDataC<UnitLevel>((VExtensionsSpider.ActionRefs<UnitLevel>)delegate(ref UnitLevel lvl) { //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) lvl.Level = new ModifiableInt(1); }); queen.WithComponentDataC<Vision>((VExtensionsSpider.ActionRefs<Vision>)delegate(ref Vision vs) { //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) vs.Range = new ModifiableFloat(0f); }); queen.WithComponentDataC<UnitStats>((VExtensionsSpider.ActionRefs<UnitStats>)delegate(ref UnitStats us) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) us.PhysicalPower = new ModifiableFloat(0f); us.PassiveHealthRegen = new ModifiableFloat(0f); us.HealthRecovery = new ModifiableFloat(0f); us.SpellPower = new ModifiableFloat(0f); }); return true; } } public static class VExtensionsSpider { public delegate void ActionRefs<T>(ref T item); private static ManualLogSource _log => Plugin.LogInstance; public static void WithComponentDataC<T>(this Entity entity, ActionRefs<T> action) where T : struct { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = Core.Server.EntityManager; T item = default(T); ((EntityManager)(ref entityManager)).TryGetComponentData<T>(entity, ref item); action(ref item); entityManager = Core.Server.EntityManager; ((EntityManager)(ref entityManager)).SetComponentData<T>(entity, item); } public static bool ComparePrefabGuidString(this Entity entity, PrefabGUID comparingvalue) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) try { EntityManager entityManager = Core.Server.EntityManager; PrefabGUID val = default(PrefabGUID); ((EntityManager)(ref entityManager)).TryGetComponentData<PrefabGUID>(entity, ref val); return ((object)(PrefabGUID)(ref val)).ToString().Equals(((object)(PrefabGUID)(ref comparingvalue)).ToString()); } catch (Exception ex) { _log.LogError((object)("Couldn't compare component data: " + ex.Message)); return false; } } public static string GetPrefabGuidNameString(this Entity entity) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) try { EntityManager entityManager = Core.Server.EntityManager; PrefabGUID val = default(PrefabGUID); if (!((EntityManager)(ref entityManager)).TryGetComponentData<PrefabGUID>(entity, ref val)) { return ""; } PrefabLookupMap prefabLookupMap = Core.Server.GetExistingSystemManaged<PrefabCollectionSystem>()._PrefabLookupMap; return ((PrefabLookupMap)(ref prefabLookupMap)).GetName(val); } catch (Exception ex) { _log.LogError((object)("Couldn't compare component data: " + ex.Message)); return ""; } } public static PrefabGUID GetPrefabGuid(this Entity entity) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0045: 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) try { EntityManager entityManager = Core.Server.EntityManager; PrefabGUID val = default(PrefabGUID); return (!((EntityManager)(ref entityManager)).TryGetComponentData<PrefabGUID>(entity, ref val)) ? PrefabGUID.Empty : val; } catch (Exception ex) { _log.LogError((object)("Couldn't compare component data: " + ex.Message)); return PrefabGUID.Empty; } } public static string GetNamefromPrefabGuid(this PrefabGUID prefab) { //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_0012: Unknown result type (might be due to invalid IL or missing references) try { PrefabLookupMap prefabLookupMap = Core.Server.GetExistingSystemManaged<PrefabCollectionSystem>()._PrefabLookupMap; return ((PrefabLookupMap)(ref prefabLookupMap)).GetName(prefab); } catch (Exception ex) { _log.LogError((object)("Couldn't compare component data: " + ex.Message)); return ""; } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "SpiderKiller"; public const string PLUGIN_NAME = "SpiderKiller"; public const string PLUGIN_VERSION = "1.6.0"; } } namespace SpiderKiller.Patches { [HarmonyPatch(typeof(DateTimeSystem), "OnUpdate")] public class DateTimeSystem_Patch { public static class EntityQueryHelper { public static Entity QueryEntityWithPrefabGUID(EntityManager entityManager, int targetPrefabGUID) { //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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<PrefabGUID>() }); Enumerator<Entity> enumerator = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)).GetEnumerator(); PrefabGUID val2 = default(PrefabGUID); while (enumerator.MoveNext()) { Entity current = enumerator.Current; if (((EntityManager)(ref entityManager)).TryGetComponentData<PrefabGUID>(current, ref val2) && ((PrefabGUID)(ref val2)).GuidHash == targetPrefabGUID) { return current; } } return Entity.Null; } } private static DateTime _noUpdateBefore = DateTime.MinValue; private static int _totalcullamount; private static Entity _queenEntity = Entity.Null; private static PrefabGUID _spiderQueen = new PrefabGUID(-548489519); private static bool _queenDowned; private static float lastDownedTimesecondcheck = 0f; private static GameDateTime lastDownedTime = default(GameDateTime); private static readonly HashSet<PrefabGUID> BlockedPrefabGUIDs = new HashSet<PrefabGUID> { new PrefabGUID(-764515001), new PrefabGUID(-1004061470), new PrefabGUID(342127250), new PrefabGUID(-581295882), new PrefabGUID(574276383), new PrefabGUID(2136899683), new PrefabGUID(-725251219), new PrefabGUID(2119230788), new PrefabGUID(-548489519), new PrefabGUID(-943858353), new PrefabGUID(2103131615), new PrefabGUID(1974733695), new PrefabGUID(1078424589), new PrefabGUID(1767714956), new PrefabGUID(-18289884) }; private static readonly HashSet<PrefabGUID> ReplacementPrefabGUIDs = new HashSet<PrefabGUID> { new PrefabGUID(-744966291), new PrefabGUID(-218175217), new PrefabGUID(-2072914343), new PrefabGUID(-559819989) }; private static ManualLogSource _log => Plugin.LogInstance; public static void Prefix(DateTimeSystem __instance) { //IL_0582: Unknown result type (might be due to invalid IL or missing references) //IL_0589: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: 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_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_0469: Unknown result type (might be due to invalid IL or missing references) //IL_046b: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: 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_0288: Unknown result type (might be due to invalid IL or missing references) //IL_050a: Unknown result type (might be due to invalid IL or missing references) //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_0525: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_052e: Unknown result type (might be due to invalid IL or missing references) //IL_0530: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_0561: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references) try { if (!Settings.ENABLE_CULLING.Value || Application.productName == "VRising" || _noUpdateBefore > DateTime.Now) { return; } _noUpdateBefore = DateTime.Now.AddSeconds(Settings.CULL_WAIT_TIME.Value); if (!Plugin.HasInitialized) { return; } EntityManager entityManager = Core.Server.EntityManager; EntityManager entityManager2 = Core.Server.EntityManager; EntityQueryDesc[] array = new EntityQueryDesc[1]; EntityQueryDesc val = new EntityQueryDesc(); val.All = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<SpawnRegion>() }); val.Any = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[2] { ComponentType.ReadOnly<SpawnRegionSpawnSlotEntry>(), ComponentType.ReadOnly<SpawnGroupBuffer>() }); val.Options = (EntityQueryOptions)2; array[0] = val; EntityQuery val2 = ((EntityManager)(ref entityManager2)).CreateEntityQuery((EntityQueryDesc[])(object)array); Enumerator<Entity> enumerator = ((EntityQuery)(ref val2)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)).GetEnumerator(); DynamicBuffer<SpawnRegionSpawnSlotEntry> val3 = default(DynamicBuffer<SpawnRegionSpawnSlotEntry>); DynamicBuffer<SpawnGroupBuffer> val7 = default(DynamicBuffer<SpawnGroupBuffer>); DynamicBuffer<SpawnGroup_SpawnTableBuffer> val8 = default(DynamicBuffer<SpawnGroup_SpawnTableBuffer>); while (enumerator.MoveNext()) { Entity current = enumerator.Current; entityManager2 = Core.Server.EntityManager; if (((EntityManager)(ref entityManager2)).TryGetBuffer<SpawnRegionSpawnSlotEntry>(current, ref val3)) { for (int i = 0; i < val3.Length; i++) { SpawnRegionSpawnSlotEntry val4 = val3[i]; if (BlockedPrefabGUIDs.Contains(val4.Entity.GetPrefabGuid())) { PrefabGUID val5 = ReplacementPrefabGUIDs.ElementAt(Random.Range(0, ReplacementPrefabGUIDs.Count)); Entity val6 = EntityQueryHelper.QueryEntityWithPrefabGUID(Core.Server.EntityManager, ((PrefabGUID)(ref val5)).GuidHash); if (!(val6 == Entity.Null)) { entityManager2 = Core.Server.EntityManager; val4.Entity = ((EntityManager)(ref entityManager2)).Instantiate(val6); val3[i] = val4; } } } } entityManager2 = Core.Server.EntityManager; if (!((EntityManager)(ref entityManager2)).TryGetBuffer<SpawnGroupBuffer>(current, ref val7)) { continue; } Enumerator<SpawnGroupBuffer> enumerator2 = val7.GetEnumerator(); while (enumerator2.MoveNext()) { SpawnGroupBuffer current2 = enumerator2.Current; entityManager2 = Core.Server.EntityManager; if (!((EntityManager)(ref entityManager2)).TryGetBuffer<SpawnGroup_SpawnTableBuffer>(current2.SpawnGroup, ref val8)) { continue; } for (int j = 0; j < val8.Length; j++) { SpawnGroup_SpawnTableBuffer val9 = val8[j]; if (BlockedPrefabGUIDs.Contains(val9.Prefab)) { val9.Prefab = ReplacementPrefabGUIDs.ElementAt(Random.Range(0, ReplacementPrefabGUIDs.Count)); if (val9.Prefab == ReplacementPrefabGUIDs.ElementAt(3)) { val9.Amount = 1; } val8[j] = val9; } } } } Enumerator<int> enumerator3 = InitializePlayer_Patch.playerEntityIndices.GetEnumerator(); while (enumerator3.MoveNext()) { int current3 = enumerator3.Current; Entity entityByEntityIndex = ((EntityManager)(ref entityManager)).GetEntityByEntityIndex(current3); if (Settings.CULL_QUEEN.Value) { DayNightCycle dayNightCycle = Core.Server.GetExistingSystemManaged<ServerScriptMapper>()._ServerGameManager.DayNightCycle; GameDateTime gameDateTimeNow = dayNightCycle.GameDateTimeNow; double num = (double)dayNightCycle.DayDurationInSeconds / 24.0; double num2 = 540.0 / num; if (!_queenDowned || Time.time - lastDownedTimesecondcheck >= 600f || gameDateTimeNow.Year > lastDownedTime.Year || (gameDateTimeNow.Year == lastDownedTime.Year && gameDateTimeNow.Month > lastDownedTime.Month) || (gameDateTimeNow.Year == lastDownedTime.Year && gameDateTimeNow.Month == lastDownedTime.Month && gameDateTimeNow.Day > lastDownedTime.Day) || (gameDateTimeNow.Year == lastDownedTime.Year && gameDateTimeNow.Month == lastDownedTime.Month && gameDateTimeNow.Day == lastDownedTime.Day && (double)(int)gameDateTimeNow.Hour >= Math.Floor((double)(int)lastDownedTime.Hour + num2))) { _queenEntity = SpiderUtil.GetQueen(entityByEntityIndex, Settings.CULL_RANGE.Value); if (_queenEntity != Entity.Null) { SpiderUtil.DownQueen(_queenEntity); _queenDowned = true; lastDownedTimesecondcheck = Time.time; lastDownedTime = dayNightCycle.GameDateTimeNow; _queenEntity = Entity.Null; } } } List<Entity> list = SpiderUtil.ClosestSpiders(entityByEntityIndex, Settings.CULL_RANGE.Value); list.RemoveAll((Entity e) => e.ComparePrefabGuidString(_spiderQueen)); int remaining; int num3 = (remaining = list.Count); if (num3 == 0) { continue; } foreach (Entity item in list.TakeWhile((Entity _) => remaining != 0)) { remaining--; if (!IsQueenSpider(item)) { KillSpider(item, entityByEntityIndex); } } if (Settings.ENABLE_EXTRA_CULL_REWARD.Value) { AddCullAmount(num3); GiveExtraCullReward(entityByEntityIndex); } } } catch (Exception ex) { ManualLogSource log = _log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val10 = new BepInExErrorLogInterpolatedStringHandler(42, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val10).AppendLiteral("Exception in DateTimeSystem_Patch.Prefix: "); ((BepInExLogInterpolatedStringHandler)val10).AppendFormatted<string>(ex.Message); } log.LogError(val10); _log.LogError((object)ex.StackTrace); } } private static bool IsQueenSpider(Entity spider) { //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 spider.ComparePrefabGuidString(_spiderQueen); } private static void KillSpider(Entity spider, Entity player) { //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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0024: 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_0046: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) DeathEvent val = default(DeathEvent); val.Died = spider; val.Killer = player; val.Source = player; DeathEvent val2 = val; Dead val3 = default(Dead); val3.ServerTimeOfDeath = Time.time; val3.DestroyAfterDuration = 5f; val3.Killer = player; val3.KillerSource = player; val3.DoNotDestroy = false; Dead val4 = val3; DeathUtilities.Kill(Core.Server.EntityManager, spider, val4, val2, default(DeathReason)); } private static void AddCullAmount(int amount) { _totalcullamount += amount; } private static int GetCullAmount() { return _totalcullamount; } private static void ResetCullAmount() { _totalcullamount = 0; } private static void CheckForCritters(ComponentSystemBase instance) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) PrefabGUID comparingvalue = default(PrefabGUID); ((PrefabGUID)(ref comparingvalue))..ctor(-80668474); PrefabGUID comparingvalue2 = default(PrefabGUID); ((PrefabGUID)(ref comparingvalue2))..ctor(1076806641); EntityManager entityManager = instance.EntityManager; EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<CritterGroup>() }); NativeArray<Entity> val2 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); if (val2.Length == 0) { return; } ManualLogSource log = _log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(23, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Checking for critters: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(val2.Length); } log.LogInfo(val3); Enumerator<Entity> enumerator = val2.GetEnumerator(); while (enumerator.MoveNext()) { Entity current = enumerator.Current; ManualLogSource log2 = _log; val3 = new BepInExInfoLogInterpolatedStringHandler(13, 0, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("CritterGroup:"); } log2.LogInfo(val3); bool flag2 = current.ComparePrefabGuidString(comparingvalue); bool flag3 = current.ComparePrefabGuidString(comparingvalue2); if (flag2 || flag3) { current.WithComponentDataC<CritterGroup>((VExtensionsSpider.ActionRefs<CritterGroup>)delegate(ref CritterGroup t) { t.SpawnZoneRadius = 0f; t.NumCritters = 0; t.MaxAliveTime = 0.1f; }); } } } private static void GiveExtraCullReward(Entity player) { //IL_0046: 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) int num = 1; int value = Settings.SILKWORM_GIVE_AMOUNT.Value; PrefabGUID guid = default(PrefabGUID); ((PrefabGUID)(ref guid))..ctor(-11246506); int cullAmount = GetCullAmount(); if (cullAmount != 0) { int num2 = 0; do { num2 = ((num2 != 0) ? (num2 * 2) : (num2 + 1)); } while (cullAmount >= num * num2); if (value * num2 > 0) { GiveDrop.AddItemToInventory(player, guid, value * num2); ResetCullAmount(); } } } } [HarmonyPatch(typeof(SpawnTeamSystem_OnPersistenceLoad), "OnUpdate")] public static class InitializationPatch { [HarmonyPostfix] public static void OneShot_AfterLoad_InitializationPatch() { Plugin.Harmony.Unpatch((MethodBase)typeof(SpawnTeamSystem_OnPersistenceLoad).GetMethod("OnUpdate"), typeof(InitializationPatch).GetMethod("OneShot_AfterLoad_InitializationPatch")); Plugin.Initialize(); } } [HarmonyPatch] public static class InitializePlayer_Patch { public static List<int> playerEntityIndices = new List<int>(); [HarmonyPatch(typeof(ServerBootstrapSystem), "OnUserConnected")] [HarmonyPostfix] public static void OnUserConnected_Patch(ServerBootstrapSystem __instance, NetConnectionId netConnectionId) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) try { int num = Core.Server.GetExistingSystemManaged<ServerBootstrapSystem>()._NetEndPointToApprovedUserIndex[netConnectionId]; Entity userEntity = ((Il2CppArrayBase<ServerClient>)(object)Core.Server.GetExistingSystemManaged<ServerBootstrapSystem>()._ApprovedUsersLookup)[num].UserEntity; EntityManager entityManager = Core.Server.EntityManager; User componentData = ((EntityManager)(ref entityManager)).GetComponentData<User>(userEntity); Entity entityOnServer = ((NetworkedEntity)(ref componentData.LocalCharacter)).GetEntityOnServer(); if (Settings.ENABLE_UNGORA_UNLOCK.Value) { UnlockVBlood val = default(UnlockVBlood); val.VBlood = new PrefabGUID(-548489519); UnlockProgressionDebugEvent val2 = default(UnlockProgressionDebugEvent); DebugEventsSystem existingSystemManaged = Core.Server.GetExistingSystemManaged<DebugEventsSystem>(); val2.PrefabGuid = new PrefabGUID(574648849); existingSystemManaged.UnlockProgression(new FromCharacter { Character = componentData.LocalCharacter._Entity, User = userEntity }, val2); val2.PrefabGuid = new PrefabGUID(693361325); existingSystemManaged.UnlockProgression(new FromCharacter { Character = componentData.LocalCharacter._Entity, User = userEntity }, val2); existingSystemManaged.UnlockVBloodEvent(existingSystemManaged, val, new FromCharacter { Character = componentData.LocalCharacter._Entity, User = userEntity }); } playerEntityIndices.Add(entityOnServer.Index); } catch (Exception ex) { Plugin.LogInstance.LogError((object)ex); } } } [HarmonyPatch(typeof(UnitSpawnerUpdateSystem), "SpawnUnit")] public static class SpawnUnit_Patch { private static readonly HashSet<PrefabGUID> BlockedPrefabGUIDs = new HashSet<PrefabGUID> { new PrefabGUID(-764515001), new PrefabGUID(-1004061470), new PrefabGUID(342127250), new PrefabGUID(-581295882), new PrefabGUID(574276383), new PrefabGUID(2136899683), new PrefabGUID(-725251219), new PrefabGUID(2119230788), new PrefabGUID(-548489519), new PrefabGUID(-943858353), new PrefabGUID(2103131615), new PrefabGUID(1974733695), new PrefabGUID(1078424589), new PrefabGUID(1767714956), new PrefabGUID(-18289884) }; private static bool Prefix(Entity stationEntity, PrefabGUID prefabGuid, float3 spawnBasePosition, int count, float minRange, float maxRange, float lifeTime = -1f) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (!Settings.DISALLOW_SPIDERLING_VERMINNEST.Value) { return true; } return !BlockedPrefabGUIDs.Contains(prefabGuid); } } [HarmonyPatch] public static class UserDisconnected_Patch { [HarmonyPatch(typeof(ServerBootstrapSystem), "OnUserDisconnected")] [HarmonyPrefix] public static void OnUserDisconnected_Patch(ServerBootstrapSystem __instance, NetConnectionId netConnectionId, ConnectionStatusChangeReason connectionStatusReason, string extraData) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) if (__instance._NetEndPointToApprovedUserIndex.ContainsKey(netConnectionId)) { int num = __instance._NetEndPointToApprovedUserIndex[netConnectionId]; Entity userEntity = ((Il2CppArrayBase<ServerClient>)(object)__instance._ApprovedUsersLookup)[num].UserEntity; EntityManager entityManager = ((ComponentSystemBase)__instance).EntityManager; User componentData = ((EntityManager)(ref entityManager)).GetComponentData<User>(userEntity); Entity entityOnServer = ((NetworkedEntity)(ref componentData.LocalCharacter)).GetEntityOnServer(); int num2 = InitializePlayer_Patch.playerEntityIndices.IndexOf(entityOnServer.Index); if (num2 != -1) { ListExtensions.RemoveAtSwapBack<int>(InitializePlayer_Patch.playerEntityIndices, num2); } } } } } namespace SpiderKiller.VCFCompat { public static class Commands { public record Spider(Entity Entity) { [CompilerGenerated] protected virtual bool PrintMembers(StringBuilder builder) { //IL_0013: 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) RuntimeHelpers.EnsureSufficientExecutionStack(); builder.Append("Entity = "); Entity entity = Entity; builder.Append(((object)(Entity)(ref entity)).ToString()); return true; } } public class SpiderRemover : CommandArgumentConverter<Spider, ChatCommandContext> { public class SpiderCommands { private static Entity _queenEntity = Entity.Null; [Command("downqueen", "dqueen", "Usage: .dqueen", "Downs Ungora", null, false)] public void downQueen(ChatCommandContext ctx) { //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) _queenEntity = SpiderUtil.GetQueen(ctx); bool flag = SpiderUtil.DownQueen(_queenEntity); ctx.Reply(flag ? "The queen can't see you and is one hit!" : "Failed to down the queen, are you in range?"); } [Command("unlockQueen", "uqueen", "Usage: .uqueen", "unlocked Ungora progression", null, false)] public void unlockQueen(ChatCommandContext ctx) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) DebugEventsSystem existingSystemManaged = Core.Server.GetExistingSystemManaged<DebugEventsSystem>(); UnlockVBlood val = new UnlockVBlood { VBlood = new PrefabGUID(-548489519) }; UnlockProgressionDebugEvent val2 = new UnlockProgressionDebugEvent { PrefabGuid = new PrefabGUID(574648849) }; existingSystemManaged.UnlockProgression(new FromCharacter { Character = ctx.Event.SenderCharacterEntity, User = ctx.Event.SenderUserEntity }, val2); val2.PrefabGuid = new PrefabGUID(693361325); existingSystemManaged.UnlockProgression(new FromCharacter { Character = ctx.Event.SenderCharacterEntity, User = ctx.Event.SenderUserEntity }, val2); existingSystemManaged.UnlockVBloodEvent(existingSystemManaged, val, new FromCharacter { Character = ctx.Event.SenderCharacterEntity, User = ctx.Event.SenderUserEntity }); ctx.Reply("Succesfully unlocked Ungora progression unlocks, no need to get close to her now."); } [Command("tpToMe", "ttm", "Usage: .ttm [range]", "Teleports all spiders(Entities with FactionIndex 25) to you in a defined range", null, true)] public void TeleportToPlayer(ChatCommandContext ctx, float range = 10f, int factionIndex = 25) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) if (range > 50f) { range = 50f; } List<Entity> list = SpiderUtil.ClosestSpiders(ctx.Event.SenderCharacterEntity, range, factionIndex); int count = list.Count; EntityManager entityManager = Core.Server.EntityManager; float3 userPos = ((EntityManager)(ref entityManager)).GetComponentData<Translation>(ctx.Event.SenderUserEntity).Value; int remaining = count; foreach (Entity item in list.TakeWhile((Entity _) => remaining != 0)) { item.WithComponentDataC<Translation>((VExtensionsSpider.ActionRefs<Translation>)delegate(ref Translation t) { //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) t.Value = userPos; }); remaining--; } ctx.Reply($"Teleported {count} spiders."); } [Command("killSpiders", "kspi", "Usage: .kspi [range]", "Kills all spiders(Entities with FactionIndex 25) in a defined range", null, false)] public void KillEnemy(ChatCommandContext ctx, float range = 10f, int factionIndex = 25) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) if (range > 50f) { range = 50f; } List<Entity> list = SpiderUtil.ClosestSpiders(ctx.Event.SenderCharacterEntity, range, factionIndex); int remaining; int value = (remaining = list.Count); foreach (Entity item in list.TakeWhile((Entity _) => remaining != 0)) { DeathEvent val = default(DeathEvent); val.Died = item; val.Killer = ctx.Event.SenderCharacterEntity; val.Source = ctx.Event.SenderCharacterEntity; DeathEvent val2 = val; Dead val3 = default(Dead); val3.ServerTimeOfDeath = Time.time; val3.DestroyAfterDuration = 5f; val3.Killer = ctx.Event.SenderCharacterEntity; val3.KillerSource = ctx.Event.SenderCharacterEntity; val3.DoNotDestroy = false; Dead val4 = val3; DeathUtilities.Kill(Core.Server.EntityManager, item, val4, val2, default(DeathReason)); remaining--; } ctx.Reply($"Killed {value} spiders."); } } private const float Radius = 25f; public override Spider Parse(ChatCommandContext ctx, string input) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) List<Entity> list = SpiderUtil.ClosestSpiders(ctx.Event.SenderCharacterEntity, 25f); EntityManager entityManager = Core.Server.EntityManager; foreach (Entity item in list) { Team componentData = ((EntityManager)(ref entityManager)).GetComponentData<Team>(item); bool flag = Team.IsInUnitTeam(componentData); if (!Team.IsInNeutralTeam(componentData) && flag) { return new Spider(item); } } throw ctx.Error($"Could not find a spider within {25f:F1}"); } } private static ManualLogSource _log => Plugin.LogInstance; public static bool Enabled { get; private set; } static Commands() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown Enabled = ((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.TryGetValue("gg.deca.VampireCommandFramework", out var value); if (Enabled) { ManualLogSource log = _log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(13, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("VCF Version: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Version>(value.Metadata.Version); } log.LogInfo(val); } } public static void Register() { CommandRegistry.RegisterAll(); } } }