Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of SOTSItemRework v1.1.1
SOTSItemRework.dll
Decompiled 2 years agousing System; 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.Configuration; using EntityStates; using EntityStates.ImpMonster; using IL.RoR2; using KinematicCharacterController; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using R2API; using RoR2; using RoR2.Navigation; using RoR2.Projectile; using SOTSItemRework.Items.Green; using SOTSItemRework.Items.Red; using SOTSItemRework.Items.White; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SOTSItemRework")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SOTSItemRework")] [assembly: AssemblyTitle("SOTSItemRework")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] 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; } } } namespace SOTSItemRework { public class ProjectileGlue : MonoBehaviour { private Transform target; private ProjectileTargetComponent targetComponent; public void Start() { targetComponent = ((Component)this).GetComponent<ProjectileTargetComponent>(); target = targetComponent.target; } private void FixedUpdate() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)target)) { ((Component)this).transform.position = target.position; } } } [BepInPlugin("com.Nuxlar.SOTSItemRework", "SOTSItemRework", "1.1.1")] public class SOTSItemRework : BaseUnityPlugin { public static ItemDef emptyItem = ScriptableObject.CreateInstance<ItemDef>(); public static BuffDef emptyBuff = ScriptableObject.CreateInstance<BuffDef>(); public static AssetBundle assetBundle; public static Sprite transmitterEquipIcon; public static ConfigEntry<bool> enableEcho; public static ConfigEntry<bool> enableAntler; public static ConfigEntry<bool> enableFin; public static ConfigEntry<bool> enableChronic; public static ConfigEntry<bool> enableLantern; public static ConfigEntry<bool> enableDoll; public static ConfigEntry<bool> enableBeads; public static ConfigEntry<bool> enableThorn; public static ConfigEntry<bool> enableTransmitter; public static ConfigEntry<bool> enableWarBonds; public static ConfigEntry<bool> enableLens; public static ConfigEntry<bool> enableNectar; private static ConfigFile SIRConfig { get; set; } public void Awake() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) SIRConfig = new ConfigFile(Paths.ConfigPath + "\\com.Nuxlar.SOTSItemRework.cfg", true); enableEcho = SIRConfig.Bind<bool>("General", "Enable Warped Echo Change", true, "Enable Rework"); enableAntler = SIRConfig.Bind<bool>("General", "Enable Antler Shield Change", true, "Enable Rework"); enableFin = SIRConfig.Bind<bool>("General", "Enable Knockback Fin Change", true, "Enable Rework"); enableChronic = SIRConfig.Bind<bool>("General", "Enable Chronic Expansion Change", true, "Enable Rework"); enableLantern = SIRConfig.Bind<bool>("General", "Enable Bolstering Lantern Change", true, "Enable Rework"); enableDoll = SIRConfig.Bind<bool>("General", "Enable Chance Doll Change", true, "Enable Rework"); enableBeads = SIRConfig.Bind<bool>("General", "Enable Prayer Beads Change", true, "Enable Rework"); enableThorn = SIRConfig.Bind<bool>("General", "Enable Noxious Thorn Change", true, "Enable Rework"); enableTransmitter = SIRConfig.Bind<bool>("General", "Enable Unstable Transmitter Change", true, "Enable Rework"); enableWarBonds = SIRConfig.Bind<bool>("General", "Enable War Bonds Change", true, "Enable Rework"); enableLens = SIRConfig.Bind<bool>("General", "Enable Runic Lens Change", true, "Enable Rework"); enableNectar = SIRConfig.Bind<bool>("General", "Enable Growth Nectar Change", true, "Enable Rework"); assetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "sotsitemrework.bundle")); transmitterEquipIcon = assetBundle.LoadAsset<Sprite>("assets/transmitterequipicon.png"); emptyItem.tier = (ItemTier)5; emptyItem.hidden = true; emptyItem.deprecatedTier = (ItemTier)5; ((Object)emptyItem).name = "Empty ItemNux"; ContentAddition.AddItemDef(emptyItem); ((Object)emptyBuff).name = "Empty BuffNux"; ContentAddition.AddBuffDef(emptyBuff); bool flag = default(bool); ContentAddition.AddEntityState<TransmitterBlink>(ref flag); if (enableEcho.Value) { new WarpedEcho(); } if (enableAntler.Value) { new AntlerShield(); } if (enableFin.Value) { new KnockbackFin(); } if (enableChronic.Value) { new ChronicExpansion(); } if (enableLantern.Value) { new BolsteringLantern(); } if (enableDoll.Value) { new ChanceDoll(); } if (enableBeads.Value) { new PrayerBeads(); } if (enableThorn.Value) { new NoxiousThorn(); } if (enableTransmitter.Value) { new UnstableTransmitter(); } if (enableWarBonds.Value) { new WarBonds(); } if (enableLens.Value) { new RunicLens(); } if (enableNectar.Value) { new GrowthNectar(); } } } public class TransmitterBlink : BaseState { private Transform modelTransform; private float stopwatch; private float duration = 0.3f; private Vector3 blinkDestination = Vector3.zero; private Vector3 blinkStart = Vector3.zero; private Animator animator; private CharacterModel characterModel; private HurtBoxGroup hurtboxGroup; private Vector3 blinkVector = Vector3.zero; public override void OnEnter() { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); modelTransform = ((EntityState)this).GetModelTransform(); if (Object.op_Implicit((Object)(object)modelTransform)) { animator = ((Component)modelTransform).GetComponent<Animator>(); characterModel = ((Component)modelTransform).GetComponent<CharacterModel>(); hurtboxGroup = ((Component)modelTransform).GetComponent<HurtBoxGroup>(); } if (Object.op_Implicit((Object)(object)characterModel)) { CharacterModel obj = characterModel; obj.invisibilityCount++; } if (Object.op_Implicit((Object)(object)hurtboxGroup)) { HurtBoxGroup obj2 = hurtboxGroup; int hurtBoxesDeactivatorCounter = obj2.hurtBoxesDeactivatorCounter + 1; obj2.hurtBoxesDeactivatorCounter = hurtBoxesDeactivatorCounter; } if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((Behaviour)((EntityState)this).characterMotor).enabled = false; } Vector3 val = GetBlinkVector() * 50f; blinkDestination = ((EntityState)this).transform.position; blinkStart = ((EntityState)this).transform.position; NodeGraph groundNodes = SceneInfo.instance.groundNodes; groundNodes.GetNodePosition(groundNodes.FindClosestNode(((EntityState)this).transform.position + val, ((EntityState)this).characterBody.hullClassification, float.PositiveInfinity), ref blinkDestination); blinkDestination += ((EntityState)this).transform.position - ((EntityState)this).characterBody.footPosition; CreateBlinkEffect(Util.GetCorePosition(((EntityState)this).gameObject)); RiftAttack(); } private void CreateBlinkEffect(Vector3 origin) { //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_000c: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown EffectManager.SpawnEffect(BlinkState.blinkPrefab, new EffectData { rotation = Util.QuaternionSafeLookRotation(blinkVector), origin = origin }, false); } protected virtual Vector3 GetBlinkVector() { //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_002a: 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_002f: 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) Vector3 val = ((((EntityState)this).inputBank.moveVector == Vector3.zero) ? ((EntityState)this).characterDirection.forward : ((EntityState)this).inputBank.moveVector); return ((Vector3)(ref val)).normalized; } private void SetPosition(Vector3 newPosition) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((BaseCharacterController)((EntityState)this).characterMotor).Motor.SetPositionAndRotation(newPosition, Quaternion.identity, true); } } private void RiftAttack() { //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_0016: 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_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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_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_009d: 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_00ae: 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_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) //IL_00c2: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected O, but got Unknown new BlastAttack { attacker = ((Component)((EntityState)this).characterBody).gameObject, baseDamage = ((EntityState)this).characterBody.damage * 4f, baseForce = 1000f, bonusForce = Vector3.zero, attackerFiltering = (AttackerFiltering)2, crit = ((EntityState)this).characterBody.RollCrit(), damageColorIndex = (DamageColorIndex)3, damageType = DamageTypeCombo.op_Implicit((DamageType)0), falloffModel = (FalloffModel)0, inflictor = ((Component)((EntityState)this).characterBody).gameObject, position = ((EntityState)this).characterBody.corePosition, procChainMask = default(ProcChainMask), procCoefficient = 1f, radius = 25f, losType = (LoSType)0, teamIndex = (TeamIndex)1 }.Fire(); EffectManager.SpawnEffect(CommonAssets.teleportOnLowHealthExplosion, new EffectData { origin = ((EntityState)this).characterBody.corePosition, scale = 50f, rotation = Quaternion.identity }, true); Util.PlaySound("Play_item_proc_teleportOnLowHealth", ((Component)((EntityState)this).characterBody).gameObject); } public override void FixedUpdate() { //IL_0045: 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_005c: 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) ((EntityState)this).FixedUpdate(); stopwatch += ((EntityState)this).GetDeltaTime(); if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && Object.op_Implicit((Object)(object)((EntityState)this).characterDirection)) { ((EntityState)this).characterMotor.velocity = Vector3.zero; } SetPosition(Vector3.Lerp(blinkStart, blinkDestination, stopwatch / BlinkState.duration)); if (!((double)stopwatch < (double)BlinkState.duration) && ((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } public override void OnExit() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) RiftAttack(); CreateBlinkEffect(Util.GetCorePosition(((EntityState)this).gameObject)); modelTransform = ((EntityState)this).GetModelTransform(); if (Object.op_Implicit((Object)(object)modelTransform) && Object.op_Implicit((Object)(object)BlinkState.destealthMaterial)) { TemporaryOverlayInstance obj = TemporaryOverlayManager.AddOverlay(((Component)animator).gameObject); obj.duration = 1f; obj.destroyComponentOnEnd = true; obj.originalMaterial = BlinkState.destealthMaterial; obj.inspectorCharacterModel = ((Component)animator).gameObject.GetComponent<CharacterModel>(); obj.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f); obj.animateShaderAlpha = true; } if (Object.op_Implicit((Object)(object)characterModel)) { CharacterModel obj2 = characterModel; obj2.invisibilityCount--; } if (Object.op_Implicit((Object)(object)hurtboxGroup)) { HurtBoxGroup obj3 = hurtboxGroup; int hurtBoxesDeactivatorCounter = obj3.hurtBoxesDeactivatorCounter - 1; obj3.hurtBoxesDeactivatorCounter = hurtBoxesDeactivatorCounter; } if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((Behaviour)((EntityState)this).characterMotor).enabled = true; } ((EntityState)this).OnExit(); } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)5; } } } namespace SOTSItemRework.Items.White { public class AntlerShield { private ItemDef antlerDef = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC2/Items/NegateAttack/NegateAttack.asset").WaitForCompletion(); public AntlerShield() { //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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown antlerDef.descriptionToken = "Gain shield equal to <style=cIsUtility>4%</style> <style=cStack>(+4% per stack)</style> of your maximum health. Increase movement speed by <style=cIsUtility>14%</style> <style=cStack>(+14% per stack)</style> while shield is active."; antlerDef.pickupToken = "Gain a recharging shield and increase movement speed while shield is active."; HealthComponent.TakeDamageProcess += new Manipulator(RemoveVanillaAntlerShield); RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(NewAntlerShield); } private void NewAntlerShield(CharacterBody sender, StatHookEventArgs args) { if (!Object.op_Implicit((Object)(object)sender.inventory)) { return; } int itemCount = sender.inventory.GetItemCount(Items.NegateAttack); if (itemCount > 0) { args.baseShieldAdd += 0.04f * sender.maxHealth * (float)itemCount; if (Object.op_Implicit((Object)(object)sender.healthComponent) && sender.healthComponent.shield > 0f) { args.moveSpeedMultAdd += 0.14f * (float)itemCount; } } } private void RemoveVanillaAntlerShield(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); if (val.TryGotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(ItemCounts), "antlerShield"), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0) })) { val.Index += 2; val.EmitDelegate<Func<int, int>>((Func<int, int>)((int stack) => int.MaxValue)); } else { Debug.LogError((object)"SOTSItemRework: Removing vanilla Antler Shield hook failed."); } } } public class BolsteringLantern { private ItemDef lanternDef = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC2/Items/LowerHealthHigherDamage/LowerHealthHigherDamage.asset").WaitForCompletion(); public BolsteringLantern() { //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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown lanternDef.descriptionToken = "While <style=cIsHealth>health and shield are at 100%</style>, increase damage by <style=cIsUtility>20%</style> <style=cStack>(+20% per stack)</style>."; lanternDef.pickupToken = "Deal extra damage at max health."; CharacterBody.UpdateLowerHealthHigherDamage += new hook_UpdateLowerHealthHigherDamage(LanternChange); } private void LanternChange(orig_UpdateLowerHealthHigherDamage orig, CharacterBody self) { //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Invalid comparison between Unknown and I4 //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Invalid comparison between Unknown and I4 //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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) if (!Object.op_Implicit((Object)(object)self.inventory)) { return; } int itemCount = self.inventory.GetItemCount(Items.LowerHealthHigherDamage); if (NetworkServer.active) { if (itemCount > 0) { if (Object.op_Implicit((Object)(object)self.inventory) && !((double)self.healthComponent.health <= 0.0) && (int)self.teamComponent.teamIndex == 1) { float combinedHealthFraction = self.healthComponent.combinedHealthFraction; if ((double)combinedHealthFraction >= 1.0 && !self.HasBuff(Buffs.LowerHealthHigherDamageBuff)) { self.AddBuff(Buffs.LowerHealthHigherDamageBuff); Util.PlaySound("Play_item_proc_lowerHealthHigherDamage_proc", ((Component)self).gameObject); self.TransmitItemBehavior(new NetworkItemBehaviorData(Items.LowerHealthHigherDamage.itemIndex, 1f)); } else if (self.HasBuff(Buffs.LowerHealthHigherDamageBuff) && !((double)combinedHealthFraction >= 1.0)) { self.RemoveBuff(Buffs.LowerHealthHigherDamageBuff); self.TransmitItemBehavior(new NetworkItemBehaviorData(Items.LowerHealthHigherDamage.itemIndex, 0f)); } } } else if (self.HasBuff(Buffs.LowerHealthHigherDamageBuff)) { self.RemoveBuff(Buffs.LowerHealthHigherDamageBuff); self.TransmitItemBehavior(new NetworkItemBehaviorData(Items.LowerHealthHigherDamage.itemIndex, 0f)); } } else if (itemCount == 0 && self.HasBuff(Buffs.LowerHealthHigherDamageBuff) && !((double)self.healthComponent.health <= 0.0) && (int)self.teamComponent.teamIndex == 1 && !((double)self.healthComponent.GetNormalizedHealth() >= 1.0)) { self.RemoveBuff(Buffs.LowerHealthHigherDamageBuff); self.TransmitItemBehavior(new NetworkItemBehaviorData(Items.LowerHealthHigherDamage.itemIndex, 0f)); } } } public class ChronicExpansion { private ItemDef cExpansionDef = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC2/Items/IncreaseDamageOnMultiKill/IncreaseDamageOnMultiKill.asset").WaitForCompletion(); public ChronicExpansion() { //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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown cExpansionDef.nameToken = "Escalating Expansion"; cExpansionDef.descriptionToken = "Gain a stacking 5% Critical Strike chance after killing an enemy for <style=cIsUtility>3 seconds</style> <style=cStack>(+1.5s per stack)</style>. Duration resets with each kill."; cExpansionDef.pickupToken = "Gain a stacking 5% Critical Strike chance after killing an enemy for a limited time. Duration resets with each kill."; CharacterBody.RecalculateStats += new Manipulator(RemoveVanillaCExpansion); CharacterBody.RecalculateStats += new Manipulator(RemoveVanillaCExpansionBuff); GlobalEventManager.onCharacterDeathGlobal += ApplyCExpansionBuff; RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(NewCExpansionBuff); CharacterBody.AddTimedBuff_BuffDef_float += new hook_AddTimedBuff_BuffDef_float(ResetCExpansionBuff); CharacterBody.UpdateMultiKill += new hook_UpdateMultiKill(RemoveVanillaCExpansionMultiKillUpdate); CharacterBody.AddMultiKill += new hook_AddMultiKill(RemoveVanillaCExpansionMultiKill); } private void RemoveVanillaCExpansionMultiKillUpdate(orig_UpdateMultiKill orig, CharacterBody self, float deltaTime) { } private void RemoveVanillaCExpansionMultiKill(orig_AddMultiKill orig, CharacterBody self, int count) { } private void RemoveVanillaCExpansionBuff(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "IncreaseDamageBuff") })) { val.Remove(); val.Emit<SOTSItemRework>(OpCodes.Ldsfld, "emptyBuff"); } else { Debug.LogError((object)"SOTSItemRework: Removing vanilla CExpansion buff hook failed."); } } private void ResetCExpansionBuff(orig_AddTimedBuff_BuffDef_float orig, CharacterBody self, BuffDef buffDef, float duration) { //IL_0001: 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_0029: 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) if (buffDef.buffIndex == Buffs.IncreaseDamageBuff.buffIndex) { foreach (TimedBuff timedBuff in self.timedBuffs) { if (timedBuff.buffIndex == Buffs.IncreaseDamageBuff.buffIndex) { timedBuff.timer = duration; } } } orig.Invoke(self, buffDef, duration); } private void ApplyCExpansionBuff(DamageReport dmgReport) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)dmgReport.attacker) || !Object.op_Implicit((Object)(object)dmgReport.attackerBody) || !Object.op_Implicit((Object)(object)dmgReport.victim) || !Object.op_Implicit((Object)(object)dmgReport.victimBody) || !NetworkServer.active) { return; } CharacterBody attackerBody = dmgReport.attackerBody; if (Object.op_Implicit((Object)(object)attackerBody.inventory) && NetworkServer.active) { int itemCount = attackerBody.inventory.GetItemCount(Items.IncreaseDamageOnMultiKill); if (itemCount > 0) { float num = 1.5f + 1.5f * (float)itemCount; attackerBody.AddTimedBuffAuthority(Buffs.IncreaseDamageBuff.buffIndex, num); } } } private void RemoveVanillaCExpansion(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "IncreaseDamageOnMultiKill") })) { val.Remove(); val.Emit<SOTSItemRework>(OpCodes.Ldsfld, "emptyItem"); } else { Debug.LogError((object)"SOTSItemRework: Removing vanilla CExpansion hook failed."); } } private void NewCExpansionBuff(CharacterBody sender, StatHookEventArgs args) { int buffCount = sender.GetBuffCount(Buffs.IncreaseDamageBuff); if (buffCount > 0) { args.critAdd += 5f * (float)buffCount; } } } public class KnockbackFin { private ItemDef finDef = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC2/Items/KnockBackHitEnemies/KnockBackHitEnemies.asset").WaitForCompletion(); public KnockbackFin() { //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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown finDef.nameToken = "Nimble Fin"; finDef.descriptionToken = "Increase jump height by <style=cIsUtility>20%</style> <style=cStack>(+20% per stack)</style>."; finDef.pickupToken = "Increase jump height by 20%."; RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(NewFin); GlobalEventManager.ProcessHitEnemy += new Manipulator(RemoveVanillaFin); } private void NewFin(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender.inventory)) { int itemCount = sender.inventory.GetItemCount(Items.KnockBackHitEnemies); if (itemCount > 0) { args.jumpPowerMultAdd += 0.2f * (float)itemCount; } } } private void RemoveVanillaFin(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "KnockBackHitEnemies") })) { val.Remove(); val.Emit<SOTSItemRework>(OpCodes.Ldsfld, "emptyItem"); } else { Debug.LogError((object)"SOTSItemRework: Removing vanilla Fin hook failed."); } } } public class WarpedEcho { private ItemDef echoDef = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC2/Items/DelayedDamage/DelayedDamage.asset").WaitForCompletion(); public WarpedEcho() { //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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown echoDef.nameToken = "Wanderer's Compass"; echoDef.descriptionToken = "Increase sprint speed by <style=cIsUtility>35%</style> <style=cStack>(+35% per stack)</style> while out of combat."; echoDef.pickupToken = "Increase sprint speed while out of combat."; RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(SpeedEcho); DelayedDamageBehavior.Update += new hook_Update(RemoveVanillaEchoBehavior); CharacterBody.UpdateDelayedDamage += new hook_UpdateDelayedDamage(RemoveVanillaEcho); } private void RemoveVanillaEcho(orig_UpdateDelayedDamage orig, CharacterBody self, float deltaTime) { } private void RemoveVanillaEchoBehavior(orig_Update orig, DelayedDamageBehavior self) { } private void SpeedEcho(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender.inventory)) { int itemCount = sender.inventory.GetItemCount(Items.DelayedDamage); if (itemCount > 0 && sender.outOfCombat) { args.sprintSpeedAdd += 0.35f * (float)itemCount; } } } } } namespace SOTSItemRework.Items.Red { public class GrowthNectar { private ItemDef nectarDef = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC2/Items/BoostAllStats/BoostAllStats.asset").WaitForCompletion(); public GrowthNectar() { //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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown nectarDef.nameToken = "Vitality Nectar"; nectarDef.descriptionToken = "Gain a <style=cIsUtility>20%</style> <style=cStack>(+20% per stack)</style> stat boost while health is <style=cIsHealth>below 100%</style>."; nectarDef.pickupToken = "Gain a 20% stat boost while health is below 100%."; CharacterBody.RecalculateStats += new hook_RecalculateStats(AddNewNectar); CharacterBody.UpdateBoostAllStatsTimer += new hook_UpdateBoostAllStatsTimer(RemoveVanillaNectarTimer); } private void RemoveVanillaNectarTimer(orig_UpdateBoostAllStatsTimer orig, CharacterBody self, float deltaTime) { } private void AddNewNectar(orig_RecalculateStats orig, CharacterBody self) { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (!Object.op_Implicit((Object)(object)self) || !Object.op_Implicit((Object)(object)self.inventory)) { return; } if (self.inventory.GetItemCount(Items.BoostAllStats) > 0) { if (Object.op_Implicit((Object)(object)self.healthComponent) && self.healthComponent.combinedHealthFraction < 1f && self.GetBuffCount(Buffs.BoostAllStatsBuff) == 0) { self.SetBuffCount(Buffs.BoostAllStatsBuff.buffIndex, 1); } } else if (self.inventory.GetItemCount(Items.BoostAllStats) <= 0 && self.GetBuffCount(Buffs.BoostAllStatsBuff) > 0) { self.SetBuffCount(Buffs.BoostAllStatsBuff.buffIndex, 0); } } } public class RunicLens { private ItemDef lensDef = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC2/Items/MeteorAttackOnHighDamage/MeteorAttackOnHighDamage.asset").WaitForCompletion(); private static GameObject tracerEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Golem/TracerGolem.prefab").WaitForCompletion(); private static GameObject hitEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Golem/ExplosionGolem.prefab").WaitForCompletion(); private static GameObject muzzleEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Golem/MuzzleflashGolem.prefab").WaitForCompletion(); public RunicLens() { //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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown List<ItemTag> list = lensDef.tags.ToList(); list.Add((ItemTag)11); list.Add((ItemTag)4); lensDef.tags = list.ToArray(); lensDef.descriptionToken = "Fire a retalitory laser on taking <style=cIsUtility>10% max health or more</style> as damage. Laser base damage <style=cIsHealth>scales with percent of max health lost</style>, multiplied by <style=cIsUtility>1</style><style=cStack> (+1 per stack)</style>."; lensDef.pickupToken = "Fire a retalitory laser blast upon taking high damage."; HealthComponent.TakeDamageProcess += new hook_TakeDamageProcess(AddNewLens); MeteorAttackOnHighDamageBehavior.FixedUpdate += new hook_FixedUpdate(RemoveVanillaLens); } private void RemoveVanillaLens(orig_FixedUpdate orig, MeteorAttackOnHighDamageBehavior self) { } private void AddNewLens(orig_TakeDamageProcess orig, HealthComponent self, DamageInfo damageInfo) { //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: 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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: 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_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: 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_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: 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_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Expected O, but got Unknown //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Expected O, but got Unknown if (!self.alive || self.godMode || (double)self.ospTimer > 0.0 || damageInfo.rejected) { return; } if (Object.op_Implicit((Object)(object)self.body) && Object.op_Implicit((Object)(object)self.body.inventory)) { int itemCount = self.body.inventory.GetItemCount(Items.MeteorAttackOnHighDamage); if (itemCount > 0 && Object.op_Implicit((Object)(object)damageInfo.attacker) && Object.op_Implicit((Object)(object)damageInfo.attacker.GetComponent<CharacterBody>())) { CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>(); CharacterBody body = self.body; float num = damageInfo.damage / self.fullCombinedHealth * 100f; Debug.LogWarning((object)("full combined hp " + self.fullCombinedHealth)); Debug.LogWarning((object)("hp nm: " + num)); Debug.LogWarning((object)("damage: " + damageInfo.damage)); num *= 1f * (float)itemCount; if (num < 10f) { orig.Invoke(self, damageInfo); return; } Util.PlaySound("Play_golem_laser_fire", ((Component)body).gameObject); new BlastAttack { attacker = ((Component)body).gameObject, inflictor = ((Component)body).gameObject, teamIndex = TeamComponent.GetObjectTeam(((Component)body).gameObject), baseDamage = body.damage * num, baseForce = 500f, position = component.corePosition, radius = 1f, falloffModel = (FalloffModel)0 }.Fire(); EffectData val = new EffectData { origin = component.corePosition, start = body.corePosition }; EffectManager.SpawnEffect(muzzleEffectPrefab, new EffectData { origin = body.corePosition }, true); EffectManager.SpawnEffect(tracerEffectPrefab, val, true); EffectManager.SpawnEffect(hitEffectPrefab, val, true); } } orig.Invoke(self, damageInfo); } } public class WarBonds { private ItemDef bondDef = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC2/Items/GoldOnStageStart/GoldOnStageStart.asset").WaitForCompletion(); private static GameObject orbitalProjectile = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Junk/Captain/CaptainAirstrikeProjectile2.prefab").WaitForCompletion(); public WarBonds() { //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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown orbitalProjectile.AddComponent<ProjectileGlue>(); orbitalProjectile.AddComponent<ProjectileTargetComponent>(); bondDef.nameToken = "Orbital Launch Codes"; bondDef.descriptionToken = "10% chance on hit to launch an orbital probe that deals <style=cIsUtility>750%</style> <style=cStack>(+750% per stack)</style> total damage."; bondDef.pickupToken = "10% chance on hit to launch an orbital probe."; GlobalEventManager.ProcessHitEnemy += new hook_ProcessHitEnemy(NewWarBond); GoldOnStageStartBehaviour.OnEnable += new hook_OnEnable(RemoveVanillaBondOnEnable); GoldOnStageStartBehaviour.OnDisable += new hook_OnDisable(RemoveVanillaBondOnDisable); } private void RemoveVanillaBondOnEnable(orig_OnEnable orig, GoldOnStageStartBehaviour self) { } private void RemoveVanillaBondOnDisable(orig_OnDisable orig, GoldOnStageStartBehaviour self) { } private void NewWarBond(orig_ProcessHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim) { //IL_00ca: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, damageInfo, victim); if ((double)damageInfo.procCoefficient == 0.0 || damageInfo.rejected || !NetworkServer.active || !Object.op_Implicit((Object)(object)damageInfo.attacker)) { return; } CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>(); if (!Object.op_Implicit((Object)(object)component)) { return; } CharacterMaster master = component.master; if (!Object.op_Implicit((Object)(object)master)) { return; } Inventory inventory = master.inventory; if (!((ProcChainMask)(ref damageInfo.procChainMask)).HasProc((ProcType)22)) { int itemCount = inventory.GetItemCount(Items.GoldOnStageStart); if (itemCount > 0 && Util.CheckRoll(10f * damageInfo.procCoefficient, master)) { float num = (float)(7.5 + 7.5 * (double)itemCount); float damage = Util.OnHitProcDamage(damageInfo.damage, component.damage, num); ProcChainMask procChainMask = default(ProcChainMask); ((ProcChainMask)(ref procChainMask)).AddProc((ProcType)22); ProjectileManager.instance.FireProjectile(new FireProjectileInfo { projectilePrefab = orbitalProjectile, position = damageInfo.position, rotation = Quaternion.identity, owner = damageInfo.attacker, damage = damage, force = 1000f, crit = damageInfo.crit, damageColorIndex = (DamageColorIndex)3, target = victim, procChainMask = procChainMask }); } } } } } namespace SOTSItemRework.Items.Green { public class ChanceDoll { private ItemDef dollDef = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC2/Items/ExtraShrineItem/ExtraShrineItem.asset").WaitForCompletion(); public ChanceDoll() { //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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown dollDef.descriptionToken = "Increase Luck by <style=cIsUtility>20%</style> <style=cStack>(+20% per stack)</style>."; dollDef.pickupToken = "Increase Luck by 20%."; ShrineChanceBehavior.AddShrineStack += new Manipulator(RemoveVanillaDoll); CharacterMaster.OnInventoryChanged += new hook_OnInventoryChanged(AddDecimalLuck); Util.CheckRoll_float_float_CharacterMaster += new hook_CheckRoll_float_float_CharacterMaster(CalculateDecimalLuck); } private void RemoveVanillaDoll(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "ExtraShrineItem") })) { val.Remove(); val.Emit<SOTSItemRework>(OpCodes.Ldsfld, "emptyItem"); } else { Debug.LogError((object)"SOTSItemRework: Removing vanilla Doll hook failed."); } } private void AddDecimalLuck(orig_OnInventoryChanged orig, CharacterMaster self) { orig.Invoke(self); if (self.inventory.GetItemCount(Items.ExtraShrineItem) > 0) { self.luck = 0f; self.luck += (float)self.inventory.GetItemCount(Items.Clover); self.luck -= (float)self.inventory.GetItemCount(Items.LunarBadLuck); self.luck += 0.2f * (float)self.inventory.GetItemCount(Items.ExtraShrineItem); } } private bool CalculateDecimalLuck(orig_CheckRoll_float_float_CharacterMaster orig, float percentChance, float luck, CharacterMaster effectOriginMaster) { if ((double)luck <= 0.0 || (double)luck % 1.0 == 0.0) { return orig.Invoke(percentChance, luck, effectOriginMaster); } if ((double)percentChance <= 0.0) { return false; } int num = Mathf.FloorToInt(Mathf.Abs(luck)); float num2 = Mathf.Abs(luck) - (float)num; float num3 = Random.Range(0f, 100f); for (int i = 0; i < num; i++) { float num4 = Random.Range(0f, 100f); num3 = (((double)luck > 0.0) ? Mathf.Min(num3, num4) : Mathf.Max(num3, num4)); } if ((double)num2 > 0.0) { float num5 = Random.Range(0f, 100f); if ((double)luck > 0.0 && (double)num5 < (double)num2 * 100.0) { float num6 = Random.Range(0f, 100f); num3 = Mathf.Min(num3, num6); } } if ((double)num3 > (double)percentChance) { return false; } if (Object.op_Implicit((Object)(object)effectOriginMaster)) { GameObject bodyObject = effectOriginMaster.GetBodyObject(); if (Object.op_Implicit((Object)(object)bodyObject)) { CharacterBody component = bodyObject.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component)) { component.wasLucky = true; } } } return true; } } public class NoxiousThorn { private ItemDef thornDef = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC2/Items/TriggerEnemyDebuffs/TriggerEnemyDebuffs.asset").WaitForCompletion(); private GameObject blightedMissile = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ElitePoison/UrchinSeekingProjectile.prefab").WaitForCompletion(), "BlightedThornMissileNux", false); public NoxiousThorn() { //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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Expected O, but got Unknown //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Expected O, but got Unknown Object.Destroy((Object)(object)blightedMissile.GetComponent<ProjectileSimple>()); Object.Destroy((Object)(object)blightedMissile.GetComponent<ProjectileDirectionalTargetFinder>()); Object.Destroy((Object)(object)blightedMissile.GetComponent<ProjectileSteerTowardTarget>()); blightedMissile.GetComponent<ProjectileDamage>().damageType = DamageTypeCombo.op_Implicit((DamageType)1048576); Rigidbody component = blightedMissile.GetComponent<Rigidbody>(); component.collisionDetectionMode = (CollisionDetectionMode)0; component.useGravity = true; component.freezeRotation = false; blightedMissile.AddComponent<QuaternionPID>().gain = 25f; MissileController obj = blightedMissile.AddComponent<MissileController>(); obj.acceleration = 3f; obj.deathTimer = 16f; obj.maxSeekDistance = 100f; obj.maxVelocity = 35f; obj.turbulence = 1f; obj.delayTimer = 0.3f; obj.giveupTimer = 8f; ContentAddition.AddProjectile(blightedMissile); thornDef.descriptionToken = "<style=cIsUtility>15%</style> chance to fire a seeking thorn that deals <style=cIsUtility>75%</style> <style=cStack>(+75% per stack)</style> total damage and blights enemies."; thornDef.pickupToken = "Chance to fire a blighted seeking thorn."; GlobalEventManager.ProcessHitEnemy += new hook_ProcessHitEnemy(NewThorn); CharacterBody.TriggerEnemyDebuffs += new hook_TriggerEnemyDebuffs(RemoveVanillaThorn); } private void RemoveVanillaThorn(orig_TriggerEnemyDebuffs orig, CharacterBody self, DamageInfo damageInfo) { } private void NewThorn(orig_ProcessHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim) { //IL_00ca: 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) orig.Invoke(self, damageInfo, victim); if ((double)damageInfo.procCoefficient == 0.0 || damageInfo.rejected || !NetworkServer.active || !Object.op_Implicit((Object)(object)damageInfo.attacker)) { return; } CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>(); if (!Object.op_Implicit((Object)(object)component)) { return; } CharacterMaster master = component.master; if (!Object.op_Implicit((Object)(object)master)) { return; } Inventory inventory = master.inventory; if (!((ProcChainMask)(ref damageInfo.procChainMask)).HasProc((ProcType)1)) { int itemCount = inventory.GetItemCount(Items.TriggerEnemyDebuffs); if (itemCount > 0 && Util.CheckRoll(15f * damageInfo.procCoefficient, master)) { float num = 0.75f * (float)itemCount; float num2 = Util.OnHitProcDamage(damageInfo.damage, component.damage, num); Util.PlaySound("Play_elite_antiHeal_turret_shot", ((Component)component).gameObject); MissileUtils.FireMissile(component.corePosition, component, damageInfo.procChainMask, victim, num2, damageInfo.crit, blightedMissile, (DamageColorIndex)3, true); } } } } public class PrayerBeads { private ItemDef beadsDef = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC2/Items/ExtraStatsOnLevelUp/ExtraStatsOnLevelUp.asset").WaitForCompletion(); public PrayerBeads() { //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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown beadsDef.descriptionToken = "Grows in power by absorbing experience, storing <style=cIsUtility>5%</style> <style=cStack>(+5% per item stack)</style> of player stats per item level up."; beadsDef.pickupToken = "Stores experience and gives stats on item level up."; CharacterBody.RecalculateStats += new Manipulator(RemoveRemovalFunctionality); CharacterBody.prayerBeadCalculateAppliedStats += new Manipulator(ReduceBeadStats); CharacterBody.RecalculateStats += new hook_RecalculateStats(AddRemovalLogic); } private void AddRemovalLogic(orig_RecalculateStats orig, CharacterBody self) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (Object.op_Implicit((Object)(object)self.inventory) && self.inventory.GetItemCount(Items.ExtraStatsOnLevelUp) <= 0 && self.GetBuffCount(Buffs.ExtraStatsOnLevelUpBuff) > 0) { self.SetBuffCount(Buffs.ExtraStatsOnLevelUpBuff.buffIndex, 0); } } private void ReduceBeadStats(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); if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0.2f) })) { val.Next.Operand = 0.05f; } else { Debug.LogError((object)"SOTSItemRework: Tweaking Beads stats hook failed."); } } private void RemoveRemovalFunctionality(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "ExtraStatsOnLevelUp") })) { val.Remove(); val.Emit<SOTSItemRework>(OpCodes.Ldsfld, "emptyItem"); } else { Debug.LogError((object)"SOTSItemRework: Removing vanilla Beads hook failed."); } } } public class UnstableTransmitter { private ItemDef transmitterDef = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC2/Items/TeleportOnLowHealth/TeleportOnLowHealth.asset").WaitForCompletion(); private static EquipmentDef transmitterEquip; public UnstableTransmitter() { //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_0025: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Expected O, but got Unknown //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Expected O, but got Unknown //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Expected O, but got Unknown //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Expected O, but got Unknown transmitterDef.deprecatedTier = (ItemTier)5; transmitterDef.tier = (ItemTier)5; transmitterEquip = ScriptableObject.CreateInstance<EquipmentDef>(); transmitterEquip.appearsInMultiPlayer = true; transmitterEquip.appearsInSinglePlayer = true; transmitterEquip.canBeRandomlyTriggered = false; transmitterEquip.canDrop = false; transmitterEquip.colorIndex = (ColorIndex)5; transmitterEquip.cooldown = 20f; transmitterEquip.isLunar = false; transmitterEquip.isBoss = false; transmitterEquip.enigmaCompatible = false; transmitterEquip.pickupIconSprite = SOTSItemRework.transmitterEquipIcon; transmitterEquip.pickupModelPrefab = transmitterDef.pickupModelPrefab; transmitterEquip.nameToken = transmitterDef.nameToken; ((Object)transmitterEquip).name = "transmitter"; transmitterEquip.descriptionToken = "Enter a dimensional rift, teleporting forwards and damaging nearby enemies for <style=cIsUtility>400%</style> base damage when entering and exiting the rift."; transmitterEquip.pickupToken = "Enter a dimensional rift, teleporting forwards and damaging nearby enemies when entering and exiting the rift."; transmitterEquip.loreToken = transmitterDef.loreToken; ContentAddition.AddEquipmentDef(transmitterEquip); EquipmentSlot.PerformEquipmentAction += new hook_PerformEquipmentAction(PerformEquipmentAction); TeleportOnLowHealthBehavior.Start += new hook_Start(RemoveVanillaTransmitterStart); TeleportOnLowHealthBehavior.Update += new hook_Update(RemoveVanillaTransmitterUpdate); TeleportOnLowHealthBehavior.OnDisable += new hook_OnDisable(RemoveVanillaTransmitterDisable); } private bool PerformEquipmentAction(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef) { if (!((Object)(object)equipmentDef == (Object)(object)transmitterEquip)) { return orig.Invoke(self, equipmentDef); } return ActivateEquipment(self); } protected bool ActivateEquipment(EquipmentSlot slot) { EntityStateMachine[] components = ((Component)slot.characterBody).GetComponents<EntityStateMachine>(); foreach (EntityStateMachine val in components) { if (val.customName == "Body") { val.SetInterruptState((EntityState)(object)new TransmitterBlink(), (InterruptPriority)5); } } return true; } private void RemoveVanillaTransmitterStart(orig_Start orig, TeleportOnLowHealthBehavior self) { } private void RemoveVanillaTransmitterUpdate(orig_Update orig, TeleportOnLowHealthBehavior self) { } private void RemoveVanillaTransmitterDisable(orig_OnDisable orig, TeleportOnLowHealthBehavior self) { } } }