Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of ServerSideItems v1.1.0
ServerSideItems.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HG.Reflection; using IL.RoR2; using IL.RoR2.Items; using InLobbyConfig; using InLobbyConfig.Fields; using LookingGlass.ItemStatsNameSpace; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using R2API; using R2API.Utils; using RoR2; using RoR2.Items; using RoR2.Projectile; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ServerSideItems")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+45d6df19cca18e6e78750bde840c933a7175b1c1")] [assembly: AssemblyProduct("ServerSideItems")] [assembly: AssemblyTitle("ServerSideItems")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ServerSideItems { public class BepConfig { public static ConfigEntry<bool> ShatterspleenWorksOnBaseHealth; public static ConfigEntry<bool> ImplementBeyondTheLimits; public static ConfigEntry<bool> NewlyHatchedZoeaRework; private static LanguageOverlay NewlyHatchedZoeaReworkOverlay; private static ItemTag[] originalItemTags; public static ConfigEntry<bool> Enabled { get; set; } public static void Init() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown ConfigFile config = ((BaseUnityPlugin)ServerSideItems.instance).Config; Enabled = config.Bind<bool>("Main", "Enabled", true, "Enable Mod"); ShatterspleenWorksOnBaseHealth = config.Bind<bool>("Main", "Shatterspleen: Works on Base Health instead of Combined Health", true, new ConfigDescription("Shatterspleen normally applies dmg based on the combined max health of enemies. This makes it super strong if enemies have health increasing items.", (AcceptableValueBase)null, Array.Empty<object>())); NewlyHatchedZoeaRework = config.Bind<bool>("Main", "NewlyHatchedZoea: Instead of summoning void creature, you become a creature of the void.", true, new ConfigDescription("Every 5 (-25% per stack) seconds, fire 3 (+3 per stack) nullifying bombs which immobilize enemies and deal 380% damage. Auto-targets strongest grounded enemy. Corrupts all yellow items.", (AcceptableValueBase)null, Array.Empty<object>())); NewlyHatchedZoeaRework.SettingChanged += SetLanguageOverlay; SetLanguageOverlay(); if (ModCompatibilityInLobbyConfig.enabled) { ModCompatibilityInLobbyConfig.CreateFromBepInExConfigFile(config, "Server-Side Items"); } } private static void SetLanguageOverlay(object sender = null, EventArgs e = null) { Action action = delegate { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) _ = Items.VoidMegaCrabItem.itemIndex; ItemDef itemDef = ItemCatalog.GetItemDef(Items.VoidMegaCrabItem.itemIndex); if (NewlyHatchedZoeaRework.Value) { originalItemTags = itemDef.tags; itemDef.tags = itemDef.tags.Where((ItemTag s) => (int)s != 13).ToArray(); NewlyHatchedZoeaReworkOverlay = LanguageAPI.AddOverlayPath(Path.Combine(Path.GetDirectoryName(ServerSideItems.PInfo.Location), "NewlyHatchedZoea.json")); } else { if (originalItemTags != null) { itemDef.tags = originalItemTags; } if (NewlyHatchedZoeaReworkOverlay != null) { NewlyHatchedZoeaReworkOverlay.Remove(); } } if (ModCompatibilityLookingGlass.enabled) { ModCompatibilityLookingGlass.UpdateNewlyHatchedZoeaDescription(NewlyHatchedZoeaRework.Value); } }; if (ServerSideItems.instance.canUpdateItemDescriptions) { action(); } else { ServerSideItems.instance.newlyHatchedZoeaUpdate = action; } } } public class BeyondTheLimits { public void Init() { } public void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown CharacterBody.OnEquipmentGained += new hook_OnEquipmentGained(CharacterBody_OnEquipmentGained); CharacterBody.OnEquipmentLost += new hook_OnEquipmentLost(CharacterBody_OnEquipmentLost); CharacterBody.RecalculateStats += new Manipulator(CharacterBody_RecalculateStats); CharacterBody.UpdateAllTemporaryVisualEffects += new Manipulator(CharacterBody_UpdateAllTemporaryVisualEffects); SprintWispBodyBehavior.FixedUpdate += new Manipulator(SprintWispBodyBehavior_FixedUpdate); MushroomVoidBehavior.FixedUpdate += new Manipulator(MushroomVoidBehavior_FixedUpdate); } public void Unhook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown CharacterBody.OnEquipmentGained -= new hook_OnEquipmentGained(CharacterBody_OnEquipmentGained); CharacterBody.OnEquipmentLost -= new hook_OnEquipmentLost(CharacterBody_OnEquipmentLost); CharacterBody.RecalculateStats -= new Manipulator(CharacterBody_RecalculateStats); CharacterBody.UpdateAllTemporaryVisualEffects -= new Manipulator(CharacterBody_UpdateAllTemporaryVisualEffects); SprintWispBodyBehavior.FixedUpdate -= new Manipulator(SprintWispBodyBehavior_FixedUpdate); MushroomVoidBehavior.FixedUpdate -= new Manipulator(MushroomVoidBehavior_FixedUpdate); } private void CharacterBody_OnEquipmentGained(orig_OnEquipmentGained orig, CharacterBody self, EquipmentDef equipmentDef) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && BepConfig.Enabled.Value && BepConfig.ImplementBeyondTheLimits.Value && ((equipmentDef != null) ? new EquipmentIndex?(equipmentDef.equipmentIndex) : null) == (EquipmentIndex?)EquipmentCatalog.FindEquipmentIndex("EliteSecretSpeedEquipment")) { self.AddBuff(Buffs.KillMoveSpeed); self.AddBuff(Buffs.KillMoveSpeed); } else { orig.Invoke(self, equipmentDef); } } private void CharacterBody_OnEquipmentLost(orig_OnEquipmentLost orig, CharacterBody self, EquipmentDef equipmentDef) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && BepConfig.Enabled.Value && BepConfig.ImplementBeyondTheLimits.Value && ((equipmentDef != null) ? new EquipmentIndex?(equipmentDef.equipmentIndex) : null) == (EquipmentIndex?)EquipmentCatalog.FindEquipmentIndex("EliteSecretSpeedEquipment")) { self.RemoveBuff(Buffs.KillMoveSpeed); self.RemoveBuff(Buffs.KillMoveSpeed); } else { orig.Invoke(self, equipmentDef); } } private bool isSprinting(CharacterBody characterBody) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (NetworkServer.active && BepConfig.Enabled.Value && BepConfig.ImplementBeyondTheLimits.Value) { Inventory inventory = characterBody.inventory; if (((inventory != null) ? new EquipmentIndex?(inventory.currentEquipmentIndex) : null) == (EquipmentIndex?)EquipmentCatalog.FindEquipmentIndex("EliteSecretSpeedEquipment")) { return characterBody.notMovingStopwatch == 0f; } } return characterBody._isSprinting; } private void CharacterBody_UpdateAllTemporaryVisualEffects(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); val.DefineLabel(); val.GotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCall<CharacterBody>(x, "get_isSprinting") }); val.Index += 1; val.Remove(); val.EmitDelegate<Func<CharacterBody, bool>>((Func<CharacterBody, bool>)isSprinting); Debug.Log((object)((object)il).ToString()); } private void MushroomVoidBehavior_FixedUpdate(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); val.DefineLabel(); val.GotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<ItemBehavior>(x, "body"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<CharacterBody>(x, "get_isSprinting") }); val.Index += 2; val.Remove(); val.EmitDelegate<Func<CharacterBody, bool>>((Func<CharacterBody, bool>)isSprinting); Debug.Log((object)((object)il).ToString()); } private void SprintWispBodyBehavior_FixedUpdate(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); val.DefineLabel(); val.GotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCall<BaseItemBodyBehavior>(x, "get_body"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<CharacterBody>(x, "get_isSprinting") }); val.Index += 2; val.Remove(); val.EmitDelegate<Func<CharacterBody, bool>>((Func<CharacterBody, bool>)isSprinting); Debug.Log((object)((object)il).ToString()); } private void CharacterBody_RecalculateStats(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); val.DefineLabel(); ILLabel val3 = default(ILLabel); ILLabel val2 = default(ILLabel); val.GotoNext(new Func<Instruction, bool>[9] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCall<CharacterBody>(x, "get_isSprinting"), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val3), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 22), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0), (Instruction x) => ILPatternMatchingExt.MatchBle(x, ref val2), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCall<CharacterBody>(x, "get_armor") }); val.Index += 1; val.Remove(); val.EmitDelegate<Func<CharacterBody, bool>>((Func<CharacterBody, bool>)isSprinting); Debug.Log((object)((object)il).ToString()); } } internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void LogDebug(object data) { _logSource.LogDebug(data); } internal static void LogError(object data) { _logSource.LogError(data); } internal static void LogFatal(object data) { _logSource.LogFatal(data); } internal static void LogInfo(object data) { _logSource.LogInfo(data); } internal static void LogMessage(object data) { _logSource.LogMessage(data); } internal static void LogWarning(object data) { _logSource.LogWarning(data); } } public static class ModCompatibilityInLobbyConfig { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("com.KingEnderBrine.InLobbyConfig"); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void CreateFromBepInExConfigFile(ConfigFile config, string displayName) { ModConfigCatalog.Add(ConfigFieldUtilities.CreateFromBepInExConfigFile(config, displayName)); } } public static class ModCompatibilityLookingGlass { private static bool? _enabled; private static object backupItemStatsDefinition; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("droppod.lookingglass"); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void UpdateNewlyHatchedZoeaDescription(bool enabled) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown //IL_00d5: Expected I4, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected I4, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected I4, but got Unknown if (enabled) { ItemStatsDef val = new ItemStatsDef(); val.descriptions.Add("Bombs: "); val.valueTypes.Add((ValueType)2); val.measurementUnits.Add((MeasurementUnits)4); val.descriptions.Add("Recharge Time: "); val.valueTypes.Add((ValueType)2); val.measurementUnits.Add((MeasurementUnits)6); val.calculateValuesNew = (float luck, int stackCount, float procChance) => new List<float> { NewlyHatchedZoea.GetBombCount(stackCount), NewlyHatchedZoea.GetRechargeDuration(stackCount) }; backupItemStatsDefinition = ItemDefinitions.allItemDefinitions[(int)Items.VoidMegaCrabItem.itemIndex]; ItemDefinitions.allItemDefinitions[(int)Items.VoidMegaCrabItem.itemIndex] = val; } else if (backupItemStatsDefinition != null) { ItemDefinitions.allItemDefinitions[(int)Items.VoidMegaCrabItem.itemIndex] = (ItemStatsDef)backupItemStatsDefinition; } } } public class NewlyHatchedZoea { internal class FireProjectileStruct { public Vector3? Target; public int BombsFired { get; set; } public float FireTimer { get; set; } public FireProjectileStruct() { BombsFired = 0; FireTimer = 0f; } } [CompilerGenerated] private sealed class <DelayDestroyBody>d__12 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CharacterMaster self; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DelayDestroyBody>d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; case 1: <>1__state = -1; self.DestroyBody(); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private AsyncOperationHandle<GameObject> NullifierDeathBombProjectile; private AsyncOperationHandle<GameObject> NullifierPreBombProjectile; protected Random RNG = new Random(); private Dictionary<CharacterMaster, FireProjectileStruct> fireProjectileByCharacter = new Dictionary<CharacterMaster, FireProjectileStruct>(); private Dictionary<int, List<Vector2>> polarPointsCache = new Dictionary<int, List<Vector2>>(); public void Init() { //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) NullifierDeathBombProjectile = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Nullifier/NullifierDeathBombProjectile.prefab"); NullifierPreBombProjectile = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Nullifier/NullifierPreBombProjectile.prefab"); } public void Hook() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown CharacterBody.onBodyInventoryChangedGlobal += CharacterBody_onBodyInventoryChangedGlobal; VoidMegaCrabItemBehavior.FixedUpdate += new hook_FixedUpdate(VoidMegaCrabItemBehavior_FixedUpdate); CharacterMaster.OnBodyDeath += new hook_OnBodyDeath(CharacterMaster_OnBodyDeath); Stage.onServerStageBegin += Stage_onServerStageBegin; } public void Unhook() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown CharacterBody.onBodyInventoryChangedGlobal -= CharacterBody_onBodyInventoryChangedGlobal; VoidMegaCrabItemBehavior.FixedUpdate -= new hook_FixedUpdate(VoidMegaCrabItemBehavior_FixedUpdate); CharacterMaster.OnBodyDeath -= new hook_OnBodyDeath(CharacterMaster_OnBodyDeath); Stage.onServerStageBegin -= Stage_onServerStageBegin; } private void Stage_onServerStageBegin(Stage obj) { fireProjectileByCharacter.Clear(); } private void HealthComponent_TakeDamageProcess(orig_TakeDamageProcess orig, HealthComponent self, DamageInfo damageInfo) { //IL_0070: 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_007f: 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) orig.Invoke(self, damageInfo); CharacterBody body = self.body; if (body != null) { Inventory inventory = body.inventory; if (((inventory != null) ? new int?(inventory.GetItemCountEffective(Items.VoidMegaCrabItem)) : null) > 0 && NetworkServer.active && BepConfig.Enabled.Value && BepConfig.NewlyHatchedZoeaRework.Value) { damageInfo.damageType |= DamageTypeCombo.op_Implicit((DamageType)65536); } } } private void CharacterMaster_OnBodyDeath(orig_OnBodyDeath orig, CharacterMaster self, CharacterBody body) { //IL_003d: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00a1: Unknown result type (might be due to invalid IL or missing references) if (self.inventory.GetItemCountEffective(Items.VoidMegaCrabItem) > 0 && NetworkServer.active && BepConfig.Enabled.Value && BepConfig.NewlyHatchedZoeaRework.Value) { FireProjectileInfo val = default(FireProjectileInfo); val.projectilePrefab = NullifierDeathBombProjectile.WaitForCompletion(); val.position = body.transform.position; val.rotation = Quaternion.identity; val.owner = ((Component)body).gameObject; val.damage = body.damage; val.crit = body.RollCrit(); FireProjectileInfo val2 = val; ProjectileManager.instance.FireProjectile(val2); ((MonoBehaviour)ServerSideItems.instance).StartCoroutine(DelayDestroyBody(self)); } orig.Invoke(self, body); if (self.inventory.GetItemCountEffective(Items.VoidMegaCrabItem) > 0 && NetworkServer.active && BepConfig.Enabled.Value && BepConfig.NewlyHatchedZoeaRework.Value) { self.DestroyBody(); } } [IteratorStateMachine(typeof(<DelayDestroyBody>d__12))] private IEnumerator DelayDestroyBody(CharacterMaster self) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DelayDestroyBody>d__12(0) { self = self }; } public static int GetBombCount(int stackCount) { return 3 + 2 * stackCount; } public static float GetRechargeDuration(int stackCount) { return 5f / (0.5f + (float)stackCount * 0.5f); } private void VoidMegaCrabItemBehavior_FixedUpdate(orig_FixedUpdate orig, VoidMegaCrabItemBehavior self) { //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: 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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016a: 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_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_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_026b: 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_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: 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_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: 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) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || !BepConfig.Enabled.Value || !BepConfig.NewlyHatchedZoeaRework.Value) { orig.Invoke(self); return; } self.spawnTimer += Time.fixedDeltaTime; if ((Object)(object)((ItemBehavior)self).body == (Object)null || (Object)(object)((ItemBehavior)self).body.master == (Object)null) { return; } if (!fireProjectileByCharacter.ContainsKey(((ItemBehavior)self).body.master)) { fireProjectileByCharacter.Add(((ItemBehavior)self).body.master, new FireProjectileStruct()); } FireProjectileStruct fireProjectileStruct = fireProjectileByCharacter[((ItemBehavior)self).body.master]; float maxDistanceFilter = 30f; int bombCount = GetBombCount(((ItemBehavior)self).stack); float num = 2f + Mathf.Sqrt(4f * (float)bombCount / MathF.PI); float fireTimer = 0.5f / (float)bombCount; float rechargeDuration = GetRechargeDuration(((ItemBehavior)self).stack); if (!(self.spawnTimer > rechargeDuration) || !NetworkServer.active) { return; } fireProjectileStruct.FireTimer -= Time.fixedDeltaTime; while (fireProjectileStruct.FireTimer <= 0f) { if (!fireProjectileStruct.Target.HasValue) { BullseyeSearch val = new BullseyeSearch { viewer = ((ItemBehavior)self).body, searchOrigin = ((ItemBehavior)self).body.transform.position, searchDirection = ((ItemBehavior)self).body.transform.position, maxDistanceFilter = maxDistanceFilter, teamMaskFilter = TeamMask.allButNeutral }; ((TeamMask)(ref val.teamMaskFilter)).RemoveTeam(TeamComponent.GetObjectTeam(((Component)((ItemBehavior)self).body).gameObject)); val.sortMode = (SortMode)1; val.RefreshCandidates(); foreach (HurtBox item in (from result in val.GetResults() orderby result.healthComponent.fullCombinedHealth descending select result).ToList()) { Vector3? target = RaycastToFloor(((Component)item).transform.position); if (target.HasValue) { fireProjectileStruct.Target = target; break; } } } if (fireProjectileStruct.Target.HasValue) { if (!polarPointsCache.ContainsKey(bombCount)) { List<Vector2> list = GeneratePolarPoints(bombCount); list.Reverse(); polarPointsCache.Add(bombCount, list); } Vector2 val2 = polarPointsCache[bombCount][fireProjectileStruct.BombsFired]; Vector3 value = fireProjectileStruct.Target.Value; value.x += val2.x * num; value.z += val2.y * num; FireProjectileInfo val3 = default(FireProjectileInfo); val3.projectilePrefab = NullifierPreBombProjectile.WaitForCompletion(); val3.position = value; val3.rotation = Quaternion.identity; val3.owner = ((Component)((ItemBehavior)self).body).gameObject; val3.damage = ((ItemBehavior)self).body.damage * 3f; val3.force = 0f; val3.crit = ((ItemBehavior)self).body.RollCrit(); FireProjectileInfo val4 = val3; ProjectileManager.instance.FireProjectile(val4); fireProjectileStruct.BombsFired++; fireProjectileStruct.FireTimer = fireTimer; if (fireProjectileStruct.BombsFired >= bombCount) { self.spawnTimer = 0f; fireProjectileStruct.FireTimer = 0f; fireProjectileStruct.BombsFired = 0; fireProjectileStruct.Target = null; break; } continue; } break; } } private void CharacterBody_onBodyInventoryChangedGlobal(CharacterBody obj) { //IL_004a: 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) if (NetworkServer.active && BepConfig.Enabled.Value && BepConfig.NewlyHatchedZoeaRework.Value) { if (obj.inventory.GetItemCountEffective(Items.VoidMegaCrabItem) > 0) { obj.SetBuffCount(Buffs.EliteVoid.buffIndex, 1); } else { obj.SetBuffCount(Buffs.EliteVoid.buffIndex, 0); } } } private Vector3? RaycastToFloor(Vector3 position) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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) RaycastHit val = default(RaycastHit); if (Physics.Raycast(new Ray(position, Vector3.down), ref val, 10f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref val)).point; } return null; } private List<Vector2> GeneratePolarPoints(int n) { //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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) switch (n) { case 0: return new List<Vector2>(); case 1: return ((IEnumerable<Vector2>)(object)new Vector2[1] { new Vector2(0f, 0f) }).ToList(); case 2: return ((IEnumerable<Vector2>)(object)new Vector2[2] { new Vector2(-1f, 0f), new Vector2(1f, 0f) }).ToList(); case 3: return ((IEnumerable<Vector2>)(object)new Vector2[3] { new Vector2(1f, 0f), new Vector2(-0.5f, Mathf.Sqrt(3f) / 2f), new Vector2(-0.5f, (0f - Mathf.Sqrt(3f)) / 2f) }).ToList(); default: { int num = (int)Mathf.Round(Mathf.Sqrt((float)n)); int num2 = n - num; float kTheta = MathF.PI * (3f - Mathf.Sqrt(5f)); float[] array = (from i in Enumerable.Range(0, n) select kTheta * (float)i).ToArray(); float[] array2 = new float[num2]; for (int j = 0; j < num2; j++) { array2[j] = Mathf.Sqrt((float)j / (float)(num2 - 1)); } float[] second = Enumerable.Repeat(1f, num).ToArray(); float[] array3 = array2.Concat(second).ToArray(); List<Vector2> list = new List<Vector2>(n); for (int k = 0; k < n; k++) { float num3 = array3[k] * Mathf.Cos(array[k]); float num4 = array3[k] * Mathf.Sin(array[k]); list.Add(new Vector2(num3, num4)); } return list; } } } } [BepInPlugin("Def.ServerSideItems", "ServerSideItems", "1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class ServerSideItems : BaseUnityPlugin { [CompilerGenerated] private sealed class <DelayUpdatingItemDescriptions>d__15 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ServerSideItems <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DelayUpdatingItemDescriptions>d__15(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown int num = <>1__state; ServerSideItems serverSideItems = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; serverSideItems.canUpdateItemDescriptions = true; if (serverSideItems.newlyHatchedZoeaUpdate != null) { serverSideItems.newlyHatchedZoeaUpdate(); } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static ServerSideItems instance; public const string PluginGUID = "Def.ServerSideItems"; public const string PluginAuthor = "Def"; public const string PluginName = "ServerSideItems"; public const string PluginVersion = "1.1.0"; private readonly BeyondTheLimits beyondTheLimits = new BeyondTheLimits(); private readonly NewlyHatchedZoea newlyHatchedZoea = new NewlyHatchedZoea(); private readonly ShatterSpleenTweak shatterSpleenTweak = new ShatterSpleenTweak(); public bool canUpdateItemDescriptions; public Action newlyHatchedZoeaUpdate; public static PluginInfo PInfo { get; private set; } public void Awake() { PInfo = ((BaseUnityPlugin)this).Info; instance = this; Log.Init(((BaseUnityPlugin)this).Logger); BepConfig.Init(); beyondTheLimits.Init(); newlyHatchedZoea.Init(); shatterSpleenTweak.Init(); ((ResourceAvailability)(ref ItemCatalog.availability)).CallWhenAvailable((Action)delegate { ((MonoBehaviour)this).StartCoroutine(DelayUpdatingItemDescriptions()); }); } [IteratorStateMachine(typeof(<DelayUpdatingItemDescriptions>d__15))] private IEnumerator DelayUpdatingItemDescriptions() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DelayUpdatingItemDescriptions>d__15(0) { <>4__this = this }; } private void OnEnable() { newlyHatchedZoea.Hook(); shatterSpleenTweak.Hook(); } private void OnDisable() { newlyHatchedZoea.Unhook(); shatterSpleenTweak.Unhook(); } } internal class ShatterSpleenTweak { public void Init() { } public void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown GlobalEventManager.OnCharacterDeath += new Manipulator(GlobalEventManager_OnCharacterDeath); } public void Unhook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown GlobalEventManager.OnCharacterDeath -= new Manipulator(GlobalEventManager_OnCharacterDeath); } private void GlobalEventManager_OnCharacterDeath(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); val.DefineLabel(); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt<CharacterBody>(x, "get_maxHealth") }); val.Remove(); val.EmitDelegate<Func<CharacterBody, float>>((Func<CharacterBody, float>)((CharacterBody body) => (BepConfig.Enabled.Value && BepConfig.ShatterspleenWorksOnBaseHealth.Value) ? Math.Min(body.baseMaxHealth + body.levelMaxHealth * (body.level - 1f), body.maxHealth) : body.maxHealth)); } } }