using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using AK.Wwise; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.Bandit2; using EntityStates.Barrel; using EntityStates.BossGroupHealNovaController; using EntityStates.BrotherMonster; using EntityStates.CaptainSupplyDrop; using EntityStates.Drifter; using EntityStates.Engi.Mine; using EntityStates.FalseSon; using EntityStates.FalseSonBoss; using EntityStates.FriendUnit; using EntityStates.GoldGat; using EntityStates.GolemMonster; using EntityStates.Halcyonite; using EntityStates.Headstompers; using EntityStates.ImpBossMonster; using EntityStates.JellyfishMonster; using EntityStates.JunkCube; using EntityStates.LaserTurbine; using EntityStates.Mage; using EntityStates.MinePod; using EntityStates.Missions.Goldshores; using EntityStates.MushroomShield; using EntityStates.ParentMonster; using EntityStates.QuestVolatileBattery; using EntityStates.QuestVolatileBatteryQuality; using EntityStates.ScavMonster; using EntityStates.Seeker; using EntityStates.SharedSufferingOrb; using EntityStates.SolusAmalgamator; using EntityStates.SurvivorPod.BatteryPanel; using EntityStates.TimedChest; using EntityStates.VagrantMonster; using EntityStates.VagrantNovaItem; using HG; using HG.Coroutines; using HG.GeneralSerializer; using HG.Reflection; using IL.EntityStates; using IL.EntityStates.Bandit2; using IL.EntityStates.BrotherMonster; using IL.EntityStates.CaptainSupplyDrop; using IL.EntityStates.Chef; using IL.EntityStates.Drifter; using IL.EntityStates.Drone.DroneBombardment; using IL.EntityStates.Drone.DroneJunk; using IL.EntityStates.FalseSon; using IL.EntityStates.FalseSonBoss; using IL.EntityStates.GoldGat; using IL.EntityStates.GolemMonster; using IL.EntityStates.Halcyonite; using IL.EntityStates.Headstompers; using IL.EntityStates.ImpBossMonster; using IL.EntityStates.JellyfishMonster; using IL.EntityStates.JunkCube; using IL.EntityStates.Mage; using IL.EntityStates.ParentMonster; using IL.EntityStates.RoboBallBoss.Weapon; using IL.EntityStates.ScavMonster; using IL.EntityStates.Seeker; using IL.EntityStates.SolusAmalgamator; using IL.EntityStates.TimedChest; using IL.EntityStates.VagrantMonster; using IL.EntityStates.VagrantNovaItem; using IL.RoR2; using IL.RoR2.Items; using IL.RoR2.Orbs; using IL.RoR2.Projectile; using IL.RoR2.Stats; using IL.RoR2.UI; using IL.RoR2.UI.LogBook; using IL.RoR2.VoidRaidCrab; using ItemQualities; using ItemQualities.Buffs; using ItemQualities.Config; using ItemQualities.ContentManagement; using ItemQualities.Equipments; using ItemQualities.Items; using ItemQualities.ModCompatibility; using ItemQualities.Networking; using ItemQualities.Orbs; using ItemQualities.Utilities; using ItemQualities.Utilities.Extensions; using KinematicCharacterController; using Mono.Cecil; using Mono.Cecil.Cil; using Mono.Collections.Generic; using MonoMod.Cil; using MonoMod.RuntimeDetour; using MonoMod.Utils; using On.EntityStates.Drifter; using On.EntityStates.FalseSon; using On.EntityStates.LaserTurbine; using On.EntityStates.Missions.Goldshores; using On.EntityStates.SurvivorPod.BatteryPanel; using On.EntityStates.TimedChest; using On.RoR2; using On.RoR2.Artifacts; using On.RoR2.Items; using On.RoR2.Orbs; using On.RoR2.Projectile; using On.RoR2.SolusWingGrid; using On.RoR2.Stats; using On.RoR2.UI; using On.RoR2.UI.LogBook; using R2API; using R2API.Networking; using R2API.Networking.Interfaces; using R2API.Utils; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.Artifacts; using RoR2.Audio; using RoR2.CharacterAI; using RoR2.ContentManagement; using RoR2.DirectionalSearch; using RoR2.EntitlementManagement; using RoR2.ExpansionManagement; using RoR2.HudOverlay; using RoR2.Items; using RoR2.Navigation; using RoR2.Orbs; using RoR2.Projectile; using RoR2.Skills; using RoR2.SolusWingGrid; using RoR2.UI; using RoR2.UI.LogBook; using RoR2.VoidRaidCrab; using RoR2BepInExPack.GameAssetPaths.Version_1_39_0; using RoR2BepInExPack.GameAssetPathsBetter; using RoR2BepInExPack.Utilities; using ShaderSwapper; using TMPro; using Unity; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.Serialization; using UnityEngine.UI; using VultureHunter; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: NetworkCompatibility(/*Could not decode attribute arguments.*/)] [assembly: OptIn] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] namespace EntityStates.SprintArmorDash { public sealed class SprintArmorDashBounce : EntityState { private static readonly SphereSearch _dashSphereSearch = new SphereSearch(); private static EffectIndex _hitEffectIndex = (EffectIndex)(-1); private CharacterBody _attachedBody; [NonSerialized] public Vector3 dashDirection; [NonSerialized] public Vector3 attackPos; [SystemInitializer(new Type[] { typeof(EffectCatalogUtils) })] private static void Init() { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 _hitEffectIndex = EffectCatalogUtils.FindEffectIndex("OmniImpactVFX"); if ((int)_hitEffectIndex == -1) { Log.Warning("Failed to find hit effect index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EntityStates\\SprintArmorDash\\SprintArmorDashBounce.cs", "Init", 33); } } public override void OnSerialize(NetworkWriter writer) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).OnSerialize(writer); writer.Write(dashDirection); writer.Write(attackPos); } public override void OnDeserialize(NetworkReader reader) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).OnDeserialize(reader); dashDirection = reader.ReadVector3(); attackPos = reader.ReadVector3(); } public override void OnEnter() { //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Invalid comparison between Unknown and I4 //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Expected O, but got Unknown //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Expected O, but got Unknown //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).OnEnter(); NetworkedBodyAttachment component = ((EntityState)this).GetComponent(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.attachedBody)) { return; } _attachedBody = component.attachedBody; if (((EntityState)this).isAuthority) { IPhysMotor obj; if (!Object.op_Implicit((Object)(object)_attachedBody.characterMotor)) { obj = ((Component)_attachedBody).GetComponent(); } else { IPhysMotor characterMotor = (IPhysMotor)(object)_attachedBody.characterMotor; obj = characterMotor; } if (obj != null) { PhysForceInfo val = default(PhysForceInfo); ((PhysForceInfo)(ref val)).resetVelocity = true; val.force = new Vector3((0f - dashDirection.x) * 20f, 20f, (0f - dashDirection.z) * 20f); ((PhysForceInfo)(ref val)).ignoreGroundStick = true; ((PhysForceInfo)(ref val)).massIsOne = true; obj.ApplyForceImpulse(ref val); } base.outer.SetNextStateToMain(); } if (!NetworkServer.active) { return; } List list = default(List); DisposableRental> val2 = CollectionPool>.RentCollection(ref list); try { _dashSphereSearch.origin = _attachedBody.corePosition; _dashSphereSearch.mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask; _dashSphereSearch.radius = _attachedBody.radius + 12f; _dashSphereSearch.RefreshCandidates(); _dashSphereSearch.FilterCandidatesByHurtBoxTeam(TeamMask.GetUnprotectedTeams(_attachedBody.teamComponent.teamIndex)); _dashSphereSearch.FilterCandidatesByDistinctHurtBoxEntities(); _dashSphereSearch.GetHurtBoxes(list); _dashSphereSearch.ClearCandidates(); SetStateOnHurt val5 = default(SetStateOnHurt); foreach (HurtBox item in list) { if (Object.op_Implicit((Object)(object)item) && Object.op_Implicit((Object)(object)item.healthComponent) && Object.op_Implicit((Object)(object)item.healthComponent.body)) { if ((int)_hitEffectIndex != -1) { EffectData val3 = new EffectData { origin = ((Component)item).transform.position }; val3.SetHurtBoxReference(item); EffectManager.SpawnEffect(_hitEffectIndex, val3, true); } DamageInfo val4 = new DamageInfo { damage = 0f, attacker = ((Component)_attachedBody).gameObject, inflictor = ((EntityState)this).gameObject, procCoefficient = 0f, position = attackPos, crit = _attachedBody.RollCrit(), inflictedHurtbox = item, canRejectForce = false, physForceFlags = (PhysForceFlags)15 }; if (item.healthComponent.body.isChampion) { val4.force = Vector3.zero; } else { val4.force = dashDirection * 50f; } item.healthComponent.TakeDamageForce(val4, false, false); GlobalEventManager.instance.OnHitEnemy(val4, ((Component)item.healthComponent).gameObject); GlobalEventManager.instance.OnHitAll(val4, ((Component)item.healthComponent).gameObject); if (((Component)item.healthComponent).TryGetComponent(ref val5) && val5.canBeStunned) { val5.SetStun(1f); StunChanceOnHit.OnImmobilize(_attachedBody, item.healthComponent.body); } ItemQualityCounts itemCountsEffective = _attachedBody.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.SprintArmor); float num = itemCountsEffective.UncommonCount * 3 + itemCountsEffective.RareCount * 6 + itemCountsEffective.EpicCount * 9 + itemCountsEffective.LegendaryCount * 12; item.healthComponent.body.AddTimedBuff(ItemQualitiesContent.Buffs.SprintArmorWeaken, num); } } } finally { val2.Dispose(); } } } public sealed class SprintArmorDashDashingState : EntityState { private static readonly SphereSearch _dashSphereSearch = new SphereSearch(); private static EffectIndex _blinkEffectIndex; private CharacterBody _attachedBody; private IPhysMotor _motor; private Vector3 _dashDirection; private bool _stoppedDash; [SystemInitializer(new Type[] { typeof(EffectCatalogUtils) })] private static void Init() { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 _blinkEffectIndex = EffectCatalogUtils.FindEffectIndex("HuntressBlinkEffect"); if ((int)_blinkEffectIndex == -1) { Log.Warning("Failed to find blink effect index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EntityStates\\SprintArmorDash\\SprintArmorDashDashingState.cs", "Init", 29); } } public override void OnEnter() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013e: 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) ((EntityState)this).OnEnter(); NetworkedBodyAttachment component = ((EntityState)this).GetComponent(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.attachedBody)) { return; } _attachedBody = component.attachedBody; _dashDirection = _attachedBody.inputBank.aimDirection; IPhysMotor motor; if (!Object.op_Implicit((Object)(object)_attachedBody.characterMotor)) { motor = ((Component)_attachedBody).GetComponent(); } else { IPhysMotor characterMotor = (IPhysMotor)(object)_attachedBody.characterMotor; motor = characterMotor; } _motor = motor; if (((EntityState)this).isAuthority) { _attachedBody.isSprinting = true; } if (NetworkServer.active) { int num = _attachedBody.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.SprintArmor).HighestQuality switch { QualityTier.Uncommon => 20, QualityTier.Rare => 15, QualityTier.Epic => 10, QualityTier.Legendary => 5, _ => 30, }; for (int i = 0; i < num; i++) { _attachedBody.AddTimedBuff(ItemQualitiesContent.Buffs.SprintArmorDashCooldown, (float)i); } _attachedBody.AddBuff(Buffs.IgnoreFallDamage); } EffectData val = new EffectData(); val.rotation = Util.QuaternionSafeLookRotation(_dashDirection); val.origin = _attachedBody.corePosition; EffectManager.SpawnEffect(_blinkEffectIndex, val, false); } public override void OnExit() { if (NetworkServer.active && Object.op_Implicit((Object)(object)_attachedBody)) { _attachedBody.RemoveBuff(Buffs.IgnoreFallDamage); _attachedBody.AddTimedBuff(Buffs.IgnoreFallDamage, 0.2f); } ((EntityState)this).OnExit(); } public override void FixedUpdate() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); if (!Object.op_Implicit((Object)(object)_attachedBody)) { if (((EntityState)this).isAuthority) { base.outer.SetNextStateToMain(); } return; } if (NetworkServer.active) { _attachedBody.isSprinting = true; } if (_attachedBody.hasEffectiveAuthority && _motor != null) { PhysForceInfo val; if (((EntityState)this).fixedAge < 0.1f) { IPhysMotor motor = _motor; val = default(PhysForceInfo); ((PhysForceInfo)(ref val)).resetVelocity = true; val.force = _dashDirection * (Time.deltaTime * _attachedBody.moveSpeed * 1000f); ((PhysForceInfo)(ref val)).ignoreGroundStick = true; ((PhysForceInfo)(ref val)).massIsOne = true; motor.ApplyForceImpulse(ref val); } else if (!_stoppedDash) { _stoppedDash = true; IPhysMotor motor2 = _motor; val = default(PhysForceInfo); ((PhysForceInfo)(ref val)).resetVelocity = true; val.force = _dashDirection * (_attachedBody.moveSpeed * 3f); ((PhysForceInfo)(ref val)).ignoreGroundStick = true; ((PhysForceInfo)(ref val)).massIsOne = true; motor2.ApplyForceImpulse(ref val); } } if (((EntityState)this).isAuthority) { if (((EntityState)this).fixedAge > 0.2f) { base.outer.SetNextStateToMain(); } tryAttack(); } } private void tryAttack() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) List list = default(List); DisposableRental> val = CollectionPool>.RentCollection(ref list); try { _dashSphereSearch.origin = _attachedBody.corePosition; _dashSphereSearch.mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask; _dashSphereSearch.radius = _attachedBody.radius + 3f; _dashSphereSearch.RefreshCandidates(); _dashSphereSearch.FilterCandidatesByHurtBoxTeam(TeamMask.GetUnprotectedTeams(_attachedBody.teamComponent.teamIndex)); _dashSphereSearch.FilterCandidatesByDistinctHurtBoxEntities(); _dashSphereSearch.GetHurtBoxes(list); _dashSphereSearch.ClearCandidates(); if (list.Count > 0) { SprintArmorDashBounce sprintArmorDashBounce = new SprintArmorDashBounce(); sprintArmorDashBounce.attackPos = _attachedBody.corePosition; sprintArmorDashBounce.dashDirection = _dashDirection; base.outer.SetNextState((EntityState)(object)sprintArmorDashBounce); } } finally { val.Dispose(); } } } public sealed class SprintArmorDashIdle : EntityState { public static float DoubleTapWindow; private float _lastValidInputTime = float.NegativeInfinity; private CharacterBody _attachedBody; public override void OnEnter() { ((EntityState)this).OnEnter(); NetworkedBodyAttachment component = ((EntityState)this).GetComponent(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.attachedBody)) { _attachedBody = component.attachedBody; } } public override void Update() { ((EntityState)this).Update(); if (Object.op_Implicit((Object)(object)_attachedBody) && ((EntityState)this).isAuthority) { UpdateAuthority(); } } private void UpdateAuthority() { if (!_attachedBody.HasBuff(ItemQualitiesContent.Buffs.SprintArmorDashCooldown) && ((ButtonState)(ref _attachedBody.inputBank.rawMoveUp)).justPressed) { if (((EntityState)this).age - _lastValidInputTime <= DoubleTapWindow) { base.outer.SetNextState((EntityState)(object)new SprintArmorDashDashingState()); } _lastValidInputTime = ((EntityState)this).age; } } } } namespace EntityStates.SharedSufferingOrb { public sealed class SharedSufferingOrbDeath : EntityState { private static GameObject _deathEffectPrefab; public static float ExplosionDamageCoefficient; public static float ExplosionForce; [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle handle = AddressableUtil.LoadTempAssetAsync(RoR2_Base_WeeklyRun.TimeCrystalDeath_prefab); handle.OnSuccess(delegate(GameObject timeCrystalDeath) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown _deathEffectPrefab = PrefabAPI.InstantiateClone(timeCrystalDeath, "SharedSufferingOrbDeathEffect", false); args.ContentPack.effectDefs.Add(new EffectDef(_deathEffectPrefab)); }); return handle.AsProgressCoroutine>(args.ProgressReceiver); } public override void OnEnter() { ((EntityState)this).OnEnter(); explode(); } private void explode() { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0159: 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_018c: 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_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: 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) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Expected O, but got Unknown //IL_0247: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator)) { if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator.modelBaseTransform)) { EntityState.Destroy((Object)(object)((Component)((EntityState)this).modelLocator.modelBaseTransform).gameObject); } if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator.modelTransform)) { EntityState.Destroy((Object)(object)((Component)((EntityState)this).modelLocator.modelTransform).gameObject); } } SharedSufferingOrbController component = ((EntityState)this).GetComponent(); float num = (Object.op_Implicit((Object)(object)component) ? component.BlastRadius : 0f); if (Object.op_Implicit((Object)(object)_deathEffectPrefab)) { EffectManager.SpawnEffect(_deathEffectPrefab, new EffectData { origin = ((EntityState)this).transform.position, scale = num, rotation = Quaternion.identity }, false); } if (NetworkServer.active) { GenericOwnership component2 = ((EntityState)this).GetComponent(); GameObject val = (Object.op_Implicit((Object)(object)component2) ? component2.ownerObject : null); CharacterBody val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponent() : null); TeamIndex val3 = (TeamIndex)((!Object.op_Implicit((Object)(object)val2)) ? (-1) : ((int)val2.teamComponent.teamIndex)); Vector3 position = ((EntityState)this).transform.position; float damage = ExplosionDamageCoefficient * (Object.op_Implicit((Object)(object)val2) ? val2.damage : Run.instance.teamlessDamageCoefficient); foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList) { if (FriendlyFireManager.ShouldSplashHitProceed(readOnlyInstances.healthComponent, val3) && !((Object)(object)readOnlyInstances == (Object)(object)val2) && !((Object)(object)readOnlyInstances == (Object)(object)((EntityState)this).characterBody) && !(Vector3.Distance(readOnlyInstances.corePosition, position) >= num)) { DamageInfo val4 = new DamageInfo { attacker = val, inflictor = ((EntityState)this).gameObject, damage = damage, crit = (Object.op_Implicit((Object)(object)val2) && val2.RollCrit()), damageType = DamageTypeCombo.op_Implicit((DamageType)131072), damageColorIndex = (DamageColorIndex)16, procCoefficient = 0f, position = position }; float explosionForce = ExplosionForce; Vector3 val5 = readOnlyInstances.corePosition - position; val4.force = explosionForce * ((Vector3)(ref val5)).normalized + ExplosionForce * 0.5f * Vector3.up; DamageInfo val6 = val4; DamageAPI.AddModdedDamageType(ref val6.damageType, DamageTypes.ForceAddToSharedSuffering); readOnlyInstances.healthComponent.TakeDamage(val6); GlobalEventManager.instance.OnHitEnemy(val6, ((Component)readOnlyInstances).gameObject); GlobalEventManager.instance.OnHitAll(val6, ((Component)readOnlyInstances).gameObject); } } } EntityState.Destroy((Object)(object)((EntityState)this).gameObject); } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)9; } } } namespace EntityStates.QuestVolatileBatteryQuality { public sealed class QuestVolatileBatteryQualityCountDown : QuestVolatileBatteryBaseState { private static GameObject _countdownEffectPrefab; public static float duration; public static float explosionRadius; private GameObject _countdownEffectInstance; [SystemInitializer(new Type[] { })] private static 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) AsyncOperationHandle handle = AddressableUtil.LoadAssetAsync(RoR2_Base_QuestVolatileBattery.VolatileBatteryPreDetonation_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject volatileBatteryPreDetonation) { _countdownEffectPrefab = volatileBatteryPreDetonation; }); } public override void OnEnter() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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) ((QuestVolatileBatteryBaseState)this).OnEnter(); if (Object.op_Implicit((Object)(object)_countdownEffectPrefab) && Object.op_Implicit((Object)(object)((QuestVolatileBatteryBaseState)this).networkedBodyAttachment.attachedBody)) { GameObject val = Object.Instantiate(_countdownEffectPrefab, ((QuestVolatileBatteryBaseState)this).networkedBodyAttachment.attachedBody.transform); val.transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); val.transform.localScale = Vector3.one * ((QuestVolatileBatteryBaseState)this).networkedBodyAttachment.attachedBody.bestFitActualRadius; _countdownEffectInstance = val; } } public override void OnExit() { if (Object.op_Implicit((Object)(object)_countdownEffectInstance)) { EntityState.Destroy((Object)(object)_countdownEffectInstance); } ((EntityState)this).OnExit(); } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (NetworkServer.active) { FixedUpdateServer(); } } private void FixedUpdateServer() { if (((EntityState)this).fixedAge >= duration) { QuestVolatileBattery.Detonate(((EntityState)this).gameObject); EntityState.Destroy((Object)(object)((EntityState)this).gameObject); } } } public sealed class QuestVolatileBatteryQualityMonitor : QuestVolatileBatteryBaseState { [NonSerialized] public static GameObject qualityBatteryPreDetonationEffect; private GameObject _vfxInstance; [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle handle = AddressableUtil.LoadTempAssetAsync(RoR2_Base_QuestVolatileBattery.VolatileBatteryPreDetonation_prefab); handle.OnSuccess(delegate(GameObject volatileBatteryPreDetonationPrefab) { //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_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) qualityBatteryPreDetonationEffect = PrefabAPI.InstantiateClone(volatileBatteryPreDetonationPrefab, "QualityVolatileBatteryPreDetonation", false); ShakeEmitter val = default(ShakeEmitter); if (qualityBatteryPreDetonationEffect.TryGetComponent(ref val)) { EntityState.Destroy((Object)(object)val); } LoopSound val2 = default(LoopSound); if (qualityBatteryPreDetonationEffect.TryGetComponent(ref val2)) { EntityState.Destroy((Object)(object)val2); } Transform val3 = qualityBatteryPreDetonationEffect.transform.Find("PP"); if (Object.op_Implicit((Object)(object)val3)) { EntityState.Destroy((Object)(object)((Component)val3).gameObject); } Transform val4 = qualityBatteryPreDetonationEffect.transform.Find("LightShafts"); if (Object.op_Implicit((Object)(object)val4)) { EntityState.Destroy((Object)(object)((Component)val4).gameObject); } Transform val5 = qualityBatteryPreDetonationEffect.transform.Find("Pulse"); if (Object.op_Implicit((Object)(object)val5)) { EntityState.Destroy((Object)(object)((Component)val5).gameObject); } Transform val6 = qualityBatteryPreDetonationEffect.transform.Find("Sparks, Trail"); ParticleSystem val7 = default(ParticleSystem); if (Object.op_Implicit((Object)(object)val6) && ((Component)val6).TryGetComponent(ref val7)) { MainModule main = val7.main; ((MainModule)(ref main)).simulationSpeed = 0.5f; EmissionModule emission = val7.emission; ((EmissionModule)(ref emission)).rateOverTimeMultiplier = 10f; } args.ContentPack.prefabs.Add(qualityBatteryPreDetonationEffect); }); return handle.AsProgressCoroutine>(args.ProgressReceiver); } public override void OnEnter() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) ((QuestVolatileBatteryBaseState)this).OnEnter(); _vfxInstance = Object.Instantiate(qualityBatteryPreDetonationEffect, ((QuestVolatileBatteryBaseState)this).networkedBodyAttachment.attachedBody.transform); _vfxInstance.transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); _vfxInstance.transform.localScale = Vector3.one * ((QuestVolatileBatteryBaseState)this).networkedBodyAttachment.attachedBody.bestFitActualRadius; } public override void OnExit() { ((EntityState)this).OnExit(); if (Object.op_Implicit((Object)(object)_vfxInstance)) { EntityState.Destroy((Object)(object)_vfxInstance); } } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (NetworkServer.active) { FixedUpdateServer(); } } private void FixedUpdateServer() { if (Object.op_Implicit((Object)(object)((QuestVolatileBatteryBaseState)this).attachedHealthComponent) && ((QuestVolatileBatteryBaseState)this).attachedHealthComponent.combinedHealthFraction <= 0.5f) { ((EntityState)this).outer.SetNextState((EntityState)(object)new QuestVolatileBatteryQualityCountDown()); } } } } namespace EntityStates.MushroomShield { public abstract class MushroomBubbleBaseState : EntityState { [NonSerialized] public float EffectRadius; public override void OnSerialize(NetworkWriter writer) { ((EntityState)this).OnSerialize(writer); writer.Write(EffectRadius); } public override void OnDeserialize(NetworkReader reader) { ((EntityState)this).OnDeserialize(reader); EffectRadius = reader.ReadSingle(); } public override void ModifyNextState(EntityState nextState) { ((EntityState)this).ModifyNextState(nextState); if (nextState is MushroomBubbleBaseState mushroomBubbleBaseState) { mushroomBubbleBaseState.EffectRadius = EffectRadius; } } public abstract void Undeploy(bool immediate); } public sealed class MushroomBubbleDeploy : MushroomBubbleBaseState { public static string StartSoundString; private CharacterBody _ownerBody; private float _startMoveStopwatchValue; private float _undeployLifetime; public override void OnEnter() { //IL_00f6: 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) ((EntityState)this).OnEnter(); Util.PlaySound(StartSoundString, ((EntityState)this).gameObject); GenericOwnership component = ((EntityState)this).GetComponent(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.ownerObject)) { return; } _ownerBody = component.ownerObject.GetComponent(); if (Object.op_Implicit((Object)(object)_ownerBody) && Object.op_Implicit((Object)(object)_ownerBody.inventory)) { ItemQualityCounts itemCountsEffective = _ownerBody.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Mushroom); _undeployLifetime = itemCountsEffective.UncommonCount + 3 * itemCountsEffective.RareCount + 6 * itemCountsEffective.EpicCount + 12 * itemCountsEffective.LegendaryCount; float num = 30f; switch (itemCountsEffective.HighestQuality) { case QualityTier.Uncommon: num = 30f; break; case QualityTier.Rare: num = 25f; break; case QualityTier.Epic: num = 20f; break; case QualityTier.Legendary: num = 15f; break; } EffectRadius = num; ((EntityState)this).transform.localScale = Vector3.one * (num / 20f); _startMoveStopwatchValue = _ownerBody.notMovingStopwatch; } } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (((EntityState)this).isAuthority && (!Object.op_Implicit((Object)(object)_ownerBody) || !Object.op_Implicit((Object)(object)_ownerBody.healthComponent) || !_ownerBody.healthComponent.alive || _ownerBody.notMovingStopwatch < _startMoveStopwatchValue)) { Undeploy(immediate: false); } } public override void Undeploy(bool immediate) { if (((EntityState)this).isAuthority) { if (immediate) { ((EntityState)this).outer.SetNextState((EntityState)(object)new MushroomBubbleFlashOut()); return; } ((EntityState)this).outer.SetNextState((EntityState)(object)new MushroomBubbleUndeploy { Duration = _undeployLifetime }); } } } public sealed class MushroomBubbleFlashOut : MushroomBubbleBaseState { private static EffectIndex _bubbleShieldEndEffect = (EffectIndex)(-1); public static string EndSoundString; public static float Duration; private BeginRapidlyActivatingAndDeactivating _blinkController; [SystemInitializer(new Type[] { typeof(EffectCatalogUtils) })] private static void Init() { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 _bubbleShieldEndEffect = EffectCatalogUtils.FindEffectIndex("BubbleShieldEndEffect"); if ((int)_bubbleShieldEndEffect == -1) { Log.Warning("Failed to find charge effect index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EntityStates\\MushroomShield\\MushroomBubbleFlashOut.cs", "Init", 16); } } public override void OnEnter() { ((EntityState)this).OnEnter(); _blinkController = ((EntityState)this).GetComponent(); if (Object.op_Implicit((Object)(object)_blinkController)) { _blinkController.delayBeforeBeginningBlinking = 0f; _blinkController.fixedAge = 0f; ((Behaviour)_blinkController).enabled = true; } } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= Duration) { EntityState.Destroy((Object)(object)((EntityState)this).gameObject); } } public override void OnExit() { //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_0010: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown ((EntityState)this).OnExit(); EffectManager.SpawnEffect(_bubbleShieldEndEffect, new EffectData { origin = ((EntityState)this).transform.position, rotation = ((EntityState)this).transform.rotation, scale = EffectRadius }, false); Util.PlaySound(EndSoundString, ((EntityState)this).gameObject); if (Object.op_Implicit((Object)(object)_blinkController)) { ((Behaviour)_blinkController).enabled = false; } } public override void Undeploy(bool immediate) { } } public sealed class MushroomBubbleUndeploy : MushroomBubbleBaseState { [NonSerialized] public float Duration; public override void OnSerialize(NetworkWriter writer) { base.OnSerialize(writer); writer.Write(Duration); } public override void OnDeserialize(NetworkReader reader) { base.OnDeserialize(reader); Duration = reader.ReadSingle(); } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= Duration - MushroomBubbleFlashOut.Duration) { Undeploy(immediate: true); } } public override void Undeploy(bool immediate) { if (((EntityState)this).isAuthority && immediate) { ((EntityState)this).outer.SetNextState((EntityState)(object)new MushroomBubbleFlashOut()); } } } } namespace EntityStates.FriendUnit { public sealed class FriendUnitPunt : BaseState { public static float BaseVelocity; public static float MaxLockOnAngle; public static float MaxDistance; public static float LaunchHorizontalSpeedMultiplier; public static string PuntSound; [NonSerialized] public GameObject Punter; [NonSerialized] public Ray AimRay; public override void OnSerialize(NetworkWriter writer) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).OnSerialize(writer); writer.Write(Punter); writer.Write(AimRay); } public override void OnDeserialize(NetworkReader reader) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).OnDeserialize(reader); Punter = reader.ReadGameObject(); AimRay = reader.ReadRay(); } public override void OnEnter() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_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_0152: 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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0197: 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_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Expected O, but got Unknown if (((EntityState)this).isAuthority) { ((EntityState)this).characterBody.isSprinting = true; } ((BaseState)this).OnEnter(); if (((EntityState)this).isAuthority) { CharacterBody val = (Object.op_Implicit((Object)(object)Punter) ? Punter.GetComponent() : null); BullseyeSearch val2 = new BullseyeSearch { searchOrigin = ((Ray)(ref AimRay)).origin, searchDirection = ((Ray)(ref AimRay)).direction, viewer = val, filterByLoS = true, filterByDistinctEntity = true, maxAngleFilter = MaxLockOnAngle, maxDistanceFilter = MaxDistance, sortMode = (SortMode)2, queryTriggerInteraction = (QueryTriggerInteraction)1, teamMaskFilter = TeamMask.GetEnemyTeams(TeamComponent.GetObjectTeam(Punter)) }; val2.RefreshCandidates(); IPhysMotor val3 = null; if (Object.op_Implicit((Object)(object)val)) { IPhysMotor obj; if (!Object.op_Implicit((Object)(object)val.characterMotor)) { obj = ((Component)val).GetComponent(); } else { IPhysMotor characterMotor = (IPhysMotor)(object)val.characterMotor; obj = characterMotor; } val3 = obj; } Vector3 val4 = Vector3.zero; if (val3 != null) { val4 = val3.velocity; } Vector3 val5 = val4; val5.y = 0f; float num = ((Vector3)(ref val5)).magnitude + BaseVelocity + base.moveSpeedStat * LaunchHorizontalSpeedMultiplier; Vector3 force = ((Ray)(ref AimRay)).direction * num; using (IEnumerator enumerator = val2.GetResults().GetEnumerator()) { if (enumerator.MoveNext()) { HurtBox current = enumerator.Current; force = Trajectory.CalculateInitialVelocityFromHSpeed(((EntityState)this).transform.position, ((Component)current).transform.position, num, 0f, float.PositiveInfinity); } } CharacterMotor characterMotor2 = ((EntityState)this).characterMotor; PhysForceInfo val6 = new PhysForceInfo { force = force }; ((PhysForceInfo)(ref val6)).massIsOne = true; ((PhysForceInfo)(ref val6)).disableAirControlUntilCollision = true; ((PhysForceInfo)(ref val6)).resetVelocity = true; ((PhysForceInfo)(ref val6)).ignoreGroundStick = true; characterMotor2.ApplyForceImpulse(ref val6); ((EntityState)this).characterMotor.onMovementHit += new MovementHitDelegate(onMovementHit); } Util.PlaySound(PuntSound, ((EntityState)this).gameObject); } public override void OnExit() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown ((EntityState)this).OnExit(); if (((EntityState)this).isAuthority) { ((EntityState)this).characterBody.isSprinting = false; ((EntityState)this).characterMotor.onMovementHit -= new MovementHitDelegate(onMovementHit); } } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (((EntityState)this).isAuthority) { ((EntityState)this).characterBody.isSprinting = true; } } private void onMovementHit(ref MovementHitInfo movementHitInfo) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).outer.SetNextState((EntityState)(object)new FriendUnitPuntImpact { Punter = Punter, ImpactPoint = movementHitInfo.hitPoint, ImpactNormal = movementHitInfo.hitNormal, ImpactVelocity = movementHitInfo.velocity, DamageMultiplierFromSpeed = Mathf.Max(1f, ((Vector3)(ref movementHitInfo.velocity)).magnitude / base.moveSpeedStat) }); } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)7; } } public sealed class FriendUnitPuntImpact : BaseState { private static EffectIndex _explosionEffectIndex = (EffectIndex)(-1); public static float ImpactBounciness; public static string ImpactSoundString; public static float ReturnVelocityMaxAngleDelta; public static float ReturnVelocityMaxMagnitudeMultiplier = 1f; [NonSerialized] public GameObject Punter; [NonSerialized] public Vector3 ImpactPoint; [NonSerialized] public Vector3 ImpactNormal; [NonSerialized] public Vector3 ImpactVelocity; [NonSerialized] public float DamageMultiplierFromSpeed; [SystemInitializer(new Type[] { typeof(EffectCatalogUtils) })] private static void Init() { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 _explosionEffectIndex = EffectCatalogUtils.FindEffectIndex("OmniExplosionVFXRoboBallDeath"); if ((int)_explosionEffectIndex == -1) { Log.Error("Failed to find explosion effect index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EntityStates\\FriendUnit\\FriendUnitPuntImpact.cs", "Init", 21); } } public override void OnSerialize(NetworkWriter writer) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).OnSerialize(writer); writer.Write(Punter); writer.Write(ImpactPoint); writer.Write(ImpactNormal); writer.Write(ImpactVelocity); writer.Write(DamageMultiplierFromSpeed); } public override void OnDeserialize(NetworkReader reader) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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) ((EntityState)this).OnDeserialize(reader); Punter = reader.ReadGameObject(); ImpactPoint = reader.ReadVector3(); ImpactNormal = reader.ReadVector3(); ImpactVelocity = reader.ReadVector3(); DamageMultiplierFromSpeed = reader.ReadSingle(); } public override void OnEnter() { //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0273: 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_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: 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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Expected O, but got Unknown //IL_01df: 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) //IL_01eb: Invalid comparison between Unknown and I4 //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Expected O, but got Unknown ((BaseState)this).OnEnter(); if (NetworkServer.active) { CharacterMaster master = ((EntityState)this).characterBody.master; ItemQualityCounts itemQualityCounts = default(ItemQualityCounts); if (Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)master.minionOwnership.ownerMaster) && Object.op_Implicit((Object)(object)master.minionOwnership.ownerMaster.inventory)) { itemQualityCounts = master.minionOwnership.ownerMaster.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.PhysicsProjectile); } if (itemQualityCounts.TotalQualityCount == 0) { itemQualityCounts.UncommonCount = 1; } float num; switch (itemQualityCounts.HighestQuality) { case QualityTier.Uncommon: num = 4f; break; case QualityTier.Rare: num = 6f; break; case QualityTier.Epic: num = 8f; break; case QualityTier.Legendary: num = 10f; break; default: Log.Error($"Quality tier {itemQualityCounts.HighestQuality} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EntityStates\\FriendUnit\\FriendUnitPuntImpact.cs", "OnEnter", 101); num = 1f; break; } float radius = 10f * (float)itemQualityCounts.UncommonCount + 15f * (float)itemQualityCounts.RareCount + 25f * (float)itemQualityCounts.EpicCount + 35f * (float)itemQualityCounts.LegendaryCount; radius = ExplodeOnDeath.GetExplosionRadius(radius, ((EntityState)this).characterBody); BlastAttack val = new BlastAttack { position = ImpactPoint, radius = radius, baseDamage = num * base.damageStat * DamageMultiplierFromSpeed, damageType = new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)32), (DamageTypeExtended)0, (DamageSource)1), crit = ((BaseState)this).RollCrit(), attacker = (Object.op_Implicit((Object)(object)Punter) ? Punter : ((EntityState)this).gameObject), inflictor = ((EntityState)this).gameObject, attackerFiltering = (AttackerFiltering)2, damageColorIndex = (DamageColorIndex)3, falloffModel = (FalloffModel)3, procCoefficient = 1f, teamIndex = ((BaseState)this).GetTeam() }; val.Fire(); if ((int)_explosionEffectIndex != -1) { EffectManager.SpawnEffect(_explosionEffectIndex, new EffectData { origin = val.position, scale = val.radius }, true); } } Util.PlaySound(ImpactSoundString, ((EntityState)this).gameObject); EffectManager.SimpleImpactEffect(KineticAura.knockbackEffectPrefab, ImpactPoint, -ImpactNormal, false); if (!((EntityState)this).isAuthority) { return; } if (ImpactVelocity == Vector3.zero) { ImpactVelocity = ((EntityState)this).characterMotor.velocity; } Vector3 val3; if (ImpactNormal != Vector3.zero) { Vector3 val2 = Vector3.Reflect(((Vector3)(ref ImpactVelocity)).normalized, ImpactNormal); float num2 = ((Vector3)(ref ImpactVelocity)).magnitude * ImpactBounciness; val3 = val2 * num2; } else { val3 = ((EntityState)this).characterMotor.velocity * (0f - ImpactBounciness); } if (Object.op_Implicit((Object)(object)Punter)) { Vector3 val4 = Trajectory.CalculateInitialVelocityFromHSpeed(((EntityState)this).transform.position, Punter.transform.position, ((Vector3)(ref ImpactVelocity)).magnitude, 0f, float.PositiveInfinity); float num3 = Mathf.Min(((Vector3)(ref val4)).magnitude / ((Vector3)(ref val3)).magnitude, ReturnVelocityMaxMagnitudeMultiplier); Quaternion val5 = Quaternion.identity; if (ReturnVelocityMaxAngleDelta > 0f) { val5 = Quaternion.FromToRotation(val3, val4); Vector3 val6 = default(Vector3); float num4 = default(float); ((Quaternion)(ref val5)).ToAngleAxis(ref num4, ref val6); num4 = Mathf.MoveTowardsAngle(0f, num4, ReturnVelocityMaxAngleDelta); val5 = Quaternion.AngleAxis(num4, val6); } val3 = val5 * val3 * num3; } CharacterMotor characterMotor = ((EntityState)this).characterMotor; PhysForceInfo val7 = new PhysForceInfo { force = val3 }; ((PhysForceInfo)(ref val7)).resetVelocity = true; ((PhysForceInfo)(ref val7)).disableAirControlUntilCollision = true; ((PhysForceInfo)(ref val7)).ignoreGroundStick = true; ((PhysForceInfo)(ref val7)).massIsOne = true; characterMotor.ApplyForceImpulse(ref val7); ((EntityState)this).outer.SetNextStateToMain(); } } } namespace EntityStates.BossGroupHealNovaController { public sealed class BossGroupHealNovaPulse : EntityState { private sealed class HealPulse { private readonly HashSet _healedTargets = new HashSet(); private readonly SphereSearch _sphereSearch; private readonly float _duration; private readonly float _finalRadius; private readonly float _healFractionValue; private readonly TeamMask _teamMask; private readonly List _hurtBoxesList = new List(); private float _timeElapsed; public HealPulse(Vector3 origin, float finalRadius, float healFractionValue, float duration, TeamIndex teamIndex) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) _sphereSearch = new SphereSearch { mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask, origin = origin, queryTriggerInteraction = (QueryTriggerInteraction)2, radius = 0f }; _finalRadius = finalRadius; _healFractionValue = healFractionValue; _duration = duration; _teamMask = default(TeamMask); ((TeamMask)(ref _teamMask)).AddTeam(teamIndex); } public void Update(float deltaTime) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) _timeElapsed += deltaTime; float num = Mathf.Clamp01(_timeElapsed / _duration); _sphereSearch.radius = _finalRadius * NovaRadiusCurve.Evaluate(num); _sphereSearch.RefreshCandidates().FilterCandidatesByHurtBoxTeam(_teamMask).FilterCandidatesByDistinctHurtBoxEntities() .GetHurtBoxes(_hurtBoxesList); foreach (HurtBox hurtBoxes in _hurtBoxesList) { if (_healedTargets.Add(hurtBoxes.healthComponent)) { healTarget(hurtBoxes.healthComponent); } } _hurtBoxesList.Clear(); } private void healTarget(HealthComponent target) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) target.HealFraction(_healFractionValue, default(ProcChainMask)); Util.PlaySound("Play_item_proc_TPhealingNova_hitPlayer", ((Component)target).gameObject); } } public static AnimationCurve NovaRadiusCurve; public static float GrowDuration; public static float LingerDuration; private float _totalDuration; private Transform _effectTransform; private HealPulse _healPulse; private float _radius; public override void OnEnter() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).OnEnter(); _totalDuration = GrowDuration + LingerDuration; BossGroupHealNovaSpawner bossGroupHealNovaSpawner = default(BossGroupHealNovaSpawner); if (Object.op_Implicit((Object)(object)((EntityState)this).transform.parent) && ((Component)((EntityState)this).transform.parent).TryGetComponent(ref bossGroupHealNovaSpawner)) { _radius = bossGroupHealNovaSpawner.NovaRadius; } TeamFilter component = ((EntityState)this).GetComponent(); TeamIndex teamIndex = (TeamIndex)((!Object.op_Implicit((Object)(object)component)) ? (-1) : ((int)component.teamIndex)); if (NetworkServer.active) { _healPulse = new HealPulse(((EntityState)this).transform.position, _radius, 0.5f, GrowDuration, teamIndex); } _effectTransform = ((EntityState)this).transform.Find("PulseEffect"); if (Object.op_Implicit((Object)(object)_effectTransform)) { ((Component)_effectTransform).gameObject.SetActive(true); } } public override void OnExit() { if (Object.op_Implicit((Object)(object)_effectTransform)) { ((Component)_effectTransform).gameObject.SetActive(false); } ((EntityState)this).OnExit(); } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (NetworkServer.active) { _healPulse.Update(((EntityState)this).GetDeltaTime()); if (((EntityState)this).fixedAge >= _totalDuration) { EntityState.Destroy((Object)(object)((Component)base.outer).gameObject); } } } public override void Update() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_effectTransform)) { float num = _radius * NovaRadiusCurve.Evaluate(Mathf.Clamp01(((EntityState)this).fixedAge / GrowDuration)); _effectTransform.localScale = new Vector3(num, num, num); } } } public sealed class BossGroupHealNovaWindup : EntityState { private static EffectIndex _chargeEffectIndex = (EffectIndex)(-1); public static float Duration; [SystemInitializer(new Type[] { typeof(EffectCatalogUtils) })] private static void Init() { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 _chargeEffectIndex = EffectCatalogUtils.FindEffectIndex("ChargeTPHealingNova"); if ((int)_chargeEffectIndex == -1) { Log.Warning("Failed to find charge effect index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EntityStates\\BossGroupHealNovaController\\BossGroupHealNovaWindup.cs", "Init", 16); } } public override void OnEnter() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown ((EntityState)this).OnEnter(); if ((int)_chargeEffectIndex != -1) { EffectManager.SpawnEffect(_chargeEffectIndex, new EffectData { origin = ((EntityState)this).transform.position }, false); } } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= Duration) { base.outer.SetNextStateToMain(); } } } } namespace System.Runtime.CompilerServices { internal static class IsExternalInit { } } namespace ItemQualities { internal static class AnimationEffectSetExplosionScalePatch { private const int ExplosionInfoBitOffset = 8; private const int ExplosionInfoBitMask = 65280; public static void SetEncodedExplosionIndex(AnimationEvent evnt, ExplosionInfoIndex explosionInfoIndex) { evnt.intParameter = EncodeExplosionIndex(evnt.intParameter, explosionInfoIndex); } public static int EncodeExplosionIndex(int intParameter, ExplosionInfoIndex explosionInfoIndex) { if (explosionInfoIndex >= (ExplosionInfoIndex)255) { Log.Error($"Cannot encode explosion index larger than 255 ({explosionInfoIndex})", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\AnimationEffectSetExplosionScalePatch.cs", "EncodeExplosionIndex", 26); return intParameter; } return (intParameter & -65281) | (((int)(explosionInfoIndex + 1) << 8) & 0xFF00); } public static ExplosionInfoIndex GetExplosionIndex(AnimationEvent evnt) { int intParameter = evnt.intParameter; DecodeExplosionIndex(ref intParameter, out var explosionInfoIndex); evnt.intParameter = intParameter; return explosionInfoIndex; } public static void DecodeExplosionIndex(ref int intParameter, out ExplosionInfoIndex explosionInfoIndex) { explosionInfoIndex = (ExplosionInfoIndex)(((intParameter & 0xFF00) >> 8) - 1); if (explosionInfoIndex < ExplosionInfoIndex.None || (int)explosionInfoIndex > ExplosionInfoCatalog.ExplosionInfoDefCount) { Log.Error($"Out of bounds explosion index encoded in intParameter, likely data overlap (param={intParameter}, explosionIndex={explosionInfoIndex})", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\AnimationEffectSetExplosionScalePatch.cs", "DecodeExplosionIndex", 47); explosionInfoIndex = ExplosionInfoIndex.None; } intParameter &= -65281; } [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown AnimationEvents.CreateEffect += new Manipulator(AnimationEvents_CreateEffect); } private static void AnimationEvents_CreateEffect(ILContext il) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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_00fa: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find AnimationEvent parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\AnimationEffectSetExplosionScalePatch.cs", "AnimationEvents_CreateEffect", 64); return; } ILCursor val = new ILCursor(il); VariableDefinition val2 = il.AddVariable(); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)GetExplosionIndex); val.Emit(OpCodes.Stloc, val2); VariableDefinition effectDataVar = null; if (!val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchNewobj(x), (Instruction x) => x.MatchStloc(typeof(EffectData), il, out effectDataVar) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\AnimationEffectSetExplosionScalePatch.cs", "AnimationEvents_CreateEffect", 81); return; } val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc, effectDataVar); val.Emit(OpCodes.Ldloc, val2); val.EmitDelegate>((Action)tryApplyExplosionScale); static void tryApplyExplosionScale(AnimationEvents self, EffectData effectData, ExplosionInfoIndex explosionInfoIndex) { if (explosionInfoIndex != ExplosionInfoIndex.None) { float defaultRange = ExplosionInfoCatalog.GetExplosionInfoDef(explosionInfoIndex).GetDefaultRange(); GameObject val3 = (Object.op_Implicit((Object)(object)self) ? self.bodyObject : null); CharacterBody val4 = (Object.op_Implicit((Object)(object)val3) ? val3.GetComponent() : null); effectData.scale = (Object.op_Implicit((Object)(object)val4) ? ExplodeOnDeath.GetExplosionRadius(defaultRange, val4) : defaultRange); } } } } internal static class AnimationPrefabSetOwnershipPatch { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown AnimationEvents.CreatePrefab += new Manipulator(AnimationEvents_CreatePrefab); } private static void AnimationEvents_CreatePrefab(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int num = 0; MethodReference val2 = default(MethodReference); while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val2) && val2 != null && ((MemberReference)val2).Name?.StartsWith("g__DoSpawnEffect|") == true })) { val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Action)onPrefabSpawned); num++; } if (num == 0) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\AnimationPrefabSetOwnershipPatch.cs", "AnimationEvents_CreatePrefab", 58); } static void onPrefabSpawned(Transform prefabTransform, AnimationEvents animationEvents) { LocalEffectOwnership localEffectOwnership = default(LocalEffectOwnership); if (Object.op_Implicit((Object)(object)prefabTransform) && ((Component)prefabTransform).TryGetComponent(ref localEffectOwnership)) { GameObject ownerObject = (Object.op_Implicit((Object)(object)animationEvents.bodyObject) ? animationEvents.bodyObject : ((!Object.op_Implicit((Object)(object)animationEvents.entityLocator)) ? ((Component)animationEvents).gameObject : animationEvents.entityLocator.entity)); localEffectOwnership.OwnerObject = ownerObject; } } } } [DefaultExecutionOrder(-1000)] public sealed class AssignAddressableReferences : MonoBehaviour, IAsyncContentLoadCallback { [Serializable] public sealed class ComponentFieldAddressableAssignment { [Tooltip("The object to assign the field on")] [SerializeField] [FormerlySerializedAs("TargetObject")] private Object _targetObject; [SerializeField] [HideInInspector] private Component _targetObjectComponent; [Tooltip("If set, the first component of this type will be located on the Target Object and used as the field instance")] [RequiredBaseType(typeof(Component))] public SerializableSystemType TargetObjectComponentType; [Tooltip("The name of the field or property to set")] public string FieldName; [Tooltip("Address of the asset to load")] public AssetReferenceT AssetReference = new AssetReferenceT(string.Empty); [Tooltip("Determines what type is used to load the asset, if not set, the type of the field/property is used")] [RequiredBaseType(typeof(Object))] public SerializableSystemType AssetTypeOverride; public Object TargetObject { get { if (!Object.op_Implicit((Object)(object)_targetObjectComponent)) { return _targetObject; } return (Object)(object)_targetObjectComponent; } } public void OnValidate() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) _targetObjectComponent = null; Type type = (Type)TargetObjectComponentType; if (!(type != null) || !Object.op_Implicit(_targetObject)) { return; } Object targetObject = _targetObject; GameObject val = (GameObject)(object)((targetObject is GameObject) ? targetObject : null); if (val == null) { Component val2 = (Component)(object)((targetObject is Component) ? targetObject : null); if (val2 != null) { _targetObjectComponent = val2.GetComponent(type); } } else { _targetObjectComponent = val.GetComponent(type); } } } public ComponentFieldAddressableAssignment[] FieldAssignments = Array.Empty(); [SerializeField] [HideInInspector] private bool _hasLoaded; public bool HasLoaded => _hasLoaded; private void Awake() { if (!_hasLoaded) { Log.Warning(Util.GetGameObjectHierarchyName(((Component)this).gameObject) + ": Addressable references were not assigned to prefab during init, loading assets now", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\AssignAddressableReferences.cs", "Awake", 32); IEnumerator enumerator = AssignFieldsAsync>(); while (enumerator.MoveNext()) { } } } IEnumerator IAsyncContentLoadCallback.OnContentLoad(TProgress progressReceiver) { return AssignFieldsAsync(progressReceiver); } public IEnumerator AssignFieldsAsync(TProgress progressReceiver = default(TProgress)) where TProgress : IProgress { if (FieldAssignments.Length != 0) { if (progressReceiver != null) { ParallelProgressCoroutine val = new ParallelProgressCoroutine((IProgress)progressReceiver); ComponentFieldAddressableAssignment[] fieldAssignments = FieldAssignments; foreach (ComponentFieldAddressableAssignment arg in fieldAssignments) { val.AddProgressCoroutine(assignComponentFieldAsync>, arg); } yield return val; } else { ParallelCoroutine val2 = new ParallelCoroutine(); ComponentFieldAddressableAssignment[] fieldAssignments = FieldAssignments; foreach (ComponentFieldAddressableAssignment componentFieldAssignment in fieldAssignments) { val2.Add(assignComponentFieldAsync>(componentFieldAssignment)); } yield return val2; } } _hasLoaded = true; ((Behaviour)this).enabled = false; } private IEnumerator assignComponentFieldAsync(ComponentFieldAddressableAssignment componentFieldAssignment, TProgress progressReceiver = default(TProgress)) where TProgress : IProgress { if (!Object.op_Implicit(componentFieldAssignment.TargetObject)) { yield break; } Type type = ((object)componentFieldAssignment.TargetObject).GetType(); Type memberType; MemberInfo targetMember = findTargetMember(type, componentFieldAssignment.FieldName, out memberType); if (targetMember == null) { Log.Error($"Failed to find field '{componentFieldAssignment.FieldName}' on component {componentFieldAssignment.TargetObject}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\AssignAddressableReferences.cs", "assignComponentFieldAsync", 88); yield break; } Type assetType = ((Type)componentFieldAssignment.AssetTypeOverride) ?? memberType; AsyncOperationHandle assetLoadHandle = AddressableUtil.LoadAssetAsync((AssetReference)(object)componentFieldAssignment.AssetReference, assetType, (AsyncReferenceHandleUnloadType)2); try { yield return assetLoadHandle.AsProgressCoroutine(progressReceiver); AssignAddressableReferences assignAddressableReferences = this; object result = ((AsyncOperationHandle)(ref assetLoadHandle)).Result; assignAddressableReferences.applyFieldValue(componentFieldAssignment, targetMember, (Object)((result is Object) ? result : null)); } finally { AddressableUtil.UnloadAsset((AssetReference)(object)componentFieldAssignment.AssetReference, assetType); } } private void applyFieldValue(ComponentFieldAddressableAssignment componentFieldAssignment, MemberInfo member, Object value) { Type type = ((object)componentFieldAssignment.TargetObject).GetType(); object runtimeKey = ((AssetReference)componentFieldAssignment.AssetReference).RuntimeKey; if (!Object.op_Implicit(value)) { Log.Warning($"{Util.GetGameObjectHierarchyName(((Component)this).gameObject)} ({type.FullName}.{componentFieldAssignment.FieldName}): Null asset loaded for asset {runtimeKey}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\AssignAddressableReferences.cs", "applyFieldValue", 114); } try { if (!(member is FieldInfo fieldInfo)) { if (member is PropertyInfo propertyInfo) { propertyInfo.SetValue(componentFieldAssignment.TargetObject, value); } } else { fieldInfo.SetValue(componentFieldAssignment.TargetObject, value); } } catch (Exception ex) { Log.Error_NoCallerPrefix($"{Util.GetGameObjectHierarchyName(((Component)this).gameObject)}: Failed to set field {type.FullName}.{componentFieldAssignment.FieldName} to asset {value} from {runtimeKey}: {ex}"); } } private void OnValidate() { //IL_00d1: Unknown result type (might be due to invalid IL or missing references) ComponentFieldAddressableAssignment[] fieldAssignments = FieldAssignments; foreach (ComponentFieldAddressableAssignment componentFieldAddressableAssignment in fieldAssignments) { componentFieldAddressableAssignment.OnValidate(); if (!Object.op_Implicit(componentFieldAddressableAssignment.TargetObject)) { continue; } Type type = ((object)componentFieldAddressableAssignment.TargetObject).GetType(); if (findTargetMember(type, componentFieldAddressableAssignment.FieldName, out var memberType) == null) { Debug.LogWarning((object)("Field or property '" + componentFieldAddressableAssignment.FieldName + "' does not exist in type " + type.FullName), (Object)(object)this); continue; } if (!typeof(Object).IsAssignableFrom(memberType)) { Debug.LogWarning((object)("Invalid type " + memberType.FullName + " on field " + type.FullName + "." + componentFieldAddressableAssignment.FieldName + " (must be UnityEngine.Object)"), (Object)(object)this); } Type type2 = (Type)componentFieldAddressableAssignment.AssetTypeOverride; if (type2 != null && !memberType.IsAssignableFrom(type2)) { Debug.LogWarning((object)("Asset type " + type2.FullName + " cannot be assigned to field of type " + memberType.FullName + " (" + type.FullName + "." + componentFieldAddressableAssignment.FieldName + ")"), (Object)(object)this); } } } private static MemberInfo findTargetMember(Type componentType, string fieldName, out Type memberType) { FieldInfo field = componentType.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { memberType = field.FieldType; return field; } PropertyInfo property = componentType.GetProperty(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null) { memberType = property.PropertyType; return property; } memberType = null; return null; } } internal static class AttackCollisionHooks { [SystemInitializer(new Type[] { })] private static void Init() { //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 BulletAttack.DefaultFilterCallbackImplementation += new hook_DefaultFilterCallbackImplementation(BulletAttack_DefaultFilterCallbackImplementation); OverlapAttack.HurtBoxPassesFilter += new hook_HurtBoxPassesFilter(OverlapAttack_HurtBoxPassesFilter); BlastAttack.CollectHits += new Manipulator(BlastAttack_CollectHits); } private static bool BulletAttack_DefaultFilterCallbackImplementation(orig_DefaultFilterCallbackImplementation orig, BulletAttack bulletAttack, ref BulletHit hitInfo) { if (!orig.Invoke(bulletAttack, ref hitInfo)) { return false; } try { if (Object.op_Implicit((Object)(object)bulletAttack.owner) && bulletAttack.owner.TryGetComponentCached(out ObjectCollisionManager component) && component.IgnoresCollisionsWith(hitInfo.collider)) { return false; } } catch (Exception ex) { Log.Error_NoCallerPrefix(ex.ToString()); } return true; } private static bool OverlapAttack_HurtBoxPassesFilter(orig_HurtBoxPassesFilter orig, OverlapAttack self, HurtBox hurtBox) { if (!orig.Invoke(self, hurtBox)) { return false; } try { if (Object.op_Implicit((Object)(object)hurtBox) && Object.op_Implicit((Object)(object)self.attacker) && self.attacker.TryGetComponentCached(out ObjectCollisionManager component) && component.IgnoresCollisionsWith(hurtBox.collider)) { return false; } } catch (Exception ex) { Log.Error_NoCallerPrefix(ex.ToString()); } return true; } private static void BlastAttack_CollectHits(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_008e: 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_00bf: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); VariableDefinition hurtBoxVar = null; ILLabel hurtBoxInvalidLabel = null; if (!val.TryGotoNext((MoveType)2, new Func[3] { (Instruction x) => x.MatchLdloc(typeof(HurtBox), il, out hurtBoxVar), (Instruction x) => x.MatchImplicitConversion(), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref hurtBoxInvalidLabel) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\AttackCollisionHooks.cs", "BlastAttack_CollectHits", 72); return; } val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc, hurtBoxVar); val.EmitDelegate>((Func)attackerIgnoresCollisionWith); val.Emit(OpCodes.Brtrue, (object)hurtBoxInvalidLabel); static bool attackerIgnoresCollisionWith(BlastAttack blastAttack, HurtBox hurtBox) { if (Object.op_Implicit((Object)(object)hurtBox) && Object.op_Implicit((Object)(object)hurtBox.collider) && blastAttack != null && Object.op_Implicit((Object)(object)blastAttack.attacker) && blastAttack.attacker.TryGetComponentCached(out ObjectCollisionManager component) && component.IgnoresCollisionsWith(hurtBox.collider)) { return true; } return false; } } } public sealed class AxisBillboard : MonoBehaviour { public Vector3 Axis = Vector3.up; private void OnEnable() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown SceneCamera.onSceneCameraPreCull += new SceneCameraDelegate(onSceneCameraPreCull); } private void OnDisable() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown SceneCamera.onSceneCameraPreCull -= new SceneCameraDelegate(onSceneCameraPreCull); } private void onSceneCameraPreCull(SceneCamera sceneCamera) { //IL_0006: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_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) Vector3 val = Vector3.ProjectOnPlane(((Component)this).transform.position, Axis); Vector3 val2 = Vector3.ProjectOnPlane(((Component)sceneCamera).transform.position, Axis); Transform transform = ((Component)this).transform; Vector3 val3 = val2 - val; transform.rotation = Util.QuaternionSafeLookRotation(((Vector3)(ref val3)).normalized); } } public sealed class BarrierPickup : MonoBehaviour { [Tooltip("The base object to destroy when this pickup is consumed.")] public GameObject BaseObject; [Tooltip("The team filter object which determines who can pick up this pack.")] public TeamFilter TeamFilter; public GameObject PickupEffect; public float FlatAmount; public float FractionalAmount; private bool _alive = true; private void OnTriggerStay(Collider other) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown if (!NetworkServer.active || !_alive || TeamComponent.GetObjectTeam(((Component)other).gameObject) != TeamFilter.teamIndex) { return; } CharacterBody component = ((Component)other).GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { return; } HealthComponent healthComponent = component.healthComponent; if (Object.op_Implicit((Object)(object)healthComponent)) { healthComponent.AddBarrier(FlatAmount + healthComponent.fullBarrier * FractionalAmount); if (Object.op_Implicit((Object)(object)PickupEffect)) { EffectManager.SpawnEffect(PickupEffect, new EffectData { origin = ((Component)this).transform.position }, true); } } Object.Destroy((Object)(object)BaseObject); _alive = false; } } [RequireComponent(typeof(NetworkedBodyAttachment))] public sealed class BodyAttachmentVFXController : MonoBehaviour, INetworkedBodyAttachmentListener { public enum RadiusMode { Constant, BodyRadius, BodyBestFitRadius, BodyBestFitActualRadius } [SerializeField] private InstantiateAddressablePrefab _bodyVFXInstantiator; [SerializeField] private RadiusMode _radiusMode = RadiusMode.BodyRadius; [SerializeField] [Min(0f)] private float _radiusMultiplier = 1f; private NetworkedBodyAttachment _bodyAttachment; private void Awake() { _bodyAttachment = ((Component)this).GetComponent(); _bodyVFXInstantiator.OnInstantiated += onVFXInstantiated; } private void OnDestroy() { _bodyVFXInstantiator.OnInstantiated -= onVFXInstantiated; } private void onVFXInstantiated(GameObject vfx) { //IL_0098: Unknown result type (might be due to invalid IL or missing references) TemporaryVisualEffect val = default(TemporaryVisualEffect); if (!vfx.TryGetComponent(ref val)) { return; } CharacterBody attachedBody = _bodyAttachment.attachedBody; if (Object.op_Implicit((Object)(object)attachedBody)) { float num = _radiusMode switch { RadiusMode.Constant => 1f, RadiusMode.BodyRadius => attachedBody.radius, RadiusMode.BodyBestFitRadius => attachedBody.bestFitRadius, RadiusMode.BodyBestFitActualRadius => attachedBody.bestFitActualRadius, _ => throw new NotImplementedException($"Radius mode {_radiusMode} is not implemented"), }; val.parentTransform = attachedBody.coreTransform; val.visualState = (VisualState)0; val.healthComponent = attachedBody.healthComponent; val.radius = num * _radiusMultiplier; LocalCameraEffect val2 = default(LocalCameraEffect); if (((Component)val).TryGetComponent(ref val2)) { val2.targetCharacter = ((Component)attachedBody).gameObject; } } } void INetworkedBodyAttachmentListener.OnAttachedBodyDiscovered(NetworkedBodyAttachment networkedBodyAttachment, CharacterBody attachedBody) { _bodyVFXInstantiator.InstantiatePrefab(); } } internal static class BoomerangProjectileHooks { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown BoomerangProjectile.FixedUpdate += new hook_FixedUpdate(BoomerangProjectile_FixedUpdate); } private static void BoomerangProjectile_FixedUpdate(orig_FixedUpdate orig, BoomerangProjectile self) { if (!Object.op_Implicit((Object)(object)self) || !((Component)(object)self).TryGetComponentCached(out BoomerangProjectileQualityController component) || !component.IsInHitPause) { orig.Invoke(self); } } } [RequireComponent(typeof(BoomerangProjectile))] public sealed class BoomerangProjectileQualityController : MonoBehaviour { public float HitPauseDuration; private BoomerangProjectile _boomerangProjectile; private bool _hasStartedHitPause; private float _hitPauseTimer; public bool IsInHitPause => _hitPauseTimer > 0f; private void Awake() { _boomerangProjectile = ((Component)this).GetComponent(); } private void OnEnable() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown ComponentCache.Add(((Component)this).gameObject, this); _boomerangProjectile.onFlyBack.AddListener(new UnityAction(onFlyBack)); } private void OnDisable() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown _boomerangProjectile.onFlyBack.RemoveListener(new UnityAction(onFlyBack)); ComponentCache.Remove(((Component)this).gameObject, this); } private void FixedUpdate() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Invalid comparison between Unknown and I4 if (NetworkServer.active) { if (IsInHitPause) { _hitPauseTimer -= Time.fixedDeltaTime; } else if (!_hasStartedHitPause && (int)_boomerangProjectile.boomerangState == 1 && _boomerangProjectile.stopwatch >= _boomerangProjectile.transitionDuration / 2f) { tryStartHitPause(); } } } private void onFlyBack() { tryStartHitPause(); } private void tryStartHitPause() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (!_hasStartedHitPause) { _hasStartedHitPause = true; _hitPauseTimer = Mathf.Max(_hitPauseTimer, HitPauseDuration); _boomerangProjectile.rigidbody.velocity = Vector3.zero; } } } public sealed class BossArenaHealNovaManager : MonoBehaviour { public BossGroup WatchingBossGroup; public float ArenaRadius = 100f; private readonly GameObject[] _healNovaSpawnersByTeam = (GameObject[])(object)new GameObject[TeamsAPICompat.TeamsCount]; [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown GridManager.OnTierSet += new hook_OnTierSet(GridManager_OnTierSet); } private static void GridManager_OnTierSet(orig_OnTierSet orig, GridManager self, int tier) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, tier); try { foreach (BossArenaHealNovaManager instances in InstanceTracker.GetInstancesList()) { Vector3 position = ((Component)instances).transform.position; position.y = self.GetLavaPosition(tier).y; instances.setPosition(position); } } catch (Exception ex) { Log.Error_NoCallerPrefix(ex.ToString()); } } private void Awake() { if (!NetworkServer.active) { Log.Warning("Created on server", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\BossArenaHealNovaManager.cs", "Awake", 49); ((Behaviour)this).enabled = false; } } private void Start() { if (Object.op_Implicit((Object)(object)WatchingBossGroup)) { updateAllTeamHealNovaManagers(); } } private void OnEnable() { InstanceTracker.Add(this); if (Object.op_Implicit((Object)(object)WatchingBossGroup)) { updateAllTeamHealNovaManagers(); } Inventory.onInventoryChangedGlobal += onInventoryChangedGlobal; BossGroup.onBossGroupDefeatedServer += onBossGroupDefeatedServer; } private void OnDisable() { InstanceTracker.Remove(this); GameObject[] healNovaSpawnersByTeam = _healNovaSpawnersByTeam; foreach (GameObject val in healNovaSpawnersByTeam) { if (Object.op_Implicit((Object)(object)val)) { Object.Destroy((Object)(object)val); } } Inventory.onInventoryChangedGlobal -= onInventoryChangedGlobal; BossGroup.onBossGroupDefeatedServer -= onBossGroupDefeatedServer; } private void onBossGroupDefeatedServer(BossGroup bossGroup) { if ((Object)(object)bossGroup == (Object)(object)WatchingBossGroup) { Object.Destroy((Object)(object)((Component)this).gameObject); } } private void onInventoryChangedGlobal(Inventory inventory) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_0015: Unknown result type (might be due to invalid IL or missing references) CharacterMaster val = default(CharacterMaster); if (((Component)inventory).TryGetComponent(ref val) && (int)val.teamIndex != -1) { updateTeamHealNovaManager(val.teamIndex); } } private void updateAllTeamHealNovaManagers() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 //IL_0005: 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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) TeamIndex val = (TeamIndex)0; while ((int)val < TeamsAPICompat.TeamsCount) { updateTeamHealNovaManager(val); val = (TeamIndex)(sbyte)(val + 1); } } private void updateTeamHealNovaManager(TeamIndex teamIndex) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected I4, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) if (!ArrayUtils.IsInBounds(_healNovaSpawnersByTeam, (int)teamIndex)) { Log.Warning($"TeamIndex {teamIndex} is not in bounds of heal nova spawners array", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\BossArenaHealNovaManager.cs", "updateTeamHealNovaManager", 122); return; } bool flag = ItemQualityUtils.GetTeamItemCounts(ItemQualitiesContent.ItemQualityGroups.TPHealingNova, teamIndex, requireAlive: true).TotalQualityCount > 0; ref GameObject reference = ref _healNovaSpawnersByTeam[teamIndex]; if (Object.op_Implicit((Object)(object)reference) != flag) { if (flag) { reference = Object.Instantiate(ItemQualitiesContent.NetworkedPrefabs.BossArenaHealNovaSpawner, ((Component)this).transform.position, ((Component)this).transform.rotation); reference.GetComponent().teamIndex = teamIndex; BossGroupHealNovaSpawner component = reference.GetComponent(); component.BossGroup = WatchingBossGroup; component.NetworkNovaRadius = ArenaRadius; NetworkServer.Spawn(reference); } else { Object.Destroy((Object)(object)reference); reference = null; } } } private void setPosition(Vector3 arenaCenter) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Invalid comparison between Unknown and I4 //IL_002e: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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) ((Component)this).transform.position = arenaCenter; GameObject[] healNovaSpawnersByTeam = _healNovaSpawnersByTeam; BossGroupHealNovaSpawner bossGroupHealNovaSpawner = default(BossGroupHealNovaSpawner); foreach (GameObject val in healNovaSpawnersByTeam) { if (Object.op_Implicit((Object)(object)val) && val.TryGetComponent(ref bossGroupHealNovaSpawner)) { bossGroupHealNovaSpawner.SetPositionServer(arenaCenter); } } TeamIndex val2 = (TeamIndex)0; while ((int)val2 < TeamsAPICompat.TeamsCount) { GameObject val3 = _healNovaSpawnersByTeam[val2]; if (Object.op_Implicit((Object)(object)val3)) { val3.transform.position = ((Component)this).transform.position; } val2 = (TeamIndex)(sbyte)(val2 + 1); } } } [RequireComponent(typeof(TeamFilter))] public sealed class BossGroupHealNovaSpawner : NetworkBehaviour { private static GameObject _pulsePrefab; public BossGroup BossGroup; public float MinSecondsBetweenPulses = 1f; [SyncVar] public float NovaRadius = 100f; private TeamFilter _teamFilter; private float _lastPulseFraction; private float _pulseAvailableTimer; private static int kRpcRpcSetPosition; public float NetworkNovaRadius { get { return NovaRadius; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref NovaRadius, 1u); } } [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle handle = AddressableUtil.LoadTempAssetAsync(RoR2_Base_TPHealingNova.TeleporterHealNovaPulse_prefab); handle.OnSuccess(delegate(GameObject novaPulse) { //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_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) _pulsePrefab = PrefabAPI.InstantiateClone(novaPulse, "BossGroupHealNovaPulse"); EntityStateMachine component = _pulsePrefab.GetComponent(); component.initialStateType = new SerializableEntityStateType(typeof(BossGroupHealNovaWindup)); component.mainStateType = new SerializableEntityStateType(typeof(BossGroupHealNovaPulse)); args.ContentPack.networkedObjectPrefabs.Add(_pulsePrefab); }); return handle.AsProgressCoroutine>(args.ProgressReceiver); } private void Awake() { _teamFilter = ((Component)this).GetComponent(); } private void Start() { if (NetworkServer.active) { _lastPulseFraction = getCurrentBossProgressFraction(); } } private void OnDisable() { ((Component)this).transform.DetachChildren(); } private void FixedUpdate() { if (NetworkServer.active) { fixedUpdateServer(Time.fixedDeltaTime); } } private void fixedUpdateServer(float deltaTime) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (_pulseAvailableTimer > 0f) { _pulseAvailableTimer -= deltaTime; return; } ItemQualityCounts teamItemCounts = ItemQualityUtils.GetTeamItemCounts(ItemQualitiesContent.ItemQualityGroups.TPHealingNova, _teamFilter.teamIndex, requireAlive: true); float nextPulseFraction = getNextPulseFraction(teamItemCounts.UncommonCount + 2 * teamItemCounts.RareCount + 3 * teamItemCounts.EpicCount + 5 * teamItemCounts.LegendaryCount, _lastPulseFraction); if (getCurrentBossProgressFraction() > nextPulseFraction) { spawnPulse(); _lastPulseFraction = nextPulseFraction; _pulseAvailableTimer = MinSecondsBetweenPulses; } } private float getCurrentBossProgressFraction() { if (!Object.op_Implicit((Object)(object)BossGroup) || !Object.op_Implicit((Object)(object)BossGroup.combatSquad)) { return 0f; } if (BossGroup.combatSquad.defeatedServer) { return 1f; } float totalMaxObservedMaxHealth = BossGroup.totalMaxObservedMaxHealth; float totalObservedHealth = BossGroup.totalObservedHealth; float num = ((totalMaxObservedMaxHealth > 0f) ? Mathf.Clamp01(totalObservedHealth / totalMaxObservedMaxHealth) : 1f); return 1f - num; } private static float getNextPulseFraction(int pulseCount, float lastPulseFraction) { float num = 1f / (float)(pulseCount + 1); for (int i = 0; i < pulseCount; i++) { float num2 = num * (float)(i + 1); if (num2 > lastPulseFraction) { return num2; } } return 1f; } private void spawnPulse() { //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_0032: Unknown result type (might be due to invalid IL or missing references) GameObject obj = Object.Instantiate(_pulsePrefab, ((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform); obj.GetComponent().teamIndex = _teamFilter.teamIndex; NetworkServer.Spawn(obj); } [Server] public void SetPositionServer(Vector3 position) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void ItemQualities.BossGroupHealNovaSpawner::SetPositionServer(UnityEngine.Vector3)' called on client"); return; } ((Component)this).transform.position = position; CallRpcSetPosition(position); } [ClientRpc] private void RpcSetPosition(Vector3 position) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.position = position; } private void UNetVersion() { } protected static void InvokeRpcRpcSetPosition(NetworkBehaviour obj, NetworkReader reader) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (!NetworkClient.active) { Debug.LogError((object)"RPC RpcSetPosition called on server."); } else { ((BossGroupHealNovaSpawner)(object)obj).RpcSetPosition(reader.ReadVector3()); } } public void CallRpcSetPosition(Vector3 position) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0041: 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) if (!NetworkServer.active) { Debug.LogError((object)"RPC Function RpcSetPosition called on client."); return; } NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)2); val.WritePackedUInt32((uint)kRpcRpcSetPosition); val.Write(((Component)this).GetComponent().netId); val.Write(position); ((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcSetPosition"); } static BossGroupHealNovaSpawner() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown kRpcRpcSetPosition = -351386061; NetworkBehaviour.RegisterRpcDelegate(typeof(BossGroupHealNovaSpawner), kRpcRpcSetPosition, new CmdDelegate(InvokeRpcRpcSetPosition)); NetworkCRC.RegisterBehaviour("BossGroupHealNovaSpawner", 0); } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { if (forceAll) { writer.Write(NovaRadius); return true; } bool flag = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(NovaRadius); } if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { if (initialState) { NovaRadius = reader.ReadSingle(); return; } int num = (int)reader.ReadPackedUInt32(); if (((uint)num & (true ? 1u : 0u)) != 0) { NovaRadius = reader.ReadSingle(); } } public override void PreStartClient() { } } [StructLayout(LayoutKind.Explicit)] public struct BuffQualityCounts : IEquatable { [FieldOffset(0)] private unsafe fixed int _buffCounts[5]; [FieldOffset(0)] public int BaseCount; [FieldOffset(4)] public int UncommonCount; [FieldOffset(8)] public int RareCount; [FieldOffset(12)] public int EpicCount; [FieldOffset(16)] public int LegendaryCount; public readonly int TotalCount { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return BaseCount + UncommonCount + RareCount + EpicCount + LegendaryCount; } } public readonly int TotalQualityCount { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return UncommonCount + RareCount + EpicCount + LegendaryCount; } } public unsafe ref int this[QualityTier qualityTier] { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return ref _buffCounts[(int)(qualityTier + 1)]; } } public unsafe readonly QualityTier HighestQuality { get { for (QualityTier qualityTier = QualityTier.Legendary; qualityTier >= QualityTier.Uncommon; qualityTier--) { if (_buffCounts[(int)(qualityTier + 1)] > 0) { return qualityTier; } } return QualityTier.None; } } public BuffQualityCounts(int baseCount, int uncommonCount, int rareCount, int epicCount, int legendaryCount) { BaseCount = Math.Max(0, baseCount); UncommonCount = Math.Max(0, uncommonCount); RareCount = Math.Max(0, rareCount); EpicCount = Math.Max(0, epicCount); LegendaryCount = Math.Max(0, legendaryCount); } public override readonly bool Equals(object obj) { if (obj is BuffQualityCounts other) { return Equals(in other); } return false; } readonly bool IEquatable.Equals(BuffQualityCounts other) { return Equals(in other); } public readonly bool Equals(in BuffQualityCounts other) { if (BaseCount == other.BaseCount && UncommonCount == other.UncommonCount && RareCount == other.RareCount && EpicCount == other.EpicCount) { return LegendaryCount == other.LegendaryCount; } return false; } public override readonly int GetHashCode() { return HashCode.Combine(BaseCount, UncommonCount, RareCount, EpicCount, LegendaryCount); } public override readonly string ToString() { return $"Normal={BaseCount}, Uncommon={UncommonCount}, Rare={RareCount}, Epic={EpicCount}, Legendary={LegendaryCount}"; } public static bool operator ==(in BuffQualityCounts left, in BuffQualityCounts right) { return left.Equals(in right); } public static bool operator !=(in BuffQualityCounts left, in BuffQualityCounts right) { return !left.Equals(in right); } public static BuffQualityCounts operator +(in BuffQualityCounts left, in BuffQualityCounts right) { return new BuffQualityCounts(left.BaseCount + right.BaseCount, left.UncommonCount + right.UncommonCount, left.RareCount + right.RareCount, left.EpicCount + right.EpicCount, left.LegendaryCount + right.LegendaryCount); } public static BuffQualityCounts operator -(in BuffQualityCounts left, in BuffQualityCounts right) { return new BuffQualityCounts(left.BaseCount - right.BaseCount, left.UncommonCount - right.UncommonCount, left.RareCount - right.RareCount, left.EpicCount - right.EpicCount, left.LegendaryCount - right.LegendaryCount); } } [CreateAssetMenu(menuName = "ItemQualities/Buffs/BuffQualityGroup")] public sealed class BuffQualityGroup : ScriptableObject, IAsyncContentLoadCallback { [NonSerialized] [HideInInspector] public BuffQualityGroupIndex GroupIndex = BuffQualityGroupIndex.Invalid; [SerializeField] internal AssetReferenceT BaseBuffReference = new AssetReferenceT(string.Empty); [SerializeField] internal BuffDef BaseBuff; [SerializeField] private BuffDef _uncommonBuff; [SerializeField] private BuffDef _rareBuff; [SerializeField] private BuffDef _epicBuff; [SerializeField] private BuffDef _legendaryBuff; [Tooltip("If set, all quality buffs in this group will be treated as an instance of the base buff by the game.")] public bool InheritBaseBuffBehavior = true; [NonSerialized] [HideInInspector] public BuffIndex BaseBuffIndex = (BuffIndex)(-1); public BuffIndex UncommonBuffIndex { get { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_uncommonBuff)) { return (BuffIndex)(-1); } return _uncommonBuff.buffIndex; } } public BuffIndex RareBuffIndex { get { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_rareBuff)) { return (BuffIndex)(-1); } return _rareBuff.buffIndex; } } public BuffIndex EpicBuffIndex { get { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_epicBuff)) { return (BuffIndex)(-1); } return _epicBuff.buffIndex; } } public BuffIndex LegendaryBuffIndex { get { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_legendaryBuff)) { return (BuffIndex)(-1); } return _legendaryBuff.buffIndex; } } private bool checkCanModify() { if (((ResourceAvailability)(ref QualityCatalog.Availability)).available) { Log.Error("Cannot modify BuffQualityGroup buffs after QualityCatalog is initialized", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\BuffQualityGroup.cs", "checkCanModify", 65); return false; } return true; } public BuffIndex GetBuffIndex(QualityTier qualityTier) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) return (BuffIndex)(qualityTier switch { QualityTier.None => BaseBuffIndex, QualityTier.Uncommon => UncommonBuffIndex, QualityTier.Rare => RareBuffIndex, QualityTier.Epic => EpicBuffIndex, QualityTier.Legendary => LegendaryBuffIndex, _ => throw new NotImplementedException($"Quality tier '{qualityTier}' is not implemented"), }); } public BuffDef GetBuffDef(QualityTier qualityTier) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) return (BuffDef)(qualityTier switch { QualityTier.None => BuffCatalog.GetBuffDef(BaseBuffIndex), QualityTier.Uncommon => _uncommonBuff, QualityTier.Rare => _rareBuff, QualityTier.Epic => _epicBuff, QualityTier.Legendary => _legendaryBuff, _ => throw new NotImplementedException($"Quality tier '{qualityTier}' is not implemented"), }); } public void SetBuffDef(BuffDef buffDef, QualityTier qualityTier) { if (checkCanModify()) { switch (qualityTier) { case QualityTier.None: Log.Warning("Cannot change base buff (group: '" + ((Object)this).name + "')", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\BuffQualityGroup.cs", "SetBuffDef", 118); break; case QualityTier.Uncommon: _uncommonBuff = buffDef; break; case QualityTier.Rare: _rareBuff = buffDef; break; case QualityTier.Epic: _epicBuff = buffDef; break; case QualityTier.Legendary: _legendaryBuff = buffDef; break; default: throw new NotImplementedException($"Quality tier '{qualityTier}' is not implemented"); } } } [MethodImpl(MethodImplOptions.AggressiveInlining)] [Obsolete("Use CharacterBodyExtensions.GetBuffCounts() instead")] public BuffQualityCounts GetBuffCounts(CharacterBody body) { if (!Object.op_Implicit((Object)(object)body)) { return default(BuffQualityCounts); } return body.GetBuffCounts(this); } [Obsolete("Use CharacterBodyExtensions.GetBuffCounts() instead")] public bool HasBuff(CharacterBody body) { QualityTier buffQualityTier; return HasBuff(body, out buffQualityTier); } [Obsolete("Use CharacterBodyExtensions.GetBuffCounts() instead")] public bool HasBuff(CharacterBody body, out QualityTier buffQualityTier) { BuffQualityCounts buffCounts = GetBuffCounts(body); buffQualityTier = buffCounts.HighestQuality; return buffCounts.TotalCount > 0; } [Obsolete("Use CharacterBodyExtensions.GetBuffCounts() instead")] public bool HasQualityBuff(CharacterBody body) { QualityTier buffQualityTier; return HasQualityBuff(body, out buffQualityTier); } [Obsolete("Use CharacterBodyExtensions.GetBuffCounts() instead")] public bool HasQualityBuff(CharacterBody body, out QualityTier buffQualityTier) { if (HasBuff(body, out buffQualityTier)) { return buffQualityTier > QualityTier.None; } return false; } [Obsolete("Use CharacterBodyExtensions.RemoveAllBuffs/RemoveAllQualityBuffs/ConvertQualityBuffsToTier/ConvertAllBuffsToQualityTier() instead")] public void EnsureBuffQualities(CharacterBody body, QualityTier buffQualityTier, bool includeBaseBuff = false) { if (!Object.op_Implicit((Object)(object)body)) { return; } if (buffQualityTier == QualityTier.None) { if (includeBaseBuff) { body.RemoveAllBuffs(this); } else { body.RemoveAllQualityBuffs(this); } } else if (includeBaseBuff) { body.ConvertAllBuffsToQualityTier(this, buffQualityTier); } else { body.ConvertQualityBuffsToTier(this, buffQualityTier); } } IEnumerator IAsyncContentLoadCallback.OnContentLoad(TProgress progressReceiver) { if (Object.op_Implicit((Object)(object)BaseBuff)) { populateBuffs(BaseBuff); } else if (BaseBuffReference != null && ((AssetReference)BaseBuffReference).RuntimeKeyIsValid()) { AsyncOperationHandle baseBuffLoad = AssetAsyncReferenceManager.LoadAsset(BaseBuffReference, (AsyncReferenceHandleUnloadType)2); yield return baseBuffLoad.AsProgressCoroutine(progressReceiver); if (baseBuffLoad.IsValid() && (int)baseBuffLoad.Status == 1) { populateBuffs(baseBuffLoad.Result); } else { Log.Error(string.Format("Failed to load base buff for quality group '{0}': {1}", ((Object)this).name, baseBuffLoad.IsValid() ? ((object)baseBuffLoad.OperationException) : ((object)"Invalid handle")), "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\BuffQualityGroup.cs", "OnContentLoad", 217); } AssetAsyncReferenceManager.UnloadAsset(BaseBuffReference); } progressReceiver.Report(1f); void populateBuffs(BuffDef baseBuff) { populateBuffAsset(_uncommonBuff, QualityTier.Uncommon); populateBuffAsset(_rareBuff, QualityTier.Rare); populateBuffAsset(_epicBuff, QualityTier.Epic); populateBuffAsset(_legendaryBuff, QualityTier.Legendary); void populateBuffAsset(BuffDef buff, QualityTier qualityTier) { if (!Object.op_Implicit((Object)(object)buff)) { Log.Warning($"Missing variant '{qualityTier}' in buff group '{((Object)this).name}'", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\BuffQualityGroup.cs", "OnContentLoad", 231); } else { if (!Object.op_Implicit((Object)(object)buff.eliteDef)) { buff.eliteDef = baseBuff.eliteDef; } if (!Object.op_Implicit((Object)(object)buff.startSfx)) { buff.startSfx = baseBuff.startSfx; } } } } } internal IEnumerator GenerateRuntimeAssetsAsync(ExtendedContentPack contentPack, TProgress progressReceiver = default(TProgress)) where TProgress : IProgress { if (Object.op_Implicit((Object)(object)BaseBuff)) { generateRuntimeAssets(BaseBuff); } else if (BaseBuffReference != null && ((AssetReference)BaseBuffReference).RuntimeKeyIsValid()) { AsyncOperationHandle baseBuffLoad = AssetAsyncReferenceManager.LoadAsset(BaseBuffReference, (AsyncReferenceHandleUnloadType)2); IEnumerator enumerator2; if (progressReceiver == null) { IEnumerator enumerator = (IEnumerator)(object)baseBuffLoad; enumerator2 = enumerator; } else { enumerator2 = baseBuffLoad.AsProgressCoroutine(progressReceiver); } yield return enumerator2; if (baseBuffLoad.IsValid() && (int)baseBuffLoad.Status == 1) { generateRuntimeAssets(baseBuffLoad.Result); } else { Log.Error(string.Format("Failed to load base buff for quality group '{0}': {1}", ((Object)this).name, baseBuffLoad.IsValid() ? ((object)baseBuffLoad.OperationException) : ((object)"Invalid handle")), "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\BuffQualityGroup.cs", "GenerateRuntimeAssetsAsync", 267); } AssetAsyncReferenceManager.UnloadAsset(BaseBuffReference); } else { generateRuntimeAssets(null); } ref TProgress reference = ref progressReceiver; TProgress val = default(TProgress); if (val == null) { val = reference; reference = ref val; if (val == null) { yield break; } } reference.Report(1f); void generateRuntimeAssets(BuffDef baseBuff) { string baseBuffName; if (Object.op_Implicit((Object)(object)baseBuff)) { baseBuffName = ((Object)baseBuff).name; } else { baseBuffName = ((Object)this).name; if (baseBuffName.StartsWith("bg") && baseBuffName.Length > 2) { baseBuffName = baseBuffName.Substring(2); } } Texture2D baseIconTexture = ((Object.op_Implicit((Object)(object)baseBuff) && Object.op_Implicit((Object)(object)baseBuff.iconSprite)) ? baseBuff.iconSprite.texture : null); if (!Object.op_Implicit((Object)(object)_uncommonBuff)) { _uncommonBuff = createBuffDef(QualityTier.Uncommon); } if (!Object.op_Implicit((Object)(object)_rareBuff)) { _rareBuff = createBuffDef(QualityTier.Rare); } if (!Object.op_Implicit((Object)(object)_epicBuff)) { _epicBuff = createBuffDef(QualityTier.Epic); } if (!Object.op_Implicit((Object)(object)_legendaryBuff)) { _legendaryBuff = createBuffDef(QualityTier.Legendary); } BuffDef createBuffDef(QualityTier qualityTier) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_018a: 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) QualityTierDef qualityTierDef = ((IEnumerable)contentPack.qualityTierDefs).FirstOrDefault((QualityTierDef qd) => qd.qualityTier == qualityTier); if (!Object.op_Implicit((Object)(object)qualityTierDef)) { Log.Error($"Failed to find quality tier def {qualityTier}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\BuffQualityGroup.cs", "GenerateRuntimeAssetsAsync", 300); } string text = baseBuffName + qualityTier; BuffDef val2 = ScriptableObject.CreateInstance(); ((Object)val2).name = "bd" + text; val2.buffColor = Color.white; if (Object.op_Implicit((Object)(object)baseBuff)) { val2.canStack = baseBuff.canStack; val2.isDebuff = baseBuff.isDebuff; val2.isDOT = baseBuff.isDOT; val2.ignoreGrowthNectar = baseBuff.ignoreGrowthNectar; val2.isCooldown = baseBuff.isCooldown; val2.isHidden = baseBuff.isHidden; val2.flags = baseBuff.flags; } if (Object.op_Implicit((Object)(object)baseIconTexture)) { Texture2D val3 = QualityCatalog.CreateQualityIconTexture(baseIconTexture, qualityTierDef, Object.op_Implicit((Object)(object)baseBuff) ? baseBuff.buffColor : Color.white); ((Object)val3).name = "tex" + text; Sprite val4 = Sprite.Create(val3, new Rect(0f, 0f, (float)((Texture)val3).width, (float)((Texture)val3).height), new Vector2(0.5f, 0.5f), (float)((Texture)val3).width / 10.24f); ((Object)val4).name = "tex" + text; val2.iconSprite = val4; } else if (Object.op_Implicit((Object)(object)baseBuff)) { val2.iconSprite = baseBuff.iconSprite; } contentPack.buffDefs.Add(val2); return val2; } } } } public enum BuffQualityGroupIndex { Invalid = -1 } public sealed class BugPickup : MonoBehaviour { [Tooltip("The base object to destroy when this pickup is consumed.")] public GameObject BaseObject; [Tooltip("The team filter object which determines who can pick up this pack.")] public TeamFilter TeamFilter; public GameObject PickupEffect; [Tooltip("How much duration to add onto the users current wing usage on pickup")] [Min(0f)] public float JetpackDurationBonus; public BuffQualityGroup BuffGroup; public QualityTier Tier = QualityTier.None; private bool _alive = true; private void OnTriggerStay(Collider other) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || !_alive || TeamComponent.GetObjectTeam(((Component)other).gameObject) != TeamFilter.teamIndex) { return; } CharacterBody component = ((Component)other).GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { return; } if (JetpackDurationBonus > 0f) { JetpackController val = JetpackController.FindJetpackController(((Component)component).gameObject); if (Object.op_Implicit((Object)(object)val)) { val.duration = Mathf.Max(val.duration, val.stopwatch) + JetpackDurationBonus; val.providingAntiGravity = true; val.providingFlight = true; } } if (Object.op_Implicit((Object)(object)BuffGroup)) { BuffIndex buffIndex = BuffGroup.GetBuffIndex(Tier); if ((int)buffIndex != -1) { component.AddBuff(buffIndex); } } component.OnPickup((PickupClass)1); if (Object.op_Implicit((Object)(object)PickupEffect)) { EffectManager.SpawnEffect(PickupEffect, new EffectData { origin = ((Component)this).transform.position }, true); } Object.Destroy((Object)(object)BaseObject); _alive = false; } } [RequireComponent(typeof(NetworkedBodyAttachment))] public sealed class BugSwarmController : MonoBehaviour, INetworkedBodyAttachmentListener { private struct BugOrbit { public Transform BugTransform; public float RadiansPerSecond; public float DistanceOffset; public int DirectionSign; public float CycleOffset; public Quaternion TiltRotation; public Wave VerticalOffset; public Vector3 PositionSmoothVelocity; public float RotationSmoothVelocity; } [Tooltip("This will be instantiated and circled around the attached body")] public GameObject BugPrefab; [Min(1f)] [Tooltip("The maximum amount of bugs to be active at a time")] public int MaxDisplayedBugCount = 20; [Header("Orbit Parameters")] [Tooltip("The min and max offsets of the distance from the attached body to orbit")] public RangeFloat OrbitDistanceOffset = new RangeFloat { min = 0f, max = 0.2f }; [Tooltip("The min and max speed of bugs in orbit (in revolutions/sec)")] public RangeFloat OrbitSpeed = new RangeFloat { min = 0.5f, max = 1f }; [Tooltip("The min and max angle tilt of the bugs orbit (in degrees)")] public RangeFloat OrbitTiltAngle = new RangeFloat { min = 0f, max = 35f }; [Header("Orbit Parameters - Offsets")] [Tooltip("The min and max vertical offset to cycle in the orbit")] public RangeFloat OrbitVerticalOffsetMagnitude = new RangeFloat { min = 0.1f, max = 0.2f }; [Tooltip("The min and max frequency of the vertical offset in the orbit")] public RangeFloat OrbitVerticalOffsetFrequency = new RangeFloat { min = 1f, max = 1.5f }; [Header("Bug Parameters")] [Min(0f)] [Tooltip("How long to smooth the position of a bug to its target position")] public float PositionSmoothDuration = 0.4f; [Min(0f)] [Tooltip("How long to smooth the rotation of a bug to its target rotation")] public float RotationSmoothDuration = 0.2f; private int _bugCount; private BugOrbit[] _bugs = Array.Empty(); private NetworkedBodyAttachment _bodyAttachment; private CharacterBody _attachedBody; private void Awake() { _bodyAttachment = ((Component)this).GetComponent(); } private void OnEnable() { if (Object.op_Implicit((Object)(object)_bodyAttachment)) { setAttachedBody(_bodyAttachment.attachedBody); } } private void OnDisable() { setAttachedBody(null); } private void setAttachedBody(CharacterBody body) { if (!((Object)(object)_attachedBody == (Object)(object)body)) { if (Object.op_Implicit((Object)(object)_attachedBody)) { _attachedBody.onRecalculateStats -= onAttachedBodyRecalculateStats; } _attachedBody = body; if (Object.op_Implicit((Object)(object)_attachedBody)) { _attachedBody.onRecalculateStats += onAttachedBodyRecalculateStats; } updateAttachedBodyBuffs(); } } private void onAttachedBodyRecalculateStats(CharacterBody body) { updateAttachedBodyBuffs(); } private void updateAttachedBodyBuffs() { int activeBugCount = (Object.op_Implicit((Object)(object)_attachedBody) ? _attachedBody.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.BugBlock).TotalQualityCount : 0); setActiveBugCount(activeBugCount); } private void setActiveBugCount(int newBugCount) { newBugCount = Math.Clamp(newBugCount, 0, MaxDisplayedBugCount); if (newBugCount == _bugCount) { return; } int num = newBugCount - _bugCount; if (num < 0) { for (int num2 = _bugCount - 1; num2 >= newBugCount; num2--) { ref BugOrbit reference = ref _bugs[num2]; if (Object.op_Implicit((Object)(object)reference.BugTransform)) { ((Component)reference.BugTransform).gameObject.SetActive(false); } } } else { ArrayUtils.EnsureCapacity(ref _bugs, newBugCount); for (int i = _bugCount; i < newBugCount; i++) { ref BugOrbit reference2 = ref _bugs[i]; if (Object.op_Implicit((Object)(object)reference2.BugTransform)) { ((Component)reference2.BugTransform).gameObject.SetActive(true); } else { GameObject val = Object.Instantiate(BugPrefab, ((Component)this).transform); reference2.BugTransform = val.transform; } initializeBugInstance(ref reference2); } } _bugCount += num; } private void initializeBugInstance(ref BugOrbit bug) { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) bug.DistanceOffset = Random.Range(OrbitDistanceOffset.min, OrbitDistanceOffset.max); bug.RadiansPerSecond = Random.Range(OrbitSpeed.min, OrbitSpeed.max) * (MathF.PI * 2f); bug.CycleOffset = Random.Range(0f, MathF.PI * 2f); float num = Random.Range(OrbitTiltAngle.min, OrbitTiltAngle.max) * (float)((Random.value > 0.5f) ? 1 : (-1)); float num2 = Random.Range(0f, 360f); bug.TiltRotation = Quaternion.AngleAxis(num2, Vector3.up) * Quaternion.AngleAxis(num, Vector3.forward); bug.DirectionSign = ((Random.value > 0.5f) ? 1 : (-1)); bug.VerticalOffset = new Wave { amplitude = Random.Range(OrbitVerticalOffsetMagnitude.min, OrbitVerticalOffsetMagnitude.max), frequency = Random.Range(OrbitVerticalOffsetFrequency.min, OrbitVerticalOffsetFrequency.max), cycleOffset = Random.Range(0f, MathF.PI * 2f) }; bug.PositionSmoothVelocity = Vector3.zero; bug.RotationSmoothVelocity = 0f; } private void FixedUpdate() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) if (_bugCount == 0) { return; } float num; Vector3 val; if (Object.op_Implicit((Object)(object)_attachedBody)) { num = _attachedBody.radius * 1.3f; val = _attachedBody.corePosition; } else { num = 1f; val = ((Component)this).transform.position; } for (int i = 0; i < _bugCount; i++) { ref BugOrbit reference = ref _bugs[i]; if (Object.op_Implicit((Object)(object)reference.BugTransform)) { float num2 = (Time.fixedTime * reference.RadiansPerSecond + reference.CycleOffset) * (float)reference.DirectionSign; float num3 = num + reference.DistanceOffset; Vector3 val2 = new Vector3(Mathf.Sin(num2), 0f, Mathf.Cos(num2)) * num3; float num4 = ((Wave)(ref reference.VerticalOffset)).Evaluate(num2); val2 += new Vector3(0f, num4, 0f); Vector3 val3 = val + reference.TiltRotation * val2; float num5 = MathF.PI / 2f * (float)reference.DirectionSign; Quaternion val4 = reference.TiltRotation * Quaternion.AngleAxis((num2 + num5) * 57.29578f, Vector3.up); Vector3 val5 = Vector3.SmoothDamp(reference.BugTransform.position, val3, ref reference.PositionSmoothVelocity, PositionSmoothDuration); Quaternion val6 = Util.SmoothDampQuaternion(reference.BugTransform.rotation, val4, ref reference.RotationSmoothVelocity, RotationSmoothDuration); reference.BugTransform.SetPositionAndRotation(val5, val6); } } } void INetworkedBodyAttachmentListener.OnAttachedBodyDiscovered(NetworkedBodyAttachment networkedBodyAttachment, CharacterBody attachedBody) { setAttachedBody(attachedBody); } } public sealed class CharacterBodyExtraStatsTracker : NetworkBehaviour, IOnIncomingDamageServerReceiver, IOnTakeDamageServerReceiver { private NetworkIdentity _netIdentity; private CharacterBody _body; private Interactor _interactor; private InteractionDriver _interactionDriver; private GameObject _currentInteractableObject; private IInteractable _currentInteractable; private CharacterModel _cachedCharacterModel; private MemoizedGetComponentCached _memoizedMasterExtraStatsComponent; private TemporaryVisualEffect _qualityDeathMarkEffectInstance; private TemporaryVisualEffect _sprintArmorWeakenEffectInstance; private TemporaryOverlayInstance _healCritBoostOverlay; private int _weakPointsEnabledCounterServer; [SyncVar] private byte _weakPointHurtBoxIndexPlusOne; public ItemQualityCounts LastExtraStatsOnLevelUpCounts; [SyncVar] public int ParryStoredProjectileIndex = -1; public float ParryStoredProjectileDamage; public bool ParryStoredProjectileCrit; [SyncVar] private int _parryStoredProjectileAttackerBodyIndexInt; [SyncVar(hook = "hookSetIsPerformingQuailJump")] private bool _isPerformingQuailJump; private float _gatewayTeleportCooldown; private Indicator _qualityGatewayPickupTargetIndicator; private GatewayQualityPickupController _currentGatewayPickupTargetAuthority; private static readonly GatewayQualityPickupSearch _sharedGatewayPickupTargetSearch; [CompilerGenerated] private HitGroundDelegate m_OnHitGroundAuthority; private static int kCmdCmdOnHitGround; private static int kCmdCmdSetPerformingQuailJump; public int WeakPointHurtBoxIndex { get { return _weakPointHurtBoxIndexPlusOne - 1; } private set { Network_weakPointHurtBoxIndexPlusOne = (byte)(value + 1); } } public CharacterBody Body => _body; public float ExecuteBossHealthFraction { get; private set; } public float StealthKitActivationThreshold { get; private set; } = HealthComponent.lowHealthFraction; public CharacterBody LastHitBody { get; private set; } public bool HasEffectiveAuthority => Util.HasEffectiveAuthority(_netIdentity); public BodyIndex ParryStoredProjectileAttackerBodyIndex { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return (BodyIndex)(_parryStoredProjectileAttackerBodyIndexInt - 1); } [MethodImpl(MethodImplOptions.AggressiveInlining)] set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected I4, but got Unknown Network_parryStoredProjectileAttackerBodyIndexInt = value + 1; } } public bool IsPerformingQuailJump { get { return _isPerformingQuailJump; } private set { Network_isPerformingQuailJump = value; if (HasEffectiveAuthority && !NetworkServer.active) { CallCmdSetPerformingQuailJump(_isPerformingQuailJump); } } } public FixedTimeStamp LastQuailLandTimeAuthority { get; private set; } = FixedTimeStamp.positiveInfinity; public Vector3 LastQuailJumpVelocityAuthority { get; private set; } = Vector3.zero; public int QuailJumpComboAuthority { get; private set; } public bool HasHadAnyQualityDeathMarkDebuffServer { get; private set; } public float CurrentMedkitProcTimeSinceLastHit { get; set; } public float LeechBuffReserveFraction { get; set; } public int EliteKillCount { get; private set; } public float WeakPointCritMultiplierBonusServer { get; set; } public int WeakPointsEnabledCounterServer { get { return _weakPointsEnabledCounterServer; } [Server] set { if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void ItemQualities.CharacterBodyExtraStatsTracker::set_WeakPointsEnabledCounterServer(System.Int32)' called on client"); return; } bool num = _weakPointsEnabledCounterServer > 0; bool flag = value > 0; _weakPointsEnabledCounterServer = value; if (num != flag) { if (flag && Object.op_Implicit((Object)(object)_body.hurtBoxGroup) && _body.hurtBoxGroup.hurtBoxes.Length != 0) { WeakPointHurtBoxIndex = Random.Range(0, _body.hurtBoxGroup.hurtBoxes.Length); } else { WeakPointHurtBoxIndex = -1; } } } } public CharacterMasterExtraStatsTracker MasterExtraStatsTracker => _memoizedMasterExtraStatsComponent.Get(_body.masterObject); public byte Network_weakPointHurtBoxIndexPlusOne { get { return _weakPointHurtBoxIndexPlusOne; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref _weakPointHurtBoxIndexPlusOne, 1u); } } public int NetworkParryStoredProjectileIndex { get { return ParryStoredProjectileIndex; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref ParryStoredProjectileIndex, 2u); } } public int Network_parryStoredProjectileAttackerBodyIndexInt { get { return _parryStoredProjectileAttackerBodyIndexInt; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref _parryStoredProjectileAttackerBodyIndexInt, 4u); } } public bool Network_isPerformingQuailJump { get { return _isPerformingQuailJump; } [param: In] set { ref bool isPerformingQuailJump = ref _isPerformingQuailJump; if (NetworkServer.localClientActive && !((NetworkBehaviour)this).syncVarHookGuard) { ((NetworkBehaviour)this).syncVarHookGuard = true; hookSetIsPerformingQuailJump(value); ((NetworkBehaviour)this).syncVarHookGuard = false; } ((NetworkBehaviour)this).SetSyncVar(value, ref isPerformingQuailJump, 8u); } } public event Action OnIncomingDamageServer; public event Action OnTakeDamageServer; public event HitGroundDelegate OnHitGroundAuthority { [CompilerGenerated] add { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown HitGroundDelegate val = this.m_OnHitGroundAuthority; HitGroundDelegate val2; do { val2 = val; HitGroundDelegate value2 = (HitGroundDelegate)Delegate.Combine((Delegate?)(object)val2, (Delegate?)(object)value); val = Interlocked.CompareExchange(ref this.m_OnHitGroundAuthority, value2, val2); } while (val != val2); } [CompilerGenerated] remove { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown HitGroundDelegate val = this.m_OnHitGroundAuthority; HitGroundDelegate val2; do { val2 = val; HitGroundDelegate value2 = (HitGroundDelegate)Delegate.Remove((Delegate?)(object)val2, (Delegate?)(object)value); val = Interlocked.CompareExchange(ref this.m_OnHitGroundAuthority, value2, val2); } while (val != val2); } } public event Action OnHitGroundServer; public event Action OnKilledOther; [SystemInitializer(new Type[] { typeof(BodyCatalog) })] private static void Init() { foreach (GameObject allBodyPrefab in BodyCatalog.allBodyPrefabs) { UnityObjectExtensions.EnsureComponent(allBodyPrefab); } GlobalEventManager.onCharacterDeathGlobal += onCharacterDeathGlobal; GlobalEventManager.onServerDamageDealt += onServerDamageDealt; } private static void onServerDamageDealt(DamageReport damageReport) { if (Object.op_Implicit((Object)(object)damageReport.attacker) && damageReport.attacker.TryGetComponentCached(out CharacterBodyExtraStatsTracker component)) { component.onDamagedOther(damageReport); } } private static void onCharacterDeathGlobal(DamageReport damageReport) { if (Object.op_Implicit((Object)(object)damageReport.attacker) && damageReport.attacker.TryGetComponentCached(out CharacterBodyExtraStatsTracker component)) { component.onKilledOther(damageReport); } } private void Awake() { _netIdentity = ((Component)this).GetComponent(); _body = ((Component)this).GetComponent(); _interactor = ((Component)this).GetComponent(); _interactionDriver = ((Component)this).GetComponent(); ComponentCache.Add(((Component)this).gameObject, this); } private void OnDestroy() { if (_qualityGatewayPickupTargetIndicator != null) { _qualityGatewayPickupTargetIndicator.active = false; } ComponentCache.Remove(((Component)this).gameObject, this); } private void Start() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown if (HasEffectiveAuthority) { _qualityGatewayPickupTargetIndicator = new Indicator(((Component)this).gameObject, Gateway.QualityGatewayPickupTargetIndicatorPrefab); } } private void OnEnable() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown InstanceTracker.Add(this); _body.onRecalculateStats += onBodyRecalculateStats; if (Object.op_Implicit((Object)(object)_body.characterMotor)) { _body.characterMotor.onHitGroundAuthority += new HitGroundDelegate(onHitGroundAuthority); } if (Object.op_Implicit((Object)(object)_body.modelLocator)) { _body.modelLocator.onModelChanged += refreshModelReference; } refreshModelReference(Object.op_Implicit((Object)(object)_body.modelLocator) ? _body.modelLocator.modelTransform : null); recalculateExtraStats(); } private void OnDisable() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown _body.onRecalculateStats -= onBodyRecalculateStats; if (Object.op_Implicit((Object)(object)_body.characterMotor)) { _body.characterMotor.onHitGroundAuthority -= new HitGroundDelegate(onHitGroundAuthority); } if (Object.op_Implicit((Object)(object)_body.modelLocator)) { _body.modelLocator.onModelChanged -= refreshModelReference; } refreshModelReference(null); InstanceTracker.Remove(this); } private void FixedUpdate() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && !HasHadAnyQualityDeathMarkDebuffServer && DeathMark.HasAnyQualityDeathMarkDebuff(_body)) { HasHadAnyQualityDeathMarkDebuffServer = true; } if (HasEffectiveAuthority && QuailJumpComboAuthority > 0 && !IsPerformingQuailJump) { FixedTimeStamp lastQuailLandTimeAuthority = LastQuailLandTimeAuthority; if (((FixedTimeStamp)(ref lastQuailLandTimeAuthority)).timeSince > 0.15f) { QuailJumpComboAuthority = 0; } } updateOverlays(); } private void Update() { if (HasEffectiveAuthority) { if (_gatewayTeleportCooldown > 0f) { _gatewayTeleportCooldown -= Time.deltaTime; } updateTargets(); if (Object.op_Implicit((Object)(object)_currentGatewayPickupTargetAuthority) && Object.op_Implicit((Object)(object)Body.inputBank) && ((ButtonState)(ref Body.inputBank.interact)).justPressed) { _currentGatewayPickupTargetAuthority.OnInteractAuthority(Body); _gatewayTeleportCooldown = 0.3f; } } } private void updateTargets() { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Invalid comparison between Unknown and I4 //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)Body.inputBank)) { if (Object.op_Implicit((Object)(object)_interactionDriver) && (Object)(object)_currentInteractableObject != (Object)(object)_interactionDriver.currentInteractable) { _currentInteractableObject = _interactionDriver.currentInteractable; _currentInteractable = (Object.op_Implicit((Object)(object)_currentInteractableObject) ? _currentInteractableObject.GetComponent() : null); } IInteractable currentInteractable = _currentInteractable; bool flag = (Object)(object)((currentInteractable is MonoBehaviour) ? currentInteractable : null) != (Object)null && (int)_currentInteractable.GetInteractability(_interactor) > 0; bool flag2 = Object.op_Implicit((Object)(object)_interactionDriver) && _interactionDriver.interactableCooldown > 0f; float num = default(float); Ray val = CameraRigController.ModifyAimRayIfApplicable(Body.inputBank.GetAimRay(), ((Component)this).gameObject, ref num); _currentGatewayPickupTargetAuthority = null; if (_gatewayTeleportCooldown <= 0f && !(flag || flag2)) { ((BaseDirectionalSearch)_sharedGatewayPickupTargetSearch).searchOrigin = ((Ray)(ref val)).origin; ((BaseDirectionalSearch)_sharedGatewayPickupTargetSearch).searchDirection = ((Ray)(ref val)).direction; _sharedGatewayPickupTargetSearch.teamIndex = Body.teamComponent.teamIndex; _currentGatewayPickupTargetAuthority = ((BaseDirectionalSearch)_sharedGatewayPickupTargetSearch).SearchCandidatesForSingleTarget>(InstanceTracker.GetInstancesList()); } bool flag3 = Object.op_Implicit((Object)(object)_currentGatewayPickupTargetAuthority); Transform targetTransform = null; if (flag3) { targetTransform = ((!Object.op_Implicit((Object)(object)_currentGatewayPickupTargetAuthority.CoreTransform)) ? ((Component)_currentGatewayPickupTargetAuthority).transform : _currentGatewayPickupTargetAuthority.CoreTransform); } _qualityGatewayPickupTargetIndicator.active = flag3; _qualityGatewayPickupTargetIndicator.targetTransform = targetTransform; } } private void refreshModelReference(Transform modelTransform) { GameObject obj = (Object.op_Implicit((Object)(object)_cachedCharacterModel) ? ((Component)_cachedCharacterModel).gameObject : null); GameObject val = (Object.op_Implicit((Object)(object)modelTransform) ? ((Component)modelTransform).gameObject : null); if ((Object)(object)obj == (Object)(object)val) { return; } _cachedCharacterModel = (Object.op_Implicit((Object)(object)modelTransform) ? ((Component)modelTransform).GetComponent() : null); if (NetworkServer.active) { HurtBoxGroup val2 = default(HurtBoxGroup); if (_weakPointsEnabledCounterServer > 0 && Object.op_Implicit((Object)(object)modelTransform) && ((Component)modelTransform).TryGetComponent(ref val2) && val2.hurtBoxes.Length != 0) { WeakPointHurtBoxIndex = Random.Range(0, val2.hurtBoxes.Length); } else { WeakPointHurtBoxIndex = -1; } } } private void updateOverlays() { setOverlay(ref _healCritBoostOverlay, ItemQualitiesContent.Materials.HealCritBoost, _body.HasBuff(ItemQualitiesContent.Buffs.HealCritBoost)); void setOverlay(ref TemporaryOverlayInstance overlayInstance, Material material, bool active) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)material)) { if (!Object.op_Implicit((Object)(object)_cachedCharacterModel)) { active = false; } if ((overlayInstance != null && (Object)(object)overlayInstance.assignedCharacterModel == (Object)(object)_cachedCharacterModel) != active) { if (overlayInstance != null) { overlayInstance.RemoveFromCharacterModel(); overlayInstance = null; } if (active) { overlayInstance = new TemporaryOverlayInstance(((Component)this).gameObject) { duration = float.PositiveInfinity, destroyComponentOnEnd = true, originalMaterial = material }; overlayInstance.AddToCharacterModel(_cachedCharacterModel); } } } } } private void onBodyRecalculateStats(CharacterBody body) { recalculateExtraStats(); } private void recalculateExtraStats() { ItemQualityCounts itemQualityCounts = default(ItemQualityCounts); ItemQualityCounts itemQualityCounts2 = default(ItemQualityCounts); if (Object.op_Implicit((Object)(object)_body) && Object.op_Implicit((Object)(object)_body.inventory)) { itemQualityCounts = _body.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.ExecuteLowHealthElite); itemQualityCounts2 = _body.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Phasing); } ExecuteBossHealthFraction = Util.ConvertAmplificationPercentageIntoReductionNormalized(0.1f * (float)itemQualityCounts.UncommonCount + 0.15f * (float)itemQualityCounts.RareCount + 0.25f * (float)itemQualityCounts.EpicCount + 0.4f * (float)itemQualityCounts.LegendaryCount); float num = 1f; num *= Mathf.Pow(0.9f, (float)itemQualityCounts2.UncommonCount); num *= Mathf.Pow(0.75f, (float)itemQualityCounts2.RareCount); num *= Mathf.Pow(0.5f, (float)itemQualityCounts2.EpicCount); num *= Mathf.Pow(0.25f, (float)itemQualityCounts2.LegendaryCount); StealthKitActivationThreshold = 1f - (1f - HealthComponent.lowHealthFraction) * num; } void IOnIncomingDamageServerReceiver.OnIncomingDamageServer(DamageInfo damageInfo) { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) BuffQualityCounts buffCounts = Body.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.BugBlock); if (buffCounts.TotalQualityCount > 0 && damageInfo.damage > 0f && !damageInfo.rejected) { bool flag = false; for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { float percentChance = (int)(qualityTier + 1) * 10; ref int reference = ref buffCounts[qualityTier]; if (reference > 0 && RollUtil.CheckRoll(percentChance, _body.master, sureProc: false)) { flag = true; reference--; Body.RemoveBuff(ItemQualitiesContent.BuffQualityGroups.BugBlock.GetBuffIndex(qualityTier)); break; } } if (flag) { EffectData val = new EffectData { origin = damageInfo.position }; EffectManager.SpawnEffect(ItemQualitiesContent.Prefabs.BugBlockProcEffect, val, true); damageInfo.rejected = true; } } this.OnIncomingDamageServer?.Invoke(damageInfo); } void IOnTakeDamageServerReceiver.OnTakeDamageServer(DamageReport damageReport) { this.OnTakeDamageServer?.Invoke(damageReport); } private void onKilledOther(DamageReport damageReport) { if (damageReport.victimIsElite) { EliteKillCount++; } this.OnKilledOther?.Invoke(damageReport); } private void onDamagedOther(DamageReport damageReport) { LastHitBody = damageReport.victimBody; } private void onHitGroundAuthority(ref HitGroundInfo hitGroundInfo) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (IsPerformingQuailJump) { LastQuailLandTimeAuthority = FixedTimeStamp.now; IsPerformingQuailJump = false; } HitGroundDelegate obj = this.OnHitGroundAuthority; if (obj != null) { obj.Invoke(ref hitGroundInfo); } CallCmdOnHitGround(hitGroundInfo.velocity, hitGroundInfo.position, hitGroundInfo.isValidForEffect); } [Command] private void CmdOnHitGround(Vector3 velocity, Vector3 position, bool isValidForEffect) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_001e: 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) this.OnHitGroundServer?.Invoke(new HitGroundInfo { velocity = velocity, position = position, isValidForEffect = isValidForEffect, ownerBodyObject = ((Component)this).gameObject }); } public void UpdateAllTemporaryVisualEffects() { updateTemporaryVisualEffect(ref _qualityDeathMarkEffectInstance, ItemQualitiesContent.Prefabs.DeathMarkQualityEffect, _body.radius, DeathMark.HasAnyQualityDeathMarkDebuff(_body)); updateTemporaryVisualEffect(ref _sprintArmorWeakenEffectInstance, SprintArmor.BucklerDefenseBigPrefab, _body.bestFitActualRadius, _body.HasBuff(ItemQualitiesContent.Buffs.SprintArmorWeaken)); void updateTemporaryVisualEffect(ref TemporaryVisualEffect temporaryEffect, GameObject effectPrefab, float effectRadius, bool active) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 _body.UpdateSingleTemporaryVisualEffect(ref temporaryEffect, effectPrefab, effectRadius, active, ""); if (!active && Object.op_Implicit((Object)(object)temporaryEffect) && (int)temporaryEffect.visualState == 1) { temporaryEffect = null; } } } public void OnQuailJumpAuthority() { if (!HasEffectiveAuthority) { Log.Warning("Caller must have authority", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\CharacterBodyExtraStatsTracker.cs", "OnQuailJumpAuthority", 540); return; } IsPerformingQuailJump = true; QuailJumpComboAuthority++; } [Command] private void CmdSetPerformingQuailJump(bool performing) { IsPerformingQuailJump = performing; } private void hookSetIsPerformingQuailJump(bool performingQuailJump) { bool num = _isPerformingQuailJump != performingQuailJump; Network_isPerformingQuailJump = performingQuailJump; if (num) { _body.MarkAllStatsDirty(); } } static CharacterBodyExtraStatsTracker() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown _sharedGatewayPickupTargetSearch = new GatewayQualityPickupSearch { minDistanceFilter = 2f, maxDistanceFilter = 1000f, maxAngleFilter = 10f, filterByLoS = true, sortMode = (SortMode)2 }; kCmdCmdOnHitGround = 2046024957; NetworkBehaviour.RegisterCommandDelegate(typeof(CharacterBodyExtraStatsTracker), kCmdCmdOnHitGround, new CmdDelegate(InvokeCmdCmdOnHitGround)); kCmdCmdSetPerformingQuailJump = -81742103; NetworkBehaviour.RegisterCommandDelegate(typeof(CharacterBodyExtraStatsTracker), kCmdCmdSetPerformingQuailJump, new CmdDelegate(InvokeCmdCmdSetPerformingQuailJump)); NetworkCRC.RegisterBehaviour("CharacterBodyExtraStatsTracker", 0); } private void UNetVersion() { } protected static void InvokeCmdCmdOnHitGround(NetworkBehaviour obj, NetworkReader reader) { //IL_001d: 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) if (!NetworkServer.active) { Debug.LogError((object)"Command CmdOnHitGround called on client."); } else { ((CharacterBodyExtraStatsTracker)(object)obj).CmdOnHitGround(reader.ReadVector3(), reader.ReadVector3(), reader.ReadBoolean()); } } protected static void InvokeCmdCmdSetPerformingQuailJump(NetworkBehaviour obj, NetworkReader reader) { if (!NetworkServer.active) { Debug.LogError((object)"Command CmdSetPerformingQuailJump called on client."); } else { ((CharacterBodyExtraStatsTracker)(object)obj).CmdSetPerformingQuailJump(reader.ReadBoolean()); } } public void CallCmdOnHitGround(Vector3 velocity, Vector3 position, bool isValidForEffect) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (!NetworkClient.active) { Debug.LogError((object)"Command function CmdOnHitGround called on server."); return; } if (((NetworkBehaviour)this).isServer) { CmdOnHitGround(velocity, position, isValidForEffect); return; } NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)5); val.WritePackedUInt32((uint)kCmdCmdOnHitGround); val.Write(((Component)this).GetComponent().netId); val.Write(velocity); val.Write(position); val.Write(isValidForEffect); ((NetworkBehaviour)this).SendCommandInternal(val, 0, "CmdOnHitGround"); } public void CallCmdSetPerformingQuailJump(bool performing) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (!NetworkClient.active) { Debug.LogError((object)"Command function CmdSetPerformingQuailJump called on server."); return; } if (((NetworkBehaviour)this).isServer) { CmdSetPerformingQuailJump(performing); return; } NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)5); val.WritePackedUInt32((uint)kCmdCmdSetPerformingQuailJump); val.Write(((Component)this).GetComponent().netId); val.Write(performing); ((NetworkBehaviour)this).SendCommandInternal(val, 0, "CmdSetPerformingQuailJump"); } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { if (forceAll) { writer.WritePackedUInt32((uint)_weakPointHurtBoxIndexPlusOne); writer.WritePackedUInt32((uint)ParryStoredProjectileIndex); writer.WritePackedUInt32((uint)_parryStoredProjectileAttackerBodyIndexInt); writer.Write(_isPerformingQuailJump); return true; } bool flag = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32((uint)_weakPointHurtBoxIndexPlusOne); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 2u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32((uint)ParryStoredProjectileIndex); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 4u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32((uint)_parryStoredProjectileAttackerBodyIndexInt); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 8u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(_isPerformingQuailJump); } if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { if (initialState) { _weakPointHurtBoxIndexPlusOne = (byte)reader.ReadPackedUInt32(); ParryStoredProjectileIndex = (int)reader.ReadPackedUInt32(); _parryStoredProjectileAttackerBodyIndexInt = (int)reader.ReadPackedUInt32(); _isPerformingQuailJump = reader.ReadBoolean(); return; } int num = (int)reader.ReadPackedUInt32(); if (((uint)num & (true ? 1u : 0u)) != 0) { _weakPointHurtBoxIndexPlusOne = (byte)reader.ReadPackedUInt32(); } if (((uint)num & 2u) != 0) { ParryStoredProjectileIndex = (int)reader.ReadPackedUInt32(); } if (((uint)num & 4u) != 0) { _parryStoredProjectileAttackerBodyIndexInt = (int)reader.ReadPackedUInt32(); } if (((uint)num & 8u) != 0) { hookSetIsPerformingQuailJump(reader.ReadBoolean()); } } public override void PreStartClient() { } } public sealed class CharacterMasterExtraStatsTracker : NetworkBehaviour { private struct PendingItemUpgrade { public readonly ItemIndex UpgradeItemIndex; public FixedTimeStamp TimeStamp; public PendingItemUpgrade(ItemIndex upgradeItemIndex, FixedTimeStamp timeStamp) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) UpgradeItemIndex = upgradeItemIndex; TimeStamp = timeStamp; } } public static readonly float ItemUpgradeDelay; private CharacterMaster _master; private CharacterBody _cachedBody; private CharacterBodyExtraStatsTracker _bodyExtraStatsComponent; [SyncVar(hook = "hookSetSteakBonus")] public float SteakBonus; [SyncVar(hook = "hookSetSpeedOnPickupBonus")] public int SpeedOnPickupBonus; [SyncVar(hook = "hookSetBossDamageBonusTicks")] public int BossDamageBonusTicks; [SyncVar] public StoredInteractableInfo CardStoredInteractableInfo = StoredInteractableInfo.None; private readonly SyncListUInt _upgradeItemIndices = new SyncListUInt(); private List _pendingItemUpgrades; private int _stageIncomingDamageInstanceCountServer; private static int kList_upgradeItemIndices; public int StageDamageInstancesTakenCount => _stageIncomingDamageInstanceCountServer; public float NetworkSteakBonus { get { return SteakBonus; } [param: In] set { ref float steakBonus = ref SteakBonus; if (NetworkServer.localClientActive && !((NetworkBehaviour)this).syncVarHookGuard) { ((NetworkBehaviour)this).syncVarHookGuard = true; hookSetSteakBonus(value); ((NetworkBehaviour)this).syncVarHookGuard = false; } ((NetworkBehaviour)this).SetSyncVar(value, ref steakBonus, 1u); } } public int NetworkSpeedOnPickupBonus { get { return SpeedOnPickupBonus; } [param: In] set { ref int speedOnPickupBonus = ref SpeedOnPickupBonus; if (NetworkServer.localClientActive && !((NetworkBehaviour)this).syncVarHookGuard) { ((NetworkBehaviour)this).syncVarHookGuard = true; hookSetSpeedOnPickupBonus(value); ((NetworkBehaviour)this).syncVarHookGuard = false; } ((NetworkBehaviour)this).SetSyncVar(value, ref speedOnPickupBonus, 2u); } } public int NetworkBossDamageBonusTicks { get { return BossDamageBonusTicks; } [param: In] set { ref int bossDamageBonusTicks = ref BossDamageBonusTicks; if (NetworkServer.localClientActive && !((NetworkBehaviour)this).syncVarHookGuard) { ((NetworkBehaviour)this).syncVarHookGuard = true; hookSetBossDamageBonusTicks(value); ((NetworkBehaviour)this).syncVarHookGuard = false; } ((NetworkBehaviour)this).SetSyncVar(value, ref bossDamageBonusTicks, 4u); } } public StoredInteractableInfo NetworkCardStoredInteractableInfo { get { return CardStoredInteractableInfo; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref CardStoredInteractableInfo, 8u); } } public event Action OnStageDamageInstancesTakenCountChangedServer; public event Action OnBossDamageBonusTicksChanged; [SystemInitializer(new Type[] { typeof(MasterCatalog) })] private static void Init() { foreach (CharacterMaster allMaster in MasterCatalog.allMasters) { if (Object.op_Implicit((Object)(object)allMaster)) { UnityObjectExtensions.EnsureComponent(((Component)allMaster).gameObject); } } } private void Awake() { _master = ((Component)this).GetComponent(); ComponentCache.Add(((Component)this).gameObject, this); if (NetworkServer.active) { _pendingItemUpgrades = CollectionPool>.RentCollection(); } ((SyncList)(object)_upgradeItemIndices).InitializeBehaviour((NetworkBehaviour)(object)this, kList_upgradeItemIndices); } private void OnDestroy() { ComponentCache.Remove(((Component)this).gameObject, this); if (_pendingItemUpgrades != null) { _pendingItemUpgrades = CollectionPool>.ReturnCollection(_pendingItemUpgrades); } } private void OnEnable() { _master.onBodyStart += setBody; _master.onBodyDestroyed += setBody; if (Object.op_Implicit((Object)(object)_master.inventory)) { _master.inventory.onInventoryChanged += onInventoryChanged; } Stage.onServerStageBegin += onServerStageBegin; setBody(_master.GetBody()); } private void OnDisable() { _master.onBodyStart -= setBody; _master.onBodyDestroyed -= setBody; if (Object.op_Implicit((Object)(object)_master.inventory)) { _master.inventory.onInventoryChanged -= onInventoryChanged; } Stage.onServerStageBegin -= onServerStageBegin; setBody(null); } private void setBody(CharacterBody body) { if (!((Object)(object)_cachedBody == (Object)(object)body)) { if (Object.op_Implicit((Object)(object)_bodyExtraStatsComponent)) { _bodyExtraStatsComponent.OnIncomingDamageServer -= onIncomingDamageServer; } _cachedBody = body; _bodyExtraStatsComponent = (Object.op_Implicit((Object)(object)body) ? ((Component)(object)body).GetComponentCached() : null); if (Object.op_Implicit((Object)(object)_bodyExtraStatsComponent)) { _bodyExtraStatsComponent.OnIncomingDamageServer += onIncomingDamageServer; } } } private void onInventoryChanged() { if (NetworkServer.active) { checkAllItemQualityUpgrades(); } } [Server] private bool checkAllItemQualityUpgrades() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Boolean ItemQualities.CharacterMasterExtraStatsTracker::checkAllItemQualityUpgrades()' called on client"); return false; } bool result = false; foreach (uint item in (SyncList)(object)_upgradeItemIndices) { ItemIndex upgradedItemIndex = (ItemIndex)item; if (checkItemQualityUpgrade(upgradedItemIndex)) { result = true; } } return result; } [Server] private bool checkItemQualityUpgrade(ItemIndex upgradedItemIndex) { //IL_001d: 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_003f: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Boolean ItemQualities.CharacterMasterExtraStatsTracker::checkItemQualityUpgrade(RoR2.ItemIndex)' called on client"); return false; } if (_pendingItemUpgrades.Any((PendingItemUpgrade p) => p.UpgradeItemIndex == upgradedItemIndex)) { return true; } ItemQualityGroup itemQualityGroup = QualityCatalog.GetItemQualityGroup(QualityCatalog.FindItemQualityGroupIndex(upgradedItemIndex)); QualityTier qualityTier = QualityCatalog.GetQualityTier(upgradedItemIndex); bool flag = false; CanTakeResult val = default(CanTakeResult); for (QualityTier qualityTier2 = QualityTier.None; qualityTier2 < qualityTier; qualityTier2++) { ItemTransformation upgradeItemTransformation = getUpgradeItemTransformation(itemQualityGroup.GetItemIndex(qualityTier2), upgradedItemIndex); if (((ItemTransformation)(ref upgradeItemTransformation)).CanTake(_master.inventory, ref val)) { flag = true; } } if (flag) { _pendingItemUpgrades.Add(new PendingItemUpgrade(upgradedItemIndex, FixedTimeStamp.now + ItemUpgradeDelay)); } return flag; } private static ItemTransformation getUpgradeItemTransformation(ItemIndex originalItemIndex, ItemIndex upgradedItemIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) QualityTier qualityTier = QualityCatalog.GetQualityTier(upgradedItemIndex); ItemTransformationTypeIndex transformationType = (ItemTransformationTypeIndex)(104 + qualityTier); ItemTransformation result = default(ItemTransformation); ((ItemTransformation)(ref result)).originalItemIndex = originalItemIndex; ((ItemTransformation)(ref result)).newItemIndex = upgradedItemIndex; ((ItemTransformation)(ref result)).minToTransform = 1; ((ItemTransformation)(ref result)).maxToTransform = int.MaxValue; result.transformationType = transformationType; return result; } public bool HasUpgradeForItem(ItemIndex itemIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) QualityTier qualityTier = QualityCatalog.GetQualityTier(itemIndex); ItemQualityGroupIndex itemQualityGroupIndex = QualityCatalog.FindItemQualityGroupIndex(itemIndex); foreach (uint item in (SyncList)(object)_upgradeItemIndices) { QualityTier qualityTier2 = QualityCatalog.GetQualityTier((ItemIndex)item); if (QualityCatalog.FindItemQualityGroupIndex((ItemIndex)item) == itemQualityGroupIndex) { if (qualityTier2 > qualityTier) { return true; } break; } } return false; } [Server] public ItemIndex TryPermanentUpgradeRandomItemToQualityTier(Xoroshiro128Plus rng, QualityTier targetQualityTier) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_006e: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0237: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Expected I4, but got Unknown //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Expected I4, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_031f: 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_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'RoR2.ItemIndex ItemQualities.CharacterMasterExtraStatsTracker::TryPermanentUpgradeRandomItemToQualityTier(Xoroshiro128Plus,ItemQualities.QualityTier)' called on client"); return default(ItemIndex); } QualityTier targetQualityTier2 = targetQualityTier; CharacterMasterExtraStatsTracker characterMasterExtraStatsTracker = this; List list = default(List); DisposableRental> val = CollectionPool>.RentCollection(ref list); try { List list2 = default(List); DisposableRental> val2 = CollectionPool>.RentCollection(ref list2); try { ((ItemCollection)(ref _master.inventory.permanentItemStacks)).GetNonZeroIndices(list2); foreach (ItemIndex item in list2) { if (canUpgrade(item)) { list.Add(item); } } } finally { val2.Dispose(); } if (list.Count == 0) { List list3 = default(List); val2 = CollectionPool>.RentCollection(ref list3); try { ((TempItemsStorage)(ref _master.inventory.tempItemsStorage)).GetNonZeroIndices(list3); foreach (ItemIndex item2 in list3) { if (canUpgrade(item2)) { list.Add(item2); } } } finally { val2.Dispose(); } } WeightedSelection itemSelection; if (list.Count == 0) { itemSelection = new WeightedSelection(8); addDropListToSelection(Run.instance.availableTier1DropList, 1f); addDropListToSelection(Run.instance.availableTier2DropList, 0.7f); addDropListToSelection(Run.instance.availableTier3DropList, 0.2f); addDropListToSelection(Run.instance.availableVoidTier1DropList, 0.4f); addDropListToSelection(Run.instance.availableVoidTier2DropList, 0.4f); addDropListToSelection(Run.instance.availableVoidTier3DropList, 0.2f); addDropListToSelection(Run.instance.availableBossDropList, 0.2f); addDropListToSelection(Run.instance.availableVoidBossDropList, 0.1f); int num = Mathf.Min(20, itemSelection.Count); for (int i = 0; i < num; i++) { int num2 = itemSelection.EvaluateToChoiceIndex(rng.nextNormalizedFloat); ItemIndex value = itemSelection.GetChoice(num2).value; list.Add(value); itemSelection.RemoveChoice(num2); } } if (list.Count == 0) { return (ItemIndex)(-1); } ItemIndex itemIndexOfQuality = QualityCatalog.GetItemIndexOfQuality(rng.NextElementUniform(list), targetQualityTier2); ItemQualityGroupIndex itemQualityGroupIndex = QualityCatalog.FindItemQualityGroupIndex(itemIndexOfQuality); bool flag = false; for (int num3 = ((SyncList)(object)_upgradeItemIndices).Count - 1; num3 >= 0; num3--) { if (QualityCatalog.FindItemQualityGroupIndex((ItemIndex)((SyncList)(object)_upgradeItemIndices)[num3]) == itemQualityGroupIndex) { ((SyncList)(object)_upgradeItemIndices)[num3] = (uint)(int)itemIndexOfQuality; flag = true; break; } } if (!flag) { ((SyncList)(object)_upgradeItemIndices).Add((uint)(int)itemIndexOfQuality); } if (!checkItemQualityUpgrade(itemIndexOfQuality)) { CustomOverrideInfo val3 = new CustomOverrideInfo().SetDescriptionText("QUALITY_HEALANDREVIVE_PICKUP_NOTIFICATION_UPGRADED_" + targetQualityTier2.ToString().ToUpper()); CharacterMasterNotificationQueue.SendCustomNotification(_master, itemIndexOfQuality, val3); } return itemIndexOfQuality; void addDropListToSelection(List dropList, float weight) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 //IL_0024: 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) foreach (PickupIndex drop in dropList) { PickupDef pickupDef = PickupCatalog.GetPickupDef(drop); if (pickupDef != null && (int)pickupDef.itemIndex != -1 && canUpgrade(pickupDef.itemIndex)) { itemSelection.AddChoice(pickupDef.itemIndex, weight); } } } } finally { val.Dispose(); } bool canUpgrade(ItemIndex itemIndex) { //IL_0000: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex); if (itemDef.isConsumed) { return false; } if (itemDef.ContainsTag((ItemTag)10)) { return false; } if (QualityCatalog.GetQualityTier(itemIndex) >= targetQualityTier2) { return false; } ItemQualityGroupIndex itemQualityGroupIndex2 = QualityCatalog.FindItemQualityGroupIndex(itemIndex); if (itemQualityGroupIndex2 == ItemQualityGroupIndex.Invalid) { return false; } foreach (uint item3 in (SyncList)(object)_upgradeItemIndices) { ItemIndex itemIndex2 = (ItemIndex)item3; if (QualityCatalog.FindItemQualityGroupIndex(itemIndex2) == itemQualityGroupIndex2) { if (QualityCatalog.GetQualityTier(itemIndex2) < targetQualityTier2) { break; } return false; } } ItemIndex itemIndex3 = QualityCatalog.GetItemQualityGroup(itemQualityGroupIndex2).GetItemIndex(targetQualityTier2); if ((int)itemIndex3 == -1) { return false; } if (!Run.instance.ruleBook.IsItemRuleEnabled(itemIndex3) || Run.instance.IsItemExpansionLocked(itemIndex3)) { return false; } return true; } } private void FixedUpdate() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_0073: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } TryTransformResult val = default(TryTransformResult); for (int num = _pendingItemUpgrades.Count - 1; num >= 0; num--) { PendingItemUpgrade value = _pendingItemUpgrades[num]; if (((FixedTimeStamp)(ref value.TimeStamp)).hasPassed) { ItemQualityGroup itemQualityGroup = QualityCatalog.GetItemQualityGroup(QualityCatalog.FindItemQualityGroupIndex(value.UpgradeItemIndex)); QualityTier qualityTier = QualityCatalog.GetQualityTier(value.UpgradeItemIndex); bool flag = false; for (QualityTier qualityTier2 = QualityTier.None; qualityTier2 < qualityTier; qualityTier2++) { ItemTransformation upgradeItemTransformation = getUpgradeItemTransformation(itemQualityGroup.GetItemIndex(qualityTier2), value.UpgradeItemIndex); if (((ItemTransformation)(ref upgradeItemTransformation)).TryTransform(_master.inventory, ref val)) { flag = true; } } if (flag) { _pendingItemUpgrades.RemoveAt(num); } else { value.TimeStamp = FixedTimeStamp.now + ItemUpgradeDelay; _pendingItemUpgrades[num] = value; } } } } private void onServerStageBegin(Stage stage) { if (_stageIncomingDamageInstanceCountServer != 0) { _stageIncomingDamageInstanceCountServer = 0; this.OnStageDamageInstancesTakenCountChangedServer?.Invoke(this); } } private void onIncomingDamageServer(DamageInfo damageInfo) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (damageInfo.damage > 0f && !damageInfo.delayedDamageSecondHalf && DamageTypeCombo.op_Implicit(damageInfo.damageType & DamageTypeCombo.op_Implicit((DamageType)67108864)) == 0L && !damageInfo.IsParried()) { _stageIncomingDamageInstanceCountServer++; this.OnStageDamageInstancesTakenCountChangedServer?.Invoke(this); } } private void markBodyStatsDirty() { if (Object.op_Implicit((Object)(object)_cachedBody)) { _cachedBody.MarkAllStatsDirty(); } } private void hookSetSteakBonus(float steakBonus) { bool num = SteakBonus != steakBonus; NetworkSteakBonus = steakBonus; if (num) { markBodyStatsDirty(); } } private void hookSetSpeedOnPickupBonus(int speedOnPickupBonus) { bool num = SpeedOnPickupBonus != speedOnPickupBonus; NetworkSpeedOnPickupBonus = speedOnPickupBonus; if (num) { markBodyStatsDirty(); } } private void hookSetBossDamageBonusTicks(int bossDamageBonusTicks) { bool num = BossDamageBonusTicks != bossDamageBonusTicks; NetworkBossDamageBonusTicks = bossDamageBonusTicks; if (num) { this.OnBossDamageBonusTicksChanged?.Invoke(this); } } static CharacterMasterExtraStatsTracker() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown ItemUpgradeDelay = 0.4f; kList_upgradeItemIndices = -1112611593; NetworkBehaviour.RegisterSyncListDelegate(typeof(CharacterMasterExtraStatsTracker), kList_upgradeItemIndices, new CmdDelegate(InvokeSyncList_upgradeItemIndices)); NetworkCRC.RegisterBehaviour("CharacterMasterExtraStatsTracker", 0); } private void UNetVersion() { } protected static void InvokeSyncList_upgradeItemIndices(NetworkBehaviour obj, NetworkReader reader) { if (!NetworkClient.active) { Debug.LogError((object)"SyncList _upgradeItemIndices called on server."); } else { ((SyncList)(object)((CharacterMasterExtraStatsTracker)(object)obj)._upgradeItemIndices).HandleMsg(reader); } } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { if (forceAll) { writer.Write(SteakBonus); writer.WritePackedUInt32((uint)SpeedOnPickupBonus); writer.WritePackedUInt32((uint)BossDamageBonusTicks); GeneratedNetworkCode._WriteStoredInteractableInfo_None(writer, CardStoredInteractableInfo); SyncListUInt.WriteInstance(writer, _upgradeItemIndices); return true; } bool flag = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(SteakBonus); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 2u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32((uint)SpeedOnPickupBonus); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 4u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32((uint)BossDamageBonusTicks); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 8u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } GeneratedNetworkCode._WriteStoredInteractableInfo_None(writer, CardStoredInteractableInfo); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 0x10u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } SyncListUInt.WriteInstance(writer, _upgradeItemIndices); } if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { if (initialState) { SteakBonus = reader.ReadSingle(); SpeedOnPickupBonus = (int)reader.ReadPackedUInt32(); BossDamageBonusTicks = (int)reader.ReadPackedUInt32(); CardStoredInteractableInfo = GeneratedNetworkCode._ReadStoredInteractableInfo_None(reader); SyncListUInt.ReadReference(reader, _upgradeItemIndices); return; } int num = (int)reader.ReadPackedUInt32(); if (((uint)num & (true ? 1u : 0u)) != 0) { hookSetSteakBonus(reader.ReadSingle()); } if (((uint)num & 2u) != 0) { hookSetSpeedOnPickupBonus((int)reader.ReadPackedUInt32()); } if (((uint)num & 4u) != 0) { hookSetBossDamageBonusTicks((int)reader.ReadPackedUInt32()); } if (((uint)num & 8u) != 0) { CardStoredInteractableInfo = GeneratedNetworkCode._ReadStoredInteractableInfo_None(reader); } if (((uint)num & 0x10u) != 0) { SyncListUInt.ReadReference(reader, _upgradeItemIndices); } } public override void PreStartClient() { } } [RequireComponent(typeof(TemporaryVisualEffect))] public sealed class CharacterOutlineVisualEffect : MonoBehaviour { public HighlightColor HighlightColor; public Color CustomHighlightColor = Color.black; public float HighlightStrength = 1f; private TemporaryVisualEffect _visualEffect; private Highlight _highlight; private void Awake() { _visualEffect = ((Component)this).GetComponent(); } private void OnEnable() { //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) CharacterModel val = null; if (Object.op_Implicit((Object)(object)_visualEffect) && Object.op_Implicit((Object)(object)_visualEffect.healthComponent)) { CharacterBody body = _visualEffect.healthComponent.body; if (Object.op_Implicit((Object)(object)body)) { ModelLocator modelLocator = body.modelLocator; if (Object.op_Implicit((Object)(object)modelLocator) && Object.op_Implicit((Object)(object)modelLocator.modelTransform)) { val = ((Component)modelLocator.modelTransform).GetComponent(); } } } List list = new List(); if (Object.op_Implicit((Object)(object)val)) { RendererInfo[] baseRendererInfos = val.baseRendererInfos; foreach (RendererInfo val2 in baseRendererInfos) { if (!val2.ignoreOverlays && Object.op_Implicit((Object)(object)val2.renderer)) { list.Add(val2.renderer); } } } if (list.Count > 0) { if (!Object.op_Implicit((Object)(object)_highlight)) { _highlight = ((Component)this).gameObject.AddComponent(); _highlight.strength = HighlightStrength; _highlight.highlightColor = HighlightColor; _highlight.CustomColor = CustomHighlightColor; _highlight.isOn = true; } else { ((Behaviour)_highlight).enabled = true; } _highlight.SetTargetRendererList(list); } } private void OnDisable() { if (Object.op_Implicit((Object)(object)_highlight)) { ((Behaviour)_highlight).enabled = false; } } } [CreateAssetMenu(menuName = "ItemQualities/ColorRampDef")] public sealed class ColorRampDef : ScriptableObject { [Serializable] public struct Segment { public string Name; public Gradient Gradient; } [Tooltip("The width of the generated texture")] [Min(1f)] public int TextureWidth = 256; [Tooltip("The height of each gradient segment")] [Min(1f)] public int SegmentHeight = 16; public Segment[] Segments = Array.Empty(); } internal static class ComponentCache { private static class TypedCache where T : Component { private static readonly Dictionary, T> _componentLookup = new Dictionary, T>(); [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryGetValue(GameObject gameObject, out T component) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _componentLookup.TryGetValue(UnityObjectWrapperKey.op_Implicit(gameObject), out component); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryAdd(GameObject gameObject, T component) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _componentLookup.TryAdd(UnityObjectWrapperKey.op_Implicit(gameObject), component); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool Remove(GameObject gameObject) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _componentLookup.Remove(UnityObjectWrapperKey.op_Implicit(gameObject)); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryGetComponent(GameObject gameObject, out T component) where T : Component { return TypedCache.TryGetValue(gameObject, out component); } public static void Add(GameObject gameObject, T component) where T : Component { if (gameObject == null) { Log.Error(string.Format("({0}) {1} is null. {2}", typeof(T).FullName, "gameObject", new StackTrace()), "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ComponentCache.cs", "Add", 22); } else if (!TypedCache.TryAdd(gameObject, component)) { Log.Error($"({typeof(T).FullName}) Duplicate component registered to object {Util.GetGameObjectHierarchyName(gameObject)}. {new StackTrace()}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ComponentCache.cs", "Add", 28); } } public static void Remove(GameObject gameObject, T component) where T : Component { T component2; if (gameObject == null) { Log.Error(string.Format("({0}) {1} is null. {2}", typeof(T).FullName, "gameObject", new StackTrace()), "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ComponentCache.cs", "Remove", 36); } else if (TypedCache.TryGetValue(gameObject, out component2)) { if ((Object)(object)component2 == (Object)(object)component) { TypedCache.Remove(gameObject); } else { Log.Error($"({typeof(T).FullName}) Attempting to remove non-cached component registered to object {Util.GetGameObjectHierarchyName(gameObject)}. {new StackTrace()}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ComponentCache.cs", "Remove", 48); } } } } public static class Configs { public static class Debug { public const bool LogItemQualities = false; public const bool EnableDebugDraw = false; } public static class General { private const string SectionName = "General"; public static ConfigEntry DifficultyCoefficientMultiplier { get; private set; } public static ConfigEntry GlobalQualityChance { get; private set; } internal static void Init(ConfigFile configFile) { //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_0034: Expected O, but got Unknown //IL_0034: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_0071: Expected O, but got Unknown DifficultyCoefficientMultiplier = configFile.Bind(new ConfigDefinition("General", "Difficulty Multiplier"), 1.25f, new ConfigDescription("Multiplier to difficulty scaling.", (AcceptableValueBase)(object)new AcceptableValueMin(1f), Array.Empty())); GlobalQualityChance = configFile.Bind(new ConfigDefinition("General", "Global Quality Chance"), 4f, new ConfigDescription("The % chance for an item not from a quality chest to be of quality", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f), Array.Empty())); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] internal static void InitRiskOfOptions() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new SliderOption(DifficultyCoefficientMultiplier, new SliderConfig { min = 1f, max = 5f, FormatString = "{0:0.##}x" }), "com.Gorakh.ItemQualities", "Quality"); ModSettingsManager.AddOption((BaseOption)new SliderOption(GlobalQualityChance, new SliderConfig { min = 0f, max = 100f, FormatString = "{0:0.#}%" }), "com.Gorakh.ItemQualities", "Quality"); } } public static class Interface { private const string SectionName = "UI"; public static ConfigEntry EnableQualityItemSorting { get; private set; } internal static void Init(ConfigFile configFile) { //IL_000b: 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_0026: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown EnableQualityItemSorting = configFile.Bind(new ConfigDefinition("UI", "Enable Quality Item Grouping"), true, new ConfigDescription("If enabled, all quality items (including non-quality item) will be sorted and grouped together in inventories.", (AcceptableValueBase)null, Array.Empty())); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] internal static void InitRiskOfOptions() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(EnableQualityItemSorting), "com.Gorakh.ItemQualities", "Quality"); } } private const string ModGuid = "com.Gorakh.ItemQualities"; private const string ModName = "Quality"; internal static void Init(ConfigFile configFile) { configFile.SaveOnConfigSet = false; General.Init(configFile); Interface.Init(configFile); configFile.SaveOnConfigSet = true; configFile.Save(); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] internal static void InitRiskOfOptions() { ModSettingsManager.SetModDescription("Settings for Quality", "com.Gorakh.ItemQualities", "Quality"); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate { if (Object.op_Implicit((Object)(object)ItemQualitiesContent.Sprites.ModIcon)) { ModSettingsManager.SetModIcon(ItemQualitiesContent.Sprites.ModIcon, "com.Gorakh.ItemQualities", "Quality"); } }); General.InitRiskOfOptions(); Interface.InitRiskOfOptions(); } } public sealed class ConstantBoneOffset : MonoBehaviour { public Vector3 PositionOffset; [SerializeField] private Animator _animator; private Vector3 _lastLocalPosition; private void OnEnable() { //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) _lastLocalPosition = Vector3.positiveInfinity; } private void LateUpdate() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_animator) && ((Behaviour)_animator).isActiveAndEnabled) { Vector3 val = ((Component)this).transform.localPosition - _lastLocalPosition; if (((Vector3)(ref val)).sqrMagnitude >= 0.0001f) { Transform transform = ((Component)this).transform; transform.localPosition += PositionOffset; _lastLocalPosition = ((Component)this).transform.localPosition; } } } } internal static class ContagiousItemQualityHandler { [SystemInitializer(new Type[] { })] private static void Init() { //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 ContagiousItemManager.OnInventoryChangedGlobal += new Manipulator(ContagiousItemManager_OnInventoryChangedGlobal); ContagiousItemManager.StepInventoryInfection += new Manipulator(ContagiousItemManager_StepInventoryInfection); } private static ItemIndex getItemForTransformation(ItemIndex itemIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) return QualityCatalog.GetItemIndexOfQuality(itemIndex, QualityTier.None); } private static void ContagiousItemManager_OnInventoryChangedGlobal(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); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(ContagiousItemManager), "_transformationInfos"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "GetItemCountEffective") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ContagiousItemQualityHandler.cs", "ContagiousItemManager_OnInventoryChangedGlobal", 30); return; } val.Goto(array[1].Next, (MoveType)0, false); val.EmitDelegate>((Func)getItemForTransformation); } private static void ContagiousItemManager_StepInventoryInfection(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); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(ContagiousItemManager), "originalToTransformed"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "GetItemCountEffective") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ContagiousItemQualityHandler.cs", "ContagiousItemManager_StepInventoryInfection", 46); return; } val.Goto(array[1].Next, (MoveType)0, false); val.EmitDelegate>((Func)getItemForTransformation); } } internal static class CustomCostTypeIndex { private static EffectIndex _regeneratingScrapDisplayExplosionEffectIndex = (EffectIndex)(-1); private static EffectIndex _regeneratingScrapPrinterExplosionEffectIndex = (EffectIndex)(-1); private static NetworkSoundEventIndex _regeneratingScrapProcSoundEventIndex = (NetworkSoundEventIndex)(-1); private static readonly CostTypeDef _whiteItemQualityCostDef = new CostTypeDef { name = "WhiteItemQuality", colorIndex = (ColorIndex)1, itemTier = (ItemTier)0, costStringFormatToken = "COST_QUALITY_ITEM_FORMAT", isAffordable = new IsAffordableDelegate(isAffordableQualityItems), payCost = new PayCostDelegate(payCostQualityItems) }; private static readonly CostTypeDef _greenItemQualityCostDef = new CostTypeDef { name = "GreenItemQuality", colorIndex = (ColorIndex)2, itemTier = (ItemTier)1, costStringFormatToken = "COST_QUALITY_ITEM_FORMAT", isAffordable = new IsAffordableDelegate(isAffordableQualityItems), payCost = new PayCostDelegate(payCostQualityItems) }; private static readonly CostTypeDef _redItemQualityCostDef = new CostTypeDef { name = "RedItemQuality", colorIndex = (ColorIndex)3, itemTier = (ItemTier)2, saturateWorldStyledCostString = false, costStringFormatToken = "COST_QUALITY_ITEM_FORMAT", isAffordable = new IsAffordableDelegate(isAffordableQualityItems), payCost = new PayCostDelegate(payCostQualityItems) }; private static readonly CostTypeDef _bossItemQualityCostDef = new CostTypeDef { name = "BossItemQuality", colorIndex = (ColorIndex)13, itemTier = (ItemTier)4, costStringFormatToken = "COST_QUALITY_ITEM_FORMAT", isAffordable = new IsAffordableDelegate(isAffordableQualityItems), payCost = new PayCostDelegate(payCostQualityItems) }; public static CostTypeIndex WhiteItemQuality { get; private set; } = (CostTypeIndex)0; public static CostTypeIndex GreenItemQuality { get; private set; } = (CostTypeIndex)0; public static CostTypeIndex RedItemQuality { get; private set; } = (CostTypeIndex)0; public static CostTypeIndex BossItemQuality { get; private set; } = (CostTypeIndex)0; [SystemInitializer(new Type[] { typeof(CostTypeCatalog), typeof(EffectCatalogUtils), typeof(NetworkSoundEventCatalog) })] private static void Init() { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Invalid comparison between Unknown and I4 //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Invalid comparison between Unknown and I4 //IL_008b: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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) _regeneratingScrapDisplayExplosionEffectIndex = EffectCatalogUtils.FindEffectIndex("RegeneratingScrapExplosionDisplay"); if ((int)_regeneratingScrapDisplayExplosionEffectIndex == -1) { Log.Warning("Failed to find RegeneratingScrapExplosionDisplay effect index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\CustomCostTypeIndex.cs", "Init", 74); } _regeneratingScrapPrinterExplosionEffectIndex = EffectCatalogUtils.FindEffectIndex("RegeneratingScrapExplosionInPrinter"); if ((int)_regeneratingScrapPrinterExplosionEffectIndex == -1) { Log.Warning("Failed to find RegeneratingScrapExplosionInPrinter effect index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\CustomCostTypeIndex.cs", "Init", 80); } _regeneratingScrapProcSoundEventIndex = NetworkSoundEventCatalog.FindNetworkSoundEventIndex("Play_item_proc_regenScrap_consume"); if ((int)_regeneratingScrapProcSoundEventIndex == -1) { Log.Warning("Failed to find regenerating scrap proc sound event index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\CustomCostTypeIndex.cs", "Init", 86); } for (CostTypeIndex val = (CostTypeIndex)0; (int)val < CostTypeCatalog.costTypeCount; val = (CostTypeIndex)(val + 1)) { CostTypeDef costTypeDef = CostTypeCatalog.GetCostTypeDef(val); if (costTypeDef == _whiteItemQualityCostDef) { WhiteItemQuality = val; } else if (costTypeDef == _greenItemQualityCostDef) { GreenItemQuality = val; } else if (costTypeDef == _redItemQualityCostDef) { RedItemQuality = val; } else if (costTypeDef == _bossItemQualityCostDef) { BossItemQuality = val; } } } internal static void Register() { CostTypeCatalog.modHelper.getAdditionalEntries += getAdditionalEntries; } private static void getAdditionalEntries(List costTypeDefs) { costTypeDefs.Add(_whiteItemQualityCostDef); costTypeDefs.Add(_greenItemQualityCostDef); costTypeDefs.Add(_redItemQualityCostDef); costTypeDefs.Add(_bossItemQualityCostDef); } private static bool isAffordableQualityItems(CostTypeDef costTypeDef, IsAffordableContext context) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) CharacterBody val = (Object.op_Implicit((Object)(object)context.activator) ? ((Component)context.activator).GetComponent() : null); Inventory val2 = (Object.op_Implicit((Object)(object)val) ? val.inventory : null); if (Object.op_Implicit((Object)(object)val2)) { return val2.HasAtLeastXTotalQualityItemsOfTierForPurchase(costTypeDef.itemTier, context.cost); } return false; } private static void payCostQualityItems(PayCostContext context, PayCostResults result) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Invalid comparison between Unknown and I4 //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Invalid comparison between Unknown and I4 //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Invalid comparison between Unknown and I4 //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Invalid comparison between Unknown and I4 //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Invalid comparison between Unknown and I4 //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_04bf: Unknown result type (might be due to invalid IL or missing references) //IL_04c4: Unknown result type (might be due to invalid IL or missing references) //IL_04c7: Unknown result type (might be due to invalid IL or missing references) //IL_04d3: Expected O, but got Unknown //IL_04e7: Unknown result type (might be due to invalid IL or missing references) //IL_0437: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Expected O, but got Unknown //IL_0462: Unknown result type (might be due to invalid IL or missing references) List itemsToTake = default(List); if (Object.op_Implicit((Object)(object)context.activatorBody)) { Inventory inventory = context.activatorBody.inventory; if (Object.op_Implicit((Object)(object)inventory)) { DisposableRental> val = CollectionPool>.RentCollection(ref itemsToTake); try { WeightedSelection val2 = new WeightedSelection(8); WeightedSelection[] array = new WeightedSelection[4]; WeightedSelection[] array2 = new WeightedSelection[4]; ItemQualityGroupIndex itemQualityGroupIndex = QualityCatalog.FindItemQualityGroupIndex(context.avoidedItemIndex); for (ItemIndex val3 = (ItemIndex)0; (int)val3 < ItemCatalog.itemCount; val3 = (ItemIndex)(val3 + 1)) { QualityTier qualityTier = QualityCatalog.GetQualityTier(val3); if (qualityTier == QualityTier.None || QualityCatalog.FindItemQualityGroupIndex(val3) == itemQualityGroupIndex) { continue; } int itemCountPermanent = inventory.GetItemCountPermanent(val3); if (itemCountPermanent <= 0) { continue; } ItemDef itemDef = ItemCatalog.GetItemDef(val3); if (itemDef.tier == context.costTypeDef.itemTier && itemDef.canRemove && !itemDef.ContainsTag((ItemTag)33)) { WeightedSelection[] array3 = null; if (itemDef.ContainsTag((ItemTag)14)) { array3 = array2; } else if (itemDef.ContainsTag((ItemTag)10)) { array3 = array; } WeightedSelection val4; if (array3 != null) { WeightedSelection[] array4 = array3; int num = (int)qualityTier; val4 = array4[num] ?? (array4[num] = new WeightedSelection(8)); } else { val4 = val2; } val4.AddChoice(val3, (float)itemCountPermanent); } } TakeItemsFromWeightedSelections(array2); TakeItemsFromWeightedSelections(array); TakeItemsFromWeightedSelection(val2); ItemQualityGroup itemQualityGroup = QualityCatalog.GetItemQualityGroup(itemQualityGroupIndex); if (Object.op_Implicit((Object)(object)itemQualityGroup)) { if (itemsToTake.Count < context.cost) { Span span = stackalloc QualityTier[4]; for (QualityTier qualityTier2 = QualityTier.Uncommon; qualityTier2 < QualityTier.Count; qualityTier2++) { span[(int)qualityTier2] = qualityTier2; } Util.ShuffleSpan(span, context.rng); ItemQualityCounts itemCountsPermanent = inventory.GetItemCountsPermanent(itemQualityGroup); Span span2 = span; for (int num = 0; num < span2.Length; num++) { QualityTier qualityTier3 = span2[num]; int num2 = Math.Min(itemCountsPermanent[qualityTier3], context.cost - itemsToTake.Count); if (num2 > 0) { ItemIndex itemIndex = itemQualityGroup.GetItemIndex(qualityTier3); for (int i = 0; i < num2; i++) { itemsToTake.Add(itemIndex); } if (itemsToTake.Count >= context.cost) { break; } } } } } else { for (int j = itemsToTake.Count; j < context.cost; j++) { itemsToTake.Add(context.avoidedItemIndex); } } bool flag = false; TryTransformResult val7 = default(TryTransformResult); foreach (ItemIndex item in itemsToTake) { ItemTransformation val5 = default(ItemTransformation); ((ItemTransformation)(ref val5)).originalItemIndex = item; ((ItemTransformation)(ref val5)).newItemIndex = (ItemIndex)(-1); ((ItemTransformation)(ref val5)).maxToTransform = 1; ((ItemTransformation)(ref val5)).forbidTempItems = true; val5.transformationType = (ItemTransformationTypeIndex)(-1); ItemTransformation val6 = val5; if (QualityCatalog.FindItemQualityGroupIndex(((ItemTransformation)(ref val6)).originalItemIndex) == ItemQualitiesContent.ItemQualityGroups.RegeneratingScrap.GroupIndex) { ((ItemTransformation)(ref val6)).newItemIndex = ItemQualitiesContent.ItemQualityGroups.RegeneratingScrapConsumed.GetItemIndex(QualityCatalog.GetQualityTier(((ItemTransformation)(ref val6)).originalItemIndex)); } if ((int)((ItemTransformation)(ref val6)).newItemIndex != -1) { val6.transformationType = (ItemTransformationTypeIndex)0; } if (((ItemTransformation)(ref val6)).TryTransform(inventory, ref val7)) { result.AddTakenItemsFromTransformation(ref val7); if (QualityCatalog.FindItemQualityGroupIndex(val7.takenItem.itemIndex) == ItemQualitiesContent.ItemQualityGroups.RegeneratingScrap.GroupIndex) { flag = true; } } } if (flag) { if ((int)_regeneratingScrapProcSoundEventIndex != -1) { EntitySoundManager.EmitSoundServer(_regeneratingScrapProcSoundEventIndex, ((Component)context.activatorBody).gameObject); } if ((int)_regeneratingScrapDisplayExplosionEffectIndex != -1) { ModelLocator modelLocator = context.activatorBody.modelLocator; CharacterModel val8 = default(CharacterModel); if (Object.op_Implicit((Object)(object)modelLocator) && Object.op_Implicit((Object)(object)modelLocator.modelTransform) && ((Component)modelLocator.modelTransform).TryGetComponent(ref val8)) { List itemDisplayObjects = val8.GetItemDisplayObjects(Items.RegeneratingScrap.itemIndex); if (itemDisplayObjects.Count > 0) { GameObject val9 = itemDisplayObjects[0]; EffectData val10 = new EffectData { origin = val9.transform.position, rotation = val9.transform.rotation }; EffectManager.SpawnEffect(_regeneratingScrapDisplayExplosionEffectIndex, val10, true); } } } ModelLocator val11 = default(ModelLocator); if ((int)_regeneratingScrapPrinterExplosionEffectIndex != -1 && context.purchasedObject.TryGetComponent(ref val11)) { ChildLocator modelChildLocator = val11.modelChildLocator; if (Object.op_Implicit((Object)(object)modelChildLocator)) { int num3 = modelChildLocator.FindChildIndex("DropPivot"); Transform val12 = modelChildLocator.FindChild(num3); if (Object.op_Implicit((Object)(object)val12)) { EffectData val13 = new EffectData { origin = val12.position }; val13.SetChildLocatorTransformReference(context.purchasedObject, num3); EffectManager.SpawnEffect(_regeneratingScrapPrinterExplosionEffectIndex, val13, true); } } } } } finally { val.Dispose(); } } } MultiShopCardUtils.OnNonMoneyPurchase(context); void TakeItemFromWeightedSelection(WeightedSelection weightedSelection, int choiceIndex) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) ChoiceInfo choice = weightedSelection.GetChoice(choiceIndex); ItemIndex value = choice.value; int num4 = (int)choice.weight; num4--; if (num4 <= 0) { weightedSelection.RemoveChoice(choiceIndex); } else { weightedSelection.ModifyChoiceWeight(choiceIndex, (float)num4); } itemsToTake.Add(value); } void TakeItemsFromWeightedSelection(WeightedSelection weightedSelection) { while (weightedSelection.Count > 0 && itemsToTake.Count < context.cost) { int choiceIndex2 = weightedSelection.EvaluateToChoiceIndex(context.rng.nextNormalizedFloat); TakeItemFromWeightedSelection(weightedSelection, choiceIndex2); } } void TakeItemsFromWeightedSelections(WeightedSelection[] weightedSelections) { for (int num5 = weightedSelections.Length - 1; num5 >= 0; num5--) { if (weightedSelections[num5] != null) { TakeItemsFromWeightedSelection(weightedSelections[num5]); } } } } public static bool IsQualityItemCostType(CostTypeIndex costTypeIndex) { //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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (costTypeIndex != WhiteItemQuality && costTypeIndex != GreenItemQuality && costTypeIndex != RedItemQuality) { return costTypeIndex == BossItemQuality; } return true; } } internal static class CustomInteractableChestRevealerAdder { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) bool flag = false; List list = new List((IEnumerable)(object)ChestRevealer.TypesToCheck); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); foreach (Type type in types) { if (typeof(IInteractable).IsAssignableFrom(type) && !list.Contains(type)) { list.Add(type); flag = true; } } if (flag) { ChestRevealer.typesToCheck = list.ToArray(); } } } internal static class CustomInteractableHandler { [SystemInitializer(new Type[] { typeof(CustomCostTypeIndex) })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0017: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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) ClassicStageInfo.RebuildCards += new hook_RebuildCards(ClassicStageInfo_RebuildCards); AsyncOperationHandle handle = AddressableUtil.LoadAssetAsync(RoR2_Base_Chest1StealthedVariant.Chest1StealthedVariant_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject cloakedChest) { ChestBehavior val2 = default(ChestBehavior); if (cloakedChest.TryGetComponent(ref val2)) { PickupDropTable val3 = null; ChestBehavior val4 = default(ChestBehavior); if (Object.op_Implicit((Object)(object)ItemQualitiesContent.SpawnCards.QualityChest1) && Object.op_Implicit((Object)(object)((SpawnCard)ItemQualitiesContent.SpawnCards.QualityChest1).prefab) && ((SpawnCard)ItemQualitiesContent.SpawnCards.QualityChest1).prefab.TryGetComponent(ref val4)) { val3 = val4.dropTable; } if (Object.op_Implicit((Object)(object)val3)) { val2.dropTable = val3; } } }); setInteractableCostType(ItemQualitiesContent.SpawnCards.QualityDuplicator, CustomCostTypeIndex.WhiteItemQuality); setInteractableCostType(ItemQualitiesContent.SpawnCards.QualityDuplicatorLarge, CustomCostTypeIndex.GreenItemQuality); setInteractableCostType(ItemQualitiesContent.SpawnCards.QualityDuplicatorMilitary, CustomCostTypeIndex.RedItemQuality); setInteractableCostType(ItemQualitiesContent.SpawnCards.QualityDuplicatorWild, CustomCostTypeIndex.BossItemQuality); static void setInteractableCostType(InteractableSpawnCard spawnCard, CostTypeIndex costType) { //IL_0063: 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_0079: 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) if (!Object.op_Implicit((Object)(object)spawnCard)) { Log.Error($"Null spawncard: {new StackTrace()}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\CustomInteractableHandler.cs", "Init", 41); } else if (!Object.op_Implicit((Object)(object)((SpawnCard)spawnCard).prefab)) { Log.Error($"Null prefab in spawncard {spawnCard}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\CustomInteractableHandler.cs", "Init", 47); } else { PurchaseInteraction val = default(PurchaseInteraction); if (((SpawnCard)spawnCard).prefab.TryGetComponent(ref val)) { val.costType = costType; } QualityDuplicatorBehavior qualityDuplicatorBehavior = default(QualityDuplicatorBehavior); if (((SpawnCard)spawnCard).prefab.TryGetComponent(ref qualityDuplicatorBehavior)) { qualityDuplicatorBehavior.CostTypeIndex = costType; } } } } private static void ClassicStageInfo_RebuildCards(orig_RebuildCards orig, ClassicStageInfo self, DirectorCardCategorySelection forcedMonsterCategory, DirectorCardCategorySelection forcedInteractableCategory) { orig.Invoke(self, forcedMonsterCategory, forcedInteractableCategory); if (Object.op_Implicit((Object)(object)self.interactableCategories)) { tryAddCustomInteractables(self.interactableCategories); } } private static void tryAddCustomInteractables(DirectorCardCategorySelection dccs) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Expected O, but got Unknown //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Expected O, but got Unknown //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Expected O, but got Unknown //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Expected O, but got Unknown //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Expected O, but got Unknown //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Expected O, but got Unknown bool flag = false; bool flag2 = false; bool flag3 = false; bool flag4 = false; bool flag5 = false; bool flag6 = false; bool flag7 = false; Category[] categories = dccs.categories; for (int i = 0; i < categories.Length; i++) { DirectorCard[] cards = categories[i].cards; foreach (DirectorCard val in cards) { flag |= (Object)(object)val.spawnCard == (Object)(object)ItemQualitiesContent.SpawnCards.QualityEquipmentBarrel; flag2 |= (Object)(object)val.spawnCard == (Object)(object)ItemQualitiesContent.SpawnCards.QualityChest1; flag3 |= (Object)(object)val.spawnCard == (Object)(object)ItemQualitiesContent.SpawnCards.QualityChest2; flag4 |= (Object)(object)val.spawnCard == (Object)(object)ItemQualitiesContent.SpawnCards.QualityDuplicator; flag5 |= (Object)(object)val.spawnCard == (Object)(object)ItemQualitiesContent.SpawnCards.QualityDuplicatorLarge; flag6 |= (Object)(object)val.spawnCard == (Object)(object)ItemQualitiesContent.SpawnCards.QualityDuplicatorMilitary; flag7 |= (Object)(object)val.spawnCard == (Object)(object)ItemQualitiesContent.SpawnCards.QualityDuplicatorWild; } } for (int k = 0; k < dccs.categories.Length; k++) { ref Category reference = ref dccs.categories[k]; DirectorCard val2 = null; DirectorCard val3 = null; DirectorCard val4 = null; DirectorCard val5 = null; DirectorCard val6 = null; DirectorCard val7 = null; DirectorCard val8 = null; DirectorCard[] cards = reference.cards; foreach (DirectorCard val9 in cards) { if (val2 == null && matchDirectorCard(val9, "iscEquipmentBarrel", RoR2_Base_EquipmentBarrel.iscEquipmentBarrel_asset)) { val2 = val9; } else if (val3 == null && matchDirectorCard(val9, "iscChest1", RoR2_Base_Chest1.iscChest1_asset)) { val3 = val9; } else if (val4 == null && matchDirectorCard(val9, "iscChest2", RoR2_Base_Chest2.iscChest2_asset)) { val4 = val9; } else if (val5 == null && matchDirectorCard(val9, "iscDuplicator", RoR2_Base_Duplicator.iscDuplicator_asset)) { val5 = val9; } else if (val6 == null && matchDirectorCard(val9, "iscDuplicatorLarge", RoR2_Base_DuplicatorLarge.iscDuplicatorLarge_asset)) { val6 = val9; } else if (val7 == null && matchDirectorCard(val9, "iscDuplicatorMilitary", RoR2_Base_DuplicatorMilitary.iscDuplicatorMilitary_asset)) { val7 = val9; } else if (val8 == null && matchDirectorCard(val9, "iscDuplicatorWild", RoR2_Base_DuplicatorWild.iscDuplicatorWild_asset)) { val8 = val9; } } if (val2 != null && !flag) { DirectorCard val10 = new DirectorCard { spawnCard = (SpawnCard)(object)ItemQualitiesContent.SpawnCards.QualityEquipmentBarrel, selectionWeight = Mathf.Max(1, Mathf.RoundToInt((float)val2.selectionWeight * 0.6f)), minimumStageCompletions = val2.minimumStageCompletions }; ArrayUtils.ArrayAppend(ref reference.cards, ref val10); flag = true; } if (val3 != null && !flag2) { DirectorCard val11 = new DirectorCard { spawnCard = (SpawnCard)(object)ItemQualitiesContent.SpawnCards.QualityChest1, selectionWeight = Mathf.Max(1, Mathf.RoundToInt((float)val3.selectionWeight * 0.3f)), minimumStageCompletions = val3.minimumStageCompletions }; ArrayUtils.ArrayAppend(ref reference.cards, ref val11); flag2 = true; } if (val4 != null && !flag3) { DirectorCard val12 = new DirectorCard { spawnCard = (SpawnCard)(object)ItemQualitiesContent.SpawnCards.QualityChest2, selectionWeight = Mathf.Max(1, Mathf.RoundToInt((float)val4.selectionWeight * 0.35f)), minimumStageCompletions = val4.minimumStageCompletions }; ArrayUtils.ArrayAppend(ref reference.cards, ref val12); flag3 = true; } if (val5 != null && !flag4) { DirectorCard val13 = new DirectorCard { spawnCard = (SpawnCard)(object)ItemQualitiesContent.SpawnCards.QualityDuplicator, selectionWeight = Mathf.Max(1, Mathf.RoundToInt((float)val5.selectionWeight * 0.3f)), minimumStageCompletions = val5.minimumStageCompletions }; ArrayUtils.ArrayAppend(ref reference.cards, ref val13); flag4 = true; } if (val6 != null && !flag5) { DirectorCard val14 = new DirectorCard { spawnCard = (SpawnCard)(object)ItemQualitiesContent.SpawnCards.QualityDuplicatorLarge, selectionWeight = Mathf.Max(1, Mathf.RoundToInt((float)val6.selectionWeight * 0.9f)), minimumStageCompletions = val6.minimumStageCompletions }; ArrayUtils.ArrayAppend(ref reference.cards, ref val14); flag5 = true; } if (val7 != null && !flag6) { DirectorCard val15 = new DirectorCard { spawnCard = (SpawnCard)(object)ItemQualitiesContent.SpawnCards.QualityDuplicatorMilitary, selectionWeight = val7.selectionWeight, minimumStageCompletions = val7.minimumStageCompletions }; ArrayUtils.ArrayAppend(ref reference.cards, ref val15); flag6 = true; } } } private static bool matchDirectorCard(DirectorCard directorCard, string spawnCardName, string spawnCardGuid) { if (directorCard == null) { return false; } if (!Object.op_Implicit((Object)(object)directorCard.spawnCard) || !(((Object)directorCard.spawnCard).name == spawnCardName)) { if (directorCard.spawnCardReference != null) { return ((AssetReference)directorCard.spawnCardReference).AssetGUID == spawnCardGuid; } return false; } return true; } } public static class CustomTransformationTypes { private delegate void CheckCustomTransformationTypeDelegate(NotificationInfo notificationInfo, ref GameObject transformationNotificationPrefab); private const TransformationType StartIndex = 104; public const TransformationType QualityUpgradeUncommon = 104; public const TransformationType QualityUpgradeRare = 105; public const TransformationType QualityUpgradeEpic = 106; public const TransformationType QualityUpgradeLegendary = 107; private static readonly GameObject[] _qualityUpgradeTransformationNotificationPrefabs = (GameObject[])(object)new GameObject[4]; [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { //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_0031: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle handle = AddressableUtil.LoadTempAssetAsync(RoR2_Base_UI.GenericTransformationNotificationPanel_prefab); handle.OnSuccess(delegate(GameObject genericTransformationNotificationPanelPrefab) { for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { GameObject val = PrefabAPI.InstantiateClone(genericTransformationNotificationPanelPrefab, "QualityUpgradeTransformationNotificationPanel" + qualityTier, false); _qualityUpgradeTransformationNotificationPrefabs[(int)qualityTier] = val; } }); return handle.AsProgressCoroutine>(args.ProgressReceiver); } [SystemInitializer(new Type[] { typeof(QualityCatalog) })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown NotificationUIController.SetUpNotification += new Manipulator(NotificationUIController_SetUpNotification); for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { GameObject val = _qualityUpgradeTransformationNotificationPrefabs[(int)qualityTier]; if (Object.op_Implicit((Object)(object)val)) { EventFunctions val2 = UnityObjectExtensions.EnsureComponent(val); StartEvent val3; StartEvent obj = (val3 = val.AddComponent()); if (val3.action == null) { val3.action = new UnityEvent(); } obj.action.AddPersistentListener(val2.PlaySound, QualityCatalog.GetQualityTierDef(qualityTier).pickupDropSound.eventName); } } } private static void NotificationUIController_SetUpNotification(ILContext il) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_0150: 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) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find CharacterMasterNotificationQueue.NotificationInfo parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\CustomTransformationTypes.cs", "NotificationUIController_SetUpNotification", 70); return; } ILCursor val = new ILCursor(il); VariableDefinition transformationNotificationPrefabVar = null; if (!val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "genericTransformationNotificationPrefab"), (Instruction x) => x.MatchStloc(il, out transformationNotificationPrefabVar) })) { Log.Error("Failed to find transformationNotificationPrefab variable", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\CustomTransformationTypes.cs", "NotificationUIController_SetUpNotification", 81); return; } val.Goto(0, (MoveType)0, false); ILLabel afterTransformationTypeSwitchLabel = null; ILLabel[] array = default(ILLabel[]); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "transformationType") }) || !val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchSwitch(x, ref array), (Instruction x) => ILPatternMatchingExt.MatchBr(x, ref afterTransformationTypeSwitchLabel) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\CustomTransformationTypes.cs", "NotificationUIController_SetUpNotification", 94); return; } val.Goto(afterTransformationTypeSwitchLabel.Target, (MoveType)1, false); val.Emit(OpCodes.Ldarg, parameter); val.Emit(OpCodes.Ldloca, transformationNotificationPrefabVar); val.EmitDelegate((CheckCustomTransformationTypeDelegate)checkCustomTransformationType); static void checkCustomTransformationType(NotificationInfo notificationInfo, ref GameObject transformationNotificationPrefab) { //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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected I4, but got Unknown TransformationType transformationType = notificationInfo.transformation.transformationType; if (transformationType - 104 <= 3) { QualityTier qualityTier = (QualityTier)(notificationInfo.transformation.transformationType - 104); GameObject safe = ArrayUtils.GetSafe(_qualityUpgradeTransformationNotificationPrefabs, (int)qualityTier); if (Object.op_Implicit((Object)(object)safe)) { transformationNotificationPrefab = safe; } } } } } public static class DamageTypes { public static ModdedDamageType Frost6s { get; private set; } public static ModdedDamageType ForceAddToSharedSuffering { get; private set; } public static ModdedDamageType BypassDrops { get; private set; } public static ModdedDamageType Echo { get; private set; } [SystemInitializer(new Type[] { })] private static void Init() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown Frost6s = DamageAPI.ReserveDamageType(); ForceAddToSharedSuffering = DamageAPI.ReserveDamageType(); BypassDrops = DamageAPI.ReserveDamageType(); Echo = DamageAPI.ReserveDamageType(); GlobalEventManager.onServerDamageDealt += onServerDamageDealt; GlobalEventManager.OnCharacterDeath += new Manipulator(GlobalEventManager_OnCharacterDeath); BombArtifactManager.OnServerCharacterDeath += new hook_OnServerCharacterDeath(BombArtifactManager_OnServerCharacterDeath); DoppelgangerInvasionManager.OnCharacterDeathGlobal += new hook_OnCharacterDeathGlobal(DoppelgangerInvasionManager_OnCharacterDeathGlobal); SacrificeArtifactManager.OnServerCharacterDeath += new hook_OnServerCharacterDeath(SacrificeArtifactManager_OnServerCharacterDeath); TeamDeathArtifactManager.OnServerCharacterDeathGlobal += new hook_OnServerCharacterDeathGlobal(TeamDeathArtifactManager_OnServerCharacterDeathGlobal); GlobalDeathRewards.OnCharacterDeathGlobal += new hook_OnCharacterDeathGlobal(GlobalDeathRewards_OnCharacterDeathGlobal); StatManager.OnCharacterDeath += new hook_OnCharacterDeath(StatManager_OnCharacterDeath); } private static void onServerDamageDealt(DamageReport damageReport) { //IL_0047: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Invalid comparison between Unknown and I4 if (damageReport?.damageInfo == null) { return; } DamageInfo damageInfo = damageReport.damageInfo; GameObject attacker = damageReport.attacker; CharacterBody victimBody = damageReport.victimBody; HealthComponent victim = damageReport.victim; if (!Object.op_Implicit((Object)(object)victim) || !Object.op_Implicit((Object)(object)victimBody)) { return; } if (DamageAPI.HasModdedDamageType(ref damageInfo.damageType, Frost6s) && !victim.isInFrozenState && !victimBody.HasBuff(Buffs.FreezeImmune)) { victimBody.AddTimedBuff(Buffs.Frost, 6f, 6); } SharedSufferingItemBehaviour val = default(SharedSufferingItemBehaviour); if (DamageAPI.HasModdedDamageType(ref damageInfo.damageType, ForceAddToSharedSuffering) && (int)victimBody.teamComponent.teamIndex != -1 && !victimBody.HasBuff(Buffs.SharedSuffering) && Object.op_Implicit((Object)(object)attacker) && attacker.TryGetComponent(ref val)) { victimBody.AddBuff(Buffs.SharedSuffering); if (!val.afflicted.Contains(victimBody)) { val.afflicted.Add(victimBody); val.afflictedDirty = true; } } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static bool shouldBypassDrops(DamageReport damageReport) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (!DamageAPI.HasModdedDamageType(ref damageReport.damageInfo.damageType, BypassDrops)) { return isEchoed(damageReport); } return true; } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static bool isEchoed(DamageReport damageReport) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) return DamageAPI.HasModdedDamageType(ref damageReport.damageInfo.damageType, Echo); } private static void GlobalEventManager_OnCharacterDeath(ILContext il) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_0480: Unknown result type (might be due to invalid IL or missing references) //IL_0553: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var damageReportParameter)) { Log.Error("Failed to find DamageReport parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\DamageTypes.cs", "GlobalEventManager_OnCharacterDeath", 104); return; } ILCursor c = new ILCursor(il); c.Goto(0, (MoveType)0, false); ILLabel afterSonorousLabel = null; int num5 = default(int); if (c.TryGotoNext((MoveType)1, new Func[6] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num5), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "get_inventory"), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "ItemDropChanceOnKill"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "GetItemCountEffective"), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0), (Instruction x) => ILPatternMatchingExt.MatchBle(x, ref afterSonorousLabel) })) { emitCheckShouldBypassDrops(); c.Emit(OpCodes.Brtrue, (object)afterSonorousLabel); } else { Log.Error("Failed to find sonorous drop patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\DamageTypes.cs", "GlobalEventManager_OnCharacterDeath", 150); } c.Goto(0, (MoveType)0, false); ILLabel afterGlacialDeathLabel = null; int num4 = default(int); if (c.TryGotoNext((MoveType)1, new Func[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num4), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "AffixWhite"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "HasBuff"), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref afterGlacialDeathLabel) })) { emitCheckIsEchoed(); c.Emit(OpCodes.Brtrue, (object)afterGlacialDeathLabel); } else { Log.Error_NoCallerPrefix("Failed to find glacial death patch location"); } c.Goto(0, (MoveType)0, false); ILLabel afterMalachiteDeathLabel = null; int num3 = default(int); if (c.TryGotoNext((MoveType)1, new Func[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num3), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "AffixPoison"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "HasBuff"), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref afterMalachiteDeathLabel) })) { emitCheckIsEchoed(); c.Emit(OpCodes.Brtrue, (object)afterMalachiteDeathLabel); } else { Log.Error_NoCallerPrefix("Failed to find malachite death patch location"); } c.Goto(0, (MoveType)0, false); ILLabel afterSoulWispSpawnLabel = null; if (c.TryGotoNext((MoveType)1, new Func[4] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "get_instance"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(Artifacts), "get_wispOnDeath"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "IsArtifactEnabled"), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref afterSoulWispSpawnLabel) })) { emitCheckIsEchoed(); c.Emit(OpCodes.Brtrue, (object)afterSoulWispSpawnLabel); } else { Log.Error_NoCallerPrefix("Failed to find soul wisp spawn patch location"); } c.Goto(0, (MoveType)0, false); ILLabel afterMendingDeathLabel = null; int num2 = default(int); if (c.TryGotoNext((MoveType)1, new Func[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num2), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "EliteEarth"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "HasBuff"), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref afterMendingDeathLabel) })) { emitCheckIsEchoed(); c.Emit(OpCodes.Brtrue, (object)afterMendingDeathLabel); } else { Log.Error_NoCallerPrefix("Failed to find mending death patch location"); } c.Goto(0, (MoveType)0, false); ILLabel afterVoidtouchedDeathLabel = null; int num = default(int); if (c.TryGotoNext((MoveType)1, new Func[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "EliteVoid"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "HasBuff"), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref afterVoidtouchedDeathLabel) })) { emitCheckIsEchoed(); c.Emit(OpCodes.Brtrue, (object)afterVoidtouchedDeathLabel); } else { Log.Error_NoCallerPrefix("Failed to find voidtouched death patch location"); } void emitCheckIsEchoed() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) c.Emit(OpCodes.Ldarg, damageReportParameter); c.EmitDelegate>((Func)isEchoed); } void emitCheckShouldBypassDrops() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) c.Emit(OpCodes.Ldarg, damageReportParameter); c.EmitDelegate>((Func)shouldBypassDrops); } } private static void BombArtifactManager_OnServerCharacterDeath(orig_OnServerCharacterDeath orig, DamageReport damageReport) { if (!isEchoed(damageReport)) { orig.Invoke(damageReport); } } private static void DoppelgangerInvasionManager_OnCharacterDeathGlobal(orig_OnCharacterDeathGlobal orig, DoppelgangerInvasionManager self, DamageReport damageReport) { if (!shouldBypassDrops(damageReport)) { orig.Invoke(self, damageReport); } } private static void SacrificeArtifactManager_OnServerCharacterDeath(orig_OnServerCharacterDeath orig, DamageReport damageReport) { if (!shouldBypassDrops(damageReport)) { orig.Invoke(damageReport); } } private static void TeamDeathArtifactManager_OnServerCharacterDeathGlobal(orig_OnServerCharacterDeathGlobal orig, DamageReport damageReport) { if (!isEchoed(damageReport)) { orig.Invoke(damageReport); } } private static void GlobalDeathRewards_OnCharacterDeathGlobal(orig_OnCharacterDeathGlobal orig, GlobalDeathRewards self, DamageReport damageReport) { if (!shouldBypassDrops(damageReport)) { orig.Invoke(self, damageReport); } } private static void StatManager_OnCharacterDeath(orig_OnCharacterDeath orig, DamageReport damageReport) { if (!isEchoed(damageReport)) { orig.Invoke(damageReport); } } } public sealed class DelayBlastExtraStats : MonoBehaviour { private DelayBlast _delayBlast; private static void Init() { GameObject[] networkedObjectPrefabs = ContentManager.networkedObjectPrefabs; for (int i = 0; i < networkedObjectPrefabs.Length; i++) { DelayBlast[] componentsInChildren = networkedObjectPrefabs[i].GetComponentsInChildren(); for (int j = 0; j < componentsInChildren.Length; j++) { UnityObjectExtensions.EnsureComponent(((Component)componentsInChildren[j]).gameObject); } } } private void Awake() { _delayBlast = ((Component)this).GetComponent(); } private void Start() { if (!Object.op_Implicit((Object)(object)_delayBlast)) { return; } GameObject attacker = _delayBlast.attacker; if (_delayBlast.blastAttackOverride != null) { attacker = _delayBlast.blastAttackOverride.attacker; } CharacterBody attacker2 = default(CharacterBody); if (Object.op_Implicit((Object)(object)attacker) && attacker.TryGetComponent(ref attacker2)) { _delayBlast.radius = ExplodeOnDeath.GetExplosionRadius(_delayBlast.radius, attacker2); if (_delayBlast.blastAttackOverride != null) { _delayBlast.blastAttackOverride.radius = ExplodeOnDeath.GetExplosionRadius(_delayBlast.blastAttackOverride.radius, attacker2); } if (_delayBlast.effectDataOverride != null) { _delayBlast.effectDataOverride.scale = ExplodeOnDeath.GetExplosionRadius(_delayBlast.effectDataOverride.scale, attacker2); } } } } public sealed class DelayedHealPackController : NetworkBehaviour { [SyncVar] public float Delay = 1f; [SerializeField] private HealthPickup _healthPickup; [SerializeField] private Collider _healthPickupTrigger; [SerializeField] private GravitatePickup _gravitatePickup; [SerializeField] private Collider _gravitateTrigger; private bool _reachedTimerEnd; private float _timer; public float NetworkDelay { get { return Delay; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref Delay, 1u); } } [ContentInitializer] private static IEnumerator Init(ContentInitializerArgs args) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle handle = AddressableUtil.LoadTempAssetAsync(RoR2_Base_Tooth.HealPack_prefab); handle.OnSuccess(delegate(GameObject healPackPrefab) { GameObject val = PrefabAPI.InstantiateClone(healPackPrefab, "HealPackDelayed"); DelayedHealPackController delayedHealPackController = val.AddComponent(); delayedHealPackController._healthPickup = val.GetComponentInChildren(); delayedHealPackController._gravitatePickup = val.GetComponentInChildren(); if (Object.op_Implicit((Object)(object)delayedHealPackController._healthPickup)) { delayedHealPackController._healthPickupTrigger = ((Component)delayedHealPackController._healthPickup).GetComponent(); } if (Object.op_Implicit((Object)(object)delayedHealPackController._gravitatePickup)) { delayedHealPackController._gravitateTrigger = ((Component)delayedHealPackController._gravitatePickup).GetComponent(); } delayedHealPackController.setBehaviorsEnabled(enabled: false); args.ContentPack.networkedObjectPrefabs.Add(val); }); return handle.AsProgressCoroutine>(args.ProgressReceiver); } private void OnEnable() { _timer = 0f; _reachedTimerEnd = false; setBehaviorsEnabled(enabled: false); } private void FixedUpdate() { if (!_reachedTimerEnd) { _timer += Time.fixedDeltaTime; if (_timer >= Delay) { _reachedTimerEnd = true; setBehaviorsEnabled(enabled: true); } } } private void setBehaviorsEnabled(bool enabled) { if (Object.op_Implicit((Object)(object)_healthPickup)) { ((Behaviour)_healthPickup).enabled = enabled; } if (Object.op_Implicit((Object)(object)_healthPickupTrigger)) { _healthPickupTrigger.enabled = enabled; } if (Object.op_Implicit((Object)(object)_gravitatePickup)) { ((Behaviour)_gravitatePickup).enabled = enabled; } if (Object.op_Implicit((Object)(object)_gravitateTrigger)) { _gravitateTrigger.enabled = enabled; } } private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { if (forceAll) { writer.Write(Delay); return true; } bool flag = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(Delay); } if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { if (initialState) { Delay = reader.ReadSingle(); return; } int num = (int)reader.ReadPackedUInt32(); if (((uint)num & (true ? 1u : 0u)) != 0) { Delay = reader.ReadSingle(); } } public override void PreStartClient() { } } internal static class DifficultyScaling { [SystemInitializer(new Type[] { })] private static void Init() { //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 Run.RecalculateDifficultyCoefficentInternal += new Manipulator(ApplyScalingValueChangesPatch); InfiniteTowerRun.RecalculateDifficultyCoefficentInternal += new Manipulator(ApplyScalingValueChangesPatch); } private static void ApplyScalingValueChangesPatch(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); int num = 0; while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "scalingValue") })) { val.EmitDelegate>((Func)getScalingValue); num++; } if (num == 0) { Log.Error("Failed to find patch location for " + ((MemberReference)il.Method).FullName, "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\DifficultyScaling.cs", "ApplyScalingValueChangesPatch", 37); } static float getScalingValue(float scalingValue) { return scalingValue * Configs.General.DifficultyCoefficientMultiplier.Value; } } } public sealed class DisableInPlaymodePrefab : MonoBehaviour, IContentLoadCallback { void IContentLoadCallback.OnContentLoad() { ((Component)this).gameObject.SetActive(false); } } internal sealed class DroneCommanderDeployableFix : MonoBehaviour { private CharacterBody _body; [SystemInitializer(new Type[] { })] private static void Init() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)BodyPrefabs.DroneCommanderBody)) { return; } Deployable val = default(Deployable); if (((Component)BodyPrefabs.DroneCommanderBody).TryGetComponent(ref val)) { DroneCommanderDeployableFix droneCommanderDeployableFix = ((Component)BodyPrefabs.DroneCommanderBody).gameObject.AddComponent(); Deployable val2 = val; if (val2.onUndeploy == null) { val2.onUndeploy = new UnityEvent(); } val.onUndeploy.AddPersistentListener(new UnityAction(droneCommanderDeployableFix.OnUndeploy)); } else { Log.Error(((Object)BodyPrefabs.DroneCommanderBody).name + " is missing Deployable component", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\DroneCommanderDeployableFix.cs", "Init", 24); } } private void Awake() { _body = ((Component)this).GetComponent(); } public void OnUndeploy() { if (Object.op_Implicit((Object)(object)_body) && Object.op_Implicit((Object)(object)_body.master)) { _body.master.TrueKill(); } } } [RequireComponent(typeof(NetworkedBodyAttachment))] public sealed class DroneShootableAttachmentController : NetworkBehaviour, IOnKilledServerReceiver, IOnIncomingDamageServerReceiver, IOnTakeDamageServerReceiver, INetworkedBodyAttachmentListener { private sealed class ShooterObjectCollideFilter : IObjectCollideFilter, IDisposable { private readonly CharacterBody _attachedBody; public event Action OnFilterDirty; public ShooterObjectCollideFilter(CharacterBody attachedBody) { _attachedBody = attachedBody; TeamComponent.onJoinTeamGlobal += onJoinTeamGlobal; TeamComponent.onLeaveTeamGlobal += onLeaveTeamGlobal; MinionOwnership.onMinionOwnerChangedGlobal += onMinionOwnerChangedGlobal; } public void Dispose() { TeamComponent.onJoinTeamGlobal -= onJoinTeamGlobal; TeamComponent.onLeaveTeamGlobal -= onLeaveTeamGlobal; MinionOwnership.onMinionOwnerChangedGlobal -= onMinionOwnerChangedGlobal; this.OnFilterDirty = null; } private void onJoinTeamGlobal(TeamComponent teamComponent, TeamIndex teamIndex) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (this.OnFilterDirty != null && Object.op_Implicit((Object)(object)_attachedBody) && teamIndex == _attachedBody.teamComponent.teamIndex && ((Component)(object)teamComponent).TryGetComponentCached(out ObjectCollisionManager component)) { this.OnFilterDirty(component); } } private void onLeaveTeamGlobal(TeamComponent teamComponent, TeamIndex teamIndex) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (this.OnFilterDirty != null && Object.op_Implicit((Object)(object)_attachedBody) && teamIndex == _attachedBody.teamComponent.teamIndex && ((Component)(object)teamComponent).TryGetComponentCached(out ObjectCollisionManager component)) { this.OnFilterDirty(component); } } private void onMinionOwnerChangedGlobal(MinionOwnership minionOwnership) { CharacterMaster val = default(CharacterMaster); if (this.OnFilterDirty != null && ((Component)minionOwnership).TryGetComponent(ref val)) { GameObject bodyObject = val.GetBodyObject(); if (Object.op_Implicit((Object)(object)bodyObject) && bodyObject.TryGetComponentCached(out ObjectCollisionManager component)) { this.OnFilterDirty(component); } } } private bool bodyPassesFilter(CharacterBody body) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)body) && (Object)(object)body != (Object)(object)_attachedBody) { if (body.teamComponent.teamIndex != _attachedBody.teamComponent.teamIndex) { if (Object.op_Implicit((Object)(object)body.master) && Object.op_Implicit((Object)(object)_attachedBody.master)) { return (Object)(object)_attachedBody.master.minionOwnership.ownerMaster == (Object)(object)body.master; } return false; } return true; } return false; } public bool PassesFilter(ObjectCollisionManager collisionManager) { if (Object.op_Implicit((Object)(object)collisionManager)) { if (!bodyPassesFilter(collisionManager.Body)) { return bodyPassesFilter(collisionManager.OwnerBody); } return true; } return false; } } private NetworkedBodyAttachment _bodyAttachment; private CharacterMaster _cachedOwnerMaster; private CharacterBody _cachedOwnerBody; public GameObject HitEffectPrefab; public Gradient DamageColorGradient; public Renderer[] IndicatorRenderers = Array.Empty(); public Transform RangeIndicator; public GameObject FxRoot; public GameObject ExplosionEffect; public HurtBoxGroup HurtBoxGroup; public IgnoredCollisionsProvider IgnoredCollisionsProvider; [SyncVar(hook = "hookSetStoredDamage")] private float _storedDamage; private float _maxStoredDamage = 1f; private float _storedDamageMultiplier = 1f; private float _minRadius; private float _maxRadius; private FixedTimeStamp _lastDamageTimeStamp = FixedTimeStamp.positiveInfinity; private FixedTimeStamp _maxStoredDamageReachedTimeStamp = FixedTimeStamp.positiveInfinity; private FixedTimeStamp _lastExplosionTimeStamp = FixedTimeStamp.negativeInfinity; private bool _limitsDirty; private bool _wasHurtBoxesDisabled; private MaterialPropertyBlock _propertyBlock; public float Network_storedDamage { get { return _storedDamage; } [param: In] set { ref float storedDamage = ref _storedDamage; if (NetworkServer.localClientActive && !((NetworkBehaviour)this).syncVarHookGuard) { ((NetworkBehaviour)this).syncVarHookGuard = true; hookSetStoredDamage(value); ((NetworkBehaviour)this).syncVarHookGuard = false; } ((NetworkBehaviour)this).SetSyncVar(value, ref storedDamage, 1u); } } private void Awake() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown _propertyBlock = new MaterialPropertyBlock(); _bodyAttachment = ((Component)this).GetComponent(); recalculateLimits(); } private void OnDestroy() { if (Object.op_Implicit((Object)(object)_bodyAttachment.attachedBody) && Object.op_Implicit((Object)(object)_bodyAttachment.attachedBody.master)) { MinionOwnership minionOwnership = _bodyAttachment.attachedBody.master.minionOwnership; minionOwnership.onOwnerDiscovered -= setOwnerMaster; minionOwnership.onOwnerLost -= setOwnerMaster; } setOwnerMaster(null); } private void FixedUpdate() { if (_limitsDirty) { _limitsDirty = false; recalculateLimits(); } bool flag = shouldDisableHurtBoxes(); if (_wasHurtBoxesDisabled != flag) { if (flag) { HurtBoxGroup hurtBoxGroup = HurtBoxGroup; int hurtBoxesDeactivatorCounter = hurtBoxGroup.hurtBoxesDeactivatorCounter; hurtBoxGroup.hurtBoxesDeactivatorCounter = hurtBoxesDeactivatorCounter + 1; } else { HurtBoxGroup hurtBoxGroup2 = HurtBoxGroup; int hurtBoxesDeactivatorCounter = hurtBoxGroup2.hurtBoxesDeactivatorCounter; hurtBoxGroup2.hurtBoxesDeactivatorCounter = hurtBoxesDeactivatorCounter - 1; } _wasHurtBoxesDisabled = flag; } if (NetworkServer.active && shouldDetonate()) { detonate(); } } private bool shouldDetonate() { if (_storedDamage > 0f) { if (((FixedTimeStamp)(ref _lastDamageTimeStamp)).timeSince >= 2.5f) { return true; } if (_storedDamage >= _maxStoredDamage && ((FixedTimeStamp)(ref _maxStoredDamageReachedTimeStamp)).timeSince >= 0.75f) { return true; } } return false; } private bool shouldDisableHurtBoxes() { if (((FixedTimeStamp)(ref _lastExplosionTimeStamp)).timeSince <= 10f) { return true; } CharacterBody attachedBody = _bodyAttachment.attachedBody; if (!Object.op_Implicit((Object)(object)attachedBody)) { return true; } if (Object.op_Implicit((Object)(object)attachedBody.hurtBoxGroup) && attachedBody.hurtBoxGroup.hurtBoxesDeactivatorCounter > 0) { return true; } if (attachedBody.hasUntargetableBuff) { return true; } if (attachedBody.HasBuff(Buffs.Immune) || attachedBody.HasBuff(Buffs.HiddenInvincibility)) { return true; } if (attachedBody.HasBuff(Buffs.HiddenRejectAllDamage)) { return true; } return false; } [Server] private unsafe void detonate() { //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_0124: 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_0131: Expected O, but got I4 //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Expected O, but got Unknown if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void ItemQualities.DroneShootableAttachmentController::detonate()' called on client"); return; } if (_storedDamage > 0f) { float num = Mathf.Clamp01(_storedDamage / _maxStoredDamage); float radius = Mathf.Lerp(_minRadius, _maxRadius, num); CharacterBody val = (Object.op_Implicit((Object)(object)_cachedOwnerMaster) ? _cachedOwnerMaster.GetBody() : null); ? val2 = new BlastAttack { attacker = (Object.op_Implicit((Object)(object)val) ? ((Component)val).gameObject : null), inflictor = ((Component)this).gameObject, position = (Object.op_Implicit((Object)(object)_bodyAttachment.attachedBody) ? _bodyAttachment.attachedBody.corePosition : ((Component)this).transform.position), radius = radius, baseDamage = _storedDamage, crit = (Object.op_Implicit((Object)(object)val) && val.RollCrit()), damageColorIndex = (DamageColorIndex)16, falloffModel = (FalloffModel)0, procCoefficient = 1f }; ? val3 = val2; int num2; if (!Object.op_Implicit((Object)(object)_cachedOwnerMaster)) { num2 = -1; val2 = num2; num2 = (int)val2; } else { val2 = _cachedOwnerMaster.teamIndex; num2 = (int)val2; } ((BlastAttack)val3).teamIndex = (TeamIndex)val2; Unsafe.Write(&((BlastAttack)num2).attackerFiltering, (AttackerFiltering)2); BlastAttack val4 = (BlastAttack)(object)num2; val4.Fire(); if (Object.op_Implicit((Object)(object)ExplosionEffect)) { EffectData val5 = new EffectData { origin = val4.position, scale = val4.radius }; EffectManager.SpawnEffect(ExplosionEffect, val5, true); } _lastExplosionTimeStamp = FixedTimeStamp.now; } Network_storedDamage = 0f; _lastDamageTimeStamp = FixedTimeStamp.positiveInfinity; _maxStoredDamageReachedTimeStamp = FixedTimeStamp.positiveInfinity; } void IOnIncomingDamageServerReceiver.OnIncomingDamageServer(DamageInfo damageInfo) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_bodyAttachment.attachedBody) && (!((DamageTypeCombo)(ref damageInfo.damageType)).IsDamageSourceSkillBased || !Object.op_Implicit((Object)(object)damageInfo.attacker) || TeamComponent.GetObjectTeam(damageInfo.attacker) != _bodyAttachment.attachedBody.teamComponent.teamIndex)) { damageInfo.rejected = true; } } void IOnTakeDamageServerReceiver.OnTakeDamageServer(DamageReport damageReport) { //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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Min(_maxStoredDamage - _storedDamage, damageReport.damageDealt * _storedDamageMultiplier); if (num > 0f) { Network_storedDamage = _storedDamage + num; float num2 = Mathf.Clamp01(_storedDamage / _maxStoredDamage); float scale = Mathf.Lerp(_minRadius, _maxRadius, num2); if (Object.op_Implicit((Object)(object)HitEffectPrefab)) { EffectManager.SpawnEffect(HitEffectPrefab, new EffectData { origin = _bodyAttachment.attachedBody.corePosition, color = Color32.op_Implicit(DamageColorGradient.Evaluate(num2)), scale = scale }, true); } if (num2 >= 1f) { _maxStoredDamageReachedTimeStamp = FixedTimeStamp.now; } } _lastDamageTimeStamp = FixedTimeStamp.now; } void IOnKilledServerReceiver.OnKilledServer(DamageReport damageReport) { if (_storedDamage > 0f) { detonate(); } Object.Destroy((Object)(object)((Component)this).gameObject); } private void recalculateLimits() { float minRadius = 0f; float num = 15f; float num2 = Run.instance.teamlessDamageCoefficient; float num3 = 4f; float storedDamageMultiplier = 0.5f; if (Object.op_Implicit((Object)(object)_cachedOwnerMaster)) { CharacterBody body = _cachedOwnerMaster.GetBody(); if (Object.op_Implicit((Object)(object)body)) { num2 = body.damage; } ItemQualityCounts itemQualityCounts = default(ItemQualityCounts); if (Object.op_Implicit((Object)(object)_cachedOwnerMaster.inventory)) { itemQualityCounts = _cachedOwnerMaster.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.DronesDropDynamite); } switch (itemQualityCounts.HighestQuality) { case QualityTier.Uncommon: storedDamageMultiplier = 0.5f; break; case QualityTier.Rare: storedDamageMultiplier = 1f; break; case QualityTier.Epic: storedDamageMultiplier = 1.25f; break; case QualityTier.Legendary: storedDamageMultiplier = 1.5f; break; } num3 += 1f * (float)itemQualityCounts.UncommonCount + 2f * (float)itemQualityCounts.RareCount + 4f * (float)itemQualityCounts.EpicCount + 6f * (float)itemQualityCounts.LegendaryCount; num += 5f * (float)itemQualityCounts.UncommonCount + 10f * (float)itemQualityCounts.RareCount + 15f * (float)itemQualityCounts.EpicCount + 20f * (float)itemQualityCounts.LegendaryCount; if (Object.op_Implicit((Object)(object)body)) { num = ExplodeOnDeath.GetExplosionRadius(num, body); } } _maxStoredDamage = num2 * num3; _storedDamageMultiplier = storedDamageMultiplier; _minRadius = minRadius; _maxRadius = num; refreshIndicator(); } private void refreshIndicator() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_00ca: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp01(_storedDamage / _maxStoredDamage); float num2 = Mathf.Lerp(_minRadius, _maxRadius, num); if (Object.op_Implicit((Object)(object)RangeIndicator)) { float num3 = num2 * 2f; RangeIndicator.localScale = new Vector3(num3, num3, num3); } if (Object.op_Implicit((Object)(object)FxRoot)) { FxRoot.SetActive(num > 0f); } if (IndicatorRenderers.Length == 0) { return; } Color val = DamageColorGradient.Evaluate(num); Renderer[] indicatorRenderers = IndicatorRenderers; foreach (Renderer val2 in indicatorRenderers) { if (Object.op_Implicit((Object)(object)val2)) { val2.GetPropertyBlock(_propertyBlock); _propertyBlock.SetColor(ShaderProperties._Color, val); _propertyBlock.SetColor(ShaderProperties._TintColor, val); val2.SetPropertyBlock(_propertyBlock); } } } private void setOwnerMaster(CharacterMaster ownerMaster) { if (!((Object)(object)_cachedOwnerMaster == (Object)(object)ownerMaster)) { if (Object.op_Implicit((Object)(object)_cachedOwnerMaster)) { _cachedOwnerMaster.onBodyStart -= setOwnerBody; _cachedOwnerMaster.onBodyDestroyed -= setOwnerBody; } _cachedOwnerMaster = ownerMaster; if (Object.op_Implicit((Object)(object)_cachedOwnerMaster)) { _cachedOwnerMaster.onBodyStart += setOwnerBody; _cachedOwnerMaster.onBodyDestroyed += setOwnerBody; } setOwnerBody(Object.op_Implicit((Object)(object)_cachedOwnerMaster) ? _cachedOwnerMaster.GetBody() : null); _limitsDirty = true; } } private void setOwnerBody(CharacterBody ownerBody) { if (!((Object)(object)_cachedOwnerBody == (Object)(object)ownerBody)) { if (Object.op_Implicit((Object)(object)_cachedOwnerBody)) { _cachedOwnerBody.onRecalculateStats -= onOwnerBodyRecalculateStats; } _cachedOwnerBody = ownerBody; if (Object.op_Implicit((Object)(object)_cachedOwnerBody)) { _cachedOwnerBody.onRecalculateStats += onOwnerBodyRecalculateStats; } _limitsDirty = true; } } private void onOwnerBodyRecalculateStats(CharacterBody body) { _limitsDirty = true; } void INetworkedBodyAttachmentListener.OnAttachedBodyDiscovered(NetworkedBodyAttachment networkedBodyAttachment, CharacterBody attachedBody) { SphereCollider val = default(SphereCollider); if (Object.op_Implicit((Object)(object)HurtBoxGroup.mainHurtBox) && ((Component)HurtBoxGroup.mainHurtBox).TryGetComponent(ref val)) { val.radius = attachedBody.bestFitActualRadius + 0.25f; } else { Log.Warning("Failed to set HurtBox size", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\DroneShootableAttachmentController.cs", "OnAttachedBodyDiscovered", 399); } if (Object.op_Implicit((Object)(object)IgnoredCollisionsProvider)) { IgnoredCollisionsProvider.CollisionWhitelistFilter = new ShooterObjectCollideFilter(attachedBody); } CharacterMaster ownerMaster = null; if (Object.op_Implicit((Object)(object)attachedBody.master)) { ownerMaster = attachedBody.master.minionOwnership.ownerMaster; attachedBody.master.minionOwnership.onOwnerDiscovered += setOwnerMaster; attachedBody.master.minionOwnership.onOwnerLost += setOwnerMaster; } setOwnerMaster(ownerMaster); } private void hookSetStoredDamage(float storedDamage) { Network_storedDamage = storedDamage; refreshIndicator(); } private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { if (forceAll) { writer.Write(_storedDamage); return true; } bool flag = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(_storedDamage); } if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { if (initialState) { _storedDamage = reader.ReadSingle(); return; } int num = (int)reader.ReadPackedUInt32(); if (((uint)num & (true ? 1u : 0u)) != 0) { hookSetStoredDamage(reader.ReadSingle()); } } public override void PreStartClient() { } } public class DropPodQualityController : MonoBehaviour { private bool appliedQuality; private bool hidQuality; private GenericPickupController _pickupController; private Transform _qualityPickupDisplay; [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0017: 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) Opening.OnEnter += new hook_OnEnter(Opening_OnEnter); AsyncOperationHandle handle = AddressableUtil.LoadAssetAsync(RoR2_Base_SurvivorPod.SurvivorPod_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject SurvivorPod) { SurvivorPod.AddComponent(); SurvivorPod.AddComponent(); }); } public void FixedUpdate() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (getWorldPickupAndController()) { if (NetworkServer.active && !appliedQuality) { appliedQuality = true; Xoroshiro128Plus rng = new Xoroshiro128Plus(Run.instance.treasureRng.nextUlong); GenericPickupController pickupController = _pickupController; UniquePickup pickup = _pickupController.pickup; PickupIndex pickupIndex = _pickupController.pickup.pickupIndex; PickupRollInfo rollInfo = new PickupRollInfo(null, (TeamIndex)1); pickupController.pickup = ((UniquePickup)(ref pickup)).WithPickupIndex(DropTableQualityHandler.RollQuality(pickupIndex, rng, in rollInfo)); } if (!hidQuality && Object.op_Implicit((Object)(object)_qualityPickupDisplay)) { ((Component)_qualityPickupDisplay).gameObject.SetActive(false); hidQuality = true; } } } private bool getWorldPickupAndController() { if (Object.op_Implicit((Object)(object)_pickupController) && Object.op_Implicit((Object)(object)_qualityPickupDisplay)) { return true; } ModelLocator component = ((Component)this).GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { return false; } Transform val = component.modelChildLocator.FindChild("BatteryAttachmentPoint"); if (!Object.op_Implicit((Object)(object)val)) { return false; } Transform val2 = val.Find("QuestVolatileBatteryWorldPickup(Clone)"); if (!Object.op_Implicit((Object)(object)val2)) { return false; } _pickupController = ((Component)val2).GetComponent(); if (!Object.op_Implicit((Object)(object)_pickupController)) { return false; } _qualityPickupDisplay = val2.Find("PickupDisplay/QualityPickupDisplay(Clone)"); if (Object.op_Implicit((Object)(object)_qualityPickupDisplay)) { return true; } return false; } private static void Opening_OnEnter(orig_OnEnter orig, Opening self) { //IL_006e: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (!Object.op_Implicit((Object)(object)((BaseBatteryPanelState)self).podInfo.podAnimator)) { return; } ChildLocator component = ((Component)((BaseBatteryPanelState)self).podInfo.podAnimator).GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { return; } Transform val = component.FindChild("BatteryAttachmentPoint"); if (!Object.op_Implicit((Object)(object)val)) { return; } Transform val2 = val.Find("QuestVolatileBatteryWorldPickup(Clone)"); if (!Object.op_Implicit((Object)(object)val2)) { return; } GenericPickupController component2 = ((Component)val2).GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { _ = component2.pickup; Transform val3 = val2.Find("PickupDisplay/QualityPickupDisplay(Clone)"); if (Object.op_Implicit((Object)(object)val3)) { ((Component)val3).gameObject.SetActive(true); } PickupDef pickupDef = PickupCatalog.GetPickupDef(component2.pickup.pickupIndex); if (QualityCatalog.GetQualityTier((EquipmentIndex)((pickupDef == null) ? (-1) : ((int)pickupDef.equipmentIndex))) > QualityTier.None) { EffectData val4 = new EffectData { origin = val2.position, rotation = val2.rotation }; QualityTierDef qualityTierDef = QualityCatalog.GetQualityTierDef(QualityCatalog.GetQualityTier(component2.pickup.pickupIndex)); EffectManager.SpawnEffect(qualityTierDef.ChestOpenEffectPrefab, val4, false); PointSoundManager.EmitSoundLocal(AkEventIdArg.op_Implicit(qualityTierDef.pickupLandSound.akId), val2.position); } } } } internal static class DropTableQualityHandler { private static readonly WeightedSelection _tierSelection; private static bool _allowQualityGeneration; private static CharacterMaster _currentDropGenerationOwnerMaster; private static TeamIndex _currentDropGenerationTeamAffiliation; static DropTableQualityHandler() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) _tierSelection = new WeightedSelection(8); _allowQualityGeneration = true; _currentDropGenerationOwnerMaster = null; _currentDropGenerationTeamAffiliation = (TeamIndex)(-1); _tierSelection.AddChoice(QualityTier.Uncommon, 0.7f); _tierSelection.AddChoice(QualityTier.Rare, 0.2f); _tierSelection.AddChoice(QualityTier.Epic, 0.08f); _tierSelection.AddChoice(QualityTier.Legendary, 0.02f); } [SystemInitializer(new Type[] { })] private static void Init() { //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 //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Expected O, but got Unknown //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Expected O, but got Unknown //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Expected O, but got Unknown //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Expected O, but got Unknown PickupDropTable.GeneratePickup += new hook_GeneratePickup(PickupDropTable_GeneratePickup); PickupDropTable.GenerateDistinctPickups += new hook_GenerateDistinctPickups(PickupDropTable_GenerateDistinctPickups); ShopTerminalBehavior.GenerateNewPickupServer_bool += new hook_GenerateNewPickupServer_bool(On_ShopTerminalBehavior_GenerateNewPickupServer_bool); ArenaMissionController.AddItemStack += new hook_AddItemStack(ArenaMissionController_AddItemStack); MonsterTeamGainsItemsArtifactManager.GrantMonsterTeamItem += new hook_GrantMonsterTeamItem(MonsterTeamGainsItemsArtifactManager_GrantMonsterTeamItem); InfiniteTowerRun.AdvanceWave += new hook_AdvanceWave(InfiniteTowerRun_AdvanceWave); ScavengerItemGranter.Start += new hook_Start(ScavengerItemGranter_Start); Salvage.DropTempItemServer += new hook_DropTempItemServer(Salvage_DropTempItemServer); EquipmentSlot.FireBossHunter += new hook_FireBossHunter(EquipmentSlot_FireBossHunter); ChestBehavior.PickFromList += new Manipulator(ChestBehavior_PickFromList); FindItem.OnEnter += new Manipulator(FindItem_OnEnter); Inventory.GiveRandomItems_int_bool_bool += new Manipulator(Inventory_GiveRandomItems); Inventory.GiveRandomItems_int_ItemTierArray += new Manipulator(Inventory_GiveRandomItems); MultiShopController.CreateTerminals += new Manipulator(MultiShopController_CreateTerminals); ScavBackpackBehavior.PickFromList += new Manipulator(ScavBackpackBehavior_PickFromList); ShopTerminalBehavior.GenerateNewPickupServer_bool += new Manipulator(IL_ShopTerminalBehavior_GenerateNewPickupServer_bool); ShrineChanceBehavior.AddShrineStack += new Manipulator(ShrineChanceBehavior_AddShrineStack); BossGroup.DropRewards += new Manipulator(BossGroup_DropRewards); Inventory.GiveRandomEquipment += new Manipulator(Inventory_GiveRandomEquipment); Inventory.GiveRandomEquipment_Xoroshiro128Plus += new Manipulator(Inventory_GiveRandomEquipment); MasterDropDroplet.DropItems += new Manipulator(MasterDropDroplet_DropItems); } public static PickupRollInfo GetCurrentPickupRollInfo(CharacterMaster rollOwnerMaster = null) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)rollOwnerMaster)) { rollOwnerMaster = _currentDropGenerationOwnerMaster; } TeamIndex val = _currentDropGenerationTeamAffiliation; if ((int)val == -1) { val = (TeamIndex)1; } if (Object.op_Implicit((Object)(object)rollOwnerMaster)) { val = rollOwnerMaster.teamIndex; } return new PickupRollInfo(rollOwnerMaster, val); } private static bool pickupCheckNotAIBlacklist(PickupIndex pickupIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex); ItemDef itemDef = ItemCatalog.GetItemDef((ItemIndex)((pickupDef == null) ? (-1) : ((int)pickupDef.itemIndex))); if (Object.op_Implicit((Object)(object)itemDef)) { return itemDef.DoesNotContainTag((ItemTag)4); } return false; } private static QualityTier rollQuality(Xoroshiro128Plus rng) { return _tierSelection.Evaluate(rng.nextNormalizedFloat); } public static QualityTier RollQualityTier(Xoroshiro128Plus rng, in PickupRollInfo rollInfo) { QualityTier qualityTier = QualityTier.None; for (int num = rollInfo.Luck; num >= 0; num--) { qualityTier = QualityCatalog.Max(qualityTier, rollQuality(rng)); } return qualityTier; } private static PickupIndex tryUpgradeQuality(PickupIndex pickupIndex, Xoroshiro128Plus rng, CharacterMaster master = null, Func isPickupAllowedFunc = null) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) rng = new Xoroshiro128Plus(rng.nextUlong); if (!_allowQualityGeneration || pickupIndex == PickupIndex.none) { return pickupIndex; } PickupRollInfo rollInfo = GetCurrentPickupRollInfo(master); return RollQuality(pickupIndex, rng, in rollInfo, isPickupAllowedFunc); } public static PickupIndex RollQuality(PickupIndex pickupIndex, Xoroshiro128Plus rng, in PickupRollInfo rollInfo, Func isPickupAllowedFunc = null) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00a0: Unknown result type (might be due to invalid IL or missing references) if (!rollInfo.IsPlayerAffiliation && isPickupAllowedFunc == null) { isPickupAllowedFunc = pickupCheckNotAIBlacklist; } PickupIndex val = pickupIndex; QualityTier qualityTier = QualityCatalog.GetQualityTier(val); if (rng.nextNormalizedFloat <= 1f - Mathf.Pow(1f - Configs.General.GlobalQualityChance.Value / 100f, (float)(1 + rollInfo.Luck))) { for (int num = rollInfo.Luck; num >= 0; num--) { QualityTier qualityTier2 = rollQuality(rng); PickupIndex pickupIndexOfQuality = QualityCatalog.GetPickupIndexOfQuality(val, qualityTier2); if ((!Object.op_Implicit((Object)(object)Run.instance) || Run.instance.ruleBook == null || Run.instance.ruleBook.IsPickupRuleEnabled(pickupIndexOfQuality)) && qualityTier2 > qualityTier && (isPickupAllowedFunc == null || isPickupAllowedFunc(pickupIndexOfQuality))) { val = pickupIndexOfQuality; qualityTier = qualityTier2; } } } return val; } private static void On_ShopTerminalBehavior_GenerateNewPickupServer_bool(orig_GenerateNewPickupServer_bool orig, ShopTerminalBehavior self, bool newHidden) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 //IL_001f: Unknown result type (might be due to invalid IL or missing references) try { bool flag = false; PurchaseInteraction val = default(PurchaseInteraction); if (((Component)self).TryGetComponent(ref val)) { CostTypeIndex costType = val.costType; flag = costType - 4 <= 9 || CustomCostTypeIndex.IsQualityItemCostType(val.costType); } _allowQualityGeneration = !flag; orig.Invoke(self, newHidden); } finally { _allowQualityGeneration = true; } } private static void ArenaMissionController_AddItemStack(orig_AddItemStack orig, ArenaMissionController self) { //IL_0001: 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) try { _currentDropGenerationTeamAffiliation = (TeamIndex)2; orig.Invoke(self); } finally { _currentDropGenerationTeamAffiliation = (TeamIndex)(-1); } } private static void MonsterTeamGainsItemsArtifactManager_GrantMonsterTeamItem(orig_GrantMonsterTeamItem orig) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) try { _currentDropGenerationTeamAffiliation = (TeamIndex)2; orig.Invoke(); } finally { _currentDropGenerationTeamAffiliation = (TeamIndex)(-1); } } private static void InfiniteTowerRun_AdvanceWave(orig_AdvanceWave orig, InfiniteTowerRun self) { //IL_0001: 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) try { _currentDropGenerationTeamAffiliation = (TeamIndex)2; orig.Invoke(self); } finally { _currentDropGenerationTeamAffiliation = (TeamIndex)(-1); } } private static void ScavengerItemGranter_Start(orig_Start orig, ScavengerItemGranter self) { try { _currentDropGenerationOwnerMaster = (Object.op_Implicit((Object)(object)self) ? ((Component)self).GetComponent() : null); orig.Invoke(self); } finally { _currentDropGenerationOwnerMaster = null; } } private static void Salvage_DropTempItemServer(orig_DropTempItemServer orig, Salvage self) { try { CharacterBody val = ((self != null) ? ((EntityState)self).characterBody : null); _currentDropGenerationOwnerMaster = (Object.op_Implicit((Object)(object)val) ? val.master : null); orig.Invoke(self); } finally { _currentDropGenerationOwnerMaster = null; } } private static bool EquipmentSlot_FireBossHunter(orig_FireBossHunter orig, EquipmentSlot self) { try { CharacterBody val = (Object.op_Implicit((Object)(object)self) ? self.characterBody : null); _currentDropGenerationOwnerMaster = (Object.op_Implicit((Object)(object)val) ? val.master : null); return orig.Invoke(self); } finally { _currentDropGenerationOwnerMaster = null; } } private static Func getDropTableFilterFunc(PickupDropTable pickupDropTable) { if (!Object.op_Implicit((Object)(object)pickupDropTable)) { return null; } ItemTag[] requiredItemTags = Array.Empty(); ItemTag[] bannedItemTags = Array.Empty(); FieldInfo[] fields = ((object)pickupDropTable).GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.IsSerialized() && fieldInfo.FieldType == typeof(ItemTag[])) { if (fieldInfo.Name.Contains("required", StringComparison.OrdinalIgnoreCase)) { requiredItemTags = (fieldInfo.GetValue(pickupDropTable) as ItemTag[]) ?? Array.Empty(); } else if (fieldInfo.Name.Contains("banned", StringComparison.OrdinalIgnoreCase) || fieldInfo.Name.Contains("forbidden", StringComparison.OrdinalIgnoreCase)) { bannedItemTags = (fieldInfo.GetValue(pickupDropTable) as ItemTag[]) ?? Array.Empty(); } } } if (requiredItemTags.Length == 0 && bannedItemTags.Length == 0) { return null; } return pickupPassesFilter; bool pickupPassesFilter(PickupIndex pickupIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex); ItemDef itemDef = ItemCatalog.GetItemDef((ItemIndex)((pickupDef == null) ? (-1) : ((int)pickupDef.itemIndex))); if (requiredItemTags.Length != 0 || bannedItemTags.Length != 0) { if (!Object.op_Implicit((Object)(object)itemDef)) { return false; } ItemTag[] array = requiredItemTags; foreach (ItemTag val in array) { if (!itemDef.ContainsTag(val)) { return false; } } array = bannedItemTags; foreach (ItemTag val2 in array) { if (itemDef.ContainsTag(val2)) { return false; } } } return true; } } private static UniquePickup PickupDropTable_GeneratePickup(orig_GeneratePickup orig, PickupDropTable self, Xoroshiro128Plus rng) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) UniquePickup val = orig.Invoke(self, rng); if (!(self is QualityPickupDropTable)) { val = ((UniquePickup)(ref val)).WithPickupIndex(tryUpgradeQuality(val.pickupIndex, rng, null, getDropTableFilterFunc(self))); } return val; } private static void PickupDropTable_GenerateDistinctPickups(orig_GenerateDistinctPickups orig, PickupDropTable self, List dest, int desiredCount, Xoroshiro128Plus rng, bool allowLoop) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, dest, desiredCount, rng, allowLoop); if (!(self is QualityPickupDropTable)) { Func dropTableFilterFunc = getDropTableFilterFunc(self); for (int i = 0; i < Math.Min(desiredCount, dest.Count); i++) { int index = i; UniquePickup val = dest[i]; dest[index] = ((UniquePickup)(ref val)).WithPickupIndex(tryUpgradeQuality(dest[i].pickupIndex, rng, null, dropTableFilterFunc)); } } } private static void ChestBehavior_PickFromList(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_000c: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int num = 0; while (val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "set_currentPickup") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)pickQuality); num++; val.SearchTarget = (SearchTarget)1; } if (num == 0) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\DropTableQualityHandler.cs", "ChestBehavior_PickFromList", 389); } static UniquePickup pickQuality(UniquePickup originalPickup, ChestBehavior chestBehavior) { //IL_0024: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (((UniquePickup)(ref originalPickup)).isValid) { return ((UniquePickup)(ref originalPickup)).WithPickupIndex(tryUpgradeQuality(originalPickup.pickupIndex, chestBehavior.rng)); } return originalPickup; } } private static void FindItem_OnEnter(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "dropPickup") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\DropTableQualityHandler.cs", "FindItem_OnEnter", 404); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)pickQuality); static PickupIndex pickQuality(PickupIndex originalPickupIndex, FindItem findItem) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) CharacterBody characterBody = ((EntityState)findItem).characterBody; CharacterMaster master = (Object.op_Implicit((Object)(object)characterBody) ? characterBody.master : null); return tryUpgradeQuality(originalPickupIndex, RoR2Application.rng, master, (Func)findItem.PickupIsNonBlacklistedItem); } } private static void Inventory_GiveRandomItems(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(PickupCatalog), "GetPickupDef") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\DropTableQualityHandler.cs", "Inventory_GiveRandomItems", 427); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)pickQuality); static PickupIndex pickQuality(PickupIndex originalPickupIndex, Inventory inventory) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) return tryUpgradeQuality(originalPickupIndex, RoR2Application.rng, Object.op_Implicit((Object)(object)inventory) ? ((Component)inventory).GetComponent() : null); } } private static void MultiShopController_CreateTerminals(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "SetPickup") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\DropTableQualityHandler.cs", "MultiShopController_CreateTerminals", 447); return; } VariableDefinition val2 = il.AddVariable(); val.Emit(OpCodes.Stloc, val2); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)pickQuality); val.Emit(OpCodes.Ldloc, val2); static UniquePickup pickQuality(UniquePickup originalPickup, MultiShopController multiShopController) { //IL_0024: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (((UniquePickup)(ref originalPickup)).isValid) { return ((UniquePickup)(ref originalPickup)).WithPickupIndex(tryUpgradeQuality(originalPickup.pickupIndex, multiShopController.rng)); } return originalPickup; } } private static void ScavBackpackBehavior_PickFromList(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); int num = 0; while (val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "dropPickup") })) { val.EmitDelegate>((Func)pickQuality); num++; val.SearchTarget = (SearchTarget)1; } if (num == 0) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\DropTableQualityHandler.cs", "ScavBackpackBehavior_PickFromList", 493); } static PickupIndex pickQuality(PickupIndex originalPickupIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return tryUpgradeQuality(originalPickupIndex, RoR2Application.rng); } } private static void IL_ShopTerminalBehavior_GenerateNewPickupServer_bool(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); MethodReference val2 = default(MethodReference); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val2) && val2 != null && ((MemberReference)val2).Name?.StartsWith("g__Pick") == true })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\DropTableQualityHandler.cs", "IL_ShopTerminalBehavior_GenerateNewPickupServer_bool", 508); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)pickQuality); static PickupIndex pickQuality(PickupIndex originalPickupIndex, ShopTerminalBehavior shopTerminalBehavior) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) return tryUpgradeQuality(originalPickupIndex, shopTerminalBehavior.rng); } } private static void ShrineChanceBehavior_AddShrineStack(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); MethodInfo pickupIndexSelectionEvaluate = typeof(WeightedSelection).GetMethod("Evaluate"); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)pickupIndexSelectionEvaluate) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\DropTableQualityHandler.cs", "ShrineChanceBehavior_AddShrineStack", 530); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)pickQuality); static PickupIndex pickQuality(PickupIndex originalPickupIndex, ShrineChanceBehavior shrineChanceBehavior) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) return tryUpgradeQuality(originalPickupIndex, shrineChanceBehavior.rng); } } private static void BossGroup_DropRewards(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); MethodInfo nextElementUniformPickupIndexList = typeof(Xoroshiro128Plus).GetMethods().FirstOrDefault((MethodInfo m) => m.Name == "NextElementUniform" && m.GetParameters().Length == 1 && m.GetParameters()[0].ParameterType.IsGenericType && m.GetParameters()[0].ParameterType.GetGenericTypeDefinition() == typeof(List<>))?.MakeGenericMethod(typeof(PickupIndex)); if (nextElementUniformPickupIndexList == null) { Log.Error("Failed to find method Xoroshiro128Plus.NextElementUniform(List)", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\DropTableQualityHandler.cs", "BossGroup_DropRewards", 550); return; } if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)nextElementUniformPickupIndexList) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\DropTableQualityHandler.cs", "BossGroup_DropRewards", 557); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)pickQuality); static PickupIndex pickQuality(PickupIndex originalPickupIndex, BossGroup bossGroup) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) return tryUpgradeQuality(originalPickupIndex, bossGroup.rng); } } private static void Inventory_GiveRandomEquipment(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { parameter = null; } if (!val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "SetEquipmentIndex") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\DropTableQualityHandler.cs", "Inventory_GiveRandomEquipment", 580); return; } if (parameter != null) { val.Emit(OpCodes.Ldarg, parameter); } else { val.Emit(OpCodes.Ldnull); } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)pickQuality); static EquipmentIndex pickQuality(EquipmentIndex originalEquipmentIndex, Xoroshiro128Plus rng, Inventory inventory) { //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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Invalid comparison between Unknown and I4 //IL_0040: 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) PickupDef pickupDef = PickupCatalog.GetPickupDef(tryUpgradeQuality(PickupCatalog.FindPickupIndex(originalEquipmentIndex), rng ?? RoR2Application.rng, Object.op_Implicit((Object)(object)inventory) ? ((Component)inventory).GetComponent() : null)); EquipmentIndex val2 = (EquipmentIndex)((pickupDef == null) ? (-1) : ((int)pickupDef.equipmentIndex)); if ((int)val2 == -1) { return originalEquipmentIndex; } return val2; } } private static void MasterDropDroplet_DropItems(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "pickupsToDrop"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(PickupCatalog), "FindPickupIndex") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\DropTableQualityHandler.cs", "MasterDropDroplet_DropItems", 616); return; } val.Goto(array[1].Next, (MoveType)2, false); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)pickQuality); static PickupIndex pickQuality(PickupIndex originalPickupIndex, MasterDropDroplet masterDropDroplet) { //IL_0000: 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) return tryUpgradeQuality(originalPickupIndex, masterDropDroplet.rng ?? RoR2Application.rng, ((Component)masterDropDroplet).GetComponent()); } } } public static class EffectCatalogUtils { private static readonly Dictionary _effectIndexByPrefabName = new Dictionary(); [SystemInitializer(new Type[] { typeof(EffectCatalog) })] private static void Init() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Invalid comparison between Unknown and I4 //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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_0078: Unknown result type (might be due to invalid IL or missing references) _effectIndexByPrefabName.Clear(); _effectIndexByPrefabName.EnsureCapacity(EffectCatalog.effectCount); for (EffectIndex val = (EffectIndex)0; (int)val < EffectCatalog.effectCount; val = (EffectIndex)(val + 1)) { EffectDef effectDef = EffectCatalog.GetEffectDef(val); if (effectDef != null && !string.IsNullOrWhiteSpace(effectDef.prefabName)) { if (_effectIndexByPrefabName.ContainsKey(effectDef.prefabName)) { Log.Warning("Duplicate effect prefab name '" + effectDef.prefabName + "'", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EffectCatalogUtils.cs", "Init", 23); } _effectIndexByPrefabName[effectDef.prefabName] = val; } } } public static EffectIndex FindEffectIndex(string effectPrefabName) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return System.Collections.Generic.CollectionExtensions.GetValueOrDefault(_effectIndexByPrefabName, effectPrefabName, (EffectIndex)(-1)); } } internal static class EffectScalingFixer { private static bool _contentLock = false; private static readonly Dictionary> _fixedScalingPrefabCaches = new Dictionary>(); public static void AddToContentPack(ContentPack contentPack) { if (_fixedScalingPrefabCaches.Count <= 0) { return; } List list = new List(); foreach (Dictionary value in _fixedScalingPrefabCaches.Values) { list.AddRange(value.Values); } contentPack.effectDefs.Add(list.ToArray()); } public static void OnContentFinalized() { _contentLock = true; _fixedScalingPrefabCaches.Clear(); } public static EffectDef GetOrCreateFixedScalingCopy(GameObject effectPrefab, float defaultRadius) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown EffectComponent val = default(EffectComponent); if (!Object.op_Implicit((Object)(object)effectPrefab) || !effectPrefab.TryGetComponent(ref val) || val.applyScale) { return null; } if (_contentLock) { Log.Error("Cannot create EffectDef after content load window", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EffectScalingFixer.cs", "GetOrCreateFixedScalingCopy", 46); return null; } defaultRadius = MathF.Round(defaultRadius, 1); Dictionary orAddNew = _fixedScalingPrefabCaches.GetOrAddNew>, GameObject, Dictionary>(effectPrefab); int key = (int)(defaultRadius * 10f); if (orAddNew.TryGetValue(key, out var value)) { return value; } EffectDef val2 = new EffectDef(CreateFixedScalingCopy(effectPrefab, defaultRadius)); orAddNew.Add(key, val2); return val2; } public static GameObject CreateFixedScalingCopy(GameObject prefab, float defaultRadius) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018b: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Invalid comparison between Unknown and I4 //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: 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) GameObject val = PrefabAPI.InstantiateClone(prefab, $"{((Object)prefab).name}_ScaleFix_x{defaultRadius:F1}", false); EffectComponent val2 = default(EffectComponent); if (val.TryGetComponent(ref val2)) { val2.applyScale = true; } if (val.transform.childCount > 0) { GameObject val3 = new GameObject("Scaler"); val3.transform.SetParent(val.transform); val3.transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); val3.transform.localScale = val.transform.localScale * (1f / defaultRadius); for (int num = val.transform.childCount - 1; num >= 0; num--) { Transform child = val.transform.GetChild(num); if ((Object)(object)child != (Object)(object)val3.transform) { child.SetParent(val3.transform, false); child.SetAsFirstSibling(); } } ParticleSystem[] componentsInChildren = val.GetComponentsInChildren(true); foreach (ParticleSystem val4 in componentsInChildren) { MainModule main = val4.main; if ((int)((MainModule)(ref main)).scalingMode == 1) { Vector3 localScale = ((Component)val4).transform.localScale * (1f / defaultRadius); ((Component)val4).transform.SetParent(val.transform, true); ((Component)val4).transform.localScale = localScale; ((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)0; } } } else { Log.Warning("Scaled effect " + ((Object)prefab).name + " has no children, set prefab scale will be lost", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EffectScalingFixer.cs", "CreateFixedScalingCopy", 105); } Transform transform = val.transform; transform.localScale *= defaultRadius; return val; } } internal static class EntityStatePatcher { public struct PatcherInfo { public Predicate ShouldApplyPredicate; public Manipulator Manipulator; } private sealed class ManipulatorGroup { public readonly Manipulator[] Manipulators; public ManipulatorGroup(Manipulator[] manipulators) { Manipulators = manipulators; } public Manipulator GetCombinedManipulator() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown if (Manipulators.Length == 0) { return null; } if (Manipulators.Length == 1) { return Manipulators[0]; } return (Manipulator)delegate(ILContext il) { Manipulator[] manipulators = Manipulators; for (int i = 0; i < manipulators.Length; i++) { manipulators[i].Invoke(il); } }; } } private static readonly List _patchers = new List(); public static void AddPatcher(in PatcherInfo patcherInfo) { if (patcherInfo.Manipulator == null) { throw new ArgumentException("Patcher info must provide an il manipulator"); } _patchers.Add(patcherInfo); if (RoR2Application.loadFinished) { executePatchers(); } else if (_patchers.Count == 1) { RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(onLoad)); } } private static void onLoad() { executePatchers(); _patchers.Clear(); RoR2Application.onLoad = (Action)Delegate.Remove(RoR2Application.onLoad, new Action(onLoad)); } private static void executePatchers() { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Expected O, but got Unknown HashSet hashSet = new HashSet(EntityStateCatalog.stateIndexToType.Length); for (int i = 0; i < EntityStateCatalog.stateIndexToType.Length; i++) { Type type = EntityStateCatalog.stateIndexToType[i]; while (type != null && typeof(EntityState).IsAssignableFrom(type) && hashSet.Add(type)) { type = type.BaseType; } } int num = 0; if (hashSet.Count <= 0) { return; } List list = new List(); foreach (Type item in hashSet) { try { if (item.Assembly == Assembly.GetExecutingAssembly()) { continue; } MethodInfo[] methods = item.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { ILHook val = null; try { _ = methodInfo.DeclaringType; if (methodInfo.IsGenericMethod || methodInfo.GetMethodBody() == null) { continue; } DynamicMethodDefinition val2 = new DynamicMethodDefinition((MethodBase)methodInfo); try { ILContext val3 = new ILContext(val2.Definition); try { list.Clear(); foreach (PatcherInfo patcher in _patchers) { if (patcher.ShouldApplyPredicate == null || patcher.ShouldApplyPredicate(val3)) { list.Add(patcher.Manipulator); } } if (list.Count > 0) { Manipulator val4 = ((list.Count <= 1) ? list[0] : new ManipulatorGroup(list.ToArray()).GetCombinedManipulator()); val = new ILHook((MethodBase)methodInfo, val4, new ILHookConfig { ManualApply = true }); val.Apply(); } } finally { ((IDisposable)val3)?.Dispose(); } } finally { ((IDisposable)val2)?.Dispose(); } goto IL_0240; } catch (Exception ex) { Log.Warning("Failed to apply attack radius hook to " + methodInfo.DeclaringType.FullName + "." + methodInfo.Name + " (" + item.Assembly.FullName + "): " + ex.Message, "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EntityStatePatcher.cs", "executePatchers", 114); if (val != null) { val.Dispose(); } val = null; goto IL_0240; } IL_0240: if (val != null) { num++; } } } catch (Exception ex2) { Log.Warning("Failed to scan type for entity state patches: " + item.FullName + " (" + item.Assembly.FullName + "): " + ex2.Message, "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EntityStatePatcher.cs", "executePatchers", 128); } } } } [CreateAssetMenu(menuName = "ItemQualities/Items/EquipmentQualityGroup")] public sealed class EquipmentQualityGroup : ScriptableObject, IAsyncContentLoadCallback { [NonSerialized] [HideInInspector] public EquipmentQualityGroupIndex GroupIndex = EquipmentQualityGroupIndex.Invalid; [SerializeField] internal AssetReferenceT BaseEquipmentReference = new AssetReferenceT(string.Empty); [SerializeField] internal EquipmentDef BaseEquipment; [SerializeField] private EquipmentDef _uncommonEquipment; [SerializeField] private EquipmentDef _rareEquipment; [SerializeField] private EquipmentDef _epicEquipment; [SerializeField] private EquipmentDef _legendaryEquipment; [NonSerialized] [HideInInspector] public EquipmentIndex BaseEquipmentIndex = (EquipmentIndex)(-1); public EquipmentIndex UncommonEquipmentIndex { get { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_uncommonEquipment)) { return (EquipmentIndex)(-1); } return _uncommonEquipment.equipmentIndex; } } public EquipmentIndex RareEquipmentIndex { get { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_rareEquipment)) { return (EquipmentIndex)(-1); } return _rareEquipment.equipmentIndex; } } public EquipmentIndex EpicEquipmentIndex { get { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_epicEquipment)) { return (EquipmentIndex)(-1); } return _epicEquipment.equipmentIndex; } } public EquipmentIndex LegendaryEquipmentIndex { get { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_legendaryEquipment)) { return (EquipmentIndex)(-1); } return _legendaryEquipment.equipmentIndex; } } private bool checkCanModify() { if (((ResourceAvailability)(ref QualityCatalog.Availability)).available) { Log.Error("Cannot modify EquipmentQualityGroup equipments after QualityCatalog is initialized", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EquipmentQualityGroup.cs", "checkCanModify", 60); return false; } return true; } public EquipmentIndex GetEquipmentIndex(QualityTier qualityTier) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) return (EquipmentIndex)(qualityTier switch { QualityTier.None => BaseEquipmentIndex, QualityTier.Uncommon => UncommonEquipmentIndex, QualityTier.Rare => RareEquipmentIndex, QualityTier.Epic => EpicEquipmentIndex, QualityTier.Legendary => LegendaryEquipmentIndex, _ => throw new NotImplementedException($"Quality tier '{qualityTier}' is not implemented"), }); } public EquipmentDef GetEquipmentDef(QualityTier qualityTier) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) switch (qualityTier) { case QualityTier.None: if (!Object.op_Implicit((Object)(object)BaseEquipment)) { return EquipmentCatalog.GetEquipmentDef(BaseEquipmentIndex); } return BaseEquipment; case QualityTier.Uncommon: return _uncommonEquipment; case QualityTier.Rare: return _rareEquipment; case QualityTier.Epic: return _epicEquipment; case QualityTier.Legendary: return _legendaryEquipment; default: throw new NotImplementedException($"Quality tier '{qualityTier}' is not implemented"); } } public void SetEquipmentDef(EquipmentDef equipmentDef, QualityTier qualityTier) { if (checkCanModify()) { switch (qualityTier) { case QualityTier.None: Log.Warning("Cannot change base equipment (group: '" + ((Object)this).name + "')", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EquipmentQualityGroup.cs", "SetEquipmentDef", 113); break; case QualityTier.Uncommon: _uncommonEquipment = equipmentDef; break; case QualityTier.Rare: _rareEquipment = equipmentDef; break; case QualityTier.Epic: _epicEquipment = equipmentDef; break; case QualityTier.Legendary: _legendaryEquipment = equipmentDef; break; default: throw new NotImplementedException($"Quality tier '{qualityTier}' is not implemented"); } } } private void OnValidate() { if (!Object.op_Implicit((Object)(object)BaseEquipment) && (BaseEquipmentReference == null || !((AssetReference)BaseEquipmentReference).RuntimeKeyIsValid())) { Debug.LogError((object)("Invalid equipment reference in group '" + ((Object)this).name + "'")); } } IEnumerator IAsyncContentLoadCallback.OnContentLoad(TProgress progressReceiver) { if (Object.op_Implicit((Object)(object)BaseEquipment)) { populateEquipments(BaseEquipment); } else if (BaseEquipmentReference != null && ((AssetReference)BaseEquipmentReference).RuntimeKeyIsValid()) { AsyncOperationHandle baseEquipmentLoad = AssetAsyncReferenceManager.LoadAsset(BaseEquipmentReference, (AsyncReferenceHandleUnloadType)2); yield return baseEquipmentLoad.AsProgressCoroutine(progressReceiver); if (baseEquipmentLoad.IsValid() && (int)baseEquipmentLoad.Status == 1) { populateEquipments(baseEquipmentLoad.Result); } else { Log.Error(string.Format("Failed to load base equipment for quality group '{0}': {1}", ((Object)this).name, baseEquipmentLoad.IsValid() ? ((object)baseEquipmentLoad.OperationException) : ((object)"Invalid handle")), "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EquipmentQualityGroup.cs", "OnContentLoad", 157); } AssetAsyncReferenceManager.UnloadAsset(BaseEquipmentReference); } else { Log.Error("Invalid equipment reference in group '" + ((Object)this).name + "'", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EquipmentQualityGroup.cs", "OnContentLoad", 164); } progressReceiver.Report(1f); void populateEquipments(EquipmentDef baseEquipment) { populateEquipmentAsset(_uncommonEquipment, QualityTier.Uncommon); populateEquipmentAsset(_rareEquipment, QualityTier.Rare); populateEquipmentAsset(_epicEquipment, QualityTier.Epic); populateEquipmentAsset(_legendaryEquipment, QualityTier.Legendary); void populateEquipmentAsset(EquipmentDef equipment, QualityTier qualityTier) { //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)equipment)) { Log.Warning($"Missing variant '{qualityTier}' in equipment group '{((Object)this).name}'", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EquipmentQualityGroup.cs", "OnContentLoad", 175); } else { if (string.IsNullOrEmpty(equipment.nameToken)) { equipment.nameToken = "EQUIPMENT_" + ((Object)baseEquipment).name.ToUpper() + "_" + qualityTier.ToString().ToUpper() + "_NAME"; } if (string.IsNullOrEmpty(equipment.pickupToken)) { equipment.pickupToken = baseEquipment.pickupToken; } if (string.IsNullOrEmpty(equipment.descriptionToken)) { equipment.descriptionToken = baseEquipment.descriptionToken; } if (string.IsNullOrEmpty(equipment.loreToken)) { equipment.loreToken = baseEquipment.loreToken; } if (!Object.op_Implicit((Object)(object)equipment.unlockableDef)) { equipment.unlockableDef = baseEquipment.unlockableDef; } if (!Object.op_Implicit((Object)(object)equipment.pickupModelPrefab)) { equipment.pickupModelPrefab = baseEquipment.pickupModelPrefab; } if (equipment.pickupModelReference == null || !((AssetReference)equipment.pickupModelReference).RuntimeKeyIsValid()) { equipment.pickupModelReference = baseEquipment.pickupModelReference; } if (!Object.op_Implicit((Object)(object)equipment.pickupIconSprite)) { equipment.pickupIconSprite = baseEquipment.pickupIconSprite; } if ((int)equipment.colorIndex == 0) { equipment.colorIndex = baseEquipment.colorIndex; } if (!Object.op_Implicit((Object)(object)equipment.passiveBuffDef)) { equipment.passiveBuffDef = baseEquipment.passiveBuffDef; } if (equipment.cooldown < 0f) { equipment.cooldown = baseEquipment.cooldown; } equipment.isConsumed = baseEquipment.isConsumed; equipment.isLunar = baseEquipment.isLunar; equipment.isBoss = baseEquipment.isBoss; equipment.foodRelated = baseEquipment.foodRelated; equipment.canBeRandomlyTriggered &= baseEquipment.canBeRandomlyTriggered; equipment.enigmaCompatible &= baseEquipment.enigmaCompatible; equipment.appearsInSinglePlayer = baseEquipment.appearsInSinglePlayer; equipment.appearsInMultiPlayer = baseEquipment.appearsInMultiPlayer; equipment.requiredExpansion = baseEquipment.requiredExpansion; } } } } internal IEnumerator GenerateRuntimeAssetsAsync(ExtendedContentPack contentPack, TProgress progressReceiver = default(TProgress)) where TProgress : IProgress { if (Object.op_Implicit((Object)(object)BaseEquipment)) { generateRuntimeAssets(BaseEquipment); } else if (BaseEquipmentReference != null && ((AssetReference)BaseEquipmentReference).RuntimeKeyIsValid()) { AsyncOperationHandle baseEquipmentLoad = AssetAsyncReferenceManager.LoadAsset(BaseEquipmentReference, (AsyncReferenceHandleUnloadType)2); IEnumerator enumerator2; if (progressReceiver == null) { IEnumerator enumerator = (IEnumerator)(object)baseEquipmentLoad; enumerator2 = enumerator; } else { enumerator2 = baseEquipmentLoad.AsProgressCoroutine(progressReceiver); } yield return enumerator2; if (baseEquipmentLoad.IsValid() && (int)baseEquipmentLoad.Status == 1) { generateRuntimeAssets(baseEquipmentLoad.Result); } else { Log.Error(string.Format("Failed to load base equipment for quality group '{0}': {1}", ((Object)this).name, baseEquipmentLoad.IsValid() ? ((object)baseEquipmentLoad.OperationException) : ((object)"Invalid handle")), "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EquipmentQualityGroup.cs", "GenerateRuntimeAssetsAsync", 253); } AssetAsyncReferenceManager.UnloadAsset(BaseEquipmentReference); } else { Log.Error("Invalid equipment reference in group '" + ((Object)this).name + "'", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EquipmentQualityGroup.cs", "GenerateRuntimeAssetsAsync", 260); } ref TProgress reference = ref progressReceiver; TProgress val = default(TProgress); if (val == null) { val = reference; reference = ref val; if (val == null) { yield break; } } reference.Report(1f); void generateRuntimeAssets(EquipmentDef baseEquipment) { string baseEquipmentName = ((Object)baseEquipment).name; Texture pickupIconTexture = baseEquipment.pickupIconTexture; Texture2D baseIconTexture = (Texture2D)(object)((pickupIconTexture is Texture2D) ? pickupIconTexture : null); if (!Object.op_Implicit((Object)(object)_uncommonEquipment)) { _uncommonEquipment = createEquipment(QualityTier.Uncommon); } if (!Object.op_Implicit((Object)(object)_rareEquipment)) { _rareEquipment = createEquipment(QualityTier.Rare); } if (!Object.op_Implicit((Object)(object)_epicEquipment)) { _epicEquipment = createEquipment(QualityTier.Epic); } if (!Object.op_Implicit((Object)(object)_legendaryEquipment)) { _legendaryEquipment = createEquipment(QualityTier.Legendary); } EquipmentDef createEquipment(QualityTier qualityTier) { //IL_0130: 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_01ae: Unknown result type (might be due to invalid IL or missing references) QualityTierDef qualityTierDef = ((IEnumerable)contentPack.qualityTierDefs).FirstOrDefault((QualityTierDef qd) => qd.qualityTier == qualityTier); if (!Object.op_Implicit((Object)(object)qualityTierDef)) { Log.Error($"Failed to find quality tier def {qualityTier}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EquipmentQualityGroup.cs", "GenerateRuntimeAssetsAsync", 275); } EquipmentDef val2 = ScriptableObject.CreateInstance(); ((Object)val2).name = baseEquipmentName + qualityTier; val2.descriptionToken = "EQUIPMENT_" + baseEquipmentName.ToUpper() + "_" + qualityTier.ToString().ToUpper() + "_DESC"; val2.pickupToken = "EQUIPMENT_" + baseEquipmentName.ToUpper() + "_" + qualityTier.ToString().ToUpper() + "_PICKUP"; val2.cooldown = -1f; val2.colorIndex = (ColorIndex)0; val2.canDrop = false; val2.dropOnDeathChance = 0f; if (Object.op_Implicit((Object)(object)baseIconTexture) && Object.op_Implicit((Object)(object)qualityTierDef)) { Texture2D val3 = QualityCatalog.CreateQualityIconTexture(baseIconTexture, qualityTierDef); ((Object)val3).name = "tex" + ((Object)val2).name; Sprite val4 = Sprite.Create(val3, new Rect(0f, 0f, (float)((Texture)val3).width, (float)((Texture)val3).height), new Vector2(0.5f, 0.5f), (float)((Texture)val3).width / 5.12f); ((Object)val4).name = "tex" + ((Object)val2).name; val2.pickupIconSprite = val4; } else { val2.pickupIconSprite = baseEquipment.pickupIconSprite; } contentPack.equipmentDefs.Add(val2); return val2; } } } } public enum EquipmentQualityGroupIndex { Invalid = -1 } public sealed class QuestVolatileBatteryPickup : MonoBehaviour { private abstract class BaseState : EntityState { protected QuestVolatileBatteryPickup batteryPickupAttachment { get; private set; } protected GenericPickupController pickupController => batteryPickupAttachment._pickupController; public override void OnEnter() { ((EntityState)this).OnEnter(); batteryPickupAttachment = ((EntityState)this).GetComponent(); } } private sealed class Idle : BaseState { public override void FixedUpdate() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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) ((EntityState)this).FixedUpdate(); if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)base.pickupController)) { PickupDef pickupDef = PickupCatalog.GetPickupDef(base.pickupController.pickup.pickupIndex); EquipmentIndex equipmentIndex = (EquipmentIndex)((pickupDef == null) ? (-1) : ((int)pickupDef.equipmentIndex)); if (QualityCatalog.FindEquipmentQualityGroupIndex(equipmentIndex) == ItemQualitiesContent.EquipmentQualityGroups.QuestVolatileBattery.GroupIndex && QualityCatalog.GetQualityTier(equipmentIndex) != QualityTier.None) { ((EntityState)this).outer.SetNextState((EntityState)(object)new CountDown()); } } } } private sealed class CountDown : BaseState { public static float duration; private GameObject _detonationEffectInstance; public override void OnEnter() { //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) base.OnEnter(); if (Object.op_Implicit((Object)(object)base.pickupController)) { GameObject modelObject = base.pickupController.pickupDisplay.modelObject; _detonationEffectInstance = Object.Instantiate(_detonationEffectPrefab, modelObject.transform); _detonationEffectInstance.transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); } } public override void OnExit() { EntityState.Destroy((Object)(object)_detonationEffectInstance); _detonationEffectInstance = null; ((EntityState)this).OnExit(); } public override void FixedUpdate() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); if (Object.op_Implicit((Object)(object)base.pickupController)) { PickupDef pickupDef = PickupCatalog.GetPickupDef(base.pickupController.pickup.pickupIndex); int num = ((pickupDef == null) ? (-1) : ((int)pickupDef.equipmentIndex)); EquipmentQualityGroupIndex equipmentQualityGroupIndex = QualityCatalog.FindEquipmentQualityGroupIndex((EquipmentIndex)num); QualityTier qualityTier = QualityCatalog.GetQualityTier((EquipmentIndex)num); if (equipmentQualityGroupIndex != ItemQualitiesContent.EquipmentQualityGroups.QuestVolatileBattery.GroupIndex || qualityTier == QualityTier.None) { if (((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextState((EntityState)(object)new Idle()); } return; } base.batteryPickupAttachment._qualityTierContext.QualityTier = qualityTier; } if (((EntityState)this).fixedAge >= duration && NetworkServer.active) { QuestVolatileBattery.Detonate(((EntityState)this).gameObject, 10f); if (Object.op_Implicit((Object)(object)base.pickupController)) { EntityState.Destroy((Object)(object)((Component)base.pickupController).gameObject); } } } } private static GameObject _detonationEffectPrefab; private QualityTierContext _qualityTierContext; private GenericOwnership _genericOwnership; private bool _resolvedParentPickupController; private GenericPickupController _pickupController; [SystemInitializer(new Type[] { })] private static 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) AsyncOperationHandle handle = AddressableUtil.LoadAssetAsync(RoR2_Base_QuestVolatileBattery.VolatileBatteryPreDetonation_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject volatileBatteryPreDetonation) { _detonationEffectPrefab = volatileBatteryPreDetonation; }); } private void Awake() { _qualityTierContext = ((Component)this).GetComponent(); _genericOwnership = ((Component)this).GetComponent(); } private void FixedUpdate() { if (!_resolvedParentPickupController && Object.op_Implicit((Object)(object)((Component)this).transform.parent)) { _pickupController = ((Component)((Component)this).transform.parent).GetComponent(); _resolvedParentPickupController = true; } } public void OnInteractionBegin(Interactor activator) { _genericOwnership.ownerObject = (Object.op_Implicit((Object)(object)activator) ? ((Component)activator).gameObject : null); } } public sealed class EventFilter : MonoBehaviour { [Flags] public enum NetworkConnectionType { None = 0, Client = 1, Host = 2, Server = 4, Any = -1 } public NetworkConnectionType AllowedConnectionTypes = NetworkConnectionType.Any; public UnityEvent Event; public bool PassesConditions() { NetworkConnectionType networkConnectionType = NetworkConnectionType.None; if (NetworkServer.active) { networkConnectionType |= NetworkConnectionType.Server; if (NetworkClient.active) { networkConnectionType |= NetworkConnectionType.Host; } } else if (NetworkClient.active) { networkConnectionType |= NetworkConnectionType.Client; } if ((AllowedConnectionTypes & networkConnectionType) == 0) { return false; } return true; } public void TryTrigger() { if (PassesConditions()) { UnityEvent @event = Event; if (@event != null) { @event.Invoke(); } } } } public static class ExplosionInfoCatalog { private static ExplosionInfoDef[] _explosionInfoDefs = Array.Empty(); public static readonly CatalogModHelper ModHelper = new CatalogModHelper((Action)delegate(int index, ExplosionInfoDef explosionInfoDef) { register(explosionInfoDef, (ExplosionInfoIndex)index); }, (Func)((ExplosionInfoDef explosionInfoDef) => explosionInfoDef.Name)); public static int ExplosionInfoDefCount => _explosionInfoDefs.Length; private static void register(ExplosionInfoDef explosionInfoDef, ExplosionInfoIndex explosionInfoIndex) { if (explosionInfoIndex > ExplosionInfoIndex.None && explosionInfoIndex < ExplosionInfoIndex.Count) { explosionInfoDef.Name = explosionInfoIndex.ToString(); } explosionInfoDef.Index = explosionInfoIndex; _explosionInfoDefs[(int)explosionInfoIndex] = explosionInfoDef; } [SystemInitializer(new Type[] { })] private static void Init() { _explosionInfoDefs = new ExplosionInfoDef[8]; register(new ExplosionInfoDef { DefaultRangeGetter = () => HitGroundState.impactBulletRadius }, ExplosionInfoIndex.CaptainSupplyDropImpact); register(new ExplosionInfoDef { DefaultRangeGetter = getEntityStateInstanceFieldGetter(typeof(MeridiansWillFire), "blastRadius") }, ExplosionInfoIndex.MeridiansWill); register(new ExplosionInfoDef { DefaultRangeGetter = () => FissureSlam.blastRadius + 3f }, ExplosionInfoIndex.FalseSonBossFissureSlam); register(new ExplosionInfoDef { DefaultRangeGetter = () => PrimeDevastator.blastRadius }, ExplosionInfoIndex.FalseSonBossPrimeDevastator); register(new ExplosionInfoDef { DefaultRangeGetter = () => ClapState.radius }, ExplosionInfoIndex.GolemClap); register(new ExplosionInfoDef { DefaultRangeGetter = getEntityStateInstanceFieldGetter(typeof(BlinkState), "blastAttackRadius") }, ExplosionInfoIndex.ImpBossBlink); register(new ExplosionInfoDef { DefaultRangeGetter = () => GroundSlam.radius }, ExplosionInfoIndex.ParentGroundSlam); register(new ExplosionInfoDef { DefaultRangeGetter = () => Detonate.blastRadius }, ExplosionInfoIndex.EngiMine); ModHelper.CollectAndRegisterAdditionalEntries(ref _explosionInfoDefs); if (ExplosionInfoDefCount >= 255) { Log.Warning($"Explosions catalog exceeded soft limit (count={ExplosionInfoDefCount}), binary packing will have errors!", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ExplosionInfoCatalog.cs", "Init", 122); } static ExplosionInfoDef.GetDefaultRangeDelegate getEntityStateInstanceFieldGetter(Type entityStateType, string fieldName) { if ((object)entityStateType == null) { throw new ArgumentNullException("entityStateType"); } if (string.IsNullOrEmpty(fieldName)) { throw new ArgumentException("'fieldName' cannot be null or empty.", "fieldName"); } EntityStateConfiguration stateConfiguration = ((IEnumerable)ContentManager.entityStateConfigurations).FirstOrDefault((Func)((EntityStateConfiguration esc) => (Type)esc.targetType == entityStateType)); if (Object.op_Implicit((Object)(object)stateConfiguration)) { FieldInfo field = entityStateType.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null && field.FieldType == typeof(float)) { return delegate { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) SerializedField[] serializedFields = stateConfiguration.serializedFieldsCollection.serializedFields; foreach (SerializedField val in serializedFields) { if (val.fieldName == field.Name) { SerializedValue fieldValue = val.fieldValue; return (float)((SerializedValue)(ref fieldValue)).GetValue(field); } } return 0f; }; } Log.Error("Failed to find target field '" + fieldName + "' in " + entityStateType.FullName + " (" + ((Object)stateConfiguration).name + ")", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ExplosionInfoCatalog.cs", "Init", 107); } else { Log.Error("Failed to find entity state configuration for type '" + entityStateType.FullName + "'", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ExplosionInfoCatalog.cs", "Init", 112); } return () => 0f; } } public static ExplosionInfoDef GetExplosionInfoDef(ExplosionInfoIndex index) { return ArrayUtils.GetSafe(_explosionInfoDefs, (int)index); } public static ExplosionInfoIndex FindExplosionInfoIndex(string name) { ExplosionInfoDef[] explosionInfoDefs = _explosionInfoDefs; foreach (ExplosionInfoDef explosionInfoDef in explosionInfoDefs) { if (explosionInfoDef.Name == name) { return explosionInfoDef.Index; } } return ExplosionInfoIndex.None; } } public sealed class ExplosionInfoDef { public delegate float GetDefaultRangeDelegate(); public string Name = string.Empty; public ExplosionInfoIndex Index { get; internal set; } = ExplosionInfoIndex.None; public GetDefaultRangeDelegate DefaultRangeGetter { private get; set; } public float GetDefaultRange() { return DefaultRangeGetter(); } } public enum ExplosionInfoIndex { None = -1, CaptainSupplyDropImpact, MeridiansWill, FalseSonBossFissureSlam, FalseSonBossPrimeDevastator, GolemClap, ImpBossBlink, ParentGroundSlam, EngiMine, Count } public sealed class ExplosionRangeIndicatorScaler : MonoBehaviour { public ExplosionInfoIndex ExplosionInfoIndex = ExplosionInfoIndex.None; public Transform[] IndicatorTransforms = Array.Empty(); private ProjectileGhostController _projectileGhostController; private ProjectileController _projectileController; private GenericOwnership _genericOwnership; private LocalEffectOwnership _localEffectOwnership; private ProjectileExplosion _projectileExplosion; private CharacterBody _ownerBody; private float _lastIndicatorScaleMultiplier = 1f; private void Awake() { _projectileGhostController = ((Component)this).GetComponent(); _projectileController = ((Component)this).GetComponent(); _projectileExplosion = ((Component)this).GetComponent(); _genericOwnership = ((Component)this).GetComponent(); _localEffectOwnership = ((Component)this).GetComponent(); } private void OnEnable() { if (Object.op_Implicit((Object)(object)_projectileGhostController)) { ProjectileController val = null; foreach (ProjectileController instances in InstanceTracker.GetInstancesList()) { if (Object.op_Implicit((Object)(object)instances) && (Object)(object)instances.ghost == (Object)(object)_projectileGhostController) { val = instances; break; } } if (Object.op_Implicit((Object)(object)val)) { setProjectileControllerReference(val); } else { ProjectileHooks.OnProjectileLinkedToGhostGlobal += onProjectileLinkedToGhostGlobal; } } else if (Object.op_Implicit((Object)(object)_projectileController)) { _projectileController.onInitialized += setProjectileControllerOwner; setProjectileControllerOwner(_projectileController); } else if (Object.op_Implicit((Object)(object)_genericOwnership)) { _genericOwnership.onOwnerChanged += setOwnerObject; setOwnerObject(_genericOwnership.ownerObject); } else if (Object.op_Implicit((Object)(object)_localEffectOwnership)) { _localEffectOwnership.OnOwnerChanged += setOwnerObject; setOwnerObject(_localEffectOwnership.OwnerObject); } } private void OnDisable() { bool flag = false; if (Object.op_Implicit((Object)(object)_projectileGhostController)) { ProjectileHooks.OnProjectileLinkedToGhostGlobal -= onProjectileLinkedToGhostGlobal; flag = true; } else if (Object.op_Implicit((Object)(object)_projectileController)) { _projectileController.onInitialized -= setProjectileControllerOwner; } else if (Object.op_Implicit((Object)(object)_genericOwnership)) { _genericOwnership.onOwnerChanged -= setOwnerObject; } else if (Object.op_Implicit((Object)(object)_localEffectOwnership)) { _localEffectOwnership.OnOwnerChanged -= setOwnerObject; } setOwner(null); if (flag) { setProjectileControllerReference(null); } } private void onProjectileLinkedToGhostGlobal(ProjectileController projectileController) { if ((Object)(object)projectileController.ghost == (Object)(object)_projectileGhostController) { setProjectileControllerReference(projectileController); } else if ((Object)(object)projectileController == (Object)(object)_projectileController) { setOwner(null); setProjectileControllerReference(null); } } private void setProjectileControllerReference(ProjectileController projectileController) { if (!((Object)(object)_projectileController == (Object)(object)projectileController)) { if (Object.op_Implicit((Object)(object)_projectileController)) { _projectileController.onInitialized -= setProjectileControllerOwner; } _projectileController = projectileController; _projectileExplosion = (Object.op_Implicit((Object)(object)_projectileController) ? ((Component)_projectileController).GetComponent() : null); if (Object.op_Implicit((Object)(object)_projectileController)) { _projectileController.onInitialized += setProjectileControllerOwner; } setProjectileControllerOwner(_projectileController); } } private void setProjectileControllerOwner(ProjectileController projectileController) { setOwnerObject(Object.op_Implicit((Object)(object)projectileController) ? projectileController.owner : null); } private void setOwnerObject(GameObject ownerObj) { setOwner(Object.op_Implicit((Object)(object)ownerObj) ? ownerObj.GetComponent() : null); } private void setOwner(CharacterBody owner) { if (!((Object)(object)_ownerBody == (Object)(object)owner)) { if (Object.op_Implicit((Object)(object)_ownerBody)) { _ownerBody.onInventoryChanged -= onOwnerInventoryChanged; } _ownerBody = owner; if (Object.op_Implicit((Object)(object)_ownerBody)) { _ownerBody.onInventoryChanged += onOwnerInventoryChanged; } recalculateIndicatorsScale(); } } private void onOwnerInventoryChanged() { recalculateIndicatorsScale(); } private void recalculateIndicatorsScale() { //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) float num; if (ExplosionInfoIndex != ExplosionInfoIndex.None) { num = ExplosionInfoCatalog.GetExplosionInfoDef(ExplosionInfoIndex).GetDefaultRange(); } else if (Object.op_Implicit((Object)(object)_projectileExplosion)) { num = _projectileExplosion.blastRadius; } else { Log.Error("No explosion info reference defined for " + Util.GetGameObjectHierarchyName(((Component)this).gameObject), "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ExplosionRangeIndicatorScaler.cs", "recalculateIndicatorsScale", 187); num = 0f; } float num2 = ExplodeOnDeath.GetExplosionRadius(num, _ownerBody) / num; float num3 = num2 / _lastIndicatorScaleMultiplier; if (!float.IsFinite(num3)) { Log.Error("Infinity or NaN when calculating indicator scale for " + Util.GetGameObjectHierarchyName(((Component)this).gameObject), "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ExplosionRangeIndicatorScaler.cs", "recalculateIndicatorsScale", 198); return; } if (Mathf.Abs(num3 - 1f) >= Mathf.Epsilon) { Transform[] indicatorTransforms = IndicatorTransforms; ObjectScaleCurve val2 = default(ObjectScaleCurve); foreach (Transform val in indicatorTransforms) { if (Object.op_Implicit((Object)(object)val)) { if (((Component)val).TryGetComponent(ref val2)) { ObjectScaleCurve obj = val2; obj.baseScale *= num3; } val.localScale *= num3; } } } _lastIndicatorScaleMultiplier = num2; } } public sealed class FriendUnitQualityController : MonoBehaviour { private static readonly string _qualityInteractContextToken = "FRIENDUNIT_QUALITY_PET_CONTEXT"; private CharacterBody _body; private GenericInteraction _genericInteraction; private FriendUnitController _friendUnitController; private EntityStateMachine _bodyStateMachine; private CharacterMaster _ownerMaster; private bool _qualityBehaviorActive; private string _defaultInteractContextToken; public bool IsQualityBehaviorActive => _qualityBehaviorActive; public InteractionProcFilter InteractionProcFilter { get; private set; } [SystemInitializer(new Type[] { })] private static void Init() { if (Object.op_Implicit((Object)(object)BodyPrefabs.FriendUnitBody)) { UnityObjectExtensions.EnsureComponent(((Component)BodyPrefabs.FriendUnitBody).gameObject); UnityObjectExtensions.EnsureComponent(((Component)BodyPrefabs.FriendUnitBody).gameObject); } else { Log.Error("Failed to add component to body prefab", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\FriendUnitQualityController.cs", "Init", 24); } } private void Awake() { _body = ((Component)this).GetComponent(); _genericInteraction = ((Component)this).GetComponent(); _friendUnitController = ((Component)this).GetComponent(); InteractionProcFilter = ((Component)this).GetComponent(); _bodyStateMachine = EntityStateMachine.FindByCustomName(((Component)this).gameObject, "Body"); } private void Start() { if (Object.op_Implicit((Object)(object)_body.master)) { _body.master.minionOwnership.onOwnerDiscovered += setOwnerMaster; _body.master.minionOwnership.onOwnerLost += setOwnerMaster; setOwnerMaster(_body.master.minionOwnership.ownerMaster); } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)_body.master)) { _body.master.minionOwnership.onOwnerDiscovered -= setOwnerMaster; _body.master.minionOwnership.onOwnerLost -= setOwnerMaster; } setOwnerMaster(null); } private void setOwnerMaster(CharacterMaster ownerMaster) { if (!((Object)(object)_ownerMaster == (Object)(object)ownerMaster)) { if (Object.op_Implicit((Object)(object)_ownerMaster)) { _ownerMaster.inventory.onInventoryChanged -= onOwnerInventoryChanged; } _ownerMaster = ownerMaster; onOwnerInventoryChanged(); if (Object.op_Implicit((Object)(object)_ownerMaster)) { _ownerMaster.inventory.onInventoryChanged += onOwnerInventoryChanged; } } } private void onOwnerInventoryChanged() { ItemQualityCounts itemQualityCounts = default(ItemQualityCounts); if (Object.op_Implicit((Object)(object)_ownerMaster) && Object.op_Implicit((Object)(object)_ownerMaster.inventory)) { itemQualityCounts = _ownerMaster.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.PhysicsProjectile); } setQualityBehaviorActive(itemQualityCounts.TotalQualityCount > 0); } private void setQualityBehaviorActive(bool active) { if (_qualityBehaviorActive == active) { return; } _qualityBehaviorActive = active; if (_qualityBehaviorActive) { if (_genericInteraction.contextToken != _qualityInteractContextToken) { _defaultInteractContextToken = _genericInteraction.contextToken; _genericInteraction.contextToken = _qualityInteractContextToken; } ((UnityEvent)(object)_genericInteraction.onActivation).AddListener((UnityAction)onQualityInteract); } else { if (_genericInteraction.contextToken == _qualityInteractContextToken) { _genericInteraction.contextToken = _defaultInteractContextToken; } ((UnityEvent)(object)_genericInteraction.onActivation).RemoveListener((UnityAction)onQualityInteract); } } private void onQualityInteract(Interactor interactor) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) CharacterBody val = (Object.op_Implicit((Object)(object)interactor) ? ((Component)interactor).GetComponent() : null); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.inputBank)) { FriendUnitPunt friendUnitPunt = new FriendUnitPunt { Punter = ((Component)val).gameObject, AimRay = val.inputBank.GetAimRay() }; if (_bodyStateMachine.SetInterruptState((EntityState)(object)friendUnitPunt, (InterruptPriority)7)) { _friendUnitController.SetInteractibility(false); } } } } [RequireComponent(typeof(TeamFilter))] public sealed class GatewayQualityPickupController : NetworkBehaviour { public TeamFilter TeamFilter; public Transform CoreTransform; private bool _hasTeleported; public bool IsAvailable => !_hasTeleported; private void Awake() { TeamFilter = ((Component)this).GetComponent(); } private void OnEnable() { InstanceTracker.Add(this); } private void OnDisable() { InstanceTracker.Remove(this); } public void OnInteractAuthority(CharacterBody body) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown if (!_hasTeleported) { IPhysMotor obj; if (!Object.op_Implicit((Object)(object)body.characterMotor)) { obj = ((Component)body).GetComponent(); } else { IPhysMotor characterMotor = (IPhysMotor)(object)body.characterMotor; obj = characterMotor; } IPhysMotor val = obj; if (val != null) { Vector3 velocityAuthority = val.velocityAuthority; val.velocityAuthority = Vector3Utils.XAZ(ref velocityAuthority, 0f); } Vector3 position = ((Component)this).transform.position; TeleportBodyArgs val2 = default(TeleportBodyArgs); ((TeleportBodyArgs)(ref val2)).body = body; val2.forceOutOfVehicle = true; val2.resetStateMachines = false; val2.targetPosition = position; val2.targetRotation = body.transform.rotation; TeleportHelper.TeleportBody(val2); GameObject teleportEffectPrefab = Run.instance.GetTeleportEffectPrefab(((Component)body).gameObject); if (Object.op_Implicit((Object)(object)teleportEffectPrefab)) { EffectManager.SpawnEffect(teleportEffectPrefab, new EffectData { origin = position }, true); } _hasTeleported = true; if (NetworkServer.active) { OnTeleportServer(); } else { NetMessageExtensions.Send((INetMessage)(object)new GatewayPickupTeleportMessage(((Component)this).gameObject), (NetworkDestination)2); } } } [Server] public void OnTeleportServer() { if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void ItemQualities.GatewayQualityPickupController::OnTeleportServer()' called on client"); } else { Object.Destroy((Object)(object)((Component)this).gameObject); } } private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { bool result = default(bool); return result; } public override void OnDeserialize(NetworkReader reader, bool initialState) { } public override void PreStartClient() { } } public sealed class GatewayQualityPickupSearch : BaseDirectionalSearch { public TeamIndex teamIndex { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return base.candidateFilter.TeamIndex; } [MethodImpl(MethodImplOptions.AggressiveInlining)] set { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) base.candidateFilter.TeamIndex = value; } } public GatewayQualityPickupSearch(GatewayQualityPickupSearchSelector selector, GatewayQualityPickupSearchFilter candidateFilter) : base(selector, candidateFilter) { } public GatewayQualityPickupSearch() : base(default(GatewayQualityPickupSearchSelector), default(GatewayQualityPickupSearchFilter)) { } } public struct GatewayQualityPickupSearchFilter : IGenericDirectionalSearchFilter { public TeamIndex TeamIndex; public readonly bool PassesFilter(GatewayQualityPickupController candidateInfo) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (candidateInfo.IsAvailable) { return candidateInfo.TeamFilter.teamIndex == TeamIndex; } return false; } } [StructLayout(LayoutKind.Sequential, Size = 1)] public readonly struct GatewayQualityPickupSearchSelector : IGenericWorldSearchSelector { public GameObject GetRootObject(GatewayQualityPickupController source) { return ((Component)source).gameObject; } public Transform GetTransform(GatewayQualityPickupController source) { if (!Object.op_Implicit((Object)(object)source.CoreTransform)) { return ((Component)source).transform; } return source.CoreTransform; } } public sealed class GenericDurationComponent : NetworkBehaviour { [SyncVar(hook = "hookSetDuration")] public float Duration; public BuffWard BuffWard; public BeginRapidlyActivatingAndDeactivating BlinkController; public float BlinkDuration = 1f; public float NetworkDuration { get { return Duration; } [param: In] set { ref float duration = ref Duration; if (NetworkServer.localClientActive && !((NetworkBehaviour)this).syncVarHookGuard) { ((NetworkBehaviour)this).syncVarHookGuard = true; hookSetDuration(value); ((NetworkBehaviour)this).syncVarHookGuard = false; } ((NetworkBehaviour)this).SetSyncVar(value, ref duration, 1u); } } public override void OnStartClient() { setDuration(); } private void setDuration() { if (Object.op_Implicit((Object)(object)BuffWard)) { BuffWard.expireDuration = Duration; } if (Object.op_Implicit((Object)(object)BlinkController)) { BlinkController.delayBeforeBeginningBlinking = Mathf.Max(0f, Duration - BlinkDuration); } } private void hookSetDuration(float duration) { NetworkDuration = duration; setDuration(); } private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { if (forceAll) { writer.Write(Duration); return true; } bool flag = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(Duration); } if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { if (initialState) { Duration = reader.ReadSingle(); return; } int num = (int)reader.ReadPackedUInt32(); if (((uint)num & (true ? 1u : 0u)) != 0) { hookSetDuration(reader.ReadSingle()); } } public override void PreStartClient() { } } public sealed class GenericNetworkedObjectAttachment : NetworkBehaviour { [SyncVar(hook = "onSyncAttachedToObject")] private GameObject _attachedToObject; [SyncVar(hook = "onSyncAttachedObjectChildName")] private string _attachedToObjectChildName; public bool ShouldParentToAttachedObject = true; public bool ForceHostAuthority; private NetworkIdentity _networkIdentity; private CharacterBody _attachmentBody; private bool _attached; private NetworkInstanceId ____attachedToObjectNetId; public GameObject AttachedToObject => _attachedToObject; public bool HasEffectiveAuthority { get; private set; } public GameObject Network_attachedToObject { get { return _attachedToObject; } [param: In] set { ref GameObject attachedToObject = ref _attachedToObject; if (NetworkServer.localClientActive && !((NetworkBehaviour)this).syncVarHookGuard) { ((NetworkBehaviour)this).syncVarHookGuard = true; onSyncAttachedToObject(value); ((NetworkBehaviour)this).syncVarHookGuard = false; } ((NetworkBehaviour)this).SetSyncVarGameObject(value, ref attachedToObject, 1u, ref ____attachedToObjectNetId); } } public string Network_attachedToObjectChildName { get { return _attachedToObjectChildName; } [param: In] set { ref string attachedToObjectChildName = ref _attachedToObjectChildName; if (NetworkServer.localClientActive && !((NetworkBehaviour)this).syncVarHookGuard) { ((NetworkBehaviour)this).syncVarHookGuard = true; onSyncAttachedObjectChildName(value); ((NetworkBehaviour)this).syncVarHookGuard = false; } ((NetworkBehaviour)this).SetSyncVar(value, ref attachedToObjectChildName, 2u); } } private void Awake() { _networkIdentity = ((Component)this).GetComponent(); _attachmentBody = ((Component)this).GetComponent(); } [Server] public void AttachToGameObjectAndSpawn(GameObject newAttachedObject, string attachedChildName = null) { //IL_0056: 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) if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void ItemQualities.GenericNetworkedObjectAttachment::AttachToGameObjectAndSpawn(UnityEngine.GameObject,System.String)' called on client"); } else if (_attached) { Log.Error($"Can't attach object '{((Component)this).gameObject}' to object '{newAttachedObject}', it's already been assigned to object '{AttachedToObject}'.", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\GenericNetworkedObjectAttachment.cs", "AttachToGameObjectAndSpawn", 42); } else if (Object.op_Implicit((Object)(object)newAttachedObject)) { NetworkIdentity component = newAttachedObject.GetComponent(); NetworkInstanceId netId = component.netId; if (((NetworkInstanceId)(ref netId)).Value == 0) { Log.Warning($"Network Identity for object {newAttachedObject} has a zero netID. Attachment will fail over the network.", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\GenericNetworkedObjectAttachment.cs", "AttachToGameObjectAndSpawn", 54); } Network_attachedToObjectChildName = attachedChildName; Network_attachedToObject = newAttachedObject; onAttachedObjectAssigned(); NetworkConnection clientAuthorityOwner = component.clientAuthorityOwner; if (clientAuthorityOwner == null || ForceHostAuthority) { NetworkServer.Spawn(((Component)this).gameObject); } else { NetworkServer.SpawnWithClientAuthority(((Component)this).gameObject, clientAuthorityOwner); } } } private void onAttachedObjectAssigned() { //IL_002d: 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) if (_attached) { return; } _attached = true; if (!Object.op_Implicit((Object)(object)_attachedToObject)) { return; } if (ShouldParentToAttachedObject) { parentToObject(); } List list = default(List); DisposableRental> val = CollectionPool>.RentCollection(ref list); try { ((Component)this).GetComponents(list); foreach (INetworkedObjectAttachmentListener item in list) { item.OnAttachedObjectDiscovered(this, _attachedToObject); } } finally { val.Dispose(); } } private void parentToObject() { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_attachedToObject)) { return; } Transform val = _attachedToObject.transform; ModelLocator val2 = default(ModelLocator); if (!string.IsNullOrEmpty(_attachedToObjectChildName) && _attachedToObject.TryGetComponent(ref val2)) { ChildLocator modelChildLocator = val2.modelChildLocator; if (Object.op_Implicit((Object)(object)modelChildLocator)) { Transform val3 = default(Transform); Transform val4 = default(Transform); if (modelChildLocator.TryFindChild(_attachedToObjectChildName, ref val3)) { val = val3; } else if (modelChildLocator.TryFindChild("Root", ref val4)) { val = val4; } } } ((Component)this).transform.SetParent(val, false); ((Component)this).transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); } private void FixedUpdate() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)AttachedToObject) && NetworkServer.active) { if (Object.op_Implicit((Object)(object)_attachmentBody) && Object.op_Implicit((Object)(object)_attachmentBody.healthComponent)) { _attachmentBody.healthComponent.Suicide((GameObject)null, (GameObject)null, default(DamageTypeCombo)); } else { Object.Destroy((Object)(object)((Component)this).gameObject); } } } private void OnValidate() { if (!((Component)this).GetComponent().localPlayerAuthority && !ForceHostAuthority) { Debug.LogWarningFormat("GenericNetworkedObjectAttachment: Object {0} NetworkIdentity needs localPlayerAuthority=true", new object[1] { ((Object)((Component)this).gameObject).name }); } } public override void OnStartClient() { ((NetworkBehaviour)this).OnStartClient(); onSyncAttachedToObject(_attachedToObject); } public override void OnStartAuthority() { ((NetworkBehaviour)this).OnStartAuthority(); HasEffectiveAuthority = Util.HasEffectiveAuthority(_networkIdentity); } public override void OnStopAuthority() { ((NetworkBehaviour)this).OnStopAuthority(); HasEffectiveAuthority = Util.HasEffectiveAuthority(_networkIdentity); } private void onSyncAttachedToObject(GameObject value) { if (!NetworkServer.active) { Network_attachedToObject = value; onAttachedObjectAssigned(); } } private void onSyncAttachedObjectChildName(string newName) { Network_attachedToObjectChildName = newName; if (ShouldParentToAttachedObject) { parentToObject(); } } private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { if (forceAll) { writer.Write(_attachedToObject); writer.Write(_attachedToObjectChildName); return true; } bool flag = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(_attachedToObject); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 2u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(_attachedToObjectChildName); } if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) if (initialState) { ____attachedToObjectNetId = reader.ReadNetworkId(); _attachedToObjectChildName = reader.ReadString(); return; } int num = (int)reader.ReadPackedUInt32(); if (((uint)num & (true ? 1u : 0u)) != 0) { onSyncAttachedToObject(reader.ReadGameObject()); } if (((uint)num & 2u) != 0) { onSyncAttachedObjectChildName(reader.ReadString()); } } public override void PreStartClient() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkInstanceId)(ref ____attachedToObjectNetId)).IsEmpty()) { Network_attachedToObject = ClientScene.FindLocalObject(____attachedToObjectNetId); } } } public interface INetworkedObjectAttachmentListener { void OnAttachedObjectDiscovered(GenericNetworkedObjectAttachment attachment, GameObject attachedObject); } internal static class GenericSkillHooks { public delegate void GenericSkillDelegate(GenericSkill skill); public static event GenericSkillDelegate OnSkillRechargeAuthority; [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown GenericSkill.RestockSteplike += new hook_RestockSteplike(GenericSkill_RestockSteplike); } private static void GenericSkill_RestockSteplike(orig_RestockSteplike orig, GenericSkill self) { orig.Invoke(self); GenericSkillHooks.OnSkillRechargeAuthority?.Invoke(self); } } [RequireComponent(typeof(HealthComponent))] public sealed class HealTargetOnDamaged : MonoBehaviour, IOnIncomingDamageServerReceiver, IOnTakeDamageServerReceiver { [SerializeField] private CharacterBody _healTarget; [Min(0f)] public float DamageToHealingConversionRate = 0.5f; [Tooltip("The collisions manager to ignore collisions with the heal target, if set")] public IgnoredCollisionsProvider IgnoredCollisionsProvider; private HealthComponent _healthComponent; public CharacterBody HealTarget { get { return _healTarget; } set { if (!((Object)(object)_healTarget == (Object)(object)value)) { _healTarget = value; if (Object.op_Implicit((Object)(object)IgnoredCollisionsProvider) && ((Behaviour)this).isActiveAndEnabled) { refreshCollisionFilter(); } } } } private void Awake() { _healthComponent = ((Component)this).GetComponent(); } private void OnEnable() { if (Object.op_Implicit((Object)(object)IgnoredCollisionsProvider)) { refreshCollisionFilter(); } } private void OnDisable() { if (Object.op_Implicit((Object)(object)IgnoredCollisionsProvider)) { IgnoredCollisionsProvider.CollisionWhitelistFilter = null; } } private void refreshCollisionFilter() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)IgnoredCollisionsProvider)) { IgnoredCollisionsProvider.CollisionWhitelistFilter = (Object.op_Implicit((Object)(object)_healTarget) ? new TeamObjectFilter(_healTarget.teamComponent.teamIndex) { InvertFilter = true } : null); } } void IOnIncomingDamageServerReceiver.OnIncomingDamageServer(DamageInfo damageInfo) { if (Object.op_Implicit((Object)(object)_healTarget) && (Object)(object)damageInfo.attacker == (Object)(object)((Component)_healTarget).gameObject) { damageInfo.rejected = true; } } void IOnTakeDamageServerReceiver.OnTakeDamageServer(DamageReport damageReport) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown if (damageReport.damageInfo.rejected) { return; } float num = damageReport.damageDealt * DamageToHealingConversionRate; if (num > 0f) { HurtBox val = (Object.op_Implicit((Object)(object)_healTarget) ? _healTarget.mainHurtBox : null); if (Object.op_Implicit((Object)(object)val)) { OrbManager.instance.AddOrb((Orb)new HealOrb { origin = damageReport.damageInfo.position, target = val, scaleOrb = true, healValue = num }); } } _healthComponent.Networkhealth = _healthComponent.fullHealth; } } internal static class HealthBarHooks { private readonly struct AdditionalBarInfos { public static readonly FieldInfo[] LowHealthUnderBarInfoFields = new FieldInfo[1] { typeof(AdditionalBarInfos).GetField("StealthKitLowHealthUnderBarInfo") }; public static readonly FieldInfo[] LowHealthOverBarInfoFields = new FieldInfo[1] { typeof(AdditionalBarInfos).GetField("StealthKitLowHealthOverBarInfo") }; public static readonly FieldInfo[] ShieldOverlayBarInfoFields = new FieldInfo[1] { typeof(AdditionalBarInfos).GetField("TemporaryShieldBarInfo") }; public static readonly FieldInfo[] HealthOverlayBarInfoFields = new FieldInfo[1] { typeof(AdditionalBarInfos).GetField("TemporaryHealthBarInfo") }; public static readonly FieldInfo[] BarrierOverlayBarInfoFields = new FieldInfo[1] { typeof(AdditionalBarInfos).GetField("BarrierOverflowBarInfo") }; public static readonly FieldInfo[] EndBarInfoFields = Array.Empty(); public readonly BarInfo StealthKitLowHealthUnderBarInfo; public readonly BarInfo StealthKitLowHealthOverBarInfo; public readonly BarInfo TemporaryShieldBarInfo; public readonly BarInfo TemporaryHealthBarInfo; public readonly BarInfo BarrierOverflowBarInfo; public readonly int EnabledBarCount; public AdditionalBarInfos(in BarInfo stealthKitLowHealthUnderBarInfo, in BarInfo stealthKitLowHealthOverBarInfo, in BarInfo temporaryShieldBarInfo, in BarInfo temporaryHealthBarInfo, in BarInfo barrierOverflowBarInfo) { int enabledBarCount = 0; setBarInfo(out StealthKitLowHealthUnderBarInfo, in stealthKitLowHealthUnderBarInfo); setBarInfo(out StealthKitLowHealthOverBarInfo, in stealthKitLowHealthOverBarInfo); setBarInfo(out TemporaryShieldBarInfo, in temporaryShieldBarInfo); setBarInfo(out TemporaryHealthBarInfo, in temporaryHealthBarInfo); setBarInfo(out BarrierOverflowBarInfo, in barrierOverflowBarInfo); EnabledBarCount = enabledBarCount; void setBarInfo(out BarInfo barInfoField, in BarInfo barInfo) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) barInfoField = barInfo; enabledBarCount += (barInfoField.enabled ? 1 : 0); } } } private delegate void CheckInventoryCleanupDelegate(ref HashSet ignoreLowHealthItemIndices); private static readonly Dictionary _barToGreyscaleBarrierBarLookup = new Dictionary(); private static readonly HashSet _greyscaleBars = new HashSet(); private static Sprite getGreyscaleBar(Sprite bar) { //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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) if (_barToGreyscaleBarrierBarLookup.TryGetValue(bar, out var value)) { return value; } if (_greyscaleBars.Contains(bar)) { return bar; } Texture2D val = TextureUtils.CreateAccessibleCopy(bar.texture); ((Object)val).name = ((Object)val).name + "_BW"; Color32[] pixels = val.GetPixels32(); float num = default(float); float num2 = default(float); float num3 = default(float); for (int i = 0; i < pixels.Length; i++) { ref Color32 reference = ref pixels[i]; byte a = reference.a; Color.RGBToHSV(Color32.op_Implicit(reference), ref num, ref num2, ref num3); reference = Color32.op_Implicit(Color.HSVToRGB(num, 0f, num3)); reference.a = a; } val.SetPixels32(pixels); val.Apply(true, true); value = Sprite.Create(val, bar.rect, bar.pivot, bar.pixelsPerUnit, 0u, (SpriteMeshType)0, bar.border); ((Object)value).name = ((Object)bar).name + "_BW"; _barToGreyscaleBarrierBarLookup.Add(bar, value); _greyscaleBars.Add(value); return value; } [SystemInitializer(new Type[] { })] private static void Init() { //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 HealthBar.CheckInventory += new Manipulator(HealthBar_CheckInventory); HealthBar.ApplyBars += new Manipulator(HealthBar_ApplyBars); HealthComponent.GetHealthBarValues += new Manipulator(HealthComponent_GetHealthBarValues); } private static void HealthBar_CheckInventory(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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) ILCursor val = new ILCursor(il); VariableDefinition val2 = il.AddVariable>(); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>>((Func>)getIgnoreLowHealthItemIndices); val.Emit(OpCodes.Stloc, val2); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 16), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(ItemCatalog), "GetItemsWithTag"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "GetItemCountEffective") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\HealthBarHooks.cs", "HealthBar_CheckInventory", 193); return; } val.Goto(array[2].Next, (MoveType)2, false); if (!val.TryFindForeachVariable(out var foreachVariable)) { Log.Error("Failed to find itemIndex foreach variable", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\HealthBarHooks.cs", "HealthBar_CheckInventory", 201); return; } val.Emit(OpCodes.Ldloc, foreachVariable); val.Emit(OpCodes.Ldloc, val2); val.EmitDelegate, int>>((Func, int>)getItemCount); int num = 0; val.Index = 0; while (val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchRet(x) })) { val.Emit(OpCodes.Ldloca, val2); val.EmitDelegate((CheckInventoryCleanupDelegate)cleanup); val.SearchTarget = (SearchTarget)1; num++; } if (num == 0) { Log.Error("Failed to find ret patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\HealthBarHooks.cs", "HealthBar_CheckInventory", 237); } static void cleanup(ref HashSet ignoreLowHealthItemIndices) { if (ignoreLowHealthItemIndices != null) { ignoreLowHealthItemIndices = CollectionPool>.ReturnCollection(ignoreLowHealthItemIndices); } } static HashSet getIgnoreLowHealthItemIndices(HealthBar healthBar) { HealthComponent val3 = (Object.op_Implicit((Object)(object)healthBar) ? healthBar.source : null); CharacterBody val4 = (Object.op_Implicit((Object)(object)val3) ? val3.body : null); Inventory inventory = (Object.op_Implicit((Object)(object)val4) ? val4.inventory : null); HashSet ignoreLowHealthItemIndices2 = CollectionPool>.RentCollection(); if (Object.op_Implicit((Object)(object)inventory)) { handleCustomQualityLowHealthThreshold(ItemQualitiesContent.ItemQualityGroups.Phasing); } if (ignoreLowHealthItemIndices2.Count == 0) { ignoreLowHealthItemIndices2 = CollectionPool>.ReturnCollection(ignoreLowHealthItemIndices2); } return ignoreLowHealthItemIndices2; void handleCustomQualityLowHealthThreshold(ItemQualityGroup itemGroup) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //IL_0027: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Invalid comparison between Unknown and I4 //IL_0054: Unknown result type (might be due to invalid IL or missing references) ItemQualityCounts itemCountsEffective = inventory.GetItemCountsEffective(itemGroup); if (itemCountsEffective.TotalQualityCount > 0) { if ((int)itemGroup.BaseItemIndex != -1) { ignoreLowHealthItemIndices2.Add(itemGroup.BaseItemIndex); } for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { if (itemCountsEffective[qualityTier] > 0) { ItemIndex itemIndex2 = itemGroup.GetItemIndex(qualityTier); if ((int)itemIndex2 != -1) { ignoreLowHealthItemIndices2.Add(itemIndex2); } } } } } } static int getItemCount(int itemCount, ItemIndex itemIndex, HashSet ignoreLowHealthItemIndices) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) if (ignoreLowHealthItemIndices == null || !ignoreLowHealthItemIndices.Contains(itemIndex)) { return itemCount; } return 0; } } private static void HealthBar_ApplyBars(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Expected O, but got Unknown //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Expected O, but got Unknown //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Expected O, but got Unknown //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Expected O, but got Unknown //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Expected O, but got Unknown ILCursor val = new ILCursor(il); MethodReference handleBarMethodRef = null; if (!val.TryGotoNext(new Func[1] { delegate(Instruction x) { if (ILPatternMatchingExt.MatchCallOrCallvirt(x, ref handleBarMethodRef)) { MethodReference obj = handleBarMethodRef; if (obj == null) { return false; } return ((MemberReference)obj).Name?.StartsWith("g__HandleBar|") == true; } return false; } })) { Log.Error("Failed to find HandleBar method", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\HealthBarHooks.cs", "HealthBar_ApplyBars", 255); return; } MethodBase handleBarMethod = ReflectionHelper.ResolveReflection(handleBarMethodRef); if (handleBarMethod == null) { Log.Error("Failed to resolve HandleBar method: " + ((MemberReference)handleBarMethodRef).FullName, "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\HealthBarHooks.cs", "HealthBar_ApplyBars", 262); return; } int localsVarIndex = -1; if (!val.TryGotoPrev(new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdloca(x, ref localsVarIndex) })) { Log.Error("Failed to find locals variable", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\HealthBarHooks.cs", "HealthBar_ApplyBars", 269); return; } VariableDefinition localsVar = il.Method.Body.Variables[localsVarIndex]; val.Index = 0; VariableDefinition customBarInfosVar = il.AddVariable(); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)collectBarInfos); val.Emit(OpCodes.Stloc, customBarInfosVar); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "GetActiveCount") })) { Log.Error("Failed to find bar count patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\HealthBarHooks.cs", "HealthBar_ApplyBars", 287); return; } val.Emit(OpCodes.Ldloc, customBarInfosVar); val.EmitDelegate>((Func)addCustomBarsToCount); ILCursor[] array = default(ILCursor[]); if (val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdflda(x, "lowHealthUnderBarInfo"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, handleBarMethod) })) { ILCursor val2 = new ILCursor(il); val2.Goto(array[1].Next, (MoveType)2, false); FieldInfo[] lowHealthUnderBarInfoFields = AdditionalBarInfos.LowHealthUnderBarInfoFields; foreach (FieldInfo barInfoField2 in lowHealthUnderBarInfoFields) { emitHandleBarInfoField(val2, barInfoField2); } } else { Log.Error("Failed to find low health under bars patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\HealthBarHooks.cs", "HealthBar_ApplyBars", 327); } if (val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdflda(x, "lowHealthOverBarInfo"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, handleBarMethod) })) { ILCursor val3 = new ILCursor(il); val3.Goto(array[1].Next, (MoveType)2, false); FieldInfo[] lowHealthUnderBarInfoFields = AdditionalBarInfos.LowHealthOverBarInfoFields; foreach (FieldInfo barInfoField3 in lowHealthUnderBarInfoFields) { emitHandleBarInfoField(val3, barInfoField3); } } else { Log.Error("Failed to find low health over bars patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\HealthBarHooks.cs", "HealthBar_ApplyBars", 344); } if (val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdflda(x, "shieldBarInfo"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, handleBarMethod) })) { ILCursor val4 = new ILCursor(il); val4.Goto(array[1].Next, (MoveType)2, false); FieldInfo[] lowHealthUnderBarInfoFields = AdditionalBarInfos.ShieldOverlayBarInfoFields; foreach (FieldInfo barInfoField4 in lowHealthUnderBarInfoFields) { emitHandleBarInfoField(val4, barInfoField4); } } else { Log.Error("Failed to find shield bars patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\HealthBarHooks.cs", "HealthBar_ApplyBars", 361); } if (val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdflda(x, "trailingOverHealthbarInfo"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, handleBarMethod) })) { ILCursor val5 = new ILCursor(il); val5.Goto(array[1].Next, (MoveType)2, false); FieldInfo[] lowHealthUnderBarInfoFields = AdditionalBarInfos.HealthOverlayBarInfoFields; foreach (FieldInfo barInfoField5 in lowHealthUnderBarInfoFields) { emitHandleBarInfoField(val5, barInfoField5); } } else { Log.Error("Failed to find health bar patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\HealthBarHooks.cs", "HealthBar_ApplyBars", 378); } if (val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdflda(x, "barrierBarInfo"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, handleBarMethod) })) { ILCursor val6 = new ILCursor(il); val6.Goto(array[1].Next, (MoveType)2, false); FieldInfo[] lowHealthUnderBarInfoFields = AdditionalBarInfos.BarrierOverlayBarInfoFields; foreach (FieldInfo barInfoField6 in lowHealthUnderBarInfoFields) { emitHandleBarInfoField(val6, barInfoField6); } } else { Log.Error("Failed to find barrier bar patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\HealthBarHooks.cs", "HealthBar_ApplyBars", 395); } val.Index = -1; if (val.TryGotoPrev((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, handleBarMethod) })) { FieldInfo[] lowHealthUnderBarInfoFields = AdditionalBarInfos.EndBarInfoFields; foreach (FieldInfo barInfoField7 in lowHealthUnderBarInfoFields) { emitHandleBarInfoField(val, barInfoField7); } } else { Log.Error("Failed to find end bars patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\HealthBarHooks.cs", "HealthBar_ApplyBars", 409); } [MethodImpl(MethodImplOptions.AggressiveInlining)] static int addCustomBarsToCount(int activeCount, AdditionalBarInfos customBarInfos) { return activeCount + customBarInfos.EnabledBarCount; } void emitHandleBarInfoField(ILCursor c, FieldInfo barInfoField) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) c.Emit(OpCodes.Ldarg_0); c.Emit(OpCodes.Ldloca, customBarInfosVar); c.Emit(OpCodes.Ldflda, barInfoField); c.Emit(OpCodes.Ldloca, localsVar); c.Emit(OpCodes.Call, handleBarMethod); } } private static AdditionalBarInfos collectBarInfos(HealthBar healthBar) { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_0439: Unknown result type (might be due to invalid IL or missing references) HealthComponent healthComponent = (Object.op_Implicit((Object)(object)healthBar) ? healthBar.source : null); CharacterBody val = (Object.op_Implicit((Object)(object)healthComponent) ? healthComponent.body : null); Inventory val2 = (Object.op_Implicit((Object)(object)val) ? val.inventory : null); if (!Object.op_Implicit((Object)(object)val2) || !Object.op_Implicit((Object)(object)val) || !((Component)(object)val).TryGetComponentCached(out CharacterBodyExtraStatsTracker component)) { return default(AdditionalBarInfos); } HealthBarValues healthBarValues = healthComponent.GetHealthBarValues(); BarInfo lowHealthUnderBarInfo = healthBar.barInfoCollection.lowHealthUnderBarInfo; BarInfo lowHealthOverBarInfo = healthBar.barInfoCollection.lowHealthOverBarInfo; BarInfo shieldBarInfo = healthBar.barInfoCollection.shieldBarInfo; BarInfo trailingOverHealthbarInfo = healthBar.barInfoCollection.trailingOverHealthbarInfo; BarInfo barrierBarInfo = healthBar.barInfoCollection.barrierBarInfo; BarInfo underBarInfo2 = lowHealthUnderBarInfo; BarInfo overBarInfo2 = lowHealthOverBarInfo; underBarInfo2.enabled = false; overBarInfo2.enabled = false; if (val2.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Phasing).TotalQualityCount > 0) { setupHealthThresholdBarInfos(ref underBarInfo2, ref overBarInfo2, component.StealthKitActivationThreshold); } BarInfo temporaryShieldBarInfo = shieldBarInfo; temporaryShieldBarInfo.enabled = false; if (healthBarValues.shieldFraction > 0f && healthBar.style.shieldBarStyle.enabled) { float num = (float)val.GetBuffCount(ItemQualitiesContent.Buffs.PersonalShield) / val.maxShield; if (num > 0f) { float num2 = healthComponent.shield / val.maxShield; float num3 = healthBarValues.shieldFraction / num2; temporaryShieldBarInfo.enabled = true; temporaryShieldBarInfo.normalizedXMax = shieldBarInfo.normalizedXMax; temporaryShieldBarInfo.normalizedXMin = shieldBarInfo.normalizedXMax - Mathf.Min(healthBarValues.shieldFraction, num3 * num); float num4 = default(float); float num5 = default(float); float num6 = default(float); Color.RGBToHSV(shieldBarInfo.color, ref num4, ref num5, ref num6); temporaryShieldBarInfo.color = Color.HSVToRGB(num4, num5, num6 * 1.5f); } } BarInfo temporaryHealthBarInfo = trailingOverHealthbarInfo; temporaryHealthBarInfo.enabled = false; if (healthBarValues.healthFraction > 0f && healthBar.style.trailingOverHealthBarStyle.enabled) { float num7 = val.GetTemporaryHealthBonus() / val.maxHealth; if (num7 > 0f) { float num8 = healthComponent.health / val.maxHealth; float num9 = healthBarValues.healthFraction / num8; temporaryHealthBarInfo.enabled = true; temporaryHealthBarInfo.normalizedXMax = trailingOverHealthbarInfo.normalizedXMax; temporaryHealthBarInfo.normalizedXMin = trailingOverHealthbarInfo.normalizedXMax - Mathf.Min(healthBarValues.healthFraction, num9 * num7); float num10 = default(float); float num11 = default(float); float num12 = default(float); Color.RGBToHSV(trailingOverHealthbarInfo.color, ref num10, ref num11, ref num12); temporaryHealthBarInfo.color = Color.HSVToRGB(num10, num11, num12 * 1.5f); } } BarInfo barrierOverflowBarInfo = barrierBarInfo; barrierOverflowBarInfo.enabled = false; if (healthBar.style.barrierBarStyle.enabled) { float num13 = healthComponent.barrier / healthComponent.fullBarrier; Sprite greyscaleBar = getGreyscaleBar(healthBar.style.barrierBarStyle.sprite); if (num13 > 1f) { float num14 = num13 - (float)(int)num13; barrierOverflowBarInfo.enabled = true; barrierOverflowBarInfo.sprite = greyscaleBar; barrierOverflowBarInfo.color = getBarColor((int)num13); barrierOverflowBarInfo.normalizedXMin = 0f; barrierOverflowBarInfo.normalizedXMax = num14 * (1f - healthBarValues.curseFraction); } if (num13 > 2f) { healthBar.barInfoCollection.barrierBarInfo.sprite = greyscaleBar; healthBar.barInfoCollection.barrierBarInfo.color = getBarColor((int)num13 - 1); } else if ((Object)(object)healthBar.barInfoCollection.barrierBarInfo.sprite == (Object)(object)greyscaleBar) { healthBar.barInfoCollection.barrierBarInfo.sprite = healthBar.style.barrierBarStyle.sprite; healthBar.barInfoCollection.barrierBarInfo.color = Color.white; } } return new AdditionalBarInfos(in underBarInfo2, in overBarInfo2, in temporaryShieldBarInfo, in temporaryHealthBarInfo, in barrierOverflowBarInfo); static Color getBarColor(int barIndex) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) if (barIndex == 0) { return Color.white; } return QualityCatalog.GetQualityTierDef((QualityTier)((barIndex - 1) % 4)).color; } void setupHealthThresholdBarInfos(ref BarInfo underBarInfo, ref BarInfo overBarInfo, float healthThreshold) { bool flag = healthComponent.IsHealthBelowThreshold(healthThreshold); underBarInfo.enabled = flag && healthBar.style.lowHealthUnderStyle.enabled; underBarInfo.normalizedXMin = 0f; underBarInfo.normalizedXMax = healthThreshold * (1f - healthBarValues.curseFraction); overBarInfo.enabled = !flag && healthBar.style.lowHealthOverStyle.enabled; overBarInfo.normalizedXMin = healthThreshold * (1f - healthBarValues.curseFraction); overBarInfo.normalizedXMax = overBarInfo.normalizedXMin + 0.005f; } } private static void HealthComponent_GetHealthBarValues(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_000c: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int num = 0; while (val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "barrier") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)clampBarrier); num++; } if (num == 0) { Log.Warning("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\HealthBarHooks.cs", "HealthComponent_GetHealthBarValues", 562); } [MethodImpl(MethodImplOptions.AggressiveInlining)] static float clampBarrier(float barrier, HealthComponent healthComponent) { return Math.Min(barrier, healthComponent.fullBarrier); } } } internal static class HiddenPickupPingPatch { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown PingIndicator.GetFormattedTargetString += new Manipulator(PingIndicator_GetFormattedTargetString); } private static void PingIndicator_GetFormattedTargetString(ILContext il) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find PickupIndex parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\HiddenPickupPingPatch.cs", "PingIndicator_GetFormattedTargetString", 22); return; } ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "?") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\HiddenPickupPingPatch.cs", "PingIndicator_GetFormattedTargetString", 31); return; } val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)getHiddenPickupName); static string getHiddenPickupName(string hiddenName, PickupIndex pickupIndex) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) string text = hiddenName; QualityTier qualityTier = QualityCatalog.GetQualityTier(pickupIndex); if (qualityTier > QualityTier.None) { text = Language.GetStringFormatted(QualityCatalog.GetQualityTierDef(qualityTier).modifierToken, new object[1] { text }); } return text; } } } public sealed class IgnoredCollisionsProvider : MonoBehaviour { private static readonly HashSet _dirtyCollisionManagers = new HashSet(); public Collider[] Colliders = Array.Empty(); private IObjectCollideFilter _collisionWhitelistFilter; public IObjectCollideFilter CollisionWhitelistFilter { get { return _collisionWhitelistFilter; } set { if (_collisionWhitelistFilter == value) { return; } if (_collisionWhitelistFilter != null) { _collisionWhitelistFilter.OnFilterDirty -= markObjectCollisionManagerDirty; if (_collisionWhitelistFilter is IDisposable disposable) { disposable.Dispose(); } } _collisionWhitelistFilter = value; if (_collisionWhitelistFilter != null) { _collisionWhitelistFilter.OnFilterDirty += markObjectCollisionManagerDirty; } if (((Behaviour)this).isActiveAndEnabled) { markAllObjectCollisionManagersDirty(); } } } private void OnDestroy() { CollisionWhitelistFilter = null; } private void OnEnable() { InstanceTracker.Add(this); markAllObjectCollisionManagersDirty(); } private void OnDisable() { InstanceTracker.Remove(this); markAllObjectCollisionManagersDirty(); } private static void markAllObjectCollisionManagersDirty() { foreach (ObjectCollisionManager instances in InstanceTracker.GetInstancesList()) { markObjectCollisionManagerDirty(instances); } } private static void markObjectCollisionManagerDirty(ObjectCollisionManager collisionManager) { if (_dirtyCollisionManagers.Add(collisionManager) && _dirtyCollisionManagers.Count == 1) { RoR2Application.onNextUpdate += refreshAllDirtyCollisionManagers; } } private static void refreshAllDirtyCollisionManagers() { foreach (ObjectCollisionManager dirtyCollisionManager in _dirtyCollisionManagers) { if (Object.op_Implicit((Object)(object)dirtyCollisionManager)) { RefreshObjectCollisions(dirtyCollisionManager); } } _dirtyCollisionManagers.Clear(); } public static void RefreshObjectCollisions(ObjectCollisionManager collisionManager) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)collisionManager)) { throw new ArgumentNullException("collisionManager"); } HashSet hashSet = default(HashSet); DisposableRental> val = CollectionPool>.RentCollection(ref hashSet); try { foreach (IgnoredCollisionsProvider instances in InstanceTracker.GetInstancesList()) { if (instances.Colliders == null || instances.Colliders.Length == 0) { continue; } bool flag = false; if (instances.CollisionWhitelistFilter != null) { flag = true; try { flag = instances.CollisionWhitelistFilter.PassesFilter(collisionManager); } catch (Exception ex) { Log.Error_NoCallerPrefix(ex.ToString()); } } if (!flag) { hashSet.UnionWith(instances.Colliders); } } collisionManager.SetIgnoredColliders(hashSet); } finally { val.Dispose(); } } } [DefaultExecutionOrder(-1)] public sealed class InstantiateAddressablePrefab : MonoBehaviour { [SerializeField] private Transform _parent; [SerializeField] private AssetReferenceGameObject _prefabAddress = new AssetReferenceGameObject(string.Empty); [SerializeField] private bool _allowAsyncLoad; [SerializeField] private AsyncReferenceHandleUnloadType _prefabUnloadType = (AsyncReferenceHandleUnloadType)3; [SerializeField] private bool _instantiateOnAwake = true; private GameObject _createdInstance; private readonly AssetOrDirectReference _prefabReference = new AssetOrDirectReference(); public event Action OnInstantiated; public event Action OnInstanceDestroyed; private void Awake() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) _prefabReference.unloadType = _prefabUnloadType; _prefabReference.address = (AssetReferenceT)(object)_prefabAddress; if (_instantiateOnAwake) { InstantiatePrefab(); } } private void OnDestroy() { _prefabReference.Reset(); _prefabReference.onValidReferenceDiscovered -= onPrefabReferenceDiscovered; _prefabReference.onValidReferenceLost -= onPrefabReferenceLost; destroyInstance(); } public void InstantiatePrefab() { if (!_prefabReference.IsLoaded() && _allowAsyncLoad) { _prefabReference.onValidReferenceDiscovered += onPrefabReferenceDiscovered; _prefabReference.onValidReferenceLost += onPrefabReferenceLost; } else { GameObject prefab = _prefabReference.WaitForCompletion(); instantiatePrefab(prefab); } } private void onPrefabReferenceDiscovered(GameObject prefab) { instantiatePrefab(prefab); } private void onPrefabReferenceLost(GameObject prefab) { destroyInstance(); } private void instantiatePrefab(GameObject prefab) { if (Object.op_Implicit((Object)(object)_createdInstance)) { Log.Warning("Attempting to instantiate prefab multiple times", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\InstantiateAddressablePrefab.cs", "instantiatePrefab", 82); return; } _createdInstance = Object.Instantiate(prefab, _parent); this.OnInstantiated?.Invoke(_createdInstance); } private void destroyInstance() { if (Object.op_Implicit((Object)(object)_createdInstance)) { Object.Destroy((Object)(object)_createdInstance); _createdInstance = null; this.OnInstanceDestroyed?.Invoke(); } } } [RequireComponent(typeof(EffectComponent))] public sealed class InteractableAttachmentEffect : MonoBehaviour { [Tooltip("Added to SpecialObjectAttributes.childObjectsToDisable of the attached interactable object.")] public GameObject[] ChildObjectsToDisable = Array.Empty(); private EffectComponent _effectComponent; private GameObject _attachedToObject; private SpecialObjectAttributes _attachedToObjectAttributes; private void Awake() { _effectComponent = ((Component)this).GetComponent(); EffectComponent effectComponent = _effectComponent; effectComponent.OnEffectComponentReset = (Action)Delegate.Combine(effectComponent.OnEffectComponentReset, new Action(onReset)); } private void OnDisable() { setAttachedObject(null); } private void onReset(bool hasEffectData) { setAttachedObject((hasEffectData && _effectComponent.effectData != null) ? _effectComponent.effectData.ResolveNetworkedObjectReference() : null); } private void setAttachedObject(GameObject attachToObject) { if ((Object)(object)_attachedToObject == (Object)(object)attachToObject) { return; } if (Object.op_Implicit((Object)(object)_attachedToObjectAttributes)) { GameObject[] childObjectsToDisable = ChildObjectsToDisable; foreach (GameObject item in childObjectsToDisable) { _attachedToObjectAttributes.childObjectsToDisable.Remove(item); } } _attachedToObject = attachToObject; _attachedToObjectAttributes = (Object.op_Implicit((Object)(object)_attachedToObject) ? _attachedToObject.GetComponent() : null); if (Object.op_Implicit((Object)(object)_attachedToObjectAttributes)) { _attachedToObjectAttributes.childObjectsToDisable.AddRange(ChildObjectsToDisable); } } } internal static class InteractableCatalog { private static InteractableDef[] _interactableDefs = Array.Empty(); private static readonly Dictionary _interactableNameToIndex = new Dictionary(); public static int InteractableCount => _interactableDefs.Length; [SystemInitializer(new Type[] { })] private static void Init() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Expected O, but got Unknown //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Expected O, but got Unknown //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Expected O, but got Unknown //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Expected O, but got Unknown HashSet hashSet = default(HashSet); DisposableRental> val = CollectionPool>.RentCollection(ref hashSet); try { hashSet.EnsureCapacity(ContentManager.networkedObjectPrefabs.Length); GameObject[] networkedObjectPrefabs = ContentManager.networkedObjectPrefabs; foreach (GameObject val2 in networkedObjectPrefabs) { if (!Object.op_Implicit((Object)(object)val2.GetComponent()) && !Object.op_Implicit((Object)(object)val2.GetComponent()) && (!Object.op_Implicit((Object)(object)val2.GetComponent()) || Object.op_Implicit((Object)(object)val2.GetComponent()) || Object.op_Implicit((Object)(object)val2.GetComponent()) || Object.op_Implicit((Object)(object)val2.GetComponent())) && !Object.op_Implicit((Object)(object)val2.GetComponent()) && (!Object.op_Implicit((Object)(object)val2.GetComponent()) || Object.op_Implicit((Object)(object)val2.GetComponent())) && (Object.op_Implicit((Object)(object)val2.GetComponent()) || Object.op_Implicit((Object)(object)val2.GetComponent()) || val2.GetComponent() != null)) { hashSet.Add(val2); } } if (hashSet.Count <= 0) { return; } foreach (GameObject item in hashSet) { UnityObjectExtensions.EnsureComponent(item); } _interactableDefs = hashSet.Select((GameObject prefab) => new InteractableDef(prefab)).ToArray(); Array.Sort(_interactableDefs, Comparer.Create((InteractableDef a, InteractableDef b) => StringComparer.Ordinal.Compare(a.Name, b.Name))); _interactableNameToIndex.EnsureCapacity(_interactableDefs.Length); for (int j = 0; j < _interactableDefs.Length; j++) { InteractableDef interactableDef = _interactableDefs[j]; GameObject prefab2 = interactableDef.Prefab; interactableDef.PrefabInfoProviderComponent.CatalogIndex = j; if (!allowCopy(prefab2)) { interactableDef.CanCopy = false; } string name = interactableDef.Name; if (!_interactableNameToIndex.ContainsKey(name)) { _interactableNameToIndex[name] = j; } else { Log.Warning("Duplicate interactable name '" + name + "'", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\InteractableCatalog.cs", "Init", 107); } } _interactableNameToIndex.TrimExcess(); SpawnCard.onSpawnedServerGlobal += onSpawnCardSpawnedServerGlobal; SpecialObjectAttributes.Start += new hook_Start(SpecialObjectAttributes_Start); PurchaseInteraction.Start += new hook_Start(PurchaseInteraction_Start); DroneVendorMultiShopController.Start += new hook_Start(DroneVendorMultiShopController_Start); ClassicStageInfo.Start += new hook_Start(ClassicStageInfo_Start); overrideCanCopy("GoldshoresBeacon", canCopy: false); overrideCanCopy("ScavBackpack", canCopy: false); overrideCanCopy("ScavLunarBackpack", canCopy: false); } finally { val.Dispose(); } static bool allowCopy(GameObject prefab) { if (Object.op_Implicit((Object)(object)prefab.GetComponent()) || Object.op_Implicit((Object)(object)prefab.GetComponent()) || Object.op_Implicit((Object)(object)prefab.GetComponent()) || Object.op_Implicit((Object)(object)prefab.GetComponent()) || Object.op_Implicit((Object)(object)prefab.GetComponent())) { return false; } return true; } static void overrideCanCopy(string interactableName, bool canCopy) { InteractableDef interactableDef2 = GetInteractableDef(FindInteractableIndex(interactableName)); if (interactableDef2 != null) { interactableDef2.CanCopy = canCopy; } else { Log.Warning("Failed to find interactable '" + interactableName + "'", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\InteractableCatalog.cs", "Init", 130); } } } private static void onSpawnCardSpawnedServerGlobal(SpawnResult spawnResult) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) SpawnCard spawnCard = spawnResult.spawnRequest.spawnCard; InteractableSpawnCard val = (InteractableSpawnCard)(object)((spawnCard is InteractableSpawnCard) ? spawnCard : null); if (val != null) { recordSpawnCard(val); } } private static void ClassicStageInfo_Start(orig_Start orig, ClassicStageInfo self) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); try { if (!Object.op_Implicit((Object)(object)self.interactableCategories)) { return; } Category[] categories = self.interactableCategories.categories; for (int i = 0; i < categories.Length; i++) { DirectorCard[] cards = categories[i].cards; for (int j = 0; j < cards.Length; j++) { SpawnCard spawnCard = cards[j].GetSpawnCard(); if (Object.op_Implicit((Object)(object)spawnCard)) { InteractableSpawnCard val = (InteractableSpawnCard)(object)((spawnCard is InteractableSpawnCard) ? spawnCard : null); if (val != null && Object.op_Implicit((Object)(object)((SpawnCard)val).prefab)) { recordSpawnCard(val); } } } } } catch (Exception ex) { Log.Warning_NoCallerPrefix(ex.ToString()); } } private static void recordSpawnCard(InteractableSpawnCard spawnCard) { int num = FindInteractableIndex(((SpawnCard)spawnCard).prefab); if (num != -1) { InteractableDef interactableDef = GetInteractableDef(num); if (interactableDef != null && !Object.op_Implicit((Object)(object)interactableDef.SpawnCard)) { interactableDef.SpawnCard = spawnCard; } } } private static void PurchaseInteraction_Start(orig_Start orig, PurchaseInteraction self) { orig.Invoke(self); tryLinkToCatalog(((Component)self).gameObject); } private static void SpecialObjectAttributes_Start(orig_Start orig, SpecialObjectAttributes self) { orig.Invoke(self); if (!Object.op_Implicit((Object)(object)((Component)self).GetComponent())) { tryLinkToCatalog(((Component)self).gameObject); } } private static void DroneVendorMultiShopController_Start(orig_Start orig, DroneVendorMultiShopController self) { orig.Invoke(self); tryLinkToCatalog(((Component)self).gameObject); } private static void tryLinkToCatalog(GameObject interactableObject) { int num = FindInteractableIndex(interactableObject); InteractableInfoProvider interactableInfoProvider = default(InteractableInfoProvider); if (num != -1 && !interactableObject.TryGetComponent(ref interactableInfoProvider)) { interactableInfoProvider = interactableObject.AddComponent(); interactableInfoProvider.CatalogIndex = num; } } public static InteractableDef GetInteractableDef(int interactableIndex) { return ArrayUtils.GetSafe(_interactableDefs, interactableIndex); } public static int FindInteractableIndex(GameObject interactableObject) { InteractableInfoProvider interactableInfoProvider = default(InteractableInfoProvider); if (interactableObject.TryGetComponent(ref interactableInfoProvider)) { return interactableInfoProvider.CatalogIndex; } string text = ((Object)interactableObject).name; if (text.EndsWith("(Clone)", StringComparison.OrdinalIgnoreCase)) { text = text.Remove(text.Length - 7); } text = Regex.Replace(text, "\\(\\d+\\)$", string.Empty); text = text.Trim(); return FindInteractableIndex(text); } public static int FindInteractableIndex(string interactableName) { return System.Collections.Generic.CollectionExtensions.GetValueOrDefault(_interactableNameToIndex, interactableName, -1); } [ConCommand(commandName = "quality_list_clonable_interactables")] private static void CCListClonableInteractables(ConCommandArgs args) { Debug.Log((object)"=== Clonable Interactables ==="); InteractableDef[] interactableDefs = _interactableDefs; foreach (InteractableDef interactableDef in interactableDefs) { if (interactableDef.CanCopy) { Debug.Log((object)interactableDef.Name); } } Debug.Log((object)"=== Non-Clonable Interactables ==="); interactableDefs = _interactableDefs; foreach (InteractableDef interactableDef2 in interactableDefs) { if (!interactableDef2.CanCopy) { Debug.Log((object)interactableDef2.Name); } } } } internal sealed class InteractableDef { public GameObject Prefab; public InteractableSpawnCard SpawnCard; public bool CanCopy = true; public InteractableInfoProvider PrefabInfoProviderComponent { get; } public IInspectInfoProvider PrefabInspectInfoProvider { get; } public GenericInspectInfoProvider PrefabGenericInspectInfoProvider { get; } public IDisplayNameProvider PrefabDisplayNameProvider { get; } public SpecialObjectAttributes PrefabSpecialObjectAttributes { get; } public PingInfoProvider PrefabPingInfoProvider { get; } public string Name { get; } public int InteractableIndex { get { if (!Object.op_Implicit((Object)(object)PrefabInfoProviderComponent)) { return -1; } return PrefabInfoProviderComponent.CatalogIndex; } } public InteractableDef(GameObject prefab) { if (!Object.op_Implicit((Object)(object)prefab)) { throw new ArgumentNullException("prefab"); } Prefab = prefab; Name = ((Object)Prefab).name; PrefabInfoProviderComponent = Prefab.GetComponent(); PrefabInspectInfoProvider = Prefab.GetComponent(); PrefabGenericInspectInfoProvider = Prefab.GetComponent(); PrefabDisplayNameProvider = Prefab.GetComponent(); PrefabSpecialObjectAttributes = Prefab.GetComponent(); PrefabPingInfoProvider = Prefab.GetComponent(); } public override string ToString() { return Name; } public override int GetHashCode() { return Name.GetHashCode(); } } internal sealed class InteractableInfoProvider : MonoBehaviour { public int CatalogIndex = -1; public bool Duplicated; public SpecialObjectAttributes SpecialObjectAttributes { get; private set; } public PurchaseInteraction PurchaseInteraction { get; private set; } public IInteractableLockable InteractableLockable { get; private set; } public Transform IndicatorTransform { get { if (Object.op_Implicit((Object)(object)SpecialObjectAttributes) && Object.op_Implicit((Object)(object)SpecialObjectAttributes.indicatorOffset)) { return SpecialObjectAttributes.indicatorOffset; } return ((Component)this).transform; } } public static event Action OnCatalogedInteractableStartGlobal; private void Awake() { SpecialObjectAttributes = ((Component)this).GetComponent(); PurchaseInteraction = ((Component)this).GetComponent(); InteractableLockable = ((Component)this).GetComponent(); } private void OnEnable() { InstanceTracker.Add(this); } private void OnDisable() { InstanceTracker.Remove(this); } private void Start() { if (CatalogIndex != -1) { InteractableInfoProvider.OnCatalogedInteractableStartGlobal?.Invoke(this); } else { Log.Warning("Failed to resolve interactable catalog index for " + Util.GetGameObjectHierarchyName(((Component)this).gameObject), "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\InteractableInfoProvider.cs", "Start", 57); } } } internal sealed class InteractableSearch : BaseDirectionalSearch { public bool requireCanCopy { get { return base.candidateFilter.requireCanCopy; } set { base.candidateFilter.requireCanCopy = value; } } public bool requireSpawnCard { get { return base.candidateFilter.requireSpawnCard; } set { base.candidateFilter.requireSpawnCard = value; } } public bool forbidDuplicated { get { return base.candidateFilter.forbidDuplicated; } set { base.candidateFilter.forbidDuplicated = value; } } public InteractableSearch() : base(default(InteractableSearchSelector), default(InteractableSearchFilter)) { } public InteractableSearch(InteractableSearchSelector selector, InteractableSearchFilter candidateFilter) : base(selector, candidateFilter) { } } internal struct InteractableSearchFilter : IGenericDirectionalSearchFilter { public bool requireCanCopy; public bool requireSpawnCard; public bool forbidDuplicated; public readonly bool PassesFilter(InteractableInfoProvider interactable) { InteractableDef interactableDef = InteractableCatalog.GetInteractableDef(interactable.CatalogIndex); if (interactableDef == null) { return false; } if (requireSpawnCard && !Object.op_Implicit((Object)(object)interactableDef.SpawnCard)) { return false; } if (requireCanCopy && !interactableDef.CanCopy) { return false; } if (forbidDuplicated && interactable.Duplicated) { return false; } if (Object.op_Implicit((Object)(object)interactable.SpecialObjectAttributes) && (!interactable.SpecialObjectAttributes.grabbable || !interactable.SpecialObjectAttributes.isTargetable)) { return false; } if (interactable.InteractableLockable != null && interactable.InteractableLockable.IsLocked()) { return false; } return true; } } [StructLayout(LayoutKind.Sequential, Size = 1)] internal readonly struct InteractableSearchSelector : IGenericWorldSearchSelector { public GameObject GetRootObject(InteractableInfoProvider source) { return ((Component)source).gameObject; } public Transform GetTransform(InteractableInfoProvider source) { return source.IndicatorTransform; } } public sealed class InteractOnTimer : MonoBehaviour { [Min(0f)] public float InteractInterval = 1f; private IInteractable _interactable; private PurchaseInteraction _interactableAsPurchaseInteraction; private VendingMachineBehavior _vendingMachineBehavior; private Deployable _deployable; private float _interactTimer; private void Awake() { _interactable = ((Component)this).GetComponent(); ref PurchaseInteraction interactableAsPurchaseInteraction = ref _interactableAsPurchaseInteraction; IInteractable interactable = _interactable; interactableAsPurchaseInteraction = (PurchaseInteraction)(object)((interactable is PurchaseInteraction) ? interactable : null); _vendingMachineBehavior = ((Component)this).GetComponent(); _deployable = ((Component)this).GetComponent(); } private void FixedUpdate() { if (NetworkServer.active) { _interactTimer += Time.fixedDeltaTime; if (_interactTimer >= InteractInterval) { _interactTimer -= InteractInterval; triggerInteractServer(); } } } private void triggerInteractServer() { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_00f5: 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 (!NetworkServer.active) { Log.Warning("Called on client", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\InteractOnTimer.cs", "triggerInteractServer", 48); } else { if (_interactable == null) { return; } Interactor val = null; if (Object.op_Implicit((Object)(object)_deployable) && Object.op_Implicit((Object)(object)_deployable.ownerMaster)) { GameObject bodyObject = _deployable.ownerMaster.GetBodyObject(); Interactor val2 = default(Interactor); if (Object.op_Implicit((Object)(object)bodyObject) && bodyObject.TryGetComponent(ref val2)) { val = val2; } } if (Object.op_Implicit((Object)(object)val)) { CostTypeIndex costType = (CostTypeIndex)0; bool available = false; if (Object.op_Implicit((Object)(object)_interactableAsPurchaseInteraction)) { costType = _interactableAsPurchaseInteraction.costType; _interactableAsPurchaseInteraction.costType = (CostTypeIndex)0; available = _interactableAsPurchaseInteraction.available; } if (Object.op_Implicit((Object)(object)_vendingMachineBehavior)) { _vendingMachineBehavior.RefreshPurchaseInteractionAvailability(); } if ((int)_interactable.GetInteractability(val) == 2) { val.AttemptInteraction(((Component)this).gameObject); } if (Object.op_Implicit((Object)(object)_interactableAsPurchaseInteraction)) { _interactableAsPurchaseInteraction.costType = costType; _interactableAsPurchaseInteraction.SetAvailable(available); } } } } } internal static class InventoryHooks { public delegate void ItemCountChangedDelegate(Inventory inventory, ItemIndex itemIndex, int itemCountDiff); public static event ItemCountChangedDelegate OnTempItemGivenServerGlobal; [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown GiveItemTempImpl.Add += new Manipulator(GiveItemTempImpl_Add); } private static void GiveItemTempImpl_Add(ILContext il) { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //IL_00ee: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find ItemIndex parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\InventoryHooks.cs", "GiveItemTempImpl_Add", 27); return; } if (!((MethodReference)(object)il.Method).TryFindParameter("count", out var parameter2)) { Log.Error("Failed to find count parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\InventoryHooks.cs", "GiveItemTempImpl_Add", 33); return; } FieldInfo field = typeof(GiveItemTempImpl).GetField("inventory", (BindingFlags)(-1)); if (field == null || field.FieldType != typeof(Inventory)) { Log.Error("Failed to find inventory field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\InventoryHooks.cs", "GiveItemTempImpl_Add", 40); return; } ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchRet(x) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\InventoryHooks.cs", "GiveItemTempImpl_Add", 49); return; } val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldfld, field); val.Emit(OpCodes.Ldarg, parameter); val.Emit(OpCodes.Ldarg, parameter2); val.EmitDelegate>((Action)onGiveItemTemp); static void onGiveItemTemp(Inventory inventory, ItemIndex itemIndex, int count) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (InventoryHooks.OnTempItemGivenServerGlobal != null) { Delegate[] invocationList = InventoryHooks.OnTempItemGivenServerGlobal.GetInvocationList(); for (int i = 0; i < invocationList.Length; i++) { ItemCountChangedDelegate itemCountChangedDelegate = (ItemCountChangedDelegate)invocationList[i]; try { itemCountChangedDelegate(inventory, itemIndex, count); } catch (Exception ex) { Log.Error_NoCallerPrefix(string.Format("Caught exception in {0} ({1}.{2}) event: {3}", "OnTempItemGivenServerGlobal", itemCountChangedDelegate.Method.DeclaringType.FullName, itemCountChangedDelegate.Method.Name, ex)); } } } } } } public interface IObjectCollideFilter { event Action OnFilterDirty; bool PassesFilter(ObjectCollisionManager collisionManager); } internal static class ItemCostQualityPatch { private delegate bool CostTypeCatalog_IsAffordableItem_orig(CostTypeDef costTypeDef, IsAffordableContext context); [SystemInitializer(new Type[] { typeof(CostTypeCatalog) })] private static void Init() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown //IL_0093: 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_00c2: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Expected O, but got Unknown //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Expected O, but got Unknown CostTypeDef costTypeDef = CostTypeCatalog.GetCostTypeDef((CostTypeIndex)4); if (((costTypeDef == null) ? null : ((Delegate)(object)costTypeDef.isAffordable)?.Method) != null) { new Hook((MethodBase)((Delegate)(object)costTypeDef.isAffordable).Method, (Delegate)new Func(CostTypeCatalog_IsAffordableItem)); } else { Log.Error("Failed to find IsAffordableItem method", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ItemCostQualityPatch.cs", "Init", 26); } if (((costTypeDef == null) ? null : ((Delegate)(object)costTypeDef.payCost)?.Method) != null) { new ILHook((MethodBase)((Delegate)(object)costTypeDef.payCost).Method, new Manipulator(CostTypeCatalog_PayCostItems)); } else { Log.Error("Failed to find PayCostItems method", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ItemCostQualityPatch.cs", "Init", 35); } ChestBehavior.BaseItemDrop += new Manipulator(ChestBehavior_BaseItemDrop); ShopTerminalBehavior.DropPickup_bool += new Manipulator(ShopTerminalBehavior_DropPickup); OptionChestBehavior.ItemDrop += new Manipulator(OptionChestBehavior_ItemDrop); } private static bool CostTypeCatalog_IsAffordableItem(CostTypeCatalog_IsAffordableItem_orig orig, CostTypeDef costTypeDef, IsAffordableContext context) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) CharacterBody val = default(CharacterBody); if (orig(costTypeDef, context) && Object.op_Implicit((Object)(object)context.activator) && ((Component)context.activator).TryGetComponent(ref val) && Object.op_Implicit((Object)(object)val.inventory)) { return val.inventory.HasAtLeastXTotalNonQualityItemsOfTierForPurchase(costTypeDef.itemTier, context.cost); } return false; } private static void CostTypeCatalog_PayCostItems(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILLabel skipItemLabel = null; ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "avoidedItemIndex"), (Instruction x) => ILPatternMatchingExt.MatchBeq(x, ref skipItemLabel) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ItemCostQualityPatch.cs", "CostTypeCatalog_PayCostItems", 62); return; } val.Goto(array[1].Next, (MoveType)2, false); if (!val.TryFindForeachVariable(out var foreachVariable)) { Log.Error("Failed to find ItemIndex variable", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ItemCostQualityPatch.cs", "CostTypeCatalog_PayCostItems", 70); return; } val.Emit(OpCodes.Ldloc, foreachVariable); val.EmitDelegate>((Func)isItemAllowed); val.Emit(OpCodes.Brfalse, (object)skipItemLabel); [MethodImpl(MethodImplOptions.AggressiveInlining)] static bool isItemAllowed(ItemIndex itemIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (QualityCatalog.GetQualityTier(itemIndex) != QualityTier.None) { return QualityCatalog.FindItemQualityGroupIndex(itemIndex) == ItemQualitiesContent.ItemQualityGroups.RegeneratingScrap.GroupIndex; } return true; } } private static QualityTier getOutputQualityTierFromCost(GameObject dropperObject) { //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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Invalid comparison between Unknown and I4 //IL_008b: 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_00cd: 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) ObjectPurchaseContext objectPurchaseContext = default(ObjectPurchaseContext); if (!Object.op_Implicit((Object)(object)dropperObject) || !dropperObject.TryGetComponent(ref objectPurchaseContext) || objectPurchaseContext.Results == null) { return QualityTier.None; } ObjectPurchaseContext.PurchaseResults results = objectPurchaseContext.Results; List list = default(List); DisposableRental> val = CollectionPool>.RentCollection(ref list); try { ListUtils.EnsureCapacity(list, results.ItemStacksTaken.Length + results.EquipmentTaken.Length); ItemAndStackValues[] itemStacksTaken = results.ItemStacksTaken; for (int i = 0; i < itemStacksTaken.Length; i++) { ItemAndStackValues val2 = itemStacksTaken[i]; ((ItemAndStackValues)(ref val2)).AddAsPickupsToList(list); } EquipmentIndex[] equipmentTaken = results.EquipmentTaken; foreach (EquipmentIndex val3 in equipmentTaken) { if ((int)val3 != -1) { list.Add(new UniquePickup(PickupCatalog.FindPickupIndex(val3))); } } if (list.Count == 0) { return QualityTier.None; } float num = 0f; int num2 = 0; foreach (UniquePickup item in list) { QualityTier qualityTier = QualityCatalog.GetQualityTier(item.pickupIndex); if (qualityTier > QualityTier.None) { num += (float)qualityTier; num2++; } } if (num2 == 0) { return QualityTier.None; } num /= (float)num2; return (QualityTier)Mathf.Clamp(Mathf.CeilToInt(num), 0, 3); } finally { val.Dispose(); } } private static PickupIndex tryUpgradeQualityFromCost(PickupIndex intendedDropPickupIndex, GameObject dropperObject) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_0014: 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) QualityTier outputQualityTierFromCost = getOutputQualityTierFromCost(dropperObject); PickupIndex val = intendedDropPickupIndex; QualityTier qualityTier = QualityCatalog.GetQualityTier(val); if (outputQualityTierFromCost > qualityTier) { val = QualityCatalog.GetPickupIndexOfQuality(val, outputQualityTierFromCost); qualityTier = outputQualityTierFromCost; } return val; } private static void OptionChestBehavior_ItemDrop(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "pickerOptions") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ItemCostQualityPatch.cs", "OptionChestBehavior_ItemDrop", 164); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getPickerOptions); static Option[] getPickerOptions(Option[] options, OptionChestBehavior optionChestBehavior) { //IL_0039: 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_004e: Unknown result type (might be due to invalid IL or missing references) if (options != null && options.Length != 0 && Object.op_Implicit((Object)(object)optionChestBehavior)) { QualityTier outputQualityTierFromCost = getOutputQualityTierFromCost(((Component)optionChestBehavior).gameObject); if (outputQualityTierFromCost > QualityTier.None) { for (int i = 0; i < options.Length; i++) { ref UniquePickup pickup = ref options[i].pickup; if (((UniquePickup)(ref pickup)).isValid && QualityCatalog.GetQualityTier(pickup.pickupIndex) < outputQualityTierFromCost) { pickup = pickup.WithQualityTier(outputQualityTierFromCost); } } } } return options; } } private static void ShopTerminalBehavior_DropPickup(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "pickup") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ItemCostQualityPatch.cs", "ShopTerminalBehavior_DropPickup", 200); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)tryUpgradeQuality); static UniquePickup tryUpgradeQuality(UniquePickup pickup, ShopTerminalBehavior shopTerminalBehavior) { //IL_002e: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (((UniquePickup)(ref pickup)).isValid) { pickup = ((UniquePickup)(ref pickup)).WithPickupIndex(tryUpgradeQualityFromCost(pickup.pickupIndex, Object.op_Implicit((Object)(object)shopTerminalBehavior) ? ((Component)shopTerminalBehavior).gameObject : null)); } return pickup; } } private static void ChestBehavior_BaseItemDrop(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "set_pickup") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ItemCostQualityPatch.cs", "ChestBehavior_BaseItemDrop", 225); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)tryUpgradeQuality); static UniquePickup tryUpgradeQuality(UniquePickup pickup, ChestBehavior chestBehavior) { //IL_002e: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (((UniquePickup)(ref pickup)).isValid) { pickup = ((UniquePickup)(ref pickup)).WithPickupIndex(tryUpgradeQualityFromCost(pickup.pickupIndex, Object.op_Implicit((Object)(object)chestBehavior) ? ((Component)chestBehavior).gameObject : null)); } return pickup; } } } internal static class ItemDiscoveryFix { private sealed class ItemGrantTracker : MonoBehaviour { private NetworkUser _networkUser; private Inventory _inventory; private void Awake() { CharacterMaster component = ((Component)this).GetComponent(); _networkUser = ((Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.playerCharacterMasterController)) ? component.playerCharacterMasterController.networkUser : ((Component)this).GetComponent()); _inventory = (Object.op_Implicit((Object)(object)component) ? component.inventory : ((Component)this).GetComponent()); } private void OnEnable() { if (Object.op_Implicit((Object)(object)_inventory)) { _inventory.onItemAddedClient += onItemAddedClient; _inventory.onEquipmentChangedClient += onEquipmentChangedClient; } } private void OnDisable() { if (Object.op_Implicit((Object)(object)_inventory)) { _inventory.onItemAddedClient -= onItemAddedClient; _inventory.onEquipmentChangedClient -= onEquipmentChangedClient; } } private void onItemAddedClient(ItemIndex itemIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) if ((int)itemIndex != -1) { tryDiscoverPickup(PickupCatalog.FindPickupIndex(itemIndex)); } } private void onEquipmentChangedClient(EquipmentIndex equipmentIndex, uint equipmentSlot) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) if ((int)equipmentIndex != -1) { tryDiscoverPickup(PickupCatalog.FindPickupIndex(equipmentIndex)); } } private void tryDiscoverPickup(PickupIndex pickupIndex) { //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_0034: Unknown result type (might be due to invalid IL or missing references) if (!(pickupIndex != PickupIndex.none) || !Object.op_Implicit((Object)(object)_networkUser)) { return; } LocalUser localUser = _networkUser.localUser; if (localUser != null) { UserProfile userProfile = localUser.userProfile; if (userProfile != null) { userProfile.DiscoverPickup(pickupIndex); } } } } [SystemInitializer(new Type[] { })] private static void Init() { CharacterMaster.onStartGlobal += onStartGlobal; } private static void onStartGlobal(CharacterMaster master) { if (Object.op_Implicit((Object)(object)master.playerCharacterMasterController) && Object.op_Implicit((Object)(object)master.playerCharacterMasterController.networkUser) && master.playerCharacterMasterController.networkUser.localUser != null) { UnityObjectExtensions.EnsureComponent(((Component)master).gameObject); } } } public sealed class ItemQualitiesContent : IContentPackProvider { public static class QualityTiers { internal static ReadOnlyCollection AllQualityTiers = Empty.ReadOnlyCollection; public static QualityTierDef Uncommon; public static QualityTierDef Rare; public static QualityTierDef Epic; public static QualityTierDef Legendary; } public static class ItemQualityGroups { internal static ReadOnlyCollection AllGroups = Empty.ReadOnlyCollection; public static ItemQualityGroup QualityTier; public static ItemQualityGroup Hoof; public static ItemQualityGroup CritGlasses; public static ItemQualityGroup SprintBonus; public static ItemQualityGroup Syringe; public static ItemQualityGroup HealWhileSafe; public static ItemQualityGroup Crowbar; public static ItemQualityGroup PersonalShield; public static ItemQualityGroup BarrierOnKill; public static ItemQualityGroup ExtraShrineItem; public static ItemQualityGroup Dagger; public static ItemQualityGroup FragileDamageBonus; public static ItemQualityGroup FragileDamageBonusConsumed; public static ItemQualityGroup SecondarySkillMagazine; public static ItemQualityGroup Firework; public static ItemQualityGroup Medkit; public static ItemQualityGroup Mushroom; public static ItemQualityGroup EquipmentMagazine; public static ItemQualityGroup HealingPotion; public static ItemQualityGroup HealingPotionConsumed; public static ItemQualityGroup TriggerEnemyDebuffs; public static ItemQualityGroup IncreaseDamageOnMultiKill; public static ItemQualityGroup NearbyDamageBonus; public static ItemQualityGroup AttackSpeedAndMoveSpeed; public static ItemQualityGroup Tooth; public static ItemQualityGroup GoldOnHurt; public static ItemQualityGroup TreasureCache; public static ItemQualityGroup FlatHealth; public static ItemQualityGroup StickyBomb; public static ItemQualityGroup StunChanceOnHit; public static ItemQualityGroup BleedOnHit; public static ItemQualityGroup Clover; public static ItemQualityGroup WardOnLevel; public static ItemQualityGroup Bear; public static ItemQualityGroup Missile; public static ItemQualityGroup WarCryOnMultiKill; public static ItemQualityGroup KnockBackHitEnemies; public static ItemQualityGroup BonusGoldPackOnKill; public static ItemQualityGroup DeathMark; public static ItemQualityGroup Bandolier; public static ItemQualityGroup SlowOnHit; public static ItemQualityGroup ExecuteLowHealthElite; public static ItemQualityGroup MoveSpeedOnKill; public static ItemQualityGroup Feather; public static ItemQualityGroup StrengthenBurn; public static ItemQualityGroup Infusion; public static ItemQualityGroup FireRing; public static ItemQualityGroup Seed; public static ItemQualityGroup TPHealingNova; public static ItemQualityGroup IncreasePrimaryDamage; public static ItemQualityGroup ExtraStatsOnLevelUp; public static ItemQualityGroup AttackSpeedOnCrit; public static ItemQualityGroup Thorns; public static ItemQualityGroup SprintOutOfCombat; public static ItemQualityGroup RegeneratingScrap; public static ItemQualityGroup RegeneratingScrapConsumed; public static ItemQualityGroup SprintArmor; public static ItemQualityGroup IceRing; public static ItemQualityGroup LowerPricedChests; public static ItemQualityGroup LowerPricedChestsConsumed; public static ItemQualityGroup HealOnCrit; public static ItemQualityGroup FreeChest; public static ItemQualityGroup PrimarySkillShuriken; public static ItemQualityGroup Squid; public static ItemQualityGroup Phasing; public static ItemQualityGroup ChainLightning; public static ItemQualityGroup TeleportOnLowHealth; public static ItemQualityGroup TeleportOnLowHealthConsumed; public static ItemQualityGroup EnergizedOnEquipmentUse; public static ItemQualityGroup JumpBoost; public static ItemQualityGroup BarrierOnOverHeal; public static ItemQualityGroup AlienHead; public static ItemQualityGroup FallBoots; public static ItemQualityGroup Behemoth; public static ItemQualityGroup RandomEquipmentTrigger; public static ItemQualityGroup ImmuneToDebuff; public static ItemQualityGroup KillEliteFrenzy; public static ItemQualityGroup ExtraLife; public static ItemQualityGroup ExtraLifeConsumed; public static ItemQualityGroup ArmorPlate; public static ItemQualityGroup StunAndPierce; public static ItemQualityGroup Icicle; public static ItemQualityGroup OutOfCombatArmor; public static ItemQualityGroup BoostAllStats; public static ItemQualityGroup GhostOnKill; public static ItemQualityGroup UtilitySkillMagazine; public static ItemQualityGroup MoreMissile; public static ItemQualityGroup Plant; public static ItemQualityGroup CritDamage; public static ItemQualityGroup IncreaseHealing; public static ItemQualityGroup NovaOnHeal; public static ItemQualityGroup LaserTurbine; public static ItemQualityGroup MeteorAttackOnHighDamage; public static ItemQualityGroup BossDamageBonus; public static ItemQualityGroup PermanentDebuffOnHit; public static ItemQualityGroup SpeedBoostPickup; public static ItemQualityGroup BounceNearby; public static ItemQualityGroup ItemDropChanceOnKill; public static ItemQualityGroup Talisman; public static ItemQualityGroup DroneWeapons; public static ItemQualityGroup BarrageOnBoss; public static ItemQualityGroup CloverVoid; public static ItemQualityGroup EquipmentMagazineVoid; public static ItemQualityGroup BoostDamageVoid; public static ItemQualityGroup IgniteOnKill; public static ItemQualityGroup BleedOnHitVoid; public static ItemQualityGroup VoidMegaCrabItem; public static ItemQualityGroup MissileVoid; public static ItemQualityGroup DelayedDamage; public static ItemQualityGroup BearVoid; public static ItemQualityGroup ArmorReductionOnHit; public static ItemQualityGroup SlowOnHitVoid; public static ItemQualityGroup ElementalRingVoid; public static ItemQualityGroup ChainLightningVoid; public static ItemQualityGroup CritGlassesVoid; public static ItemQualityGroup ExtraLifeVoid; public static ItemQualityGroup ExtraLifeVoidConsumed; public static ItemQualityGroup TreasureCacheVoid; public static ItemQualityGroup ExplodeOnDeathVoid; public static ItemQualityGroup MushroomVoid; public static ItemQualityGroup AttackSpeedPerNearbyAllyOrEnemy; public static ItemQualityGroup HeadHunter; public static ItemQualityGroup ScrapWhite; public static ItemQualityGroup ScrapGreen; public static ItemQualityGroup ScrapRed; public static ItemQualityGroup ScrapYellow; public static ItemQualityGroup BarrierOnCooldown; public static ItemQualityGroup SpeedOnPickup; public static ItemQualityGroup Duplicator; public static ItemQualityGroup ExplodeOnDeath; public static ItemQualityGroup DronesDropDynamite; public static ItemQualityGroup CritAtLowerElevation; public static ItemQualityGroup ShieldBooster; public static ItemQualityGroup SharedSuffering; public static ItemQualityGroup PhysicsProjectile; public static ItemQualityGroup JumpDamageStrike; public static ItemQualityGroup ShockNearby; public static ItemQualityGroup TreebotBuddy; } public static class Items { public static ItemDef DronesDropDynamiteQualityDroneItem; public static ItemDef SquidUpgradeChanceOnKill; public static ItemDef SquidUpgradeHidden; public static ItemDef TrueKillOnTimer; } public static class EquipmentQualityGroups { internal static ReadOnlyCollection AllGroups = Empty.ReadOnlyCollection; public static EquipmentQualityGroup BossHunter; public static EquipmentQualityGroup BossHunterConsumed; public static EquipmentQualityGroup Recycle; public static EquipmentQualityGroup VendingMachine; public static EquipmentQualityGroup CommandMissile; public static EquipmentQualityGroup MultiShopCard; public static EquipmentQualityGroup DeathProjectile; public static EquipmentQualityGroup PassiveHealing; public static EquipmentQualityGroup GummyClone; public static EquipmentQualityGroup TeamWarCry; public static EquipmentQualityGroup GainArmor; public static EquipmentQualityGroup CritOnUse; public static EquipmentQualityGroup BFG; public static EquipmentQualityGroup Blackhole; public static EquipmentQualityGroup Scanner; public static EquipmentQualityGroup Lightning; public static EquipmentQualityGroup Saw; public static EquipmentQualityGroup LifestealOnHit; public static EquipmentQualityGroup DroneBackup; public static EquipmentQualityGroup GoldGat; public static EquipmentQualityGroup Jetpack; public static EquipmentQualityGroup Parry; public static EquipmentQualityGroup HealAndRevive; public static EquipmentQualityGroup HealAndReviveConsumed; public static EquipmentQualityGroup QuestVolatileBattery; public static EquipmentQualityGroup Fruit; public static EquipmentQualityGroup Gateway; } public static class BuffQualityGroups { internal static ReadOnlyCollection AllGroups = Empty.ReadOnlyCollection; public static BuffQualityGroup DeathMark; public static BuffQualityGroup Slow60; public static BuffQualityGroup KillMoveSpeed; public static BuffQualityGroup AttackSpeedOnCrit; public static BuffQualityGroup WhipBoost; public static BuffQualityGroup Energized; public static BuffQualityGroup KillEliteFrenzyBuff; public static BuffQualityGroup ArmorPlateBuildup; public static BuffQualityGroup ArmorPlateBuff; public static BuffQualityGroup BoostAllStatsBuff; public static BuffQualityGroup AttackSpeedPerNearbyAllyOrEnemyBuff; public static BuffQualityGroup FragileDamageBonusBuff; public static BuffQualityGroup GoldArmorBuff; public static BuffQualityGroup ToothPrimaryBuff; public static BuffQualityGroup ToothSecondaryBuff; public static BuffQualityGroup ShieldBoosterBuff; public static BuffQualityGroup MultikillWarCryBuff; public static BuffQualityGroup TeamWarCry; public static BuffQualityGroup FullCrit; public static BuffQualityGroup LifeSteal; public static BuffQualityGroup BugBlock; public static BuffQualityGroup Warbanner; public static BuffQualityGroup DelayedDamageDebuff; public static BuffQualityGroup CrowbarCharge; } public static class Buffs { public static BuffDef BossStun; public static BuffDef SprintArmorWeaken; public static BuffDef SprintArmorDashCooldown; public static BuffDef HealCritBoost; public static BuffDef MiniBossMarker; public static BuffDef GoldenGun; public static BuffDef PersonalShield; public static BuffDef FeatherExtraJumps; public static BuffDef SlugHealth; public static BuffDef FruitTempHealth; public static BuffDef MiniBossCooldown; public static BuffDef LifeStealSpeed; public static BuffDef ScorpionVenom; public static BuffDef Immobilized; } public static class Prefabs { public static GameObject QualityPickupDisplay; public static GameObject DeathMarkQualityEffect; public static GameObject VoidDeathOrbEffect; public static GameObject DuplicatedInteractableEffect; public static GameObject MultiShopCardTooltipContext; public static GameObject BugBlockProcEffect; public static GameObject BugOrbEffect; public static GameObject HitlistMarkersUI; public static GameObject ParryProjectileDisplayUI; } public static class NetworkedPrefabs { public static GameObject BossArenaHealNovaSpawner; public static GameObject ChainLightningArcAttachment; public static GameObject ExtraLifeReviveAttachment; public static GameObject MiniBossBodyAttachment; public static GameObject MeatHookDelayedForce; public static GameObject SlowOnHitRootArea; public static GameObject HealPackDelayed; public static GameObject HealOrbPrimary; public static GameObject HealOrbSecondary; public static GameObject HealOrbUtility; public static GameObject HealOrbSpecial; public static GameObject DuplicatorQualityAttachment; public static GameObject DroneShootableAttachment; public static GameObject CleanseQualityAttachment; public static GameObject QualityCritOnUseAttachment; public static GameObject BugPickup; public static GameObject BugSwarmController; public static GameObject HealAndReviveSproutAttachment; public static GameObject QuestVolatileBatteryPickup; public static GameObject SprintArmorDashAttachment; public static GameObject GatewayQualityAttachment; public static GameObject RecyclableObjectAttachment; } public static class ProjectilePrefabs { public static GameObject IncreasePrimaryDamageQualityDotZone; } public static class Materials { public static Material HealCritBoost; } public static class SpawnCards { [TargetAssetName("iscQualityEquipmentBarrel")] public static InteractableSpawnCard QualityEquipmentBarrel; [TargetAssetName("iscQualityChest2")] public static InteractableSpawnCard QualityChest2; [TargetAssetName("iscQualityChest1")] public static InteractableSpawnCard QualityChest1; [TargetAssetName("iscQualityDuplicator")] public static InteractableSpawnCard QualityDuplicator; [TargetAssetName("iscQualityDuplicatorLarge")] public static InteractableSpawnCard QualityDuplicatorLarge; [TargetAssetName("iscQualityDuplicatorMilitary")] public static InteractableSpawnCard QualityDuplicatorMilitary; [TargetAssetName("iscQualityDuplicatorWild")] public static InteractableSpawnCard QualityDuplicatorWild; [TargetAssetName("iscChest2Stealthed")] public static InteractableSpawnCard Chest2Stealthed; } public static class Sprites { [TargetAssetName("icon")] public static Sprite ModIcon; } public static class TMP_SpriteAssets { internal static ReadOnlyCollection AllSpriteAssets = Empty.ReadOnlyCollection; } public static class NetworkSoundEvents { public static NetworkSoundEventDef DuplicateInteractable; } private readonly ExtendedContentPack _contentPack = new ExtendedContentPack(); private QualityContagiousItemHelper _qualityContagiousItemHelper; private ProjectileExplosionEffectScaleFixHelper _projectileExplosionEffectScaleFixHelper; public string identifier => "com.Gorakh.ItemQualities"; internal ItemQualitiesContent() { } internal void Register() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(collectContentPackProviders); } private void collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)this); } public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { PartitionedProgress> partitionedProgress = new PartitionedProgress>(args.progressReceiver); ProgressPartition progressPartition = partitionedProgress.AddPartition(); ProgressPartition finalizeContentProgress = partitionedProgress.AddPartition(); ParallelProgressCoroutine val = new ParallelProgressCoroutine((IProgress)progressPartition); val.AddProgressCoroutine(loadAssetBundleContentAsync>); val.AddProgressCoroutine(ContentInitializerAttribute.RunContentInitializers>, _contentPack); yield return val; Stopwatch.StartNew(); ParallelProgressCoroutine val2 = new ParallelProgressCoroutine((IProgress)finalizeContentProgress); val2.AddProgressCoroutine(runContentLoadCallbacks>); yield return val2; populateTypeFields(typeof(QualityTiers), _contentPack.qualityTierDefs, (string fieldName) => "qd" + fieldName); QualityTiers.AllQualityTiers = new ReadOnlyCollection(((IEnumerable)_contentPack.qualityTierDefs).ToArray()); populateTypeFields(typeof(ItemQualityGroups), _contentPack.itemQualityGroups, (string fieldName) => "ig" + fieldName); ItemQualityGroups.AllGroups = new ReadOnlyCollection(((IEnumerable)_contentPack.itemQualityGroups).ToArray()); populateTypeFields(typeof(Items), _contentPack.itemDefs); populateTypeFields(typeof(EquipmentQualityGroups), _contentPack.equipmentQualityGroups, (string fieldName) => "eg" + fieldName); EquipmentQualityGroups.AllGroups = new ReadOnlyCollection(((IEnumerable)_contentPack.equipmentQualityGroups).ToArray()); populateTypeFields(typeof(BuffQualityGroups), _contentPack.buffQualityGroups, (string fieldName) => "bg" + fieldName); BuffQualityGroups.AllGroups = new ReadOnlyCollection(((IEnumerable)_contentPack.buffQualityGroups).ToArray()); populateTypeFields(typeof(Buffs), _contentPack.buffDefs, (string fieldName) => "bd" + fieldName); populateTypeFields(typeof(Prefabs), _contentPack.prefabs); populateTypeFields(typeof(NetworkedPrefabs), _contentPack.networkedObjectPrefabs); populateTypeFields(typeof(ProjectilePrefabs), _contentPack.projectilePrefabs); populateTypeFields(typeof(Materials), _contentPack.materials, (string fieldName) => "mat" + fieldName); populateTypeFields(typeof(SpawnCards), _contentPack.spawnCards); populateTypeFields(typeof(Sprites), _contentPack.sprites); populateTypeFields(typeof(TMP_SpriteAssets), _contentPack.spriteAssets, (string fieldName) => "tmpspr" + fieldName); TMP_SpriteAssets.AllSpriteAssets = new ReadOnlyCollection(((IEnumerable)_contentPack.spriteAssets).ToArray()); populateTypeFields(typeof(NetworkSoundEvents), _contentPack.networkSoundEventDefs, (string fieldName) => "nse" + fieldName); } private IEnumerator loadAssetBundleContentAsync(TProgress progressReceiver) where TProgress : IProgress { Stopwatch stopwatch = Stopwatch.StartNew(); string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)ItemQualitiesPlugin.Instance).Info.Location), "itemqualitiesassets"); if (!File.Exists(text)) { throw new FileNotFoundException("Could not find ItemQualities assetbundle file"); } PartitionedProgress partitionedProgress = new PartitionedProgress(progressReceiver); ProgressPartition progressReceiver2 = partitionedProgress.AddPartition(0.5f); ProgressPartition loadAssetsProgress = partitionedProgress.AddPartition(); ProgressPartition generateAssetsProgress = partitionedProgress.AddPartition(); AssetBundleCreateRequest assetBundleLoad = AssetBundle.LoadFromFileAsync(text); yield return ((AsyncOperation)(object)assetBundleLoad).AsProgressCoroutine(progressReceiver2); stopwatch.Restart(); AssetBundle assetBundle = assetBundleLoad.assetBundle; yield return ShaderSwapper.UpgradeStubbedShadersAsync(assetBundle); AssetBundleRequest allAssetsLoad = assetBundle.LoadAllAssetsAsync(); yield return ((AsyncOperation)(object)allAssetsLoad).AsProgressCoroutine(loadAssetsProgress); Object[] assetBundleAssets = allAssetsLoad.allAssets; new List(); ParallelProgressCoroutine val = new ParallelProgressCoroutine((IProgress)generateAssetsProgress); Object[] array = assetBundleAssets; foreach (Object obj in array) { if (obj is IAsyncAssetGenerator asyncAssetGenerator) { val.AddProgressCoroutine(asyncAssetGenerator.GenerateAssetsAsync>, _contentPack); } GameObject val2 = (GameObject)(object)((obj is GameObject) ? obj : null); if (val2 != null) { IAsyncAssetGenerator[] componentsInChildren = val2.GetComponentsInChildren(true); foreach (IAsyncAssetGenerator asyncAssetGenerator2 in componentsInChildren) { val.AddProgressCoroutine(asyncAssetGenerator2.GenerateAssetsAsync>, _contentPack); } } } yield return val; List list = new List(); List list2 = new List(); List list3 = new List(); List list4 = new List(); List list5 = new List(); List list6 = new List(); List list7 = new List(); List list8 = new List(); List list9 = new List(); List list10 = new List(); List list11 = new List(); List list12 = new List(); List list13 = new List(); List list14 = new List(); List list15 = new List(); List list16 = new List(); List list17 = new List(); List list18 = new List(); List list19 = new List(); List list20 = new List(); List list21 = new List(); array = assetBundleAssets; foreach (Object val3 in array) { GameObject val4 = (GameObject)(object)((val3 is GameObject) ? val3 : null); if (val4 == null) { if (!(val3 is QualityTierDef item)) { if (!(val3 is ItemQualityGroup item2)) { if (!(val3 is EquipmentQualityGroup item3)) { if (!(val3 is BuffQualityGroup item4)) { ItemDef val5 = (ItemDef)(object)((val3 is ItemDef) ? val3 : null); if (val5 == null) { ItemTierDef val6 = (ItemTierDef)(object)((val3 is ItemTierDef) ? val3 : null); if (val6 == null) { EquipmentDef val7 = (EquipmentDef)(object)((val3 is EquipmentDef) ? val3 : null); if (val7 == null) { BuffDef val8 = (BuffDef)(object)((val3 is BuffDef) ? val3 : null); if (val8 == null) { EntityStateConfiguration val9 = (EntityStateConfiguration)(object)((val3 is EntityStateConfiguration) ? val3 : null); if (val9 == null) { TMP_SpriteAsset val10 = (TMP_SpriteAsset)(object)((val3 is TMP_SpriteAsset) ? val3 : null); if (val10 == null) { Material val11 = (Material)(object)((val3 is Material) ? val3 : null); if (val11 == null) { SpawnCard val12 = (SpawnCard)(object)((val3 is SpawnCard) ? val3 : null); if (val12 == null) { Texture val13 = (Texture)(object)((val3 is Texture) ? val3 : null); if (val13 == null) { Sprite val14 = (Sprite)(object)((val3 is Sprite) ? val3 : null); if (val14 == null) { NetworkSoundEventDef val15 = (NetworkSoundEventDef)(object)((val3 is NetworkSoundEventDef) ? val3 : null); if (val15 != null) { list21.Add(val15); } } else { list20.Add(val14); } } else { list19.Add(val13); } } else { list18.Add(val12); } } else { list17.Add(val11); } } else { list16.Add(val10); } } else { list15.Add(val9); } } else { list14.Add(val8); } } else { list13.Add(val7); } } else { list12.Add(val6); } } else { list11.Add(val5); } } else { list10.Add(item4); } } else { list9.Add(item3); } } else { list8.Add(item2); } } else { list7.Add(item); } } else { if (Object.op_Implicit((Object)(object)val4.GetComponent())) { list3.Add(val4); } if (Object.op_Implicit((Object)(object)val4.GetComponent())) { list4.Add(val4); } if (Object.op_Implicit((Object)(object)val4.GetComponent())) { list5.Add(val4); } if (Object.op_Implicit((Object)(object)val4.GetComponent())) { list6.Add(new EffectDef(val4)); } if (Object.op_Implicit((Object)(object)val4.GetComponent())) { list.Add(val4); } else { list2.Add(val4); } } } _contentPack.prefabs.Add(list2.ToArray()); _contentPack.qualityTierDefs.Add(list7.ToArray()); _contentPack.itemQualityGroups.Add(list8.ToArray()); _contentPack.equipmentQualityGroups.Add(list9.ToArray()); _contentPack.buffQualityGroups.Add(list10.ToArray()); _contentPack.itemDefs.Add(list11.ToArray()); _contentPack.itemTierDefs.Add(list12.ToArray()); _contentPack.buffDefs.Add(list14.ToArray()); _contentPack.equipmentDefs.Add(list13.ToArray()); _contentPack.projectilePrefabs.Add(list3.ToArray()); _contentPack.masterPrefabs.Add(list5.ToArray()); _contentPack.bodyPrefabs.Add(list4.ToArray()); _contentPack.effectDefs.Add(list6.ToArray()); _contentPack.networkedObjectPrefabs.Add(list.ToArray()); _contentPack.entityStateConfigurations.Add(list15.ToArray()); _contentPack.entityStateTypes.Add((from esc in list15 select (Type)esc.targetType into t where t != null select t).ToArray()); _contentPack.spriteAssets.Add(list16.ToArray()); _contentPack.materials.Add(list17.ToArray()); _contentPack.spawnCards.Add(list18.ToArray()); _contentPack.textures.Add(list19.ToArray()); _contentPack.sprites.Add(list20.ToArray()); _contentPack.networkSoundEventDefs.Add(list21.ToArray()); } private IEnumerator runContentLoadCallbacks(TProgress progressReceiver) where TProgress : IProgress { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown ParallelProgressCoroutine val = new ParallelProgressCoroutine((IProgress)progressReceiver); foreach (Object allAsset in _contentPack.allAssets) { GameObject val2 = (GameObject)(object)((allAsset is GameObject) ? allAsset : null); if (val2 != null) { IAsyncContentLoadCallback[] componentsInChildren = val2.GetComponentsInChildren(true); foreach (IAsyncContentLoadCallback asyncContentLoadCallback in componentsInChildren) { val.AddProgressCoroutine(asyncContentLoadCallback.OnContentLoad>); } IContentLoadCallback[] componentsInChildren2 = val2.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren2.Length; i++) { componentsInChildren2[i].OnContentLoad(); } } else { if (allAsset is IAsyncContentLoadCallback asyncContentLoadCallback2) { val.AddProgressCoroutine(asyncContentLoadCallback2.OnContentLoad>); } if (allAsset is IContentLoadCallback contentLoadCallback) { contentLoadCallback.OnContentLoad(); } } } return (IEnumerator)val; } public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { ContentPack.Copy((ContentPack)_contentPack, args.output); if (_qualityContagiousItemHelper == null) { _qualityContagiousItemHelper = new QualityContagiousItemHelper(); } yield return _qualityContagiousItemHelper.Step(_contentPack, args, args.progressReceiver); if (_projectileExplosionEffectScaleFixHelper == null) { _projectileExplosionEffectScaleFixHelper = new ProjectileExplosionEffectScaleFixHelper(); } _projectileExplosionEffectScaleFixHelper.Step(_contentPack, args); EffectScalingFixer.AddToContentPack(args.output); } public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { ContentManager.collectContentPackProviders -= new CollectContentPackProvidersDelegate(collectContentPackProviders); _qualityContagiousItemHelper?.Dispose(); _qualityContagiousItemHelper = null; _projectileExplosionEffectScaleFixHelper = null; EffectScalingFixer.OnContentFinalized(); args.ReportProgress(1f); yield break; } private static void populateTypeFields(Type typeToPopulate, NamedAssetCollection assets, Func fieldNameToAssetNameConverter = null) { FieldInfo[] fields = typeToPopulate.GetFields(BindingFlags.Static | BindingFlags.Public); foreach (FieldInfo fieldInfo in fields) { if (typeof(TAsset).IsAssignableFrom(fieldInfo.FieldType)) { TargetAssetNameAttribute customAttribute = ((MemberInfo)fieldInfo).GetCustomAttribute(); string text = ((customAttribute != null) ? customAttribute.targetAssetName : ((fieldNameToAssetNameConverter == null) ? fieldInfo.Name : fieldNameToAssetNameConverter(fieldInfo.Name))); TAsset val = assets.Find(text); if (val != null) { fieldInfo.SetValue(null, val); continue; } Log.Warning("Failed to assign " + fieldInfo.DeclaringType.Name + "." + fieldInfo.Name + ": Asset \"" + text + "\" not found", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ItemQualitiesContent.cs", "populateTypeFields", 412); } } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.Gorakh.ItemQualities", "ItemQualities", "0.7.6")] public sealed class ItemQualitiesPlugin : BaseUnityPlugin { public const string PluginName = "ItemQualities"; public const string PluginAuthor = "Gorakh"; public const string PluginGUID = "com.Gorakh.ItemQualities"; public const string PluginVersion = "0.7.6"; private static ItemQualitiesPlugin _instance; public static ItemQualitiesPlugin Instance => _instance; private void Awake() { Stopwatch stopwatch = Stopwatch.StartNew(); SingletonHelper.Assign(ref _instance, this); Log.Init(((BaseUnityPlugin)this).Logger); Configs.Init(((BaseUnityPlugin)this).Config); if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { Configs.InitRiskOfOptions(); } new ItemQualitiesContent().Register(); CustomCostTypeIndex.Register(); LanguageFolderHandler.Register(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location)); stopwatch.Stop(); Log.Message_NoCallerPrefix($"Initialized in {stopwatch.Elapsed.TotalMilliseconds:F0}ms"); } private void OnDestroy() { SingletonHelper.Unassign(ref _instance, this); } } [StructLayout(LayoutKind.Explicit)] public struct ItemQualityCounts : IEquatable { [FieldOffset(0)] private unsafe fixed int _itemCounts[5]; [FieldOffset(0)] public int BaseItemCount; [FieldOffset(4)] public int UncommonCount; [FieldOffset(8)] public int RareCount; [FieldOffset(12)] public int EpicCount; [FieldOffset(16)] public int LegendaryCount; public readonly int TotalCount { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return BaseItemCount + UncommonCount + RareCount + EpicCount + LegendaryCount; } } public readonly int TotalQualityCount { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return UncommonCount + RareCount + EpicCount + LegendaryCount; } } public unsafe ref int this[QualityTier qualityTier] { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return ref _itemCounts[(int)(qualityTier + 1)]; } } public unsafe readonly QualityTier HighestQuality { get { for (QualityTier qualityTier = QualityTier.Legendary; qualityTier >= QualityTier.Uncommon; qualityTier--) { if (_itemCounts[(int)(qualityTier + 1)] > 0) { return qualityTier; } } return QualityTier.None; } } public ItemQualityCounts(int baseItemCount, int uncommonCount, int rareCount, int epicCount, int legendaryCount) { BaseItemCount = Math.Max(0, baseItemCount); UncommonCount = Math.Max(0, uncommonCount); RareCount = Math.Max(0, rareCount); EpicCount = Math.Max(0, epicCount); LegendaryCount = Math.Max(0, legendaryCount); } public override readonly bool Equals(object obj) { if (obj is ItemQualityCounts other) { return Equals(in other); } return false; } readonly bool IEquatable.Equals(ItemQualityCounts other) { return Equals(in other); } public readonly bool Equals(in ItemQualityCounts other) { if (BaseItemCount == other.BaseItemCount && UncommonCount == other.UncommonCount && RareCount == other.RareCount && EpicCount == other.EpicCount) { return LegendaryCount == other.LegendaryCount; } return false; } public override readonly int GetHashCode() { return HashCode.Combine(BaseItemCount, UncommonCount, RareCount, EpicCount, LegendaryCount); } public override readonly string ToString() { return $"Normal={BaseItemCount}, Uncommon={UncommonCount}, Rare={RareCount}, Epic={EpicCount}, Legendary={LegendaryCount}"; } public static bool operator ==(in ItemQualityCounts left, in ItemQualityCounts right) { return left.Equals(in right); } public static bool operator !=(in ItemQualityCounts left, in ItemQualityCounts right) { return !left.Equals(in right); } public static ItemQualityCounts operator +(in ItemQualityCounts left, in ItemQualityCounts right) { return new ItemQualityCounts(left.BaseItemCount + right.BaseItemCount, left.UncommonCount + right.UncommonCount, left.RareCount + right.RareCount, left.EpicCount + right.EpicCount, left.LegendaryCount + right.LegendaryCount); } public static ItemQualityCounts operator -(in ItemQualityCounts left, in ItemQualityCounts right) { return new ItemQualityCounts(left.BaseItemCount - right.BaseItemCount, left.UncommonCount - right.UncommonCount, left.RareCount - right.RareCount, left.EpicCount - right.EpicCount, left.LegendaryCount - right.LegendaryCount); } public static explicit operator TempItemQualityCounts(in ItemQualityCounts itemCounts) { return new TempItemQualityCounts(itemCounts.BaseItemCount, itemCounts.UncommonCount, itemCounts.RareCount, itemCounts.EpicCount, itemCounts.LegendaryCount); } } [StructLayout(LayoutKind.Explicit)] public struct TempItemQualityCounts : IEquatable { [FieldOffset(0)] private unsafe fixed float _itemCounts[5]; [FieldOffset(0)] public float BaseItemCount; [FieldOffset(4)] public float UncommonCount; [FieldOffset(8)] public float RareCount; [FieldOffset(12)] public float EpicCount; [FieldOffset(16)] public float LegendaryCount; public readonly float TotalCount { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return BaseItemCount + UncommonCount + RareCount + EpicCount + LegendaryCount; } } public readonly float TotalQualityCount { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return UncommonCount + RareCount + EpicCount + LegendaryCount; } } public unsafe ref float this[QualityTier qualityTier] { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return ref _itemCounts[(int)(qualityTier + 1)]; } } public unsafe readonly QualityTier HighestQuality { get { for (QualityTier qualityTier = QualityTier.Legendary; qualityTier >= QualityTier.Uncommon; qualityTier--) { if (_itemCounts[(int)(qualityTier + 1)] > 0f) { return qualityTier; } } return QualityTier.None; } } public TempItemQualityCounts(float baseItemCount, float uncommonCount, float rareCount, float epicCount, float legendaryCount) { BaseItemCount = Math.Max(0f, baseItemCount); UncommonCount = Math.Max(0f, uncommonCount); RareCount = Math.Max(0f, rareCount); EpicCount = Math.Max(0f, epicCount); LegendaryCount = Math.Max(0f, legendaryCount); } public override readonly bool Equals(object obj) { if (obj is TempItemQualityCounts other) { return Equals(in other); } return false; } readonly bool IEquatable.Equals(TempItemQualityCounts other) { return Equals(in other); } public readonly bool Equals(in TempItemQualityCounts other) { if (BaseItemCount == other.BaseItemCount && UncommonCount == other.UncommonCount && RareCount == other.RareCount && EpicCount == other.EpicCount) { return LegendaryCount == other.LegendaryCount; } return false; } public override readonly int GetHashCode() { return HashCode.Combine(BaseItemCount, UncommonCount, RareCount, EpicCount, LegendaryCount); } public override readonly string ToString() { return $"Normal={BaseItemCount}, Uncommon={UncommonCount}, Rare={RareCount}, Epic={EpicCount}, Legendary={LegendaryCount}"; } public static bool operator ==(in TempItemQualityCounts left, in TempItemQualityCounts right) { return left.Equals(in right); } public static bool operator !=(in TempItemQualityCounts left, in TempItemQualityCounts right) { return !left.Equals(in right); } public static TempItemQualityCounts operator +(in TempItemQualityCounts left, in TempItemQualityCounts right) { return new TempItemQualityCounts(left.BaseItemCount + right.BaseItemCount, left.UncommonCount + right.UncommonCount, left.RareCount + right.RareCount, left.EpicCount + right.EpicCount, left.LegendaryCount + right.LegendaryCount); } public static TempItemQualityCounts operator -(in TempItemQualityCounts left, in TempItemQualityCounts right) { return new TempItemQualityCounts(left.BaseItemCount - right.BaseItemCount, left.UncommonCount - right.UncommonCount, left.RareCount - right.RareCount, left.EpicCount - right.EpicCount, left.LegendaryCount - right.LegendaryCount); } public static explicit operator ItemQualityCounts(in TempItemQualityCounts tempCounts) { return new ItemQualityCounts((int)tempCounts.BaseItemCount, (int)tempCounts.UncommonCount, (int)tempCounts.RareCount, (int)tempCounts.EpicCount, (int)tempCounts.LegendaryCount); } } [CreateAssetMenu(menuName = "ItemQualities/Items/ItemQualityGroup")] public sealed class ItemQualityGroup : ScriptableObject, IAsyncContentLoadCallback { [NonSerialized] [HideInInspector] public ItemQualityGroupIndex GroupIndex = ItemQualityGroupIndex.Invalid; [FormerlySerializedAs("BaseItem")] [SerializeField] internal AssetReferenceT BaseItemReference = new AssetReferenceT(string.Empty); [SerializeField] internal ItemDef BaseItem; [FormerlySerializedAs("UncommonVariant")] [SerializeField] private ItemDef _uncommonItem; [FormerlySerializedAs("RareVariant")] [SerializeField] private ItemDef _rareItem; [FormerlySerializedAs("EpicVariant")] [SerializeField] private ItemDef _epicItem; [FormerlySerializedAs("LegendaryVariant")] [SerializeField] private ItemDef _legendaryItem; [NonSerialized] [HideInInspector] public ItemIndex BaseItemIndex = (ItemIndex)(-1); public ItemIndex UncommonItemIndex { get { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_uncommonItem)) { return (ItemIndex)(-1); } return _uncommonItem.itemIndex; } } public ItemIndex RareItemIndex { get { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_rareItem)) { return (ItemIndex)(-1); } return _rareItem.itemIndex; } } public ItemIndex EpicItemIndex { get { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_epicItem)) { return (ItemIndex)(-1); } return _epicItem.itemIndex; } } public ItemIndex LegendaryItemIndex { get { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_legendaryItem)) { return (ItemIndex)(-1); } return _legendaryItem.itemIndex; } } private bool checkCanModify() { if (((ResourceAvailability)(ref QualityCatalog.Availability)).available) { Log.Error("Cannot modify ItemQualityGroup items after QualityCatalog is initialized", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ItemQualityGroup.cs", "checkCanModify", 69); return false; } return true; } public ItemDef GetItemDef(QualityTier qualityTier) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) switch (qualityTier) { case QualityTier.None: if (!Object.op_Implicit((Object)(object)BaseItem)) { return ItemCatalog.GetItemDef(BaseItemIndex); } return BaseItem; case QualityTier.Uncommon: return _uncommonItem; case QualityTier.Rare: return _rareItem; case QualityTier.Epic: return _epicItem; case QualityTier.Legendary: return _legendaryItem; default: throw new NotImplementedException($"Quality tier '{qualityTier}' is not implemented"); } } public void SetItemDef(ItemDef itemDef, QualityTier qualityTier) { if (checkCanModify()) { switch (qualityTier) { case QualityTier.None: Log.Warning("Cannot change base item (group: '" + ((Object)this).name + "')", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ItemQualityGroup.cs", "SetItemDef", 103); break; case QualityTier.Uncommon: _uncommonItem = itemDef; break; case QualityTier.Rare: _rareItem = itemDef; break; case QualityTier.Epic: _epicItem = itemDef; break; case QualityTier.Legendary: _legendaryItem = itemDef; break; default: throw new NotImplementedException($"Quality tier '{qualityTier}' is not implemented"); } } } public ItemIndex GetItemIndex(QualityTier qualityTier) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) return (ItemIndex)(qualityTier switch { QualityTier.None => BaseItemIndex, QualityTier.Uncommon => UncommonItemIndex, QualityTier.Rare => RareItemIndex, QualityTier.Epic => EpicItemIndex, QualityTier.Legendary => LegendaryItemIndex, _ => throw new NotImplementedException($"Quality tier '{qualityTier}' is not implemented"), }); } [MethodImpl(MethodImplOptions.AggressiveInlining)] [Obsolete("Use InventoryExtensions.GetItemCountsEffective() instead")] public ItemQualityCounts GetItemCountsEffective(Inventory inventory) { if (!Object.op_Implicit((Object)(object)inventory)) { return default(ItemQualityCounts); } return inventory.GetItemCountsEffective(this); } [MethodImpl(MethodImplOptions.AggressiveInlining)] [Obsolete("Use InventoryExtensions.GetItemCountsPermanent() instead")] public ItemQualityCounts GetItemCountsPermanent(Inventory inventory) { if (!Object.op_Implicit((Object)(object)inventory)) { return default(ItemQualityCounts); } return inventory.GetItemCountsPermanent(this); } [MethodImpl(MethodImplOptions.AggressiveInlining)] [Obsolete("Use InventoryExtensions.GetItemCountsTemp() instead")] public ItemQualityCounts GetItemCountsTemp(Inventory inventory) { if (!Object.op_Implicit((Object)(object)inventory)) { return default(ItemQualityCounts); } return inventory.GetItemCountsTemp(this); } [MethodImpl(MethodImplOptions.AggressiveInlining)] [Obsolete("Use InventoryExtensions.GetItemCountsChanneled() instead")] public ItemQualityCounts GetItemCountsChanneled(Inventory inventory) { if (!Object.op_Implicit((Object)(object)inventory)) { return default(ItemQualityCounts); } return inventory.GetItemCountsChanneled(this); } [MethodImpl(MethodImplOptions.AggressiveInlining)] [Obsolete("Use ItemQualityUtils.GetTeamItemCounts() instead")] public ItemQualityCounts GetTeamItemCounts(TeamIndex teamIndex, bool requireAlive, bool requireConnected = true) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return ItemQualityUtils.GetTeamItemCounts(this, teamIndex, requireAlive, requireConnected); } IEnumerator IAsyncContentLoadCallback.OnContentLoad(TProgress progressReceiver) { if (Object.op_Implicit((Object)(object)BaseItem)) { populateItems(BaseItem); } else if (BaseItemReference != null && ((AssetReference)BaseItemReference).RuntimeKeyIsValid()) { AsyncOperationHandle baseItemLoad = AssetAsyncReferenceManager.LoadAsset(BaseItemReference, (AsyncReferenceHandleUnloadType)2); yield return baseItemLoad.AsProgressCoroutine(progressReceiver); if (baseItemLoad.IsValid() && (int)baseItemLoad.Status == 1) { ItemDef result = baseItemLoad.Result; populateItems(result); } else { Log.Error(string.Format("Failed to load base item for quality group '{0}': {1}", ((Object)this).name, baseItemLoad.IsValid() ? ((object)baseItemLoad.OperationException) : ((object)"Invalid handle")), "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ItemQualityGroup.cs", "OnContentLoad", 194); } AssetAsyncReferenceManager.UnloadAsset(BaseItemReference); } progressReceiver.Report(1f); void populateItems(ItemDef baseItem) { populateItemAsset(_uncommonItem, QualityTier.Uncommon); populateItemAsset(_rareItem, QualityTier.Rare); populateItemAsset(_epicItem, QualityTier.Epic); populateItemAsset(_legendaryItem, QualityTier.Legendary); void populateItemAsset(ItemDef item, QualityTier qualityTier) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)item)) { Log.Warning($"Missing variant '{qualityTier}' in item group '{((Object)this).name}'", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ItemQualityGroup.cs", "OnContentLoad", 208); } else { item.deprecatedTier = baseItem.deprecatedTier; item._itemTierDef = baseItem._itemTierDef; if (string.IsNullOrEmpty(item.nameToken)) { item.nameToken = "ITEM_" + ((Object)baseItem).name.ToUpper() + "_" + qualityTier.ToString().ToUpper() + "_NAME"; } if (string.IsNullOrEmpty(item.pickupToken)) { item.pickupToken = baseItem.pickupToken; } if (string.IsNullOrEmpty(item.descriptionToken)) { item.descriptionToken = baseItem.descriptionToken; } if (string.IsNullOrEmpty(item.loreToken)) { item.loreToken = baseItem.loreToken; } if (!Object.op_Implicit((Object)(object)item.unlockableDef)) { item.unlockableDef = baseItem.unlockableDef; } if (!Object.op_Implicit((Object)(object)item.pickupModelPrefab)) { item.pickupModelPrefab = baseItem.pickupModelPrefab; } if (item.pickupModelReference == null || !((AssetReference)item.pickupModelReference).RuntimeKeyIsValid()) { item.pickupModelReference = baseItem.pickupModelReference; } if (!Object.op_Implicit((Object)(object)item.pickupIconSprite)) { item.pickupIconSprite = baseItem.pickupIconSprite; } item.isConsumed = baseItem.isConsumed; item.hidden = baseItem.hidden; item.canRemove = baseItem.canRemove; HashSet hashSet = default(HashSet); DisposableRental> val = CollectionPool>.RentCollection(ref hashSet); try { hashSet.UnionWith(item.tags); hashSet.UnionWith(baseItem.tags); hashSet.Add((ItemTag)9); item.tags = hashSet.ToArray(); } finally { val.Dispose(); } item.requiredExpansion = baseItem.requiredExpansion; } } } } internal IEnumerator GenerateRuntimeAssetsAsync(ExtendedContentPack contentPack, TProgress progressReceiver = default(TProgress)) where TProgress : IProgress { if (Object.op_Implicit((Object)(object)BaseItem)) { generateRuntimeAssets(BaseItem); } else if (BaseItemReference != null && ((AssetReference)BaseItemReference).RuntimeKeyIsValid()) { AsyncOperationHandle baseItemLoad = AssetAsyncReferenceManager.LoadAsset(BaseItemReference, (AsyncReferenceHandleUnloadType)2); IEnumerator enumerator2; if (progressReceiver == null) { IEnumerator enumerator = (IEnumerator)(object)baseItemLoad; enumerator2 = enumerator; } else { enumerator2 = baseItemLoad.AsProgressCoroutine(progressReceiver); } yield return enumerator2; if (baseItemLoad.IsValid() && (int)baseItemLoad.Status == 1) { generateRuntimeAssets(baseItemLoad.Result); } else { Log.Error(string.Format("Failed to load base item for quality group '{0}': {1}", ((Object)this).name, baseItemLoad.IsValid() ? ((object)baseItemLoad.OperationException) : ((object)"Invalid handle")), "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ItemQualityGroup.cs", "GenerateRuntimeAssetsAsync", 283); } AssetAsyncReferenceManager.UnloadAsset(BaseItemReference); } ref TProgress reference = ref progressReceiver; TProgress val = default(TProgress); if (val == null) { val = reference; reference = ref val; if (val == null) { yield break; } } reference.Report(1f); void generateRuntimeAssets(ItemDef baseItem) { string baseItemName = ((Object)baseItem).name; Texture pickupIconTexture = baseItem.pickupIconTexture; Texture2D baseIconTexture = (Texture2D)(object)((pickupIconTexture is Texture2D) ? pickupIconTexture : null); if (!Object.op_Implicit((Object)(object)_uncommonItem)) { _uncommonItem = createItem(QualityTier.Uncommon); } if (!Object.op_Implicit((Object)(object)_rareItem)) { _rareItem = createItem(QualityTier.Rare); } if (!Object.op_Implicit((Object)(object)_epicItem)) { _epicItem = createItem(QualityTier.Epic); } if (!Object.op_Implicit((Object)(object)_legendaryItem)) { _legendaryItem = createItem(QualityTier.Legendary); } ItemDef createItem(QualityTier qualityTier) { //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_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) QualityTierDef qualityTierDef = ((IEnumerable)contentPack.qualityTierDefs).FirstOrDefault((QualityTierDef qd) => qd.qualityTier == qualityTier); if (!Object.op_Implicit((Object)(object)qualityTierDef)) { Log.Error($"Failed to find quality tier def {qualityTier}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ItemQualityGroup.cs", "GenerateRuntimeAssetsAsync", 301); } ItemDef val2 = ScriptableObject.CreateInstance(); ((Object)val2).name = baseItemName + qualityTier; val2.descriptionToken = "ITEM_" + baseItemName.ToUpper() + "_" + qualityTier.ToString().ToUpper() + "_DESC"; val2.pickupToken = "ITEM_" + baseItemName.ToUpper() + "_" + qualityTier.ToString().ToUpper() + "_PICKUP"; val2.isConsumed = baseItem.isConsumed; val2.hidden = baseItem.hidden; val2.canRemove = baseItem.canRemove; HashSet hashSet = default(HashSet); DisposableRental> val3 = CollectionPool>.RentCollection(ref hashSet); try { hashSet.UnionWith(baseItem.tags); hashSet.Add((ItemTag)9); val2.tags = hashSet.ToArray(); } finally { val3.Dispose(); } if (Object.op_Implicit((Object)(object)baseIconTexture) && Object.op_Implicit((Object)(object)qualityTierDef)) { Texture2D val4 = QualityCatalog.CreateQualityIconTexture(baseIconTexture, qualityTierDef, baseItem.isConsumed); ((Object)val4).name = "tex" + ((Object)val2).name; Sprite val5 = Sprite.Create(val4, new Rect(0f, 0f, (float)((Texture)val4).width, (float)((Texture)val4).height), new Vector2(0.5f, 0.5f), (float)((Texture)val4).width / 5.12f); ((Object)val5).name = "tex" + ((Object)val2).name; val2.pickupIconSprite = val5; } else { val2.pickupIconSprite = baseItem.pickupIconSprite; } val2.deprecatedTier = baseItem.tier; val2._itemTierDef = baseItem._itemTierDef; contentPack.itemDefs.Add(val2); return val2; } } } } public enum ItemQualityGroupIndex { Invalid = -1 } public static class ItemTags { public static ItemTag MissileRelated { get; private set; } = (ItemTag)(-1); [InitDuringStartupPhase(/*Could not decode attribute arguments.*/)] private static void PreInit() { //IL_0005: 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_0022: Expected I4, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected I4, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected I4, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected I4, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected I4, but got Unknown MissileRelated = ItemAPI.AddItemTag("Quality_MissileRelated"); addTags(RoR2_Base_Missile.Missile_asset, (ItemTag[])(object)new ItemTag[1] { (ItemTag)(int)MissileRelated }); addTags(RoR2_Base_Firework.Firework_asset, (ItemTag[])(object)new ItemTag[1] { (ItemTag)(int)MissileRelated }); addTags(RoR2_DLC1_MissileVoid.MissileVoid_asset, (ItemTag[])(object)new ItemTag[1] { (ItemTag)(int)MissileRelated }); addTags(RoR2_DLC1_MoreMissile.MoreMissile_asset, (ItemTag[])(object)new ItemTag[1] { (ItemTag)(int)MissileRelated }); addTags(RoR2_DLC2_Items_BarrageOnBoss.BarrageOnBoss_asset, (ItemTag[])(object)new ItemTag[1] { (ItemTag)(int)MissileRelated }); static void addTags(string itemDefAssetGuid, ItemTag[] tags) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (tags.Length == 0) { Log.Warning("Empty tags array for item guid '" + itemDefAssetGuid + "'", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ItemTags.cs", "PreInit", 21); } ItemDef val = Addressables.LoadAssetAsync((object)itemDefAssetGuid).WaitForCompletion(); for (int i = 0; i < tags.Length; i++) { ItemAPI.ApplyTagToItem(tags[i], val); } } } } internal static class LanguageFolderHandler { public static void Register(string searchFolder, string langFolderName = "lang") { string langFolderPath = Path.Combine(searchFolder, langFolderName); if (Directory.Exists(langFolderPath)) { Language.collectLanguageRootFolders += delegate(List folders) { folders.Add(langFolderPath); }; } else { Log.Error("Lang folder not found: " + langFolderPath, "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\LanguageFolderHandler.cs", "Register", 24); } } } internal sealed class LocalEffectOwnership : MonoBehaviour { private EffectComponent _effectComponent; private EffectManagerHelper _effectManagerHelper; private GameObject _ownerObject; public GameObject OwnerObject { get { return _ownerObject; } set { if (!((Object)(object)_ownerObject == (Object)(object)value)) { _ownerObject = value; this.OnOwnerChanged?.Invoke(_ownerObject); } } } public event Action OnOwnerChanged; private void Awake() { _effectComponent = ((Component)this).GetComponent(); _effectManagerHelper = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)_effectComponent)) { EffectComponent effectComponent = _effectComponent; effectComponent.OnEffectComponentReset = (Action)Delegate.Combine(effectComponent.OnEffectComponentReset, new Action(onReset)); } else if (Object.op_Implicit((Object)(object)_effectManagerHelper)) { EffectManagerHelper effectManagerHelper = _effectManagerHelper; effectManagerHelper.OnEffectActivated = (Action)Delegate.Combine(effectManagerHelper.OnEffectActivated, new Action(onActivated)); } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)_effectComponent)) { EffectComponent effectComponent = _effectComponent; effectComponent.OnEffectComponentReset = (Action)Delegate.Remove(effectComponent.OnEffectComponentReset, new Action(onReset)); } else if (Object.op_Implicit((Object)(object)_effectManagerHelper)) { EffectManagerHelper effectManagerHelper = _effectManagerHelper; effectManagerHelper.OnEffectActivated = (Action)Delegate.Remove(effectManagerHelper.OnEffectActivated, new Action(onActivated)); } } private void onReset(bool hasEffectData) { OwnerObject = ((hasEffectData && _effectComponent.effectData != null) ? _effectComponent.effectData.ResolveNetworkedObjectReference() : null); } private void onActivated() { OwnerObject = null; } } internal static class Log { private static readonly StringBuilder _sharedStringBuilder; private static readonly int _cachedCallerPathPrefixLength; private static readonly object _logLock; private static ManualLogSource _logSource; static Log() { _sharedStringBuilder = new StringBuilder(256); _logLock = new object(); _cachedCallerPathPrefixLength = getCallerPathPrefixLength("D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Log.cs"); static int getCallerPathPrefixLength([CallerFilePath] string callerPath) { int num = callerPath.LastIndexOf("ItemQualities\\Scripts\\"); if (num >= 0) { return num + "ItemQualities\\Scripts\\".Length; } Debug.LogError((object)"[ItemQualities] Logger failed to determine caller path prefix length"); return 0; } } internal static void Init(ManualLogSource logSource) { _logSource = logSource; } private static StringBuilder buildCallerLogString(string callerPath, string callerMemberName, int callerLineNumber, string data) { return _sharedStringBuilder.Clear().Append(callerPath, _cachedCallerPathPrefixLength, callerPath.Length - _cachedCallerPathPrefixLength).Append(":") .Append(callerLineNumber) .Append(" (") .Append(callerMemberName) .Append("): ") .Append(data); } [Conditional("DEBUG")] internal static void Debug(string data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { lock (_logLock) { _logSource.LogDebug((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data)); } } [Conditional("DEBUG")] internal static void Debug_NoCallerPrefix(string data) { lock (_logLock) { _logSource.LogDebug((object)data); } } internal static void Error(string data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { lock (_logLock) { _logSource.LogError((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data)); } } internal static void Error_NoCallerPrefix(string data) { lock (_logLock) { _logSource.LogError((object)data); } } internal static void Fatal(string data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { lock (_logLock) { _logSource.LogFatal((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data)); } } internal static void Fatal_NoCallerPrefix(string data) { lock (_logLock) { _logSource.LogFatal((object)data); } } internal static void Info(string data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { lock (_logLock) { _logSource.LogInfo((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data)); } } internal static void Info_NoCallerPrefix(string data) { lock (_logLock) { _logSource.LogInfo((object)data); } } internal static void Message(string data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { lock (_logLock) { _logSource.LogMessage((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data)); } } internal static void Message_NoCallerPrefix(string data) { lock (_logLock) { _logSource.LogMessage((object)data); } } internal static void Warning(string data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { lock (_logLock) { _logSource.LogWarning((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data)); } } internal static void Warning_NoCallerPrefix(string data) { lock (_logLock) { _logSource.LogWarning((object)data); } } internal static void LogType(LogLevel level, string data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if ((level & 0x20) != 0) { return; } lock (_logLock) { _logSource.Log(level, (object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data)); } } internal static void LogType_NoCallerPrefix(LogLevel level, string data) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if ((level & 0x20) != 0) { return; } lock (_logLock) { _logSource.Log(level, (object)data); } } } internal static class LogbookOrderFix { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown LogBookController.BuildPickupEntries += new hook_BuildPickupEntries(LogBookController_BuildPickupEntries); } private static Entry[] LogBookController_BuildPickupEntries(orig_BuildPickupEntries orig, Dictionary expansionAvailability) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) Entry[] array = orig.Invoke(expansionAvailability); try { Entry[] array2 = (Entry[])(object)new Entry[array.Length]; Array.Copy(array, array2, array.Length); for (int i = 0; i < array2.Length; i++) { if (!(array2[i]?.extraData is PickupIndex val) || QualityCatalog.GetQualityTier(val) != QualityTier.None) { continue; } for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { int num = (int)(i + qualityTier + 1); if (num >= array2.Length) { break; } PickupIndex qualityPickupIndex = QualityCatalog.GetPickupIndexOfQuality(val, qualityTier); if (!(qualityPickupIndex != val)) { continue; } int num2 = Array.FindIndex(array2, (Entry e) => e?.extraData is PickupIndex val3 && val3 == qualityPickupIndex); if (num2 != -1 && num2 != num) { Entry val2 = array2[num2]; if (num2 < num) { Array.Copy(array2, num2 + 1, array2, num2, num - num2); i--; num--; } else { Array.Copy(array2, num, array2, num + 1, num2 - num); } array2[num] = val2; } } } Array.ConstrainedCopy(array2, 0, array, 0, array.Length); } catch (Exception ex) { Log.Error_NoCallerPrefix(ex.ToString()); } return array; } } internal struct MemoizedGetComponentCached where TComponent : Component { private GameObject _cachedGameObject; private TComponent _cachedComponent; public TComponent Get(GameObject gameObject) { if ((Object)(object)_cachedGameObject != (Object)(object)gameObject) { _cachedGameObject = gameObject; _cachedComponent = (Object.op_Implicit((Object)(object)gameObject) ? gameObject.GetComponentCached() : default(TComponent)); } return _cachedComponent; } public bool TryGet(GameObject gameObject, out TComponent result) { result = Get(gameObject); return Object.op_Implicit((Object)(object)result); } } public sealed class ObjectCollisionManager : MonoBehaviour { [SerializeField] private Collider[] _ourColliders = Array.Empty(); private HashSet _ignoringCollisionsWith; public CharacterBody Body { get; private set; } public ProjectileController ProjectileController { get; private set; } public CharacterBody OwnerBody { get; private set; } [SystemInitializer(new Type[] { typeof(ProjectileCatalog), typeof(BodyCatalog) })] private static void Init() { foreach (GameObject allBodyPrefab in BodyCatalog.allBodyPrefabs) { ensureComponent(allBodyPrefab); } for (int i = 0; i < ProjectileCatalog.projectilePrefabCount; i++) { GameObject projectilePrefab = ProjectileCatalog.GetProjectilePrefab(i); if (Object.op_Implicit((Object)(object)projectilePrefab) && Object.op_Implicit((Object)(object)projectilePrefab.GetComponentInChildren(true))) { ensureComponent(projectilePrefab); } } static void ensureComponent(GameObject prefab) { ObjectCollisionManager objectCollisionManager = default(ObjectCollisionManager); if (!prefab.TryGetComponent(ref objectCollisionManager)) { objectCollisionManager = prefab.AddComponent(); objectCollisionManager._ourColliders = prefab.GetComponentsInChildren(true); } } } private void Awake() { Body = ((Component)this).GetComponent(); ProjectileController = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)ProjectileController)) { ProjectileController.onInitialized += onInitialized; } _ignoringCollisionsWith = CollectionPool>.RentCollection(); ComponentCache.Add(((Component)this).gameObject, this); } private void OnDestroy() { _ignoringCollisionsWith = CollectionPool>.ReturnCollection(_ignoringCollisionsWith); if (Object.op_Implicit((Object)(object)ProjectileController)) { ProjectileController.onInitialized -= onInitialized; } ComponentCache.Remove(((Component)this).gameObject, this); } private void OnEnable() { InstanceTracker.Add(this); IgnoredCollisionsProvider.RefreshObjectCollisions(this); } private void OnDisable() { InstanceTracker.Remove(this); SetIgnoredColliders((IReadOnlyCollection)(object)Array.Empty()); } private void onInitialized(ProjectileController projectileController) { OwnerBody = (Object.op_Implicit((Object)(object)projectileController.owner) ? projectileController.owner.GetComponent() : null); IgnoredCollisionsProvider.RefreshObjectCollisions(this); } public void SetIgnoredColliders(IReadOnlyCollection newIgnoredColliders) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) if (_ignoringCollisionsWith == null) { Log.Error("Cannot set ignored colliders on destroyed object", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ObjectCollisionManager.cs", "SetIgnoredColliders", 102); } else { if ((newIgnoredColliders == null || newIgnoredColliders.Count == 0) && _ignoringCollisionsWith.Count == 0) { return; } _ignoringCollisionsWith.RemoveWhere((Collider c) => !Object.op_Implicit((Object)(object)c)); List list = default(List); DisposableRental> val = CollectionPool>.RentCollection(ref list); try { ListUtils.EnsureCapacity(list, _ignoringCollisionsWith.Count); foreach (Collider item in _ignoringCollisionsWith) { list.Add(item); } if (newIgnoredColliders != null) { foreach (Collider newIgnoredCollider in newIgnoredColliders) { if (Object.op_Implicit((Object)(object)newIgnoredCollider)) { if (_ignoringCollisionsWith.Add(newIgnoredCollider)) { setIgnoringCollisionsWith(newIgnoredCollider, ignore: true); } else { list.Remove(newIgnoredCollider); } } } } foreach (Collider item2 in list) { if (_ignoringCollisionsWith.Remove(item2)) { setIgnoringCollisionsWith(item2, ignore: false); } } } finally { val.Dispose(); } } } private void setIgnoringCollisionsWith(Collider otherCollider, bool ignore) { if (!Object.op_Implicit((Object)(object)otherCollider)) { return; } Collider[] ourColliders = _ourColliders; foreach (Collider val in ourColliders) { if (Object.op_Implicit((Object)(object)val)) { Physics.IgnoreCollision(val, otherCollider, ignore); } } } public bool IgnoresCollisionsWith(Collider collider) { if (_ignoringCollisionsWith != null && Object.op_Implicit((Object)(object)collider)) { return _ignoringCollisionsWith.Contains(collider); } return false; } } internal static class ObjectiveEvents { private sealed class MoonBatteryMissionControllerEvents : MonoBehaviour { private MoonBatteryMissionController _missionController; private readonly List _chargedOrder = new List(); private void Awake() { _missionController = ((Component)this).GetComponent(); } private void OnEnable() { HoldoutZoneController[] batteryHoldoutZones = _missionController.batteryHoldoutZones; for (int i = 0; i < batteryHoldoutZones.Length; i++) { ((UnityEvent)(object)batteryHoldoutZones[i].onCharged).AddListener((UnityAction)onPillarCharged); } } private void OnDisable() { HoldoutZoneController[] batteryHoldoutZones = _missionController.batteryHoldoutZones; for (int i = 0; i < batteryHoldoutZones.Length; i++) { ((UnityEvent)(object)batteryHoldoutZones[i].onCharged).RemoveListener((UnityAction)onPillarCharged); } } private void FixedUpdate() { if (_chargedOrder.Count >= _missionController.numRequiredBatteries) { HoldoutZoneController obj = _chargedOrder[_missionController.numRequiredBatteries - 1]; ObjectiveEvents.OnFinalMoonPillarChargedGlobal?.Invoke(obj); Object.Destroy((Object)(object)this); } } private void onPillarCharged(HoldoutZoneController pillarHoldoutZone) { _chargedOrder.Add(pillarHoldoutZone); ObjectiveEvents.OnMoonPillarChargedGlobal?.Invoke(pillarHoldoutZone); } } private sealed class VoidStageMissionControllerEvents : MonoBehaviour { private VoidStageMissionController _missionController; private readonly List _batteryHoldoutZones = new List(); private readonly List _chargedOrder = new List(); private void Awake() { _missionController = ((Component)this).GetComponent(); } private void OnEnable() { foreach (HoldoutZoneController batteryHoldoutZone in _batteryHoldoutZones) { ((UnityEvent)(object)batteryHoldoutZone.onCharged).AddListener((UnityAction)onBatteryZoneCharged); } } private void OnDisable() { foreach (HoldoutZoneController batteryHoldoutZone in _batteryHoldoutZones) { ((UnityEvent)(object)batteryHoldoutZone.onCharged).RemoveListener((UnityAction)onBatteryZoneCharged); } } private void FixedUpdate() { if (_chargedOrder.Count >= _missionController.numBatteriesSpawned) { HoldoutZoneController obj = _chargedOrder[_missionController.numBatteriesSpawned - 1]; ObjectiveEvents.OnFinalVoidStagePillarChargedServer?.Invoke(obj); Object.Destroy((Object)(object)this); } } private void onBatteryZoneCharged(HoldoutZoneController batteryHoldoutZone) { _chargedOrder.Add(batteryHoldoutZone); ObjectiveEvents.OnVoidStagePillarChargedServer?.Invoke(batteryHoldoutZone); } public void OnVoidBatterySpawned(SpawnResult spawnResult) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) HoldoutZoneController val = default(HoldoutZoneController); if (Object.op_Implicit((Object)(object)this) && spawnResult.success && Object.op_Implicit((Object)(object)spawnResult.spawnedInstance) && spawnResult.spawnedInstance.TryGetComponent(ref val)) { _batteryHoldoutZones.Add(val); if (((Behaviour)this).isActiveAndEnabled) { ((UnityEvent)(object)val.onCharged).AddListener((UnityAction)onBatteryZoneCharged); } } } } public static event Action OnMoonPillarChargedGlobal; public static event Action OnFinalMoonPillarChargedGlobal; public static event Action OnVoidStagePillarChargedServer; public static event Action OnFinalVoidStagePillarChargedServer; [SystemInitializer(new Type[] { })] private static void Init() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown MoonBatteryMissionController.onInstanceChangedGlobal += onMoonBatteryMissionControllerInstanceChangedGlobal; VoidStageMissionController.Start += new Manipulator(VoidStageMissionController_Start); } private static void onMoonBatteryMissionControllerInstanceChangedGlobal() { if (Object.op_Implicit((Object)(object)MoonBatteryMissionController.instance)) { UnityObjectExtensions.EnsureComponent(((Component)MoonBatteryMissionController.instance).gameObject); } } private static void VoidStageMissionController_Start(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_00b4: 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_00df: 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) ILCursor val = new ILCursor(il); VariableDefinition voidBatterySpawnRequestVar = null; if (!val.TryGotoNext((MoveType)0, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "get_instance"), (Instruction x) => x.MatchLdloc(il, out voidBatterySpawnRequestVar), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "TrySpawnObject") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ObjectiveEvents.cs", "VoidStageMissionController_Start", 101); return; } VariableDefinition val2 = il.AddVariable(); ILCursor obj = val.Clone().Goto(0, (MoveType)0, false); obj.Emit(OpCodes.Ldarg_0); obj.EmitDelegate>((Func)setupComponent); obj.Emit(OpCodes.Stloc, val2); val.Emit(OpCodes.Ldloc, voidBatterySpawnRequestVar); val.Emit(OpCodes.Ldloc, val2); val.EmitDelegate>((Action)addVoidBatterySpawnedEventListener); static void addVoidBatterySpawnedEventListener(DirectorSpawnRequest voidBatterySpawnRequest, VoidStageMissionControllerEvents eventsController) { if (Object.op_Implicit((Object)(object)eventsController)) { voidBatterySpawnRequest.onSpawnedServer = (Action)Delegate.Combine(voidBatterySpawnRequest.onSpawnedServer, new Action(eventsController.OnVoidBatterySpawned)); } } static VoidStageMissionControllerEvents setupComponent(VoidStageMissionController missionController) { if (!NetworkServer.active) { return null; } return UnityObjectExtensions.EnsureComponent(((Component)missionController).gameObject); } } } public sealed class ObjectPurchaseContext : MonoBehaviour { public sealed class PurchaseResults { public readonly ItemAndStackValues[] ItemStacksTaken; public readonly EquipmentIndex[] EquipmentTaken; public readonly ItemQualityCounts UsedSaleStarCounts; public PurchaseResults(PayCostResults payCostResults) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) ItemStacksTaken = (ReadOnlyList.op_Implicit(payCostResults.itemStacksTaken) ? payCostResults.itemStacksTaken.ToArray() : Array.Empty()); EquipmentTaken = payCostResults.equipmentTaken?.ToArray() ?? Array.Empty(); UsedSaleStarCounts = payCostResults.GetUsedSaleStars(); } } public CostTypeIndex CostTypeIndex { get; private set; } public PurchaseResults FirstInteractionResults { get; private set; } public PurchaseResults Results { get; private set; } [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown CostTypeDef.PayCost += new hook_PayCost(CostTypeDef_PayCost); QualityDuplicatorBehavior.OnPickupsSelectedForPurchase += QualityDuplicatorBehavior_OnPickupsSelectedForPurchase; } private static void CostTypeDef_PayCost(orig_PayCost orig, CostTypeDef self, PayCostContext context, PayCostResults result) { orig.Invoke(self, context, result); PurchaseResults purchaseResults = new PurchaseResults(result); ObjectPurchaseContext objectPurchaseContext = UnityObjectExtensions.EnsureComponent(context.purchasedObject); objectPurchaseContext.CostTypeIndex = (CostTypeIndex)Math.Max(0, Array.IndexOf(CostTypeCatalog.costTypeDefs, context.costTypeDef)); ObjectPurchaseContext objectPurchaseContext2 = objectPurchaseContext; if (objectPurchaseContext2.FirstInteractionResults == null) { PurchaseResults purchaseResults3 = (objectPurchaseContext2.FirstInteractionResults = purchaseResults); } objectPurchaseContext.Results = purchaseResults; } private static void QualityDuplicatorBehavior_OnPickupsSelectedForPurchase(QualityDuplicatorBehavior qualityDuplicatorBehavior, Interactor activator, IReadOnlyList pickupsSpent) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Invalid comparison between Unknown and I4 //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Invalid comparison between Unknown and I4 //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) PayCostResults val = new PayCostResults(); foreach (PickupIndex item in pickupsSpent) { PickupDef pickupDef = PickupCatalog.GetPickupDef(item); if (pickupDef != null) { if ((int)pickupDef.itemIndex != -1) { ItemAndStackValues val2 = new ItemAndStackValues { itemIndex = pickupDef.itemIndex, stackValues = new ItemStackValues { permanentStacks = 1 } }; val.AddTakenItems(ref val2); } else if ((int)pickupDef.equipmentIndex != -1) { val.equipmentTaken.Add(pickupDef.equipmentIndex); } } } PurchaseResults purchaseResults = new PurchaseResults(val); ObjectPurchaseContext objectPurchaseContext = UnityObjectExtensions.EnsureComponent(((Component)qualityDuplicatorBehavior).gameObject); objectPurchaseContext.CostTypeIndex = qualityDuplicatorBehavior.CostTypeIndex; ObjectPurchaseContext objectPurchaseContext2 = objectPurchaseContext; if (objectPurchaseContext2.FirstInteractionResults == null) { PurchaseResults purchaseResults3 = (objectPurchaseContext2.FirstInteractionResults = purchaseResults); } objectPurchaseContext.Results = purchaseResults; } } internal static class PickupNotificationTransformationPatch { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown GenericPickupController.HandlePickupMessage += new Manipulator(GenericPickupController_HandlePickupMessage); } private static void GenericPickupController_HandlePickupMessage(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); VariableDefinition masterObjectVar = null; if (!val.TryGotoNext((MoveType)0, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "masterGameObject"), (Instruction x) => x.MatchStloc(il, out masterObjectVar) })) { Log.Error("Failed to find masterObject variable", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\PickupNotificationTransformationPatch.cs", "GenericPickupController_HandlePickupMessage", 27); } val.Goto(0, (MoveType)0, false); VariableDefinition pickupVar = null; if (!val.TryGotoNext((MoveType)0, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "pickupState"), (Instruction x) => x.MatchStloc(il, out pickupVar) })) { Log.Error("Failed to find pickup variable", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\PickupNotificationTransformationPatch.cs", "GenericPickupController_HandlePickupMessage", 37); } val.Goto(0, (MoveType)0, false); if (!val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "PushPickupNotification") })) { Log.Error("Failed to find PushPickupNotification call", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\PickupNotificationTransformationPatch.cs", "GenericPickupController_HandlePickupMessage", 45); return; } Instruction pushPickupNotificationCallInstruction = val.Next; ILLabel skipPushPickupNotificationLabel = null; if (!val.TryGotoPrev((MoveType)2, new Func[1] { (Instruction x) => matchBranchAny(x, out skipPushPickupNotificationLabel) && il.IndexOf(skipPushPickupNotificationLabel.Target) > il.IndexOf(pushPickupNotificationCallInstruction) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\PickupNotificationTransformationPatch.cs", "GenericPickupController_HandlePickupMessage", 71); return; } val.MoveAfterLabels(); val.Emit(OpCodes.Ldloc, masterObjectVar); val.Emit(OpCodes.Ldloc, pickupVar); val.EmitDelegate>((Func)shouldPushPickupNotification); val.Emit(OpCodes.Brfalse, (object)skipPushPickupNotificationLabel); static bool matchBranchAny(Instruction instruction, out ILLabel label) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 OpCode opCode = instruction.OpCode; FlowControl flowControl = ((OpCode)(ref opCode)).FlowControl; if ((int)flowControl == 0 || (int)flowControl == 3) { object operand = instruction.Operand; label = (ILLabel)((operand is ILLabel) ? operand : null); } else { label = null; } return label != null; } static bool shouldPushPickupNotification(GameObject masterObject, UniquePickup pickup) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Invalid comparison between Unknown and I4 //IL_003f: Unknown result type (might be due to invalid IL or missing references) CharacterMaster val2 = default(CharacterMaster); if (!Object.op_Implicit((Object)(object)masterObject) || !masterObject.TryGetComponent(ref val2)) { return true; } PickupDef pickupDef = PickupCatalog.GetPickupDef(pickup.pickupIndex); if (pickupDef == null) { return true; } CharacterMasterExtraStatsTracker componentCached = masterObject.GetComponentCached(); if ((int)pickupDef.itemIndex != -1 && Object.op_Implicit((Object)(object)componentCached) && componentCached.HasUpgradeForItem(pickupDef.itemIndex)) { return false; } return true; } } } public readonly struct PickupRollInfo { public readonly CharacterMaster Master; public readonly TeamIndex TeamAffiliation; public readonly int Luck; public bool IsPlayerAffiliation { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)TeamAffiliation != 1) { if (Object.op_Implicit((Object)(object)Master)) { return Object.op_Implicit((Object)(object)Master.playerCharacterMasterController); } return false; } return true; } } public PickupRollInfo(CharacterMaster master, TeamIndex teamAffiliation) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) this = default(PickupRollInfo); Master = master; TeamAffiliation = teamAffiliation; bool isPlayerAffiliation = IsPlayerAffiliation; ItemQualityCounts left = default(ItemQualityCounts); if (Object.op_Implicit((Object)(object)master)) { if (Object.op_Implicit((Object)(object)master.inventory)) { left = master.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Clover); } } else { ItemQualityCounts left2 = default(ItemQualityCounts); foreach (EnemyInfoPanelInventoryProvider instances in InstanceTracker.GetInstancesList()) { if (Object.op_Implicit((Object)(object)instances.inventory) && Object.op_Implicit((Object)(object)instances.teamFilter) && instances.teamFilter.teamIndex == teamAffiliation) { ItemQualityCounts right = instances.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Clover); left2 += right; } } bool flag = left2.TotalQualityCount > 0; if (flag) { left += left2; } foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { if (readOnlyInstances.teamIndex != teamAffiliation || !Object.op_Implicit((Object)(object)readOnlyInstances.inventory)) { continue; } if (isPlayerAffiliation) { PlayerCharacterMasterController playerCharacterMasterController = readOnlyInstances.playerCharacterMasterController; if (!Object.op_Implicit((Object)(object)playerCharacterMasterController) || !playerCharacterMasterController.isConnected) { continue; } } else if (!readOnlyInstances.hasBody) { continue; } ItemQualityCounts right2 = readOnlyInstances.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Clover); if (flag) { for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { if (right2[qualityTier] >= left2[qualityTier]) { right2[qualityTier] -= left2[qualityTier]; } } } left += right2; } } int luck = left.UncommonCount + 2 * left.RareCount + 3 * left.EpicCount + 5 * left.LegendaryCount; Luck = luck; } } [RequireComponent(typeof(NetworkedBodyAttachment))] public sealed class PositionIndicatorAttachment : MonoBehaviour, INetworkedBodyAttachmentListener { public PositionIndicator PositionIndicator; void INetworkedBodyAttachmentListener.OnAttachedBodyDiscovered(NetworkedBodyAttachment networkedBodyAttachment, CharacterBody attachedBody) { if (Object.op_Implicit((Object)(object)PositionIndicator)) { PositionIndicator.targetTransform = attachedBody.coreTransform; } } } internal static class PrayerBeadsIgnoreXp { private delegate bool AllowPrayerBeadsXpGainDelegate(ref ulong experience); private sealed class IgnoreXpChunk { public ulong Amount; public readonly FixedTimeStamp ExpirationTime; public IgnoreXpChunk(ulong amount, FixedTimeStamp expirationTime) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) Amount = amount; ExpirationTime = expirationTime; } } private static readonly List _ignoreXpChunks = new List(); private static readonly IComparer _xpChunkExpirationTimeComparer = Comparer.Create((IgnoreXpChunk a, IgnoreXpChunk b) => ((FixedTimeStamp)(ref a.ExpirationTime)).CompareTo(b.ExpirationTime)); [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown TeamManager.GiveTeamExperience += new Manipulator(TeamManager_GiveTeamExperience); } public static void IgnoreXpGain(ulong amount, float duration) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (amount != 0L && !(duration <= 0f) && Object.op_Implicit((Object)(object)Run.instance)) { if (_ignoreXpChunks.Count == 0) { Run.onRunDestroyGlobal += onRunDestroyGlobal; } IgnoreXpChunk item = new IgnoreXpChunk(amount, FixedTimeStamp.now + duration); int num = _ignoreXpChunks.BinarySearch(item, _xpChunkExpirationTimeComparer); if (num < 0) { num = ~num; } _ignoreXpChunks.Insert(num, item); } } private static void onRunDestroyGlobal(Run run) { _ignoreXpChunks.Clear(); Run.onRunDestroyGlobal -= onRunDestroyGlobal; } private static void TeamManager_GiveTeamExperience(ILContext il) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var teamIndexParameter)) { Log.Error("Failed to find TeamIndex parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\PrayerBeadsIgnoreXp.cs", "TeamManager_GiveTeamExperience", 56); return; } if (!((MethodReference)(object)il.Method).TryFindParameter("experience", out var parameter)) { Log.Error("Failed to find experience parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\PrayerBeadsIgnoreXp.cs", "TeamManager_GiveTeamExperience", 62); return; } ILCursor val = new ILCursor(il); ILLabel skipPrayerBeadsXpLabel = null; if (!val.TryGotoNext((MoveType)2, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, teamIndexParameter.Sequence), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 1), (Instruction x) => ILPatternMatchingExt.MatchBneUn(x, ref skipPrayerBeadsXpLabel) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\PrayerBeadsIgnoreXp.cs", "TeamManager_GiveTeamExperience", 74); return; } val.Emit(OpCodes.Ldarga, parameter); val.EmitDelegate((AllowPrayerBeadsXpGainDelegate)allowPrayerBeadsXpGain); val.Emit(OpCodes.Brfalse, (object)skipPrayerBeadsXpLabel); static bool allowPrayerBeadsXpGain(ref ulong experience) { if (experience != 0 && _ignoreXpChunks.Count > 0) { while (_ignoreXpChunks.Count > 0) { IgnoreXpChunk ignoreXpChunk = _ignoreXpChunks[0]; if (!((FixedTimeStamp)(ref ignoreXpChunk.ExpirationTime)).hasPassed) { if (ignoreXpChunk.Amount > experience) { ignoreXpChunk.Amount -= experience; experience = 0uL; break; } experience -= ignoreXpChunk.Amount; } _ignoreXpChunks.RemoveAt(0); } if (_ignoreXpChunks.Count == 0) { Run.onRunDestroyGlobal -= onRunDestroyGlobal; } if (experience == 0L) { return false; } } return true; } } } public sealed class ProcDamageModifier : MonoBehaviour, IOnIncomingDamageServerReceiver { public float ProcCoefficientMultiplier = 1f; public DamageTypeCombo DamageTypeToAdd; public void OnIncomingDamageServer(DamageInfo damageInfo) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) damageInfo.procCoefficient *= ProcCoefficientMultiplier; damageInfo.damageType |= DamageTypeToAdd; } } public static class ProcTypes { public static ModdedProcType IncreasePrimaryDamage { get; private set; } public static ModdedProcType Immobilize { get; private set; } public static ModdedProcType VoidDeathOrbProcType { get; private set; } public static ModdedProcType Bug { get; private set; } public static ModdedProcType Crowbar { get; private set; } [SystemInitializer(new Type[] { })] private static void Init() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_0028: Unknown result type (might be due to invalid IL or missing references) IncreasePrimaryDamage = ProcTypeAPI.ReserveProcType(); Immobilize = ProcTypeAPI.ReserveProcType(); VoidDeathOrbProcType = ProcTypeAPI.ReserveProcType(); Bug = ProcTypeAPI.ReserveProcType(); Crowbar = ProcTypeAPI.ReserveProcType(); } } internal static class ProjectileHooks { public delegate void ProjectileEventDelegate(ProjectileController projectileController); public static event ProjectileEventDelegate OnProjectileLinkedToGhostGlobal; [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown ProjectileController.Start += new hook_Start(ProjectileController_Start); } private static void ProjectileController_Start(orig_Start orig, ProjectileController self) { orig.Invoke(self); if (ProjectileHooks.OnProjectileLinkedToGhostGlobal == null || !Object.op_Implicit((Object)(object)self) || !Object.op_Implicit((Object)(object)self.ghost)) { return; } foreach (ProjectileEventDelegate item in ProjectileHooks.OnProjectileLinkedToGhostGlobal.GetInvocationList().OfType()) { if (item != null) { try { item(self); } catch (Exception arg) { Log.Error_NoCallerPrefix(string.Format("Failed to execute {0} event: {1}", "OnProjectileLinkedToGhostGlobal", arg)); } } } } } [RequireComponent(typeof(ProjectileController))] public sealed class ProjectileInstantiateDeployableOnImpact : MonoBehaviour, IProjectileImpactBehavior { private ProjectileController _projectileController; public DeployableSlot DeployableSlot = (DeployableSlot)35; public GameObject DeployablePrefab; private void Awake() { _projectileController = ((Component)this).GetComponent(); } void IProjectileImpactBehavior.OnProjectileImpact(ProjectileImpactInfo impactInfo) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Log.Warning("Called on client", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ProjectileInstantiateDeployableOnImpact.cs", "OnProjectileImpact", 26); return; } CharacterBody val = (Object.op_Implicit((Object)(object)_projectileController.owner) ? _projectileController.owner.GetComponent() : null); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.master)) { Vector3 position = ((Component)this).transform.position; Vector3 val2 = Vector3.ProjectOnPlane(Random.onUnitSphere, impactInfo.estimatedImpactNormal); Vector3 normalized = ((Vector3)(ref val2)).normalized; if (((Vector3)(ref normalized)).sqrMagnitude < 0.01f) { val2 = Vector3.ProjectOnPlane(Vector3.right, impactInfo.estimatedImpactNormal); normalized = ((Vector3)(ref val2)).normalized; } Quaternion val3 = Quaternion.LookRotation(normalized, impactInfo.estimatedImpactNormal); GameObject val4 = Object.Instantiate(DeployablePrefab, position, val3); GenericOwnership val5 = default(GenericOwnership); if (val4.TryGetComponent(ref val5)) { val5.ownerObject = _projectileController.owner; } NetworkServer.Spawn(val4); val.master.AddDeployable(val4.GetComponent(), DeployableSlot); Object.Destroy((Object)(object)((Component)this).gameObject); } } } public static class QualityCatalog { private static readonly QualityTierDef[] _qualityTierDefs = new QualityTierDef[4]; private static ItemQualityGroup[] _allItemQualityGroups = Array.Empty(); private static QualityTier[] _itemIndexToQuality = Array.Empty(); private static ItemQualityGroupIndex[] _itemIndexToQualityGroupIndex = Array.Empty(); private static readonly ReadOnlyArray[] _itemsByQualityTier = new ReadOnlyArray[5]; private static EquipmentQualityGroup[] _allEquipmentQualityGroups = Array.Empty(); private static QualityTier[] _equipmentIndexToQuality = Array.Empty(); private static EquipmentQualityGroupIndex[] _equipmentIndexToQualityGroupIndex = Array.Empty(); private static readonly ReadOnlyArray[] _equipmentsByQualityTier = new ReadOnlyArray[5]; private static BuffQualityGroup[] _allBuffQualityGroups = Array.Empty(); private static QualityTier[] _buffIndexToQuality = Array.Empty(); private static BuffQualityGroupIndex[] _buffIndexToQualityGroupIndex = Array.Empty(); private static readonly ReadOnlyArray[] _buffsByQualityTier = new ReadOnlyArray[5]; public static ResourceAvailability Availability = default(ResourceAvailability); public static int ItemQualityGroupCount => _allItemQualityGroups.Length; public static int EquipmentQualityGroupCount => _allEquipmentQualityGroups.Length; public static int BuffQualityGroupCount => _allBuffQualityGroups.Length; [SystemInitializer(new Type[] { typeof(ItemCatalog), typeof(EquipmentCatalog), typeof(BuffCatalog) })] private static IEnumerator Init() { yield return setQualityGroups(ItemQualitiesContent.QualityTiers.AllQualityTiers, ItemQualitiesContent.ItemQualityGroups.AllGroups, ItemQualitiesContent.EquipmentQualityGroups.AllGroups, ItemQualitiesContent.BuffQualityGroups.AllGroups); ((ResourceAvailability)(ref Availability)).MakeAvailable(); } private static IEnumerator setQualityGroups(ReadOnlyCollection qualityTierDefs, ReadOnlyCollection itemQualityGroups, ReadOnlyCollection equipmentQualityGroups, ReadOnlyCollection buffQualityGroups) { for (int i = 0; i < qualityTierDefs.Count; i++) { QualityTierDef qualityTierDef = qualityTierDefs[i]; _qualityTierDefs[(int)qualityTierDef.qualityTier] = qualityTierDef; } ItemQualityGroup[] allItemQualityGroups = _allItemQualityGroups; for (int j = 0; j < allItemQualityGroups.Length; j++) { allItemQualityGroups[j].GroupIndex = ItemQualityGroupIndex.Invalid; } _allItemQualityGroups = itemQualityGroups.ToArray(); UnityUtils.SortObjectsByName(_allBuffQualityGroups, StringComparer.Ordinal); Array.Resize(ref _itemIndexToQuality, ItemCatalog.itemCount); Array.Fill(_itemIndexToQuality, QualityTier.None); Array.Resize(ref _itemIndexToQualityGroupIndex, ItemCatalog.itemCount); Array.Fill(_itemIndexToQualityGroupIndex, ItemQualityGroupIndex.Invalid); EquipmentQualityGroup[] allEquipmentQualityGroups = _allEquipmentQualityGroups; for (int j = 0; j < allEquipmentQualityGroups.Length; j++) { allEquipmentQualityGroups[j].GroupIndex = EquipmentQualityGroupIndex.Invalid; } _allEquipmentQualityGroups = equipmentQualityGroups.ToArray(); UnityUtils.SortObjectsByName(_allEquipmentQualityGroups, StringComparer.Ordinal); Array.Resize(ref _equipmentIndexToQuality, EquipmentCatalog.equipmentCount); Array.Fill(_equipmentIndexToQuality, QualityTier.None); Array.Resize(ref _equipmentIndexToQualityGroupIndex, EquipmentCatalog.equipmentCount); Array.Fill(_equipmentIndexToQualityGroupIndex, EquipmentQualityGroupIndex.Invalid); BuffQualityGroup[] allBuffQualityGroups = _allBuffQualityGroups; for (int j = 0; j < allBuffQualityGroups.Length; j++) { allBuffQualityGroups[j].GroupIndex = BuffQualityGroupIndex.Invalid; } _allBuffQualityGroups = buffQualityGroups.ToArray(); UnityUtils.SortObjectsByName(_allBuffQualityGroups, StringComparer.Ordinal); Array.Resize(ref _buffIndexToQuality, BuffCatalog.buffCount); Array.Fill(_buffIndexToQuality, QualityTier.None); Array.Resize(ref _buffIndexToQualityGroupIndex, BuffCatalog.buffCount); Array.Fill(_buffIndexToQualityGroupIndex, BuffQualityGroupIndex.Invalid); ParallelCoroutine val = new ParallelCoroutine(); for (int k = 0; k < _allItemQualityGroups.Length; k++) { ItemQualityGroupIndex itemQualityGroupIndex = (ItemQualityGroupIndex)k; ItemQualityGroup itemQualityGroup = _allItemQualityGroups[k]; itemQualityGroup.GroupIndex = itemQualityGroupIndex; for (QualityTier qualityTier2 = QualityTier.Uncommon; qualityTier2 < QualityTier.Count; qualityTier2++) { ItemIndex itemIndex2 = itemQualityGroup.GetItemIndex(qualityTier2); if ((int)itemIndex2 == -1) { ItemDef itemDef = itemQualityGroup.GetItemDef(qualityTier2); if (Object.op_Implicit((Object)(object)itemDef)) { Log.Error($"Item '{((Object)itemDef).name}' ({qualityTier2} variant in group '{((Object)itemQualityGroup).name}') is not registered to the catalog.", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityCatalog.cs", "setQualityGroups", 141); } else { Log.Warning($"No item registered as {qualityTier2} variant in group '{((Object)itemQualityGroup).name}'", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityCatalog.cs", "setQualityGroups", 145); } } else { recordItemInGroup(itemIndex2, qualityTier2); } } if (Object.op_Implicit((Object)(object)itemQualityGroup.BaseItem)) { recordBaseItem(itemQualityGroup.BaseItem); } else if (itemQualityGroup.BaseItemReference != null && ((AssetReference)itemQualityGroup.BaseItemReference).RuntimeKeyIsValid()) { AsyncOperationHandle handle = AddressableUtil.LoadTempAssetAsync(itemQualityGroup.BaseItemReference); AssetLoadExtensions.OnSuccess(in handle, recordBaseItem); val.Add((IEnumerator)(object)handle); } void recordBaseItem(ItemDef baseItem) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if ((int)baseItem.itemIndex != -1) { itemQualityGroup.BaseItemIndex = baseItem.itemIndex; recordItemInGroup(baseItem.itemIndex, QualityTier.None); } else { Log.Error($"Base item ({baseItem}) in group {itemQualityGroup} is not registered in the catalog.", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityCatalog.cs", "setQualityGroups", 163); } } void recordItemInGroup(ItemIndex itemIndex, QualityTier qualityTier) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if ((int)itemIndex != -1) { if (_itemIndexToQualityGroupIndex[itemIndex] != ItemQualityGroupIndex.Invalid) { Log.Error($"Item {ItemCatalog.GetItemDef(itemIndex)} is registered in several quality groups, ({GetItemQualityGroup(_itemIndexToQualityGroupIndex[itemIndex])} & {GetItemQualityGroup(itemQualityGroupIndex)})", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityCatalog.cs", "setQualityGroups", 125); } else { _itemIndexToQuality[itemIndex] = qualityTier; _itemIndexToQualityGroupIndex[itemIndex] = itemQualityGroupIndex; } } } } for (int l = 0; l < _allEquipmentQualityGroups.Length; l++) { EquipmentQualityGroupIndex equipmentQualityGroupIndex = (EquipmentQualityGroupIndex)l; EquipmentQualityGroup equipmentQualityGroup = _allEquipmentQualityGroups[l]; equipmentQualityGroup.GroupIndex = equipmentQualityGroupIndex; for (QualityTier qualityTier3 = QualityTier.Uncommon; qualityTier3 < QualityTier.Count; qualityTier3++) { EquipmentIndex equipmentIndex2 = equipmentQualityGroup.GetEquipmentIndex(qualityTier3); if ((int)equipmentIndex2 == -1) { EquipmentDef equipmentDef = equipmentQualityGroup.GetEquipmentDef(qualityTier3); if (Object.op_Implicit((Object)(object)equipmentDef)) { Log.Error($"Equipment {((Object)equipmentDef).name} ({qualityTier3} variant in group '{((Object)equipmentQualityGroup).name}') is not registered to the catalog.", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityCatalog.cs", "setQualityGroups", 209); } else { Log.Warning($"No equipment registered as {qualityTier3} variant in group '{((Object)equipmentQualityGroup).name}'", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityCatalog.cs", "setQualityGroups", 213); } } else { recordEquipmentInGroup(equipmentIndex2, qualityTier3); } } if (Object.op_Implicit((Object)(object)equipmentQualityGroup.BaseEquipment)) { recordBaseEquipment(equipmentQualityGroup.BaseEquipment); } else if (equipmentQualityGroup.BaseEquipmentReference != null && ((AssetReference)equipmentQualityGroup.BaseEquipmentReference).RuntimeKeyIsValid()) { AsyncOperationHandle handle2 = AddressableUtil.LoadTempAssetAsync(equipmentQualityGroup.BaseEquipmentReference); AssetLoadExtensions.OnSuccess(in handle2, recordBaseEquipment); val.Add((IEnumerator)(object)handle2); } else { Log.Error("No base equipment defined for quality group '" + ((Object)equipmentQualityGroup).name + "'", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityCatalog.cs", "setQualityGroups", 248); } void recordBaseEquipment(EquipmentDef baseEquipment) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if ((int)baseEquipment.equipmentIndex != -1) { equipmentQualityGroup.BaseEquipmentIndex = baseEquipment.equipmentIndex; recordEquipmentInGroup(baseEquipment.equipmentIndex, QualityTier.None); } else { Log.Error("Base equipment (" + ((Object)baseEquipment).name + ") in group '" + ((Object)equipmentQualityGroup).name + "' is not registered in the catalog.", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityCatalog.cs", "setQualityGroups", 231); } } void recordEquipmentInGroup(EquipmentIndex equipmentIndex, QualityTier qualityTier) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) if ((int)equipmentIndex != -1) { if (_equipmentIndexToQualityGroupIndex[equipmentIndex] != EquipmentQualityGroupIndex.Invalid) { Log.Error("Equipment '" + ((Object)EquipmentCatalog.GetEquipmentDef(equipmentIndex)).name + "' is registered in several quality groups, ('" + ((Object)GetEquipmentQualityGroup(_equipmentIndexToQualityGroupIndex[equipmentIndex])).name + "' and '" + ((Object)GetEquipmentQualityGroup(equipmentQualityGroupIndex)).name + "')", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityCatalog.cs", "setQualityGroups", 193); } else { _equipmentIndexToQuality[equipmentIndex] = qualityTier; _equipmentIndexToQualityGroupIndex[equipmentIndex] = equipmentQualityGroupIndex; } } } } for (int m = 0; m < _allBuffQualityGroups.Length; m++) { BuffQualityGroupIndex buffQualityGroupIndex = (BuffQualityGroupIndex)m; BuffQualityGroup buffQualityGroup = _allBuffQualityGroups[m]; buffQualityGroup.GroupIndex = buffQualityGroupIndex; for (QualityTier qualityTier4 = QualityTier.Uncommon; qualityTier4 < QualityTier.Count; qualityTier4++) { BuffIndex buffIndex2 = buffQualityGroup.GetBuffIndex(qualityTier4); if ((int)buffIndex2 == -1) { BuffDef buffDef = buffQualityGroup.GetBuffDef(qualityTier4); if (Object.op_Implicit((Object)(object)buffDef)) { Log.Error($"Buff {((Object)buffDef).name} ({qualityTier4} variant in group '{((Object)buffQualityGroup).name}') is not registered to the catalog.", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityCatalog.cs", "setQualityGroups", 281); } else { Log.Warning($"No buff registered as {qualityTier4} variant in group '{((Object)buffQualityGroup).name}'", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityCatalog.cs", "setQualityGroups", 285); } } else { recordBuffInGroup(buffIndex2, qualityTier4); } } if (Object.op_Implicit((Object)(object)buffQualityGroup.BaseBuff)) { recordBaseBuff(buffQualityGroup.BaseBuff); } else if (buffQualityGroup.BaseBuffReference != null && ((AssetReference)buffQualityGroup.BaseBuffReference).RuntimeKeyIsValid()) { AsyncOperationHandle handle3 = AddressableUtil.LoadTempAssetAsync(buffQualityGroup.BaseBuffReference); AssetLoadExtensions.OnSuccess(in handle3, recordBaseBuff); val.Add((IEnumerator)(object)handle3); } void recordBaseBuff(BuffDef baseBuff) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if ((int)baseBuff.buffIndex != -1) { buffQualityGroup.BaseBuffIndex = baseBuff.buffIndex; recordBuffInGroup(baseBuff.buffIndex, QualityTier.None); } else { Log.Error("Base buff (" + ((Object)baseBuff).name + ") in group '" + ((Object)buffQualityGroup).name + "' is not registered in the catalog.", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityCatalog.cs", "setQualityGroups", 303); } } void recordBuffInGroup(BuffIndex buffIndex, QualityTier qualityTier) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_000a: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if ((int)buffIndex != -1) { if (_buffIndexToQualityGroupIndex[buffIndex] != BuffQualityGroupIndex.Invalid) { Log.Error($"Buff {BuffCatalog.GetBuffDef(buffIndex)} is registered in several quality groups, ({GetBuffQualityGroup(_buffIndexToQualityGroupIndex[buffIndex])} & {GetBuffQualityGroup(buffQualityGroupIndex)})", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityCatalog.cs", "setQualityGroups", 265); } else { _buffIndexToQuality[buffIndex] = qualityTier; _buffIndexToQualityGroupIndex[buffIndex] = buffQualityGroupIndex; } } } } yield return val; List[] array = new List[5]; List[] array2 = new List[5]; List[] array3 = new List[5]; for (QualityTier qualityTier5 = QualityTier.None; qualityTier5 < QualityTier.Count; qualityTier5++) { List list = CollectionPool>.RentCollection(); ListUtils.EnsureCapacity(list, ItemCatalog.itemCount / 5); array[(int)(qualityTier5 + 1)] = list; List list2 = CollectionPool>.RentCollection(); ListUtils.EnsureCapacity(list2, EquipmentCatalog.equipmentCount / 5); array2[(int)(qualityTier5 + 1)] = list2; List list3 = CollectionPool>.RentCollection(); ListUtils.EnsureCapacity(list3, BuffCatalog.buffCount / 5); array3[(int)(qualityTier5 + 1)] = list3; } for (ItemIndex val2 = (ItemIndex)0; (int)val2 < ItemCatalog.itemCount; val2 = (ItemIndex)(val2 + 1)) { array[(int)(GetQualityTier(val2) + 1)].Add(val2); } for (EquipmentIndex val3 = (EquipmentIndex)0; (int)val3 < EquipmentCatalog.equipmentCount; val3 = (EquipmentIndex)(val3 + 1)) { array2[(int)(GetQualityTier(val3) + 1)].Add(val3); } for (BuffIndex val4 = (BuffIndex)0; (int)val4 < BuffCatalog.buffCount; val4 = (BuffIndex)(val4 + 1)) { array3[(int)(GetQualityTier(val4) + 1)].Add(val4); } for (QualityTier qualityTier6 = QualityTier.None; qualityTier6 < QualityTier.Count; qualityTier6++) { List list4 = array[(int)(qualityTier6 + 1)]; _itemsByQualityTier[(int)(qualityTier6 + 1)] = ReadOnlyArray.op_Implicit((list4.Count > 0) ? list4.ToArray() : Array.Empty()); CollectionPool>.ReturnCollection(list4); List list5 = array2[(int)(qualityTier6 + 1)]; _equipmentsByQualityTier[(int)(qualityTier6 + 1)] = ReadOnlyArray.op_Implicit((list5.Count > 0) ? list5.ToArray() : Array.Empty()); CollectionPool>.ReturnCollection(list5); List list6 = array3[(int)(qualityTier6 + 1)]; _buffsByQualityTier[(int)(qualityTier6 + 1)] = ReadOnlyArray.op_Implicit((list6.Count > 0) ? list6.ToArray() : Array.Empty()); CollectionPool>.ReturnCollection(list6); } List tempLoadedLanguages = new List(); ParallelCoroutine val5 = new ParallelCoroutine(); foreach (Language allLanguage in Language.GetAllLanguages()) { if (!allLanguage.stringsLoaded) { LanguageLoaderCoroutine val6 = new LanguageLoaderCoroutine(allLanguage); val5.Add(val6.LoadStringsWithYield()); tempLoadedLanguages.Add(allLanguage); } } if (tempLoadedLanguages.Count > 0) { yield return val5; } Dictionary> dictionary = new Dictionary>(); foreach (Language allLanguage2 in Language.GetAllLanguages()) { dictionary.Add(allLanguage2.name, new Dictionary()); } allItemQualityGroups = _allItemQualityGroups; foreach (ItemQualityGroup itemQualityGroup2 in allItemQualityGroups) { ItemDef itemDef2 = ItemCatalog.GetItemDef(itemQualityGroup2.BaseItemIndex); if (!Object.op_Implicit((Object)(object)itemDef2)) { continue; } for (QualityTier qualityTier7 = QualityTier.Uncommon; qualityTier7 < QualityTier.Count; qualityTier7++) { ItemDef itemDef3 = ItemCatalog.GetItemDef(itemQualityGroup2.GetItemIndex(qualityTier7)); if (Object.op_Implicit((Object)(object)itemDef3)) { string text = qualityTier7.ToString().ToUpper(); formatQualityNameTokens(qualityModifierToken: (!itemDef3.isConsumed) ? ("QUALITY_" + text + "_MODIFIER") : ("QUALITY_" + text + "_CONSUMED_MODIFIER"), baseNameToken: itemDef2.nameToken, qualityNameToken: itemDef3.nameToken, qualityLanguageDictionary: dictionary); formatQualityTokens(itemDef2.pickupToken, itemDef3.pickupToken, dictionary); formatQualityTokens(itemDef2.descriptionToken, itemDef3.descriptionToken, dictionary); } } } allEquipmentQualityGroups = _allEquipmentQualityGroups; foreach (EquipmentQualityGroup equipmentQualityGroup2 in allEquipmentQualityGroups) { EquipmentDef equipmentDef2 = EquipmentCatalog.GetEquipmentDef(equipmentQualityGroup2.BaseEquipmentIndex); if (!Object.op_Implicit((Object)(object)equipmentDef2)) { Log.Error($"Invalid base equipment in group {equipmentQualityGroup2}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityCatalog.cs", "setQualityGroups", 469); continue; } for (QualityTier qualityTier8 = QualityTier.Uncommon; qualityTier8 < QualityTier.Count; qualityTier8++) { EquipmentDef equipmentDef3 = EquipmentCatalog.GetEquipmentDef(equipmentQualityGroup2.GetEquipmentIndex(qualityTier8)); if (Object.op_Implicit((Object)(object)equipmentDef3)) { string text2 = qualityTier8.ToString().ToUpper(); string qualityModifierToken3 = "QUALITY_" + text2 + "_MODIFIER"; formatQualityNameTokens(equipmentDef2.nameToken, equipmentDef3.nameToken, qualityModifierToken3, dictionary); formatQualityTokens(equipmentDef2.pickupToken, equipmentDef3.pickupToken, dictionary); formatQualityTokens(equipmentDef2.descriptionToken, equipmentDef3.descriptionToken, dictionary); } } } LanguageAPI.Add(dictionary); foreach (Language item in tempLoadedLanguages) { item.UnloadStrings(); } static void formatQualityNameTokens(string baseNameToken, string qualityNameToken, string qualityModifierToken, Dictionary> qualityLanguageDictionary) { if (string.IsNullOrEmpty(qualityNameToken)) { return; } foreach (Language allLanguage3 in Language.GetAllLanguages()) { if (!allLanguage3.TokenIsRegistered(qualityNameToken)) { string localizedFormattedStringByToken = allLanguage3.GetLocalizedFormattedStringByToken(qualityModifierToken, new object[1] { allLanguage3.GetLocalizedStringByToken(baseNameToken) }); qualityLanguageDictionary[allLanguage3.name][qualityNameToken] = localizedFormattedStringByToken; } } } static void formatQualityTokens(string baseToken, string qualityToken, Dictionary> qualityLanguageDictionary) { if (string.IsNullOrEmpty(qualityToken)) { return; } foreach (Language allLanguage4 in Language.GetAllLanguages()) { string localizedStringByToken = allLanguage4.GetLocalizedStringByToken(qualityToken); if (localizedStringByToken.Contains("{0}")) { localizedStringByToken = string.Format(localizedStringByToken, allLanguage4.GetLocalizedStringByToken(baseToken)); qualityLanguageDictionary[allLanguage4.name][qualityToken] = localizedStringByToken; } } } } public static QualityTierDef GetQualityTierDef(QualityTier qualityTier) { return ArrayUtils.GetSafe(_qualityTierDefs, (int)qualityTier); } public static ItemQualityGroup GetItemQualityGroup(ItemQualityGroupIndex itemQualityGroupIndex) { return ArrayUtils.GetSafe(_allItemQualityGroups, (int)itemQualityGroupIndex); } public static EquipmentQualityGroup GetEquipmentQualityGroup(EquipmentQualityGroupIndex equipmentQualityGroupIndex) { return ArrayUtils.GetSafe(_allEquipmentQualityGroups, (int)equipmentQualityGroupIndex); } public static BuffQualityGroup GetBuffQualityGroup(BuffQualityGroupIndex buffQualityGroupIndex) { return ArrayUtils.GetSafe(_allBuffQualityGroups, (int)buffQualityGroupIndex); } public static ItemQualityGroupIndex FindItemQualityGroupIndex(ItemIndex itemIndex) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected I4, but got Unknown ItemQualityGroupIndex[] itemIndexToQualityGroupIndex = _itemIndexToQualityGroupIndex; ItemQualityGroupIndex itemQualityGroupIndex = ItemQualityGroupIndex.Invalid; return ArrayUtils.GetSafe(itemIndexToQualityGroupIndex, (int)itemIndex, ref itemQualityGroupIndex); } public static EquipmentQualityGroupIndex FindEquipmentQualityGroupIndex(EquipmentIndex equipmentIndex) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected I4, but got Unknown EquipmentQualityGroupIndex[] equipmentIndexToQualityGroupIndex = _equipmentIndexToQualityGroupIndex; EquipmentQualityGroupIndex equipmentQualityGroupIndex = EquipmentQualityGroupIndex.Invalid; return ArrayUtils.GetSafe(equipmentIndexToQualityGroupIndex, (int)equipmentIndex, ref equipmentQualityGroupIndex); } public static BuffQualityGroupIndex FindBuffQualityGroupIndex(BuffIndex buffIndex) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected I4, but got Unknown BuffQualityGroupIndex[] buffIndexToQualityGroupIndex = _buffIndexToQualityGroupIndex; BuffQualityGroupIndex buffQualityGroupIndex = BuffQualityGroupIndex.Invalid; return ArrayUtils.GetSafe(buffIndexToQualityGroupIndex, (int)buffIndex, ref buffQualityGroupIndex); } public static QualityTier GetQualityTier(ItemIndex itemIndex) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected I4, but got Unknown QualityTier[] itemIndexToQuality = _itemIndexToQuality; QualityTier qualityTier = QualityTier.None; return ArrayUtils.GetSafe(itemIndexToQuality, (int)itemIndex, ref qualityTier); } public static QualityTier GetQualityTier(EquipmentIndex equipmentIndex) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected I4, but got Unknown QualityTier[] equipmentIndexToQuality = _equipmentIndexToQuality; QualityTier qualityTier = QualityTier.None; return ArrayUtils.GetSafe(equipmentIndexToQuality, (int)equipmentIndex, ref qualityTier); } public static QualityTier GetQualityTier(BuffIndex buffIndex) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected I4, but got Unknown QualityTier[] buffIndexToQuality = _buffIndexToQuality; QualityTier qualityTier = QualityTier.None; return ArrayUtils.GetSafe(buffIndexToQuality, (int)buffIndex, ref qualityTier); } public static QualityTier GetQualityTier(PickupIndex pickupIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_0016: 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) PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex); if (pickupDef == null) { return QualityTier.None; } if ((int)pickupDef.itemIndex != -1) { return GetQualityTier(pickupDef.itemIndex); } if ((int)pickupDef.equipmentIndex != -1) { return GetQualityTier(pickupDef.equipmentIndex); } return QualityTier.None; } public static ItemIndex GetItemIndexOfQuality(ItemIndex itemIndex, QualityTier qualityTier) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 //IL_0025: 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) ItemQualityGroup itemQualityGroup = GetItemQualityGroup(FindItemQualityGroupIndex(itemIndex)); ItemIndex val = (ItemIndex)((!Object.op_Implicit((Object)(object)itemQualityGroup)) ? (-1) : ((int)itemQualityGroup.GetItemIndex(qualityTier))); if ((int)val == -1) { return itemIndex; } return val; } public static EquipmentIndex GetEquipmentIndexOfQuality(EquipmentIndex equipmentIndex, QualityTier qualityTier) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 //IL_0025: 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) EquipmentQualityGroup equipmentQualityGroup = GetEquipmentQualityGroup(FindEquipmentQualityGroupIndex(equipmentIndex)); EquipmentIndex val = (EquipmentIndex)((!Object.op_Implicit((Object)(object)equipmentQualityGroup)) ? (-1) : ((int)equipmentQualityGroup.GetEquipmentIndex(qualityTier))); if ((int)val == -1) { return equipmentIndex; } return val; } public static BuffIndex GetBuffIndexOfQuality(BuffIndex buffIndex, QualityTier qualityTier) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 //IL_0025: 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) BuffQualityGroup buffQualityGroup = GetBuffQualityGroup(FindBuffQualityGroupIndex(buffIndex)); BuffIndex val = (BuffIndex)((!Object.op_Implicit((Object)(object)buffQualityGroup)) ? (-1) : ((int)buffQualityGroup.GetBuffIndex(qualityTier))); if ((int)val == -1) { return buffIndex; } return val; } public static PickupIndex GetPickupIndexOfQuality(PickupIndex pickupIndex, QualityTier qualityTier) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Invalid comparison between Unknown and I4 //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex); if (pickupDef != null) { if ((int)pickupDef.itemIndex != -1) { PickupIndex val = PickupCatalog.FindPickupIndex(GetItemIndexOfQuality(pickupDef.itemIndex, qualityTier)); if (val != PickupIndex.none) { return val; } } else if ((int)pickupDef.equipmentIndex != -1) { PickupIndex val2 = PickupCatalog.FindPickupIndex(GetEquipmentIndexOfQuality(pickupDef.equipmentIndex, qualityTier)); if (val2 != PickupIndex.none) { return val2; } } } return pickupIndex; } public static PickupIndex GetScrapIndexForPickup(PickupIndex scrappingPickupIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_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_0021: 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) PickupDef pickupDef = PickupCatalog.GetPickupDef(scrappingPickupIndex); if (pickupDef == null) { return PickupIndex.none; } return GetPickupIndexOfQuality(PickupCatalog.FindScrapIndexForItemTier(pickupDef.itemTier), GetQualityTier(scrappingPickupIndex)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ReadOnlyArray GetAllItemsOfQuality(QualityTier qualityTier) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) return _itemsByQualityTier[(int)(qualityTier + 1)]; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ReadOnlyArray GetAllEquipmentsOfQuality(QualityTier qualityTier) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) return _equipmentsByQualityTier[(int)(qualityTier + 1)]; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ReadOnlyArray GetAllBuffsOfQuality(QualityTier qualityTier) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) return _buffsByQualityTier[(int)(qualityTier + 1)]; } public static QualityTier Max(QualityTier a, QualityTier b) { if (a <= b) { return b; } return a; } public static QualityTier Min(QualityTier a, QualityTier b) { if (a >= b) { return b; } return a; } public static Texture2D CreateQualityIconTexture(Texture2D baseIconTexture, QualityTier qualityTier, bool useConsumedIcon = false) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return CreateQualityIconTexture(baseIconTexture, qualityTier, Color.white, useConsumedIcon); } public static Texture2D CreateQualityIconTexture(Texture2D baseIconTexture, QualityTier qualityTier, Color baseIconTint, bool useConsumedIcon = false) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return CreateQualityIconTexture(baseIconTexture, GetQualityTierDef(qualityTier), baseIconTint, useConsumedIcon); } internal static Texture2D CreateQualityIconTexture(Texture2D baseIconTexture, QualityTierDef qualityTierDef, bool useConsumedIcon = false) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return CreateQualityIconTexture(baseIconTexture, qualityTierDef, Color.white, useConsumedIcon); } internal static Texture2D CreateQualityIconTexture(Texture2D baseIconTexture, QualityTierDef qualityTierDef, Color baseIconTint, bool useConsumedIcon = false) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_018d: 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) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0172: 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) Texture2D val = TextureUtils.CreateAccessibleCopy(baseIconTexture); Sprite val2 = qualityTierDef.icon; if (useConsumedIcon && Object.op_Implicit((Object)(object)qualityTierDef.consumedIcon)) { val2 = qualityTierDef.consumedIcon; } if (Object.op_Implicit((Object)(object)val2)) { int width = ((Texture)val).width; int height = ((Texture)val).height; int num = (int)((float)width * 0.5f); int num2 = (int)((float)height * 0.5f); Rect rect = val2.rect; float num3 = ((Rect)(ref rect)).x / (float)((Texture)val2.texture).width; rect = val2.rect; float x = ((Rect)(ref rect)).x; rect = val2.rect; float num4 = (x + ((Rect)(ref rect)).width) / (float)((Texture)val2.texture).width; rect = val2.rect; float num5 = ((Rect)(ref rect)).y / (float)((Texture)val2.texture).height; rect = val2.rect; float y = ((Rect)(ref rect)).y; rect = val2.rect; float num6 = (y + ((Rect)(ref rect)).height) / (float)((Texture)val2.texture).height; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { Color val3 = val.GetPixel(i, j) * baseIconTint; if (i < num && j > height - num2) { float num7 = Mathf.Lerp(num3, num4, (float)i / (float)num); float num8 = Mathf.Lerp(num5, num6, (float)(j - (height - num2)) / (float)num2); Color pixelBilinear = val2.texture.GetPixelBilinear(num7, num8); if (pixelBilinear.a > 0f) { val3 = ((val3.a > 0f) ? Color.Lerp(val3, pixelBilinear, pixelBilinear.a) : pixelBilinear); } } val.SetPixel(i, j, val3); } } val.Apply(); } return val; } } internal static class QualityCraftingHandler { private static readonly HashSet _qualityCraftableDefs = new HashSet(); [InitDuringStartupPhase(/*Could not decode attribute arguments.*/)] private static void Init() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown SystemInitializerInjector.InjectDependency(typeof(CraftableCatalog), typeof(QualityCatalog)); CraftableCatalog.Init += new hook_Init(CraftableCatalog_Init); CraftableCatalog.SetCraftableDefs += new Manipulator(CraftableCatalog_SetCraftableDefs); } private static void CraftableCatalog_Init(orig_Init orig) { appendQualityCraftableDefs(ref ContentManager._craftableDefs); orig.Invoke(); } private static void appendQualityCraftableDefs(ref CraftableDef[] allCraftableDefs) { //IL_00c6: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04ad: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: 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) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: 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_01ab: 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_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Expected O, but got Unknown //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Expected O, but got Unknown Stopwatch.StartNew(); if (_qualityCraftableDefs.Count > 0) { foreach (CraftableDef qualityCraftableDef in _qualityCraftableDefs) { Object.Destroy((Object)(object)qualityCraftableDef); } _qualityCraftableDefs.Clear(); } List list = new List(allCraftableDefs.Length * 4); int num = 0; Span> span = new List[5]; Span> span2 = span; for (int i = 0; i < span2.Length; i++) { span2[i] = new List(); } CraftableDef[] array = allCraftableDefs; HashSet hashSet2 = default(HashSet); foreach (CraftableDef val in array) { if (!Object.op_Implicit((Object)(object)val)) { continue; } PickupDef pickupDefFromResult = val.GetPickupDefFromResult(); PickupIndex val2 = ((pickupDefFromResult != null) ? pickupDefFromResult.pickupIndex : PickupIndex.none); if (!((PickupIndex)(ref val2)).isValid) { continue; } span2 = span; for (int j = 0; j < span2.Length; j++) { span2[j].Clear(); } HashSet hashSet = new HashSet(EqualityComparer.Default); Recipe[] recipes = val.recipes; foreach (Recipe val3 in recipes) { if (val3?.ingredients == null) { continue; } int num2 = val3.ingredients.Length; if (num2 == 0) { continue; } Span span3 = new PickupIndex[num2][]; bool flag = true; for (int k = 0; k < num2; k++) { RecipeIngredient val4 = val3.ingredients[k]; if (val4.IsDefinedPickup() && val4.pickupIndex == PickupIndex.none) { Object pickup = val4.pickup; ItemDef val5 = (ItemDef)(object)((pickup is ItemDef) ? pickup : null); if (val5 != null) { val4.pickupIndex = PickupCatalog.FindPickupIndex(val5.itemIndex); } else { Object pickup2 = val4.pickup; EquipmentDef val6 = (EquipmentDef)(object)((pickup2 is EquipmentDef) ? pickup2 : null); if (val6 != null) { val4.pickupIndex = PickupCatalog.FindPickupIndex(val6.equipmentIndex); } } } DisposableRental> val7 = CollectionPool>.RentCollection(ref hashSet2); try { Enumerator enumerator2 = PickupCatalog.allPickupIndices.GetEnumerator(); try { while (((Enumerator)(ref enumerator2)).MoveNext()) { PickupIndex current = ((Enumerator)(ref enumerator2)).Current; if (val4.Validate(QualityCatalog.GetPickupIndexOfQuality(current, QualityTier.None))) { hashSet2.Add(current); } } } finally { ((IDisposable)(Enumerator)(ref enumerator2)).Dispose(); } if (hashSet2.Count > 0) { span3[k] = hashSet2.ToArray(); continue; } flag = false; break; } finally { val7.Dispose(); } } if (!flag) { continue; } hashSet.Clear(); Span span4 = stackalloc int[num2]; bool flag2; do { PickupIndex[] array2 = (PickupIndex[])(object)new PickupIndex[num2]; for (int l = 0; l < num2; l++) { int num3 = span4[l]; array2[l] = span3[l][num3]; } hashSet.Add(array2); flag2 = false; for (int m = 0; m < num2; m++) { ref int reference = ref span4[m]; if (reference < span3[m].Length - 1) { reference++; flag2 = true; break; } reference = 0; } } while (flag2); foreach (PickupIndex[] item in hashSet) { int num4 = 0; int num5 = 0; PickupIndex[] array3 = item; for (int n = 0; n < array3.Length; n++) { QualityTier qualityTier = QualityCatalog.GetQualityTier(array3[n]); if (qualityTier != QualityTier.None) { num4 = (int)(num4 + qualityTier); num5++; } } if (num5 != 0) { bool num6 = num5 == item.Length; QualityTier qualityTier2 = (QualityTier)(num4 / num5); QualityTier qualityTier3 = (num6 ? qualityTier2 : QualityTier.None); if (QualityCatalog.GetPickupIndexOfQuality(val2, qualityTier3) == val2) { qualityTier3 = QualityTier.None; } Recipe val8 = new Recipe { amountToDrop = val3.amountToDrop, priority = val3.priority, ingredients = (RecipeIngredient[])(object)new RecipeIngredient[item.Length] }; for (int num7 = 0; num7 < item.Length; num7++) { val8.ingredients[num7] = new RecipeIngredient { pickup = getPickupDefObject(item[num7]), type = (IngredientTypeIndex)0, forbiddenTags = Array.Empty(), requiredTags = Array.Empty() }; } span[(int)(qualityTier3 + 1)].Add(val8); } } } for (QualityTier qualityTier4 = QualityTier.None; qualityTier4 < QualityTier.Count; qualityTier4++) { ref List reference2 = ref span[(int)(qualityTier4 + 1)]; if (reference2.Count <= 0) { continue; } PickupIndex pickupIndexOfQuality = QualityCatalog.GetPickupIndexOfQuality(val2, qualityTier4); if (qualityTier4 == QualityTier.None || val2 != pickupIndexOfQuality) { Object pickupDefObject = getPickupDefObject(pickupIndexOfQuality); if (Object.op_Implicit(pickupDefObject)) { CraftableDef val9 = ScriptableObject.CreateInstance(); ((Object)val9).name = $"{((Object)val).name}{qualityTier4}"; val9.pickup = pickupDefObject; val9.recipes = reference2.ToArray(); list.Add(val9); num += val9.recipes.Length; } } } } if (list.Count > 0) { _qualityCraftableDefs.UnionWith(list); int num8 = allCraftableDefs.Length; Array.Resize(ref allCraftableDefs, num8 + list.Count); list.CopyTo(allCraftableDefs, num8); } _qualityCraftableDefs.TrimExcess(); } private static Object getPickupDefObject(PickupIndex pickupIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Invalid comparison between Unknown and I4 //IL_0014: 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) PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex); if (pickupDef != null) { if ((int)pickupDef.itemIndex != -1) { return (Object)(object)ItemCatalog.GetItemDef(pickupDef.itemIndex); } if ((int)pickupDef.equipmentIndex != -1) { return (Object)(object)EquipmentCatalog.GetEquipmentDef(pickupDef.equipmentIndex); } } return null; } private static void CraftableCatalog_SetCraftableDefs(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); VariableDefinition allRecipesEnumeratorVar = null; VariableDefinition recipeEntryVar = null; MethodReference val5 = default(MethodReference); MethodReference val4 = default(MethodReference); if (!val.TryGotoNext((MoveType)2, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(CraftableCatalog), "allRecipes"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val5) && ((val5 != null) ? ((MemberReference)val5).Name : null) == "GetEnumerator", (Instruction x) => x.MatchStloc(il, out allRecipesEnumeratorVar) }) || !val.TryGotoNext((MoveType)2, new Func[3] { (Instruction x) => x.MatchLdloca(allRecipesEnumeratorVar), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val4) && ((val4 != null) ? ((MemberReference)val4).Name : null) == "get_Current", (Instruction x) => x.MatchStloc(typeof(RecipeEntry), il, out recipeEntryVar) })) { Log.Error("Failed to find RecipeEntry loop variable", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityCraftingHandler.cs", "CraftableCatalog_SetCraftableDefs", 356); return; } VariableDefinition allPickupsEnumeratorVar = null; VariableDefinition pickupDefVar = null; int num2 = default(int); MethodReference val3 = default(MethodReference); MethodReference val2 = default(MethodReference); if (!val.TryGotoNext((MoveType)2, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num2), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val3) && ((val3 != null) ? ((MemberReference)val3).Name : null) == "GetEnumerator", (Instruction x) => x.MatchStloc(il, out allPickupsEnumeratorVar) }) || !val.TryGotoNext((MoveType)2, new Func[3] { (Instruction x) => x.MatchLdloc(allPickupsEnumeratorVar), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val2) && ((val2 != null) ? ((MemberReference)val2).Name : null) == "get_Current", (Instruction x) => x.MatchStloc(typeof(PickupDef), il, out pickupDefVar) })) { Log.Error("Failed to find PickupDef loop variable", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityCraftingHandler.cs", "CraftableCatalog_SetCraftableDefs", 375); return; } ILLabel ingredientInvalidLabel = null; if (!val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "Validate"), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref ingredientInvalidLabel) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityCraftingHandler.cs", "CraftableCatalog_SetCraftableDefs", 384); return; } val.Emit(OpCodes.Ldloc, pickupDefVar); val.Emit(OpCodes.Ldloc, recipeEntryVar); val.EmitDelegate>((Func)allowIngredient); val.Emit(OpCodes.Brfalse, (object)ingredientInvalidLabel); static bool allowIngredient(PickupDef ingredientPickup, RecipeEntry recipeEntry) { //IL_0009: 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 (ingredientPickup == null || recipeEntry == null) { return true; } bool num = QualityCatalog.GetQualityTier(ingredientPickup.pickupIndex) != QualityTier.None; bool flag = QualityCatalog.GetQualityTier(recipeEntry.result) != QualityTier.None; if ((num || flag) && !_qualityCraftableDefs.Contains(recipeEntry.recipe.craftableDef)) { return false; } return true; } } } [RequireComponent(typeof(NetworkedBodyAttachment))] public sealed class QualityCritOnUseAttachment : MonoBehaviour, INetworkedBodyAttachmentListener { public GameObject HudOverlayPrefab; public string HudOverlayChildLocatorEntry; private OverlayController _hudOverlayController; private HashSet _bodiesWithWeakPointsEnabledServer; private CharacterBody _attachedBody; private float _cachedWeakPointCritMultBonus; public NetworkedBodyAttachment BodyAttachment { get; private set; } private void Awake() { BodyAttachment = ((Component)this).GetComponent(); } private void OnEnable() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) InstanceTracker.Add(this); if (NetworkServer.active) { _bodiesWithWeakPointsEnabledServer = CollectionPool>.RentCollection(); setAttachedBody(BodyAttachment.attachedBody); } if (NetworkClient.active && Object.op_Implicit((Object)(object)HudOverlayPrefab)) { _hudOverlayController = HudOverlayManager.AddGlobalOverlay(new OverlayCreationParams { prefab = HudOverlayPrefab, childLocatorEntry = HudOverlayChildLocatorEntry }); } } private void OnDisable() { if (_hudOverlayController != null) { HudOverlayManager.RemoveGlobalOverlay(_hudOverlayController); _hudOverlayController = null; } setAttachedBody(null); if (_bodiesWithWeakPointsEnabledServer != null) { _bodiesWithWeakPointsEnabledServer = CollectionPool>.ReturnCollection(_bodiesWithWeakPointsEnabledServer); } InstanceTracker.Remove(this); } private void setAttachedBody(CharacterBody attachedBody) { if ((Object)(object)_attachedBody == (Object)(object)attachedBody) { return; } bool num = Object.op_Implicit((Object)(object)_attachedBody); if (num) { _attachedBody.onRecalculateStats -= onAttachedBodyRecalculateStats; } _attachedBody = attachedBody; bool flag = Object.op_Implicit((Object)(object)_attachedBody); if (flag) { _attachedBody.onRecalculateStats += onAttachedBodyRecalculateStats; } if (num != flag) { if (flag) { CharacterBody.onBodyStartGlobal += onBodyStartGlobal; CharacterBody.onBodyDestroyGlobal += onBodyDestroyGlobal; } else { CharacterBody.onBodyStartGlobal -= onBodyStartGlobal; CharacterBody.onBodyDestroyGlobal -= onBodyDestroyGlobal; } } refreshAttachedBodyBuffs(); foreach (CharacterBodyExtraStatsTracker instances in InstanceTracker.GetInstancesList()) { refreshWeakPointsActive(instances); } } private void onAttachedBodyRecalculateStats(CharacterBody attachedBody) { refreshAttachedBodyBuffs(); } private void refreshAttachedBodyBuffs() { float weakPointCritMultiplierBonus = 0f; if (Object.op_Implicit((Object)(object)_attachedBody)) { weakPointCritMultiplierBonus = CritOnUse.GetCritMultiplierBonus(_attachedBody.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.FullCrit).HighestQuality); } setWeakPointCritMultiplierBonus(weakPointCritMultiplierBonus); } private void setWeakPointCritMultiplierBonus(float weakPointCritMultiplierBonus) { float num = weakPointCritMultiplierBonus - _cachedWeakPointCritMultBonus; if (Mathf.Abs(num) < Mathf.Epsilon) { return; } _cachedWeakPointCritMultBonus = weakPointCritMultiplierBonus; if (_bodiesWithWeakPointsEnabledServer == null) { return; } foreach (CharacterBodyExtraStatsTracker item in _bodiesWithWeakPointsEnabledServer) { item.WeakPointCritMultiplierBonusServer += num; } } private void onBodyStartGlobal(CharacterBody body) { if (((Component)(object)body).TryGetComponentCached(out CharacterBodyExtraStatsTracker component)) { refreshWeakPointsActive(component); } } private void onBodyDestroyGlobal(CharacterBody body) { if (((Component)(object)body).TryGetComponentCached(out CharacterBodyExtraStatsTracker component)) { setWeakPointActive(component, active: false); } } private void refreshWeakPointsActive(CharacterBodyExtraStatsTracker bodyExtraStats) { setWeakPointActive(bodyExtraStats, shouldEnableWeakPoints(bodyExtraStats.Body)); } private bool shouldEnableWeakPoints(CharacterBody body) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)_attachedBody)) { return FriendlyFireManager.ShouldDirectHitProceed(body.healthComponent, _attachedBody.teamComponent.teamIndex); } return false; } private void setWeakPointActive(CharacterBodyExtraStatsTracker bodyExtraStats, bool active) { if (_bodiesWithWeakPointsEnabledServer != null && bodyExtraStats != null && (active ? _bodiesWithWeakPointsEnabledServer.Add(bodyExtraStats) : _bodiesWithWeakPointsEnabledServer.Remove(bodyExtraStats))) { if (active) { bodyExtraStats.WeakPointCritMultiplierBonusServer += _cachedWeakPointCritMultBonus; bodyExtraStats.WeakPointsEnabledCounterServer++; } else { bodyExtraStats.WeakPointsEnabledCounterServer--; bodyExtraStats.WeakPointCritMultiplierBonusServer -= _cachedWeakPointCritMultBonus; } } } void INetworkedBodyAttachmentListener.OnAttachedBodyDiscovered(NetworkedBodyAttachment networkedBodyAttachment, CharacterBody attachedBody) { if (NetworkServer.active) { setAttachedBody(attachedBody); } } public static QualityCritOnUseAttachment FindAttachment(CharacterBody body) { if (!Object.op_Implicit((Object)(object)body)) { return null; } foreach (QualityCritOnUseAttachment instances in InstanceTracker.GetInstancesList()) { if ((Object)(object)instances.BodyAttachment.attachedBody == (Object)(object)body) { return instances; } } return null; } public static QualityCritOnUseAttachment EnsureAttachment(CharacterBody body) { if (!Object.op_Implicit((Object)(object)body)) { return null; } QualityCritOnUseAttachment qualityCritOnUseAttachment = FindAttachment(body); if (!Object.op_Implicit((Object)(object)qualityCritOnUseAttachment)) { GameObject obj = Object.Instantiate(ItemQualitiesContent.NetworkedPrefabs.QualityCritOnUseAttachment); obj.GetComponent().AttachToGameObjectAndSpawn(((Component)body).gameObject, (string)null); qualityCritOnUseAttachment = obj.GetComponent(); } return qualityCritOnUseAttachment; } } [RequireComponent(typeof(PickupPickerController))] [RequireComponent(typeof(ShopTerminalBehavior))] public sealed class QualityDuplicatorBehavior : NetworkBehaviour, IInteractable, IHologramContentProvider { private static EffectIndex _itemTakenOrbEffectIndex = (EffectIndex)(-1); private static EffectIndex _regeneratingScrapExplosionDisplayEffectIndex = (EffectIndex)(-1); public CostTypeIndex CostTypeIndex = (CostTypeIndex)4; public int Cost = 1; public string ContextToken; public AssetReferenceGameObject HologramContentPrefab = new AssetReferenceGameObject(RoR2_Base_Common_VFX.CostHologramContent_prefab); public UnityEvent OnPurchase; [SyncVar] private bool _available = true; private Xoroshiro128Plus _rng; private AsyncOperationHandle _hologramContentPrefabLoad; private PickupPickerController _pickerController; private NetworkUIPromptController _promptController; private ShopTerminalBehavior _terminalBehavior; private readonly List _selectedPickups = new List(); public bool Network_available { get { return _available; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref _available, 1u); } } public static event Action> OnPickupsSelectedForPurchase; [SystemInitializer(new Type[] { typeof(EffectCatalogUtils) })] private static void Init() { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Invalid comparison between Unknown and I4 _itemTakenOrbEffectIndex = EffectCatalogUtils.FindEffectIndex("ItemTakenOrbEffect"); if ((int)_itemTakenOrbEffectIndex == -1) { Log.Error("Failed to find item taken orb effect index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityDuplicatorBehavior.cs", "Init", 27); } _regeneratingScrapExplosionDisplayEffectIndex = EffectCatalogUtils.FindEffectIndex("RegeneratingScrapExplosionDisplay"); if ((int)_regeneratingScrapExplosionDisplayEffectIndex == -1) { Log.Error("Failed to find regenerating scrap item display effect index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityDuplicatorBehavior.cs", "Init", 33); } } private void Awake() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) _terminalBehavior = ((Component)this).GetComponent(); _pickerController = ((Component)this).GetComponent(); _promptController = ((Component)this).GetComponent(); _promptController.onDisplayEnd += onPromptDisplayEnd; _hologramContentPrefabLoad = AssetAsyncReferenceManager.LoadAsset((AssetReferenceT)(object)HologramContentPrefab, (AsyncReferenceHandleUnloadType)2); } private void Start() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown if (NetworkServer.active) { _rng = new Xoroshiro128Plus(Run.instance.treasureRng.nextUlong); } } private void OnDestroy() { AssetAsyncReferenceManager.UnloadAsset((AssetReferenceT)(object)HologramContentPrefab); } private void onPromptDisplayEnd(NetworkUIPromptController promptController, LocalUser localUser, CameraRigController cameraRig) { _selectedPickups.Clear(); ((Behaviour)_pickerController).enabled = false; } public void OnPickupSelected(int pickupIndexInt) { } [Server] private static void createItemTakenOrb(Vector3 effectOrigin, GameObject targetObject, ItemIndex itemIndex) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected I4, but got Unknown //IL_003e: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void ItemQualities.QualityDuplicatorBehavior::createItemTakenOrb(UnityEngine.Vector3,UnityEngine.GameObject,RoR2.ItemIndex)' called on client"); } else if ((int)_itemTakenOrbEffectIndex != -1) { EffectData val = new EffectData { origin = effectOrigin, genericFloat = 1.5f, genericUInt = (uint)(itemIndex + 1) }; val.SetNetworkedObjectReference(targetObject); EffectManager.SpawnEffect(_itemTakenOrbEffectIndex, val, true); } } [Server] public void SetAvailable(bool available) { if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void ItemQualities.QualityDuplicatorBehavior::SetAvailable(System.Boolean)' called on client"); } else { Network_available = available; } } public void SetQualityScrapOptionsFromInteractor(Interactor interactor) { } private bool canBeAffordedByInteractor(Interactor interactor) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return CostTypeCatalog.GetCostTypeDef(CostTypeIndex).IsAffordable(Cost, interactor); } private bool hasAmbiguousPayment(Interactor interactor) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Invalid comparison between Unknown and I4 //IL_0088: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Invalid comparison between Unknown and I4 //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Invalid comparison between Unknown and I4 //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Invalid comparison between Unknown and I4 //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_00cd: Unknown result type (might be due to invalid IL or missing references) CharacterBody val = (Object.op_Implicit((Object)(object)interactor) ? ((Component)interactor).GetComponent() : null); Inventory val2 = (Object.op_Implicit((Object)(object)val) ? val.inventory : null); if (Object.op_Implicit((Object)(object)val2)) { ItemTier val3 = (ItemTier)5; CostTypeDef costTypeDef = CostTypeCatalog.GetCostTypeDef(CostTypeIndex); if (costTypeDef != null) { val3 = costTypeDef.itemTier; } bool result = false; ItemIndex val4 = (ItemIndex)(-1); bool result2 = false; ItemIndex val5 = (ItemIndex)(-1); foreach (ItemIndex item in val2.itemAcquisitionOrder) { ItemDef itemDef = ItemCatalog.GetItemDef(item); if (!Object.op_Implicit((Object)(object)itemDef) || !itemDef.canRemove || itemDef.tier != val3 || QualityCatalog.GetQualityTier(item) <= QualityTier.None) { continue; } if (itemDef.ContainsTag((ItemTag)14)) { if ((int)val5 != -1) { if (val5 != item) { result2 = true; } } else { val5 = item; } } else { if (!itemDef.ContainsTag((ItemTag)10)) { continue; } if ((int)val4 != -1) { if (val4 != item) { result = true; } } else { val4 = item; } } } if ((int)val5 != -1) { return result2; } if ((int)val4 != -1) { return result; } } return false; } public string GetContextString(Interactor activator) { return Language.GetString(ContextToken); } public Interactability GetInteractability(Interactor activator) { if (_available) { if (Object.op_Implicit((Object)(object)_promptController) && !_promptController.inUse) { if (canBeAffordedByInteractor(activator)) { return (Interactability)2; } return (Interactability)1; } return (Interactability)1; } return (Interactability)0; } public void OnInteractionBegin(Interactor activator) { } public bool ShouldIgnoreSpherecastForInteractibility(Interactor activator) { return false; } public bool ShouldProximityHighlight() { return true; } public bool ShouldShowOnScanner() { return _available; } public bool ShouldDisplayHologram(GameObject viewer) { return _available; } public GameObject GetHologramContentPrefab() { if (_hologramContentPrefabLoad.IsValid()) { _hologramContentPrefabLoad.WaitForCompletion(); return _hologramContentPrefabLoad.Result; } return null; } public void UpdateHologramContent(GameObject hologramContentObject, Transform viewerBody) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) CostHologramContent val = default(CostHologramContent); if (hologramContentObject.TryGetComponent(ref val)) { val.displayValue = Cost; val.costType = CostTypeIndex; } } private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { if (forceAll) { writer.Write(_available); return true; } bool flag = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(_available); } if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { if (initialState) { _available = reader.ReadBoolean(); return; } int num = (int)reader.ReadPackedUInt32(); if (((uint)num & (true ? 1u : 0u)) != 0) { _available = reader.ReadBoolean(); } } public override void PreStartClient() { } } public sealed class QualityItemDropletEffectController : NetworkBehaviour { private PickupDropletController _dropletController; [SyncVar] private uint _pickupQualityTierInt; public QualityTier PickupQualityTier { get { return (QualityTier)(_pickupQualityTierInt - 1); } private set { Network_pickupQualityTierInt = (uint)(value + 1); } } public uint Network_pickupQualityTierInt { get { return _pickupQualityTierInt; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref _pickupQualityTierInt, 1u); } } [SystemInitializer(new Type[] { })] private static 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) AsyncOperationHandle handle = AddressableUtil.LoadAssetAsync(RoR2_Base_Common.PickupDroplet_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject pickupDropletPrefab) { UnityObjectExtensions.EnsureComponent(pickupDropletPrefab); }); } private void Awake() { _dropletController = ((Component)this).GetComponent(); if (!Object.op_Implicit((Object)(object)_dropletController)) { ((Behaviour)this).enabled = false; Log.Warning(Util.GetGameObjectHierarchyName(((Component)this).gameObject) + " is missing PickupDropletController component", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityItemDropletEffectController.cs", "Awake", 39); } } private void Start() { //IL_0015: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } QualityTier qualityTier = QualityCatalog.GetQualityTier(_dropletController.pickupState.pickupIndex); if (_dropletController.createPickupInfo.pickerOptions != null) { Option[] pickerOptions = _dropletController.createPickupInfo.pickerOptions; foreach (Option val in pickerOptions) { if (val.available) { qualityTier = QualityCatalog.Max(qualityTier, QualityCatalog.GetQualityTier(val.pickup.pickupIndex)); } } } PickupQualityTier = qualityTier; trySpawnQualityEffectServer(PickupQualityTier); } private void OnDestroy() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) QualityTierDef qualityTierDef = QualityCatalog.GetQualityTierDef(PickupQualityTier); if (Object.op_Implicit((Object)(object)qualityTierDef) && Object.op_Implicit((Object)(object)qualityTierDef.pickupLandSound)) { PointSoundManager.EmitSoundLocal(AkEventIdArg.op_Implicit(qualityTierDef.pickupLandSound.akId), ((Component)this).transform.position); } } [Server] private void trySpawnQualityEffectServer(QualityTier qualityTier) { //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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void ItemQualities.QualityItemDropletEffectController::trySpawnQualityEffectServer(ItemQualities.QualityTier)' called on client"); return; } QualityTierDef qualityTierDef = QualityCatalog.GetQualityTierDef(qualityTier); if (Object.op_Implicit((Object)(object)qualityTierDef)) { EffectData val = new EffectData { origin = _dropletController.createPickupInfo.position }; Vector3 val2 = Vector3.zero; Rigidbody val3 = default(Rigidbody); if (((Component)this).TryGetComponent(ref val3)) { val2 = val3.velocity; } if (((Vector3)(ref val2)).sqrMagnitude > 0f) { val.rotation = Quaternion.FromToRotation(Vector3.up, ((Vector3)(ref val2)).normalized); } else { val.rotation = _dropletController.createPickupInfo.rotation; } EffectManager.SpawnEffect(qualityTierDef.ChestOpenEffectPrefab, val, true); } } private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { if (forceAll) { writer.WritePackedUInt32(_pickupQualityTierInt); return true; } bool flag = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32(_pickupQualityTierInt); } if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { if (initialState) { _pickupQualityTierInt = reader.ReadPackedUInt32(); return; } int num = (int)reader.ReadPackedUInt32(); if (((uint)num & (true ? 1u : 0u)) != 0) { _pickupQualityTierInt = reader.ReadPackedUInt32(); } } public override void PreStartClient() { } } internal static class QualityItemInventoryCopyHandler { [SystemInitializer(new Type[] { })] private static void Init() { //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 Inventory.AddItemsFrom_Int32Array_Func2 += new Manipulator(Inventory_AddItemsFrom_Int32Array_Func2); Inventory.AddItemsFrom_Inventory_Func2 += new Manipulator(Inventory_AddItemsFrom_Inventory_Func2); } private static int calculateBonusItemCountFromQualities(ItemIndex itemIndex, in ItemQualityCounts itemCounts, Func filter) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) QualityTier qualityTier = QualityCatalog.GetQualityTier(itemIndex); int num = 0; for (QualityTier qualityTier2 = qualityTier + 1; qualityTier2 < QualityTier.Count; qualityTier2++) { ItemIndex itemIndexOfQuality = QualityCatalog.GetItemIndexOfQuality(itemIndex, qualityTier2); if (itemIndexOfQuality != itemIndex) { if (filter(itemIndexOfQuality)) { return 0; } num += itemCounts[qualityTier2]; } } return num; } private static void Inventory_AddItemsFrom_Int32Array_Func2(ILContext il) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_00b9: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter>(out var parameter)) { Log.Error("Failed to find filter parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityItemInventoryCopyHandler.cs", "Inventory_AddItemsFrom_Int32Array_Func2", 51); return; } ILCursor val = new ILCursor(il); ParameterDefinition otherItemStacksParameter = null; VariableDefinition itemIndexVar = null; if (!val.TryGotoNext((MoveType)2, new Func[3] { (Instruction x) => x.MatchLdarg(il, out otherItemStacksParameter), (Instruction x) => x.MatchLdloc(il, out itemIndexVar), (Instruction x) => ILPatternMatchingExt.MatchLdelemI4(x) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityItemInventoryCopyHandler.cs", "Inventory_AddItemsFrom_Int32Array_Func2", 72); return; } val.Emit(OpCodes.Ldarg, otherItemStacksParameter); val.Emit(OpCodes.Ldarg, parameter); val.Emit(OpCodes.Ldloc, itemIndexVar); val.EmitDelegate, ItemIndex, int>>((Func, ItemIndex, int>)getBonusItemCount); val.Emit(OpCodes.Add); static int getBonusItemCount(int[] otherItemStacks, Func filter, ItemIndex itemIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) ItemQualityGroupIndex itemQualityGroupIndex = QualityCatalog.FindItemQualityGroupIndex(itemIndex); if (itemQualityGroupIndex != ItemQualityGroupIndex.Invalid) { ItemQualityGroup itemQualityGroup = QualityCatalog.GetItemQualityGroup(itemQualityGroupIndex); ItemQualityCounts itemCounts = default(ItemQualityCounts); for (QualityTier qualityTier = QualityTier.None; qualityTier < QualityTier.Count; qualityTier++) { ItemIndex itemIndex2 = itemQualityGroup.GetItemIndex(qualityTier); if ((int)itemIndex2 != -1) { itemCounts[qualityTier] = otherItemStacks[itemIndex2]; } } int result = calculateBonusItemCountFromQualities(itemIndex, in itemCounts, filter); _ = 0; return result; } return 0; } } private static void Inventory_AddItemsFrom_Inventory_Func2(ILContext il) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter("other", out var otherInventoryParameter)) { Log.Error("Failed to find other inventory parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityItemInventoryCopyHandler.cs", "Inventory_AddItemsFrom_Inventory_Func2", 115); return; } if (!((MethodReference)(object)il.Method).TryFindParameter>(out var parameter)) { Log.Error("Failed to find filter parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityItemInventoryCopyHandler.cs", "Inventory_AddItemsFrom_Inventory_Func2", 121); return; } ILCursor val = new ILCursor(il); VariableDefinition nonZeroIndicesVar = null; if (val.TryGotoNext((MoveType)2, new Func[4] { (Instruction x) => x.MatchLdarg(otherInventoryParameter), (Instruction x) => ILPatternMatchingExt.MatchLdflda(x, "permanentItemStacks"), (Instruction x) => x.MatchLdloc>(il, out nonZeroIndicesVar), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "GetNonZeroIndices") })) { val.Emit(OpCodes.Ldarg, otherInventoryParameter); val.Emit(OpCodes.Ldarg, parameter); val.Emit(OpCodes.Ldloc, nonZeroIndicesVar); val.EmitDelegate, List>>((Action, List>)fixNonZeroIndices); } else { Log.Warning("Failed to find NonZeroIndices patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityItemInventoryCopyHandler.cs", "Inventory_AddItemsFrom_Inventory_Func2", 199); } VariableDefinition itemIndexVar = null; if (!val.TryGotoNext((MoveType)2, new Func[4] { (Instruction x) => x.MatchLdarg(otherInventoryParameter), (Instruction x) => ILPatternMatchingExt.MatchLdflda(x, "permanentItemStacks"), (Instruction x) => x.MatchLdloc(il, out itemIndexVar), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "GetStackValue") })) { Log.Error("Failed to find stack value patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityItemInventoryCopyHandler.cs", "Inventory_AddItemsFrom_Inventory_Func2", 217); return; } val.Emit(OpCodes.Ldarg, otherInventoryParameter); val.Emit(OpCodes.Ldarg, parameter); val.Emit(OpCodes.Ldloc, itemIndexVar); val.EmitDelegate, ItemIndex, int>>((Func, ItemIndex, int>)getBonusItemCount); val.Emit(OpCodes.Add); static void fixNonZeroIndices(Inventory otherInventory, Func filter, List nonZeroItemIndices) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Invalid comparison between Unknown and I4 //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Invalid comparison between Unknown and I4 //IL_0084: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) for (int num = nonZeroItemIndices.Count - 1; num >= 0; num--) { ItemIndex val2 = nonZeroItemIndices[num]; ItemQualityGroupIndex itemQualityGroupIndex2 = QualityCatalog.FindItemQualityGroupIndex(val2); if (itemQualityGroupIndex2 != ItemQualityGroupIndex.Invalid && !filter(val2)) { ItemQualityGroup itemQualityGroup = QualityCatalog.GetItemQualityGroup(itemQualityGroupIndex2); QualityTier qualityTier = QualityCatalog.GetQualityTier(val2); if (qualityTier != QualityTier.None) { QualityTier qualityTier2 = qualityTier - 1; ItemIndex val3 = itemQualityGroup.GetItemIndex(qualityTier2); while (qualityTier2 >= QualityTier.None && ((int)val3 == -1 || !filter(val3))) { if (qualityTier2 == QualityTier.None) { val3 = (ItemIndex)(-1); break; } qualityTier2--; val3 = itemQualityGroup.GetItemIndex(qualityTier2); } if ((int)val3 != -1 && !nonZeroItemIndices.Contains(val3)) { nonZeroItemIndices.Add(val3); } } } } } static int getBonusItemCount(Inventory otherInventory, Func filter, ItemIndex itemIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) ItemQualityGroupIndex itemQualityGroupIndex = QualityCatalog.FindItemQualityGroupIndex(itemIndex); if (itemQualityGroupIndex != ItemQualityGroupIndex.Invalid) { ItemQualityCounts itemCounts = otherInventory.GetItemCountsPermanent(itemQualityGroupIndex); int result = calculateBonusItemCountFromQualities(itemIndex, in itemCounts, filter); _ = 0; return result; } return 0; } } } internal static class QualityItemOrderPatch { private static readonly IComparer _itemQualityComparer = Comparer.Create(delegate(ItemIndex a, ItemIndex b) { //IL_0000: 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) QualityTier qualityTier = QualityCatalog.GetQualityTier(a); QualityTier qualityTier2 = QualityCatalog.GetQualityTier(b); return qualityTier - qualityTier2; }); [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown Inventory.SetItemAcquiredServer += new Manipulator(Inventory_SetItemAcquiredServer); Configs.Interface.EnableQualityItemSorting.SettingChanged += onEnableQualityItemSortingChanged; } private static void onEnableQualityItemSortingChanged(object sender, EventArgs e) { if (Configs.Interface.EnableQualityItemSorting.Value && NetworkServer.active) { Inventory[] array = Object.FindObjectsByType((FindObjectsInactive)1, (FindObjectsSortMode)0); for (int i = 0; i < array.Length; i++) { sortAllQualityItems(array[i]); } } } private static void sortAllQualityItems(Inventory inventory) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) List list = default(List); DisposableRental> val = CollectionPool>.RentCollection(ref list); try { list.AddRange(inventory.itemAcquisitionOrder); bool flag = false; try { List list2 = default(List); DisposableRental> val2 = CollectionPool>.RentCollection(ref list2); try { for (int i = 0; i < list.Count; i++) { ItemQualityGroupIndex itemQualityGroupIndex = QualityCatalog.FindItemQualityGroupIndex(list[i]); if (itemQualityGroupIndex != ItemQualityGroupIndex.Invalid) { extractAndSortAllItemsInGroup(itemQualityGroupIndex, i, list, list2, out var firstFoundIndex); list.InsertRange(firstFoundIndex, list2); i = Math.Max(i, firstFoundIndex) + list2.Count - 1; list2.Clear(); flag = true; } } } finally { val2.Dispose(); } } catch (Exception ex) { Log.Error_NoCallerPrefix(ex.ToString()); return; } if (flag) { inventory.itemAcquisitionOrder.Clear(); inventory.itemAcquisitionOrder.AddRange(list); ((NetworkBehaviour)inventory).SetDirtyBit(8u); inventory.HandleInventoryChanged(); } } finally { val.Dispose(); } } private static void sortQualityItem(Inventory inventory, ItemQualityGroupIndex itemGroupIndex) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) List list = default(List); DisposableRental> val = CollectionPool>.RentCollection(ref list); try { list.AddRange(inventory.itemAcquisitionOrder); bool flag = false; try { List list2 = default(List); DisposableRental> val2 = CollectionPool>.RentCollection(ref list2); try { extractAndSortAllItemsInGroup(itemGroupIndex, 0, list, list2, out var firstFoundIndex); if (list2.Count > 0) { list.InsertRange(firstFoundIndex, list2); flag = true; } } finally { val2.Dispose(); } } catch (Exception ex) { Log.Error_NoCallerPrefix(ex.ToString()); return; } if (flag) { inventory.itemAcquisitionOrder.Clear(); inventory.itemAcquisitionOrder.AddRange(list); ((NetworkBehaviour)inventory).SetDirtyBit(8u); inventory.HandleInventoryChanged(); } } finally { val.Dispose(); } } private static void extractAndSortAllItemsInGroup(ItemQualityGroupIndex itemGroupIndex, int startSearchIndex, List itemsList, List extractedGroup, out int firstFoundIndex) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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) firstFoundIndex = -1; for (int i = startSearchIndex; i < itemsList.Count; i++) { ItemIndex itemIndex2 = itemsList[i]; if (QualityCatalog.FindItemQualityGroupIndex(itemIndex2) == itemGroupIndex) { if (firstFoundIndex == -1) { firstFoundIndex = i; } recordItemInGroup(itemIndex2); itemsList.RemoveAt(i); i--; if (extractedGroup.Count >= 5) { break; } } } void recordItemInGroup(ItemIndex itemIndex) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) int num = extractedGroup.BinarySearch(itemIndex, _itemQualityComparer); if (num < 0) { num = ~num; } extractedGroup.Insert(num, itemIndex); } } private static void Inventory_SetItemAcquiredServer(ILContext il) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) MethodInfo itemIndexListAddMethod = typeof(List).GetMethod("Add"); if (itemIndexListAddMethod == null) { Log.Error("Failed to find List index getter method", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityItemOrderPatch.cs", "Inventory_SetItemAcquiredServer", 162); return; } ILCursor val = new ILCursor(il); int itemIndexParameterIndex = -1; if (!val.TryGotoNext((MoveType)2, new Func[4] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "itemAcquisitionOrder"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, ref itemIndexParameterIndex), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)itemIndexListAddMethod) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityItemOrderPatch.cs", "Inventory_SetItemAcquiredServer", 175); return; } val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg, itemIndexParameterIndex); val.EmitDelegate>((Action)tryCustomInsertIndex); static void tryCustomInsertIndex(Inventory inventory, ItemIndex itemIndex) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (Configs.Interface.EnableQualityItemSorting.Value) { ItemQualityGroupIndex itemQualityGroupIndex = QualityCatalog.FindItemQualityGroupIndex(itemIndex); if (itemQualityGroupIndex != ItemQualityGroupIndex.Invalid) { sortQualityItem(inventory, itemQualityGroupIndex); } } } } } public sealed class QualityPickupDisplayController : MonoBehaviour { public SpriteRenderer QualityIconRenderer; public GameObject QualityItemEffect; public Renderer[] Renderers = Array.Empty(); private PickupDisplay _pickupDisplay; private PickupIndex _lastPickupIndex = PickupIndex.none; [SystemInitializer(new Type[] { })] private static void Init() { //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 PickupDisplay.Start += new hook_Start(PickupDisplay_Start); PickupDisplay.RebuildModel += new hook_RebuildModel(PickupDisplay_RebuildModel); } private static void PickupDisplay_Start(orig_Start orig, PickupDisplay self) { orig.Invoke(self); Object.Instantiate(ItemQualitiesContent.Prefabs.QualityPickupDisplay, ((Component)self).transform).GetComponent()._pickupDisplay = self; } private static void PickupDisplay_RebuildModel(orig_RebuildModel orig, PickupDisplay self, GameObject modelObjectOverride) { orig.Invoke(self, modelObjectOverride); QualityPickupDisplayController componentInChildren = ((Component)self).GetComponentInChildren(); if (Object.op_Implicit((Object)(object)componentInChildren)) { self.modelRenderers.AddRange(componentInChildren.Renderers); } } private void Awake() { if (!Object.op_Implicit((Object)(object)_pickupDisplay)) { _pickupDisplay = ((Component)this).GetComponentInParent(); } } private void OnEnable() { _pickupDisplay.modelRenderers?.AddRange(Renderers); refreshQualityIcon(); } private void OnDisable() { _pickupDisplay.modelRenderers?.RemoveAll((Renderer r) => Array.IndexOf(Renderers, r) != -1); } private void FixedUpdate() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) PickupIndex val = (Object.op_Implicit((Object)(object)_pickupDisplay) ? _pickupDisplay.pickupState.pickupIndex : PickupIndex.none); if (_lastPickupIndex != val) { refreshQualityIcon(); } } private void refreshQualityIcon() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) PickupIndex val = (Object.op_Implicit((Object)(object)_pickupDisplay) ? _pickupDisplay.pickupState.pickupIndex : PickupIndex.none); PickupDef pickupDef = PickupCatalog.GetPickupDef(val); QualityTier qualityTier = QualityCatalog.GetQualityTier(val); QualityTierDef qualityTierDef = QualityCatalog.GetQualityTierDef(qualityTier); Sprite sprite = null; if (Object.op_Implicit((Object)(object)qualityTierDef)) { sprite = qualityTierDef.icon; bool flag = false; if (pickupDef != null) { ItemDef itemDef = ItemCatalog.GetItemDef(pickupDef.itemIndex); if (Object.op_Implicit((Object)(object)itemDef) && itemDef.isConsumed) { flag = true; } } if (flag && Object.op_Implicit((Object)(object)qualityTierDef.consumedIcon)) { sprite = qualityTierDef.consumedIcon; } } QualityIconRenderer.sprite = sprite; if (Object.op_Implicit((Object)(object)QualityItemEffect)) { QualityItemEffect.SetActive(qualityTier > QualityTier.None); } _lastPickupIndex = val; } } [CreateAssetMenu(menuName = "ItemQualities/DropTable/QualityPickupDropTable")] public sealed class QualityPickupDropTable : PickupDropTable { [Header("Pickups")] public ItemTag[] RequiredItemTags = Array.Empty(); public ItemTag[] BannedItemTags = Array.Empty(); public float Tier1Weight = 0.8f; public float Tier2Weight = 0.2f; public float Tier3Weight = 0.01f; public float BossWeight; public float LunarEquipmentWeight; public float LunarItemWeight; public float LunarCombinedWeight; public float EquipmentWeight; public float VoidTier1Weight; public float VoidTier2Weight; public float VoidTier3Weight; public float VoidBossWeight; [Header("Quality")] [Tooltip("If set, all pickups added to the droptable must have all quality tiers implemented, regardless of the quality tier weights")] public bool RequireAllQualitiesImplemented; public float BaseQualityWeight; public float UncommonQualityWeight = 0.7f; public float RareQualityWeight = 0.2f; public float EpicQualityWeight = 0.08f; public float LegendaryQualityWeight = 0.02f; private readonly WeightedSelection _selector = new WeightedSelection(8); private readonly WeightedSelection _qualityTierSelection = new WeightedSelection(8); public override void Regenerate(Run run) { generateWeightedSelection(run); } public void RegenerateDropTable(Run run) { generateWeightedSelection(run); } public bool IsFilterRequired() { if (RequiredItemTags.Length == 0 && BannedItemTags.Length == 0) { return RequireAllQualitiesImplemented; } return true; } public bool PassesFilter(PickupIndex pickupIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Invalid comparison between Unknown and I4 //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Invalid comparison between Unknown and I4 //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Invalid comparison between Unknown and I4 PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex); if ((int)pickupDef.itemIndex != -1) { ItemDef itemDef = ItemCatalog.GetItemDef(pickupDef.itemIndex); ItemTag[] requiredItemTags = RequiredItemTags; foreach (ItemTag value in requiredItemTags) { if (Array.IndexOf(itemDef.tags, value) == -1) { return false; } } requiredItemTags = BannedItemTags; foreach (ItemTag value2 in requiredItemTags) { if (Array.IndexOf(itemDef.tags, value2) != -1) { return false; } } if (RequireAllQualitiesImplemented) { ItemQualityGroup itemQualityGroup = QualityCatalog.GetItemQualityGroup(QualityCatalog.FindItemQualityGroupIndex(pickupDef.itemIndex)); if (!Object.op_Implicit((Object)(object)itemQualityGroup)) { return false; } for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { if ((int)itemQualityGroup.GetItemIndex(qualityTier) == -1) { return false; } } } } else if ((int)pickupDef.equipmentIndex != -1 && RequireAllQualitiesImplemented) { EquipmentQualityGroup equipmentQualityGroup = QualityCatalog.GetEquipmentQualityGroup(QualityCatalog.FindEquipmentQualityGroupIndex(pickupDef.equipmentIndex)); if (!Object.op_Implicit((Object)(object)equipmentQualityGroup)) { return false; } for (QualityTier qualityTier2 = QualityTier.Uncommon; qualityTier2 < QualityTier.Count; qualityTier2++) { if ((int)equipmentQualityGroup.GetEquipmentIndex(qualityTier2) == -1) { return false; } } } return true; } private void generateWeightedSelection(Run run) { _selector.Clear(); addPickups(run.availableTier1DropList, Tier1Weight); addPickups(run.availableTier2DropList, Tier2Weight); addPickups(run.availableTier3DropList, Tier3Weight); addPickups(run.availableBossDropList, BossWeight); addPickups(run.availableLunarItemDropList, LunarItemWeight); addPickups(run.availableLunarEquipmentDropList, LunarEquipmentWeight); addPickups(run.availableLunarCombinedDropList, LunarCombinedWeight); addPickups(run.availableEquipmentDropList, EquipmentWeight); addPickups(run.availableVoidTier1DropList, VoidTier1Weight); addPickups(run.availableVoidTier2DropList, VoidTier2Weight); addPickups(run.availableVoidTier3DropList, VoidTier3Weight); addPickups(run.availableVoidBossDropList, VoidBossWeight); _qualityTierSelection.Clear(); addQuality(QualityTier.None, BaseQualityWeight); addQuality(QualityTier.Uncommon, UncommonQualityWeight); addQuality(QualityTier.Rare, RareQualityWeight); addQuality(QualityTier.Epic, EpicQualityWeight); addQuality(QualityTier.Legendary, LegendaryQualityWeight); void addPickups(List sourceDropList, float weight) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (weight <= 0f || sourceDropList.Count == 0) { return; } foreach (PickupIndex sourceDrop in sourceDropList) { PickupIndex pickupIndex = sourceDrop; if ((!IsFilterRequired() || PassesFilter(pickupIndex)) && QualityCatalog.GetQualityTier(pickupIndex) == QualityTier.None) { tryAddQualityChoice(QualityTier.None, BaseQualityWeight); tryAddQualityChoice(QualityTier.Uncommon, UncommonQualityWeight); tryAddQualityChoice(QualityTier.Rare, RareQualityWeight); tryAddQualityChoice(QualityTier.Epic, EpicQualityWeight); tryAddQualityChoice(QualityTier.Legendary, LegendaryQualityWeight); } void tryAddQualityChoice(QualityTier qualityTier, float qualityWeight) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (!(qualityWeight <= 0f)) { PickupIndex pickupIndexOfQuality = QualityCatalog.GetPickupIndexOfQuality(pickupIndex, qualityTier); if (!(pickupIndexOfQuality == PickupIndex.none) && (!Object.op_Implicit((Object)(object)Run.instance) || Run.instance.ruleBook == null || Run.instance.ruleBook.IsPickupRuleEnabled(pickupIndexOfQuality)) && (qualityTier == QualityTier.None || pickupIndexOfQuality != pickupIndex)) { _selector.AddChoice(new UniquePickup(pickupIndexOfQuality), weight * qualityWeight); } } } } } void addQuality(QualityTier qualityTier, float weight) { if (!(weight <= 0f)) { _qualityTierSelection.AddChoice(qualityTier, weight); } } } private QualityTier rollQuality(Xoroshiro128Plus rng) { return _qualityTierSelection.Evaluate(rng.nextNormalizedFloat); } private PickupIndex tryRerollQuality(PickupIndex pickupIndex, Xoroshiro128Plus rng, int qualityLuck) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) QualityTier qualityTier = QualityCatalog.GetQualityTier(pickupIndex); for (int i = 0; i < qualityLuck; i++) { QualityTier qualityTier2 = rollQuality(rng); PickupIndex pickupIndexOfQuality = QualityCatalog.GetPickupIndexOfQuality(pickupIndex, qualityTier2); if (qualityTier2 > qualityTier && (!IsFilterRequired() || PassesFilter(pickupIndexOfQuality))) { pickupIndex = pickupIndexOfQuality; qualityTier = qualityTier2; } } return pickupIndex; } public override UniquePickup GeneratePickupPreReplacement(Xoroshiro128Plus rng) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) rng = new Xoroshiro128Plus(rng.nextUlong); UniquePickup val = PickupDropTable.GeneratePickupFromWeightedSelection(rng, _selector); PickupRollInfo currentPickupRollInfo = DropTableQualityHandler.GetCurrentPickupRollInfo(); val = ((UniquePickup)(ref val)).WithPickupIndex(tryRerollQuality(val.pickupIndex, rng, currentPickupRollInfo.Luck)); return val; } public override void GenerateDistinctPickupsPreReplacement(List dest, int desiredCount, Xoroshiro128Plus rng) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) rng = new Xoroshiro128Plus(rng.nextUlong); PickupDropTable.GenerateDistinctFromWeightedSelection(dest, desiredCount, rng, _selector); PickupRollInfo currentPickupRollInfo = DropTableQualityHandler.GetCurrentPickupRollInfo(); for (int i = 0; i < dest.Count; i++) { UniquePickup val = dest[i]; bool flag = false; if (((UniquePickup)(ref val)).isValid) { PickupIndex val2 = tryRerollQuality(val.pickupIndex, rng, currentPickupRollInfo.Luck); if (val2 != val.pickupIndex) { val = ((UniquePickup)(ref val)).WithPickupIndex(val2); flag = true; } } if (flag) { dest[i] = val; } } } public override int GetPickupCount() { return _selector.Count; } } internal static class QualityPickupTransmutationPatcher { [InitDuringStartupPhase(/*Could not decode attribute arguments.*/)] private static void Init() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown SystemInitializerInjector.InjectDependency(typeof(PickupTransmutationManager), typeof(QualityCatalog)); PickupTransmutationManager.RebuildPickupGroups += new hook_RebuildPickupGroups(PickupTransmutationManager_RebuildPickupGroups); Util.RollTemporaryItemFromItemIndex += new hook_RollTemporaryItemFromItemIndex(Util_RollTemporaryItemFromItemIndex); } private static void PickupTransmutationManager_RebuildPickupGroups(orig_RebuildPickupGroups orig) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011c: 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_012f: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(); List list = new List(); List list2 = new List(); PickupIndex[][] pickupGroups = PickupTransmutationManager.pickupGroups; foreach (PickupIndex[] array in pickupGroups) { ListUtils.EnsureCapacity(list2, array.Length); for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { PickupIndex[] array2 = array; foreach (PickupIndex val in array2) { PickupIndex pickupIndexOfQuality = QualityCatalog.GetPickupIndexOfQuality(val, qualityTier); if (((PickupIndex)(ref pickupIndexOfQuality)).isValid && pickupIndexOfQuality != val) { PickupIndex[] safe = ArrayUtils.GetSafe(PickupTransmutationManager.pickupGroupMap, pickupIndexOfQuality.value); if (safe == null || safe.Length == 0) { list2.Add(pickupIndexOfQuality); } } } if (list2.Count > 0) { list.Add(list2.ToArray()); list2.Clear(); } } } if (list.Count <= 0) { return; } PickupTransmutationManager.pickupGroups = ArrayUtils.Join(PickupTransmutationManager.pickupGroups, list.ToArray()); foreach (PickupIndex[] item in list) { PickupIndex[] array2 = item; foreach (PickupIndex val2 in array2) { if (ArrayUtils.IsInBounds(PickupTransmutationManager.pickupGroupMap, val2.value)) { PickupTransmutationManager.pickupGroupMap[val2.value] = item; } } } } private static ItemIndex Util_RollTemporaryItemFromItemIndex(orig_RollTemporaryItemFromItemIndex orig, ItemIndex itemIndex) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return orig.Invoke(QualityCatalog.GetItemIndexOfQuality(itemIndex, QualityTier.None)); } } internal static class QualityTempItemHandler { [SystemInitializer(new Type[] { })] private static void Init() { //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 Surprise.DropTempItemServer += new Manipulator(Surprise_DropTempItemServer); Salvage.DropTempItemServer += new Manipulator(Salvage_DropTempItemServer); } private static void Surprise_DropTempItemServer(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((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "GeneratePickup") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityTempItemHandler.cs", "Surprise_DropTempItemServer", 25); } else { val.EmitDelegate>((Func)clampPickupQuality); } static UniquePickup clampPickupQuality(UniquePickup pickup) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return pickup.WithQualityTier(QualityTier.None); } } private static void Salvage_DropTempItemServer(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((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "GeneratePickup") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityTempItemHandler.cs", "Salvage_DropTempItemServer", 44); } else { val.EmitDelegate>((Func)clampPickupQuality); } static UniquePickup clampPickupQuality(UniquePickup pickup) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return pickup.WithQualityTier(QualityTier.None); } } } public enum QualityTier { None = -1, Uncommon, Rare, Epic, Legendary, Count } [DisallowMultipleComponent] public sealed class QualityTierContext : MonoBehaviour { public QualityTier QualityTier = QualityTier.None; private void Awake() { ComponentCache.Add(((Component)this).gameObject, this); } private void OnDestroy() { ComponentCache.Remove(((Component)this).gameObject, this); } public static QualityTier GetQualityTier(GameObject gameObject) { if (!Object.op_Implicit((Object)(object)gameObject) || !gameObject.TryGetComponentCached(out QualityTierContext component)) { return QualityTier.None; } return component.QualityTier; } } [CreateAssetMenu(menuName = "ItemQualities/QualityTierDef")] public sealed class QualityTierDef : ScriptableObject { public QualityTier qualityTier = QualityTier.None; public string modifierToken = string.Empty; public string consumedModifierToken = string.Empty; public Color color; public Texture2D colorRampTexture; public Sprite icon; public Sprite consumedIcon; public GameObject ChestOpenEffectPrefab; public NetworkSoundEventDef pickupDropSound; public NetworkSoundEventDef pickupLandSound; } public sealed class RandomBugFlyMovement : MonoBehaviour { private enum State : byte { Idle, Moving } private Vector3 _basePosition; [Tooltip("The maximum distance from the center position the bug can move")] public float MaxDistance; [Tooltip("The minimum amount of time to stay in any given position")] public float PauseDurationMin; [Tooltip("The maximum amount of time to stay in any given position")] public float PauseDurationMax; [Tooltip("How fast to move towards a new position")] public float MoveSpeed; [Tooltip("If set, this object's forward vector will be set to match the current movement direction")] public bool FaceMoveDirection; public AnimationCurve MoveCurve = AnimationCurve.Linear(0f, 0f, 1f, 1f); private State _currentState; private float _timer; private float _moveTotalDuration; private Vector3 _lastPosition; private Vector3 _targetPosition; private void OnEnable() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) _basePosition = ((Component)this).transform.localPosition; setState(State.Idle); } private void OnDisable() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.localPosition = _basePosition; } private void FixedUpdate() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) switch (_currentState) { case State.Idle: _timer -= Time.fixedDeltaTime; if (_timer <= 0f) { setState(State.Moving); } break; case State.Moving: { _timer -= Time.fixedDeltaTime; float num = MoveCurve.Evaluate(1f - _timer / _moveTotalDuration); ((Component)this).transform.localPosition = Vector3.Lerp(_lastPosition, _targetPosition, num); if (_timer <= 0f) { setState(State.Idle); } break; } } } private void setState(State state) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) _currentState = state; switch (_currentState) { case State.Idle: _timer = Random.Range(PauseDurationMin, PauseDurationMax); break; case State.Moving: { _lastPosition = ((Component)this).transform.localPosition; _targetPosition = _basePosition + Random.insideUnitSphere * MaxDistance; Vector3 val = _lastPosition - _targetPosition; _moveTotalDuration = ((Vector3)(ref val)).magnitude / MoveSpeed; _timer = _moveTotalDuration; if (FaceMoveDirection) { Vector3 val2 = val; val2.y = 0f; ((Component)this).transform.forward = ((Component)this).transform.TransformDirection(((Vector3)(ref val2)).normalized); } break; } } } } [RequireComponent(typeof(GenericNetworkedObjectAttachment))] public sealed class RecyclableObject : NetworkBehaviour, INetworkedObjectAttachmentListener { private static EffectIndex _recycleEffectIndex = (EffectIndex)(-1); private static int[] _recyclableInteractableIndices = Array.Empty(); public int MaxRecycles = 1; [SyncVar] private int _numRecycles; public Transform IndicatorTransform; private GenericNetworkedObjectAttachment _objectAttachment; private TinkerableObjectAttributes _tinkerAttributes; private PurchaseInteraction _purchaseInteraction; private ShopTerminalBehavior _shopTerminalBehavior; private SpecialObjectAttributes _specialObjectAttributes; public bool IsRecyclable { get { if (_numRecycles >= MaxRecycles) { return false; } if (!Object.op_Implicit((Object)(object)InteractableObject)) { return false; } if (Object.op_Implicit((Object)(object)_tinkerAttributes) && _tinkerAttributes.tinkers > 0) { return false; } if (Object.op_Implicit((Object)(object)_purchaseInteraction) && !_purchaseInteraction.available) { return false; } if (Object.op_Implicit((Object)(object)_shopTerminalBehavior) && _shopTerminalBehavior.pickupIndexIsHidden) { return false; } if (Object.op_Implicit((Object)(object)_specialObjectAttributes) && !_specialObjectAttributes.isTargetable) { return false; } return true; } } public GameObject InteractableObject { get { if (!Object.op_Implicit((Object)(object)_objectAttachment)) { return null; } return _objectAttachment.AttachedToObject; } } public int Network_numRecycles { get { return _numRecycles; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref _numRecycles, 1u); } } [SystemInitializer(new Type[] { typeof(EffectCatalogUtils), typeof(InteractableCatalog), typeof(CustomInteractableHandler) })] private static void Init() { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_0076: Unknown result type (might be due to invalid IL or missing references) _recycleEffectIndex = EffectCatalogUtils.FindEffectIndex("OmniRecycleEffect"); if ((int)_recycleEffectIndex == -1) { Log.Warning("Failed to find recycle effect index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\RecyclableObject.cs", "Init", 22); } List list = new List(InteractableCatalog.InteractableCount); ShopTerminalBehavior val = default(ShopTerminalBehavior); PurchaseInteraction val2 = default(PurchaseInteraction); for (int i = 0; i < InteractableCatalog.InteractableCount; i++) { InteractableDef interactableDef = InteractableCatalog.GetInteractableDef(i); if (interactableDef.Name.Contains("Duplicator", StringComparison.OrdinalIgnoreCase) && interactableDef.Prefab.TryGetComponent(ref val) && interactableDef.Prefab.TryGetComponent(ref val2) && CustomCostTypeIndex.IsQualityItemCostType(val2.costType)) { list.Add(i); } } if (list.Count > 0) { _recyclableInteractableIndices = list.ToArray(); Array.Sort(_recyclableInteractableIndices); InteractableInfoProvider.OnCatalogedInteractableStartGlobal += onCatalogedInteractableStartGlobal; } } private static void onCatalogedInteractableStartGlobal(InteractableInfoProvider interactableInfo) { if (NetworkServer.active && Array.BinarySearch(_recyclableInteractableIndices, interactableInfo.CatalogIndex) >= 0) { Object.Instantiate(ItemQualitiesContent.NetworkedPrefabs.RecyclableObjectAttachment).GetComponent().AttachToGameObjectAndSpawn(((Component)interactableInfo).gameObject); } } private void Awake() { _objectAttachment = ((Component)this).GetComponent(); if (!Object.op_Implicit((Object)(object)IndicatorTransform)) { IndicatorTransform = ((Component)this).transform; } } private void OnEnable() { InstanceTracker.Add(this); } private void OnDisable() { InstanceTracker.Remove(this); } [Server] public void DoRecycle() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Invalid comparison between Unknown and I4 //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void ItemQualities.RecyclableObject::DoRecycle()' called on client"); return; } if (Object.op_Implicit((Object)(object)_shopTerminalBehavior)) { _shopTerminalBehavior.RerollPickup(); } Network_numRecycles = _numRecycles + 1; if (Object.op_Implicit((Object)(object)_tinkerAttributes) && _tinkerAttributes.tinkers < _tinkerAttributes.maxTinkers) { _tinkerAttributes.Networktinkers = _tinkerAttributes.tinkers + 1; } if ((int)_recycleEffectIndex != -1) { EffectManager.SpawnEffect(_recycleEffectIndex, new EffectData { origin = IndicatorTransform.position }, true); } } void INetworkedObjectAttachmentListener.OnAttachedObjectDiscovered(GenericNetworkedObjectAttachment attachment, GameObject attachedObject) { _tinkerAttributes = (Object.op_Implicit((Object)(object)attachedObject) ? attachedObject.GetComponent() : null); _purchaseInteraction = (Object.op_Implicit((Object)(object)attachedObject) ? attachedObject.GetComponent() : null); _shopTerminalBehavior = (Object.op_Implicit((Object)(object)attachedObject) ? attachedObject.GetComponent() : null); _specialObjectAttributes = (Object.op_Implicit((Object)(object)attachedObject) ? attachedObject.GetComponent() : null); Transform indicatorTransform = ((Component)this).transform; if (Object.op_Implicit((Object)(object)_shopTerminalBehavior) && Object.op_Implicit((Object)(object)_shopTerminalBehavior.pickupDisplay)) { indicatorTransform = ((Component)_shopTerminalBehavior.pickupDisplay).transform; } else if (Object.op_Implicit((Object)(object)_tinkerAttributes) && Object.op_Implicit((Object)(object)_tinkerAttributes.indicatorOffset)) { indicatorTransform = _tinkerAttributes.indicatorOffset; } IndicatorTransform = indicatorTransform; } private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { if (forceAll) { writer.WritePackedUInt32((uint)_numRecycles); return true; } bool flag = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32((uint)_numRecycles); } if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { if (initialState) { _numRecycles = (int)reader.ReadPackedUInt32(); return; } int num = (int)reader.ReadPackedUInt32(); if (((uint)num & (true ? 1u : 0u)) != 0) { _numRecycles = (int)reader.ReadPackedUInt32(); } } public override void PreStartClient() { } } public sealed class RecyclableObjectSearch : BaseDirectionalSearch { public static readonly RecyclableObjectSearch SharedInstance = new RecyclableObjectSearch(); public ref bool RequireRecyclable { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return ref base.candidateFilter.RequireRecyclable; } } public RecyclableObjectSearch(RecyclableObjectSearchSelector selector, RecyclableObjectSearchFilter candidateFilter) : base(selector, candidateFilter) { } public RecyclableObjectSearch() : base(default(RecyclableObjectSearchSelector), default(RecyclableObjectSearchFilter)) { } } [StructLayout(LayoutKind.Sequential, Size = 1)] public readonly struct RecyclableObjectSearchSelector : IGenericWorldSearchSelector { public GameObject GetRootObject(RecyclableObject source) { return source.InteractableObject; } public Transform GetTransform(RecyclableObject source) { return source.IndicatorTransform; } } public struct RecyclableObjectSearchFilter : IGenericDirectionalSearchFilter { public bool RequireRecyclable; public readonly bool PassesFilter(RecyclableObject candidateInfo) { if (RequireRecyclable) { return candidateInfo.IsRecyclable; } return true; } } [RequireComponent(typeof(NetworkedBodyAttachment))] public sealed class RepeatCleanseAttachment : MonoBehaviour { public bool CleanseDebuffs; public bool CleanseBuffs; public bool CleanseCooldownBuffs; public bool CleanseDots; public bool CleanseStun; public bool CleanseNearbyProjectiles; [Min(0f)] public float CleanseInterval = 0.2f; public int CleansesRemaining; public AssetReferenceGameObject CleanseEffectPrefabReference = new AssetReferenceGameObject(string.Empty); [Min(0f)] public float CleanseEffectInterval = 0.5f; private NetworkedBodyAttachment _bodyAttachment; private float _cleanseTimer; private float _cleanseEffectTimer; private AsyncOperationHandle _cleanseEffectPrefabLoad; private void Awake() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) _bodyAttachment = ((Component)this).GetComponent(); if (NetworkClient.active) { _cleanseEffectPrefabLoad = AssetAsyncReferenceManager.LoadAsset((AssetReferenceT)(object)CleanseEffectPrefabReference, (AsyncReferenceHandleUnloadType)2); } } private void OnEnable() { InstanceTracker.Add(this); } private void OnDisable() { InstanceTracker.Remove(this); } private void OnDestroy() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) AssetAsyncReferenceManager.UnloadAsset((AssetReferenceT)(object)CleanseEffectPrefabReference); _cleanseEffectPrefabLoad = default(AsyncOperationHandle); } private void FixedUpdate() { if (NetworkClient.active) { _cleanseEffectTimer += Time.fixedDeltaTime; if (_cleanseEffectTimer >= CleanseEffectInterval) { _cleanseEffectTimer -= CleanseEffectInterval; spawnCleanseEffect(); } } if (!NetworkServer.active) { return; } _cleanseTimer += Time.fixedDeltaTime; if (_cleanseTimer >= CleanseInterval) { _cleanseTimer -= CleanseInterval; doCleanse(); CleansesRemaining--; if (CleansesRemaining <= 0) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } private void doCleanse() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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) CharacterBody attachedBody = _bodyAttachment.attachedBody; if (Object.op_Implicit((Object)(object)attachedBody)) { CleanseArgs val = default(CleanseArgs); val.characterBody = attachedBody; val.removeDebuffs = CleanseDebuffs; val.removeBuffs = CleanseBuffs; val.removeCooldownBuffs = CleanseCooldownBuffs; val.removeDots = CleanseDots; val.removeStun = CleanseStun; val.removeNearbyProjectiles = CleanseNearbyProjectiles; CleanseArgs val2 = val; CleanseSystem.CleanseBodyServer(val2.characterBody, ref val2); } } private void spawnCleanseEffect() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown CharacterBody attachedBody = _bodyAttachment.attachedBody; if (Object.op_Implicit((Object)(object)attachedBody) && _cleanseEffectPrefabLoad.IsValid()) { EffectData val = new EffectData { origin = attachedBody.corePosition }; val.SetNetworkedObjectReference(((Component)attachedBody).gameObject); EffectManager.SpawnEffect(_cleanseEffectPrefabLoad.WaitForCompletion(), val, false); } } public static RepeatCleanseAttachment FindCleanseAttachmentForBody(CharacterBody body) { if (Object.op_Implicit((Object)(object)body)) { foreach (RepeatCleanseAttachment instances in InstanceTracker.GetInstancesList()) { if ((Object)(object)instances._bodyAttachment.attachedBody == (Object)(object)body) { return instances; } } } return null; } } [RequireComponent(typeof(NetworkedBodyAttachment))] [RequireComponent(typeof(HealthComponent))] public sealed class RepeatDeathEvent : MonoBehaviour { private static EffectIndex _deathEventTickEffectIndex = (EffectIndex)(-1); public int RemainingDeathEvents = 1; public float DelayBetweenDeathEvents = 1f; private NetworkedBodyAttachment _bodyAttachment; private HealthComponent _healthComponent; private float _timer; [SystemInitializer(new Type[] { typeof(EffectCatalogUtils) })] private static void Init() { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 _deathEventTickEffectIndex = EffectCatalogUtils.FindEffectIndex("DeathProjectileTickEffect"); if ((int)_deathEventTickEffectIndex == -1) { Log.Warning("Failed to find death tick effect index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\RepeatDeathEvent.cs", "Init", 19); } } private void Awake() { _bodyAttachment = ((Component)this).GetComponent(); _healthComponent = ((Component)this).GetComponent(); } private void FixedUpdate() { if (!NetworkServer.active) { return; } _timer += Time.fixedDeltaTime; if (_timer > DelayBetweenDeathEvents) { if (RemainingDeathEvents == 0) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } _timer -= DelayBetweenDeathEvents; RemainingDeathEvents--; tickDeathEvent(); } } private void tickDeathEvent() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0056: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_0049: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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_00be: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown CharacterBody attachedBody = _bodyAttachment.attachedBody; Vector3 val = (Object.op_Implicit((Object)(object)attachedBody) ? attachedBody.corePosition : ((Component)this).transform.position); if ((int)_deathEventTickEffectIndex != -1) { EffectData val2 = new EffectData { origin = val, rotation = Quaternion.identity }; EffectManager.SpawnEffect(_deathEventTickEffectIndex, val2, true); } DamageInfo val3 = new DamageInfo { attacker = (Object.op_Implicit((Object)(object)attachedBody) ? ((Component)attachedBody).gameObject : null), damage = (Object.op_Implicit((Object)(object)attachedBody) ? attachedBody.damage : 0f), crit = (Object.op_Implicit((Object)(object)attachedBody) && attachedBody.RollCrit()), procCoefficient = 0f, position = val, damageColorIndex = (DamageColorIndex)3 }; DamageReport val4 = new DamageReport(val3, _healthComponent, val3.damage, _healthComponent.combinedHealth); GlobalEventManager.instance.OnCharacterDeath(val4); } } internal static class RunExtraStatsHooks { [SystemInitializer(new Type[] { })] private static void Init() { //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 Run.RecalculateDifficultyCoefficentInternal += new Manipulator(Run_RecalculateDifficultyCoefficentInternal); InfiniteTowerRun.RecalculateDifficultyCoefficentInternal += new Manipulator(Run_RecalculateDifficultyCoefficentInternal); } private static void Run_RecalculateDifficultyCoefficentInternal(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "set_ambientLevel") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\RunExtraStatsHooks.cs", "Run_RecalculateDifficultyCoefficentInternal", 25); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getAmbientLevel); static float getAmbientLevel(float ambientLevel, Run run) { if (Object.op_Implicit((Object)(object)RunExtraStatsTracker.Instance)) { ambientLevel = Mathf.Max(1f, ambientLevel - (float)RunExtraStatsTracker.Instance.AmbientLevelPenalty); } return ambientLevel; } } } public sealed class RunExtraStatsTracker : NetworkBehaviour { private static RunExtraStatsTracker _instance; [SyncVar] public int AmbientLevelPenalty; public static RunExtraStatsTracker Instance => _instance; public int NetworkAmbientLevelPenalty { get { return AmbientLevelPenalty; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref AmbientLevelPenalty, 1u); } } [SystemInitializer(new Type[] { typeof(GameModeCatalog) })] private static void Init() { //IL_0001: 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_0029: Invalid comparison between Unknown and I4 //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) for (GameModeIndex val = (GameModeIndex)0; (int)val < GameModeCatalog.gameModeCount; val = (GameModeIndex)(val + 1)) { Run gameModePrefabComponent = GameModeCatalog.GetGameModePrefabComponent(val); if (Object.op_Implicit((Object)(object)gameModePrefabComponent)) { UnityObjectExtensions.EnsureComponent(((Component)gameModePrefabComponent).gameObject); } } } private void OnEnable() { SingletonHelper.Assign(ref _instance, this); } private void OnDisable() { SingletonHelper.Unassign(ref _instance, this); } private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { if (forceAll) { writer.WritePackedUInt32((uint)AmbientLevelPenalty); return true; } bool flag = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32((uint)AmbientLevelPenalty); } if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { if (initialState) { AmbientLevelPenalty = (int)reader.ReadPackedUInt32(); return; } int num = (int)reader.ReadPackedUInt32(); if (((uint)num & (true ? 1u : 0u)) != 0) { AmbientLevelPenalty = (int)reader.ReadPackedUInt32(); } } public override void PreStartClient() { } } [RequireComponent(typeof(ProjectileController))] public sealed class ScaleProjectileGhostDurationsToLifetime : MonoBehaviour { private ProjectileController _projectileController; private void Awake() { _projectileController = ((Component)this).GetComponent(); } private void Start() { if (Object.op_Implicit((Object)(object)_projectileController.ghost)) { float num = float.PositiveInfinity; ProjectileSimple val = default(ProjectileSimple); if (((Component)this).TryGetComponent(ref val)) { num = Mathf.Min(num, val.lifetime); } ScaleParticleSystemDuration val2 = default(ScaleParticleSystemDuration); if (float.IsFinite(num) && ((Component)_projectileController.ghost).TryGetComponent(ref val2)) { val2.newDuration = num; } } } } internal static class ShaderProperties { public static readonly int _Color = Shader.PropertyToID("_Color"); public static readonly int _TintColor = Shader.PropertyToID("_TintColor"); public static readonly int _EmPower = Shader.PropertyToID("_EmPower"); public static readonly int _EmissionColor = Shader.PropertyToID("_EmColor"); public static readonly int _Smoothness = Shader.PropertyToID("_Smoothness"); public static readonly int _SpecularStrength = Shader.PropertyToID("_SpecularStrength"); public static readonly int _SpecularExponent = Shader.PropertyToID("_SpecularExponent"); public static readonly int _FresnelEmissionEnabled = Shader.PropertyToID("_FEON"); public static readonly int _EliteRamp = Shader.PropertyToID("_EliteRamp"); } public sealed class ShrineBossExtraStatsTracker : MonoBehaviour { private ShrineBossBehavior _shrineBossBehavior; private int _baseMaxInteractions; [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown ShrineBossBehavior.Start += new hook_Start(ShrineBossBehavior_Start); } private static void ShrineBossBehavior_Start(orig_Start orig, ShrineBossBehavior self) { orig.Invoke(self); UnityObjectExtensions.EnsureComponent(((Component)self).gameObject); } private void Awake() { _shrineBossBehavior = ((Component)this).GetComponent(); _baseMaxInteractions = _shrineBossBehavior.maxPurchaseCount; } private void OnEnable() { refreshMaxPurchases(); Inventory.onInventoryChangedGlobal += onInventoryChangedGlobal; } private void OnDisable() { Inventory.onInventoryChangedGlobal -= onInventoryChangedGlobal; } private void onInventoryChangedGlobal(Inventory inventory) { refreshMaxPurchases(); } private void refreshMaxPurchases() { ItemQualityCounts left = default(ItemQualityCounts); foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (instance.isConnected) { CharacterMaster val = (Object.op_Implicit((Object)(object)instance) ? instance.master : null); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.inventory)) { ItemQualityCounts right = val.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.BarrageOnBoss); left += right; } } } int num = left.UncommonCount + 2 * left.RareCount + 3 * left.EpicCount + 5 * left.LegendaryCount; bool num2 = _shrineBossBehavior.purchaseCount >= _shrineBossBehavior.maxPurchaseCount; _shrineBossBehavior.maxPurchaseCount = _baseMaxInteractions + num; bool flag = _shrineBossBehavior.purchaseCount >= _shrineBossBehavior.maxPurchaseCount; if (num2 == flag) { return; } if (flag) { if (Object.op_Implicit((Object)(object)_shrineBossBehavior.purchaseInteraction)) { _shrineBossBehavior.purchaseInteraction.SetAvailable(false); } _shrineBossBehavior.waitingForRefresh = false; } else { _shrineBossBehavior.refreshTimer = 0f; _shrineBossBehavior.waitingForRefresh = true; } if (Object.op_Implicit((Object)(object)_shrineBossBehavior.symbolTransform)) { ((Component)_shrineBossBehavior.symbolTransform).gameObject.SetActive(!flag); } ((ShrineBehavior)_shrineBossBehavior).CallRpcSetPingable(!flag); } } public sealed class ShrineChanceExtraStatsTracker : MonoBehaviour { private ShrineChanceBehavior _shrineChanceBehavior; private int _baseMaxInteractions; [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown ShrineChanceBehavior.Awake += new hook_Awake(ShrineChanceBehavior_Awake); } private static void ShrineChanceBehavior_Awake(orig_Awake orig, ShrineChanceBehavior self) { ((Component)self).gameObject.AddComponent(); orig.Invoke(self); } private void Awake() { _shrineChanceBehavior = ((Component)this).GetComponent(); _baseMaxInteractions = _shrineChanceBehavior.maxPurchaseCount; } private void OnEnable() { refreshMaxPurchases(); Inventory.onInventoryChangedGlobal += onInventoryChangedGlobal; } private void OnDisable() { Inventory.onInventoryChangedGlobal -= onInventoryChangedGlobal; } private void onInventoryChangedGlobal(Inventory inventory) { refreshMaxPurchases(); } private void refreshMaxPurchases() { ItemQualityCounts left = default(ItemQualityCounts); foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (instance.isConnected) { CharacterMaster val = (Object.op_Implicit((Object)(object)instance) ? instance.master : null); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.inventory)) { ItemQualityCounts right = val.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.ExtraShrineItem); left += right; } } } int num = left.UncommonCount + 2 * left.RareCount + 3 * left.EpicCount + 5 * left.LegendaryCount; bool num2 = _shrineChanceBehavior.successfulPurchaseCount >= _shrineChanceBehavior.maxPurchaseCount; _shrineChanceBehavior.maxPurchaseCount = _baseMaxInteractions + num; bool flag = _shrineChanceBehavior.successfulPurchaseCount >= _shrineChanceBehavior.maxPurchaseCount; if (num2 == flag) { return; } if (flag) { if (Object.op_Implicit((Object)(object)_shrineChanceBehavior.purchaseInteraction)) { _shrineChanceBehavior.purchaseInteraction.SetAvailable(false); } _shrineChanceBehavior.waitingForRefresh = false; } else { _shrineChanceBehavior.refreshTimer = 0f; _shrineChanceBehavior.waitingForRefresh = true; } if (Object.op_Implicit((Object)(object)_shrineChanceBehavior.symbolTransform)) { ((Component)_shrineChanceBehavior.symbolTransform).gameObject.SetActive(!flag); } ((ShrineBehavior)_shrineChanceBehavior).CallRpcSetPingable(!flag); } } public sealed class SkillCooldownPickup : MonoBehaviour { [Tooltip("The base object to destroy when this pickup is consumed.")] public GameObject BaseObject; [Tooltip("The team filter object which determines who can pick up this pack.")] public TeamFilter TeamFilter; public GameObject PickupEffect; public float FlatAmount; public float FractionalAmount; public SkillSlot[] ExcludeSkills = Array.Empty(); private bool _alive = true; private void OnTriggerStay(Collider other) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown if (!NetworkServer.active || !_alive || TeamComponent.GetObjectTeam(((Component)other).gameObject) != TeamFilter.teamIndex) { return; } CharacterBody component = ((Component)other).GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { return; } if (Object.op_Implicit((Object)(object)component.skillLocator)) { GenericSkill[] allSkills = component.skillLocator.allSkills; foreach (GenericSkill val in allSkills) { if (val.baseRechargeInterval > 0f && Array.IndexOf(ExcludeSkills, component.skillLocator.FindSkillSlot(val)) == -1) { applyCooldownReduction(val); } } if (Object.op_Implicit((Object)(object)PickupEffect)) { EffectManager.SpawnEffect(PickupEffect, new EffectData { origin = ((Component)this).transform.position }, true); } } Object.Destroy((Object)(object)BaseObject); _alive = false; } private void applyCooldownReduction(GenericSkill genericSkill) { genericSkill.RunRecharge(FlatAmount + genericSkill.cooldownRemaining * FractionalAmount); } } internal static class SkillHooks { public static event Action OnSkillUsedIndirectAuthority; [SystemInitializer(new Type[] { })] private static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown EntityStatePatcher.PatcherInfo patcherInfo = default(EntityStatePatcher.PatcherInfo); patcherInfo.Manipulator = new Manipulator(entityStateStockDeductHookManipulator); patcherInfo.ShouldApplyPredicate = matchEntityStateDeductStocks; EntityStatePatcher.AddPatcher(in patcherInfo); } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void invokeOnSkillUsedIndirectAuthority(GenericSkill skill) { SkillHooks.OnSkillUsedIndirectAuthority?.Invoke(skill); } private static void emitOnSkillUsedIndirectAuthority(ILCursor c) { c.EmitDelegate>((Action)invokeOnSkillUsedIndirectAuthority); } private static bool matchEntityStateDeductStocks(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown ILCursor val = new ILCursor(il); int num4 = default(int); if (val.TryGotoNext((MoveType)0, new Func[4] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "get_activatorSkillSlot"), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num4), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "DeductStock") })) { return true; } FieldReference val3 = default(FieldReference); int num3 = default(int); if (val.TryGotoNext((MoveType)0, new Func[5] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "get_skillLocator"), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, ref val3), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num3), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "DeductStock") })) { return true; } FieldReference val2 = default(FieldReference); int num2 = default(int); if (val.TryGotoNext((MoveType)0, new Func[4] { (Instruction x) => x.MatchLdloc(il, out var _), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, ref val2), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num2), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "DeductStock") })) { return true; } int num = default(int); if (val.TryGotoNext((MoveType)0, new Func[3] { (Instruction x) => x.MatchLdloc(il, out var _), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "DeductStock") })) { return true; } return false; } private static void entityStateStockDeductHookManipulator(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0038: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); bool flag = false; val.Goto(0, (MoveType)0, false); int num = 0; MethodReference activatorSkillSlotGetterMethod = null; int num8 = default(int); while (val.TryGotoNext((MoveType)2, new Func[4] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref activatorSkillSlotGetterMethod) && Extensions.Is(activatorSkillSlotGetterMethod, typeof(BaseSkillState), "get_activatorSkillSlot"), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num8), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "DeductStock") })) { val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Call, activatorSkillSlotGetterMethod); emitOnSkillUsedIndirectAuthority(val); num++; } if (num > 0) { flag = true; } val.Goto(0, (MoveType)0, false); int num2 = 0; MethodReference skillLocatorGetterMethod = null; FieldReference skillField2 = null; int num7 = default(int); while (val.TryGotoNext((MoveType)2, new Func[5] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref skillLocatorGetterMethod) && Extensions.Is(skillLocatorGetterMethod, typeof(EntityState), "get_skillLocator"), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, ref skillField2), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num7), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "DeductStock") })) { val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Call, skillLocatorGetterMethod); val.Emit(OpCodes.Ldfld, skillField2); emitOnSkillUsedIndirectAuthority(val); num2++; } if (num2 > 0) { flag = true; } val.Goto(0, (MoveType)0, false); int num3 = 0; VariableDefinition skillLocatorVar = null; FieldReference skillField = null; int num6 = default(int); while (val.TryGotoNext((MoveType)2, new Func[4] { (Instruction x) => x.MatchLdloc(il, out skillLocatorVar), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, ref skillField), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num6), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "DeductStock") })) { val.Emit(OpCodes.Ldloc, skillLocatorVar); val.Emit(OpCodes.Ldfld, skillField); emitOnSkillUsedIndirectAuthority(val); num3++; } if (num3 > 0) { flag = true; } val.Goto(0, (MoveType)0, false); int num4 = 0; VariableDefinition skillVar = null; int num5 = default(int); while (val.TryGotoNext((MoveType)2, new Func[3] { (Instruction x) => x.MatchLdloc(il, out skillVar), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num5), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "DeductStock") })) { val.Emit(OpCodes.Ldloc, skillVar); emitOnSkillUsedIndirectAuthority(val); num4++; } if (num4 > 0) { flag = true; } if (!flag) { Log.Warning("[" + ((MemberReference)il.Method).FullName + "] Failed to find DeductStock patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\SkillHooks.cs", "entityStateStockDeductHookManipulator", 202); } } } internal static class SpecificItemCostTransformationHooks { public delegate void ModifyItemCostTransformationDelegate(ref ItemTransformation itemTransformation, Interactor activator, int cost); private static MethodInfo _getTransformationForSpecificItemCostMethod; public static event ModifyItemCostTransformationDelegate ModifyItemCostTransformation; [SystemInitializer(new Type[] { typeof(CostTypeCatalog) })] private unsafe static void Init() { //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown //IL_012d: Unknown result type (might be due to invalid IL or missing references) _getTransformationForSpecificItemCostMethod = typeof(CostTypeCatalog).GetMethods(BindingFlags.Static | BindingFlags.NonPublic).SingleOrDefault((MethodInfo m) => m.Name.StartsWith("g__GetTransformationForSpecificItemCost|")); if (_getTransformationForSpecificItemCostMethod == null) { Log.Error("Failed to find GetTransformationForSpecificItemCost method", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\SpecificItemCostTransformationHooks.cs", "Init", 28); return; } HashSet hashSet = new HashSet(); byte* num = stackalloc byte[12]; *(int*)num = 11; *(int*)(num + Unsafe.SizeOf()) = 12; *(int*)(num + (nint)2 * (nint)Unsafe.SizeOf()) = 13; Span span = new Span(num, 3); int num2 = 0; int num3 = 0; Span span2 = span; for (int i = 0; i < span2.Length; i++) { CostTypeDef costTypeDef = CostTypeCatalog.GetCostTypeDef(span2[i]); if (costTypeDef != null) { MethodInfo methodInfo = ((Delegate)(object)costTypeDef.isAffordable)?.Method; if (methodInfo != null && hashSet.Add(methodInfo)) { num2++; new ILHook((MethodBase)methodInfo, new Manipulator(IsAffordableHooksPatch)); } MethodInfo methodInfo2 = ((Delegate)(object)costTypeDef.payCost)?.Method; if (methodInfo2 != null && hashSet.Add(methodInfo2)) { num3++; new ILHook((MethodBase)methodInfo2, new Manipulator(PayCostHooksPatch)); } } } if (num2 == 0) { Log.Error("Failed to find specific item isAffordable method", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\SpecificItemCostTransformationHooks.cs", "Init", 67); } if (num3 == 0) { Log.Error("Failed to find specific item payCost method", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\SpecificItemCostTransformationHooks.cs", "Init", 76); } } private static void IsAffordableHooksPatch(ILContext il) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find IsAffordableContext parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\SpecificItemCostTransformationHooks.cs", "IsAffordableHooksPatch", 88); return; } ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)_getTransformationForSpecificItemCostMethod) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\SpecificItemCostTransformationHooks.cs", "IsAffordableHooksPatch", 97); return; } val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)getItemTransformation); static ItemTransformation getItemTransformation(ItemTransformation itemTransformation, IsAffordableContext context) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) SpecificItemCostTransformationHooks.ModifyItemCostTransformation?.Invoke(ref itemTransformation, context.activator, context.cost); return itemTransformation; } } private static void PayCostHooksPatch(ILContext il) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find IsAffordableContext parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\SpecificItemCostTransformationHooks.cs", "PayCostHooksPatch", 115); return; } ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)_getTransformationForSpecificItemCostMethod) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\SpecificItemCostTransformationHooks.cs", "PayCostHooksPatch", 124); return; } val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)getItemTransformation); static ItemTransformation getItemTransformation(ItemTransformation itemTransformation, PayCostContext context) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) SpecificItemCostTransformationHooks.ModifyItemCostTransformation?.Invoke(ref itemTransformation, context.activator, context.cost); return itemTransformation; } } } public sealed class SpeedOnPickupBarrelInteraction : NetworkBehaviour, IInteractable, IDisplayNameProvider { public GameObject PickupPrefab; [SyncVar] private bool _opened; public bool IsOpened => _opened; public bool Network_opened { get { return _opened; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref _opened, 1u); } } private void OnEnable() { InstanceTracker.Add(this); InterfaceInstanceTracker.Add((IInteractable)(object)this); } private void OnDisable() { InstanceTracker.Remove(this); InterfaceInstanceTracker.Remove((IInteractable)(object)this); } public string GetDisplayName() { return Language.GetString("BARREL_SPEEDONPICKUP_NAME"); } public string GetContextString(Interactor activator) { return Language.GetString("BARREL_SPEEDONPICKUP_CONTEXT"); } public Interactability GetInteractability(Interactor activator) { if (_opened) { return (Interactability)0; } return (Interactability)2; } [Server] public void OnInteractionBegin(Interactor activator) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_00be->IL00be: Incompatible stack types: O vs I4 //IL_00b3->IL00be: Incompatible stack types: I4 vs O //IL_00b3->IL00be: Incompatible stack types: O vs I4 //IL_00c3->IL00c3: Incompatible stack types: I4 vs O if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void ItemQualities.SpeedOnPickupBarrelInteraction::OnInteractionBegin(RoR2.Interactor)' called on client"); } else { if (_opened) { return; } Network_opened = true; CharacterBody val = (Object.op_Implicit((Object)(object)activator) ? ((Component)activator).GetComponent() : null); Inventory val2 = (Object.op_Implicit((Object)(object)val) ? val.inventory : null); EntityStateMachine val3 = default(EntityStateMachine); if (((Component)this).TryGetComponent(ref val3)) { val3.SetNextState((EntityState)new Opening()); } if (!Object.op_Implicit((Object)(object)PickupPrefab)) { return; } object obj = Object.Instantiate(PickupPrefab, ((Component)this).transform.position + Vector3.up * 1f, Random.rotationUniform); TeamFilter val4 = default(TeamFilter); if (((GameObject)obj).TryGetComponent(ref val4)) { TeamFilter obj2 = val4; int num; if (Object.op_Implicit((Object)(object)val)) { obj = val.teamComponent.teamIndex; num = (int)obj; } else { num = -1; obj = num; num = (int)obj; } obj2.teamIndex = (TeamIndex)obj; obj = num; } ItemQualityCounts itemQualityCounts = default(ItemQualityCounts); if (Object.op_Implicit((Object)(object)val2)) { itemQualityCounts = val2.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.SpeedOnPickup); } if (itemQualityCounts.TotalQualityCount <= 0) { itemQualityCounts.UncommonCount = 1; } SpeedOnPickupStatsPickup componentInChildren = ((GameObject)obj).GetComponentInChildren(); if (Object.op_Implicit((Object)(object)componentInChildren)) { int buffStacks = 3 * itemQualityCounts.UncommonCount + 5 * itemQualityCounts.RareCount + 7 * itemQualityCounts.EpicCount + 10 * itemQualityCounts.LegendaryCount; componentInChildren.BuffStacks = buffStacks; } GravitatePickup componentInChildren2 = ((GameObject)obj).GetComponentInChildren(); if (Object.op_Implicit((Object)(object)componentInChildren2)) { componentInChildren2.ForceGravitate(((Component)val).GetComponent()); } NetworkServer.Spawn((GameObject)obj); } } public bool ShouldIgnoreSpherecastForInteractibility(Interactor activator) { return false; } public bool ShouldProximityHighlight() { return true; } public bool ShouldShowOnScanner() { return !_opened; } public bool ShouldSpawnLesserInteractionRewards(Interactor interactor) { return false; } private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { if (forceAll) { writer.Write(_opened); return true; } bool flag = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(_opened); } if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { if (initialState) { _opened = reader.ReadBoolean(); return; } int num = (int)reader.ReadPackedUInt32(); if (((uint)num & (true ? 1u : 0u)) != 0) { _opened = reader.ReadBoolean(); } } public override void PreStartClient() { } } public sealed class SpeedOnPickupStatsPickup : MonoBehaviour { [Tooltip("The base object to destroy when this pickup is consumed.")] public GameObject BaseObject; [Tooltip("The team filter object which determines who can pick up this pack.")] public TeamFilter TeamFilter; public GameObject PickupEffect; public int BuffStacks = 1; private bool _alive = true; private void OnTriggerStay(Collider other) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown CharacterBody val = default(CharacterBody); if (NetworkServer.active && _alive && TeamComponent.GetObjectTeam(((Component)other).gameObject) == TeamFilter.teamIndex && ((Component)other).TryGetComponent(ref val) && Object.op_Implicit((Object)(object)val.master) && ((Component)(object)val.master).TryGetComponentCached(out CharacterMasterExtraStatsTracker component)) { val.OnPickup((PickupClass)1); CharacterMasterExtraStatsTracker characterMasterExtraStatsTracker = component; characterMasterExtraStatsTracker.NetworkSpeedOnPickupBonus = characterMasterExtraStatsTracker.SpeedOnPickupBonus + BuffStacks; if (Object.op_Implicit((Object)(object)PickupEffect)) { EffectManager.SpawnEffect(PickupEffect, new EffectData { origin = ((Component)this).transform.position }, true); } Object.Destroy((Object)(object)BaseObject); _alive = false; } } } public struct StoredInteractableInfo : IEquatable { public static readonly StoredInteractableInfo None = new StoredInteractableInfo { InteractableIndex = -1 }; public int InteractableIndex; public int UpgradeValue; public override readonly bool Equals(object obj) { if (obj is StoredInteractableInfo other) { return Equals(in other); } return false; } readonly bool IEquatable.Equals(StoredInteractableInfo other) { return Equals(in other); } public readonly bool Equals(in StoredInteractableInfo other) { if (InteractableIndex == other.InteractableIndex) { return UpgradeValue == other.UpgradeValue; } return false; } public override readonly int GetHashCode() { return HashCode.Combine(InteractableIndex, UpgradeValue); } public override readonly string ToString() { return string.Format("{0} (T{1})", InteractableCatalog.GetInteractableDef(InteractableIndex)?.Name ?? "None", UpgradeValue + 1); } public static bool operator ==(in StoredInteractableInfo left, in StoredInteractableInfo right) { return left.Equals(in right); } public static bool operator !=(in StoredInteractableInfo left, in StoredInteractableInfo right) { return !left.Equals(in right); } } [RequireComponent(typeof(TeamFilter))] public sealed class TauntZone : MonoBehaviour { private static SphereSearch _sphereSearch; public CharacterBody Attacker; public GameObject Target; [Min(0f)] public float Interval = 1f; [Min(0f)] public float Range = 10f; [Range(0f, 100f)] public float TauntChance = 60f; [Min(0f)] public float HitEntitiesClearInterval = 1f; private float _tauntTimer; private float _hitEntitiesListClearTimer; private List _hitEntities; private void Awake() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown if (NetworkServer.active) { _hitEntities = CollectionPool>.RentCollection(); if (_sphereSearch == null) { _sphereSearch = new SphereSearch { mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask, queryTriggerInteraction = (QueryTriggerInteraction)1 }; } } } private void OnDestroy() { if (_hitEntities != null) { _hitEntities = CollectionPool>.ReturnCollection(_hitEntities); } } private void Start() { if (NetworkServer.active) { doTauntNearby(); } } private void FixedUpdate() { if (NetworkServer.active) { _tauntTimer += Time.fixedDeltaTime; if (_tauntTimer >= Interval) { _tauntTimer = 0f; doTauntNearby(); } _hitEntitiesListClearTimer += Time.fixedDeltaTime; if (_hitEntitiesListClearTimer >= HitEntitiesClearInterval) { _hitEntitiesListClearTimer = 0f; _hitEntities.Clear(); } } } private void doTauntNearby() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Invalid comparison between Unknown and I4 if (!NetworkServer.active) { Log.Warning("Called on client", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\TauntZone.cs", "doTauntNearby", 91); return; } _sphereSearch.origin = ((Component)this).transform.position; _sphereSearch.radius = Range; List list = default(List); DisposableRental> val = CollectionPool>.RentCollection(ref list); try { _sphereSearch.RefreshCandidates().FilterCandidatesByDistinctHurtBoxEntities(); if (Object.op_Implicit((Object)(object)Attacker)) { _sphereSearch.FilterCandidatesByHurtBoxTeam(TeamMask.GetEnemyTeams(Attacker.teamComponent.teamIndex)); } _sphereSearch.GetHurtBoxes(list); SetStateOnHurt val5 = default(SetStateOnHurt); foreach (HurtBox item in list) { HealthComponent val2 = (Object.op_Implicit((Object)(object)item) ? item.healthComponent : null); CharacterBody val3 = (Object.op_Implicit((Object)(object)val2) ? val2.body : null); CharacterMaster val4 = (Object.op_Implicit((Object)(object)val3) ? val3.master : null); if (!Object.op_Implicit((Object)(object)val3) || !Object.op_Implicit((Object)(object)val4) || val3.isChampion || (((Component)val3).TryGetComponent(ref val5) && !val5.canBeTaunted) || (Object.op_Implicit((Object)(object)Attacker) && (int)val3.GetVisibilityLevel(Attacker) < 3) || _hitEntities.Contains(val2)) { continue; } _hitEntities.Add(val2); if (RollUtil.CheckRoll(TauntChance, Object.op_Implicit((Object)(object)Attacker) ? Attacker.master : null, sureProc: false)) { BaseAI safe = ArrayUtils.GetSafe(val4.AiComponents, 0); if (Object.op_Implicit((Object)(object)safe)) { safe.currentEnemy.gameObject = Target; } } } } finally { val.Dispose(); } } private void OnDrawGizmos() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) Gizmos.DrawWireSphere(((Component)this).transform.position, Range); } } internal sealed class TeamObjectFilter : IObjectCollideFilter, IDisposable { private readonly TeamIndex _teamIndex = (TeamIndex)(-1); public bool InvertFilter { get; init; } public event Action OnFilterDirty; public TeamObjectFilter(TeamIndex teamIndex) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) _teamIndex = teamIndex; TeamComponent.onJoinTeamGlobal += onJoinTeamGlobal; TeamComponent.onLeaveTeamGlobal += onLeaveTeamGlobal; } private bool bodyPassesFilter(CharacterBody body) { //IL_001d: 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) if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.teamComponent)) { return false; } return body.teamComponent.teamIndex == _teamIndex != InvertFilter; } public bool PassesFilter(ObjectCollisionManager collisionManager) { if (Object.op_Implicit((Object)(object)collisionManager)) { if (!bodyPassesFilter(collisionManager.Body)) { return bodyPassesFilter(collisionManager.OwnerBody); } return true; } return false; } private void onLeaveTeamGlobal(TeamComponent teamComponent, TeamIndex teamIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) if (teamIndex == _teamIndex && this.OnFilterDirty != null && ((Component)(object)teamComponent).TryGetComponentCached(out ObjectCollisionManager component)) { this.OnFilterDirty(component); } } private void onJoinTeamGlobal(TeamComponent teamComponent, TeamIndex teamIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) if (teamIndex == _teamIndex && this.OnFilterDirty != null && ((Component)(object)teamComponent).TryGetComponentCached(out ObjectCollisionManager component)) { this.OnFilterDirty(component); } } public void Dispose() { TeamComponent.onJoinTeamGlobal -= onJoinTeamGlobal; TeamComponent.onLeaveTeamGlobal -= onLeaveTeamGlobal; } } internal static class TemporaryHealth { public static float GetTemporaryHealthBonus(this CharacterBody body) { return body.GetBuffCount(ItemQualitiesContent.Buffs.SlugHealth) + body.GetBuffCount(ItemQualitiesContent.Buffs.FruitTempHealth); } [SystemInitializer(new Type[] { })] private static void Init() { //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 RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(getStatCoefficients); HealthComponent.TakeDamageProcess += new Manipulator(HealthComponent_TakeDamageProcess); } private static void HealthComponent_TakeDamageProcess(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0148: 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) ILCursor val = new ILCursor(il); VariableDefinition healthDamageDealtVar = null; if (!val.TryGotoNext((MoveType)2, new Func[6] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "shield"), (Instruction x) => x.MatchLdloc(typeof(float), il, out healthDamageDealtVar), (Instruction x) => ILPatternMatchingExt.MatchSub(x), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "set_Networkshield") })) { Log.Error("Failed to find damageDealt variable index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\TemporaryHealth.cs", "HealthComponent_TakeDamageProcess", 40); return; } if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "ServerDamageDealt") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\TemporaryHealth.cs", "HealthComponent_TakeDamageProcess", 47); return; } val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc, healthDamageDealtVar); val.EmitDelegate>((Action)onDamageDealt); static void onDamageDealt(HealthComponent healthComponent, float healthDamageDealt) { if (Object.op_Implicit((Object)(object)healthComponent) && Object.op_Implicit((Object)(object)healthComponent.body) && healthDamageDealt > 0f) { float temporaryHealthDamage2 = healthDamageDealt; tryDeductTemporaryHealth(ref temporaryHealthDamage2, ItemQualitiesContent.Buffs.SlugHealth); tryDeductTemporaryHealth(ref temporaryHealthDamage2, ItemQualitiesContent.Buffs.FruitTempHealth); } void tryDeductTemporaryHealth(ref float temporaryHealthDamage, BuffDef tempHealthBuff) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) if (!(temporaryHealthDamage <= 0f)) { int buffCount = healthComponent.body.GetBuffCount(tempHealthBuff); if (buffCount != 0) { int num = Mathf.FloorToInt(Math.Min(temporaryHealthDamage, buffCount)); temporaryHealthDamage -= num; if (num > 0) { healthComponent.body.SetBuffCount(tempHealthBuff.buffIndex, Mathf.Max(0, buffCount - num)); } } } } } } private static void getStatCoefficients(CharacterBody sender, StatHookEventArgs args) { args.baseHealthAdd += sender.GetTemporaryHealthBonus(); } } internal static class TextSpriteHandler { [SystemInitializer(new Type[] { })] private static void Init() { foreach (TMP_SpriteAsset allSpriteAsset in ItemQualitiesContent.TMP_SpriteAssets.AllSpriteAssets) { registerSpriteAsset(allSpriteAsset); } } private static void registerSpriteAsset(TMP_SpriteAsset spriteAsset) { TMP_Settings.defaultSpriteAsset.fallbackSpriteAssets.Add(spriteAsset); } } public sealed class TimedChestQualityController : MonoBehaviour { private Xoroshiro128Plus _rng; private ModelLocator _modelLocator; private GenericPickupController _pickupController; private QualityPickupDisplayController _qualityPickupDisplayController; private bool _foundPickupController; private float _findPickupTimer; [SystemInitializer(new Type[] { })] private static void Init() { //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 TimedChestController.OnEnable += new hook_OnEnable(TimedChestController_OnEnable); Opening.OnEnter += new hook_OnEnter(Opening_OnEnter); Opening.FixedUpdate += new Manipulator(Opening_FixedUpdate); } private static void TimedChestController_OnEnable(orig_OnEnable orig, TimedChestController self) { orig.Invoke(self); UnityObjectExtensions.EnsureComponent((Component)(object)self); } private static void Opening_OnEnter(orig_OnEnter orig, Opening self) { orig.Invoke(self); TimedChestQualityController timedChestQualityController = default(TimedChestQualityController); if (((EntityState)self).TryGetComponent(ref timedChestQualityController)) { timedChestQualityController.onOpening(); } } private static void Opening_FixedUpdate(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "hasGrantedAchievement") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\TimedChestQualityController.cs", "Opening_FixedUpdate", 47); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Action)onOpened); static void onOpened(Opening self) { TimedChestQualityController timedChestQualityController = default(TimedChestQualityController); if (((EntityState)self).TryGetComponent(ref timedChestQualityController)) { timedChestQualityController.onOpened(); } } } private void Awake() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown _modelLocator = ((Component)this).GetComponent(); if (NetworkServer.active) { _rng = new Xoroshiro128Plus(Run.instance.treasureRng.nextUlong); } } private void FixedUpdate() { if (_foundPickupController) { return; } _findPickupTimer += Time.fixedDeltaTime; if (!(_findPickupTimer >= 0.3f)) { return; } _findPickupTimer = 0f; if (!Object.op_Implicit((Object)(object)_modelLocator) || !Object.op_Implicit((Object)(object)_modelLocator.modelTransform)) { return; } GenericPickupController componentInChildren = ((Component)_modelLocator.modelTransform).GetComponentInChildren(); if (Object.op_Implicit((Object)(object)componentInChildren)) { _pickupController = componentInChildren; _qualityPickupDisplayController = (Object.op_Implicit((Object)(object)componentInChildren.pickupDisplay) ? ((Component)componentInChildren.pickupDisplay).GetComponentInChildren() : null); if (Object.op_Implicit((Object)(object)_qualityPickupDisplayController)) { ((Behaviour)_qualityPickupDisplayController).enabled = false; } _foundPickupController = true; if (NetworkServer.active) { rollQualityServer(); } } } private void rollQualityServer() { //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_0029: Unknown result type (might be due to invalid IL or missing references) GenericPickupController pickupController = _pickupController; UniquePickup pickup = _pickupController.pickup; Xoroshiro128Plus rng = _rng; PickupRollInfo rollInfo = new PickupRollInfo(null, (TeamIndex)1); pickupController.pickup = pickup.WithQualityTier(DropTableQualityHandler.RollQualityTier(rng, in rollInfo)); } private void onOpening() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)_qualityPickupDisplayController)) { ((Behaviour)_qualityPickupDisplayController).enabled = true; } if (!Object.op_Implicit((Object)(object)_pickupController)) { return; } QualityTier qualityTier = QualityCatalog.GetQualityTier(_pickupController.pickup.pickupIndex); if (qualityTier > QualityTier.None) { QualityTierDef qualityTierDef = QualityCatalog.GetQualityTierDef(qualityTier); int num = -1; Transform val = null; ChildLocator val2 = (Object.op_Implicit((Object)(object)_modelLocator) ? _modelLocator.modelChildLocator : null); if (Object.op_Implicit((Object)(object)val2)) { num = val2.FindChildIndex("BurstCenter"); val = val2.FindChild(num); } EffectData val3 = new EffectData { origin = (Object.op_Implicit((Object)(object)val) ? val.position : ((Component)_pickupController).transform.position), rotation = (Object.op_Implicit((Object)(object)val) ? val.rotation : ((Component)_pickupController).transform.rotation) }; if (num != -1) { val3.SetChildLocatorTransformReference(((Component)this).gameObject, num); } EffectManager.SpawnEffect(qualityTierDef.ChestOpenEffectPrefab, val3, false); } } private void onOpened() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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 (!Object.op_Implicit((Object)(object)_pickupController)) { return; } QualityTier qualityTier = QualityCatalog.GetQualityTier(_pickupController.pickup.pickupIndex); if (qualityTier > QualityTier.None) { QualityTierDef qualityTierDef = QualityCatalog.GetQualityTierDef(qualityTier); if (Object.op_Implicit((Object)(object)qualityTierDef.pickupLandSound)) { PointSoundManager.EmitSoundLocal(AkEventIdArg.op_Implicit(qualityTierDef.pickupLandSound.akId), ((Component)this).transform.position); } } } } internal static class TinkerHooks { private delegate bool orig_TinkerableObjectAttributes_get_IsTinkerable(TinkerableObjectAttributes self); private delegate bool GetBaseQualityIsWorldUniqueDelegate(bool isWorldUnique, in UniquePickup pickup); [SystemInitializer(new Type[] { })] private static void Init() { //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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown TinkerProjectile.TransmuteTargetObject += new Manipulator(Scrap.ReplaceScrapPickupFromItemDefTierQualityPatch); DrifterTracker.IsWhitelist += new Manipulator(DrifterTracker_IsWhitelist); PropertyInfo property = typeof(TinkerableObjectAttributes).GetProperty("IsTinkerable"); if (property?.GetMethod != null) { new Hook((MethodBase)property.GetMethod, (Delegate)new Func(TinkerableObjectAttributes_get_IsTinkerable)); } else { Log.Error("Failed to find TinkerableObjectAttributes.IsTinkerable getter method", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\TinkerHooks.cs", "Init", 29); } PickupPickerController.RerollCurrentOptions += new Manipulator(PickupPickerController_RerollCurrentOptions); ShopTerminalBehavior.GenerateReroll += new hook_GenerateReroll(ShopTerminalBehavior_GenerateReroll); } private static bool interactablePickupIsTinkerable(in UniquePickup pickup) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (((UniquePickup)(ref pickup)).isValid) { return QualityCatalog.GetQualityTier(pickup.pickupIndex) == QualityTier.None; } return false; } private static bool TinkerableObjectAttributes_get_IsTinkerable(orig_TinkerableObjectAttributes_get_IsTinkerable orig, TinkerableObjectAttributes self) { //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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) if (!orig(self)) { return false; } PickupDistributorBehavior val = default(PickupDistributorBehavior); PickupPickerController val2 = default(PickupPickerController); if (Object.op_Implicit((Object)(object)self.shopBehavior)) { UniquePickup pickup = self.shopBehavior.CurrentPickup(); if (!interactablePickupIsTinkerable(in pickup)) { return false; } } else if (((Component)self).TryGetComponent(ref val)) { if (!interactablePickupIsTinkerable(in val.pickup)) { return false; } } else if (((Component)self).TryGetComponent(ref val2)) { bool flag = false; Option[] options = val2.options; for (int i = 0; i < options.Length; i++) { Option val3 = options[i]; if (interactablePickupIsTinkerable(in val3.pickup)) { flag = true; break; } } if (!flag) { return false; } } return true; } private static UniquePickup? ShopTerminalBehavior_GenerateReroll(orig_GenerateReroll orig, PickupDropTable dropTable, Xoroshiro128Plus rng, UniquePickup pickup) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) UniquePickup? result = orig.Invoke(dropTable, rng, pickup); if (result.HasValue) { UniquePickup pickup2 = result.Value; if (((UniquePickup)(ref pickup2)).isValid && ((UniquePickup)(ref pickup)).isValid) { pickup2 = result.Value; result = pickup2.WithQualityTier(QualityCatalog.GetQualityTier(pickup.pickupIndex)); } } return result; } private static void PickupPickerController_RerollCurrentOptions(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0040: 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) ILCursor val = new ILCursor(il); val.Index = 0; if (val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(PickupTransmutationManager), "GetAvailableGroupFromPickupIndex") })) { val.Emit(OpCodes.Dup); int index = val.Index; val.Index = index + 1; val.EmitDelegate>((Func)getPickupTransmutationGroup); } else { Log.Error("Failed to find transmutation group patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\TinkerHooks.cs", "PickupPickerController_RerollCurrentOptions", 110); } val.Index = 0; if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "SetOptionsServer") })) { ILLabel val2 = val.MarkLabel(); int num = 0; while (val.TryGotoPrev((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchRet(x) })) { val.Emit(OpCodes.Br, (object)val2); num++; } if (num == 0) { Log.Warning("Failed to find loop exit fix patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\TinkerHooks.cs", "PickupPickerController_RerollCurrentOptions", 131); } } else { Log.Error("Failed to find loop end location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\TinkerHooks.cs", "PickupPickerController_RerollCurrentOptions", 140); } static PickupIndex[] getPickupTransmutationGroup(PickupIndex pickupIndex, PickupIndex[] group) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (QualityCatalog.GetQualityTier(pickupIndex) != QualityTier.None) { return Array.Empty(); } return group; } } private static void DrifterTracker_IsWhitelist(ILContext il) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(typeof(UniquePickup).MakeByRefType(), out var parameter)) { Log.Error("Failed to find pickup parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\TinkerHooks.cs", "DrifterTracker_IsWhitelist", 148); return; } ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 9), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "ContainsTag") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\TinkerHooks.cs", "DrifterTracker_IsWhitelist", 158); return; } val.Goto(array[1].Next, (MoveType)2, false); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate((GetBaseQualityIsWorldUniqueDelegate)getBaseQualityIsWorldUnique); static bool getBaseQualityIsWorldUnique(bool isWorldUnique, in UniquePickup pickup) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_002b: Unknown result type (might be due to invalid IL or missing references) PickupIndex pickupIndexOfQuality = QualityCatalog.GetPickupIndexOfQuality(pickup.pickupIndex, QualityTier.None); if (pickupIndexOfQuality == pickup.pickupIndex) { return isWorldUnique; } PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndexOfQuality); ItemDef val2 = ((pickupDef != null) ? ItemCatalog.GetItemDef(pickupDef.itemIndex) : null); if (!Object.op_Implicit((Object)(object)val2)) { return isWorldUnique; } return val2.ContainsTag((ItemTag)9); } } } public sealed class TreebotUnlockableQualityController : MonoBehaviour { private static int _treebotUnlockInteractableIndex = -1; private PurchaseInteraction _purchaseInteraction; [SystemInitializer(new Type[] { typeof(InteractableCatalog), typeof(MasterCatalog), typeof(BodyCatalog) })] private static void Init() { _treebotUnlockInteractableIndex = InteractableCatalog.FindInteractableIndex("TreebotUnlockInteractable"); if (_treebotUnlockInteractableIndex == -1) { Log.Error("Failed to find treebot unlockable interactabel index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\TreebotUnlockableQualityController.cs", "Init", 17); } InteractableInfoProvider.OnCatalogedInteractableStartGlobal += onCatalogedInteractableStartGlobal; } private static void onCatalogedInteractableStartGlobal(InteractableInfoProvider interactableInfo) { if (interactableInfo.CatalogIndex == _treebotUnlockInteractableIndex) { UnityObjectExtensions.EnsureComponent(((Component)interactableInfo).gameObject); } } private void Awake() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown _purchaseInteraction = ((Component)this).GetComponent(); PurchaseInteraction purchaseInteraction = _purchaseInteraction; if (purchaseInteraction.onDetailedPurchaseServer == null) { purchaseInteraction.onDetailedPurchaseServer = new DetailedPurchaseEvent(); } } private void OnEnable() { ((UnityEvent)(object)_purchaseInteraction.onDetailedPurchaseServer).AddListener((UnityAction)onDetailedPurchaseServer); } private void OnDisable() { ((UnityEvent)(object)_purchaseInteraction.onDetailedPurchaseServer).RemoveListener((UnityAction)onDetailedPurchaseServer); } private static void onDetailedPurchaseServer(PayCostContext context, PayCostResults results) { //IL_0020: 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_006c: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)context.activatorBody)) { return; } QualityTier qualityTier = QualityTier.None; foreach (EquipmentIndex item in results.equipmentTaken) { QualityTier qualityTier2 = QualityCatalog.GetQualityTier(item); if (QualityCatalog.FindEquipmentQualityGroupIndex(item) == ItemQualitiesContent.EquipmentQualityGroups.QuestVolatileBattery.GroupIndex && qualityTier2 > qualityTier) { qualityTier = qualityTier2; } } if (qualityTier != QualityTier.None) { context.activatorInventory.GiveItemPermanent(ItemQualitiesContent.ItemQualityGroups.TreebotBuddy.GetItemIndex(qualityTier), 1); } } } internal static class UpdateTemporaryVisualEffectsHook { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown CharacterBody.UpdateAllTemporaryVisualEffects += new hook_UpdateAllTemporaryVisualEffects(CharacterBody_UpdateAllTemporaryVisualEffects); } private static void CharacterBody_UpdateAllTemporaryVisualEffects(orig_UpdateAllTemporaryVisualEffects orig, CharacterBody self) { orig.Invoke(self); if (((Component)(object)self).TryGetComponentCached(out CharacterBodyExtraStatsTracker component)) { component.UpdateAllTemporaryVisualEffects(); } } } [RequireComponent(typeof(PointViewer))] public sealed class WeakPointTargetViewer : MonoBehaviour { public GameObject VisualizerPrefab; private PointViewer _pointViewer; private HUD _hud; private readonly Dictionary, GameObject> _visualizersByHurtBox = new Dictionary, GameObject>(); private void Awake() { _pointViewer = ((Component)this).GetComponent(); } private void OnEnable() { OnTransformParentChanged(); } private void OnDisable() { setDisplayedWeakPoints(Array.Empty()); _visualizersByHurtBox.Clear(); } private void OnTransformParentChanged() { _hud = ((Component)this).GetComponentInParent(); } private void FixedUpdate() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) List list = default(List); DisposableRental> val = CollectionPool>.RentCollection(ref list); try { if (Object.op_Implicit((Object)(object)_hud) && Object.op_Implicit((Object)(object)_hud.targetMaster)) { foreach (CharacterBodyExtraStatsTracker instances in InstanceTracker.GetInstancesList()) { if (instances.WeakPointHurtBoxIndex != -1 && Object.op_Implicit((Object)(object)instances.Body) && Object.op_Implicit((Object)(object)instances.Body.hurtBoxGroup)) { HurtBox safe = ArrayUtils.GetSafe(instances.Body.hurtBoxGroup.hurtBoxes, instances.WeakPointHurtBoxIndex); if (Object.op_Implicit((Object)(object)safe) && Object.op_Implicit((Object)(object)safe.healthComponent) && safe.healthComponent.alive && FriendlyFireManager.ShouldDirectHitProceed(safe.healthComponent, _hud.targetMaster.teamIndex) && (Object)(object)safe.healthComponent.body != (Object)(object)_hud.targetMaster.GetBody()) { list.Add(safe); } } } } setDisplayedWeakPoints(list); } finally { val.Dispose(); } } private void setDisplayedWeakPoints(IReadOnlyList newWeakPoints) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) List> list = default(List>); DisposableRental, List>> val = CollectionPool, List>>.RentCollection(ref list); try { foreach (UnityObjectWrapperKey key2 in _visualizersByHurtBox.Keys) { HurtBox val2 = UnityObjectWrapperKey.op_Implicit(key2); if (!Object.op_Implicit((Object)(object)val2) || !newWeakPoints.Contains(val2)) { list.Add(key2); } } foreach (UnityObjectWrapperKey item in list) { if (_visualizersByHurtBox.Remove(item, out var value)) { _pointViewer.RemoveElement(value); } } foreach (HurtBox newWeakPoint in newWeakPoints) { if (!_visualizersByHurtBox.ContainsKey(UnityObjectWrapperKey.op_Implicit(newWeakPoint))) { Dictionary, GameObject> visualizersByHurtBox = _visualizersByHurtBox; UnityObjectWrapperKey key = UnityObjectWrapperKey.op_Implicit(newWeakPoint); PointViewer pointViewer = _pointViewer; AddElementRequest val3 = new AddElementRequest { elementPrefab = VisualizerPrefab, target = ((Component)newWeakPoint).transform, targetWorldVerticalOffset = 0f }; ((AddElementRequest)(ref val3)).targetWorldRadius = 1.2f; val3.scaleWithDistance = true; visualizersByHurtBox.Add(key, pointViewer.AddElement(val3)); } } } finally { val.Dispose(); } } } public sealed class WingsAnimator : MonoBehaviour { [SerializeField] private Animator _animator; public bool Ready = true; public float FlyRate = 4f; private void OnEnable() { if (Object.op_Implicit((Object)(object)_animator)) { _animator.SetBool(JetpackController.wingsReadyParamHash, Ready); _animator.SetFloat(JetpackController.flyParamHash, FlyRate); } } } } namespace ItemQualities.Utilities { public static class AddressableUtil { private sealed class AssetAsyncReferenceManagerInstance { private static readonly FieldInfo _assetReferenceSubObjectTypeField = typeof(AssetReference).GetField("m_SubObjectType", BindingFlags.Instance | BindingFlags.NonPublic); private readonly Type _assetAsyncReferenceManagerType; private readonly Type _desiredAssetReferenceType; private readonly MethodInfo _loadAssetMethod; private readonly MethodInfo _unloadAssetMethod; private readonly MethodInfo _handleConverterMethod; public Type AssetType { get; } public AssetAsyncReferenceManagerInstance(Type assetType) { AssetType = assetType; _assetAsyncReferenceManagerType = typeof(AssetAsyncReferenceManager<>).MakeGenericType(AssetType); _desiredAssetReferenceType = typeof(AssetReferenceT<>).MakeGenericType(AssetType); _loadAssetMethod = _assetAsyncReferenceManagerType.GetMethod("LoadAsset"); _unloadAssetMethod = _assetAsyncReferenceManagerType.GetMethod("UnloadAsset"); _handleConverterMethod = ReflectionUtil.FindImplicitConverter(typeof(AsyncOperationHandle<>).MakeGenericType(assetType), typeof(AsyncOperationHandle)); } public AsyncOperationHandle LoadAssetAsync(AssetReference assetReference, AsyncReferenceHandleUnloadType unloadType = 2) { //IL_001b: 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) ensureDesiredAssetReferenceType(ref assetReference); object obj = _loadAssetMethod.Invoke(null, new object[2] { assetReference, unloadType }); return (AsyncOperationHandle)_handleConverterMethod.Invoke(null, new object[1] { obj }); } public void UnloadAsset(AssetReference assetReference) { ensureDesiredAssetReferenceType(ref assetReference); _unloadAssetMethod.Invoke(null, new object[1] { assetReference }); } private void ensureDesiredAssetReferenceType(ref AssetReference assetReference) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown if (assetReference != null) { Type type = ((object)assetReference).GetType(); if (!_desiredAssetReferenceType.IsAssignableFrom(type)) { string assetGUID = assetReference.AssetGUID; string subObjectName = assetReference.SubObjectName; string value = _assetReferenceSubObjectTypeField.GetValue(assetReference) as string; assetReference = (AssetReference)Activator.CreateInstance(_desiredAssetReferenceType, assetGUID); assetReference.SubObjectName = subObjectName; _assetReferenceSubObjectTypeField.SetValue(assetReference, value); } } } } private static readonly Dictionary _assetAsyncReferenceManagerCache = new Dictionary(); [MethodImpl(MethodImplOptions.AggressiveInlining)] public static AsyncOperationHandle LoadTempAssetAsync(string assetKey) where T : Object { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return AssetAsyncReferenceManager.LoadAsset(new AssetReferenceT(assetKey), (AsyncReferenceHandleUnloadType)0); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static AsyncOperationHandle LoadTempAssetAsync(AssetReferenceT assetReference) where T : Object { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return AssetAsyncReferenceManager.LoadAsset(assetReference, (AsyncReferenceHandleUnloadType)0); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static AsyncOperationHandle LoadAssetAsync(string assetKey, AsyncReferenceHandleUnloadType unloadType = 2) where T : Object { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return AssetAsyncReferenceManager.LoadAsset(new AssetReferenceT(assetKey), unloadType); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static AsyncOperationHandle LoadAssetAsync(AssetReferenceT assetReference, AsyncReferenceHandleUnloadType unloadType = 2) where T : Object { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) return AssetAsyncReferenceManager.LoadAsset(assetReference, unloadType); } public static AsyncOperationHandle LoadAssetAsync(AssetReference assetReference, Type assetType, AsyncReferenceHandleUnloadType unloadType = 2) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return getOrCreateAssetAsyncReferenceManager(assetType).LoadAssetAsync(assetReference, unloadType); } public static void UnloadAsset(AssetReference assetReference, Type assetType) { getOrCreateAssetAsyncReferenceManager(assetType).UnloadAsset(assetReference); } private static AssetAsyncReferenceManagerInstance getOrCreateAssetAsyncReferenceManager(Type assetType) { if (!_assetAsyncReferenceManagerCache.TryGetValue(assetType, out var value)) { _assetAsyncReferenceManagerCache.Add(assetType, value = new AssetAsyncReferenceManagerInstance(assetType)); } return value; } } internal sealed class CollectionComparer : Comparer where TCollection : ICollection { private readonly bool _descending; public static CollectionComparer SizeAscending { get; } = new CollectionComparer(descending: false); public static CollectionComparer SizeDescending { get; } = new CollectionComparer(descending: true); private CollectionComparer(bool descending) { _descending = descending; } public override int Compare(TCollection x, TCollection y) { int num = x?.Count ?? (-1); int num2 = y?.Count ?? (-1); if (!_descending) { return num - num2; } return num2 - num; } } internal static class Empty { public static readonly ReadOnlyCollection ReadOnlyCollection = new ReadOnlyCollection(Array.Empty()); } internal static class EventUtils { private static readonly Dictionary _invokeDelegateCache = new Dictionary(); public static TDelegate GetInvokeMethodDelegate(Type eventDeclaringType, string eventName) where TDelegate : Delegate { if ((object)eventDeclaringType == null) { throw new ArgumentNullException("eventDeclaringType"); } if (string.IsNullOrWhiteSpace(eventName)) { throw new ArgumentException("'eventName' cannot be null or whitespace.", "eventName"); } FieldInfo field = eventDeclaringType.GetField(eventName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); if (field == null) { Log.Error("Failed to find field: " + eventDeclaringType.FullName + "." + eventName, "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Utilities\\EventUtils.cs", "GetInvokeMethodDelegate", 28); return null; } return GetInvokeMethodDelegate(field); } public static TDelegate GetInvokeMethodDelegate(FieldInfo eventDelegateField) where TDelegate : Delegate { //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Expected O, but got Unknown //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Expected O, but got Unknown //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Expected O, but got Unknown if ((object)eventDelegateField == null) { throw new ArgumentNullException("eventDelegateField"); } if (_invokeDelegateCache.TryGetValue(eventDelegateField, out var value)) { if (!typeof(TDelegate).IsAssignableFrom(value.GetType())) { throw new ArgumentException("Invoke delegate type " + typeof(TDelegate).FullName + " does not match invoke delegate " + value.GetType().FullName, "TDelegate"); } return (TDelegate)value; } Type delegateType = eventDelegateField.FieldType; MethodInfo delegateInvokeMethod = delegateType.GetMethod("Invoke", BindingFlags.Instance | BindingFlags.Public); if ((object)delegateInvokeMethod == null) { throw new ArgumentException("Field '" + eventDelegateField.DeclaringType.FullName + "." + eventDelegateField.Name + "' is not a delegate type", "eventDelegateField"); } ParameterInfo[] parameters = delegateInvokeMethod.GetParameters(); Type[] delegateInvokeParameterTypes = Array.ConvertAll(parameters, (ParameterInfo p) => p.ParameterType); Type[] array; if (eventDelegateField.IsStatic) { array = delegateInvokeParameterTypes; } else { Type type = eventDelegateField.DeclaringType; if (type.IsValueType) { type = type.MakeByRefType(); } array = new Type[1 + delegateInvokeParameterTypes.Length]; array[0] = type; Array.Copy(delegateInvokeParameterTypes, 0, array, 1, delegateInvokeParameterTypes.Length); } DynamicMethodDefinition val = new DynamicMethodDefinition("DMD_Invoke<" + eventDelegateField.DeclaringType.FullName + "." + eventDelegateField.Name + ">", delegateInvokeMethod.ReturnType, array); try { ILContext val2 = new ILContext(val.Definition); try { val2.ReferenceBag = (IILReferenceBag)(object)RuntimeILReferenceBag.Instance; val2.Invoke((Manipulator)delegate(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_0097: 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) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) ILCursor val4 = new ILCursor(il); bool flag = !eventDelegateField.IsStatic; if (flag) { val4.Emit(OpCodes.Ldarg_0); val4.Emit(OpCodes.Ldfld, eventDelegateField); } else { val4.Emit(OpCodes.Ldsfld, eventDelegateField); } val4.Emit(OpCodes.Dup); ILLabel val5 = val4.DefineLabel(); val4.Emit(OpCodes.Brtrue, (object)val5); val4.Emit(OpCodes.Pop); if (delegateInvokeMethod.ReturnType != typeof(void)) { val4.Emit(OpCodes.Ldstr, "Attempting to invoke delegate " + eventDelegateField.DeclaringType.FullName + "." + eventDelegateField.Name + " (" + delegateType.FullName + ") without a delegate instance, the default value for the return type (" + delegateInvokeMethod.ReturnType.FullName + ") will be returned"); val4.EmitDelegate>((Action)Log.Warning_NoCallerPrefix); val4.EmitDefaultValue(delegateInvokeMethod.ReturnType); } val4.Emit(OpCodes.Ret); val4.MarkLabel(val5); for (int i = 0; i < delegateInvokeParameterTypes.Length; i++) { val4.Emit(OpCodes.Ldarg, i + (flag ? 1 : 0)); } val4.Emit(OpCodes.Call, (MethodBase)delegateInvokeMethod); val4.Emit(OpCodes.Ret); }); TDelegate val3; try { val3 = Extensions.CreateDelegate((MethodBase)val.Generate()); } catch (Exception arg) { Log.Error_NoCallerPrefix($"Failed to create delegate ({typeof(TDelegate).FullName}) for invoke method: {arg}"); return null; } _invokeDelegateCache.Add(eventDelegateField, val3); return val3; } finally { ((IDisposable)val2)?.Dispose(); } } finally { ((IDisposable)val)?.Dispose(); } } } public static class FileUtils { public static FileInfo SearchUpwards(DirectoryInfo startDir, DirectoryInfo endDir, string searchPattern) { if (startDir == null) { throw new ArgumentNullException("startDir"); } if (endDir == null) { throw new ArgumentNullException("endDir"); } if (string.IsNullOrEmpty(searchPattern)) { throw new ArgumentException("'searchPattern' cannot be null or empty.", "searchPattern"); } if (!startDir.IsChildOf(endDir)) { return null; } for (DirectoryInfo directoryInfo = startDir; directoryInfo != null; directoryInfo = directoryInfo.Parent) { FileInfo fileInfo = directoryInfo.EnumerateFiles(searchPattern, SearchOption.TopDirectoryOnly).FirstOrDefault(); if (fileInfo != null) { return fileInfo; } if (string.Equals(directoryInfo.FullName, endDir.FullName, StringComparison.OrdinalIgnoreCase)) { break; } } return null; } public static FileInfo SearchUpwards(DirectoryInfo startDir, string searchPattern) { return SearchUpwards(startDir, startDir.Root, searchPattern); } } public static class ItemQualityUtils { public static ItemQualityCounts GetTeamItemCounts(ItemQualityGroupIndex itemGroupIndex, TeamIndex teamIndex, bool requireAlive, bool requireConnected = true) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return GetTeamItemCounts(QualityCatalog.GetItemQualityGroup(itemGroupIndex), teamIndex, requireAlive, requireConnected); } public static ItemQualityCounts GetTeamItemCounts(ItemQualityGroup itemGroup, TeamIndex teamIndex, bool requireAlive, bool requireConnected = true) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)itemGroup)) { return default(ItemQualityCounts); } ItemQualityCounts left = default(ItemQualityCounts); foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { if (Object.op_Implicit((Object)(object)readOnlyInstances) && readOnlyInstances.teamIndex == teamIndex) { CharacterBody body = readOnlyInstances.GetBody(); if ((!requireAlive || (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.alive)) && (!requireConnected || (Object.op_Implicit((Object)(object)readOnlyInstances.playerCharacterMasterController) && readOnlyInstances.playerCharacterMasterController.isConnected))) { ItemQualityCounts right = readOnlyInstances.inventory.GetItemCountsEffective(itemGroup); left += right; } } } return left; } } public static class MeshUtil { private static Mesh[] _primitiveMeshCache = (Mesh[])(object)new Mesh[6]; public static Mesh GetPrimitive(PrimitiveType primitiveType) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected I4, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected I4, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) Mesh val = ArrayUtils.GetSafe(_primitiveMeshCache, (int)primitiveType); if (!Object.op_Implicit((Object)(object)val)) { GameObject val2 = GameObject.CreatePrimitive(primitiveType); if (Object.op_Implicit((Object)(object)val2)) { MeshFilter val3 = default(MeshFilter); if (val2.TryGetComponent(ref val3)) { val = val3.sharedMesh; if (Object.op_Implicit((Object)(object)val)) { ArrayUtils.EnsureCapacity(ref _primitiveMeshCache, primitiveType + 1); _primitiveMeshCache[primitiveType] = val; } } Object.Destroy((Object)(object)val2); } } return val; } } public static class ReflectionUtil { public const BindingFlags AllFlags = (BindingFlags)(-1); public static MethodInfo FindImplicitConverter() { return FindImplicitConverter(typeof(TFrom), typeof(TTo)); } public static MethodInfo FindImplicitConverter(Type from, Type to) { return findConverterMethod(from, to, "op_Implicit"); } public static MethodInfo FindExplicitConverter() { return FindExplicitConverter(typeof(TFrom), typeof(TTo)); } public static MethodInfo FindExplicitConverter(Type from, Type to) { return findConverterMethod(from, to, "op_Explicit"); } private static MethodInfo findConverterMethod(Type from, Type to, string name) { if ((object)from == null) { throw new ArgumentNullException("from"); } if ((object)to == null) { throw new ArgumentNullException("to"); } foreach (MethodInfo item in from m in @from.GetMethods(BindingFlags.Static | BindingFlags.Public).Concat(to.GetMethods(BindingFlags.Static | BindingFlags.Public)) where m.IsSpecialName && m.Name == name select m) { if (!(item.ReturnType != to)) { ParameterInfo[] parameters = item.GetParameters(); if (parameters.Length == 1 && !(parameters[0].ParameterType != from)) { return item; } } } return null; } public static MethodInfo FindEqualityOperator() { return FindEqualityOperator(); } public static MethodInfo FindEqualityOperator() { return FindEqualityOperator(typeof(T1), typeof(T2)); } public static MethodInfo FindEqualityOperator(Type typeA, Type typeB) { foreach (MethodInfo item in from m in typeA.GetMethods(BindingFlags.Static | BindingFlags.Public).Concat(typeB.GetMethods(BindingFlags.Static | BindingFlags.Public)) where m.IsSpecialName && m.Name == "op_Equality" select m) { if (!(item.ReturnType != typeof(bool))) { ParameterInfo[] parameters = item.GetParameters(); if (parameters.Length == 2 && (!(parameters[0].ParameterType != typeA) || !(parameters[0].ParameterType != typeB)) && (!(parameters[1].ParameterType != typeA) || !(parameters[1].ParameterType != typeB))) { return item; } } } return null; } } public static class RollUtil { public static int GetOverflowRoll(float percentChance, Xoroshiro128Plus rng) { int num = (int)(percentChance / 100f); if (rng.nextNormalizedFloat * 100f < percentChance % 100f) { num++; } return num; } public static int GetOverflowRoll(float percentChance, CharacterMaster master, bool sureProc) { int num = (int)(percentChance / 100f); if (CheckRoll(percentChance % 100f, master, sureProc)) { num++; } return num; } public static bool CheckRoll(float percentChance, CharacterMaster master, bool sureProc) { if (!sureProc || !(percentChance > 0f)) { return Util.CheckRoll(percentChance, master); } return true; } } public readonly struct ScopedAsyncOperationHandle : IDisposable { private readonly AsyncOperationHandle _handle; public ScopedAsyncOperationHandle(AsyncOperationHandle handle) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) _handle = handle; } public void Dispose() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle handle = _handle; if (((AsyncOperationHandle)(ref handle)).IsValid()) { Addressables.Release(_handle); } } } public readonly struct ScopedAsyncOperationHandle : IDisposable { private readonly AsyncOperationHandle _handle; public ScopedAsyncOperationHandle(AsyncOperationHandle handle) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) _handle = handle; } public void Dispose() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (_handle.IsValid()) { Addressables.Release(_handle); } } } public static class TextureUtils { public static Texture2D CreateAccessibleCopy(Texture2D texture) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown RenderTexture temporary = RenderTexture.GetTemporary(((Texture)texture).width, ((Texture)texture).height, 0, (RenderTextureFormat)0, (RenderTextureReadWrite)((!((Texture)texture).isDataSRGB) ? 1 : 2)); Graphics.Blit((Texture)(object)texture, temporary); RenderTexture active = RenderTexture.active; RenderTexture.active = temporary; Texture2D val = new Texture2D(((Texture)temporary).width, ((Texture)temporary).height, (TextureFormat)5, ((Texture)texture).mipmapCount, !((Texture)texture).isDataSRGB) { name = ((Object)texture).name }; val.ReadPixels(new Rect(0f, 0f, (float)((Texture)temporary).width, (float)((Texture)temporary).height), 0, 0); val.Apply(); RenderTexture.active = active; RenderTexture.ReleaseTemporary(temporary); return val; } } internal static class UnityUtils { public static void SortObjectsByName(T[] objects, TComparer nameComparer) where T : Object where TComparer : IComparer { string[] array = new string[objects.Length]; for (int i = 0; i < objects.Length; i++) { array[i] = ((Object)objects[i]).name; } Array.Sort(array, objects, nameComparer); } } public sealed class UnorderedCollectionComparer : EqualityComparer where TCollection : ICollection { public override bool Equals(TCollection a, TCollection b) { //IL_0050: 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) if (a == null != (b == null)) { return false; } if (a == null) { return true; } if ((object)a == (object)b) { return true; } if (a.Count != b.Count) { return false; } List list = default(List); DisposableRental> val = CollectionPool>.RentCollection(ref list); try { list.AddRange(b); foreach (T item in a) { int num = list.IndexOf(item); if (num == -1) { return false; } list.RemoveAt(num); } return list.Count == 0; } finally { val.Dispose(); } } public override int GetHashCode(TCollection collection) { if (collection == null) { return 0; } HashCode hashCode = default(HashCode); foreach (T item in collection) { hashCode.Add(item); } return hashCode.ToHashCode(); } } } namespace ItemQualities.Utilities.Extensions { internal static class AssetLoadExtensions { private static class AsyncOperationHandleStaticData { public static readonly PropertyInfo LocationNamePropertyInfo = typeof(AsyncOperationHandle).GetProperty("LocationName", BindingFlags.Instance | BindingFlags.NonPublic); } public static void OnSuccess(this in AsyncOperationHandle handle, Action onSuccess) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (handle.IsDone) { handleCompleted(in handle); return; } AsyncOperationHandle val = handle; val.Completed += onCompleted; void handleCompleted(in AsyncOperationHandle handle) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) if ((int)handle.Status != 1) { string text = AsyncOperationHandleStaticData.LocationNamePropertyInfo?.GetValue(handle) as string; if (string.IsNullOrEmpty(text)) { text = handle.DebugName; if (string.IsNullOrEmpty(text)) { text = "Unknown handle (" + typeof(T).FullName + ")"; } } Log.Error("Failed to load asset from location/handle: '" + text + "'", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Utilities\\Extensions\\AssetLoadExtensions.cs", "OnSuccess", 39); } else { onSuccess(handle.Result); } } void onCompleted(AsyncOperationHandle handle) { handleCompleted(in handle); } } public static IEnumerator AsProgressCoroutine(this AsyncOperation asyncOperation, TProgress progressReceiver) where TProgress : IProgress { while (!asyncOperation.isDone) { yield return null; progressReceiver.Report(asyncOperation.progress); } } public static IEnumerator AsProgressCoroutine(this AsyncOperationHandle asyncOperation, TProgress progressReceiver) where TProgress : IProgress { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) while (!((AsyncOperationHandle)(ref asyncOperation)).IsDone) { yield return null; progressReceiver.Report(((AsyncOperationHandle)(ref asyncOperation)).PercentComplete); } } public static IEnumerator AsProgressCoroutine(this AsyncOperationHandle asyncOperation, TProgress progressReceiver) where TProgress : IProgress { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) while (!asyncOperation.IsDone) { yield return null; progressReceiver.Report(asyncOperation.PercentComplete); } } public static void AddProgressCoroutine(this ParallelProgressCoroutine parallelProgressCoroutine, Func, IEnumerator> coroutine) { ReadableProgress val = new ReadableProgress(); parallelProgressCoroutine.Add(coroutine(val), val); } public static void AddProgressCoroutine(this ParallelProgressCoroutine parallelProgressCoroutine, Func, IEnumerator> coroutine, TArg arg) { ReadableProgress val = new ReadableProgress(); parallelProgressCoroutine.Add(coroutine(arg, val), val); } public static void Add(this ParallelProgressCoroutine parallelProgressCoroutine, AsyncOperation asyncOperation) { ReadableProgress val = new ReadableProgress(); parallelProgressCoroutine.Add(asyncOperation.AsProgressCoroutine>(val), val); } public static void Add(this ParallelProgressCoroutine parallelProgressCoroutine, in AsyncOperationHandle asyncOperation) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) ReadableProgress val = new ReadableProgress(); parallelProgressCoroutine.Add(asyncOperation.AsProgressCoroutine>(val), val); } public static void Add(this ParallelProgressCoroutine parallelProgressCoroutine, in AsyncOperationHandle asyncOperation) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) ReadableProgress val = new ReadableProgress(); parallelProgressCoroutine.Add(asyncOperation.AsProgressCoroutine>(val), val); } public static bool AssertLoaded(this in AsyncOperationHandle asyncOperation, string assetName = null, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { //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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_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) AsyncOperationHandle val = asyncOperation; if (((AsyncOperationHandle)(ref val)).IsValid()) { val = asyncOperation; if ((int)((AsyncOperationHandle)(ref val)).Status == 1) { val = asyncOperation; if (((AsyncOperationHandle)(ref val)).Result != null) { return true; } } } string text = assetName; if (text == null) { val = asyncOperation; text = ((AsyncOperationHandle)(ref val)).DebugName; } val = asyncOperation; object arg; if (!((AsyncOperationHandle)(ref val)).IsValid()) { arg = "Invalid Handle"; } else { val = asyncOperation; arg = ((AsyncOperationHandle)(ref val)).OperationException; } Log.Error($"Failed to load asset {text}: {arg}", callerPath, callerMemberName, callerLineNumber); return false; } public static bool AssertLoaded(this in AsyncOperationHandle asyncOperation, string assetName = null, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { //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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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) if (!asyncOperation.IsValid() || (int)asyncOperation.Status != 1 || asyncOperation.Result == null) { Log.Error(string.Format("Failed to load asset {0}: {1}", assetName ?? asyncOperation.DebugName, asyncOperation.IsValid() ? ((object)asyncOperation.OperationException) : ((object)"Invalid Handle")), callerPath, callerMemberName, callerLineNumber); return false; } return true; } } public static class CharacterBodyExtensions { public static int GetBuffCountRaw(this CharacterBody body, BuffIndex buffIndex) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) using (new BuffHooks.DisableBuffCountHooksScope(body)) { return body.GetBuffCount(buffIndex); } } public static bool HasBuffRaw(this CharacterBody body, BuffIndex buffIndex) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) using (new BuffHooks.DisableBuffCountHooksScope(body)) { return body.HasBuff(buffIndex); } } public static void ClearTimedBuffsRaw(this CharacterBody body, BuffIndex buffIndex) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) using (new BuffHooks.DisableBuffCountHooksScope(body)) { body.ClearTimedBuffs(buffIndex); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static BuffQualityCounts GetBuffCounts(this CharacterBody body, BuffQualityGroupIndex buffGroupIndex) { return body.GetBuffCounts(QualityCatalog.GetBuffQualityGroup(buffGroupIndex)); } public static BuffQualityCounts GetBuffCounts(this CharacterBody body, BuffQualityGroup buffGroup) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body)) { throw new ArgumentNullException("body"); } if (!Object.op_Implicit((Object)(object)buffGroup)) { return default(BuffQualityCounts); } int buffCountRaw = body.GetBuffCountRaw(buffGroup.BaseBuffIndex); int buffCountRaw2 = body.GetBuffCountRaw(buffGroup.UncommonBuffIndex); int buffCountRaw3 = body.GetBuffCountRaw(buffGroup.RareBuffIndex); int buffCountRaw4 = body.GetBuffCountRaw(buffGroup.EpicBuffIndex); int buffCountRaw5 = body.GetBuffCountRaw(buffGroup.LegendaryBuffIndex); return new BuffQualityCounts(buffCountRaw, buffCountRaw2, buffCountRaw3, buffCountRaw4, buffCountRaw5); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void RemoveAllBuffs(this CharacterBody body, BuffQualityGroupIndex buffGroupIndex) { body.RemoveAllBuffs(QualityCatalog.GetBuffQualityGroup(buffGroupIndex)); } public static void RemoveAllBuffs(this CharacterBody body, BuffQualityGroup buffGroup) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_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 (!Object.op_Implicit((Object)(object)body)) { throw new ArgumentNullException("body"); } if (!Object.op_Implicit((Object)(object)buffGroup)) { return; } for (QualityTier qualityTier = QualityTier.None; qualityTier < QualityTier.Count; qualityTier++) { BuffIndex buffIndex = buffGroup.GetBuffIndex(qualityTier); for (int num = body.GetBuffCountRaw(buffIndex); num > 0; num--) { body.RemoveBuff(buffIndex); } } } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void RemoveAllQualityBuffs(this CharacterBody body, BuffQualityGroupIndex buffGroupIndex) { body.RemoveAllQualityBuffs(QualityCatalog.GetBuffQualityGroup(buffGroupIndex)); } public static void RemoveAllQualityBuffs(this CharacterBody body, BuffQualityGroup buffGroup) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_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 (!Object.op_Implicit((Object)(object)body)) { throw new ArgumentNullException("body"); } if (!Object.op_Implicit((Object)(object)buffGroup)) { return; } for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { BuffIndex buffIndex = buffGroup.GetBuffIndex(qualityTier); for (int num = body.GetBuffCountRaw(buffIndex); num > 0; num--) { body.RemoveBuff(buffIndex); } } } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void ConvertQualityBuffsToTier(this CharacterBody body, BuffQualityGroupIndex buffGroupIndex, QualityTier buffQualityTier) { body.ConvertQualityBuffsToTier(QualityCatalog.GetBuffQualityGroup(buffGroupIndex), buffQualityTier); } public static void ConvertQualityBuffsToTier(this CharacterBody body, BuffQualityGroup buffGroup, QualityTier buffQualityTier) { convertBuffs(body, buffGroup, buffQualityTier, includeBaseBuff: false); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void ConvertAllBuffsToQualityTier(this CharacterBody body, BuffQualityGroupIndex buffGroupIndex, QualityTier buffQualityTier) { body.ConvertAllBuffsToQualityTier(QualityCatalog.GetBuffQualityGroup(buffGroupIndex), buffQualityTier); } public static void ConvertAllBuffsToQualityTier(this CharacterBody body, BuffQualityGroup buffGroup, QualityTier buffQualityTier) { convertBuffs(body, buffGroup, buffQualityTier, includeBaseBuff: true); } private static void convertBuffs(CharacterBody body, BuffQualityGroup buffGroup, QualityTier buffQualityTier, bool includeBaseBuff) { //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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Invalid comparison between Unknown and I4 //IL_004f: 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_00b5: 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_00bd: Invalid comparison between Unknown and I4 //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body)) { throw new ArgumentNullException("body"); } if (!Object.op_Implicit((Object)(object)buffGroup)) { return; } BuffIndex buffIndex = buffGroup.GetBuffIndex(buffQualityTier); BuffDef buffDef = BuffCatalog.GetBuffDef(buffIndex); for (QualityTier qualityTier = (includeBaseBuff ? QualityTier.None : QualityTier.Uncommon); qualityTier < QualityTier.Count; qualityTier++) { if (qualityTier == buffQualityTier) { continue; } BuffIndex buffIndex2 = buffGroup.GetBuffIndex(qualityTier); if ((int)buffIndex2 == -1) { continue; } for (int num = body.GetBuffCountRaw(buffIndex2); num > 0; num--) { float? num2 = null; for (int i = 0; i < body.timedBuffs.Count; i++) { TimedBuff val = body.timedBuffs[i]; if (val.buffIndex == buffIndex2) { num2 = val.timer; body.timedBuffs.RemoveAt(i); break; } } body.RemoveBuff(buffIndex2); if ((int)buffIndex != -1 && Object.op_Implicit((Object)(object)buffDef) && (buffDef.canStack || !body.HasBuffRaw(buffIndex))) { if (num2.HasValue) { body.AddTimedBuff(buffDef, num2.Value); } else { body.AddBuff(buffIndex); } } } } } } internal static class CollectionExtensions { private static class SharedSingleElementArray { public static readonly T[] Array = new T[1]; } public static void Add(this NamedAssetCollection namedAssetCollection, T value) { SharedSingleElementArray.Array[0] = value; try { namedAssetCollection.Add(SharedSingleElementArray.Array); } finally { SharedSingleElementArray.Array[0] = default(T); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static T GetSafe(this TList list, int index, in T defaultValue = default(T)) where TList : IList { if (list == null || (uint)index >= list.Count) { return defaultValue; } return list[index]; } public static int IndexOf(this TList list, T item, TComparer equalityComparer) where TList : IList where TComparer : IEqualityComparer { for (int i = 0; i < list.Count; i++) { if (equalityComparer.Equals(list[i], item)) { return i; } } return -1; } public static int LastIndexOf(this TList list, T item, TComparer equalityComparer) where TList : IList where TComparer : IEqualityComparer { for (int num = list.Count - 1; num >= 0; num--) { if (equalityComparer.Equals(list[num], item)) { return num; } } return -1; } } internal static class DamageInfoExtensions { private sealed class DamageInfoData { public bool Parried; } private static readonly FixedConditionalWeakTable _damageInfoDataLookup = new FixedConditionalWeakTable(); [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown HealthComponent.ProcParry += new hook_ProcParry(HealthComponent_ProcParry); } private static void HealthComponent_ProcParry(orig_ProcParry orig, HealthComponent self, DamageInfo damageInfo) { orig.Invoke(self, damageInfo); _damageInfoDataLookup.GetOrCreateValue(damageInfo).Parried = true; } public static bool IsParried(this DamageInfo damageInfo) { DamageInfoData damageInfoData = default(DamageInfoData); if (_damageInfoDataLookup.TryGetValue(damageInfo, ref damageInfoData)) { return damageInfoData.Parried; } return false; } } internal static class DictionaryExtensions { public static TValue GetOrAddNew(this TDict dictionary, TKey key) where TDict : IDictionary where TValue : new() { if (!dictionary.TryGetValue(key, out var value)) { dictionary.Add(key, value = new TValue()); } return value; } } internal static class EntityStateConfigurationExtensions { public static bool TryGetFieldValue(this EntityStateConfiguration entityStateConfiguration, string fieldName, out T value) { //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_009e: 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_0063: Unknown result type (might be due to invalid IL or missing references) SerializedField[] serializedFields = entityStateConfiguration.serializedFieldsCollection.serializedFields; foreach (SerializedField val in serializedFields) { if (!(val.fieldName == fieldName)) { continue; } if (typeof(Object).IsAssignableFrom(typeof(T))) { if (!Object.op_Implicit(val.fieldValue.objectValue)) { value = default(T); return true; } Object objectValue = val.fieldValue.objectValue; if (!(objectValue is T)) { break; } T val2 = (T)(object)((objectValue is T) ? objectValue : null); value = val2; return true; } try { value = (T)StringSerializer.Deserialize(typeof(T), val.fieldValue.stringValue); return true; } catch (Exception ex) { Log.Error($"Failed to deserialize field value '{val.fieldValue.stringValue}' for field {val.fieldName} in {entityStateConfiguration}: {ex}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Utilities\\Extensions\\EntityStateConfigurationExtensions.cs", "TryGetFieldValue", 38); } break; } value = default(T); return false; } public static bool TrySetFieldValue(this EntityStateConfiguration entityStateConfiguration, string fieldName, T value) { ref SerializedFieldCollection serializedFieldsCollection = ref entityStateConfiguration.serializedFieldsCollection; for (int i = 0; i < serializedFieldsCollection.serializedFields.Length; i++) { ref SerializedField reference = ref serializedFieldsCollection.serializedFields[i]; if (!(reference.fieldName == fieldName)) { continue; } if (!typeof(Object).IsAssignableFrom(typeof(T))) { try { reference.fieldValue.stringValue = StringSerializer.Serialize(typeof(T), (object)value); return true; } catch (Exception ex) { Log.Error($"Failed to serialize field value '{value}' for field {reference.fieldName} in {entityStateConfiguration}: {ex}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Utilities\\Extensions\\EntityStateConfigurationExtensions.cs", "TrySetFieldValue", 74); } break; } ref Object objectValue = ref reference.fieldValue.objectValue; object obj = value; objectValue = (Object)((obj is Object) ? obj : null); return true; } return false; } } internal static class EntityStateExtensions { public static bool TryGetComponent(this EntityState entityState, Type componentType, out Component component) { if (!Object.op_Implicit((Object)(object)entityState?.outer)) { component = null; return false; } return ((Component)entityState.outer).TryGetComponent(componentType, ref component); } internal static bool TryGetComponentCached(this EntityState entityState, out T component) where T : Component { if (!Object.op_Implicit((Object)(object)entityState?.outer)) { component = default(T); return false; } return ((Component)(object)entityState.outer).TryGetComponentCached(out component); } internal static T GetComponentCached(this EntityState entityState) where T : Component { if (!Object.op_Implicit((Object)(object)entityState?.outer)) { return default(T); } return ((Component)(object)entityState.outer).GetComponentCached(); } } public static class EquipmentExtensions { public static QualityTier GetCurrentEquipmentActionQualityTier(this EquipmentSlot equipmentSlot) { if (!Object.op_Implicit((Object)(object)equipmentSlot)) { throw new ArgumentNullException("equipmentSlot"); } if (!EquipmentHooks.TryGetCurrentEquipmentAction(equipmentSlot, out var action)) { return QualityTier.None; } return action.QualityTier; } public static QualityTier GetActiveEquipmentQualityTier(this EquipmentSlot equipmentSlot) { if (!Object.op_Implicit((Object)(object)equipmentSlot)) { throw new ArgumentNullException("equipmentSlot"); } if (!Object.op_Implicit((Object)(object)equipmentSlot.characterBody) || !Object.op_Implicit((Object)(object)equipmentSlot.characterBody.inventory)) { return QualityTier.None; } return equipmentSlot.characterBody.inventory.GetActiveEquipmentQualityTier(); } public static QualityTier GetActiveEquipmentQualityTier(this Inventory inventory) { if (!Object.op_Implicit((Object)(object)inventory)) { throw new ArgumentNullException("inventory"); } byte activeEquipmentSlot = inventory.activeEquipmentSlot; if (activeEquipmentSlot >= inventory.activeEquipmentSet.Length) { return QualityTier.None; } byte set = inventory.activeEquipmentSet[activeEquipmentSlot]; return inventory.GetEquipmentQualityTier(activeEquipmentSlot, set); } public static QualityTier GetEquipmentQualityTier(this Inventory inventory, uint slot, uint set) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return QualityCatalog.GetQualityTier(inventory.GetEquipment(slot, set).equipmentIndex); } public static EquipmentState WithQualityTier(this EquipmentState equipmentState, QualityTier qualityTier) { //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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) EquipmentIndex equipmentIndexOfQuality = QualityCatalog.GetEquipmentIndexOfQuality(equipmentState.equipmentIndex, qualityTier); if (equipmentIndexOfQuality != equipmentState.equipmentIndex) { equipmentState.equipmentIndex = equipmentIndexOfQuality; equipmentState.equipmentDef = EquipmentCatalog.GetEquipmentDef(equipmentState.equipmentIndex); } return equipmentState; } public static bool HasAnyQualityEquipment(this Inventory inventory, EquipmentQualityGroupIndex equipmentGroupIndex, QualityTier minQualityTier = QualityTier.Uncommon) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (!Object.op_Implicit((Object)(object)inventory)) { throw new ArgumentNullException("inventory"); } int equipmentSlotCount = inventory.GetEquipmentSlotCount(); for (uint num = 0u; num < equipmentSlotCount; num++) { int equipmentSetCount = inventory.GetEquipmentSetCount(num); for (uint num2 = 0u; num2 < equipmentSetCount; num2++) { EquipmentState equipment = inventory.GetEquipment(num, num2); if (QualityCatalog.FindEquipmentQualityGroupIndex(equipment.equipmentIndex) == equipmentGroupIndex && QualityCatalog.GetQualityTier(equipment.equipmentIndex) >= minQualityTier) { return true; } } } return false; } } internal static class FileExtensions { public static bool IsChildOf(this DirectoryInfo dir, DirectoryInfo other) { if (dir != null && other != null) { return dir.FullName.StartsWith(other.FullName, ignoreCase: true, CultureInfo.InvariantCulture); } return false; } } public static class InventoryExtensions { [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ItemQualityCounts GetItemCountsEffective(this Inventory inventory, ItemQualityGroupIndex itemGroupIndex) { return inventory.GetItemCountsEffective(QualityCatalog.GetItemQualityGroup(itemGroupIndex)); } public static ItemQualityCounts GetItemCountsEffective(this Inventory inventory, ItemQualityGroup itemGroup) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)inventory)) { throw new ArgumentNullException("inventory"); } if (!Object.op_Implicit((Object)(object)itemGroup)) { return default(ItemQualityCounts); } int baseItemCount = inventory.CalculateEffectiveItemStacks(itemGroup.BaseItemIndex); int itemCountEffective = inventory.GetItemCountEffective(itemGroup.UncommonItemIndex); int itemCountEffective2 = inventory.GetItemCountEffective(itemGroup.RareItemIndex); int itemCountEffective3 = inventory.GetItemCountEffective(itemGroup.EpicItemIndex); int itemCountEffective4 = inventory.GetItemCountEffective(itemGroup.LegendaryItemIndex); return new ItemQualityCounts(baseItemCount, itemCountEffective, itemCountEffective2, itemCountEffective3, itemCountEffective4); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ItemQualityCounts GetItemCountsPermanent(this Inventory inventory, ItemQualityGroupIndex itemGroupIndex) { return inventory.GetItemCountsPermanent(QualityCatalog.GetItemQualityGroup(itemGroupIndex)); } public static ItemQualityCounts GetItemCountsPermanent(this Inventory inventory, ItemQualityGroup itemGroup) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)inventory)) { throw new ArgumentNullException("inventory"); } if (!Object.op_Implicit((Object)(object)itemGroup)) { return default(ItemQualityCounts); } int itemCountPermanent = inventory.GetItemCountPermanent(itemGroup.BaseItemIndex); int itemCountPermanent2 = inventory.GetItemCountPermanent(itemGroup.UncommonItemIndex); int itemCountPermanent3 = inventory.GetItemCountPermanent(itemGroup.RareItemIndex); int itemCountPermanent4 = inventory.GetItemCountPermanent(itemGroup.EpicItemIndex); int itemCountPermanent5 = inventory.GetItemCountPermanent(itemGroup.LegendaryItemIndex); return new ItemQualityCounts(itemCountPermanent, itemCountPermanent2, itemCountPermanent3, itemCountPermanent4, itemCountPermanent5); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void GiveItemsPermanent(this Inventory inventory, ItemQualityGroupIndex itemGroupIndex, in ItemQualityCounts counts) { inventory.GiveItemsPermanent(QualityCatalog.GetItemQualityGroup(itemGroupIndex), in counts); } public static void GiveItemsPermanent(this Inventory inventory, ItemQualityGroup itemGroup, in ItemQualityCounts counts) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)inventory)) { throw new ArgumentNullException("inventory"); } if (Object.op_Implicit((Object)(object)itemGroup)) { inventory.GiveItemPermanent(itemGroup.BaseItemIndex, counts.BaseItemCount); inventory.GiveItemPermanent(itemGroup.UncommonItemIndex, counts.UncommonCount); inventory.GiveItemPermanent(itemGroup.RareItemIndex, counts.RareCount); inventory.GiveItemPermanent(itemGroup.EpicItemIndex, counts.EpicCount); inventory.GiveItemPermanent(itemGroup.LegendaryItemIndex, counts.LegendaryCount); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ItemQualityCounts GetItemCountsTemp(this Inventory inventory, ItemQualityGroupIndex itemGroupIndex) { return inventory.GetItemCountsTemp(QualityCatalog.GetItemQualityGroup(itemGroupIndex)); } public static ItemQualityCounts GetItemCountsTemp(this Inventory inventory, ItemQualityGroup itemGroup) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)inventory)) { throw new ArgumentNullException("inventory"); } if (!Object.op_Implicit((Object)(object)itemGroup)) { return default(ItemQualityCounts); } int itemCountTemp = inventory.GetItemCountTemp(itemGroup.BaseItemIndex); int itemCountTemp2 = inventory.GetItemCountTemp(itemGroup.UncommonItemIndex); int itemCountTemp3 = inventory.GetItemCountTemp(itemGroup.RareItemIndex); int itemCountTemp4 = inventory.GetItemCountTemp(itemGroup.EpicItemIndex); int itemCountTemp5 = inventory.GetItemCountTemp(itemGroup.LegendaryItemIndex); return new ItemQualityCounts(itemCountTemp, itemCountTemp2, itemCountTemp3, itemCountTemp4, itemCountTemp5); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static TempItemQualityCounts GetTempItemsDecayValue(this Inventory inventory, ItemQualityGroupIndex itemGroupIndex) { return inventory.GetTempItemsDecayValue(QualityCatalog.GetItemQualityGroup(itemGroupIndex)); } public static TempItemQualityCounts GetTempItemsDecayValue(this Inventory inventory, ItemQualityGroup itemGroup) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)inventory)) { throw new ArgumentNullException("inventory"); } if (!Object.op_Implicit((Object)(object)itemGroup)) { return default(TempItemQualityCounts); } float tempItemDecayValue = inventory.GetTempItemDecayValue(itemGroup.BaseItemIndex); float tempItemDecayValue2 = inventory.GetTempItemDecayValue(itemGroup.UncommonItemIndex); float tempItemDecayValue3 = inventory.GetTempItemDecayValue(itemGroup.RareItemIndex); float tempItemDecayValue4 = inventory.GetTempItemDecayValue(itemGroup.EpicItemIndex); float tempItemDecayValue5 = inventory.GetTempItemDecayValue(itemGroup.LegendaryItemIndex); return new TempItemQualityCounts(tempItemDecayValue, tempItemDecayValue2, tempItemDecayValue3, tempItemDecayValue4, tempItemDecayValue5); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static TempItemQualityCounts GetTempItemsRawValue(this Inventory inventory, ItemQualityGroupIndex itemGroupIndex) { return inventory.GetTempItemsRawValue(QualityCatalog.GetItemQualityGroup(itemGroupIndex)); } public static TempItemQualityCounts GetTempItemsRawValue(this Inventory inventory, ItemQualityGroup itemGroup) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)inventory)) { throw new ArgumentNullException("inventory"); } if (!Object.op_Implicit((Object)(object)itemGroup)) { return default(TempItemQualityCounts); } float tempItemRawValue = inventory.GetTempItemRawValue(itemGroup.BaseItemIndex); float tempItemRawValue2 = inventory.GetTempItemRawValue(itemGroup.UncommonItemIndex); float tempItemRawValue3 = inventory.GetTempItemRawValue(itemGroup.RareItemIndex); float tempItemRawValue4 = inventory.GetTempItemRawValue(itemGroup.EpicItemIndex); float tempItemRawValue5 = inventory.GetTempItemRawValue(itemGroup.LegendaryItemIndex); return new TempItemQualityCounts(tempItemRawValue, tempItemRawValue2, tempItemRawValue3, tempItemRawValue4, tempItemRawValue5); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void GiveItemsTemp(this Inventory inventory, ItemQualityGroupIndex itemGroupIndex, in TempItemQualityCounts counts) { inventory.GiveItemsTemp(QualityCatalog.GetItemQualityGroup(itemGroupIndex), in counts); } public static void GiveItemsTemp(this Inventory inventory, ItemQualityGroup itemGroup, in TempItemQualityCounts counts) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)inventory)) { throw new ArgumentNullException("inventory"); } if (Object.op_Implicit((Object)(object)itemGroup)) { inventory.GiveItemTemp(itemGroup.BaseItemIndex, counts.BaseItemCount); inventory.GiveItemTemp(itemGroup.UncommonItemIndex, counts.UncommonCount); inventory.GiveItemTemp(itemGroup.RareItemIndex, counts.RareCount); inventory.GiveItemTemp(itemGroup.EpicItemIndex, counts.EpicCount); inventory.GiveItemTemp(itemGroup.LegendaryItemIndex, counts.LegendaryCount); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ItemQualityCounts GetItemCountsChanneled(this Inventory inventory, ItemQualityGroupIndex itemGroupIndex) { return inventory.GetItemCountsChanneled(QualityCatalog.GetItemQualityGroup(itemGroupIndex)); } public static ItemQualityCounts GetItemCountsChanneled(this Inventory inventory, ItemQualityGroup itemGroup) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)inventory)) { throw new ArgumentNullException("inventory"); } if (!Object.op_Implicit((Object)(object)itemGroup)) { return default(ItemQualityCounts); } int itemCountChanneled = inventory.GetItemCountChanneled(itemGroup.BaseItemIndex); int itemCountChanneled2 = inventory.GetItemCountChanneled(itemGroup.UncommonItemIndex); int itemCountChanneled3 = inventory.GetItemCountChanneled(itemGroup.RareItemIndex); int itemCountChanneled4 = inventory.GetItemCountChanneled(itemGroup.EpicItemIndex); int itemCountChanneled5 = inventory.GetItemCountChanneled(itemGroup.LegendaryItemIndex); return new ItemQualityCounts(itemCountChanneled, itemCountChanneled2, itemCountChanneled3, itemCountChanneled4, itemCountChanneled5); } public static bool HasAtLeastXTotalQualityItemsOfTierForPurchase(this Inventory inventory, ItemTier itemTier, int x) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_0065: 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) if (!Object.op_Implicit((Object)(object)inventory)) { throw new ArgumentNullException("inventory"); } if (inventory.inventoryDisabled) { return false; } if (x <= 0) { return true; } int num = 0; foreach (ItemIndex item in inventory.itemAcquisitionOrder) { ItemDef itemDef = ItemCatalog.GetItemDef(item); if (Object.op_Implicit((Object)(object)itemDef) && itemDef.canRemove && !itemDef.ContainsTag((ItemTag)33) && itemDef.tier == itemTier && QualityCatalog.GetQualityTier(item) > QualityTier.None) { num += inventory.GetItemCountPermanent(item); if (num >= x) { return true; } } } return false; } public static bool HasAtLeastXTotalNonQualityItemsOfTierForPurchase(this Inventory inventory, ItemTier itemTier, int x) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)inventory)) { throw new ArgumentNullException("inventory"); } if (inventory.inventoryDisabled) { return false; } if (x <= 0) { return true; } int num = 0; foreach (ItemIndex item in inventory.itemAcquisitionOrder) { if (QualityCatalog.GetQualityTier(item) != QualityTier.None && QualityCatalog.FindItemQualityGroupIndex(item) != ItemQualitiesContent.ItemQualityGroups.RegeneratingScrap.GroupIndex) { continue; } ItemDef itemDef = ItemCatalog.GetItemDef(item); if (Object.op_Implicit((Object)(object)itemDef) && itemDef.canRemove && !itemDef.ContainsTag((ItemTag)33) && itemDef.tier == itemTier) { num += inventory.GetItemCountPermanent(item); if (num >= x) { return true; } } } return false; } } internal static class ObjectExtensions { private static readonly Dictionary _cloneConstructorCache = new Dictionary(); public static T ShallowCopy(this T source, BindingFlags fieldBindingFlags = BindingFlags.Instance | BindingFlags.Public) { if (source == null) { return default(T); } if (source is ValueType) { return source; } if ((object)source is ICloneable cloneable) { return (T)cloneable.Clone(); } Type type = source.GetType(); if (TryFindCloneConstructor(type, out var cloneConstructor)) { return (T)cloneConstructor.Invoke(new object[1] { source }); } T dest = (T)Activator.CreateInstance(type); source.ShallowCopy(ref dest, fieldBindingFlags); return dest; } public static void ShallowCopy(this T source, ref T dest, BindingFlags fieldBindingFlags = BindingFlags.Instance | BindingFlags.Public) { if (source == null) { dest = default(T); return; } if (source is ValueType) { dest = source; return; } if ((object)source is ICloneable cloneable) { dest = (T)cloneable.Clone(); return; } FieldInfo[] fields = source.GetType().GetFields(fieldBindingFlags); foreach (FieldInfo fieldInfo in fields) { try { Type fieldType = fieldInfo.FieldType; object obj = fieldInfo.GetValue(source); if (obj is ICloneable cloneable2) { obj = cloneable2.Clone(); } else if (fieldType.IsClass && obj != null && !(obj is Object)) { if (TryFindCloneConstructor(fieldType, out var cloneConstructor)) { try { obj = cloneConstructor.Invoke(new object[1] { obj }); } catch (Exception ex) { Log.Error_NoCallerPrefix($"Failed to copy {fieldInfo.DeclaringType.FullName}.{fieldInfo.Name} ({fieldType.FullName}) via constructor, same object instance will be used in the cloned object: {ex}"); } } else { Log.Warning("Failed to find copy method for reference type field " + fieldInfo.DeclaringType.FullName + "." + fieldInfo.Name + " (" + fieldType.FullName + "), same object instance will be used in the cloned object.", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Utilities\\Extensions\\ObjectExtensions.cs", "ShallowCopy", 81); } } fieldInfo.SetValue(dest, obj); } catch (Exception ex2) { Log.Warning_NoCallerPrefix($"Failed to set copy field value {fieldInfo.DeclaringType.FullName}.{fieldInfo.Name} ({fieldInfo.FieldType.FullName}): {ex2}"); } } } public static bool TryFindCloneConstructor(Type type, out ConstructorInfo cloneConstructor) { if (_cloneConstructorCache.TryGetValue(type, out cloneConstructor)) { return true; } ConstructorInfo constructorInfo = null; Type type2 = null; ConstructorInfo[] constructors = type.GetConstructors(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (ConstructorInfo constructorInfo2 in constructors) { ParameterInfo[] parameters = constructorInfo2.GetParameters(); if (parameters.Length == 1) { Type parameterType = parameters[0].ParameterType; if (parameterType.IsAssignableFrom(type) && (type2 == null || (parameterType != type2 && type2.IsAssignableFrom(parameterType)))) { constructorInfo = constructorInfo2; type2 = parameterType; } } } cloneConstructor = constructorInfo; if (cloneConstructor == null) { return false; } _cloneConstructorCache[type] = cloneConstructor; return true; } } internal static class PatchExtensions { private static FieldInfo _cachedDecimalZeroFieldInfo; public static void EmitSkipMethodCall(this ILCursor c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) c.EmitSkipMethodCall(OpCodes.Br); } public static void EmitSkipMethodCall(this ILCursor c, OpCode branchOpCode) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) c.EmitSkipMethodCall(branchOpCode, null); } public static void EmitSkipMethodCall(this ILCursor c, Action emitSkippedReturnValue) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) c.EmitSkipMethodCall(OpCodes.Br, emitSkippedReturnValue); } public static void EmitSkipMethodCall(this ILCursor c, OpCode branchOpCode, Action emitSkippedReturnValue) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_0135: 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_014a: Invalid comparison between Unknown and I4 //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) if (c == null) { throw new ArgumentNullException("c"); } if ((int)((OpCode)(ref branchOpCode)).FlowControl != 0 && (int)((OpCode)(ref branchOpCode)).FlowControl != 3) { throw new ArgumentException($"Invalid branch OpCode: {branchOpCode}"); } MethodReference val = default(MethodReference); if (c.Next == null || !ILPatternMatchingExt.MatchCallOrCallvirt(c.Next, ref val)) { Log.Error($"Failed to find method call to skip: {((MemberReference)c.Context.Method).FullName} at instruction {c.Next.SafeToString()} ({c.Index})", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Utilities\\Extensions\\PatchExtensions.cs", "EmitSkipMethodCall", 74); return; } MethodDefinition val2 = Extensions.SafeResolve(val); if (val2 == null) { Log.Error($"Failed to resolve method '{((MemberReference)val).FullName}': {((MemberReference)c.Context.Method).FullName} at instruction {c.Next.SafeToString()} ({c.Index})", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Utilities\\Extensions\\PatchExtensions.cs", "EmitSkipMethodCall", 82); return; } int num = ((MethodReference)val2).Parameters.Count + ((!val2.IsStatic) ? 1 : 0); bool flag = Extensions.Is((MemberReference)(object)((MethodReference)val2).ReturnType, (MemberInfo)typeof(void)); ILLabel val3 = c.DefineLabel(); if ((int)((OpCode)(ref branchOpCode)).FlowControl == 0) { c.Emit(OpCodes.Ldc_I4_0); c.Emit(((int)((OpCode)(ref branchOpCode)).OperandType == 15) ? OpCodes.Brfalse_S : OpCodes.Brfalse, (object)val3); } else { c.Emit(branchOpCode, (object)val3); } int index = c.Index; c.Index = index + 1; if (num == 0 && flag) { c.MarkLabel(val3); return; } ILLabel val4 = c.DefineLabel(); c.Emit(OpCodes.Br, (object)val4); c.MarkLabel(val3); for (int i = 0; i < num; i++) { c.Emit(OpCodes.Pop); } if (emitSkippedReturnValue != null) { emitSkippedReturnValue(c); } else if (!flag) { Log.Warning($"Skipped method ({((MemberReference)val2).FullName}) is not void, emitting default value: {((MemberReference)c.Context.Method).FullName} at instruction {c.Next.SafeToString()} ({c.Index})", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Utilities\\Extensions\\PatchExtensions.cs", "EmitSkipMethodCall", 128); c.EmitDefaultValue(((MethodReference)val2).ReturnType); } c.MarkLabel(val4); } public static void EmitDefaultValue(this ILCursor cursor) { cursor.EmitDefaultValue(Extensions.Import(cursor.IL, typeof(T))); } public static void EmitDefaultValue(this ILCursor cursor, Type type) { cursor.EmitDefaultValue(Extensions.Import(cursor.IL, type)); } public static void EmitDefaultValue(this ILCursor cursor, TypeReference type) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) if (type == null || Extensions.Is((MemberReference)(object)type, (MemberInfo)typeof(void))) { return; } if (!type.IsValueType) { cursor.Emit(OpCodes.Ldnull); return; } switch (type.GetTypeCode()) { case TypeCode.Boolean: case TypeCode.Char: case TypeCode.SByte: case TypeCode.Byte: case TypeCode.Int16: case TypeCode.UInt16: case TypeCode.Int32: case TypeCode.UInt32: cursor.Emit(OpCodes.Ldc_I4_0); break; case TypeCode.Int64: case TypeCode.UInt64: cursor.Emit(OpCodes.Ldc_I4_0); cursor.Emit(OpCodes.Conv_I8); break; case TypeCode.Single: cursor.Emit(OpCodes.Ldc_R4, 0f); break; case TypeCode.Double: cursor.Emit(OpCodes.Ldc_R8, 0.0); break; case TypeCode.Decimal: if ((object)_cachedDecimalZeroFieldInfo == null) { _cachedDecimalZeroFieldInfo = typeof(decimal).GetField("Zero", BindingFlags.DeclaredOnly | BindingFlags.Static | BindingFlags.Public); } cursor.Emit(OpCodes.Ldsfld, _cachedDecimalZeroFieldInfo); break; default: { VariableDefinition val = cursor.Context.AddVariable(type); cursor.Emit(OpCodes.Ldloca, val); cursor.Emit(OpCodes.Initobj, type); cursor.Emit(OpCodes.Ldloc, val); break; } } } public static TypeCode GetTypeCode(this TypeReference type) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (type == null) { return TypeCode.Empty; } TypeReference val = null; TypeDefinition val2 = Extensions.SafeResolve(type); if (val2 != null && val2.IsEnum) { Enumerator enumerator = val2.Fields.GetEnumerator(); try { while (enumerator.MoveNext()) { FieldDefinition current = enumerator.Current; if (!current.IsStatic) { val = ((FieldReference)current).FieldType; break; } } } finally { ((IDisposable)enumerator).Dispose(); } } return ((MemberReference)(val ?? type)).FullName switch { "System.DBNull" => TypeCode.DBNull, "System.Boolean" => TypeCode.Boolean, "System.Char" => TypeCode.Char, "System.SByte" => TypeCode.SByte, "System.Byte" => TypeCode.Byte, "System.Int16" => TypeCode.Int16, "System.UInt16" => TypeCode.UInt16, "System.Int32" => TypeCode.Int32, "System.UInt32" => TypeCode.UInt32, "System.Int64" => TypeCode.Int64, "System.UInt64" => TypeCode.UInt64, "System.Single" => TypeCode.Single, "System.Double" => TypeCode.Double, "System.Decimal" => TypeCode.Decimal, "System.DateTime" => TypeCode.DateTime, "System.String" => TypeCode.String, _ => TypeCode.Object, }; } public static bool TryFindForeachContinueLabel(this ILCursor cursor, out ILLabel continueLabel) { ILCursor val = cursor.Clone(); int enumeratorLocalIndex = -1; MethodReference method2 = default(MethodReference); if (!val.TryGotoPrev(new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref method2) && isEnumerableGetEnumerator(method2) }) || !val.TryGotoNext(new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref enumeratorLocalIndex) })) { Log.Warning("Failed to find GetEnumerator call", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Utilities\\Extensions\\PatchExtensions.cs", "TryFindForeachContinueLabel", 283); continueLabel = null; return false; } val = cursor.Clone(); if (!val.TryGotoNext((MoveType)0, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, enumeratorLocalIndex), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "MoveNext") })) { Log.Warning("Failed to find matching MoveNext call", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Utilities\\Extensions\\PatchExtensions.cs", "TryFindForeachContinueLabel", 293); continueLabel = null; return false; } continueLabel = val.MarkLabel(); return true; static bool isEnumerableGetEnumerator(MethodReference method) { if (method == null) { return false; } if (!string.Equals(((MemberReference)method).Name, "GetEnumerator")) { return false; } return true; } } public static bool TryFindForeachVariable(this ILCursor cursor, out VariableDefinition foreachVariable) { ILCursor obj = cursor.Clone(); int foreachVariableIndex = -1; MethodReference method2 = default(MethodReference); if (!obj.TryGotoPrev((MoveType)0, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref method2) && isEnumeratorGetCurrent(method2), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref foreachVariableIndex) })) { Log.Warning("Failed to find matching get_Current call", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Utilities\\Extensions\\PatchExtensions.cs", "TryFindForeachVariable", 324); foreachVariable = null; return false; } foreachVariable = cursor.Context.Method.Body.Variables[foreachVariableIndex]; return true; static bool isEnumeratorGetCurrent(MethodReference method) { if (method == null) { return false; } if (!string.Equals(((MemberReference)method).Name, "get_Current")) { return false; } return true; } } public static string SafeToString(this Instruction instruction) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (instruction == null) { return "NULL"; } try { return ((object)instruction).ToString(); } catch { } StringBuilder stringBuilder = StringBuilderPool.RentStringBuilder(); try { StringBuilder stringBuilder2 = stringBuilder.Append(formatLabel(instruction)).Append(": "); OpCode opCode = instruction.OpCode; stringBuilder2.Append(((OpCode)(ref opCode)).Name); if (instruction.Operand != null) { stringBuilder.Append(' '); object operand = instruction.Operand; Instruction val = (Instruction)((operand is Instruction) ? operand : null); if (val == null) { if (operand is IEnumerable source) { stringBuilder.Append('[').Append(string.Join(", ", source.Select(formatLabel))).Append(']'); } else { stringBuilder.Append(instruction.Operand); } } else { stringBuilder.Append(formatLabel(val)); } } return stringBuilder.ToString(); } finally { StringBuilderPool.ReturnStringBuilder(stringBuilder); } static string formatLabel(Instruction instruction) { if (instruction == null) { return "IL_????"; } return $"IL_{instruction.Offset:x4}"; } } public static bool TryFindParameter(this MethodReference method, Type parameterType, string parameterName, out ParameterDefinition parameter) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) if (method == null) { throw new ArgumentNullException("method"); } if (parameterType == null && string.IsNullOrEmpty(parameterName)) { throw new ArgumentException("Cannot find parameter for method " + ((MemberReference)method).FullName + ": Neither parameter type or name specified"); } if (method.HasParameters) { Enumerator enumerator = method.Parameters.GetEnumerator(); try { while (enumerator.MoveNext()) { ParameterDefinition current = enumerator.Current; if ((string.IsNullOrEmpty(parameterName) || ((ParameterReference)current).Name == parameterName) && (parameterType == null || Extensions.Is((MemberReference)(object)((ParameterReference)current).ParameterType, (MemberInfo)parameterType))) { parameter = current; return true; } } } finally { ((IDisposable)enumerator).Dispose(); } } parameter = null; return false; } public static bool TryFindParameter(this MethodReference method, string name, out ParameterDefinition parameter) { return method.TryFindParameter(null, name, out parameter); } public static bool TryFindParameter(this MethodReference method, Type type, out ParameterDefinition parameter) { return method.TryFindParameter(type, null, out parameter); } public static bool TryFindParameter(this MethodReference method, string name, out ParameterDefinition parameter) { return method.TryFindParameter(typeof(T), name, out parameter); } public static bool TryFindParameter(this MethodReference method, out ParameterDefinition parameter) { return method.TryFindParameter(typeof(T), null, out parameter); } public static VariableDefinition AddVariable(this ILContext context, TypeReference variableType) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown VariableDefinition val = new VariableDefinition(variableType); context.Method.Body.Variables.Add(val); return val; } public static VariableDefinition AddVariable(this ILContext context, Type variableType) { return context.AddVariable(context.Import(variableType)); } public static VariableDefinition AddVariable(this ILContext context) { return context.AddVariable(context.Import(typeof(T))); } public static void EmitStoreStack(this ILCursor cursor, params VariableDefinition[] variables) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (cursor == null) { throw new ArgumentNullException("cursor"); } if (variables == null) { throw new ArgumentNullException("variables"); } if (variables.Length != 0) { for (int num = variables.Length - 1; num >= 1; num--) { cursor.Emit(OpCodes.Stloc, variables[num]); } cursor.Emit(OpCodes.Dup); cursor.Emit(OpCodes.Stloc, variables[0]); for (int i = 1; i < variables.Length; i++) { cursor.Emit(OpCodes.Ldloc, variables[i]); } } } public static bool MatchAny(this Instruction instr, out Instruction instruction) { instruction = instr; return true; } public static bool MatchImplicitConversion(this Instruction instruction) { MethodInfo methodInfo = ReflectionUtil.FindImplicitConverter(); if (methodInfo != null) { return ILPatternMatchingExt.MatchCallOrCallvirt(instruction, (MethodBase)methodInfo); } return false; } public static bool MatchOpEquality(this Instruction instruction) { return instruction.MatchOpEquality(); } public static bool MatchOpEquality(this Instruction instruction) { MethodInfo methodInfo = ReflectionUtil.FindEqualityOperator(); if (methodInfo != null) { return ILPatternMatchingExt.MatchCallOrCallvirt(instruction, (MethodBase)methodInfo); } return false; } public static bool MatchLdloc(this Instruction instruction, ILContext il, out VariableDefinition variableDefinition) { if (instruction == null) { throw new ArgumentNullException("instruction"); } if (il == null) { throw new ArgumentNullException("il"); } MethodDefinition method = il.Method; object obj; if (method == null) { obj = null; } else { MethodBody body = method.Body; obj = ((body != null) ? body.Variables : null); } if (obj == null) { Log.Error("Attempting to match ldloc instruction on method without a body: " + ((MemberReference)il.Method).FullName, "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Utilities\\Extensions\\PatchExtensions.cs", "MatchLdloc", 593); variableDefinition = null; return false; } int num = default(int); if (ILPatternMatchingExt.MatchLdloc(instruction, ref num)) { Collection variables = il.Method.Body.Variables; int index = num; VariableDefinition defaultValue = null; variableDefinition = variables.GetSafe>(index, in defaultValue); return variableDefinition != null; } variableDefinition = null; return false; } public static bool MatchLdloc(this Instruction instruction, Type variableType, ILContext il, out VariableDefinition variableDefinition) { if ((object)variableType == null) { throw new ArgumentNullException("variableType"); } if (instruction.MatchLdloc(il, out variableDefinition)) { return Extensions.Is((MemberReference)(object)((VariableReference)variableDefinition).VariableType, (MemberInfo)variableType); } return false; } public static bool MatchLdloc(this Instruction instruction, ILContext il, out VariableDefinition variableDefinition) { if (instruction.MatchLdloc(il, out variableDefinition)) { return Extensions.Is((MemberReference)(object)((VariableReference)variableDefinition).VariableType, (MemberInfo)typeof(TVariable)); } return false; } public static bool MatchLdloc(this Instruction instruction, VariableDefinition variableDefinition) { return ILPatternMatchingExt.MatchLdloc(instruction, ((VariableReference)variableDefinition).Index); } public static bool MatchLdloca(this Instruction instruction, ILContext il, out VariableDefinition variableDefinition) { if (instruction == null) { throw new ArgumentNullException("instruction"); } if (il == null) { throw new ArgumentNullException("il"); } MethodDefinition method = il.Method; object obj; if (method == null) { obj = null; } else { MethodBody body = method.Body; obj = ((body != null) ? body.Variables : null); } if (obj == null) { Log.Error("Attempting to match ldloca instruction on method without a body: " + ((MemberReference)il.Method).FullName, "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Utilities\\Extensions\\PatchExtensions.cs", "MatchLdloca", 638); variableDefinition = null; return false; } int num = default(int); if (ILPatternMatchingExt.MatchLdloca(instruction, ref num)) { Collection variables = il.Method.Body.Variables; int index = num; VariableDefinition defaultValue = null; variableDefinition = variables.GetSafe>(index, in defaultValue); return variableDefinition != null; } variableDefinition = null; return false; } public static bool MatchLdloca(this Instruction instruction, Type variableType, ILContext il, out VariableDefinition variableDefinition) { if ((object)variableType == null) { throw new ArgumentNullException("variableType"); } if (instruction.MatchLdloca(il, out variableDefinition)) { return Extensions.Is((MemberReference)(object)((VariableReference)variableDefinition).VariableType, (MemberInfo)variableType); } return false; } public static bool MatchLdloca(this Instruction instruction, ILContext il, out VariableDefinition variableDefinition) { if (instruction.MatchLdloca(il, out variableDefinition)) { return Extensions.Is((MemberReference)(object)((VariableReference)variableDefinition).VariableType, (MemberInfo)typeof(TVariable)); } return false; } public static bool MatchLdloca(this Instruction instruction, VariableDefinition variableDefinition) { return ILPatternMatchingExt.MatchLdloca(instruction, ((VariableReference)variableDefinition).Index); } public static bool MatchStloc(this Instruction instruction, ILContext il, out VariableDefinition variableDefinition) { if (instruction == null) { throw new ArgumentNullException("instruction"); } if (il == null) { throw new ArgumentNullException("il"); } MethodDefinition method = il.Method; object obj; if (method == null) { obj = null; } else { MethodBody body = method.Body; obj = ((body != null) ? body.Variables : null); } if (obj == null) { Log.Error("Attempting to match stloc instruction on method without a body: " + ((MemberReference)il.Method).FullName, "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Utilities\\Extensions\\PatchExtensions.cs", "MatchStloc", 683); variableDefinition = null; return false; } int num = default(int); if (ILPatternMatchingExt.MatchStloc(instruction, ref num)) { Collection variables = il.Method.Body.Variables; int index = num; VariableDefinition defaultValue = null; variableDefinition = variables.GetSafe>(index, in defaultValue); return variableDefinition != null; } variableDefinition = null; return false; } public static bool MatchStloc(this Instruction instruction, Type variableType, ILContext il, out VariableDefinition variableDefinition) { if ((object)variableType == null) { throw new ArgumentNullException("variableType"); } if (instruction.MatchStloc(il, out variableDefinition)) { return Extensions.Is((MemberReference)(object)((VariableReference)variableDefinition).VariableType, (MemberInfo)variableType); } return false; } public static bool MatchStloc(this Instruction instruction, ILContext il, out VariableDefinition variableDefinition) { if (instruction.MatchStloc(il, out variableDefinition)) { return Extensions.Is((MemberReference)(object)((VariableReference)variableDefinition).VariableType, (MemberInfo)typeof(TVariable)); } return false; } public static bool MatchStloc(this Instruction instruction, VariableDefinition variableDefinition) { return ILPatternMatchingExt.MatchStloc(instruction, ((VariableReference)variableDefinition).Index); } public static bool MatchLdarg(this Instruction instruction, ILContext il, out ParameterDefinition parameter) { if (instruction == null) { throw new ArgumentNullException("instruction"); } if (il == null) { throw new ArgumentNullException("il"); } int num = default(int); if (ILPatternMatchingExt.MatchLdarg(instruction, ref num)) { Collection parameters = ((MethodReference)il.Method).Parameters; int index = num; ParameterDefinition defaultValue = null; parameter = parameters.GetSafe>(index, in defaultValue); return parameter != null; } parameter = null; return false; } public static bool MatchLdarg(this Instruction instruction, Type parameterType, string parameterName, ILContext il, out ParameterDefinition parameter) { if (instruction == null) { throw new ArgumentNullException("instruction"); } if ((object)parameterType == null) { throw new ArgumentNullException("parameterType"); } if (string.IsNullOrEmpty(parameterName)) { throw new ArgumentException("'parameterName' cannot be null or empty.", "parameterName"); } if (il == null) { throw new ArgumentNullException("il"); } if (instruction.MatchLdarg(il, out parameter) && Extensions.Is((MemberReference)(object)((ParameterReference)parameter).ParameterType, (MemberInfo)parameterType)) { return string.Equals(((ParameterReference)parameter).Name, parameterName); } return false; } public static bool MatchLdarg(this Instruction instruction, Type parameterType, ILContext il, out ParameterDefinition parameter) { if (instruction == null) { throw new ArgumentNullException("instruction"); } if ((object)parameterType == null) { throw new ArgumentNullException("parameterType"); } if (il == null) { throw new ArgumentNullException("il"); } if (instruction.MatchLdarg(il, out parameter)) { return Extensions.Is((MemberReference)(object)((ParameterReference)parameter).ParameterType, (MemberInfo)parameterType); } return false; } public static bool MatchLdarg(this Instruction instruction, string parameterName, ILContext il, out ParameterDefinition parameter) { if (instruction == null) { throw new ArgumentNullException("instruction"); } if (string.IsNullOrEmpty(parameterName)) { throw new ArgumentException("'parameterName' cannot be null or empty.", "parameterName"); } if (il == null) { throw new ArgumentNullException("il"); } if (instruction.MatchLdarg(il, out parameter)) { return string.Equals(((ParameterReference)parameter).Name, parameterName); } return false; } public static bool MatchLdarg(this Instruction instruction, string parameterName, ILContext il, out ParameterDefinition parameter) { if (instruction == null) { throw new ArgumentNullException("instruction"); } if (string.IsNullOrEmpty(parameterName)) { throw new ArgumentException("'parameterName' cannot be null or empty.", "parameterName"); } if (il == null) { throw new ArgumentNullException("il"); } if (instruction.MatchLdarg(il, out parameter) && Extensions.Is((MemberReference)(object)((ParameterReference)parameter).ParameterType, (MemberInfo)typeof(TParameter))) { return string.Equals(((ParameterReference)parameter).Name, parameterName); } return false; } public static bool MatchLdarg(this Instruction instruction, ILContext il, out ParameterDefinition parameter) { if (instruction == null) { throw new ArgumentNullException("instruction"); } if (il == null) { throw new ArgumentNullException("il"); } if (instruction.MatchLdarg(il, out parameter)) { return Extensions.Is((MemberReference)(object)((ParameterReference)parameter).ParameterType, (MemberInfo)typeof(TParameter)); } return false; } public static bool MatchLdarg(this Instruction instruction, ParameterDefinition parameterDefinition) { return ILPatternMatchingExt.MatchLdarg(instruction, parameterDefinition.Sequence); } public static bool MatchStarg(this Instruction instruction, ILContext il, out ParameterDefinition parameter) { if (instruction == null) { throw new ArgumentNullException("instruction"); } if (il == null) { throw new ArgumentNullException("il"); } int num = default(int); if (ILPatternMatchingExt.MatchStarg(instruction, ref num)) { Collection parameters = ((MethodReference)il.Method).Parameters; int index = num; ParameterDefinition defaultValue = null; parameter = parameters.GetSafe>(index, in defaultValue); return parameter != null; } parameter = null; return false; } public static bool MatchStarg(this Instruction instruction, Type parameterType, string parameterName, ILContext il, out ParameterDefinition parameter) { if (instruction == null) { throw new ArgumentNullException("instruction"); } if ((object)parameterType == null) { throw new ArgumentNullException("parameterType"); } if (string.IsNullOrEmpty(parameterName)) { throw new ArgumentException("'parameterName' cannot be null or empty.", "parameterName"); } if (il == null) { throw new ArgumentNullException("il"); } if (instruction.MatchStarg(il, out parameter) && Extensions.Is((MemberReference)(object)((ParameterReference)parameter).ParameterType, (MemberInfo)parameterType)) { return string.Equals(((ParameterReference)parameter).Name, parameterName); } return false; } public static bool MatchStarg(this Instruction instruction, Type parameterType, ILContext il, out ParameterDefinition parameter) { if (instruction == null) { throw new ArgumentNullException("instruction"); } if ((object)parameterType == null) { throw new ArgumentNullException("parameterType"); } if (il == null) { throw new ArgumentNullException("il"); } if (instruction.MatchStarg(il, out parameter)) { return Extensions.Is((MemberReference)(object)((ParameterReference)parameter).ParameterType, (MemberInfo)parameterType); } return false; } public static bool MatchStarg(this Instruction instruction, string parameterName, ILContext il, out ParameterDefinition parameter) { if (instruction == null) { throw new ArgumentNullException("instruction"); } if (string.IsNullOrEmpty(parameterName)) { throw new ArgumentException("'parameterName' cannot be null or empty.", "parameterName"); } if (il == null) { throw new ArgumentNullException("il"); } if (instruction.MatchStarg(il, out parameter)) { return string.Equals(((ParameterReference)parameter).Name, parameterName); } return false; } public static bool MatchStarg(this Instruction instruction, string parameterName, ILContext il, out ParameterDefinition parameter) { if (instruction == null) { throw new ArgumentNullException("instruction"); } if (string.IsNullOrEmpty(parameterName)) { throw new ArgumentException("'parameterName' cannot be null or empty.", "parameterName"); } if (il == null) { throw new ArgumentNullException("il"); } if (instruction.MatchStarg(il, out parameter) && Extensions.Is((MemberReference)(object)((ParameterReference)parameter).ParameterType, (MemberInfo)typeof(TParameter))) { return string.Equals(((ParameterReference)parameter).Name, parameterName); } return false; } public static bool MatchStarg(this Instruction instruction, ILContext il, out ParameterDefinition parameter) { if (instruction == null) { throw new ArgumentNullException("instruction"); } if (il == null) { throw new ArgumentNullException("il"); } if (instruction.MatchStarg(il, out parameter)) { return Extensions.Is((MemberReference)(object)((ParameterReference)parameter).ParameterType, (MemberInfo)typeof(TParameter)); } return false; } public static bool MatchStarg(this Instruction instruction, ParameterDefinition parameterDefinition) { return ILPatternMatchingExt.MatchStarg(instruction, parameterDefinition.Sequence); } public static bool MatchLdarga(this Instruction instruction, ILContext il, out ParameterDefinition parameter) { if (instruction == null) { throw new ArgumentNullException("instruction"); } if (il == null) { throw new ArgumentNullException("il"); } int num = default(int); if (ILPatternMatchingExt.MatchLdarga(instruction, ref num)) { Collection parameters = ((MethodReference)il.Method).Parameters; int index = num; ParameterDefinition defaultValue = null; parameter = parameters.GetSafe>(index, in defaultValue); return parameter != null; } parameter = null; return false; } public static bool MatchLdarga(this Instruction instruction, Type parameterType, string parameterName, ILContext il, out ParameterDefinition parameter) { if (instruction == null) { throw new ArgumentNullException("instruction"); } if ((object)parameterType == null) { throw new ArgumentNullException("parameterType"); } if (string.IsNullOrEmpty(parameterName)) { throw new ArgumentException("'parameterName' cannot be null or empty.", "parameterName"); } if (il == null) { throw new ArgumentNullException("il"); } if (instruction.MatchLdarga(il, out parameter) && Extensions.Is((MemberReference)(object)((ParameterReference)parameter).ParameterType, (MemberInfo)parameterType)) { return string.Equals(((ParameterReference)parameter).Name, parameterName); } return false; } public static bool MatchLdarga(this Instruction instruction, Type parameterType, ILContext il, out ParameterDefinition parameter) { if (instruction == null) { throw new ArgumentNullException("instruction"); } if ((object)parameterType == null) { throw new ArgumentNullException("parameterType"); } if (il == null) { throw new ArgumentNullException("il"); } if (instruction.MatchLdarga(il, out parameter)) { return Extensions.Is((MemberReference)(object)((ParameterReference)parameter).ParameterType, (MemberInfo)parameterType); } return false; } public static bool MatchLdarga(this Instruction instruction, string parameterName, ILContext il, out ParameterDefinition parameter) { if (instruction == null) { throw new ArgumentNullException("instruction"); } if (string.IsNullOrEmpty(parameterName)) { throw new ArgumentException("'parameterName' cannot be null or empty.", "parameterName"); } if (il == null) { throw new ArgumentNullException("il"); } if (instruction.MatchLdarga(il, out parameter)) { return string.Equals(((ParameterReference)parameter).Name, parameterName); } return false; } public static bool MatchLdarga(this Instruction instruction, string parameterName, ILContext il, out ParameterDefinition parameter) { if (instruction == null) { throw new ArgumentNullException("instruction"); } if (string.IsNullOrEmpty(parameterName)) { throw new ArgumentException("'parameterName' cannot be null or empty.", "parameterName"); } if (il == null) { throw new ArgumentNullException("il"); } if (instruction.MatchLdarga(il, out parameter) && Extensions.Is((MemberReference)(object)((ParameterReference)parameter).ParameterType, (MemberInfo)typeof(TParameter))) { return string.Equals(((ParameterReference)parameter).Name, parameterName); } return false; } public static bool MatchLdarga(this Instruction instruction, ILContext il, out ParameterDefinition parameter) { if (instruction == null) { throw new ArgumentNullException("instruction"); } if (il == null) { throw new ArgumentNullException("il"); } if (instruction.MatchLdarga(il, out parameter)) { return Extensions.Is((MemberReference)(object)((ParameterReference)parameter).ParameterType, (MemberInfo)typeof(TParameter)); } return false; } public static bool MatchLdarga(this Instruction instruction, ParameterDefinition parameterDefinition) { return ILPatternMatchingExt.MatchLdarga(instruction, parameterDefinition.Sequence); } } internal static class PayCostResultsExtensions { private sealed class ExtraData { public ItemQualityCounts UsedSaleStarCounts; } private static bool _addedClearHook = false; private static readonly FixedConditionalWeakTable _extraDataTable = new FixedConditionalWeakTable(); private static ExtraData getExtraData(PayCostResults payCostResults) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown if (!_addedClearHook) { _addedClearHook = true; PayCostResults.Clear += new hook_Clear(PayCostResults_Clear); } return _extraDataTable.GetOrCreateValue(payCostResults); } public static void SetUsedSaleStars(this PayCostResults payCostResults, ItemQualityCounts usedSaleStarCounts) { if (payCostResults == null) { throw new ArgumentNullException("payCostResults"); } getExtraData(payCostResults).UsedSaleStarCounts = usedSaleStarCounts; } public static ItemQualityCounts GetUsedSaleStars(this PayCostResults payCostResults) { if (payCostResults == null) { throw new ArgumentNullException("payCostResults"); } ExtraData extraData = default(ExtraData); if (!_extraDataTable.TryGetValue(payCostResults, ref extraData)) { return default(ItemQualityCounts); } return extraData.UsedSaleStarCounts; } private static void PayCostResults_Clear(orig_Clear orig, PayCostResults self) { orig.Invoke(self); _extraDataTable.Remove(self); } } internal static class ReflectionExtensions { public static bool IsSerialized(this FieldInfo field) { if (!field.IsNotSerialized) { if (!field.IsPublic) { return ((MemberInfo)field).GetCustomAttribute() != null; } return true; } return false; } } internal static class RuleExtensions { public static bool IsPickupRuleEnabled(this RuleBook ruleBook, PickupIndex pickupIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //IL_0017: 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) PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex); if (pickupDef == null) { return false; } if ((int)pickupDef.itemIndex != -1) { return ruleBook.IsItemRuleEnabled(pickupDef.itemIndex); } if ((int)pickupDef.equipmentIndex != -1) { return ruleBook.IsEquipmentRuleEnabled(pickupDef.equipmentIndex); } return true; } public static bool IsItemRuleEnabled(this RuleBook ruleBook, ItemIndex itemIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) if ((int)itemIndex == -1) { return false; } RuleDef val = RuleCatalog.FindRuleDef("Items." + ((Object)ItemCatalog.GetItemDef(itemIndex)).name); if (val == null) { return true; } RuleChoiceDef ruleChoice = ruleBook.GetRuleChoice(val); if (ruleChoice == null) { return true; } return ruleChoice.itemIndex == itemIndex; } public static bool IsEquipmentRuleEnabled(this RuleBook ruleBook, EquipmentIndex equipmentIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) if ((int)equipmentIndex == -1) { return false; } RuleDef val = RuleCatalog.FindRuleDef("Equipments." + ((Object)EquipmentCatalog.GetEquipmentDef(equipmentIndex)).name); if (val == null) { return true; } RuleChoiceDef ruleChoice = ruleBook.GetRuleChoice(val); if (ruleChoice == null) { return true; } return ruleChoice.equipmentIndex == equipmentIndex; } } public static class UniquePickupExtensions { public static UniquePickup WithQualityTier(this in UniquePickup pickup, QualityTier qualityTier) { //IL_0011: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (!((UniquePickup)(ref pickup)).isValid) { return pickup; } return ((UniquePickup)(ref pickup)).WithPickupIndex(QualityCatalog.GetPickupIndexOfQuality(pickup.pickupIndex, qualityTier)); } } internal static class UnityExtensions { private static class UnityEventInterface { private static readonly FieldInfo _unityEventBasePersistentListenersField; private static readonly Type _unityPersistentCallGroupType; private static readonly Type _unityPersistentCallType; private static readonly MethodInfo _persistentCallGroupAddListenerMethod; private static readonly MethodInfo _persistentCallGroupRegisterVoidPersistentListenerMethod; private static readonly MethodInfo _persistentCallGroupRegisterStringPersistentListenerMethod; static UnityEventInterface() { _unityEventBasePersistentListenersField = typeof(UnityEventBase).GetField("m_PersistentCalls", BindingFlags.Instance | BindingFlags.NonPublic); if (_unityEventBasePersistentListenersField == null) { Log.Error("Failed to initialize event interface: Could not find field: UnityEventBase.m_PersistentCalls", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Utilities\\Extensions\\UnityExtensions.cs", ".cctor", 105); return; } _unityPersistentCallGroupType = _unityEventBasePersistentListenersField.FieldType; _persistentCallGroupAddListenerMethod = _unityPersistentCallGroupType.GetMethod("AddListener", BindingFlags.Instance | BindingFlags.Public, null, Array.Empty(), null); if (_persistentCallGroupAddListenerMethod == null) { Log.Error("Failed to find PersistentCallGroup.AddListener() method", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Utilities\\Extensions\\UnityExtensions.cs", ".cctor", 114); } _persistentCallGroupRegisterVoidPersistentListenerMethod = _unityPersistentCallGroupType.GetMethod("RegisterVoidPersistentListener", BindingFlags.Instance | BindingFlags.Public, null, new Type[4] { typeof(int), typeof(Object), typeof(Type), typeof(string) }, null); if (_persistentCallGroupRegisterVoidPersistentListenerMethod == null) { Log.Error("Failed to find PersistentCallGroup.RegisterVoidPersistentListener(int, UnityEngine.Object, Type, string) method", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Utilities\\Extensions\\UnityExtensions.cs", ".cctor", 120); } _persistentCallGroupRegisterStringPersistentListenerMethod = _unityPersistentCallGroupType.GetMethod("RegisterStringPersistentListener", BindingFlags.Instance | BindingFlags.Public, null, new Type[5] { typeof(int), typeof(Object), typeof(Type), typeof(string), typeof(string) }, null); if (_persistentCallGroupRegisterStringPersistentListenerMethod == null) { Log.Error("Failed to find PersistentCallGroup.RegisterStringPersistentListener(int, UnityEngine.Object, Type, string, string) method", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Utilities\\Extensions\\UnityExtensions.cs", ".cctor", 126); } } private static bool tryRegisterPersistentListener(UnityEvent unityEvent, out int index, out object persistentCallGroup) { if (_unityEventBasePersistentListenersField == null || _persistentCallGroupAddListenerMethod == null) { index = -1; persistentCallGroup = null; return false; } index = ((UnityEventBase)unityEvent).GetPersistentEventCount(); persistentCallGroup = _unityEventBasePersistentListenersField.GetValue(unityEvent); _persistentCallGroupAddListenerMethod.Invoke(persistentCallGroup, Array.Empty()); return true; } public static void AddVoidPersistentListener(UnityEvent unityEvent, UnityAction action) { if (_persistentCallGroupRegisterVoidPersistentListenerMethod == null || !tryRegisterPersistentListener(unityEvent, out var index, out var persistentCallGroup)) { Log.Error("Failed to add listener: Interface initialization did not succeed for required component(s). Listener will not be persistent.", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Utilities\\Extensions\\UnityExtensions.cs", "AddVoidPersistentListener", 154); unityEvent.AddListener(action); return; } _persistentCallGroupRegisterVoidPersistentListenerMethod.Invoke(persistentCallGroup, new object[4] { index, (object)/*isinst with value type is only supported in some contexts*/, ((Delegate)(object)action).Target.GetType(), ((Delegate)(object)action).Method.Name }); } private static void addArgumentPersistentListener(UnityEvent unityEvent, MethodInfo registerMethod, UnityAction action, T argument) { if (registerMethod == null || !tryRegisterPersistentListener(unityEvent, out var index, out var persistentCallGroup)) { Log.Error("Failed to add listener of type " + typeof(T).FullName + ": Interface initialization did not succeed for required component(s).", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Utilities\\Extensions\\UnityExtensions.cs", "addArgumentPersistentListener", 173); return; } registerMethod.Invoke(persistentCallGroup, new object[5] { index, (object)/*isinst with value type is only supported in some contexts*/, ((Delegate)(object)action).Target.GetType(), argument, ((Delegate)(object)action).Method.Name }); } public static void AddStringPersistentListener(UnityEvent unityEvent, UnityAction action, string argument) { addArgumentPersistentListener(unityEvent, _persistentCallGroupRegisterStringPersistentListenerMethod, action, argument); } } public static bool TryGetComponentCached(this GameObject gameObject, out T component) where T : Component { if (!Object.op_Implicit((Object)(object)gameObject)) { throw new ArgumentNullException("gameObject"); } return ComponentCache.TryGetComponent(gameObject, out component); } public static T GetComponentCached(this GameObject gameObject) where T : Component { if (!Object.op_Implicit((Object)(object)gameObject)) { throw new ArgumentNullException("gameObject"); } if (!ComponentCache.TryGetComponent(gameObject, out var component)) { return default(T); } return component; } public static bool TryGetComponentCached(this Component srcComponent, out T component) where T : Component { if (!Object.op_Implicit((Object)(object)srcComponent)) { throw new ArgumentNullException("srcComponent"); } return ComponentCache.TryGetComponent(srcComponent.gameObject, out component); } public static T GetComponentCached(this Component srcComponent) where T : Component { if (!Object.op_Implicit((Object)(object)srcComponent)) { throw new ArgumentNullException("srcComponent"); } if (!ComponentCache.TryGetComponent(srcComponent.gameObject, out var component)) { return default(T); } return component; } private static void validatePersistentListener(UnityEvent unityEvent, Delegate action) { if (unityEvent == null) { throw new ArgumentNullException("unityEvent"); } if ((object)action == null) { throw new ArgumentNullException("action"); } if (!(action.Target is Object)) { throw new ArgumentException("Invalid action: Listeners must have a UnityEngine.Object instance", "action"); } if ((object)action.Method == null) { throw new ArgumentException("Invalid action: Listeners cannot be combined delegates.", "action"); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void AddPersistentListener(this UnityEvent unityEvent, UnityAction action) { validatePersistentListener(unityEvent, (Delegate)(object)action); UnityEventInterface.AddVoidPersistentListener(unityEvent, action); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void AddPersistentListener(this UnityEvent unityEvent, UnityAction action, string argument) { validatePersistentListener(unityEvent, (Delegate)(object)action); UnityEventInterface.AddStringPersistentListener(unityEvent, action, argument); } } internal static class VectorExtensions { public static Vector2 Inverse(this in Vector2 vector) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) return new Vector2(1f / vector.x, 1f / vector.y); } public static Vector3 Inverse(this in Vector3 vector) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) return new Vector3(1f / vector.x, 1f / vector.y, 1f / vector.z); } public static Vector4 Inverse(this in Vector4 vector) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) return new Vector4(1f / vector.x, 1f / vector.y, 1f / vector.z, 1f / vector.w); } } } namespace ItemQualities.UI { public sealed class BossDamageBonusTickController : MonoBehaviour { public Sprite[] NumberSprites = Array.Empty(); public Image Image; private int _displayedNumber; public int DisplayedNumber { get { return _displayedNumber; } set { if (_displayedNumber != value) { _displayedNumber = value; refreshDisplayedNumber(); } } } private void OnEnable() { refreshDisplayedNumber(); } private void refreshDisplayedNumber() { Image.sprite = ArrayUtils.GetSafe(NumberSprites, DisplayedNumber - 1); } } public sealed class BossDamageBonusUI : MonoBehaviour { public RectTransform MarkersRoot; public GameObject MarkerSectionPrefab; private UIElementAllocator _tickAllocator; private int _maxTicksPerSection; private HUD _hud; private CharacterMaster _targetMaster; private CharacterMasterExtraStatsTracker _targetMasterStats; private void Awake() { _hud = ((Component)this).GetComponentInParent(); _tickAllocator = new UIElementAllocator(MarkersRoot, MarkerSectionPrefab, true, false); _maxTicksPerSection = MarkerSectionPrefab.GetComponent().NumberSprites.Length; } private void OnEnable() { setTargetMaster(_hud.targetMaster); HUD.onHudTargetChangedGlobal += onHudTargetChangedGlobal; } private void OnDisable() { HUD.onHudTargetChangedGlobal -= onHudTargetChangedGlobal; setTargetMaster(null); } private void onHudTargetChangedGlobal(HUD hud) { if (!((Object)(object)hud != (Object)(object)_hud)) { setTargetMaster(hud.targetMaster); } } private void setTargetMaster(CharacterMaster master) { if (!((Object)(object)_targetMaster == (Object)(object)master)) { if (Object.op_Implicit((Object)(object)_targetMasterStats)) { _targetMasterStats.OnBossDamageBonusTicksChanged -= onBossDamageBonusTicksChanged; } if (Object.op_Implicit((Object)(object)_targetMaster) && Object.op_Implicit((Object)(object)_targetMaster.inventory)) { _targetMaster.inventory.onInventoryChanged -= onTargetInventoryChanged; } _targetMaster = master; _targetMasterStats = (Object.op_Implicit((Object)(object)master) ? ((Component)(object)master).GetComponentCached() : null); if (Object.op_Implicit((Object)(object)_targetMasterStats)) { _targetMasterStats.OnBossDamageBonusTicksChanged += onBossDamageBonusTicksChanged; } if (Object.op_Implicit((Object)(object)_targetMaster) && Object.op_Implicit((Object)(object)_targetMaster.inventory)) { _targetMaster.inventory.onInventoryChanged += onTargetInventoryChanged; } refreshTicks(); } } private void onBossDamageBonusTicksChanged(CharacterMasterExtraStatsTracker masterExtraStats) { refreshTicks(); } private void onTargetInventoryChanged() { refreshTicks(); } private void refreshTicks() { ItemQualityCounts itemQualityCounts = default(ItemQualityCounts); if (Object.op_Implicit((Object)(object)_targetMaster) && Object.op_Implicit((Object)(object)_targetMaster.inventory)) { itemQualityCounts = _targetMaster.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.BossDamageBonus); } int num = ((itemQualityCounts.TotalQualityCount > 0 && Object.op_Implicit((Object)(object)_targetMasterStats)) ? _targetMasterStats.BossDamageBonusTicks : 0); int num2 = ((num > 0) ? HGMath.IntDivCeil(num, _maxTicksPerSection) : 0); _tickAllocator.AllocateElements(num2); for (int i = 0; i < num2; i++) { _tickAllocator.elements[i].DisplayedNumber = Mathf.Min(_maxTicksPerSection, _targetMasterStats.BossDamageBonusTicks - _maxTicksPerSection * i); } } } public sealed class DuplicatorItemShareUIController : MonoBehaviour { private HUD _hud; private ChildLocator _childLocator; private GameObject _itemShareInventoryDisplayRoot; private ItemInventoryDisplay _itemShareInventoryDisplay; private CharacterBody _currentTargetBody; private GameObject _currentTargetBodyObject; private DuplicatorQualityAttachmentBehavior _currentBodyDuplicatorAttachment; [SystemInitializer(new Type[] { })] private static 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) AsyncOperationHandle handle = AddressableUtil.LoadAssetAsync(RoR2_Base_UI.HUDSimple_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject hudPrefab) { hudPrefab.AddComponent(); }); } private void Awake() { _hud = ((Component)this).GetComponent(); _childLocator = ((Component)this).GetComponent(); } private void Start() { //IL_005b: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) Transform val = _childLocator.FindChild("LeftCluster"); _itemShareInventoryDisplayRoot = Object.Instantiate(((Component)_hud.itemInventoryDisplay).gameObject, val); ((Object)_itemShareInventoryDisplayRoot).name = "DuplicatorItemShareInventoryDisplay"; _itemShareInventoryDisplay = _itemShareInventoryDisplayRoot.GetComponent(); RectTransform component = _itemShareInventoryDisplayRoot.GetComponent(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.sizeDelta = new Vector2(-120f, 0f); component.anchoredPosition = new Vector2(-90f, 0f); ItemInventoryDisplay itemShareInventoryDisplay = _itemShareInventoryDisplay; Rect rect = component.rect; itemShareInventoryDisplay.maxHeight = ((Rect)(ref rect)).height; Inventory displayedDuplicatorInventory = (Object.op_Implicit((Object)(object)_currentBodyDuplicatorAttachment) ? _currentBodyDuplicatorAttachment.MinionMirrorInventory : null); setDisplayedDuplicatorInventory(displayedDuplicatorInventory); } private void OnEnable() { setTargetBodyObject(_hud.targetBodyObject); HUD.onHudTargetChangedGlobal += onHudTargetChangedGlobal; DuplicatorQualityAttachmentBehavior.OnAttachedBodyChangedGlobal += onDuplicatorAttachmentBodyChangedGlobal; } private void OnDisable() { DuplicatorQualityAttachmentBehavior.OnAttachedBodyChangedGlobal -= onDuplicatorAttachmentBodyChangedGlobal; HUD.onHudTargetChangedGlobal -= onHudTargetChangedGlobal; setTargetBodyObject(null); } private void onHudTargetChangedGlobal(HUD hud) { if (!((Object)(object)hud != (Object)(object)_hud)) { setTargetBodyObject(hud.targetBodyObject); } } private void setTargetBodyObject(GameObject targetBodyObject) { if ((Object)(object)targetBodyObject == (Object)(object)_currentTargetBodyObject) { return; } _currentTargetBodyObject = targetBodyObject; _currentTargetBody = (Object.op_Implicit((Object)(object)_currentTargetBodyObject) ? _currentTargetBodyObject.GetComponent() : null); DuplicatorQualityAttachmentBehavior currentBodyDuplicatorAttachment = null; if (Object.op_Implicit((Object)(object)_currentTargetBody)) { foreach (DuplicatorQualityAttachmentBehavior instances in InstanceTracker.GetInstancesList()) { if ((Object)(object)instances.AttachedBody == (Object)(object)_currentTargetBody) { currentBodyDuplicatorAttachment = instances; break; } } } setCurrentBodyDuplicatorAttachment(currentBodyDuplicatorAttachment); } private void onDuplicatorAttachmentBodyChangedGlobal(DuplicatorQualityAttachmentBehavior duplicatorAttachment) { if (Object.op_Implicit((Object)(object)_currentTargetBody) && (Object)(object)duplicatorAttachment.AttachedBody == (Object)(object)_currentTargetBody) { setCurrentBodyDuplicatorAttachment(duplicatorAttachment); } else if ((Object)(object)duplicatorAttachment == (Object)(object)_currentBodyDuplicatorAttachment) { setCurrentBodyDuplicatorAttachment(null); } } private void setCurrentBodyDuplicatorAttachment(DuplicatorQualityAttachmentBehavior duplicatorAttachment) { if (!((Object)(object)_currentBodyDuplicatorAttachment == (Object)(object)duplicatorAttachment)) { _currentBodyDuplicatorAttachment = duplicatorAttachment; Inventory displayedDuplicatorInventory = (Object.op_Implicit((Object)(object)_currentBodyDuplicatorAttachment) ? _currentBodyDuplicatorAttachment.MinionMirrorInventory : null); setDisplayedDuplicatorInventory(displayedDuplicatorInventory); } } private void setDisplayedDuplicatorInventory(Inventory duplicatorInventory) { if (Object.op_Implicit((Object)(object)_itemShareInventoryDisplayRoot)) { _itemShareInventoryDisplayRoot.SetActive((Object)(object)duplicatorInventory != (Object)null); } if (Object.op_Implicit((Object)(object)_itemShareInventoryDisplay)) { _itemShareInventoryDisplay.SetSubscribedInventory(duplicatorInventory); } } } [RequireComponent(typeof(TooltipContext))] public sealed class MultiShopCardStoredInteractableDisplayController : MonoBehaviour { public RawImage InteractableIcon; public LanguageTextMeshController InteractableNameLabel; public GameObject DisplayRoot; private TooltipContext _context; private void Awake() { _context = ((Component)this).GetComponent(); } private void OnEnable() { _context.OnTooltipProviderDiscovered += rebuild; rebuild(); } private void OnDisable() { _context.OnTooltipProviderDiscovered -= rebuild; } private void rebuild() { //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) EquipmentIcon val = (Object.op_Implicit((Object)(object)_context.SourceTooltipProvider) ? ((Component)_context.SourceTooltipProvider).GetComponent() : null); Inventory val2 = (Object.op_Implicit((Object)(object)val) ? val.targetInventory : null); CharacterMasterExtraStatsTracker characterMasterExtraStatsTracker = (Object.op_Implicit((Object)(object)val2) ? ((Component)(object)val2).GetComponentCached() : null); StoredInteractableInfo obj = (Object.op_Implicit((Object)(object)characterMasterExtraStatsTracker) ? characterMasterExtraStatsTracker.CardStoredInteractableInfo : StoredInteractableInfo.None); int interactableIndex = obj.InteractableIndex; int upgradeValue = obj.UpgradeValue; if (interactableIndex != -1) { InteractableDef interactableDef = InteractableCatalog.GetInteractableDef(interactableIndex); string text = string.Empty; Texture texture = null; bool flag = false; bool flag2 = false; if ((!flag || !flag2) && Object.op_Implicit((Object)(object)interactableDef.PrefabSpecialObjectAttributes)) { if (!flag && !string.IsNullOrWhiteSpace(interactableDef.PrefabSpecialObjectAttributes.bestName)) { text = interactableDef.PrefabSpecialObjectAttributes.bestName; flag = true; } if (!flag2 && Object.op_Implicit((Object)(object)interactableDef.PrefabSpecialObjectAttributes.portraitIcon)) { texture = interactableDef.PrefabSpecialObjectAttributes.portraitIcon; flag2 = true; } } IInspectInfoProvider val3 = interactableDef.PrefabInspectInfoProvider; if (val3 is ShopTerminalBehavior) { val3 = (IInspectInfoProvider)(object)interactableDef.PrefabGenericInspectInfoProvider; } if ((!flag || !flag2) && val3 != null) { InspectInfo info = val3.GetInfo(); if (info != null) { if (!flag && !string.IsNullOrWhiteSpace(info.TitleToken)) { text = info.TitleToken; flag = true; } if (!flag2 && Object.op_Implicit((Object)(object)info.Visual) && Object.op_Implicit((Object)(object)info.Visual.texture)) { texture = (Texture)(object)info.Visual.texture; flag2 = true; } } } if (!flag && interactableDef.PrefabDisplayNameProvider != null) { string displayName = interactableDef.PrefabDisplayNameProvider.GetDisplayName(); if (!string.IsNullOrWhiteSpace(displayName)) { text = displayName; flag = true; } } if (!flag2 && Object.op_Implicit((Object)(object)interactableDef.PrefabPingInfoProvider)) { Sprite pingIconOverride = interactableDef.PrefabPingInfoProvider.pingIconOverride; if (Object.op_Implicit((Object)(object)pingIconOverride) && Object.op_Implicit((Object)(object)pingIconOverride.texture)) { texture = (Texture)(object)pingIconOverride.texture; } } if (!flag) { text = interactableDef.Name; flag = true; } if (upgradeValue > 0) { text = Util.GetNameFromUpgradeCount(text, upgradeValue); } if (!flag2) { texture = (Texture)(object)Addressables.LoadAssetAsync((object)RoR2_Base_Common_MiscIcons.texMysteryIcon_png).WaitForCompletion(); flag2 = true; } InteractableNameLabel.token = text; InteractableIcon.texture = texture; } DisplayRoot.SetActive(interactableIndex != -1); } } [RequireComponent(typeof(RectTransform))] public sealed class ParryStoredProjectileDisplay : MonoBehaviour { public RawImage ProjectileIcon; [Tooltip("Will be enabled/disabled depending on if there is anything to display")] public GameObject DisplayRoot; public float LowPositionOffset = -20f; [NonSerialized] public EquipmentIcon ParentEquipmentIcon; private float _highPosition; private Vector3 _positionVelocity; private HUD _hud; private MemoizedGetComponentCached _targetBodyExtraStats; public RectTransform transform { get { Transform obj = ((Component)this).transform; return (RectTransform)(object)((obj is RectTransform) ? obj : null); } } private void Awake() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) _highPosition = transform.anchoredPosition.y; } private void OnEnable() { _hud = ((Component)this).GetComponentInParent(); } private void OnTransformParentChanged() { _hud = ((Component)this).GetComponentInParent(); } private void FixedUpdate() { //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) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) GameObject gameObject = (Object.op_Implicit((Object)(object)_hud) ? _hud.targetBodyObject : null); CharacterBodyExtraStatsTracker characterBodyExtraStatsTracker = _targetBodyExtraStats.Get(gameObject); CharacterBody val = (Object.op_Implicit((Object)(object)characterBodyExtraStatsTracker) ? characterBodyExtraStatsTracker.Body : null); bool flag = Object.op_Implicit((Object)(object)characterBodyExtraStatsTracker) && characterBodyExtraStatsTracker.ParryStoredProjectileIndex != -1 && Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.inventory) && val.inventory.currentEquipmentIndex == Equipment.Parry.equipmentIndex && val.inventory.GetActiveEquipmentQualityTier() > QualityTier.None; DisplayRoot.SetActive(flag); if (flag) { CharacterBody bodyPrefabBodyComponent = BodyCatalog.GetBodyPrefabBodyComponent(characterBodyExtraStatsTracker.ParryStoredProjectileAttackerBodyIndex); Texture val2 = null; if (Object.op_Implicit((Object)(object)bodyPrefabBodyComponent)) { val2 = bodyPrefabBodyComponent.portraitIcon; } if (!Object.op_Implicit((Object)(object)val2)) { val2 = (Texture)(object)BodyCatalog.defaultPortraitIcon; } ProjectileIcon.texture = val2; } bool flag2 = Object.op_Implicit((Object)(object)ParentEquipmentIcon) && Object.op_Implicit((Object)(object)ParentEquipmentIcon.stockText) && ((Component)ParentEquipmentIcon.stockText).gameObject.activeInHierarchy; Vector3 val3 = Vector2.op_Implicit(transform.anchoredPosition); val3.y = (flag2 ? _highPosition : (_highPosition + LowPositionOffset)); transform.anchoredPosition = Vector2.op_Implicit(Vector3.SmoothDamp(Vector2.op_Implicit(transform.anchoredPosition), val3, ref _positionVelocity, 0.1f)); } } internal sealed class TooltipContext : MonoBehaviour { public TooltipProvider SourceTooltipProvider { get; private set; } public event Action OnTooltipProviderDiscovered; [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown TooltipController.SetTooltipProvider += new Manipulator(TooltipController_SetTooltipProvider); } private static void TooltipController_SetTooltipProvider(ILContext il) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_00f5: 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) if (!((MethodReference)(object)il.Method).TryFindParameter(out var tooltipProviderParameter)) { Log.Error("Failed to find TooltipProvider parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\UI\\TooltipContext.cs", "TooltipController_SetTooltipProvider", 24); return; } ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[5] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, tooltipProviderParameter.Sequence), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "extraUIDisplayPrefab"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "extraUIPos"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "Instantiate") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\UI\\TooltipContext.cs", "TooltipController_SetTooltipProvider", 37); return; } val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg, tooltipProviderParameter); val.EmitDelegate>((Action)onCreateExtraUIDisplayPrefab); static void onCreateExtraUIDisplayPrefab(GameObject extraUIDisplay, TooltipProvider tooltipProvider) { TooltipContext tooltipContext = default(TooltipContext); if (Object.op_Implicit((Object)(object)extraUIDisplay) && extraUIDisplay.TryGetComponent(ref tooltipContext)) { tooltipContext.SourceTooltipProvider = tooltipProvider; tooltipContext.OnTooltipProviderDiscovered?.Invoke(); } } } } internal sealed class UIInstantiator : MonoBehaviour { [SystemInitializer(new Type[] { })] private static 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) AsyncOperationHandle handle = AddressableUtil.LoadAssetAsync(RoR2_Base_UI.HUDSimple_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject hudPrefab) { hudPrefab.AddComponent(); }); } private void Awake() { HUD component = ((Component)this).GetComponent(); Transform val = ((Component)this).GetComponent().FindChild("BottomRightCluster"); Object.Instantiate(ItemQualitiesContent.Prefabs.HitlistMarkersUI, val); EquipmentIcon val2 = ((IEnumerable)component.equipmentIcons).FirstOrDefault((Func)((EquipmentIcon e) => !e.displayAlternateEquipment)); if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.displayRoot)) { GameObject obj = Object.Instantiate(ItemQualitiesContent.Prefabs.ParryProjectileDisplayUI, val2.displayRoot.transform); obj.transform.SetAsFirstSibling(); obj.GetComponent().ParentEquipmentIcon = val2; } ((Behaviour)this).enabled = false; } } } namespace ItemQualities.Orbs { public sealed class BugOrb : GenericDamageOrb { private static readonly float _baseSpeed = 60f; public override GameObject GetOrbEffect() { return ItemQualitiesContent.Prefabs.BugOrbEffect; } public override void Begin() { base.speed = _baseSpeed; ((GenericDamageOrb)this).Begin(); } } public sealed class ImmuneToDebuffOrb : Orb { private static EffectIndex _orbEffectIndex = (EffectIndex)(-1); private CharacterMaster _attackerMaster; public InflictDotInfo? InflictDotInfo; public BuffIndex BuffIndex = (BuffIndex)(-1); public float BuffDuration; public int BuffStackCount; public GameObject Attacker { get { if (!Object.op_Implicit((Object)(object)_attackerMaster)) { return null; } return _attackerMaster.GetBodyObject(); } set { CharacterBody val = (Object.op_Implicit((Object)(object)value) ? value.GetComponent() : null); _attackerMaster = (Object.op_Implicit((Object)(object)val) ? val.master : null); } } [SystemInitializer(new Type[] { typeof(EffectCatalogUtils) })] private static void Init() { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 _orbEffectIndex = EffectCatalogUtils.FindEffectIndex("ChainVineOrbEffect"); if ((int)_orbEffectIndex == -1) { Log.Warning("Failed to find thorn orb effect index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Orbs\\ImmuneToDebuffOrb.cs", "Init", 17); } } public override void Begin() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Invalid comparison between Unknown and I4 //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) ((Orb)this).duration = Mathf.Max(Time.fixedDeltaTime, ((Orb)this).distanceToTarget / 20f); if ((int)_orbEffectIndex != -1) { EffectData val = new EffectData { origin = base.origin, genericFloat = ((Orb)this).duration }; val.SetHurtBoxReference(base.target); EffectManager.SpawnEffect(_orbEffectIndex, val, true); } if (!Object.op_Implicit((Object)(object)Attacker) && InflictDotInfo.HasValue) { Attacker = InflictDotInfo.Value.attackerObject; } } public override void OnArrival() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Invalid comparison between Unknown and I4 //IL_004d: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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) HealthComponent val = (Object.op_Implicit((Object)(object)base.target) ? base.target.healthComponent : null); CharacterBody val2 = (Object.op_Implicit((Object)(object)val) ? val.body : null); if (!Object.op_Implicit((Object)(object)val2)) { return; } if (InflictDotInfo.HasValue) { onArriveDot(InflictDotInfo.Value); } else { DotIndex dotDefIndex = DotController.GetDotDefIndex(BuffCatalog.GetBuffDef(BuffIndex)); if ((int)dotDefIndex != -1) { InflictDotInfo val3 = default(InflictDotInfo); val3.attackerObject = Attacker; val3.victimObject = ((Component)val2).gameObject; val3.damageMultiplier = 1f; val3.dotIndex = dotDefIndex; val3.duration = BuffDuration; InflictDotInfo inflictDotInfo = val3; onArriveDot(inflictDotInfo); } else { onArriveBuff(val2); } } if (Object.op_Implicit((Object)(object)_attackerMaster)) { GlobalEventManager.ProcDeathMark(((Component)base.target).gameObject, val2, _attackerMaster); } Util.PlaySound("Play_item_proc_triggerEnemyDebuffs", ((Component)val2).gameObject); } private void onArriveDot(InflictDotInfo inflictDotInfo) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_attackerMaster)) { StrengthenBurnUtils.CheckDotForUpgrade(_attackerMaster.inventory, ref inflictDotInfo); } for (int i = 0; i < BuffStackCount; i++) { InflictDotInfo val = inflictDotInfo; DotController.InflictDot(ref val); } } private void onArriveBuff(CharacterBody victimBody) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < BuffStackCount; i++) { victimBody.AddTimedBuff(BuffIndex, BuffDuration); } } } public sealed class SlugOrb : Orb { private static EffectIndex _orbEffectIndex = (EffectIndex)(-1); public int SlugBuffCount; [SystemInitializer(new Type[] { typeof(EffectCatalogUtils) })] private static void Init() { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 _orbEffectIndex = EffectCatalogUtils.FindEffectIndex("InfusionOrbEffect"); if ((int)_orbEffectIndex == -1) { Log.Warning("Failed to find orb effect index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Orbs\\SlugOrb.cs", "Init", 17); } } public override void Begin() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Invalid comparison between Unknown and I4 //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) ((Orb)this).duration = Mathf.Max(Time.fixedDeltaTime, ((Orb)this).distanceToTarget / 50f); if ((int)_orbEffectIndex != -1) { EffectData val = new EffectData { origin = base.origin, genericFloat = ((Orb)this).duration }; val.SetHurtBoxReference(base.target); EffectManager.SpawnEffect(_orbEffectIndex, val, true); } } public override void OnArrival() { if (Object.op_Implicit((Object)(object)base.target) && Object.op_Implicit((Object)(object)base.target.healthComponent) && Object.op_Implicit((Object)(object)base.target.healthComponent.body)) { for (int i = 0; i < SlugBuffCount; i++) { base.target.healthComponent.body.AddBuff(ItemQualitiesContent.Buffs.SlugHealth); } } } } public sealed class SteakOrb : Orb { private static EffectIndex _orbEffectIndex = (EffectIndex)(-1); public float SteakBonus; private CharacterMasterExtraStatsTracker _targetMasterStats; [SystemInitializer(new Type[] { typeof(EffectCatalogUtils) })] private static void Init() { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 _orbEffectIndex = EffectCatalogUtils.FindEffectIndex("InfusionOrbEffect"); if ((int)_orbEffectIndex == -1) { Log.Warning("Failed to find orb effect index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Orbs\\SteakOrb.cs", "Init", 18); } } public override void Begin() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Invalid comparison between Unknown and I4 //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) ((Orb)this).duration = Mathf.Max(Time.fixedDeltaTime, ((Orb)this).distanceToTarget / 30f); if ((int)_orbEffectIndex != -1) { EffectData val = new EffectData { origin = base.origin, genericFloat = ((Orb)this).duration }; val.SetHurtBoxReference(base.target); EffectManager.SpawnEffect(_orbEffectIndex, val, true); } HealthComponent val2 = (Object.op_Implicit((Object)(object)base.target) ? base.target.healthComponent : null); CharacterBody val3 = (Object.op_Implicit((Object)(object)val2) ? val2.body : null); CharacterMaster val4 = (Object.op_Implicit((Object)(object)val3) ? val3.master : null); if (Object.op_Implicit((Object)(object)val4)) { _targetMasterStats = ((Component)(object)val4).GetComponentCached(); } } public override void OnArrival() { if (Object.op_Implicit((Object)(object)_targetMasterStats)) { CharacterMasterExtraStatsTracker targetMasterStats = _targetMasterStats; targetMasterStats.NetworkSteakBonus = targetMasterStats.SteakBonus + SteakBonus; } } } public sealed class VoidDeathOrb : Orb { private static EffectIndex _orbEffectIndex = (EffectIndex)(-1); public GameObject Attacker; public ProcChainMask ProcChainMask; public bool Crit; [SystemInitializer(new Type[] { typeof(EffectCatalog) })] private static void Init() { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 _orbEffectIndex = EffectCatalog.FindEffectIndexFromPrefab(ItemQualitiesContent.Prefabs.VoidDeathOrbEffect); if ((int)_orbEffectIndex == -1) { Log.Error("Failed to find VoidDeathOrb effect index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Orbs\\VoidDeathOrb.cs", "Init", 18); } } public override void Begin() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) ((Orb)this).duration = 0.4f; if ((int)_orbEffectIndex != -1) { EffectData val = new EffectData { origin = base.origin, genericFloat = ((Orb)this).duration }; val.SetHurtBoxReference(base.target); EffectManager.SpawnEffect(_orbEffectIndex, val, true); } } public override void OnArrival() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00bb: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)base.target)) { HealthComponent healthComponent = base.target.healthComponent; if (Object.op_Implicit((Object)(object)healthComponent)) { ProcChainMask procChainMask = ProcChainMask; ProcTypeAPI.AddModdedProc(ref procChainMask, ProcTypes.VoidDeathOrbProcType); DamageInfo val = new DamageInfo { damage = 0f, attacker = Attacker, inflictor = Attacker, inflictedHurtbox = base.target, crit = Crit, procChainMask = procChainMask, procCoefficient = 0f, position = ((Component)base.target).transform.position, damageColorIndex = (DamageColorIndex)9, damageType = DamageTypeCombo.op_Implicit((DamageType)67648) }; healthComponent.TakeDamage(val); GlobalEventManager.instance.OnHitEnemy(val, ((Component)healthComponent).gameObject); GlobalEventManager.instance.OnHitAll(val, ((Component)healthComponent).gameObject); } } } } } namespace ItemQualities.Networking { public sealed class GatewayPickupTeleportMessage : INetMessage, ISerializableObject { private GameObject _pickupObject; public GatewayPickupTeleportMessage(GameObject pickupObject) { _pickupObject = pickupObject; } public GatewayPickupTeleportMessage() { } void ISerializableObject.Serialize(NetworkWriter writer) { writer.Write(_pickupObject); } void ISerializableObject.Deserialize(NetworkReader reader) { _pickupObject = reader.ReadGameObject(); } void INetMessage.OnReceived() { GatewayQualityPickupController gatewayQualityPickupController = default(GatewayQualityPickupController); if (Object.op_Implicit((Object)(object)_pickupObject) && _pickupObject.TryGetComponent(ref gatewayQualityPickupController)) { gatewayQualityPickupController.OnTeleportServer(); } } } internal static class NetworkMessageHandler { [InitDuringStartupPhase(/*Could not decode attribute arguments.*/)] private static void Init() { NetworkingAPI.RegisterMessageType(); } } } namespace ItemQualities.ModCompatibility { internal static class TeamsAPICompat { public static int TeamsCount => TeamCatalog.teamDefs.Length; } } namespace ItemQualities.Items { internal static class AlienHead { [SystemInitializer(new Type[] { })] private static void Init() { GlobalEventManager.onCharacterDeathGlobal += onCharacterDeathGlobal; } private static void onCharacterDeathGlobal(DamageReport deathReport) { if (!NetworkServer.active) { return; } CharacterBody val = deathReport?.attackerBody; if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.inventory)) { return; } ItemQualityCounts itemCountsEffective = val.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.AlienHead); if (itemCountsEffective.TotalQualityCount > 0) { float percentChance = 15f * (float)itemCountsEffective.UncommonCount + 35f * (float)itemCountsEffective.RareCount + 75f * (float)itemCountsEffective.EpicCount + 100f * (float)itemCountsEffective.LegendaryCount; float num = 1f * (float)RollUtil.GetOverflowRoll(percentChance, deathReport.attackerMaster, ((ProcChainMask)(ref deathReport.damageInfo.procChainMask)).HasProc((ProcType)26)); if (num > 0f) { val.skillLocator.DeductCooldownFromAllSkillsServer(num); } } } } internal static class ArmorPlate { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(getStatCoefficients); GlobalEventManager.onServerDamageDealt += onServerDamageDealt; } private static void getStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender) && sender.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.ArmorPlateBuff).TotalCount > 0) { args.armorAdd += 75f; } } private static void onServerDamageDealt(DamageReport damageReport) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || damageReport?.damageInfo == null || damageReport.damageDealt <= 0f || damageReport.damageInfo.rejected) { return; } CharacterBody victimBody = damageReport.victimBody; if (!Object.op_Implicit((Object)(object)victimBody) || !Object.op_Implicit((Object)(object)victimBody.inventory)) { return; } ItemQualityCounts itemCountsEffective = victimBody.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.ArmorPlate); if (itemCountsEffective.TotalQualityCount > 0) { QualityTier highestQuality = itemCountsEffective.HighestQuality; victimBody.AddBuff(ItemQualitiesContent.BuffQualityGroups.ArmorPlateBuildup.GetBuffIndex(highestQuality)); if (victimBody.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.ArmorPlateBuildup).TotalCount >= 15) { victimBody.RemoveAllBuffs(ItemQualitiesContent.BuffQualityGroups.ArmorPlateBuildup); float num = 3f * (float)itemCountsEffective.UncommonCount + 6f * (float)itemCountsEffective.RareCount + 9f * (float)itemCountsEffective.EpicCount + 12f * (float)itemCountsEffective.LegendaryCount; victimBody.AddTimedBuff(ItemQualitiesContent.BuffQualityGroups.ArmorPlateBuff.GetBuffIndex(highestQuality), num); } } } } public sealed class ArmorPlateQualityItemBehavior : QualityItemBodyBehavior { [ItemGroupAssociation(QualityItemBehaviorUsageFlags.Server)] private static ItemQualityGroup GetItemGroup() { return ItemQualitiesContent.ItemQualityGroups.ArmorPlate; } private void OnDisable() { if (NetworkServer.active) { base.Body.RemoveAllQualityBuffs(ItemQualitiesContent.BuffQualityGroups.ArmorPlateBuildup); } } protected override void OnStacksChanged() { base.OnStacksChanged(); base.Body.ConvertQualityBuffsToTier(ItemQualitiesContent.BuffQualityGroups.ArmorPlateBuildup, base.Stacks.HighestQuality); base.Body.ConvertQualityBuffsToTier(ItemQualitiesContent.BuffQualityGroups.ArmorPlateBuff, base.Stacks.HighestQuality); } } internal static class ArmorReductionOnHit { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown HealthComponent.TakeDamageProcess += new Manipulator(QualityArmorReductionOnHit); } private static void QualityArmorReductionOnHit(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "ArmorReductionOnHit"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "ClearTimedBuffs") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ArmorReductionOnHit.cs", "QualityArmorReductionOnHit", 25); return; } val.Goto(array[1].Next, (MoveType)2, false); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg_1); val.EmitDelegate>((Action)doExtraDamage); } private static void doExtraDamage(HealthComponent victim, DamageInfo damageInfo) { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)victim.body)) { return; } CharacterBody val = (Object.op_Implicit((Object)(object)damageInfo?.attacker) ? damageInfo.attacker.GetComponent() : null); if (!Object.op_Implicit((Object)(object)val)) { return; } Inventory inventory = val.inventory; if (Object.op_Implicit((Object)(object)inventory)) { ItemQualityCounts itemCountsEffective = inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.ArmorReductionOnHit); if (itemCountsEffective.TotalQualityCount > 0) { float num = 1f + 0.2f * (float)itemCountsEffective.UncommonCount + 0.4f * (float)itemCountsEffective.RareCount + 0.6f * (float)itemCountsEffective.EpicCount + 1f * (float)itemCountsEffective.LegendaryCount; DamageInfo val2 = new DamageInfo { attacker = damageInfo.attacker, damage = val.damage * num, crit = damageInfo.crit, procCoefficient = 0f, procChainMask = damageInfo.procChainMask, position = damageInfo.position, damageColorIndex = (DamageColorIndex)3 }; victim.TakeDamage(val2); } } } } internal static class AttackSpeedAndMoveSpeed { private enum BonusType { None, AttackSpeed, MoveSpeed } private static BonusType _currentCallBonusType; [SystemInitializer(new Type[] { })] private static void Init() { //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 CharacterBody.RecalculateStats += new hook_RecalculateStats(CharacterBody_RecalculateStats); RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients); } private static void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args) { Inventory val = (Object.op_Implicit((Object)(object)sender) ? sender.inventory : null); if (Object.op_Implicit((Object)(object)val)) { ItemQualityCounts itemCountsEffective = val.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.AttackSpeedAndMoveSpeed); switch (_currentCallBonusType) { case BonusType.AttackSpeed: args.attackSpeedMultAdd += 0.1f * (float)itemCountsEffective.UncommonCount + 0.2f * (float)itemCountsEffective.RareCount + 0.4f * (float)itemCountsEffective.EpicCount + 0.6f * (float)itemCountsEffective.LegendaryCount; break; case BonusType.MoveSpeed: args.moveSpeedMultAdd += 0.1f * (float)itemCountsEffective.UncommonCount + 0.2f * (float)itemCountsEffective.RareCount + 0.4f * (float)itemCountsEffective.EpicCount + 0.6f * (float)itemCountsEffective.LegendaryCount; break; } } } private static void CharacterBody_RecalculateStats(orig_RecalculateStats orig, CharacterBody self) { orig.Invoke(self); if (_currentCallBonusType != 0) { return; } ItemQualityCounts itemQualityCounts = default(ItemQualityCounts); if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.inventory)) { itemQualityCounts = self.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.AttackSpeedAndMoveSpeed); } if (itemQualityCounts.TotalQualityCount <= 0) { return; } BonusType bonusType = BonusType.None; float num = self.moveSpeed; if (self.isSprinting) { num /= self.sprintingSpeedMultiplier; } float num2 = ((self.baseMoveSpeed > 0f) ? (num / self.baseMoveSpeed) : 1f); bonusType = ((((self.baseAttackSpeed > 0f) ? (self.attackSpeed / self.baseAttackSpeed) : 1f) < num2) ? BonusType.AttackSpeed : BonusType.MoveSpeed); if (bonusType == BonusType.None) { return; } _currentCallBonusType = bonusType; try { self.RecalculateStats(); } finally { _currentCallBonusType = BonusType.None; } } } internal static class AttackSpeedOnCrit { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(getStatCoefficients); GlobalEventManager.onCharacterDeathGlobal += onCharacterDeathGlobal; } private static void getStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender) && Object.op_Implicit((Object)(object)sender.inventory)) { ItemQualityCounts itemCountsEffective = sender.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.AttackSpeedOnCrit); BuffQualityCounts buffCounts = sender.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.AttackSpeedOnCrit); float num = 0.01f * (float)itemCountsEffective.UncommonCount + 0.02f * (float)itemCountsEffective.RareCount + 0.03f * (float)itemCountsEffective.EpicCount + 0.05f * (float)itemCountsEffective.LegendaryCount; args.attackSpeedMultAdd += num * (float)buffCounts.TotalQualityCount; } } private static void onCharacterDeathGlobal(DamageReport damageReport) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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) if (!NetworkServer.active || damageReport?.damageInfo == null || !damageReport.damageInfo.crit || !Object.op_Implicit((Object)(object)damageReport.attackerBody) || !Object.op_Implicit((Object)(object)damageReport.attackerBody.inventory)) { return; } ItemQualityCounts itemCountsEffective = damageReport.attackerBody.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.AttackSpeedOnCrit); if (itemCountsEffective.TotalQualityCount > 0) { QualityTier highestQuality = itemCountsEffective.HighestQuality; BuffIndex buffIndex = ItemQualitiesContent.BuffQualityGroups.AttackSpeedOnCrit.GetBuffIndex(highestQuality); int num = 40 * itemCountsEffective.UncommonCount + 45 * itemCountsEffective.RareCount + 60 * itemCountsEffective.EpicCount + 75 * itemCountsEffective.LegendaryCount; if (damageReport.attackerBody.GetBuffCount(buffIndex) < num) { damageReport.attackerBody.AddBuff(buffIndex); } } } } public sealed class AttackSpeedOnCritQualityItemBehavior : QualityItemBodyBehavior { [ItemGroupAssociation(QualityItemBehaviorUsageFlags.Server)] private static ItemQualityGroup GetItemGroup() { return ItemQualitiesContent.ItemQualityGroups.AttackSpeedOnCrit; } private void OnDisable() { if (NetworkServer.active) { base.Body.RemoveAllQualityBuffs(ItemQualitiesContent.BuffQualityGroups.AttackSpeedOnCrit); } } protected override void OnStacksChanged() { base.OnStacksChanged(); base.Body.ConvertQualityBuffsToTier(ItemQualitiesContent.BuffQualityGroups.AttackSpeedOnCrit, base.Stacks.HighestQuality); } } internal static class AttackSpeedPerNearbyAllyOrEnemy { [SystemInitializer(new Type[] { })] private static void Init() { //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 AttackSpeedPerNearbyCollider.UpdateValues += new hook_UpdateValues(AttackSpeedPerNearbyCollider_UpdateValues); AttackSpeedPerNearbyCollider.SetIndicatorDiameter += new hook_SetIndicatorDiameter(AttackSpeedPerNearbyCollider_SetIndicatorDiameter); RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients); } private static void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (!Object.op_Implicit((Object)(object)sender.inventory)) { return; } BuffQualityCounts buffCounts = sender.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.AttackSpeedPerNearbyAllyOrEnemyBuff); if (buffCounts.TotalQualityCount > 0) { ItemQualityCounts itemCountsEffective = sender.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.AttackSpeedPerNearbyAllyOrEnemy); float num = 0f; switch (itemCountsEffective.HighestQuality) { case QualityTier.None: case QualityTier.Uncommon: num = 0.05f; break; case QualityTier.Rare: num = 0.1f; break; case QualityTier.Epic: num = 0.2f; break; case QualityTier.Legendary: num = 0.35f; break; default: Log.Error($"Quality tier {itemCountsEffective.HighestQuality} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\AttackSpeedPerNearbyAllyOrEnemy.cs", "RecalculateStatsAPI_GetStatCoefficients", 46); break; } if (itemCountsEffective.UncommonCount > 0) { num += 0.025f * (float)(itemCountsEffective.UncommonCount - 1); } if (itemCountsEffective.RareCount > 0) { num += 0.05f * (float)(itemCountsEffective.RareCount - 1); } if (itemCountsEffective.EpicCount > 0) { num += 0.1f * (float)(itemCountsEffective.EpicCount - 1); } if (itemCountsEffective.LegendaryCount > 0) { num += 0.15f * (float)(itemCountsEffective.LegendaryCount - 1); } args.attackSpeedMultAdd += num * (float)buffCounts.TotalQualityCount; } } private static void AttackSpeedPerNearbyCollider_UpdateValues(orig_UpdateValues orig, AttackSpeedPerNearbyCollider self, int itemCount, out float diameter) { orig.Invoke(self, itemCount, ref diameter); if (!Object.op_Implicit((Object)(object)self.body) || !Object.op_Implicit((Object)(object)self.body.inventory)) { return; } BuffQualityCounts buffCounts = self.body.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.AttackSpeedPerNearbyAllyOrEnemyBuff); if (buffCounts.TotalQualityCount > 0) { ItemQualityCounts itemCountsEffective = self.body.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.AttackSpeedPerNearbyAllyOrEnemy); QualityTier highestQuality = itemCountsEffective.HighestQuality; float num = 0f; switch (highestQuality) { case QualityTier.None: case QualityTier.Uncommon: num = 5f; break; case QualityTier.Rare: num = 10f; break; case QualityTier.Epic: num = 20f; break; case QualityTier.Legendary: num = 40f; break; default: Log.Error($"Quality tier {highestQuality} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\AttackSpeedPerNearbyAllyOrEnemy.cs", "AttackSpeedPerNearbyCollider_UpdateValues", 104); break; } if (itemCountsEffective.UncommonCount > 0) { num += 2f * (float)(itemCountsEffective.UncommonCount - 1); } if (itemCountsEffective.RareCount > 0) { num += 5f * (float)(itemCountsEffective.RareCount - 1); } if (itemCountsEffective.EpicCount > 0) { num += 10f * (float)(itemCountsEffective.EpicCount - 1); } if (itemCountsEffective.LegendaryCount > 0) { num += 20f * (float)(itemCountsEffective.LegendaryCount - 1); } diameter += num * (float)buffCounts.TotalQualityCount; } } private static void AttackSpeedPerNearbyCollider_SetIndicatorDiameter(orig_SetIndicatorDiameter orig, AttackSpeedPerNearbyCollider self, float diameter) { AttackSpeedPerNearbyColliderQualityController attackSpeedPerNearbyColliderQualityController = default(AttackSpeedPerNearbyColliderQualityController); if (!((Component)self).TryGetComponent(ref attackSpeedPerNearbyColliderQualityController) || attackSpeedPerNearbyColliderQualityController.HandleSetDiameter(diameter)) { orig.Invoke(self, diameter); } } } public sealed class AttackSpeedPerNearbyColliderQualityController : MonoBehaviour { private NetworkedBodyAttachment _bodyAttachment; private AttackSpeedPerNearbyCollider _lanternCollider; private BuffQualityCounts _lastLanternBuffCounts; private float _targetDiameter = 40f; private float _diameterVelocity; private bool _settingDiameter; [SystemInitializer(new Type[] { })] private static IEnumerator 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_0032: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle handle = AddressableUtil.LoadAssetAsync(RoR2_DLC2_Items_AttackSpeedPerNearbyAllyOrEnemy.BolsteringLanternBonusIndicator_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject lanternAttachment) { UnityObjectExtensions.EnsureComponent(lanternAttachment); }); return (IEnumerator)(object)handle; } private void Awake() { _bodyAttachment = ((Component)this).GetComponent(); if (!Object.op_Implicit((Object)(object)_bodyAttachment)) { Log.Error(Util.GetGameObjectHierarchyName(((Component)this).gameObject) + " is missing NetworkedBodyAttachment component", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\AttackSpeedPerNearbyColliderQualityController.cs", "Awake", 43); ((Behaviour)this).enabled = false; return; } _lanternCollider = ((Component)this).GetComponent(); if (!Object.op_Implicit((Object)(object)_lanternCollider)) { Log.Error(Util.GetGameObjectHierarchyName(((Component)this).gameObject) + " is missing AttackSpeedPerNearbyCollider component", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\AttackSpeedPerNearbyColliderQualityController.cs", "Awake", 51); ((Behaviour)this).enabled = false; } } private void OnEnable() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { GlobalEventManager.onCharacterDeathGlobal += onCharacterDeathGlobal; updateBuffCounts(); } if (Object.op_Implicit((Object)(object)_lanternCollider.indicatorSphere)) { _targetDiameter = _lanternCollider.indicatorSphere.transform.localScale.x; } } private void OnDisable() { GlobalEventManager.onCharacterDeathGlobal -= onCharacterDeathGlobal; } private void FixedUpdate() { //IL_0079: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { CharacterBody val = (Object.op_Implicit((Object)(object)_bodyAttachment) ? _bodyAttachment.attachedBody : null); BuffQualityCounts left = (Object.op_Implicit((Object)(object)val) ? val.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.AttackSpeedPerNearbyAllyOrEnemyBuff) : default(BuffQualityCounts)); if (left != _lastLanternBuffCounts) { updateBuffCounts(); } } if (!Object.op_Implicit((Object)(object)_lanternCollider.indicatorSphere)) { return; } float x = _lanternCollider.indicatorSphere.transform.localScale.x; if (x != _targetDiameter) { float indicatorDiameter = Mathf.SmoothDamp(x, _targetDiameter, ref _diameterVelocity, 0.3f); _settingDiameter = true; try { _lanternCollider.SetIndicatorDiameter(indicatorDiameter); } finally { _settingDiameter = false; } } } private void onCharacterDeathGlobal(DamageReport damageReport) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) CharacterBody val = (Object.op_Implicit((Object)(object)_bodyAttachment) ? _bodyAttachment.attachedBody : null); if (!Object.op_Implicit((Object)(object)val) || (Object)(object)damageReport.attackerBody != (Object)(object)val || !Object.op_Implicit((Object)(object)val.inventory)) { return; } ItemQualityCounts itemCountsEffective = val.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.AttackSpeedPerNearbyAllyOrEnemy); if (itemCountsEffective.TotalQualityCount <= 0) { return; } QualityTier highestQuality = itemCountsEffective.HighestQuality; if (!Object.op_Implicit((Object)(object)damageReport.victimBody)) { return; } Vector3 val2 = damageReport.victimBody.corePosition - val.corePosition; if (((Vector3)(ref val2)).magnitude <= _lanternCollider.sphereCollider.radius) { float num = 0f; switch (highestQuality) { case QualityTier.Uncommon: num = 3f; break; case QualityTier.Rare: num = 5f; break; case QualityTier.Epic: num = 7f; break; case QualityTier.Legendary: num = 10f; break; default: Log.Error($"Quality tier {highestQuality} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\AttackSpeedPerNearbyColliderQualityController.cs", "onCharacterDeathGlobal", 139); break; } if (num > 0f) { BuffIndex buffIndex = ItemQualitiesContent.BuffQualityGroups.AttackSpeedPerNearbyAllyOrEnemyBuff.GetBuffIndex(highestQuality); val.AddTimedBuff(buffIndex, num); updateBuffCounts(); } } } private void updateBuffCounts() { if (Object.op_Implicit((Object)(object)_lanternCollider.body)) { _lanternCollider.ServerUpdateValuesFromInventory(); } BuffQualityCounts lastLanternBuffCounts = default(BuffQualityCounts); if (Object.op_Implicit((Object)(object)_bodyAttachment.attachedBody)) { lastLanternBuffCounts = _bodyAttachment.attachedBody.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.AttackSpeedPerNearbyAllyOrEnemyBuff); } _lastLanternBuffCounts = lastLanternBuffCounts; } public bool HandleSetDiameter(float diameter) { if (_settingDiameter || !((Behaviour)this).enabled || !Object.op_Implicit((Object)(object)_lanternCollider.indicatorSphere)) { return true; } _targetDiameter = diameter; return false; } } internal static class Bandolier { [SystemInitializer(new Type[] { })] private static void Init() { //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 GlobalEventManager.OnCharacterDeath += new Manipulator(GlobalEventManager_OnCharacterDeath); AmmoPickup.OnTriggerStay += new Manipulator(AmmoPickup_OnTriggerStay); SkillIcon.Update += new Manipulator(SkillIcon_Update); } private static 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 //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageReport parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Bandolier.cs", "GlobalEventManager_OnCharacterDeath", 32); return; } ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "Bandolier"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(NetworkServer), "Spawn") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Bandolier.cs", "GlobalEventManager_OnCharacterDeath", 40); return; } val.Goto(array[1].Next, (MoveType)0, false); val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Action)beforeBandolierSpawn); static void beforeBandolierSpawn(GameObject bandolierObj, DamageReport damageReport) { if (Object.op_Implicit((Object)(object)bandolierObj) && damageReport?.damageInfo != null) { CharacterMaster attackerMaster = damageReport.attackerMaster; Inventory val2 = (Object.op_Implicit((Object)(object)attackerMaster) ? attackerMaster.inventory : null); ItemQualityCounts itemQualityCounts = default(ItemQualityCounts); if (Object.op_Implicit((Object)(object)val2)) { itemQualityCounts = val2.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Bandolier); } if (itemQualityCounts.TotalQualityCount > 0 && RollUtil.CheckRoll(8f, attackerMaster, ((ProcChainMask)(ref damageReport.damageInfo.procChainMask)).HasProc((ProcType)26))) { int num = 3 * itemQualityCounts.UncommonCount + 6 * itemQualityCounts.RareCount + 10 * itemQualityCounts.EpicCount + 15 * itemQualityCounts.LegendaryCount; BandolierQualityInfo bandolierQualityInfo = default(BandolierQualityInfo); if (num > 0 && bandolierObj.TryGetComponent(ref bandolierQualityInfo)) { bandolierQualityInfo.ExtraSkillChargesServer = num; } } } } } private static void AmmoPickup_OnTriggerStay(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find Collider parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Bandolier.cs", "AmmoPickup_OnTriggerStay", 84); return; } if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "ApplyAmmoPack") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Bandolier.cs", "AmmoPickup_OnTriggerStay", 91); return; } val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Action)onApplyAmmoPackServer); static void onApplyAmmoPackServer(AmmoPickup ammoPickup, Collider recipient) { if (Object.op_Implicit((Object)(object)ammoPickup) && Object.op_Implicit((Object)(object)recipient)) { BandolierQualityInfo componentInParent = ((Component)ammoPickup).GetComponentInParent(); if (Object.op_Implicit((Object)(object)componentInParent)) { componentInParent.OnApplyAmmoPackServer(((Component)recipient).gameObject); } } } } private static void SkillIcon_Update(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "get_maxStock") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Bandolier.cs", "SkillIcon_Update", 119); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getCurrentMaxStock); static int getCurrentMaxStock(int maxStock, SkillIcon skillIcon) { if (Object.op_Implicit((Object)(object)skillIcon) && Object.op_Implicit((Object)(object)skillIcon.targetSkill)) { maxStock = Mathf.Max(skillIcon.targetSkill.stock, maxStock); } return maxStock; } } } public sealed class BandolierQualityInfo : NetworkBehaviour { [NonSerialized] [HideInInspector] public int ExtraSkillChargesServer; private static int kTargetRpcTargetApplyAmmoPack; [SystemInitializer(new Type[] { })] private static 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) AsyncOperationHandle handle = AddressableUtil.LoadAssetAsync(RoR2_Base_Bandolier.AmmoPack_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject bandolierPrefab) { UnityObjectExtensions.EnsureComponent(bandolierPrefab); }); } [Server] public void OnApplyAmmoPackServer(GameObject recipient) { if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void ItemQualities.Items.BandolierQualityInfo::OnApplyAmmoPackServer(UnityEngine.GameObject)' called on client"); } else if (Object.op_Implicit((Object)(object)recipient)) { NetworkIdentity val = default(NetworkIdentity); if (Util.HasEffectiveAuthority(recipient)) { applyAmmoPack(recipient, ExtraSkillChargesServer); } else if (recipient.TryGetComponent(ref val) && val.clientAuthorityOwner != null) { CallTargetApplyAmmoPack(val.clientAuthorityOwner, recipient, ExtraSkillChargesServer); } else { Log.Warning("Attempting to grant to non-networked object " + Util.GetGameObjectHierarchyName(recipient), "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\BandolierQualityInfo.cs", "OnApplyAmmoPackServer", 44); } } } [TargetRpc] private void TargetApplyAmmoPack(NetworkConnection connection, GameObject recipient, int extraSkillCharges) { applyAmmoPack(recipient, extraSkillCharges); } private static void applyAmmoPack(GameObject recipient, int extraSkillCharges) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) SkillLocator val = default(SkillLocator); List skills; if (Object.op_Implicit((Object)(object)recipient) && recipient.TryGetComponent(ref val)) { skills = new List(4); tryAddSkill(val.primary); tryAddSkill(val.secondary); tryAddSkill(val.utility); tryAddSkill(val.special); if (skills.Count != 0) { GenericSkill obj = new Xoroshiro128Plus(RoR2Application.rng.nextUlong).NextElementUniform(skills); obj.stock += extraSkillCharges; } } void tryAddSkill(GenericSkill genericSkill) { if (Object.op_Implicit((Object)(object)genericSkill) && Object.op_Implicit((Object)(object)genericSkill.skillDef) && genericSkill.baseRechargeInterval > 0f && genericSkill.skillDef.stockToConsume > 0 && !genericSkill.skillDef.dontAllowPastMaxStocks) { skills.Add(genericSkill); } } } private void UNetVersion() { } protected static void InvokeRpcTargetApplyAmmoPack(NetworkBehaviour obj, NetworkReader reader) { if (!NetworkClient.active) { Debug.LogError((object)"TargetRPC TargetApplyAmmoPack called on server."); } else { ((BandolierQualityInfo)(object)obj).TargetApplyAmmoPack(ClientScene.readyConnection, reader.ReadGameObject(), (int)reader.ReadPackedUInt32()); } } public void CallTargetApplyAmmoPack(NetworkConnection connection, GameObject recipient, int extraSkillCharges) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogError((object)"TargetRPC Function TargetApplyAmmoPack called on client."); return; } if (connection is ULocalConnectionToServer) { Debug.LogError((object)"TargetRPC Function TargetApplyAmmoPack called on connection to server"); return; } NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)2); val.WritePackedUInt32((uint)kTargetRpcTargetApplyAmmoPack); val.Write(((Component)this).GetComponent().netId); val.Write(recipient); val.WritePackedUInt32((uint)extraSkillCharges); ((NetworkBehaviour)this).SendTargetRPCInternal(connection, val, 0, "TargetApplyAmmoPack"); } static BandolierQualityInfo() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown kTargetRpcTargetApplyAmmoPack = -1156747091; NetworkBehaviour.RegisterRpcDelegate(typeof(BandolierQualityInfo), kTargetRpcTargetApplyAmmoPack, new CmdDelegate(InvokeRpcTargetApplyAmmoPack)); NetworkCRC.RegisterBehaviour("BandolierQualityInfo", 0); } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { bool result = default(bool); return result; } public override void OnDeserialize(NetworkReader reader, bool initialState) { } public override void PreStartClient() { } } internal static class BarrageOnBoss { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown SceneDirector.PopulateScene += new Manipulator(SceneDirector_PopulateScene); } private static void SceneDirector_PopulateScene(ILContext il) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown ILLabel label = null; ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Artifacts), "Prestige"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(RunArtifactManager), "IsArtifactEnabled") }) && val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref label) })) { val.EmitDelegate>((Func)checkWarBonds); } else { Log.Error(((MemberReference)il.Method).Name + " IL Hook failed!", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\BarrageOnBoss.cs", "SceneDirector_PopulateScene", 32); } } private static bool checkWarBonds(bool forcespawn) { if (ItemQualityUtils.GetTeamItemCounts(ItemQualitiesContent.ItemQualityGroups.BarrageOnBoss, (TeamIndex)1, requireAlive: false).TotalQualityCount > 0) { return true; } return forcespawn; } } internal static class BarrierOnCooldown { private static EffectIndex _barrierOnCooldownProcEffect = (EffectIndex)(-1); [SystemInitializer(new Type[] { typeof(EffectCatalogUtils) })] private static void Init() { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //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 _barrierOnCooldownProcEffect = EffectCatalogUtils.FindEffectIndex("BarrierOnCooldownProc"); if ((int)_barrierOnCooldownProcEffect == -1) { Log.Error("Failed to find Eclipse Lite proc effect index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\BarrierOnCooldown.cs", "Init", 16); } EquipmentSlot.onServerEquipmentActivated += onServerEquipmentActivated; HealthComponent.AddBarrier += new hook_AddBarrier(HealthComponent_AddBarrier); HealthComponent.AddCharge += new hook_AddCharge(HealthComponent_AddCharge); } private static void HealthComponent_AddCharge(orig_AddCharge orig, HealthComponent self, float value) { float maxBarrier = self.body.maxBarrier; self.body.maxBarrier = getMaxBarrier(self.body); try { orig.Invoke(self, value); } finally { self.body.maxBarrier = maxBarrier; } } private static void HealthComponent_AddBarrier(orig_AddBarrier orig, HealthComponent self, float value) { float maxBarrier = self.body.maxBarrier; self.body.maxBarrier = getMaxBarrier(self.body); try { orig.Invoke(self, value); } finally { self.body.maxBarrier = maxBarrier; } } private static float getMaxBarrier(CharacterBody body) { float num = body.maxBarrier; if (Object.op_Implicit((Object)(object)body.inventory)) { ItemQualityCounts itemCountsEffective = body.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.BarrierOnCooldown); float num2 = (float)itemCountsEffective.UncommonCount * 0.3f + (float)itemCountsEffective.RareCount * 0.6f + (float)itemCountsEffective.EpicCount * 1f + (float)itemCountsEffective.LegendaryCount * 1.5f; if (num2 > 0f) { num *= 1f + num2; } } return num; } private static void onServerEquipmentActivated(EquipmentSlot equipmentSlot, EquipmentIndex equipmentIndex) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Invalid comparison between Unknown and I4 //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)equipmentSlot) || (int)equipmentIndex == -1) { return; } CharacterBody characterBody = equipmentSlot.characterBody; Inventory val = (Object.op_Implicit((Object)(object)characterBody) ? characterBody.inventory : null); if (!Object.op_Implicit((Object)(object)val)) { return; } ItemQualityCounts itemCountsEffective = val.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.BarrierOnCooldown); if (itemCountsEffective.TotalQualityCount > 0) { float cooldown = EquipmentCatalog.GetEquipmentDef(equipmentIndex).cooldown; float num = 0.01f * (float)itemCountsEffective.UncommonCount + 0.02f * (float)itemCountsEffective.RareCount + 0.03f * (float)itemCountsEffective.EpicCount + 0.04f * (float)itemCountsEffective.LegendaryCount; characterBody.healthComponent.AddBarrier(characterBody.healthComponent.fullCombinedHealth * cooldown * num); if ((int)_barrierOnCooldownProcEffect != -1) { EffectManager.SpawnEffect(_barrierOnCooldownProcEffect, new EffectData { origin = characterBody.corePosition }, true); } } } } internal static class BarrierOnKill { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(getStatCoefficients); } private static void getStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender.inventory)) { ItemQualityCounts itemCountsEffective = sender.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.BarrierOnKill); if (itemCountsEffective.TotalQualityCount > 0) { args.barrierDecayMult *= Mathf.Pow(0.9f, (float)itemCountsEffective.UncommonCount) * Mathf.Pow(0.8f, (float)itemCountsEffective.RareCount) * Mathf.Pow(0.5f, (float)itemCountsEffective.EpicCount) * Mathf.Pow(0.25f, (float)itemCountsEffective.LegendaryCount); } } } } internal static class BarrierOnOverHeal { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(getStatCoefficients); } private static void getStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender.healthComponent) && Object.op_Implicit((Object)(object)sender.inventory)) { ItemQualityCounts itemCountsEffective = sender.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.BarrierOnOverHeal); if (itemCountsEffective.TotalQualityCount > 0 && sender.healthComponent.barrier > 0f) { args.armorAdd += (float)(20 * itemCountsEffective.UncommonCount + 50 * itemCountsEffective.RareCount + 80 * itemCountsEffective.EpicCount + 100 * itemCountsEffective.LegendaryCount); } } } } internal static class Bear { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown HealthComponent.TakeDamageProcess += new Manipulator(HealthComponent_TakeDamageProcess); } private static void HealthComponent_TakeDamageProcess(ILContext il) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageInfo parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Bear.cs", "HealthComponent_TakeDamageProcess", 23); return; } ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "OnIncomingDamageServer") })) { Log.Error("Failed to find OnIncomingDamageServer call location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Bear.cs", "HealthComponent_TakeDamageProcess", 32); return; } int num5 = default(int); if (!val.TryGotoNext((MoveType)1, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num5), delegate(Instruction x) { FieldReference val3 = default(FieldReference); if (ILPatternMatchingExt.MatchLdfld(x, ref val3)) { if (val3 == null) { return false; } TypeReference fieldType = val3.FieldType; return ((fieldType != null) ? new bool?(Extensions.Is((MemberReference)(object)fieldType, (MemberInfo)typeof(DamageInfo))) : null) == true; } return false; }, (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "rejected") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Bear.cs", "HealthComponent_TakeDamageProcess", 41); return; } val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Action)onIncomingDamageServer); static void onIncomingDamageServer(HealthComponent healthComponent, DamageInfo damageInfo) { CharacterBody body = healthComponent.body; Inventory val2 = (Object.op_Implicit((Object)(object)body) ? body.inventory : null); if (Object.op_Implicit((Object)(object)val2)) { ItemQualityCounts itemCountsEffective = val2.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Bear); if (itemCountsEffective.TotalQualityCount > 0 && damageInfo.rejected && ((!body.HasBuff(Buffs.Immune) && !body.HasBuff(Buffs.SojournVehicle) && !body.HasBuff(Buffs.HiddenInvincibility)) || damageInfo.IsParried())) { float num = damageInfo.damage / body.healthComponent.fullCombinedHealth; float num2 = 0.02f * (float)itemCountsEffective.UncommonCount + 0.05f * (float)itemCountsEffective.RareCount + 0.1f * (float)itemCountsEffective.EpicCount + 0.15f * (float)itemCountsEffective.LegendaryCount; int num3 = 3 * itemCountsEffective.UncommonCount + 6 * itemCountsEffective.RareCount + 9 * itemCountsEffective.EpicCount + 12 * itemCountsEffective.LegendaryCount; float num4 = Math.Min(num * 100f * num2, num3); if (num4 >= 1f / 30f) { body.AddTimedBuff(Buffs.Immune, num4); } } } } } } internal static class BearVoid { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown HealthComponent.TakeDamageProcess += new Manipulator(HealthComponent_TakeDamageProcess); } private static void HealthComponent_TakeDamageProcess(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "BearVoid"), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "BearVoidCooldown"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "AddTimedBuff") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\BearVoid.cs", "HealthComponent_TakeDamageProcess", 27); return; } val.Goto(array[2].Next, (MoveType)0, false); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getCooldown); static float getCooldown(float cooldown, HealthComponent healthComponent) { CharacterBody val2 = (Object.op_Implicit((Object)(object)healthComponent) ? healthComponent.body : null); Inventory val3 = (Object.op_Implicit((Object)(object)val2) ? val2.inventory : null); if (Object.op_Implicit((Object)(object)val3)) { ItemQualityCounts itemCountsEffective = val3.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.BearVoid); if (itemCountsEffective.TotalQualityCount > 0) { cooldown *= Mathf.Pow(0.95f, (float)itemCountsEffective.UncommonCount) * Mathf.Pow(0.9f, (float)itemCountsEffective.RareCount) * Mathf.Pow(0.8f, (float)itemCountsEffective.EpicCount) * Mathf.Pow(0.7f, (float)itemCountsEffective.LegendaryCount); } } return cooldown; } } } internal static class Behemoth { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown GlobalEventManager.OnHitAllProcess += new Manipulator(GlobalEventManager_OnHitAllProcess); } private static void GlobalEventManager_OnHitAllProcess(ILContext il) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageInfo parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Behemoth.cs", "GlobalEventManager_OnHitAllProcess", 23); return; } ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "Behemoth"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "Fire") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Behemoth.cs", "GlobalEventManager_OnHitAllProcess", 33); return; } val.Goto(array[1].Next, (MoveType)0, false); val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Action)handleQualityBehemoth); static void handleQualityBehemoth(BlastAttack behemothBlastAttack, DamageInfo damageInfo) { if (behemothBlastAttack != null && Object.op_Implicit((Object)(object)damageInfo?.attacker)) { CharacterBody component = damageInfo.attacker.GetComponent(); Inventory val2 = (Object.op_Implicit((Object)(object)component) ? component.inventory : null); if (Object.op_Implicit((Object)(object)val2)) { ItemQualityCounts itemCountsEffective = val2.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Behemoth); if (itemCountsEffective.TotalQualityCount > 0) { float num = 0.1f * (float)itemCountsEffective.UncommonCount + 0.3f * (float)itemCountsEffective.RareCount + 0.7f * (float)itemCountsEffective.EpicCount + 0.9f * (float)itemCountsEffective.LegendaryCount; if (num > 0f) { float num2 = Mathf.Min(1f - behemothBlastAttack.procCoefficient, num); behemothBlastAttack.procCoefficient += num2; ((ProcChainMask)(ref behemothBlastAttack.procChainMask)).AddProc((ProcType)0); num -= num2; if (num > 0f) { float num3 = num * 0.5f; behemothBlastAttack.baseDamage += damageInfo.damage * num3; } } } } } } } } internal static class BleedOnHit { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown DotController.InflictDot_refInflictDotInfo += new hook_InflictDot_refInflictDotInfo(DotController_InflictDot_refInflictDotInfo); } private static void DotController_InflictDot_refInflictDotInfo(orig_InflictDot_refInflictDotInfo orig, ref InflictDotInfo inflictDotInfo) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) try { if ((int)inflictDotInfo.dotIndex == 0) { CharacterBody val = (Object.op_Implicit((Object)(object)inflictDotInfo.attackerObject) ? inflictDotInfo.attackerObject.GetComponent() : null); Inventory val2 = (Object.op_Implicit((Object)(object)val) ? val.inventory : null); if (Object.op_Implicit((Object)(object)val2)) { ItemQualityCounts itemCountsEffective = val2.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.BleedOnHit); float num = 0.1f * (float)itemCountsEffective.UncommonCount + 0.2f * (float)itemCountsEffective.RareCount + 0.3f * (float)itemCountsEffective.EpicCount + 0.5f * (float)itemCountsEffective.LegendaryCount; inflictDotInfo.damageMultiplier += num; } } } catch (Exception ex) { Log.Error_NoCallerPrefix(ex.ToString()); } orig.Invoke(ref inflictDotInfo); } } internal static class BleedOnHitVoid { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown DotController.InflictDot_refInflictDotInfo += new hook_InflictDot_refInflictDotInfo(DotController_InflictDot_refInflictDotInfo); } private static void DotController_InflictDot_refInflictDotInfo(orig_InflictDot_refInflictDotInfo orig, ref InflictDotInfo inflictDotInfo) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 try { if ((int)inflictDotInfo.dotIndex == 8) { CharacterBody val = (Object.op_Implicit((Object)(object)inflictDotInfo.attackerObject) ? inflictDotInfo.attackerObject.GetComponent() : null); Inventory val2 = (Object.op_Implicit((Object)(object)val) ? val.inventory : null); if (Object.op_Implicit((Object)(object)val2)) { ItemQualityCounts itemCountsEffective = val2.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.BleedOnHitVoid); if (itemCountsEffective.TotalQualityCount > 0) { float num = 0.1f * (float)itemCountsEffective.UncommonCount + 0.2f * (float)itemCountsEffective.RareCount + 0.3f * (float)itemCountsEffective.EpicCount + 0.5f * (float)itemCountsEffective.LegendaryCount; inflictDotInfo.damageMultiplier += num; } } } } catch (Exception ex) { Log.Error_NoCallerPrefix(ex.ToString()); } orig.Invoke(ref inflictDotInfo); } } internal static class BonusGoldPackOnKill { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(getStatCoefficients); } private static void getStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender)) { args.baseDamageAdd += 0.01f * sender.baseDamage * (float)sender.GetBuffCount(ItemQualitiesContent.Buffs.GoldenGun); } } } public sealed class BonusGoldPackOnKillQualityItemBehavior : QualityItemBodyBehavior { private uint _lastGoldAmount; private float _buffRefreshTimer; [ItemGroupAssociation(QualityItemBehaviorUsageFlags.Server)] private static ItemQualityGroup GetItemGroup() { return ItemQualitiesContent.ItemQualityGroups.BonusGoldPackOnKill; } private void OnEnable() { refreshBuff(); _lastGoldAmount = (Object.op_Implicit((Object)(object)base.Body.master) ? base.Body.master.money : 0u); } private void OnDisable() { if (NetworkServer.active) { for (int num = base.Body.GetBuffCount(ItemQualitiesContent.Buffs.GoldenGun); num > 0; num--) { base.Body.RemoveBuff(ItemQualitiesContent.Buffs.GoldenGun); } } } private void FixedUpdate() { _buffRefreshTimer -= Time.fixedDeltaTime; if (_buffRefreshTimer <= 0f) { _buffRefreshTimer = 0.2f; uint num = (Object.op_Implicit((Object)(object)base.Body.master) ? base.Body.master.money : 0u); if (num != _lastGoldAmount) { _lastGoldAmount = num; refreshBuff(); } } } protected override void OnStacksChanged() { base.OnStacksChanged(); refreshBuff(); } private void refreshBuff() { ref readonly ItemQualityCounts stacks = ref base.Stacks; int num = 20 * stacks.UncommonCount + 40 * stacks.RareCount + 60 * stacks.EpicCount + 100 * stacks.LegendaryCount; float num2; switch (stacks.HighestQuality) { case QualityTier.None: num2 = 0f; break; case QualityTier.Uncommon: num2 = 1f; break; case QualityTier.Rare: num2 = 1.5f; break; case QualityTier.Epic: num2 = 2f; break; case QualityTier.Legendary: num2 = 3f; break; default: num2 = 0f; Log.Error($"Quality tier {stacks.HighestQuality} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\BonusGoldPackOnKillQualityItemBehavior.cs", "refreshBuff", 87); break; } uint num3 = (Object.op_Implicit((Object)(object)base.Body.master) ? base.Body.master.money : 0u); int difficultyScaledCost = Run.instance.GetDifficultyScaledCost(25, Stage.instance.entryDifficultyCoefficient); int num4 = (int)(num2 * ((float)num3 / (float)difficultyScaledCost)); int num5 = Mathf.Min(num, num4); int buffCount = base.Body.GetBuffCount(ItemQualitiesContent.Buffs.GoldenGun); if (num5 == buffCount) { return; } if (num5 > buffCount) { for (int i = buffCount; i < num5; i++) { base.Body.AddBuff(ItemQualitiesContent.Buffs.GoldenGun); } return; } for (int num6 = buffCount; num6 > num5; num6--) { base.Body.RemoveBuff(ItemQualitiesContent.Buffs.GoldenGun); } } } internal static class BoostAllStats { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(getStatCoefficients); } private static void getStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender.inventory)) { ItemQualityCounts itemCountsEffective = sender.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.BoostAllStats); if (itemCountsEffective.TotalQualityCount > 0 && sender.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.BoostAllStatsBuff).TotalQualityCount > 0) { float num = Mathf.Pow(0.7f, (float)itemCountsEffective.UncommonCount) * Mathf.Pow(0.6f, (float)itemCountsEffective.RareCount) * Mathf.Pow(0.5f, (float)itemCountsEffective.EpicCount) * Mathf.Pow(0.39999998f, (float)itemCountsEffective.LegendaryCount); args.allSkills.cooldownMultiplier *= num; } } } } public sealed class BoostAllStatsQualityItemBehavior : QualityItemBodyBehavior { private static BuffIndex[] _validBuffIndices = Array.Empty(); private float _buffCheckTimer; [SystemInitializer(new Type[] { typeof(BuffCatalog) })] private static void Init() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) List list = new List(BuffCatalog.buffCount); for (BuffIndex val = (BuffIndex)0; (int)val < BuffCatalog.buffCount; val = (BuffIndex)(val + 1)) { if (val != Buffs.BoostAllStatsBuff.buffIndex && !BuffCatalog.ignoreGrowthNectarIndices.Contains(val)) { list.Add(val); } } _validBuffIndices = list.ToArray(); Array.Sort(_validBuffIndices); } [ItemGroupAssociation(QualityItemBehaviorUsageFlags.Server)] private static ItemQualityGroup GetItemGroup() { return ItemQualitiesContent.ItemQualityGroups.BoostAllStats; } private void OnDisable() { if (NetworkServer.active) { setBuffActive(active: false); } } protected override void OnStacksChanged() { base.OnStacksChanged(); base.Body.ConvertQualityBuffsToTier(ItemQualitiesContent.BuffQualityGroups.BoostAllStatsBuff, base.Stacks.HighestQuality); } private void FixedUpdate() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } _buffCheckTimer -= Time.fixedDeltaTime; if (!(_buffCheckTimer <= 0f)) { return; } _buffCheckTimer = 0.2f; int num = 0; BuffIndex[] validBuffIndices = _validBuffIndices; foreach (BuffIndex buffIndex in validBuffIndices) { if (base.Body.HasBuffRaw(buffIndex)) { num++; } } setBuffActive(num >= 8); } private void setBuffActive(bool active) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) bool flag = base.Body.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.BoostAllStatsBuff).TotalQualityCount > 0; if (active != flag) { if (active) { BuffIndex buffIndex = ItemQualitiesContent.BuffQualityGroups.BoostAllStatsBuff.GetBuffIndex(base.Stacks.HighestQuality); base.Body.AddBuff(buffIndex); } else { base.Body.RemoveAllQualityBuffs(ItemQualitiesContent.BuffQualityGroups.BoostAllStatsBuff); } } } } internal static class BossDamageBonus { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown HealthComponent.TakeDamageProcess += new Manipulator(HealthComponent_TakeDamageProcess); GlobalEventManager.onCharacterDeathGlobal += onCharacterDeathGlobal; } private static void onCharacterDeathGlobal(DamageReport report) { if (Object.op_Implicit((Object)(object)report.victimBody) && report.victimBody.HasBuff(ItemQualitiesContent.Buffs.MiniBossMarker)) { if (Object.op_Implicit((Object)(object)report.attackerBody)) { applyTicks(report.attackerMaster); } if (Object.op_Implicit((Object)(object)report.attackerOwnerMaster)) { applyTicks(report.attackerOwnerMaster); } } } private static void applyTicks(CharacterMaster attackerMaster) { int num = attackerMaster.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.BossDamageBonus).HighestQuality switch { QualityTier.Uncommon => 15, QualityTier.Rare => 30, QualityTier.Epic => 45, QualityTier.Legendary => 60, _ => 0, }; if (((Component)(object)attackerMaster).TryGetComponentCached(out CharacterMasterExtraStatsTracker component) && component.BossDamageBonusTicks < num) { CharacterMasterExtraStatsTracker characterMasterExtraStatsTracker = component; characterMasterExtraStatsTracker.NetworkBossDamageBonusTicks = characterMasterExtraStatsTracker.BossDamageBonusTicks + 1; } } private static void HealthComponent_TakeDamageProcess(ILContext il) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageInfo parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\BossDamageBonus.cs", "HealthComponent_TakeDamageProcess", 61); return; } ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "BossDamageBonus"), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0.2f), (Instruction x) => ILPatternMatchingExt.MatchMul(x) })) { Log.Error("Failed to find damage patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\BossDamageBonus.cs", "HealthComponent_TakeDamageProcess", 72); return; } val.Goto(array[0].Next, (MoveType)0, false); if (!val.TryGotoPrev((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "get_isBoss") })) { Log.Error("Failed to find isBoss patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\BossDamageBonus.cs", "HealthComponent_TakeDamageProcess", 80); return; } VariableDefinition val2 = il.AddVariable(); val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)isMiniBoss); val.Emit(OpCodes.Dup); val.Emit(OpCodes.Stloc, val2); val.Emit(OpCodes.Or); val.Goto(array[2].Next, (MoveType)2, false); val.Emit(OpCodes.Ldloc, val2); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)getBossDamageMultiplier); static float getBossDamageMultiplier(float damageMultiplier, bool isMiniBoss, DamageInfo damageInfo) { if (isMiniBoss) { CharacterBody val3 = (Object.op_Implicit((Object)(object)damageInfo?.attacker) ? damageInfo.attacker.GetComponent() : null); if (Object.op_Implicit((Object)(object)val3) && Object.op_Implicit((Object)(object)val3.master) && ((Component)(object)val3.master).TryGetComponentCached(out CharacterMasterExtraStatsTracker component)) { ItemQualityCounts itemCountsEffective = val3.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.BossDamageBonus); damageMultiplier += (float)component.BossDamageBonusTicks * ((float)itemCountsEffective.UncommonCount * 0.01f + (float)itemCountsEffective.EpicCount * 0.0125f + (float)itemCountsEffective.RareCount * 0.015f + (float)itemCountsEffective.LegendaryCount * 0.02f); } } return damageMultiplier; } static bool isMiniBoss(bool isBoss, HealthComponent victim, DamageInfo damageInfo) { if (!Object.op_Implicit((Object)(object)victim) || !Object.op_Implicit((Object)(object)victim.body)) { return false; } if (isBoss) { return true; } CharacterBody val4 = (Object.op_Implicit((Object)(object)damageInfo?.attacker) ? damageInfo.attacker.GetComponent() : null); Inventory val5 = (Object.op_Implicit((Object)(object)val4) ? val4.inventory : null); if (!Object.op_Implicit((Object)(object)val5)) { return false; } if (val5.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.BossDamageBonus).TotalQualityCount > 0) { return victim.body.HasBuff(ItemQualitiesContent.Buffs.MiniBossMarker); } return false; } } } public sealed class BossDamageBonusQualityItemBehavior : QualityItemBodyBehavior { private sealed class MinibossController : MonoBehaviour, IOnTakeDamageServerReceiver { private CharacterBody _body; private GameObject _miniBossBodyAttachmentObj; private void Awake() { _body = ((Component)this).GetComponent(); _miniBossBodyAttachmentObj = Object.Instantiate(ItemQualitiesContent.NetworkedPrefabs.MiniBossBodyAttachment); _miniBossBodyAttachmentObj.GetComponent().AttachToGameObjectAndSpawn(((Component)this).gameObject, (string)null); } private void OnEnable() { if (Object.op_Implicit((Object)(object)_body) && Object.op_Implicit((Object)(object)_body.healthComponent)) { _body.healthComponent.AddOnTakeDamageServerReceiver((IOnTakeDamageServerReceiver)(object)this); } } private void OnDisable() { if (Object.op_Implicit((Object)(object)_body) && Object.op_Implicit((Object)(object)_body.healthComponent)) { _body.healthComponent.RemoveOnTakeDamageServerReceiver((IOnTakeDamageServerReceiver)(object)this); } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)_body)) { _body.ClearTimedBuffs(ItemQualitiesContent.Buffs.MiniBossMarker); } Object.Destroy((Object)(object)_miniBossBodyAttachmentObj); _miniBossBodyAttachmentObj = null; } private void FixedUpdate() { if (!Object.op_Implicit((Object)(object)_body) || !Object.op_Implicit((Object)(object)_body.healthComponent) || !_body.healthComponent.alive || !_body.HasBuff(ItemQualitiesContent.Buffs.MiniBossMarker)) { Object.Destroy((Object)(object)this); } } void IOnTakeDamageServerReceiver.OnTakeDamageServer(DamageReport damageReport) { if (Object.op_Implicit((Object)(object)damageReport.attackerMaster) && damageReport.attackerMaster.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.BossDamageBonus).TotalQualityCount > 0 && _body.healthComponent.combinedHealthFraction < 0.1f) { _body.ExtendTimedBuffIfPresent(ItemQualitiesContent.Buffs.MiniBossMarker, 1f, 3f); } } } private float _updateMiniBossTimer; [ItemGroupAssociation(QualityItemBehaviorUsageFlags.Server)] private static ItemQualityGroup GetItemGroup() { return ItemQualitiesContent.ItemQualityGroups.BossDamageBonus; } private void FixedUpdate() { _updateMiniBossTimer -= Time.fixedDeltaTime; if (_updateMiniBossTimer <= 0f) { CharacterBody val = findBestMiniBoss(); if (Object.op_Implicit((Object)(object)val)) { ref readonly ItemQualityCounts stacks = ref base.Stacks; float num = 10 + stacks.UncommonCount * 5 + stacks.RareCount * 10 + stacks.EpicCount * 15 + stacks.LegendaryCount * 20; val.AddTimedBuff(ItemQualitiesContent.Buffs.MiniBossMarker, num); val.AddTimedBuff(ItemQualitiesContent.Buffs.MiniBossCooldown, 90f); UnityObjectExtensions.EnsureComponent(((Component)val).gameObject); _updateMiniBossTimer = 40f; } else { _updateMiniBossTimer = 1f; } } } private CharacterBody findBestMiniBoss() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Invalid comparison between Unknown and I4 //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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) CharacterBody val = null; TeamMask allButNeutral = TeamMask.allButNeutral; ((TeamMask)(ref allButNeutral)).RemoveTeam(base.Body.teamComponent.teamIndex); TeamIndex val2 = (TeamIndex)0; while ((int)val2 < TeamsAPICompat.TeamsCount) { if (((TeamMask)(ref allButNeutral)).HasTeam(val2)) { foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers(val2)) { CharacterBody body = teamMember.body; if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.alive && !body.isBoss && !body.HasBuff(ItemQualitiesContent.Buffs.MiniBossCooldown) && !body.HasBuff(ItemQualitiesContent.Buffs.MiniBossMarker) && (body.bodyFlags & 4) == 0 && Object.op_Implicit((Object)(object)body.master)) { Vector3 val3 = base.Body.corePosition - body.corePosition; if (!(((Vector3)(ref val3)).sqrMagnitude >= 62500f) && (!Object.op_Implicit((Object)(object)val) || body.healthComponent.fullCombinedHealth > val.healthComponent.fullCombinedHealth)) { val = body; } } } } val2 = (TeamIndex)(sbyte)(val2 + 1); } return val; } } internal static class BounceNearby { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown GlobalEventManager.ProcessHitEnemy += new Manipulator(GlobalEventManager_ProcessHitEnemy); } private static void GlobalEventManager_ProcessHitEnemy(ILContext il) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageInfo parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\BounceNearby.cs", "GlobalEventManager_ProcessHitEnemy", 26); return; } ILCursor val = new ILCursor(il); VariableDefinition foundTargetsListVar = null; ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "BounceNearby"), (Instruction x) => x.MatchStloc(typeof(List), il, out foundTargetsListVar), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "SearchForTargets") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\BounceNearby.cs", "GlobalEventManager_ProcessHitEnemy", 38); return; } val.Goto(array[2].Next, (MoveType)2, false); val.Emit(OpCodes.Ldarg, parameter); val.Emit(OpCodes.Ldloc, foundTargetsListVar); val.EmitDelegate>>((Action>)tryProcQualityHook); static void tryProcQualityHook(DamageInfo damageInfo, List foundTargets) { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && foundTargets.Count > 0) { CharacterBody val2 = (Object.op_Implicit((Object)(object)damageInfo?.attacker) ? damageInfo.attacker.GetComponent() : null); Inventory val3 = (Object.op_Implicit((Object)(object)val2) ? val2.inventory : null); if (Object.op_Implicit((Object)(object)val3)) { ItemQualityCounts itemCountsEffective = val3.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.BounceNearby); if (itemCountsEffective.TotalQualityCount > 0) { float duration = 1f * (float)itemCountsEffective.UncommonCount + 2f * (float)itemCountsEffective.RareCount + 4f * (float)itemCountsEffective.EpicCount + 6f * (float)itemCountsEffective.LegendaryCount; GameObject obj = Object.Instantiate(ItemQualitiesContent.NetworkedPrefabs.MeatHookDelayedForce, damageInfo.position, Quaternion.identity); obj.GetComponent().teamIndex = val2.teamComponent.teamIndex; obj.GetComponent().duration = duration; NetworkServer.Spawn(obj); } } } } } } internal static class ChainLightning { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown GlobalEventManager.ProcessHitEnemy += new Manipulator(GlobalEventManager_ProcessHitEnemy); } private static void GlobalEventManager_ProcessHitEnemy(ILContext il) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageInfo parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ChainLightning.cs", "GlobalEventManager_ProcessHitEnemy", 24); return; } if (!((MethodReference)(object)il.Method).TryFindParameter("victim", out var parameter2)) { Log.Error("Failed to find victim parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ChainLightning.cs", "GlobalEventManager_ProcessHitEnemy", 30); return; } ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "ChainLightning"), (Instruction x) => ILPatternMatchingExt.MatchNewobj(x), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "AddOrb") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ChainLightning.cs", "GlobalEventManager_ProcessHitEnemy", 41); return; } val.Goto(array[2].Next, (MoveType)2, false); val.Emit(OpCodes.Ldarg, parameter); val.Emit(OpCodes.Ldarg, parameter2); val.EmitDelegate>((Action)handleQualityUkuleleProc); static void handleQualityUkuleleProc(DamageInfo damageInfo, GameObject victim) { if (damageInfo != null && Object.op_Implicit((Object)(object)victim)) { CharacterBody val2 = (Object.op_Implicit((Object)(object)damageInfo.attacker) ? damageInfo.attacker.GetComponent() : null); Inventory val3 = (Object.op_Implicit((Object)(object)val2) ? val2.inventory : null); if (Object.op_Implicit((Object)(object)val3)) { ItemQualityCounts itemCountsEffective = val3.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.ChainLightning); if (itemCountsEffective.TotalQualityCount > 0) { int num = 3 * itemCountsEffective.UncommonCount + 5 * itemCountsEffective.RareCount + 8 * itemCountsEffective.EpicCount + 12 * itemCountsEffective.LegendaryCount; if (num > 0) { ChainLightningArcController.AddToBody(victim, damageInfo.attacker, damageInfo.crit, ChainLightningArcController.FireInterval * (float)num); } } } } } } } [RequireComponent(typeof(NetworkedBodyAttachment))] public sealed class ChainLightningArcController : NetworkBehaviour { public static readonly float FireInterval = 0.2f; [NonSerialized] [SyncVar] public GameObject Attacker; [NonSerialized] [SyncVar] public bool IsCrit; [NonSerialized] [SyncVar] public float Duration; private NetworkedBodyAttachment _bodyAttachment; private MemoizedGetComponent _attackerBody; private float _stopwatch; private float _fireTimer; private NetworkInstanceId ___AttackerNetId; public GameObject NetworkAttacker { get { return Attacker; } [param: In] set { ((NetworkBehaviour)this).SetSyncVarGameObject(value, ref Attacker, 1u, ref ___AttackerNetId); } } public bool NetworkIsCrit { get { return IsCrit; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref IsCrit, 2u); } } public float NetworkDuration { get { return Duration; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref Duration, 4u); } } private void Awake() { _bodyAttachment = ((Component)this).GetComponent(); } private void OnEnable() { InstanceTracker.Add(this); } private void OnDisable() { InstanceTracker.Remove(this); } private void FixedUpdate() { if (NetworkServer.active) { fixedUpdateServer(Time.fixedDeltaTime); } } private void fixedUpdateServer(float deltaTime) { _stopwatch += deltaTime; if (_stopwatch >= Duration) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } _fireTimer += deltaTime; if (_fireTimer >= FireInterval) { _fireTimer -= FireInterval; fireArc(); } } private void fireArc() { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_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_0143: Unknown result type (might be due to invalid IL or missing references) CharacterBody val = _attackerBody.Get(Attacker); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.inventory)) { ItemQualityCounts itemCountsEffective = val.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.ChainLightning); float num = 1.5f * (float)itemCountsEffective.TotalQualityCount; float range = 20f + 2f * (float)itemCountsEffective.TotalCount; Vector3 origin = ((Component)this).transform.position; if (Object.op_Implicit((Object)(object)_bodyAttachment.attachedBody)) { origin = _bodyAttachment.attachedBody.corePosition; } LightningOrb val2 = new LightningOrb(); ((Orb)val2).origin = origin; val2.damageValue = val.damage * num; val2.isCrit = IsCrit; val2.bouncesRemaining = 0; val2.bouncedObjects = new List(); val2.teamIndex = val.teamComponent.teamIndex; val2.attacker = ((Component)val).gameObject; val2.procCoefficient = 0f; val2.lightningType = (LightningType)0; val2.damageColorIndex = (DamageColorIndex)3; val2.range = range; if (Object.op_Implicit((Object)(object)_bodyAttachment.attachedBody)) { val2.bouncedObjects.Add(_bodyAttachment.attachedBody.healthComponent); } HurtBox val3 = val2.PickNextTarget(((Orb)val2).origin); if (Object.op_Implicit((Object)(object)val3)) { ((Orb)val2).target = val3; OrbManager.instance.AddOrb((Orb)(object)val2); } } } public static void AddToBody(GameObject bodyObject, GameObject attacker, bool isCrit, float duration) { if (!NetworkServer.active) { Log.Warning("Called on client", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ChainLightningArcController.cs", "AddToBody", 123); } else { if (!Object.op_Implicit((Object)(object)bodyObject)) { return; } ChainLightningArcController chainLightningArcController = null; foreach (ChainLightningArcController instances in InstanceTracker.GetInstancesList()) { if ((Object)(object)instances.Attacker == (Object)(object)attacker) { chainLightningArcController = instances; break; } } if (!Object.op_Implicit((Object)(object)chainLightningArcController)) { GameObject obj = Object.Instantiate(ItemQualitiesContent.NetworkedPrefabs.ChainLightningArcAttachment); chainLightningArcController = obj.GetComponent(); chainLightningArcController.NetworkAttacker = attacker; obj.GetComponent().AttachToGameObjectAndSpawn(bodyObject, (string)null); } ChainLightningArcController chainLightningArcController2 = chainLightningArcController; chainLightningArcController2.NetworkDuration = chainLightningArcController2.Duration + duration; ChainLightningArcController chainLightningArcController3 = chainLightningArcController; chainLightningArcController3.NetworkIsCrit = chainLightningArcController3.IsCrit || isCrit; } } private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { if (forceAll) { writer.Write(Attacker); writer.Write(IsCrit); writer.Write(Duration); return true; } bool flag = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(Attacker); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 2u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(IsCrit); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 4u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(Duration); } if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) if (initialState) { ___AttackerNetId = reader.ReadNetworkId(); IsCrit = reader.ReadBoolean(); Duration = reader.ReadSingle(); return; } int num = (int)reader.ReadPackedUInt32(); if (((uint)num & (true ? 1u : 0u)) != 0) { Attacker = reader.ReadGameObject(); } if (((uint)num & 2u) != 0) { IsCrit = reader.ReadBoolean(); } if (((uint)num & 4u) != 0) { Duration = reader.ReadSingle(); } } public override void PreStartClient() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkInstanceId)(ref ___AttackerNetId)).IsEmpty()) { NetworkAttacker = ClientScene.FindLocalObject(___AttackerNetId); } } } internal static class ChainLightningVoid { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown GlobalEventManager.ProcessHitEnemy += new Manipulator(GlobalEventManager_ProcessHitEnemy); } private static void GlobalEventManager_ProcessHitEnemy(ILContext il) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageInfo parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ChainLightningVoid.cs", "GlobalEventManager_ProcessHitEnemy", 24); return; } ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "ChainLightningVoid"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "AddOrb") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ChainLightningVoid.cs", "GlobalEventManager_ProcessHitEnemy", 34); return; } val.Goto(array[1].Next, (MoveType)0, false); val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Action)tryHandleQualityOrb); static void tryHandleQualityOrb(VoidLightningOrb voidLightningOrb, DamageInfo damageInfo) { if (voidLightningOrb != null) { CharacterBody val2 = (Object.op_Implicit((Object)(object)damageInfo?.attacker) ? damageInfo.attacker.GetComponent() : null); Inventory val3 = (Object.op_Implicit((Object)(object)val2) ? val2.inventory : null); if (Object.op_Implicit((Object)(object)val3)) { ItemQualityCounts itemCountsEffective = val3.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.ChainLightningVoid); if (itemCountsEffective.TotalQualityCount > 0) { float num = 0.1f * (float)itemCountsEffective.UncommonCount + 0.3f * (float)itemCountsEffective.RareCount + 0.5f * (float)itemCountsEffective.EpicCount + 0.8f * (float)itemCountsEffective.LegendaryCount; float num2 = Mathf.Min(1f - voidLightningOrb.procCoefficient, num); voidLightningOrb.procCoefficient += num2; num -= num2; if (num > 0f) { float num3 = num * 0.5f; voidLightningOrb.damageValue += damageInfo.damage * num3; } } } } } } } internal static class CloverVoid { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown CharacterMaster.TryCloverVoidUpgrades += new Manipulator(CharacterMaster_TryCloverVoidUpgrades); } private static void CharacterMaster_TryCloverVoidUpgrades(ILContext il) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) ILCursor c = new ILCursor(il); int localsVar = -1; FieldReference startingItemDefLocalsField = null; if (c.Clone().TryGotoNext((MoveType)0, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref localsVar), delegate(Instruction x) { if (ILPatternMatchingExt.MatchLdfld(x, ref startingItemDefLocalsField)) { FieldReference obj2 = startingItemDefLocalsField; return ((obj2 != null) ? ((MemberReference)obj2).Name : null) == "startingItemDef"; } return false; } })) { VariableDefinition tier2DropListVar = null; if (c.TryGotoNext((MoveType)2, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "availableTier2DropList"), (Instruction x) => ILPatternMatchingExt.MatchNewobj>(x), (Instruction x) => x.MatchStloc(typeof(List), il, out tier2DropListVar) })) { patchDropList(tier2DropListVar, "tier2"); } else { Log.Error("Failed to find tier2 droplist variable", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\CloverVoid.cs", "CharacterMaster_TryCloverVoidUpgrades", 40); } c.Index = 0; VariableDefinition tier3DropListVar = null; if (c.TryGotoNext((MoveType)2, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "availableTier3DropList"), (Instruction x) => ILPatternMatchingExt.MatchNewobj>(x), (Instruction x) => x.MatchStloc(typeof(List), il, out tier3DropListVar) })) { patchDropList(tier3DropListVar, "tier3"); } else { Log.Error("Failed to find tier3 droplist variable", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\CloverVoid.cs", "CharacterMaster_TryCloverVoidUpgrades", 55); } } else { Log.Error("Failed to find locals variable", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\CloverVoid.cs", "CharacterMaster_TryCloverVoidUpgrades", 128); } c.Index = 0; VariableDefinition upgradableItemListVar = null; ILCursor[] array = default(ILCursor[]); if (!c.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "itemAcquisitionOrder"), (Instruction x) => x.MatchStloc(typeof(List), il, out upgradableItemListVar) })) { Log.Error("Failed to find upgradableItems list variable", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\CloverVoid.cs", "CharacterMaster_TryCloverVoidUpgrades", 138); } if (!c.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "TryTransform") })) { Log.Fatal("Failed to find ItemTransformation call location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\CloverVoid.cs", "CharacterMaster_TryCloverVoidUpgrades", 144); return; } VariableDefinition itemTransformationVar = null; if (!c.TryFindPrev(ref array, new Func[2] { (Instruction x) => x.MatchLdloca(typeof(ItemTransformation), il, out itemTransformationVar), (Instruction x) => ILPatternMatchingExt.MatchInitobj(x) })) { Log.Fatal("Failed to find ItemTransformation variable", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\CloverVoid.cs", "CharacterMaster_TryCloverVoidUpgrades", 153); return; } c.Emit(OpCodes.Ldarg_0); c.Emit(OpCodes.Ldloc, itemTransformationVar); if (upgradableItemListVar != null) { c.Emit(OpCodes.Ldloc, upgradableItemListVar); } else { c.Emit(OpCodes.Ldnull); } c.EmitDelegate>>((Action>)upgradeItemQualities); static List getAvailablePickupList(List availableDropList, List[] availableDropListsByQuality, ItemDef startingItemDef) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) QualityTier qualityTier8 = QualityCatalog.GetQualityTier((ItemIndex)((!Object.op_Implicit((Object)(object)startingItemDef)) ? (-1) : ((int)startingItemDef.itemIndex))); List list2 = null; if (availableDropListsByQuality != null) { list2 = ArrayUtils.GetSafe>(availableDropListsByQuality, (int)qualityTier8); } return list2 ?? availableDropList; } static List getQualityPickupsList(List pickupIndices, QualityTier qualityTier) { //IL_0017: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0038: Unknown result type (might be due to invalid IL or missing references) List list3 = new List(pickupIndices.Count); foreach (PickupIndex pickupIndex in pickupIndices) { PickupIndex pickupIndexOfQuality = QualityCatalog.GetPickupIndexOfQuality(pickupIndex, qualityTier); if (((PickupIndex)(ref pickupIndexOfQuality)).isValid && pickupIndexOfQuality != pickupIndex) { list3.Add(pickupIndexOfQuality); } } list3.TrimExcess(); return list3; } void patchDropList(VariableDefinition tierDropListVar, string name) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0138: 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) VariableDefinition val4 = il.AddVariable[]>(); c.Emit(OpCodes.Ldc_I4, 4); c.Emit(OpCodes.Newarr, typeof(List)); for (QualityTier qualityTier9 = QualityTier.Uncommon; qualityTier9 < QualityTier.Count; qualityTier9++) { c.Emit(OpCodes.Dup); c.Emit(OpCodes.Ldc_I4, (int)qualityTier9); c.Emit(OpCodes.Ldloc, tierDropListVar); c.Emit(OpCodes.Ldc_I4, (int)qualityTier9); c.EmitDelegate, QualityTier, List>>((Func, QualityTier, List>)getQualityPickupsList); c.Emit(OpCodes.Stelem_Ref); } c.Emit(OpCodes.Stloc, val4); if (c.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => x.MatchLdloc(tierDropListVar), (Instruction x) => x.MatchStloc(typeof(List), il, out var _) })) { ILCursor obj = c; int index = obj.Index; obj.Index = index - 1; c.Emit(OpCodes.Ldloc, val4); c.Emit(OpCodes.Ldloc, localsVar); c.Emit(OpCodes.Ldfld, startingItemDefLocalsField); c.EmitDelegate, List[], ItemDef, List>>((Func, List[], ItemDef, List>)getAvailablePickupList); } else { Log.Error("Failed to find " + name + " available transformations set location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\CloverVoid.cs", "CharacterMaster_TryCloverVoidUpgrades", 122); } } static void upgradeItemQualities(CharacterMaster master, ItemTransformation itemTransformation, List upgradableItems) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) Inventory val = (Object.op_Implicit((Object)(object)master) ? master.inventory : null); if (Object.op_Implicit((Object)(object)val)) { ItemQualityCounts itemCountsEffective = val.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.CloverVoid); if (itemCountsEffective.TotalQualityCount > 0) { ItemIndex originalItemIndex = ((ItemTransformation)(ref itemTransformation)).originalItemIndex; int num = val.CalculateEffectiveItemStacks(originalItemIndex); QualityTier qualityTier2 = QualityCatalog.GetQualityTier(originalItemIndex); ItemQualityCounts itemQualityCounts = default(ItemQualityCounts); itemQualityCounts[qualityTier2] = num; float num2 = 0.1f * (float)itemCountsEffective.UncommonCount + 0.25f * (float)itemCountsEffective.RareCount + 0.35f * (float)itemCountsEffective.EpicCount + 0.5f * (float)itemCountsEffective.LegendaryCount; QualityTier qualityTier3 = itemCountsEffective.HighestQuality - 1; List list = new List(num); for (QualityTier qualityTier4 = QualityTier.None; qualityTier4 <= qualityTier3; qualityTier4++) { int num3 = itemQualityCounts[qualityTier4]; for (int i = 0; i < num3; i++) { list.Add(qualityTier4); } } int num4 = num; for (int j = 0; j < num4; j++) { if (list.Count <= 0) { break; } Util.ShuffleList(list, master.cloverVoidRng); if (master.cloverVoidRng.nextNormalizedFloat < num2) { QualityTier qualityTier5 = ListUtils.Take(list, 0); QualityTier qualityTier6 = qualityTier5 + 1; itemQualityCounts[qualityTier5]--; itemQualityCounts[qualityTier6]++; if (qualityTier6 <= qualityTier3) { list.Add(qualityTier6); } } } TryTransformResult val3 = default(TryTransformResult); for (QualityTier qualityTier7 = QualityTier.Legendary; qualityTier7 >= QualityTier.Uncommon; qualityTier7--) { int num5 = itemQualityCounts[qualityTier7]; if (num5 > 0) { ItemTransformation val2 = itemTransformation; ((ItemTransformation)(ref val2)).newItemIndex = QualityCatalog.GetItemIndexOfQuality(((ItemTransformation)(ref itemTransformation)).newItemIndex, qualityTier7); ((ItemTransformation)(ref val2)).maxToTransform = num5; if (((ItemTransformation)(ref val2)).newItemIndex != ((ItemTransformation)(ref itemTransformation)).newItemIndex && ((ItemTransformation)(ref val2)).TryTransform(val, ref val3) && upgradableItems != null && !upgradableItems.Contains(val3.givenItem.itemIndex)) { upgradableItems.Add(val3.givenItem.itemIndex); } } } } } } } } internal static class CritAtLowerElevation { private static GameObject _forceDownEffectPrefab; [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle handle = AddressableUtil.LoadTempAssetAsync(RoR2_DLC3_Items_CritAtLowerElevation.CritAtLowerElevationFullEffect_prefab); handle.OnSuccess(delegate(GameObject critAtLowerElevationFullEffect) { //IL_0030: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown _forceDownEffectPrefab = PrefabAPI.InstantiateClone(critAtLowerElevationFullEffect, "CritAtLowerElevationQualityForceDownEffect", false); Transform val = _forceDownEffectPrefab.transform.Find("Donut"); if (Object.op_Implicit((Object)(object)val)) { val.localRotation *= Quaternion.Euler(180f, 0f, 0f); } else { Log.Error("Failed to find donut transform", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\CritAtLowerElevation.cs", "LoadContent", 32); } ParticleSystem[] componentsInChildren = _forceDownEffectPrefab.GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { MainModule main = componentsInChildren[i].main; ((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)0; } args.ContentPack.effectDefs.Add(new EffectDef(_forceDownEffectPrefab)); }); return handle.AsProgressCoroutine>(args.ProgressReceiver); } [SystemInitializer(new Type[] { })] private static void Init() { GlobalEventManager.onServerDamageDealt += onServerDamageDealt; } private static void onServerDamageDealt(DamageReport damageReport) { //IL_0042: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Expected I4, but got Unknown //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Expected O, but got Unknown if (damageReport?.damageInfo == null || damageReport.damageDealt <= 0f || damageReport.damageInfo.procCoefficient <= 0f || !Object.op_Implicit((Object)(object)damageReport.victimBody) || (damageReport.victimBody.bodyFlags & 0x10000) != 0 || (damageReport.victimBody.bodyFlags & 0x4000) != 0) { return; } Inventory val = (Object.op_Implicit((Object)(object)damageReport.attackerBody) ? damageReport.attackerBody.inventory : null); if (!Object.op_Implicit((Object)(object)val)) { return; } ItemQualityCounts itemCountsEffective = val.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.CritAtLowerElevation); if (itemCountsEffective.TotalQualityCount == 0) { return; } int overflowRoll = RollUtil.GetOverflowRoll((10f * (float)itemCountsEffective.UncommonCount + 20f * (float)itemCountsEffective.RareCount + 35f * (float)itemCountsEffective.EpicCount + 50f * (float)itemCountsEffective.LegendaryCount) * damageReport.damageInfo.procCoefficient, damageReport.attackerMaster, ((ProcChainMask)(ref damageReport.damageInfo.procChainMask)).HasProc((ProcType)26)); if (overflowRoll <= 0) { return; } IPhysMotor obj; if (!Object.op_Implicit((Object)(object)damageReport.victimBody.characterMotor)) { obj = ((Component)damageReport.victimBody).GetComponent(); } else { IPhysMotor characterMotor = (IPhysMotor)(object)damageReport.victimBody.characterMotor; obj = characterMotor; } IPhysMotor val2 = obj; if (val2 is PseudoCharacterMotor) { return; } bool flag = val2 != null && (Object)(object)((val2 is Behaviour) ? val2 : null) != (Object)null; Rigidbody component = ((Component)damageReport.victim).GetComponent(); if ((!flag || val2 is RigidbodyMotor) && Object.op_Implicit((Object)(object)component) && component.isKinematic) { return; } if (flag) { CharacterMotor val3 = (CharacterMotor)(object)((val2 is CharacterMotor) ? val2 : null); if (val3 != null && val3.isGrounded) { return; } } float num; switch (itemCountsEffective.HighestQuality) { case QualityTier.Uncommon: num = 30f; break; case QualityTier.Rare: num = 35f; break; case QualityTier.Epic: num = 40f; break; case QualityTier.Legendary: num = 50f; break; default: Log.Error($"Quality tier {itemCountsEffective.HighestQuality} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\CritAtLowerElevation.cs", "onServerDamageDealt", 113); return; } num *= (float)overflowRoll; HullClassification hullClassification = damageReport.victimBody.hullClassification; switch ((int)hullClassification) { case 0: num *= 1f; break; case 1: num *= 0.75f; break; case 2: num *= 0.5f; break; } if (damageReport.victimIsChampion || damageReport.victimIsBoss) { num *= 0.5f; } PhysForceInfo val4 = default(PhysForceInfo); val4.force = new Vector3(0f, 0f - num, 0f); ((PhysForceInfo)(ref val4)).massIsOne = true; PhysForceInfo val5 = val4; bool flag2 = false; if (flag) { val2.ApplyForceImpulse(ref val5); flag2 = true; } else if (Object.op_Implicit((Object)(object)component) && !component.isKinematic) { RigidBodyExtensions.AddForceWithInfo(component, val5); flag2 = true; } if (flag2 && Object.op_Implicit((Object)(object)_forceDownEffectPrefab)) { EffectData val6 = new EffectData { origin = damageReport.victimBody.corePosition, scale = damageReport.victimBody.radius * 0.75f }; EffectManager.SpawnEffect(_forceDownEffectPrefab, val6, true); } } } internal static class CritDamage { private static readonly DamageColorIndex[] _critDamageColors = (DamageColorIndex[])(object)new DamageColorIndex[6] { (DamageColorIndex)(int)ColorsAPI.RegisterDamageColor(new Color(1f, 0.9f, 0.9f)), (DamageColorIndex)(int)ColorsAPI.RegisterDamageColor(new Color(1f, 0.7f, 0.7f)), (DamageColorIndex)(int)ColorsAPI.RegisterDamageColor(new Color(1f, 0.5f, 0.5f)), (DamageColorIndex)(int)ColorsAPI.RegisterDamageColor(new Color(1f, 0.3f, 0.3f)), (DamageColorIndex)(int)ColorsAPI.RegisterDamageColor(new Color(1f, 0.1f, 0.1f)), (DamageColorIndex)(int)ColorsAPI.RegisterDamageColor(new Color(1f, 0f, 0f)) }; [SystemInitializer(new Type[] { typeof(CritOnUse) })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown HealthComponent.TakeDamageProcess += new Manipulator(HealthComponent_TakeDamageProcess); } private static void HealthComponent_TakeDamageProcess(ILContext il) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageInfo parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\CritDamage.cs", "HealthComponent_TakeDamageProcess", 36); return; } ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "crit"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "get_critMultiplier") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\CritDamage.cs", "HealthComponent_TakeDamageProcess", 46); return; } val.Goto(array[1].Next, (MoveType)2, false); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)getCritMultiplier); static float getCritMultiplier(float critMultiplier, DamageInfo damageInfo) { //IL_00d9: Unknown result type (might be due to invalid IL or missing references) if (damageInfo != null && damageInfo.crit) { CharacterBody val2 = (Object.op_Implicit((Object)(object)damageInfo.attacker) ? damageInfo.attacker.GetComponent() : null); if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.inventory)) { ItemQualityCounts itemCountsEffective = val2.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.CritDamage); if (itemCountsEffective.TotalQualityCount > 0) { int overflowRoll = RollUtil.GetOverflowRoll(20f * (float)itemCountsEffective.UncommonCount + 35f * (float)itemCountsEffective.RareCount + 50f * (float)itemCountsEffective.EpicCount + 75f * (float)itemCountsEffective.LegendaryCount, val2.master, ((ProcChainMask)(ref damageInfo.procChainMask)).HasProc((ProcType)26)); if (overflowRoll > 0) { critMultiplier = Mathf.Pow(critMultiplier, (float)(overflowRoll + 1)); damageInfo.damageColorIndex = _critDamageColors[Mathf.Min(overflowRoll, _critDamageColors.Length - 1)]; } } } } return critMultiplier; } } } internal static class CritGlasses { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients); } private static void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender.inventory)) { ItemQualityCounts itemCountsEffective = sender.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.CritGlasses); if (itemCountsEffective.TotalQualityCount > 0) { args.critDamageMultAdd += 0.15f * (float)itemCountsEffective.UncommonCount + 0.3f * (float)itemCountsEffective.RareCount + 0.8f * (float)itemCountsEffective.EpicCount + 1.2f * (float)itemCountsEffective.LegendaryCount; } } } } internal static class CritGlassesVoid { [SystemInitializer(new Type[] { })] private static void Init() { GlobalEventManager.onServerCharacterExecuted += onServerCharacterExecuted; } private static void onServerCharacterExecuted(DamageReport damageReport, float executedHealth) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_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_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || damageReport?.damageInfo == null || DamageTypeCombo.op_Implicit(damageReport.damageInfo.damageType & DamageTypeCombo.op_Implicit((DamageType)65536)) == 0L || ProcTypeAPI.HasModdedProc(damageReport.damageInfo.procChainMask, ProcTypes.VoidDeathOrbProcType) || !Object.op_Implicit((Object)(object)damageReport.attackerBody) || !Object.op_Implicit((Object)(object)damageReport.attackerBody.inventory)) { return; } ItemQualityCounts itemCountsEffective = damageReport.attackerBody.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.CritGlassesVoid); if (itemCountsEffective.TotalQualityCount <= 0) { return; } float num = 15f * (float)itemCountsEffective.UncommonCount + 25f * (float)itemCountsEffective.RareCount + 35f * (float)itemCountsEffective.EpicCount + 50f * (float)itemCountsEffective.LegendaryCount; if (!(num > 0f)) { return; } SphereSearch val = new SphereSearch { origin = damageReport.damageInfo.position, radius = ExplodeOnDeath.GetExplosionRadius(num, damageReport.attackerBody), mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask, queryTriggerInteraction = (QueryTriggerInteraction)1 }; val.RefreshCandidates(); val.FilterCandidatesByHurtBoxTeam(TeamMask.GetEnemyTeams(damageReport.attackerTeamIndex)); val.FilterCandidatesByDistinctHurtBoxEntities(); List list = default(List); DisposableRental> val2 = CollectionPool>.RentCollection(ref list); try { val.GetHurtBoxes(list); foreach (HurtBox item in list) { if (Object.op_Implicit((Object)(object)item) && Object.op_Implicit((Object)(object)item.healthComponent) && item.healthComponent.alive && (Object)(object)((Component)item.healthComponent).gameObject != (Object)(object)damageReport.attacker && (Object)(object)item.healthComponent != (Object)(object)damageReport.victim && Object.op_Implicit((Object)(object)item.healthComponent.body) && !item.healthComponent.body.isBoss && (item.healthComponent.body.bodyFlags & 0x800) == 0) { VoidDeathOrb voidDeathOrb = new VoidDeathOrb { target = item, origin = (Object.op_Implicit((Object)(object)damageReport.victimBody) ? damageReport.victimBody.corePosition : damageReport.damageInfo.position), Attacker = damageReport.attacker, ProcChainMask = damageReport.damageInfo.procChainMask, Crit = damageReport.damageInfo.crit }; OrbManager.instance.AddOrb((Orb)(object)voidDeathOrb); } } } finally { val2.Dispose(); } } } internal static class Crowbar { private static GameObject _impactEffectPrefab; [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle handle = AddressableUtil.LoadTempAssetAsync(RoR2_Base_ElementalRings.IceRingExplosion_prefab); handle.OnSuccess(delegate(GameObject iceRingExplosionPrefab) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Expected O, but got Unknown _impactEffectPrefab = PrefabAPI.InstantiateClone(iceRingExplosionPrefab, "CrowbarExplosion", false); Transform val = _impactEffectPrefab.transform.Find("IceMesh"); ParticleSystemRenderer val2 = default(ParticleSystemRenderer); if (Object.op_Implicit((Object)(object)val) && ((Component)val).TryGetComponent(ref val2)) { Material val3 = new Material(((Renderer)val2).sharedMaterial); val3.color = Color32.op_Implicit(new Color32((byte)168, (byte)161, (byte)148, byte.MaxValue)); ((Renderer)val2).sharedMaterial = val3; } Transform val4 = _impactEffectPrefab.transform.Find("Chunks"); ParticleSystem val5 = default(ParticleSystem); if (Object.op_Implicit((Object)(object)val4) && ((Component)val4).TryGetComponent(ref val5)) { MainModule main = val5.main; ((MainModule)(ref main)).startColor = new MinMaxGradient(Color32.op_Implicit(new Color32((byte)137, (byte)135, (byte)132, byte.MaxValue))); } Transform val6 = _impactEffectPrefab.transform.Find("BillboardSplash"); if (Object.op_Implicit((Object)(object)val6)) { ((Component)val6).gameObject.SetActive(false); } Transform val7 = _impactEffectPrefab.transform.Find("RuneRings"); if (Object.op_Implicit((Object)(object)val7)) { ((Component)val7).gameObject.SetActive(false); } args.ContentPack.effectDefs.Add(new EffectDef(_impactEffectPrefab)); }); return handle.AsProgressCoroutine>(args.ProgressReceiver); } [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown GlobalEventManager.ProcessHitEnemy += new hook_ProcessHitEnemy(GlobalEventManager_ProcessHitEnemy); } private static void GlobalEventManager_ProcessHitEnemy(orig_ProcessHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_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_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Expected O, but got Unknown //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, damageInfo, victim); CharacterBody val = default(CharacterBody); if (!Object.op_Implicit((Object)(object)damageInfo.attacker) || !damageInfo.attacker.TryGetComponent(ref val) || !Object.op_Implicit((Object)(object)val.inventory)) { return; } ItemQualityCounts itemCountsEffective = val.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Crowbar); CharacterBody val2 = default(CharacterBody); if (itemCountsEffective.TotalQualityCount != 0 && Object.op_Implicit((Object)(object)victim) && victim.TryGetComponent(ref val2) && damageInfo.damage >= val.damage * 4f && !ProcTypeAPI.HasModdedProc(damageInfo.procChainMask, ProcTypes.Crowbar)) { if (val.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.CrowbarCharge).TotalQualityCount >= 9) { float num = (float)itemCountsEffective.UncommonCount * 0.5f + (float)itemCountsEffective.RareCount * 1f + (float)itemCountsEffective.EpicCount * 2.5f + (float)itemCountsEffective.LegendaryCount * 4f; ProcChainMask procChainMask = damageInfo.procChainMask; ProcTypeAPI.AddModdedProc(ref procChainMask, ProcTypes.Crowbar); DamageInfo val3 = new DamageInfo { attacker = damageInfo.attacker, damage = num * damageInfo.damage, crit = damageInfo.crit, procChainMask = procChainMask, procCoefficient = 1f, position = damageInfo.position, damageColorIndex = (DamageColorIndex)3, inflictedHurtbox = damageInfo.inflictedHurtbox }; val2.healthComponent.TakeDamage(val3); EffectManager.SimpleEffect(_impactEffectPrefab, damageInfo.position, Quaternion.identity, true); val.RemoveAllQualityBuffs(ItemQualitiesContent.BuffQualityGroups.CrowbarCharge); } else { val.AddBuff(ItemQualitiesContent.BuffQualityGroups.CrowbarCharge.GetBuffIndex(itemCountsEffective.HighestQuality)); } } } } public sealed class CrowbarQualityItemBehavior : QualityItemBodyBehavior { [ItemGroupAssociation(QualityItemBehaviorUsageFlags.Server)] private static ItemQualityGroup GetItemGroup() { return ItemQualitiesContent.ItemQualityGroups.Crowbar; } protected override void OnStacksChanged() { base.OnStacksChanged(); base.Body.ConvertQualityBuffsToTier(ItemQualitiesContent.BuffQualityGroups.CrowbarCharge, base.Stacks.HighestQuality); } private void OnDisable() { base.Body.RemoveAllQualityBuffs(ItemQualitiesContent.BuffQualityGroups.CrowbarCharge); } } internal static class Dagger { [SystemInitializer(new Type[] { })] private static void Init() { //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 static 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 //IL_00cc: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageReport parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Dagger.cs", "GlobalEventManager_OnCharacterDeath", 25); return; } ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "Dagger"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "FireProjectileWithoutDamageType"), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 3) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Dagger.cs", "GlobalEventManager_OnCharacterDeath", 34); return; } val.Goto(array[2].Next, (MoveType)2, false); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)modifyDaggerSpawnCount); static int modifyDaggerSpawnCount(int daggerSpawnCount, DamageReport damageReport) { CharacterMaster val2 = damageReport?.attackerMaster; Inventory val3 = (Object.op_Implicit((Object)(object)val2) ? val2.inventory : null); if (Object.op_Implicit((Object)(object)val3)) { ItemQualityCounts itemCountsEffective = val3.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Dagger); daggerSpawnCount += itemCountsEffective.UncommonCount + 2 * itemCountsEffective.RareCount + 5 * itemCountsEffective.EpicCount + 7 * itemCountsEffective.LegendaryCount; } return daggerSpawnCount; } } } internal static class DeathMark { [SystemInitializer(new Type[] { })] private static void Init() { //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 HealthComponent.TakeDamageProcess += new Manipulator(HealthComponent_TakeDamageProcess); GlobalEventManager.ProcDeathMark += new Manipulator(GlobalEventManager_ProcDeathMark); } public static bool HasAnyQualityDeathMarkDebuff(CharacterBody body) { if (Object.op_Implicit((Object)(object)body)) { return body.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.DeathMark).TotalQualityCount > 0; } return false; } private static void HealthComponent_TakeDamageProcess(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!((MethodReference)(object)il.Method).TryFindParameter(out var _)) { Log.Error("Failed to find DamageInfo parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\DeathMark.cs", "HealthComponent_TakeDamageProcess", 31); return; } ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "DeathMark"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "HasBuff"), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 1.5f) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\DeathMark.cs", "HealthComponent_TakeDamageProcess", 40); return; } val.Goto(array[1].Next, (MoveType)2, false); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)hasDeathMarkDebuffHealthComponent); val.Goto(array[2].Next, (MoveType)2, false); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getDeathMarkDamageMultiplier); static float getDeathMarkDamageMultiplier(float baseDeathMarkDamageMultiplier, HealthComponent healthComponent) { CharacterBody val2 = (Object.op_Implicit((Object)(object)healthComponent) ? healthComponent.body : null); if (!Object.op_Implicit((Object)(object)val2)) { return baseDeathMarkDamageMultiplier; } float num = 1f; BuffQualityCounts buffCounts = val2.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.DeathMark); if (buffCounts.BaseCount > 0) { num += baseDeathMarkDamageMultiplier - 1f; } if (buffCounts.UncommonCount > 0) { num += 0.2f; } if (buffCounts.RareCount > 0) { num += 0.5f; } if (buffCounts.EpicCount > 0) { num += 1f; } if (buffCounts.LegendaryCount > 0) { num += 1.5f; } return num; } static bool hasDeathMarkDebuffHealthComponent(bool hasDebuff, HealthComponent healthComponent) { if (!hasDebuff) { return HasAnyQualityDeathMarkDebuff(Object.op_Implicit((Object)(object)healthComponent) ? healthComponent.body : null); } return true; } } private static void GlobalEventManager_ProcDeathMark(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!((MethodReference)(object)il.Method).TryFindParameter("attackerMaster", out var parameter)) { Log.Error("Failed to find attackerMaster parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\DeathMark.cs", "GlobalEventManager_ProcDeathMark", 104); return; } if (!((MethodReference)(object)il.Method).TryFindParameter("victimBody", out var parameter2)) { Log.Error("Failed to find attackerMaster parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\DeathMark.cs", "GlobalEventManager_ProcDeathMark", 110); return; } ILCursor[] array = default(ILCursor[]); ILLabel val4 = default(ILLabel); if (!val.TryFindNext(ref array, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "DeathMark"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "HasBuff"), (Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref val4) })) { Log.Error("Failed to find DeathMark buff check location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\DeathMark.cs", "GlobalEventManager_ProcDeathMark", 119); return; } val.Goto(array[2].Next, (MoveType)2, false); ILLabel val2 = val.MarkLabel(); val.Goto(array[2].Next, (MoveType)0, false); val.Emit(OpCodes.Brfalse, (object)val2); val.Emit(OpCodes.Ldarg, parameter); val.Emit(OpCodes.Ldarg, parameter2); val.EmitDelegate>((Func)disallowQualityDeathMarkProc); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "AddTimedBuff") })) { Log.Error("Failed to find DeathMark buff apply location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\DeathMark.cs", "GlobalEventManager_ProcDeathMark", 164); return; } Instruction prev = val.Prev; VariableDefinition debuffCountVar = null; ILLabel val3 = default(ILLabel); if (!val.TryFindPrev(ref array, new Func[3] { (Instruction x) => x.MatchLdloc(typeof(int), il, out debuffCountVar), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 4), (Instruction x) => ILPatternMatchingExt.MatchBlt(x, ref val3) })) { Log.Error("Failed to find debuffCount variable", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\DeathMark.cs", "GlobalEventManager_ProcDeathMark", 176); return; } val.Goto(prev, (MoveType)2, false); val.Emit(OpCodes.Ldloc, debuffCountVar); val.Emit(OpCodes.Ldarg, parameter); val.Emit(OpCodes.Ldarg, parameter2); val.EmitDelegate>((Action)tryQualityDeathMarkProc); static bool allowQualityDeathMarkProc(CharacterMaster attackerMaster, CharacterBody victimBody) { if (!Object.op_Implicit((Object)(object)attackerMaster) || !Object.op_Implicit((Object)(object)victimBody)) { return false; } Inventory inventory = attackerMaster.inventory; if (!Object.op_Implicit((Object)(object)inventory)) { return false; } if (inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.DeathMark).TotalQualityCount > 0 && ((Component)(object)victimBody).TryGetComponentCached(out CharacterBodyExtraStatsTracker component) && !component.HasHadAnyQualityDeathMarkDebuffServer) { return true; } return false; } static bool disallowQualityDeathMarkProc(CharacterMaster attackerMaster, CharacterBody victimBody) { return !allowQualityDeathMarkProc(attackerMaster, victimBody); } static void tryQualityDeathMarkProc(int debuffCount, CharacterMaster attackerMaster, CharacterBody victimBody) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 //IL_0073: Unknown result type (might be due to invalid IL or missing references) if (debuffCount >= 7 && allowQualityDeathMarkProc(attackerMaster, victimBody)) { ItemQualityCounts itemCountsEffective = attackerMaster.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.DeathMark); QualityTier highestQuality = itemCountsEffective.HighestQuality; if (highestQuality > QualityTier.None) { BuffIndex buffIndex = ItemQualitiesContent.BuffQualityGroups.DeathMark.GetBuffIndex(highestQuality); if ((int)buffIndex > -1) { float num = 5f * (float)itemCountsEffective.UncommonCount + 7f * (float)itemCountsEffective.RareCount + 9f * (float)itemCountsEffective.EpicCount + 12f * (float)itemCountsEffective.LegendaryCount; victimBody.AddTimedBuff(buffIndex, num); } } } } } } internal static class DelayedDamage { [SystemInitializer(new Type[] { })] private static void Init() { GlobalEventManager.onCharacterDeathGlobal += onCharacterDeathGlobal; GlobalEventManager.onServerDamageDealt += onServerDamageDealt; } private static void onCharacterDeathGlobal(DamageReport report) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)report.victimBody)) { return; } BuffQualityCounts buffCounts = report.victimBody.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.DelayedDamageDebuff); int num = buffCounts.UncommonCount + buffCounts.RareCount * 2 + buffCounts.EpicCount * 3 + buffCounts.LegendaryCount * 4; report.victimBody.RemoveAllQualityBuffs(ItemQualitiesContent.BuffQualityGroups.DelayedDamageDebuff); if (num > 0) { DamageAPI.AddModdedDamageType(ref report.damageInfo.damageType, DamageTypes.Echo); for (int i = 0; i < num; i++) { GlobalEventManager.instance.OnCharacterDeath(report); } DamageAPI.RemoveModdedDamageType(ref report.damageInfo.damageType, DamageTypes.Echo); } } private static void onServerDamageDealt(DamageReport report) { if (Object.op_Implicit((Object)(object)report.attackerBody) && Object.op_Implicit((Object)(object)report.attackerBody.inventory) && Object.op_Implicit((Object)(object)report.victimBody)) { ItemQualityCounts itemCountsEffective = report.attackerBody.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.DelayedDamage); if (itemCountsEffective.TotalQualityCount > 0 && RollUtil.CheckRoll(((float)itemCountsEffective.UncommonCount * 1f + (float)itemCountsEffective.RareCount * 1.5f + (float)itemCountsEffective.EpicCount * 2f + (float)itemCountsEffective.LegendaryCount * 2.5f) * report.damageInfo.procCoefficient, report.attackerMaster, ((ProcChainMask)(ref report.damageInfo.procChainMask)).HasProc((ProcType)26))) { report.victimBody.AddBuff(ItemQualitiesContent.BuffQualityGroups.DelayedDamageDebuff.GetBuffDef(itemCountsEffective.HighestQuality)); } } } } internal static class DronesDropDynamite { [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { AsyncOperationHandle droneBallDotZoneLoad = AddressableUtil.LoadTempAssetAsync(RoR2_DLC3_Drone_Tech.DroneBallDotZone_prefab); AsyncOperationHandle droneTechBodyLoad = AddressableUtil.LoadTempAssetAsync(RoR2_DLC3_Drone_Tech.DroneTechBody_prefab); ParallelProgressCoroutine val = new ParallelProgressCoroutine((IProgress)args.ProgressReceiver); val.Add(in droneBallDotZoneLoad); val.Add(in droneTechBodyLoad); yield return val; if (!AssetLoadExtensions.AssertLoaded(in droneBallDotZoneLoad, null, "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\DronesDropDynamite.cs", "LoadContent", 34)) { yield break; } GameObject val2 = PrefabAPI.InstantiateClone(droneBallDotZoneLoad.Result, "DroneShootableAttachment"); ProjectileController component = val2.GetComponent(); DroneBallShootableController component2 = val2.GetComponent(); ProjectileImpactExplosion component3 = val2.GetComponent(); HurtBoxGroup componentInChildren = val2.GetComponentInChildren(); GameObject damageEffectPrefab = component2.damageEffectPrefab; Renderer[] array = component2.renderers.Where((Renderer r) => Object.op_Implicit((Object)(object)r)).ToArray(); Gradient damageColorGradient = component2.damageColorGradient; Transform visualizerTransform = component2.visualizerTransform; Transform val3 = ((Component)component2).transform.Find("FX"); Renderer[] array2 = array; foreach (Renderer val4 in array2) { if ((Object)(object)((Component)val4).transform.parent == (Object)(object)val3 && (Object)(object)((Component)val4).transform != (Object)(object)visualizerTransform) { ((Component)val4).transform.SetParent(visualizerTransform, true); } } for (int num = val3.childCount - 1; num >= 0; num--) { Transform child = val3.GetChild(num); if (Object.op_Implicit((Object)(object)((Component)child).GetComponent()) || Object.op_Implicit((Object)(object)((Component)child).GetComponent())) { child.SetParent(((Component)component2).transform, true); } } GameObject explosionEffect = ((ProjectileExplosion)component3).explosionEffect; IgnoredCollisionsProvider ignoredCollisionsProvider = val2.AddComponent(); ignoredCollisionsProvider.Colliders = Array.ConvertAll(componentInChildren.hurtBoxes, (HurtBox h) => ((Component)h).GetComponent()); NetworkedBodyAttachment obj = val2.AddComponent(); obj.forceHostAuthority = true; obj.shouldParentToAttachedBody = true; DroneShootableAttachmentController droneShootableAttachmentController = val2.AddComponent(); droneShootableAttachmentController.HitEffectPrefab = damageEffectPrefab; droneShootableAttachmentController.IndicatorRenderers = array; droneShootableAttachmentController.DamageColorGradient = damageColorGradient; droneShootableAttachmentController.RangeIndicator = visualizerTransform; droneShootableAttachmentController.ExplosionEffect = explosionEffect; droneShootableAttachmentController.HurtBoxGroup = componentInChildren; droneShootableAttachmentController.FxRoot = ((Component)val3).gameObject; droneShootableAttachmentController.IgnoredCollisionsProvider = ignoredCollisionsProvider; if (Object.op_Implicit((Object)(object)component.flightSoundLoop)) { ((Component)val3).gameObject.AddComponent().loopDef = component.flightSoundLoop; } TeamComponent val5 = default(TeamComponent); if (val2.TryGetComponent(ref val5)) { val5._teamIndex = (TeamIndex)0; } ProcDamageModifier procDamageModifier = UnityObjectExtensions.EnsureComponent(val2); procDamageModifier.ProcCoefficientMultiplier = 0f; procDamageModifier.DamageTypeToAdd = DamageTypeCombo.op_Implicit((DamageType)2048); Object.Destroy((Object)(object)val2.GetComponent()); Object.Destroy((Object)(object)component2); Object.Destroy((Object)(object)component3); Object.Destroy((Object)(object)val2.GetComponent()); Object.Destroy((Object)(object)val2.GetComponent()); Object.Destroy((Object)(object)component); Object.Destroy((Object)(object)val2.GetComponent()); Object.Destroy((Object)(object)val2.GetComponent()); Object.Destroy((Object)(object)val2.GetComponent()); Object.Destroy((Object)(object)val2.GetComponent()); val2.layer = LayerIndex.defaultLayer.intVal; Bank val6 = null; AkBank val7 = default(AkBank); if ((int)droneTechBodyLoad.Status == 1 && Object.op_Implicit((Object)(object)droneTechBodyLoad.Result) && droneTechBodyLoad.Result.TryGetComponent(ref val7)) { val6 = val7.data; } if (val6 != null) { AkBank obj2 = val2.AddComponent(); obj2.data = val6; ((AkTriggerHandler)obj2).triggerList = new List { -320808462 }; obj2.unloadTriggerList = new List { 716467161 }; } else { Log.Warning("Failed to load operator sound bank", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\DronesDropDynamite.cs", "LoadContent", 131); } args.ContentPack.networkedObjectPrefabs.Add(val2); } } public sealed class DronesDropDynamiteDroneItemQualityItemBehavior : BaseItemBodyBehavior { private GameObject _attachmentInstance; [ItemDefAssociation(useOnServer = true)] private static ItemDef GetItemDef() { return ItemQualitiesContent.Items.DronesDropDynamiteQualityDroneItem; } private void OnEnable() { _attachmentInstance = Object.Instantiate(ItemQualitiesContent.NetworkedPrefabs.DroneShootableAttachment); _attachmentInstance.GetComponent().AttachToGameObjectAndSpawn(((Component)this).gameObject, (string)null); } private void OnDisable() { if (Object.op_Implicit((Object)(object)_attachmentInstance)) { Object.Destroy((Object)(object)_attachmentInstance); _attachmentInstance = null; } } } public sealed class DronesDropDynamiteQualityItemBehavior : QualityItemBodyBehavior { private sealed class MinionInfo : IEquatable { public MinionOwnership Ownership { get; } public CharacterMaster Master { get; } public Inventory Inventory { get; } public MinionInfo(MinionOwnership minion) { Ownership = minion; Master = (Object.op_Implicit((Object)(object)Ownership) ? ((Component)Ownership).GetComponent() : null); Inventory = (Object.op_Implicit((Object)(object)Master) ? Master.inventory : (Object.op_Implicit((Object)(object)Ownership) ? ((Component)Ownership).GetComponent() : null)); } public bool Equals(MinionInfo other) { return (Object)(object)Ownership == (Object)(object)other.Ownership; } } private readonly HashSet _trackedMinions = new HashSet(); [ItemGroupAssociation(QualityItemBehaviorUsageFlags.Server)] private static ItemQualityGroup GetItemGroup() { return ItemQualitiesContent.ItemQualityGroups.DronesDropDynamite; } private void OnEnable() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) MinionOwnership.onMinionOwnerChangedGlobal += onMinionOwnerChangedGlobal; if (!Object.op_Implicit((Object)(object)base.Body.master)) { return; } MinionGroup val = MinionGroup.FindGroup(((NetworkBehaviour)base.Body.master).netId); if (val == null) { return; } _trackedMinions.EnsureCapacity(val.memberCount); for (int i = 0; i < val.memberCount; i++) { MinionOwnership val2 = val.members[i]; if (Object.op_Implicit((Object)(object)val2)) { MinionInfo minionInfo = new MinionInfo(val2); if (_trackedMinions.Add(minionInfo)) { onMinionEnter(minionInfo); } } } } private void OnDisable() { MinionOwnership.onMinionOwnerChangedGlobal -= onMinionOwnerChangedGlobal; foreach (MinionInfo trackedMinion in _trackedMinions) { onMinionExit(trackedMinion); } _trackedMinions.Clear(); } private void onMinionOwnerChangedGlobal(MinionOwnership minionOwnership) { MinionInfo minionInfo = new MinionInfo(minionOwnership); if (Object.op_Implicit((Object)(object)base.Body.master) && (Object)(object)minionOwnership.ownerMaster == (Object)(object)base.Body.master) { if (_trackedMinions.Add(minionInfo)) { onMinionEnter(minionInfo); } } else if (_trackedMinions.Remove(minionInfo)) { onMinionExit(minionInfo); } } private void onMinionEnter(MinionInfo minion) { if (Object.op_Implicit((Object)(object)minion.Inventory)) { minion.Inventory.GiveItemPermanent(ItemQualitiesContent.Items.DronesDropDynamiteQualityDroneItem, 1); } } private void onMinionExit(MinionInfo minion) { if (Object.op_Implicit((Object)(object)minion.Inventory)) { minion.Inventory.RemoveItemPermanent(ItemQualitiesContent.Items.DronesDropDynamiteQualityDroneItem, 1); } } } internal static class DroneWeapons { [SystemInitializer(new Type[] { })] private static void Init() { //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 CharacterMaster.GetDeployableSameSlotLimit += new hook_GetDeployableSameSlotLimit(CharacterMaster_GetDeployableSameSlotLimit); DroneWeaponsBehavior.OnMasterSpawned += new hook_OnMasterSpawned(DroneWeaponsBehavior_OnMasterSpawned); } private static void DroneWeaponsBehavior_OnMasterSpawned(orig_OnMasterSpawned orig, DroneWeaponsBehavior self, SpawnResult spawnResult) { //IL_0002: 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) orig.Invoke(self, spawnResult); if (!Object.op_Implicit((Object)(object)((ItemBehavior)self).body) || !Object.op_Implicit((Object)(object)((ItemBehavior)self).body.master) || ((ItemBehavior)self).body.master.IsDeployableLimited((DeployableSlot)31)) { return; } self.hasSpawnedDrone = false; if (spawnResult.success && Object.op_Implicit((Object)(object)((ItemBehavior)self).body.inventory)) { switch (((ItemBehavior)self).body.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.DroneWeapons).HighestQuality) { case QualityTier.Uncommon: self.spawnDelay = 120f; break; case QualityTier.Rare: self.spawnDelay = 90f; break; case QualityTier.Epic: self.spawnDelay = 45f; break; case QualityTier.Legendary: self.spawnDelay = 1f; break; } } } private static int CharacterMaster_GetDeployableSameSlotLimit(orig_GetDeployableSameSlotLimit orig, CharacterMaster self, DeployableSlot slot) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 int num = orig.Invoke(self, slot); if ((int)slot == 19 && Object.op_Implicit((Object)(object)self.inventory)) { ItemQualityCounts itemCountsEffective = self.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.DroneWeapons); if (itemCountsEffective.TotalQualityCount > 0) { num += 2 * itemCountsEffective.UncommonCount + 3 * itemCountsEffective.RareCount + 4 * itemCountsEffective.EpicCount + 5 * itemCountsEffective.LegendaryCount - 1; } } return num; } } internal static class Duplicator { private static ItemIndex[] _allyShareBlacklist = Array.Empty(); [SystemInitializer(new Type[] { typeof(QualityCatalog) })] private static void Init() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown HashSet hashSet = new HashSet(); addItemGroup(Items.Duplicator.itemIndex, hashSet); _allyShareBlacklist = hashSet.ToArray(); Array.Sort(_allyShareBlacklist); CharacterBody.CheckDroneHasItems += new hook_CheckDroneHasItems(CharacterBody_CheckDroneHasItems); static void addItemGroup(ItemIndex itemIndex, HashSet itemCollection) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 //IL_002a: Unknown result type (might be due to invalid IL or missing references) if ((int)itemIndex != -1) { ItemQualityGroup itemQualityGroup = QualityCatalog.GetItemQualityGroup(QualityCatalog.FindItemQualityGroupIndex(itemIndex)); if (Object.op_Implicit((Object)(object)itemQualityGroup)) { for (QualityTier qualityTier = QualityTier.None; qualityTier < QualityTier.Count; qualityTier++) { ItemIndex itemIndex2 = itemQualityGroup.GetItemIndex(qualityTier); if ((int)itemIndex2 != -1) { itemCollection.Add(itemIndex2); } } } else { itemCollection.Add(itemIndex); } } } } public static bool ItemShareFilter(ItemIndex itemIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0006: 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 ((int)itemIndex == -1) { return false; } ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex); if (itemDef.hidden || !itemDef.canRemove || itemDef.ContainsTag((ItemTag)13) || itemDef.ContainsTag((ItemTag)20)) { return false; } if (Array.BinarySearch(_allyShareBlacklist, itemIndex) >= 0) { return false; } return true; } private static bool CharacterBody_CheckDroneHasItems(orig_CheckDroneHasItems orig, CharacterBody self) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (self.IsDrone) { self.bodyFlags = (BodyFlags)(self.bodyFlags & -2097153); } return orig.Invoke(self); } } [RequireComponent(typeof(NetworkedBodyAttachment))] [RequireComponent(typeof(Inventory))] public sealed class DuplicatorQualityAttachmentBehavior : NetworkBehaviour, INetworkedBodyAttachmentListener { private Inventory _minionMirrorInventory; private CharacterMaster _attachedMaster; private Inventory _attachedBodyInventory; private CharacterBody _attachedBody; private readonly List _cachedMinionInventories = new List(); private bool _attachedInventoryChanged; public CharacterBody AttachedBody { get { return _attachedBody; } private set { //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_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Invalid comparison between Unknown and I4 //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_attachedBody == (Object)(object)value) { return; } if (Object.op_Implicit((Object)(object)_attachedBody)) { _attachedBody.onInventoryChanged -= onAttachedBodyInventoryChanged; } _attachedBody = value; _attachedMaster = (Object.op_Implicit((Object)(object)_attachedBody) ? _attachedBody.master : null); _attachedBodyInventory = (Object.op_Implicit((Object)(object)_attachedBody) ? _attachedBody.inventory : null); if (Object.op_Implicit((Object)(object)_attachedBody)) { _attachedBody.onInventoryChanged += onAttachedBodyInventoryChanged; } InventoryChangeScope val = default(InventoryChangeScope); ((InventoryChangeScope)(ref val))..ctor(_minionMirrorInventory); try { clearMinionInventory(); if (Object.op_Implicit((Object)(object)_attachedBodyInventory)) { List list = default(List); DisposableRental> val2 = CollectionPool>.RentCollection(ref list); try { ((TempItemsStorage)(ref _attachedBodyInventory.tempItemsStorage)).GetNonZeroIndices(list); foreach (ItemIndex item in list) { if ((int)getSharedItemIndex(item) != -1) { _minionMirrorInventory.GiveItemTemp(item, _attachedBodyInventory.GetTempItemRawValue(item)); } } } finally { val2.Dispose(); } } } finally { ((InventoryChangeScope)(ref val)).Dispose(); } MinionOwnership minion = default(MinionOwnership); for (int num = _cachedMinionInventories.Count - 1; num >= 0; num--) { if (Object.op_Implicit((Object)(object)_cachedMinionInventories[num]) && ((Component)_cachedMinionInventories[num]).TryGetComponent(ref minion)) { handleMinionExit(minion); } } _cachedMinionInventories.Clear(); if (Object.op_Implicit((Object)(object)_attachedMaster)) { MinionGroup val3 = MinionGroup.FindGroup(((NetworkBehaviour)_attachedMaster).netId); if (val3 != null) { ListUtils.EnsureCapacity(_cachedMinionInventories, val3.memberCount); for (int i = 0; i < val3.memberCount; i++) { MinionOwnership val4 = val3.members[i]; if (Object.op_Implicit((Object)(object)val4)) { handleMinionEnter(val4); } } } } onAttachedBodyInventoryChanged(); DuplicatorQualityAttachmentBehavior.OnAttachedBodyChangedGlobal?.Invoke(this); } } public Inventory MinionMirrorInventory => _minionMirrorInventory; public static event Action OnAttachedBodyChangedGlobal; private void Awake() { _minionMirrorInventory = ((Component)this).GetComponent(); if (NetworkServer.active) { InventoryHooks.OnTempItemGivenServerGlobal += onTempItemGivenServerGlobal; MinionOwnership.onMinionOwnerChangedGlobal += onMinionOwnerChangedGlobal; ItemTransformation.onItemTransformedServerGlobal += onItemTransformedServerGlobal; } } private void OnEnable() { InstanceTracker.Add(this); } private void OnDisable() { InstanceTracker.Remove(this); } private void OnDestroy() { AttachedBody = null; InventoryHooks.OnTempItemGivenServerGlobal -= onTempItemGivenServerGlobal; MinionOwnership.onMinionOwnerChangedGlobal -= onMinionOwnerChangedGlobal; ItemTransformation.onItemTransformedServerGlobal -= onItemTransformedServerGlobal; } private void FixedUpdate() { if (_attachedInventoryChanged) { _attachedInventoryChanged = false; if (NetworkServer.active) { refreshItemDecayDuration(); } } } private float calculateMinionItemDecayDuration() { float num = (Object.op_Implicit((Object)(object)_attachedBodyInventory) ? _attachedBodyInventory.tempItemsStorage.decayDuration : 0f); if (num <= 0f) { num = 80f; } ItemQualityCounts itemQualityCounts = default(ItemQualityCounts); if (Object.op_Implicit((Object)(object)_attachedBodyInventory)) { itemQualityCounts = _attachedBodyInventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Duplicator); } if (itemQualityCounts.TotalQualityCount == 0) { itemQualityCounts.UncommonCount = 1; } float num2 = 0.5f * (float)itemQualityCounts.UncommonCount + 0.75f * (float)itemQualityCounts.RareCount + 1f * (float)itemQualityCounts.EpicCount + 1.5f * (float)itemQualityCounts.LegendaryCount; return num * num2; } [Server] private void refreshItemDecayDuration() { if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void ItemQualities.Items.DuplicatorQualityAttachmentBehavior::refreshItemDecayDuration()' called on client"); return; } float itemDecayDurationServer = calculateMinionItemDecayDuration(); _minionMirrorInventory.SetItemDecayDurationServer(itemDecayDurationServer); foreach (Inventory cachedMinionInventory in _cachedMinionInventories) { if (Object.op_Implicit((Object)(object)cachedMinionInventory)) { cachedMinionInventory.SetItemDecayDurationServer(itemDecayDurationServer); } } } private static ItemIndex getSharedItemIndex(ItemIndex itemIndex) { //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_0002: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_001d: Unknown result type (might be due to invalid IL or missing references) ItemIndex val = itemIndex; bool flag = Duplicator.ItemShareFilter(val); if (!flag && QualityCatalog.GetQualityTier(val) != QualityTier.None) { val = QualityCatalog.GetItemIndexOfQuality(val, QualityTier.None); flag = Duplicator.ItemShareFilter(val); } if (!flag) { return (ItemIndex)(-1); } return val; } [Server] private void onTempItemGivenServerGlobal(Inventory inventory, ItemIndex itemIndex, int itemCountDiff) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Invalid comparison between Unknown and I4 //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void ItemQualities.Items.DuplicatorQualityAttachmentBehavior::onTempItemGivenServerGlobal(RoR2.Inventory,RoR2.ItemIndex,System.Int32)' called on client"); } else { if (!Object.op_Implicit((Object)(object)inventory) || !((Object)(object)inventory == (Object)(object)_attachedBodyInventory)) { return; } int num = itemCountDiff; if (num <= 0) { return; } float tempItemDecayValue = inventory.GetTempItemDecayValue(itemIndex); if (tempItemDecayValue > 0f && tempItemDecayValue * inventory.tempItemsStorage.decayDuration <= Time.fixedDeltaTime) { tempItemDecayValue = 0f; num--; } if (num <= 0) { return; } ItemIndex sharedItemIndex = getSharedItemIndex(itemIndex); if ((int)sharedItemIndex == -1) { return; } _minionMirrorInventory.GiveItemTemp(sharedItemIndex, (float)num); foreach (Inventory cachedMinionInventory in _cachedMinionInventories) { if (Object.op_Implicit((Object)(object)cachedMinionInventory)) { cachedMinionInventory.GiveItemTemp(sharedItemIndex, (float)num); } } } } [Server] private void onItemTransformedServerGlobal(TryTransformResult transformResult) { //IL_0015: 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_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_0044: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Invalid comparison between Unknown and I4 //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void ItemQualities.Items.DuplicatorQualityAttachmentBehavior::onItemTransformedServerGlobal(RoR2.Inventory/ItemTransformation/TryTransformResult)' called on client"); } else { if (!Object.op_Implicit((Object)(object)transformResult.inventory) || !((Object)(object)transformResult.inventory == (Object)(object)_attachedBodyInventory)) { return; } ItemIndex itemIndex = transformResult.takenItem.itemIndex; float temporaryStacksValue = transformResult.takenItem.stackValues.temporaryStacksValue; if ((int)itemIndex == -1 || !(temporaryStacksValue > 0f) || !Duplicator.ItemShareFilter(itemIndex)) { return; } _minionMirrorInventory.RemoveItemTemp(itemIndex, temporaryStacksValue); foreach (Inventory cachedMinionInventory in _cachedMinionInventories) { if (Object.op_Implicit((Object)(object)cachedMinionInventory)) { cachedMinionInventory.RemoveItemTemp(itemIndex, temporaryStacksValue); } } } } private void onAttachedBodyInventoryChanged() { _attachedInventoryChanged = true; } [Server] private void clearMinionInventory() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_00ac: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void ItemQualities.Items.DuplicatorQualityAttachmentBehavior::clearMinionInventory()' called on client"); return; } InventoryChangeScope val = default(InventoryChangeScope); ((InventoryChangeScope)(ref val))..ctor(_minionMirrorInventory); try { List list = default(List); DisposableRental> val2 = CollectionPool>.RentCollection(ref list); try { ((TempItemsStorage)(ref _minionMirrorInventory.tempItemsStorage)).GetNonZeroIndices(list); foreach (ItemIndex item in list) { float tempItemRawValue = _minionMirrorInventory.GetTempItemRawValue(item); foreach (Inventory cachedMinionInventory in _cachedMinionInventories) { if (Object.op_Implicit((Object)(object)cachedMinionInventory)) { cachedMinionInventory.RemoveItemTemp(item, tempItemRawValue); } } ((TempItemsStorage)(ref _minionMirrorInventory.tempItemsStorage)).ResetItem(item); } } finally { val2.Dispose(); } } finally { ((InventoryChangeScope)(ref val)).Dispose(); } } [Server] private void onMinionOwnerChangedGlobal(MinionOwnership minionOwnership) { if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void ItemQualities.Items.DuplicatorQualityAttachmentBehavior::onMinionOwnerChangedGlobal(RoR2.MinionOwnership)' called on client"); return; } if (Object.op_Implicit((Object)(object)_attachedMaster) && (Object)(object)minionOwnership.ownerMaster == (Object)(object)_attachedMaster) { handleMinionEnter(minionOwnership); return; } for (int num = _cachedMinionInventories.Count - 1; num >= 0; num--) { Inventory val = _cachedMinionInventories[num]; if (!Object.op_Implicit((Object)(object)val)) { _cachedMinionInventories.RemoveAt(num); } else if ((Object)(object)((Component)val).gameObject == (Object)(object)((Component)minionOwnership).gameObject) { handleMinionExit(minionOwnership); break; } } } [Server] private void handleMinionEnter(MinionOwnership minion) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void ItemQualities.Items.DuplicatorQualityAttachmentBehavior::handleMinionEnter(RoR2.MinionOwnership)' called on client"); } else { Inventory val = default(Inventory); if (!((Component)minion).TryGetComponent(ref val) || _cachedMinionInventories.Contains(val)) { return; } InventoryChangeScope val2 = default(InventoryChangeScope); ((InventoryChangeScope)(ref val2))..ctor(val); try { val.SetItemDecayDurationServer(calculateMinionItemDecayDuration()); List list = default(List); DisposableRental> val3 = CollectionPool>.RentCollection(ref list); try { ((TempItemsStorage)(ref _minionMirrorInventory.tempItemsStorage)).GetNonZeroIndices(list); foreach (ItemIndex item in list) { float tempItemRawValue = _minionMirrorInventory.GetTempItemRawValue(item); val.GiveItemTemp(item, tempItemRawValue); } } finally { val3.Dispose(); } } finally { ((InventoryChangeScope)(ref val2)).Dispose(); } _cachedMinionInventories.Add(val); } } [Server] private void handleMinionExit(MinionOwnership minion) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void ItemQualities.Items.DuplicatorQualityAttachmentBehavior::handleMinionExit(RoR2.MinionOwnership)' called on client"); } else { Inventory val = default(Inventory); if (!((Component)minion).TryGetComponent(ref val) || !_cachedMinionInventories.Remove(val)) { return; } InventoryChangeScope val2 = default(InventoryChangeScope); ((InventoryChangeScope)(ref val2))..ctor(val); try { List list = default(List); DisposableRental> val3 = CollectionPool>.RentCollection(ref list); try { ((TempItemsStorage)(ref _minionMirrorInventory.tempItemsStorage)).GetNonZeroIndices(list); foreach (ItemIndex item in list) { float tempItemRawValue = _minionMirrorInventory.GetTempItemRawValue(item); val.RemoveItemTemp(item, tempItemRawValue); } } finally { val3.Dispose(); } } finally { ((InventoryChangeScope)(ref val2)).Dispose(); } } } void INetworkedBodyAttachmentListener.OnAttachedBodyDiscovered(NetworkedBodyAttachment networkedBodyAttachment, CharacterBody attachedBody) { AttachedBody = attachedBody; } private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { bool result = default(bool); return result; } public override void OnDeserialize(NetworkReader reader, bool initialState) { } public override void PreStartClient() { } } public sealed class DuplicatorQualityItemBehavior : QualityItemBodyBehavior { private GameObject _attachmentInstance; [ItemGroupAssociation(QualityItemBehaviorUsageFlags.Server)] private static ItemQualityGroup GetItemGroup() { return ItemQualitiesContent.ItemQualityGroups.Duplicator; } private void OnEnable() { if (!Object.op_Implicit((Object)(object)base.Body.master) || !Object.op_Implicit((Object)(object)base.Body.master.minionOwnership.ownerMaster)) { _attachmentInstance = Object.Instantiate(ItemQualitiesContent.NetworkedPrefabs.DuplicatorQualityAttachment); _attachmentInstance.GetComponent().AttachToGameObjectAndSpawn(((Component)this).gameObject, (string)null); } } private void OnDisable() { if (Object.op_Implicit((Object)(object)_attachmentInstance)) { Object.Destroy((Object)(object)_attachmentInstance); _attachmentInstance = null; } } } internal static class ElementalRingVoid { [SystemInitializer(new Type[] { })] private static IEnumerator Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0017: 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_0043: Unknown result type (might be due to invalid IL or missing references) GlobalEventManager.ProcessHitEnemy += new Manipulator(GlobalEventManager_ProcessHitEnemy); AsyncOperationHandle handle = AddressableUtil.LoadAssetAsync(RoR2_DLC1_ElementalRingVoid.ElementalRingVoidBlackHole_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject blackHoleProjectile) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) ParticleSystem[] componentsInChildren = blackHoleProjectile.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { MainModule main = componentsInChildren[i].main; ((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)0; } UnityObjectExtensions.EnsureComponent(blackHoleProjectile); }); return (IEnumerator)(object)handle; } private static void GlobalEventManager_ProcessHitEnemy(ILContext il) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageInfo parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ElementalRingVoid.cs", "GlobalEventManager_ProcessHitEnemy", 43); return; } ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "ElementalRingVoid"), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 20f), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(Util), "OnHitProcDamage") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ElementalRingVoid.cs", "GlobalEventManager_ProcessHitEnemy", 54); return; } val.Goto(array[1].Next, (MoveType)2, false); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)getCooldown); val.Goto(array[2].Next, (MoveType)0, false); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)getDamageCoefficient); static float getCooldown(float cooldown, DamageInfo damageInfo) { CharacterBody val4 = (Object.op_Implicit((Object)(object)damageInfo?.attacker) ? damageInfo.attacker.GetComponent() : null); Inventory val5 = (Object.op_Implicit((Object)(object)val4) ? val4.inventory : null); if (Object.op_Implicit((Object)(object)val5)) { ItemQualityCounts itemCountsEffective2 = val5.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.ElementalRingVoid); if (itemCountsEffective2.TotalQualityCount > 0) { switch (itemCountsEffective2.HighestQuality) { case QualityTier.Uncommon: cooldown = Mathf.Min(cooldown, 18f); break; case QualityTier.Rare: cooldown = Mathf.Min(cooldown, 15f); break; case QualityTier.Epic: cooldown = Mathf.Min(cooldown, 12f); break; case QualityTier.Legendary: cooldown = Mathf.Min(cooldown, 10f); break; default: Log.Error($"Quality tier {itemCountsEffective2.HighestQuality} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ElementalRingVoid.cs", "GlobalEventManager_ProcessHitEnemy", 87); break; } } } return cooldown; } static float getDamageCoefficient(float damageCoefficient, DamageInfo damageInfo) { CharacterBody val2 = (Object.op_Implicit((Object)(object)damageInfo?.attacker) ? damageInfo.attacker.GetComponent() : null); Inventory val3 = (Object.op_Implicit((Object)(object)val2) ? val2.inventory : null); if (Object.op_Implicit((Object)(object)val3)) { ItemQualityCounts itemCountsEffective = val3.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.ElementalRingVoid); if (itemCountsEffective.TotalQualityCount > 0) { damageCoefficient += 2f + 3f * (float)itemCountsEffective.UncommonCount + 4f * (float)itemCountsEffective.RareCount + 5f * (float)itemCountsEffective.EpicCount + 6f * (float)itemCountsEffective.LegendaryCount; } } return damageCoefficient; } } } public sealed class ElementalRingVoidBlackHoleProjectileController : NetworkBehaviour { [SyncVar] private float _scaleMultiplier = 1f; private bool _appliedScaleMultiplier; private RadialForce _radialForce; public float Network_scaleMultiplier { get { return _scaleMultiplier; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref _scaleMultiplier, 1u); } } private void Awake() { RadialForce radialForce = default(RadialForce); if (((Component)this).TryGetComponent(ref radialForce)) { _radialForce = radialForce; } else { Log.Error(Util.GetGameObjectHierarchyName(((Component)this).gameObject) + " is missing RadialForce component", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ElementalRingVoidBlackHoleProjectileController.cs", "Awake", 25); ((Behaviour)this).enabled = false; } if (NetworkServer.active) { ProjectileController val = default(ProjectileController); if (((Component)this).TryGetComponent(ref val)) { val.onInitialized += onInitializedServer; return; } Log.Error(Util.GetGameObjectHierarchyName(((Component)this).gameObject) + " is missing ProjectileController component", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ElementalRingVoidBlackHoleProjectileController.cs", "Awake", 37); ((Behaviour)this).enabled = false; } } [Server] private void onInitializedServer(ProjectileController projectileController) { //IL_00f0: 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 (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void ItemQualities.Items.ElementalRingVoidBlackHoleProjectileController::onInitializedServer(RoR2.Projectile.ProjectileController)' called on client"); return; } ItemQualityCounts itemQualityCounts = default(ItemQualityCounts); CharacterBody val = default(CharacterBody); if (Object.op_Implicit((Object)(object)projectileController) && Object.op_Implicit((Object)(object)projectileController.owner) && projectileController.owner.TryGetComponent(ref val) && Object.op_Implicit((Object)(object)val.inventory)) { itemQualityCounts = val.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.ElementalRingVoid); } float num; switch (itemQualityCounts.HighestQuality) { case QualityTier.None: num = 1f; break; case QualityTier.Uncommon: num = 1.33f; break; case QualityTier.Rare: num = 1.66f; break; case QualityTier.Epic: num = 2.33f; break; case QualityTier.Legendary: num = 3f; break; default: num = 1f; Log.Error($"Quality tier {itemQualityCounts.HighestQuality} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ElementalRingVoidBlackHoleProjectileController.cs", "onInitializedServer", 72); break; } Network_scaleMultiplier = num; if (num > 1f) { Transform transform = ((Component)this).transform; transform.localScale *= num; } applyScaleMultiplier(); } public override void OnStartClient() { ((NetworkBehaviour)this).OnStartClient(); applyScaleMultiplier(); } private void applyScaleMultiplier() { if (!_appliedScaleMultiplier) { RadialForce radialForce = _radialForce; radialForce.radius *= _scaleMultiplier; _appliedScaleMultiplier = true; } } private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { if (forceAll) { writer.Write(_scaleMultiplier); return true; } bool flag = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(_scaleMultiplier); } if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { if (initialState) { _scaleMultiplier = reader.ReadSingle(); return; } int num = (int)reader.ReadPackedUInt32(); if (((uint)num & (true ? 1u : 0u)) != 0) { _scaleMultiplier = reader.ReadSingle(); } } public override void PreStartClient() { } } internal static class EnergizedOnEquipmentUse { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown EquipmentSlot.OnEquipmentExecuted_byte_byte_EquipmentIndex += new Manipulator(EquipmentSlot_OnEquipmentExecuted); } private static void EquipmentSlot_OnEquipmentExecuted(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "Energized") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\EnergizedOnEquipmentUse.cs", "EquipmentSlot_OnEquipmentExecuted", 24); return; } val.Goto(array[0].Next, (MoveType)2, false); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getWarhornBuff); static BuffDef getWarhornBuff(BuffDef warhornBuffDef, EquipmentSlot equipmentSlot) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Invalid comparison between Unknown and I4 //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Invalid comparison between Unknown and I4 //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) CharacterBody val2 = (Object.op_Implicit((Object)(object)equipmentSlot) ? equipmentSlot.characterBody : null); Inventory val3 = (Object.op_Implicit((Object)(object)val2) ? val2.inventory : null); if (Object.op_Implicit((Object)(object)val3)) { BuffIndex val4 = (BuffIndex)((!Object.op_Implicit((Object)(object)warhornBuffDef)) ? (-1) : ((int)warhornBuffDef.buffIndex)); if ((int)val4 != -1) { QualityTier highestQuality = val3.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.EnergizedOnEquipmentUse).HighestQuality; BuffIndex buffIndexOfQuality = QualityCatalog.GetBuffIndexOfQuality(val4, highestQuality); if ((int)buffIndexOfQuality != -1 && buffIndexOfQuality != val4) { warhornBuffDef = BuffCatalog.GetBuffDef(buffIndexOfQuality); val4 = buffIndexOfQuality; } } } return warhornBuffDef; } } } public sealed class EnergizedOnEquipmentUseItemBehavior : QualityItemBodyBehavior { [ItemGroupAssociation(QualityItemBehaviorUsageFlags.Server)] private static ItemQualityGroup GetItemGroup() { return ItemQualitiesContent.ItemQualityGroups.EnergizedOnEquipmentUse; } private void OnDisable() { if (Object.op_Implicit((Object)(object)base.Body.inventory) && base.Body.inventory.GetItemCountEffective(Items.EnergizedOnEquipmentUse) > 0) { base.Body.ConvertAllBuffsToQualityTier(ItemQualitiesContent.BuffQualityGroups.Energized, QualityTier.None); } else { base.Body.RemoveAllQualityBuffs(ItemQualitiesContent.BuffQualityGroups.Energized); } } protected override void OnStacksChanged() { base.OnStacksChanged(); base.Body.ConvertAllBuffsToQualityTier(ItemQualitiesContent.BuffQualityGroups.Energized, base.Stacks.HighestQuality); } } public sealed class EquipmentMagazineQualityItemBehavior : QualityItemBodyBehavior { [ItemGroupAssociation(QualityItemBehaviorUsageFlags.Server)] private static ItemQualityGroup GetItemGroup() { return ItemQualitiesContent.ItemQualityGroups.EquipmentMagazine; } private void OnEnable() { EquipmentSlot.onServerEquipmentActivated += onEquipmentActivated; } private void OnDisable() { EquipmentSlot.onServerEquipmentActivated -= onEquipmentActivated; } private void onEquipmentActivated(EquipmentSlot equipmentSlot, EquipmentIndex equipmentIndex) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 if (!((Object)(object)base.Body.equipmentSlot != (Object)(object)equipmentSlot) && (int)equipmentIndex != -1) { ref readonly ItemQualityCounts stacks = ref base.Stacks; if (RollUtil.CheckRoll(Util.ConvertAmplificationPercentageIntoReductionPercentage(10f * (float)stacks.UncommonCount + 20f * (float)stacks.RareCount + 35f * (float)stacks.EpicCount + 60f * (float)stacks.LegendaryCount), base.Body.master, sureProc: false)) { base.Body.inventory.RestockEquipmentCharges(equipmentSlot.activeEquipmentSlot, equipmentSlot.activeEquipmentSet[equipmentSlot.activeEquipmentSlot], 1); } } } } internal static class EquipmentMagazineVoid { [SystemInitializer(new Type[] { })] private static void Init() { //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 ItemHooks.TakeDamageModifier += modifyTakeDamage; RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(getStatCoefficients); CharacterBody.HandleConstructTurret += new Manipulator(CharacterBody_HandleConstructTurret); } private static void CharacterBody_HandleConstructTurret(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)1, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "Perform") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\EquipmentMagazineVoid.cs", "CharacterBody_HandleConstructTurret", 29); return; } val.Emit(OpCodes.Dup); val.EmitDelegate>((Action)handleTurretSummon); static void handleTurretSummon(MasterSummon turretSummon) { CharacterBody val2 = default(CharacterBody); ItemQualityCounts equipmentMagazineVoid; if (Object.op_Implicit((Object)(object)turretSummon?.summonerBodyObject) && turretSummon.summonerBodyObject.TryGetComponent(ref val2) && Object.op_Implicit((Object)(object)val2.inventory)) { equipmentMagazineVoid = val2.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.EquipmentMagazineVoid); if (equipmentMagazineVoid.TotalQualityCount > 0) { turretSummon.preSpawnSetupCallback = (Action)Delegate.Combine(turretSummon.preSpawnSetupCallback, new Action(onTurretSpawned)); } } void onTurretSpawned(CharacterMaster turretMaster) { if (Object.op_Implicit((Object)(object)turretMaster) && Object.op_Implicit((Object)(object)turretMaster.inventory)) { turretMaster.inventory.GiveItemsPermanent(ItemQualitiesContent.ItemQualityGroups.BoostDamageVoid, in equipmentMagazineVoid); } } } } private static void modifyTakeDamage(ref float damageValue, DamageInfo damageInfo) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) if (damageInfo == null) { return; } CharacterBody val = (Object.op_Implicit((Object)(object)damageInfo.attacker) ? damageInfo.attacker.GetComponent() : null); Inventory val2 = (Object.op_Implicit((Object)(object)val) ? val.inventory : null); if (!Object.op_Implicit((Object)(object)val2)) { return; } ItemQualityCounts left = default(ItemQualityCounts); ItemQualityCounts right; if ((damageInfo.damageType.damageSource & 8) != 0) { right = val2.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.EquipmentMagazineVoid); left += right; } right = val2.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.BoostDamageVoid); left += right; if (left.TotalQualityCount > 0) { float num = 0.1f * (float)left.UncommonCount + 0.2f * (float)left.RareCount + 0.4f * (float)left.EpicCount + 0.5f * (float)left.LegendaryCount; if (num > 0f) { damageValue *= 1f + num; damageInfo.damageColorIndex = (DamageColorIndex)9; } } } private static void getStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (!Object.op_Implicit((Object)(object)sender) || !Object.op_Implicit((Object)(object)sender.inventory)) { return; } ItemQualityCounts itemCountsEffective = sender.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.EquipmentMagazineVoid); if (itemCountsEffective.TotalQualityCount > 0) { float num; switch (itemCountsEffective.HighestQuality) { case QualityTier.Uncommon: num = 0.9f; break; case QualityTier.Rare: num = 0.8f; break; case QualityTier.Epic: num = 0.6f; break; case QualityTier.Legendary: num = 0.45f; break; default: num = 1f; Log.Error($"Quality tier {itemCountsEffective.HighestQuality} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\EquipmentMagazineVoid.cs", "getStatCoefficients", 117); break; } args.specialSkill.cooldownMultiplier *= num; } } } internal static class ExecuteLowHealthElite { [SystemInitializer(new Type[] { })] private static void Init() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown ExecuteAPI.CalculateExecuteThresholdForViewer = (CalculateExecuteThresholdForViewerEventHandler)Delegate.Combine((Delegate?)(object)ExecuteAPI.CalculateExecuteThresholdForViewer, (Delegate?)new CalculateExecuteThresholdForViewerEventHandler(calculateExecuteThreshold)); } private static void calculateExecuteThreshold(CharacterBody victimBody, CharacterBody viewerBody, ref float highestExecuteThreshold) { if (Object.op_Implicit((Object)(object)victimBody) && Object.op_Implicit((Object)(object)viewerBody) && (victimBody.isBoss || victimBody.isChampion) && ((Component)(object)viewerBody).TryGetComponentCached(out CharacterBodyExtraStatsTracker component)) { highestExecuteThreshold = Mathf.Max(highestExecuteThreshold, component.ExecuteBossHealthFraction); } } } internal static class ExplodeOnDeath { private static GameObject _banditSmokeBombScalingFixPrefab; private static GameObject _lightningStrikeScalingFixPrefab; private static GameObject _simpleLightningStrikeScalingFixPrefab; private static GameObject _meteorWarningEffectScalingFixPrefab; private static GameObject _meteorTravelEffectScalingFixPrefab; private static GameObject _meteorImpactEffectScalingFixPrefab; private static GameObject _brotherFistSlamImpactScaleFixPrefab; private static GameObject _brotherWeaponSlamImpactScaleFixPrefab; private static GameObject _golemLaserImpactScaleFixPrefab; private static GameObject _halcyoniteTriLaserImpactScaleFixPrefab; private static GameObject _impBossBlinkScaleFixPrefab; private static GameObject _impBossGroundPoundSlamScaleFixPrefab; private static GameObject _mageFlyUpBlinkScaleFixPrefab; private const float LightningStrikeOrbRadius = 3f; private const float SimpleLightningStrikeOrbRadius = 3f; public static float GetExplosionRadius(float radius, CharacterBody attacker) { if (Object.op_Implicit((Object)(object)attacker) && Object.op_Implicit((Object)(object)attacker.inventory)) { ItemQualityCounts itemCountsEffective = attacker.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.ExplodeOnDeath); if (itemCountsEffective.TotalQualityCount > 0) { float num = 0.2f * (float)itemCountsEffective.UncommonCount + 0.4f * (float)itemCountsEffective.RareCount + 0.7f * (float)itemCountsEffective.EpicCount + 1f * (float)itemCountsEffective.LegendaryCount; if (num > 0f) { radius *= 1f + num; } } } return radius; } private static bool isScaledExplosion(float baseRadius, CharacterBody attacker) { if (baseRadius <= 0f) { return false; } return Mathf.Abs(GetExplosionRadius(baseRadius, attacker) / baseRadius - 1f) > Mathf.Epsilon; } private static void spawnEffectAtMuzzle(GameObject effectPrefab, EffectData effectData, GameObject entityObject, string muzzleName, bool transmit) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) ModelLocator val = default(ModelLocator); if (Object.op_Implicit((Object)(object)entityObject) && entityObject.TryGetComponent(ref val) && Object.op_Implicit((Object)(object)val.modelChildLocator)) { int num = val.modelChildLocator.FindChildIndex(muzzleName); Transform val2 = ((num < 0) ? null : val.modelChildLocator.FindChild(num)); if (Object.op_Implicit((Object)(object)val2)) { effectData.origin = val2.position; effectData.SetChildLocatorTransformReference(entityObject, num); EffectManager.SpawnEffect(effectPrefab, effectData, transmit); } } } [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { //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_001d: Expected O, but got Unknown //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Expected O, but got Unknown //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Expected O, but got Unknown //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Expected O, but got Unknown //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Expected O, but got Unknown //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Expected O, but got Unknown //IL_0162: Expected O, but got Unknown ParallelProgressCoroutine val = new ParallelProgressCoroutine((IProgress)args.ProgressReceiver); AssetLoadExtensions.AddProgressCoroutine(val, banditSmokeBombScaleFixAsync>); AssetLoadExtensions.AddProgressCoroutine(val, lightningStrikeImpactScaleFixAsync>); AssetLoadExtensions.AddProgressCoroutine(val, simpleLightningStrikeImpactScaleFixAsync>); AssetLoadExtensions.AddProgressCoroutine(val, meteorStormScaleFixAsync>); AssetLoadExtensions.AddProgressCoroutine(val, brotherFistSlamScaleFixAsync>); AssetLoadExtensions.AddProgressCoroutine(val, brotherWeaponSlamScaleFixAsync>); AssetLoadExtensions.AddProgressCoroutine(val, falseSonBossPrimarySlamScaleFixAsync>, args.ContentPack); AssetLoadExtensions.AddProgressCoroutine(val, falseSonBossPrimeDevastatorScaleFixAsync>, args.ContentPack); AssetLoadExtensions.AddProgressCoroutine(val, golemClapScaleFixAsync>, args.ContentPack); AssetLoadExtensions.AddProgressCoroutine(val, golemLaserScaleFixAsync>); AssetLoadExtensions.AddProgressCoroutine(val, halcyoniteTriLaserScaleFixAsync>); AssetLoadExtensions.AddProgressCoroutine(val, impBossBlinkScaleFixAsync>); AssetLoadExtensions.AddProgressCoroutine(val, impBossGroundPoundScaleFixAsync>); AssetLoadExtensions.AddProgressCoroutine(val, parentGroundSlamScaleFixAsync>); AssetLoadExtensions.AddProgressCoroutine(val, mageFlyUpBlinkScaleFixAsync>); AssetLoadExtensions.AddProgressCoroutine(val, junkCubeDamageImpactScaleFixAsync>); AssetLoadExtensions.AddProgressCoroutine(val, junkCubeLaunchedImpactScaleFixAsync>); AssetLoadExtensions.AddProgressCoroutine(val, junkCubeDeathImpactScaleFixAsync>); return (IEnumerator)val; static IEnumerator banditSmokeBombScaleFixAsync(TProgress progressReceiver) where TProgress : IProgress { AsyncOperationHandle smokeBombPrefabLoad = AddressableUtil.LoadTempAssetAsync(RoR2_Base_Bandit2.Bandit2SmokeBomb_prefab); AsyncOperationHandle stealthModeConfigurationLoad = AddressableUtil.LoadTempAssetAsync(RoR2_Base_Bandit2.EntityStates_Bandit2_StealthMode_asset); ParallelProgressCoroutine val20 = new ParallelProgressCoroutine((IProgress)progressReceiver); val20.Add(in smokeBombPrefabLoad); val20.Add(in stealthModeConfigurationLoad); yield return val20; if (AssetLoadExtensions.AssertLoaded(in smokeBombPrefabLoad, "Bandit2SmokeBomb", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 125) && AssetLoadExtensions.AssertLoaded(in stealthModeConfigurationLoad, "EntityStates.Bandit2.StealthMode", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 126) && stealthModeConfigurationLoad.Result.TryGetFieldValue("blastAttackRadius", out var value26)) { EffectDef orCreateFixedScalingCopy17 = EffectScalingFixer.GetOrCreateFixedScalingCopy(smokeBombPrefabLoad.Result, value26); if (orCreateFixedScalingCopy17 != null) { _banditSmokeBombScalingFixPrefab = orCreateFixedScalingCopy17.prefab; } } } static IEnumerator brotherFistSlamScaleFixAsync(TProgress progressReceiver) where TProgress : IProgress { AsyncOperationHandle brotherFistSlamConfigurationLoad = AddressableUtil.LoadTempAssetAsync(RoR2_Base_Brother.EntityStates_BrotherMonster_FistSlam_asset); yield return brotherFistSlamConfigurationLoad.AsProgressCoroutine(progressReceiver); if (AssetLoadExtensions.AssertLoaded(in brotherFistSlamConfigurationLoad, "EntityStates.BrotherMonster.FistSlam", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 237)) { GameObject value25; if (!brotherFistSlamConfigurationLoad.Result.TryGetFieldValue("radius", out var value24)) { Log.Error("Failed to get EntityStates.BrotherMonster.FistSlam.radius field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 242); } else if (brotherFistSlamConfigurationLoad.Result.TryGetFieldValue("slamImpactEffect", out value25)) { EffectDef orCreateFixedScalingCopy11 = EffectScalingFixer.GetOrCreateFixedScalingCopy(value25, value24); if (orCreateFixedScalingCopy11 != null) { _brotherFistSlamImpactScaleFixPrefab = orCreateFixedScalingCopy11.prefab; } } else { Log.Error("Failed to get EntityStates.BrotherMonster.FistSlam.slamImpactEffect field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 256); } } } static IEnumerator brotherWeaponSlamScaleFixAsync(TProgress progressReceiver) where TProgress : IProgress { AsyncOperationHandle brotherWeaponSlamConfigurationLoad = AddressableUtil.LoadTempAssetAsync(RoR2_Base_Brother.EntityStates_BrotherMonster_WeaponSlam_asset); yield return brotherWeaponSlamConfigurationLoad.AsProgressCoroutine(progressReceiver); if (AssetLoadExtensions.AssertLoaded(in brotherWeaponSlamConfigurationLoad, "EntityStates.BrotherMonster.WeaponSlam", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 269)) { GameObject value23; if (!brotherWeaponSlamConfigurationLoad.Result.TryGetFieldValue("radius", out var value22)) { Log.Error("Failed to get EntityStates.BrotherMonster.WeaponSlam.radius field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 274); } else if (brotherWeaponSlamConfigurationLoad.Result.TryGetFieldValue("slamImpactEffect", out value23)) { EffectDef orCreateFixedScalingCopy10 = EffectScalingFixer.GetOrCreateFixedScalingCopy(value23, value22); if (orCreateFixedScalingCopy10 != null) { _brotherWeaponSlamImpactScaleFixPrefab = orCreateFixedScalingCopy10.prefab; } } else { Log.Error("Failed to get EntityStates.BrotherMonster.WeaponSlam.slamImpactEffect field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 288); } } } static IEnumerator falseSonBossPrimarySlamScaleFixAsync(ExtendedContentPack contentPack, TProgress progressReceiver) where TProgress : IProgress { AssetReferenceT falseSonBossPrimarySlamClipReference = new AssetReferenceT(RoR2_DLC2_FalseSon.AS_FalseSon_PrimarySlam_fbx_FSArmature_BossPrimarySlam_); AsyncOperationHandle falseSonBossPrimarySlamClipLoad = AssetAsyncReferenceManager.LoadAsset(falseSonBossPrimarySlamClipReference, (AsyncReferenceHandleUnloadType)2); AsyncOperationHandle falseSonFissureSlamConfigurationLoad = AddressableUtil.LoadTempAssetAsync(RoR2_DLC2_FalseSonBoss.EntityStates_FalseSonBoss_FissureSlam_asset); ParallelProgressCoroutine val16 = new ParallelProgressCoroutine((IProgress)progressReceiver); val16.Add(in falseSonBossPrimarySlamClipLoad); val16.Add(in falseSonFissureSlamConfigurationLoad); yield return val16; if (AssetLoadExtensions.AssertLoaded(in falseSonBossPrimarySlamClipLoad, "FSArmature|BossPrimarySlam", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 307) && AssetLoadExtensions.AssertLoaded(in falseSonFissureSlamConfigurationLoad, "EntityStates.FalseSonBoss.FissureSlam", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 308)) { if (!falseSonFissureSlamConfigurationLoad.Result.TryGetFieldValue("blastRadius", out var value21)) { Log.Error("Failed to get EntityStates.FalseSonBoss.FissureSlam.blastRadius field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 315); } else { value21 += 3f; AnimationEvent[] events4 = falseSonBossPrimarySlamClipLoad.Result.events; bool flag10 = false; bool flag11 = false; AnimationEvent[] array6 = events4; foreach (AnimationEvent val17 in array6) { if (val17.functionName == "CreatePrefab" && val17.stringParameter == "ClubExplosionPoint") { Object objectReferenceParameter4 = val17.objectReferenceParameter; GameObject val18 = (GameObject)(object)((objectReferenceParameter4 is GameObject) ? objectReferenceParameter4 : null); if (val18 != null && Object.op_Implicit((Object)(object)val18)) { GameObject val19 = EffectScalingFixer.CreateFixedScalingCopy(val18, value21); ((Object)val19).name = ((Object)val19).name + "_FissureSlam"; UnityObjectExtensions.EnsureComponent(val19); ExplosionRangeIndicatorScaler explosionRangeIndicatorScaler4 = UnityObjectExtensions.EnsureComponent(val19); explosionRangeIndicatorScaler4.ExplosionInfoIndex = ExplosionInfoIndex.FalseSonBossFissureSlam; explosionRangeIndicatorScaler4.IndicatorTransforms = (Transform[])(object)new Transform[1] { val19.transform }; val17.objectReferenceParameter = (Object)(object)val19; contentPack.effectDefs.Add(new EffectDef(val19)); flag10 = true; flag11 = true; } } } if (flag10) { falseSonBossPrimarySlamClipLoad.Result.events = events4; } else { if (!flag11) { Log.Error("Failed to find create impact effect animation event in " + ((Object)falseSonBossPrimarySlamClipLoad.Result).name, "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 358); } AssetAsyncReferenceManager.UnloadAsset(falseSonBossPrimarySlamClipReference); } } } } static IEnumerator falseSonBossPrimeDevastatorScaleFixAsync(ExtendedContentPack contentPack, TProgress progressReceiver) where TProgress : IProgress { AssetReferenceT falseSonBossPrimeDevastatorClipReference = new AssetReferenceT(RoR2_DLC2_FalseSon.AS_FalseSonBoss_PrimeDevastator_fbx_FSArmature_BossPrimaryDevastator_); AsyncOperationHandle falseSonBossPrimeDevastatorClipLoad = AssetAsyncReferenceManager.LoadAsset(falseSonBossPrimeDevastatorClipReference, (AsyncReferenceHandleUnloadType)2); AsyncOperationHandle falseSonPrimeDevastatorConfigurationLoad = AddressableUtil.LoadTempAssetAsync(RoR2_DLC2_FalseSonBoss.EntityStates_FalseSonBoss_PrimeDevastator_asset); ParallelProgressCoroutine val12 = new ParallelProgressCoroutine((IProgress)progressReceiver); val12.Add(in falseSonBossPrimeDevastatorClipLoad); val12.Add(in falseSonPrimeDevastatorConfigurationLoad); yield return val12; if (AssetLoadExtensions.AssertLoaded(in falseSonBossPrimeDevastatorClipLoad, "FSArmature|BossPrimaryDevastator", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 380) && AssetLoadExtensions.AssertLoaded(in falseSonPrimeDevastatorConfigurationLoad, "EntityStates.FalseSonBoss.PrimeDevastator", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 381)) { if (!falseSonPrimeDevastatorConfigurationLoad.Result.TryGetFieldValue("blastRadius", out var value20)) { Log.Error("Failed to get EntityStates.FalseSonBoss.PrimeDevastator.blastRadius field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 388); } else { AnimationEvent[] events3 = falseSonBossPrimeDevastatorClipLoad.Result.events; bool flag8 = false; bool flag9 = false; AnimationEvent[] array5 = events3; foreach (AnimationEvent val13 in array5) { if (val13.functionName == "CreatePrefab") { Object objectReferenceParameter3 = val13.objectReferenceParameter; GameObject val14 = (GameObject)(object)((objectReferenceParameter3 is GameObject) ? objectReferenceParameter3 : null); if (val14 != null && Object.op_Implicit((Object)(object)val14)) { GameObject val15 = EffectScalingFixer.CreateFixedScalingCopy(val14, value20); ((Object)val15).name = ((Object)val15).name + "_PrimeDevastator"; UnityObjectExtensions.EnsureComponent(val15); ExplosionRangeIndicatorScaler explosionRangeIndicatorScaler3 = UnityObjectExtensions.EnsureComponent(val15); explosionRangeIndicatorScaler3.ExplosionInfoIndex = ExplosionInfoIndex.FalseSonBossPrimeDevastator; explosionRangeIndicatorScaler3.IndicatorTransforms = (Transform[])(object)new Transform[1] { val15.transform }; val13.objectReferenceParameter = (Object)(object)val15; contentPack.effectDefs.Add(new EffectDef(val15)); flag8 = true; flag9 = true; } } } if (flag8) { falseSonBossPrimeDevastatorClipLoad.Result.events = events3; } else { if (!flag9) { Log.Error("Failed to find create impact effect animation event(s) in " + ((Object)falseSonBossPrimeDevastatorClipLoad.Result).name, "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 427); } AssetAsyncReferenceManager.UnloadAsset(falseSonBossPrimeDevastatorClipReference); } } } } static IEnumerator golemClapScaleFixAsync(ExtendedContentPack contentPack, TProgress progressReceiver) where TProgress : IProgress { AssetReferenceT golemClapClipReference = new AssetReferenceT(RoR2_Base_Golem.mdlGolem_fbx_GolemArmature_Smack_); AsyncOperationHandle golemClapClipLoad = AssetAsyncReferenceManager.LoadAsset(golemClapClipReference, (AsyncReferenceHandleUnloadType)2); AsyncOperationHandle golemClapConfigurationLoad = AddressableUtil.LoadTempAssetAsync(RoR2_Base_Golem.EntityStates_GolemMonster_ClapState_asset); ParallelProgressCoroutine val8 = new ParallelProgressCoroutine((IProgress)progressReceiver); val8.Add(in golemClapClipLoad); val8.Add(in golemClapConfigurationLoad); yield return val8; if (AssetLoadExtensions.AssertLoaded(in golemClapClipLoad, "GolemArmature|Smack", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 449) && AssetLoadExtensions.AssertLoaded(in golemClapConfigurationLoad, "EntityStates.GolemMonster.ClapState", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 450)) { if (!golemClapConfigurationLoad.Result.TryGetFieldValue("radius", out var value19)) { Log.Error("Failed to get EntityStates.GolemMonster.ClapState.radius field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 457); } else { AnimationEvent[] events2 = golemClapClipLoad.Result.events; bool flag6 = false; bool flag7 = false; AnimationEvent[] array4 = events2; foreach (AnimationEvent val9 in array4) { if (val9.functionName == "CreatePrefab") { Object objectReferenceParameter2 = val9.objectReferenceParameter; GameObject val10 = (GameObject)(object)((objectReferenceParameter2 is GameObject) ? objectReferenceParameter2 : null); if (val10 != null && Object.op_Implicit((Object)(object)val10)) { GameObject val11 = EffectScalingFixer.CreateFixedScalingCopy(val10, value19); ((Object)val11).name = ((Object)val11).name + "_GolemClap"; UnityObjectExtensions.EnsureComponent(val11); ExplosionRangeIndicatorScaler explosionRangeIndicatorScaler2 = UnityObjectExtensions.EnsureComponent(val11); explosionRangeIndicatorScaler2.ExplosionInfoIndex = ExplosionInfoIndex.GolemClap; explosionRangeIndicatorScaler2.IndicatorTransforms = (Transform[])(object)new Transform[1] { val11.transform }; val9.objectReferenceParameter = (Object)(object)val11; contentPack.effectDefs.Add(new EffectDef(val11)); flag6 = true; flag7 = true; } } } if (flag6) { golemClapClipLoad.Result.events = events2; } else { if (!flag7) { Log.Error("Failed to find create impact effect animation event(s) in " + ((Object)golemClapClipLoad.Result).name, "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 496); } AssetAsyncReferenceManager.UnloadAsset(golemClapClipReference); } } } } static IEnumerator golemLaserScaleFixAsync(TProgress progressReceiver) where TProgress : IProgress { AsyncOperationHandle golemLaserConfigurationLoad = AddressableUtil.LoadTempAssetAsync(RoR2_Base_Golem.EntityStates_GolemMonster_FireLaser_asset); yield return golemLaserConfigurationLoad.AsProgressCoroutine(progressReceiver); if (AssetLoadExtensions.AssertLoaded(in golemLaserConfigurationLoad, "EntityStates.GolemMonster.FireLaser", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 512)) { GameObject value18; if (!golemLaserConfigurationLoad.Result.TryGetFieldValue("blastRadius", out var value17)) { Log.Error("Failed to get EntityStates.GolemMonster.FireLaser.blastRadius field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 517); } else if (golemLaserConfigurationLoad.Result.TryGetFieldValue("hitEffectPrefab", out value18)) { EffectDef orCreateFixedScalingCopy9 = EffectScalingFixer.GetOrCreateFixedScalingCopy(value18, value17); if (orCreateFixedScalingCopy9 != null) { _golemLaserImpactScaleFixPrefab = orCreateFixedScalingCopy9.prefab; } } else { Log.Error("Failed to get EntityStates.GolemMonster.FireLaser.hitEffectPrefab field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 531); } } } static IEnumerator halcyoniteTriLaserScaleFixAsync(TProgress progressReceiver) where TProgress : IProgress { AsyncOperationHandle halcyoniteTriLaserConfigurationLoad = AddressableUtil.LoadTempAssetAsync(RoR2_DLC2_Halcyonite.EntityStates_HalcyoniteMonster_TriLaser_asset); yield return halcyoniteTriLaserConfigurationLoad.AsProgressCoroutine(progressReceiver); if (AssetLoadExtensions.AssertLoaded(in halcyoniteTriLaserConfigurationLoad, "EntityStates.Halcyonite.TriLaser", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 544)) { GameObject value16; if (!halcyoniteTriLaserConfigurationLoad.Result.TryGetFieldValue("blastRadius", out var value15)) { Log.Error("Failed to get EntityStates.Halcyonite.TriLaser.blastRadius field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 549); } else if (halcyoniteTriLaserConfigurationLoad.Result.TryGetFieldValue("hitEffectPrefab", out value16)) { EffectDef orCreateFixedScalingCopy8 = EffectScalingFixer.GetOrCreateFixedScalingCopy(value16, value15); if (orCreateFixedScalingCopy8 != null) { _halcyoniteTriLaserImpactScaleFixPrefab = orCreateFixedScalingCopy8.prefab; } } else { Log.Error("Failed to get EntityStates.Halcyonite.TriLaser.hitEffectPrefab field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 563); } } } static IEnumerator impBossBlinkScaleFixAsync(TProgress progressReceiver) where TProgress : IProgress { AsyncOperationHandle impBossBlinkConfigurationLoad = AddressableUtil.LoadAssetAsync(RoR2_Base_ImpBoss.EntityStates_ImpBossMonster_BlinkState_asset, (AsyncReferenceHandleUnloadType)2); yield return impBossBlinkConfigurationLoad.AsProgressCoroutine(progressReceiver); if (AssetLoadExtensions.AssertLoaded(in impBossBlinkConfigurationLoad, "EntityStates.ImpBossMonster.BlinkState", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 576)) { if (!impBossBlinkConfigurationLoad.Result.TryGetFieldValue("blastAttackRadius", out var value12)) { Log.Error("Failed to get EntityStates.ImpBossMonster.BlinkState.blastAttackRadius field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 581); } else { if (impBossBlinkConfigurationLoad.Result.TryGetFieldValue("blinkPrefab", out var value13)) { EffectDef orCreateFixedScalingCopy7 = EffectScalingFixer.GetOrCreateFixedScalingCopy(value13, value12); if (orCreateFixedScalingCopy7 != null) { _impBossBlinkScaleFixPrefab = orCreateFixedScalingCopy7.prefab; } } else { Log.Error("Failed to get EntityStates.ImpBossMonster.BlinkState.blinkPrefab field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 595); } if (impBossBlinkConfigurationLoad.Result.TryGetFieldValue("blinkDestinationPrefab", out var value14)) { GameObject val7 = EffectScalingFixer.CreateFixedScalingCopy(value14, value12); if (Object.op_Implicit((Object)(object)val7)) { UnityObjectExtensions.EnsureComponent(val7); UnityObjectExtensions.EnsureComponent(val7); ExplosionRangeIndicatorScaler explosionRangeIndicatorScaler = UnityObjectExtensions.EnsureComponent(val7); explosionRangeIndicatorScaler.ExplosionInfoIndex = ExplosionInfoIndex.ImpBossBlink; explosionRangeIndicatorScaler.IndicatorTransforms = (Transform[])(object)new Transform[1] { val7.transform }; if (!impBossBlinkConfigurationLoad.Result.TrySetFieldValue("blinkDestinationPrefab", val7)) { Log.Error("Failed to set EntityStates.ImpBossMonster.BlinkState.blinkDestinationPrefab field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 612); } } } else { Log.Error("Failed to get EntityStates.ImpBossMonster.BlinkState.blinkDestinationPrefab field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 618); } } } } static IEnumerator impBossGroundPoundScaleFixAsync(TProgress progressReceiver) where TProgress : IProgress { AsyncOperationHandle impBossGroundPoundConfigurationLoad = AddressableUtil.LoadTempAssetAsync(RoR2_Base_ImpBoss.EntityStates_ImpBossMonster_GroundPound_asset); yield return impBossGroundPoundConfigurationLoad.AsProgressCoroutine(progressReceiver); if (AssetLoadExtensions.AssertLoaded(in impBossGroundPoundConfigurationLoad, "EntityStates.ImpBossMonster.GroundPound", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 631)) { GameObject value11; if (!impBossGroundPoundConfigurationLoad.Result.TryGetFieldValue("blastAttackRadius", out var value10)) { Log.Error("Failed to get EntityStates.ImpBossMonster.GroundPound.blastAttackRadius field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 636); } else if (impBossGroundPoundConfigurationLoad.Result.TryGetFieldValue("slamEffectPrefab", out value11)) { EffectDef orCreateFixedScalingCopy6 = EffectScalingFixer.GetOrCreateFixedScalingCopy(value11, value10); if (orCreateFixedScalingCopy6 != null) { _impBossGroundPoundSlamScaleFixPrefab = orCreateFixedScalingCopy6.prefab; } } else { Log.Error("Failed to get EntityStates.ImpBossMonster.GroundPound.slamEffectPrefab field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 650); } } } static IEnumerator junkCubeDamageImpactScaleFixAsync(TProgress progressReceiver) where TProgress : IProgress { AssetReferenceT[] junkCubeDamageConfigurationReferences = new AssetReferenceT[3] { new AssetReferenceT(RoR2_DLC3_Drifter.JunkCube_DamageSmall_asset), new AssetReferenceT(RoR2_DLC3_Drifter.JunkCube_DamageMedium_asset), new AssetReferenceT(RoR2_DLC3_Drifter.JunkCube_DamageLarge_asset) }; AsyncOperationHandle[] junkCubeDamageConfigurationLoadHandles = Array.ConvertAll(junkCubeDamageConfigurationReferences, (AssetReferenceT r) => AssetAsyncReferenceManager.LoadAsset(r, (AsyncReferenceHandleUnloadType)2)); ParallelProgressCoroutine val3 = new ParallelProgressCoroutine((IProgress)progressReceiver); AsyncOperationHandle[] array2 = junkCubeDamageConfigurationLoadHandles; for (int k = 0; k < array2.Length; k++) { AsyncOperationHandle asyncOperation3 = array2[k]; val3.Add(in asyncOperation3); } yield return val3; for (int l = 0; l < junkCubeDamageConfigurationLoadHandles.Length; l++) { AsyncOperationHandle asyncOperation4 = junkCubeDamageConfigurationLoadHandles[l]; bool flag3 = false; if (AssetLoadExtensions.AssertLoaded(in asyncOperation4, l switch { 0 => "EntityStates.JunkCube.DamageSmall", 1 => "EntityStates.JunkCube.DamageMedium", 2 => "EntityStates.JunkCube.DamageLarge", _ => throw new NotImplementedException(), }, "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 786)) { EntityStateConfiguration result3 = asyncOperation4.Result; if (result3.TryGetFieldValue("DamageRadius", out var value5)) { if (result3.TryGetFieldValue("AttackVfxPrefab", out var value6)) { EffectDef orCreateFixedScalingCopy3 = EffectScalingFixer.GetOrCreateFixedScalingCopy(value6, value5); if (orCreateFixedScalingCopy3 != null) { if (result3.TrySetFieldValue("AttackVfxPrefab", orCreateFixedScalingCopy3.prefab)) { flag3 = true; } else { Log.Error("Failed to set EntityStates." + ((Object)result3).name + ".AttackVfxPrefab field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 802); } } } else { Log.Error("Failed to get EntityStates." + ((Object)result3).name + ".AttackVfxPrefab field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 808); } } else { Log.Error("Failed to get EntityStates." + ((Object)result3).name + ".DamageRadius field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 813); } } if (!flag3) { AssetAsyncReferenceManager.UnloadAsset(junkCubeDamageConfigurationReferences[l]); } } } static IEnumerator junkCubeDeathImpactScaleFixAsync(TProgress progressReceiver) where TProgress : IProgress { AssetReferenceT[] junkCubeDeathConfigurationReferences = new AssetReferenceT[3] { new AssetReferenceT(RoR2_DLC3_Drifter.JunkCube_DeathSmall_asset), new AssetReferenceT(RoR2_DLC3_Drifter.JunkCube_DeathMedium_asset), new AssetReferenceT(RoR2_DLC3_Drifter.JunkCube_DeathLarge_asset) }; AsyncOperationHandle[] junkCubeDeathConfigurationLoadHandles = Array.ConvertAll(junkCubeDeathConfigurationReferences, (AssetReferenceT r) => AssetAsyncReferenceManager.LoadAsset(r, (AsyncReferenceHandleUnloadType)2)); ParallelProgressCoroutine val2 = new ParallelProgressCoroutine((IProgress)progressReceiver); AsyncOperationHandle[] array = junkCubeDeathConfigurationLoadHandles; for (int i = 0; i < array.Length; i++) { AsyncOperationHandle asyncOperation = array[i]; val2.Add(in asyncOperation); } yield return val2; for (int j = 0; j < junkCubeDeathConfigurationLoadHandles.Length; j++) { AsyncOperationHandle asyncOperation2 = junkCubeDeathConfigurationLoadHandles[j]; bool flag = false; if (AssetLoadExtensions.AssertLoaded(in asyncOperation2, j switch { 0 => "EntityStates.JunkCube.DeathSmall", 1 => "EntityStates.JunkCube.DeathMedium", 2 => "EntityStates.JunkCube.DeathLarge", _ => throw new NotImplementedException(), }, "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 909)) { EntityStateConfiguration result = asyncOperation2.Result; if (result.TryGetFieldValue("explosionRadius", out var value)) { if (result.TryGetFieldValue("explosionEffectPrefab", out var value2)) { EffectDef orCreateFixedScalingCopy = EffectScalingFixer.GetOrCreateFixedScalingCopy(value2, value); if (orCreateFixedScalingCopy != null) { if (result.TrySetFieldValue("explosionEffectPrefab", orCreateFixedScalingCopy.prefab)) { flag = true; } else { Log.Error("Failed to set EntityStates." + ((Object)result).name + ".explosionEffectPrefab field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 925); } } } else { Log.Error("Failed to get EntityStates." + ((Object)result).name + ".explosionEffectPrefab field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 931); } } else { Log.Error("Failed to get EntityStates." + ((Object)result).name + ".explosionRadius field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 936); } } if (!flag) { AssetAsyncReferenceManager.UnloadAsset(junkCubeDeathConfigurationReferences[j]); } } } static IEnumerator junkCubeLaunchedImpactScaleFixAsync(TProgress progressReceiver) where TProgress : IProgress { AssetReferenceT junkCubeLaunchedConfigurationReference = new AssetReferenceT(RoR2_DLC3_Drifter.EntityStates_JunkCube_Launched_asset); AsyncOperationHandle junkCubeLaunchedConfigurationLoad = AssetAsyncReferenceManager.LoadAsset(junkCubeLaunchedConfigurationReference, (AsyncReferenceHandleUnloadType)2); yield return junkCubeLaunchedConfigurationLoad.AsProgressCoroutine(progressReceiver); bool flag2 = false; if (AssetLoadExtensions.AssertLoaded(in junkCubeLaunchedConfigurationLoad, "EntityStates.JunkCube.Launched", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 836)) { EntityStateConfiguration result2 = junkCubeLaunchedConfigurationLoad.Result; if (result2.TryGetFieldValue("blastRadius", out var value3)) { if (result2.TryGetFieldValue("impactEffectPrefab", out var value4)) { EffectDef orCreateFixedScalingCopy2 = EffectScalingFixer.GetOrCreateFixedScalingCopy(value4, value3); if (orCreateFixedScalingCopy2 != null) { if (result2.TrySetFieldValue("impactEffectPrefab", orCreateFixedScalingCopy2.prefab)) { flag2 = true; } else { Log.Error("Failed to set EntityStates.JunkCube.Launched.impactEffectPrefab field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 852); } } } else { Log.Error("Failed to get EntityStates.JunkCube.Launched.impactEffectPrefab field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 858); } } else { Log.Error("Failed to get EntityStates.JunkCube.Launched.blastRadius field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 863); } } if (!flag2) { AssetAsyncReferenceManager.UnloadAsset(junkCubeLaunchedConfigurationReference); } } static IEnumerator lightningStrikeImpactScaleFixAsync(TProgress progressReceiver) where TProgress : IProgress { AsyncOperationHandle impactEffectLoad2 = AddressableUtil.LoadTempAssetAsync(RoR2_Base_Lightning.LightningStrikeImpact_prefab); yield return impactEffectLoad2.AsProgressCoroutine(progressReceiver); if (AssetLoadExtensions.AssertLoaded(in impactEffectLoad2, "LightningStrikeImpact", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 150)) { EffectDef orCreateFixedScalingCopy16 = EffectScalingFixer.GetOrCreateFixedScalingCopy(impactEffectLoad2.Result, 3f); if (orCreateFixedScalingCopy16 != null) { _lightningStrikeScalingFixPrefab = orCreateFixedScalingCopy16.prefab; } } } static IEnumerator mageFlyUpBlinkScaleFixAsync(TProgress progressReceiver) where TProgress : IProgress { AsyncOperationHandle mageFlyUpStateConfigurationLoad = AddressableUtil.LoadAssetAsync(RoR2_Base_Mage.EntityStates_Mage_FlyUpState_asset, (AsyncReferenceHandleUnloadType)2); yield return mageFlyUpStateConfigurationLoad.AsProgressCoroutine(progressReceiver); if (AssetLoadExtensions.AssertLoaded(in mageFlyUpStateConfigurationLoad, "EntityStates.Mage.FlyUpState", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 727)) { GameObject value8; if (!mageFlyUpStateConfigurationLoad.Result.TryGetFieldValue("blastAttackRadius", out var value7)) { Log.Error("Failed to get EntityStates.Mage.FlyUpState.blastAttackRadius field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 732); } else if (mageFlyUpStateConfigurationLoad.Result.TryGetFieldValue("blinkPrefab", out value8)) { EffectDef orCreateFixedScalingCopy4 = EffectScalingFixer.GetOrCreateFixedScalingCopy(value8, value7); if (orCreateFixedScalingCopy4 != null) { _mageFlyUpBlinkScaleFixPrefab = orCreateFixedScalingCopy4.prefab; } } else { Log.Error("Failed to get EntityStates.Mage.FlyUpState.blinkPrefab field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 746); } } } static IEnumerator meteorStormScaleFixAsync(TProgress progressReceiver) where TProgress : IProgress { AsyncOperationHandle meteorStormLoad = AddressableUtil.LoadTempAssetAsync(RoR2_Base_Meteor.MeteorStorm_prefab); yield return meteorStormLoad.AsProgressCoroutine(progressReceiver); if (AssetLoadExtensions.AssertLoaded(in meteorStormLoad, "MeteorStorm", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 188)) { MeteorStormController component = meteorStormLoad.Result.GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { Log.Error($"Missing MeteorStormController on {meteorStormLoad.Result}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 194); } else { float blastRadius = component.blastRadius; if (Object.op_Implicit((Object)(object)component.warningEffectPrefab)) { EffectDef orCreateFixedScalingCopy12 = EffectScalingFixer.GetOrCreateFixedScalingCopy(component.warningEffectPrefab, blastRadius); if (orCreateFixedScalingCopy12 != null) { _meteorWarningEffectScalingFixPrefab = orCreateFixedScalingCopy12.prefab; } } if (Object.op_Implicit((Object)(object)component.impactEffectPrefab)) { EffectDef orCreateFixedScalingCopy13 = EffectScalingFixer.GetOrCreateFixedScalingCopy(component.impactEffectPrefab, blastRadius); if (orCreateFixedScalingCopy13 != null) { _meteorImpactEffectScalingFixPrefab = orCreateFixedScalingCopy13.prefab; } } if (Object.op_Implicit((Object)(object)component.travelEffectPrefab)) { EffectDef orCreateFixedScalingCopy14 = EffectScalingFixer.GetOrCreateFixedScalingCopy(component.travelEffectPrefab, blastRadius); if (orCreateFixedScalingCopy14 != null) { _meteorTravelEffectScalingFixPrefab = orCreateFixedScalingCopy14.prefab; } } } } } static IEnumerator parentGroundSlamScaleFixAsync(TProgress progressReceiver) where TProgress : IProgress { AssetReferenceT parentGroundSlamClipReference = new AssetReferenceT(RoR2_Base_Parent.mdlParent_fbx_ParentArmature_Slam_); AsyncOperationHandle parentGroundSlamClipLoad = AssetAsyncReferenceManager.LoadAsset(parentGroundSlamClipReference, (AsyncReferenceHandleUnloadType)2); AsyncOperationHandle parentGroundSlamConfigurationLoad = AddressableUtil.LoadTempAssetAsync(RoR2_Base_Parent.EntityStates_ParentMonster_GroundSlam_asset); ParallelProgressCoroutine val4 = new ParallelProgressCoroutine((IProgress)progressReceiver); val4.Add(in parentGroundSlamClipLoad); val4.Add(in parentGroundSlamConfigurationLoad); yield return val4; if (AssetLoadExtensions.AssertLoaded(in parentGroundSlamClipLoad, "ParentArmature|Slam", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 669) && AssetLoadExtensions.AssertLoaded(in parentGroundSlamConfigurationLoad, "EntityStates.ParentMonster.GroundSlam", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 670)) { if (!parentGroundSlamConfigurationLoad.Result.TryGetFieldValue("radius", out var value9)) { Log.Error("Failed to get EntityStates.ParentMonster.GroundSlam.radius field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 677); } else { AnimationEvent[] events = parentGroundSlamClipLoad.Result.events; bool flag4 = false; bool flag5 = false; AnimationEvent[] array3 = events; foreach (AnimationEvent val5 in array3) { if (val5.functionName == "CreateEffect") { Object objectReferenceParameter = val5.objectReferenceParameter; GameObject val6 = (GameObject)(object)((objectReferenceParameter is GameObject) ? objectReferenceParameter : null); if (val6 != null && Object.op_Implicit((Object)(object)val6)) { EffectDef orCreateFixedScalingCopy5 = EffectScalingFixer.GetOrCreateFixedScalingCopy(val6, value9); if (orCreateFixedScalingCopy5 != null) { val5.objectReferenceParameter = (Object)(object)orCreateFixedScalingCopy5.prefab; AnimationEffectSetExplosionScalePatch.SetEncodedExplosionIndex(val5, ExplosionInfoIndex.ParentGroundSlam); flag4 = true; } flag5 = true; } } } if (flag4) { parentGroundSlamClipLoad.Result.events = events; } else { if (!flag5) { Log.Error("Failed to find create impact effect animation event(s) in " + ((Object)parentGroundSlamClipLoad.Result).name, "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 711); } AssetAsyncReferenceManager.UnloadAsset(parentGroundSlamClipReference); } } } } static IEnumerator simpleLightningStrikeImpactScaleFixAsync(TProgress progressReceiver) where TProgress : IProgress { AsyncOperationHandle impactEffectLoad = AddressableUtil.LoadTempAssetAsync(RoR2_Base_LightningStrikeOnHit.SimpleLightningStrikeImpact_prefab); yield return impactEffectLoad.AsProgressCoroutine(progressReceiver); if (AssetLoadExtensions.AssertLoaded(in impactEffectLoad, "SimpleLightningStrikeImpact", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LoadContent", 169)) { EffectDef orCreateFixedScalingCopy15 = EffectScalingFixer.GetOrCreateFixedScalingCopy(impactEffectLoad.Result, 3f); if (orCreateFixedScalingCopy15 != null) { _simpleLightningStrikeScalingFixPrefab = orCreateFixedScalingCopy15.prefab; } } } } [SystemInitializer(new Type[] { typeof(EffectCatalogUtils) })] private static void Init() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Expected O, but got Unknown //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Expected O, but got Unknown //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Expected O, but got Unknown //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Expected O, but got Unknown //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Expected O, but got Unknown //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Expected O, but got Unknown //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Expected O, but got Unknown //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Expected O, but got Unknown //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Expected O, but got Unknown //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Expected O, but got Unknown //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_0489: Expected O, but got Unknown //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Expected O, but got Unknown //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_04c2: Expected O, but got Unknown //IL_04df: Unknown result type (might be due to invalid IL or missing references) //IL_04e9: Expected O, but got Unknown //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_0510: Expected O, but got Unknown //IL_0517: Unknown result type (might be due to invalid IL or missing references) //IL_0521: Expected O, but got Unknown //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_0532: Expected O, but got Unknown //IL_0539: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Expected O, but got Unknown //IL_054a: Unknown result type (might be due to invalid IL or missing references) //IL_0554: Expected O, but got Unknown //IL_055b: Unknown result type (might be due to invalid IL or missing references) //IL_0565: Expected O, but got Unknown //IL_056c: Unknown result type (might be due to invalid IL or missing references) //IL_0576: Expected O, but got Unknown //IL_057d: Unknown result type (might be due to invalid IL or missing references) //IL_0587: Expected O, but got Unknown //IL_058e: Unknown result type (might be due to invalid IL or missing references) //IL_0598: Expected O, but got Unknown //IL_05b5: Unknown result type (might be due to invalid IL or missing references) //IL_05bf: Expected O, but got Unknown //IL_05f2: Unknown result type (might be due to invalid IL or missing references) //IL_05fc: Expected O, but got Unknown //IL_0603: Unknown result type (might be due to invalid IL or missing references) //IL_060d: Expected O, but got Unknown //IL_062a: Unknown result type (might be due to invalid IL or missing references) //IL_0634: Expected O, but got Unknown //IL_063b: Unknown result type (might be due to invalid IL or missing references) //IL_0645: Expected O, but got Unknown //IL_0662: Unknown result type (might be due to invalid IL or missing references) //IL_066c: Expected O, but got Unknown //IL_0689: Unknown result type (might be due to invalid IL or missing references) //IL_0693: Expected O, but got Unknown //IL_069a: Unknown result type (might be due to invalid IL or missing references) //IL_06a4: Expected O, but got Unknown //IL_06ab: Unknown result type (might be due to invalid IL or missing references) //IL_06b5: Expected O, but got Unknown beaconImpactIndicatorScaler(RoR2_Base_Captain.CaptainSupplyDrop__Base_prefab); beaconImpactIndicatorScaler(RoR2_Base_Captain.CaptainSupplyDrop__EquipmentRestock_prefab); beaconImpactIndicatorScaler(RoR2_Base_Captain.CaptainSupplyDrop__Hacking_prefab); beaconImpactIndicatorScaler(RoR2_Base_Captain.CaptainSupplyDrop__Healing_prefab); beaconImpactIndicatorScaler(RoR2_Base_Captain.CaptainSupplyDrop__Plating_prefab); beaconImpactIndicatorScaler(RoR2_Base_Captain.CaptainSupplyDrop__Shocking_prefab); AsyncOperationHandle handle = AddressableUtil.LoadAssetAsync(RoR2_DLC2_FalseSon.FalseSonMeridiansWillIndicator_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject meridiansWillIndicator) { UnityObjectExtensions.EnsureComponent(meridiansWillIndicator); ExplosionRangeIndicatorScaler explosionRangeIndicatorScaler8 = UnityObjectExtensions.EnsureComponent(meridiansWillIndicator); explosionRangeIndicatorScaler8.ExplosionInfoIndex = ExplosionInfoIndex.MeridiansWill; explosionRangeIndicatorScaler8.IndicatorTransforms = (Transform[])(object)new Transform[1] { meridiansWillIndicator.transform }; }); handle = AddressableUtil.LoadAssetAsync(RoR2_Base_Engi.EngiMine_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject engiMinePrefab) { List list2 = new List(); Transform val8 = engiMinePrefab.transform.Find("WeakIndicator"); if (Object.op_Implicit((Object)(object)val8)) { list2.Add(val8); } else { Log.Warning($"Failed to find WeakIndicator transform on {engiMinePrefab}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "Init", 1011); } Transform val9 = engiMinePrefab.transform.Find("StrongIndicator"); if (Object.op_Implicit((Object)(object)val9)) { list2.Add(val9); } else { Log.Warning($"Failed to find StrongIndicator transform on {engiMinePrefab}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "Init", 1021); } ExplosionRangeIndicatorScaler explosionRangeIndicatorScaler7 = default(ExplosionRangeIndicatorScaler); if (list2.Count > 0 && !engiMinePrefab.TryGetComponent(ref explosionRangeIndicatorScaler7)) { explosionRangeIndicatorScaler7 = engiMinePrefab.AddComponent(); explosionRangeIndicatorScaler7.ExplosionInfoIndex = ExplosionInfoIndex.EngiMine; explosionRangeIndicatorScaler7.IndicatorTransforms = list2.ToArray(); } }); handle = AddressableUtil.LoadAssetAsync(RoR2_Base_Captain.CaptainAirstrikeGhost1_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject captainAirstrikeGhostPrefab) { Transform val7 = captainAirstrikeGhostPrefab.transform.Find("Expander"); ExplosionRangeIndicatorScaler explosionRangeIndicatorScaler6 = default(ExplosionRangeIndicatorScaler); if (!Object.op_Implicit((Object)(object)val7)) { Log.Error($"Failed to find Expander child on {captainAirstrikeGhostPrefab}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "Init", 1037); } else if (!captainAirstrikeGhostPrefab.TryGetComponent(ref explosionRangeIndicatorScaler6)) { explosionRangeIndicatorScaler6 = captainAirstrikeGhostPrefab.AddComponent(); explosionRangeIndicatorScaler6.IndicatorTransforms = (Transform[])(object)new Transform[1] { val7 }; } }); handle = AddressableUtil.LoadAssetAsync(RoR2_Base_Captain.CaptainAirstrikeAltGhost_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject captainAirstrikeAltGhostPrefab) { List list = new List(); for (int num = captainAirstrikeAltGhostPrefab.transform.childCount - 1; num >= 0; num--) { list.Add(captainAirstrikeAltGhostPrefab.transform.GetChild(num)); } if (list.Count > 0) { ExplosionRangeIndicatorScaler explosionRangeIndicatorScaler5 = default(ExplosionRangeIndicatorScaler); if (!captainAirstrikeAltGhostPrefab.TryGetComponent(ref explosionRangeIndicatorScaler5)) { explosionRangeIndicatorScaler5 = captainAirstrikeAltGhostPrefab.AddComponent(); explosionRangeIndicatorScaler5.IndicatorTransforms = list.ToArray(); } } else { Log.Warning($"Failed to find indicator transforms for {captainAirstrikeAltGhostPrefab}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "Init", 1067); } }); handle = AddressableUtil.LoadAssetAsync(RoR2_Base_Treebot.TreebotMortar2_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject mortarProjectilePrefab) { Transform val6 = mortarProjectilePrefab.transform.Find("Expander"); ExplosionRangeIndicatorScaler explosionRangeIndicatorScaler4 = default(ExplosionRangeIndicatorScaler); if (!Object.op_Implicit((Object)(object)val6)) { Log.Error($"Failed to find Expander child on {mortarProjectilePrefab}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "Init", 1077); } else if (!mortarProjectilePrefab.TryGetComponent(ref explosionRangeIndicatorScaler4)) { explosionRangeIndicatorScaler4 = mortarProjectilePrefab.AddComponent(); explosionRangeIndicatorScaler4.IndicatorTransforms = (Transform[])(object)new Transform[1] { val6 }; } }); handle = AddressableUtil.LoadAssetAsync(RoR2_DLC2_FalseSon.FalseSonLightningProjectile_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject falseSonLightningProjectilePrefab) { Transform val5 = falseSonLightningProjectilePrefab.transform.Find("TeamAreaIndicator, GroundOnly"); ExplosionRangeIndicatorScaler explosionRangeIndicatorScaler3 = default(ExplosionRangeIndicatorScaler); if (!Object.op_Implicit((Object)(object)val5)) { Log.Error($"Failed to find area indicator child on {falseSonLightningProjectilePrefab}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "Init", 1094); } else if (!falseSonLightningProjectilePrefab.TryGetComponent(ref explosionRangeIndicatorScaler3)) { explosionRangeIndicatorScaler3 = falseSonLightningProjectilePrefab.AddComponent(); explosionRangeIndicatorScaler3.IndicatorTransforms = (Transform[])(object)new Transform[1] { val5 }; } }); handle = AddressableUtil.LoadAssetAsync(RoR2_DLC2_FalseSon.FalseSonLightningPredictGhost_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject falseSonLightningProjectileGhostPrefab) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Invalid comparison between Unknown and I4 //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //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) Transform val3 = falseSonLightningProjectileGhostPrefab.transform.Find("ParticleInitial"); ExplosionRangeIndicatorScaler explosionRangeIndicatorScaler2 = default(ExplosionRangeIndicatorScaler); if (!Object.op_Implicit((Object)(object)val3)) { Log.Error($"Failed to find area indicator child on {falseSonLightningProjectileGhostPrefab}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "Init", 1109); } else if (!falseSonLightningProjectileGhostPrefab.TryGetComponent(ref explosionRangeIndicatorScaler2)) { explosionRangeIndicatorScaler2 = falseSonLightningProjectileGhostPrefab.AddComponent(); explosionRangeIndicatorScaler2.IndicatorTransforms = (Transform[])(object)new Transform[1] { val3 }; ParticleSystem[] componentsInChildren2 = ((Component)val3).GetComponentsInChildren(); foreach (ParticleSystem val4 in componentsInChildren2) { MainModule main2 = val4.main; if ((int)((MainModule)(ref main2)).scalingMode == 1) { ((MainModule)(ref main2)).scalingMode = (ParticleSystemScalingMode)0; Transform transform2 = ((Component)val4).transform; Vector3 localScale2 = ((Component)val4).transform.localScale; Vector3 vector2 = ((Component)val4).transform.lossyScale; transform2.localScale = Vector3.Scale(localScale2, vector2.Inverse()); } } } }); RolyPoly.GearShift += getVisualBlastAttackRadiusManipulator(emitGetEntityStateAttackerBody, strictRadiusMatch: false); YesChef.OnEnter += getSimpleEffectDataScaleManipulator(emitGetEntityStateAttackerBody); YesChef.FixedUpdate += groupManipulators(getSimpleBlastAttackRadiusManipulator(emitGetEntityStateAttackerBody), getSimpleSphereSearchRadiusManipulator(emitGetEntityStateAttackerBody)); BombardmentDroneProjectileEffect.ExecuteRadialAttack += groupManipulators(getSimpleSphereSearchRadiusManipulator(emitGetEntityStateAttackerBody), getSimpleEffectDataScaleManipulator(emitGetEntityStateAttackerBody)); BombardmentDroneSkill.SpawnBombardmentRays += groupManipulators(getSimpleSphereSearchRadiusManipulator(emitGetEntityStateAttackerBody), getSimpleEffectDataScaleManipulator(emitGetEntityStateAttackerBody)); JellyNova.OnEnter += new Manipulator(JellyNova_ReplaceNovaRadius); DeathState.Explode += new Manipulator(JunkCube_DeathState_Explode_ReplaceRadius); FlyUpState.OnEnter += getSimpleBlastAttackRadiusManipulator(emitGetEntityStateAttackerBody); FlyUpState.CreateBlinkEffect += new Manipulator(Mage_FlyUpState_CreateBlinkEffect_ReplaceEffectRadius); Meditate.Update += new Manipulator(Seeker_Meditate_Update_ReplaceRadius); ShockArmor.OnEnter += getSimpleEffectDataScaleManipulator(emitGetEntityStateAttackerBody); ShockArmor.StartShock += getSimpleEffectDataScaleManipulator(emitGetEntityStateAttackerBody); ShockArmor.ApplyShock += getSimpleBlastAttackRadiusManipulator(emitGetEntityStateAttackerBody); ChargeMegaNova.OnEnter += new Manipulator(ChargeMegaNova_ReplaceNovaRadius); ChargeMegaNova.FixedUpdate += new Manipulator(ChargeMegaNova_ReplaceNovaRadius); ChargeState.OnEnter += new Manipulator(VagrantNovaItem_ReplaceBlastRadius); DetonateState.OnEnter += new Manipulator(VagrantNovaItem_ReplaceBlastRadius); FireballVehicle.DetonateServer += getVisualBlastAttackRadiusManipulator(emitGetVehicleSeatPassengerBody); FissureSlamCracksController.DetonateMeteor += getVisualBlastAttackRadiusManipulator(emitGetFissureSlamCracksControllerOwnerBody); FissureSlamCracksController.DoMeteorEffect += getSimpleEffectDataScaleManipulator(emitGetFissureSlamCracksControllerOwnerBody); GlobalEventManager.FrozenExplosion += getVisualBlastAttackRadiusManipulator(emitGetMethodParameterBody); GlobalEventManager.OnHitAllProcess += getVisualBlastAttackRadiusManipulator(emitGetMethodParameterDamageInfoAttackerBody); GlobalEventManager.ProcIgniteOnKill += groupManipulators(getVisualBlastAttackRadiusManipulator(emitGetMethodParameterDamageReportAttackerBody), getSimpleSphereSearchRadiusManipulator(emitGetMethodParameterDamageReportAttackerBody)); JumpDamageStrikeBodyBehavior.GetRadius += new hook_GetRadius(JumpDamageStrikeBodyBehavior_GetRadius_ReplaceRadius); ProjectileExplosion.DetonateServer += getVisualBlastAttackRadiusManipulator(emitGetProjectileOwner); SojournVehicle.EndSojournVehicle += getVisualBlastAttackRadiusManipulator(emitGetVehicleSeatPassengerBody); LegController.DoToeConcussionBlastAuthority += getVisualBlastAttackRadiusManipulator(emitGetVoidRaidCrabLegControllerMainBody); WormBodyPositions2.FireImpactBlastAttack += getVisualBlastAttackRadiusManipulator(emitGetBodyComponentBody); DroneBallShootableController.Start += new hook_Start(DroneBallShootableController_Start_ReplaceRadius); StealthMode.FireSmokebomb += new Manipulator(StealthMode_FireSmokebomb_ReplaceRadius); ProjectileFunballBehavior.FixedUpdate += getVisualBlastAttackRadiusManipulator(emitGetProjectileOwner); HitGroundState.OnEnter += new Manipulator(HitGroundState_OnEnter_ReplaceRadius); ClubGroundSlam.DetonateAuthority += new Manipulator(ClubGroundSlam_DetonateAuthority_ReplaceRadius); ChargedClubSwing.DoBlastAttack += getSimpleBlastAttackRadiusManipulator(emitGetEntityStateAttackerBody); ChargedClubSwing.InitializeBlastAttackAsCharged += new Manipulator(ChargedClubSwing_InitializeBlastAttackAsCharged_ReplaceEffectRadius); MeridiansWillFire.GetHurtBoxs += getSimpleSphereSearchRadiusManipulator(emitGetEntityStateAttackerBody); MeridiansWillAim.OnEnter += new hook_OnEnter(MeridiansWillAim_OnEnter_SetIndicatorOwner); MeridiansWillAim.OnExit += new hook_OnExit(MeridiansWillAim_OnExit_UnsetIndicatorOwner); LightningStrikeOrb.OnArrival += new Manipulator(LightningStrikeOrb_OnArrival_ReplaceRadius); SimpleLightningStrikeOrb.OnArrival += new Manipulator(SimpleLightningStrikeOrb_OnArrival_ReplaceRadius); MeteorStormController.FixedUpdate += new Manipulator(MeteorStormController_FixedUpdate_ReplaceRadius); MeteorStormController.DetonateMeteor += new Manipulator(MeteorStormController_DetonateMeteor_ReplaceRadius); MeteorStormController.DoMeteorEffect += new Manipulator(MeteorStormController_DoMeteorEffect_ReplaceTravelEffectRadius); FistSlam.FixedUpdate += new Manipulator(FistSlam_FixedUpdate_ReplaceRadius); WeaponSlam.FixedUpdate += new Manipulator(WeaponSlam_FixedUpdate_ReplaceRadius); FissureSlam.DetonateAuthority += getSimpleBlastAttackRadiusManipulator(emitGetEntityStateAttackerBody); CorruptedPathsDash.FixedUpdate += new Manipulator(CorruptedPathsDash_FixedUpdate_ReplaceRadius); PrimeDevastator.DetonateAuthority += getSimpleBlastAttackRadiusManipulator(emitGetEntityStateAttackerBody); ClapState.FixedUpdate += getSimpleBlastAttackRadiusManipulator(emitGetEntityStateAttackerBody); FireLaser.OnEnter += new Manipulator(FireLaser_OnEnter_ReplaceRadius); TriLaser.FireTriLaser += new Manipulator(TriLaser_FireTriLaser_ReplaceRadius); BlinkState.ExitCleanup += getSimpleBlastAttackRadiusManipulator(emitGetEntityStateAttackerBody); BlinkState.CreateBlinkEffect += new Manipulator(ImpBoss_BlinkState_CreateBlinkEffect_ReplaceRadius); BlinkState.FixedUpdate += new Manipulator(ImpBoss_BlinkState_FixedUpdate_SetBlinkDestinationEffectOwner); GroundPound.OnEnter += getSimpleBlastAttackRadiusManipulator(emitGetEntityStateAttackerBody); GroundPound.FixedUpdate += new Manipulator(ImpBoss_GroundPound_FixedUpdate_ReplaceEffectRadius); GroundSlam.FixedUpdate += getSimpleBlastAttackRadiusManipulator(emitGetEntityStateAttackerBody); AimThrowableBase.OnEnter += new Manipulator(AimThrowableBase_OnEnter_ReplaceEndpointRadius); LunarStakesLightningController.FireLightning += new Manipulator(LunarStakesLightningController_FixProjectileInitializeDispatch); LunarStakesLightningController.FireLastLightning += new Manipulator(LunarStakesLightningController_FixProjectileInitializeDispatch); EntityStatePatcher.PatcherInfo patcherInfo = default(EntityStatePatcher.PatcherInfo); patcherInfo.Manipulator = getVisualBlastAttackRadiusManipulator(emitGetEntityStateAttackerBody); patcherInfo.ShouldApplyPredicate = matchSetupBlastAttack; EntityStatePatcher.AddPatcher(in patcherInfo); static void beaconImpactIndicatorScaler(string beaconGuid) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle handle2 = AddressableUtil.LoadAssetAsync(beaconGuid, (AsyncReferenceHandleUnloadType)2); handle2.OnSuccess(delegate(GameObject beaconPrefab) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Invalid comparison between Unknown and I4 //IL_006f: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) Transform val = beaconPrefab.transform.Find("Inactive"); if (!Object.op_Implicit((Object)(object)val)) { Log.Error($"Failed to find prediction VFX for beacon prefab: {beaconPrefab}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "Init", 962); } else { ParticleSystem[] componentsInChildren = ((Component)val).GetComponentsInChildren(true); foreach (ParticleSystem val2 in componentsInChildren) { MainModule main = val2.main; if ((int)((MainModule)(ref main)).scalingMode == 1) { ((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)0; Transform transform = ((Component)val2).transform; Vector3 localScale = ((Component)val2).transform.localScale; Vector3 vector = ((Component)val2).transform.lossyScale; transform.localScale = Vector3.Scale(localScale, vector.Inverse()); } } ExplosionRangeIndicatorScaler explosionRangeIndicatorScaler = UnityObjectExtensions.EnsureComponent(beaconPrefab); explosionRangeIndicatorScaler.ExplosionInfoIndex = ExplosionInfoIndex.CaptainSupplyDropImpact; explosionRangeIndicatorScaler.IndicatorTransforms = (Transform[])(object)new Transform[1] { val }; } }); } } private static bool matchLoadValue(Instruction x, out Instruction instruction) { MethodReference val = default(MethodReference); FieldReference val2 = default(FieldReference); int num = default(int); float num2 = default(float); if (ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val) || ILPatternMatchingExt.MatchLdsfld(x, ref val2) || ILPatternMatchingExt.MatchLdfld(x, ref val2) || ILPatternMatchingExt.MatchLdloc(x, ref num) || ILPatternMatchingExt.MatchLdarg(x, ref num) || ILPatternMatchingExt.MatchLdcR4(x, ref num2)) { instruction = x; return true; } instruction = null; return false; } private static bool instructionsEqual(Instruction a, Instruction b) { float num = default(float); if (ILPatternMatchingExt.MatchLdcR4(a, ref num)) { return ILPatternMatchingExt.MatchLdcR4(b, num); } int num2 = default(int); if (ILPatternMatchingExt.MatchLdarg(a, ref num2)) { return ILPatternMatchingExt.MatchLdarg(b, num2); } int num3 = default(int); if (ILPatternMatchingExt.MatchLdloc(a, ref num3)) { return ILPatternMatchingExt.MatchLdloc(b, num3); } FieldReference val = default(FieldReference); if (ILPatternMatchingExt.MatchLdfld(a, ref val)) { FieldReference val2 = default(FieldReference); if (ILPatternMatchingExt.MatchLdfld(b, ref val2)) { return ((MemberReference)val).FullName == ((MemberReference)val2).FullName; } return false; } FieldReference val3 = default(FieldReference); if (ILPatternMatchingExt.MatchLdsfld(a, ref val3)) { FieldReference val4 = default(FieldReference); if (ILPatternMatchingExt.MatchLdsfld(b, ref val4)) { return ((MemberReference)val3).FullName == ((MemberReference)val4).FullName; } return false; } MethodReference val5 = default(MethodReference); if (ILPatternMatchingExt.MatchCallOrCallvirt(a, ref val5)) { MethodReference val6 = default(MethodReference); if (ILPatternMatchingExt.MatchCallOrCallvirt(b, ref val6)) { return ((MemberReference)val5).FullName == ((MemberReference)val6).FullName; } return false; } return false; } private static bool matchSetupBlastAttack(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown ILCursor val = new ILCursor(il); Instruction loadRadiusValueInstruction = null; if (!val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => matchLoadValue(x, out loadRadiusValueInstruction), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "radius") })) { return false; } Func[] array = new Func[2] { (Instruction x) => instructionsEqual(x, loadRadiusValueInstruction), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "scale") }; if (!val.TryGotoNext(array)) { return val.TryGotoPrev(array); } return true; } private static void JellyNova_ReplaceNovaRadius(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_000c: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int num = 0; while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "novaRadius") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getRadius); num++; } if (num == 0) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "JellyNova_ReplaceNovaRadius", 1337); } static float getRadius(float radius, EntityState entityState) { return GetExplosionRadius(radius, (entityState != null) ? entityState.characterBody : null); } } private static void ChargeMegaNova_ReplaceNovaRadius(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_000c: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int num = 0; while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "novaRadius") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getRadius); num++; } if (num == 0) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "ChargeMegaNova_ReplaceNovaRadius", 1367); } static float getRadius(float radius, EntityState entityState) { return GetExplosionRadius(radius, (entityState != null) ? entityState.characterBody : null); } } private static void VagrantNovaItem_ReplaceBlastRadius(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_000c: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int num = 0; while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "blastRadius") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getRadius); num++; } if (num == 0) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "VagrantNovaItem_ReplaceBlastRadius", 1397); } static float getRadius(float radius, EntityState entityState) { return GetExplosionRadius(radius, (entityState != null) ? entityState.characterBody : null); } } private static float JumpDamageStrikeBodyBehavior_GetRadius_ReplaceRadius(orig_GetRadius orig, JumpDamageStrikeBodyBehavior self, int charge, int stacks) { return GetExplosionRadius(orig.Invoke(self, charge, stacks), ((BaseItemBodyBehavior)self).body); } private static void DroneBallShootableController_Start_ReplaceRadius(orig_Start orig, DroneBallShootableController self) { ProjectileController val = default(ProjectileController); CharacterBody attacker = default(CharacterBody); if (Object.op_Implicit((Object)(object)self) && ((Component)self).TryGetComponent(ref val) && Object.op_Implicit((Object)(object)val.owner) && val.owner.TryGetComponent(ref attacker)) { self.minRadius = GetExplosionRadius(self.minRadius, attacker); self.maxRadius = GetExplosionRadius(self.maxRadius, attacker); } orig.Invoke(self); } private static void StealthMode_FireSmokebomb_ReplaceRadius(ILContext il) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_00a8: 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) getSimpleBlastAttackRadiusManipulator(emitGetEntityStateAttackerBody).Invoke(il); ILCursor val = new ILCursor(il); ILLabel afterSpawnBlastEffectLabel = null; if (!val.TryGotoNext((MoveType)1, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "smokeBombEffectPrefab"), (Instruction x) => x.MatchImplicitConversion(), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref afterSpawnBlastEffectLabel) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "StealthMode_FireSmokebomb_ReplaceRadius", 1436); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)trySpawnEffectScaled); val.Emit(OpCodes.Brtrue, (object)afterSpawnBlastEffectLabel); static bool trySpawnEffectScaled(StealthMode stealthMode) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)_banditSmokeBombScalingFixPrefab)) { return false; } if (!isScaledExplosion(StealthMode.blastAttackRadius, (stealthMode != null) ? ((EntityState)stealthMode).characterBody : null)) { return false; } spawnEffectAtMuzzle(_banditSmokeBombScalingFixPrefab, new EffectData { scale = GetExplosionRadius(StealthMode.blastAttackRadius, ((EntityState)stealthMode).characterBody) }, ((EntityState)stealthMode).gameObject, StealthMode.smokeBombMuzzleString, transmit: false); return true; } } private static void HitGroundState_OnEnter_ReplaceRadius(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); int num = 0; while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "impactBulletRadius") })) { emitGetEntityStateAttackerBody(val); val.EmitDelegate>((Func)GetExplosionRadius); num++; } if (num == 0) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "HitGroundState_OnEnter_ReplaceRadius", 1478); } } private static void ClubGroundSlam_DetonateAuthority_ReplaceRadius(ILContext il) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown if (simpleBlastAttackRadiusManipulator(il, emitGetEntityStateAttackerBody)) { ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "blastVFXScaleMultiplier"), (Instruction x) => ILPatternMatchingExt.MatchMul(x) })) { Log.Error("Failed to find effect scale patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "ClubGroundSlam_DetonateAuthority_ReplaceRadius", 1497); return; } emitGetEntityStateAttackerBody(val); val.EmitDelegate>((Func)GetExplosionRadius); } } private static void ChargedClubSwing_InitializeBlastAttackAsCharged_ReplaceEffectRadius(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((MoveType)2, new Func[4] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "charge"), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "blastVFXScaleMultiplier"), (Instruction x) => ILPatternMatchingExt.MatchMul(x) })) { Log.Error("Failed to find effect scale patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "ChargedClubSwing_InitializeBlastAttackAsCharged_ReplaceEffectRadius", 1515); return; } emitGetEntityStateAttackerBody(val); val.EmitDelegate>((Func)GetExplosionRadius); } private static void MeridiansWillAim_OnEnter_SetIndicatorOwner(orig_OnEnter orig, MeridiansWillAim self) { orig.Invoke(self); try { GenericOwnership val = default(GenericOwnership); if (Object.op_Implicit((Object)(object)self?.areaIndicatorInstance) && self.areaIndicatorInstance.TryGetComponent(ref val)) { val.ownerObject = ((EntityState)self).gameObject; } } catch (Exception ex) { Log.Error_NoCallerPrefix(ex.ToString()); } } private static void MeridiansWillAim_OnExit_UnsetIndicatorOwner(orig_OnExit orig, MeridiansWillAim self) { try { GenericOwnership val = default(GenericOwnership); if (Object.op_Implicit((Object)(object)self?.areaIndicatorInstance) && self.areaIndicatorInstance.TryGetComponent(ref val)) { val.ownerObject = null; } } catch (Exception ex) { Log.Error_NoCallerPrefix(ex.ToString()); } orig.Invoke(self); } private static void LightningStrikeOrb_OnArrival_ReplaceRadius(ILContext il) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_008a: 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_0100: Unknown result type (might be due to invalid IL or missing references) if (!simpleBlastAttackRadiusManipulator(il, emitGetOrbOwnerBody)) { return; } ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Prefabs/Effects/ImpactEffects/LightningStrikeImpact"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(OrbStorageUtility), "Get") })) { Log.Error("Failed to find impact prefab patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LightningStrikeOrb_OnArrival_ReplaceRadius", 1568); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getImpactPrefab); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchNewobj(x) })) { Log.Error("Failed to find impact effect patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LightningStrikeOrb_OnArrival_ReplaceRadius", 1592); return; } val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Action)populateImpactEffect); static GameObject getImpactPrefab(GameObject prefab, LightningStrikeOrb self) { if (!isScaledImpact(self) || !Object.op_Implicit((Object)(object)_lightningStrikeScalingFixPrefab)) { return prefab; } return _lightningStrikeScalingFixPrefab; } static bool isScaledImpact(LightningStrikeOrb self) { CharacterBody attacker2 = (Object.op_Implicit((Object)(object)((GenericDamageOrb)(self?)).attacker) ? ((GenericDamageOrb)self).attacker.GetComponent() : null); return Mathf.Abs(GetExplosionRadius(3f, attacker2) / 3f - 1f) > Mathf.Epsilon; } static void populateImpactEffect(EffectData effectData, LightningStrikeOrb self) { if (isScaledImpact(self)) { CharacterBody attacker = (Object.op_Implicit((Object)(object)((GenericDamageOrb)(self?)).attacker) ? ((GenericDamageOrb)self).attacker.GetComponent() : null); effectData.scale = GetExplosionRadius(3f, attacker); } } } private static void SimpleLightningStrikeOrb_OnArrival_ReplaceRadius(ILContext il) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_008a: 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_0100: Unknown result type (might be due to invalid IL or missing references) if (!simpleBlastAttackRadiusManipulator(il, emitGetOrbOwnerBody)) { return; } ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Prefabs/Effects/ImpactEffects/SimpleLightningStrikeImpact"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(OrbStorageUtility), "Get") })) { Log.Error("Failed to find impact prefab patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "SimpleLightningStrikeOrb_OnArrival_ReplaceRadius", 1621); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getImpactPrefab); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchNewobj(x) })) { Log.Error("Failed to find impact effect patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "SimpleLightningStrikeOrb_OnArrival_ReplaceRadius", 1647); return; } val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Action)populateImpactEffect); static GameObject getImpactPrefab(GameObject prefab, SimpleLightningStrikeOrb self) { if (!isScaledImpact(self) || !Object.op_Implicit((Object)(object)_simpleLightningStrikeScalingFixPrefab)) { return prefab; } return _simpleLightningStrikeScalingFixPrefab; } static bool isScaledImpact(SimpleLightningStrikeOrb self) { CharacterBody val2 = (Object.op_Implicit((Object)(object)((GenericDamageOrb)(self?)).attacker) ? ((GenericDamageOrb)self).attacker.GetComponent() : null); if (!Object.op_Implicit((Object)(object)val2)) { return false; } return Mathf.Abs(GetExplosionRadius(3f, val2) / 3f - 1f) > Mathf.Epsilon; } static void populateImpactEffect(EffectData effectData, SimpleLightningStrikeOrb self) { if (isScaledImpact(self)) { CharacterBody attacker = (Object.op_Implicit((Object)(object)((GenericDamageOrb)(self?)).attacker) ? ((GenericDamageOrb)self).attacker.GetComponent() : null); effectData.scale = GetExplosionRadius(3f, attacker); } } } private static void MeteorStormController_ReplaceRadius(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); int num = 0; while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "blastRadius") })) { emitGetMeteorStormControllerOwner(val); val.EmitDelegate>((Func)GetExplosionRadius); num++; } if (num == 0) { Log.Error(((MemberReference)il.Method).FullName + ": Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "MeteorStormController_ReplaceRadius", 1682); } } private static void MeteorStormController_FixedUpdate_ReplaceRadius(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) MeteorStormController_ReplaceRadius(il); ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "warningEffectPrefab") })) { Log.Error("Failed to find warning prefab patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "MeteorStormController_FixedUpdate_ReplaceRadius", 1699); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getWarningPrefab); static GameObject getWarningPrefab(GameObject prefab, MeteorStormController self) { if (!isScaledImpact(self) || !Object.op_Implicit((Object)(object)_meteorWarningEffectScalingFixPrefab)) { return prefab; } return _meteorWarningEffectScalingFixPrefab; } static bool isScaledImpact(MeteorStormController self) { if (!Object.op_Implicit((Object)(object)self)) { return false; } CharacterBody attacker = (Object.op_Implicit((Object)(object)self.owner) ? self.owner.GetComponent() : null); return Mathf.Abs(GetExplosionRadius(self.blastRadius, attacker) / self.blastRadius - 1f) > Mathf.Epsilon; } } private static void MeteorStormController_DetonateMeteor_ReplaceRadius(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) MeteorStormController_ReplaceRadius(il); ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "impactEffectPrefab") })) { Log.Error("Failed to find impact prefab patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "MeteorStormController_DetonateMeteor_ReplaceRadius", 1733); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getImpactPrefab); if (!val.TryGotoPrev((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchNewobj(x) })) { Log.Error("Failed to find impact effect patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "MeteorStormController_DetonateMeteor_ReplaceRadius", 1760); return; } val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Action)populateImpactEffect); static GameObject getImpactPrefab(GameObject prefab, MeteorStormController self) { if (!isScaledImpact(self) || !Object.op_Implicit((Object)(object)_meteorImpactEffectScalingFixPrefab)) { return prefab; } return _meteorImpactEffectScalingFixPrefab; } static bool isScaledImpact(MeteorStormController self) { if (!Object.op_Implicit((Object)(object)self)) { return false; } CharacterBody attacker2 = (Object.op_Implicit((Object)(object)self.owner) ? self.owner.GetComponent() : null); return Mathf.Abs(GetExplosionRadius(self.blastRadius, attacker2) / self.blastRadius - 1f) > Mathf.Epsilon; } static void populateImpactEffect(EffectData effectData, MeteorStormController self) { if (Object.op_Implicit((Object)(object)self) && isScaledImpact(self)) { CharacterBody attacker = (Object.op_Implicit((Object)(object)self.owner) ? self.owner.GetComponent() : null); effectData.scale = GetExplosionRadius(self.blastRadius, attacker); } } } private static void MeteorStormController_DoMeteorEffect_ReplaceTravelEffectRadius(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0053: 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_00c9: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "travelEffectPrefab") })) { Log.Error("Failed to find travel prefab patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "MeteorStormController_DoMeteorEffect_ReplaceTravelEffectRadius", 1786); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getTravelEffectPrefab); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchNewobj(x) })) { Log.Error("Failed to find travel effect patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "MeteorStormController_DoMeteorEffect_ReplaceTravelEffectRadius", 1813); return; } val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Action)populateTravelEffect); static GameObject getTravelEffectPrefab(GameObject prefab, MeteorStormController self) { if (!isScaledImpact(self) || !Object.op_Implicit((Object)(object)_meteorTravelEffectScalingFixPrefab)) { return prefab; } return _meteorTravelEffectScalingFixPrefab; } static bool isScaledImpact(MeteorStormController self) { if (!Object.op_Implicit((Object)(object)self)) { return false; } CharacterBody attacker2 = (Object.op_Implicit((Object)(object)self.owner) ? self.owner.GetComponent() : null); return Mathf.Abs(GetExplosionRadius(self.blastRadius, attacker2) / self.blastRadius - 1f) > Mathf.Epsilon; } static void populateTravelEffect(EffectData effectData, MeteorStormController self) { if (Object.op_Implicit((Object)(object)self) && isScaledImpact(self)) { CharacterBody attacker = (Object.op_Implicit((Object)(object)self.owner) ? self.owner.GetComponent() : null); effectData.scale = GetExplosionRadius(self.blastRadius, attacker); } } } private static void FistSlam_FixedUpdate_ReplaceRadius(ILContext il) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) if (simpleBlastAttackRadiusManipulator(il, emitGetEntityStateAttackerBody)) { ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "slamImpactEffect"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(EffectManager), "SimpleMuzzleFlash") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "FistSlam_FixedUpdate_ReplaceRadius", 1842); return; } val.Goto(array[1].Next, (MoveType)2, false); ILLabel val2 = val.MarkLabel(); val.Goto(array[0].Next, (MoveType)1, false); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)trySpawnScaledEffect); val.Emit(OpCodes.Brtrue, (object)val2); } static bool trySpawnScaledEffect(FistSlam self) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown if (!isScaledExplosion(FistSlam.radius, (self != null) ? ((EntityState)self).characterBody : null) || !Object.op_Implicit((Object)(object)_brotherFistSlamImpactScaleFixPrefab)) { return false; } spawnEffectAtMuzzle(_banditSmokeBombScalingFixPrefab, new EffectData { scale = GetExplosionRadius(FistSlam.radius, ((EntityState)self).characterBody) }, ((EntityState)self).gameObject, FistSlam.muzzleString, transmit: false); return true; } } private static void WeaponSlam_FixedUpdate_ReplaceRadius(ILContext il) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) if (simpleBlastAttackRadiusManipulator(il, emitGetEntityStateAttackerBody)) { ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "slamImpactEffect"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(EffectManager), "SimpleMuzzleFlash") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "WeaponSlam_FixedUpdate_ReplaceRadius", 1880); return; } val.Goto(array[1].Next, (MoveType)2, false); ILLabel val2 = val.MarkLabel(); val.Goto(array[0].Next, (MoveType)1, false); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)trySpawnScaledEffect); val.Emit(OpCodes.Brtrue, (object)val2); } static bool trySpawnScaledEffect(WeaponSlam self) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown if (!isScaledExplosion(WeaponSlam.radius, (self != null) ? ((EntityState)self).characterBody : null) || !Object.op_Implicit((Object)(object)_brotherWeaponSlamImpactScaleFixPrefab)) { return false; } spawnEffectAtMuzzle(_banditSmokeBombScalingFixPrefab, new EffectData { scale = GetExplosionRadius(WeaponSlam.radius, ((EntityState)self).characterBody) }, ((EntityState)self).gameObject, WeaponSlam.muzzleString, transmit: false); return true; } } private static void CorruptedPathsDash_FixedUpdate_ReplaceRadius(ILContext il) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0068: 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) if (simpleBlastAttackRadiusManipulator(il, emitGetEntityStateAttackerBody)) { ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "scale") })) { Log.Error("Failed to find effect scale patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "CorruptedPathsDash_FixedUpdate_ReplaceRadius", 1919); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getScaleMultiplier); val.Emit(OpCodes.Mul); } static float getScaleMultiplier(CorruptedPathsDash corruptedPathsDash) { if (!Object.op_Implicit((Object)(object)((corruptedPathsDash != null) ? ((EntityState)corruptedPathsDash).characterBody : null))) { return 1f; } return GetExplosionRadius(20f, ((EntityState)corruptedPathsDash).characterBody) / 20f; } } private static void FireLaser_OnEnter_ReplaceRadius(ILContext il) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_00a7: 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) if (simpleBlastAttackRadiusManipulator(il, emitGetEntityStateAttackerBody)) { ILCursor val = new ILCursor(il); VariableDefinition effectDataVar = null; ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "hitEffectPrefab"), (Instruction x) => x.MatchLdloc(typeof(EffectData), il, out effectDataVar) })) { Log.Error("Failed to find hit effect scale patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "FireLaser_OnEnter_ReplaceRadius", 1949); return; } val.Goto(array[0].Next, (MoveType)2, false); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getHitEffectPrefab); val.Goto(array[1].Next, (MoveType)2, false); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getHitEffectData); } static EffectData getHitEffectData(EffectData effectData, FireLaser self) { if (isScaledExplosion(FireLaser.blastRadius, (self != null) ? ((EntityState)self).characterBody : null)) { effectData = effectData.Clone(); effectData.scale = GetExplosionRadius(FireLaser.blastRadius, ((EntityState)self).characterBody); } return effectData; } static GameObject getHitEffectPrefab(GameObject prefab, FireLaser self) { if (!isScaledExplosion(FireLaser.blastRadius, (self != null) ? ((EntityState)self).characterBody : null) || !Object.op_Implicit((Object)(object)_golemLaserImpactScaleFixPrefab)) { return prefab; } return _golemLaserImpactScaleFixPrefab; } } private static void TriLaser_FireTriLaser_ReplaceRadius(ILContext il) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_00a7: 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) if (simpleBlastAttackRadiusManipulator(il, emitGetEntityStateAttackerBody)) { ILCursor val = new ILCursor(il); VariableDefinition effectDataVar = null; ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "hitEffectPrefab"), (Instruction x) => x.MatchLdloc(typeof(EffectData), il, out effectDataVar) })) { Log.Error("Failed to find hit effect scale patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "TriLaser_FireTriLaser_ReplaceRadius", 1990); return; } val.Goto(array[0].Next, (MoveType)2, false); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getHitEffectPrefab); val.Goto(array[1].Next, (MoveType)2, false); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getHitEffectData); } static EffectData getHitEffectData(EffectData effectData, TriLaser self) { if (isScaledExplosion(TriLaser.blastRadius, (self != null) ? ((EntityState)self).characterBody : null)) { effectData = effectData.Clone(); effectData.scale = GetExplosionRadius(TriLaser.blastRadius, ((EntityState)self).characterBody); } return effectData; } static GameObject getHitEffectPrefab(GameObject prefab, TriLaser self) { if (!isScaledExplosion(TriLaser.blastRadius, (self != null) ? ((EntityState)self).characterBody : null) || !Object.op_Implicit((Object)(object)_halcyoniteTriLaserImpactScaleFixPrefab)) { return prefab; } return _halcyoniteTriLaserImpactScaleFixPrefab; } } private static void ImpBoss_BlinkState_CreateBlinkEffect_ReplaceRadius(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "set_origin") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Action)trySetEffectDataScale); } else { Log.Error("Failed to find blink effect scale set patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "ImpBoss_BlinkState_CreateBlinkEffect_ReplaceRadius", 2039); } if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "blinkPrefab") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getBlinkPrefab); } else { Log.Error("Failed to find blink effect prefab patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "ImpBoss_BlinkState_CreateBlinkEffect_ReplaceRadius", 2055); } static GameObject getBlinkPrefab(GameObject blinkPrefab, BlinkState self) { if (self == null || !isScaledExplosion(self.blastAttackRadius, ((EntityState)self).characterBody) || !Object.op_Implicit((Object)(object)_impBossBlinkScaleFixPrefab)) { return blinkPrefab; } return _impBossBlinkScaleFixPrefab; } static void trySetEffectDataScale(BlinkState self) { if (self != null && self._effectData != null) { self._effectData.scale = GetExplosionRadius(self.blastAttackRadius, ((EntityState)self).characterBody); } } } private static void ImpBoss_BlinkState_FixedUpdate_SetBlinkDestinationEffectOwner(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILLabel afterInstantiateBlinkDestinationInstanceLabel = null; if (!val.TryGotoNext((MoveType)0, new Func[4] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "blinkDestinationPrefab"), (Instruction x) => x.MatchImplicitConversion(), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref afterInstantiateBlinkDestinationInstanceLabel) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "ImpBoss_BlinkState_FixedUpdate_SetBlinkDestinationEffectOwner", 2070); return; } val.Goto(afterInstantiateBlinkDestinationInstanceLabel.Target, (MoveType)0, false); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Action)setBlinkDestinationEffectOwner); static void setBlinkDestinationEffectOwner(BlinkState self) { LocalEffectOwnership localEffectOwnership = default(LocalEffectOwnership); if (Object.op_Implicit((Object)(object)self?.blinkDestinationInstance) && self.blinkDestinationInstance.TryGetComponent(ref localEffectOwnership)) { CharacterBody val2 = entityStateGetAttackerBody((EntityState)(object)self); localEffectOwnership.OwnerObject = (Object.op_Implicit((Object)(object)val2) ? ((Component)val2).gameObject : ((EntityState)self).gameObject); } } } private static void ImpBoss_GroundPound_FixedUpdate_ReplaceEffectRadius(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "slamEffectPrefab"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(EffectManager), "SimpleMuzzleFlash") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "ImpBoss_GroundPound_FixedUpdate_ReplaceEffectRadius", 2097); return; } val.Goto(array[1].Next, (MoveType)2, false); ILLabel val2 = val.MarkLabel(); val.Goto(array[0].Next, (MoveType)1, false); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)trySpawnScaledEffect); val.Emit(OpCodes.Brtrue, (object)val2); static bool trySpawnScaledEffect(GroundPound self) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown if (!isScaledExplosion(GroundPound.blastAttackRadius, (self != null) ? ((EntityState)self).characterBody : null) || !Object.op_Implicit((Object)(object)_impBossGroundPoundSlamScaleFixPrefab)) { return false; } spawnEffectAtMuzzle(_impBossGroundPoundSlamScaleFixPrefab, new EffectData { scale = GetExplosionRadius(GroundPound.blastAttackRadius, ((EntityState)self).characterBody) }, ((EntityState)self).gameObject, "GroundPoundCenter", transmit: true); return true; } } private static void Mage_FlyUpState_CreateBlinkEffect_ReplaceEffectRadius(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); VariableDefinition effectDataVar = null; if (val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchNewobj(x), (Instruction x) => x.MatchStloc(typeof(EffectData), il, out effectDataVar) })) { val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc, effectDataVar); val.EmitDelegate>((Action)trySetEffectDataScale); } else { Log.Error("Failed to find blink effect scale set patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "Mage_FlyUpState_CreateBlinkEffect_ReplaceEffectRadius", 2150); } if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "blinkPrefab") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getBlinkPrefab); } else { Log.Error("Failed to find blink effect prefab patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "Mage_FlyUpState_CreateBlinkEffect_ReplaceEffectRadius", 2166); } static GameObject getBlinkPrefab(GameObject blinkPrefab, FlyUpState self) { if (self == null || !isScaledExplosion(FlyUpState.blastAttackRadius, ((EntityState)self).characterBody) || !Object.op_Implicit((Object)(object)_mageFlyUpBlinkScaleFixPrefab)) { return blinkPrefab; } return _mageFlyUpBlinkScaleFixPrefab; } static void trySetEffectDataScale(FlyUpState self, EffectData effectData) { if (self != null && effectData != null) { effectData.scale = GetExplosionRadius(FlyUpState.blastAttackRadius, ((EntityState)self).characterBody); } } } private static void Seeker_Meditate_Update_ReplaceRadius(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); int num = 0; while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "blastRadius") })) { emitGetEntityStateAttackerBody(val); val.EmitDelegate>((Func)GetExplosionRadius); num++; } if (num == 0) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "Seeker_Meditate_Update_ReplaceRadius", 2187); } } private static void JunkCube_DeathState_Explode_ReplaceRadius(ILContext il) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) if (simpleBlastAttackRadiusManipulator(il, emitGetEntityStateAttackerBody)) { ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchNewobj(x) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "JunkCube_DeathState_Explode_ReplaceRadius", 2205); return; } val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Action)setEffectScale); } static void setEffectScale(EffectData effectData, DeathState self) { if (effectData != null && self != null) { effectData.scale = GetExplosionRadius(self.explosionRadius, entityStateGetAttackerBody((EntityState)(object)self)); } } } private static void AimThrowableBase_OnEnter_ReplaceEndpointRadius(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int projectileExplosionComponentVarIndex = -1; if (!val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref projectileExplosionComponentVarIndex), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "blastRadius") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "AimThrowableBase_OnEnter_ReplaceEndpointRadius", 2231); return; } emitGetEntityStateAttackerBody(val); val.Emit(OpCodes.Ldloc, projectileExplosionComponentVarIndex); val.EmitDelegate>((Func)getImpactExplosionRadius); static float getImpactExplosionRadius(float radius, CharacterBody attackerBody, ProjectileExplosion projectileExplosionPrefabComponent) { if (!Object.op_Implicit((Object)(object)projectileExplosionPrefabComponent) || !((Behaviour)projectileExplosionPrefabComponent).enabled) { return radius; } return GetExplosionRadius(radius, attackerBody); } } private static void LunarStakesLightningController_FixProjectileInitializeDispatch(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)1, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(NetworkServer), "Spawn") })) { Log.Error(((MemberReference)il.Method).FullName + ": Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "LunarStakesLightningController_FixProjectileInitializeDispatch", 2256); return; } val.Emit(OpCodes.Dup); val.EmitDelegate>((Action)dispatchOnInitialized); static void dispatchOnInitialized(GameObject projectileObj) { ProjectileController val2 = default(ProjectileController); if (Object.op_Implicit((Object)(object)projectileObj) && projectileObj.TryGetComponent(ref val2)) { val2.DispatchOnInitialized(); } } } private static Manipulator groupManipulators(params Manipulator[] manipulators) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown return (Manipulator)delegate(ILContext il) { Manipulator[] array = manipulators; for (int i = 0; i < array.Length; i++) { array[i].Invoke(il); } }; } private static CharacterBody entityStateGetAttackerBody(EntityState entityState) { if (entityState == null) { return null; } NetworkedBodyAttachment val = default(NetworkedBodyAttachment); GenericOwnership val2 = default(GenericOwnership); DroneCommandReceiver val3 = default(DroneCommandReceiver); DestructibleSpawerDynamiteController val4 = default(DestructibleSpawerDynamiteController); JunkCubeController val5 = default(JunkCubeController); if (Object.op_Implicit((Object)(object)entityState.projectileController)) { GameObject owner = entityState.projectileController.owner; CharacterBody result = default(CharacterBody); if (Object.op_Implicit((Object)(object)owner) && owner.TryGetComponent(ref result)) { return result; } } else if (entityState.TryGetComponent(ref val)) { CharacterBody attachedBody = val.attachedBody; if (Object.op_Implicit((Object)(object)attachedBody)) { return attachedBody; } } else if (entityState.TryGetComponent(ref val2)) { GameObject ownerObject = val2.ownerObject; CharacterBody result2 = default(CharacterBody); if (Object.op_Implicit((Object)(object)ownerObject) && ownerObject.TryGetComponent(ref result2)) { return result2; } } else if (entityState.TryGetComponent(ref val3)) { CharacterBody leaderBody = val3.leaderBody; if (Object.op_Implicit((Object)(object)leaderBody)) { return leaderBody; } } else if (entityState.TryGetComponent(ref val4)) { GameObject owner2 = val4.owner; CharacterBody result3 = default(CharacterBody); if (Object.op_Implicit((Object)(object)owner2) && owner2.TryGetComponent(ref result3)) { return result3; } } else if (entityState.TryGetComponent(ref val5)) { GameObject owner3 = val5.owner; CharacterBody result4 = default(CharacterBody); if (Object.op_Implicit((Object)(object)owner3) && owner3.TryGetComponent(ref result4)) { return result4; } } return entityState.characterBody; } private static void emitGetEntityStateAttackerBody(ILCursor c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) c.Emit(OpCodes.Ldarg_0); c.EmitDelegate>((Func)entityStateGetAttackerBody); } private static T tryGetAsComponent(Component component) where T : Component { if (Object.op_Implicit((Object)(object)component)) { T val = (T)(object)((component is T) ? component : null); if (val != null || component.TryGetComponent(ref val)) { return val; } } return default(T); } private static void emitGetVehicleSeatPassengerBody(ILCursor c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) c.Emit(OpCodes.Ldarg_0); c.EmitDelegate>((Func)getPassenger); static CharacterBody getPassenger(MonoBehaviour component) { VehicleSeat val = tryGetAsComponent((Component)(object)component); if (!Object.op_Implicit((Object)(object)val)) { return null; } return val.currentPassengerBody; } } private static void emitGetBodyComponentBody(ILCursor c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) c.Emit(OpCodes.Ldarg_0); c.EmitDelegate>((Func)getBody); static CharacterBody getBody(MonoBehaviour component) { return tryGetAsComponent((Component)(object)component); } } private static void emitGetMethodParameterBody(ILCursor c) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (((MethodReference)(object)c.Context.Method).TryFindParameter(out var parameter)) { c.Emit(OpCodes.Ldarg, parameter); return; } Log.Error("Failed to find body parameter for " + ((MemberReference)c.Context.Method).FullName, "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "emitGetMethodParameterBody", 2388); c.Emit(OpCodes.Ldnull); } private static void emitGetMethodParameterDamageInfoAttackerBody(ILCursor c) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (((MethodReference)(object)c.Context.Method).TryFindParameter(out var parameter)) { c.Emit(OpCodes.Ldarg, parameter); c.EmitDelegate>((Func)getAttackerBody); } else { Log.Error("Failed to find DamageInfo parameter for " + ((MemberReference)c.Context.Method).FullName, "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "emitGetMethodParameterDamageInfoAttackerBody", 2407); c.Emit(OpCodes.Ldnull); } static CharacterBody getAttackerBody(DamageInfo damageInfo) { if (!Object.op_Implicit((Object)(object)damageInfo?.attacker)) { return null; } return damageInfo.attacker.GetComponent(); } } private static void emitGetMethodParameterDamageReportAttackerBody(ILCursor c) { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) FieldInfo field = typeof(DamageReport).GetField("attackerBody", BindingFlags.Instance | BindingFlags.Public); if (field == null) { Log.Warning("Failed to find DamageReport.attackerBody field", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "emitGetMethodParameterDamageReportAttackerBody", 2417); } if (((MethodReference)(object)c.Context.Method).TryFindParameter(out var parameter)) { c.Emit(OpCodes.Ldarg, parameter); if (field != null) { c.Emit(OpCodes.Ldfld, field); } else { c.EmitDelegate>((Func)getAttackerBody); } } else { Log.Error("Failed to find DamageReport parameter for " + ((MemberReference)c.Context.Method).FullName, "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "emitGetMethodParameterDamageReportAttackerBody", 2439); c.Emit(OpCodes.Ldnull); } static CharacterBody getAttackerBody(DamageReport damageReport) { return damageReport?.attackerBody; } } private static void emitGetProjectileOwner(ILCursor c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) c.Emit(OpCodes.Ldarg_0); c.EmitDelegate>((Func)getBody); static CharacterBody getBody(MonoBehaviour component) { ProjectileController val = tryGetAsComponent((Component)(object)component); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.owner)) { return null; } return val.owner.GetComponent(); } } private static void emitGetVoidRaidCrabLegControllerMainBody(ILCursor c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) c.Emit(OpCodes.Ldarg_0); c.EmitDelegate>((Func)getBody); static CharacterBody getBody(MonoBehaviour component) { LegController val = tryGetAsComponent((Component)(object)component); if (!Object.op_Implicit((Object)(object)val)) { return null; } return val.mainBody; } } private static void emitGetFissureSlamCracksControllerOwnerBody(ILCursor c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) c.Emit(OpCodes.Ldarg_0); c.EmitDelegate>((Func)getBody); static CharacterBody getBody(MonoBehaviour component) { FissureSlamCracksController val = tryGetAsComponent((Component)(object)component); GameObject val2 = (Object.op_Implicit((Object)(object)val) ? val.owner : null); if (!Object.op_Implicit((Object)(object)val2)) { return null; } return val2.GetComponent(); } } private static void emitGetOrbOwnerBody(ILCursor c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) c.Emit(OpCodes.Ldarg_0); c.EmitDelegate>((Func)getBody); static CharacterBody getBody(Orb orb) { BounceOrb val = (BounceOrb)(object)((orb is BounceOrb) ? orb : null); if (val != null) { if (!Object.op_Implicit((Object)(object)val.attacker)) { return null; } return val.attacker.GetComponent(); } DamageOrb val2 = (DamageOrb)(object)((orb is DamageOrb) ? orb : null); if (val2 != null) { if (!Object.op_Implicit((Object)(object)val2.attacker)) { return null; } return val2.attacker.GetComponent(); } DevilOrb val3 = (DevilOrb)(object)((orb is DevilOrb) ? orb : null); if (val3 != null) { if (!Object.op_Implicit((Object)(object)val3.attacker)) { return null; } return val3.attacker.GetComponent(); } GenericDamageOrb val4 = (GenericDamageOrb)(object)((orb is GenericDamageOrb) ? orb : null); if (val4 != null) { if (!Object.op_Implicit((Object)(object)val4.attacker)) { return null; } return val4.attacker.GetComponent(); } LightningOrb val5 = (LightningOrb)(object)((orb is LightningOrb) ? orb : null); if (val5 != null) { if (!Object.op_Implicit((Object)(object)val5.attacker)) { return null; } return val5.attacker.GetComponent(); } LunarDetonatorOrb val6 = (LunarDetonatorOrb)(object)((orb is LunarDetonatorOrb) ? orb : null); if (val6 != null) { if (!Object.op_Implicit((Object)(object)val6.attacker)) { return null; } return val6.attacker.GetComponent(); } VoidLightningOrb val7 = (VoidLightningOrb)(object)((orb is VoidLightningOrb) ? orb : null); if (val7 != null) { if (!Object.op_Implicit((Object)(object)val7.attacker)) { return null; } return val7.attacker.GetComponent(); } Log.Error($"Unhandled orb type {orb}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "emitGetOrbOwnerBody", 2508); return null; } } private static void emitGetMeteorStormControllerOwner(ILCursor c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) c.Emit(OpCodes.Ldarg_0); c.EmitDelegate>((Func)getBody); static CharacterBody getBody(MonoBehaviour component) { MeteorStormController val = tryGetAsComponent((Component)(object)component); GameObject val2 = (Object.op_Implicit((Object)(object)val) ? val.owner : null); if (!Object.op_Implicit((Object)(object)val2)) { return null; } return val2.GetComponent(); } } private static Manipulator getVisualBlastAttackRadiusManipulator(Action emitGetAttackerBody, bool strictRadiusMatch = true) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown return (Manipulator)delegate(ILContext il) { visualBlastAttackRadiusManipulator(il, emitGetAttackerBody, strictRadiusMatch); }; } private static Manipulator getSimpleBlastAttackRadiusManipulator(Action emitGetAttackerBody) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown return (Manipulator)delegate(ILContext il) { simpleBlastAttackRadiusManipulator(il, emitGetAttackerBody); }; } private static Manipulator getSimpleSphereSearchRadiusManipulator(Action emitGetAttackerBody) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown return (Manipulator)delegate(ILContext il) { simpleSphereSearchRadiusManipulator(il, emitGetAttackerBody); }; } private static Manipulator getSimpleEffectDataScaleManipulator(Action emitGetAttackerBody) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown return (Manipulator)delegate(ILContext il) { simpleEffectDataScaleManipulator(il, emitGetAttackerBody); }; } private static void visualBlastAttackRadiusManipulator(ILContext il, Action emitGetAttackerBody, bool strictRadiusMatch = true) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown ILCursor val = new ILCursor(il); HashSet patchedEffectDataScaleSetters = new HashSet(); Instruction loadRadiusValueInstruction = null; Func[] array = new Func[2] { (Instruction x) => !strictRadiusMatch || instructionsEqual(x, loadRadiusValueInstruction), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "scale") && !patchedEffectDataScaleSetters.Contains(x) }; int num = 0; int num2 = 0; while (val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => matchLoadValue(x, out loadRadiusValueInstruction), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "radius") })) { ILCursor val2 = val.Clone(); int index; if (val2.TryGotoNext((MoveType)2, array) || val2.TryGotoPrev((MoveType)2, array)) { index = val2.Index; val2.Index = index - 1; patchedEffectDataScaleSetters.Add(val2.Next); emitGetAttackerBody(val2); val2.EmitDelegate>((Func)GetExplosionRadius); num2++; } index = val.Index; val.Index = index - 1; emitGetAttackerBody(val); val.EmitDelegate>((Func)GetExplosionRadius); num++; val.SearchTarget = (SearchTarget)1; } if (num == 0 || num2 != num) { Log.Error($"{((MemberReference)il.Method).FullName}: Failed to find valid patch location(s) (found {num} radius location(s), {num2} effect radius location(s))", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "visualBlastAttackRadiusManipulator", 2608); } } private static bool simpleBlastAttackRadiusManipulator(ILContext il, Action emitGetAttackerBody) { //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); int num = 0; while (val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "radius") })) { emitGetAttackerBody(val); val.EmitDelegate>((Func)GetExplosionRadius); num++; val.SearchTarget = (SearchTarget)1; } if (num == 0) { Log.Error(((MemberReference)il.Method).FullName + ": Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "simpleBlastAttackRadiusManipulator", 2634); } return num > 0; } private static void simpleSphereSearchRadiusManipulator(ILContext il, Action emitGetAttackerBody) { //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); int num = 0; while (val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "radius") })) { emitGetAttackerBody(val); val.EmitDelegate>((Func)GetExplosionRadius); num++; val.SearchTarget = (SearchTarget)1; } if (num == 0) { Log.Error(((MemberReference)il.Method).FullName + ": Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "simpleSphereSearchRadiusManipulator", 2662); } } private static void simpleEffectDataScaleManipulator(ILContext il, Action emitGetAttackerBody) { //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); int num = 0; while (val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "scale") })) { emitGetAttackerBody(val); val.EmitDelegate>((Func)GetExplosionRadius); num++; val.SearchTarget = (SearchTarget)1; } if (num == 0) { Log.Error(((MemberReference)il.Method).FullName + ": Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeath.cs", "simpleEffectDataScaleManipulator", 2688); } } } internal static class ExplodeOnDeathVoid { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown HealthComponent.TakeDamageProcess += new Manipulator(HealthComponent_TakeDamageProcess); } private static void HealthComponent_TakeDamageProcess(ILContext il) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageInfo parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeathVoid.cs", "HealthComponent_TakeDamageProcess", 22); return; } ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "ExplodeOnDeathVoid"), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "baseDamage") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExplodeOnDeathVoid.cs", "HealthComponent_TakeDamageProcess", 32); return; } val.Goto(array[1].Next, (MoveType)0, false); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)getBlastDamage); static float getBlastDamage(float damage, DamageInfo damageInfo) { CharacterBody val2 = (Object.op_Implicit((Object)(object)damageInfo?.attacker) ? damageInfo.attacker.GetComponent() : null); Inventory val3 = (Object.op_Implicit((Object)(object)val2) ? val2.inventory : null); if (Object.op_Implicit((Object)(object)val3)) { ItemQualityCounts itemCountsEffective = val3.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.ExplodeOnDeathVoid); if (itemCountsEffective.TotalQualityCount > 0) { float num = 0.5f * (float)itemCountsEffective.UncommonCount + 0.7f * (float)itemCountsEffective.RareCount + 1f * (float)itemCountsEffective.EpicCount + 1.5f * (float)itemCountsEffective.LegendaryCount; damage += damageInfo.damage * num; } } return damage; } } } internal static class ExtraLife { private static EffectIndex _reviveEffectIndex = (EffectIndex)(-1); [SystemInitializer(new Type[] { typeof(QualityCatalog), typeof(EffectCatalogUtils) })] private static void Init() { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown _reviveEffectIndex = EffectCatalogUtils.FindEffectIndex("HippoRezEffect"); if ((int)_reviveEffectIndex == -1) { Log.Warning("Failed to find revive effect index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExtraLife.cs", "Init", 19); } CharacterMaster.TryReviveOnBodyDeath += new Manipulator(CharacterMaster_TryReviveOnBodyDeath); CharacterMaster.TrueKill_GameObject_GameObject_DamageTypeCombo += new hook_TrueKill_GameObject_GameObject_DamageTypeCombo(CharacterMaster_TrueKill_GameObject_GameObject_DamageTypeCombo); } private static void CharacterMaster_TryReviveOnBodyDeath(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int extraLifeItemTransformationVarIndex = -1; if (!val.TryGotoNext((MoveType)1, new Func[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloca(x, ref extraLifeItemTransformationVarIndex), (Instruction x) => ILPatternMatchingExt.MatchInitobj(x), (Instruction x) => ILPatternMatchingExt.MatchLdloca(x, extraLifeItemTransformationVarIndex), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "ExtraLife") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExtraLife.cs", "CharacterMaster_TryReviveOnBodyDeath", 44); return; } ILLabel val2 = val.DefineLabel(); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)tryReviveQualityExtraLife); val.Emit(OpCodes.Brfalse, (object)val2); val.Emit(OpCodes.Ldc_I4_1); val.Emit(OpCodes.Ret); val.MarkLabel(val2); static bool tryReviveQualityExtraLife(CharacterMaster master) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Invalid comparison between Unknown and I4 //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_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_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_015c: 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_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)master.inventory)) { QualityTier qualityTier = QualityTier.Legendary; TakeResult pendingTransformation = default(TakeResult); while (qualityTier >= QualityTier.Uncommon) { ItemIndex itemIndex = ItemQualitiesContent.ItemQualityGroups.ExtraLife.GetItemIndex(qualityTier); int deathEventCount; if ((int)itemIndex != -1) { ItemIndex itemIndex2 = ItemQualitiesContent.ItemQualityGroups.ExtraLifeConsumed.GetItemIndex(qualityTier); if ((int)itemIndex2 == -1) { itemIndex2 = Items.ExtraLifeConsumed.itemIndex; } ItemTransformation val3 = default(ItemTransformation); ((ItemTransformation)(ref val3)).originalItemIndex = itemIndex; ((ItemTransformation)(ref val3)).newItemIndex = itemIndex2; ((ItemTransformation)(ref val3)).minToTransform = 1; ((ItemTransformation)(ref val3)).maxToTransform = 1; val3.transformationType = (ItemTransformationTypeIndex)0; if (((ItemTransformation)(ref val3)).TryTake(master.inventory, ref pendingTransformation)) { switch (qualityTier) { case QualityTier.None: deathEventCount = 0; break; case QualityTier.Uncommon: deathEventCount = 12; break; case QualityTier.Rare: deathEventCount = 18; break; case QualityTier.Epic: deathEventCount = 25; break; case QualityTier.Legendary: deathEventCount = 30; break; default: deathEventCount = 0; Log.Error($"Quality tier {qualityTier} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExtraLife.cs", "CharacterMaster_TryReviveOnBodyDeath", 101); break; } ExtraLifeServerBehavior obj = ((Component)master).gameObject.AddComponent(); obj.pendingTransformation = pendingTransformation; obj.consumedItemIndex = itemIndex2; obj.completionTime = FixedTimeStamp.now + 2f; obj.completionCallback = (Action)Delegate.Combine(obj.completionCallback, new Action(respawnQualityExtraLife)); obj.soundTime = obj.completionTime - 1f; obj.soundCallback = (Action)Delegate.Combine(obj.soundCallback, new Action(master.PlayExtraLifeSFX)); return true; } } qualityTier--; void respawnQualityExtraLife() { //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_0094: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Invalid comparison between Unknown and I4 //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)master)) { Vector3 val4 = master.deathFootPosition; if (master.killedByUnsafeArea) { val4 = (Vector3)(((??)TeleportHelper.FindSafeTeleportDestination(master.deathFootPosition, master.bodyPrefab.GetComponent(), RoR2Application.rng)) ?? master.deathFootPosition); } CharacterBody val5 = master.Respawn(val4, Quaternion.Euler(0f, Random.Range(0f, 360f), 0f), true); val5.AddTimedBuff(Buffs.Immune, 3f); EntityStateMachine[] components = ((Component)val5).GetComponents(); foreach (EntityStateMachine obj2 in components) { obj2.initialStateType = obj2.mainStateType; } if ((int)_reviveEffectIndex != -1) { EffectManager.SpawnEffect(_reviveEffectIndex, new EffectData { origin = val4, rotation = val5.transform.rotation }, true); } if (deathEventCount > 0) { GameObject obj3 = Object.Instantiate(ItemQualitiesContent.NetworkedPrefabs.ExtraLifeReviveAttachment); obj3.GetComponent().RemainingDeathEvents = deathEventCount; obj3.GetComponent().AttachToGameObjectAndSpawn(((Component)val5).gameObject, (string)null); } } } } } return false; } } private static void CharacterMaster_TrueKill_GameObject_GameObject_DamageTypeCombo(orig_TrueKill_GameObject_GameObject_DamageTypeCombo orig, CharacterMaster self, GameObject killerOverride, GameObject inflictorOverride, DamageTypeCombo damageTypeOverride) { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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) if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.inventory)) { TryTransformResult val3 = default(TryTransformResult); for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { ItemIndex itemIndex = ItemQualitiesContent.ItemQualityGroups.ExtraLife.GetItemIndex(qualityTier); ItemIndex itemIndex2 = ItemQualitiesContent.ItemQualityGroups.ExtraLifeConsumed.GetItemIndex(qualityTier); ItemTransformation val = default(ItemTransformation); ((ItemTransformation)(ref val)).originalItemIndex = itemIndex; ((ItemTransformation)(ref val)).newItemIndex = itemIndex2; ((ItemTransformation)(ref val)).allowWhenDisabled = true; ((ItemTransformation)(ref val)).maxToTransform = int.MaxValue; val.transformationType = (ItemTransformationTypeIndex)0; ItemTransformation val2 = val; ((ItemTransformation)(ref val2)).TryTransform(self.inventory, ref val3); } } orig.Invoke(self, killerOverride, inflictorOverride, damageTypeOverride); } } internal static class ExtraLifeVoid { private static EffectIndex _reviveEffectIndex = (EffectIndex)(-1); [SystemInitializer(new Type[] { typeof(QualityCatalog), typeof(EffectCatalogUtils) })] private static void Init() { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown _reviveEffectIndex = EffectCatalogUtils.FindEffectIndex("VoidRezEffect"); if ((int)_reviveEffectIndex == -1) { Log.Warning("Failed to find revive effect index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExtraLifeVoid.cs", "Init", 21); } CharacterMaster.TryReviveOnBodyDeath += new Manipulator(CharacterMaster_TryReviveOnBodyDeath); CharacterMaster.TrueKill_GameObject_GameObject_DamageTypeCombo += new hook_TrueKill_GameObject_GameObject_DamageTypeCombo(CharacterMaster_TrueKill_GameObject_GameObject_DamageTypeCombo); } private static void CharacterMaster_TryReviveOnBodyDeath(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int extraLifeItemTransformationVarIndex = -1; if (!val.TryGotoNext((MoveType)1, new Func[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloca(x, ref extraLifeItemTransformationVarIndex), (Instruction x) => ILPatternMatchingExt.MatchInitobj(x), (Instruction x) => ILPatternMatchingExt.MatchLdloca(x, extraLifeItemTransformationVarIndex), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "ExtraLifeVoid") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExtraLifeVoid.cs", "CharacterMaster_TryReviveOnBodyDeath", 47); return; } ILLabel val2 = val.DefineLabel(); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)tryReviveQualityExtraLifeVoid); val.Emit(OpCodes.Brfalse, (object)val2); val.Emit(OpCodes.Ldc_I4_1); val.Emit(OpCodes.Ret); val.MarkLabel(val2); static void corruptItems(CharacterMaster master, QualityTier targetQualityTier) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d1: Unknown result type (might be due to invalid IL or missing references) TryTransformResult val5 = default(TryTransformResult); for (int i = 0; i < ContagiousItemManager.transformationInfos.Length; i++) { ref TransformationInfo reference = ContagiousItemManager.transformationInfos[i]; QualityTier qualityTier = QualityCatalog.Max(QualityCatalog.GetQualityTier(reference.originalItem), targetQualityTier); ItemIndex itemIndexOfQuality = QualityCatalog.GetItemIndexOfQuality(reference.transformedItem, qualityTier); ItemTransformation val3 = default(ItemTransformation); ((ItemTransformation)(ref val3)).originalItemIndex = reference.originalItem; ((ItemTransformation)(ref val3)).newItemIndex = itemIndexOfQuality; ((ItemTransformation)(ref val3)).maxToTransform = int.MaxValue; val3.transformationType = (ItemTransformationTypeIndex)1; ItemTransformation val4 = val3; ((ItemTransformation)(ref val4)).TryTransform(master.inventory, ref val5); if (QualityCatalog.GetQualityTier(reference.transformedItem) < targetQualityTier) { ItemIndex itemIndexOfQuality2 = QualityCatalog.GetItemIndexOfQuality(reference.transformedItem, targetQualityTier); if (itemIndexOfQuality2 != reference.transformedItem) { val3 = default(ItemTransformation); ((ItemTransformation)(ref val3)).originalItemIndex = reference.transformedItem; ((ItemTransformation)(ref val3)).newItemIndex = itemIndexOfQuality2; ((ItemTransformation)(ref val3)).maxToTransform = int.MaxValue; val3.transformationType = (ItemTransformationTypeIndex)1; ItemTransformation val6 = val3; ((ItemTransformation)(ref val6)).TryTransform(master.inventory, ref val5); } } } } static bool tryReviveQualityExtraLifeVoid(CharacterMaster master) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Invalid comparison between Unknown and I4 //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_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_00de: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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) if (Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)master.inventory)) { QualityTier qualityTier2 = QualityTier.Legendary; TakeResult pendingTransformation = default(TakeResult); while (qualityTier2 >= QualityTier.Uncommon) { ItemIndex itemIndex = ItemQualitiesContent.ItemQualityGroups.ExtraLifeVoid.GetItemIndex(qualityTier2); QualityTier extraLifeVoidQualityTier; if ((int)itemIndex != -1) { ItemIndex itemIndex2 = ItemQualitiesContent.ItemQualityGroups.ExtraLifeVoidConsumed.GetItemIndex(qualityTier2); if ((int)itemIndex2 == -1) { itemIndex2 = Items.ExtraLifeVoidConsumed.itemIndex; } ItemTransformation val7 = default(ItemTransformation); ((ItemTransformation)(ref val7)).originalItemIndex = itemIndex; ((ItemTransformation)(ref val7)).newItemIndex = itemIndex2; ((ItemTransformation)(ref val7)).minToTransform = 1; ((ItemTransformation)(ref val7)).maxToTransform = 1; val7.transformationType = (ItemTransformationTypeIndex)0; if (((ItemTransformation)(ref val7)).TryTake(master.inventory, ref pendingTransformation)) { extraLifeVoidQualityTier = qualityTier2; ExtraLifeServerBehavior obj = ((Component)master).gameObject.AddComponent(); obj.pendingTransformation = pendingTransformation; obj.consumedItemIndex = itemIndex2; obj.completionTime = FixedTimeStamp.now + 2f; obj.completionCallback = (Action)Delegate.Combine(obj.completionCallback, new Action(respawnQualityExtraLifeVoid)); obj.soundTime = obj.completionTime - 1f; obj.soundCallback = (Action)Delegate.Combine(obj.soundCallback, new Action(master.PlayExtraLifeVoidSFX)); return true; } } qualityTier2--; void respawnQualityExtraLifeVoid() { //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_0094: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Invalid comparison between Unknown and I4 //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)master)) { Vector3 val8 = master.deathFootPosition; if (master.killedByUnsafeArea) { val8 = (Vector3)(((??)TeleportHelper.FindSafeTeleportDestination(master.deathFootPosition, master.bodyPrefab.GetComponent(), RoR2Application.rng)) ?? master.deathFootPosition); } CharacterBody val9 = master.Respawn(val8, Quaternion.Euler(0f, Random.Range(0f, 360f), 0f), true); val9.AddTimedBuff(Buffs.Immune, 3f); EntityStateMachine[] components = ((Component)val9).GetComponents(); foreach (EntityStateMachine obj2 in components) { obj2.initialStateType = obj2.mainStateType; } if ((int)_reviveEffectIndex != -1) { EffectManager.SpawnEffect(_reviveEffectIndex, new EffectData { origin = val8, rotation = val9.transform.rotation }, true); } ((MonoBehaviour)master).StartCoroutine(waitThenCorruptItems(master, extraLifeVoidQualityTier)); } } } } return false; } static IEnumerator waitThenCorruptItems(CharacterMaster master, QualityTier targetQualityTier) { yield return (object)new WaitForSeconds(ContagiousItemManager.transformDelay); corruptItems(master, targetQualityTier); } } private static void CharacterMaster_TrueKill_GameObject_GameObject_DamageTypeCombo(orig_TrueKill_GameObject_GameObject_DamageTypeCombo orig, CharacterMaster self, GameObject killerOverride, GameObject inflictorOverride, DamageTypeCombo damageTypeOverride) { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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) if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.inventory)) { TryTransformResult val3 = default(TryTransformResult); for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { ItemIndex itemIndex = ItemQualitiesContent.ItemQualityGroups.ExtraLifeVoid.GetItemIndex(qualityTier); ItemIndex itemIndex2 = ItemQualitiesContent.ItemQualityGroups.ExtraLifeVoidConsumed.GetItemIndex(qualityTier); ItemTransformation val = default(ItemTransformation); ((ItemTransformation)(ref val)).originalItemIndex = itemIndex; ((ItemTransformation)(ref val)).newItemIndex = itemIndex2; ((ItemTransformation)(ref val)).allowWhenDisabled = true; ((ItemTransformation)(ref val)).maxToTransform = int.MaxValue; val.transformationType = (ItemTransformationTypeIndex)0; ItemTransformation val2 = val; ((ItemTransformation)(ref val2)).TryTransform(self.inventory, ref val3); } } orig.Invoke(self, killerOverride, inflictorOverride, damageTypeOverride); } } internal static class ExtraShrineItem { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown ShrineChanceBehavior.AddShrineStack += new hook_AddShrineStack(ShrineChanceBehavior_AddShrineStack); } private static void ShrineChanceBehavior_AddShrineStack(orig_AddShrineStack orig, ShrineChanceBehavior self, Interactor activator) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) try { TeamComponent val = default(TeamComponent); if (((Component)activator).TryGetComponent(ref val)) { ItemQualityCounts teamItemCounts = ItemQualityUtils.GetTeamItemCounts(ItemQualitiesContent.ItemQualityGroups.ExtraShrineItem, val.teamIndex, requireAlive: true); if (teamItemCounts.TotalQualityCount > 0) { int num = ((teamItemCounts.HighestQuality > QualityTier.Uncommon) ? 1 : 2); if (self.successfulPurchaseCount >= num) { self.costMultiplierPerPurchase = 1f; } } } } catch (Exception ex) { Log.Error_NoCallerPrefix(ex.ToString()); } orig.Invoke(self, activator); } } internal static class ExtraStatsOnLevelUp { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown CharacterBody.RecalculateStats += new Manipulator(CharacterBody_RecalculateStats); } private static void CharacterBody_RecalculateStats(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); VariableDefinition extraStatsOnLevelUpItemCountVar = null; if (!val.TryGotoNext((MoveType)2, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "ExtraStatsOnLevelUp"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "GetItemCountPermanent"), (Instruction x) => x.MatchStloc(typeof(int), il, out extraStatsOnLevelUpItemCountVar) })) { Log.Error("Failed to find Prayer Beads item count variable", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExtraStatsOnLevelUp.cs", "CharacterBody_RecalculateStats", 30); return; } val.Emit(OpCodes.Ldloc, extraStatsOnLevelUpItemCountVar); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getQualityItemCount); val.Emit(OpCodes.Add); val.Emit(OpCodes.Stloc, extraStatsOnLevelUpItemCountVar); int num = 0; val.Index = 0; while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "extraStatsOnLevelUpCount_CachedLastApplied") })) { val.MoveBeforeLabels(); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Action)recordBeadCount); num++; } if (num == 0) { Log.Error("Failed to find bead reset patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExtraStatsOnLevelUp.cs", "CharacterBody_RecalculateStats", 73); } val.Index = 0; FieldReference val4 = default(FieldReference); ILLabel val3 = default(ILLabel); if (!val.TryGotoNext((MoveType)2, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, ref val4) && ((val4 != null) ? ((MemberReference)val4).Name : null) == "levelUpBuffCount", (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0), (Instruction x) => ILPatternMatchingExt.MatchBle(x, ref val3) })) { Log.Error("Failed to find Prayer Bead proc patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExtraStatsOnLevelUp.cs", "CharacterBody_RecalculateStats", 87); return; } VariableDefinition val2 = il.AddVariable(); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)tryProcQualityBeads); val.Emit(OpCodes.Stloc, val2); if (val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(CommonAssets), "prayerBeadEffect"), (Instruction x) => ILPatternMatchingExt.MatchNewobj(x) })) { val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldloc, val2); val.EmitDelegate>((Action)addQualityInfoToEffect); } else { Log.Warning("Failed to find prayer bead effect patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExtraStatsOnLevelUp.cs", "CharacterBody_RecalculateStats", 164); } static void addQualityInfoToEffect(EffectData effectData, uint packedLevelBonuses) { effectData.genericUInt = packedLevelBonuses; } static int getQualityItemCount(CharacterBody body) { if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.inventory)) { return 0; } return body.inventory.GetItemCountsPermanent(ItemQualitiesContent.ItemQualityGroups.ExtraStatsOnLevelUp).TotalQualityCount; } static void recordBeadCount(CharacterBody body) { if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.inventory) && ((Component)(object)body).TryGetComponentCached(out CharacterBodyExtraStatsTracker component2)) { component2.LastExtraStatsOnLevelUpCounts = body.inventory.GetItemCountsPermanent(ItemQualitiesContent.ItemQualityGroups.ExtraStatsOnLevelUp); } } static uint tryProcQualityBeads(CharacterBody body) { //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Invalid comparison between Unknown and I4 //IL_00fb: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return 0u; } if (!Object.op_Implicit((Object)(object)body) || !body.isPlayerControlled || !Object.op_Implicit((Object)(object)body.inventory) || !((Component)(object)body).TryGetComponentCached(out CharacterBodyExtraStatsTracker component)) { return 0u; } ItemQualityCounts right = body.inventory.GetItemCountsPermanent(ItemQualitiesContent.ItemQualityGroups.ExtraStatsOnLevelUp); ItemQualityCounts itemQualityCounts = component.LastExtraStatsOnLevelUpCounts - right; if (itemQualityCounts.TotalQualityCount <= 0) { return 0u; } int num2 = itemQualityCounts.UncommonCount + 2 * itemQualityCounts.RareCount + 3 * itemQualityCounts.EpicCount + 5 * itemQualityCounts.LegendaryCount; int num3 = 2 * itemQualityCounts.UncommonCount + 4 * itemQualityCounts.RareCount + 6 * itemQualityCounts.EpicCount + 8 * itemQualityCounts.LegendaryCount; if (num2 > 0) { uint teamLevel = TeamManager.instance.GetTeamLevel(body.teamComponent.teamIndex); ulong experienceForLevel = TeamManager.GetExperienceForLevel(teamLevel); ulong experienceForLevel2 = TeamManager.GetExperienceForLevel(teamLevel + (uint)num2); if (experienceForLevel2 > experienceForLevel) { ulong num4 = experienceForLevel2 - experienceForLevel; if ((int)body.teamComponent.teamIndex == 1) { PrayerBeadsIgnoreXp.IgnoreXpGain(num4, 2.2f); } ExperienceManager.instance.AwardExperience(body.footPosition, body, num4); } } if (num3 > 0 && Object.op_Implicit((Object)(object)RunExtraStatsTracker.Instance)) { RunExtraStatsTracker instance = RunExtraStatsTracker.Instance; instance.NetworkAmbientLevelPenalty = instance.AmbientLevelPenalty + num3; } return PackLevelBonuses(num2, num3); } } public static uint PackLevelBonuses(int playerLevelBonus, int ambientLevelPenalty) { ushort num = (ushort)((uint)playerLevelBonus & 0xFFFFu); return (uint)(((ushort)(ambientLevelPenalty & 0xFFFF) << 16) | num); } public static (int playerLevelBonus, int ambientLevelPenalty) UnpackLevelBonuses(uint packedLevelBonuses) { short item = (short)(packedLevelBonuses & 0xFFFF); int item2 = (short)((packedLevelBonuses >> 16) & 0xFFFF); return (item, item2); } } public sealed class ExtraStatsOnLevelUpEffectAppendQualityInfo : MonoBehaviour { private EffectComponent _effectComponent; private MultiTextRiserController _textRiserController; private List _appendedTextRiserStrings; [SystemInitializer(new Type[] { })] private static 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) AsyncOperationHandle handle = AddressableUtil.LoadAssetAsync(RoR2_DLC2_Items_ExtraStatsOnLevelUp.ExtraStatsOnLevelUpScrapEffect_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject scrapEffect) { UnityObjectExtensions.EnsureComponent(scrapEffect); }); } private void Awake() { _effectComponent = ((Component)this).GetComponent(); _textRiserController = ((Component)this).GetComponent(); if (!Object.op_Implicit((Object)(object)_effectComponent)) { Log.Warning("Missing EffectComponent on " + Util.GetGameObjectHierarchyName(((Component)this).gameObject), "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExtraStatsOnLevelUpEffectAppendQualityInfo.cs", "Awake", 34); ((Behaviour)this).enabled = false; } else if (!Object.op_Implicit((Object)(object)_textRiserController)) { Log.Warning("Missing MultiTextRiserController on " + Util.GetGameObjectHierarchyName(((Component)this).gameObject), "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ExtraStatsOnLevelUpEffectAppendQualityInfo.cs", "Awake", 41); ((Behaviour)this).enabled = false; } else { EffectComponent effectComponent = _effectComponent; effectComponent.OnEffectComponentReset = (Action)Delegate.Combine(effectComponent.OnEffectComponentReset, new Action(onReset)); _appendedTextRiserStrings = CollectionPool>.RentCollection(); } } private void OnDestroy() { EffectComponent effectComponent = _effectComponent; effectComponent.OnEffectComponentReset = (Action)Delegate.Remove(effectComponent.OnEffectComponentReset, new Action(onReset)); _appendedTextRiserStrings = CollectionPool>.ReturnCollection(_appendedTextRiserStrings); } private void onReset(bool hasEffectData) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (_appendedTextRiserStrings == null) { return; } if (_appendedTextRiserStrings.Count > 0) { List list = default(List); DisposableRental> val = CollectionPool>.RentCollection(ref list); try { list.AddRange(_textRiserController.DisplayStrings); foreach (string appendedTextRiserString in _appendedTextRiserStrings) { list.Remove(appendedTextRiserString); } if (list.Count < _textRiserController.DisplayStrings.Length) { _textRiserController.DisplayStrings = list.ToArray(); } _appendedTextRiserStrings.Clear(); } finally { val.Dispose(); } } if (hasEffectData) { var (num, num2) = ExtraStatsOnLevelUp.UnpackLevelBonuses(_effectComponent.effectData.genericUInt); if (num > 0) { addTextRiserString(Language.GetStringFormatted("EXTRASTATSONLEVELUP_INCREASE_LEVEL", new object[1] { num })); } if (num2 > 0) { addTextRiserString(Language.GetStringFormatted("EXTRASTATSONLEVELUP_REDUCE_AMBIENT_LEVEL", new object[1] { num2 })); } } void addTextRiserString(string str) { _appendedTextRiserStrings.Add(str); ArrayUtils.ArrayAppend(ref _textRiserController.DisplayStrings, ref str); } } } internal static class FallBoots { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown HeadstompersFall.DoStompExplosionAuthority += new Manipulator(HeadstompersFall_DoStompExplosionAuthority); } private static void HeadstompersFall_DoStompExplosionAuthority(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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) ILCursor val = new ILCursor(il); int num = 0; val.Goto(0, (MoveType)0, false); while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "maxDistance") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getMaxDistance); num++; } if (num == 0) { Log.Error("Failed to find maxDistance patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\FallBoots.cs", "HeadstompersFall_DoStompExplosionAuthority", 57); } int num2 = 0; val.Goto(0, (MoveType)0, false); while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "minimumDamageCoefficient") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getMinimumDamageCoefficient); num2++; } if (num2 == 0) { Log.Error("Failed to find minimumDamageCoefficient patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\FallBoots.cs", "HeadstompersFall_DoStompExplosionAuthority", 98); } int num3 = 0; val.Goto(0, (MoveType)0, false); while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "maximumDamageCoefficient") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getMaximumDamageCoefficient); num3++; } if (num3 == 0) { Log.Error("Failed to find maximumDamageCoefficient patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\FallBoots.cs", "HeadstompersFall_DoStompExplosionAuthority", 139); } static float getMaxDistance(float maxDistance, HeadstompersFall self) { Inventory val4 = (Object.op_Implicit((Object)(object)((BaseHeadstompersState)(self?)).body) ? ((BaseHeadstompersState)self).body.inventory : null); if (Object.op_Implicit((Object)(object)val4)) { ItemQualityCounts itemCountsEffective3 = val4.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.FallBoots); if (itemCountsEffective3.TotalQualityCount > 0) { float num6 = Mathf.Pow(0.9f, (float)itemCountsEffective3.UncommonCount) * Mathf.Pow(0.8f, (float)itemCountsEffective3.RareCount) * Mathf.Pow(0.7f, (float)itemCountsEffective3.EpicCount) * Mathf.Pow(0.6f, (float)itemCountsEffective3.LegendaryCount); maxDistance *= num6; } } return maxDistance; } static float getMaximumDamageCoefficient(float maximumDamageCoefficient, HeadstompersFall self) { Inventory val2 = (Object.op_Implicit((Object)(object)((BaseHeadstompersState)(self?)).body) ? ((BaseHeadstompersState)self).body.inventory : null); if (Object.op_Implicit((Object)(object)val2)) { ItemQualityCounts itemCountsEffective = val2.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.FallBoots); if (itemCountsEffective.TotalQualityCount > 0) { float num4 = 10f * (float)itemCountsEffective.UncommonCount + 20f * (float)itemCountsEffective.RareCount + 30f * (float)itemCountsEffective.EpicCount + 50f * (float)itemCountsEffective.LegendaryCount; maximumDamageCoefficient += num4; } } return maximumDamageCoefficient; } static float getMinimumDamageCoefficient(float minimumDamageCoefficient, HeadstompersFall self) { Inventory val3 = (Object.op_Implicit((Object)(object)((BaseHeadstompersState)(self?)).body) ? ((BaseHeadstompersState)self).body.inventory : null); if (Object.op_Implicit((Object)(object)val3)) { ItemQualityCounts itemCountsEffective2 = val3.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.FallBoots); if (itemCountsEffective2.TotalQualityCount > 0) { float num5 = 1f * (float)itemCountsEffective2.UncommonCount + 2f * (float)itemCountsEffective2.RareCount + 3f * (float)itemCountsEffective2.EpicCount + 5f * (float)itemCountsEffective2.LegendaryCount; minimumDamageCoefficient += num5; } } return minimumDamageCoefficient; } } } internal static class Feather { private static GameObject _featherEffectOut; private static GameObject _featherEffectLast; [SystemInitializer(new Type[] { })] private static void Init() { //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 RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(getStatCoefficients); GenericCharacterMain.ProcessJump_bool += new Manipulator(FeatherEffect); } [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { AsyncOperationHandle featherEffectLoad = AddressableUtil.LoadTempAssetAsync(RoR2_Base_Feather.FeatherEffect_prefab); ParallelProgressCoroutine val = new ParallelProgressCoroutine((IProgress)args.ProgressReceiver); val.Add(in featherEffectLoad); yield return val; if ((int)featherEffectLoad.Status != 1 || !Object.op_Implicit((Object)(object)featherEffectLoad.Result)) { Log.Error($"Failed to load feather effect prefab: {featherEffectLoad.OperationException}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Feather.cs", "LoadContent", 42); yield break; } _featherEffectOut = PrefabAPI.InstantiateClone(featherEffectLoad.Result, "featherEffectOut", false); change_color(_featherEffectOut.transform.Find("Big Feathers"), new Color(1f, 0.9f, 0f)); change_color(_featherEffectOut.transform.Find("Ring"), new Color(1f, 0.9f, 0f)); args.ContentPack.effectDefs.Add(new EffectDef(_featherEffectOut)); _featherEffectLast = PrefabAPI.InstantiateClone(featherEffectLoad.Result, "featherEffectLast", false); change_color(_featherEffectLast.transform.Find("Big Feathers"), new Color(1f, 0.05f, 0f)); change_color(_featherEffectLast.transform.Find("Ring"), new Color(1f, 0.05f, 0f)); args.ContentPack.effectDefs.Add(new EffectDef(_featherEffectLast)); static void change_color(Transform child, Color color) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)child)) { ParticleSystemRenderer component = ((Component)child).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { ((Renderer)component).material.SetColor("_TintColor", color); ((Renderer)component).material.SetColor("_Color", color); } } } } private static void FeatherEffect(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Prefabs/Effects/FeatherEffect"), (Instruction x) => ILPatternMatchingExt.MatchCall(x, typeof(LegacyResourcesAPI), "Load") })) { Log.Error(((MemberReference)il.Method).Name + " IL Hook failed!", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Feather.cs", "FeatherEffect", 78); return; } val.Goto(array[1].Next, (MoveType)2, false); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)changeFeatherEffect); } private static GameObject changeFeatherEffect(GameObject prefab, GenericCharacterMain self) { CharacterBody val = ((self != null) ? ((EntityState)self).characterBody : null); if (Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.inventory)) { return prefab; } ItemQualityCounts itemCountsEffective = val.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Feather); int num = itemCountsEffective.UncommonCount * 3 + itemCountsEffective.RareCount * 5 + itemCountsEffective.EpicCount * 7 + itemCountsEffective.LegendaryCount * 9 + itemCountsEffective.BaseItemCount + val.baseJumpCount - 1; if (((EntityState)self).characterMotor.jumpCount == val.maxJumpCount - 1) { if (((EntityState)self).characterMotor.jumpCount == num) { return _featherEffectLast; } return _featherEffectOut; } return prefab; } private static void getStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender)) { args.jumpCountAdd += sender.GetBuffCount(ItemQualitiesContent.Buffs.FeatherExtraJumps); } } } public sealed class FeatherQualityItemBehavior : QualityItemBodyBehavior { private CharacterBodyExtraStatsTracker _bodyStats; [ItemGroupAssociation(QualityItemBehaviorUsageFlags.Server)] private static ItemQualityGroup GetItemGroup() { return ItemQualitiesContent.ItemQualityGroups.Feather; } protected override void Awake() { base.Awake(); _bodyStats = ((Component)(object)this).GetComponentCached(); } private void OnEnable() { GlobalEventManager.onCharacterDeathGlobal += onCharacterDeathGlobal; _bodyStats.OnHitGroundServer += onHitGroundServer; } private void OnDisable() { GlobalEventManager.onCharacterDeathGlobal -= onCharacterDeathGlobal; _bodyStats.OnHitGroundServer -= onHitGroundServer; } private void onCharacterDeathGlobal(DamageReport report) { if (!((Object)(object)report.attackerBody != (Object)(object)base.Body) && (!Object.op_Implicit((Object)(object)base.Body.characterMotor) || !base.Body.characterMotor.isGrounded)) { ref readonly ItemQualityCounts stacks = ref base.Stacks; int num = stacks.UncommonCount * 2 + stacks.RareCount * 4 + stacks.EpicCount * 6 + stacks.LegendaryCount * 8; if (report.attackerBody.GetBuffCount(ItemQualitiesContent.Buffs.FeatherExtraJumps) < num) { report.attackerBody.AddBuff(ItemQualitiesContent.Buffs.FeatherExtraJumps); } } } private void onHitGroundServer(HitGroundInfo info) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) base.Body.SetBuffCount(ItemQualitiesContent.Buffs.FeatherExtraJumps.buffIndex, 0); } } internal static class FireRing { [SystemInitializer(new Type[] { })] private static IEnumerator Init() { AsyncOperationHandle fireTornadoLoad = AddressableUtil.LoadAssetAsync(RoR2_Base_ElementalRings.FireTornado_prefab, (AsyncReferenceHandleUnloadType)2); AsyncOperationHandle fireTornadoGhostLoad = AddressableUtil.LoadAssetAsync(RoR2_Base_ElementalRings.FireTornadoGhost_prefab, (AsyncReferenceHandleUnloadType)2); ParallelCoroutine val = new ParallelCoroutine(); val.Add((IEnumerator)(object)fireTornadoLoad); val.Add((IEnumerator)(object)fireTornadoGhostLoad); yield return val; if ((int)fireTornadoLoad.Status != 1 || !Object.op_Implicit((Object)(object)fireTornadoLoad.Result)) { Log.Error($"Failed to load FireTornado prefab: {fireTornadoLoad.OperationException}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\FireRing.cs", "Init", 28); yield break; } if ((int)fireTornadoGhostLoad.Status != 1 || !Object.op_Implicit((Object)(object)fireTornadoGhostLoad.Result)) { Log.Error($"Failed to load FireTornadoGhost prefab: {fireTornadoGhostLoad.OperationException}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\FireRing.cs", "Init", 34); yield break; } GameObject result = fireTornadoLoad.Result; result.AddComponent(); result.AddComponent(); float initialDuration = 3.3f; ProjectileSimple val2 = default(ProjectileSimple); if (result.TryGetComponent(ref val2)) { initialDuration = val2.lifetime; } GameObject result2 = fireTornadoGhostLoad.Result; result2.GetComponent().inheritScaleFromProjectile = true; ParticleSystem[] componentsInChildren = result2.GetComponentsInChildren(true); ParticleSystem[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { MainModule main = array[i].main; ((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)0; } ScaleParticleSystemDuration obj = result2.AddComponent(); obj.initialDuration = initialDuration; obj.particleSystems = componentsInChildren; } } public sealed class FireTornadoProjectileController : NetworkBehaviour { [SyncVar] private float _overrideLifetime = -1f; private ProjectileSimple _projectileSimple; public float Network_overrideLifetime { get { return _overrideLifetime; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref _overrideLifetime, 1u); } } private void Awake() { _projectileSimple = ((Component)this).GetComponent(); if (!Object.op_Implicit((Object)(object)_projectileSimple)) { Log.Error(Util.GetGameObjectHierarchyName(((Component)this).gameObject) + " is missing ProjectileSimple component", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\FireTornadoProjectileController.cs", "Awake", 20); ((Behaviour)this).enabled = false; return; } ProjectileController component = ((Component)this).GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { Log.Error(Util.GetGameObjectHierarchyName(((Component)this).gameObject) + " is missing ProjectileController component", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\FireTornadoProjectileController.cs", "Awake", 28); ((Behaviour)this).enabled = false; } else if (NetworkServer.active) { component.onInitialized += onInitializedServer; } } [Server] private void onInitializedServer(ProjectileController projectileController) { //IL_00f0: 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 (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void ItemQualities.Items.FireTornadoProjectileController::onInitializedServer(RoR2.Projectile.ProjectileController)' called on client"); return; } ItemQualityCounts itemQualityCounts = default(ItemQualityCounts); CharacterBody val = default(CharacterBody); if (Object.op_Implicit((Object)(object)projectileController.owner) && projectileController.owner.TryGetComponent(ref val) && Object.op_Implicit((Object)(object)val.inventory)) { itemQualityCounts = val.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.FireRing); } float num = 1f; float num2 = 1f; if (itemQualityCounts.TotalQualityCount > 0) { num += 0.05f * (float)itemQualityCounts.UncommonCount + 0.15f * (float)itemQualityCounts.RareCount + 0.3f * (float)itemQualityCounts.EpicCount + 0.5f * (float)itemQualityCounts.LegendaryCount; num2 += 0.5f * (float)itemQualityCounts.UncommonCount + 0.75f * (float)itemQualityCounts.RareCount + 1f * (float)itemQualityCounts.EpicCount + 2f * (float)itemQualityCounts.LegendaryCount; } if (num2 != 1f) { Transform transform = ((Component)this).transform; transform.localScale *= num2; } if (num != 1f) { Network_overrideLifetime = _projectileSimple.lifetime * num; applyLifetimeOverride(); } } public override void OnStartClient() { ((NetworkBehaviour)this).OnStartClient(); applyLifetimeOverride(); } private void applyLifetimeOverride() { if (Object.op_Implicit((Object)(object)_projectileSimple) && _overrideLifetime > 0f) { _projectileSimple.lifetime = _overrideLifetime; } } private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { if (forceAll) { writer.Write(_overrideLifetime); return true; } bool flag = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(_overrideLifetime); } if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { if (initialState) { _overrideLifetime = reader.ReadSingle(); return; } int num = (int)reader.ReadPackedUInt32(); if (((uint)num & (true ? 1u : 0u)) != 0) { _overrideLifetime = reader.ReadSingle(); } } public override void PreStartClient() { } } internal static class Firework { private static GameObject _fireworkBigProjectilePrefab; [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { AsyncOperationHandle fireworkProjectileLoad = AddressableUtil.LoadTempAssetAsync(RoR2_Base_Firework.FireworkProjectile_prefab); AsyncOperationHandle fireworkGhostLoad = AddressableUtil.LoadTempAssetAsync(RoR2_Base_Firework.FireworkGhost_prefab); AsyncOperationHandle explodeEffectLoad = AddressableUtil.LoadAssetAsync(RoR2_Base_Common_VFX.OmniExplosionVFXQuick_prefab, (AsyncReferenceHandleUnloadType)2); ParallelProgressCoroutine val = new ParallelProgressCoroutine((IProgress)args.ProgressReceiver); val.Add(in fireworkProjectileLoad); val.Add(in fireworkGhostLoad); val.Add(in explodeEffectLoad); yield return val; if ((int)fireworkProjectileLoad.Status != 1 || !Object.op_Implicit((Object)(object)fireworkProjectileLoad.Result)) { Log.Error($"Failed to load firework projectile prefab: {fireworkProjectileLoad.OperationException}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Firework.cs", "LoadContent", 38); yield break; } if ((int)fireworkGhostLoad.Status != 1 || !Object.op_Implicit((Object)(object)fireworkGhostLoad.Result)) { Log.Error($"Failed to load firework projectile ghost prefab: {fireworkGhostLoad.OperationException}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Firework.cs", "LoadContent", 44); yield break; } GameObject val2 = PrefabAPI.InstantiateClone(fireworkGhostLoad.Result, "FireworkBigGhost", false); Transform val3 = val2.transform.Find("mdlFireworkProjectile"); if (Object.op_Implicit((Object)(object)val3)) { val3.localScale *= 3f; } else { Log.Warning("Failed to find firework model root", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Firework.cs", "LoadContent", 56); } GameObject val4 = PrefabAPI.InstantiateClone(fireworkProjectileLoad.Result, "FireworkBigProjectile"); val4.GetComponent().ghostPrefab = val2; MissileController component = val4.GetComponent(); component.giveupTimer = 20f; component.deathTimer = 30f; component.maxSeekDistance = 150f; val4.GetComponent().PID = new Vector3(10f, 0.3f, 0f); ProjectileImpactExplosion component2 = val4.GetComponent(); ((ProjectileExplosion)component2).blastRadius = 7.5f; if ((int)explodeEffectLoad.Status == 1 && Object.op_Implicit((Object)(object)explodeEffectLoad.Result)) { component2.impactEffect = explodeEffectLoad.Result; } _fireworkBigProjectilePrefab = val4; args.ContentPack.projectilePrefabs.Add(val4); } [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown FireworkLauncher.FireMissile += new Manipulator(FireworkLauncher_FireMissile); } private static void FireworkLauncher_FireMissile(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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) ILCursor val = new ILCursor(il); VariableDefinition val2 = il.AddVariable(); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getShouldFireLargeFirework); val.Emit(OpCodes.Stloc, val2); int num = 0; while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "projectilePrefab") })) { val.Emit(OpCodes.Ldloc, val2); val.EmitDelegate>((Func)getProjectilePrefab); num++; } if (num == 0) { Log.Error("Failed to find projectile prefab patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Firework.cs", "FireworkLauncher_FireMissile", 143); } num = 0; val.Index = 0; while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "damageCoefficient") })) { val.Emit(OpCodes.Ldloc, val2); val.EmitDelegate>((Func)getDamageCoefficient); num++; } if (num == 0) { Log.Error("Failed to find damage coefficient patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Firework.cs", "FireworkLauncher_FireMissile", 175); } static float getDamageCoefficient(float damageCoefficient, bool shouldFireLargeFirework) { if (shouldFireLargeFirework) { damageCoefficient = 5f; } return damageCoefficient; } static GameObject getProjectilePrefab(GameObject projectilePrefab, bool shouldFireLargeFirework) { if (shouldFireLargeFirework && Object.op_Implicit((Object)(object)_fireworkBigProjectilePrefab)) { projectilePrefab = _fireworkBigProjectilePrefab; } return projectilePrefab; } static bool getShouldFireLargeFirework(FireworkLauncher fireworkLauncher) { GameObject val3 = (Object.op_Implicit((Object)(object)fireworkLauncher) ? fireworkLauncher.owner : null); CharacterBody val4 = (Object.op_Implicit((Object)(object)val3) ? val3.GetComponent() : null); Inventory val5 = (Object.op_Implicit((Object)(object)val4) ? val4.inventory : null); float percentChance = 0f; if (Object.op_Implicit((Object)(object)val5)) { ItemQualityCounts itemCountsEffective = val5.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Firework); percentChance = 10f * (float)itemCountsEffective.UncommonCount + 20f * (float)itemCountsEffective.RareCount + 40f * (float)itemCountsEffective.EpicCount + 60f * (float)itemCountsEffective.LegendaryCount; } return RollUtil.CheckRoll(percentChance, Object.op_Implicit((Object)(object)val4) ? val4.master : null, sureProc: false); } } } internal static class FlatHealth { [SystemInitializer(new Type[] { })] private static void Init() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown ObjectiveEvents.OnFinalMoonPillarChargedGlobal += onFinalMoonPillarChargedGlobal; ObjectiveEvents.OnFinalVoidStagePillarChargedServer += onFinalVoidStagePillarChargedServer; ArenaMissionController.onBeatArena += onBeatArena; BossGroup.onBossGroupDefeatedServer += onBossGroupDefeatedServer; RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(getStatCoefficients); } private static void tryDispatchSteakReward(CharacterBody targetBody, Vector3 origin) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)targetBody) || !Object.op_Implicit((Object)(object)targetBody.healthComponent) || !targetBody.healthComponent.alive) { return; } Inventory inventory = targetBody.inventory; if (!Object.op_Implicit((Object)(object)inventory)) { return; } ItemQualityCounts itemCountsEffective = inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.FlatHealth); if (itemCountsEffective.TotalQualityCount > 0) { float num = 40f * (float)itemCountsEffective.UncommonCount + 80f * (float)itemCountsEffective.RareCount + 130f * (float)itemCountsEffective.EpicCount + 200f * (float)itemCountsEffective.LegendaryCount; if (num > 0f) { SteakOrb steakOrb = new SteakOrb { origin = origin, target = targetBody.mainHurtBox, SteakBonus = num }; OrbManager.instance.AddOrb((Orb)(object)steakOrb); } } } private static void tryDispatchSteakRewards(TeamIndex targetTeam, Vector3 origin) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers(targetTeam)) { tryDispatchSteakReward(teamMember.body, origin); } } private static void onFinalMoonPillarChargedGlobal(HoldoutZoneController pillarHoldoutZone) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_0014: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { TeamIndex chargingTeam = pillarHoldoutZone.chargingTeam; if ((int)chargingTeam != -1) { tryDispatchSteakRewards(chargingTeam, ((Component)pillarHoldoutZone).transform.position + new Vector3(0f, 2f, 0f)); } } } private static void onFinalVoidStagePillarChargedServer(HoldoutZoneController pillarHoldoutZone) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_0014: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { TeamIndex chargingTeam = pillarHoldoutZone.chargingTeam; if ((int)chargingTeam != -1) { tryDispatchSteakRewards(chargingTeam, ((Component)pillarHoldoutZone).transform.position + new Vector3(0f, 2f, 0f)); } } } private static void onBeatArena() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Invalid comparison between Unknown and I4 //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && Object.op_Implicit((Object)(object)ArenaMissionController.instance)) { GameObject val = null; if (ArenaMissionController.instance.nullWards != null && ArenaMissionController.instance.nullWards.Length != 0) { val = ArenaMissionController.instance.nullWards[^1]; } HoldoutZoneController val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponent() : null); TeamIndex val3 = (TeamIndex)((!Object.op_Implicit((Object)(object)val2)) ? (-1) : ((int)val2.chargingTeam)); if ((int)val3 != -1) { Vector3 origin = (Object.op_Implicit((Object)(object)val) ? val.transform.position : ((Component)ArenaMissionController.instance).transform.position); tryDispatchSteakRewards(val3, origin); } } } private static void onBossGroupDefeatedServer(BossGroup bossGroup) { //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Invalid comparison between Unknown and I4 //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Invalid comparison between Unknown and I4 //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) switch (((Object)bossGroup).name) { case "FSBF Phase1": return; case "FSBF Phase2": return; case "BrotherEncounter, Phase 1": return; case "BrotherEncounter, Phase 2": return; case "BrotherEncounter, Phase 3": return; case "VoidRaidCrabCombatEncounter Phase 1": return; case "VoidRaidCrabCombatEncounter Phase 2": return; } TeamIndex val = (TeamIndex)(-1); Vector3 val2 = ((Component)bossGroup).transform.position; bool flag = false; CharacterMaster val4 = default(CharacterMaster); foreach (NetworkInstanceId item in bossGroup.combatSquad.memberHistory) { GameObject val3 = (NetworkServer.active ? NetworkServer.FindLocalObject(item) : ClientScene.FindLocalObject(item)); if (Object.op_Implicit((Object)(object)val3) && val3.TryGetComponent(ref val4)) { val = val4.teamIndex; if (val4.lostBodyToDeath) { val2 = val4.deathFootPosition; flag = true; } break; } } ScriptedCombatEncounter val5 = default(ScriptedCombatEncounter); if (((Component)bossGroup).TryGetComponent(ref val5)) { val = val5.teamIndex; if (!flag) { Vector3? val6 = null; float num = float.PositiveInfinity; float num2 = float.NegativeInfinity; SpawnInfo[] spawns = val5.spawns; CharacterMaster val8 = default(CharacterMaster); CharacterBody val9 = default(CharacterBody); foreach (SpawnInfo val7 in spawns) { if (Object.op_Implicit((Object)(object)val7.explicitSpawnPosition)) { float num3 = 0f; if (Object.op_Implicit((Object)(object)val7.spawnCard) && Object.op_Implicit((Object)(object)val7.spawnCard.prefab) && val7.spawnCard.prefab.TryGetComponent(ref val8) && Object.op_Implicit((Object)(object)val8.bodyPrefab) && val8.bodyPrefab.TryGetComponent(ref val9)) { num3 = val9.baseMaxHealth; } if (!val6.HasValue || num3 > num2 || (Mathf.Abs(num3 - num2) < 0.01f && val7.cullChance < num)) { num2 = num3; num = val7.cullChance; val6 = val7.explicitSpawnPosition.position; } } } if (val6.HasValue) { val2 = val6.Value; flag = true; } } } HoldoutZoneController val10 = default(HoldoutZoneController); TeamMask val11; if (((Component)bossGroup).TryGetComponent(ref val10)) { val11 = TeamMask.none; ((TeamMask)(ref val11)).AddTeam(val10.chargingTeam); } else if ((int)val != -1) { val11 = TeamMask.allButNeutral; ((TeamMask)(ref val11)).RemoveTeam(val); } else { val11 = TeamMask.none; ((TeamMask)(ref val11)).AddTeam((TeamIndex)1); } Vector3 origin = (Object.op_Implicit((Object)(object)bossGroup.dropPosition) ? bossGroup.dropPosition.position : val2); TeamIndex val12 = (TeamIndex)0; while ((int)val12 < TeamsAPICompat.TeamsCount) { tryDispatchSteakRewards(val12, origin); val12 = (TeamIndex)(sbyte)(val12 + 1); } } private static void getStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender.inventory) && sender.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.FlatHealth).TotalQualityCount > 0 && ((Component)(object)sender.master).TryGetComponentCached(out CharacterMasterExtraStatsTracker component)) { args.baseHealthAdd += component.SteakBonus; } } } internal static class FragileDamageBonus { private delegate bool ConsumeQualityWatchesDelegate(bool result, HealthComponent healthComponent, in ItemTransformation itemTransformation, ref TryTransformResult consumeTransformResult); [SystemInitializer(new Type[] { })] private static void Init() { //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 RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(getStatCoefficients); HealthComponent.UpdateLastHitTime += new Manipulator(HealthComponent_UpdateLastHitTime); } private static void getStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender.inventory)) { ItemQualityCounts itemCountsEffective = sender.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.FragileDamageBonus); if (itemCountsEffective.TotalQualityCount > 0 && sender.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.FragileDamageBonusBuff).TotalQualityCount > 0) { float num = 0.07f * (float)itemCountsEffective.UncommonCount + 0.1f * (float)itemCountsEffective.RareCount + 0.15f * (float)itemCountsEffective.EpicCount + 0.2f * (float)itemCountsEffective.LegendaryCount; args.damageMultAdd += num; } } } private static void HealthComponent_UpdateLastHitTime(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0128: 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_0146: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); VariableDefinition watchItemTransformationVar = null; VariableDefinition watchItemTransformationResultVar = null; if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "fragileDamageBonus") }) || !val.TryGotoNext((MoveType)2, new Func[6] { (Instruction x) => x.MatchLdloca(typeof(ItemTransformation), il, out watchItemTransformationVar), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "body"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "get_inventory"), (Instruction x) => x.MatchLdloca(typeof(TryTransformResult), il, out watchItemTransformationResultVar), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "TryTransform") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\FragileDamageBonus.cs", "HealthComponent_UpdateLastHitTime", 56); return; } val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloca, watchItemTransformationVar); val.Emit(OpCodes.Ldloca, watchItemTransformationResultVar); val.EmitDelegate((ConsumeQualityWatchesDelegate)consumeQualityWatches); static void addStackValues(ref ItemStackValues a, in ItemStackValues b) { a.permanentStacks += b.permanentStacks; a.temporaryStacksValue += b.temporaryStacksValue; a.totalStacks += b.totalStacks; } static bool consumeQualityWatches(bool result, HealthComponent healthComponent, in ItemTransformation itemTransformation, ref TryTransformResult consumeTransformResult) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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) CharacterBody val2 = (Object.op_Implicit((Object)(object)healthComponent) ? healthComponent.body : null); Inventory val3 = (Object.op_Implicit((Object)(object)val2) ? val2.inventory : null); if (Object.op_Implicit((Object)(object)val3)) { TryTransformResult val5 = default(TryTransformResult); for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { ItemTransformation val4 = itemTransformation; ((ItemTransformation)(ref val4)).originalItemIndex = ItemQualitiesContent.ItemQualityGroups.FragileDamageBonus.GetItemIndex(qualityTier); ((ItemTransformation)(ref val4)).newItemIndex = ItemQualitiesContent.ItemQualityGroups.FragileDamageBonusConsumed.GetItemIndex(qualityTier); if (((ItemTransformation)(ref val4)).TryTransform(val3, ref val5)) { result = true; addStackValues(ref consumeTransformResult.takenItem.stackValues, in val5.takenItem.stackValues); addStackValues(ref consumeTransformResult.givenItem.stackValues, in val5.givenItem.stackValues); } } } return result; } } } public sealed class FragileDamageBonusQualityItemBehavior : QualityItemBodyBehavior { private static EffectIndex _watchBreakEffectIndex = (EffectIndex)(-1); private CharacterBodyExtraStatsTracker _bodyExtraStats; private bool _buffCountsDirty; private int _maxHits; [SystemInitializer(new Type[] { typeof(EffectCatalogUtils) })] private static void Init() { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 _watchBreakEffectIndex = EffectCatalogUtils.FindEffectIndex("DelicateWatchProcEffect"); if ((int)_watchBreakEffectIndex == -1) { Log.Error("Failed to find watch break effect index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\FragileDamageBonusQualityItemBehavior.cs", "Init", 18); } } [ItemGroupAssociation(QualityItemBehaviorUsageFlags.Server)] private static ItemQualityGroup GetItemGroup() { return ItemQualitiesContent.ItemQualityGroups.FragileDamageBonus; } protected override void Awake() { base.Awake(); _bodyExtraStats = ((Component)(object)this).GetComponentCached(); } private void OnEnable() { if (Object.op_Implicit((Object)(object)_bodyExtraStats.MasterExtraStatsTracker)) { _bodyExtraStats.MasterExtraStatsTracker.OnStageDamageInstancesTakenCountChangedServer += onStageDamageInstancesTakenCountChangedServer; } refreshBuffCounts(); } private void OnDisable() { if (Object.op_Implicit((Object)(object)_bodyExtraStats.MasterExtraStatsTracker)) { _bodyExtraStats.MasterExtraStatsTracker.OnStageDamageInstancesTakenCountChangedServer -= onStageDamageInstancesTakenCountChangedServer; } if (NetworkServer.active) { base.Body.RemoveAllQualityBuffs(ItemQualitiesContent.BuffQualityGroups.FragileDamageBonusBuff); } } private void FixedUpdate() { if (_buffCountsDirty) { _buffCountsDirty = false; refreshBuffCounts(); } } private void onStageDamageInstancesTakenCountChangedServer(CharacterMasterExtraStatsTracker _) { _buffCountsDirty = true; } protected override void OnStacksChanged() { base.OnStacksChanged(); ensureBuffQualities(); switch (base.Stacks.HighestQuality) { case QualityTier.Uncommon: _maxHits = 12; break; case QualityTier.Rare: _maxHits = 15; break; case QualityTier.Epic: _maxHits = 20; break; case QualityTier.Legendary: _maxHits = 25; break; default: _maxHits = 0; break; } refreshBuffCounts(); } private void ensureBuffQualities() { base.Body.ConvertQualityBuffsToTier(ItemQualitiesContent.BuffQualityGroups.FragileDamageBonusBuff, base.Stacks.HighestQuality); } private void refreshBuffCounts() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Invalid comparison between Unknown and I4 //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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) int num = (Object.op_Implicit((Object)(object)_bodyExtraStats.MasterExtraStatsTracker) ? _bodyExtraStats.MasterExtraStatsTracker.StageDamageInstancesTakenCount : 0); int totalQualityCount = base.Body.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.FragileDamageBonusBuff).TotalQualityCount; int num2 = Mathf.Max(0, _maxHits - num); int num3 = num2 - totalQualityCount; if (num3 == 0) { return; } ensureBuffQualities(); BuffIndex buffIndex = ItemQualitiesContent.BuffQualityGroups.FragileDamageBonusBuff.GetBuffIndex(base.Stacks.HighestQuality); if (num3 > 0) { for (int i = 0; i < num3; i++) { base.Body.AddBuff(buffIndex); } } else { for (int j = 0; j < -num3; j++) { base.Body.RemoveBuff(buffIndex); } } if (num2 == 0 && (int)_watchBreakEffectIndex != -1) { EffectData val = new EffectData { origin = base.Body.corePosition }; val.SetNetworkedObjectReference(((Component)base.Body).gameObject); EffectManager.SpawnEffect(_watchBreakEffectIndex, val, true); } } } internal static class FreeChest { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown SceneDirector.PopulateScene += new Manipulator(SceneDirector_PopulateScene); } private static void SceneDirector_PopulateScene(ILContext il) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) MethodInfo masterEnumeratorCurrentGetter = typeof(IEnumerator).GetProperty("Current")?.GetMethod; if (masterEnumeratorCurrentGetter == null) { Log.Error("Failed to find CharacterMaster enumerator Current getter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\FreeChest.cs", "SceneDirector_PopulateScene", 26); return; } ILCursor val = new ILCursor(il); VariableDefinition freeChestSpawnCountVar = null; ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "FreeChest"), (Instruction x) => x.MatchStloc(typeof(int), il, out freeChestSpawnCountVar) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\FreeChest.cs", "SceneDirector_PopulateScene", 37); return; } val.Goto(array[0].Next, (MoveType)0, false); if (!val.TryGotoPrev((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)masterEnumeratorCurrentGetter) })) { Log.Error("Failed to find master iterator variable", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\FreeChest.cs", "SceneDirector_PopulateScene", 44); return; } VariableDefinition val2 = il.AddVariable(); val.Emit(OpCodes.Stloc, val2); val.Emit(OpCodes.Ldloc, val2); val.Goto(array[1].Next, (MoveType)2, false); val.Emit(OpCodes.Ldloc, freeChestSpawnCountVar); val.Emit(OpCodes.Ldloc, val2); val.EmitDelegate>((Func)getExtraFreeChestSpawnCount); val.Emit(OpCodes.Add); val.Emit(OpCodes.Stloc, freeChestSpawnCountVar); static int getExtraFreeChestSpawnCount(CharacterMaster master) { Inventory val3 = (Object.op_Implicit((Object)(object)master) ? master.inventory : null); int num = 0; if (Object.op_Implicit((Object)(object)val3)) { ItemQualityCounts itemCountsEffective = val3.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.FreeChest); if (itemCountsEffective.TotalQualityCount > 0) { float percentChance = 50f * (float)itemCountsEffective.UncommonCount + 75f * (float)itemCountsEffective.RareCount + 100f * (float)itemCountsEffective.EpicCount + 150f * (float)itemCountsEffective.LegendaryCount; num += RollUtil.GetOverflowRoll(percentChance, master, sureProc: false); } } return num; } } } internal static class GhostOnKill { private delegate bool ShouldSpawnAnotherGhostDelegate(ref int ghostSpawnCount); [SystemInitializer(new Type[] { })] private static void Init() { //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 GlobalEventManager.OnCharacterDeath += new Manipulator(GlobalEventManager_OnCharacterDeath); Util.TryToCreateGhost += new Manipulator(Util_TryToCreateGhost); } private static void GlobalEventManager_OnCharacterDeath(ILContext il) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0139: 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_0165: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageReport parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\GhostOnKill.cs", "GlobalEventManager_OnCharacterDeath", 26); return; } ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); ILLabel val7 = default(ILLabel); if (!val.TryFindNext(ref array, new Func[6] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "GhostOnKill"), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 7f), (Instruction x) => ItemHooks.MatchCallLocalCheckRoll(x), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val7), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(Util), "TryToCreateGhost"), (Instruction x) => ILPatternMatchingExt.MatchPop(x) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\GhostOnKill.cs", "GlobalEventManager_OnCharacterDeath", 40); return; } val.Goto(array[1].Next, (MoveType)2, false); VariableDefinition val2 = il.AddVariable(); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)getGhostSpawnChance); val.Emit(OpCodes.Dup); val.Emit(OpCodes.Stloc, val2); val.Goto(array[3].Next, (MoveType)2, false); VariableDefinition val3 = il.AddVariable(); val.Emit(OpCodes.Ldloc, val2); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)getGhostSpawnCount); val.Emit(OpCodes.Stloc, val3); ILLabel val4 = val.DefineLabel(); val.Emit(OpCodes.Br, (object)val4); ILLabel val5 = val.MarkLabel(); val.Goto(array[5].Next, (MoveType)2, false); val.MarkLabel(val4); val.Emit(OpCodes.Ldloca, val3); val.EmitDelegate((ShouldSpawnAnotherGhostDelegate)shouldSpawnAnotherGhost); val.Emit(OpCodes.Brtrue, (object)val5); static float getGhostSpawnChance(float spawnChance, DamageReport damageReport) { Inventory val6 = (Object.op_Implicit((Object)(object)damageReport?.attackerBody) ? damageReport.attackerBody.inventory : null); if (Object.op_Implicit((Object)(object)val6)) { ItemQualityCounts itemCountsEffective = val6.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.GhostOnKill); if (itemCountsEffective.TotalQualityCount > 0) { spawnChance += 10f * (float)itemCountsEffective.UncommonCount + 20f * (float)itemCountsEffective.RareCount + 30f * (float)itemCountsEffective.EpicCount + 40f * (float)itemCountsEffective.LegendaryCount; } } return spawnChance; } static int getGhostSpawnCount(float spawnChance, DamageReport damageReport) { int num = 1; if (spawnChance > 100f) { num += RollUtil.GetOverflowRoll(spawnChance - 100f, damageReport?.attackerMaster, ((ProcChainMask)(ref damageReport.damageInfo.procChainMask)).HasProc((ProcType)26)); } return num; } static bool shouldSpawnAnotherGhost(ref int ghostSpawnCount) { return ghostSpawnCount-- > 0; } } private static void Util_TryToCreateGhost(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((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "position") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\GhostOnKill.cs", "Util_TryToCreateGhost", 122); } else { val.EmitDelegate>((Func)getSpawnPosition); } static Vector3 getSpawnPosition(Vector3 position) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_002a: Unknown result type (might be due to invalid IL or missing references) Vector3 val2 = Random.insideUnitSphere * 0.5f; val2.y = Mathf.Abs(val2.y) * 0.2f; return position + val2; } } } internal static class GoldOnHurt { private static GameObject _goldPackPrefab; [SystemInitializer(new Type[] { })] private static void Init() { //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) AsyncOperationHandle handle = Addressables.LoadAssetAsync((object)RoR2_Base_BonusGoldPackOnKill.BonusMoneyPack_prefab); handle.OnSuccess(delegate(GameObject prefab) { _goldPackPrefab = prefab; }); GlobalEventManager.OnInteractionsGlobal += onInteractGlobal; } private static void onInteractGlobal(Interactor interactor, IInteractable interactable, GameObject interactableObject) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } CharacterBody val = (Object.op_Implicit((Object)(object)interactor) ? ((Component)interactor).GetComponent() : null); Inventory val2 = (Object.op_Implicit((Object)(object)val) ? val.inventory : null); if (!Object.op_Implicit((Object)(object)val2)) { return; } ItemQualityCounts itemCountsEffective = val2.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.GoldOnHurt); if (itemCountsEffective.TotalQualityCount <= 0 || (!(interactable is BarrelInteraction) && !(interactable is SpeedOnPickupBarrelInteraction)) || !Object.op_Implicit((Object)(object)_goldPackPrefab)) { return; } Vector3 position = interactableObject.transform.position; ModelLocator val3 = default(ModelLocator); if (interactableObject.TryGetComponent(ref val3)) { ChildLocator modelChildLocator = val3.modelChildLocator; if (Object.op_Implicit((Object)(object)modelChildLocator)) { Transform val4 = modelChildLocator.FindChild("FireworkOrigin"); if (Object.op_Implicit((Object)(object)val4)) { position = val4.position; } } } GameObject val5 = Object.Instantiate(_goldPackPrefab, position, Quaternion.identity); MoneyPickup componentInChildren = val5.GetComponentInChildren(); if (Object.op_Implicit((Object)(object)componentInChildren)) { int baseGoldReward = 25 * itemCountsEffective.UncommonCount + 50 * itemCountsEffective.RareCount + 75 * itemCountsEffective.EpicCount + 100 * itemCountsEffective.LegendaryCount; componentInChildren.baseGoldReward = baseGoldReward; } TeamFilter val6 = default(TeamFilter); if (Object.op_Implicit((Object)(object)val) && val5.TryGetComponent(ref val6)) { val6.teamIndex = val.teamComponent.teamIndex; } NetworkServer.Spawn(val5); } } internal static class HeadHunter { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(getStatCoefficients); } private static void getStatCoefficients(CharacterBody sender, StatHookEventArgs args) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)sender.inventory)) { return; } ItemQualityCounts itemCountsEffective = sender.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.HeadHunter); if (itemCountsEffective.TotalQualityCount <= 0) { return; } int num = 0; BuffIndex[] eliteBuffIndices = BuffCatalog.eliteBuffIndices; foreach (BuffIndex buffIndex in eliteBuffIndices) { if (sender.HasBuffRaw(buffIndex)) { num++; } } if (num > 0) { float num2 = 0.2f * (float)itemCountsEffective.UncommonCount + 0.4f * (float)itemCountsEffective.RareCount + 0.8f * (float)itemCountsEffective.EpicCount + 1f * (float)itemCountsEffective.LegendaryCount; args.damageMultAdd += num2 * (float)num; } } } internal static class HealingPotion { private delegate void TryConsumeQualityElixirsDelegate(HealthComponent healthComponent, ref ItemTransformation itemTransformation); [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown HealthComponent.UpdateLastHitTime += new Manipulator(HealthComponent_UpdateLastHitTime); } private static void HealthComponent_UpdateLastHitTime(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0198: 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) ILCursor val = new ILCursor(il); VariableDefinition potionItemTransformationVar = null; Instruction skipPotionTransformationTargetInstruction = null; ILLabel val7 = default(ILLabel); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "healingPotion") }) || !val.TryGotoNext((MoveType)0, new Func[8] { (Instruction x) => x.MatchLdloca(typeof(ItemTransformation), il, out potionItemTransformationVar), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "body"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "get_inventory"), (Instruction x) => x.MatchLdloca(typeof(TryTransformResult), il, out var _), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "TryTransform"), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val7), (Instruction x) => x.MatchAny(out skipPotionTransformationTargetInstruction) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\HealingPotion.cs", "HealthComponent_UpdateLastHitTime", 36); return; } ILLabel val2 = val.DefineLabel(); val2.Target = skipPotionTransformationTargetInstruction; val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)tryProtectElixirs); val.Emit(OpCodes.Brtrue, (object)val2); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloca, potionItemTransformationVar); val.EmitDelegate((TryConsumeQualityElixirsDelegate)tryConsumeQualityElixirs); static void tryConsumeQualityElixirs(HealthComponent healthComponent, ref ItemTransformation itemTransformation) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) CharacterBody val3 = (Object.op_Implicit((Object)(object)healthComponent) ? healthComponent.body : null); Inventory val4 = (Object.op_Implicit((Object)(object)val3) ? val3.inventory : null); if (Object.op_Implicit((Object)(object)val4)) { ItemQualityCounts itemCountsEffective = val4.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.HealingPotion); if (itemCountsEffective.BaseItemCount == 0 && itemCountsEffective.TotalQualityCount > 0) { for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { if (itemCountsEffective[qualityTier] > 0) { ((ItemTransformation)(ref itemTransformation)).originalItemIndex = ItemQualitiesContent.ItemQualityGroups.HealingPotion.GetItemIndex(qualityTier); ((ItemTransformation)(ref itemTransformation)).newItemIndex = ItemQualitiesContent.ItemQualityGroups.HealingPotionConsumed.GetItemIndex(qualityTier); break; } } } } } static bool tryProtectElixirs(HealthComponent healthComponent) { CharacterBody val5 = (Object.op_Implicit((Object)(object)healthComponent) ? healthComponent.body : null); CharacterMaster master = (Object.op_Implicit((Object)(object)val5) ? val5.master : null); Inventory val6 = (Object.op_Implicit((Object)(object)val5) ? val5.inventory : null); if (!Object.op_Implicit((Object)(object)val6)) { return false; } ItemQualityCounts itemCountsEffective2 = val6.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.HealingPotion); for (int i = 0; i < itemCountsEffective2.UncommonCount; i++) { if (RollUtil.CheckRoll(20f, master, sureProc: false)) { return true; } } for (int j = 0; j < itemCountsEffective2.RareCount; j++) { if (RollUtil.CheckRoll(35f, master, sureProc: false)) { return true; } } for (int k = 0; k < itemCountsEffective2.EpicCount; k++) { if (RollUtil.CheckRoll(50f, master, sureProc: false)) { return true; } } for (int l = 0; l < itemCountsEffective2.LegendaryCount; l++) { if (RollUtil.CheckRoll(75f, master, sureProc: false)) { return true; } } return false; } } } internal static class HealOnCrit { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(getStatCoefficients); } private static void getStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (!Object.op_Implicit((Object)(object)sender.inventory)) { return; } ItemQualityCounts itemCountsEffective = sender.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.HealOnCrit); if (itemCountsEffective.TotalQualityCount > 0 && sender.HasBuff(ItemQualitiesContent.Buffs.HealCritBoost)) { float num; switch (itemCountsEffective.HighestQuality) { case QualityTier.Uncommon: num = 20f; break; case QualityTier.Rare: num = 30f; break; case QualityTier.Epic: num = 40f; break; case QualityTier.Legendary: num = 50f; break; default: Log.Error($"Quality tier {itemCountsEffective.HighestQuality} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\HealOnCrit.cs", "getStatCoefficients", 39); num = 0f; break; } if (num > 0f) { args.critAdd += num; } } } } public sealed class HealOnCritQualityItemBehavior : QualityItemBodyBehavior { private float _accumulatedHealing; [ItemGroupAssociation(QualityItemBehaviorUsageFlags.Server)] private static ItemQualityGroup GetItemGroup() { return ItemQualitiesContent.ItemQualityGroups.HealOnCrit; } private void OnEnable() { HealthComponent.onCharacterHealServer += onCharacterHealServer; } private void OnDisable() { HealthComponent.onCharacterHealServer -= onCharacterHealServer; } private void onCharacterHealServer(HealthComponent healthComponent, float amount, ProcChainMask procChainMask) { if (Object.op_Implicit((Object)(object)healthComponent) && !((Object)(object)healthComponent != (Object)(object)base.Body.healthComponent)) { _accumulatedHealing += amount; updateAccumulatedHealing(); } } protected override void OnStacksChanged() { base.OnStacksChanged(); updateAccumulatedHealing(); } private void updateAccumulatedHealing() { ref readonly ItemQualityCounts stacks = ref base.Stacks; if (stacks.TotalQualityCount != 0) { float num; switch (stacks.HighestQuality) { case QualityTier.Uncommon: num = 2f; break; case QualityTier.Rare: num = 1f; break; case QualityTier.Epic: num = 0.5f; break; case QualityTier.Legendary: num = 0.2f; break; default: Log.Error($"Quality tier {stacks.HighestQuality} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\HealOnCritQualityItemBehavior.cs", "updateAccumulatedHealing", 63); num = 0f; break; } float num2 = num * base.Body.healthComponent.fullHealth; if (num2 > 0f && _accumulatedHealing >= num2) { float num3 = 4f * (float)stacks.UncommonCount + 6f * (float)stacks.RareCount + 8f * (float)stacks.EpicCount + 10f * (float)stacks.LegendaryCount; _accumulatedHealing %= num2; base.Body.AddTimedBuff(ItemQualitiesContent.Buffs.HealCritBoost, num3); } } } } internal static class HealWhileSafe { [SystemInitializer(new Type[] { })] private static void Init() { GlobalEventManager.onCharacterDeathGlobal += onCharacterDeathGlobal; } private static void onCharacterDeathGlobal(DamageReport damageReport) { //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || damageReport?.damageInfo == null || !Object.op_Implicit((Object)(object)damageReport.attackerBody) || !damageReport.attackerBody.outOfDanger || !Object.op_Implicit((Object)(object)damageReport.attackerBody.inventory)) { return; } ItemQualityCounts itemCountsEffective = damageReport.attackerBody.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.HealWhileSafe); if (itemCountsEffective.TotalQualityCount != 0) { int num = 2 * itemCountsEffective.UncommonCount + 4 * itemCountsEffective.RareCount + 8 * itemCountsEffective.EpicCount + 12 * itemCountsEffective.LegendaryCount; int num2 = num * 50; int buffCount = damageReport.attackerBody.GetBuffCount(ItemQualitiesContent.Buffs.SlugHealth); int num3 = Mathf.Min(num, num2 - buffCount); if (num3 > 0) { SlugOrb slugOrb = new SlugOrb { target = damageReport.attackerBody.mainHurtBox, origin = (Object.op_Implicit((Object)(object)damageReport.victimBody) ? damageReport.victimBody.corePosition : damageReport.damageInfo.position), SlugBuffCount = num3 }; OrbManager.instance.AddOrb((Orb)(object)slugOrb); } } } } internal static class Hoof { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients); } private static void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender.inventory)) { ItemQualityCounts itemCountsEffective = sender.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Hoof); args.moveSpeedMultAdd += 0.11f * (float)itemCountsEffective.UncommonCount + 0.26f * (float)itemCountsEffective.RareCount + 0.46000004f * (float)itemCountsEffective.EpicCount + 0.61f * (float)itemCountsEffective.LegendaryCount; } } } internal static class IceRing { [SystemInitializer(new Type[] { })] private static void Init() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown ExecuteAPI.CalculateExecuteThresholdForViewer = (CalculateExecuteThresholdForViewerEventHandler)Delegate.Combine((Delegate?)(object)ExecuteAPI.CalculateExecuteThresholdForViewer, (Delegate?)new CalculateExecuteThresholdForViewerEventHandler(calculateExecuteThreshold)); GlobalEventManager.ProcessHitEnemy += new Manipulator(GlobalEventManager_ProcessHitEnemy); } private static void calculateExecuteThreshold(CharacterBody victimBody, CharacterBody viewerBody, ref float highestExecuteThreshold) { if (Object.op_Implicit((Object)(object)victimBody) && Object.op_Implicit((Object)(object)victimBody.healthComponent) && Object.op_Implicit((Object)(object)viewerBody) && victimBody.healthComponent.isInFrozenState) { highestExecuteThreshold = Mathf.Max(highestExecuteThreshold, GetFreezeExecuteThreshold(viewerBody)); } } public static float GetFreezeExecuteThreshold(CharacterBody attackerBody) { return getFreezeExecuteThreshold(0.3f, attackerBody); } private static float getFreezeExecuteThreshold(float defaultFreezeThreshold, CharacterBody attackerBody) { float num = defaultFreezeThreshold; Inventory val = (Object.op_Implicit((Object)(object)attackerBody) ? attackerBody.inventory : null); if (Object.op_Implicit((Object)(object)val)) { ItemQualityCounts itemCountsEffective = val.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.IceRing); if (itemCountsEffective.TotalQualityCount > 0) { float num2 = 0.05f * (float)itemCountsEffective.UncommonCount + 0.1f * (float)itemCountsEffective.RareCount + 0.2f * (float)itemCountsEffective.EpicCount + 0.4f * (float)itemCountsEffective.LegendaryCount; num = 1f - (1f - num) / (1f + num2); } } return num; } private static void GlobalEventManager_ProcessHitEnemy(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageInfo parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\IceRing.cs", "GlobalEventManager_ProcessHitEnemy", 66); return; } if (!((MethodReference)(object)il.Method).TryFindParameter("victim", out var _)) { Log.Error("Failed to find victim parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\IceRing.cs", "GlobalEventManager_ProcessHitEnemy", 72); return; } ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "IceRing"), (Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Prefabs/Effects/ImpactEffects/IceRingExplosion"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "TakeDamage") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\IceRing.cs", "GlobalEventManager_ProcessHitEnemy", 81); return; } val.Goto(array[2].Next, (MoveType)0, false); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)getIceBandDamageInfo); static DamageInfo getIceBandDamageInfo(DamageInfo iceBandDamageInfo, DamageInfo procDamageInfo) { //IL_0057: 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_006b: Unknown result type (might be due to invalid IL or missing references) if (iceBandDamageInfo != null) { CharacterBody val2 = (Object.op_Implicit((Object)(object)procDamageInfo?.attacker) ? procDamageInfo.attacker.GetComponent() : null); Inventory val3 = (Object.op_Implicit((Object)(object)val2) ? val2.inventory : null); if (Object.op_Implicit((Object)(object)val3) && val3.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.IceRing).TotalQualityCount > 0) { iceBandDamageInfo.damageType |= DamageTypeCombo.op_Implicit((DamageType)256); } } return iceBandDamageInfo; } } } internal static class Icicle { [SystemInitializer(new Type[] { })] private static void Init() { //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 IcicleAuraController.FixedUpdate += new Manipulator(IcicleAuraController_FixedUpdate); IcicleAuraController.UpdateRadius += new hook_UpdateRadius(IcicleAuraController_UpdateRadius); } private static void IcicleAuraController_FixedUpdate(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "damageType") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Icicle.cs", "IcicleAuraController_FixedUpdate", 27); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getIcicleDamageType); static DamageTypeCombo getIcicleDamageType(DamageTypeCombo damageType, IcicleAuraController icicleAuraController) { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) CharacterBody val2 = (Object.op_Implicit((Object)(object)icicleAuraController) ? icicleAuraController.cachedOwnerInfo.characterBody : null); if (Object.op_Implicit((Object)(object)val2)) { Inventory val3 = (Object.op_Implicit((Object)(object)val2) ? val2.inventory : null); if (Object.op_Implicit((Object)(object)val3)) { ItemQualityCounts itemCountsEffective = val3.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Icicle); if (itemCountsEffective.TotalQualityCount > 0 && RollUtil.CheckRoll(20f * (float)itemCountsEffective.UncommonCount + 30f * (float)itemCountsEffective.RareCount + 50f * (float)itemCountsEffective.EpicCount + 75f * (float)itemCountsEffective.LegendaryCount, val2.master, sureProc: false)) { DamageAPI.AddModdedDamageType(ref damageType, DamageTypes.Frost6s); } } } return damageType; } } private static void IcicleAuraController_UpdateRadius(orig_UpdateRadius orig, IcicleAuraController self) { orig.Invoke(self); CharacterBody val = (Object.op_Implicit((Object)(object)self) ? self.cachedOwnerInfo.characterBody : null); Inventory val2 = (Object.op_Implicit((Object)(object)val) ? val.inventory : null); if (!Object.op_Implicit((Object)(object)val2)) { return; } ItemQualityCounts itemCountsEffective = val2.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Icicle); if (itemCountsEffective.TotalQualityCount > 0) { float num = 0.3f * (float)itemCountsEffective.UncommonCount + 0.5f * (float)itemCountsEffective.RareCount + 0.8f * (float)itemCountsEffective.EpicCount + 1f * (float)itemCountsEffective.LegendaryCount; if (num > 0f) { self.actualRadius *= 1f + num; } } } } public sealed class IgniteOnKillQualityItemBehavior : QualityItemBodyBehavior { private static GameObject _fireAuraPrefab; private static readonly SphereSearch _igniteOnKillSphereSearch = new SphereSearch(); private IcicleAuraController _icicleAura; private GameObject _fireAuraObj; [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { AsyncOperationHandle icicleAuraLoad = AddressableUtil.LoadTempAssetAsync(RoR2_Base_Icicle.IcicleAura_prefab); ParallelProgressCoroutine val = new ParallelProgressCoroutine((IProgress)args.ProgressReceiver); val.Add(in icicleAuraLoad); yield return val; if ((int)icicleAuraLoad.Status != 1 || !Object.op_Implicit((Object)(object)icicleAuraLoad.Result)) { Log.Error($"Failed to load icicle Aura prefab: {icicleAuraLoad.OperationException}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\IgniteOnKillQualityItemBehavior.cs", "LoadContent", 35); yield break; } _fireAuraPrefab = PrefabAPI.InstantiateClone(icicleAuraLoad.Result, "FireAura"); IcicleAuraController component = _fireAuraPrefab.GetComponent(); component.icicleMaxPerStack = 0; component.icicleBaseRadius = 1f; component.icicleRadiusPerIcicle = 2.5f; Object.Destroy((Object)(object)component.buffWard); Transform particles = _fireAuraPrefab.transform.Find("Particles"); Dictionary materialCache; if (Object.op_Implicit((Object)(object)particles)) { materialCache = new Dictionary(); setColor("Chunks"); setColor("Ring, Core"); setColor("Ring, Outer"); setColor("Ring, Procced"); setColor("SpinningSharpChunks"); setColor("Area"); } else { Log.Error("Failed to find Particles in icicle Aura prefab", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\IgniteOnKillQualityItemBehavior.cs", "LoadContent", 87); } args.ContentPack.networkedObjectPrefabs.Add(_fireAuraPrefab); void setColor(string childName) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) Transform val2 = particles.Find(childName); ParticleSystemRenderer val3 = default(ParticleSystemRenderer); if (Object.op_Implicit((Object)(object)val2) && ((Component)val2).TryGetComponent(ref val3)) { Material sharedMaterial = ((Renderer)val3).sharedMaterial; if (Object.op_Implicit((Object)(object)sharedMaterial)) { if (!materialCache.TryGetValue(sharedMaterial, out var value)) { value = new Material(sharedMaterial); ((Object)value).name = ((Object)sharedMaterial).name + "_Red"; value.SetColor(ShaderProperties._TintColor, new Color(1f, 0.1f, 0f)); value.SetColor(ShaderProperties._Color, new Color(1f, 0.1f, 0f)); materialCache.Add(sharedMaterial, value); } ((Renderer)val3).sharedMaterial = value; } } } } [ItemGroupAssociation(QualityItemBehaviorUsageFlags.Server)] private static ItemQualityGroup GetItemGroup() { return ItemQualitiesContent.ItemQualityGroups.IgniteOnKill; } private void OnEnable() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) GlobalEventManager.onCharacterDeathGlobal += onCharacterDeathGlobal; _fireAuraObj = Object.Instantiate(_fireAuraPrefab, ((Component)this).transform.position, Quaternion.identity); _icicleAura = _fireAuraObj.GetComponent(); _icicleAura.Networkowner = ((Component)this).gameObject; NetworkServer.Spawn(_fireAuraObj); } private void OnDisable() { GlobalEventManager.onCharacterDeathGlobal -= onCharacterDeathGlobal; if (Object.op_Implicit((Object)(object)_icicleAura)) { Object.Destroy((Object)(object)_icicleAura); _icicleAura = null; } } private void onCharacterDeathGlobal(DamageReport damageReport) { if (damageReport != null && !((Object)(object)damageReport.attackerBody != (Object)(object)base.Body) && Object.op_Implicit((Object)(object)_icicleAura)) { DotController val = DotController.FindDotController(((Component)damageReport.victimBody).gameObject); if (damageReport.victimBody.GetBuffCount(Buffs.OnFire) > 1 || damageReport.victimBody.GetBuffCount(Buffs.StrongerBurn) > 1 || damageReport.victimBody.HasBuff(Buffs.AffixRed) || (Object.op_Implicit((Object)(object)val) && val.HasDotActive((DotIndex)2))) { _icicleAura.OnOwnerKillOther(); } } } protected override void OnStacksChanged() { base.OnStacksChanged(); ref readonly ItemQualityCounts stacks = ref base.Stacks; _icicleAura.icicleDamageCoefficientPerTick = stacks.UncommonCount + 2 * stacks.RareCount + 3 * stacks.EpicCount + 5 * stacks.LegendaryCount; switch (stacks.HighestQuality) { case QualityTier.Uncommon: _icicleAura.baseIcicleMax = 4; _icicleAura.icicleDuration = 3f; break; case QualityTier.Rare: _icicleAura.baseIcicleMax = 8; _icicleAura.icicleDuration = 5f; break; case QualityTier.Epic: _icicleAura.baseIcicleMax = 12; _icicleAura.icicleDuration = 7f; break; case QualityTier.Legendary: _icicleAura.baseIcicleMax = 20; _icicleAura.icicleDuration = 10f; break; } } private void FixedUpdate() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0180: 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) if (!NetworkServer.active || !Object.op_Implicit((Object)(object)_icicleAura) || _icicleAura.finalIcicleCount <= 0 || (!(_icicleAura.attackStopwatch >= _icicleAura.baseIcicleAttackInterval) && _icicleAura.attackStopwatch != 0f)) { return; } List list = default(List); DisposableRental> val = CollectionPool>.RentCollection(ref list); try { _igniteOnKillSphereSearch.origin = base.Body.corePosition; _igniteOnKillSphereSearch.mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask; _igniteOnKillSphereSearch.radius = _icicleAura.actualRadius; _igniteOnKillSphereSearch.RefreshCandidates(); _igniteOnKillSphereSearch.FilterCandidatesByHurtBoxTeam(TeamMask.GetUnprotectedTeams(base.Body.teamComponent.teamIndex)); _igniteOnKillSphereSearch.FilterCandidatesByDistinctHurtBoxEntities(); _igniteOnKillSphereSearch.GetHurtBoxes(list); _igniteOnKillSphereSearch.ClearCandidates(); foreach (HurtBox item in list) { if (Object.op_Implicit((Object)(object)item.healthComponent) && (Object)(object)item.healthComponent.body != (Object)(object)base.Body) { InflictDotInfo val2 = default(InflictDotInfo); val2.victimObject = ((Component)item.healthComponent).gameObject; val2.attackerObject = ((Component)base.Body).gameObject; val2.totalDamage = base.Body.damage * 1f; val2.dotIndex = (DotIndex)1; val2.damageMultiplier = 1f; InflictDotInfo val3 = val2; if (Object.op_Implicit((Object)(object)base.Body.inventory)) { StrengthenBurnUtils.CheckDotForUpgrade(base.Body.inventory, ref val3); } DotController.InflictDot(ref val3); } } } finally { val.Dispose(); } } } internal static class ImmuneToDebuff { [SystemInitializer(new Type[] { })] private static void Init() { //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 ImmuneToDebuffBehavior.OverrideDot += new hook_OverrideDot(ImmuneToDebuffBehavior_OverrideDot); CharacterBody.AddTimedBuff_BuffDef_float += new Manipulator(handleDebuffBuffReflectPatch); CharacterBody.AddTimedBuff_BuffDef_float_int += new Manipulator(handleDebuffBuffReflectPatch); CharacterBody.AddTimedBuffDontRefreshDuration += new Manipulator(handleDebuffBuffReflectPatch); CharacterBody.ExtendTimedBuffIfPresent_BuffDef_float_float += new Manipulator(handleDebuffBuffReflectPatch); } private static void trySpreadBlockedDebuff(CharacterBody victimBody, BuffIndex buffIndex, float duration, InflictDotInfo? inflictDotInfo) { //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Invalid comparison between Unknown and I4 //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0178: 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_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0195: 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_019e: Expected O, but got Unknown //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: 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_0273: 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_0298: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Log.Warning("Called on client", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ImmuneToDebuff.cs", "trySpreadBlockedDebuff", 35); } else { if (!Object.op_Implicit((Object)(object)victimBody) || !Object.op_Implicit((Object)(object)victimBody.inventory) || (duration <= 0f && !inflictDotInfo.HasValue)) { return; } if (inflictDotInfo.HasValue) { if ((int)buffIndex == -1) { DotDef dotDef = DotController.GetDotDef(inflictDotInfo.Value.dotIndex); if (dotDef != null && Object.op_Implicit((Object)(object)dotDef.associatedBuff)) { buffIndex = dotDef.associatedBuff.buffIndex; } } if (duration <= 0f) { duration = inflictDotInfo.Value.duration; } } BuffDef buffDef = BuffCatalog.GetBuffDef(buffIndex); if (!Object.op_Implicit((Object)(object)buffDef) || (buffDef.flags & 1) != 0) { return; } ItemQualityCounts itemCountsEffective = victimBody.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.ImmuneToDebuff); QualityTier highestQuality = itemCountsEffective.HighestQuality; if (highestQuality == QualityTier.None) { return; } float radius = 15f * (float)itemCountsEffective.UncommonCount + 25f * (float)itemCountsEffective.RareCount + 35f * (float)itemCountsEffective.EpicCount + 50f * (float)itemCountsEffective.LegendaryCount; int num; switch (highestQuality) { case QualityTier.Uncommon: num = 5; break; case QualityTier.Rare: num = 8; break; case QualityTier.Epic: num = 12; break; case QualityTier.Legendary: num = 15; break; default: num = 1; Log.Warning($"Quality tier {highestQuality} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ImmuneToDebuff.cs", "trySpreadBlockedDebuff", 93); break; } if (!buffDef.canStack) { duration *= (float)num; } SphereSearch val = new SphereSearch { mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask, origin = victimBody.corePosition, radius = radius, queryTriggerInteraction = (QueryTriggerInteraction)1 }; List list = default(List); DisposableRental> val2 = CollectionPool>.RentCollection(ref list); try { val.RefreshCandidates().FilterCandidatesByHurtBoxTeam(TeamMask.GetEnemyTeams(victimBody.teamComponent.teamIndex)).FilterCandidatesByDistinctHurtBoxEntities() .OrderCandidatesByDistance() .GetHurtBoxes(list); foreach (HurtBox item in list) { HealthComponent val3 = (Object.op_Implicit((Object)(object)item) ? item.healthComponent : null); CharacterBody val4 = (Object.op_Implicit((Object)(object)val3) ? val3.body : null); if (Object.op_Implicit((Object)(object)val4) && (Object)(object)val4 != (Object)(object)victimBody) { ImmuneToDebuffOrb immuneToDebuffOrb = new ImmuneToDebuffOrb { origin = victimBody.corePosition, target = item, Attacker = ((Component)victimBody).gameObject, BuffStackCount = ((!buffDef.canStack) ? 1 : num) }; if (inflictDotInfo.HasValue) { InflictDotInfo value = inflictDotInfo.Value; value.attackerObject = immuneToDebuffOrb.Attacker; value.victimObject = ((Component)val4).gameObject; immuneToDebuffOrb.InflictDotInfo = value; } else { immuneToDebuffOrb.BuffIndex = buffIndex; immuneToDebuffOrb.BuffDuration = duration; } OrbManager.instance.AddOrb((Orb)(object)immuneToDebuffOrb); } } } finally { val2.Dispose(); } } } private static bool ImmuneToDebuffBehavior_OverrideDot(orig_OverrideDot orig, InflictDotInfo inflictDotInfo) { //IL_0001: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) bool num = orig.Invoke(inflictDotInfo); if (num) { trySpreadBlockedDebuff(Object.op_Implicit((Object)(object)inflictDotInfo.victimObject) ? inflictDotInfo.victimObject.GetComponent() : null, (BuffIndex)(-1), 0f, inflictDotInfo); } return num; } private static void handleDebuffBuffReflectPatch(ILContext il) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter("duration", out var parameter)) { parameter = null; } ILCursor val = new ILCursor(il); int num = 0; VariableDefinition val2 = il.AddVariable(); VariableDefinition val3 = null; VariableDefinition val4 = null; while (val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "OverrideDebuff") })) { bool flag = Extensions.Is((MemberReference)(object)((ParameterReference)((MethodReference)val.Next.Operand).Parameters[0]).ParameterType, (MemberInfo)typeof(BuffIndex)); if (flag) { if (val4 == null) { val4 = il.AddVariable(); } } else if (val3 == null) { val3 = il.AddVariable(); } val.EmitStoreStack(flag ? val4 : val3, val2); int index = val.Index; val.Index = index + 1; val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldloc, val2); val.Emit(OpCodes.Ldloc, flag ? val4 : val3); if (flag) { val.EmitDelegate>((Func)BuffCatalog.GetBuffDef); } if (parameter != null) { val.Emit(OpCodes.Ldarg, parameter); } else { val.Emit(OpCodes.Ldc_R4, 8f); } val.EmitDelegate>((Action)onOverrideDebuff); num++; } if (num == 0) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ImmuneToDebuff.cs", "handleDebuffBuffReflectPatch", 232); } static void onOverrideDebuff(bool blocked, CharacterBody body, BuffDef buffDef, float duration) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (blocked && Object.op_Implicit((Object)(object)buffDef) && buffDef.isDebuff) { trySpreadBlockedDebuff(body, buffDef.buffIndex, duration, null); } } } } internal static class IncreaseDamageOnMultiKill { [SystemInitializer(new Type[] { })] private static void Init() { //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 CharacterBody.AddIncreasedDamageMultiKillTime += new Manipulator(CharacterBody_AddIncreasedDamageMultiKillTime); IncreaseDamageOnMultiKillItemDisplayUpdater.UpdateKillCounterText += new Manipulator(IncreaseDamageOnMultiKillItemDisplayUpdater_UpdateKillCounterText); CharacterBody.UpdateMultiKill += new Manipulator(CharacterBody_UpdateMultiKill); } private static float getChronicExpansionBuffResetTime(float baseDuration, CharacterBody body) { Inventory val = (Object.op_Implicit((Object)(object)body) ? body.inventory : null); if (Object.op_Implicit((Object)(object)val)) { ItemQualityCounts itemCountsEffective = val.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.IncreaseDamageOnMultiKill); if (itemCountsEffective.TotalQualityCount > 0) { baseDuration += 1f * (float)itemCountsEffective.UncommonCount; baseDuration += 3f * (float)itemCountsEffective.RareCount; baseDuration += 5f * (float)itemCountsEffective.EpicCount; baseDuration += 7f * (float)itemCountsEffective.LegendaryCount; } } return baseDuration; } private static void CharacterBody_AddIncreasedDamageMultiKillTime(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "increasedDamageKillTimer") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\IncreaseDamageOnMultiKill.cs", "CharacterBody_AddIncreasedDamageMultiKillTime", 46); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getChronicExpansionBuffResetTime); } private static void IncreaseDamageOnMultiKillItemDisplayUpdater_UpdateKillCounterText(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "resetTime") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\IncreaseDamageOnMultiKill.cs", "IncreaseDamageOnMultiKillItemDisplayUpdater_UpdateKillCounterText", 61); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getResetTime); static float getResetTime(float baseResetTime, IncreaseDamageOnMultiKillItemDisplayUpdater displayUpdater) { CharacterBody body = (Object.op_Implicit((Object)(object)displayUpdater) ? displayUpdater.body : null); return getChronicExpansionBuffResetTime(baseResetTime, body); } } private static void CharacterBody_UpdateMultiKill(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); ILLabel val4 = default(ILLabel); if (!val.TryFindNext(ref array, new Func[4] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "increasedDamageKillTimer"), (Instruction x) => ILPatternMatchingExt.MatchBgtUn(x, ref val4), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "increasedDamageKillTimer"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "SetBuffCount") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\IncreaseDamageOnMultiKill.cs", "CharacterBody_UpdateMultiKill", 85); return; } val.Goto(array[3].Next, (MoveType)2, false); ILLabel val2 = val.MarkLabel(); val.Goto(array[2].Next, (MoveType)2, false); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)tryDoQualityBuffReset); val.Emit(OpCodes.Brtrue, (object)val2); static bool tryDoQualityBuffReset(CharacterBody body) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) Inventory val3 = (Object.op_Implicit((Object)(object)body) ? body.inventory : null); if (!Object.op_Implicit((Object)(object)val3)) { return false; } int num; switch (val3.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.IncreaseDamageOnMultiKill).HighestQuality) { case QualityTier.Uncommon: num = 10; break; case QualityTier.Rare: num = 5; break; case QualityTier.Epic: num = 3; break; case QualityTier.Legendary: num = 1; break; default: return false; } body.SetBuffCount(Buffs.IncreaseDamageBuff.buffIndex, Mathf.Max(0, body.GetBuffCount(Buffs.IncreaseDamageBuff) - num)); int buffCount = body.GetBuffCount(Buffs.IncreaseDamageBuff); body.increasedDamageKillCount = Mathf.Min(body.increasedDamageKillCount, buffCount); body.increasedDamageKillCountBuff = Mathf.Min(body.increasedDamageKillCountBuff, buffCount); if (buffCount > 0) { body.AddIncreasedDamageMultiKillTime(); } return true; } } } internal static class IncreaseHealing { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown HealthComponent.Heal += new Manipulator(HealthComponent_Heal); } private static void HealthComponent_Heal(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); int num = default(int); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "increaseHealing"), (Instruction x) => ILPatternMatchingExt.MatchStarg(x, ref num) })) { Log.Error("Failed to find IncreaseHealing item location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\IncreaseHealing.cs", "HealthComponent_Heal", 25); return; } val.Goto(array[1].Next, (MoveType)0, false); if (!val.TryGotoPrev((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchMul(x) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\IncreaseHealing.cs", "HealthComponent_Heal", 34); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getHealingIncrease); static float getHealingIncrease(float healingIncrease, HealthComponent healthComponent) { if (Object.op_Implicit((Object)(object)healthComponent) && Object.op_Implicit((Object)(object)healthComponent.body) && Object.op_Implicit((Object)(object)healthComponent.body.inventory)) { ItemQualityCounts itemCountsEffective = healthComponent.body.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.IncreaseHealing); if (itemCountsEffective.TotalQualityCount > 0) { healingIncrease += 0.5f * (float)itemCountsEffective.UncommonCount + 1f * (float)itemCountsEffective.RareCount + 2f * (float)itemCountsEffective.EpicCount + 3f * (float)itemCountsEffective.LegendaryCount; } } return healingIncrease; } } } internal static class IncreasePrimaryDamage { private static readonly int _qualityBuffActivationThreshold = 5; [SystemInitializer(new Type[] { })] private static void Init() { //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 GlobalEventManager.ProcessHitEnemy += new Manipulator(GlobalEventManager_ProcessHitEnemy); IncreasePrimaryDamageEffectUpdater.LightUpRings += new hook_LightUpRings(IncreasePrimaryDamageEffectUpdater_LightUpRings); } private static void GlobalEventManager_ProcessHitEnemy(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_012d: 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_0147: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageInfo parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\IncreasePrimaryDamage.cs", "GlobalEventManager_ProcessHitEnemy", 33); return; } if (!((MethodReference)(object)il.Method).TryFindParameter("victim", out var parameter2)) { Log.Error("Failed to find victim parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\IncreasePrimaryDamage.cs", "GlobalEventManager_ProcessHitEnemy", 39); return; } VariableDefinition attackerLuminousBuffCountVar = null; ILLabel afterLuminousBlockLabel = null; ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[5] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "IncreasePrimaryDamageBuff"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "GetBuffCount"), (Instruction x) => x.MatchStloc(typeof(int), il, out attackerLuminousBuffCountVar), (Instruction x) => x.MatchLdloc(attackerLuminousBuffCountVar), (Instruction x) => ILPatternMatchingExt.MatchBlt(x, ref afterLuminousBlockLabel) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\IncreasePrimaryDamage.cs", "GlobalEventManager_ProcessHitEnemy", 52); return; } val.Goto(array[4].Next, (MoveType)2, false); val.Emit(OpCodes.Ldarg, parameter); val.Emit(OpCodes.Ldarg, parameter2); val.Emit(OpCodes.Ldloc, attackerLuminousBuffCountVar); val.EmitDelegate>((Func)tryQualityLuminousProc); val.Emit(OpCodes.Brtrue, (object)afterLuminousBlockLabel); static bool tryQualityLuminousProc(DamageInfo damageInfo, GameObject victim, int attackerLuminousBuffCount) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0161: 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_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: 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) if (!NetworkServer.active || damageInfo == null || !Object.op_Implicit((Object)(object)victim) || !Object.op_Implicit((Object)(object)ItemQualitiesContent.ProjectilePrefabs.IncreasePrimaryDamageQualityDotZone)) { return false; } if (ProcTypeAPI.HasModdedProc(damageInfo.procChainMask, ProcTypes.IncreasePrimaryDamage)) { return false; } if (attackerLuminousBuffCount < _qualityBuffActivationThreshold) { return false; } CharacterBody val2 = (Object.op_Implicit((Object)(object)damageInfo.attacker) ? damageInfo.attacker.GetComponent() : null); Inventory val3 = (Object.op_Implicit((Object)(object)val2) ? val2.inventory : null); if (!Object.op_Implicit((Object)(object)val3)) { return false; } ItemQualityCounts itemCountsEffective = val3.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.IncreasePrimaryDamage); if (itemCountsEffective.TotalQualityCount <= 0) { return false; } for (int i = 0; i < _qualityBuffActivationThreshold; i++) { val2.RemoveBuff(Buffs.IncreasePrimaryDamageBuff); } val2.TransmitItemBehavior(new NetworkItemBehaviorData(Items.IncreasePrimaryDamage.itemIndex, (float)val2.GetBuffCount(Buffs.IncreasePrimaryDamageBuff)), false); Vector3 val4 = damageInfo.position; RaycastHit val5 = default(RaycastHit); if (Physics.SphereCast(val4, 1f, Vector3.down, ref val5, 4.5f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { val4 = ((RaycastHit)(ref val5)).point; } float num = 4f + 8f * (float)itemCountsEffective.UncommonCount + 12f * (float)itemCountsEffective.RareCount + 14f * (float)itemCountsEffective.EpicCount + 16f * (float)itemCountsEffective.LegendaryCount; ProcChainMask procChainMask = damageInfo.procChainMask; ProcTypeAPI.AddModdedProc(ref procChainMask, ProcTypes.IncreasePrimaryDamage); ProjectileManager.instance.FireProjectile(new FireProjectileInfo { projectilePrefab = ItemQualitiesContent.ProjectilePrefabs.IncreasePrimaryDamageQualityDotZone, owner = damageInfo.attacker, position = val4, rotation = Quaternion.identity, damage = damageInfo.damage * num, crit = damageInfo.crit, damageColorIndex = (DamageColorIndex)13, procChainMask = procChainMask }); return true; } } private static void IncreasePrimaryDamageEffectUpdater_LightUpRings(orig_LightUpRings orig, IncreasePrimaryDamageEffectUpdater self, int ringsToLight) { RendererInfo[] rendererInfos; if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.itemDisplay)) { rendererInfos = self.itemDisplay.rendererInfos; if (rendererInfos != null) { resetMaterial(self.itemDisplay_ShotRingBottomIndex); resetMaterial(self.itemDisplay_ShotRingMiddleIndex); resetMaterial(self.itemDisplay_ShotRingTopIndex); } } orig.Invoke(self, ringsToLight); void resetMaterial(int rendererIndex) { if (ArrayUtils.IsInBounds(rendererInfos, rendererIndex)) { rendererInfos[rendererIndex].defaultMaterial = self.unlitEnergyMaterial; } } } } [RequireComponent(typeof(ProjectileController))] public sealed class IncreasePrimaryDamageQualityDotZoneController : MonoBehaviour { private void Awake() { if (NetworkServer.active) { ProjectileController val = default(ProjectileController); if (((Component)this).TryGetComponent(ref val)) { val.onInitialized += onInitializedServer; return; } Log.Error("Missing ProjectileController component on " + Util.GetGameObjectHierarchyName(((Component)this).gameObject), "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\IncreasePrimaryDamageQualityDotZoneController.cs", "Awake", 22); ((Behaviour)this).enabled = false; } } private void onInitializedServer(ProjectileController projectileController) { //IL_00e9: Unknown result type (might be due to invalid IL or missing references) GameObject val = (Object.op_Implicit((Object)(object)projectileController) ? projectileController.owner : null); CharacterBody val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponent() : null); Inventory val3 = (Object.op_Implicit((Object)(object)val2) ? val2.inventory : null); if (Object.op_Implicit((Object)(object)val3)) { ItemQualityCounts itemCountsEffective = val3.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.IncreasePrimaryDamage); if (itemCountsEffective.TotalQualityCount == 0) { itemCountsEffective.UncommonCount = 1; } float num; switch (itemCountsEffective.HighestQuality) { case QualityTier.Uncommon: num = 7f; break; case QualityTier.Rare: num = 12f; break; case QualityTier.Epic: num = 20f; break; case QualityTier.Legendary: num = 30f; break; default: num = 7f; Log.Error($"Quality tier {itemCountsEffective.HighestQuality} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\IncreasePrimaryDamageQualityDotZoneController.cs", "onInitializedServer", 58); break; } float num2 = num * 2f; ((Component)this).transform.localScale = new Vector3(num2, 1f, num2); } } } internal static class Infusion { [SystemInitializer(new Type[] { })] private static void Init() { GlobalEventManager.onCharacterDeathGlobal += onCharacterDeathGlobal; } private static void onCharacterDeathGlobal(DamageReport damageReport) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown if (NetworkServer.active && damageReport?.damageInfo != null && Object.op_Implicit((Object)(object)damageReport.attackerBody) && Object.op_Implicit((Object)(object)damageReport.attackerMaster) && Object.op_Implicit((Object)(object)damageReport.attackerMaster.inventory) && (damageReport.victimIsBoss || damageReport.victimIsChampion)) { Vector3 origin = damageReport.damageInfo.position; if (Object.op_Implicit((Object)(object)damageReport.victimBody)) { origin = damageReport.victimBody.corePosition; } ItemQualityCounts itemCountsEffective = damageReport.attackerMaster.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Infusion); if (itemCountsEffective.TotalQualityCount > 0) { int maxHpValue = 10 * itemCountsEffective.UncommonCount + 20 * itemCountsEffective.RareCount + 35 * itemCountsEffective.EpicCount + 55 * itemCountsEffective.LegendaryCount; InfusionOrb val = new InfusionOrb { origin = origin, target = Util.FindBodyMainHurtBox(damageReport.attackerBody), maxHpValue = maxHpValue }; OrbManager.instance.AddOrb((Orb)(object)val); } } } } internal static class ItemDropChanceOnKill { private static BasicPickupDropTable _sonorousQualityDropTable; [SystemInitializer(new Type[] { })] private static void Init() { //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 static void GlobalEventManager_OnCharacterDeath(ILContext il) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageReport parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ItemDropChanceOnKill.cs", "GlobalEventManager_OnCharacterDeath", 25); return; } ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); ILLabel val5 = default(ILLabel); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "ItemDropChanceOnKill"), (Instruction x) => ILPatternMatchingExt.MatchBle(x, ref val5) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ItemDropChanceOnKill.cs", "GlobalEventManager_OnCharacterDeath", 35); return; } val.Goto(array[1].Next, (MoveType)2, false); VariableDefinition val2 = il.AddVariable(); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)tryGetQualityDropTable); val.Emit(OpCodes.Stloc, val2); int num = 0; while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(CommonAssets), "dtSonorousEchoPath") })) { val.Emit(OpCodes.Ldloc, val2); val.EmitDelegate>((Func)getDropTable); num++; } if (num == 0) { Log.Error("Failed to find drop table patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ItemDropChanceOnKill.cs", "GlobalEventManager_OnCharacterDeath", 112); } static PickupDropTable getDropTable(PickupDropTable baseDropTable, PickupDropTable overrideDropTable) { if (!Object.op_Implicit((Object)(object)overrideDropTable)) { return baseDropTable; } return overrideDropTable; } static PickupDropTable tryGetQualityDropTable(DamageReport damageReport) { Inventory val3 = (Object.op_Implicit((Object)(object)damageReport?.attackerBody) ? damageReport.attackerBody.inventory : null); if (!Object.op_Implicit((Object)(object)val3)) { return null; } ItemQualityCounts itemCountsEffective = val3.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.ItemDropChanceOnKill); if (itemCountsEffective.TotalQualityCount <= 0) { return null; } PickupDropTable dtSonorousEchoPath = CommonAssets.dtSonorousEchoPath; BasicPickupDropTable val4 = (BasicPickupDropTable)(object)((dtSonorousEchoPath is BasicPickupDropTable) ? dtSonorousEchoPath : null); if (val4 == null) { Log.Error("GlobalEventManager.CommonAssets.dtSonorousEchoPath is not of type BasicPickupDropTable", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ItemDropChanceOnKill.cs", "GlobalEventManager_OnCharacterDeath", 59); return null; } if (!Object.op_Implicit((Object)(object)_sonorousQualityDropTable)) { _sonorousQualityDropTable = Object.Instantiate(val4); ((Object)_sonorousQualityDropTable).name = ((Object)val4).name + "Quality"; } else { val4.ShallowCopy(ref _sonorousQualityDropTable); } BasicPickupDropTable sonorousQualityDropTable = _sonorousQualityDropTable; float num2 = 1f * (float)itemCountsEffective.UncommonCount + 2f * (float)itemCountsEffective.RareCount + 4f * (float)itemCountsEffective.EpicCount + 8f * (float)itemCountsEffective.LegendaryCount; if (num2 > 0f) { sonorousQualityDropTable.tier2Weight *= 1f + num2; sonorousQualityDropTable.tier3Weight *= Mathf.Pow(1f + num2, 2f); } if (Object.op_Implicit((Object)(object)Run.instance)) { ((PickupDropTable)sonorousQualityDropTable).Regenerate(Run.instance); } return (PickupDropTable)(object)sonorousQualityDropTable; } } } internal static class ItemHooks { public delegate void ModifyDamageDelegate(ref float damageValue, DamageInfo damageInfo); public static event ModifyDamageDelegate TakeDamageModifier; [SystemInitializer(new Type[] { })] private static void Init() { //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 Inventory.UpdateEffectiveItemStacks += new Manipulator(Inventory_UpdateEffectiveItemStacks); ItemInventoryDisplay.OnInventoryChanged += new Manipulator(ItemInventoryDisplay_OnInventoryChanged); CharacterModel.UpdateItemDisplay += new Manipulator(CharacterModel_UpdateItemDisplay); CharacterMaster.HighlightNewItem += new hook_HighlightNewItem(CharacterMaster_HighlightNewItem); HealthComponent.TakeDamageProcess += new Manipulator(HealthComponent_TakeDamageProcess); } private static void Inventory_UpdateEffectiveItemStacks(ILContext il) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find ItemIndex parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ItemHooks.cs", "Inventory_UpdateEffectiveItemStacks", 37); return; } ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdflda(x, "effectiveItemStacks"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "SetStackValue") })) { Log.Error("Failed to find effectiveItemStacks.SetStackValue call", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ItemHooks.cs", "Inventory_UpdateEffectiveItemStacks", 48); return; } val.Goto(array[1].Next, (MoveType)2, false); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Action)onSetEffectiveItemCount); VariableDefinition effectiveItemCountVar = null; if (!val.TryFindPrev(ref array, new Func[1] { (Instruction x) => x.MatchLdloc(typeof(int), il, out effectiveItemCountVar) })) { Log.Error("Failed to find effectiveItemCount variable", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ItemHooks.cs", "Inventory_UpdateEffectiveItemStacks", 74); return; } if (!val.TryFindPrev(ref array, new Func[3] { (Instruction x) => x.MatchStloc(effectiveItemCountVar), (Instruction x) => ILPatternMatchingExt.MatchCall(x, typeof(Math), "Clamp"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "get_inventoryDisabled") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ItemHooks.cs", "Inventory_UpdateEffectiveItemStacks", 83); return; } val.Goto(array[0].Next, (MoveType)2, false); val.Emit(OpCodes.Ldloc, effectiveItemCountVar); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)getEffectiveItemCountFromQualities); val.Emit(OpCodes.Add); val.Emit(OpCodes.Stloc, effectiveItemCountVar); static int getEffectiveItemCountFromQualities(Inventory inventory, ItemIndex itemIndex) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)inventory)) { return 0; } if (QualityCatalog.GetQualityTier(itemIndex) > QualityTier.None) { return 0; } return inventory.GetItemCountsEffective(QualityCatalog.FindItemQualityGroupIndex(itemIndex)).TotalQualityCount; } static void onSetEffectiveItemCount(Inventory inventory, ItemIndex itemIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (QualityCatalog.GetQualityTier(itemIndex) > QualityTier.None) { ItemIndex itemIndexOfQuality = QualityCatalog.GetItemIndexOfQuality(itemIndex, QualityTier.None); if ((int)itemIndexOfQuality != -1 && itemIndexOfQuality != itemIndex) { inventory.UpdateEffectiveItemStacks(itemIndexOfQuality); } } } } private static void ItemInventoryDisplay_OnInventoryChanged(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "WriteItemStacks") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ItemHooks.cs", "ItemInventoryDisplay_OnInventoryChanged", 116); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Action)undoQualityEffectiveStacks); static void undoQualityEffectiveStacks(ItemInventoryDisplay itemInventoryDisplay) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Invalid comparison between Unknown and I4 //IL_0040: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)itemInventoryDisplay.inventory) && itemInventoryDisplay.itemStacks != null && itemInventoryDisplay.itemStacks.Length == ItemCatalog.itemCount) { for (ItemQualityGroupIndex itemQualityGroupIndex = (ItemQualityGroupIndex)0; (int)itemQualityGroupIndex < QualityCatalog.ItemQualityGroupCount; itemQualityGroupIndex++) { ItemQualityGroup itemQualityGroup = QualityCatalog.GetItemQualityGroup(itemQualityGroupIndex); if ((int)itemQualityGroup.BaseItemIndex != -1) { ref int reference = ref itemInventoryDisplay.itemStacks[itemQualityGroup.BaseItemIndex]; if (reference > 0) { ItemQualityCounts itemCountsEffective = itemInventoryDisplay.inventory.GetItemCountsEffective(itemQualityGroup); reference = Math.Max(0, reference - itemCountsEffective.TotalQualityCount); } } } } } } private static void CharacterModel_UpdateItemDisplay(ILContext il) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var inventoryParameter)) { Log.Error("Failed to find inventory parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ItemHooks.cs", "CharacterModel_UpdateItemDisplay", 148); return; } ILCursor val = new ILCursor(il); VariableDefinition itemIndexVar = null; if (!val.TryGotoNext((MoveType)2, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, inventoryParameter.Sequence), (Instruction x) => x.MatchLdloc(typeof(ItemIndex), il, out itemIndexVar), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "CalculateEffectiveItemStacks") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ItemHooks.cs", "CharacterModel_UpdateItemDisplay", 160); return; } val.Emit(OpCodes.Ldarg, inventoryParameter); val.Emit(OpCodes.Ldloc, itemIndexVar); val.EmitDelegate>((Func)getItemCountWithQualities); static int getItemCountWithQualities(int itemCount, Inventory inventory, ItemIndex itemIndex) { //IL_0008: 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) if (Object.op_Implicit((Object)(object)inventory) && QualityCatalog.GetQualityTier(itemIndex) == QualityTier.None) { ItemQualityGroupIndex itemQualityGroupIndex = QualityCatalog.FindItemQualityGroupIndex(itemIndex); if (itemQualityGroupIndex != ItemQualityGroupIndex.Invalid) { itemCount += inventory.GetItemCountsEffective(itemQualityGroupIndex).TotalQualityCount; } } return itemCount; } } private static void HealthComponent_TakeDamageProcess(ILContext il) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_00e7: 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) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageInfo parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ItemHooks.cs", "HealthComponent_TakeDamageProcess", 187); return; } ILCursor val = new ILCursor(il); VariableDefinition damageValueVar = null; if (!val.TryGotoNext(new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "friendlyFireScaling") }) || !val.TryGotoPrev(new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "damage") }) || !val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => x.MatchStloc(typeof(float), il, out damageValueVar) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ItemHooks.cs", "HealthComponent_TakeDamageProcess", 199); return; } val.Emit(OpCodes.Ldloca, damageValueVar); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate((ModifyDamageDelegate)invokeModifyDamage); static void invokeModifyDamage(ref float damageValue, DamageInfo damageInfo) { foreach (ModifyDamageDelegate item in ItemHooks.TakeDamageModifier.GetInvocationList().OfType()) { try { item?.Invoke(ref damageValue, damageInfo); } catch (Exception arg) { Log.Error_NoCallerPrefix($"Failed to invoke TakeDamageModifier: {arg}"); } } } } private static IEnumerator CharacterMaster_HighlightNewItem(orig_HighlightNewItem orig, CharacterMaster self, ItemIndex itemIndex) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) return orig.Invoke(self, QualityCatalog.GetItemIndexOfQuality(itemIndex, QualityTier.None)); } public static bool MatchCallLocalCheckRoll(Instruction instruction) { MethodReference val = default(MethodReference); if (ILPatternMatchingExt.MatchCallOrCallvirt(instruction, ref val) && !string.IsNullOrEmpty((val != null) ? ((MemberReference)val).Name : null) && ((MemberReference)val).Name.Contains(">g__LocalCheckRoll|")) { return true; } return false; } public static bool TryFindNextItemCountVariable(ILCursor c, Type itemDeclaringType, string itemName, out VariableDefinition itemCountVariable) { int itemCountVariableIndex = -1; ILCursor[] array = default(ILCursor[]); if (c.TryFindNext(ref array, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, itemDeclaringType, itemName), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "GetItemCountEffective"), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref itemCountVariableIndex) && Extensions.Is((MemberReference)(object)((VariableReference)c.Context.Method.Body.Variables[itemCountVariableIndex]).VariableType, (MemberInfo)typeof(int)) })) { itemCountVariable = c.Context.Method.Body.Variables[itemCountVariableIndex]; return true; } itemCountVariable = null; return false; } } internal static class JumpBoost { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown GenericCharacterMain.ProcessJump_bool += new Manipulator(GenericCharacterMain_ProcessJump_bool); } private static void GenericCharacterMain_ProcessJump_bool(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); VariableDefinition isQuailJumpVar = null; if (!val.TryGotoNext(new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Prefabs/Effects/BoostJumpEffect") }) || !val.TryGotoPrev(new Func[1] { (Instruction x) => x.MatchLdloc(typeof(bool), il, out isQuailJumpVar) })) { Log.Error("Failed to find isQuailJump variable", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\JumpBoost.cs", "GenericCharacterMain_ProcessJump_bool", 27); return; } val.Goto(0, (MoveType)0, false); VariableDefinition someVar = null; VariableDefinition horizontalJumpVelocityScaleVar = null; ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "JumpBoost"), (Instruction x) => x.MatchStloc(isQuailJumpVar) }) || !val.TryGotoNext((MoveType)2, new Func[5] { (Instruction x) => x.MatchLdloc(typeof(float), il, out someVar), (Instruction x) => ILPatternMatchingExt.MatchAdd(x), (Instruction x) => x.MatchLdloc(someVar), (Instruction x) => ILPatternMatchingExt.MatchDiv(x), (Instruction x) => x.MatchStloc(typeof(float), il, out horizontalJumpVelocityScaleVar) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\JumpBoost.cs", "GenericCharacterMain_ProcessJump_bool", 45); return; } val.Goto(val.Prev, (MoveType)0, false); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getHorizontalJumpVelocityScale); val.Goto(0, (MoveType)0, false); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "ApplyJumpVelocity") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\JumpBoost.cs", "GenericCharacterMain_ProcessJump_bool", 92); return; } val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc, isQuailJumpVar); val.EmitDelegate>((Action)onJump); static float getHorizontalJumpVelocityScale(float horizontalJumpVelocityScale, GenericCharacterMain genericCharacterMain) { Inventory val2 = (Object.op_Implicit((Object)(object)((genericCharacterMain != null) ? ((EntityState)genericCharacterMain).characterBody : null)) ? ((EntityState)genericCharacterMain).characterBody.inventory : null); if (Object.op_Implicit((Object)(object)val2)) { ItemQualityCounts itemCountsEffective = val2.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.JumpBoost); if (itemCountsEffective.TotalQualityCount > 0 && ((EntityState)(object)genericCharacterMain).TryGetComponentCached(out CharacterBodyExtraStatsTracker component2) && component2.QuailJumpComboAuthority > 0) { float num = 0.2f * (float)itemCountsEffective.UncommonCount + 0.4f * (float)itemCountsEffective.RareCount + 0.7f * (float)itemCountsEffective.EpicCount + 1f * (float)itemCountsEffective.LegendaryCount; int num2 = 5 * itemCountsEffective.TotalQualityCount; if (num > 0f) { float num3 = (float)Mathf.Min(num2, component2.QuailJumpComboAuthority) * num; horizontalJumpVelocityScale += num3; } } } return horizontalJumpVelocityScale; } static void onJump(GenericCharacterMain genericCharacterMain, bool isQuailJump) { if (isQuailJump && ((EntityState)(object)genericCharacterMain).TryGetComponentCached(out CharacterBodyExtraStatsTracker component)) { component.OnQuailJumpAuthority(); } } } } internal static class JumpDamageStrike { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown JumpDamageStrikeBodyBehavior.DischargeEffects += new Manipulator(JumpDamageStrikeBodyBehavior_DischargeEffects); } private static void JumpDamageStrikeBodyBehavior_DischargeEffects(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0051: 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) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "baseDamage") })) { Log.Error("Failed to find damage patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\JumpDamageStrike.cs", "JumpDamageStrikeBodyBehavior_DischargeEffects", 26); } else { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getBlastDamage); } val.Goto(0, (MoveType)0, false); if (!val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "SetBuffCount") })) { Log.Error("Failed to find charge decrease patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\JumpDamageStrike.cs", "JumpDamageStrikeBodyBehavior_DischargeEffects", 62); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getBuffCountAfterDischarge); static float getBlastDamage(float blastDamage, JumpDamageStrikeBodyBehavior jumpDamageStrikeBodyBehavior) { CharacterBody val3 = (Object.op_Implicit((Object)(object)jumpDamageStrikeBodyBehavior) ? ((BaseItemBodyBehavior)jumpDamageStrikeBodyBehavior).body : null); if (Object.op_Implicit((Object)(object)val3) && Object.op_Implicit((Object)(object)val3.inventory)) { ItemQualityCounts itemCountsEffective2 = val3.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.JumpDamageStrike); if (itemCountsEffective2.TotalQualityCount > 0) { float num2 = 1.5f * (float)itemCountsEffective2.UncommonCount + 2.5f * (float)itemCountsEffective2.RareCount + 3.5f * (float)itemCountsEffective2.EpicCount + 5f * (float)itemCountsEffective2.LegendaryCount; float num3 = ((val3.baseMoveSpeed > 0f) ? Mathf.Max(0f, val3.moveSpeed / val3.baseMoveSpeed - 1f) : 0f); float num4 = num2 * num3; blastDamage += num4 * val3.damage; } } return blastDamage; } static int getBuffCountAfterDischarge(int newBuffCount, JumpDamageStrikeBodyBehavior jumpDamageStrikeBodyBehavior) { CharacterBody val2 = (Object.op_Implicit((Object)(object)jumpDamageStrikeBodyBehavior) ? ((BaseItemBodyBehavior)jumpDamageStrikeBodyBehavior).body : null); if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.inventory)) { ItemQualityCounts itemCountsEffective = val2.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.JumpDamageStrike); int num; switch (itemCountsEffective.HighestQuality) { case QualityTier.None: num = int.MaxValue; break; case QualityTier.Uncommon: num = 75; break; case QualityTier.Rare: num = 50; break; case QualityTier.Epic: num = 25; break; case QualityTier.Legendary: num = 10; break; default: Log.Error($"Quality tier {itemCountsEffective.HighestQuality} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\JumpDamageStrike.cs", "JumpDamageStrikeBodyBehavior_DischargeEffects", 95); num = int.MaxValue; break; } int buffCount = val2.GetBuffCount(Buffs.JumpDamageStrikeCharge); if (buffCount > num) { newBuffCount = buffCount - num; } } return newBuffCount; } } } internal static class KillEliteFrenzy { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(getStatCoefficients); GlobalEventManager.onCharacterDeathGlobal += onCharacterDeathGlobal; } private static void getStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (!Object.op_Implicit((Object)(object)sender.inventory)) { return; } ItemQualityCounts itemCountsEffective = sender.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.KillEliteFrenzy); BuffQualityCounts buffCounts = sender.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.KillEliteFrenzyBuff); if (itemCountsEffective.TotalQualityCount > 0 && buffCounts.TotalQualityCount > 0) { float num = 0.1f * (float)itemCountsEffective.UncommonCount + 0.2f * (float)itemCountsEffective.RareCount + 0.4f * (float)itemCountsEffective.EpicCount + 0.6f * (float)itemCountsEffective.LegendaryCount; if (num > 0f) { args.damageMultAdd += num * (float)buffCounts.TotalQualityCount; } } } private static void onCharacterDeathGlobal(DamageReport deathReport) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && deathReport != null && deathReport.victimIsElite && Object.op_Implicit((Object)(object)deathReport.attackerBody) && Object.op_Implicit((Object)(object)deathReport.attackerBody.inventory)) { ItemQualityCounts itemCountsEffective = deathReport.attackerBody.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.KillEliteFrenzy); if (itemCountsEffective.TotalQualityCount > 0 && deathReport.attackerBody.HasBuff(Buffs.NoCooldowns)) { deathReport.attackerBody.AddBuff(ItemQualitiesContent.BuffQualityGroups.KillEliteFrenzyBuff.GetBuffIndex(itemCountsEffective.HighestQuality)); } } } } public sealed class KillEliteFrenzyQualityItemBehavior : QualityItemBodyBehavior { [ItemGroupAssociation(QualityItemBehaviorUsageFlags.Server)] private static ItemQualityGroup GetItemGroup() { return ItemQualitiesContent.ItemQualityGroups.KillEliteFrenzy; } private void OnDisable() { if (NetworkServer.active) { base.Body.RemoveAllQualityBuffs(ItemQualitiesContent.BuffQualityGroups.KillEliteFrenzyBuff); } } private void FixedUpdate() { if (NetworkServer.active && !base.Body.HasBuff(Buffs.NoCooldowns) && base.Body.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.KillEliteFrenzyBuff).TotalQualityCount > 0) { base.Body.RemoveAllQualityBuffs(ItemQualitiesContent.BuffQualityGroups.KillEliteFrenzyBuff); } } protected override void OnStacksChanged() { base.OnStacksChanged(); base.Body.ConvertQualityBuffsToTier(ItemQualitiesContent.BuffQualityGroups.KillEliteFrenzyBuff, base.Stacks.HighestQuality); } } internal static class KnockBackHitEnemies { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown KnockbackFinUtil.ModifyDamageInfo += new Manipulator(KnockbackFinUtil_ModifyDamageInfo); } private static void KnockbackFinUtil_ModifyDamageInfo(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!((MethodReference)(object)il.Method).TryFindParameter("attacker", out var parameter)) { Log.Error("Failed to find attacker body parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\KnockBackHitEnemies.cs", "KnockbackFinUtil_ModifyDamageInfo", 24); return; } if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0.1f) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\KnockBackHitEnemies.cs", "KnockbackFinUtil_ModifyDamageInfo", 31); return; } val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)getDamageCoefficientPerBounce); static float getDamageCoefficientPerBounce(float damageCoefficient, CharacterBody attackerBody) { Inventory val2 = (Object.op_Implicit((Object)(object)attackerBody) ? attackerBody.inventory : null); if (Object.op_Implicit((Object)(object)val2)) { ItemQualityCounts itemCountsEffective = val2.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.KnockBackHitEnemies); if (itemCountsEffective.TotalQualityCount > 0) { damageCoefficient += 0.05f * (float)itemCountsEffective.UncommonCount + 0.1f * (float)itemCountsEffective.RareCount + 0.2f * (float)itemCountsEffective.EpicCount + 0.35f * (float)itemCountsEffective.LegendaryCount; } } return damageCoefficient; } } } internal static class LaserTurbine { [SystemInitializer(new Type[] { })] private static void Init() { //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 LaserTurbineController.OnOwnerKilledOtherServer += new Manipulator(LaserTurbineController_OnOwnerKilledOtherServer); AimState.Update += new hook_Update(AimState_Update); } private static void AimState_Update(orig_Update orig, AimState self) { //IL_006f: 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) if (Object.op_Implicit((Object)(object)((LaserTurbineBaseState)self).ownerBody) && Object.op_Implicit((Object)(object)((LaserTurbineBaseState)self).ownerBody.inventory) && ((LaserTurbineBaseState)self).ownerBody.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.LaserTurbine).TotalQualityCount > 0 && ((Component)(object)((LaserTurbineBaseState)self).ownerBody).TryGetComponentCached(out CharacterBodyExtraStatsTracker component) && Object.op_Implicit((Object)(object)component.LastHitBody)) { ((LaserTurbineBaseState)self).simpleRotateToDirection.targetRotation = Quaternion.LookRotation(component.LastHitBody.transform.position - ((EntityState)self).transform.position); self.foundTarget = true; } orig.Invoke(self); } public static float GetExplosionRadius(float baseExplosionRadius, CharacterBody attackerBody) { float num = baseExplosionRadius; Inventory val = (Object.op_Implicit((Object)(object)attackerBody) ? attackerBody.inventory : null); if (Object.op_Implicit((Object)(object)val)) { ItemQualityCounts itemCountsEffective = val.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.LaserTurbine); if (itemCountsEffective.TotalQualityCount > 0) { num += 4f * (float)itemCountsEffective.UncommonCount + 7f * (float)itemCountsEffective.RareCount + 10f * (float)itemCountsEffective.EpicCount + 14f * (float)itemCountsEffective.LegendaryCount; } } return num; } private static void LaserTurbineController_OnOwnerKilledOtherServer(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "killChargeDuration"), (Instruction x) => ILPatternMatchingExt.MatchConvR4(x) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\LaserTurbine.cs", "LaserTurbineController_OnOwnerKilledOtherServer", 65); return; } val.Goto(array[1].Next, (MoveType)2, false); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getKillChargeDuration); static float getKillChargeDuration(float killChargeDuration, LaserTurbineController laserTurbineController) { if (Object.op_Implicit((Object)(object)laserTurbineController) && Object.op_Implicit((Object)(object)laserTurbineController.cachedOwnerBody) && Object.op_Implicit((Object)(object)laserTurbineController.cachedOwnerBody.inventory)) { ItemQualityCounts itemCountsEffective = laserTurbineController.cachedOwnerBody.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.LaserTurbine); if (itemCountsEffective.TotalQualityCount > 0) { killChargeDuration += 1f * (float)itemCountsEffective.UncommonCount + 3f * (float)itemCountsEffective.RareCount + 5f * (float)itemCountsEffective.EpicCount + 7f * (float)itemCountsEffective.LegendaryCount; } } return killChargeDuration; } } } public sealed class LaserTurbineBombQualityController : MonoBehaviour { private ProjectileImpactExplosion _projectileImpactExplosion; [SystemInitializer(new Type[] { })] private static 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) AsyncOperationHandle handle = AddressableUtil.LoadAssetAsync(RoR2_Base_LaserTurbine.LaserTurbineBomb_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject laserTurbineBomb) { UnityObjectExtensions.EnsureComponent(laserTurbineBomb); }); } private void Awake() { _projectileImpactExplosion = ((Component)this).GetComponent(); ProjectileController val = default(ProjectileController); if (Object.op_Implicit((Object)(object)_projectileImpactExplosion) && ((Component)this).TryGetComponent(ref val)) { val.onInitialized += onInitialized; } } private void onInitialized(ProjectileController projectileController) { GameObject val = (Object.op_Implicit((Object)(object)projectileController) ? projectileController.owner : null); CharacterBody val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponent() : null); if (Object.op_Implicit((Object)(object)val2)) { ((ProjectileExplosion)_projectileImpactExplosion).blastRadius = LaserTurbine.GetExplosionRadius(((ProjectileExplosion)_projectileImpactExplosion).blastRadius, val2); } } } internal static class LowerPricedChests { private sealed class QualitySaleStarState { public ItemQualityCounts SaleStarsSpent; } private delegate bool ConsumeQualitySaleStarsDelegate(bool result, Interactor activator, in ItemTransformation itemTransformation, ref TryTransformResult consumeTransformResult, QualitySaleStarState saleStarState); private delegate UniquePickup TryUpgradePickupQualityFromSaleStarsDelegate(UniquePickup pickup, QualityTier[] saleStarDropQualityTiers, ref int pickupSequenceIndex); [SystemInitializer(new Type[] { })] private static void Init() { //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 CharacterMaster.TrySaleStar += new hook_TrySaleStar(CharacterMaster_TrySaleStar); PurchaseInteraction.OnInteractionBegin += new Manipulator(PurchaseInteraction_OnInteractionBegin); ChestBehavior.BaseItemDrop += new Manipulator(ChestBehavior_BaseItemDrop); RouletteChestController.EjectPickupServer += new Manipulator(RouletteChestController_EjectPickupServer); } private static void CharacterMaster_TrySaleStar(orig_TrySaleStar orig, CharacterMaster self) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 //IL_0042: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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) orig.Invoke(self); if (!Object.op_Implicit((Object)(object)self) || !Object.op_Implicit((Object)(object)self.inventory)) { return; } TryTransformResult val3 = default(TryTransformResult); for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { ItemIndex itemIndex = ItemQualitiesContent.ItemQualityGroups.LowerPricedChests.GetItemIndex(qualityTier); ItemIndex itemIndex2 = ItemQualitiesContent.ItemQualityGroups.LowerPricedChestsConsumed.GetItemIndex(qualityTier); if ((int)itemIndex != -1 && (int)itemIndex2 != -1) { ItemTransformation val = default(ItemTransformation); ((ItemTransformation)(ref val)).originalItemIndex = itemIndex2; ((ItemTransformation)(ref val)).newItemIndex = itemIndex; ((ItemTransformation)(ref val)).maxToTransform = int.MaxValue; val.transformationType = (ItemTransformationTypeIndex)6; ItemTransformation val2 = val; ((ItemTransformation)(ref val2)).TryTransform(self.inventory, ref val3); } } } private static void PurchaseInteraction_OnInteractionBegin(ILContext il) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find Interactor parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\LowerPricedChests.cs", "PurchaseInteraction_OnInteractionBegin", 61); return; } ILCursor val = new ILCursor(il); VariableDefinition val2 = il.AddVariable(); val.Emit(OpCodes.Newobj, (MethodBase)typeof(QualitySaleStarState).GetConstructor(Array.Empty())); val.Emit(OpCodes.Stloc, val2); VariableDefinition saleStarItemTransformationVar = null; VariableDefinition saleStarItemTransformationResultVar = null; if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "saleStarCompatible") }) || !val.TryGotoNext((MoveType)2, new Func[5] { (Instruction x) => x.MatchLdloca(typeof(ItemTransformation), il, out saleStarItemTransformationVar), (Instruction x) => x.MatchLdloc(typeof(CharacterBody), il, out var _), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "get_inventory"), (Instruction x) => x.MatchLdloca(typeof(TryTransformResult), il, out saleStarItemTransformationResultVar), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "TryTransform") })) { Log.Error("Failed to find sale star proc patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\LowerPricedChests.cs", "PurchaseInteraction_OnInteractionBegin", 82); return; } val.Emit(OpCodes.Ldarg, parameter); val.Emit(OpCodes.Ldloca, saleStarItemTransformationVar); val.Emit(OpCodes.Ldloca, saleStarItemTransformationResultVar); val.Emit(OpCodes.Ldloc, val2); val.EmitDelegate((ConsumeQualitySaleStarsDelegate)consumeQualitySaleStars); if (!val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "PayCost") })) { Log.Error("Failed to find PayCost patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\LowerPricedChests.cs", "PurchaseInteraction_OnInteractionBegin", 141); return; } val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldloc, val2); val.EmitDelegate>((Action)onPayCost); static void addStackValues(ref ItemStackValues a, in ItemStackValues b) { a.permanentStacks += b.permanentStacks; a.temporaryStacksValue += b.temporaryStacksValue; a.totalStacks += b.totalStacks; } static bool consumeQualitySaleStars(bool result, Interactor activator, in ItemTransformation itemTransformation, ref TryTransformResult consumeTransformResult, QualitySaleStarState saleStarState) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) CharacterBody val3 = (Object.op_Implicit((Object)(object)activator) ? ((Component)activator).GetComponent() : null); Inventory val4 = (Object.op_Implicit((Object)(object)val3) ? val3.inventory : null); if (result && saleStarState != null) { saleStarState.SaleStarsSpent.BaseItemCount = consumeTransformResult.takenItem.stackValues.permanentStacks; } if (Object.op_Implicit((Object)(object)val4)) { TryTransformResult val6 = default(TryTransformResult); for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { ItemTransformation val5 = itemTransformation; ((ItemTransformation)(ref val5)).originalItemIndex = ItemQualitiesContent.ItemQualityGroups.LowerPricedChests.GetItemIndex(qualityTier); ((ItemTransformation)(ref val5)).newItemIndex = ItemQualitiesContent.ItemQualityGroups.LowerPricedChestsConsumed.GetItemIndex(qualityTier); if (((ItemTransformation)(ref val5)).TryTransform(val4, ref val6)) { result = true; addStackValues(ref consumeTransformResult.takenItem.stackValues, in val6.takenItem.stackValues); addStackValues(ref consumeTransformResult.givenItem.stackValues, in val6.givenItem.stackValues); if (saleStarState != null) { saleStarState.SaleStarsSpent[qualityTier] += val6.takenItem.stackValues.totalStacks; } } } } return result; } static void onPayCost(PayCostResults results, QualitySaleStarState saleStarState) { if (results != null && saleStarState != null) { results.SetUsedSaleStars(saleStarState.SaleStarsSpent); } } } private static QualityTier[] generateQualityDropTiersFromSaleStars(GameObject purchasedObject, int dropCount, bool useFirstInteractionCost, Xoroshiro128Plus rng) { QualityTier[] result = Array.Empty(); ObjectPurchaseContext objectPurchaseContext = default(ObjectPurchaseContext); if (dropCount > 0 && Object.op_Implicit((Object)(object)purchasedObject) && purchasedObject.TryGetComponent(ref objectPurchaseContext)) { ObjectPurchaseContext.PurchaseResults purchaseResults = (useFirstInteractionCost ? objectPurchaseContext.FirstInteractionResults : objectPurchaseContext.Results); if (purchaseResults != null) { ItemQualityCounts usedSaleStarCounts = purchaseResults.UsedSaleStarCounts; if (usedSaleStarCounts.TotalQualityCount > 0) { int num = dropCount - 1; Span span = stackalloc QualityTier[num]; int num2 = 0; for (QualityTier qualityTier = QualityTier.Legendary; qualityTier > QualityTier.None; qualityTier--) { int num3 = Mathf.Min(Mathf.CeilToInt((float)usedSaleStarCounts[qualityTier] / (float)usedSaleStarCounts.TotalCount * (float)num), span.Length - num2); if (num3 > 0) { span.Slice(num2, num3).Fill(qualityTier); num2 += num3; if (num2 >= span.Length) { break; } } } if (num2 < span.Length) { span.Slice(num2).Fill(QualityTier.None); } Util.ShuffleSpan(span, rng); result = span.ToArray(); } } } return result; } private static UniquePickup tryUpgradePickupQualityFromSaleStars(UniquePickup pickup, QualityTier[] saleStarDropQualityTiers, ref int pickupSequenceIndex) { //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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) QualityTier qualityTier = QualityCatalog.GetQualityTier(pickup.pickupIndex); if (saleStarDropQualityTiers != null && pickupSequenceIndex > 0) { int num = pickupSequenceIndex - 1; QualityTier qualityTier2 = QualityTier.None; QualityTier safe = ArrayUtils.GetSafe(saleStarDropQualityTiers, num, ref qualityTier2); if (safe > qualityTier) { pickup = pickup.WithQualityTier(safe); qualityTier = safe; } } pickupSequenceIndex++; return pickup; } private static void ChestBehavior_BaseItemDrop(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_000f: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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) ILCursor val = new ILCursor(il); VariableDefinition val2 = il.AddVariable(); val.Emit(OpCodes.Ldc_I4_0); val.Emit(OpCodes.Stloc, val2); VariableDefinition val3 = il.AddVariable(); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getUpgradeQualityTiers); val.Emit(OpCodes.Stloc, val3); if (val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "CreatePickupDroplet") }) && val.TryGotoPrev((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "set_pickup") })) { val.Emit(OpCodes.Ldloc, val3); val.Emit(OpCodes.Ldloca, val2); val.EmitDelegate((TryUpgradePickupQualityFromSaleStarsDelegate)tryUpgradePickupQualityFromSaleStars); } else { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\LowerPricedChests.cs", "ChestBehavior_BaseItemDrop", 261); } static QualityTier[] getUpgradeQualityTiers(ChestBehavior chestBehavior) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)chestBehavior)) { return Array.Empty(); } Xoroshiro128Plus rng = new Xoroshiro128Plus(chestBehavior.rng.nextUlong); return generateQualityDropTiersFromSaleStars(((Component)chestBehavior).gameObject, chestBehavior.dropCount, useFirstInteractionCost: false, rng); } } private static void RouletteChestController_EjectPickupServer(ILContext il) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var pickupParameter)) { Log.Error("Failed to find PickupIndex parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\LowerPricedChests.cs", "RouletteChestController_EjectPickupServer", 269); return; } ILCursor val = new ILCursor(il); VariableDefinition val2 = il.AddVariable(); val.Emit(OpCodes.Ldc_I4_0); val.Emit(OpCodes.Stloc, val2); VariableDefinition val3 = il.AddVariable(); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getUpgradeQualityTiers); val.Emit(OpCodes.Stloc, val3); if (val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "CreatePickupDroplet") }) && val.TryGotoPrev((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, ((ParameterReference)pickupParameter).Index) })) { val.Emit(OpCodes.Ldloc, val3); val.Emit(OpCodes.Ldloca, val2); val.EmitDelegate((TryUpgradePickupQualityFromSaleStarsDelegate)tryUpgradePickupQualityFromSaleStars); } else { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\LowerPricedChests.cs", "RouletteChestController_EjectPickupServer", 304); } static QualityTier[] getUpgradeQualityTiers(RouletteChestController rouletteChestController) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)rouletteChestController)) { return Array.Empty(); } Xoroshiro128Plus rng = new Xoroshiro128Plus(rouletteChestController.rng.nextUlong); return generateQualityDropTiersFromSaleStars(((Component)rouletteChestController).gameObject, rouletteChestController.dropCount, useFirstInteractionCost: true, rng); } } } internal static class Medkit { [SystemInitializer(new Type[] { })] private static void Init() { //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 HealthComponent.UpdateLastHitTime += new Manipulator(HealthComponent_UpdateLastHitTime); CharacterBody.RemoveBuff_BuffIndex += new Manipulator(CharacterBody_RemoveBuff_BuffIndex); } private static void CharacterBody_RemoveBuff_BuffIndex(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "MedkitHeal"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "Heal") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Medkit.cs", "CharacterBody_RemoveBuff_BuffIndex", 31); return; } val.Goto(array[1].Next, (MoveType)0, false); MethodReference val2 = (MethodReference)val.Next.Operand; List list = new List(); for (int num = val2.Parameters.Count - 1; num >= 0; num--) { ParameterDefinition val3 = val2.Parameters[num]; if (Extensions.Is((MemberReference)(object)((ParameterReference)val3).ParameterType, (MemberInfo)typeof(float))) { break; } list.Add(il.AddVariable(((ParameterReference)val3).ParameterType)); } list.Reverse(); for (int num2 = list.Count - 1; num2 >= 0; num2--) { val.Emit(OpCodes.Stloc, list[num2]); } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getHealAmount); for (int i = 0; i < list.Count; i++) { val.Emit(OpCodes.Ldloc, list[i]); } static float getHealAmount(float healAmount, CharacterBody body) { if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.inventory)) { ItemQualityCounts itemCountsEffective = body.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Medkit); if (itemCountsEffective.TotalQualityCount > 0 && ((Component)(object)body).TryGetComponentCached(out CharacterBodyExtraStatsTracker component)) { float currentMedkitProcTimeSinceLastHit = component.CurrentMedkitProcTimeSinceLastHit; component.CurrentMedkitProcTimeSinceLastHit = 0f; if (currentMedkitProcTimeSinceLastHit > 0f) { float num3 = 0.01f * (float)itemCountsEffective.UncommonCount + 0.02f * (float)itemCountsEffective.RareCount + 0.04f * (float)itemCountsEffective.EpicCount + 0.08f * (float)itemCountsEffective.LegendaryCount; float num4 = 1f * (float)itemCountsEffective.UncommonCount + 1.5f * (float)itemCountsEffective.RareCount + 2.5f * (float)itemCountsEffective.EpicCount + 4f * (float)itemCountsEffective.LegendaryCount; float num5 = 1f + Mathf.Min(num4, num3 * currentMedkitProcTimeSinceLastHit); healAmount *= num5; } } } return healAmount; } } private static void HealthComponent_UpdateLastHitTime(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "medkit"), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "MedkitHeal"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "AddTimedBuff") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Medkit.cs", "HealthComponent_UpdateLastHitTime", 107); return; } val.Goto(array[2].Next, (MoveType)2, false); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Action)onMedkitProc); static void onMedkitProc(HealthComponent healthComponent) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)healthComponent) && ((Component)(object)healthComponent).TryGetComponentCached(out CharacterBodyExtraStatsTracker component)) { FixedTimeStamp val2 = healthComponent.lastHitTime; if (((FixedTimeStamp)(ref val2)).isInfinity && Object.op_Implicit((Object)(object)healthComponent.body)) { val2 = healthComponent.body.localStartTime; } float timeSince = ((FixedTimeStamp)(ref val2)).timeSince; component.CurrentMedkitProcTimeSinceLastHit = timeSince; } } } } internal static class MeteorAttackOnHighDamage { private const float BaseRadius = 10f; private static float _radiusToPredictionScale = 0.1f; private static float _radiusToImpactScale = 0.1f; [SystemInitializer(new Type[] { })] private static 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_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 AsyncOperationHandle handle = AddressableUtil.LoadAssetAsync(RoR2_DLC2_Items_MeteorAttackOnHighDamage.RunicMeteorStrikePredictionEffect_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject meteorPredictionEffect) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) float x2 = meteorPredictionEffect.transform.localScale.x; _radiusToPredictionScale *= x2; EffectComponent val2 = default(EffectComponent); if (meteorPredictionEffect.TryGetComponent(ref val2)) { val2.applyScale = true; } }); handle = AddressableUtil.LoadAssetAsync(RoR2_DLC2_Items_MeteorAttackOnHighDamage.RunicMeteorStrikeImpact_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject meteorImpactEffect) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) float x = meteorImpactEffect.transform.localScale.x; _radiusToImpactScale *= x; EffectComponent val = default(EffectComponent); if (meteorImpactEffect.TryGetComponent(ref val)) { val.applyScale = true; } }); MeteorAttackOnHighDamageBodyBehavior.DetonateRunicLensMeteor += new Manipulator(MeteorAttackOnHighDamageBodyBehavior_DetonateRunicLensMeteor); MeteorAttackOnHighDamageBodyBehavior.FixedUpdate += new Manipulator(MeteorAttackOnHighDamageBodyBehavior_FixedUpdate); GlobalEventManager.ProcessHitEnemy += new Manipulator(GlobalEventManager_ProcessHitEnemy); } public static float GetMeteorRadius(CharacterBody attackerBody) { return getMeteorRadius(10f, attackerBody); } private static float getMeteorRadius(float baseRadius, CharacterBody attackerBody) { float num = baseRadius; if (Object.op_Implicit((Object)(object)attackerBody) && Object.op_Implicit((Object)(object)attackerBody.inventory)) { ItemQualityCounts itemCountsEffective = attackerBody.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.MeteorAttackOnHighDamage); if (itemCountsEffective.TotalQualityCount > 0) { float num2 = 0.75f * (float)itemCountsEffective.UncommonCount + 1f * (float)itemCountsEffective.RareCount + 1.5f * (float)itemCountsEffective.EpicCount + 2f * (float)itemCountsEffective.LegendaryCount; if (num2 > 0f) { num *= 1f + num2; } } num = ExplodeOnDeath.GetExplosionRadius(num, attackerBody); } return num; } private static void MeteorAttackOnHighDamageBodyBehavior_DetonateRunicLensMeteor(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "radius") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\MeteorAttackOnHighDamage.cs", "MeteorAttackOnHighDamageBodyBehavior_DetonateRunicLensMeteor", 90); return; } val.Goto(array[0].Next, (MoveType)0, false); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getMeteorBlastRadius); static float getMeteorBlastRadius(float radius, MeteorAttackOnHighDamageBodyBehavior meteorItemBehavior) { return getMeteorRadius(radius, Object.op_Implicit((Object)(object)meteorItemBehavior) ? ((ItemBehavior)meteorItemBehavior).body : null); } } private static void MeteorAttackOnHighDamageBodyBehavior_FixedUpdate(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_00ce: 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) ILCursor val = new ILCursor(il); VariableDefinition meteorImpactEffectDataVar = null; ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[4] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "shouldSpawnMeteorStrikeVFX"), (Instruction x) => ILPatternMatchingExt.MatchNewobj(x), (Instruction x) => x.MatchStloc(typeof(EffectData), il, out meteorImpactEffectDataVar), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(EffectManager), "SpawnEffect") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\MeteorAttackOnHighDamage.cs", "MeteorAttackOnHighDamageBodyBehavior_FixedUpdate", 116); return; } val.Goto(array[3].Next, (MoveType)0, false); val.Emit(OpCodes.Ldloc, meteorImpactEffectDataVar); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Action)handleQualityMeteorImpactEffectData); static void handleQualityMeteorImpactEffectData(EffectData impactEffectData, MeteorAttackOnHighDamageBodyBehavior meteorItemBehavior) { if (impactEffectData != null) { CharacterBody attackerBody = (Object.op_Implicit((Object)(object)meteorItemBehavior) ? ((ItemBehavior)meteorItemBehavior).body : null); impactEffectData.scale = GetMeteorRadius(attackerBody) * _radiusToImpactScale; } } } private static void GlobalEventManager_ProcessHitEnemy(ILContext il) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageInfo parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\MeteorAttackOnHighDamage.cs", "GlobalEventManager_ProcessHitEnemy", 140); return; } ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[4] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "MeteorAttackOnHighDamage"), (Instruction x) => ILPatternMatchingExt.MatchNewobj(x), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "scale"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(EffectManager), "SpawnEffect") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\MeteorAttackOnHighDamage.cs", "GlobalEventManager_ProcessHitEnemy", 152); return; } val.Goto(array[2].Next, (MoveType)0, false); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)getQualityMeteorPredictionScale); static float getQualityMeteorPredictionScale(float scale, DamageInfo meteorItemBehavior) { return GetMeteorRadius(Object.op_Implicit((Object)(object)meteorItemBehavior?.attacker) ? meteorItemBehavior.attacker.GetComponent() : null) * _radiusToPredictionScale * (scale / 10f); } } } internal static class Missile { private static GameObject _missileBigProjectilePrefab; [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { AsyncOperationHandle missileProjectileLoad = AddressableUtil.LoadTempAssetAsync(RoR2_Base_Common.MissileProjectile_prefab); AsyncOperationHandle missileGhostLoad = AddressableUtil.LoadTempAssetAsync(RoR2_Base_Common.MissileGhost_prefab); AsyncOperationHandle explodeEffectLoad = AddressableUtil.LoadAssetAsync(RoR2_Base_Common_VFX.OmniExplosionVFXQuick_prefab, (AsyncReferenceHandleUnloadType)2); ParallelProgressCoroutine val = new ParallelProgressCoroutine((IProgress)args.ProgressReceiver); val.Add(in missileProjectileLoad); val.Add(in missileGhostLoad); val.Add(in explodeEffectLoad); yield return val; if ((int)missileProjectileLoad.Status != 1 || !Object.op_Implicit((Object)(object)missileProjectileLoad.Result)) { Log.Error($"Failed to load missile projectile prefab: {missileProjectileLoad.OperationException}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Missile.cs", "LoadContent", 39); yield break; } if ((int)missileGhostLoad.Status != 1 || !Object.op_Implicit((Object)(object)missileGhostLoad.Result)) { Log.Error($"Failed to load missile projectile ghost prefab: {missileGhostLoad.OperationException}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Missile.cs", "LoadContent", 45); yield break; } GameObject val2 = PrefabAPI.InstantiateClone(missileGhostLoad.Result, "MissileBigGhost", false); Transform val3 = val2.transform.Find("missile VFX"); if (Object.op_Implicit((Object)(object)val3)) { val3.localScale *= 3f; } else { Log.Warning("Failed to find missile model root", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Missile.cs", "LoadContent", 57); } GameObject val4 = PrefabAPI.InstantiateClone(missileProjectileLoad.Result, "MissileBigProjectile"); val4.GetComponent().ghostPrefab = val2; ProjectileSingleTargetImpact component = val4.GetComponent(); ProjectileImpactExplosion obj = val4.AddComponent(); obj.destroyOnWorld = component.destroyOnWorld; ((ProjectileExplosion)obj).blastDamageCoefficient = 1f; ((ProjectileExplosion)obj).blastProcCoefficient = 1f; ((ProjectileExplosion)obj).blastRadius = 10f; obj.lifetime = float.PositiveInfinity; ((ProjectileExplosion)obj).explosionSoundString = component.hitSoundString; ((ProjectileExplosion)obj).explosionEffect = explodeEffectLoad.Result; Object.Destroy((Object)(object)component); _missileBigProjectilePrefab = val4; args.ContentPack.projectilePrefabs.Add(val4); } [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown GlobalEventManager.ProcessHitEnemy += new Manipulator(GlobalEventManager_ProcessHitEnemy); } private static void GlobalEventManager_ProcessHitEnemy(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0110: 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_0155: 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_0193: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageInfo parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Missile.cs", "GlobalEventManager_ProcessHitEnemy", 96); return; } ILCursor[] array = default(ILCursor[]); ILLabel val12 = default(ILLabel); if (!val.TryFindNext(ref array, new Func[5] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "Missile"), (Instruction x) => ItemHooks.MatchCallLocalCheckRoll(x), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val12), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(Util), "OnHitProcDamage"), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(CommonAssets), "missilePrefab") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Missile.cs", "GlobalEventManager_ProcessHitEnemy", 107); return; } val.Goto(array[2].Next, (MoveType)2, false); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)checkShouldFireBigMissile); VariableDefinition val2 = il.AddVariable(); val.Emit(OpCodes.Stloc, val2); val.Goto(array[3].Next, (MoveType)0, false); val.Emit(OpCodes.Ldarg, parameter); val.Emit(OpCodes.Ldloc, val2); val.EmitDelegate>((Func)getMissileDamageCoefficient); val.Goto(array[4].Next, (MoveType)2, false); val.Emit(OpCodes.Ldloc, val2); val.EmitDelegate>((Func)getMissileProjectilePrefab); val.Index = 0; float num2 = default(float); if (val.TryGotoNext(new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "Missile") }) && val.TryGotoNext(new Func[1] { (Instruction x) => ItemHooks.MatchCallLocalCheckRoll(x) }) && val.TryGotoPrev((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num2) })) { val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)baseMissileChance); } else { Log.Error("IL Hook failed!", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Missile.cs", "GlobalEventManager_ProcessHitEnemy", 199); } static float baseMissileChance(float chance, DamageInfo damageInfo) { GameObject val3 = damageInfo?.attacker; CharacterBody val4 = (Object.op_Implicit((Object)(object)val3) ? val3.GetComponent() : null); Inventory val5 = (Object.op_Implicit((Object)(object)val4) ? val4.inventory : null); if (Object.op_Implicit((Object)(object)val5)) { ItemQualityCounts itemCountsEffective = val5.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Missile); float num = chance; chance = num + (float)(itemCountsEffective.HighestQuality switch { QualityTier.Uncommon => 2, QualityTier.Rare => 4, QualityTier.Epic => 6, QualityTier.Legendary => 10, _ => 0, }); } return chance; } static bool checkShouldFireBigMissile(DamageInfo damageInfo) { GameObject val9 = damageInfo?.attacker; CharacterBody val10 = (Object.op_Implicit((Object)(object)val9) ? val9.GetComponent() : null); CharacterMaster master = (Object.op_Implicit((Object)(object)val10) ? val10.master : null); Inventory val11 = (Object.op_Implicit((Object)(object)val10) ? val10.inventory : null); if (!Object.op_Implicit((Object)(object)val11)) { return false; } ItemQualityCounts itemCountsEffective3 = val11.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Missile); if (itemCountsEffective3.TotalQualityCount <= 0) { return false; } return RollUtil.CheckRoll(10f * (float)itemCountsEffective3.UncommonCount + 15f * (float)itemCountsEffective3.RareCount + 25f * (float)itemCountsEffective3.EpicCount + 40f * (float)itemCountsEffective3.LegendaryCount, master, ((ProcChainMask)(ref damageInfo.procChainMask)).HasProc((ProcType)26)); } static float getMissileDamageCoefficient(float damageCoefficient, DamageInfo damageInfo, bool shouldFireBigMissile) { GameObject val6 = damageInfo?.attacker; CharacterBody val7 = (Object.op_Implicit((Object)(object)val6) ? val6.GetComponent() : null); Inventory val8 = (Object.op_Implicit((Object)(object)val7) ? val7.inventory : null); if (Object.op_Implicit((Object)(object)val8)) { ItemQualityCounts itemCountsEffective2 = val8.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Missile); if (shouldFireBigMissile) { damageCoefficient += 1.5f * (float)itemCountsEffective2.UncommonCount + 3f * (float)itemCountsEffective2.RareCount + 6f * (float)itemCountsEffective2.EpicCount + 8f * (float)itemCountsEffective2.LegendaryCount; } } return damageCoefficient; } static GameObject getMissileProjectilePrefab(GameObject missilePrefab, bool shouldFireBigMissile) { if (shouldFireBigMissile && Object.op_Implicit((Object)(object)_missileBigProjectilePrefab)) { missilePrefab = _missileBigProjectilePrefab; } return missilePrefab; } } } internal static class MissileVoid { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown GlobalEventManager.ProcessHitEnemy += new Manipulator(GlobalEventManager_ProcessHitEnemy); } private static void GlobalEventManager_ProcessHitEnemy(ILContext il) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageInfo parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\MissileVoid.cs", "GlobalEventManager_ProcessHitEnemy", 23); return; } ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "MissileVoid"), (Instruction x) => ILPatternMatchingExt.MatchNewobj(x), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "damageValue") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\MissileVoid.cs", "GlobalEventManager_ProcessHitEnemy", 34); return; } val.Goto(array[2].Next, (MoveType)0, false); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)getOrbDamage); static float getOrbDamage(float damageValue, DamageInfo damageInfo) { CharacterBody val2 = (Object.op_Implicit((Object)(object)damageInfo?.attacker) ? damageInfo.attacker.GetComponent() : null); Inventory val3 = (Object.op_Implicit((Object)(object)val2) ? val2.inventory : null); if (Object.op_Implicit((Object)(object)val3)) { ItemQualityCounts itemCountsEffective = val3.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.MissileVoid); if (itemCountsEffective.TotalQualityCount > 0) { float num = 1f * (float)itemCountsEffective.UncommonCount + 2f * (float)itemCountsEffective.RareCount + 3f * (float)itemCountsEffective.EpicCount + 5f * (float)itemCountsEffective.LegendaryCount; float num2 = 0f; if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.healthComponent)) { num2 = val2.healthComponent.shield / val2.healthComponent.fullCombinedHealth; } float num3 = num2 * num; if (num3 > 0f) { damageValue += Util.OnHitProcDamage(damageInfo.damage, val2.damage, num3); } } } return damageValue; } } } internal static class MoreMissile { [SystemInitializer(new Type[] { })] private static void Init() { //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 MissileUtils.FireMissile_Vector3_CharacterBody_ProcChainMask_GameObject_float_bool_GameObject_DamageColorIndex_Vector3_float_bool += new Manipulator(MissileUtils_FireMissile); GlobalEventManager.ProcessHitEnemy += new Manipulator(GlobalEventManager_ProcessHitEnemy); } public static int RollAdditionalMissileCount(CharacterBody attackerBody, bool sureProc) { if (!Object.op_Implicit((Object)(object)attackerBody) || !Object.op_Implicit((Object)(object)attackerBody.inventory)) { return 0; } ItemQualityCounts itemCountsEffective = attackerBody.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.MoreMissile); if (itemCountsEffective.TotalQualityCount <= 0) { return 0; } return RollUtil.GetOverflowRoll(50f * (float)itemCountsEffective.UncommonCount + 100f * (float)itemCountsEffective.RareCount + 150f * (float)itemCountsEffective.EpicCount + 250f * (float)itemCountsEffective.LegendaryCount, attackerBody.master, sureProc); } private static void MissileUtils_FireMissile(ILContext il) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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) if (!((MethodReference)(object)il.Method).TryFindParameter("attackerBody", out var parameter)) { Log.Error("Failed to find attackerBody parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\MoreMissile.cs", "MissileUtils_FireMissile", 43); } if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter2)) { Log.Error("Failed to find ProcChainMaskParameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\MoreMissile.cs", "MissileUtils_FireMissile", 48); } ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "FireProjectile") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\MoreMissile.cs", "MissileUtils_FireMissile", 56); return; } if (parameter != null) { val.Emit(OpCodes.Ldarg, parameter); } else { val.Emit(OpCodes.Ldnull); } if (parameter2 != null) { val.Emit(OpCodes.Ldarg, parameter2); } else { val.EmitDefaultValue(); } val.EmitDelegate>((Func)tryFireExtraMissiles); static FireProjectileInfo tryFireExtraMissiles(FireProjectileInfo missileProjectileInfo, CharacterBody attackerBody, ProcChainMask procChainMask) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c2: 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) if (!Object.op_Implicit((Object)(object)attackerBody) && Object.op_Implicit((Object)(object)missileProjectileInfo.owner)) { attackerBody = missileProjectileInfo.owner.GetComponent(); } if (Object.op_Implicit((Object)(object)attackerBody)) { _ = attackerBody.inventory; } int num = RollAdditionalMissileCount(attackerBody, ((ProcChainMask)(ref procChainMask)).HasProc((ProcType)26)); if (num > 0) { Vector3 val2 = missileProjectileInfo.rotation * Vector3.forward; Vector3 val3 = (Object.op_Implicit((Object)(object)attackerBody.inputBank) ? attackerBody.inputBank.aimDirection : attackerBody.transform.position); int num2 = num + 1; int num3 = num2 + 2; for (int i = 0; i < num2; i++) { float num4 = Util.Remap((float)(i + 1), 0f, (float)(num3 - 1), -45f, 45f); missileProjectileInfo.rotation = Util.QuaternionSafeLookRotation(Quaternion.AngleAxis(num4, val3) * val2); if (i < num) { ProjectileManager.instance.FireProjectile(missileProjectileInfo); } } } return missileProjectileInfo; } } private static void GlobalEventManager_ProcessHitEnemy(ILContext il) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageInfo parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\MoreMissile.cs", "GlobalEventManager_ProcessHitEnemy", 120); return; } ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "MissileVoid"), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "MoreMissile"), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 3) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\MoreMissile.cs", "GlobalEventManager_ProcessHitEnemy", 131); return; } val.Goto(array[2].Next, (MoveType)2, false); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)getMoreMissileCount); static int getMoreMissileCount(int missileCount, DamageInfo damageInfo) { CharacterBody attackerBody = default(CharacterBody); if (Object.op_Implicit((Object)(object)damageInfo?.attacker) && damageInfo.attacker.TryGetComponent(ref attackerBody)) { missileCount += RollAdditionalMissileCount(attackerBody, ((ProcChainMask)(ref damageInfo.procChainMask)).HasProc((ProcType)26)); } return missileCount; } } } internal static class MoveSpeedOnKill { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(getStatCoefficients); GlobalEventManager.onCharacterDeathGlobal += onCharacterDeathGlobal; } private static void getStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender.inventory)) { ItemQualityCounts itemCountsEffective = sender.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.MoveSpeedOnKill); BuffQualityCounts buffCounts = sender.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.KillMoveSpeed); float num = 0.005f * (float)itemCountsEffective.UncommonCount + 0.006f * (float)itemCountsEffective.RareCount + 0.007f * (float)itemCountsEffective.EpicCount + 0.01f * (float)itemCountsEffective.LegendaryCount; args.moveSpeedMultAdd += num * (float)buffCounts.TotalQualityCount; } } private static void onCharacterDeathGlobal(DamageReport damageReport) { //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_00a6: 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) if (!NetworkServer.active || damageReport == null || !Object.op_Implicit((Object)(object)damageReport.attackerMaster) || !Object.op_Implicit((Object)(object)damageReport.attackerBody) || !Object.op_Implicit((Object)(object)damageReport.attackerMaster.inventory)) { return; } ItemQualityCounts itemCountsEffective = damageReport.attackerMaster.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.MoveSpeedOnKill); if (itemCountsEffective.TotalQualityCount > 0) { BuffIndex buffIndex = ItemQualitiesContent.BuffQualityGroups.KillMoveSpeed.GetBuffIndex(itemCountsEffective.HighestQuality); int num = 100 * itemCountsEffective.UncommonCount + 150 * itemCountsEffective.RareCount + 200 * itemCountsEffective.EpicCount + 250 * itemCountsEffective.LegendaryCount; if (damageReport.attackerBody.GetBuffCount(buffIndex) < num) { damageReport.attackerBody.AddBuff(buffIndex); } } } } public sealed class MoveSpeedOnKillQualityItemBehavior : QualityItemBodyBehavior { [ItemGroupAssociation(QualityItemBehaviorUsageFlags.Server)] private static ItemQualityGroup GetItemGroup() { return ItemQualitiesContent.ItemQualityGroups.MoveSpeedOnKill; } private void OnDisable() { if (NetworkServer.active) { base.Body.RemoveAllQualityBuffs(ItemQualitiesContent.BuffQualityGroups.KillMoveSpeed); } } protected override void OnStacksChanged() { base.OnStacksChanged(); base.Body.ConvertQualityBuffsToTier(ItemQualitiesContent.BuffQualityGroups.KillMoveSpeed, base.Stacks.HighestQuality); } } public sealed class MushroomBubbleController : MonoBehaviour { private GenericOwnership _genericOwnership; private IgnoredCollisionsProvider _ignoredCollisionsProvider; private EntityStateMachine _stateMachine; private void Awake() { _genericOwnership = ((Component)this).GetComponent(); _ignoredCollisionsProvider = ((Component)this).GetComponent(); _stateMachine = ((Component)this).GetComponent(); } private void OnEnable() { if (Object.op_Implicit((Object)(object)_genericOwnership)) { _genericOwnership.onOwnerChanged += onOwnerChanged; } refreshCollisionWhitelist(); } private void OnDisable() { if (Object.op_Implicit((Object)(object)_genericOwnership)) { _genericOwnership.onOwnerChanged -= onOwnerChanged; } } private void onOwnerChanged(GameObject newOwner) { refreshCollisionWhitelist(); } private void refreshCollisionWhitelist() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Invalid comparison between Unknown and I4 //IL_003b: Unknown result type (might be due to invalid IL or missing references) TeamIndex objectTeam = TeamComponent.GetObjectTeam(Object.op_Implicit((Object)(object)_genericOwnership) ? _genericOwnership.ownerObject : null); if (Object.op_Implicit((Object)(object)_ignoredCollisionsProvider)) { _ignoredCollisionsProvider.CollisionWhitelistFilter = (((int)objectTeam != -1) ? new TeamObjectFilter(objectTeam) { InvertFilter = true } : null); } } public void Undeploy() { invokeStateUndeploy(immediate: false); } public void UndeployImmediate() { invokeStateUndeploy(immediate: true); } private void invokeStateUndeploy(bool immediate) { if (Object.op_Implicit((Object)(object)_stateMachine) && _stateMachine.state is MushroomBubbleBaseState mushroomBubbleBaseState) { mushroomBubbleBaseState.Undeploy(immediate); } } } public sealed class MushroomQualityItemBehavior : QualityItemBodyBehavior { private static DeployableSlot _mushroomBubbleDeployableSlot = (DeployableSlot)35; private static GameObject _bubbleShieldPrefab; private MushroomBubbleController _shieldInstance; private static int getMushroomBubbleLimit(CharacterMaster master, int deployableCountMultiplier) { return 1; } [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //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) _mushroomBubbleDeployableSlot = DeployableAPI.RegisterDeployableSlot(new GetDeployableSameSlotLimit(getMushroomBubbleLimit)); } [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { AsyncOperationHandle bubbleShieldLoad = AddressableUtil.LoadTempAssetAsync(RoR2_Base_Engi.EngiBubbleShield_prefab); AsyncOperationHandle engiBodyLoad = AddressableUtil.LoadTempAssetAsync(RoR2_Base_Engi.EngiBody_prefab); ParallelProgressCoroutine val = new ParallelProgressCoroutine((IProgress)args.ProgressReceiver); val.Add(in bubbleShieldLoad); val.Add(in engiBodyLoad); yield return val; if ((int)bubbleShieldLoad.Status != 1 || !Object.op_Implicit((Object)(object)bubbleShieldLoad.Result)) { Log.Error($"Failed to load Engie Bubble Shield prefab: {bubbleShieldLoad.OperationException}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\MushroomQualityItemBehavior.cs", "LoadContent", 53); yield break; } _bubbleShieldPrefab = PrefabAPI.InstantiateClone(bubbleShieldLoad.Result, "MushroomShield"); Object.Destroy((Object)(object)_bubbleShieldPrefab.GetComponent()); Object.Destroy((Object)(object)_bubbleShieldPrefab.GetComponent()); Object.Destroy((Object)(object)_bubbleShieldPrefab.GetComponent()); Object.Destroy((Object)(object)_bubbleShieldPrefab.GetComponent()); Object.Destroy((Object)(object)_bubbleShieldPrefab.GetComponent()); Object.Destroy((Object)(object)_bubbleShieldPrefab.GetComponent()); Object.Destroy((Object)(object)_bubbleShieldPrefab.GetComponent()); EntityStateMachine component = _bubbleShieldPrefab.GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { Log.Error("Missing EntityStateMachine in MushroomShield", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\MushroomQualityItemBehavior.cs", "LoadContent", 69); yield break; } SerializableEntityStateType val2 = default(SerializableEntityStateType); ((SerializableEntityStateType)(ref val2))..ctor(typeof(MushroomBubbleDeploy)); component.initialStateType = val2; component.mainStateType = val2; ChildLocator component2 = _bubbleShieldPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { Transform val3 = component2.FindChild("Bubble"); if (!Object.op_Implicit((Object)(object)val3)) { Log.Error("Failed to find child in MushroomShield", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\MushroomQualityItemBehavior.cs", "LoadContent", 83); yield break; } ((Component)val3).gameObject.SetActive(true); } BeginRapidlyActivatingAndDeactivating val4 = default(BeginRapidlyActivatingAndDeactivating); if (_bubbleShieldPrefab.TryGetComponent(ref val4)) { ((Behaviour)val4).enabled = false; } Deployable obj = UnityObjectExtensions.EnsureComponent(_bubbleShieldPrefab); _bubbleShieldPrefab.AddComponent(); MushroomBubbleController mushroomBubbleController = _bubbleShieldPrefab.AddComponent(); Deployable val5 = obj; if (val5.onUndeploy == null) { val5.onUndeploy = new UnityEvent(); } obj.onUndeploy.AddPersistentListener(new UnityAction(mushroomBubbleController.UndeployImmediate)); _bubbleShieldPrefab.AddComponent().Colliders = _bubbleShieldPrefab.GetComponentsInChildren(true); Bank val6 = null; AkBank val7 = default(AkBank); if ((int)engiBodyLoad.Status == 1 && Object.op_Implicit((Object)(object)engiBodyLoad.Result) && engiBodyLoad.Result.TryGetComponent(ref val7)) { val6 = val7.data; } if (val6 != null) { AkBank obj2 = _bubbleShieldPrefab.AddComponent(); obj2.data = val6; ((AkTriggerHandler)obj2).triggerList = new List { -320808462 }; obj2.unloadTriggerList = new List { 716467161 }; } else { Log.Warning("Failed to load engineer sound bank", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\MushroomQualityItemBehavior.cs", "LoadContent", 125); } args.ContentPack.networkedObjectPrefabs.Add(_bubbleShieldPrefab); } [ItemGroupAssociation(QualityItemBehaviorUsageFlags.Server)] private static ItemQualityGroup GetItemGroup() { return ItemQualitiesContent.ItemQualityGroups.Mushroom; } private void FixedUpdate() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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) if (Object.op_Implicit((Object)(object)base.Body) && base.Body.notMovingStopwatch >= 0.6f && Object.op_Implicit((Object)(object)base.Body.healthComponent) && base.Body.healthComponent.alive) { if (!Object.op_Implicit((Object)(object)_shieldInstance)) { GameObject val = Object.Instantiate(_bubbleShieldPrefab, ((Component)this).transform.position, Quaternion.identity); val.GetComponent().ownerObject = ((Component)this).gameObject; if (Object.op_Implicit((Object)(object)base.Body.master)) { Deployable component = val.GetComponent(); base.Body.master.AddDeployable(component, _mushroomBubbleDeployableSlot); } _shieldInstance = val.GetComponent(); NetworkServer.Spawn(val); } } else if (Object.op_Implicit((Object)(object)_shieldInstance)) { _shieldInstance.Undeploy(); _shieldInstance = null; } } private void OnDisable() { if (Object.op_Implicit((Object)(object)_shieldInstance)) { _shieldInstance.UndeployImmediate(); _shieldInstance = null; } } } public sealed class MushroomVoidQualityItemBehavior : QualityItemBodyBehavior { public const float HealOrbSpawnInterval = 1f; private float _healOrbSpawnTimer; [ItemGroupAssociation(QualityItemBehaviorUsageFlags.Server)] private static ItemQualityGroup GetItemGroup() { return ItemQualitiesContent.ItemQualityGroups.MushroomVoid; } private void OnEnable() { _healOrbSpawnTimer = 0f; } private void FixedUpdate() { if (base.Body.isSprinting) { _healOrbSpawnTimer += Time.fixedDeltaTime; if (_healOrbSpawnTimer >= 1f) { _healOrbSpawnTimer -= 1f; ((MonoBehaviour)this).StartCoroutine(spawnHealOrb()); } } else { _healOrbSpawnTimer = 0f; } } private IEnumerator spawnHealOrb() { Vector3 spawnPosition = base.Body.corePosition; yield return (object)new WaitForSeconds(0.2f); ItemQualityCounts stacks = base.Stacks; if (stacks.TotalQualityCount <= 0) { yield break; } float num = Mathf.Pow((float)(stacks.UncommonCount + 2 * stacks.RareCount + 3 * stacks.EpicCount + 4 * stacks.LegendaryCount), 0.25f); float flatHealing = base.Body.maxHealth * (0.01f * (float)stacks.UncommonCount + 0.03f * (float)stacks.RareCount + 0.05f * (float)stacks.EpicCount + 0.1f * (float)stacks.LegendaryCount); float fractionalHealing = 0f; GameObject val = Object.Instantiate(ItemQualitiesContent.NetworkedPrefabs.HealPackDelayed, spawnPosition, Quaternion.identity); val.transform.localScale = new Vector3(num, num, num); TeamFilter val2 = default(TeamFilter); if (val.TryGetComponent(ref val2)) { val2.teamIndex = base.Body.teamComponent.teamIndex; } HealthPickup componentInChildren = val.GetComponentInChildren(true); if (Object.op_Implicit((Object)(object)componentInChildren)) { componentInChildren.flatHealing = flatHealing; componentInChildren.fractionalHealing = fractionalHealing; } DelayedHealPackController delayedHealPackController = default(DelayedHealPackController); if (val.TryGetComponent(ref delayedHealPackController)) { float num2 = 6f; GravitatePickup componentInChildren2 = val.GetComponentInChildren(true); SphereCollider val3 = default(SphereCollider); if (Object.op_Implicit((Object)(object)componentInChildren2) && ((Component)componentInChildren2).TryGetComponent(ref val3)) { num2 = val3.radius * ((Component)val3).transform.lossyScale.x; } float num3 = ((!(base.Body.moveSpeed > 0f)) ? 1f : (num2 / base.Body.moveSpeed)); num3 -= 0.2f; delayedHealPackController.NetworkDelay = Mathf.Clamp(num3 + 0.2f, 0.5f, 3f); } NetworkServer.Spawn(val); } } internal static class NearbyDamageBonus { private delegate void ModifyFocusCrystalDamageDelegate(HealthComponent healthComponent, DamageInfo damageInfo, ref float damageValue); private static DamageColorIndex _nearbyBoostedColorIndex; [SystemInitializer(new Type[] { })] private static void Init() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown _nearbyBoostedColorIndex = ColorsAPI.RegisterDamageColor(Color32.op_Implicit(new Color32((byte)247, (byte)59, (byte)115, byte.MaxValue))); HealthComponent.TakeDamageProcess += new Manipulator(HealthComponent_TakeDamageProcess); } private static void HealthComponent_TakeDamageProcess(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageInfo parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\NearbyDamageBonus.cs", "HealthComponent_TakeDamageProcess", 30); return; } ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "NearbyDamageBonus"), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0.2f) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\NearbyDamageBonus.cs", "HealthComponent_TakeDamageProcess", 38); return; } val.Goto(array[1].Next, (MoveType)2, false); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)getFocusCrystalDamage); static float getFocusCrystalDamage(float damagePerFocusCrystal, DamageInfo damageInfo) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Invalid comparison between Unknown and I4 //IL_00aa: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) GameObject val2 = damageInfo?.attacker; CharacterBody val3 = (Object.op_Implicit((Object)(object)val2) ? val2.GetComponent() : null); Inventory val4 = (Object.op_Implicit((Object)(object)val3) ? val3.inventory : null); TeamIndex objectTeam = TeamComponent.GetObjectTeam(val2); if (Object.op_Implicit((Object)(object)val4)) { ItemQualityCounts itemCountsEffective = val4.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.NearbyDamageBonus); if (itemCountsEffective.TotalQualityCount > 0) { SphereSearch val5 = new SphereSearch { origin = val3.corePosition, radius = 13f, queryTriggerInteraction = (QueryTriggerInteraction)1, mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask }; val5.RefreshCandidates(); TeamMask val6 = TeamMask.all; if ((int)objectTeam != -1) { val6 = TeamMask.GetEnemyTeams(objectTeam); } val5.FilterCandidatesByHurtBoxTeam(val6); val5.FilterCandidatesByDistinctHurtBoxEntities(); int num = 0; HurtBox[] hurtBoxes = val5.GetHurtBoxes(); foreach (HurtBox val7 in hurtBoxes) { HealthComponent val8 = (Object.op_Implicit((Object)(object)val7) ? val7.healthComponent : null); if (Object.op_Implicit((Object)(object)val8) && val8.alive && !((Object)(object)((Component)val8).gameObject == (Object)(object)val2)) { num++; } } if (num == 1) { float num2 = 0.05f * (float)itemCountsEffective.UncommonCount + 0.15f * (float)itemCountsEffective.RareCount + 0.35f * (float)itemCountsEffective.EpicCount + 0.5f * (float)itemCountsEffective.LegendaryCount; if (num2 > 0f) { damagePerFocusCrystal += num2; damageInfo.damageColorIndex = _nearbyBoostedColorIndex; } } } } return damagePerFocusCrystal; } } } internal static class NovaOnHeal { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown HealthComponent.ServerFixedUpdate += new Manipulator(HealthComponent_ServerFixedUpdate); } private static void HealthComponent_ServerFixedUpdate(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); VariableDefinition devilOrbVar = null; ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchNewobj(x), (Instruction x) => x.MatchStloc(typeof(DevilOrb), il, out devilOrbVar), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "isCrit") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\NovaOnHeal.cs", "HealthComponent_ServerFixedUpdate", 29); return; } val.Goto(array[2].Next, (MoveType)2, false); val.Emit(OpCodes.Ldloc, devilOrbVar); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Action)handleQualityItem); static void handleQualityItem(DevilOrb devilOrb, HealthComponent healthComponent) { if (devilOrb != null && Object.op_Implicit((Object)(object)healthComponent) && Object.op_Implicit((Object)(object)healthComponent.body) && Object.op_Implicit((Object)(object)healthComponent.body.inventory)) { ItemQualityCounts itemCountsEffective = healthComponent.body.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.NovaOnHeal); if (itemCountsEffective.TotalQualityCount > 0) { float num = itemCountsEffective.HighestQuality switch { QualityTier.Uncommon => 0.4f, QualityTier.Rare => 0.6f, QualityTier.Epic => 0.8f, QualityTier.Legendary => 1f, _ => throw new NotImplementedException($"Quality tier {itemCountsEffective.HighestQuality} is not implemented"), }; devilOrb.procCoefficient = Mathf.Max(devilOrb.procCoefficient, num); float num2 = 0.4f * (float)itemCountsEffective.UncommonCount + 0.8f * (float)itemCountsEffective.RareCount + 1f * (float)itemCountsEffective.EpicCount + 1.5f * (float)itemCountsEffective.LegendaryCount; if (num2 > 0f) { devilOrb.damageValue *= 1f + num2; } } } } } } internal static class OutOfCombatArmor { private static readonly SphereSearch _opalSphereSearch = new SphereSearch(); private static GameObject _explosionVFX; [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown CharacterBody.OnTakeDamageServer += new Manipulator(CharacterBody_OnTakeDamageServer); } [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { AsyncOperationHandle igniteOnKillExplosionLoad = AddressableUtil.LoadTempAssetAsync(RoR2_Base_IgniteOnKill.IgniteExplosionVFX_prefab); ParallelProgressCoroutine val = new ParallelProgressCoroutine((IProgress)args.ProgressReceiver); val.Add(in igniteOnKillExplosionLoad); yield return val; if ((int)igniteOnKillExplosionLoad.Status != 1 || !Object.op_Implicit((Object)(object)igniteOnKillExplosionLoad.Result)) { Log.Error($"Failed to load igniteOnKill VFX prefab: {igniteOnKillExplosionLoad.OperationException}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\OutOfCombatArmor.cs", "LoadContent", 44); yield break; } _explosionVFX = PrefabAPI.InstantiateClone(igniteOnKillExplosionLoad.Result, "opalExplosionVFX", false); Object.Destroy((Object)(object)((Component)_explosionVFX.transform.Find("Flames")).gameObject); Object.Destroy((Object)(object)((Component)_explosionVFX.transform.Find("Flash")).gameObject); args.ContentPack.effectDefs.Add(new EffectDef(_explosionVFX)); } private static void CharacterBody_OnTakeDamageServer(ILContext il) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageReport parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\OutOfCombatArmor.cs", "CharacterBody_OnTakeDamageServer", 58); return; } ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "outOfDangerStopwatch") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\OutOfCombatArmor.cs", "CharacterBody_OnTakeDamageServer", 67); return; } val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Action)onEnterDanger); static void onEnterDanger(CharacterBody victimBody, DamageReport damageReport) { //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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)victimBody) && Object.op_Implicit((Object)(object)victimBody.inventory) && damageReport?.damageInfo != null) { ItemQualityCounts itemCountsEffective = victimBody.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.OutOfCombatArmor); if (itemCountsEffective.TotalQualityCount > 0) { float radius = 0f; switch (itemCountsEffective.HighestQuality) { case QualityTier.Uncommon: radius = 10f; break; case QualityTier.Rare: radius = 20f; break; case QualityTier.Epic: radius = 30f; break; case QualityTier.Legendary: radius = 50f; break; } float stun = itemCountsEffective.UncommonCount * 2 + itemCountsEffective.RareCount * 4 + itemCountsEffective.EpicCount * 6 + itemCountsEffective.LegendaryCount * 8; if (victimBody.HasBuff(Buffs.OutOfCombatArmorBuff)) { List list = default(List); DisposableRental> val2 = CollectionPool>.RentCollection(ref list); try { _opalSphereSearch.origin = victimBody.corePosition; _opalSphereSearch.mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask; _opalSphereSearch.radius = ExplodeOnDeath.GetExplosionRadius(radius, victimBody); _opalSphereSearch.RefreshCandidates(); _opalSphereSearch.FilterCandidatesByHurtBoxTeam(TeamMask.GetUnprotectedTeams(victimBody.teamComponent.teamIndex)); _opalSphereSearch.FilterCandidatesByDistinctHurtBoxEntities(); _opalSphereSearch.GetHurtBoxes(list); _opalSphereSearch.ClearCandidates(); SetStateOnHurt val3 = default(SetStateOnHurt); foreach (HurtBox item in list) { if (Object.op_Implicit((Object)(object)item.healthComponent) && (Object)(object)item.healthComponent.body != (Object)(object)victimBody && ((Component)item.healthComponent).TryGetComponent(ref val3) && val3.canBeStunned) { val3.SetStun(stun); StunChanceOnHit.OnImmobilize(victimBody, item.healthComponent.body); } } EffectManager.SpawnEffect(_explosionVFX, new EffectData { origin = _opalSphereSearch.origin, scale = _opalSphereSearch.radius, rotation = Util.QuaternionSafeLookRotation(damageReport.damageInfo.force) }, true); } finally { val2.Dispose(); } } } } } } } internal static class PermanentDebuffOnHit { private static DotIndex _scorpionVenomDot; [SystemInitializer(new Type[] { })] private static void Init() { //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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0040: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) _scorpionVenomDot = DotAPI.RegisterDotDef(new DotDef { associatedBuff = ItemQualitiesContent.Buffs.ScorpionVenom, damageCoefficient = 0.5f, interval = 0.5f, damageColorIndex = (DamageColorIndex)3 }, (CustomDotBehaviour)null, (CustomDotVisual)null, new CustomDotDamageEvaluation(dealVenomDamage)); GlobalEventManager.onServerDamageDealt += onServerDamageDealt; } private static void onServerDamageDealt(DamageReport damageReport) { //IL_011d: Unknown result type (might be due to invalid IL or missing references) CharacterMaster master = (Object.op_Implicit((Object)(object)damageReport.attackerBody) ? damageReport.attackerBody.master : null); Inventory val = (Object.op_Implicit((Object)(object)damageReport.attackerBody) ? damageReport.attackerBody.inventory : null); if (!Object.op_Implicit((Object)(object)val)) { return; } ItemQualityCounts itemCountsEffective = val.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.PermanentDebuffOnHit); if (itemCountsEffective.TotalQualityCount <= 0) { return; } uint? num = null; if (Object.op_Implicit((Object)(object)damageReport.damageInfo?.inflictor)) { ProjectileDamage component = damageReport.damageInfo.inflictor.GetComponent(); if (Object.op_Implicit((Object)(object)component) && component.useDotMaxStacksFromAttacker) { num = component.dotMaxStacksFromAttacker; } } if (RollUtil.CheckRoll(itemCountsEffective.HighestQuality switch { QualityTier.Uncommon => 2, QualityTier.Rare => 3, QualityTier.Epic => 4, QualityTier.Legendary => 5, _ => 0, }, master, ((ProcChainMask)(ref damageReport.damageInfo.procChainMask)).HasProc((ProcType)26))) { DotController.InflictDot(((Component)damageReport.victim).gameObject, damageReport.attacker, damageReport.damageInfo.inflictedHurtbox, _scorpionVenomDot, 10f * damageReport.damageInfo.procCoefficient, 1f, num); } } private static void dealVenomDamage(DotController self, PendingDamage pendingDamage) { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //IL_00e3: 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_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014c: 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) GameObject attackerObject = pendingDamage.attackerObject; CharacterBody val = (Object.op_Implicit((Object)(object)attackerObject) ? attackerObject.GetComponent() : null); Inventory val2 = (Object.op_Implicit((Object)(object)val) ? val.inventory : null); if (!Object.op_Implicit((Object)(object)val2)) { return; } ItemQualityCounts itemCountsEffective = val2.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.PermanentDebuffOnHit); if (itemCountsEffective.TotalQualityCount <= 0) { return; } float num = (float)itemCountsEffective.UncommonCount * 0.5f + (float)itemCountsEffective.RareCount * 1f + (float)itemCountsEffective.EpicCount * 1.5f + (float)itemCountsEffective.LegendaryCount * 2f; int num2 = 0; for (int i = 0; i < DotAPI.VanillaDotCount + DotAPI.CustomDotCount; i++) { if (self.HasDotActive((DotIndex)i)) { num2++; } } DamageInfo val3 = new DamageInfo(); val3.attacker = pendingDamage.attackerObject; val3.crit = false; val3.damage = pendingDamage.totalDamage * num * (float)num2; val3.force = Vector3.zero; val3.inflictor = ((Component)self).gameObject; val3.position = self.victimBody.corePosition; val3.procCoefficient = 0f; val3.damageColorIndex = DotController.GetDotDef(_scorpionVenomDot).damageColorIndex; val3.damageType = pendingDamage.damageType | DamageTypeCombo.op_Implicit((DamageType)67108864); val3.dotIndex = _scorpionVenomDot; val3.inflictedHurtbox = pendingDamage.hitHurtBox; self.victimHealthComponent.TakeDamage(val3); } } internal static class PersonalShield { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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 RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(getStatCoefficients); GlobalEventManager.OnInteractionsGlobal += onInteractGlobal; HealthComponent.TakeDamageProcess += new Manipulator(HealthComponent_TakeDamageProcess); } private static void HealthComponent_TakeDamageProcess(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); VariableDefinition pendingDamageVar = null; ILLabel val2 = default(ILLabel); if (!val.TryGotoNext((MoveType)0, new Func[4] { (Instruction x) => x.MatchLdloc(typeof(float), il, out pendingDamageVar), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "shield"), (Instruction x) => ILPatternMatchingExt.MatchBgtUn(x, ref val2) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\PersonalShield.cs", "HealthComponent_TakeDamageProcess", 34); return; } val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc, pendingDamageVar); val.EmitDelegate>((Action)onShieldDamaged); static void onShieldDamaged(HealthComponent healthComponent, float pendingDamage) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)healthComponent) && Object.op_Implicit((Object)(object)healthComponent.body)) { float num = Mathf.Min(pendingDamage, healthComponent.shield); if (num > 0f && healthComponent.body.HasBuff(ItemQualitiesContent.Buffs.PersonalShield)) { healthComponent.body.SetBuffCount(ItemQualitiesContent.Buffs.PersonalShield.buffIndex, Mathf.Max(0, (int)((float)healthComponent.body.GetBuffCount(ItemQualitiesContent.Buffs.PersonalShield) - num))); } } } } private static void onInteractGlobal(Interactor interactor, IInteractable interactable, GameObject @object) { //IL_011f: Unknown result type (might be due to invalid IL or missing references) if (!SharedItemUtils.InteractableIsPermittedForSpawn(interactable)) { return; } CharacterBody component = ((Component)interactor).GetComponent(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.inventory)) { return; } ItemQualityCounts itemCountsEffective = component.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.PersonalShield); if (itemCountsEffective.TotalQualityCount > 0) { float num; switch (itemCountsEffective.HighestQuality) { case QualityTier.Uncommon: num = 0.02f; break; case QualityTier.Rare: num = 0.05f; break; case QualityTier.Epic: num = 0.07f; break; case QualityTier.Legendary: num = 0.1f; break; default: Log.Error($"Quality tier {itemCountsEffective.HighestQuality} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\PersonalShield.cs", "onInteractGlobal", 87); return; } float num2 = (float)itemCountsEffective.UncommonCount * 0.2f + (float)itemCountsEffective.RareCount * 0.5f + (float)itemCountsEffective.EpicCount * 0.9f + (float)itemCountsEffective.LegendaryCount * 2f; int buffCount = component.GetBuffCount(ItemQualitiesContent.Buffs.PersonalShield); int num3 = Mathf.CeilToInt((float)buffCount + num * component.maxHealth); int num4 = Mathf.CeilToInt(num2 * component.maxHealth); if (buffCount < num3 && buffCount < num4) { component.SetBuffCount(ItemQualitiesContent.Buffs.PersonalShield.buffIndex, Mathf.Min(num3, num4)); } } } private static void getStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender)) { args.baseShieldAdd += (float)sender.GetBuffCount(ItemQualitiesContent.Buffs.PersonalShield); } } } internal static class Phasing { private static EffectIndex _stealthKitProcEffectIndex = (EffectIndex)(-1); [SystemInitializer(new Type[] { typeof(EffectCatalogUtils) })] private static void Init() { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown _stealthKitProcEffectIndex = EffectCatalogUtils.FindEffectIndex("ProcStealthkit"); if ((int)_stealthKitProcEffectIndex == -1) { Log.Warning("Failed to find stealthkit proc effect index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Phasing.cs", "Init", 21); } PhasingBodyBehavior.FixedUpdate += new Manipulator(PhasingBodyBehavior_FixedUpdate); GlobalEventManager.onServerDamageDealt += onServerDamageDealt; } private static void onServerDamageDealt(DamageReport damageReport) { //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Invalid comparison between Unknown and I4 //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Expected O, but got Unknown if (damageReport?.damageInfo == null || !Object.op_Implicit((Object)(object)damageReport.victimBody) || !Object.op_Implicit((Object)(object)damageReport.victimBody.inventory) || !(damageReport.damageDealt > 0f) || damageReport.damageInfo.rejected) { return; } ItemQualityCounts itemCountsEffective = damageReport.victimBody.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Phasing); if (itemCountsEffective.TotalQualityCount > 0 && RollUtil.CheckRoll(5f * (float)itemCountsEffective.UncommonCount + 15f * (float)itemCountsEffective.RareCount + 30f * (float)itemCountsEffective.EpicCount + 60f * (float)itemCountsEffective.LegendaryCount, damageReport.victimMaster, sureProc: false) && !damageReport.victimBody.hasCloakBuff) { damageReport.victimBody.AddTimedBuff(Buffs.Cloak, 5f); damageReport.victimBody.AddTimedBuff(Buffs.CloakSpeed, 5f); if ((int)_stealthKitProcEffectIndex != -1) { EffectManager.SpawnEffect(_stealthKitProcEffectIndex, new EffectData { origin = damageReport.victimBody.corePosition, rotation = Quaternion.identity }, true); } } } private static void PhasingBodyBehavior_FixedUpdate(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_000c: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int num = 0; while (val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(HealthComponent).GetProperty("isHealthLow").GetMethod) })) { val.Emit(OpCodes.Dup); int index = val.Index; val.Index = index + 1; val.EmitDelegate>((Func)isUnderStealthKitThreshold); num++; } if (num == 0) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Phasing.cs", "PhasingBodyBehavior_FixedUpdate", 94); } static bool isUnderStealthKitThreshold(HealthComponent healthComponent, bool isHealthLow) { if (Object.op_Implicit((Object)(object)healthComponent) && ((Component)(object)healthComponent).TryGetComponentCached(out CharacterBodyExtraStatsTracker component)) { isHealthLow = healthComponent.IsHealthBelowThreshold(component.StealthKitActivationThreshold); } return isHealthLow; } } } internal static class PhysicsProjectile { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown FriendUnitController.ForceInteractibilityUpdate += new hook_ForceInteractibilityUpdate(FriendUnitController_ForceInteractibilityUpdate); } private static void FriendUnitController_ForceInteractibilityUpdate(orig_ForceInteractibilityUpdate orig, FriendUnitController self) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 orig.Invoke(self); FriendUnitQualityController friendUnitQualityController = default(FriendUnitQualityController); if (((Component)self).TryGetComponent(ref friendUnitQualityController)) { bool shouldAllowOnInteractionBeginProc = Object.op_Implicit((Object)(object)self.genericInteraction) && (int)self.genericInteraction.interactability == 2; if (friendUnitQualityController.IsQualityBehaviorActive) { self.SetInteractibility(true); } if (Object.op_Implicit((Object)(object)friendUnitQualityController.InteractionProcFilter)) { friendUnitQualityController.InteractionProcFilter.shouldAllowOnInteractionBeginProc = shouldAllowOnInteractionBeginProc; } } } } internal static class Plant { [SystemInitializer(new Type[] { })] private static 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown AsyncOperationHandle handle = AddressableUtil.LoadAssetAsync(RoR2_Base_Plant.InterstellarDeskPlant_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject deskPlantPrefab) { UnityObjectExtensions.EnsureComponent(deskPlantPrefab); }); GlobalEventManager.OnCharacterDeath += new Manipulator(GlobalEventManager_OnCharacterDeath); MainState.OnEnter += new hook_OnEnter(MainState_OnEnter); } private static void GlobalEventManager_OnCharacterDeath(ILContext il) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageReport parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Plant.cs", "GlobalEventManager_OnCharacterDeath", 33); return; } ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "Plant"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(NetworkServer), "Spawn") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Plant.cs", "GlobalEventManager_OnCharacterDeath", 43); return; } val.Goto(array[1].Next, (MoveType)0, false); val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Action)onSpawnPlant); static void onSpawnPlant(GameObject plantObj, DamageReport damageReport) { GenericOwnership val2 = default(GenericOwnership); if (Object.op_Implicit((Object)(object)plantObj) && plantObj.TryGetComponent(ref val2)) { val2.ownerObject = damageReport?.attacker; } } } private static void MainState_OnEnter(orig_OnEnter orig, BaseState _self) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown orig.Invoke(_self); if (!NetworkServer.active) { return; } try { MainState val = (MainState)_self; HealingWard val2 = default(HealingWard); if (!Object.op_Implicit((Object)(object)val.deskplantWard) || !val.deskplantWard.TryGetComponent(ref val2)) { return; } GameObject val3 = null; GenericOwnership val4 = default(GenericOwnership); if (((EntityState)val).TryGetComponent(ref val4)) { val3 = val4.ownerObject; } CharacterBody val5 = (Object.op_Implicit((Object)(object)val3) ? val3.GetComponent() : null); Inventory val6 = (Object.op_Implicit((Object)(object)val5) ? val5.inventory : null); if (!Object.op_Implicit((Object)(object)val6)) { return; } ItemQualityCounts itemCountsEffective = val6.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Plant); if (itemCountsEffective.TotalQualityCount > 0) { float num = 0.15f * (float)itemCountsEffective.UncommonCount + 0.3f * (float)itemCountsEffective.RareCount + 0.6f * (float)itemCountsEffective.EpicCount + 1f * (float)itemCountsEffective.LegendaryCount; if (num > 0f) { HealingWard obj = val2; obj.interval /= 1f + num; } } } catch (Exception ex) { Log.Error_NoCallerPrefix(ex.ToString()); } } } internal static class PrimarySkillShuriken { [SystemInitializer(new Type[] { })] private static IEnumerator Init() { PrimarySkillShurikenBehavior.FixedUpdate += new Manipulator(PrimarySkillShurikenBehavior_FixedUpdate); GlobalEventManager.onCharacterDeathGlobal += onCharacterDeathGlobal; AsyncOperationHandle shurikenLoad = AddressableUtil.LoadAssetAsync(RoR2_DLC1_PrimarySkillShuriken.ShurikenProjectile_prefab, (AsyncReferenceHandleUnloadType)2); AsyncOperationHandle shurikenGhostLoad = AddressableUtil.LoadAssetAsync(RoR2_DLC1_PrimarySkillShuriken.ShurikenGhost_prefab, (AsyncReferenceHandleUnloadType)2); ParallelCoroutine val = new ParallelCoroutine(); val.Add((IEnumerator)(object)shurikenLoad); val.Add((IEnumerator)(object)shurikenGhostLoad); yield return val; if ((int)shurikenLoad.Status != 1 || !Object.op_Implicit((Object)(object)shurikenLoad.Result)) { Log.Error($"Failed to load Shuriken prefab: {shurikenLoad.OperationException}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\PrimarySkillShuriken.cs", "Init", 35); yield break; } if ((int)shurikenGhostLoad.Status != 1 || !Object.op_Implicit((Object)(object)shurikenGhostLoad.Result)) { Log.Error($"Failed to load ShurikenGhost prefab: {shurikenGhostLoad.OperationException}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\PrimarySkillShuriken.cs", "Init", 41); yield break; } shurikenLoad.Result.AddComponent(); shurikenGhostLoad.Result.GetComponent().inheritScaleFromProjectile = true; } public static float GetTotalReloadTime(CharacterBody body) { return getTotalReloadTime(10f, body); } private static float getTotalReloadTime(float totalReloadTime, CharacterBody body) { Inventory val = (Object.op_Implicit((Object)(object)body) ? body.inventory : null); if (Object.op_Implicit((Object)(object)val)) { ItemQualityCounts itemCountsEffective = val.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.PrimarySkillShuriken); if (itemCountsEffective.TotalQualityCount > 0) { float num = 0.1f * (float)itemCountsEffective.UncommonCount + 0.3f * (float)itemCountsEffective.RareCount + 0.5f * (float)itemCountsEffective.EpicCount + 1f * (float)itemCountsEffective.LegendaryCount; if (num > 0f) { totalReloadTime /= 1f + num; } } } return totalReloadTime; } private static void PrimarySkillShurikenBehavior_FixedUpdate(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 10f) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\PrimarySkillShuriken.cs", "PrimarySkillShurikenBehavior_FixedUpdate", 89); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getTotalShurikenReloadTime); static float getTotalShurikenReloadTime(float totalReloadTime, PrimarySkillShurikenBehavior shurikenBehavior) { return getTotalReloadTime(totalReloadTime, Object.op_Implicit((Object)(object)shurikenBehavior) ? ((ItemBehavior)shurikenBehavior).body : null); } } private static void onCharacterDeathGlobal(DamageReport damageReport) { if (damageReport == null) { return; } CharacterBody attackerBody = damageReport.attackerBody; CharacterMaster attackerMaster = damageReport.attackerMaster; if (!Object.op_Implicit((Object)(object)attackerMaster) || !Object.op_Implicit((Object)(object)attackerBody) || damageReport.damageInfo == null) { return; } Inventory inventory = attackerBody.inventory; if (Object.op_Implicit((Object)(object)inventory)) { ItemQualityCounts itemCountsEffective = inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.PrimarySkillShuriken); if (itemCountsEffective.TotalQualityCount != 0 && RollUtil.CheckRoll(itemCountsEffective.HighestQuality switch { QualityTier.Uncommon => 20, QualityTier.Rare => 40, QualityTier.Epic => 70, QualityTier.Legendary => 100, _ => 0, }, attackerMaster, ((ProcChainMask)(ref damageReport.damageInfo.procChainMask)).HasProc((ProcType)26))) { attackerBody.AddBuff(Buffs.PrimarySkillShurikenBuff); } } } } public abstract class QualityItemBodyBehavior : MonoBehaviour { private sealed class BodyBehaviorInfo { public readonly QualityItemBodyBehavior[] BehaviorComponents; public readonly int CollectionIndex; public BodyBehaviorInfo(QualityItemBodyBehavior[] behaviors, int collectionIndex) { BehaviorComponents = behaviors; CollectionIndex = collectionIndex; } } private readonly struct QualityGroupBehaviorInfo { public readonly ItemQualityGroupIndex ItemGroupIndex; public readonly Type BehaviorType; public QualityGroupBehaviorInfo(ItemQualityGroupIndex groupIndex, Type qualityItemBehaviorType) { ItemGroupIndex = groupIndex; BehaviorType = qualityItemBehaviorType; } } private readonly struct QualityGroupBehaviorCollection { public readonly QualityGroupBehaviorInfo[] Behaviors; public readonly FixedSizeArrayPool BehaviorsArrayPool; public QualityGroupBehaviorCollection(QualityGroupBehaviorInfo[] itemGroups, FixedSizeArrayPool behaviorsArrayPool) { Behaviors = itemGroups; BehaviorsArrayPool = behaviorsArrayPool; } } [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] protected sealed class ItemGroupAssociationAttribute : SearchableAttribute { public MethodInfo target => ((SearchableAttribute)this).target as MethodInfo; public QualityItemBehaviorUsageFlags Usage { get; } public ItemGroupAssociationAttribute(QualityItemBehaviorUsageFlags usage) { Usage = usage; } } [Flags] public enum QualityItemBehaviorUsageFlags : uint { None = 0u, Server = 1u, Client = 2u, Authority = 4u, All = 7u } private static readonly QualityGroupBehaviorCollection[] _behaviorCollectionsLookup = new QualityGroupBehaviorCollection[7]; private static readonly Dictionary, BodyBehaviorInfo> _bodyQualityBehaviorInfoLookup = new Dictionary, BodyBehaviorInfo>(); private static CharacterBody _earlyAssignmentBody; private static ItemQualityCounts _earlyAssignmentStacks; private ItemQualityCounts _stacks; public CharacterBody Body { get; private set; } public ref readonly ItemQualityCounts Stacks { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return ref _stacks; } } protected virtual void Awake() { Body = _earlyAssignmentBody; _earlyAssignmentBody = null; _stacks = _earlyAssignmentStacks; _earlyAssignmentStacks = default(ItemQualityCounts); } protected virtual void OnStacksChanged() { } [SystemInitializer(new Type[] { typeof(QualityCatalog) })] private static void Init() { Span> span = new List[7]; Span> span2 = span; for (int i = 0; i < span2.Length; i++) { span2[i] = new List(); } foreach (ItemGroupAssociationAttribute item in SearchableAttribute.GetInstances().OfType()) { MethodInfo target = item.target; if (target == null) { Log.Error("Null target method for item group attribute.", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\QualityItemBodyBehavior.cs", "Init", 61); continue; } QualityItemBehaviorUsageFlags qualityItemBehaviorUsageFlags = item.Usage & QualityItemBehaviorUsageFlags.All; Type type = null; try { type = target.DeclaringType; if (qualityItemBehaviorUsageFlags == QualityItemBehaviorUsageFlags.None) { Log.Error("ItemGroupAssociationAttribute method (" + type.FullName + "." + target.Name + ") has no usage defined.", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\QualityItemBodyBehavior.cs", "Init", 74); continue; } if (!typeof(QualityItemBodyBehavior).IsAssignableFrom(type)) { Log.Error("ItemGroupAssociationAttribute method (" + type.FullName + "." + target.Name + ") must be declared in a type that inherits from QualityItemBodyBehavior. Found type: " + type.FullName, "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\QualityItemBodyBehavior.cs", "Init", 80); continue; } if (!target.IsStatic) { Log.Error("ItemGroupAssociationAttribute method (" + type.FullName + "." + target.Name + ") must be static", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\QualityItemBodyBehavior.cs", "Init", 86); continue; } if (target.ReturnType != typeof(ItemQualityGroup)) { Log.Error("ItemGroupAssociationAttribute method (" + type.FullName + "." + target.Name + ") must return ItemQualityGroup. Found return type: " + target.ReturnType.FullName, "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\QualityItemBodyBehavior.cs", "Init", 92); continue; } if (target.GetParameters().Length != 0) { Log.Error("ItemGroupAssociationAttribute method (" + type.FullName + "." + target.Name + ") cannot have parameters", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\QualityItemBodyBehavior.cs", "Init", 98); continue; } ItemQualityGroup itemQualityGroup = target.Invoke(null, Array.Empty()) as ItemQualityGroup; if (!Object.op_Implicit((Object)(object)itemQualityGroup)) { Log.Error("ItemGroupAssociationAttribute method (" + type.FullName + "." + target.Name + ") returned null", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\QualityItemBodyBehavior.cs", "Init", 105); continue; } if (itemQualityGroup.GroupIndex == ItemQualityGroupIndex.Invalid) { Log.Error("ItemGroupAssociationAttribute method (" + type.FullName + "." + target.Name + ") returned a group that is not registered in QualityCatalog.", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\QualityItemBodyBehavior.cs", "Init", 111); continue; } for (QualityItemBehaviorUsageFlags qualityItemBehaviorUsageFlags2 = QualityItemBehaviorUsageFlags.Server; qualityItemBehaviorUsageFlags2 <= QualityItemBehaviorUsageFlags.All; qualityItemBehaviorUsageFlags2++) { if ((qualityItemBehaviorUsageFlags2 & qualityItemBehaviorUsageFlags) != 0) { span[(int)(qualityItemBehaviorUsageFlags2 - 1)].Add(new QualityGroupBehaviorInfo(itemQualityGroup.GroupIndex, type)); } } } catch (Exception arg) { Log.Error_NoCallerPrefix(string.Format("Failed to register quality item behavior for {0} ({1}): {2}", type?.FullName ?? "[UNRESOLVED TYPE]", target.Name, arg)); } } Dictionary> dictionary = new Dictionary>(span.Length); int num = 0; for (int j = 0; j < span.Length; j++) { _ = j + 1; List list = span[j]; QualityGroupBehaviorInfo[] array = ((list.Count > 0) ? list.ToArray() : Array.Empty()); FixedSizeArrayPool value = null; if (array.Length != 0 && !dictionary.TryGetValue(array.Length, out value)) { value = new FixedSizeArrayPool(array.Length); dictionary.Add(array.Length, value); } _behaviorCollectionsLookup[j] = new QualityGroupBehaviorCollection(array, value); num += array.Length; } if (num > 0) { CharacterBody.onBodyStartGlobal += onBodyStartGlobal; CharacterBody.onBodyDestroyGlobal += onBodyDestroyGlobal; CharacterBody.onBodyInventoryChangedGlobal += onBodyInventoryChangedGlobal; } } private static QualityItemBehaviorUsageFlags getBehaviorFlagsForBody(CharacterBody body) { QualityItemBehaviorUsageFlags qualityItemBehaviorUsageFlags = QualityItemBehaviorUsageFlags.None; if (NetworkServer.active) { qualityItemBehaviorUsageFlags |= QualityItemBehaviorUsageFlags.Server; } if (NetworkClient.active) { qualityItemBehaviorUsageFlags |= QualityItemBehaviorUsageFlags.Client; } if (Object.op_Implicit((Object)(object)body) && body.hasEffectiveAuthority) { qualityItemBehaviorUsageFlags |= QualityItemBehaviorUsageFlags.Authority; } return qualityItemBehaviorUsageFlags; } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static int getBehaviorCollectionIndex(CharacterBody body) { return (int)(getBehaviorFlagsForBody(body) - 1); } private static void onBodyStartGlobal(CharacterBody body) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) if ((!Object.op_Implicit((Object)(object)body.inventory) && ((NetworkInstanceId)(ref body.masterObjectId)).IsEmpty()) || _bodyQualityBehaviorInfoLookup.ContainsKey(UnityObjectWrapperKey.op_Implicit(body))) { return; } int behaviorCollectionIndex = getBehaviorCollectionIndex(body); if (ArrayUtils.IsInBounds(_behaviorCollectionsLookup, behaviorCollectionIndex)) { ref QualityGroupBehaviorCollection reference = ref _behaviorCollectionsLookup[behaviorCollectionIndex]; if (reference.BehaviorsArrayPool != null) { BodyBehaviorInfo bodyBehaviorInfo = new BodyBehaviorInfo(reference.BehaviorsArrayPool.Request(), behaviorCollectionIndex); _bodyQualityBehaviorInfoLookup.Add(UnityObjectWrapperKey.op_Implicit(body), bodyBehaviorInfo); refreshBodyQualityBehaviors(body, bodyBehaviorInfo); } } } private static void onBodyDestroyGlobal(CharacterBody body) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) if (_bodyQualityBehaviorInfoLookup.Remove(UnityObjectWrapperKey.op_Implicit(body), out var value)) { _behaviorCollectionsLookup[value.CollectionIndex].BehaviorsArrayPool?.Return(value.BehaviorComponents, (ClearType)0); } } private static void onBodyInventoryChangedGlobal(CharacterBody body) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) if (!_bodyQualityBehaviorInfoLookup.TryGetValue(UnityObjectWrapperKey.op_Implicit(body), out var value)) { int behaviorCollectionIndex = getBehaviorCollectionIndex(body); if (!ArrayUtils.IsInBounds(_behaviorCollectionsLookup, behaviorCollectionIndex)) { return; } ref QualityGroupBehaviorCollection reference = ref _behaviorCollectionsLookup[behaviorCollectionIndex]; if (reference.Behaviors.Length == 0) { return; } value = new BodyBehaviorInfo(reference.BehaviorsArrayPool.Request(), behaviorCollectionIndex); _bodyQualityBehaviorInfoLookup.Add(UnityObjectWrapperKey.op_Implicit(body), value); } refreshBodyQualityBehaviors(body, value); } private static void refreshBodyQualityBehaviors(CharacterBody body, BodyBehaviorInfo bodyBehaviorInfo) { if (Object.op_Implicit((Object)(object)body.inventory)) { ref QualityGroupBehaviorCollection reference = ref _behaviorCollectionsLookup[bodyBehaviorInfo.CollectionIndex]; for (int i = 0; i < reference.Behaviors.Length; i++) { ref QualityGroupBehaviorInfo reference2 = ref reference.Behaviors[i]; ref QualityItemBodyBehavior itemBehavior = ref bodyBehaviorInfo.BehaviorComponents[i]; Type behaviorType = reference2.BehaviorType; ItemQualityCounts itemCounts = body.inventory.GetItemCountsEffective(reference2.ItemGroupIndex); updateItemStacks(body, ref itemBehavior, behaviorType, in itemCounts); } return; } for (int j = 0; j < bodyBehaviorInfo.BehaviorComponents.Length; j++) { ref QualityItemBodyBehavior reference3 = ref bodyBehaviorInfo.BehaviorComponents[j]; if (reference3 != null) { Object.Destroy((Object)(object)reference3); reference3 = null; } } } private static void updateItemStacks(CharacterBody body, ref QualityItemBodyBehavior itemBehavior, Type qualityBehaviorType, in ItemQualityCounts itemCounts) { bool flag = itemBehavior != null; bool flag2 = itemCounts.TotalQualityCount > 0; if (flag != flag2) { if (flag2) { _earlyAssignmentBody = body; _earlyAssignmentStacks = itemCounts; try { itemBehavior = (QualityItemBodyBehavior)(object)((Component)body).gameObject.AddComponent(qualityBehaviorType); } finally { _earlyAssignmentBody = null; _earlyAssignmentStacks = default(ItemQualityCounts); } itemBehavior.OnStacksChanged(); flag = true; } else { Object.Destroy((Object)(object)itemBehavior); itemBehavior = null; flag = false; } } else if (flag && itemBehavior._stacks != itemCounts) { itemBehavior._stacks = itemCounts; itemBehavior.OnStacksChanged(); } } } internal static class QualityTierItem { private static Texture2D _defaultElitesRamp; private static readonly int _overrideQualityRampIndex = -1; [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) Util.GetBestBodyName += new hook_GetBestBodyName(Util_GetBestBodyName); MethodInfo method = typeof(CharacterModel).GetMethod("UpdateMaterials", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { new ILHook((MethodBase)method, new Manipulator(CharacterModel_UpdateMaterials), new ILHookConfig { Priority = -100 }); AsyncOperationHandle handle = AddressableUtil.LoadAssetAsync(RoR2_Base_Common_GlobalTextures.texRampElites_psd, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(Texture2D rampElites) { _defaultElitesRamp = rampElites; }); } else { Log.Error("Failed to find CharacterModel.UpdateMaterials method", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\QualityTierItem.cs", "Init", 41); } MasterSummon.onServerMasterSummonGlobal += onServerMasterSummonGlobal; } private static void onServerMasterSummonGlobal(MasterSummonReport summonReport) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)summonReport.summonMasterInstance) || !Object.op_Implicit((Object)(object)summonReport.summonMasterInstance.inventory)) { return; } GameObject val = summonReport.masterSummon?.summonerBodyObject; CharacterBody val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponent() : null); if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.inventory)) { QualityTier highestQuality = summonReport.masterSummon.summonerBodyObject.GetComponent().inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.QualityTier).HighestQuality; if (highestQuality != QualityTier.None) { summonReport.summonMasterInstance.inventory.GiveItemPermanent(ItemQualitiesContent.ItemQualityGroups.QualityTier.GetItemIndex(highestQuality), 1); } } } private static string Util_GetBestBodyName(orig_GetBestBodyName orig, GameObject bodyObject) { string text = orig.Invoke(bodyObject); CharacterBody val = default(CharacterBody); if (Object.op_Implicit((Object)(object)bodyObject) && bodyObject.TryGetComponent(ref val) && Object.op_Implicit((Object)(object)val.inventory)) { QualityTier highestQuality = val.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.QualityTier).HighestQuality; if (highestQuality > QualityTier.None) { QualityTierDef qualityTierDef = QualityCatalog.GetQualityTierDef(highestQuality); if (!string.IsNullOrWhiteSpace(qualityTierDef.modifierToken)) { text = Language.GetStringFormatted(qualityTierDef.modifierToken, new object[1] { text }); } } } return text; } private static void CharacterModel_UpdateMaterials(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_00dc: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "propertyStorage"), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(CommonShaderProperties), "_EliteIndex") })) { Log.Error("Failed to find patch start location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\QualityTierItem.cs", "CharacterModel_UpdateMaterials", 95); return; } if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "SetFloat") })) { Log.Error("Failed to find patch end location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\QualityTierItem.cs", "CharacterModel_UpdateMaterials", 102); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Action)handleQualityRamp); static void handleQualityRamp(CharacterModel characterModel) { QualityTier qualityTier = QualityTier.None; if (Object.op_Implicit((Object)(object)characterModel.body) && Object.op_Implicit((Object)(object)characterModel.body.inventory)) { qualityTier = characterModel.body.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.QualityTier).HighestQuality; } MaterialPropertyBlock propertyStorage = characterModel.propertyStorage; if (qualityTier != QualityTier.None) { propertyStorage.SetTexture(ShaderProperties._EliteRamp, (Texture)(object)QualityCatalog.GetQualityTierDef(qualityTier).colorRampTexture); propertyStorage.SetFloat(CommonShaderProperties._EliteIndex, 1f); } else if (isQualityRampTexture(propertyStorage.GetTexture(ShaderProperties._EliteRamp))) { propertyStorage.SetTexture(ShaderProperties._EliteRamp, (Texture)(object)_defaultElitesRamp); } } } private static bool isQualityRampTexture(Texture texture) { if (Object.op_Implicit((Object)(object)texture)) { for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { if ((Object)(object)QualityCatalog.GetQualityTierDef(qualityTier).colorRampTexture == (Object)(object)texture) { return true; } } } return false; } } public sealed class QualityTierItemBodyBehavior : QualityItemBodyBehavior { private Collider _collider; private CameraTargetParams _cameraTargetParams; private Interactor _interactor; private Transform _modelScaleTransform; private Transform _modelOffsetTransform; private ItemQualityCounts _previousStack; [ItemGroupAssociation(QualityItemBehaviorUsageFlags.Server | QualityItemBehaviorUsageFlags.Client)] private static ItemQualityGroup GetItemGroup() { return ItemQualitiesContent.ItemQualityGroups.QualityTier; } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float getScale(QualityTier qualityTier) { return Mathf.Max(1f, 1.35f + Mathf.Log((float)(qualityTier + 1), 4f)); } private void OnEnable() { _collider = ((Component)this).GetComponent(); _cameraTargetParams = ((Component)this).GetComponent(); _interactor = ((Component)this).GetComponent(); ModelLocator modelLocator = base.Body.modelLocator; if (Object.op_Implicit((Object)(object)modelLocator)) { _modelScaleTransform = modelLocator.modelTransform; Transform val = null; if (Object.op_Implicit((Object)(object)modelLocator.modelTransform) && Object.op_Implicit((Object)(object)modelLocator.modelTransform.parent) && (Object)(object)modelLocator.modelTransform.parent != (Object)(object)base.Body.transform) { val = modelLocator.modelTransform.parent; } else if (Object.op_Implicit((Object)(object)modelLocator.modelParentTransform)) { val = modelLocator.modelParentTransform; } else if (Object.op_Implicit((Object)(object)_modelScaleTransform) && _modelScaleTransform.IsChildOf(((Component)modelLocator).transform)) { val = _modelScaleTransform; } if (Object.op_Implicit((Object)(object)val) && (Object)(object)val != (Object)(object)base.Body.transform && Object.op_Implicit((Object)(object)val.parent)) { _modelOffsetTransform = val; } } } private void OnDisable() { ItemQualityCounts newStack = default(ItemQualityCounts); setStack(in newStack); } protected override void OnStacksChanged() { base.OnStacksChanged(); setStack(in base.Stacks); } private void setStack(in ItemQualityCounts newStack) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_008c: 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_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0165: 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_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) if (_previousStack == newStack) { return; } float scale = getScale(_previousStack.HighestQuality); float num = getScale(newStack.HighestQuality) / scale; _previousStack = newStack; if (Mathf.Abs(1f - num) < Mathf.Epsilon) { return; } if (Object.op_Implicit((Object)(object)_modelScaleTransform)) { Transform modelScaleTransform = _modelScaleTransform; modelScaleTransform.localScale *= num; } if (Object.op_Implicit((Object)(object)_modelOffsetTransform)) { Transform modelOffsetTransform = _modelOffsetTransform; modelOffsetTransform.localPosition *= num; } if (Object.op_Implicit((Object)(object)base.Body.characterMotor)) { ((BaseCharacterController)base.Body.characterMotor).Motor.SetCapsuleDimensions(base.Body.characterMotor.capsuleRadius * num, base.Body.characterMotor.capsuleHeight * num, base.Body.characterMotor.capsuleYOffset * num); } else { Collider collider = _collider; CapsuleCollider val = (CapsuleCollider)(object)((collider is CapsuleCollider) ? collider : null); if (val == null) { SphereCollider val2 = (SphereCollider)(object)((collider is SphereCollider) ? collider : null); if (val2 == null) { BoxCollider val3 = (BoxCollider)(object)((collider is BoxCollider) ? collider : null); if (val3 != null) { val3.size *= num; val3.center *= num; } } else { val2.radius *= num; val2.center *= num; } } else { val.height *= num; val.radius *= num; val.center *= num; } } if (Object.op_Implicit((Object)(object)base.Body.aimOriginTransform) && (Object)(object)base.Body.aimOriginTransform != (Object)(object)base.Body.transform) { Transform aimOriginTransform = base.Body.aimOriginTransform; aimOriginTransform.localPosition *= num; } if (Object.op_Implicit((Object)(object)_cameraTargetParams) && Object.op_Implicit((Object)(object)_cameraTargetParams.cameraPivotTransform) && (Object)(object)_cameraTargetParams.cameraPivotTransform != (Object)(object)base.Body.transform) { Transform cameraPivotTransform = _cameraTargetParams.cameraPivotTransform; cameraPivotTransform.localPosition *= num; } if (Object.op_Implicit((Object)(object)_interactor)) { Interactor interactor = _interactor; interactor.maxInteractionDistance *= num; } } } internal static class RandomEquipmentTrigger { private delegate void OnEquipmentActionPerformedDelegate(bool success, ref int qualityTierIndex); [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown EquipmentSlot.OnEquipmentExecuted_byte_byte_EquipmentIndex += new Manipulator(EquipmentSlot_OnEquipmentExecuted); } private static void EquipmentSlot_OnEquipmentExecuted(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "RandomEquipmentTrigger"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "PerformEquipmentAction") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\RandomEquipmentTrigger.cs", "EquipmentSlot_OnEquipmentExecuted", 25); return; } VariableDefinition val2 = il.AddVariable(); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getRandomEquipmentQualityTiers); val.Emit(OpCodes.Stloc, val2); VariableDefinition val3 = il.AddVariable(); val.Emit(OpCodes.Ldc_I4_0); val.Emit(OpCodes.Stloc, val3); val.Goto(array[1].Next, (MoveType)0, false); val.Emit(OpCodes.Ldloc, val2); val.Emit(OpCodes.Ldloc, val3); val.EmitDelegate>((Func)tryUpgradeEquipmentQuality); val.Goto(array[1].Next, (MoveType)2, false); val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldloca, val3); val.EmitDelegate((OnEquipmentActionPerformedDelegate)onEquipmentActionPerformed); static QualityTier[] getRandomEquipmentQualityTiers(EquipmentSlot equipmentSlot) { CharacterBody val5 = (Object.op_Implicit((Object)(object)equipmentSlot) ? equipmentSlot.characterBody : null); Inventory val6 = (Object.op_Implicit((Object)(object)val5) ? val5.inventory : null); QualityTier[] result = Array.Empty(); if (Object.op_Implicit((Object)(object)val6)) { ItemQualityCounts itemCountsEffective = val6.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.RandomEquipmentTrigger); if (itemCountsEffective.TotalQualityCount > 0) { Span span = stackalloc QualityTier[itemCountsEffective.TotalCount]; int num = 0; for (QualityTier qualityTier2 = QualityTier.None; qualityTier2 < QualityTier.Count; qualityTier2++) { int num2 = itemCountsEffective[qualityTier2]; if (num2 > 0) { span.Slice(num, num2).Fill(qualityTier2); num += num2; } } result = span.ToArray(); } } return result; } static void onEquipmentActionPerformed(bool success, ref int qualityTierIndex) { if (success) { qualityTierIndex++; } } static EquipmentDef tryUpgradeEquipmentQuality(EquipmentDef equipmentDef, QualityTier[] qualityTiers, int qualityTierIndex) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) EquipmentIndex val4 = (EquipmentIndex)((!Object.op_Implicit((Object)(object)equipmentDef)) ? (-1) : ((int)equipmentDef.equipmentIndex)); if ((int)val4 != -1 && qualityTiers.Length != 0) { QualityTier qualityTier = qualityTiers[qualityTierIndex % qualityTiers.Length]; EquipmentIndex equipmentIndexOfQuality = QualityCatalog.GetEquipmentIndexOfQuality(val4, qualityTier); if ((int)equipmentIndexOfQuality != -1 && equipmentIndexOfQuality != val4) { equipmentDef = EquipmentCatalog.GetEquipmentDef(equipmentIndexOfQuality); val4 = equipmentIndexOfQuality; if (!equipmentDef.canBeRandomlyTriggered) { equipmentDef = null; val4 = (EquipmentIndex)(-1); } } else { equipmentDef = null; val4 = (EquipmentIndex)(-1); } } return equipmentDef; } } } internal static class RegeneratingScrap { [SystemInitializer(new Type[] { typeof(CostTypeCatalog) })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) CharacterMaster.TryRegenerateScrap += new hook_TryRegenerateScrap(CharacterMaster_TryRegenerateScrap); CostTypeDef costTypeDef = CostTypeCatalog.GetCostTypeDef((CostTypeIndex)5); MethodInfo methodInfo = ((costTypeDef == null) ? null : ((Delegate)(object)costTypeDef.payCost)?.Method); if (methodInfo != null) { new ILHook((MethodBase)methodInfo, new Manipulator(ItemPayCostManipulator)); } else { Log.Error("Failed to find item PayCost method", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\RegeneratingScrap.cs", "Init", 27); } } private static void CharacterMaster_TryRegenerateScrap(orig_TryRegenerateScrap orig, CharacterMaster self) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 //IL_0042: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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) orig.Invoke(self); if (!Object.op_Implicit((Object)(object)self) || !Object.op_Implicit((Object)(object)self.inventory)) { return; } TryTransformResult val3 = default(TryTransformResult); for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { ItemIndex itemIndex = ItemQualitiesContent.ItemQualityGroups.RegeneratingScrap.GetItemIndex(qualityTier); ItemIndex itemIndex2 = ItemQualitiesContent.ItemQualityGroups.RegeneratingScrapConsumed.GetItemIndex(qualityTier); if ((int)itemIndex != -1 && (int)itemIndex2 != -1) { ItemTransformation val = default(ItemTransformation); ((ItemTransformation)(ref val)).originalItemIndex = itemIndex2; ((ItemTransformation)(ref val)).newItemIndex = itemIndex; ((ItemTransformation)(ref val)).maxToTransform = int.MaxValue; val.transformationType = (ItemTransformationTypeIndex)5; ItemTransformation val2 = val; ((ItemTransformation)(ref val2)).TryTransform(self.inventory, ref val3); } } } private static void ItemPayCostManipulator(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_00f5: 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_0132: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!((MethodReference)(object)il.Method).TryFindParameter(out var _)) { Log.Fatal("Failed to find context parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\RegeneratingScrap.cs", "ItemPayCostManipulator", 64); return; } ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[4] { (Instruction x) => ILPatternMatchingExt.MatchInitobj(x), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "get_originalItemIndex"), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "RegeneratingScrap"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "set_newItemIndex") })) { Log.Fatal("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\RegeneratingScrap.cs", "ItemPayCostManipulator", 74); return; } val.Goto(array[1].Next, (MoveType)2, false); VariableDefinition val2 = il.AddVariable(); val.Emit(OpCodes.Dup); val.Emit(OpCodes.Stloc, val2); val.EmitDelegate>((Func)getNonQualityItem); val.Goto(array[3].Next, (MoveType)0, false); val.Emit(OpCodes.Ldloc, val2); val.EmitDelegate>((Func)tryGetQualityRegeneratingScrap); val.Index = 0; if (val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "SendTransformNotification") })) { val.EmitSkipMethodCall(); } else { Log.Warning("Failed to find duplicate CharacterMasterNotificationQueue.SendTransformNotification call, it was likely removed", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\RegeneratingScrap.cs", "ItemPayCostManipulator", 109); } static ItemIndex getNonQualityItem(ItemIndex itemIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) return QualityCatalog.GetItemIndexOfQuality(itemIndex, QualityTier.None); } static ItemIndex tryGetQualityRegeneratingScrap(ItemIndex consumedScrapIndex, ItemIndex originalItemIndex) { //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_0007: Unknown result type (might be due to invalid IL or missing references) return QualityCatalog.GetItemIndexOfQuality(consumedScrapIndex, QualityCatalog.GetQualityTier(originalItemIndex)); } } } internal static class Scrap { private static ItemIndex[] _qualityScrapItemIndices = Array.Empty(); private static SceneIndex[] _convertScrapOnEntrySceneIndices = Array.Empty(); private static PickupIndex _scrapperPanelShowingPickupIndexContext = PickupIndex.none; [SystemInitializer(new Type[] { typeof(SceneCatalog), typeof(ItemCatalog), typeof(QualityCatalog) })] private static void Init() { //IL_0038: 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_006f: Invalid comparison between Unknown and I4 //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_005e: Unknown result type (might be due to invalid IL or missing references) HashSet hashSet = new HashSet(); tryAddSceneIndexByName("moon", hashSet); tryAddSceneIndexByName("moon2", hashSet); _convertScrapOnEntrySceneIndices = hashSet.ToArray(); Array.Sort(_convertScrapOnEntrySceneIndices); HashSet hashSet2 = new HashSet(); for (ItemIndex val = (ItemIndex)0; (int)val < ItemCatalog.itemCount; val = (ItemIndex)(val + 1)) { if (QualityCatalog.GetQualityTier(val) > QualityTier.None) { ItemDef itemDef = ItemCatalog.GetItemDef(val); if (Object.op_Implicit((Object)(object)itemDef) && itemDef.ContainsTag((ItemTag)10)) { hashSet2.Add(val); } } } _qualityScrapItemIndices = hashSet2.ToArray(); Array.Sort(_qualityScrapItemIndices); Stage.onServerStageBegin += onServerStageBegin; ScrapperController.BeginScrapping_UniquePickup += new Manipulator(ReplaceScrapPickupFromItemDefTierQualityPatch); ScrapperInfoPanelHelper.ShowInfo += new hook_ShowInfo(ScrapperInfoPanelHelper_ShowInfo); ScrapperInfoPanelHelper.ShowTierInfoInternal_MPButton_ItemTier_int += new Manipulator(ScrapperInfoPanelHelper_ShowTierInfoInternal_MPButton_ItemTier_int); static void tryAddSceneIndexByName(string sceneName, HashSet sceneIndicesList) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 //IL_000c: Unknown result type (might be due to invalid IL or missing references) SceneIndex val2 = SceneCatalog.FindSceneIndex(sceneName); if ((int)val2 != -1) { sceneIndicesList.Add(val2); } else { Log.Warning("Failed to find scene '" + sceneName + "'", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Scrap.cs", "Init", 33); } } } private static void onServerStageBegin(Stage stage) { //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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Invalid comparison between Unknown and I4 //IL_002d: Unknown result type (might be due to invalid IL or missing references) SceneDef val = (Object.op_Implicit((Object)(object)stage) ? stage.sceneDef : null); SceneIndex val2 = (SceneIndex)((!Object.op_Implicit((Object)(object)val)) ? (-1) : ((int)val.sceneDefIndex)); if ((int)val2 == -1 || Array.BinarySearch(_convertScrapOnEntrySceneIndices, val2) < 0) { return; } foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (instance.isConnected && Object.op_Implicit((Object)(object)instance.master)) { convertQualityScrap(instance.master.inventory); } } } private static void convertQualityScrap(Inventory inventory) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) ItemIndex[] qualityScrapItemIndices = _qualityScrapItemIndices; TryTransformResult val4 = default(TryTransformResult); foreach (ItemIndex val in qualityScrapItemIndices) { ItemTransformation val2 = default(ItemTransformation); ((ItemTransformation)(ref val2)).originalItemIndex = val; ((ItemTransformation)(ref val2)).newItemIndex = QualityCatalog.GetItemIndexOfQuality(val, QualityTier.None); ((ItemTransformation)(ref val2)).minToTransform = 1; ((ItemTransformation)(ref val2)).maxToTransform = int.MaxValue; ((ItemTransformation)(ref val2)).allowWhenDisabled = true; val2.transformationType = (ItemTransformationTypeIndex)0; ItemTransformation val3 = val2; ((ItemTransformation)(ref val3)).TryTransform(inventory, ref val4); } } private static void ScrapperInfoPanelHelper_ShowInfo(orig_ShowInfo orig, ScrapperInfoPanelHelper self, MPButton button, PickupDef pickupDef) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (pickupDef != null) { _scrapperPanelShowingPickupIndexContext = pickupDef.pickupIndex; } try { orig.Invoke(self, button, pickupDef); } finally { _scrapperPanelShowingPickupIndexContext = PickupIndex.none; } } private static void ScrapperInfoPanelHelper_ShowTierInfoInternal_MPButton_ItemTier_int(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); int num = 0; while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(PickupCatalog), "FindScrapIndexForItemTier") })) { val.EmitDelegate>((Func)getScrapPickupIndex); num++; } if (num == 0) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Scrap.cs", "ScrapperInfoPanelHelper_ShowTierInfoInternal_MPButton_ItemTier_int", 148); } static PickupIndex getScrapPickupIndex(PickupIndex scrapPickupIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_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) QualityTier qualityTier = QualityCatalog.GetQualityTier(_scrapperPanelShowingPickupIndexContext); if (qualityTier > QualityCatalog.GetQualityTier(scrapPickupIndex)) { scrapPickupIndex = QualityCatalog.GetPickupIndexOfQuality(scrapPickupIndex, qualityTier); } return scrapPickupIndex; } } public static void ReplaceScrapPickupFromItemDefTierQualityPatch(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); VariableDefinition val2 = null; Instruction val3 = null; int num = 0; int num2 = 0; while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(PickupCatalog), "FindScrapIndexForItemTier") })) { num++; ILCursor val4 = val.Clone(); if (val4.TryGotoPrev((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "get_tier") }) && (val3 == null || val4.IsAfter(val3))) { if (val2 == null) { val2 = il.AddVariable(); } val4.EmitStoreStack(val2); val.Emit(OpCodes.Ldloc, val2); val.EmitDelegate>((Func)getScrapPickupIndex); num2++; } val3 = val.Prev; } if (num2 == 0) { Log.Error("Failed to find patch location for " + ((MemberReference)il.Method).FullName, "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Scrap.cs", "ReplaceScrapPickupFromItemDefTierQualityPatch", 201); } static PickupIndex getScrapPickupIndex(PickupIndex scrapPickupIndex, ItemDef scrappingItem) { //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_0027: 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) PickupIndex scrapIndexForPickup = QualityCatalog.GetScrapIndexForPickup(PickupCatalog.FindPickupIndex((ItemIndex)((!Object.op_Implicit((Object)(object)scrappingItem)) ? (-1) : ((int)scrappingItem.itemIndex)))); if (!((PickupIndex)(ref scrapIndexForPickup)).isValid) { return scrapPickupIndex; } return scrapIndexForPickup; } } } public sealed class SecondarySkillMagazineQualityItemBehavior : QualityItemBodyBehavior { private static int[] _onActivateBlacklistSkillIndices = Array.Empty(); private static int[] _otherSkillIndicesToRestock = Array.Empty(); private static EffectIndex _restockEffectIndex = (EffectIndex)(-1); [SystemInitializer(new Type[] { typeof(EffectCatalogUtils), typeof(SkillCatalog) })] private static void Init() { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 _restockEffectIndex = EffectCatalogUtils.FindEffectIndex("AmmoPackPickupEffect"); if ((int)_restockEffectIndex == -1) { Log.Error("Failed to find restock effect index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SecondarySkillMagazineQualityItemBehavior.cs", "Init", 25); } List list = new List(); foreach (SkillDef allSkillDef in SkillCatalog.allSkillDefs) { if (allSkillDef.stockToConsume == 0) { list.Add(allSkillDef.skillIndex); } } HashSet hashSet = new HashSet(); tryAddSkillByName("SnipeHeavy", hashSet); if (list.Count > 0) { _onActivateBlacklistSkillIndices = list.ToArray(); Array.Sort(_onActivateBlacklistSkillIndices); } if (hashSet.Count > 0) { _otherSkillIndicesToRestock = hashSet.ToArray(); Array.Sort(_otherSkillIndicesToRestock); } static void tryAddSkillByName(string name, HashSet skillIndices) { int num = SkillCatalog.FindSkillIndexByName(name); if (num != -1) { skillIndices.Add(num); } } } [ItemGroupAssociation(QualityItemBehaviorUsageFlags.Authority)] private static ItemQualityGroup GetItemGroup() { return ItemQualitiesContent.ItemQualityGroups.SecondarySkillMagazine; } private void OnEnable() { base.Body.onSkillActivatedAuthority += onSkillActivatedAuthority; SkillHooks.OnSkillUsedIndirectAuthority += onSkillUsedIndirectAuthority; } private void OnDisable() { base.Body.onSkillActivatedAuthority -= onSkillActivatedAuthority; SkillHooks.OnSkillUsedIndirectAuthority -= onSkillUsedIndirectAuthority; } private void onSkillActivatedAuthority(GenericSkill skill) { if (Array.BinarySearch(_onActivateBlacklistSkillIndices, skill.skillDef.skillIndex) < 0 && Object.op_Implicit((Object)(object)base.Body.skillLocator) && (Object)(object)skill == (Object)(object)base.Body.skillLocator.secondary) { rollRestockSkill(skill); } } private void onSkillUsedIndirectAuthority(GenericSkill skill) { if (Object.op_Implicit((Object)(object)base.Body.skillLocator) && (Object)(object)skill == (Object)(object)base.Body.skillLocator.secondary) { rollRestockSkill(skill); } } private void rollRestockSkill(GenericSkill skill) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Invalid comparison between Unknown and I4 //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) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown ref readonly ItemQualityCounts stacks = ref base.Stacks; if (!RollUtil.CheckRoll((1f - Mathf.Pow(0.85f, (float)stacks.UncommonCount) * Mathf.Pow(0.75f, (float)stacks.RareCount) * Mathf.Pow(0.6f, (float)stacks.EpicCount) * Mathf.Pow(0.39999998f, (float)stacks.LegendaryCount)) * 100f, base.Body.master, sureProc: false)) { return; } restockSkill(skill); if ((int)_restockEffectIndex != -1) { EffectManager.SpawnEffect(_restockEffectIndex, new EffectData { origin = base.Body.corePosition }, true); } int skillSlotCount = base.Body.skillLocator.skillSlotCount; for (int i = 0; i < skillSlotCount; i++) { GenericSkill skillAtIndex = base.Body.skillLocator.GetSkillAtIndex(i); if (Object.op_Implicit((Object)(object)skillAtIndex) && (Object)(object)skillAtIndex != (Object)(object)skill && Array.BinarySearch(_otherSkillIndicesToRestock, skillAtIndex.skillDef.skillIndex) >= 0) { restockSkill(skillAtIndex); } } } private void restockSkill(GenericSkill skill) { skill.AddOneStock(); base.Body.OnSkillCooldown(skill, 1); } } internal static class Seed { [SystemInitializer(new Type[] { })] private static void Init() { GlobalEventManager.onServerDamageDealt += onServerDamageDealt; } private static void onServerDamageDealt(DamageReport damageReport) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)damageReport.attackerBody) && Object.op_Implicit((Object)(object)damageReport.attackerBody.inventory) && damageReport.damageInfo.procCoefficient > 0f && !((ProcChainMask)(ref damageReport.damageInfo.procChainMask)).HasProc((ProcType)6)) { ItemQualityCounts itemCountsEffective = damageReport.attackerBody.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Seed); if (itemCountsEffective.TotalQualityCount > 0) { ProcChainMask procChainMask = damageReport.damageInfo.procChainMask; ((ProcChainMask)(ref procChainMask)).AddProc((ProcType)6); float num = 0.01f * (float)itemCountsEffective.UncommonCount + 0.03f * (float)itemCountsEffective.RareCount + 0.06f * (float)itemCountsEffective.EpicCount + 0.1f * (float)itemCountsEffective.LegendaryCount; damageReport.attackerBody.healthComponent.Heal(num * damageReport.damageDealt * damageReport.damageInfo.procCoefficient, procChainMask, true); } } } } internal static class SharedItemUtils { public static bool InteractableIsPermittedForSpawn(IInteractable interactable) { MonoBehaviour val = (MonoBehaviour)(object)((interactable is MonoBehaviour) ? interactable : null); if (val == null || !Object.op_Implicit((Object)(object)val)) { return false; } InteractionProcFilter val2 = default(InteractionProcFilter); if (((Component)val).TryGetComponent(ref val2)) { return val2.shouldAllowOnInteractionBeginProc; } PurchaseInteraction val3 = default(PurchaseInteraction); if (((Component)val).TryGetComponent(ref val3)) { return !val3.disableSpawnOnInteraction; } PowerPedestal val4 = default(PowerPedestal); if (((Component)val).TryGetComponent(ref val4)) { return val4.CanTriggerFireworks; } AccessCodesNodeController val5 = default(AccessCodesNodeController); if (((Component)val).TryGetComponent(ref val5)) { return val5.CheckInteractionOrder(); } if (Object.op_Implicit((Object)(object)((Component)val).GetComponent())) { PickupPickerController val6 = default(PickupPickerController); if (((Component)val).TryGetComponent(ref val6)) { return !((Behaviour)val6).enabled; } return true; } if (Object.op_Implicit((Object)(object)((Component)val).GetComponent())) { return false; } if (Object.op_Implicit((Object)(object)((Component)val).GetComponent())) { return false; } if (Object.op_Implicit((Object)(object)((Component)val).GetComponent())) { return false; } return true; } } internal static class SharedSuffering { private static DeployableSlot _sharedSufferingOrbSlot = (DeployableSlot)35; private static GameObject _sharedSufferingOrbProjectilePrefab; [InitDuringStartupPhase(/*Could not decode attribute arguments.*/)] private static void EarlyInit() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //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) _sharedSufferingOrbSlot = DeployableAPI.RegisterDeployableSlot(new GetDeployableSameSlotLimit(getSharedSufferingOrbLimit)); } private static int getSharedSufferingOrbLimit(CharacterMaster self, int swarmsMultiplier) { return 3; } [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { AsyncOperationHandle timeCrystalBodyLoad = AddressableUtil.LoadTempAssetAsync(RoR2_Base_WeeklyRun.TimeCrystalBody_prefab); AsyncOperationHandle minorConstructOnKillProjectileLoad = AddressableUtil.LoadTempAssetAsync(RoR2_DLC1_MinorConstructOnKill.MinorConstructOnKillProjectile_prefab); AsyncOperationHandle minorConstructOnKillProjectileGhostLoad = AddressableUtil.LoadTempAssetAsync(RoR2_DLC1_MinorConstructOnKill.MinorConstructOnKillProjectileGhost_prefab); AsyncOperationHandle matTimeCrystalSolidLoad = AddressableUtil.LoadTempAssetAsync(RoR2_Base_crystalworld.matTimeCrystalSolid_mat); ParallelProgressCoroutine val = new ParallelProgressCoroutine((IProgress)args.ProgressReceiver); val.Add(in timeCrystalBodyLoad); val.Add(in minorConstructOnKillProjectileLoad); val.Add(in minorConstructOnKillProjectileGhostLoad); val.Add(in matTimeCrystalSolidLoad); yield return val; if (!AssetLoadExtensions.AssertLoaded(in timeCrystalBodyLoad, "TimeCrystalBody", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SharedSuffering.cs", "LoadContent", 58) || !AssetLoadExtensions.AssertLoaded(in minorConstructOnKillProjectileLoad, "MinorConstructOnKillProjectile", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SharedSuffering.cs", "LoadContent", 59) || !AssetLoadExtensions.AssertLoaded(in minorConstructOnKillProjectileGhostLoad, "MinorConstructOnKillProjectileGhost", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SharedSuffering.cs", "LoadContent", 60) || !AssetLoadExtensions.AssertLoaded(in matTimeCrystalSolidLoad, "matTimeCrystalSolid", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SharedSuffering.cs", "LoadContent", 61)) { yield break; } GameObject val2 = PrefabAPI.InstantiateClone(timeCrystalBodyLoad.Result, "QualitySharedSufferingOrbBody"); CharacterBody component = val2.GetComponent(); component.baseNameToken = "QUALITY_SHARED_SUFFERING_ORB_BODY_NAME"; component.baseMaxHealth = 1f; component.levelMaxHealth = 0f; component.bodyFlags = (BodyFlags)(component.bodyFlags & -524289); val2.GetComponent().teamIndex = (TeamIndex)0; UnityObjectExtensions.EnsureComponent(val2)._damageCoeficient = 0f; UnityObjectExtensions.EnsureComponent(val2).ProcCoefficientMultiplier = 0f; val2.GetComponent().deathState = new SerializableEntityStateType(typeof(SharedSufferingOrbDeath)); UnityObjectExtensions.EnsureComponent(val2); UnityObjectExtensions.EnsureComponent(val2); SpecialObjectAttributes val3 = UnityObjectExtensions.EnsureComponent(val2); SpecialObjectAttributes val4 = val3; if (val4.renderersToDisable == null) { val4.renderersToDisable = new List(); } val4 = val3; if (val4.lightsToDisable == null) { val4.lightsToDisable = new List(); } SharedSufferingOrbController sharedSufferingOrbController = UnityObjectExtensions.EnsureComponent(val2); ModelLocator component2 = val2.GetComponent(); Transform val5 = (Object.op_Implicit((Object)(object)component2) ? component2.modelTransform : null); ModelSkinController val6 = default(ModelSkinController); if (Object.op_Implicit((Object)(object)val5) && ((Component)val5).TryGetComponent(ref val6)) { SkinDef val7 = ScriptableObject.CreateInstance(); ((Object)val7).name = "skinSharedSufferingOrbDefault"; val7.skinDefParams = ScriptableObject.CreateInstance(); ((Object)val7.skinDefParams).name = ((Object)val7).name + "_params"; val7.rootObject = ((Component)component2.modelTransform).gameObject; MeshRenderer val8 = default(MeshRenderer); if (((Component)component2.modelTransform).TryGetComponent(ref val8)) { Material val9 = Object.Instantiate(matTimeCrystalSolidLoad.Result); ((Object)val9).name = "matSharedSufferingOrb"; val9.SetColor(ShaderProperties._Color, Color32.op_Implicit(new Color32((byte)75, (byte)221, (byte)164, byte.MaxValue))); val9.SetColor(ShaderProperties._EmissionColor, Color32.op_Implicit(new Color32((byte)39, (byte)93, (byte)70, byte.MaxValue))); val7.skinDefParams.rendererInfos = (RendererInfo[])(object)new RendererInfo[1] { new RendererInfo { renderer = (Renderer)(object)val8, defaultMaterial = val9, defaultShadowCastingMode = (ShadowCastingMode)1 } }; val7.skinDefParams.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[1] { new MeshReplacement { renderer = (Renderer)(object)val8, meshAddress = new AssetReferenceT(RoR2_Base_crystalworld.crystalworld_props_fbx_CrystalMeshLarge_) } }; val3.useSkillHighlightRenderers = true; val4 = val3; if (val4.skillHighlightRenderers == null) { val4.skillHighlightRenderers = new List(); } val3.skillHighlightRenderers.Add((Renderer)(object)val8); } else { Log.Error("Failed to find renderer for skin", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SharedSuffering.cs", "LoadContent", 138); } Light componentInChildren = ((Component)component2.modelTransform).GetComponentInChildren(); if (Object.op_Implicit((Object)(object)componentInChildren)) { val3.lightsToDisable.Add(componentInChildren); val7.skinDefParams.lightReplacements = (LightInfo[])(object)new LightInfo[1] { new LightInfo { light = componentInChildren, defaultColor = Color32.op_Implicit(new Color32((byte)27, (byte)249, (byte)109, byte.MaxValue)) } }; } else { Log.Error("Failed to find light for skin", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SharedSuffering.cs", "LoadContent", 157); } val6.skins = (SkinDef[])(object)new SkinDef[1] { val7 }; } else { Log.Error("Failed to find skin controller", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SharedSuffering.cs", "LoadContent", 164); } Transform val10 = (Object.op_Implicit((Object)(object)val5) ? val5.Find("Beam") : null); if (Object.op_Implicit((Object)(object)val10)) { ((Component)val10).gameObject.SetActive(false); } else { Log.Warning("Failed to find beam", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SharedSuffering.cs", "LoadContent", 174); } Transform val11 = val2.transform.Find("ModelBase/WarningRadius"); if (Object.op_Implicit((Object)(object)val11)) { MeshFilter val12 = default(MeshFilter); if (((Component)val11).TryGetComponent(ref val12)) { val12.sharedMesh = MeshUtil.GetPrimitive((PrimitiveType)0); } Renderer val13 = default(Renderer); if (((Component)val11).TryGetComponent(ref val13)) { val3.renderersToDisable.Add(val13); Material val14 = args.ContentPack.materials.Find("matSharedSufferingOrbAreaIndicator"); if (Object.op_Implicit((Object)(object)val14)) { val13.sharedMaterial = val14; } } sharedSufferingOrbController.RadiusIndicator = val11; } else { Log.Error("Failed to find radius indicator", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SharedSuffering.cs", "LoadContent", 200); } Transform val15 = val2.transform.Find("ModelBase/Swirls"); Renderer item = default(Renderer); if (Object.op_Implicit((Object)(object)val15) && ((Component)val15).TryGetComponent(ref item)) { val3.renderersToDisable.Add(item); } else { Log.Warning("Failed to find particles", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SharedSuffering.cs", "LoadContent", 210); } _sharedSufferingOrbProjectilePrefab = PrefabAPI.InstantiateClone(minorConstructOnKillProjectileLoad.Result, "QualitySharedSufferingOrbOnKillProjectile"); Object.Destroy((Object)(object)_sharedSufferingOrbProjectilePrefab.GetComponent()); ProjectileInstantiateDeployableOnImpact projectileInstantiateDeployableOnImpact = _sharedSufferingOrbProjectilePrefab.AddComponent(); projectileInstantiateDeployableOnImpact.DeployableSlot = _sharedSufferingOrbSlot; projectileInstantiateDeployableOnImpact.DeployablePrefab = val2; args.ContentPack.bodyPrefabs.Add(val2); args.ContentPack.projectilePrefabs.Add(_sharedSufferingOrbProjectilePrefab); } [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown SharedSufferingItemBehaviour.TryAdd += new hook_TryAdd(SharedSufferingItemBehaviour_TryAdd); GlobalEventManager.onCharacterDeathGlobal += onCharacterDeathGlobal; } private static bool SharedSufferingItemBehaviour_TryAdd(orig_TryAdd orig, SharedSufferingItemBehaviour self, CharacterBody newTarget) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 if (Object.op_Implicit((Object)(object)newTarget) && Object.op_Implicit((Object)(object)newTarget.teamComponent) && (int)newTarget.teamComponent.teamIndex != -1) { return orig.Invoke(self, newTarget); } return false; } private static void onCharacterDeathGlobal(DamageReport damageReport) { //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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_0139: 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_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || !Object.op_Implicit((Object)(object)damageReport.attackerBody) || !Object.op_Implicit((Object)(object)damageReport.attackerBody.inventory)) { return; } ItemQualityCounts itemCountsEffective = damageReport.attackerBody.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.SharedSuffering); if (itemCountsEffective.TotalQualityCount > 0) { float percentChance; switch (itemCountsEffective.HighestQuality) { case QualityTier.Uncommon: percentChance = 10f; break; case QualityTier.Rare: percentChance = 12f; break; case QualityTier.Epic: percentChance = 15f; break; case QualityTier.Legendary: percentChance = 20f; break; default: Log.Error($"Quality tier {itemCountsEffective.HighestQuality} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SharedSuffering.cs", "onCharacterDeathGlobal", 271); percentChance = 0f; break; } if (RollUtil.CheckRoll(percentChance, damageReport.attackerMaster, ((ProcChainMask)(ref damageReport.damageInfo.procChainMask)).HasProc((ProcType)26))) { ProjectileManager.instance.FireProjectile(new FireProjectileInfo { projectilePrefab = _sharedSufferingOrbProjectilePrefab, position = (Object.op_Implicit((Object)(object)damageReport.victimBody) ? damageReport.victimBody.corePosition : damageReport.damageInfo.position), rotation = Quaternion.LookRotation(Quaternion.AngleAxis(Random.Range(-180f, 180f), Vector3.up) * Quaternion.AngleAxis(-80f, Vector3.right) * Vector3.forward), owner = ((Component)damageReport.attackerBody).gameObject }); } } } } public sealed class SharedSufferingOrbController : NetworkBehaviour { public Transform RadiusIndicator; [SyncVar(hook = "hookSetRadius")] public float BlastRadius = 5f; private GenericOwnership _ownership; private Deployable _deployable; private CharacterBody _ownerBody; public float NetworkBlastRadius { get { return BlastRadius; } [param: In] set { ref float blastRadius = ref BlastRadius; if (NetworkServer.localClientActive && !((NetworkBehaviour)this).syncVarHookGuard) { ((NetworkBehaviour)this).syncVarHookGuard = true; hookSetRadius(value); ((NetworkBehaviour)this).syncVarHookGuard = false; } ((NetworkBehaviour)this).SetSyncVar(value, ref blastRadius, 1u); } } private void Awake() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown if (!NetworkServer.active) { return; } _deployable = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)_deployable)) { Deployable deployable = _deployable; if (deployable.onUndeploy == null) { deployable.onUndeploy = new UnityEvent(); } _deployable.onUndeploy.AddListener(new UnityAction(onUndeploy)); } else { Log.Warning("Missing Deployable component on " + Util.GetGameObjectHierarchyName(((Component)this).gameObject), "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SharedSufferingOrbController.cs", "Awake", 33); } _ownership = ((Component)this).GetComponent(); if (!Object.op_Implicit((Object)(object)_ownership)) { Log.Warning("Missing GenericOwnership component on " + Util.GetGameObjectHierarchyName(((Component)this).gameObject), "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SharedSufferingOrbController.cs", "Awake", 39); } } private void Start() { CharacterBody ownerBody = null; if (Object.op_Implicit((Object)(object)_ownership)) { GameObject ownerObject = _ownership.ownerObject; ownerBody = (Object.op_Implicit((Object)(object)ownerObject) ? ownerObject.GetComponent() : null); } _ownerBody = ownerBody; if (NetworkServer.active) { recalculateRadius(); } } public override void OnStartClient() { ((NetworkBehaviour)this).OnStartClient(); refreshIndicator(); } private void OnDestroy() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)_deployable)) { UnityEvent obj = _deployable.onUndeploy; if (obj != null) { obj.RemoveListener(new UnityAction(onUndeploy)); } } } private void onUndeploy() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) HealthComponent val = default(HealthComponent); if (((Component)this).TryGetComponent(ref val)) { val.Suicide((GameObject)null, (GameObject)null, default(DamageTypeCombo)); } } [Server] private void recalculateRadius() { if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void ItemQualities.Items.SharedSufferingOrbController::recalculateRadius()' called on client"); return; } Inventory val = (Object.op_Implicit((Object)(object)_ownerBody) ? _ownerBody.inventory : null); ItemQualityCounts itemQualityCounts = default(ItemQualityCounts); if (Object.op_Implicit((Object)(object)val)) { itemQualityCounts = val.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.SharedSuffering); } if (itemQualityCounts.TotalQualityCount == 0) { itemQualityCounts.UncommonCount = 1; } float num = 25f * (float)itemQualityCounts.UncommonCount + 35f * (float)itemQualityCounts.RareCount + 50f * (float)itemQualityCounts.EpicCount + 65f * (float)itemQualityCounts.LegendaryCount; if (Object.op_Implicit((Object)(object)_ownerBody)) { num = ExplodeOnDeath.GetExplosionRadius(num, _ownerBody); } NetworkBlastRadius = num; } private void refreshIndicator() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)RadiusIndicator)) { float num = BlastRadius * 2f; RadiusIndicator.localScale = new Vector3(num, num, num); } } private void hookSetRadius(float radius) { NetworkBlastRadius = radius; refreshIndicator(); } private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { if (forceAll) { writer.Write(BlastRadius); return true; } bool flag = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(BlastRadius); } if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { if (initialState) { BlastRadius = reader.ReadSingle(); return; } int num = (int)reader.ReadPackedUInt32(); if (((uint)num & (true ? 1u : 0u)) != 0) { hookSetRadius(reader.ReadSingle()); } } public override void PreStartClient() { } } internal static class ShieldBooster { private static float _defaultShieldBreakBlastRadius = 12.5f; public static event Action OnShieldBoosterBreakServerGlobal; [SystemInitializer(new Type[] { })] private static 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_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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Expected O, but got Unknown //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown AsyncOperationHandle handle = AddressableUtil.LoadAssetAsync(RoR2_DLC3_Items_ShieldBooster.ShieldEMPPulseEffect_prefab, (AsyncReferenceHandleUnloadType)2); AssetLoadExtensions.OnSuccess(in handle, fixShieldBreakEffectScaling); handle = AddressableUtil.LoadAssetAsync(RoR2_DLC3_Items_ShieldBooster.ShieldEMPPulseEffectVoid_prefab, (AsyncReferenceHandleUnloadType)2); AssetLoadExtensions.OnSuccess(in handle, fixShieldBreakEffectScaling); MethodInfo method = typeof(HealthComponent).GetMethod("TakeDamageProcess", (BindingFlags)(-1)); if (method != null) { DynamicMethodDefinition val = new DynamicMethodDefinition((MethodBase)method); try { ILContext val2 = new ILContext(val.Definition); try { ILCursor val3 = new ILCursor(val2); float shieldBreakBlastRadius = -1f; if (val3.TryGotoNext(new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "ShieldBooster") }) && val3.TryGotoNext(new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref shieldBreakBlastRadius), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "radius") })) { _defaultShieldBreakBlastRadius = shieldBreakBlastRadius; } else { Log.Error($"Failed to find default shield break blast radius, assuming hardcoded value of {_defaultShieldBreakBlastRadius}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ShieldBooster.cs", "Init", 53); } } finally { ((IDisposable)val2)?.Dispose(); } } finally { ((IDisposable)val)?.Dispose(); } } else { Log.Error("Failed to find HealthComponent.TakeDamageProcess method", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ShieldBooster.cs", "Init", 58); } HealthComponent.GetShieldBoosterDamage += new hook_GetShieldBoosterDamage(HealthComponent_GetShieldBoosterDamage); HealthComponent.TakeDamageProcess += new Manipulator(HealthComponent_TakeDamageProcess); static void fixShieldBreakEffectScaling(GameObject shieldBreakEffectPrefab) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) ParticleSystem[] componentsInChildren = shieldBreakEffectPrefab.GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { MainModule main = componentsInChildren[i].main; ((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)0; } } } public static float GetShieldBreakBlastRadius(CharacterBody body) { return getShieldBreakBlastRadius(_defaultShieldBreakBlastRadius, body); } private static float getShieldBreakBlastRadius(float baseRadius, CharacterBody body) { float num = baseRadius; if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.inventory)) { ItemQualityCounts itemCountsEffective = body.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.ShieldBooster); if (itemCountsEffective.TotalQualityCount > 0) { float num2 = (float)body.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.ShieldBoosterBuff).TotalQualityCount / 100f; if (num2 > 0f) { float num3 = 5f * (float)itemCountsEffective.UncommonCount + 12f * (float)itemCountsEffective.RareCount + 18f * (float)itemCountsEffective.EpicCount + 25f * (float)itemCountsEffective.LegendaryCount; float num4 = num2 * num3; num += num4; } } num = ExplodeOnDeath.GetExplosionRadius(num, body); } return num; } private static float HealthComponent_GetShieldBoosterDamage(orig_GetShieldBoosterDamage orig, HealthComponent self, int stack) { float num = orig.Invoke(self, stack); if (Object.op_Implicit((Object)(object)self.body) && Object.op_Implicit((Object)(object)self.body.inventory)) { ItemQualityCounts itemCountsEffective = self.body.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.ShieldBooster); if (itemCountsEffective.TotalQualityCount > 0) { float num2 = (float)self.body.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.ShieldBoosterBuff).TotalQualityCount / 100f; if (num2 > 0f) { float num3 = 2f * (float)itemCountsEffective.UncommonCount + 5f * (float)itemCountsEffective.RareCount + 10f * (float)itemCountsEffective.EpicCount + 15f * (float)itemCountsEffective.LegendaryCount; float num4 = num2 * num3; num += self.body.damage * num4; } } } return num; } private static void HealthComponent_TakeDamageProcess(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "ShieldBooster"), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "radius"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "Fire") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ShieldBooster.cs", "HealthComponent_TakeDamageProcess", 138); return; } val.Goto(array[1].Next, (MoveType)0, false); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getBlastRadius); val.Goto(array[2].Next, (MoveType)2, false); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Action)onShieldBoosterBreak); val.Goto(array[1].Next, (MoveType)0, false); if (val.TryGotoPrev((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "scale") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getBlastEffectScale); } else { Log.Warning("Failed to find shield break", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ShieldBooster.cs", "HealthComponent_TakeDamageProcess", 181); } static float getBlastEffectScale(float scale, HealthComponent healthComponent) { return getBlastRadius(_defaultShieldBreakBlastRadius, healthComponent) / _defaultShieldBreakBlastRadius; } static float getBlastRadius(float radius, HealthComponent healthComponent) { return getShieldBreakBlastRadius(radius, Object.op_Implicit((Object)(object)healthComponent) ? healthComponent.body : null); } static void onShieldBoosterBreak(HealthComponent healthComponent) { CharacterBody val2 = (Object.op_Implicit((Object)(object)healthComponent) ? healthComponent.body : null); if (Object.op_Implicit((Object)(object)val2)) { ShieldBooster.OnShieldBoosterBreakServerGlobal?.Invoke(val2); } } } } public sealed class ShieldBoosterQualityItemBehavior : QualityItemBodyBehavior { private CharacterBodyExtraStatsTracker _bodyExtraStats; private float _boosterFraction; [ItemGroupAssociation(QualityItemBehaviorUsageFlags.Server)] private static ItemQualityGroup GetItemGroup() { return ItemQualitiesContent.ItemQualityGroups.ShieldBooster; } protected override void Awake() { base.Awake(); _bodyExtraStats = ((Component)(object)this).GetComponentCached(); } private void OnEnable() { _bodyExtraStats.OnTakeDamageServer += onTakeDamageServer; ShieldBooster.OnShieldBoosterBreakServerGlobal += onShieldBoosterBreakServerGlobal; _boosterFraction = 0f; updateBuffCount(); } private void OnDisable() { _bodyExtraStats.OnTakeDamageServer -= onTakeDamageServer; ShieldBooster.OnShieldBoosterBreakServerGlobal -= onShieldBoosterBreakServerGlobal; base.Body.RemoveAllQualityBuffs(ItemQualitiesContent.BuffQualityGroups.ShieldBoosterBuff); } protected override void OnStacksChanged() { base.OnStacksChanged(); updateBuffCount(); } private void onTakeDamageServer(DamageReport damageReport) { if (damageReport.damageDealt > 0f && base.Body.healthComponent.shield > 0f) { float num = base.Stacks.HighestQuality switch { QualityTier.Rare => 1f, QualityTier.Epic => 1.5f, QualityTier.Legendary => 2f, _ => 0.75f, }; float num2 = Mathf.Min(1f - _boosterFraction, num * (damageReport.damageDealt / base.Body.healthComponent.fullCombinedHealth)); if (num2 > 0f) { _boosterFraction += num2; updateBuffCount(); } } } private void onShieldBoosterBreakServerGlobal(CharacterBody body) { if ((Object)(object)body == (Object)(object)base.Body) { _boosterFraction = 0f; updateBuffCount(); } } private void updateBuffCount() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) ref readonly ItemQualityCounts stacks = ref base.Stacks; int totalQualityCount = base.Body.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.ShieldBoosterBuff).TotalQualityCount; int num = Mathf.CeilToInt(_boosterFraction * 100f); if (num != totalQualityCount) { BuffIndex buffIndex = ItemQualitiesContent.BuffQualityGroups.ShieldBoosterBuff.GetBuffIndex(stacks.HighestQuality); if (num < totalQualityCount) { for (int num2 = totalQualityCount; num2 > num; num2--) { base.Body.RemoveBuff(buffIndex); } } else { for (int i = totalQualityCount; i < num; i++) { base.Body.AddBuff(buffIndex); } } } base.Body.ConvertQualityBuffsToTier(ItemQualitiesContent.BuffQualityGroups.ShieldBoosterBuff, stacks.HighestQuality); } } internal static class ShockNearby { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown ShockNearbyBodyBehavior.FixedUpdate += new Manipulator(ShockNearbyBodyBehavior_FixedUpdate); } private static void ShockNearbyBodyBehavior_FixedUpdate(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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) //IL_0160: 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) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); VariableDefinition val2 = il.AddVariable(); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getIntervalMultiplier); val.Emit(OpCodes.Stloc, val2); if (val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "teslaBuffRollTimer"), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 10f) })) { val.Emit(OpCodes.Ldloc, val2); val.Emit(OpCodes.Mul); if (val.TryGotoNext((MoveType)0, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0f), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "teslaBuffRollTimer") })) { int index = val.Index; val.Index = index + 1; val.Emit(OpCodes.Pop); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldfld, "teslaBuffRollTimer"); val.Emit(OpCodes.Ldc_R4, 10f); val.Emit(OpCodes.Ldloc, val2); val.Emit(OpCodes.Mul); val.Emit(OpCodes.Sub); } else { Log.Warning("Failed to find buff roll reset patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ShockNearby.cs", "ShockNearbyBodyBehavior_FixedUpdate", 73); } } else { Log.Error("Failed to find buff roll interval patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ShockNearby.cs", "ShockNearbyBodyBehavior_FixedUpdate", 78); } int num = 0; val.Index = 0; while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "teslaResetListInterval") })) { val.Emit(OpCodes.Ldloc, val2); val.Emit(OpCodes.Mul); num++; } if (num == 0) { Log.Warning("Failed to find list reset interval patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ShockNearby.cs", "ShockNearbyBodyBehavior_FixedUpdate", 95); } static float getIntervalMultiplier(ShockNearbyBodyBehavior shockNearbyBodyBehavior) { CharacterBody val3 = (Object.op_Implicit((Object)(object)shockNearbyBodyBehavior) ? ((BaseItemBodyBehavior)shockNearbyBodyBehavior).body : null); Inventory val4 = (Object.op_Implicit((Object)(object)val3) ? val3.inventory : null); if (Object.op_Implicit((Object)(object)val4)) { ItemQualityCounts itemCountsEffective = val4.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.ShockNearby); if (itemCountsEffective.TotalQualityCount > 0) { return Mathf.Pow(0.9f, (float)itemCountsEffective.UncommonCount) * Mathf.Pow(0.8f, (float)itemCountsEffective.RareCount) * Mathf.Pow(0.7f, (float)itemCountsEffective.EpicCount) * Mathf.Pow(0.5f, (float)itemCountsEffective.LegendaryCount); } } return 1f; } } } public sealed class ShurikenProjectileController : MonoBehaviour { private void Awake() { ProjectileController component = ((Component)this).GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { Log.Error(Util.GetGameObjectHierarchyName(((Component)this).gameObject) + " is missing ProjectileController component", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\ShurikenProjectileController.cs", "Awake", 15); ((Behaviour)this).enabled = false; } else { component.onInitialized += onInitialized; } } private void onInitialized(ProjectileController projectileController) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) ItemQualityCounts itemQualityCounts = default(ItemQualityCounts); CharacterBody val = default(CharacterBody); if (Object.op_Implicit((Object)(object)projectileController.owner) && projectileController.owner.TryGetComponent(ref val) && Object.op_Implicit((Object)(object)val.inventory)) { itemQualityCounts = val.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.PrimarySkillShuriken); } Vector3 val2 = ((Component)this).transform.localScale; if (itemQualityCounts.TotalQualityCount > 0) { float num = 0.3f * (float)itemQualityCounts.UncommonCount + 0.6f * (float)itemQualityCounts.RareCount + 1f * (float)itemQualityCounts.EpicCount + 1.5f * (float)itemQualityCounts.LegendaryCount; if (num > 0f) { val2 *= 1f + num; } } ((Component)this).transform.localScale = val2; } } internal static class SlowOnHit { private delegate bool ShouldApplyBaseSlowOnHitDelegate(DamageInfo damageInfo, GameObject victim, out bool isQualityProc); [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown GlobalEventManager.ProcessHitEnemy += new Manipulator(GlobalEventManager_ProcessHitEnemy); } private static void GlobalEventManager_ProcessHitEnemy(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageInfo parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SlowOnHit.cs", "GlobalEventManager_ProcessHitEnemy", 26); return; } if (!((MethodReference)(object)il.Method).TryFindParameter("victim", out var parameter2)) { Log.Error("Failed to find victim parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SlowOnHit.cs", "GlobalEventManager_ProcessHitEnemy", 32); return; } ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "SlowOnHit"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "AddTimedBuff") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SlowOnHit.cs", "GlobalEventManager_ProcessHitEnemy", 40); return; } val.Goto(array[1].Next, (MoveType)0, false); VariableDefinition val2 = il.AddVariable(); val.Emit(OpCodes.Ldarg, parameter); val.Emit(OpCodes.Ldarg, parameter2); val.Emit(OpCodes.Ldloca, val2); val.EmitDelegate((ShouldApplyBaseSlowOnHitDelegate)shouldApplyBaseSlowOnHit); val.EmitSkipMethodCall(OpCodes.Brfalse); val.Emit(OpCodes.Ldloc, val2); val.Emit(OpCodes.Ldarg, parameter); val.Emit(OpCodes.Ldarg, parameter2); val.EmitDelegate>((Action)handleQualityProc); static void handleQualityProc(bool isQualityProc, DamageInfo damageInfo, GameObject victim) { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if (isQualityProc) { CharacterBody val3 = (Object.op_Implicit((Object)(object)victim) ? victim.GetComponent() : null); if (Object.op_Implicit((Object)(object)val3)) { GameObject val4 = damageInfo?.attacker; CharacterBody val5 = (Object.op_Implicit((Object)(object)val4) ? val4.GetComponent() : null); if (Object.op_Implicit((Object)(object)val5)) { _ = val5.master; } Inventory val6 = (Object.op_Implicit((Object)(object)val5) ? val5.inventory : null); if (Object.op_Implicit((Object)(object)val6)) { ItemQualityCounts itemCountsEffective = val6.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.SlowOnHit); QualityTier highestQuality = itemCountsEffective.HighestQuality; if (highestQuality != QualityTier.None) { for (QualityTier qualityTier = highestQuality - 1; qualityTier >= QualityTier.None; qualityTier--) { BuffIndex buffIndex = ItemQualitiesContent.BuffQualityGroups.Slow60.GetBuffIndex(qualityTier); if (val3.HasBuffRaw(buffIndex)) { val3.ClearTimedBuffs(buffIndex); } } BuffIndex buffIndex2 = ItemQualitiesContent.BuffQualityGroups.Slow60.GetBuffIndex(highestQuality); val3.AddTimedBuff(buffIndex2, 2f * (float)itemCountsEffective.TotalCount); } } } } } static bool shouldApplyBaseSlowOnHit(DamageInfo damageInfo, GameObject victim, out bool isQualityProc) { GameObject val7 = damageInfo?.attacker; CharacterBody val8 = (Object.op_Implicit((Object)(object)val7) ? val7.GetComponent() : null); CharacterMaster master = (Object.op_Implicit((Object)(object)val8) ? val8.master : null); Inventory val9 = (Object.op_Implicit((Object)(object)val8) ? val8.inventory : null); if (!Object.op_Implicit((Object)(object)val9)) { isQualityProc = false; return true; } ItemQualityCounts itemCountsEffective2 = val9.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.SlowOnHit); if (itemCountsEffective2.TotalQualityCount <= 0) { isQualityProc = false; return true; } float num = 10f * (float)itemCountsEffective2.UncommonCount + 20f * (float)itemCountsEffective2.RareCount + 35f * (float)itemCountsEffective2.EpicCount + 60f * (float)itemCountsEffective2.LegendaryCount; isQualityProc = RollUtil.CheckRoll(Util.ConvertAmplificationPercentageIntoReductionPercentage(num) * damageInfo.procCoefficient, master, ((ProcChainMask)(ref damageInfo.procChainMask)).HasProc((ProcType)26)); if (isQualityProc) { return false; } CharacterBody val10 = (Object.op_Implicit((Object)(object)victim) ? victim.GetComponent() : null); if (Object.op_Implicit((Object)(object)val10)) { return val10.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.Slow60).TotalQualityCount == 0; } return false; } } } internal static class SlowOnHitVoid { private static DeployableSlot _rootAreaDeployableSlot = (DeployableSlot)35; [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //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) _rootAreaDeployableSlot = DeployableAPI.RegisterDeployableSlot(new GetDeployableSameSlotLimit(getRootAreaLimit)); GlobalEventManager.onCharacterDeathGlobal += onCharacterDeathGlobal; } private static int getRootAreaLimit(CharacterMaster self, int deployableCountMultiplier) { return 2; } private static void onCharacterDeathGlobal(DamageReport deathReport) { //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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) if (deathReport?.damageInfo == null || !NetworkServer.active) { return; } Inventory val = (Object.op_Implicit((Object)(object)deathReport.attackerBody) ? deathReport.attackerBody.inventory : null); if (!Object.op_Implicit((Object)(object)val)) { return; } ItemQualityCounts itemCountsEffective = val.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.SlowOnHitVoid); if (itemCountsEffective.TotalQualityCount > 0 && Object.op_Implicit((Object)(object)deathReport.victimBody) && deathReport.victimBody.HasBuff(Buffs.Nullified)) { float networkradius = 4f * (float)itemCountsEffective.UncommonCount + 7f * (float)itemCountsEffective.RareCount + 10f * (float)itemCountsEffective.EpicCount + 15f * (float)itemCountsEffective.LegendaryCount; Vector3 val2 = deathReport.victimBody.footPosition; RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(new Ray(val2, Vector3.down), ref val3, 100f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask))) { val2 = ((RaycastHit)(ref val3)).point; } GameObject val4 = Object.Instantiate(ItemQualitiesContent.NetworkedPrefabs.SlowOnHitRootArea, val2, Quaternion.identity); val4.GetComponent().Networkradius = networkradius; if (Object.op_Implicit((Object)(object)deathReport.attackerMaster)) { Deployable component = val4.GetComponent(); deathReport.attackerMaster.AddDeployable(component, _rootAreaDeployableSlot); } NetworkServer.Spawn(val4); } } } internal static class SpeedBoostPickup { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown ElusiveAntlersPickup.OnTriggerStay += new Manipulator(ElusiveAntlersPickup_OnTriggerStay); } private static void ElusiveAntlersPickup_OnTriggerStay(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "ElusiveAntlersBuff"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "AddTimedBuff") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SpeedBoostPickup.cs", "ElusiveAntlersPickup_OnTriggerStay", 27); return; } val.Goto(array[1].Next, (MoveType)0, false); VariableDefinition targetBodyVar = null; ILCursor[] array2 = default(ILCursor[]); if (val.TryFindPrev(ref array2, new Func[1] { (Instruction x) => x.MatchLdloc(typeof(CharacterBody), il, out targetBodyVar) })) { val.Emit(OpCodes.Ldloc, targetBodyVar); } else { Log.Warning("Failed to find targetBody variable", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SpeedBoostPickup.cs", "ElusiveAntlersPickup_OnTriggerStay", 41); if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find Collider parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SpeedBoostPickup.cs", "ElusiveAntlersPickup_OnTriggerStay", 45); return; } val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)getTargetBody); } val.EmitDelegate>((Action)beforeGiveAntlerBuff); static void beforeGiveAntlerBuff(CharacterBody body) { if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.inventory)) { ItemQualityCounts itemCountsEffective = body.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.SpeedBoostPickup); if (itemCountsEffective.TotalQualityCount > 0 && body.GetBuffCount(Buffs.ElusiveAntlersBuff) >= Mathf.Min(6, body.GetElusiveAntlersCurrentMaxStack())) { float num = 1f * (float)itemCountsEffective.UncommonCount + 3f * (float)itemCountsEffective.RareCount + 6f * (float)itemCountsEffective.EpicCount + 8f * (float)itemCountsEffective.LegendaryCount; if (num > 0f) { body.AddTimedBuff(Buffs.Cloak, num); } } } } static CharacterBody getTargetBody(Collider collider) { if (!Object.op_Implicit((Object)(object)collider)) { return null; } CharacterBody result = default(CharacterBody); if (((Component)collider).TryGetComponent(ref result)) { return result; } EntityLocator val2 = default(EntityLocator); CharacterBody result2 = default(CharacterBody); if (((Component)collider).TryGetComponent(ref val2) && Object.op_Implicit((Object)(object)val2.entity) && val2.entity.TryGetComponent(ref result2)) { return result2; } return null; } } } internal static class SpeedOnPickup { private static InteractableSpawnCard _iscSpeedOnPickupBarrel; [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { AsyncOperationHandle barrelLoad = AddressableUtil.LoadTempAssetAsync(RoR2_Base_Barrel1.Barrel1_prefab); AsyncOperationHandle barrelIconLoad = AddressableUtil.LoadAssetAsync(RoR2_Base_Common_MiscIcons.texBarrelIcon_png, (AsyncReferenceHandleUnloadType)2); AsyncOperationHandle speedOnPickupSalvageLoad = AddressableUtil.LoadTempAssetAsync(RoR2_DLC3_Items_SpeedOnPickup.SpeedOnPickupSalvage_prefab); AsyncOperationHandle extraStatsOnLevelUpScrapEffectLoad = AddressableUtil.LoadTempAssetAsync(RoR2_DLC2_Items_ExtraStatsOnLevelUp.ExtraStatsOnLevelUpScrapEffect_prefab); ParallelProgressCoroutine val = new ParallelProgressCoroutine((IProgress)args.ProgressReceiver); val.Add(in barrelLoad); val.Add(in barrelIconLoad); val.Add(in speedOnPickupSalvageLoad); val.Add(in extraStatsOnLevelUpScrapEffectLoad); yield return val; GameObject val2 = null; if (extraStatsOnLevelUpScrapEffectLoad.IsValid() && (int)extraStatsOnLevelUpScrapEffectLoad.Status == 1 && Object.op_Implicit((Object)(object)extraStatsOnLevelUpScrapEffectLoad.Result)) { val2 = PrefabAPI.InstantiateClone(extraStatsOnLevelUpScrapEffectLoad.Result, "SpeedOnPickupBarrelSalvagePickupEffect", false); MultiTextRiserController val3 = default(MultiTextRiserController); if (val2.TryGetComponent(ref val3)) { val3.DisplayStrings = new string[7] { "SPEEDONPICKUP_STATBUFF_DAMAGE", "SPEEDONPICKUP_STATBUFF_HEALTH", "SPEEDONPICKUP_STATBUFF_ATTACKSPEED", "SPEEDONPICKUP_STATBUFF_MOVESPEED", "SPEEDONPICKUP_STATBUFF_REGENERATION", "SPEEDONPICKUP_STATBUFF_CRIT", "SPEEDONPICKUP_STATBUFF_ARMOR" }; val3.BaseDuration = 1f; val3.DurationModifier = 0f; } else { Log.Error($"Missing MultiTextRiserController component on {extraStatsOnLevelUpScrapEffectLoad.Result}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SpeedOnPickup.cs", "LoadContent", 58); } } else { Log.Error(string.Format("Failed to load beads scrap effect: {0}", extraStatsOnLevelUpScrapEffectLoad.IsValid() ? ((object)extraStatsOnLevelUpScrapEffectLoad.OperationException) : ((object)"invalid handle")), "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SpeedOnPickup.cs", "LoadContent", 63); } GameObject val4 = null; if (speedOnPickupSalvageLoad.IsValid() && (int)speedOnPickupSalvageLoad.Status == 1 && Object.op_Implicit((Object)(object)speedOnPickupSalvageLoad.Result)) { val4 = PrefabAPI.InstantiateClone(speedOnPickupSalvageLoad.Result, "SpeedOnPickupBarrelSalvage"); HealthPickup componentInChildren = val4.GetComponentInChildren(); if (Object.op_Implicit((Object)(object)componentInChildren)) { SpeedOnPickupStatsPickup speedOnPickupStatsPickup = ((Component)componentInChildren).gameObject.AddComponent(); speedOnPickupStatsPickup.BaseObject = componentInChildren.baseObject; speedOnPickupStatsPickup.TeamFilter = componentInChildren.teamFilter; speedOnPickupStatsPickup.PickupEffect = (Object.op_Implicit((Object)(object)val2) ? val2 : componentInChildren.pickupEffect); Object.Destroy((Object)(object)componentInChildren); } else { Log.Error("Failed to find HealthPickup prefab", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SpeedOnPickup.cs", "LoadContent", 83); } } else { Log.Error(string.Format("Failed to load salvage prefab: {0}", speedOnPickupSalvageLoad.IsValid() ? ((object)speedOnPickupSalvageLoad.OperationException) : ((object)"invalid handle")), "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SpeedOnPickup.cs", "LoadContent", 88); } GameObject val5 = null; if (barrelLoad.IsValid() && (int)barrelLoad.Status == 1 && Object.op_Implicit((Object)(object)barrelLoad.Result)) { val5 = PrefabAPI.InstantiateClone(barrelLoad.Result, "SpeedOnPickupBarrel"); Renderer val6 = null; ModelLocator val7 = default(ModelLocator); if (val5.TryGetComponent(ref val7) && Object.op_Implicit((Object)(object)val7.modelTransform)) { ((Object)val7.modelTransform).name = "mdlSpeedOnPickupBarrel"; RandomizeSplatBias val8 = default(RandomizeSplatBias); if (((Component)val7.modelTransform).TryGetComponent(ref val8)) { Object.Destroy((Object)(object)val8); } val6 = ((Component)val7.modelTransform).GetComponentInChildren(); } Texture val9 = args.ContentPack.textures.Find("texTrimSheetConstructionGold"); if (Object.op_Implicit((Object)(object)val9)) { if (Object.op_Implicit((Object)(object)val6)) { Material val10 = new Material(val6.sharedMaterial); ((Object)val10).name = "matBarrelGold"; val10.mainTexture = val9; val10.SetFloat(ShaderProperties._Smoothness, 0.9f); val10.SetFloat(ShaderProperties._SpecularStrength, 0.3f); val10.SetFloat(ShaderProperties._SpecularExponent, 2f); val10.SetInt(ShaderProperties._FresnelEmissionEnabled, 1); val6.sharedMaterial = val10; } else { Log.Error("Failed to find barrel prefab model renderer", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SpeedOnPickup.cs", "LoadContent", 125); } } else { Log.Error("Failed to get collectors compulsion barrel texture", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SpeedOnPickup.cs", "LoadContent", 130); } Object.Destroy((Object)(object)val5.GetComponent()); UnityObjectExtensions.EnsureComponent(val5).displayToken = "BARREL_SPEEDONPICKUP_NAME"; GenericInspectInfoProvider val11 = default(GenericInspectInfoProvider); if (val5.TryGetComponent(ref val11)) { val11.InspectInfo = Object.Instantiate(val11.InspectInfo); ((Object)val11.InspectInfo).name = "SpeedOnPickupBarrelInspectDef"; val11.InspectInfo.Info.TitleToken = "BARREL_SPEEDONPICKUP_NAME"; val11.InspectInfo.Info.DescriptionToken = "BARREL_SPEEDONPICKUP_DESCRIPTION"; } SpeedOnPickupBarrelInteraction speedOnPickupBarrelInteraction = val5.AddComponent(); speedOnPickupBarrelInteraction.PickupPrefab = val4; SpecialObjectAttributes val12 = default(SpecialObjectAttributes); if (val5.TryGetComponent(ref val12)) { for (int num = val12.behavioursToDisable.Count - 1; num >= 0; num--) { if (!Object.op_Implicit((Object)(object)val12.behavioursToDisable[num])) { val12.behavioursToDisable.RemoveAt(num); } } val12.behavioursToDisable.Add((MonoBehaviour)(object)speedOnPickupBarrelInteraction); } args.ContentPack.networkedObjectPrefabs.Add((GameObject[])(object)new GameObject[2] { val5, val4 }); args.ContentPack.effectDefs.Add((EffectDef[])(object)new EffectDef[1] { new EffectDef(val2) }); _iscSpeedOnPickupBarrel = ScriptableObject.CreateInstance(); ((Object)_iscSpeedOnPickupBarrel).name = "iscSpeedOnPickupBarrel"; ((SpawnCard)_iscSpeedOnPickupBarrel).prefab = val5; ((SpawnCard)_iscSpeedOnPickupBarrel).sendOverNetwork = true; ((SpawnCard)_iscSpeedOnPickupBarrel).hullSize = (HullClassification)0; ((SpawnCard)_iscSpeedOnPickupBarrel).nodeGraphType = (GraphType)0; ((SpawnCard)_iscSpeedOnPickupBarrel).requiredFlags = (NodeFlags)0; ((SpawnCard)_iscSpeedOnPickupBarrel).forbiddenFlags = (NodeFlags)8; ((SpawnCard)_iscSpeedOnPickupBarrel).occupyPosition = true; _iscSpeedOnPickupBarrel.orientToFloor = true; _iscSpeedOnPickupBarrel.slightlyRandomizeOrientation = true; args.ContentPack.spawnCards.Add((SpawnCard)(object)_iscSpeedOnPickupBarrel); } else { Log.Error(string.Format("Failed to load barrel prefab: {0}", barrelLoad.IsValid() ? ((object)barrelLoad.OperationException) : ((object)"invalid handle")), "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SpeedOnPickup.cs", "LoadContent", 189); } if (barrelIconLoad.IsValid() && (int)barrelIconLoad.Status == 1 && Object.op_Implicit((Object)(object)barrelIconLoad.Result)) { if (Object.op_Implicit((Object)(object)val5)) { PingInfoProvider val13 = UnityObjectExtensions.EnsureComponent(val5); if (!Object.op_Implicit((Object)(object)val13.pingIconOverride)) { val13.pingIconOverride = barrelIconLoad.Result; } } } else { Log.Error(string.Format("Failed to load barrel icon sprite: {0}", barrelIconLoad.IsValid() ? ((object)barrelIconLoad.OperationException) : ((object)"invalid handle")), "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SpeedOnPickup.cs", "LoadContent", 205); } } [SystemInitializer(new Type[] { })] private static void Init() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown SceneDirector.onPostPopulateSceneServer += onPostPopulateSceneServer; RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(getStatCoefficients); } private static void onPostPopulateSceneServer(SceneDirector sceneDirector) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)_iscSpeedOnPickupBarrel) || (!SceneInfo.instance.countsAsStage && !SceneInfo.instance.sceneDef.allowItemsToSpawnObjects)) { return; } Xoroshiro128Plus val = new Xoroshiro128Plus(sceneDirector.rng.nextUlong); foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { if (Object.op_Implicit((Object)(object)readOnlyInstances.inventory) && readOnlyInstances.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.SpeedOnPickup).TotalQualityCount > 0) { DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest((SpawnCard)(object)_iscSpeedOnPickupBarrel, new DirectorPlacementRule { placementMode = (PlacementMode)(Object.op_Implicit((Object)(object)SceneInfo.instance.approximateMapBoundMesh) ? 5 : 4) }, val)); } } } private static void getStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender.master) && ((Component)(object)sender.master).TryGetComponentCached(out CharacterMasterExtraStatsTracker component) && component.SpeedOnPickupBonus > 0) { float num = 1f + 0.01f * (float)component.SpeedOnPickupBonus; if (num > 0f) { args.armorTotalMult *= num; args.attackSpeedTotalMult *= num; args.critDamageTotalMult *= num; args.critTotalMult *= num; args.damageTotalMult *= num; args.healthTotalMult *= num; args.moveSpeedTotalMult *= num; args.regenTotalMult *= num; } } } } internal static class SprintArmor { public static GameObject BucklerDefenseBigPrefab; [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { //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_0031: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle handle = AddressableUtil.LoadTempAssetAsync(RoR2_Base_SprintArmor.BucklerDefense_prefab); handle.OnSuccess(delegate(GameObject bucklerDefense) { //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) BucklerDefenseBigPrefab = PrefabAPI.InstantiateClone(bucklerDefense, "BucklerDefenseBig", false); Transform val = BucklerDefenseBigPrefab.transform.Find("MeshHolder"); Dictionary dictionary = new Dictionary(); MeshRenderer val2 = default(MeshRenderer); for (int i = 0; i < val.childCount; i++) { Transform child = val.GetChild(i); if (Object.op_Implicit((Object)(object)child) && ((Component)child).TryGetComponent(ref val2)) { Material sharedMaterial = ((Renderer)val2).sharedMaterial; if (Object.op_Implicit((Object)(object)sharedMaterial)) { if (!dictionary.TryGetValue(sharedMaterial, out var value)) { value = new Material(sharedMaterial); ((Object)value).name = ((Object)sharedMaterial).name + "_Red"; value.SetColor(ShaderProperties._TintColor, new Color(0.9f, 0f, 0f)); value.SetColor(ShaderProperties._Color, new Color(0.9f, 0f, 0f)); dictionary.Add(sharedMaterial, value); } ((Renderer)val2).sharedMaterial = value; } } } RotateObject componentInChildren = BucklerDefenseBigPrefab.GetComponentInChildren(true); if (Object.op_Implicit((Object)(object)componentInChildren)) { componentInChildren.rotationSpeed *= 0.5f; } }); return handle.AsProgressCoroutine>(args.ProgressReceiver); } [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(getStatCoefficients); } private static void getStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender.inventory)) { sender.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.SprintArmor); if (sender.HasBuff(ItemQualitiesContent.Buffs.SprintArmorWeaken)) { args.armorAdd -= 20f; args.damageTotalMult *= 0.6f; args.moveSpeedTotalMult *= 0.6f; } } } } public sealed class SprintArmorQualityItemBehavior : QualityItemBodyBehavior { private GameObject _sprintArmorDashAttachment; [ItemGroupAssociation(QualityItemBehaviorUsageFlags.Server)] private static ItemQualityGroup GetItemGroup() { return ItemQualitiesContent.ItemQualityGroups.SprintArmor; } private void OnEnable() { _sprintArmorDashAttachment = Object.Instantiate(ItemQualitiesContent.NetworkedPrefabs.SprintArmorDashAttachment); _sprintArmorDashAttachment.GetComponent().AttachToGameObjectAndSpawn(((Component)base.Body).gameObject, (string)null); } private void OnDisable() { Object.Destroy((Object)(object)_sprintArmorDashAttachment); base.Body.ClearTimedBuffs(ItemQualitiesContent.Buffs.SprintArmorDashCooldown); } } internal static class SprintBonus { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients); } private static void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender.inventory)) { ItemQualityCounts itemCountsEffective = sender.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.SprintBonus); if (sender.isSprinting && itemCountsEffective.TotalQualityCount > 0) { args.moveSpeedMultAdd += (0.15f * (float)itemCountsEffective.UncommonCount + 0.25f * (float)itemCountsEffective.RareCount + 0.39999998f * (float)itemCountsEffective.EpicCount + 0.55f * (float)itemCountsEffective.LegendaryCount) / sender.sprintingSpeedMultiplier; } } } } internal static class SprintOutOfCombat { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(getStatCoefficients); } private static void getStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender.inventory)) { ItemQualityCounts itemCountsEffective = sender.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.SprintOutOfCombat); if (sender.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.WhipBoost).TotalQualityCount > 0) { args.moveSpeedMultAdd += 0.2f * (float)itemCountsEffective.UncommonCount + 0.4f * (float)itemCountsEffective.RareCount + 0.7f * (float)itemCountsEffective.EpicCount + 1f * (float)itemCountsEffective.LegendaryCount; } } } } public sealed class SprintOutOfCombatQualityItemBehavior : QualityItemBodyBehavior { private static EffectIndex _whipActivateEffectIndex = (EffectIndex)(-1); private bool _providingBuff; [SystemInitializer(new Type[] { typeof(EffectCatalogUtils) })] private static void Init() { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 _whipActivateEffectIndex = EffectCatalogUtils.FindEffectIndex("SprintActivate"); if ((int)_whipActivateEffectIndex == -1) { Log.Warning("Failed to find whip activate effect index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\SprintOutOfCombatQualityItemBehavior.cs", "Init", 18); } } [ItemGroupAssociation(QualityItemBehaviorUsageFlags.Server)] private static ItemQualityGroup GetItemGroup() { return ItemQualitiesContent.ItemQualityGroups.SprintOutOfCombat; } private void OnDisable() { if (NetworkServer.active) { setProvidingBuff(providingBuff: false); } } private void FixedUpdate() { if (NetworkServer.active) { setProvidingBuff((Object.op_Implicit((Object)(object)TeleporterInteraction.instance) && TeleporterInteraction.instance.isCharged) || (Object.op_Implicit((Object)(object)MoonBatteryMissionController.instance) && MoonBatteryMissionController.instance.numChargedBatteries >= MoonBatteryMissionController.instance.numRequiredBatteries)); } } protected override void OnStacksChanged() { base.OnStacksChanged(); base.Body.ConvertQualityBuffsToTier(ItemQualitiesContent.BuffQualityGroups.WhipBoost, base.Stacks.HighestQuality); } private void setProvidingBuff(bool providingBuff) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Invalid comparison between Unknown and I4 //IL_0056: 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_00b3: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_00b2: 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_009f: Unknown result type (might be due to invalid IL or missing references) if (providingBuff == _providingBuff) { return; } _providingBuff = providingBuff; if (providingBuff) { QualityTier highestQuality = base.Stacks.HighestQuality; QualityTierDef qualityTierDef = QualityCatalog.GetQualityTierDef(highestQuality); base.Body.AddBuff(ItemQualitiesContent.BuffQualityGroups.WhipBoost.GetBuffIndex(highestQuality)); if ((int)_whipActivateEffectIndex != -1) { Vector3 val = base.Body.transform.forward; if (Object.op_Implicit((Object)(object)base.Body.characterDirection)) { val = ((!(((Vector3)(ref base.Body.characterDirection.moveVector)).sqrMagnitude > Mathf.Epsilon)) ? base.Body.characterDirection.forward : ((Vector3)(ref base.Body.characterDirection.moveVector)).normalized); } EffectData val2 = new EffectData { origin = base.Body.corePosition, rotation = Util.QuaternionSafeLookRotation(val) }; if (Object.op_Implicit((Object)(object)qualityTierDef)) { val2.color = Color32.op_Implicit(qualityTierDef.color); } EffectManager.SpawnEffect(_whipActivateEffectIndex, val2, true); } } else { base.Body.RemoveAllQualityBuffs(ItemQualitiesContent.BuffQualityGroups.WhipBoost); } } } internal static class Squid { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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 GlobalEventManager.OnInteractionBegin += new Manipulator(GlobalEventManager_OnInteractionBegin); GlobalEventManager.onCharacterDeathGlobal += onCharacterDeathGlobal; RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(getStatCoefficients); } private static void getStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender.inventory)) { int itemCountEffective = sender.inventory.GetItemCountEffective(ItemQualitiesContent.Items.SquidUpgradeHidden); if (itemCountEffective > 0) { args.healthMultAdd += (float)itemCountEffective; args.damageMultAdd += (float)itemCountEffective; args.allSkills.cooldownMultiplier *= Mathf.Pow(0.8f, (float)itemCountEffective); } } } private static void onCharacterDeathGlobal(DamageReport damageReport) { //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) CharacterMaster val = damageReport?.attackerMaster; if (!Object.op_Implicit((Object)(object)val)) { return; } Inventory inventory = val.inventory; if (!Object.op_Implicit((Object)(object)inventory)) { return; } int itemCountEffective = inventory.GetItemCountEffective(ItemQualitiesContent.Items.SquidUpgradeChanceOnKill); if (itemCountEffective == 0) { return; } int num = Mathf.Min(itemCountEffective, 4); int itemCountEffective2 = inventory.GetItemCountEffective(ItemQualitiesContent.Items.SquidUpgradeHidden); if (!RollUtil.CheckRoll(10 + itemCountEffective * 10, val, ((ProcChainMask)(ref damageReport.damageInfo.procChainMask)).HasProc((ProcType)26))) { return; } if (itemCountEffective2 < num) { QualityTier qualityTier = (QualityTier)(itemCountEffective2 - 1); bool flag; if (qualityTier != QualityTier.None) { ItemTransformation val2 = default(ItemTransformation); ((ItemTransformation)(ref val2)).originalItemIndex = ItemQualitiesContent.ItemQualityGroups.QualityTier.GetItemIndex(qualityTier); ((ItemTransformation)(ref val2)).newItemIndex = ItemQualitiesContent.ItemQualityGroups.QualityTier.GetItemIndex(qualityTier + 1); ((ItemTransformation)(ref val2)).allowWhenDisabled = true; ((ItemTransformation)(ref val2)).minToTransform = 1; ((ItemTransformation)(ref val2)).maxToTransform = 1; val2.transformationType = (ItemTransformationTypeIndex)(-1); ItemTransformation val3 = val2; TryTransformResult val4 = default(TryTransformResult); flag = ((ItemTransformation)(ref val3)).TryTransform(inventory, ref val4); } else { inventory.GiveItemPermanent(ItemQualitiesContent.ItemQualityGroups.QualityTier.UncommonItemIndex, 1); flag = true; } if (flag) { inventory.GiveItemPermanent(ItemQualitiesContent.Items.SquidUpgradeHidden, 1); } } if (inventory.GetItemCountEffective(Items.HealthDecay) > 0) { inventory.GiveItemPermanent(Items.HealthDecay, 10); } } private static void GlobalEventManager_OnInteractionBegin(ILContext il) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find Interactor parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Squid.cs", "GlobalEventManager_OnInteractionBegin", 100); return; } ILCursor val = new ILCursor(il); VariableDefinition squidDirectorSpawnRequestVar = null; ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[4] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "Squid"), (Instruction x) => ILPatternMatchingExt.MatchNewobj(x), (Instruction x) => x.MatchStloc(typeof(DirectorSpawnRequest), il, out squidDirectorSpawnRequestVar), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "onSpawnedServer") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Squid.cs", "GlobalEventManager_OnInteractionBegin", 113); return; } val.Goto(array[3].Next, (MoveType)2, false); val.Emit(OpCodes.Ldloc, squidDirectorSpawnRequestVar); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Action)handleQualitySquid); static void handleQualitySquid(DirectorSpawnRequest directorSpawnRequest, Interactor interactor) { if (directorSpawnRequest != null) { CharacterBody val2 = (Object.op_Implicit((Object)(object)interactor) ? ((Component)interactor).GetComponent() : null); Inventory val3 = (Object.op_Implicit((Object)(object)val2) ? val2.inventory : null); if (Object.op_Implicit((Object)(object)val3)) { ItemQualityCounts squid = val3.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Squid); if (squid.TotalQualityCount > 0) { directorSpawnRequest.onSpawnedServer = (Action)Delegate.Combine(directorSpawnRequest.onSpawnedServer, (Action)delegate(SpawnResult result) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) CharacterMaster val4 = default(CharacterMaster); if (result.success && Object.op_Implicit((Object)(object)result.spawnedInstance) && result.spawnedInstance.TryGetComponent(ref val4) && Object.op_Implicit((Object)(object)val4.inventory)) { val4.inventory.GiveItemPermanent(ItemQualitiesContent.Items.SquidUpgradeChanceOnKill, (int)(squid.HighestQuality + 1)); int num = 3 * squid.UncommonCount + 4 * squid.RareCount + 5 * squid.EpicCount + 6 * squid.LegendaryCount; if (num > 0) { val4.inventory.GiveItemPermanent(Items.BoostDamage, num); } } }); } } } } } } internal static class StickyBomb { [SystemInitializer(new Type[] { })] private static 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown AsyncOperationHandle handle = AddressableUtil.LoadAssetAsync(RoR2_Base_StickyBomb.StickyBombGhost_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject stickyBombGhost) { ProjectileGhostController val = default(ProjectileGhostController); if (stickyBombGhost.TryGetComponent(ref val)) { val.inheritScaleFromProjectile = true; } }); GlobalEventManager.ProcessHitEnemy += new Manipulator(GlobalEventManager_ProcessHitEnemy); } public static float GetStickyBombScaleMultiplier(CharacterBody ownerBody) { Inventory val = (Object.op_Implicit((Object)(object)ownerBody) ? ownerBody.inventory : null); if (!Object.op_Implicit((Object)(object)val)) { return 1f; } ItemQualityCounts itemCountsEffective = val.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.StickyBomb); if (itemCountsEffective.TotalQualityCount <= 0) { return 1f; } return 1f + 0.2f * (float)itemCountsEffective.UncommonCount + 0.5f * (float)itemCountsEffective.RareCount + 1f * (float)itemCountsEffective.EpicCount + 2f * (float)itemCountsEffective.LegendaryCount; } private static void GlobalEventManager_ProcessHitEnemy(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageInfo parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\StickyBomb.cs", "GlobalEventManager_ProcessHitEnemy", 54); return; } ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "StickyBomb"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(Util), "OnHitProcDamage"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "FireProjectileWithoutDamageType") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\StickyBomb.cs", "GlobalEventManager_ProcessHitEnemy", 63); return; } val.Goto(array[1].Next, (MoveType)0, false); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)getStickyBombDamageCoefficient); static float getStickyBombDamageCoefficient(float damageCoefficient, DamageInfo damageInfo) { GameObject val2 = damageInfo?.attacker; CharacterBody val3 = (Object.op_Implicit((Object)(object)val2) ? val2.GetComponent() : null); Inventory val4 = (Object.op_Implicit((Object)(object)val3) ? val3.inventory : null); if (Object.op_Implicit((Object)(object)val4)) { ItemQualityCounts itemCountsEffective = val4.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.StickyBomb); if (itemCountsEffective.TotalQualityCount > 0) { damageCoefficient += 0.5f * (float)itemCountsEffective.UncommonCount + 0.8f * (float)itemCountsEffective.RareCount + 1.2f * (float)itemCountsEffective.EpicCount + 2f * (float)itemCountsEffective.LegendaryCount; } } return damageCoefficient; } } } public sealed class StickyBombProjectileQualityController : MonoBehaviour { [SystemInitializer(new Type[] { })] private static 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) AsyncOperationHandle handle = AddressableUtil.LoadAssetAsync(RoR2_Base_StickyBomb.StickyBomb_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject stickyBombPrefab) { UnityObjectExtensions.EnsureComponent(stickyBombPrefab); }); } private void Awake() { ProjectileController val = default(ProjectileController); if (NetworkServer.active && ((Component)this).TryGetComponent(ref val)) { val.onInitialized += onInitializedServer; } } private void onInitializedServer(ProjectileController projectileController) { //IL_003d: 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) GameObject val = (Object.op_Implicit((Object)(object)projectileController) ? projectileController.owner : null); float stickyBombScaleMultiplier = StickyBomb.GetStickyBombScaleMultiplier(Object.op_Implicit((Object)(object)val) ? val.GetComponent() : null); if (stickyBombScaleMultiplier >= 1f) { ((Component)this).transform.localScale = ((Component)this).transform.localScale * stickyBombScaleMultiplier; ProjectileExplosion val2 = default(ProjectileExplosion); if (((Component)this).TryGetComponent(ref val2)) { val2.SetExplosionRadius(val2.blastRadius * stickyBombScaleMultiplier); } } } } internal static class StrengthenBurn { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(getStatCoefficients); GlobalEventManager.onServerDamageDealt += onServerDamageDealt; } private static void getStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender.inventory) && sender.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.StrengthenBurn).TotalQualityCount > 0) { args.critAdd += 5f; } } private static void onServerDamageDealt(DamageReport damageReport) { //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) if (damageReport?.damageInfo == null || !damageReport.damageInfo.crit || !Object.op_Implicit((Object)(object)damageReport.victimBody) || !Object.op_Implicit((Object)(object)damageReport.attackerBody) || !Object.op_Implicit((Object)(object)damageReport.attackerMaster) || !Object.op_Implicit((Object)(object)damageReport.attackerMaster.inventory)) { return; } ItemQualityCounts itemCountsEffective = damageReport.attackerMaster.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.StrengthenBurn); if (itemCountsEffective.TotalQualityCount > 0) { float num = 0.1f * (float)itemCountsEffective.UncommonCount + 0.2f * (float)itemCountsEffective.RareCount + 0.3f * (float)itemCountsEffective.EpicCount + 0.5f * (float)itemCountsEffective.LegendaryCount; uint value = 5u; InflictDotInfo val = default(InflictDotInfo); val.attackerObject = damageReport.attacker; val.victimObject = ((Component)damageReport.victim).gameObject; val.dotIndex = (DotIndex)1; val.totalDamage = num * damageReport.attackerBody.damage; val.damageMultiplier = 1f; val.maxStacksFromAttacker = value; InflictDotInfo val2 = val; if (Object.op_Implicit((Object)(object)damageReport.attackerMaster) && Object.op_Implicit((Object)(object)damageReport.attackerMaster.inventory)) { StrengthenBurnUtils.CheckDotForUpgrade(damageReport.attackerMaster.inventory, ref val2); } DotController.InflictDot(ref val2); } } } public sealed class StunAndPierceProjectileController : NetworkBehaviour { private ProjectileController _projectileController; private BoomerangProjectile _boomerangProjectile; private ProjectileOverlapAttack _projectileOverlapAttack; private float _startBounceTimer = -1f; private int _bouncesRemaining; private GameObject _lastHitObject; private readonly List _bouncedObjects = new List(); private readonly BullseyeSearch _bounceTargetSearch = new BullseyeSearch { queryTriggerInteraction = (QueryTriggerInteraction)1, filterByDistinctEntity = true, filterByLoS = true, sortMode = (SortMode)3, maxAngleFilter = 360f, teamMaskFilter = TeamMask.all }; [SystemInitializer(new Type[] { })] private static 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) AsyncOperationHandle handle = AddressableUtil.LoadAssetAsync(RoR2_DLC2_Items_StunAndPierce.StunAndPierceBoomerang_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject boomerangPrefab) { UnityObjectExtensions.EnsureComponent(boomerangPrefab); }); } private void Awake() { _projectileController = ((Component)this).GetComponent(); _boomerangProjectile = ((Component)this).GetComponent(); _projectileOverlapAttack = ((Component)this).GetComponent(); _projectileController.onInitialized += onInitialized; } private void onInitialized(ProjectileController projectileController) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)projectileController.owner)) { return; } _bounceTargetSearch.teamMaskFilter = TeamMask.GetEnemyTeams(TeamComponent.GetObjectTeam(projectileController.owner)); CharacterBody val = default(CharacterBody); if (projectileController.owner.TryGetComponent(ref val) && Object.op_Implicit((Object)(object)val.inventory)) { ItemQualityCounts itemCountsEffective = val.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.StunAndPierce); if (itemCountsEffective.TotalQualityCount > 0) { float percentChance = 75f * (float)itemCountsEffective.UncommonCount + 150f * (float)itemCountsEffective.RareCount + 300f * (float)itemCountsEffective.EpicCount + 500f * (float)itemCountsEffective.LegendaryCount; CharacterMaster master = val.master; ProcChainMask procChainMask = projectileController.procChainMask; _bouncesRemaining = RollUtil.GetOverflowRoll(percentChance, master, ((ProcChainMask)(ref procChainMask)).HasProc((ProcType)26)); } } } private void OnEnable() { _projectileOverlapAttack.onServerHitGameObject.AddListener((UnityAction)onHit); } private void OnDisable() { _projectileOverlapAttack.onServerHitGameObject.RemoveListener((UnityAction)onHit); _bouncedObjects.Clear(); } private void FixedUpdate() { if (_startBounceTimer > 0f) { _startBounceTimer -= Time.fixedDeltaTime; if (_startBounceTimer <= 0f) { tryRedirectBoomerang(); } } } private void onHit(GameObject hitObject) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && (int)_boomerangProjectile.boomerangState == 0 && Object.op_Implicit((Object)(object)hitObject) && !((Object)(object)_lastHitObject == (Object)(object)hitObject) && _bouncesRemaining > 0) { _lastHitObject = hitObject; if (_startBounceTimer <= 0f) { _startBounceTimer = 0.4f; } } } [Server] private void tryRedirectBoomerang() { //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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: 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_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void ItemQualities.Items.StunAndPierceProjectileController::tryRedirectBoomerang()' called on client"); } else { if (_bouncesRemaining <= 0) { return; } _bouncesRemaining--; _bounceTargetSearch.searchOrigin = ((Component)this).transform.position; _bounceTargetSearch.searchDirection = ((Component)this).transform.forward; _bounceTargetSearch.maxDistanceFilter = _boomerangProjectile.travelSpeed * _boomerangProjectile.maxFlyStopwatch; _bounceTargetSearch.RefreshCandidates(); GameObject val = null; foreach (HurtBox result in _bounceTargetSearch.GetResults()) { HealthComponent val2 = (Object.op_Implicit((Object)(object)result) ? result.healthComponent : null); if (Object.op_Implicit((Object)(object)val2) && (Object)(object)((Component)val2).gameObject != (Object)(object)_lastHitObject && !_bouncedObjects.Contains(((Component)val2).gameObject)) { val = ((Component)val2).gameObject; break; } } if (Object.op_Implicit((Object)(object)val)) { _bouncedObjects.Add(val); Vector3 val3 = val.transform.position; CharacterBody val4 = default(CharacterBody); if (val.TryGetComponent(ref val4)) { val3 = val4.corePosition; } Transform transform = ((Component)this).transform; Vector3 val5 = val3 - ((Component)this).transform.position; transform.forward = ((Vector3)(ref val5)).normalized; resetBoomerang(); } } } private void resetBoomerang() { _boomerangProjectile.NetworkboomerangState = (BoomerangState)0; _boomerangProjectile.stopwatch = 0f; } private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { bool result = default(bool); return result; } public override void OnDeserialize(NetworkReader reader, bool initialState) { } public override void PreStartClient() { } } internal static class StunChanceOnHit { private sealed class DelayedHitHandler : MonoBehaviour { public float damage; public CharacterBody attacker; private EntityStateMachine _entityStateMachine; private CharacterBody _body; private bool _wasInFrozenState; private void Awake() { _entityStateMachine = EntityStateMachine.FindByCustomName(((Component)this).gameObject, "Body"); _body = ((Component)this).GetComponent(); if (!Object.op_Implicit((Object)(object)_entityStateMachine) || !Object.op_Implicit((Object)(object)_body)) { Object.Destroy((Object)(object)this); } } private void FixedUpdate() { if (damage == 0f || !Object.op_Implicit((Object)(object)_body.healthComponent)) { Object.Destroy((Object)(object)this); return; } if (!IsImmobile(_entityStateMachine)) { dealDelayedDamage(); Object.Destroy((Object)(object)this); } _wasInFrozenState = _body.healthComponent.isInFrozenState; } private void dealDelayedDamage() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown ProcChainMask procChainMask = default(ProcChainMask); ProcTypeAPI.AddModdedProc(ref procChainMask, ProcTypes.Immobilize); bool isInFrozenState = _body.healthComponent.isInFrozenState; _body.healthComponent.isInFrozenState = _wasInFrozenState; DamageInfo val = new DamageInfo { damage = damage, inflictor = (Object.op_Implicit((Object)(object)attacker) ? ((Component)attacker).gameObject : null), attacker = (Object.op_Implicit((Object)(object)attacker) ? ((Component)attacker).gameObject : null), procChainMask = procChainMask, procCoefficient = 1f, damageColorIndex = (DamageColorIndex)15, damageType = DamageTypeCombo.op_Implicit((DamageTypeExtended)262144), position = _body.corePosition }; _body.healthComponent.TakeDamage(val); GlobalEventManager.instance.OnHitEnemy(val, ((Component)_body.healthComponent).gameObject); GlobalEventManager.instance.OnHitAll(val, ((Component)_body.healthComponent).gameObject); _body.healthComponent.isInFrozenState = isInFrozenState; } } [SystemInitializer(new Type[] { })] private static void Init() { //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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown SetStateOnHurt.OnTakeDamageServer += new Manipulator(SetStateOnHurt_OnTakeDamageServer); GlobalEventManager.ProcessHitEnemy += new Manipulator(GlobalEventManager_ProcessHitEnemy); GlobalEventManager.onServerDamageDealt += onServerDamageDealt; RadialForce.ApplyPullToHurtBox += new hook_ApplyPullToHurtBox(RadialForce_ApplyPullToHurtBox); } private static void RadialForce_ApplyPullToHurtBox(orig_ApplyPullToHurtBox orig, RadialForce self, HurtBox hurtBox) { orig.Invoke(self, hurtBox); if (NetworkServer.active && Object.op_Implicit((Object)(object)hurtBox) && Object.op_Implicit((Object)(object)hurtBox.healthComponent) && Object.op_Implicit((Object)(object)hurtBox.healthComponent.body)) { hurtBox.healthComponent.body.AddTimedBuff(ItemQualitiesContent.Buffs.Immobilized, 0.2f); } } private static DelayedHitHandler onImmobilizeInternal(CharacterBody attacker, CharacterBody victim) { DelayedHitHandler delayedHitHandler = ((Component)victim).GetComponent(); if (!Object.op_Implicit((Object)(object)delayedHitHandler)) { delayedHitHandler = ((Component)victim).gameObject.AddComponent(); delayedHitHandler.attacker = attacker; } return delayedHitHandler; } public static void OnImmobilize(CharacterBody attacker, CharacterBody victim) { onImmobilizeInternal(attacker, victim); } public static bool IsImmobile(EntityStateMachine entityStateMachine) { CharacterBody characterBody = entityStateMachine.commonComponents.characterBody; if (entityStateMachine.state is StunState || entityStateMachine.state is FrozenState || entityStateMachine.state is ShockState) { return true; } if (Object.op_Implicit((Object)(object)characterBody) && (characterBody.HasBuff(ItemQualitiesContent.Buffs.Immobilized) || characterBody.HasBuff(Buffs.Entangle) || characterBody.HasBuff(Buffs.Nullified) || characterBody.HasBuff(Buffs.LunarSecondaryRoot) || characterBody.HasBuff(Buffs.VultureRoot) || characterBody.HasBuff(Buffs.Jailed) || (characterBody.moveSpeed < Mathf.Epsilon && characterBody.baseMoveSpeed > 0f) || Object.op_Implicit((Object)(object)characterBody.currentVehicle))) { return true; } return false; } private static void onServerDamageDealt(DamageReport report) { CharacterBody attackerBody = report.attackerBody; if (!Object.op_Implicit((Object)(object)attackerBody) || !Object.op_Implicit((Object)(object)attackerBody.inventory)) { return; } DelayedHitHandler delayedHitHandler = default(DelayedHitHandler); if (!((Component)report.victimBody).TryGetComponent(ref delayedHitHandler)) { EntityStateMachine val = EntityStateMachine.FindByCustomName(((Component)report.victimBody).gameObject, "Body"); if (Object.op_Implicit((Object)(object)val) && IsImmobile(val)) { delayedHitHandler = onImmobilizeInternal(report.attackerBody, report.victimBody); } } if (Object.op_Implicit((Object)(object)delayedHitHandler)) { ItemQualityCounts itemCountsEffective = attackerBody.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.StunChanceOnHit); if (itemCountsEffective.TotalQualityCount != 0) { float num = (float)itemCountsEffective.UncommonCount * 0.15f + (float)itemCountsEffective.RareCount * 0.3f + (float)itemCountsEffective.EpicCount * 0.45f + (float)itemCountsEffective.LegendaryCount * 0.6f; delayedHitHandler.damage += report.damageDealt * num; } } } private static void GlobalEventManager_ProcessHitEnemy(ILContext il) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageInfo parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\StunChanceOnHit.cs", "GlobalEventManager_ProcessHitEnemy", 120); return; } if (!((MethodReference)(object)il.Method).TryFindParameter("victim", out var parameter2)) { Log.Error("Failed to find victim parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\StunChanceOnHit.cs", "GlobalEventManager_ProcessHitEnemy", 126); return; } ILCursor val = new ILCursor(il); ILLabel label = null; if (val.TryGotoNext(new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "Nullified") }) && val.TryGotoPrev((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref label) })) { val.Emit(OpCodes.Ldarg, parameter); val.Emit(OpCodes.Ldarg, parameter2); val.EmitDelegate>((Func)tryImmobilize); val.Emit(OpCodes.Brfalse, (object)label); } else { Log.Error(((MemberReference)il.Method).Name + " IL Hook failed!", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\StunChanceOnHit.cs", "GlobalEventManager_ProcessHitEnemy", 148); } static bool tryImmobilize(DamageInfo damageInfo, GameObject victim) { //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) if (!ProcTypeAPI.HasModdedProc(damageInfo.procChainMask, ProcTypes.Immobilize)) { CharacterBody attacker = (Object.op_Implicit((Object)(object)damageInfo.attacker) ? damageInfo.attacker.GetComponent() : null); CharacterBody victim2 = (Object.op_Implicit((Object)(object)victim) ? victim.GetComponent() : null); OnImmobilize(attacker, victim2); return true; } return false; } } private static void SetStateOnHurt_OnTakeDamageServer(ILContext il) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageReport parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\StunChanceOnHit.cs", "SetStateOnHurt_OnTakeDamageServer", 171); return; } ILCursor val = new ILCursor(il); ILLabel label = null; val.Goto(0, (MoveType)0, false); if (val.TryGotoNext(new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(SetStateOnHurt), "SetStun") }) && val.TryGotoPrev((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref label) })) { val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)tryImmobilize); val.Emit(OpCodes.Brfalse, (object)label); } else { Log.Error("stungrenade IL Hook failed!", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\StunChanceOnHit.cs", "SetStateOnHurt_OnTakeDamageServer", 196); } val.Goto(0, (MoveType)0, false); if (val.TryGotoNext(new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(SetStateOnHurt), "SetFrozen") }) && val.TryGotoPrev((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref label) })) { val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)tryImmobilize); val.Emit(OpCodes.Brfalse, (object)label); } else { Log.Error("freezeonhit IL Hook failed!", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\StunChanceOnHit.cs", "SetStateOnHurt_OnTakeDamageServer", 217); } val.Goto(0, (MoveType)0, false); if (val.TryGotoNext(new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(SetStateOnHurt), "SetShock") }) && val.TryGotoPrev((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref label) })) { val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)tryImmobilize); val.Emit(OpCodes.Brfalse, (object)label); } else { Log.Error("shockonhit IL Hook failed!", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\StunChanceOnHit.cs", "SetStateOnHurt_OnTakeDamageServer", 238); } val.Goto(0, (MoveType)0, false); float num = default(float); if (val.TryGotoNext((MoveType)0, new Func[4] { (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref label), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(SetStateOnHurt), "SetStun") })) { int index = val.Index; val.Index = index + 1; val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)tryImmobilize); val.Emit(OpCodes.Brfalse, (object)label); } else { Log.Error("stunbullet IL Hook failed!", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\StunChanceOnHit.cs", "SetStateOnHurt_OnTakeDamageServer", 260); } val.Goto(0, (MoveType)0, false); if (val.TryGotoNext(new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(SetStateOnHurt), "SetImmobilize") }) && val.TryGotoPrev((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref label) })) { val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)tryImmobilize); val.Emit(OpCodes.Brfalse, (object)label); } else { Log.Error("immobilizestate IL Hook failed!", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\StunChanceOnHit.cs", "SetStateOnHurt_OnTakeDamageServer", 281); } static bool tryImmobilize(DamageReport damageReport) { //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) if (!ProcTypeAPI.HasModdedProc(damageReport.damageInfo.procChainMask, ProcTypes.Immobilize)) { OnImmobilize(damageReport.attackerBody, damageReport.victimBody); return true; } return false; } } } internal static class Syringe { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients); } private static void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender.inventory)) { ItemQualityCounts itemCountsEffective = sender.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Syringe); if (itemCountsEffective.TotalQualityCount > 0) { args.attackSpeedMultAdd += 0.15f * (float)itemCountsEffective.UncommonCount + 0.45000002f * (float)itemCountsEffective.RareCount + 0.9f * (float)itemCountsEffective.EpicCount + 1.35f * (float)itemCountsEffective.LegendaryCount; } } } } internal static class Talisman { private static Action _invokeInventoryOnEquipmentExternalRestockServer; [SystemInitializer(new Type[] { })] private static void Init() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown _invokeInventoryOnEquipmentExternalRestockServer = EventUtils.GetInvokeMethodDelegate>(typeof(Inventory), "onEquipmentExternalRestockServer"); GlobalEventManager.OnCharacterDeath += new Manipulator(GlobalEventManager_OnCharacterDeath); GlobalEventManager.onCharacterDeathGlobal += onCharacterDeathGlobal; } private static void onCharacterDeathGlobal(DamageReport damageReport) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Invalid comparison between Unknown and I4 //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } Inventory val = (Object.op_Implicit((Object)(object)damageReport?.attackerBody) ? damageReport.attackerBody.inventory : null); if (!Object.op_Implicit((Object)(object)val) || (int)val.currentEquipmentIndex == -1) { return; } ItemQualityCounts itemCountsEffective = val.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Talisman); if (itemCountsEffective.TotalQualityCount > 0 && damageReport.victimIsChampion) { int val2 = itemCountsEffective.UncommonCount + itemCountsEffective.RareCount * 2 + itemCountsEffective.EpicCount * 3 + itemCountsEffective.LegendaryCount * 4; EquipmentState equipment = val.GetEquipment((uint)val.activeEquipmentSlot, (uint)val.activeEquipmentSet[val.activeEquipmentSlot]); equipment.charges = HGMath.ByteSafeAdd(equipment.charges, (byte)Math.Min(val2, 255)); if (equipment.charges > val.GetEquipmentSlotMaxCharges()) { equipment.chargeFinishTime = FixedTimeStamp.positiveInfinity; } val.SetEquipment(equipment, (uint)val.activeEquipmentSlot, (uint)val.activeEquipmentSet[val.activeEquipmentSlot]); _invokeInventoryOnEquipmentExternalRestockServer?.Invoke(val); } } private static void GlobalEventManager_OnCharacterDeath(ILContext il) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageReport parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Talisman.cs", "GlobalEventManager_OnCharacterDeath", 61); return; } ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "Talisman"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "DeductActiveEquipmentCooldown") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Talisman.cs", "GlobalEventManager_OnCharacterDeath", 71); return; } val.Goto(array[1].Next, (MoveType)0, false); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)getEquipmentCooldownReduction); static float getEquipmentCooldownReduction(float cooldownReduction, DamageReport damageReport) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Invalid comparison between Unknown and I4 //IL_003a: Unknown result type (might be due to invalid IL or missing references) Inventory val2 = (Object.op_Implicit((Object)(object)damageReport?.attackerBody) ? damageReport.attackerBody.inventory : null); if (Object.op_Implicit((Object)(object)val2) && (int)val2.currentEquipmentIndex != -1) { EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(val2.currentEquipmentIndex); if (Object.op_Implicit((Object)(object)equipmentDef)) { float num = equipmentDef.cooldown * val2.CalculateEquipmentCooldownScale(); ItemQualityCounts itemCountsEffective = val2.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Talisman); if (itemCountsEffective.TotalQualityCount > 0) { float num2 = 0f; if (damageReport.victimIsElite) { num2 += 0.05f * (float)itemCountsEffective.UncommonCount + 0.1f * (float)itemCountsEffective.RareCount + 0.2f * (float)itemCountsEffective.EpicCount + 0.33f * (float)itemCountsEffective.LegendaryCount; } if (num2 > 0f) { cooldownReduction += num2 * num; } } } } return cooldownReduction; } } } internal static class TeleportOnLowHealth { [SystemInitializer(new Type[] { })] private static void Init() { //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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) CharacterMaster.TryTeleportOnLowHealthRegen += new hook_TryTeleportOnLowHealthRegen(CharacterMaster_TryTeleportOnLowHealthRegen); TeleportOnLowHealthBehavior.DestroyTeleportOrb += new Manipulator(TeleportOnLowHealthBehavior_DestroyTeleportOrb); TeleportOnLowHealthBehavior.OnCharacterDeathGlobal += new Manipulator(TeleportOnLowHealthBehavior_OnCharacterDeathGlobal); HealthComponent.DoWarp += new Manipulator(HealthComponent_DoWarp); AsyncOperationHandle handle = AddressableUtil.LoadAssetAsync(RoR2_DLC2_Items_TeleportOnLowHealth.TeleportOnLowHealthExplosion_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject teleportOnLowHealthExplosion) { UnityObjectExtensions.EnsureComponent(teleportOnLowHealthExplosion); }); } private static void CharacterMaster_TryTeleportOnLowHealthRegen(orig_TryTeleportOnLowHealthRegen orig, CharacterMaster self) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 //IL_0042: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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) orig.Invoke(self); if (!Object.op_Implicit((Object)(object)self) || !Object.op_Implicit((Object)(object)self.inventory)) { return; } TryTransformResult val3 = default(TryTransformResult); for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { ItemIndex itemIndex = ItemQualitiesContent.ItemQualityGroups.TeleportOnLowHealth.GetItemIndex(qualityTier); ItemIndex itemIndex2 = ItemQualitiesContent.ItemQualityGroups.TeleportOnLowHealthConsumed.GetItemIndex(qualityTier); if ((int)itemIndex != -1 && (int)itemIndex2 != -1) { ItemTransformation val = default(ItemTransformation); ((ItemTransformation)(ref val)).originalItemIndex = itemIndex2; ((ItemTransformation)(ref val)).newItemIndex = itemIndex; ((ItemTransformation)(ref val)).maxToTransform = int.MaxValue; val.transformationType = (ItemTransformationTypeIndex)7; ItemTransformation val2 = val; ((ItemTransformation)(ref val2)).TryTransform(self.inventory, ref val3); } } } private static void TeleportOnLowHealthBehavior_DestroyTeleportOrb(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "TryTransform") })) { Log.Fatal("Failed to find transmitter consume transformation call", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\TeleportOnLowHealth.cs", "TeleportOnLowHealthBehavior_DestroyTeleportOrb", 67); return; } VariableDefinition itemTransformationVar = null; ILCursor[] array = default(ILCursor[]); if (!val.TryFindPrev(ref array, new Func[2] { (Instruction x) => x.MatchLdloca(typeof(ItemTransformation), il, out itemTransformationVar), (Instruction x) => ILPatternMatchingExt.MatchInitobj(x) })) { Log.Fatal("Failed to find ItemTransformation variable", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\TeleportOnLowHealth.cs", "TeleportOnLowHealthBehavior_DestroyTeleportOrb", 76); return; } val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc, itemTransformationVar); val.EmitDelegate>((Func)tryConsumeQualityTransmitters); static bool tryConsumeQualityTransmitters(bool consumedRegularTransmitter, TeleportOnLowHealthBehavior teleportOnLowHealthBehavior, ItemTransformation itemTransformation) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_0068: 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_007c: Unknown result type (might be due to invalid IL or missing references) if (consumedRegularTransmitter) { return true; } CharacterBody val2 = (Object.op_Implicit((Object)(object)teleportOnLowHealthBehavior) ? ((BaseItemBodyBehavior)teleportOnLowHealthBehavior).body : null); Inventory val3 = (Object.op_Implicit((Object)(object)val2) ? val2.inventory : null); if (Object.op_Implicit((Object)(object)val2)) { _ = val2.master; } if (Object.op_Implicit((Object)(object)val3)) { TryTransformResult val5 = default(TryTransformResult); for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { ItemQualitiesContent.ItemQualityGroups.TeleportOnLowHealth.GetItemIndex(qualityTier); ItemQualitiesContent.ItemQualityGroups.TeleportOnLowHealthConsumed.GetItemIndex(qualityTier); ItemTransformation val4 = itemTransformation; ((ItemTransformation)(ref val4)).originalItemIndex = QualityCatalog.GetItemIndexOfQuality(((ItemTransformation)(ref itemTransformation)).originalItemIndex, qualityTier); ((ItemTransformation)(ref val4)).newItemIndex = QualityCatalog.GetItemIndexOfQuality(((ItemTransformation)(ref itemTransformation)).newItemIndex, qualityTier); if (((ItemTransformation)(ref val4)).TryTransform(val3, ref val5)) { return true; } } } return false; } } private static void TeleportOnLowHealthBehavior_OnCharacterDeathGlobal(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "ExtendTimedBuffIfPresent") }) && val.TryGotoPrev((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 1f) })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getBuffExtensionDuration); } else { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\TeleportOnLowHealth.cs", "TeleportOnLowHealthBehavior_OnCharacterDeathGlobal", 160); } static float getBuffExtensionDuration(float extensionDuration, TeleportOnLowHealthBehavior teleportOnLowHealthBehavior) { CharacterBody val2 = (Object.op_Implicit((Object)(object)teleportOnLowHealthBehavior) ? ((BaseItemBodyBehavior)teleportOnLowHealthBehavior).body : null); Inventory val3 = (Object.op_Implicit((Object)(object)val2) ? val2.inventory : null); if (Object.op_Implicit((Object)(object)val3)) { ItemQualityCounts itemCountsEffective = val3.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.TeleportOnLowHealth); if (itemCountsEffective.UncommonCount > 0) { extensionDuration += 0.5f; } if (itemCountsEffective.RareCount > 0) { extensionDuration += 1.5f; } if (itemCountsEffective.EpicCount > 0) { extensionDuration += 3f; } if (itemCountsEffective.LegendaryCount > 0) { extensionDuration += 5f; } } return extensionDuration; } } private static void HealthComponent_DoWarp(ILContext il) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter("attackerBody", out var parameter)) { Log.Error("Failed to find attackerBody parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\TeleportOnLowHealth.cs", "HealthComponent_DoWarp", 168); return; } ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "InflictDot") }) && val.TryGotoPrev((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 5f) })) { val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)getBleedDuration); } else { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\TeleportOnLowHealth.cs", "HealthComponent_DoWarp", 204); } static float getBleedDuration(float bleedDuration, CharacterBody attackerBody) { Inventory val2 = (Object.op_Implicit((Object)(object)attackerBody) ? attackerBody.inventory : null); if (Object.op_Implicit((Object)(object)val2)) { ItemQualityCounts itemCountsEffective = val2.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.TeleportOnLowHealth); if (itemCountsEffective.TotalQualityCount > 0) { bleedDuration += 1f * (float)itemCountsEffective.UncommonCount + 2f * (float)itemCountsEffective.RareCount + 3.5f * (float)itemCountsEffective.EpicCount + 5f * (float)itemCountsEffective.LegendaryCount; } } return bleedDuration; } } } [DefaultExecutionOrder(50)] public sealed class TeleportOnLowHealthAuraQualityController : MonoBehaviour { private TeleportOnLowHealthAuraController _auraController; private MemoizedGetComponent _ownerBody; private Vector3 _baseScale = Vector3.one; private void Awake() { _auraController = ((Component)this).GetComponent(); } private void Start() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) _baseScale = ((Component)this).transform.localScale; Inventory.onInventoryChangedGlobal += onInventoryChangedGlobal; refreshScale(); } private void onInventoryChangedGlobal(Inventory inventory) { CharacterBody val = _ownerBody.Get(Object.op_Implicit((Object)(object)_auraController) ? _auraController.owner : null); if (Object.op_Implicit((Object)(object)val) && (Object)(object)val.inventory == (Object)(object)inventory) { refreshScale(); } } private void refreshScale() { //IL_00a5: 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) CharacterBody val = _ownerBody.Get(Object.op_Implicit((Object)(object)_auraController) ? _auraController.owner : null); Inventory val2 = (Object.op_Implicit((Object)(object)val) ? val.inventory : null); if (Object.op_Implicit((Object)(object)val2)) { ItemQualityCounts itemCountsEffective = val2.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.TeleportOnLowHealth); if (itemCountsEffective.TotalQualityCount > 0) { float num = 1f; num += 0.2f * (float)itemCountsEffective.UncommonCount; num += 0.4f * (float)itemCountsEffective.RareCount; num += 0.7f * (float)itemCountsEffective.EpicCount; num += 1f * (float)itemCountsEffective.LegendaryCount; ((Component)this).transform.localScale = _baseScale * Mathf.Max(1f, num); } } } } internal static class Thorns { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown HealthComponent.TakeDamageProcess += new Manipulator(HealthComponent_TakeDamageProcess); } private static void HealthComponent_TakeDamageProcess(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); VariableDefinition damageReportVar = null; ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[4] { (Instruction x) => ILPatternMatchingExt.MatchNewobj(x), (Instruction x) => x.MatchStloc(typeof(DamageReport), il, out damageReportVar), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "thorns"), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "damageValue") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Thorns.cs", "HealthComponent_TakeDamageProcess", 30); return; } val.Goto(array[3].Next, (MoveType)1, false); val.Emit(OpCodes.Ldloc, damageReportVar); val.EmitDelegate>((Func)getThornsDamage); static float getThornsDamage(float thornsDamage, DamageReport damageReport) { Inventory val2 = (Object.op_Implicit((Object)(object)damageReport?.victimBody) ? damageReport.victimBody.inventory : null); if (Object.op_Implicit((Object)(object)val2)) { ItemQualityCounts itemCountsEffective = val2.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Thorns); if (itemCountsEffective.TotalQualityCount > 0) { float num = 1f * (float)itemCountsEffective.UncommonCount + 2f * (float)itemCountsEffective.RareCount + 3f * (float)itemCountsEffective.EpicCount + 5f * (float)itemCountsEffective.LegendaryCount; thornsDamage += num * Mathf.Max(damageReport.damageDealt, damageReport.damageInfo.damage); } } return thornsDamage; } } } internal static class Tooth { private delegate GameObject GetHealingOrbPrefabDelegate(GameObject healingOrbPrefab, DamageReport damageReport, out ToothOrbParameters orbParameters); private readonly struct ToothOrbParameters { public readonly float FlatValue; public readonly float FractionalValue; public readonly BuffDef Buff; public ToothOrbParameters(float flatValue, float fractionalValue, BuffDef buff) { FlatValue = flatValue; FractionalValue = fractionalValue; Buff = buff; } } [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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 RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(getStatCoefficients); ItemHooks.TakeDamageModifier += takeDamageModifier; GlobalEventManager.OnCharacterDeath += new Manipulator(GlobalEventManager_OnCharacterDeath); } private static void getStatCoefficients(CharacterBody sender, StatHookEventArgs args) { BuffQualityCounts buffCounts = sender.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.ToothPrimaryBuff); if (buffCounts.TotalQualityCount > 0) { switch (buffCounts.HighestQuality) { case QualityTier.Uncommon: args.attackSpeedMultAdd += 0.3f; break; case QualityTier.Rare: args.attackSpeedMultAdd += 0.5f; break; case QualityTier.Epic: args.attackSpeedMultAdd += 0.8f; break; case QualityTier.Legendary: args.attackSpeedMultAdd += 1.2f; break; default: Log.Error($"Quality tier {buffCounts.HighestQuality} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Tooth.cs", "getStatCoefficients", 44); break; } } } private static void takeDamageModifier(ref float damageValue, DamageInfo damageInfo) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) if (damageInfo == null || (damageInfo.damageType.damageSource & 2) == 0) { return; } CharacterBody val = (Object.op_Implicit((Object)(object)damageInfo?.attacker) ? damageInfo.attacker.GetComponent() : null); if (!Object.op_Implicit((Object)(object)val)) { return; } BuffQualityCounts buffCounts = val.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.ToothSecondaryBuff); if (buffCounts.TotalQualityCount > 0) { float num = 1f; switch (buffCounts.HighestQuality) { case QualityTier.Uncommon: num += 0.05f; break; case QualityTier.Rare: num += 0.1f; break; case QualityTier.Epic: num += 0.15f; break; case QualityTier.Legendary: num += 0.2f; break; default: Log.Error($"Quality tier {buffCounts.HighestQuality} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Tooth.cs", "takeDamageModifier", 77); break; } if (num > 1f) { damageValue *= num; damageInfo.damageColorIndex = (DamageColorIndex)3; } } } private static 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 //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageReport parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Tooth.cs", "GlobalEventManager_OnCharacterDeath", 96); return; } ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "Tooth"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(LegacyResourcesAPI), "Load"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(Object), "Instantiate") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\Tooth.cs", "GlobalEventManager_OnCharacterDeath", 105); return; } val.Goto(array[1].Next, (MoveType)2, false); VariableDefinition val2 = il.AddVariable(); val.Emit(OpCodes.Ldarg, parameter); val.Emit(OpCodes.Ldloca, val2); val.EmitDelegate((GetHealingOrbPrefabDelegate)getHealingOrbPrefab); val.Goto(array[2].Next, (MoveType)2, false); val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldloc, val2); val.EmitDelegate>((Action)setupHealingOrb); static GameObject getHealingOrbPrefab(GameObject healingOrbPrefab, DamageReport damageReport, out ToothOrbParameters orbParameters) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) float flatValue = 0f; float fractionalValue = 0f; BuffDef buff = null; if (damageReport?.damageInfo != null) { CharacterMaster attackerMaster = damageReport.attackerMaster; Inventory val3 = (Object.op_Implicit((Object)(object)attackerMaster) ? attackerMaster.inventory : null); if (Object.op_Implicit((Object)(object)val3)) { ItemQualityCounts itemCountsEffective = val3.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Tooth); if (itemCountsEffective.TotalQualityCount > 0) { GameObject val4 = null; DamageSource damageSource = damageReport.damageInfo.damageType.damageSource; if ((damageSource & 1) != 0) { val4 = ItemQualitiesContent.NetworkedPrefabs.HealOrbPrimary; flatValue = 1f * (float)itemCountsEffective.UncommonCount + 2f * (float)itemCountsEffective.RareCount + 3f * (float)itemCountsEffective.EpicCount + 5f * (float)itemCountsEffective.LegendaryCount; buff = BuffCatalog.GetBuffDef(ItemQualitiesContent.BuffQualityGroups.ToothPrimaryBuff.GetBuffIndex(itemCountsEffective.HighestQuality)); } else if ((damageSource & 2) != 0) { val4 = ItemQualitiesContent.NetworkedPrefabs.HealOrbSecondary; flatValue = 2f * (float)itemCountsEffective.UncommonCount + 4f * (float)itemCountsEffective.RareCount + 6f * (float)itemCountsEffective.EpicCount + 10f * (float)itemCountsEffective.LegendaryCount; buff = BuffCatalog.GetBuffDef(ItemQualitiesContent.BuffQualityGroups.ToothSecondaryBuff.GetBuffIndex(itemCountsEffective.HighestQuality)); } else if ((damageSource & 4) != 0) { val4 = ItemQualitiesContent.NetworkedPrefabs.HealOrbUtility; flatValue = 15f * (float)itemCountsEffective.UncommonCount + 25f * (float)itemCountsEffective.RareCount + 35f * (float)itemCountsEffective.EpicCount + 50f * (float)itemCountsEffective.LegendaryCount; } else if ((damageSource & 8) != 0) { val4 = ItemQualitiesContent.NetworkedPrefabs.HealOrbSpecial; flatValue = 1f * (float)itemCountsEffective.UncommonCount + 2f * (float)itemCountsEffective.RareCount + 3f * (float)itemCountsEffective.EpicCount + 5f * (float)itemCountsEffective.LegendaryCount; } if (Object.op_Implicit((Object)(object)val4)) { healingOrbPrefab = val4; } } } } orbParameters = new ToothOrbParameters(flatValue, fractionalValue, buff); return healingOrbPrefab; } static void setupHealingOrb(GameObject healingOrb, ToothOrbParameters orbParameters) { if (Object.op_Implicit((Object)(object)healingOrb) && (orbParameters.FlatValue > 0f || orbParameters.FractionalValue > 0f)) { BuffPickup componentInChildren = healingOrb.GetComponentInChildren(); if (Object.op_Implicit((Object)(object)componentInChildren)) { componentInChildren.buffDuration = orbParameters.FlatValue; componentInChildren.buffDef = orbParameters.Buff; } BarrierPickup componentInChildren2 = healingOrb.GetComponentInChildren(); if (Object.op_Implicit((Object)(object)componentInChildren2)) { componentInChildren2.FlatAmount = orbParameters.FlatValue; componentInChildren2.FractionalAmount = orbParameters.FractionalValue; } SkillCooldownPickup componentInChildren3 = healingOrb.GetComponentInChildren(); if (Object.op_Implicit((Object)(object)componentInChildren3)) { componentInChildren3.FlatAmount = orbParameters.FlatValue; componentInChildren3.FractionalAmount = orbParameters.FractionalValue; } } } } } internal static class TPHealingNova { private static SceneIndex _limboSceneIndex = (SceneIndex)(-1); [SystemInitializer(new Type[] { typeof(SceneCatalog) })] private static void Init() { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown _limboSceneIndex = SceneCatalog.FindSceneIndex("limbo"); if ((int)_limboSceneIndex == -1) { Log.Warning("Failed to find limbo scene index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\TPHealingNova.cs", "Init", 19); } GoldshoresBossfight.SpawnBoss += new hook_SpawnBoss(GoldshoresBossfight_SpawnBoss); Stage.onServerStageBegin += onServerStageBegin; } private static void GoldshoresBossfight_SpawnBoss(orig_SpawnBoss orig, GoldshoresBossfight self) { orig.Invoke(self); tryInitializeGoldshoresNovaManagers(self.scriptedCombatEncounter); } private static void onServerStageBegin(Stage stage) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && Object.op_Implicit((Object)(object)stage)) { SceneIndex sceneIndex = (SceneIndex)((!Object.op_Implicit((Object)(object)stage.sceneDef)) ? (-1) : ((int)stage.sceneDef.sceneDefIndex)); ((MonoBehaviour)stage).StartCoroutine(tryInitializeStageNovaManagers(sceneIndex)); } } private static GameObject createHealNovaManager(BossGroup bossGroup, Transform parent, Vector3 position, float radius) { //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_0016: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown GameObject val = new GameObject("HealNovaManager"); val.transform.SetParent(parent); val.transform.position = position; BossArenaHealNovaManager bossArenaHealNovaManager = val.AddComponent(); bossArenaHealNovaManager.WatchingBossGroup = bossGroup; bossArenaHealNovaManager.ArenaRadius = radius; return val; } private static IEnumerator tryInitializeStageNovaManagers(SceneIndex sceneIndex) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) yield return (object)new WaitForFixedUpdate(); tryInitializeMoonNovaManagers(); if (Object.op_Implicit((Object)(object)VoidRaidGauntletController.instance)) { ((MonoBehaviour)VoidRaidGauntletController.instance).StartCoroutine(tryInitializeVoidRaidNovaManagers()); } tryInitializeMeridianNovaManagers(); tryInitializeHauntNovaManagers(); tryInitializeHeartNovaManagers(); if ((int)sceneIndex != -1 && sceneIndex == _limboSceneIndex) { tryInitializeLimboNovaManagers(); } } private static void tryInitializeHeartNovaManagers() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("SolusWebMissionController"); if (!Object.op_Implicit((Object)(object)val)) { return; } GameObject val2 = GameObject.Find("SolusHeartSpawn"); if (Object.op_Implicit((Object)(object)val2)) { Vector3 position = val2.transform.position; BossGroup component = val.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { createHealNovaManager(component, ((Component)component).transform, position, 150f); } } } private static void tryInitializeHauntNovaManagers() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)SolutionalHauntReferences.singletonInstance)) { return; } GameObject val = GameObject.Find("HOLDER2: Geo and Spawnpoints (prev ArenaCenter)"); if (Object.op_Implicit((Object)(object)val)) { Vector3 position = val.transform.position; BossGroup solusWingBossGroup = SolutionalHauntReferences.singletonInstance.solusWingBossGroup; if (Object.op_Implicit((Object)(object)solusWingBossGroup)) { createHealNovaManager(solusWingBossGroup, ((Component)solusWingBossGroup).transform, position, 250f); } } } private static void tryInitializeMoonNovaManagers() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)SceneInfo.instance)) { return; } Transform val = ((Component)SceneInfo.instance).transform.Find("BrotherMissionController"); if (!Object.op_Implicit((Object)(object)val)) { return; } Vector3 position = val.position; ChildLocator val2 = default(ChildLocator); if (((Component)SceneInfo.instance).TryGetComponent(ref val2)) { Transform val3 = val2.FindChild("CenterOfArena"); if (Object.op_Implicit((Object)(object)val3)) { position = val3.position; } } BossGroup[] componentsInChildren = ((Component)val).GetComponentsInChildren(true); if (componentsInChildren.Length != 0) { BossGroup[] array = componentsInChildren; foreach (BossGroup obj in array) { createHealNovaManager(obj, ((Component)obj).transform, position, 260f); } } } private static IEnumerator tryInitializeVoidRaidNovaManagers() { while (Object.op_Implicit((Object)(object)VoidRaidGauntletController.instance) && !VoidRaidGauntletController.instance.hasShuffled) { yield return null; } if (!Object.op_Implicit((Object)(object)VoidRaidGauntletController.instance)) { yield break; } ScriptedCombatEncounter[] phaseEncounters = VoidRaidGauntletController.instance.phaseEncounters; List list = new List(); list.Add(VoidRaidGauntletController.instance.initialDonut); list.AddRange(VoidRaidGauntletController.instance.followingDonuts); BossGroup bossGroup = default(BossGroup); for (int i = 0; i < phaseEncounters.Length; i++) { DonutInfo val = list[i]; ScriptedCombatEncounter val2 = phaseEncounters[i]; if (!Object.op_Implicit((Object)(object)val?.root) || !Object.op_Implicit((Object)(object)val2) || !((Component)val2).TryGetComponent(ref bossGroup)) { Log.Warning($"Invalid phase encounter at index {i}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\TPHealingNova.cs", "tryInitializeVoidRaidNovaManagers", 166); continue; } Vector3 position = val.root.transform.position; switch (((Object)val.root).name) { case "RaidBB": ((Vector3)(ref position))..ctor(-4000f, 0f, -4000f); break; case "RaidGP": ((Vector3)(ref position))..ctor(0f, 0f, 4000f); break; case "RaidSG": ((Vector3)(ref position))..ctor(-4000f, 0f, 0f); break; case "RaidDC": ((Vector3)(ref position))..ctor(0f, 0f, -4000f); break; } createHealNovaManager(bossGroup, val.root.transform, position, 200f); } } private static void tryInitializeMeridianNovaManagers() { ChildLocator childLocator = default(ChildLocator); if (Object.op_Implicit((Object)(object)MeridianEventTriggerInteraction.instance) && ((Component)MeridianEventTriggerInteraction.instance).TryGetComponent(ref childLocator)) { tryCreateNovaManagerForPhase("Phase1", 175f); tryCreateNovaManagerForPhase("Phase2", 115f); tryCreateNovaManagerForPhase("Phase3", 75f); } void tryCreateNovaManagerForPhase(string phaseChildString, float arenaRadius) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) GameObject val = childLocator.FindChildGameObject(phaseChildString); ScriptedCombatEncounter val2 = default(ScriptedCombatEncounter); BossGroup bossGroup = default(BossGroup); if (!Object.op_Implicit((Object)(object)val)) { Log.Warning("Failed to find phase object '" + phaseChildString + "'", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\TPHealingNova.cs", "tryInitializeMeridianNovaManagers", 209); } else if (!val.TryGetComponent(ref val2) || !val.TryGetComponent(ref bossGroup)) { Log.Warning("Phase object " + Util.GetGameObjectHierarchyName(val) + " is missing boss encounter components", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\TPHealingNova.cs", "tryInitializeMeridianNovaManagers", 215); } else { Vector3 position = val.transform.position; SpawnInfo[] spawns = val2.spawns; foreach (SpawnInfo val3 in spawns) { if (Object.op_Implicit((Object)(object)val3.explicitSpawnPosition)) { position = val3.explicitSpawnPosition.position; break; } } createHealNovaManager(bossGroup, val.transform, position, arenaRadius); } } } private static void tryInitializeGoldshoresNovaManagers(ScriptedCombatEncounter combatEncounter) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) BossGroup bossGroup = default(BossGroup); if (Object.op_Implicit((Object)(object)combatEncounter) && ((Component)combatEncounter).TryGetComponent(ref bossGroup)) { createHealNovaManager(bossGroup, ((Component)combatEncounter).transform, new Vector3(0f, -8.5f, 0f), 200f); } } private static void tryInitializeLimboNovaManagers() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("ScavLunarEncounter"); BossGroup bossGroup = default(BossGroup); if (Object.op_Implicit((Object)(object)val) && val.TryGetComponent(ref bossGroup)) { createHealNovaManager(bossGroup, val.transform, new Vector3(23.64539f, -6.5077f, 24.37448f), 300f).transform.eulerAngles = new Vector3(0.7121587f, 0f, 4.222344f); } } } public sealed class TPHealingNovaHoldoutZoneController : MonoBehaviour { private HoldoutZoneController _holdoutZoneController; [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown HoldoutZoneController.Awake += new hook_Awake(HoldoutZoneController_Awake); } private static void HoldoutZoneController_Awake(orig_Awake orig, HoldoutZoneController self) { orig.Invoke(self); UnityObjectExtensions.EnsureComponent((Component)(object)self); } private void Awake() { _holdoutZoneController = ((Component)this).GetComponent(); } private void OnEnable() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown _holdoutZoneController.calcChargeRate += new CalcChargeRateDelegate(applyRate); } private void OnDisable() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown _holdoutZoneController.calcChargeRate -= new CalcChargeRateDelegate(applyRate); } private void applyRate(ref float rate) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0124: 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) if (!Object.op_Implicit((Object)(object)_holdoutZoneController)) { return; } float num = 0f; foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers(_holdoutZoneController.chargingTeam)) { if (Object.op_Implicit((Object)(object)teamMember.body) && teamMember.body.isPlayerControlled && !teamMember.body.isRemoteOp && Object.op_Implicit((Object)(object)teamMember.body.inventory) && HoldoutZoneController.IsBodyInChargingRadius(_holdoutZoneController, ((Component)this).transform.position, MathF.Pow(_holdoutZoneController.currentRadius, 2f), teamMember.body)) { ItemQualityCounts itemCountsEffective = teamMember.body.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.TPHealingNova); num += (float)itemCountsEffective.UncommonCount * 0.4f + (float)itemCountsEffective.RareCount * 0.8f + (float)itemCountsEffective.EpicCount * 1.2f + (float)itemCountsEffective.LegendaryCount * 1.6f; } } rate *= 1f + num / (float)HoldoutZoneController.CountLivingPlayers(_holdoutZoneController.chargingTeam); } } internal static class TreasureCache { [SystemInitializer(new Type[] { })] private static void Init() { SpecificItemCostTransformationHooks.ModifyItemCostTransformation += modifyItemCostTransformation; } private static void modifyItemCostTransformation(ref ItemTransformation itemTransformation, Interactor activator, int cost) { //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_005e: 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_0070: 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) if (((ItemTransformation)(ref itemTransformation)).originalItemIndex != Items.TreasureCache.itemIndex) { return; } CharacterBody val = (Object.op_Implicit((Object)(object)activator) ? ((Component)activator).GetComponent() : null); Inventory val2 = (Object.op_Implicit((Object)(object)val) ? val.inventory : null); if (!Object.op_Implicit((Object)(object)val2)) { return; } ItemQualityCounts itemCountsEffective = val2.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.TreasureCache); for (QualityTier qualityTier = QualityTier.Legendary; qualityTier > QualityTier.None; qualityTier--) { if (itemCountsEffective[qualityTier] >= cost) { ((ItemTransformation)(ref itemTransformation)).originalItemIndex = QualityCatalog.GetItemIndexOfQuality(((ItemTransformation)(ref itemTransformation)).originalItemIndex, qualityTier); ((ItemTransformation)(ref itemTransformation)).newItemIndex = QualityCatalog.GetItemIndexOfQuality(((ItemTransformation)(ref itemTransformation)).newItemIndex, qualityTier); break; } } } } internal static class TreasureCacheVoid { [SystemInitializer(new Type[] { })] private static void Init() { SpecificItemCostTransformationHooks.ModifyItemCostTransformation += modifyItemCostTransformation; } private static void modifyItemCostTransformation(ref ItemTransformation itemTransformation, Interactor activator, int cost) { //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_005e: 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_0070: 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) if (((ItemTransformation)(ref itemTransformation)).originalItemIndex != Items.TreasureCacheVoid.itemIndex) { return; } CharacterBody val = (Object.op_Implicit((Object)(object)activator) ? ((Component)activator).GetComponent() : null); Inventory val2 = (Object.op_Implicit((Object)(object)val) ? val.inventory : null); if (!Object.op_Implicit((Object)(object)val2)) { return; } ItemQualityCounts itemCountsEffective = val2.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.TreasureCacheVoid); for (QualityTier qualityTier = QualityTier.Legendary; qualityTier > QualityTier.None; qualityTier--) { if (itemCountsEffective[qualityTier] >= cost) { ((ItemTransformation)(ref itemTransformation)).originalItemIndex = QualityCatalog.GetItemIndexOfQuality(((ItemTransformation)(ref itemTransformation)).originalItemIndex, qualityTier); ((ItemTransformation)(ref itemTransformation)).newItemIndex = QualityCatalog.GetItemIndexOfQuality(((ItemTransformation)(ref itemTransformation)).newItemIndex, qualityTier); break; } } } } internal static class TreebotBuddy { private static readonly DeployableSlot[] _treebotBuddyDeployableSlots = (DeployableSlot[])(object)new DeployableSlot[4]; [MethodImpl(MethodImplOptions.AggressiveInlining)] public static DeployableSlot GetTreebotBuddyDeployableSlot(QualityTier qualityTier) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) DeployableSlot[] treebotBuddyDeployableSlots = _treebotBuddyDeployableSlots; DeployableSlot val = (DeployableSlot)35; return ArrayUtils.GetSafe(treebotBuddyDeployableSlots, (int)qualityTier, ref val); } private static GetDeployableSameSlotLimit getTreebotBuddyLimitGetter(QualityTier qualityTier) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown return new GetDeployableSameSlotLimit(getTreebotBuddyLimit); int getTreebotBuddyLimit(CharacterMaster master, int swarmsMultiplier) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) return master.inventory.GetItemCountEffective(ItemQualitiesContent.ItemQualityGroups.TreebotBuddy.GetItemIndex(qualityTier)); } } [SystemInitializer(new Type[] { })] private static void Init() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected I4, but got Unknown for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { _treebotBuddyDeployableSlots[(int)qualityTier] = (DeployableSlot)(int)DeployableAPI.RegisterDeployableSlot(getTreebotBuddyLimitGetter(qualityTier)); } } } public sealed class TreebotBuddyQualityItemBehavior : QualityItemBodyBehavior { private static GameObject _spawnPodPrefab; private static GameObject _treebotAiMasterPrefab; private static CharacterSpawnCard _treebotAiSpawnCard; private const float SpawnInterval = 30f; private Xoroshiro128Plus _rng; private readonly float[] _spawnTimers = new float[4]; [ItemGroupAssociation(QualityItemBehaviorUsageFlags.Server)] private static ItemQualityGroup GetItemGroup() { return ItemQualitiesContent.ItemQualityGroups.TreebotBuddy; } [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { ParallelProgressCoroutine val = new ParallelProgressCoroutine((IProgress)args.ProgressReceiver); AsyncOperationHandle handle = AddressableUtil.LoadAssetAsync(RoR2_Base_Treebot.TreebotMonsterMaster_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject treebotMonsterMasterPrefab) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown //IL_00d0: 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_00e6: 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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) _treebotAiMasterPrefab = PrefabAPI.InstantiateClone(treebotMonsterMasterPrefab, ((Object)treebotMonsterMasterPrefab).name + "_UnlockableSpawn"); Deployable val3 = UnityObjectExtensions.EnsureComponent(_treebotAiMasterPrefab); Deployable val4 = val3; if (val4.onUndeploy == null) { val4.onUndeploy = new UnityEvent(); } UnityObjectExtensions.EnsureComponent(_treebotAiMasterPrefab); args.ContentPack.masterPrefabs.Add(_treebotAiMasterPrefab); CharacterMaster val5 = default(CharacterMaster); if (!_treebotAiMasterPrefab.TryGetComponent(ref val5)) { Log.Error($"{_treebotAiMasterPrefab} is missing CharacterMaster component", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\TreebotBuddy.cs", "LoadContent", 80); } else { val3.onUndeploy.AddPersistentListener(new UnityAction(val5.TrueKill)); _treebotAiSpawnCard = ScriptableObject.CreateInstance(); ((SpawnCard)_treebotAiSpawnCard).prefab = _treebotAiMasterPrefab; ((SpawnCard)_treebotAiSpawnCard).sendOverNetwork = false; ((SpawnCard)_treebotAiSpawnCard).hullSize = (HullClassification)0; ((SpawnCard)_treebotAiSpawnCard).nodeGraphType = (GraphType)0; ((SpawnCard)_treebotAiSpawnCard).requiredFlags = (NodeFlags)0; ((SpawnCard)_treebotAiSpawnCard).forbiddenFlags = (NodeFlags)4; ((SpawnCard)_treebotAiSpawnCard).directorCreditCost = 0; ((SpawnCard)_treebotAiSpawnCard).occupyPosition = false; CharacterBody val6 = default(CharacterBody); if (Object.op_Implicit((Object)(object)val5.bodyPrefab) && val5.bodyPrefab.TryGetComponent(ref val6)) { ((SpawnCard)_treebotAiSpawnCard).hullSize = val6.hullClassification; } else { Log.Error($"{_treebotAiMasterPrefab} is missing body prefab!", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\TreebotBuddy.cs", "LoadContent", 103); } args.ContentPack.spawnCards.Add((SpawnCard)(object)_treebotAiSpawnCard); } }); val.Add(in handle); AsyncOperationHandle toolbotBodyLoad = AddressableUtil.LoadTempAssetAsync(RoR2_Base_Toolbot.ToolbotBody_prefab); val.Add(in toolbotBodyLoad); yield return val; if (AssetLoadExtensions.AssertLoaded(in toolbotBodyLoad, null, "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\TreebotBuddy.cs", "LoadContent", 116) && Object.op_Implicit((Object)(object)_treebotAiMasterPrefab)) { AkBank[] components = toolbotBodyLoad.Result.GetComponents(); foreach (AkBank val2 in components) { AkBank obj = _treebotAiMasterPrefab.AddComponent(); obj.data = val2.data; ((AkTriggerHandler)obj).triggerList = new List { -320808462 }; obj.unloadTriggerList = new List { 716467161 }; } } } [SystemInitializer(new Type[] { })] private static void Init() { //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) AsyncOperationHandle handle = Addressables.LoadAssetAsync((object)RoR2_Base_Toolbot.RoboCratePod_prefab); handle.OnSuccess(delegate(GameObject roboCratePod) { _spawnPodPrefab = roboCratePod; }); } private void OnEnable() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown _rng = new Xoroshiro128Plus(Run.instance.spawnRng.nextUlong); } private void FixedUpdate() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { ref float reference = ref _spawnTimers[(int)qualityTier]; if (!base.Body.master.IsDeployableSlotAvailable(TreebotBuddy.GetTreebotBuddyDeployableSlot(qualityTier))) { continue; } reference -= Time.fixedDeltaTime; if (reference <= 0f) { if (attemptSpawn(qualityTier)) { reference = 30f; } else { reference = 1f; } } } } private bool attemptSpawn(QualityTier spawnQualityTier) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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_009a: Expected O, but got Unknown DirectorPlacementRule val = new DirectorPlacementRule { position = base.Body.footPosition, maxDistance = 30f, minDistance = 5f, placementMode = (PlacementMode)1 }; DirectorSpawnRequest val2 = new DirectorSpawnRequest((SpawnCard)(object)_treebotAiSpawnCard, val, _rng) { summonerBodyObject = ((Component)this).gameObject, teamIndexOverride = base.Body.teamComponent.teamIndex, ignoreTeamMemberLimit = true, onSpawnedServer = onSpawnedServer }; return (Object)(object)DirectorCore.instance.TrySpawnObject(val2) != (Object)null; void onSpawnedServer(SpawnResult spawnResult) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Invalid comparison between Unknown and I4 //IL_006a: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) CharacterMaster val3 = default(CharacterMaster); if (spawnResult.success && Object.op_Implicit((Object)(object)spawnResult.spawnedInstance) && spawnResult.spawnedInstance.TryGetComponent(ref val3)) { val3.inventory.GiveItemPermanent(ItemQualitiesContent.ItemQualityGroups.QualityTier.GetItemIndex(spawnQualityTier), 1); DeployableSlot treebotBuddyDeployableSlot = TreebotBuddy.GetTreebotBuddyDeployableSlot(spawnQualityTier); if ((int)treebotBuddyDeployableSlot != 35) { Deployable component = ((Component)val3).GetComponent(); base.Body.master.AddDeployable(component, treebotBuddyDeployableSlot); } CharacterBody body = val3.GetBody(); if (Object.op_Implicit((Object)(object)body)) { EntityStateMachine[] components = ((Component)body).GetComponents(); foreach (EntityStateMachine obj in components) { obj.initialStateType = obj.mainStateType; } if (Object.op_Implicit((Object)(object)_spawnPodPrefab)) { GameObject obj2 = Object.Instantiate(_spawnPodPrefab, spawnResult.position, spawnResult.rotation); NetworkServer.Spawn(obj2); obj2.GetComponent().AssignPassenger(((Component)body).gameObject); } } } } } } internal static class TriggerEnemyDebuffs { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown CharacterBody.TriggerEnemyDebuffs += new Manipulator(CharacterBody_TriggerEnemyDebuffs); } private static void CharacterBody_TriggerEnemyDebuffs(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); MethodInfo splitDebuffInfoListAddMethod = typeof(List).GetMethod("Add"); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "GetBuffCount"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)splitDebuffInfoListAddMethod) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\TriggerEnemyDebuffs.cs", "CharacterBody_TriggerEnemyDebuffs", 31); return; } val.Goto(array[1].Next, (MoveType)0, false); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)modifySplitDebuffInfo); static SplitDebuffInformation modifySplitDebuffInfo(SplitDebuffInformation splitDebuffInfo, CharacterBody body) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) if (splitDebuffInfo.duration < 30f) { Inventory val2 = (Object.op_Implicit((Object)(object)body) ? body.inventory : null); if (Object.op_Implicit((Object)(object)val2)) { ItemQualityCounts itemCountsEffective = val2.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.TriggerEnemyDebuffs); if (itemCountsEffective.TotalQualityCount > 0) { float num = 1f; num += 0.2f * (float)itemCountsEffective.UncommonCount; num += 0.5f * (float)itemCountsEffective.RareCount; num += 0.75f * (float)itemCountsEffective.EpicCount; num += 1.5f * (float)itemCountsEffective.LegendaryCount; splitDebuffInfo.duration = Mathf.Min(30f, splitDebuffInfo.duration * num); } } } return splitDebuffInfo; } } } internal static class TrueKillOnTimer { [SystemInitializer(new Type[] { })] private static void Init() { //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 MasterSummon.onServerMasterSummonGlobal += onServerMasterSummonGlobal; DroneCombinerController.TryGetCombinableDrones += new Manipulator(DroneCombinerController_TryGetCombinableDrones); DroneScrapperController.AssignDronesFromInteractor += new Manipulator(DroneScrapperController_AssignDronesFromInteractor); } private static bool hasKillTimer(CharacterBody body) { if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.inventory)) { return body.inventory.GetItemCountEffective(ItemQualitiesContent.Items.TrueKillOnTimer) > 0; } return false; } private static void onServerMasterSummonGlobal(MasterSummonReport summonReport) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) CharacterBody val = default(CharacterBody); if (Object.op_Implicit((Object)(object)summonReport.masterSummon?.summonerBodyObject) && Object.op_Implicit((Object)(object)summonReport.summonMasterInstance) && summonReport.masterSummon.summonerBodyObject.TryGetComponent(ref val) && Object.op_Implicit((Object)(object)val.inventory)) { int itemCountEffective = val.inventory.GetItemCountEffective(ItemQualitiesContent.Items.TrueKillOnTimer); if (itemCountEffective > 0) { summonReport.summonMasterInstance.inventory.ResetItemPermanent(ItemQualitiesContent.Items.TrueKillOnTimer); summonReport.summonMasterInstance.inventory.GiveItemPermanent(ItemQualitiesContent.Items.TrueKillOnTimer, itemCountEffective); } } } private static void DroneCombinerController_TryGetCombinableDrones(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_00d2: 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) ILCursor val = new ILCursor(il); VariableDefinition droneBodyVar = null; ILLabel invalidDroneLabel = null; if (!val.TryGotoNext((MoveType)2, new Func[5] { (Instruction x) => x.MatchLdloc(il, out droneBodyVar), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "bodyFlags"), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 4194304), (Instruction x) => ILPatternMatchingExt.MatchAnd(x), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref invalidDroneLabel) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\TrueKillOnTimer.cs", "DroneCombinerController_TryGetCombinableDrones", 63); return; } val.Emit(OpCodes.Ldloc, droneBodyVar); val.EmitDelegate>((Func)hasKillTimer); val.Emit(OpCodes.Brtrue, (object)invalidDroneLabel); } private static void DroneScrapperController_AssignDronesFromInteractor(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); VariableDefinition droneBodyVar = null; ILLabel invalidDroneLabel = null; int num = default(int); if (!val.TryGotoNext((MoveType)2, new Func[6] { (Instruction x) => x.MatchLdloc(il, out droneBodyVar), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "get_inventory"), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "GummyCloneIdentifier"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "GetItemCountEffective"), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchBgt(x, ref invalidDroneLabel) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\TrueKillOnTimer.cs", "DroneScrapperController_AssignDronesFromInteractor", 95); return; } val.Emit(OpCodes.Ldloc, droneBodyVar); val.EmitDelegate>((Func)hasKillTimer); val.Emit(OpCodes.Brtrue, (object)invalidDroneLabel); } } public sealed class TrueKillOnTimerBehavior : BaseItemBodyBehavior { [ItemDefAssociation(useOnServer = true, useOnClient = false)] private static ItemDef GetItemDef() { return ItemQualitiesContent.Items.TrueKillOnTimer; } private void OnEnable() { DroneRepairMaster val = default(DroneRepairMaster); if (Object.op_Implicit((Object)(object)((BaseItemBodyBehavior)this).body.master) && ((Component)((BaseItemBodyBehavior)this).body.master).TryGetComponent(ref val)) { val.DoNotRepair = true; ((BaseItemBodyBehavior)this).body.master.destroyOnBodyDeath = true; } } private void FixedUpdate() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) float num; if (!Object.op_Implicit((Object)(object)((BaseItemBodyBehavior)this).body.master)) { FixedTimeStamp localStartTime = ((BaseItemBodyBehavior)this).body.localStartTime; num = ((FixedTimeStamp)(ref localStartTime)).timeSince; } else { num = ((BaseItemBodyBehavior)this).body.master.currentLifeStopwatch; } if (num >= (float)base.stack) { if (Object.op_Implicit((Object)(object)((BaseItemBodyBehavior)this).body.master)) { ((BaseItemBodyBehavior)this).body.master.TrueKill(); } else { ((BaseItemBodyBehavior)this).body.healthComponent.Suicide((GameObject)null, (GameObject)null, default(DamageTypeCombo)); } } } } public sealed class UtilitySkillMagazineQualityItemBehavior : QualityItemBodyBehavior { private static EffectIndex _restockEffectIndex = (EffectIndex)(-1); private FixedTimeStamp _lastUtilitySkillRechargeTime; [SystemInitializer(new Type[] { typeof(EffectCatalogUtils) })] private static void Init() { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 _restockEffectIndex = EffectCatalogUtils.FindEffectIndex("AmmoPackPickupEffect"); if ((int)_restockEffectIndex == -1) { Log.Error("Failed to find restock effect index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\UtilitySkillMagazineQualityItemBehavior.cs", "Init", 16); } } [ItemGroupAssociation(QualityItemBehaviorUsageFlags.Authority)] private static ItemQualityGroup GetItemGroup() { return ItemQualitiesContent.ItemQualityGroups.UtilitySkillMagazine; } private void OnEnable() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) GenericSkillHooks.OnSkillRechargeAuthority += onSkillRechargeAuthority; base.Body.onSkillActivatedAuthority += onSkillActivatedAuthority; _lastUtilitySkillRechargeTime = FixedTimeStamp.negativeInfinity; } private void OnDisable() { GenericSkillHooks.OnSkillRechargeAuthority -= onSkillRechargeAuthority; base.Body.onSkillActivatedAuthority -= onSkillActivatedAuthority; } private void onSkillRechargeAuthority(GenericSkill skill) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)base.Body.skillLocator) && Object.op_Implicit((Object)(object)skill) && (Object)(object)skill == (Object)(object)base.Body.skillLocator.utility) { _lastUtilitySkillRechargeTime = FixedTimeStamp.now; } } private void onSkillActivatedAuthority(GenericSkill skill) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_00aa: Expected O, but got Unknown if (!((ButtonState)(ref base.Body.inputBank.skill3)).justPressed || !Object.op_Implicit((Object)(object)base.Body.skillLocator) || !Object.op_Implicit((Object)(object)skill) || !((Object)(object)skill == (Object)(object)base.Body.skillLocator.utility)) { return; } ref readonly ItemQualityCounts stacks = ref base.Stacks; float num = 0.1f; float num2 = num + 0.2f; if (((FixedTimeStamp)(ref _lastUtilitySkillRechargeTime)).timeSince <= num) { skill.AddOneStock(); if ((int)_restockEffectIndex != -1) { EffectManager.SpawnEffect(_restockEffectIndex, new EffectData { origin = base.Body.corePosition }, true); } } else if (((FixedTimeStamp)(ref _lastUtilitySkillRechargeTime)).timeSince <= num2) { float num3 = Mathf.Pow(0.9f, (float)stacks.UncommonCount) * Mathf.Pow(0.8f, (float)stacks.RareCount) * Mathf.Pow(0.7f, (float)stacks.EpicCount) * Mathf.Pow(0.5f, (float)stacks.LegendaryCount); skill.rechargeStopwatch += skill.cooldownRemaining * (1f - num3); } } } internal static class VoidMegaCrabItem { [SystemInitializer(new Type[] { })] private static void Init() { //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 VoidMegaCrabItemBehavior.FixedUpdate += new Manipulator(VoidMegaCrabItemBehavior_FixedUpdate); VoidMegaCrabItemBehavior.OnMasterSpawned += new hook_OnMasterSpawned(VoidMegaCrabItemBehavior_OnMasterSpawned); } private static void VoidMegaCrabItemBehavior_FixedUpdate(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); if (!val.TryFindNext(ref array, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "IsDeployableLimited"), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "spawnTimer"), (Instruction x) => ILPatternMatchingExt.MatchDiv(x) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\VoidMegaCrabItem.cs", "VoidMegaCrabItemBehavior_FixedUpdate", 27); return; } val.Goto(array[2].Next, (MoveType)0, false); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getSpawnRate); static float getSpawnRate(float spawnRate, VoidMegaCrabItemBehavior itemBehavior) { CharacterBody val2 = (Object.op_Implicit((Object)(object)itemBehavior) ? ((ItemBehavior)itemBehavior).body : null); Inventory val3 = (Object.op_Implicit((Object)(object)val2) ? val2.inventory : null); if (Object.op_Implicit((Object)(object)val3)) { ItemQualityCounts itemCountsEffective = val3.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.VoidMegaCrabItem); if (itemCountsEffective.TotalQualityCount > 0) { spawnRate += 0.1f * (float)itemCountsEffective.UncommonCount + 0.3f * (float)itemCountsEffective.RareCount + 0.5f * (float)itemCountsEffective.EpicCount + 1f * (float)itemCountsEffective.LegendaryCount; } } return spawnRate; } } private static void VoidMegaCrabItemBehavior_OnMasterSpawned(orig_OnMasterSpawned orig, VoidMegaCrabItemBehavior self, SpawnResult spawnResult) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, spawnResult); CharacterMaster val = default(CharacterMaster); if (!spawnResult.success || !spawnResult.spawnedInstance.TryGetComponent(ref val)) { return; } CharacterBody val2 = (Object.op_Implicit((Object)(object)self) ? ((ItemBehavior)self).body : null); Inventory val3 = (Object.op_Implicit((Object)(object)val2) ? val2.inventory : null); if (Object.op_Implicit((Object)(object)val3)) { ItemQualityCounts itemCountsEffective = val3.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.VoidMegaCrabItem); if (itemCountsEffective.TotalQualityCount > 0) { int num = 3 * itemCountsEffective.UncommonCount + 5 * itemCountsEffective.RareCount + 7 * itemCountsEffective.EpicCount + 10 * itemCountsEffective.LegendaryCount; val.inventory.GiveItemPermanent(Items.BoostDamage, num); val.inventory.GiveItemPermanent(ItemQualitiesContent.ItemQualityGroups.QualityTier.GetItemIndex(itemCountsEffective.HighestQuality), 1); } } } } internal static class WarCryOnMultiKill { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(getStatCoefficients); } private static void getStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender.inventory) && (sender.HasBuff(Buffs.WarCryBuff) || sender.HasBuff(Buffs.TeamWarCry))) { ItemQualityCounts itemCountsEffective = sender.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.WarCryOnMultiKill); BuffQualityCounts buffCounts = sender.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.MultikillWarCryBuff); if (itemCountsEffective.TotalQualityCount > 0 && buffCounts.TotalQualityCount > 0) { float num = 0.01f * (float)itemCountsEffective.UncommonCount + 0.02f * (float)itemCountsEffective.RareCount + 0.03f * (float)itemCountsEffective.EpicCount + 0.05f * (float)itemCountsEffective.LegendaryCount; args.damageMultAdd += num * (float)buffCounts.TotalQualityCount; } } } } public sealed class WarCryOnMultiKillQualityItemBehavior : QualityItemBodyBehavior { private CharacterBodyExtraStatsTracker _bodyExtraStats; private bool _hadWarCryBuff; private bool hasWarCryBuff { get { if (!base.Body.HasBuff(Buffs.WarCryBuff)) { return base.Body.HasBuff(Buffs.TeamWarCry); } return true; } } [ItemGroupAssociation(QualityItemBehaviorUsageFlags.Server)] private static ItemQualityGroup GetItemGroup() { return ItemQualitiesContent.ItemQualityGroups.WarCryOnMultiKill; } protected override void Awake() { base.Awake(); _bodyExtraStats = ((Component)(object)this).GetComponentCached(); } private void OnEnable() { _bodyExtraStats.OnKilledOther += onKilledOther; _hadWarCryBuff = false; } private void OnDisable() { _bodyExtraStats.OnKilledOther -= onKilledOther; setWarCryBuffCount(0); } private void FixedUpdate() { bool flag = hasWarCryBuff; if (flag != _hadWarCryBuff) { setWarCryBuffCount(flag ? _bodyExtraStats.EliteKillCount : 0); _hadWarCryBuff = flag; } } private void onKilledOther(DamageReport damageReport) { if (damageReport.victimIsElite && hasWarCryBuff) { setWarCryBuffCount(_bodyExtraStats.EliteKillCount); } } protected override void OnStacksChanged() { base.OnStacksChanged(); setWarCryBuffCount(hasWarCryBuff ? _bodyExtraStats.EliteKillCount : 0); } private void setWarCryBuffCount(int count) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) int totalQualityCount = base.Body.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.MultikillWarCryBuff).TotalQualityCount; if (totalQualityCount == count) { return; } BuffIndex buffIndex = ItemQualitiesContent.BuffQualityGroups.MultikillWarCryBuff.GetBuffIndex(base.Stacks.HighestQuality); if (totalQualityCount < count) { for (int i = totalQualityCount; i < count; i++) { base.Body.AddBuff(buffIndex); } } else { for (int num = totalQualityCount; num > count; num--) { base.Body.RemoveBuff(buffIndex); } } base.Body.ConvertQualityBuffsToTier(ItemQualitiesContent.BuffQualityGroups.MultikillWarCryBuff, base.Stacks.HighestQuality); } } internal static class WardOnLevel { private static GameObject _wardTemporaryPrefab; [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle handle = AddressableUtil.LoadTempAssetAsync(RoR2_Base_WardOnLevel.WarbannerWard_prefab); handle.OnSuccess(delegate(GameObject warbannerWard) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) ((Behaviour)warbannerWard.AddComponent()).enabled = false; GameObject val = PrefabAPI.InstantiateClone(warbannerWard, "WarbannerWardTemporary"); GenericDurationComponent genericDurationComponent = val.AddComponent(); BuffWard component = val.GetComponent(); component.expires = true; component.expireDuration = 15f; genericDurationComponent.BuffWard = component; Transform val2 = val.transform.Find("mdlWarbanner"); if (Object.op_Implicit((Object)(object)val2)) { GameObject val3 = new GameObject("ModelRoot"); val3.transform.SetParent(val2, false); val3.transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); val3.transform.localScale = Vector3.one; for (int num = val2.childCount - 1; num >= 0; num--) { Transform child = val2.GetChild(num); if ((Object)(object)child != (Object)(object)val3.transform) { child.SetParent(val3.transform, true); } } BeginRapidlyActivatingAndDeactivating val4 = val.AddComponent(); val4.delayBeforeBeginningBlinking = 9f; val4.blinkFrequency = 10f; val4.blinkingRootObject = val3; genericDurationComponent.BlinkController = val4; genericDurationComponent.BlinkDuration = 5f; } else { Log.Error("Failed to find warbanner model root on " + Util.GetGameObjectHierarchyName(val), "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\WardOnLevel.cs", "LoadContent", 66); } args.ContentPack.networkedObjectPrefabs.Add(val); _wardTemporaryPrefab = val; }); return handle.AsProgressCoroutine>(args.ProgressReceiver); } [SystemInitializer(new Type[] { })] private static void Init() { //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 GlobalEventManager.OnInteractionsGlobal += onInteractionsGlobal; WardOnLevelManager.OnCharacterLevelUp += new Manipulator(WardOnLevelManager_OnCharacterLevelUp); ChargingState.OnEnter += new Manipulator(ChargingState_OnEnter); RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(getStatCoefficients); } private static void getStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender)) { BuffQualityCounts buffCounts = sender.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.Warbanner); args.attackSpeedMultAdd += (float)buffCounts.UncommonCount * 0.02f + (float)buffCounts.RareCount * 0.03f + (float)buffCounts.EpicCount * 0.04f + (float)buffCounts.LegendaryCount * 0.05f; } } private static void WardOnLevelManager_OnCharacterLevelUp(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0039: 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) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(Object), "Instantiate") })) { val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Action)addGrowingBuff); } else { Log.Error(((MemberReference)il.Method).Name + " IL Hook failed!", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\WardOnLevel.cs", "WardOnLevelManager_OnCharacterLevelUp", 110); } } private static void ChargingState_OnEnter(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int body = 0; if (val.TryGotoNext(new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(TeamComponent), "get_body"), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref body) }) && val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(Object), "Instantiate") })) { val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldloc, body); val.EmitDelegate>((Action)addGrowingBuff); } else { Log.Error(((MemberReference)il.Method).Name + " IL Hook failed!", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Items\\WardOnLevel.cs", "ChargingState_OnEnter", 134); } } private static void addGrowingBuff(GameObject banner, CharacterBody body) { ItemQualityCounts itemCountsEffective = body.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.WardOnLevel); if (itemCountsEffective.TotalQualityCount > 0) { banner.GetComponent().buffDef = null; WardOnLevelGrowingBuff component = banner.GetComponent(); ((Behaviour)component).enabled = true; component.buff = ItemQualitiesContent.BuffQualityGroups.Warbanner.GetBuffDef(itemCountsEffective.HighestQuality); component.maxStacks = itemCountsEffective.UncommonCount * 30 + itemCountsEffective.RareCount * 40 + itemCountsEffective.EpicCount * 50 + itemCountsEffective.LegendaryCount * 60; } } private static void onInteractionsGlobal(Interactor interactor, IInteractable interactable, GameObject interactableObject) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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) if (!NetworkServer.active || !SharedItemUtils.InteractableIsPermittedForSpawn(interactable)) { return; } CharacterBody val = (Object.op_Implicit((Object)(object)interactor) ? ((Component)interactor).GetComponent() : null); TeamIndex teamIndex = (TeamIndex)((!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.teamComponent)) ? (-1) : ((int)val.teamComponent.teamIndex)); Inventory val2 = (Object.op_Implicit((Object)(object)val) ? val.inventory : null); if (!Object.op_Implicit((Object)(object)val2)) { return; } ItemQualityCounts itemCountsEffective = val2.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.WardOnLevel); if (itemCountsEffective.TotalQualityCount > 0) { float num = 10f * (float)itemCountsEffective.UncommonCount + 20f * (float)itemCountsEffective.RareCount + 30f * (float)itemCountsEffective.EpicCount + 40f * (float)itemCountsEffective.LegendaryCount; if (num > 0f) { Vector3 val3 = (Object.op_Implicit((Object)(object)val) ? val.footPosition : interactableObject.transform.position); GameObject obj = Object.Instantiate(_wardTemporaryPrefab, val3, Quaternion.identity); obj.GetComponent().teamIndex = teamIndex; obj.GetComponent().Networkradius = 8f + 8f * (float)itemCountsEffective.TotalCount; obj.GetComponent().NetworkDuration = num; addGrowingBuff(obj, val); NetworkServer.Spawn(obj); } } } } public class WardOnLevelGrowingBuff : NetworkBehaviour { private float _buffTimer; private TeamFilter _teamFilter; private BuffWard _buffWard; public int maxStacks; public BuffDef buff; private void Awake() { _teamFilter = ((Component)this).GetComponent(); _buffWard = ((Component)this).GetComponent(); } private void FixedUpdate() { //IL_003a: 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) if (NetworkServer.active) { _buffTimer -= Time.fixedDeltaTime; if (!(_buffTimer > 0f)) { _buffTimer = 1f; BuffTeam(TeamComponent.GetTeamMembers(_teamFilter.teamIndex), _buffWard.radius * _buffWard.radius, ((Component)this).transform.position); } } } private void BuffTeam(IEnumerable recipients, float radiusSqr, Vector3 currentPosition) { //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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } foreach (TeamComponent recipient in recipients) { Vector3 val = ((Component)recipient).transform.position - currentPosition; if (!(((Vector3)(ref val)).sqrMagnitude > radiusSqr)) { CharacterBody body = recipient.body; if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.alive) { body.AddTimedBuff(buff, 1.5f, maxStacks); body.SetTimedBuffDurationIfPresent(buff, 1.5f, true); } } } } private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { bool result = default(bool); return result; } public override void OnDeserialize(NetworkReader reader, bool initialState) { } public override void PreStartClient() { } } } namespace ItemQualities.Equipments { internal static class BFG { private sealed class EquipmentSlotBFGQualityInfo { public QualityTier QualityTier = QualityTier.None; } private static readonly GameObject[] _qualityProjectilePrefabs = (GameObject[])(object)new GameObject[4]; private static readonly FixedConditionalWeakTable _equipmentSlotQualityInfoLookup = new FixedConditionalWeakTable(); [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle handle = AddressableUtil.LoadTempAssetAsync(RoR2_Base_BFG.BeamSphere_prefab); handle.OnSuccess(delegate(GameObject projectilePrefab) { //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) ProjectileController val = default(ProjectileController); ProjectileImpactExplosion val2 = default(ProjectileImpactExplosion); if (!projectilePrefab.TryGetComponent(ref val)) { Log.Warning($"Expected ProjectileController component on {projectilePrefab}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\BFG.cs", "LoadContent", 32); } else if (!projectilePrefab.TryGetComponent(ref val2)) { Log.Warning($"Expected ProjectileImpactExplosion component on {projectilePrefab}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\BFG.cs", "LoadContent", 38); } else { float blastRadius = ((ProjectileExplosion)val2).blastRadius; GameObject val3 = EffectScalingFixer.CreateFixedScalingCopy(val.ghostPrefab, 1f); ((Object)val3).name = "Quality" + ((Object)val3).name; ProjectileGhostController val4 = default(ProjectileGhostController); if (val3.TryGetComponent(ref val4)) { val4.inheritScaleFromProjectile = true; } else { Log.Warning($"Expected ProjectileGhostController component on {val3}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\BFG.cs", "LoadContent", 52); } GameObject val5 = EffectScalingFixer.CreateFixedScalingCopy(val2.impactEffect, blastRadius); ((Object)val5).name = "Quality" + ((Object)val5).name; args.ContentPack.effectDefs.Add(new EffectDef(val5)); ProjectileProximityBeamController val7 = default(ProjectileProximityBeamController); for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { float num = qualityTier switch { QualityTier.Uncommon => 5f, QualityTier.Rare => 10f, QualityTier.Epic => 20f, QualityTier.Legendary => 25f, _ => throw new NotImplementedException($"Quality tier {qualityTier} is not implemented"), }; float num2 = (blastRadius + num) / blastRadius; GameObject val6 = PrefabAPI.InstantiateClone(projectilePrefab, ((Object)projectilePrefab).name + qualityTier); Transform transform = val6.transform; transform.localScale *= num2; val6.GetComponent().ghostPrefab = val3; ProjectileImpactExplosion component = val6.GetComponent(); ((ProjectileExplosion)component).blastRadius = ((ProjectileExplosion)component).blastRadius + num; component.impactEffect = val5; if (val6.TryGetComponent(ref val7)) { ProjectileProximityBeamController obj = val7; obj.attackRange += num; } else { Log.Warning($"Expected ProjectileProximityBeamController component on {val6}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\BFG.cs", "LoadContent", 90); } val6.GetComponent().updateAfterFiring = true; ProjectileSteerTowardTarget val8 = val6.AddComponent(); val8.rotationSpeed = qualityTier switch { QualityTier.Uncommon => 10f, QualityTier.Rare => 15f, QualityTier.Epic => 25f, QualityTier.Legendary => 30f, _ => throw new NotImplementedException($"Quality tier {qualityTier} is not implemented"), }; ProjectileDirectionalTargetFinder obj2 = val6.AddComponent(); obj2.lookRange = 600f; obj2.lookCone = 180f; obj2.targetSearchInterval = 1f; obj2.onlySearchIfNoTarget = true; obj2.allowTargetLoss = false; obj2.testLoS = true; _qualityProjectilePrefabs[(int)qualityTier] = val6; } args.ContentPack.projectilePrefabs.Add(_qualityProjectilePrefabs); } }); return handle.AsProgressCoroutine>(args.ProgressReceiver); } [SystemInitializer(new Type[] { })] private static void Init() { //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 EquipmentSlot.FireBfg += new hook_FireBfg(EquipmentSlot_FireBfg); EquipmentSlot.MyFixedUpdate += new Manipulator(EquipmentSlot_MyFixedUpdate); } private static bool EquipmentSlot_FireBfg(orig_FireBfg orig, EquipmentSlot self) { bool num = orig.Invoke(self); QualityTier qualityTier = QualityTier.None; if (num) { qualityTier = self.GetCurrentEquipmentActionQualityTier(); } if (qualityTier > QualityTier.None) { _equipmentSlotQualityInfoLookup.GetOrCreateValue(self).QualityTier = qualityTier; return num; } _equipmentSlotQualityInfoLookup.Remove(self); return num; } private static void EquipmentSlot_MyFixedUpdate(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0075: 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) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Prefabs/Projectiles/BeamSphere"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(LegacyResourcesAPI), "Load") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\BFG.cs", "EquipmentSlot_MyFixedUpdate", 168); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getProjectilePrefab); Instruction next = val.Next; if (val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "FireProjectileWithoutDamageType") }) && val.TryGotoPrev((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdnull(x) }) && val.IsAfter(next)) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getTarget); } else { Log.Error("Failed to find target patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\BFG.cs", "EquipmentSlot_MyFixedUpdate", 217); } static GameObject getProjectilePrefab(GameObject prefab, EquipmentSlot equipmentSlot) { if (System.Collections.Generic.CollectionExtensions.Remove((IDictionary)_equipmentSlotQualityInfoLookup, equipmentSlot, out var value)) { QualityTier qualityTier = value.QualityTier; if (qualityTier > QualityTier.None) { GameObject safe = ArrayUtils.GetSafe(_qualityProjectilePrefabs, (int)qualityTier); if (Object.op_Implicit((Object)(object)safe)) { prefab = safe; } } } return prefab; } static GameObject getTarget(GameObject target, EquipmentSlot equipmentSlot) { if (Object.op_Implicit((Object)(object)equipmentSlot) && ((Component)(object)equipmentSlot).TryGetComponentCached(out CharacterBodyExtraStatsTracker component) && Object.op_Implicit((Object)(object)component.LastHitBody)) { target = ((Component)component.LastHitBody).gameObject; } return target; } } } internal static class Blackhole { private static readonly GameObject[] _qualityProjectilePrefabs = (GameObject[])(object)new GameObject[4]; [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle handle = AddressableUtil.LoadTempAssetAsync(RoR2_Base_Blackhole.GravSphere_prefab); handle.OnSuccess(delegate(GameObject gravSphereProjectilePrefab) { //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Invalid comparison between Unknown and I4 ProjectileSimple val = default(ProjectileSimple); RadialForce val2 = default(RadialForce); if (!gravSphereProjectilePrefab.TryGetComponent(ref val)) { Log.Warning($"Expected component ProjectileSimple on {gravSphereProjectilePrefab}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Blackhole.cs", "LoadContent", 30); } else if (!gravSphereProjectilePrefab.TryGetComponent(ref val2)) { Log.Warning($"Expected component RadialForce on {gravSphereProjectilePrefab}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Blackhole.cs", "LoadContent", 36); } else { float radius = val2.radius; ObjectScaleCurve val5 = default(ObjectScaleCurve); LightIntensityCurve val7 = default(LightIntensityCurve); for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { float num; float num2; float num3; switch (qualityTier) { case QualityTier.Uncommon: num = 10f; num2 = 4f; num3 = 3f; break; case QualityTier.Rare: num = 25f; num2 = 8f; num3 = 5f; break; case QualityTier.Epic: num = 40f; num2 = 15f; num3 = 8f; break; case QualityTier.Legendary: num = 60f; num2 = 25f; num3 = 10f; break; default: throw new NotImplementedException($"Quality tier {qualityTier} is not implemented"); } GameObject val3 = PrefabAPI.InstantiateClone(gravSphereProjectilePrefab, ((Object)gravSphereProjectilePrefab).name + qualityTier); ProjectileSimple component = val3.GetComponent(); component.lifetime += num2; RadialForce component2 = val3.GetComponent(); component2.radius += num; component2.forceMagnitude *= num3; Transform val4 = val3.transform.Find("Sphere"); if (Object.op_Implicit((Object)(object)val4) && ((Component)val4).TryGetComponent(ref val5)) { ObjectScaleCurve obj = val5; obj.timeMax += num2; } Transform val6 = val3.transform.Find("Point light"); if (Object.op_Implicit((Object)(object)val6) && ((Component)val6).TryGetComponent(ref val7)) { LightIntensityCurve obj2 = val7; obj2.timeMax += num2; } float num4 = (radius + num) / radius; for (int num5 = val3.transform.childCount - 1; num5 >= 0; num5--) { Transform child = val3.transform.GetChild(num5); if (Object.op_Implicit((Object)(object)child)) { child.localScale *= num4; } } ParticleSystem[] componentsInChildren = val3.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { MainModule main = componentsInChildren[i].main; if ((int)((MainModule)(ref main)).scalingMode == 1) { ((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)0; } } _qualityProjectilePrefabs[(int)qualityTier] = val3; } args.ContentPack.projectilePrefabs.Add(_qualityProjectilePrefabs); } }); return handle.AsProgressCoroutine>(args.ProgressReceiver); } [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown EquipmentSlot.FireBlackhole += new Manipulator(EquipmentSlot_FireBlackhole); } private static void EquipmentSlot_FireBlackhole(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Prefabs/Projectiles/GravSphere"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(LegacyResourcesAPI), "Load") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Blackhole.cs", "EquipmentSlot_FireBlackhole", 136); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getProjectilePrefab); static GameObject getProjectilePrefab(GameObject prefab, EquipmentSlot equipmentSlot) { QualityTier currentEquipmentActionQualityTier = equipmentSlot.GetCurrentEquipmentActionQualityTier(); if (currentEquipmentActionQualityTier > QualityTier.None) { GameObject safe = ArrayUtils.GetSafe(_qualityProjectilePrefabs, (int)currentEquipmentActionQualityTier); if (Object.op_Implicit((Object)(object)safe)) { prefab = safe; } } return prefab; } } } internal static class BossHunter { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown EquipmentSlot.FireBossHunter += new Manipulator(EquipmentSlot_FireBossHunter); } private static void EquipmentSlot_FireBossHunter(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_003f: 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) EquipmentHooks.GenericPatchAllGetEquipmentQuality(il); ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "GeneratePickup") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)tryGetQualityPickup); } else { Log.Error("Failed to find drop patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\BossHunter.cs", "EquipmentSlot_FireBossHunter", 67); } val.Goto(0, (MoveType)0, false); int num = 0; while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Equipment), "BossHunterConsumed") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)tryGetQualityEquipment); num++; } if (num == 0) { Log.Error("Failed to find static equipment reference patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\BossHunter.cs", "EquipmentSlot_FireBossHunter", 103); } static EquipmentDef tryGetQualityEquipment(EquipmentDef equipmentDef, EquipmentSlot equipmentSlot) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between Unknown and I4 //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_003f: Unknown result type (might be due to invalid IL or missing references) QualityTier currentEquipmentActionQualityTier = equipmentSlot.GetCurrentEquipmentActionQualityTier(); EquipmentIndex val2 = (EquipmentIndex)((!Object.op_Implicit((Object)(object)equipmentDef)) ? (-1) : ((int)equipmentDef.equipmentIndex)); if ((int)val2 != -1 && currentEquipmentActionQualityTier > QualityCatalog.GetQualityTier(val2)) { EquipmentIndex equipmentIndexOfQuality = QualityCatalog.GetEquipmentIndexOfQuality(val2, currentEquipmentActionQualityTier); if ((int)equipmentIndexOfQuality != -1 && equipmentIndexOfQuality != val2) { equipmentDef = EquipmentCatalog.GetEquipmentDef(equipmentIndexOfQuality); val2 = equipmentIndexOfQuality; } } return equipmentDef; } static UniquePickup tryGetQualityPickup(UniquePickup pickup, EquipmentSlot equipmentSlot) { //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) QualityTier currentEquipmentActionQualityTier2 = equipmentSlot.GetCurrentEquipmentActionQualityTier(); if (currentEquipmentActionQualityTier2 > QualityTier.None && currentEquipmentActionQualityTier2 > QualityCatalog.GetQualityTier(pickup.pickupIndex)) { PickupIndex pickupIndexOfQuality = QualityCatalog.GetPickupIndexOfQuality(pickup.pickupIndex, currentEquipmentActionQualityTier2); if (((PickupIndex)(ref pickupIndexOfQuality)).isValid && pickupIndexOfQuality != pickup.pickupIndex) { return ((UniquePickup)(ref pickup)).WithPickupIndex(pickupIndexOfQuality); } Vector3 val3 = (Object.op_Implicit((Object)(object)equipmentSlot.currentTarget.hurtBox) ? ((Component)equipmentSlot.currentTarget.hurtBox).transform.position : Vector3.zero); Vector3 val4 = val3 - equipmentSlot.characterBody.corePosition; Vector3 normalized = ((Vector3)(ref val4)).normalized; int num2 = (int)(currentEquipmentActionQualityTier2 + 1); for (int i = 0; i < num2; i++) { Vector3 val5 = Quaternion.Euler(Random.Range(-10f, 10f), Random.Range(-10f, 10f), 0f) * normalized; CreatePickupInfo val6 = default(CreatePickupInfo); ((CreatePickupInfo)(ref val6)).pickup = pickup; val6.position = val3; PickupDropletController.CreatePickupDroplet(val6, val3, val5 * 15f); } } return pickup; } } } internal static class BossHunterConsumed { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown EquipmentSlot.FireBossHunterConsumed += new Manipulator(EquipmentSlot_FireBossHunterConsumed); } private static void EquipmentSlot_FireBossHunterConsumed(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "token") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\BossHunterConsumed.cs", "EquipmentSlot_FireBossHunterConsumed", 24); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getChatMessageToken); static string getChatMessageToken(string token, EquipmentSlot self) { QualityTier currentEquipmentActionQualityTier = self.GetCurrentEquipmentActionQualityTier(); if (currentEquipmentActionQualityTier != QualityTier.None) { token = "EQUIPMENT_BOSSHUNTERCONSUMED_" + currentEquipmentActionQualityTier.ToString().ToUpper() + "_CHAT"; } return token; } } } internal static class Cleanse { [SystemInitializer(new Type[] { typeof(BuffCatalog) })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0016: Unknown result type (might be due to invalid IL or missing references) EquipmentSlot.FireCleanse += new hook_FireCleanse(EquipmentSlot_FireCleanse); BuffDef buffDef = BuffCatalog.GetBuffDef(BuffCatalog.FindBuffIndex("bdVoidFogStackCooldown")); if (Object.op_Implicit((Object)(object)buffDef)) { buffDef.isCooldown = false; } else { Log.Warning("Failed to find bdVoidFogStackCooldown", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Cleanse.cs", "Init", 23); } } private static bool EquipmentSlot_FireCleanse(orig_FireCleanse orig, EquipmentSlot self) { bool result = orig.Invoke(self); try { if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.characterBody)) { QualityTier currentEquipmentActionQualityTier = self.GetCurrentEquipmentActionQualityTier(); float num = 0f; switch (currentEquipmentActionQualityTier) { case QualityTier.None: num = 0f; break; case QualityTier.Uncommon: num = 2f; break; case QualityTier.Rare: num = 3f; break; case QualityTier.Epic: num = 5f; break; case QualityTier.Legendary: num = 6f; break; default: num = 0f; Log.Error($"Quality tier {currentEquipmentActionQualityTier} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Cleanse.cs", "EquipmentSlot_FireCleanse", 56); break; } if (num > 0f) { RepeatCleanseAttachment repeatCleanseAttachment = RepeatCleanseAttachment.FindCleanseAttachmentForBody(self.characterBody); if (!Object.op_Implicit((Object)(object)repeatCleanseAttachment)) { GameObject obj = Object.Instantiate(ItemQualitiesContent.NetworkedPrefabs.CleanseQualityAttachment); obj.GetComponent().AttachToGameObjectAndSpawn(((Component)self.characterBody).gameObject, (string)null); repeatCleanseAttachment = obj.GetComponent(); repeatCleanseAttachment.CleansesRemaining = 0; } repeatCleanseAttachment.CleansesRemaining += Mathf.CeilToInt(num / repeatCleanseAttachment.CleanseInterval); result = true; } } } catch (Exception ex) { Log.Error_NoCallerPrefix(ex.ToString()); } return result; } } internal static class CommandMissile { private static EquipmentIndex[] _missileEquipments = Array.Empty(); [SystemInitializer(new Type[] { typeof(EquipmentCatalog) })] private static void Init() { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown HashSet missileEquipments = new HashSet(EquipmentCatalog.equipmentCount); QualityTier qualityTier; for (qualityTier = QualityTier.None; qualityTier < QualityTier.Count; qualityTier++) { tryAddEquipment(ItemQualitiesContent.EquipmentQualityGroups.CommandMissile); if (qualityTier != QualityTier.None) { tryAddEquipment(ItemQualitiesContent.EquipmentQualityGroups.Jetpack); } } if (missileEquipments.Count > 0) { _missileEquipments = missileEquipments.ToArray(); Array.Sort(_missileEquipments); } EquipmentSlot.FireCommandMissile += new Manipulator(EquipmentSlot_FireCommandMissile); void tryAddEquipment(EquipmentQualityGroup equipmentGroup) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)equipmentGroup)) { EquipmentIndex equipmentIndex = equipmentGroup.GetEquipmentIndex(qualityTier); if ((int)equipmentIndex != -1) { missileEquipments.Add(equipmentIndex); } } } } private static void EquipmentSlot_FireCommandMissile(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)0, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchAdd(x), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "remainingMissiles") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\CommandMissile.cs", "EquipmentSlot_FireCommandMissile", 58); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getMissileProjectileCount); static int getMissileProjectileCount(int missileCount, EquipmentSlot equipmentSlot) { QualityTier qualityTier = (Object.op_Implicit((Object)(object)equipmentSlot) ? equipmentSlot.GetCurrentEquipmentActionQualityTier() : QualityTier.None); if (qualityTier > QualityTier.None) { CharacterBody characterBody = equipmentSlot.characterBody; if (Object.op_Implicit((Object)(object)characterBody) && Object.op_Implicit((Object)(object)characterBody.master)) { int missileCount2 = getMissileCount(characterBody.master); int num; switch (qualityTier) { case QualityTier.Uncommon: num = 2; break; case QualityTier.Rare: num = 5; break; case QualityTier.Epic: num = 8; break; case QualityTier.Legendary: num = 12; break; default: num = 0; Log.Error($"Quality tier {qualityTier} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\CommandMissile.cs", "EquipmentSlot_FireCommandMissile", 94); break; } missileCount += missileCount2 * num; } } return missileCount; } } private static int getMissileCount(CharacterMaster master) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) int num = 0; if (!master.inventory.inventoryDisabled) { Enumerator enumerator = ItemCatalog.GetItemsWithTag(ItemTags.MissileRelated).GetEnumerator(); try { while (enumerator.MoveNext()) { ItemIndex current = enumerator.Current; num += master.inventory.GetItemCountEffective(current); } } finally { ((IDisposable)enumerator).Dispose(); } } if (!master.inventory.GetEquipmentDisabled()) { int equipmentSlotCount = master.inventory.GetEquipmentSlotCount(); for (uint num2 = 0u; num2 < equipmentSlotCount; num2++) { int equipmentSetCount = master.inventory.GetEquipmentSetCount(num2); for (uint num3 = 0u; num3 < equipmentSetCount; num3++) { EquipmentState equipment = master.inventory.GetEquipment(num2, num3); if ((int)equipment.equipmentIndex != -1 && Array.BinarySearch(_missileEquipments, equipment.equipmentIndex) >= 0) { num++; } } } } if (Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)master.minionOwnership.ownerMaster)) { num += getMissileCount(master.minionOwnership.ownerMaster); } return num; } } internal static class CritOnUse { public const float WeakPointRadius = 1.2f; public const float WeakPointRadiusSqr = 1.44f; public static float GetCritMultiplierBonus(QualityTier qualityTier) { switch (qualityTier) { case QualityTier.None: return 0f; case QualityTier.Uncommon: return 0.5f; case QualityTier.Rare: return 1f; case QualityTier.Epic: return 1.5f; case QualityTier.Legendary: return 2.5f; default: Log.Warning($"Quality tier {qualityTier} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\CritOnUse.cs", "GetCritMultiplierBonus", 33); return 0f; } } private static bool isWeakPointHit(DamageInfo damageInfo) { if (Object.op_Implicit((Object)(object)damageInfo.inflictedHurtbox) && ((Behaviour)damageInfo.inflictedHurtbox).enabled && damageInfo.inflictedHurtbox.indexInGroup != -1 && Object.op_Implicit((Object)(object)damageInfo.inflictedHurtbox.healthComponent) && ((Component)(object)damageInfo.inflictedHurtbox.healthComponent).TryGetComponentCached(out CharacterBodyExtraStatsTracker component)) { return damageInfo.inflictedHurtbox.indexInGroup == component.WeakPointHurtBoxIndex; } return false; } [SystemInitializer(new Type[] { })] private static void Init() { //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 EquipmentSlot.FireCritOnUse += new Manipulator(EquipmentSlot_FireCritOnUse); HealthComponent.TakeDamageProcess += new Manipulator(IL_HealthComponent_TakeDamageProcess); BuffHooks.OnBuffFirstStackGainedGlobal += onBuffFirstStackGainedGlobal; BuffHooks.OnBuffFinalStackLostGlobal += onBuffFinalStackLostGlobal; } private static void onBuffFirstStackGainedGlobal(CharacterBody body, BuffDef buffDef) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } BuffIndex val = (BuffIndex)((!Object.op_Implicit((Object)(object)buffDef)) ? (-1) : ((int)buffDef.buffIndex)); QualityTier qualityTier = QualityCatalog.GetQualityTier(val); if (QualityCatalog.FindBuffQualityGroupIndex(val) != ItemQualitiesContent.BuffQualityGroups.FullCrit.GroupIndex) { return; } for (QualityTier qualityTier2 = QualityTier.None; qualityTier2 < QualityTier.Count; qualityTier2++) { BuffIndex buffIndexOfQuality = QualityCatalog.GetBuffIndexOfQuality(val, qualityTier2); if (buffIndexOfQuality != val && body.HasBuffRaw(buffIndexOfQuality)) { if (qualityTier2 > qualityTier) { body.ClearTimedBuffsRaw(val); return; } body.ClearTimedBuffsRaw(buffIndexOfQuality); } } if (qualityTier > QualityTier.None) { QualityCritOnUseAttachment.EnsureAttachment(body); } } private static void onBuffFinalStackLostGlobal(CharacterBody body, BuffDef buffDef) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0047: 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) { return; } BuffIndex val = (BuffIndex)((!Object.op_Implicit((Object)(object)buffDef)) ? (-1) : ((int)buffDef.buffIndex)); QualityTier qualityTier = QualityCatalog.GetQualityTier(val); if (QualityCatalog.FindBuffQualityGroupIndex(val) != ItemQualitiesContent.BuffQualityGroups.FullCrit.GroupIndex || qualityTier == QualityTier.None) { return; } for (QualityTier qualityTier2 = QualityTier.Uncommon; qualityTier2 < QualityTier.Count; qualityTier2++) { BuffIndex buffIndexOfQuality = QualityCatalog.GetBuffIndexOfQuality(val, qualityTier2); if (buffIndexOfQuality != val && body.HasBuffRaw(buffIndexOfQuality)) { return; } } QualityCritOnUseAttachment qualityCritOnUseAttachment = QualityCritOnUseAttachment.FindAttachment(body); if (Object.op_Implicit((Object)(object)qualityCritOnUseAttachment)) { Object.Destroy((Object)(object)((Component)qualityCritOnUseAttachment).gameObject); } } private static void EquipmentSlot_FireCritOnUse(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "FullCrit") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getBuff); } else { Log.Error("Failed to find buff patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\CritOnUse.cs", "EquipmentSlot_FireCritOnUse", 150); } if (val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(CharacterBody), "AddTimedBuff") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getDuration); } else { Log.Error("Failed to find duration patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\CritOnUse.cs", "EquipmentSlot_FireCritOnUse", 183); } static BuffDef getBuff(BuffDef buffDef, EquipmentSlot equipmentSlot) { //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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 //IL_0029: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) BuffIndex val2 = (BuffIndex)((!Object.op_Implicit((Object)(object)buffDef)) ? (-1) : ((int)buffDef.buffIndex)); QualityTier currentEquipmentActionQualityTier = equipmentSlot.GetCurrentEquipmentActionQualityTier(); if (currentEquipmentActionQualityTier > QualityTier.None) { BuffIndex buffIndexOfQuality = QualityCatalog.GetBuffIndexOfQuality(val2, currentEquipmentActionQualityTier); if ((int)buffIndexOfQuality != -1 && buffIndexOfQuality != val2) { buffDef = BuffCatalog.GetBuffDef(buffIndexOfQuality); val2 = buffIndexOfQuality; } } return buffDef; } static float getDuration(float duration, EquipmentSlot equipmentSlot) { switch (equipmentSlot.GetCurrentEquipmentActionQualityTier()) { case QualityTier.Uncommon: duration += 2f; break; case QualityTier.Rare: duration += 4f; break; case QualityTier.Epic: duration += 6f; break; case QualityTier.Legendary: duration += 8f; break; } return duration; } } private static void IL_HealthComponent_TakeDamageProcess(ILContext il) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0031: 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) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DamageInfo parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\CritOnUse.cs", "IL_HealthComponent_TakeDamageProcess", 191); return; } ILCursor val = new ILCursor(il); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Action)handleWeakPointHit); int num = 0; while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "get_critMultiplier") })) { val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Func)getCritMultiplier); num++; } if (num == 0) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\CritOnUse.cs", "IL_HealthComponent_TakeDamageProcess", 238); } static float getCritMultiplier(float critMultiplier, DamageInfo damageInfo) { if (isWeakPointHit(damageInfo) && Object.op_Implicit((Object)(object)damageInfo.inflictedHurtbox) && Object.op_Implicit((Object)(object)damageInfo.inflictedHurtbox.healthComponent) && ((Component)(object)damageInfo.inflictedHurtbox.healthComponent).TryGetComponentCached(out CharacterBodyExtraStatsTracker component) && component.WeakPointCritMultiplierBonusServer > 0f) { critMultiplier += component.WeakPointCritMultiplierBonusServer; } return critMultiplier; } static void handleWeakPointHit(DamageInfo damageInfo) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (isWeakPointHit(damageInfo)) { damageInfo.crit = true; damageInfo.damageColorIndex = (DamageColorIndex)5; } } } } internal static class DeathProjectile { private static readonly GameObject[] _qualityDeathProjectilePrefabs = (GameObject[])(object)new GameObject[4]; private static BuffIndex[] _validEliteBuffIndices = Array.Empty(); [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle handle = AddressableUtil.LoadTempAssetAsync(RoR2_Base_DeathProjectile.DeathProjectile_prefab); handle.OnSuccess(delegate(GameObject deathProjectilePrefab) { for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { float num = qualityTier switch { QualityTier.Uncommon => 1f, QualityTier.Rare => 3f, QualityTier.Epic => 5f, QualityTier.Legendary => 8f, _ => throw new NotImplementedException($"Quality tier {qualityTier} is not implemented"), }; GameObject val = PrefabAPI.InstantiateClone(deathProjectilePrefab, ((Object)deathProjectilePrefab).name + qualityTier); DeathProjectile component = val.GetComponent(); component.baseDuration += num; val.AddComponent().QualityTier = qualityTier; Object.Destroy((Object)(object)val.GetComponent()); _qualityDeathProjectilePrefabs[(int)qualityTier] = val; } args.ContentPack.networkedObjectPrefabs.Add(_qualityDeathProjectilePrefabs); args.ContentPack.bodyPrefabs.Add(_qualityDeathProjectilePrefabs); args.ContentPack.projectilePrefabs.Add(_qualityDeathProjectilePrefabs); }); return handle.AsProgressCoroutine>(args.ProgressReceiver); } [SystemInitializer(new Type[] { typeof(BuffCatalog) })] private static void Init() { //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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_007a: Unknown result type (might be due to invalid IL or missing references) EquipmentSlot.FireDeathProjectile += new Manipulator(EquipmentSlot_FireDeathProjectile); DeathProjectile.FixedUpdate += new Manipulator(DeathProjectile_FixedUpdate); HashSet hashSet = default(HashSet); DisposableRental> val = CollectionPool>.RentCollection(ref hashSet); try { BuffIndex[] eliteBuffIndices = BuffCatalog.eliteBuffIndices; foreach (BuffIndex val2 in eliteBuffIndices) { BuffDef buffDef = BuffCatalog.GetBuffDef(val2); if (Object.op_Implicit((Object)(object)buffDef) && Object.op_Implicit((Object)(object)buffDef.eliteDef)) { string modifierToken = buffDef.eliteDef.modifierToken; if (!string.IsNullOrWhiteSpace(modifierToken) && !Language.IsTokenInvalid(modifierToken)) { hashSet.Add(val2); } } } if (hashSet.Count > 0) { _validEliteBuffIndices = hashSet.ToArray(); Array.Sort(_validEliteBuffIndices); } } finally { val.Dispose(); } } private static void EquipmentSlot_FireDeathProjectile(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Prefabs/Projectiles/DeathProjectile"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(LegacyResourcesAPI), "Load") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\DeathProjectile.cs", "EquipmentSlot_FireDeathProjectile", 116); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getProjectilePrefab); static GameObject getProjectilePrefab(GameObject prefab, EquipmentSlot equipmentSlot) { QualityTier currentEquipmentActionQualityTier = equipmentSlot.GetCurrentEquipmentActionQualityTier(); if (currentEquipmentActionQualityTier > QualityTier.None) { GameObject safe = ArrayUtils.GetSafe(_qualityDeathProjectilePrefabs, (int)currentEquipmentActionQualityTier); if (Object.op_Implicit((Object)(object)safe)) { prefab = safe; } } return prefab; } } private static void DeathProjectile_FixedUpdate(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "SpawnTickEffect") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Action)onTick); } else { Log.Error("Failed to find elite buff patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\DeathProjectile.cs", "DeathProjectile_FixedUpdate", 215); } val.Goto(0, (MoveType)0, false); VariableDefinition damageReportVar = null; if (val.TryGotoNext((MoveType)0, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "instance"), (Instruction x) => x.MatchLdloc(il, out damageReportVar), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "OnCharacterDeath") })) { val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc, damageReportVar); val.EmitDelegate>((Action)modifyDeathReport); } else { Log.Error("Failed to find damage report patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\DeathProjectile.cs", "DeathProjectile_FixedUpdate", 241); } static void modifyDeathReport(DeathProjectile deathProjectileComponent, DamageReport damageReport) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (QualityTierContext.GetQualityTier(((Component)deathProjectileComponent).gameObject) != QualityTier.None) { DamageAPI.AddModdedDamageType(ref damageReport.damageInfo.damageType, DamageTypes.BypassDrops); } } static void onTick(DeathProjectile deathProjectileComponent) { //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_013c: 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) if (_validEliteBuffIndices.Length != 0 && Object.op_Implicit((Object)(object)deathProjectileComponent) && Object.op_Implicit((Object)(object)deathProjectileComponent.healthComponent) && Object.op_Implicit((Object)(object)deathProjectileComponent.healthComponent.body) && Object.op_Implicit((Object)(object)deathProjectileComponent.projectileController) && ((Component)(object)deathProjectileComponent).TryGetComponentCached(out QualityTierContext component)) { QualityTier qualityTier = component.QualityTier; float num; switch (qualityTier) { case QualityTier.None: num = 0f; break; case QualityTier.Uncommon: num = 5f; break; case QualityTier.Rare: num = 10f; break; case QualityTier.Epic: num = 20f; break; case QualityTier.Legendary: num = 33f; break; default: num = 0f; Log.Warning($"Quality tier {qualityTier} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\DeathProjectile.cs", "DeathProjectile_FixedUpdate", 187); break; } if (num > 0f) { CharacterBody val2 = (Object.op_Implicit((Object)(object)deathProjectileComponent.projectileController.owner) ? deathProjectileComponent.projectileController.owner.GetComponent() : null); CharacterMaster master = (Object.op_Implicit((Object)(object)val2) ? val2.master : null); ProcChainMask procChainMask = deathProjectileComponent.projectileController.procChainMask; bool sureProc = ((ProcChainMask)(ref procChainMask)).HasProc((ProcType)26); if (RollUtil.CheckRoll(num, master, sureProc)) { BuffIndex val3 = RoR2Application.rng.NextElementUniform(_validEliteBuffIndices); deathProjectileComponent.healthComponent.body.AddTimedBuff(val3, 0.5f); deathProjectileComponent.healthComponent.body.RecalculateStats(); } } } } } } internal static class DroneBackup { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown EquipmentSlot.FireDroneBackup += new Manipulator(EquipmentSlot_FireDroneBackup); } private static void EquipmentSlot_FireDroneBackup(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_00ce: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); VariableDefinition droneCountVar = null; float num = default(float); if (!val.TryGotoNext((MoveType)0, new Func[3] { (Instruction x) => x.MatchLdloc(il, out droneCountVar), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchNewobj(x) })) { Log.Error("Failed to find droneCount variable", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\DroneBackup.cs", "EquipmentSlot_FireDroneBackup", 27); return; } if (!val.TryGotoPrev((MoveType)2, new Func[1] { (Instruction x) => x.MatchStloc(droneCountVar) })) { Log.Warning("Failed to find droneCount set location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\DroneBackup.cs", "EquipmentSlot_FireDroneBackup", 34); } val.Emit(OpCodes.Ldloc, droneCountVar); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getBonusDroneCount); val.Emit(OpCodes.Add); val.Emit(OpCodes.Stloc, droneCountVar); static int getBonusDroneCount(EquipmentSlot equipmentSlot) { QualityTier currentEquipmentActionQualityTier = equipmentSlot.GetCurrentEquipmentActionQualityTier(); switch (currentEquipmentActionQualityTier) { case QualityTier.None: return 0; case QualityTier.Uncommon: return 1; case QualityTier.Rare: return 2; case QualityTier.Epic: return 3; case QualityTier.Legendary: return 4; default: Log.Warning($"Quality tier {currentEquipmentActionQualityTier} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\DroneBackup.cs", "EquipmentSlot_FireDroneBackup", 59); return 0; } } } } internal static class EquipmentHooks { internal sealed class EquipmentAction { public EquipmentSlot EquipmentSlot { get; } public QualityTier QualityTier { get; } public EquipmentAction(EquipmentSlot equipmentSlot, QualityTier qualityTier) { EquipmentSlot = equipmentSlot; QualityTier = qualityTier; } } private delegate EquipmentIndex orig_Inventory_get_currentEquipmentIndex(Inventory self); private delegate EquipmentIndex hook_Inventory_get_currentEquipmentIndex(orig_Inventory_get_currentEquipmentIndex orig, Inventory self); private delegate EquipmentIndex orig_Inventory_get_alternateEquipmentIndex(Inventory self); private delegate EquipmentIndex hook_Inventory_get_alternateEquipmentIndex(orig_Inventory_get_alternateEquipmentIndex orig, Inventory self); private static readonly FixedConditionalWeakTable> _equipmentActionsBySlot = new FixedConditionalWeakTable>(); public static bool TryGetCurrentEquipmentAction(EquipmentSlot equipmentSlot, out EquipmentAction action) { List list = default(List); if (_equipmentActionsBySlot.TryGetValue(equipmentSlot, ref list) && list.Count > 0) { action = list[^1]; return true; } action = null; return false; } [InitDuringStartupPhase(/*Could not decode attribute arguments.*/)] private static void PreInit() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown SystemInitializerInjector.InjectDependency(typeof(RuleCatalog), typeof(QualityCatalog)); RuleCatalog.Init += new Manipulator(qualityEquipmentCanDropPatch); } [SystemInitializer(new Type[] { typeof(CostTypeCatalog) })] private static void Init() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_0044: 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_0073: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Expected O, but got Unknown //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Expected O, but got Unknown //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Expected O, but got Unknown //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Expected O, but got Unknown //IL_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_04d4: Unknown result type (might be due to invalid IL or missing references) //IL_04de: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_0532: Expected O, but got Unknown //IL_052d: 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_013f: Expected O, but got Unknown //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Expected O, but got Unknown //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Expected O, but got Unknown //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Expected O, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Expected O, but got Unknown //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Expected O, but got Unknown //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Expected O, but got Unknown //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Expected O, but got Unknown //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Expected O, but got Unknown //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Expected O, but got Unknown //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Expected O, but got Unknown //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Expected O, but got Unknown //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Expected O, but got Unknown //IL_022b: Unknown result type (might be due to invalid IL or missing references) MethodInfo method = typeof(EquipmentSlot).GetMethod("PerformEquipmentAction", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { HookConfig val = default(HookConfig); val.Priority = 100; HookConfig val2 = val; new Hook((MethodBase)method, (Delegate)new hook_PerformEquipmentAction(EquipmentSlot_PerformEquipmentAction), val2); } else { Log.Error("Failed to find EquipmentSlot.PerformEquipmentAction method", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\EquipmentHooks.cs", "Init", 69); } CharacterModel.SetEquipmentDisplay += new hook_SetEquipmentDisplay(CharacterModel_SetEquipmentDisplay); CharacterModel.HighlightEquipentDisplay += new hook_HighlightEquipentDisplay(CharacterModel_HighlightEquipentDisplay); MethodInfo methodInfo = typeof(Inventory).GetProperty("currentEquipmentIndex")?.GetMethod; if (methodInfo != null) { new Hook((MethodBase)methodInfo, (Delegate)new hook_Inventory_get_currentEquipmentIndex(Inventory_get_currentEquipmentIndex)); } else { Log.Error("Failed to find Inventory.currentEquipmentIndex getter method", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\EquipmentHooks.cs", "Init", 82); } MethodInfo methodInfo2 = typeof(Inventory).GetProperty("alternateEquipmentIndex")?.GetMethod; if (methodInfo2 != null) { new Hook((MethodBase)methodInfo2, (Delegate)new hook_Inventory_get_alternateEquipmentIndex(Inventory_get_alternateEquipmentIndex)); } else { Log.Error("Failed to find Inventory.alternateEquipmentIndex getter method", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\EquipmentHooks.cs", "Init", 92); } Inventory.GetActiveEquipment += new hook_GetActiveEquipment(Inventory_GetActiveEquipment); CharacterMaster.TrueKill_GameObject_GameObject_DamageTypeCombo += new Manipulator(CharacterMaster_TrueKill_GameObject_GameObject_DamageTypeCombo); HealthComponent.ProcParry += new Manipulator(GenericPatchAllGetEquipmentQuality); DeployMinions.SummonMinion += new Manipulator(GenericPatchAllGetEquipmentQuality); StatManager.ProcessCharacterUpdateEvents += new Manipulator(GenericPatchAllGetEquipmentQuality); IngredientSlotEntry.Validate_Inventory += new Manipulator(GenericPatchAllGetEquipmentQuality); CraftingController.GetGeneratedOptionsFromInteractor += new Manipulator(GenericPatchAllGetEquipmentQuality); EquipmentSlot.Execute += new Manipulator(GenericPatchAllGetEquipmentQuality); EquipmentSlot.OnEquipmentExecuted += new Manipulator(GenericPatchAllGetEquipmentQuality); GlobalEventManager.OnCharacterDeath += new Manipulator(GenericPatchAllGetEquipmentQuality); CharacterBody.OnInventoryChanged += new Manipulator(CharacterBody_OnInventoryChanged); MethodInfo method2 = typeof(DetatchState).GetMethod("SummonDetachable", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method2 != null) { DynamicMethodDefinition val3 = new DynamicMethodDefinition((MethodBase)method2); try { ILContext val4 = new ILContext(val3.Definition); try { ILCursor val5 = new ILCursor(val4); MethodReference onSpawnedServerMethodRef2 = null; if (val5.TryGotoNext(new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdftn(x, ref onSpawnedServerMethodRef2), (Instruction x) => ILPatternMatchingExt.MatchNewobj>(x), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "onSpawnedServer") })) { MethodBase methodBase = null; try { methodBase = ReflectionHelper.ResolveReflection(onSpawnedServerMethodRef2); } catch (Exception arg) { Log.Error_NoCallerPrefix($"Failed to resolve EntityStates.SolusAmalgamator.DetatchState.SummonDetachable onSpawnedServer method: {arg}"); } if (methodBase != null) { new ILHook(methodBase, new Manipulator(GenericPatchAllGetEquipmentQuality)); } } else { Log.Error("Failed to find onSpawnedServer method in EntityStates.SolusAmalgamator.DetatchState.SummonDetachable", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\EquipmentHooks.cs", "Init", 149); } } finally { ((IDisposable)val4)?.Dispose(); } } finally { ((IDisposable)val3)?.Dispose(); } } else { Log.Error("Failed to find method EntityStates.SolusAmalgamator.DetatchState.SummonDetachable", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\EquipmentHooks.cs", "Init", 154); } MethodInfo method3 = typeof(MinePlant).GetMethod("SpawnMine", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method3 != null) { DynamicMethodDefinition val6 = new DynamicMethodDefinition((MethodBase)method3); try { ILContext val7 = new ILContext(val6.Definition); try { ILCursor val8 = new ILCursor(val7); MethodReference onSpawnedServerMethodRef = null; if (val8.TryGotoNext(new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdftn(x, ref onSpawnedServerMethodRef), (Instruction x) => ILPatternMatchingExt.MatchNewobj>(x), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "onSpawnedServer") })) { MethodBase methodBase2 = null; try { methodBase2 = ReflectionHelper.ResolveReflection(onSpawnedServerMethodRef); } catch (Exception arg2) { Log.Error_NoCallerPrefix($"Failed to resolve EntityStates.MinePod.MinePlant.SpawnMine onSpawnedServer method: {arg2}"); } if (methodBase2 != null) { new ILHook(methodBase2, new Manipulator(GenericPatchAllGetEquipmentQuality)); } } else { Log.Error("Failed to find onSpawnedServer method in EntityStates.MinePod.MinePlant.SpawnMine", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\EquipmentHooks.cs", "Init", 187); } } finally { ((IDisposable)val7)?.Dispose(); } } finally { ((IDisposable)val6)?.Dispose(); } } else { Log.Error("Failed to find method EntityStates.MinePod.MinePlant.SpawnMine", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\EquipmentHooks.cs", "Init", 192); } CostTypeDef costTypeDef = CostTypeCatalog.GetCostTypeDef((CostTypeIndex)7); MethodInfo methodInfo3 = ((costTypeDef == null) ? null : ((Delegate)(object)costTypeDef.payCost)?.Method); if (methodInfo3 != null) { new ILHook((MethodBase)methodInfo3, new Manipulator(GenericPatchAllGetEquipmentQuality)); } else { Log.Error("Failed to find Equipment payCost method", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\EquipmentHooks.cs", "Init", 202); } LogBookController.CanSelectEquipmentEntry += new Manipulator(qualityEquipmentCanDropPatch); MethodInfo methodInfo4 = typeof(GameCompletionStatsHelper).GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic).SingleOrDefault((MethodInfo m) => m.Name.StartsWith("<.ctor>g__AddPickup|")); if (methodInfo4 != null) { new ILHook((MethodBase)methodInfo4, new Manipulator(qualityEquipmentCanDropPatch)); } else { Log.Error("Failed to find GameCompletionStatsHelper..ctor AddPickup local function", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\EquipmentHooks.cs", "Init", 214); } } private static bool EquipmentSlot_PerformEquipmentAction(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Invalid comparison between Unknown and I4 //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) QualityTier qualityTier = QualityTier.None; if (Object.op_Implicit((Object)(object)equipmentDef)) { qualityTier = QualityCatalog.GetQualityTier(equipmentDef.equipmentIndex); EquipmentIndex equipmentIndexOfQuality = QualityCatalog.GetEquipmentIndexOfQuality(equipmentDef.equipmentIndex, QualityTier.None); if ((int)equipmentIndexOfQuality != -1 && equipmentDef.equipmentIndex != equipmentIndexOfQuality) { equipmentDef = EquipmentCatalog.GetEquipmentDef(equipmentIndexOfQuality); } } List list = default(List); if (!_equipmentActionsBySlot.TryGetValue(self, ref list)) { _equipmentActionsBySlot.Add(self, list = CollectionPool>.RentCollection()); } list.Add(new EquipmentAction(self, qualityTier)); try { return orig.Invoke(self, equipmentDef); } finally { if (list.Count > 0) { list.RemoveAt(list.Count - 1); } if (list.Count == 0) { CollectionPool>.ReturnCollection(list); _equipmentActionsBySlot.Remove(self); } } } private static void CharacterModel_SetEquipmentDisplay(orig_SetEquipmentDisplay orig, CharacterModel self, EquipmentIndex newEquipmentIndex) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, QualityCatalog.GetEquipmentIndexOfQuality(newEquipmentIndex, QualityTier.None)); } private static void CharacterModel_HighlightEquipentDisplay(orig_HighlightEquipentDisplay orig, CharacterModel self, EquipmentIndex equipmentIndex) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, QualityCatalog.GetEquipmentIndexOfQuality(equipmentIndex, QualityTier.None)); } private static EquipmentIndex Inventory_get_currentEquipmentIndex(orig_Inventory_get_currentEquipmentIndex orig, Inventory self) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return QualityCatalog.GetEquipmentIndexOfQuality(orig(self), QualityTier.None); } private static EquipmentIndex Inventory_get_alternateEquipmentIndex(orig_Inventory_get_alternateEquipmentIndex orig, Inventory self) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return QualityCatalog.GetEquipmentIndexOfQuality(orig(self), QualityTier.None); } private static EquipmentState Inventory_GetActiveEquipment(orig_GetActiveEquipment orig, Inventory self) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return orig.Invoke(self).WithQualityTier(QualityTier.None); } private static void CharacterMaster_TrueKill_GameObject_GameObject_DamageTypeCombo(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILLabel healAndReviveBlockEndLabel = null; if (!val.TryGotoNext((MoveType)0, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Equipment), "HealAndRevive"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "get_equipmentIndex"), (Instruction x) => ILPatternMatchingExt.MatchBneUn(x, ref healAndReviveBlockEndLabel) })) { Log.Error("Failed to find seed of life equipment check location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\EquipmentHooks.cs", "CharacterMaster_TrueKill_GameObject_GameObject_DamageTypeCombo", 297); return; } if (!val.TryGotoPrev((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "GetEquipment") })) { Log.Error("Failed to find seed of life equipment state location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\EquipmentHooks.cs", "CharacterMaster_TrueKill_GameObject_GameObject_DamageTypeCombo", 304); return; } VariableDefinition val2 = il.AddVariable(); val.Emit(OpCodes.Dup); val.Emit(OpCodes.Stloc, val2); int num = 0; while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Equipment), "HealAndRevive") || ILPatternMatchingExt.MatchLdsfld(x, typeof(Equipment), "HealAndReviveConsumed") })) { val.Emit(OpCodes.Ldloc, val2); val.EmitDelegate>((Func)getEquipmentOfQualityInState); num++; } if (num == 0) { Log.Error("Failed to find quality seed of life patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\EquipmentHooks.cs", "CharacterMaster_TrueKill_GameObject_GameObject_DamageTypeCombo", 342); } static EquipmentDef getEquipmentOfQualityInState(EquipmentDef equipmentDef, EquipmentState equipmentState) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) EquipmentIndex val3 = (EquipmentIndex)((!Object.op_Implicit((Object)(object)equipmentDef)) ? (-1) : ((int)equipmentDef.equipmentIndex)); if ((int)val3 != -1) { QualityTier qualityTier = QualityCatalog.GetQualityTier(equipmentState.equipmentIndex); EquipmentIndex equipmentIndexOfQuality = QualityCatalog.GetEquipmentIndexOfQuality(val3, qualityTier); if (equipmentIndexOfQuality != val3) { equipmentDef = EquipmentCatalog.GetEquipmentDef(equipmentIndexOfQuality); val3 = equipmentIndexOfQuality; } } return equipmentDef; } } private static void CharacterBody_OnInventoryChanged(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); VariableDefinition qualityTierTempVar = null; if (val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "get_currentEquipmentIndex") })) { patchSingleEquipmentQuality(val, ref qualityTierTempVar); } else { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\EquipmentHooks.cs", "CharacterBody_OnInventoryChanged", 363); } } public static void GenericPatchAllGetEquipmentQuality(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); VariableDefinition qualityTierTempVar = null; int num = 0; while (val.TryGotoNext((MoveType)0, new Func[1] { matchGetEquipmentCall })) { patchSingleEquipmentQuality(val, ref qualityTierTempVar); num++; val.SearchTarget = (SearchTarget)1; } if (num == 0) { Log.Error(((MemberReference)il.Method).FullName + ": Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\EquipmentHooks.cs", "GenericPatchAllGetEquipmentQuality", 395); } static bool matchGetEquipmentCall(Instruction x) { if (!ILPatternMatchingExt.MatchCallOrCallvirt(x, "GetActiveEquipment") && !ILPatternMatchingExt.MatchCallOrCallvirt(x, "get_currentEquipmentIndex") && !ILPatternMatchingExt.MatchCallOrCallvirt(x, "get_alternateEquipmentIndex") && !ILPatternMatchingExt.MatchCallOrCallvirt(x, "GetEquipmentIndex")) { return ILPatternMatchingExt.MatchCallOrCallvirt(x, "get_equipmentIndex"); } return true; } } private static void patchSingleEquipmentQuality(ILCursor cursor, ref VariableDefinition qualityTierTempVar) { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) ILCursor val = cursor.Clone(); MethodReference val2 = default(MethodReference); if (!ILPatternMatchingExt.MatchCallOrCallvirt(val.Next, ref val2) || val2.Parameters.Count != 0 || !val2.HasThis || (!Extensions.Is((MemberReference)(object)((MemberReference)val2).DeclaringType, (MemberInfo)typeof(Inventory)) && !Extensions.Is((MemberReference)(object)((MemberReference)val2).DeclaringType, (MemberInfo)typeof(EquipmentSlot))) || (!Extensions.Is((MemberReference)(object)val2.ReturnType, (MemberInfo)typeof(EquipmentState)) && !Extensions.Is((MemberReference)(object)val2.ReturnType, (MemberInfo)typeof(EquipmentIndex)))) { Log.Error($"{((MemberReference)val.Method).FullName}:{val.Index:X4} Cursor must be placed before a call that gets an EquipmentIndex/State from an Inventory/EquipmentSlot instance", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\EquipmentHooks.cs", "patchSingleEquipmentQuality", 413); return; } val.Emit(OpCodes.Dup); if (Extensions.Is((MemberReference)(object)((MemberReference)val2).DeclaringType, (MemberInfo)typeof(EquipmentSlot))) { val.EmitDelegate>((Func)EquipmentExtensions.GetActiveEquipmentQualityTier); } else { val.EmitDelegate>((Func)EquipmentExtensions.GetActiveEquipmentQualityTier); } if (qualityTierTempVar == null) { qualityTierTempVar = val.Context.AddVariable(); } val.Emit(OpCodes.Stloc, qualityTierTempVar); int index = val.Index; val.Index = index + 1; val.Emit(OpCodes.Ldloc, qualityTierTempVar); if (Extensions.Is((MemberReference)(object)val2.ReturnType, (MemberInfo)typeof(EquipmentState))) { val.EmitDelegate>((Func)EquipmentExtensions.WithQualityTier); } else { val.EmitDelegate>((Func)QualityCatalog.GetEquipmentIndexOfQuality); } } private static void qualityEquipmentCanDropPatch(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); int num = 0; while (val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "canDrop") })) { val.EmitDelegate>((Func)getBaseEquipment); num++; val.SearchTarget = (SearchTarget)1; } if (num == 0) { Log.Error(((MemberReference)il.Method).FullName + " Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\EquipmentHooks.cs", "qualityEquipmentCanDropPatch", 478); } static EquipmentDef getBaseEquipment(EquipmentDef equipmentDef) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) EquipmentIndex val2 = (EquipmentIndex)((!Object.op_Implicit((Object)(object)equipmentDef)) ? (-1) : ((int)equipmentDef.equipmentIndex)); if ((int)val2 != -1) { EquipmentIndex equipmentIndexOfQuality = QualityCatalog.GetEquipmentIndexOfQuality(val2, QualityTier.None); if (equipmentIndexOfQuality != val2) { equipmentDef = EquipmentCatalog.GetEquipmentDef(equipmentIndexOfQuality); val2 = equipmentIndexOfQuality; } } return equipmentDef; } } } internal static class FireBallDash { private static readonly GameObject[] _qualityVehiclePrefabs = (GameObject[])(object)new GameObject[4]; [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle handle = AddressableUtil.LoadTempAssetAsync(RoR2_Base_FireBallDash.FireballVehicle_prefab); handle.OnSuccess(delegate(GameObject fireballVehiclePrefab) { for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { float blastDamageCoefficientBonusPerHit; float blastRadiusBonusPerHit; switch (qualityTier) { case QualityTier.Uncommon: blastDamageCoefficientBonusPerHit = 3f; blastRadiusBonusPerHit = 0.5f; break; case QualityTier.Rare: blastDamageCoefficientBonusPerHit = 4.5f; blastRadiusBonusPerHit = 1f; break; case QualityTier.Epic: blastDamageCoefficientBonusPerHit = 6.5f; blastRadiusBonusPerHit = 1.5f; break; case QualityTier.Legendary: blastDamageCoefficientBonusPerHit = 8.5f; blastRadiusBonusPerHit = 2.5f; break; default: throw new NotImplementedException($"Quality tier {qualityTier} is not implemented"); } GameObject val = PrefabAPI.InstantiateClone(fireballVehiclePrefab, ((Object)fireballVehiclePrefab).name + qualityTier); FireballVehicleQualityController fireballVehicleQualityController = UnityObjectExtensions.EnsureComponent(val); fireballVehicleQualityController.BlastDamageCoefficientBonusPerHit = blastDamageCoefficientBonusPerHit; fireballVehicleQualityController.BlastRadiusBonusPerHit = blastRadiusBonusPerHit; _qualityVehiclePrefabs[(int)qualityTier] = val; } args.ContentPack.networkedObjectPrefabs.Add(_qualityVehiclePrefabs); }); return handle.AsProgressCoroutine>(args.ProgressReceiver); } [SystemInitializer(new Type[] { })] private static void Init() { //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 EquipmentSlot.FireFireBallDash += new Manipulator(EquipmentSlot_FireFireBallDash); FireballVehicle.FixedUpdate += new Manipulator(FireballVehicle_FixedUpdate); } private static void EquipmentSlot_FireFireBallDash(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Prefabs/NetworkedObjects/FireballVehicle"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(LegacyResourcesAPI), "Load") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\FireBallDash.cs", "EquipmentSlot_FireFireBallDash", 84); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getVehiclePrefab); static GameObject getVehiclePrefab(GameObject prefab, EquipmentSlot equipmentSlot) { QualityTier currentEquipmentActionQualityTier = equipmentSlot.GetCurrentEquipmentActionQualityTier(); if (currentEquipmentActionQualityTier > QualityTier.None) { GameObject safe = ArrayUtils.GetSafe(_qualityVehiclePrefabs, (int)currentEquipmentActionQualityTier); if (Object.op_Implicit((Object)(object)safe)) { prefab = safe; } } return prefab; } } private static void FireballVehicle_FixedUpdate(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILLabel val2 = default(ILLabel); if (!val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "Fire"), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val2) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\FireBallDash.cs", "FireballVehicle_FixedUpdate", 115); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Action)onOverlapAttackHit); static void onOverlapAttackHit(FireballVehicle fireballVehicle) { if (((Component)(object)fireballVehicle).TryGetComponentCached(out FireballVehicleQualityController component)) { component.OnOverlapAttackHitServer(); } } } } public sealed class FireballVehicleQualityController : MonoBehaviour { public float BlastRadiusBonusPerHit; public float BlastDamageCoefficientBonusPerHit; private FireballVehicle _fireballVehicle; private void Awake() { _fireballVehicle = ((Component)this).GetComponent(); ComponentCache.Add(((Component)this).gameObject, this); } private void OnDestroy() { ComponentCache.Remove(((Component)this).gameObject, this); } public void OnOverlapAttackHitServer() { FireballVehicle fireballVehicle = _fireballVehicle; fireballVehicle.blastDamageCoefficient += BlastDamageCoefficientBonusPerHit; FireballVehicle fireballVehicle2 = _fireballVehicle; fireballVehicle2.blastRadius += BlastRadiusBonusPerHit; } } internal static class Fruit { [SystemInitializer(new Type[] { })] private static void Init() { //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 EquipmentSlot.FireFruit += new hook_FireFruit(EquipmentSlot_FireFruit); CharacterBody.AddTimedBuff_BuffDef_float += new hook_AddTimedBuff_BuffDef_float(CharacterBody_AddTimedBuff_BuffDef_float); } private static void CharacterBody_AddTimedBuff_BuffDef_float(orig_AddTimedBuff_BuffDef_float orig, CharacterBody self, BuffDef buffDef, float duration) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)buffDef) && !buffDef.isHidden && !buffDef.isCooldown && !buffDef.isDebuff && !buffDef.isDOT) { EquipmentIndex val = (EquipmentIndex)(-1); QualityTier qualityTier = QualityTier.None; if (Object.op_Implicit((Object)(object)self.inventory)) { val = self.inventory.currentEquipmentIndex; qualityTier = self.inventory.GetActiveEquipmentQualityTier(); } if (val == Equipment.Fruit.equipmentIndex && qualityTier != QualityTier.None && self.GetTemporaryHealthBonus() > 0f) { float num; switch (qualityTier) { case QualityTier.Uncommon: num = 1.25f; break; case QualityTier.Rare: num = 1.75f; break; case QualityTier.Epic: num = 2f; break; case QualityTier.Legendary: num = 3f; break; default: Log.Warning($"Quality tier {qualityTier} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Fruit.cs", "CharacterBody_AddTimedBuff_BuffDef_float", 49); num = 1f; break; } if (num > 1f) { duration *= num; } } } orig.Invoke(self, buffDef, duration); } private static bool EquipmentSlot_FireFruit(orig_FireFruit orig, EquipmentSlot self) { bool flag = orig.Invoke(self); if (flag) { QualityTier currentEquipmentActionQualityTier = self.GetCurrentEquipmentActionQualityTier(); float num; switch (currentEquipmentActionQualityTier) { case QualityTier.Uncommon: num = 0.05f; goto IL_007b; case QualityTier.Rare: num = 0.1f; goto IL_007b; case QualityTier.Epic: num = 0.2f; goto IL_007b; case QualityTier.Legendary: num = 0.25f; goto IL_007b; default: Log.Warning($"Quality tier {currentEquipmentActionQualityTier} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Fruit.cs", "EquipmentSlot_FireFruit", 88); num = 0f; goto IL_007b; case QualityTier.None: break; IL_007b: if (num > 0f) { float temporaryHealthBonus = self.characterBody.GetTemporaryHealthBonus(); float num2 = self.healthComponent.fullHealth - temporaryHealthBonus; float num3 = num2 * 0.5f; float num4 = Mathf.Max(0f, num3 - (float)self.characterBody.GetBuffCount(ItemQualitiesContent.Buffs.FruitTempHealth)); float num5 = Mathf.Max(1f, num2 * num); int num6 = Mathf.CeilToInt(Mathf.Min(num4, num5)); for (int i = 0; i < num6; i++) { self.characterBody.AddBuff(ItemQualitiesContent.Buffs.FruitTempHealth); } } break; } } return flag; } } internal static class GainArmor { [SystemInitializer(new Type[] { })] private static void Init() { //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 RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(getStatCoefficients); EquipmentSlot.FireGainArmor += new hook_FireGainArmor(EquipmentSlot_FireGainArmor); } private static void getStatCoefficients(CharacterBody sender, StatHookEventArgs args) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Invalid comparison between Unknown and I4 if (!Object.op_Implicit((Object)(object)sender.inventory) || sender.inventory.GetEquipmentDisabled() || !(sender.healthComponent.barrier > 0f)) { return; } int equipmentSlotCount = sender.inventory.GetEquipmentSlotCount(); for (uint num = 0u; num < equipmentSlotCount; num++) { int equipmentSetCount = sender.inventory.GetEquipmentSetCount(num); for (uint num2 = 0u; num2 < equipmentSetCount; num2++) { EquipmentIndex equipmentIndex = sender.inventory.GetEquipment(num, num2).equipmentIndex; EquipmentQualityGroupIndex equipmentQualityGroupIndex = QualityCatalog.FindEquipmentQualityGroupIndex(equipmentIndex); if ((int)equipmentIndex != -1 && equipmentQualityGroupIndex == ItemQualitiesContent.EquipmentQualityGroups.GainArmor.GroupIndex) { QualityTier equipmentQualityTier = sender.inventory.GetEquipmentQualityTier(num, num2); switch (equipmentQualityTier) { case QualityTier.Uncommon: args.armorAdd += 30f; break; case QualityTier.Rare: args.armorAdd += 60f; break; case QualityTier.Epic: args.armorAdd += 100f; break; case QualityTier.Legendary: args.armorAdd += 150f; break; default: Log.Warning($"Quality tier {equipmentQualityTier} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\GainArmor.cs", "getStatCoefficients", 52); break; case QualityTier.None: break; } } } } } private static bool EquipmentSlot_FireGainArmor(orig_FireGainArmor orig, EquipmentSlot self) { bool num = orig.Invoke(self); if (num) { self.characterBody.healthComponent.AddBarrier(self.characterBody.healthComponent.fullHealth * 0.2f); } return num; } } internal static class Gateway { public static GameObject QualityGatewayPickupTargetIndicatorPrefab { get; private set; } [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { //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_0031: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle handle = AddressableUtil.LoadTempAssetAsync(RoR2_Base_Lightning.LightningIndicator_prefab); handle.OnSuccess(delegate(GameObject lightningIndicatorPrefab) { //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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) QualityGatewayPickupTargetIndicatorPrefab = PrefabAPI.InstantiateClone(lightningIndicatorPrefab, "QualityGatewayPickupIndicator", false); InputBindingDisplayController componentInChildren = QualityGatewayPickupTargetIndicatorPrefab.GetComponentInChildren(); if (Object.op_Implicit((Object)(object)componentInChildren)) { componentInChildren.actionName = "Interact"; TMP_Text val = default(TMP_Text); if (((Component)componentInChildren).TryGetComponent(ref val)) { ((Graphic)val).color = Color32.op_Implicit(new Color32((byte)234, (byte)42, (byte)170, byte.MaxValue)); } } SpriteRenderer[] componentsInChildren = QualityGatewayPickupTargetIndicatorPrefab.GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].color = Color32.op_Implicit(new Color32((byte)224, (byte)24, (byte)131, byte.MaxValue)); } }); return handle.AsProgressCoroutine>(args.ProgressReceiver); } [SystemInitializer(new Type[] { })] private static void Init() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown CharacterBody.onBodyInventoryChangedGlobal += onBodyInventoryChangedGlobal; EquipmentSlot.FireGateway += new hook_FireGateway(EquipmentSlot_FireGateway); } private static void onBodyInventoryChangedGlobal(CharacterBody body) { //IL_000e: 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) if (!NetworkServer.active) { return; } EquipmentIndex currentEquipmentIndex = body.inventory.currentEquipmentIndex; QualityTier activeEquipmentQualityTier = body.inventory.GetActiveEquipmentQualityTier(); GatewayQualityAttachment gatewayQualityAttachment = GatewayQualityAttachment.FindAttachmentForBody(body); bool flag = currentEquipmentIndex == Equipment.Gateway.equipmentIndex && activeEquipmentQualityTier != QualityTier.None; if (flag != Object.op_Implicit((Object)(object)gatewayQualityAttachment)) { if (flag) { GameObject obj = Object.Instantiate(ItemQualitiesContent.NetworkedPrefabs.GatewayQualityAttachment); obj.GetComponent().AttachToGameObjectAndSpawn(((Component)body).gameObject, (string)null); gatewayQualityAttachment = obj.GetComponent(); } else { Object.Destroy((Object)(object)((Component)gatewayQualityAttachment).gameObject); gatewayQualityAttachment = null; } } if (Object.op_Implicit((Object)(object)gatewayQualityAttachment)) { gatewayQualityAttachment.QualityTier = activeEquipmentQualityTier; } } private static bool EquipmentSlot_FireGateway(orig_FireGateway orig, EquipmentSlot self) { //IL_00b3: 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) bool flag = orig.Invoke(self); if (flag) { QualityTier currentEquipmentActionQualityTier = self.GetCurrentEquipmentActionQualityTier(); int num; float num2; Vector3 bodyForward; GatewayQualityAttachment gatewayAttachment; switch (currentEquipmentActionQualityTier) { case QualityTier.Uncommon: num = 1; num2 = 35f; goto IL_00a1; case QualityTier.Rare: num = 2; num2 = 90f; goto IL_00a1; case QualityTier.Epic: num = 4; num2 = 120f; goto IL_00a1; case QualityTier.Legendary: num = 8; num2 = 180f; goto IL_00a1; default: Log.Warning($"Quality tier {currentEquipmentActionQualityTier} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Gateway.cs", "EquipmentSlot_FireGateway", 120); num = 0; num2 = 0f; goto IL_00a1; case QualityTier.None: break; IL_00a1: bodyForward = self.characterBody.inputBank.aimDirection; bodyForward.y = 0f; ((Vector3)(ref bodyForward)).Normalize(); gatewayAttachment = GatewayQualityAttachment.FindAttachmentForBody(self.characterBody); for (int i = 0; i < num; i++) { float num3 = num2 / (float)num * (float)(i + 1); attemptSpawnPickup(num3); if (num3 < 180f) { attemptSpawnPickup(0f - num3); } if (Object.op_Implicit((Object)(object)gatewayAttachment) && gatewayAttachment.PickupLimitReached) { break; } } break; } } return flag; } } [RequireComponent(typeof(NetworkedBodyAttachment))] public sealed class GatewayQualityAttachment : NetworkBehaviour, INetworkedBodyAttachmentListener { private static GameObject _gatewayPickupPrefab; [SyncVar] private int _qualityTierInt; public const int MaxPickups = 30; [SyncVar] private bool _pickupLimitReached; private int _numActivePickupsServer; private float _spawnTimer; private CharacterBody _attachedBody; private static int kCmdCmdCreatePickup; public QualityTier QualityTier { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return (QualityTier)(_qualityTierInt - 1); } [MethodImpl(MethodImplOptions.AggressiveInlining)] set { Network_qualityTierInt = (int)(value + 1); } } public float SpawnInterval => QualityTier switch { QualityTier.Uncommon => 10f, QualityTier.Rare => 8f, QualityTier.Epic => 6f, QualityTier.Legendary => 4f, _ => float.PositiveInfinity, }; public bool PickupLimitReached => _pickupLimitReached; public int Network_qualityTierInt { get { return _qualityTierInt; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref _qualityTierInt, 1u); } } public bool Network_pickupLimitReached { get { return _pickupLimitReached; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref _pickupLimitReached, 2u); } } [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle handle = AddressableUtil.LoadTempAssetAsync(RoR2_DLC2_Items_SpeedBoostPickup.ElusiveAntlersPickup_prefab); handle.OnSuccess(delegate(GameObject elusiveAntlersPickupPrefab) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: 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) _gatewayPickupPrefab = PrefabAPI.InstantiateClone(elusiveAntlersPickupPrefab, "QualityGatewayPickup"); GravitatePickup componentInChildren = _gatewayPickupPrefab.GetComponentInChildren(); if (Object.op_Implicit((Object)(object)componentInChildren)) { Object.Destroy((Object)(object)((Component)componentInChildren).gameObject); } ElusiveAntlersPickup component = _gatewayPickupPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { Object.Destroy((Object)(object)component); } Dictionary dictionary = new Dictionary(); Renderer[] componentsInChildren = _gatewayPickupPrefab.GetComponentsInChildren(true); foreach (Renderer val in componentsInChildren) { if (!dictionary.TryGetValue(val.sharedMaterial, out var value)) { value = new Material(val.sharedMaterial); value.SetColor(ShaderProperties._TintColor, new Color(0.9f, 0.1f, 0.7f, 1f)); dictionary.Add(val.sharedMaterial, value); } val.sharedMaterial = value; } Light componentInChildren2 = _gatewayPickupPrefab.GetComponentInChildren(); if (Object.op_Implicit((Object)(object)componentInChildren2)) { componentInChildren2.color = Color32.op_Implicit(new Color32((byte)206, (byte)41, (byte)206, byte.MaxValue)); } UnityObjectExtensions.EnsureComponent(_gatewayPickupPrefab).duration = 60f; GatewayQualityPickupController gatewayQualityPickupController = _gatewayPickupPrefab.AddComponent(); Transform transform = new GameObject("CorePosition").transform; transform.SetParent(_gatewayPickupPrefab.transform); transform.SetLocalPositionAndRotation(new Vector3(0f, 1.3f, 0f), Quaternion.identity); gatewayQualityPickupController.CoreTransform = transform; args.ContentPack.networkedObjectPrefabs.Add(_gatewayPickupPrefab); }); return handle.AsProgressCoroutine>(args.ProgressReceiver); } private void OnEnable() { InstanceTracker.Add(this); } private void OnDisable() { InstanceTracker.Remove(this); } private void FixedUpdate() { //IL_007a: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { Network_pickupLimitReached = _numActivePickupsServer >= 30; } if (!Object.op_Implicit((Object)(object)_attachedBody) || !_attachedBody.hasEffectiveAuthority) { return; } _spawnTimer += Time.fixedDeltaTime; if (!(_spawnTimer >= SpawnInterval)) { return; } _spawnTimer = 0f; if (_pickupLimitReached) { return; } bool flag = false; for (int i = 0; i < 10; i++) { if (tryGetNextPickupPositionAuthority(out var pickupPosition)) { flag = true; createPickupAuthority(pickupPosition); break; } } } private bool tryGetNextPickupPositionAuthority(out Vector3 pickupPosition) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_attachedBody)) { pickupPosition = default(Vector3); return false; } Vector3 aimDirection = _attachedBody.inputBank.aimDirection; Quaternion val = Quaternion.Euler(Random.Range(-20f, 20f), Random.Range(-35f, 35f), 0f); Vector3 val2 = Vector3Utils.XAZ(ref aimDirection, 0f); Vector3 val3 = val * ((Vector3)(ref val2)).normalized; float num = Random.Range(40f, 120f); Vector3 val4 = _attachedBody.corePosition + val3 * num; if (Object.op_Implicit((Object)(object)SceneInfo.instance.groundNodes)) { NodeIndex val5 = SceneInfo.instance.groundNodes.FindClosestNode(val4, _attachedBody.hullClassification, num / 3f); Vector3 val6 = default(Vector3); if (SceneInfo.instance.groundNodes.GetNodePosition(val5, ref val6)) { pickupPosition = val6; return true; } } pickupPosition = default(Vector3); return false; } private void createPickupAuthority(Vector3 pickupPosition) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { createPickupServer(pickupPosition); } else { CallCmdCreatePickup(pickupPosition); } } [Command] private void CmdCreatePickup(Vector3 pickupPosition) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) createPickupServer(pickupPosition); } private GameObject createPickupServer(Vector3 pickupPosition) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (_pickupLimitReached) { return null; } GameObject val = SpawnPickup(pickupPosition, _attachedBody); RegisterPickupServer(val); return val; } [Server] public void RegisterPickupServer(GameObject pickupObject) { if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void ItemQualities.Equipments.GatewayQualityAttachment::RegisterPickupServer(UnityEngine.GameObject)' called on client"); return; } _numActivePickupsServer++; OnDestroyCallback.AddCallback(pickupObject, (Action)delegate { _numActivePickupsServer--; }); } public static GameObject SpawnPickup(Vector3 pickupPosition, CharacterBody ownerBody) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate(_gatewayPickupPrefab, pickupPosition, Quaternion.identity); if (Object.op_Implicit((Object)(object)ownerBody)) { val.GetComponent().teamIndex = ownerBody.teamComponent.teamIndex; } NetworkServer.Spawn(val); return val; } void INetworkedBodyAttachmentListener.OnAttachedBodyDiscovered(NetworkedBodyAttachment networkedBodyAttachment, CharacterBody attachedBody) { _attachedBody = attachedBody; } public static GatewayQualityAttachment FindAttachmentForBody(CharacterBody body) { foreach (GatewayQualityAttachment instances in InstanceTracker.GetInstancesList()) { if ((Object)(object)instances._attachedBody == (Object)(object)body) { return instances; } } return null; } private void UNetVersion() { } protected static void InvokeCmdCmdCreatePickup(NetworkBehaviour obj, NetworkReader reader) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogError((object)"Command CmdCreatePickup called on client."); } else { ((GatewayQualityAttachment)(object)obj).CmdCreatePickup(reader.ReadVector3()); } } public void CallCmdCreatePickup(Vector3 pickupPosition) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (!NetworkClient.active) { Debug.LogError((object)"Command function CmdCreatePickup called on server."); return; } if (((NetworkBehaviour)this).isServer) { CmdCreatePickup(pickupPosition); return; } NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)5); val.WritePackedUInt32((uint)kCmdCmdCreatePickup); val.Write(((Component)this).GetComponent().netId); val.Write(pickupPosition); ((NetworkBehaviour)this).SendCommandInternal(val, 0, "CmdCreatePickup"); } static GatewayQualityAttachment() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown kCmdCmdCreatePickup = -852589898; NetworkBehaviour.RegisterCommandDelegate(typeof(GatewayQualityAttachment), kCmdCmdCreatePickup, new CmdDelegate(InvokeCmdCmdCreatePickup)); NetworkCRC.RegisterBehaviour("GatewayQualityAttachment", 0); } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { if (forceAll) { writer.WritePackedUInt32((uint)_qualityTierInt); writer.Write(_pickupLimitReached); return true; } bool flag = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32((uint)_qualityTierInt); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 2u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(_pickupLimitReached); } if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { if (initialState) { _qualityTierInt = (int)reader.ReadPackedUInt32(); _pickupLimitReached = reader.ReadBoolean(); return; } int num = (int)reader.ReadPackedUInt32(); if (((uint)num & (true ? 1u : 0u)) != 0) { _qualityTierInt = (int)reader.ReadPackedUInt32(); } if (((uint)num & 2u) != 0) { _pickupLimitReached = reader.ReadBoolean(); } } public override void PreStartClient() { } } internal static class GoldGat { [SystemInitializer(new Type[] { })] private static 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown AsyncOperationHandle handle = AddressableUtil.LoadAssetAsync(RoR2_Base_GoldGat.GoldGatController_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject goldGatAttachmentPrefab) { UnityObjectExtensions.EnsureComponent(goldGatAttachmentPrefab); }); EquipmentSlot.UpdateGoldGat += new hook_UpdateGoldGat(EquipmentSlot_UpdateGoldGat); GoldGatFire.FireBullet += new Manipulator(GoldGatFire_FireBullet); } private static void EquipmentSlot_UpdateGoldGat(orig_UpdateGoldGat orig, EquipmentSlot self) { orig.Invoke(self); if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.goldgatControllerObject) && self.goldgatControllerObject.TryGetComponentCached(out QualityTierContext component)) { component.QualityTier = self.GetActiveEquipmentQualityTier(); } } private static void GoldGatFire_FireBullet(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); VariableDefinition val2 = il.AddVariable(); int num = 0; while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "maxFireFrequency") })) { val.Emit(OpCodes.Ldloc, val2); val.Emit(OpCodes.Mul); num++; } if (num == 0) { Log.Error("Failed to find maxFireFrequency patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\GoldGat.cs", "GoldGatFire_FireBullet", 55); return; } val.Goto(0, (MoveType)0, false); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getMaxFireFrequencyMultiplier); val.Emit(OpCodes.Stloc, val2); static float getMaxFireFrequencyMultiplier(GoldGatFire self) { QualityTier qualityTier = QualityTierContext.GetQualityTier(((EntityState)self).gameObject); switch (qualityTier) { case QualityTier.None: return 1f; case QualityTier.Uncommon: return 1.2f; case QualityTier.Rare: return 1.4f; case QualityTier.Epic: return 1.8f; case QualityTier.Legendary: return 2.5f; default: Log.Warning($"Quality tier {qualityTier} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\GoldGat.cs", "GoldGatFire_FireBullet", 85); return 1f; } } } } internal static class GummyClone { private static readonly GameObject[] _qualityGummyCloneProjectilePrefabs = (GameObject[])(object)new GameObject[4]; private static readonly Func[] _qualityItemCopyFilters = new Func[4] { uncommonItemCopyFilter, rareItemCopyFilter, epicItemCopyFilter, legendaryItemCopyFilter }; [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle handle = AddressableUtil.LoadTempAssetAsync(RoR2_DLC1_GummyClone.GummyCloneProjectile_prefab); handle.OnSuccess(delegate(GameObject gummyCloneProjectilePrefab) { for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { GameObject val = PrefabAPI.InstantiateClone(gummyCloneProjectilePrefab, ((Object)gummyCloneProjectilePrefab).name + qualityTier); val.AddComponent().QualityTier = qualityTier; _qualityGummyCloneProjectilePrefabs[(int)qualityTier] = val; } args.ContentPack.networkedObjectPrefabs.Add(_qualityGummyCloneProjectilePrefabs); args.ContentPack.projectilePrefabs.Add(_qualityGummyCloneProjectilePrefabs); }); return handle.AsProgressCoroutine>(args.ProgressReceiver); } [SystemInitializer(new Type[] { })] private static void Init() { //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 EquipmentSlot.FireGummyClone += new Manipulator(EquipmentSlot_FireGummyClone); GummyCloneProjectile.SpawnGummyClone += new Manipulator(GummyCloneProjectile_SpawnGummyClone); } private static void EquipmentSlot_FireGummyClone(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Prefabs/Projectiles/GummyCloneProjectile"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(LegacyResourcesAPI), "Load") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\GummyClone.cs", "EquipmentSlot_FireGummyClone", 69); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getProjectilePrefab); static GameObject getProjectilePrefab(GameObject prefab, EquipmentSlot equipmentSlot) { QualityTier currentEquipmentActionQualityTier = equipmentSlot.GetCurrentEquipmentActionQualityTier(); GameObject safe = ArrayUtils.GetSafe(_qualityGummyCloneProjectilePrefabs, (int)currentEquipmentActionQualityTier); if (!Object.op_Implicit((Object)(object)safe)) { return prefab; } return safe; } } private static void GummyCloneProjectile_SpawnGummyClone(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); VariableDefinition spawnCardVar = null; int num7 = default(int); if (!val.TryGotoNext((MoveType)2, new Func[4] { (Instruction x) => x.MatchLdloc(typeof(MasterCopySpawnCard), il, out spawnCardVar), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "GummyCloneIdentifier"), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num7), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "GiveItem") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\GummyClone.cs", "GummyCloneProjectile_SpawnGummyClone", 96); return; } val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc, spawnCardVar); val.EmitDelegate>((Action)setupSpawnCard); unsafe static void setupSpawnCard(GummyCloneProjectile gummyCloneProjectile, MasterCopySpawnCard spawnCard) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_0165: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: 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_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) QualityTier qualityTier = QualityTierContext.GetQualityTier(((Component)gummyCloneProjectile).gameObject); if (qualityTier != QualityTier.None) { spawnCard.GiveItem(ItemQualitiesContent.ItemQualityGroups.QualityTier.GetItemIndex(qualityTier), 1); ProjectileController val2 = default(ProjectileController); CharacterBody val3 = default(CharacterBody); if (((Component)gummyCloneProjectile).TryGetComponent(ref val2) && Object.op_Implicit((Object)(object)val2.owner) && val2.owner.TryGetComponent(ref val3) && Object.op_Implicit((Object)(object)val3.inventory)) { Func func = _qualityItemCopyFilters[(int)qualityTier]; bool flag = qualityTier == QualityTier.Legendary; ReadOnlyArray allItemsOfQuality = QualityCatalog.GetAllItemsOfQuality(QualityTier.None); for (int i = 0; i < allItemsOfQuality.Length; i++) { ItemIndex val4 = (ItemIndex)(*(int*)allItemsOfQuality[i]); int num = 0; float num2 = 0f; for (QualityTier qualityTier2 = QualityTier.Legendary; qualityTier2 >= QualityTier.Uncommon; qualityTier2--) { ItemIndex itemIndexOfQuality = QualityCatalog.GetItemIndexOfQuality(val4, qualityTier2); if (itemIndexOfQuality != val4) { int num3 = val3.inventory.GetItemCountPermanent(itemIndexOfQuality) + num; float num4 = val3.inventory.GetTempItemRawValue(itemIndexOfQuality) + num2; if (num3 > 0 || num4 > 0f) { bool flag2 = func(itemIndexOfQuality); if (num3 > 0) { if (flag2) { num = 0; spawnCard.GiveItem(itemIndexOfQuality, (!flag) ? 1 : num3); } else { num += num3; } } if (num4 > 0f) { if (flag2) { num2 = 0f; spawnCard.srcTempItemRawValues[itemIndexOfQuality] += (flag ? num4 : Mathf.Min(num4, 1f)); } else { num2 += num4; } } } } } if (func(val4)) { int num5 = val3.inventory.GetItemCountPermanent(val4) + num; num = 0; if (num5 > 0) { spawnCard.GiveItem(val4, (!flag) ? 1 : num5); } float num6 = val3.inventory.GetTempItemRawValue(val4) + num2; num2 = 0f; if (num6 > 0f) { spawnCard.srcTempItemRawValues[val4] += (flag ? num6 : Mathf.Min(num6, 1f)); } } } } } } } private static bool uncommonItemCopyFilter(ItemIndex itemIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (QualityCatalog.GetQualityTier(itemIndex) > QualityTier.Uncommon) { return false; } ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex); if (!Object.op_Implicit((Object)(object)itemDef)) { return false; } if (itemDef.ContainsTag((ItemTag)13)) { return false; } if ((int)itemDef.tier == 0) { return true; } return false; } private static bool rareItemCopyFilter(ItemIndex itemIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 if (QualityCatalog.GetQualityTier(itemIndex) > QualityTier.Rare) { return false; } ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex); if (!Object.op_Implicit((Object)(object)itemDef)) { return false; } if (itemDef.ContainsTag((ItemTag)13)) { return false; } ItemTier tier = itemDef.tier; if ((int)tier <= 1) { return true; } return false; } private static bool epicItemCopyFilter(ItemIndex itemIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 if (QualityCatalog.GetQualityTier(itemIndex) > QualityTier.Epic) { return false; } ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex); if (!Object.op_Implicit((Object)(object)itemDef)) { return false; } if (itemDef.ContainsTag((ItemTag)13)) { return false; } ItemTier tier = itemDef.tier; if ((int)tier <= 2) { return true; } return false; } private static bool legendaryItemCopyFilter(ItemIndex itemIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex); if (!Object.op_Implicit((Object)(object)itemDef)) { return false; } if (itemDef.ContainsTag((ItemTag)13)) { return false; } return true; } } internal static class HealAndRevive { private static Xoroshiro128Plus _rng; [SystemInitializer(new Type[] { })] private static void Init() { //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 CharacterMaster.TrueKill += new hook_TrueKill(CharacterMaster_TrueKill); CharacterMaster.TryReviveOnBodyDeath += new Manipulator(CharacterMaster_TryReviveOnBodyDeath); EquipmentSlot.FireHealAndRevive += new Manipulator(EquipmentSlot_FireHealAndRevive); Run.onRunStartGlobal += onRunStartGlobal; } private static void onRunStartGlobal(Run run) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown if (NetworkServer.active) { _rng = new Xoroshiro128Plus(run.runRNG.nextUlong); } } private static void onRevivedServer(CharacterMaster master, QualityTier qualityTier) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)master) && ((Component)(object)master).TryGetComponentCached(out CharacterMasterExtraStatsTracker component)) { component.TryPermanentUpgradeRandomItemToQualityTier(_rng, qualityTier); } } private static void CharacterMaster_TrueKill(orig_TrueKill orig, CharacterMaster self) { //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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_0084: 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) if (Object.op_Implicit((Object)(object)self.inventory)) { int equipmentSlotCount = self.inventory.GetEquipmentSlotCount(); for (uint num = 0u; num < equipmentSlotCount; num++) { int equipmentSetCount = self.inventory.GetEquipmentSetCount(num); for (uint num2 = 0u; num2 < equipmentSetCount; num2++) { EquipmentIndex equipmentIndex = self.inventory.GetEquipment(num, num2).equipmentIndex; QualityTier qualityTier = QualityCatalog.GetQualityTier(equipmentIndex); if (QualityCatalog.FindEquipmentQualityGroupIndex(equipmentIndex) == ItemQualitiesContent.EquipmentQualityGroups.HealAndRevive.GroupIndex && qualityTier > QualityTier.None) { EquipmentIndex equipmentIndex2 = ItemQualitiesContent.EquipmentQualityGroups.HealAndReviveConsumed.GetEquipmentIndex(qualityTier); self.inventory.SetEquipmentIndexForSlot(equipmentIndex2, num, num2); CharacterMasterNotificationQueue.SendTransformNotification(self, equipmentIndex, equipmentIndex2, (TransformationType)0); } } } } orig.Invoke(self); } private static void CharacterMaster_TryReviveOnBodyDeath(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_00ab: 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_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILLabel afterHealAndReviveLabel = null; int num2 = default(int); if (!val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "RespawnExtraLifeHealAndRevive") }) || !val.TryGotoPrev((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num2), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref afterHealAndReviveLabel) })) { Log.Error("Failed to find HealAndRevive location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\HealAndRevive.cs", "CharacterMaster_TryReviveOnBodyDeath", 82); return; } Instruction next = val.Next; VariableDefinition val2 = il.AddVariable(); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getHealAndReviveQualityTier); val.Emit(OpCodes.Stloc, val2); int num = 0; while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => matchHealAndReviveEquipment(x) }) && val.IsBefore(afterHealAndReviveLabel.Target)) { val.Emit(OpCodes.Ldloc, val2); val.EmitDelegate>((Func)getQualityEquipment); num++; } if (num == 0) { Log.Error("Failed to find static equipment reference patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\HealAndRevive.cs", "CharacterMaster_TryReviveOnBodyDeath", 138); } val.Goto(next, (MoveType)0, false); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc, val2); val.EmitDelegate>((Action)tryQualityHealAndRevive); static QualityTier getHealAndReviveQualityTier(CharacterMaster master) { if (!Object.op_Implicit((Object)(object)master.inventory)) { return QualityTier.None; } return master.inventory.GetActiveEquipmentQualityTier(); } static EquipmentDef getQualityEquipment(EquipmentDef equipmentDef, QualityTier qualityTier) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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 (qualityTier != QualityTier.None) { EquipmentIndex val3 = (EquipmentIndex)((!Object.op_Implicit((Object)(object)equipmentDef)) ? (-1) : ((int)equipmentDef.equipmentIndex)); if ((int)val3 != -1) { EquipmentIndex equipmentIndexOfQuality = QualityCatalog.GetEquipmentIndexOfQuality(val3, qualityTier); if ((int)equipmentIndexOfQuality != -1 && equipmentIndexOfQuality != val3) { equipmentDef = EquipmentCatalog.GetEquipmentDef(equipmentIndexOfQuality); val3 = equipmentIndexOfQuality; } } } return equipmentDef; } static bool matchHealAndReviveEquipment(Instruction instr) { if (!ILPatternMatchingExt.MatchLdsfld(instr, typeof(Equipment), "HealAndRevive")) { return ILPatternMatchingExt.MatchLdsfld(instr, typeof(Equipment), "HealAndReviveConsumed"); } return true; } static void tryQualityHealAndRevive(CharacterMaster master, QualityTier qualityTier) { if (qualityTier != QualityTier.None) { ((MonoBehaviour)master).StartCoroutine(waitThenAddItemUpgrade(master, qualityTier)); } } static IEnumerator waitThenAddItemUpgrade(CharacterMaster master, QualityTier qualityTier) { yield return (object)new WaitForSeconds(2.05f); onRevivedServer(master, qualityTier); } } private static void EquipmentSlot_FireHealAndRevive(ILContext il) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) MethodInfo method = typeof(GameObject).GetMethod("AddComponent", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public, null, Array.Empty(), Array.Empty()); if (method == null || !method.IsGenericMethodDefinition) { Log.Error("Failed to find AddComponent method", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\HealAndRevive.cs", "EquipmentSlot_FireHealAndRevive", 171); return; } MethodInfo addComponentHealAndReviveLockMethod = method.MakeGenericMethod(typeof(HealAndReviveLock)); ILCursor val = new ILCursor(il); VariableDefinition revivedMasterVar = null; if (val.TryGotoNext((MoveType)2, new Func[4] { (Instruction x) => x.MatchLdloc(il, out revivedMasterVar), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "get_gameObject"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)addComponentHealAndReviveLockMethod), (Instruction x) => ILPatternMatchingExt.MatchPop(x) })) { val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc, revivedMasterVar); val.EmitDelegate>((Action)tryQualityHealAndRevive); } else { Log.Error("Failed to find revive patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\HealAndRevive.cs", "EquipmentSlot_FireHealAndRevive", 207); } val.Goto(0, (MoveType)0, false); ILLabel afterHealAndReviveConsumeLabel = null; if (val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "SendTransformNotification") }) && val.TryGotoPrev((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref afterHealAndReviveConsumeLabel) })) { int num = 0; while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => matchHealAndReviveEquipment(x) }) && val.IsBefore(afterHealAndReviveConsumeLabel.Target)) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getQualityEquipment); num++; } if (num == 0) { Log.Error("Failed to find consume equipment reference patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\HealAndRevive.cs", "EquipmentSlot_FireHealAndRevive", 258); } } else { Log.Error("Failed to find consume patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\HealAndRevive.cs", "EquipmentSlot_FireHealAndRevive", 267); } static EquipmentDef getQualityEquipment(EquipmentDef equipmentDef, EquipmentSlot equipmentSlot) { //IL_0017: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Invalid comparison between Unknown and I4 //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) QualityTier currentEquipmentActionQualityTier = equipmentSlot.GetCurrentEquipmentActionQualityTier(); if (currentEquipmentActionQualityTier != QualityTier.None) { EquipmentIndex val2 = (EquipmentIndex)((!Object.op_Implicit((Object)(object)equipmentDef)) ? (-1) : ((int)equipmentDef.equipmentIndex)); if ((int)val2 != -1) { EquipmentIndex equipmentIndexOfQuality = QualityCatalog.GetEquipmentIndexOfQuality(val2, currentEquipmentActionQualityTier); if ((int)equipmentIndexOfQuality != -1 && equipmentIndexOfQuality != val2) { equipmentDef = EquipmentCatalog.GetEquipmentDef(equipmentIndexOfQuality); val2 = equipmentIndexOfQuality; } } } return equipmentDef; } static bool matchHealAndReviveEquipment(Instruction instr) { if (!ILPatternMatchingExt.MatchLdsfld(instr, typeof(Equipment), "HealAndRevive")) { return ILPatternMatchingExt.MatchLdsfld(instr, typeof(Equipment), "HealAndReviveConsumed"); } return true; } static void tryQualityHealAndRevive(EquipmentSlot equipmentSlot, CharacterMaster revivedMaster) { QualityTier currentEquipmentActionQualityTier2 = equipmentSlot.GetCurrentEquipmentActionQualityTier(); if (currentEquipmentActionQualityTier2 != QualityTier.None) { ((MonoBehaviour)revivedMaster).StartCoroutine(waitThenAddItemUpgrade(revivedMaster, currentEquipmentActionQualityTier2)); } } static IEnumerator waitThenAddItemUpgrade(CharacterMaster master, QualityTier qualityTier) { yield return (object)new WaitForSeconds(0.15f); onRevivedServer(master, qualityTier); } } } internal static class HealAndReviveConsumed { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown EquipmentSlot.FireSproutOfLife += new hook_FireSproutOfLife(EquipmentSlot_FireSproutOfLife); } private static bool EquipmentSlot_FireSproutOfLife(orig_FireSproutOfLife orig, EquipmentSlot self) { //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) bool flag = orig.Invoke(self); if (flag && self.sproutIsSpawned && Object.op_Implicit((Object)(object)self.sprout)) { QualityTier currentEquipmentActionQualityTier = self.GetCurrentEquipmentActionQualityTier(); if (currentEquipmentActionQualityTier != QualityTier.None) { SproutOfLifeHealOrbSpawn val = default(SproutOfLifeHealOrbSpawn); if (self.sprout.TryGetComponent(ref val)) { float num; switch (currentEquipmentActionQualityTier) { case QualityTier.Uncommon: num = 1f; break; case QualityTier.Rare: num = 2f; break; case QualityTier.Epic: num = 5f; break; case QualityTier.Legendary: num = 10f; break; default: num = 0f; Log.Warning($"Quality tier {currentEquipmentActionQualityTier} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\HealAndReviveConsumed.cs", "EquipmentSlot_FireSproutOfLife", 44); break; } if (num > 0f) { SproutOfLifeHealOrbSpawn obj = val; obj.seedOfLifeOrbsLeft += num * 2f; } } GameObject obj2 = Object.Instantiate(ItemQualitiesContent.NetworkedPrefabs.HealAndReviveSproutAttachment, self.sprout.transform); obj2.GetComponent().HealTarget = self.characterBody; TeamIndex teamIndex = self.characterBody.teamComponent.teamIndex; obj2.GetComponent().teamIndex = teamIndex; obj2.GetComponent().Attacker = self.characterBody; NetworkServer.Spawn(obj2); } } return flag; } } internal static class Jetpack { private static DamageColorIndex _bugColorIndex; [SystemInitializer(new Type[] { })] private static void Init() { //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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown _bugColorIndex = ColorsAPI.RegisterDamageColor(Color32.op_Implicit(new Color32((byte)147, (byte)138, (byte)113, byte.MaxValue))); AsyncOperationHandle handle = AddressableUtil.LoadAssetAsync(RoR2_Base_Jetpack.JetpackController_prefab, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(GameObject jetpackAttachment) { UnityObjectExtensions.EnsureComponent(jetpackAttachment); }); EquipmentSlot.FireJetpack += new hook_FireJetpack(EquipmentSlot_FireJetpack); GlobalEventManager.onServerDamageDealt += onServerDamageDealt; } private static bool EquipmentSlot_FireJetpack(orig_FireJetpack orig, EquipmentSlot self) { bool num = orig.Invoke(self); if (num) { JetpackController val = JetpackController.FindJetpackController(((Component)self).gameObject); JetpackQualityController jetpackQualityController = default(JetpackQualityController); if (Object.op_Implicit((Object)(object)val) && ((Component)val).TryGetComponent(ref jetpackQualityController)) { jetpackQualityController.ActiveQualityTier = self.GetCurrentEquipmentActionQualityTier(); } } return num; } private static void onServerDamageDealt(DamageReport damageReport) { //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) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Invalid comparison between Unknown and I4 //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) if (damageReport?.damageInfo == null || damageReport.damageDealt <= 0f || damageReport.damageInfo.procCoefficient <= 0f || !Object.op_Implicit((Object)(object)damageReport.attackerBody) || !Object.op_Implicit((Object)(object)damageReport.victimBody) || !Object.op_Implicit((Object)(object)damageReport.victimBody.mainHurtBox)) { return; } BuffQualityCounts buffCounts = damageReport.attackerBody.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.BugBlock); if (buffCounts.TotalQualityCount <= 0 || ProcTypeAPI.HasModdedProc(damageReport.damageInfo.procChainMask, ProcTypes.Bug)) { return; } QualityTier highestQuality = buffCounts.HighestQuality; float num; switch (highestQuality) { case QualityTier.Uncommon: num = 0.8f; break; case QualityTier.Rare: num = 1.2f; break; case QualityTier.Epic: num = 1.6f; break; case QualityTier.Legendary: num = 2f; break; default: num = 0f; Log.Warning($"Quality tier {highestQuality} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Jetpack.cs", "onServerDamageDealt", 79); break; } if (num > 0f) { ProcChainMask procChainMask = damageReport.damageInfo.procChainMask; ProcTypeAPI.AddModdedProc(ref procChainMask, ProcTypes.Bug); int num2 = (Object.op_Implicit((Object)(object)damageReport.attackerBody.inventory) ? damageReport.attackerBody.inventory.GetItemCountEffective(Items.MoreMissile) : 0); float damageValue = Util.OnHitProcDamage(damageReport.damageInfo.damage, damageReport.attackerBody.damage, num) * MissileUtils.GetMoreMissileDamageMultiplier(num2); int num3 = ((num2 <= 0) ? 1 : 3); num3 += MoreMissile.RollAdditionalMissileCount(damageReport.attackerBody, ((ProcChainMask)(ref procChainMask)).HasProc((ProcType)26)); for (int i = 0; i < num3; i++) { OrbManager.instance.AddOrb((Orb)(object)new BugOrb { attacker = damageReport.attacker, origin = damageReport.attackerBody.aimOrigin, teamIndex = damageReport.attackerBody.teamComponent.teamIndex, target = damageReport.victimBody.mainHurtBox, damageValue = damageValue, procChainMask = procChainMask, procCoefficient = 0.2f, isCrit = damageReport.damageInfo.crit, damageColorIndex = _bugColorIndex }); } } BuffIndex buffIndex = ItemQualitiesContent.BuffQualityGroups.BugBlock.GetBuffIndex(highestQuality); if ((int)buffIndex != -1) { damageReport.attackerBody.RemoveBuff(buffIndex); } } } [RequireComponent(typeof(NetworkedBodyAttachment))] public sealed class JetpackQualityController : MonoBehaviour { private NetworkedBodyAttachment _bodyAttachment; private int _bugsPerPickup; private float _pickupSpawnInterval; private float _pickupSpawnTimer; private QualityTier _activeQualityTier = QualityTier.None; public QualityTier ActiveQualityTier { get { return _activeQualityTier; } set { if (_activeQualityTier != value) { _activeQualityTier = value; switch (_activeQualityTier) { case QualityTier.Uncommon: _bugsPerPickup = 2; _pickupSpawnInterval = 4f; break; case QualityTier.Rare: _bugsPerPickup = 3; _pickupSpawnInterval = 4f; break; case QualityTier.Epic: _bugsPerPickup = 4; _pickupSpawnInterval = 3f; break; case QualityTier.Legendary: _bugsPerPickup = 5; _pickupSpawnInterval = 3f; break; default: Log.Warning($"Quality tier {_activeQualityTier} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\JetpackQualityController.cs", "ActiveQualityTier", 50); break; case QualityTier.None: break; } } } } private void Awake() { _bodyAttachment = ((Component)this).GetComponent(); } private void FixedUpdate() { if (NetworkServer.active && _activeQualityTier != QualityTier.None) { _pickupSpawnTimer += Time.fixedDeltaTime; if (_pickupSpawnTimer >= _pickupSpawnInterval) { _pickupSpawnTimer = 0f; trySpawnNearbyPickup(); } } } private void trySpawnNearbyPickup() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_013d: 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_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: 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_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_bodyAttachment)) { return; } CharacterBody attachedBody = _bodyAttachment.attachedBody; if (!Object.op_Implicit((Object)(object)attachedBody)) { return; } IPhysMotor obj; if (!Object.op_Implicit((Object)(object)attachedBody.characterMotor)) { obj = ((Component)attachedBody).GetComponent(); } else { IPhysMotor characterMotor = (IPhysMotor)(object)attachedBody.characterMotor; obj = characterMotor; } IPhysMotor val = obj; Vector3 val2 = attachedBody.transform.forward; Vector3 val3; if (val != null) { val3 = val.velocity; if (((Vector3)(ref val3)).sqrMagnitude > Mathf.Epsilon) { val3 = val.velocity; val2 = ((Vector3)(ref val3)).normalized; goto IL_00bd; } } if (Object.op_Implicit((Object)(object)attachedBody.characterDirection)) { val2 = ((!(((Vector3)(ref attachedBody.characterDirection.moveVector)).sqrMagnitude > Mathf.Epsilon)) ? attachedBody.characterDirection.forward : ((Vector3)(ref attachedBody.characterDirection.moveVector)).normalized); } goto IL_00bd; IL_00bd: float num = Mathf.Max(2f, attachedBody.bestFitActualRadius); Ray val6 = default(Ray); RaycastHit val7 = default(RaycastHit); for (int i = 0; i < 10; i++) { Vector3 val4 = attachedBody.corePosition; Vector3 val5 = val2; for (int j = 0; j < 4; j++) { val5 = Quaternion.Euler(Random.Range(-30f, 30f), Random.Range(-45f, 45f), 0f) * val5; float value = Random.value; value *= value; float num2 = Mathf.Lerp(6.25f, 12.5f, value); ((Ray)(ref val6))..ctor(val4, val5); Vector3 val8; Vector3 val9; if (Physics.SphereCast(val6, num, ref val7, num2, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { val8 = ((RaycastHit)(ref val7)).point - ((Ray)(ref val6)).direction * num; val9 = Vector3.Reflect(val5, ((RaycastHit)(ref val7)).normal); } else { val8 = ((Ray)(ref val6)).GetPoint(num2 - num); val9 = val5; } val4 = val8; val5 = val9; } val3 = val4 - attachedBody.corePosition; if (((Vector3)(ref val3)).sqrMagnitude > 64f) { for (int k = 0; k < _bugsPerPickup; k++) { GameObject obj2 = Object.Instantiate(ItemQualitiesContent.NetworkedPrefabs.BugPickup, val4, Quaternion.Euler(0f, Random.Range(0f, 360f), 0f)); obj2.GetComponent().teamIndex = attachedBody.teamComponent.teamIndex; obj2.GetComponentInChildren().Tier = _activeQualityTier; NetworkServer.Spawn(obj2); } break; } } } } internal static class LifestealOnHit { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown EquipmentSlot.FireLifeStealOnHit += new Manipulator(EquipmentSlot_FireLifeStealOnHit); } private static void EquipmentSlot_FireLifeStealOnHit(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "LifeSteal") })) { Log.Error("Failed to find buff patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\LifestealOnHit.cs", "EquipmentSlot_FireLifeStealOnHit", 24); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getBuffDef); float num = default(float); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num) })) { Log.Error("Failed to find duration patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\LifestealOnHit.cs", "EquipmentSlot_FireLifeStealOnHit", 52); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getBuffDuration); static BuffDef getBuffDef(BuffDef buffDef, EquipmentSlot equipmentSlot) { //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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 //IL_0029: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) BuffIndex val2 = (BuffIndex)((!Object.op_Implicit((Object)(object)buffDef)) ? (-1) : ((int)buffDef.buffIndex)); QualityTier currentEquipmentActionQualityTier2 = equipmentSlot.GetCurrentEquipmentActionQualityTier(); if (currentEquipmentActionQualityTier2 > QualityTier.None) { BuffIndex buffIndexOfQuality = QualityCatalog.GetBuffIndexOfQuality(val2, currentEquipmentActionQualityTier2); if ((int)buffIndexOfQuality != -1 && buffIndexOfQuality != val2) { buffDef = BuffCatalog.GetBuffDef(buffIndexOfQuality); val2 = buffIndexOfQuality; } } return buffDef; } static float getBuffDuration(float duration, EquipmentSlot equipmentSlot) { QualityTier currentEquipmentActionQualityTier = equipmentSlot.GetCurrentEquipmentActionQualityTier(); switch (currentEquipmentActionQualityTier) { case QualityTier.Uncommon: duration += 2f; break; case QualityTier.Rare: duration += 4f; break; case QualityTier.Epic: duration += 8f; break; case QualityTier.Legendary: duration += 17f; break; default: Log.Warning($"Quality tier {currentEquipmentActionQualityTier} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\LifestealOnHit.cs", "EquipmentSlot_FireLifeStealOnHit", 79); break; case QualityTier.None: break; } return duration; } } } internal static class Lightning { private sealed class LightningOrbQualityInfo { public QualityTier QualityTier = QualityTier.None; public int BouncesRemaining; public void CopyTo(LightningOrbQualityInfo other) { other.QualityTier = QualityTier; other.BouncesRemaining = BouncesRemaining; } } private static readonly FixedConditionalWeakTable _lightningOrbQualityInfoLookup = new FixedConditionalWeakTable(); [SystemInitializer(new Type[] { })] private static void Init() { //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 EquipmentSlot.FireLightning += new Manipulator(EquipmentSlot_FireLightning); LightningStrikeOrb.OnArrival += new hook_OnArrival(LightningStrikeOrb_OnArrival); } private static void EquipmentSlot_FireLightning(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0050: 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) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchNewobj(x) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Lightning.cs", "EquipmentSlot_FireLightning", 43); return; } val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Action)setOrbQualityTier); static void setOrbQualityTier(LightningStrikeOrb lightningStrikeOrb, EquipmentSlot equipmentSlot) { if (lightningStrikeOrb != null && Object.op_Implicit((Object)(object)equipmentSlot)) { QualityTier currentEquipmentActionQualityTier = equipmentSlot.GetCurrentEquipmentActionQualityTier(); float percentChance; switch (currentEquipmentActionQualityTier) { case QualityTier.None: _lightningOrbQualityInfoLookup.Remove(lightningStrikeOrb); return; case QualityTier.Uncommon: percentChance = 50f; break; case QualityTier.Rare: percentChance = 120f; break; case QualityTier.Epic: percentChance = 220f; break; case QualityTier.Legendary: percentChance = 400f; break; default: percentChance = 0f; Log.Warning($"Quality tier {currentEquipmentActionQualityTier} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Lightning.cs", "EquipmentSlot_FireLightning", 80); break; } CharacterMaster master = (Object.op_Implicit((Object)(object)equipmentSlot.characterBody) ? equipmentSlot.characterBody.master : null); LightningOrbQualityInfo orCreateValue = _lightningOrbQualityInfoLookup.GetOrCreateValue(lightningStrikeOrb); orCreateValue.QualityTier = currentEquipmentActionQualityTier; orCreateValue.BouncesRemaining = RollUtil.GetOverflowRoll(percentChance, master, sureProc: false); } } } private static void LightningStrikeOrb_OnArrival(orig_OnArrival orig, LightningStrikeOrb self) { orig.Invoke(self); LightningOrbQualityInfo lightningOrbQualityInfo = default(LightningOrbQualityInfo); if (_lightningOrbQualityInfoLookup.TryGetValue(self, ref lightningOrbQualityInfo)) { if (lightningOrbQualityInfo.BouncesRemaining > 0 && Object.op_Implicit((Object)(object)((Orb)self).target)) { lightningOrbQualityInfo.BouncesRemaining--; OrbManager.instance.AddOrb((Orb)(object)self); } else { _lightningOrbQualityInfoLookup.Remove(self); } } } } internal static class Molotov { private static readonly GameObject[] _qualityMolotovClusterProjectilePrefabs = (GameObject[])(object)new GameObject[4]; [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle handle = AddressableUtil.LoadTempAssetAsync(RoR2_DLC1_Molotov.MolotovClusterProjectile_prefab); handle.OnSuccess(delegate(GameObject molotovClusterProjectilePrefab) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) List list = default(List); DisposableRental> val = CollectionPool>.RentCollection(ref list); try { ProjectileController val3 = default(ProjectileController); ProjectileSimple val4 = default(ProjectileSimple); ProjectileImpactExplosion val5 = default(ProjectileImpactExplosion); ProjectileController val7 = default(ProjectileController); ProjectileSimple val8 = default(ProjectileSimple); ProjectileImpactExplosion val9 = default(ProjectileImpactExplosion); ProjectileDotZone val11 = default(ProjectileDotZone); for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { GameObject val2 = PrefabAPI.InstantiateClone(molotovClusterProjectilePrefab, ((Object)molotovClusterProjectilePrefab).name + qualityTier); float num = qualityTier switch { QualityTier.Uncommon => 1.6f, QualityTier.Rare => 2f, QualityTier.Epic => 3f, QualityTier.Legendary => 4f, _ => throw new NotImplementedException($"Quality tier {qualityTier} is not implemented"), }; if (val2.TryGetComponent(ref val3)) { val3.ghostPrefab = PrefabAPI.InstantiateClone(val3.ghostPrefab, ((Object)val3.ghostPrefab).name + qualityTier, false); Transform transform = val3.ghostPrefab.transform; transform.localScale *= num; } else { Log.Warning($"Expected ProjectileController component on {val2}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Molotov.cs", "LoadContent", 51); } if (val2.TryGetComponent(ref val4)) { ProjectileSimple obj = val4; obj.desiredForwardSpeed *= (num - 1f) / 5f + 1f; } else { Log.Warning($"Expected ProjectileSimple component on {val2}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Molotov.cs", "LoadContent", 60); } if (val2.TryGetComponent(ref val5)) { ProjectileImpactExplosion obj2 = val5; ((ProjectileExplosion)obj2).childrenCount = (int)(((ProjectileExplosion)obj2).childrenCount + (qualityTier + 1)); GameObject val6 = (((ProjectileExplosion)val5).childrenProjectilePrefab = PrefabAPI.InstantiateClone(((ProjectileExplosion)val5).childrenProjectilePrefab, ((Object)((ProjectileExplosion)val5).childrenProjectilePrefab).name + qualityTier)); if (val6.TryGetComponent(ref val7)) { val7.ghostPrefab = PrefabAPI.InstantiateClone(val7.ghostPrefab, ((Object)val7.ghostPrefab).name + qualityTier, false); Transform transform2 = val7.ghostPrefab.transform; transform2.localScale *= num; } else { Log.Warning($"Expected ProjectileController component on {val6}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Molotov.cs", "LoadContent", 77); } if (val6.TryGetComponent(ref val8)) { ProjectileSimple obj3 = val8; obj3.desiredForwardSpeed *= (num - 1f) / 5f + 1f; } else { Log.Warning($"Expected ProjectileSimple component on {val6}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Molotov.cs", "LoadContent", 86); } if (val6.TryGetComponent(ref val9)) { GameObject val10 = (((ProjectileExplosion)val9).childrenProjectilePrefab = PrefabAPI.InstantiateClone(((ProjectileExplosion)val9).childrenProjectilePrefab, ((Object)((ProjectileExplosion)val9).childrenProjectilePrefab).name + qualityTier)); float num2 = 0f; if (val10.TryGetComponent(ref val11)) { ProjectileDotZone val12; float damageCoefficient = (val12 = val11).damageCoefficient; val12.damageCoefficient = damageCoefficient + qualityTier switch { QualityTier.Uncommon => 0.5f, QualityTier.Rare => 1f, QualityTier.Epic => 2f, QualityTier.Legendary => 3f, _ => throw new NotImplementedException($"Quality tier {qualityTier} is not implemented"), }; num2 = val11.lifetime; } else { Log.Warning($"Expected ProjectileDotZone component on {val10}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Molotov.cs", "LoadContent", 111); } Transform val13 = val10.transform.Find("FX"); if (Object.op_Implicit((Object)(object)val13)) { Transform transform3 = ((Component)val13).transform; transform3.localScale *= num; ObjectScaleCurve obj4 = ((Component)val13).gameObject.AddComponent(); obj4.timeMax = num2 + 0.5f; obj4.useOverallCurveOnly = true; ObjectScaleCurve val14 = obj4; val14.overallCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, qualityTier switch { QualityTier.Uncommon => 1.5f, QualityTier.Rare => 2f, QualityTier.Epic => 2.5f, QualityTier.Legendary => 3f, _ => throw new NotImplementedException($"Quality tier {qualityTier} is not implemented"), }); } else { Log.Warning($"Failed to find FX child on {val10}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Molotov.cs", "LoadContent", 133); } list.Add(val10); } else { Log.Warning($"Expected ProjectileImpactExplosion component on {val6}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Molotov.cs", "LoadContent", 140); } list.Add(val6); } else { Log.Warning($"Expected ProjectileImpactExplosion component on {val2}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Molotov.cs", "LoadContent", 147); } list.Add(val2); _qualityMolotovClusterProjectilePrefabs[(int)qualityTier] = val2; } if (list.Count > 0) { args.ContentPack.projectilePrefabs.Add(list.ToArray()); } } finally { val.Dispose(); } }); return handle.AsProgressCoroutine>(args.ProgressReceiver); } [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown EquipmentSlot.FireMolotov += new Manipulator(EquipmentSlot_FireMolotov); } private static void EquipmentSlot_FireMolotov(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Prefabs/Projectiles/MolotovClusterProjectile"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(LegacyResourcesAPI), "Load") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Molotov.cs", "EquipmentSlot_FireMolotov", 178); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getProjectilePrefab); static GameObject getProjectilePrefab(GameObject prefab, EquipmentSlot equipmentSlot) { QualityTier currentEquipmentActionQualityTier = equipmentSlot.GetCurrentEquipmentActionQualityTier(); GameObject safe = ArrayUtils.GetSafe(_qualityMolotovClusterProjectilePrefabs, (int)currentEquipmentActionQualityTier); if (!Object.op_Implicit((Object)(object)safe)) { return prefab; } return safe; } } } internal static class MultiShopCard { private static readonly InteractableSearch _sharedInteractableSearch = new InteractableSearch { requireCanCopy = true, requireSpawnCard = true, forbidDuplicated = true }; private static readonly float _interactableSearchMinDistance = 0f; private static readonly float _interactableSearchMaxDistance = 15f; private static readonly float _interactableSearchMinAngle = 0f; private static readonly float _interactableSearchMaxAngle = 12.5f; private static readonly bool _interactableSearchFilterByLoS = false; private static readonly bool _interactableSearchFilterByDistinctEntity = true; private static readonly SortMode _interactableSearchSortMode = (SortMode)2; [SystemInitializer(new Type[] { })] private static void Init() { //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 EquipmentSlot.UpdateTargets += new Manipulator(EquipmentSlot_UpdateTargets); EquipmentSlot.PerformEquipmentAction += new hook_PerformEquipmentAction(EquipmentSlot_PerformEquipmentAction); EquipmentIcon.SetDisplayData += new Manipulator(EquipmentIcon_SetDisplayData); SummonMasterBehavior.OnEquipmentSpentOnPurchase += new Manipulator(SummonMasterBehavior_OnEquipmentSpentOnPurchase); SceneDirector.onPostPopulateSceneServer += onPostPopulateSceneServer; } private static void onPostPopulateSceneServer(SceneDirector sceneDirector) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_00bd: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Expected O, but got Unknown //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Expected O, but got Unknown if (!SceneInfo.instance.countsAsStage && !SceneInfo.instance.sceneDef.allowItemsToSpawnObjects) { return; } Xoroshiro128Plus val = new Xoroshiro128Plus(sceneDirector.rng.nextUlong); foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { if (readOnlyInstances.inventory.GetEquipmentDisabled() || !((Component)(object)readOnlyInstances).TryGetComponentCached(out CharacterMasterExtraStatsTracker component) || component.CardStoredInteractableInfo.InteractableIndex == -1) { continue; } StoredInteractableInfo storedInteractableInfo = component.CardStoredInteractableInfo; QualityTier qualityTier = QualityTier.None; int equipmentSlotCount = readOnlyInstances.inventory.GetEquipmentSlotCount(); for (uint num = 0u; num < equipmentSlotCount; num++) { int equipmentSetCount = readOnlyInstances.inventory.GetEquipmentSetCount(num); for (uint num2 = 0u; num2 < equipmentSetCount; num2++) { EquipmentState equipment = readOnlyInstances.inventory.GetEquipment(num, num2); if (QualityCatalog.FindEquipmentQualityGroupIndex(equipment.equipmentIndex) == ItemQualitiesContent.EquipmentQualityGroups.MultiShopCard.GroupIndex) { QualityTier qualityTier2 = QualityCatalog.GetQualityTier(equipment.equipmentIndex); if (qualityTier2 > qualityTier) { qualityTier = qualityTier2; } } } } if (qualityTier > QualityTier.None) { InteractableDef interactableDef = InteractableCatalog.GetInteractableDef(storedInteractableInfo.InteractableIndex); float percentChance; switch (qualityTier) { case QualityTier.Uncommon: percentChance = 100f; break; case QualityTier.Rare: percentChance = 130f; break; case QualityTier.Epic: percentChance = 180f; break; case QualityTier.Legendary: percentChance = 220f; break; default: percentChance = 100f; Log.Warning($"Quality tier {qualityTier} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\MultiShopCard.cs", "onPostPopulateSceneServer", 105); break; } int overflowRoll = RollUtil.GetOverflowRoll(percentChance, val); for (int i = 0; i < overflowRoll; i++) { DirectorSpawnRequest val2 = new DirectorSpawnRequest((SpawnCard)(object)interactableDef.SpawnCard, new DirectorPlacementRule { placementMode = (PlacementMode)4 }, val); val2.onSpawnedServer = (Action)Delegate.Combine(val2.onSpawnedServer, new Action(onSpawnedServer)); DirectorCore.instance.TrySpawnObject(val2); } } component.NetworkCardStoredInteractableInfo = StoredInteractableInfo.None; void onSpawnedServer(SpawnResult spawnResult) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) if (spawnResult.success && Object.op_Implicit((Object)(object)spawnResult.spawnedInstance)) { PurchaseInteraction val3 = default(PurchaseInteraction); if (spawnResult.spawnedInstance.TryGetComponent(ref val3) && (int)val3.costType == 1 && !val3.automaticallyScaleCostWithDifficulty) { val3.Networkcost = Run.instance.GetDifficultyScaledCost(val3.cost); } SummonMasterBehavior val4 = default(SummonMasterBehavior); if (spawnResult.spawnedInstance.TryGetComponent(ref val4)) { val4.NetworkdroneUpgradeCount = storedInteractableInfo.UpgradeValue; } InteractableInfoProvider interactableInfoProvider = default(InteractableInfoProvider); if (spawnResult.spawnedInstance.TryGetComponent(ref interactableInfoProvider)) { interactableInfoProvider.Duplicated = true; } EffectData val5 = new EffectData { origin = spawnResult.spawnedInstance.transform.position }; val5.SetNetworkedObjectReference(spawnResult.spawnedInstance); EffectManager.SpawnEffect(ItemQualitiesContent.Prefabs.DuplicatedInteractableEffect, val5, true); } } } } private static void EquipmentSlot_UpdateTargets(ILContext il) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_00f1: 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_012c: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter("targetingEquipmentIndex", out var parameter)) { Log.Error("Failed to find 'targetingEquipmentIndex' parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\MultiShopCard.cs", "EquipmentSlot_UpdateTargets", 169); return; } ILCursor c = new ILCursor(il); if (c.TryGotoNext((MoveType)1, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdflda(x, "currentTarget"), (Instruction x) => ILPatternMatchingExt.MatchInitobj(x) })) { ILLabel setTargetIfElseEndLabel = null; if (c.Clone().TryGotoPrev(new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchBr(x, ref setTargetIfElseEndLabel) && c.IsBefore(setTargetIfElseEndLabel.Target) })) { c.Emit(OpCodes.Ldarg_0); c.Emit(OpCodes.Ldarg, parameter); c.EmitDelegate>((Func)trySetInteractableTarget); c.Emit(OpCodes.Brtrue, (object)setTargetIfElseEndLabel); } else { Log.Error("Failed to find target if-else end location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\MultiShopCard.cs", "EquipmentSlot_UpdateTargets", 228); } } else { Log.Error("Failed to find target patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\MultiShopCard.cs", "EquipmentSlot_UpdateTargets", 233); } static bool trySetInteractableTarget(EquipmentSlot equipmentSlot, EquipmentIndex targetingEquipmentIndex) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) if (equipmentSlot.GetActiveEquipmentQualityTier() == QualityTier.None) { return false; } if (QualityCatalog.FindEquipmentQualityGroupIndex(targetingEquipmentIndex) != ItemQualitiesContent.EquipmentQualityGroups.MultiShopCard.GroupIndex) { return false; } Ray val = equipmentSlot.GetAimRay(); float num = default(float); val = CameraRigController.ModifyAimRayIfApplicable(val, ((Component)equipmentSlot).gameObject, ref num); ((BaseDirectionalSearch)_sharedInteractableSearch).searchOrigin = ((Ray)(ref val)).origin; ((BaseDirectionalSearch)_sharedInteractableSearch).searchDirection = ((Ray)(ref val)).direction; ((BaseDirectionalSearch)_sharedInteractableSearch).minAngleFilter = _interactableSearchMinAngle; ((BaseDirectionalSearch)_sharedInteractableSearch).maxAngleFilter = _interactableSearchMaxAngle; ((BaseDirectionalSearch)_sharedInteractableSearch).minDistanceFilter = _interactableSearchMinDistance; ((BaseDirectionalSearch)_sharedInteractableSearch).maxDistanceFilter = _interactableSearchMaxDistance + num; ((BaseDirectionalSearch)_sharedInteractableSearch).filterByLoS = _interactableSearchFilterByLoS; ((BaseDirectionalSearch)_sharedInteractableSearch).filterByDistinctEntity = _interactableSearchFilterByDistinctEntity; ((BaseDirectionalSearch)_sharedInteractableSearch).sortMode = _interactableSearchSortMode; InteractableInfoProvider interactableInfoProvider = ((BaseDirectionalSearch)_sharedInteractableSearch).SearchCandidatesForSingleTarget>(InstanceTracker.GetInstancesList()); equipmentSlot.currentTarget = new UserTargetInfo { rootObject = (Object.op_Implicit((Object)(object)interactableInfoProvider) ? ((Component)interactableInfoProvider).gameObject : null), transformToIndicateAt = (Object.op_Implicit((Object)(object)interactableInfoProvider) ? interactableInfoProvider.IndicatorTransform : null) }; return true; } } private static bool EquipmentSlot_PerformEquipmentAction(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) bool flag = orig.Invoke(self, equipmentDef); try { if (!flag && (Object)(object)equipmentDef == (Object)(object)Equipment.MultiShopCard && self.GetCurrentEquipmentActionQualityTier() > QualityTier.None && Object.op_Implicit((Object)(object)self.characterBody) && Object.op_Implicit((Object)(object)self.characterBody.master) && ((Component)(object)self.characterBody.master).TryGetComponentCached(out CharacterMasterExtraStatsTracker component)) { self.UpdateTargets(Equipment.MultiShopCard.equipmentIndex, false); GameObject rootObject = self.currentTarget.rootObject; InteractableInfoProvider interactableInfoProvider = default(InteractableInfoProvider); if (Object.op_Implicit((Object)(object)rootObject) && rootObject.TryGetComponent(ref interactableInfoProvider)) { StoredInteractableInfo storedInteractableInfo = default(StoredInteractableInfo); storedInteractableInfo.InteractableIndex = interactableInfoProvider.CatalogIndex; StoredInteractableInfo left = storedInteractableInfo; SummonMasterBehavior val = default(SummonMasterBehavior); if (rootObject.TryGetComponent(ref val)) { left.UpgradeValue = val.droneUpgradeCount; } if (left != component.CardStoredInteractableInfo) { component.NetworkCardStoredInteractableInfo = left; PointSoundManager.EmitSoundServer(ItemQualitiesContent.NetworkSoundEvents.DuplicateInteractable.index, interactableInfoProvider.IndicatorTransform.position); flag = true; } } } } catch (Exception ex) { Log.Warning_NoCallerPrefix(ex.ToString()); } return flag; } private static void EquipmentIcon_SetDisplayData(ILContext il) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find DisplayData parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\MultiShopCard.cs", "EquipmentIcon_SetDisplayData", 290); return; } ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "bodyColor") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\MultiShopCard.cs", "EquipmentIcon_SetDisplayData", 299); return; } val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Action)setupTooltipProvider); static void setupTooltipProvider(EquipmentIcon equipmentIcon, DisplayData displayData) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Invalid comparison between Unknown and I4 //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)equipmentIcon) && Object.op_Implicit((Object)(object)equipmentIcon.tooltipProvider)) { bool flag = false; EquipmentIndex val2 = (EquipmentIndex)((!Object.op_Implicit((Object)(object)displayData.equipmentDef)) ? (-1) : ((int)displayData.equipmentDef.equipmentIndex)); if ((int)val2 != -1 && QualityCatalog.GetQualityTier(val2) != QualityTier.None && QualityCatalog.FindEquipmentQualityGroupIndex(val2) == ItemQualitiesContent.EquipmentQualityGroups.MultiShopCard.GroupIndex) { Inventory targetInventory = equipmentIcon.targetInventory; if (Object.op_Implicit((Object)(object)targetInventory) && ((Component)(object)targetInventory).TryGetComponentCached(out CharacterMasterExtraStatsTracker component) && component.CardStoredInteractableInfo.InteractableIndex != -1) { flag = true; } } bool flag2 = Object.op_Implicit((Object)(object)equipmentIcon.tooltipProvider.extraUIDisplayPrefab); if (flag != flag2) { if (flag) { equipmentIcon.tooltipProvider.extraUIDisplayPrefab = ItemQualitiesContent.Prefabs.MultiShopCardTooltipContext; } else if ((Object)(object)equipmentIcon.tooltipProvider.extraUIDisplayPrefab == (Object)(object)ItemQualitiesContent.Prefabs.MultiShopCardTooltipContext) { equipmentIcon.tooltipProvider.extraUIDisplayPrefab = null; } } } } } private static void SummonMasterBehavior_OnEquipmentSpentOnPurchase(ILContext il) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { Log.Error("Failed to find interactor parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\MultiShopCard.cs", "SummonMasterBehavior_OnEquipmentSpentOnPurchase", 350); return; } if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter2)) { Log.Error("Failed to find equipmentIndex parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\MultiShopCard.cs", "SummonMasterBehavior_OnEquipmentSpentOnPurchase", 356); return; } ILCursor val = new ILCursor(il); VariableDefinition summonedMasterVar = null; if (!val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "OpenSummonReturnMaster"), (Instruction x) => x.MatchStloc(il, out summonedMasterVar) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\MultiShopCard.cs", "SummonMasterBehavior_OnEquipmentSpentOnPurchase", 367); return; } val.Emit(OpCodes.Ldarg, parameter); val.Emit(OpCodes.Ldloc, summonedMasterVar); val.Emit(OpCodes.Ldarg, parameter2); val.EmitDelegate>((Action)tryTransferQualityData); static void tryTransferQualityData(Interactor interactor, CharacterMaster summonedMaster, EquipmentIndex equipmentIndex) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)interactor) && Object.op_Implicit((Object)(object)summonedMaster) && QualityCatalog.FindEquipmentQualityGroupIndex(equipmentIndex) == ItemQualitiesContent.EquipmentQualityGroups.MultiShopCard.GroupIndex && ((Component)(object)summonedMaster).TryGetComponentCached(out CharacterMasterExtraStatsTracker component)) { CharacterBody component2 = ((Component)interactor).GetComponent(); CharacterMaster val2 = (Object.op_Implicit((Object)(object)component2) ? component2.master : null); if (Object.op_Implicit((Object)(object)val2) && ((Component)(object)val2).TryGetComponentCached(out CharacterMasterExtraStatsTracker component3)) { component.NetworkCardStoredInteractableInfo = component3.CardStoredInteractableInfo; component3.NetworkCardStoredInteractableInfo = StoredInteractableInfo.None; } } } } } internal static class Parry { private static int[] _projectileIndexConversions = Array.Empty(); [SystemInitializer(new Type[] { typeof(ProjectileCatalog) })] private static void Init() { //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Expected O, but got Unknown //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown int projectilePrefabCount = ProjectileCatalog.projectilePrefabCount; HashSet[] spawnedByProjectileIndicesMap = new HashSet[projectilePrefabCount]; int projectileIndex; ProjectileFireChildren val = default(ProjectileFireChildren); ProjectileExplosion val2 = default(ProjectileExplosion); LunarStakesLightningController val3 = default(LunarStakesLightningController); VultureHunterSpearController val4 = default(VultureHunterSpearController); for (projectileIndex = 0; projectileIndex < projectilePrefabCount; projectileIndex++) { GameObject projectilePrefab = ProjectileCatalog.GetProjectilePrefab(projectileIndex); if (projectilePrefab.TryGetComponent(ref val)) { tryRecordChildProjectile(val.childProjectilePrefab); } if (projectilePrefab.TryGetComponent(ref val2) && val2.fireChildren) { tryRecordChildProjectile(val2.childrenProjectilePrefab); } if (projectilePrefab.TryGetComponent(ref val3)) { tryRecordChildProjectile(val3.childProjectilePrefab); } if (projectilePrefab.TryGetComponent(ref val4)) { tryRecordChildProjectile(val4.delayedProjectilePrefab); } } _projectileIndexConversions = new int[projectilePrefabCount]; for (int i = 0; i < projectilePrefabCount; i++) { int num = i; while (true) { HashSet obj = spawnedByProjectileIndicesMap[num]; if (obj == null || obj.Count != 1) { break; } num = spawnedByProjectileIndicesMap[num].First(); } _projectileIndexConversions[i] = num; } for (int j = 0; j < spawnedByProjectileIndicesMap.Length; j++) { ref HashSet reference = ref spawnedByProjectileIndicesMap[j]; if (reference != null) { reference = CollectionPool>.ReturnCollection(reference); } } HealthComponent.ProcParry += new hook_ProcParry(HealthComponent_ProcParry); EquipmentSlot.FireParry += new hook_FireParry(EquipmentSlot_FireParry); void tryRecordChildProjectile(GameObject childProjectilePrefab) { int projectileIndex2 = ProjectileCatalog.GetProjectileIndex(childProjectilePrefab); if (projectileIndex2 != -1) { HashSet[] array = spawnedByProjectileIndicesMap; int num2 = projectileIndex2; (array[num2] ?? (array[num2] = CollectionPool>.RentCollection())).Add(projectileIndex); } } } private static void HealthComponent_ProcParry(orig_ProcParry orig, HealthComponent self, DamageInfo damageInfo) { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got I4 //IL_0099->IL0099: Incompatible stack types: O vs I4 //IL_008e->IL0099: Incompatible stack types: I4 vs O //IL_008e->IL0099: Incompatible stack types: O vs I4 orig.Invoke(self, damageInfo); int num = -1; float parryStoredProjectileDamage = 0f; if (Object.op_Implicit((Object)(object)damageInfo.inflictor)) { ProjectileController val = default(ProjectileController); if (damageInfo.inflictor.TryGetComponent(ref val)) { num = val.catalogIndex; } ProjectileDamage val2 = default(ProjectileDamage); if (damageInfo.inflictor.TryGetComponent(ref val2)) { parryStoredProjectileDamage = val2.damage; } } if (ArrayUtils.IsInBounds(_projectileIndexConversions, num)) { num = _projectileIndexConversions[num]; } _ = -1; if (Object.op_Implicit((Object)(object)self.body) && ((Component)(object)self.body).TryGetComponentCached(out CharacterBodyExtraStatsTracker component)) { component.NetworkParryStoredProjectileIndex = num; object obj = component; int num2; if (num != -1) { obj = BodyCatalog.FindBodyIndex(damageInfo.attacker); num2 = (int)obj; } else { num2 = -1; obj = num2; num2 = (int)obj; } ((CharacterBodyExtraStatsTracker)num2).ParryStoredProjectileAttackerBodyIndex = (BodyIndex)obj; component.ParryStoredProjectileDamage = parryStoredProjectileDamage; component.ParryStoredProjectileCrit = damageInfo.crit; } } private static bool EquipmentSlot_FireParry(orig_FireParry orig, EquipmentSlot self) { //IL_00ef: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: 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_0168: 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_018b: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0185: 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) int num = -1; float num2 = 0f; bool flag = false; if (Object.op_Implicit((Object)(object)self.characterBody) && ((Component)(object)self.characterBody).TryGetComponentCached(out CharacterBodyExtraStatsTracker component) && component.ParryStoredProjectileIndex != -1) { num = component.ParryStoredProjectileIndex; num2 = component.ParryStoredProjectileDamage; flag = component.ParryStoredProjectileCrit; component.NetworkParryStoredProjectileIndex = -1; component.ParryStoredProjectileAttackerBodyIndex = (BodyIndex)(-1); component.ParryStoredProjectileDamage = 0f; component.ParryStoredProjectileCrit = false; } QualityTier currentEquipmentActionQualityTier = self.GetCurrentEquipmentActionQualityTier(); if (currentEquipmentActionQualityTier > QualityTier.None && num != -1) { float num3; switch (currentEquipmentActionQualityTier) { case QualityTier.Uncommon: num3 = 1.5f; break; case QualityTier.Rare: num3 = 2.5f; break; case QualityTier.Epic: num3 = 4f; break; case QualityTier.Legendary: num3 = 10f; break; default: num3 = 1f; Log.Warning($"Quality tier {currentEquipmentActionQualityTier} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Parry.cs", "EquipmentSlot_FireParry", 171); break; } Ray aimRay = self.characterBody.inputBank.GetAimRay(); GameObject projectilePrefab = ProjectileCatalog.GetProjectilePrefab(num); FireProjectileInfo val = default(FireProjectileInfo); val.projectilePrefab = projectilePrefab; val.position = ((Ray)(ref aimRay)).origin; val.rotation = Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction); val.owner = ((Component)self).gameObject; val.damage = num2 * num3; val.crit = flag || self.characterBody.RollCrit(); val.damageColorIndex = (DamageColorIndex)3; FireProjectileInfo val2 = val; ProjectileDamage val3 = default(ProjectileDamage); if (!projectilePrefab.TryGetComponent(ref val3) || (val3.damageType.damageSource & 0xF) == 0) { val2.damageTypeOverride = DamageTypeCombo.op_Implicit((DamageSource)1); } ProjectileManager.instance.FireProjectile(val2); } return orig.Invoke(self); } } internal static class PassiveHealing { private static GameObject _thrownObjectProjectileSilentPrefab; private static GameObject _teleportEffectPrefab; private static DeployableSlot _woodspriteCloneDeployableSlot = (DeployableSlot)35; private static readonly Func itemCopyFilterDelegate = itemCopyFilter; [InitDuringStartupPhase(/*Could not decode attribute arguments.*/)] private static void EarlyInit() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //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) _woodspriteCloneDeployableSlot = DeployableAPI.RegisterDeployableSlot(new GetDeployableSameSlotLimit(getWoodspriteCloneLimit)); } private static bool itemCopyFilter(ItemIndex itemIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (!Inventory.DefaultItemCopyFilter(itemIndex)) { return itemIndex == Items.DroneUpgradeHidden.itemIndex; } return true; } private static int getWoodspriteCloneLimit(CharacterMaster master, int swarmsMultiplier) { QualityTier qualityTier = QualityTier.None; if (!master.inventory.GetEquipmentDisabled()) { int equipmentSlotCount = master.inventory.GetEquipmentSlotCount(); for (uint num = 0u; num < equipmentSlotCount; num++) { int equipmentSetCount = master.inventory.GetEquipmentSetCount(num); for (uint num2 = 0u; num2 < equipmentSetCount; num2++) { qualityTier = QualityCatalog.Max(qualityTier, master.inventory.GetEquipmentQualityTier(num, num2)); } } } switch (qualityTier) { case QualityTier.None: case QualityTier.Uncommon: return 1; case QualityTier.Rare: return 2; case QualityTier.Epic: return 3; case QualityTier.Legendary: return 5; default: Log.Warning($"Quality tier {qualityTier} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\PassiveHealing.cs", "getWoodspriteCloneLimit", 70); return 1; } } [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_006a: Expected O, but got Unknown ParallelProgressCoroutine val = new ParallelProgressCoroutine((IProgress)args.ProgressReceiver); AsyncOperationHandle handle = AddressableUtil.LoadTempAssetAsync(RoR2_DLC3_Drifter.ThrownObjectProjectileNoStun_prefab); handle.OnSuccess(delegate(GameObject thrownObjectProjectilePrefab) { _thrownObjectProjectileSilentPrefab = PrefabAPI.InstantiateClone(thrownObjectProjectilePrefab, "ThrownObjectProjectileSilent"); RotateObject componentInChildren = _thrownObjectProjectileSilentPrefab.GetComponentInChildren(); if (Object.op_Implicit((Object)(object)componentInChildren)) { ((Behaviour)componentInChildren).enabled = false; } Transform val7 = _thrownObjectProjectileSilentPrefab.transform.Find("JunkTrail"); if (Object.op_Implicit((Object)(object)val7)) { ((Component)val7).gameObject.SetActive(false); } args.ContentPack.projectilePrefabs.Add(_thrownObjectProjectileSilentPrefab); }); AssetLoadExtensions.Add(val, in handle); AsyncOperationHandle handle2 = AddressableUtil.LoadTempAssetAsync(RoR2_DLC1_BossHunter.BossHunterGunEffect_prefab); handle2.OnSuccess(delegate(GameObject teleportEffectPrefab) { //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Expected O, but got Unknown _teleportEffectPrefab = PrefabAPI.InstantiateClone(teleportEffectPrefab, "PassiveHealingQualityTeleportEffect", false); Transform val2 = _teleportEffectPrefab.transform.Find("Blast/GunMesh"); if (Object.op_Implicit((Object)(object)val2)) { ((Component)val2).gameObject.SetActive(false); } Transform val3 = _teleportEffectPrefab.transform.Find("Blast/Shards, Mesh"); if (Object.op_Implicit((Object)(object)val3)) { ((Component)val3).gameObject.SetActive(false); } Transform val4 = _teleportEffectPrefab.transform.Find("Blast/Shards light"); if (Object.op_Implicit((Object)(object)val4)) { ((Component)val4).gameObject.SetActive(false); } Transform val5 = _teleportEffectPrefab.transform.Find("Blast/Spookies2"); if (Object.op_Implicit((Object)(object)val5)) { ((Component)val5).gameObject.SetActive(false); } Transform val6 = _teleportEffectPrefab.transform.Find("Blast/PP"); if (Object.op_Implicit((Object)(object)val6)) { ((Component)val6).gameObject.SetActive(false); } args.ContentPack.effectDefs.Add(new EffectDef(_teleportEffectPrefab)); }); AssetLoadExtensions.Add(val, in handle2); return (IEnumerator)val; } [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown EquipmentSlot.FirePassiveHealing += new Manipulator(EquipmentSlot_FirePassiveHealing); } private static void EquipmentSlot_FirePassiveHealing(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "AssignNewTarget") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\PassiveHealing.cs", "EquipmentSlot_FirePassiveHealing", 158); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Action)onAssignTarget); static void onAssignTarget(EquipmentSlot equipmentSlot) { //IL_0088: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: 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_0153: 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_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Expected O, but got Unknown //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) QualityTier qualityTier; BaseAI targetBodyAIController; if (Object.op_Implicit((Object)(object)equipmentSlot) && Object.op_Implicit((Object)(object)equipmentSlot.passiveHealingFollower)) { qualityTier = equipmentSlot.GetCurrentEquipmentActionQualityTier(); if (qualityTier != QualityTier.None) { GameObject targetBodyObject = equipmentSlot.passiveHealingFollower.targetBodyObject; CharacterBody val2 = (Object.op_Implicit((Object)(object)targetBodyObject) ? targetBodyObject.GetComponent() : null); if (Object.op_Implicit((Object)(object)val2) && !((Object)(object)val2 == (Object)(object)equipmentSlot.characterBody)) { GameObject masterPrefab = MasterCatalog.GetMasterPrefab(MasterCatalog.FindAiMasterIndexForBody(val2.bodyIndex)); if (Object.op_Implicit((Object)(object)masterPrefab)) { Vector3 footPosition = val2.footPosition; Quaternion rotation = ((Component)val2).transform.rotation; if (Object.op_Implicit((Object)(object)val2.characterDirection)) { rotation = Quaternion.Euler(0f, val2.characterDirection.yaw, 0f); } Vector3 val3 = Random.insideUnitSphere * 2f; val3.y = Mathf.Abs(val3.y) * 0.2f + equipmentSlot.characterBody.bestFitRadius * 1.5f; Vector3 val4 = equipmentSlot.characterBody.corePosition + val3; Vector3 val5 = val4 - val2.corePosition; Vector3 normalized = ((Vector3)(ref val5)).normalized; Vector3 val6 = normalized; val6.y = 0f; ((Vector3)(ref val6)).Normalize(); TeleportBodyArgs val7 = default(TeleportBodyArgs); ((TeleportBodyArgs)(ref val7)).body = val2; val7.forceOutOfVehicle = true; val7.resetStateMachines = false; val7.targetPosition = val4; TeleportBodyArgs val8 = val7; if (val2.hasEffectiveAuthority) { TeleportHelper.TeleportBody(val8); } else { val2.CallRpcTeleportWithLocalAuthority(val8); } IPhysMotor obj; if (!Object.op_Implicit((Object)(object)val2.characterMotor)) { obj = ((Component)val2).GetComponent(); } else { IPhysMotor characterMotor = (IPhysMotor)(object)val2.characterMotor; obj = characterMotor; } IPhysMotor val9 = obj; Rigidbody val10 = default(Rigidbody); if (val9 == null || val9 is PseudoCharacterMotor || (!(val9 is CharacterMotor) && (!((Component)val2).TryGetComponent(ref val10) || val10.isKinematic))) { ProjectileManager instance = ProjectileManager.instance; FireProjectileInfo val11 = new FireProjectileInfo { projectilePrefab = _thrownObjectProjectileSilentPrefab, owner = ((Component)equipmentSlot).gameObject, position = val4, rotation = Quaternion.LookRotation(val6, Vector3.up) }; ((FireProjectileInfo)(ref val11)).speedOverride = 5f; val11.passenger = ((Component)val2).gameObject; ThrownObjectProjectileController val12 = default(ThrownObjectProjectileController); if (instance.FireProjectileImmediateServer(val11, (NetworkConnection)null, (ushort)0, 0.0).TryGetComponent(ref val12)) { val12.SetPassengerServer(((Component)val2).gameObject); } } else if (val9 != null) { PhysForceInfo val13 = new PhysForceInfo { force = val6 * 5f }; ((PhysForceInfo)(ref val13)).ignoreGroundStick = true; ((PhysForceInfo)(ref val13)).massIsOne = true; ((PhysForceInfo)(ref val13)).resetVelocity = true; val9.ApplyForceImpulse(ref val13); } EffectManager.SpawnEffect(_teleportEffectPrefab, new EffectData { origin = val4, rotation = Util.QuaternionSafeLookRotation(-normalized, Vector3.up) }, true); targetBodyAIController = (Object.op_Implicit((Object)(object)val2.master) ? ((Component)val2.master).GetComponent() : null); CharacterMaster val14 = new MasterSummon { summonerBodyObject = ((Component)equipmentSlot.characterBody).gameObject, masterPrefab = masterPrefab, ignoreTeamMemberLimit = true, position = footPosition, rotation = rotation, inventoryToCopy = val2.inventory, inventoryItemCopyFilter = itemCopyFilterDelegate, preSpawnSetupCallback = preSpawnSetup, loadout = (Object.op_Implicit((Object)(object)val2.master) ? val2.master.loadout : null) }.Perform(); if (Object.op_Implicit((Object)(object)val14)) { GameObject bodyObject = val14.GetBodyObject(); if (Object.op_Implicit((Object)(object)bodyObject)) { EntityStateMachine[] components = bodyObject.GetComponents(); foreach (EntityStateMachine obj2 in components) { obj2.initialStateType = obj2.mainStateType; } } } } } } } void preSpawnSetup(CharacterMaster spawnedMaster) { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_010c: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)spawnedMaster)) { spawnedMaster.inventory.GiveItemPermanent(Items.Ghost, 1); spawnedMaster.inventory.GiveItemPermanent(Items.BoostDamage, 10); int num; switch (qualityTier) { case QualityTier.Uncommon: num = 15; break; case QualityTier.Rare: num = 20; break; case QualityTier.Epic: num = 40; break; case QualityTier.Legendary: num = 60; break; default: num = 10; Log.Warning($"Quality tier {qualityTier} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\PassiveHealing.cs", "EquipmentSlot_FirePassiveHealing", 309); break; } spawnedMaster.inventory.GiveItemPermanent(ItemQualitiesContent.Items.TrueKillOnTimer, num); Deployable val15 = UnityObjectExtensions.EnsureComponent((Component)(object)spawnedMaster); Deployable val16 = val15; if (val16.onUndeploy == null) { val16.onUndeploy = new UnityEvent(); } val15.onUndeploy.AddListener(new UnityAction(spawnedMaster.TrueKill)); if (Object.op_Implicit((Object)(object)equipmentSlot.characterBody) && Object.op_Implicit((Object)(object)equipmentSlot.characterBody.master)) { equipmentSlot.characterBody.master.AddDeployable(val15, _woodspriteCloneDeployableSlot); } BaseAI val17 = default(BaseAI); if (Object.op_Implicit((Object)(object)targetBodyAIController) && ((Component)spawnedMaster).TryGetComponent(ref val17)) { val17.currentEnemy = targetBodyAIController.currentEnemy; val17.leader = targetBodyAIController.leader; val17.buddy = targetBodyAIController.buddy; val17.customTarget = targetBodyAIController.customTarget; val17.UpdateTargets(); } } } } } } internal static class QuestVolatileBattery { private static EffectIndex _explosionEffectIndex = (EffectIndex)(-1); private static GameObject _qualityVolatileBatteryAttachmentPrefab; [SystemInitializer(new Type[] { typeof(EffectCatalogUtils) })] private static void Init() { //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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Invalid comparison between Unknown and I4 EquipmentSlot.UpdateTargets += new Manipulator(EquipmentSlot_UpdateTargets); EquipmentSlot.PerformEquipmentAction += new hook_PerformEquipmentAction(EquipmentSlot_PerformEquipmentAction); GenericPickupController.Start += new hook_Start(GenericPickupController_Start); GenericPickupController.OnInteractionBegin += new hook_OnInteractionBegin(GenericPickupController_OnInteractionBegin); _explosionEffectIndex = EffectCatalogUtils.FindEffectIndex("VolatileBatteryExplosion"); if ((int)_explosionEffectIndex == -1) { Log.Error("Failed to find VolatileBatteryExplosion effect index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\QuestVolatileBattery.cs", "Init", 39); } } [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle handle = AddressableUtil.LoadTempAssetAsync(RoR2_Base_QuestVolatileBattery.QuestVolatileBatteryAttachment_prefab); handle.OnSuccess(delegate(GameObject questVolatileBatteryAttachmentPrefab) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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) _qualityVolatileBatteryAttachmentPrefab = PrefabAPI.InstantiateClone(questVolatileBatteryAttachmentPrefab, "QualityVolatileBatteryAttachment", true); UnityObjectExtensions.EnsureComponent(_qualityVolatileBatteryAttachmentPrefab); UnityObjectExtensions.EnsureComponent(_qualityVolatileBatteryAttachmentPrefab); EntityStateMachine component = _qualityVolatileBatteryAttachmentPrefab.GetComponent(); component.initialStateType = new SerializableEntityStateType(typeof(QuestVolatileBatteryQualityMonitor)); component.mainStateType = new SerializableEntityStateType(typeof(QuestVolatileBatteryQualityMonitor)); args.ContentPack.networkedObjectPrefabs.Add(_qualityVolatileBatteryAttachmentPrefab); }); return handle.AsProgressCoroutine>(args.ProgressReceiver); } private static void GenericPickupController_Start(orig_Start orig, GenericPickupController self) { orig.Invoke(self); if (NetworkServer.active && !Object.op_Implicit((Object)(object)((Component)self).transform.parent)) { NetworkServer.Spawn(Object.Instantiate(ItemQualitiesContent.NetworkedPrefabs.QuestVolatileBatteryPickup, ((Component)self).transform)); } } private static void GenericPickupController_OnInteractionBegin(orig_OnInteractionBegin orig, GenericPickupController self, Interactor activator) { try { QuestVolatileBatteryPickup componentInChildren = ((Component)self).GetComponentInChildren(); if (Object.op_Implicit((Object)(object)componentInChildren)) { componentInChildren.OnInteractionBegin(activator); } } catch (Exception ex) { Log.Error_NoCallerPrefix(ex.ToString()); } orig.Invoke(self, activator); } private static void EquipmentSlot_UpdateTargets(ILContext il) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter("targetingEquipmentIndex", out var targetingEquipmentIndexParameter)) { Log.Error("Failed to find 'targetingEquipmentIndex' parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\QuestVolatileBattery.cs", "EquipmentSlot_UpdateTargets", 97); return; } ILCursor val = new ILCursor(il); ILLabel targetEnemyLabel = null; if (!val.TryGotoNext((MoveType)2, new Func[4] { (Instruction x) => x.MatchLdarg(targetingEquipmentIndexParameter), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Equipment), "Lightning"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "get_equipmentIndex"), (Instruction x) => ILPatternMatchingExt.MatchBeq(x, ref targetEnemyLabel) })) { Log.Error("Failed to find target patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\QuestVolatileBattery.cs", "EquipmentSlot_UpdateTargets", 110); return; } val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg, targetingEquipmentIndexParameter); val.EmitDelegate>((Func)shouldTargetEnemy); val.Emit(OpCodes.Brtrue, (object)targetEnemyLabel); static bool shouldTargetEnemy(EquipmentSlot equipmentSlot, EquipmentIndex targetingEquipmentIndex) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (equipmentSlot.GetActiveEquipmentQualityTier() == QualityTier.None) { return false; } if (QualityCatalog.FindEquipmentQualityGroupIndex(targetingEquipmentIndex) == ItemQualitiesContent.EquipmentQualityGroups.QuestVolatileBattery.GroupIndex) { return true; } return false; } } private static bool EquipmentSlot_PerformEquipmentAction(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) if (orig.Invoke(self, equipmentDef)) { return true; } if ((Object)(object)equipmentDef == (Object)(object)Equipment.QuestVolatileBattery) { QualityTier currentEquipmentActionQualityTier = self.GetCurrentEquipmentActionQualityTier(); GameObject rootObject = self.currentTarget.rootObject; if (currentEquipmentActionQualityTier != QualityTier.None && Object.op_Implicit((Object)(object)rootObject)) { self.UpdateTargets(Equipment.QuestVolatileBattery.equipmentIndex, false); GameObject obj = Object.Instantiate(_qualityVolatileBatteryAttachmentPrefab); obj.GetComponent().QualityTier = currentEquipmentActionQualityTier; obj.GetComponent().ownerObject = ((Component)self).gameObject; obj.GetComponent().AttachToGameObjectAndSpawn(rootObject, (string)null); return true; } } return false; } public static void Detonate(GameObject victimObject, float damageMultiplier = 1f) { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_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_010b: 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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Expected O, but got Unknown //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Expected O, but got Unknown //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } QualityTierContext component = victimObject.GetComponent(); if (Object.op_Implicit((Object)(object)component) && component.QualityTier > QualityTier.None) { CharacterBody val = null; GenericOwnership val2 = default(GenericOwnership); if (victimObject.TryGetComponent(ref val2) && Object.op_Implicit((Object)(object)val2.ownerObject)) { val = val2.ownerObject.GetComponent(); } CharacterBody component2 = victimObject.GetComponent(); GenericPickupController componentInParent = victimObject.GetComponentInParent(); float num = component.QualityTier switch { QualityTier.Uncommon => 20f, QualityTier.Rare => 30f, QualityTier.Epic => 40f, QualityTier.Legendary => 50f, _ => 0f, } * damageMultiplier; Vector3 val3 = victimObject.transform.position; if (Object.op_Implicit((Object)(object)component2)) { val3 = component2.corePosition; } else if (Object.op_Implicit((Object)(object)componentInParent) && Object.op_Implicit((Object)(object)componentInParent.pickupDisplay)) { val3 = ((Component)componentInParent.pickupDisplay).transform.position; } float explosionRadius = ExplodeOnDeath.GetExplosionRadius(30f, val); EffectManager.SpawnEffect(_explosionEffectIndex, new EffectData { origin = val3, scale = explosionRadius }, true); BlastAttack val4 = new BlastAttack(); val4.position = val3 + Random.onUnitSphere; val4.falloffModel = (FalloffModel)0; val4.attacker = victimObject; val4.inflictor = victimObject; val4.radius = explosionRadius; if (Object.op_Implicit((Object)(object)val)) { val4.attacker = ((Component)val).gameObject; val4.baseDamage = val.damage * num; val4.teamIndex = val.teamComponent.teamIndex; val4.crit = val.RollCrit(); } else { val4.baseDamage = Run.instance.teamlessDamageCoefficient * num; val4.crit = false; } val4.damageColorIndex = (DamageColorIndex)3; val4.baseForce = 5000f; val4.bonusForce = Vector3.zero; val4.attackerFiltering = (AttackerFiltering)1; val4.procChainMask = default(ProcChainMask); val4.procCoefficient = 1f; val4.Fire(); } } } internal static class Recycle { private delegate bool TryCheckTargetRecyclableObjectIsRecyclableDelegate(EquipmentSlot equipmentSlot, EquipmentIndex equipmentIndex, out bool isTargetObjectRecyclable); [SystemInitializer(new Type[] { })] private static void Init() { //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 EquipmentSlot.UpdateTargets += new Manipulator(EquipmentSlot_UpdateTargets); EquipmentSlot.FireRecycle += new Manipulator(IL_EquipmentSlot_FireRecycle); EquipmentSlot.FireRecycle += new hook_FireRecycle(On_EquipmentSlot_FireRecycle); } private static void EquipmentSlot_UpdateTargets(ILContext il) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var parameter)) { parameter = null; Log.Warning("Failed to find targetingEquipmentIndex parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Recycle.cs", "EquipmentSlot_UpdateTargets", 27); } ILCursor val = new ILCursor(il); val.Goto(0, (MoveType)0, false); if (!val.TryGotoNext((MoveType)2, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "FindPickupController"), (Instruction x) => ILPatternMatchingExt.MatchNewobj(x), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "currentTarget") })) { Log.Error("Failed to find target search patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Recycle.cs", "EquipmentSlot_UpdateTargets", 41); } else if (parameter != null) { val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg, parameter); val.EmitDelegate>((Action)tryModifyCurrentPickupTarget); Instruction recyclerValidInstr = null; ILLabel recyclerInvalidLabel = null; if (val.TryGotoNext((MoveType)1, new Func[4] { (Instruction x) => x.MatchLdloc(il, out var _), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "Recycled"), (Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref recyclerInvalidLabel), (Instruction x) => x.MatchAny(out recyclerValidInstr) })) { VariableDefinition val2 = il.AddVariable(); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg, parameter); val.Emit(OpCodes.Ldloca, val2); val.EmitDelegate((TryCheckTargetRecyclableObjectIsRecyclableDelegate)tryCheckTargetRecyclableObjectIsRecyclable); ILLabel val3 = val.DefineLabel(); val.Emit(OpCodes.Brfalse, (object)val3); val.Emit(OpCodes.Ldloc, val2); val.Emit(OpCodes.Brtrue, (object)il.DefineLabel(recyclerValidInstr)); val.Emit(OpCodes.Br, (object)recyclerInvalidLabel); val.MarkLabel(val3); } else { Log.Error("Failed to find targetting indicator patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Recycle.cs", "EquipmentSlot_UpdateTargets", 137); } } val.Goto(0, (MoveType)0, false); int num = 0; int pickupControllerVarIndex = -1; while (val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref pickupControllerVarIndex), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "Recycled") })) { val.Emit(OpCodes.Ldloc, pickupControllerVarIndex); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)isUnrecyclable); num++; } if (num == 0) { Log.Error("Failed to find GenericPickupController.Recycled patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Recycle.cs", "EquipmentSlot_UpdateTargets", 176); } static bool isUnrecyclable(bool isRecycled, GenericPickupController pickupController, EquipmentSlot equipmentSlot) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (isRecycled) { return true; } bool num2 = Object.op_Implicit((Object)(object)pickupController) && QualityCatalog.GetQualityTier(pickupController.pickup.pickupIndex) > QualityTier.None; bool flag = equipmentSlot.GetActiveEquipmentQualityTier() > QualityTier.None; if (num2 && !flag) { return true; } return false; } static bool tryCheckTargetRecyclableObjectIsRecyclable(EquipmentSlot equipmentSlot, EquipmentIndex equipmentIndex, out bool isTargetObjectRecyclable) { RecyclableObject recyclableObject = default(RecyclableObject); if (Object.op_Implicit((Object)(object)equipmentSlot.currentTarget.rootObject) && equipmentSlot.currentTarget.rootObject.TryGetComponent(ref recyclableObject)) { isTargetObjectRecyclable = recyclableObject.IsRecyclable; return true; } isTargetObjectRecyclable = false; return false; } static void tryModifyCurrentPickupTarget(EquipmentSlot equipmentSlot, EquipmentIndex targetingEquipmentIndex) { //IL_0000: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) if (targetingEquipmentIndex == Equipment.Recycle.equipmentIndex && equipmentSlot.GetActiveEquipmentQualityTier() != QualityTier.None && !Object.op_Implicit((Object)(object)equipmentSlot.currentTarget.rootObject)) { CharacterBody characterBody = equipmentSlot.characterBody; if (Object.op_Implicit((Object)(object)characterBody)) { InputBankTest inputBank = characterBody.inputBank; if (Object.op_Implicit((Object)(object)inputBank)) { Ray val4 = inputBank.GetAimRay(); RecyclableObjectSearch sharedInstance = RecyclableObjectSearch.SharedInstance; float num3 = default(float); val4 = CameraRigController.ModifyAimRayIfApplicable(val4, ((Component)equipmentSlot).gameObject, ref num3); ((BaseDirectionalSearch)sharedInstance).searchOrigin = ((Ray)(ref val4)).origin; ((BaseDirectionalSearch)sharedInstance).searchDirection = ((Ray)(ref val4)).direction; ((BaseDirectionalSearch)sharedInstance).minAngleFilter = 0f; ((BaseDirectionalSearch)sharedInstance).maxAngleFilter = 10f; ((BaseDirectionalSearch)sharedInstance).minDistanceFilter = 0f; ((BaseDirectionalSearch)sharedInstance).maxDistanceFilter = 30f + num3; ((BaseDirectionalSearch)sharedInstance).filterByDistinctEntity = true; ((BaseDirectionalSearch)sharedInstance).filterByLoS = true; ((BaseDirectionalSearch)sharedInstance).sortMode = (SortMode)2; sharedInstance.RequireRecyclable = false; RecyclableObject recyclableObject2 = ((BaseDirectionalSearch)sharedInstance).SearchCandidatesForSingleTarget>(InstanceTracker.GetInstancesList()); if (Object.op_Implicit((Object)(object)recyclableObject2)) { equipmentSlot.currentTarget = new UserTargetInfo { rootObject = ((Component)recyclableObject2).gameObject, transformToIndicateAt = recyclableObject2.IndicatorTransform }; } } } } } } private static void IL_EquipmentSlot_FireRecycle(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int num = 0; int pickupControllerVarIndex = -1; while (val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref pickupControllerVarIndex), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "Recycled") })) { val.Emit(OpCodes.Ldloc, pickupControllerVarIndex); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)isUnrecyclable); num++; } if (num == 0) { Log.Error("Failed to find recyclable patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Recycle.cs", "IL_EquipmentSlot_FireRecycle", 221); } val.Goto(0, (MoveType)0, false); if (val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(PickupTransmutationManager), "GetAvailableGroupFromPickupIndex") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getPickupIndex); } else { Log.Error("Failed to find pickup group patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Recycle.cs", "IL_EquipmentSlot_FireRecycle", 251); } static PickupIndex getPickupIndex(PickupIndex pickupIndex, EquipmentSlot equipmentSlot) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) QualityTier qualityTier = QualityCatalog.GetQualityTier(pickupIndex); QualityTier currentEquipmentActionQualityTier = equipmentSlot.GetCurrentEquipmentActionQualityTier(); if (qualityTier > currentEquipmentActionQualityTier) { pickupIndex = QualityCatalog.GetPickupIndexOfQuality(pickupIndex, currentEquipmentActionQualityTier); } return pickupIndex; } static bool isUnrecyclable(bool isRecycled, GenericPickupController pickupController, EquipmentSlot equipmentSlot) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (isRecycled) { return true; } bool num2 = Object.op_Implicit((Object)(object)pickupController) && QualityCatalog.GetQualityTier(pickupController.pickup.pickupIndex) > QualityTier.None; bool flag = equipmentSlot.GetCurrentEquipmentActionQualityTier() > QualityTier.None; if (num2 && !flag) { return true; } return false; } } private static bool On_EquipmentSlot_FireRecycle(orig_FireRecycle orig, EquipmentSlot self) { if (orig.Invoke(self)) { return true; } if (self.GetCurrentEquipmentActionQualityTier() > QualityTier.None) { GameObject rootObject = self.currentTarget.rootObject; RecyclableObject recyclableObject = default(RecyclableObject); if (Object.op_Implicit((Object)(object)rootObject) && rootObject.TryGetComponent(ref recyclableObject) && recyclableObject.IsRecyclable) { recyclableObject.DoRecycle(); self.InvalidateCurrentTarget(); return true; } } return false; } } internal static class Saw { private delegate void GetSawLoopParamsDelegate(EquipmentSlot equipmentSlot, float sawAngle, out int middleSawRepeatCount, out Quaternion rotationPerSaw, ref Quaternion sawRotation); private static readonly GameObject[] _qualitySawProjectilePrefabs = (GameObject[])(object)new GameObject[4]; [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { //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_0031: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle handle = AddressableUtil.LoadTempAssetAsync(RoR2_Base_Saw.Sawmerang_prefab); handle.OnSuccess(delegate(GameObject sawProjectilePrefab) { for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { GameObject val = PrefabAPI.InstantiateClone(sawProjectilePrefab, ((Object)sawProjectilePrefab).name + qualityTier); UnityObjectExtensions.EnsureComponent(val).HitPauseDuration = 1f; _qualitySawProjectilePrefabs[(int)qualityTier] = val; } }); return handle.AsProgressCoroutine>(args.ProgressReceiver); } [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) EquipmentSlot.FireSaw += new Manipulator(EquipmentSlot_FireSaw); MethodInfo method = typeof(EquipmentSlot).GetMethod("FireSaw", (BindingFlags)(-1)); if (method != null) { DynamicMethodDefinition val = new DynamicMethodDefinition((MethodBase)method); try { ILContext val2 = new ILContext(val.Definition); try { ILCursor val3 = new ILCursor(val2); MethodReference fireSingleSawMethodRef = null; if (!val3.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref fireSingleSawMethodRef) && fireSingleSawMethodRef != null && ((MemberReference)fireSingleSawMethodRef).Name.StartsWith("g__FireSingleSaw|") })) { Log.Error("Failed to find FireSaw FireSingleSaw local method", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Saw.cs", "Init", 61); return; } MethodBase methodBase; try { MethodReference obj = fireSingleSawMethodRef; methodBase = ((obj != null) ? ReflectionHelper.ResolveReflection(obj) : null); } catch (Exception) { methodBase = null; } if (methodBase == null) { Log.Error("Failed to resolve FireSaw FireSingleSaw local method", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Saw.cs", "Init", 77); } else { new ILHook(methodBase, new Manipulator(EquipmentSlot_FireSaw_FireSingleSaw)); } return; } finally { ((IDisposable)val2)?.Dispose(); } } finally { ((IDisposable)val)?.Dispose(); } } Log.Error("Failed to find EquipmentSlot.FireSaw method", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Saw.cs", "Init", 87); } private static void EquipmentSlot_FireSaw_FireSingleSaw(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Prefabs/Projectiles/Sawmerang"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(LegacyResourcesAPI), "Load") })) { Log.Error("Failed to find saw projectile prefab patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Saw.cs", "EquipmentSlot_FireSaw_FireSingleSaw", 99); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getProjectilePrefab); static GameObject getProjectilePrefab(GameObject prefab, EquipmentSlot equipmentSlot) { QualityTier currentEquipmentActionQualityTier = equipmentSlot.GetCurrentEquipmentActionQualityTier(); GameObject safe = ArrayUtils.GetSafe(_qualitySawProjectilePrefabs, (int)currentEquipmentActionQualityTier); if (!Object.op_Implicit((Object)(object)safe)) { return prefab; } return safe; } } private static void EquipmentSlot_FireSaw(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); VariableDefinition sawRotationVar = null; Instruction afterFireMiddleSawInstruction = null; int num4 = default(int); MethodReference val7 = default(MethodReference); if (!val.TryGotoNext((MoveType)1, new Func[8] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "get_characterBody"), (Instruction x) => ILPatternMatchingExt.MatchLdloca(x, ref num4), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "get_origin"), (Instruction x) => x.MatchLdloc(il, out sawRotationVar), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val7), (Instruction x) => x.MatchAny(out afterFireMiddleSawInstruction) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Saw.cs", "EquipmentSlot_FireSaw", 140); return; } VariableDefinition sawAngleVar = null; float num3 = default(float); float num2 = default(float); if (!val.Clone().TryGotoNext(new Func[4] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num3), (Instruction x) => x.MatchLdloc(il, out sawAngleVar), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num2), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "Euler") })) { Log.Warning("Failed to find sawAngle variable", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Saw.cs", "EquipmentSlot_FireSaw", 150); } VariableDefinition val2 = il.AddVariable(); VariableDefinition val3 = il.AddVariable(); VariableDefinition val4 = il.AddVariable(); val.Emit(OpCodes.Ldloc, sawRotationVar); val.Emit(OpCodes.Stloc, val4); val.Emit(OpCodes.Ldarg_0); if (sawAngleVar != null) { val.Emit(OpCodes.Ldloc, sawAngleVar); } else { val.Emit(OpCodes.Ldc_R4, 15f); } val.Emit(OpCodes.Ldloca, val2); val.Emit(OpCodes.Ldloca, val3); val.Emit(OpCodes.Ldloca, sawRotationVar); val.EmitDelegate((GetSawLoopParamsDelegate)getSawLoopParams); ILLabel val5 = val.MarkLabel(); ILLabel val6 = val.DefineLabel(); val.Emit(OpCodes.Ldloc, val2); val.Emit(OpCodes.Ldc_I4_0); val.Emit(OpCodes.Ble, (object)val6); val.Emit(OpCodes.Ldloc, sawRotationVar); val.Emit(OpCodes.Ldloc, val3); val.EmitDelegate>((Func)getNextSawRotation); val.Emit(OpCodes.Stloc, sawRotationVar); val.Goto(afterFireMiddleSawInstruction, (MoveType)0, false); val.Emit(OpCodes.Ldloc, val2); val.Emit(OpCodes.Ldc_I4_1); val.Emit(OpCodes.Sub); val.Emit(OpCodes.Stloc, val2); val.Emit(OpCodes.Br, (object)val5); val.MarkLabel(val6); val.Emit(OpCodes.Ldloc, val4); val.Emit(OpCodes.Stloc, sawRotationVar); static Quaternion getNextSawRotation(Quaternion sawRotation, Quaternion rotationPerSaw) { //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_0002: Unknown result type (might be due to invalid IL or missing references) return sawRotation * rotationPerSaw; } static void getSawLoopParams(EquipmentSlot equipmentSlot, float sawAngle, out int middleSawRepeatCount, out Quaternion rotationPerSaw, ref Quaternion sawRotation) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) QualityTier currentEquipmentActionQualityTier = equipmentSlot.GetCurrentEquipmentActionQualityTier(); int num; switch (currentEquipmentActionQualityTier) { case QualityTier.None: num = 0; break; case QualityTier.Uncommon: num = 1; break; case QualityTier.Rare: num = 2; break; case QualityTier.Epic: num = 3; break; case QualityTier.Legendary: num = 5; break; default: num = 0; Log.Warning($"Quality tier {currentEquipmentActionQualityTier} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Saw.cs", "EquipmentSlot_FireSaw", 200); break; } middleSawRepeatCount = 1 + num; rotationPerSaw = Quaternion.Euler(0f, sawAngle * 2f / (float)(middleSawRepeatCount + 1), 0f); sawRotation *= Quaternion.Euler(0f, 0f - sawAngle, 0f); } } } internal static class Scanner { private static InteractableSpawnCard _iscChest1Stealthed; [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { AsyncOperationHandle chest2LoadHandle = AddressableUtil.LoadAssetAsync(RoR2_Base_Chest2.Chest2_prefab, (AsyncReferenceHandleUnloadType)2); AsyncOperationHandle cloakedMaterialLoadHandle = AddressableUtil.LoadAssetAsync(RoR2_Base_Common.matCloakedEffect_mat, (AsyncReferenceHandleUnloadType)2); ParallelProgressCoroutine val = new ParallelProgressCoroutine((IProgress)args.ProgressReceiver); val.Add(in chest2LoadHandle); val.Add(in cloakedMaterialLoadHandle); yield return val; if (!AssetLoadExtensions.AssertLoaded(in chest2LoadHandle, "Chest2", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Scanner.cs", "LoadContent", 32) || !AssetLoadExtensions.AssertLoaded(in cloakedMaterialLoadHandle, "matCloakedEffect", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Scanner.cs", "LoadContent", 32)) { yield break; } GameObject val2 = PrefabAPI.InstantiateClone(chest2LoadHandle.Result, "Chest2StealthedVariant"); PurchaseInteraction val3 = default(PurchaseInteraction); if (val2.TryGetComponent(ref val3)) { val3.costType = (CostTypeIndex)0; val3.cost = 0; val3.displayNameToken = "QUALITY_CHEST2_STEALTHED_NAME"; val3.contextToken = "QUALITY_CHEST2_STEALTHED_CONTEXT"; } else { Log.Warning($"Expected component PurchaseInteraction on {val2}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Scanner.cs", "LoadContent", 47); } ModelLocator val4 = default(ModelLocator); if (val2.TryGetComponent(ref val4) && Object.op_Implicit((Object)(object)val4._modelTransform)) { SkinnedMeshRenderer[] componentsInChildren = ((Component)val4._modelTransform).GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { ((Renderer)componentsInChildren[i]).sharedMaterial = cloakedMaterialLoadHandle.Result; } } else { Log.Warning($"Failed to find {val2} model transform", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\Scanner.cs", "LoadContent", 59); } GenericDisplayNameProvider val5 = default(GenericDisplayNameProvider); if (val2.TryGetComponent(ref val5)) { val5.displayToken = "QUALITY_CHEST2_STEALTHED_NAME"; } GenericInspectInfoProvider val6 = default(GenericInspectInfoProvider); if (val2.TryGetComponent(ref val6)) { InspectDef val7 = Object.Instantiate(val6.InspectInfo); ((Object)val7).name = "CloakedChest2InspectDef"; val7.Info = new InspectInfo { TitleToken = "QUALITY_CHEST2_STEALTHED_NAME", DescriptionToken = "QUALITY_CHEST2_STEALTHED_DESCRIPTION" }; val6.InspectInfo = val7; } InteractableSpawnCard val8 = ScriptableObject.CreateInstance(); ((Object)val8).name = "iscChest2Stealthed"; ((SpawnCard)val8).prefab = val2; ((SpawnCard)val8).sendOverNetwork = true; ((SpawnCard)val8).hullSize = (HullClassification)0; ((SpawnCard)val8).nodeGraphType = (GraphType)0; ((SpawnCard)val8).requiredFlags = (NodeFlags)0; ((SpawnCard)val8).forbiddenFlags = (NodeFlags)8; ((SpawnCard)val8).occupyPosition = true; val8.orientToFloor = true; val8.slightlyRandomizeOrientation = true; args.ContentPack.spawnCards.Add((SpawnCard)(object)val8); } [SystemInitializer(new Type[] { })] private static 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) AsyncOperationHandle handle = AddressableUtil.LoadAssetAsync(RoR2_Base_Chest1StealthedVariant.iscChest1Stealthed_asset, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(InteractableSpawnCard cloakedChestSpawnCard) { _iscChest1Stealthed = cloakedChestSpawnCard; }); ChestBehavior val = default(ChestBehavior); ChestBehavior val2 = default(ChestBehavior); if (Object.op_Implicit((Object)(object)ItemQualitiesContent.SpawnCards.QualityChest2) && Object.op_Implicit((Object)(object)((SpawnCard)ItemQualitiesContent.SpawnCards.QualityChest2).prefab) && ((SpawnCard)ItemQualitiesContent.SpawnCards.QualityChest2).prefab.TryGetComponent(ref val) && Object.op_Implicit((Object)(object)val.dropTable) && Object.op_Implicit((Object)(object)ItemQualitiesContent.SpawnCards.Chest2Stealthed) && Object.op_Implicit((Object)(object)((SpawnCard)ItemQualitiesContent.SpawnCards.Chest2Stealthed).prefab) && ((SpawnCard)ItemQualitiesContent.SpawnCards.Chest2Stealthed).prefab.TryGetComponent(ref val2)) { val2.dropTable = val.dropTable; } SceneDirector.onPostPopulateSceneServer += onPostPopulateSceneServer; } private static void onPostPopulateSceneServer(SceneDirector sceneDirector) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Expected O, but got Unknown //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown if (!SceneInfo.instance.countsAsStage && !SceneInfo.instance.sceneDef.allowItemsToSpawnObjects) { return; } Xoroshiro128Plus val = new Xoroshiro128Plus(sceneDirector.rng.nextUlong); foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { if (!Object.op_Implicit((Object)(object)readOnlyInstances.inventory) || readOnlyInstances.inventory.GetEquipmentDisabled()) { continue; } int equipmentSlotCount = readOnlyInstances.inventory.GetEquipmentSlotCount(); for (uint num = 0u; num < equipmentSlotCount; num++) { int equipmentSetCount = readOnlyInstances.inventory.GetEquipmentSetCount(num); for (uint num2 = 0u; num2 < equipmentSetCount; num2++) { EquipmentState equipment = readOnlyInstances.inventory.GetEquipment(num, num2); QualityTier qualityTier = QualityCatalog.GetQualityTier(equipment.equipmentIndex); EquipmentQualityGroupIndex equipmentQualityGroupIndex = QualityCatalog.FindEquipmentQualityGroupIndex(equipment.equipmentIndex); if (qualityTier <= QualityTier.None || equipmentQualityGroupIndex != ItemQualitiesContent.EquipmentQualityGroups.Scanner.GroupIndex) { continue; } InteractableSpawnCard val2 = _iscChest1Stealthed; int num3 = (int)(qualityTier + 1); if (qualityTier > QualityTier.Rare && Object.op_Implicit((Object)(object)ItemQualitiesContent.SpawnCards.Chest2Stealthed)) { val2 = ItemQualitiesContent.SpawnCards.Chest2Stealthed; num3 = (int)(qualityTier - 1); } if (Object.op_Implicit((Object)(object)val2)) { DirectorPlacementRule val3 = new DirectorPlacementRule { placementMode = (PlacementMode)(Object.op_Implicit((Object)(object)SceneInfo.instance.approximateMapBoundMesh) ? 5 : 4) }; for (int i = 0; i < num3; i++) { DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest((SpawnCard)(object)val2, val3, val)); } } } } } } } internal static class TeamWarCry { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown EquipmentSlot.FireTeamWarCry += new Manipulator(EquipmentSlot_FireTeamWarCry); } private static void EquipmentSlot_FireTeamWarCry(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_000c: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int num = 0; while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "TeamWarCry") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getBuff); num++; } if (num == 0) { Log.Warning("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\TeamWarCry.cs", "EquipmentSlot_FireTeamWarCry", 51); } static BuffDef getBuff(BuffDef buffDef, EquipmentSlot equipmentSlot) { //IL_0017: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 //IL_0029: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) QualityTier currentEquipmentActionQualityTier = equipmentSlot.GetCurrentEquipmentActionQualityTier(); if (currentEquipmentActionQualityTier > QualityTier.None) { BuffIndex val2 = (BuffIndex)((!Object.op_Implicit((Object)(object)buffDef)) ? (-1) : ((int)buffDef.buffIndex)); BuffIndex buffIndexOfQuality = QualityCatalog.GetBuffIndexOfQuality(val2, currentEquipmentActionQualityTier); if ((int)buffIndexOfQuality != -1 && buffIndexOfQuality != val2) { buffDef = BuffCatalog.GetBuffDef(buffIndexOfQuality); val2 = buffIndexOfQuality; } } return buffDef; } } } internal static class VendingMachine { private static readonly GameObject[] _qualityVendingMachineProjectilePrefabs = (GameObject[])(object)new GameObject[4]; [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle handle = AddressableUtil.LoadTempAssetAsync(RoR2_DLC1_VendingMachine.VendingMachineProjectile_prefab); handle.OnSuccess(delegate(GameObject vendingMachineProjectilePrefab) { ProjectileInstantiateDeployable val2 = default(ProjectileInstantiateDeployable); for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { GameObject val = PrefabAPI.InstantiateClone(vendingMachineProjectilePrefab, ((Object)vendingMachineProjectilePrefab).name + qualityTier); if (val.TryGetComponent(ref val2)) { val2.prefab = PrefabAPI.InstantiateClone(val2.prefab, ((Object)val2.prefab).name + qualityTier); InteractOnTimer interactOnTimer = UnityObjectExtensions.EnsureComponent(val2.prefab); interactOnTimer.InteractInterval = qualityTier switch { QualityTier.Uncommon => 15f, QualityTier.Rare => 8f, QualityTier.Epic => 4f, QualityTier.Legendary => 1f, _ => throw new NotImplementedException($"Quality tier {qualityTier} is not implemented"), }; args.ContentPack.networkedObjectPrefabs.Add(val2.prefab); } else { Log.Error(((Object)val).name + " is missing ProjectileInstantiateDeployable component", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\VendingMachine.cs", "LoadContent", 50); } args.ContentPack.projectilePrefabs.Add(val); _qualityVendingMachineProjectilePrefabs[(int)qualityTier] = val; } }); return handle.AsProgressCoroutine>(args.ProgressReceiver); } [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown EquipmentSlot.FireVendingMachine += new Manipulator(EquipmentSlot_FireVendingMachine); } private static void EquipmentSlot_FireVendingMachine(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Prefabs/Projectiles/VendingMachineProjectile"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(LegacyResourcesAPI), "Load") })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Equipments\\VendingMachine.cs", "EquipmentSlot_FireVendingMachine", 76); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)getProjectilePrefab); static GameObject getProjectilePrefab(GameObject projectilePrefab, EquipmentSlot equipmentSlot) { QualityTier currentEquipmentActionQualityTier = equipmentSlot.GetCurrentEquipmentActionQualityTier(); GameObject safe = ArrayUtils.GetSafe(_qualityVendingMachineProjectilePrefabs, (int)currentEquipmentActionQualityTier); if (Object.op_Implicit((Object)(object)safe)) { projectilePrefab = safe; } return projectilePrefab; } } } } namespace ItemQualities.ContentManagement { internal sealed class ContentInitializerArgs { public ExtendedContentPack ContentPack { get; } public ReadableProgress ProgressReceiver { get; } public ContentInitializerArgs(ExtendedContentPack contentPack, ReadableProgress progressReceiver) { ContentPack = contentPack; ProgressReceiver = progressReceiver; } } [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] internal sealed class ContentInitializerAttribute : SearchableAttribute { private sealed class ParallelCoroutineGroup : IEnumerator { private readonly HashSet _initializedTypes = new HashSet(); private readonly ParallelProgressCoroutine _combinedCoroutine; public readonly ReadableProgress Progress; object IEnumerator.Current => ((IEnumerator)_combinedCoroutine).Current; public IReadOnlyCollection InitializedTypes => _initializedTypes; public ParallelCoroutineGroup(ReadableProgress progressReceiver) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown Progress = progressReceiver; _combinedCoroutine = new ParallelProgressCoroutine((IProgress)Progress); } public bool InitializesType(Type type) { return _initializedTypes.Contains(type); } public void Add(ContentInitializerAttribute attribute, IEnumerator coroutine, ReadableProgress coroutineProgressReceiver) { SetInitialized(attribute); _combinedCoroutine.Add(coroutine, coroutineProgressReceiver); } public void SetInitialized(ContentInitializerAttribute attribute) { _initializedTypes.Add(attribute.target.DeclaringType); } bool IEnumerator.MoveNext() { return ((IEnumerator)_combinedCoroutine).MoveNext(); } void IEnumerator.Reset() { ((IEnumerator)_combinedCoroutine).Reset(); } } public MethodInfo target => ((SearchableAttribute)this).target as MethodInfo; public Type[] Dependencies { get; } = Array.Empty(); public ContentInitializerAttribute() { } public ContentInitializerAttribute(params Type[] dependencies) { Dependencies = dependencies; } public static IEnumerator RunContentInitializers(ExtendedContentPack contentPack, TProgress progressReceiver) where TProgress : IProgress { List<(IEnumerator coroutine, ReadableProgress progress)> contentInitializersSequence = new List<(IEnumerator, ReadableProgress)>(); List list = new List(); List list2 = new List(); SearchableAttribute.GetInstances(list2); while (list2.Count > 0) { bool flag = false; for (int num = list2.Count - 1; num >= 0; num--) { ContentInitializerAttribute contentInitializerAttribute = list2[num]; MethodInfo methodInfo = contentInitializerAttribute.target; ParameterInfo[] parameters = methodInfo.GetParameters(); if (parameters.Length != 1 || parameters[0].ParameterType != typeof(ContentInitializerArgs)) { Log.Error("Invalid parameters for Content Initializer method " + methodInfo.DeclaringType.FullName + "." + methodInfo.Name, "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ContentManagement\\ContentInitializerAttribute.cs", "RunContentInitializers", 50); list2.RemoveAt(num); } else { int num2 = -1; List list3 = contentInitializerAttribute.Dependencies.ToList(); if (list3.Count > 0) { for (int j = 0; j < list.Count; j++) { if (list3.RemoveAll(list[j].InitializesType) > 0) { num2 = j; if (list3.Count == 0) { break; } } } } if (list3.Count == 0) { ReadableProgress val = new ReadableProgress(); ContentInitializerArgs contentIntializerArgs2 = new ContentInitializerArgs(contentPack, val); int num3 = ((num2 >= 0) ? (num2 + 1) : 0); ParallelCoroutineGroup parallelCoroutineGroup; if (num3 < list.Count) { parallelCoroutineGroup = list[num3]; } else { ReadableProgress val2 = new ReadableProgress(); parallelCoroutineGroup = new ParallelCoroutineGroup(val2); list.Add(parallelCoroutineGroup); contentInitializersSequence.Add((parallelCoroutineGroup, val2)); } parallelCoroutineGroup.Add(contentInitializerAttribute, runInitializerCoroutine(methodInfo, contentIntializerArgs2), val); list2.RemoveAt(num); flag = true; } } } if (!flag) { Log.Error($"Failed to find group for {list2.Count} content initializer attribute(s)", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ContentManagement\\ContentInitializerAttribute.cs", "RunContentInitializers", 122); break; } } PartitionedProgress partitionedProgress = new PartitionedProgress(progressReceiver); ProgressPartition[] initializerGroupProgressReceivers = partitionedProgress.AddPartitions(contentInitializersSequence.Count); for (int i = 0; i < contentInitializersSequence.Count; i++) { var (coroutine, progress) = contentInitializersSequence[i]; while (coroutine.MoveNext()) { yield return coroutine.Current; initializerGroupProgressReceivers[i].Report(progress.value); } initializerGroupProgressReceivers[i].Report(1f); } static IEnumerator runInitializerCoroutine(MethodInfo method, ContentInitializerArgs contentIntializerArgs) { object obj = method.Invoke(null, new object[1] { contentIntializerArgs }); if (obj is IEnumerator enumerator) { yield return enumerator; } else if (obj is IEnumerable enumerable) { yield return enumerable.GetEnumerator(); } else if (method.ReturnType != typeof(void)) { throw new NotImplementedException($"Unhandled return value: {obj} ({method.ReturnType.FullName}) from method {method.DeclaringType.FullName}.{method.Name}"); } } } } internal sealed class ExtendedContentPack { private readonly ContentPack _innerContentPack; private readonly NamedAssetCollection[] _extendedAssetCollections = Array.Empty(); public static Func getUnityObjectName = (Object obj) => obj.name; public string identifier { get { return _innerContentPack.identifier; } internal set { _innerContentPack.identifier = value; } } public NamedAssetCollection bodyPrefabs => _innerContentPack.bodyPrefabs; public NamedAssetCollection masterPrefabs => _innerContentPack.masterPrefabs; public NamedAssetCollection projectilePrefabs => _innerContentPack.projectilePrefabs; public NamedAssetCollection gameModePrefabs => _innerContentPack.gameModePrefabs; public NamedAssetCollection networkedObjectPrefabs => _innerContentPack.networkedObjectPrefabs; public NamedAssetCollection skillDefs => _innerContentPack.skillDefs; public NamedAssetCollection skillFamilies => _innerContentPack.skillFamilies; public NamedAssetCollection sceneDefs => _innerContentPack.sceneDefs; public NamedAssetCollection itemDefs => _innerContentPack.itemDefs; public NamedAssetCollection itemTierDefs => _innerContentPack.itemTierDefs; public NamedAssetCollection itemRelationshipProviders => _innerContentPack.itemRelationshipProviders; public NamedAssetCollection itemRelationshipTypes => _innerContentPack.itemRelationshipTypes; public NamedAssetCollection equipmentDefs => _innerContentPack.equipmentDefs; public NamedAssetCollection buffDefs => _innerContentPack.buffDefs; public NamedAssetCollection eliteDefs => _innerContentPack.eliteDefs; public NamedAssetCollection unlockableDefs => _innerContentPack.unlockableDefs; public NamedAssetCollection survivorDefs => _innerContentPack.survivorDefs; public NamedAssetCollection artifactDefs => _innerContentPack.artifactDefs; public NamedAssetCollection effectDefs => _innerContentPack.effectDefs; public NamedAssetCollection surfaceDefs => _innerContentPack.surfaceDefs; public NamedAssetCollection networkSoundEventDefs => _innerContentPack.networkSoundEventDefs; public NamedAssetCollection musicTrackDefs => _innerContentPack.musicTrackDefs; public NamedAssetCollection gameEndingDefs => _innerContentPack.gameEndingDefs; public NamedAssetCollection entityStateConfigurations => _innerContentPack.entityStateConfigurations; public NamedAssetCollection expansionDefs => _innerContentPack.expansionDefs; public NamedAssetCollection entitlementDefs => _innerContentPack.entitlementDefs; public NamedAssetCollection miscPickupDefs => _innerContentPack.miscPickupDefs; public NamedAssetCollection entityStateTypes => _innerContentPack.entityStateTypes; public NamedAssetCollection prefabs { get; } = new NamedAssetCollection(ContentPack.getGameObjectName); public NamedAssetCollection spawnCards { get; } = new NamedAssetCollection((Func)ContentPack.getScriptableObjectName); public NamedAssetCollection qualityTierDefs { get; } = new NamedAssetCollection((Func)ContentPack.getScriptableObjectName); public NamedAssetCollection itemQualityGroups { get; } = new NamedAssetCollection((Func)ContentPack.getScriptableObjectName); public NamedAssetCollection equipmentQualityGroups { get; } = new NamedAssetCollection((Func)ContentPack.getScriptableObjectName); public NamedAssetCollection buffQualityGroups { get; } = new NamedAssetCollection((Func)ContentPack.getScriptableObjectName); public NamedAssetCollection spriteAssets { get; } = new NamedAssetCollection((Func)ContentPack.getScriptableObjectName); public NamedAssetCollection materials { get; } = new NamedAssetCollection((Func)getUnityObjectName); public NamedAssetCollection textures { get; } = new NamedAssetCollection((Func)getUnityObjectName); public NamedAssetCollection sprites { get; } = new NamedAssetCollection((Func)getUnityObjectName); public IEnumerable allAssets { get { List list = new List(); foreach (NamedAssetCollection item in _innerContentPack.assetCollections.OfType().Concat(_extendedAssetCollections)) { if (item is IEnumerable source) { list.AddRange(source.OfType()); } } return list; } } public ExtendedContentPack(ContentPack contentPack) { _innerContentPack = contentPack; _extendedAssetCollections = (NamedAssetCollection[])(object)new NamedAssetCollection[8] { (NamedAssetCollection)prefabs, (NamedAssetCollection)spawnCards, (NamedAssetCollection)qualityTierDefs, (NamedAssetCollection)itemQualityGroups, (NamedAssetCollection)equipmentQualityGroups, (NamedAssetCollection)buffQualityGroups, (NamedAssetCollection)spriteAssets, (NamedAssetCollection)materials }; } public ExtendedContentPack() : this(new ContentPack()) { }//IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown public static implicit operator ContentPack(ExtendedContentPack contentPack) { return contentPack._innerContentPack; } } internal interface IAsyncAssetGenerator { IEnumerator GenerateAssetsAsync(ExtendedContentPack contentPack, TProgress progressReceiver = default(TProgress)) where TProgress : IProgress; } internal interface IAsyncContentLoadCallback { IEnumerator OnContentLoad(TProgress progressReceiver = default(TProgress)) where TProgress : IProgress; } internal interface IContentLoadCallback { void OnContentLoad(); } internal sealed class PartitionedProgress where TReceiver : IProgress { private readonly TReceiver _progressReceiver; private readonly List _partitions = new List(); public float Progress { get; private set; } public PartitionedProgress(TReceiver receiver) { _progressReceiver = receiver; } public ProgressPartition AddPartition(float weight = 1f) { ProgressPartition progressPartition = new ProgressPartition(weight); progressPartition.OnReport += onPartitionReport; _partitions.Add(progressPartition); return progressPartition; } public ProgressPartition[] AddPartitions(int count, float weight = 1f) { ProgressPartition[] array = new ProgressPartition[count]; for (int i = 0; i < count; i++) { array[i] = AddPartition(weight); } return array; } private void recalculateProgress() { float num = 0f; if (_partitions.Count > 0) { float num2 = 0f; foreach (ProgressPartition partition in _partitions) { num += partition.Value * partition.Weight; num2 += partition.Weight; } num /= num2; } Progress = num; } private void onPartitionReport(float _) { recalculateProgress(); _progressReceiver.Report(Progress); } } internal sealed class ProgressPartition : IProgress { public float Value { get; private set; } public float Weight { get; } public event Action OnReport; public ProgressPartition(float weight = 1f) { Weight = weight; } public void Report(float value) { Value = value; this.OnReport?.Invoke(value); } } internal sealed class ProjectileExplosionEffectScaleFixHelper { public void Step(ExtendedContentPack contentPack, GetContentPackAsyncArgs args) { //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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_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) Enumerator enumerator = args.peerLoadInfos.GetEnumerator(); try { ProjectileExplosion val = default(ProjectileExplosion); ProjectileImpactExplosion val2 = default(ProjectileImpactExplosion); while (enumerator.MoveNext()) { ContentPackLoadInfo current = enumerator.Current; AssetEnumerator enumerator2 = ((ReadOnlyContentPack)(ref current.previousContentPack)).projectilePrefabs.GetEnumerator(); try { while (enumerator2.MoveNext()) { GameObject current2 = enumerator2.Current; if (current2.TryGetComponent(ref val)) { tryFixProjectileEffectPrefab(ref val.explosionEffect, val.blastRadius); } if (current2.TryGetComponent(ref val2)) { tryFixProjectileEffectPrefab(ref val2.impactEffect, ((ProjectileExplosion)val2).blastRadius); } } } finally { ((IDisposable)enumerator2).Dispose(); } } } finally { ((IDisposable)enumerator).Dispose(); } static void tryFixProjectileEffectPrefab(ref GameObject effectPrefab, float defaultRadius) { EffectComponent val3 = default(EffectComponent); if (Object.op_Implicit((Object)(object)effectPrefab) && effectPrefab.TryGetComponent(ref val3) && !val3.applyScale) { EffectDef orCreateFixedScalingCopy = EffectScalingFixer.GetOrCreateFixedScalingCopy(effectPrefab, defaultRadius); if (orCreateFixedScalingCopy != null) { effectPrefab = orCreateFixedScalingCopy.prefab; } } } } } internal sealed class QualityContagiousItemHelper : IDisposable { private int _completedSteps; private readonly AssetReferenceT _contagiousItemRelationshipTypeRef = new AssetReferenceT(RoR2_DLC1_Common.ContagiousItem_asset); private ItemRelationshipType _contagiousItemRelationshipType; private ItemRelationshipProvider _contagiousQualityItemProvider; private bool _contagiousItemProviderInContentPack; private readonly Dictionary _baseItemToGroupLookup = new Dictionary(); private readonly List> _itemDefReferences = new List>(); private IEnumerator initialize(ExtendedContentPack contentPack, TProgress progessReceiver) where TProgress : IProgress { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) ParallelProgressCoroutine val = new ParallelProgressCoroutine((IProgress)progessReceiver); AsyncOperationHandle handle = AssetAsyncReferenceManager.LoadAsset(_contagiousItemRelationshipTypeRef, (AsyncReferenceHandleUnloadType)2); handle.OnSuccess(delegate(ItemRelationshipType contagiousItemRelationshipType) { _contagiousItemRelationshipType = contagiousItemRelationshipType; }); val.Add(in handle); AssetEnumerator enumerator = contentPack.itemQualityGroups.GetEnumerator(); try { while (enumerator.MoveNext()) { ItemQualityGroup current = enumerator.Current; if (Object.op_Implicit((Object)(object)current.BaseItem)) { _baseItemToGroupLookup[current.BaseItem] = current; } else if (current.BaseItemReference != null && ((AssetReference)current.BaseItemReference).RuntimeKeyIsValid()) { AsyncOperationHandle handle2 = AssetAsyncReferenceManager.LoadAsset(current.BaseItemReference, (AsyncReferenceHandleUnloadType)2); ItemQualityGroup capturedItemQualityGroup = current; handle2.OnSuccess(delegate(ItemDef baseItem) { _baseItemToGroupLookup[baseItem] = capturedItemQualityGroup; }); _itemDefReferences.Add(current.BaseItemReference); val.Add(in handle2); } } return (IEnumerator)val; } finally { ((IDisposable)enumerator).Dispose(); } } public IEnumerator Step(ExtendedContentPack contentPack, GetContentPackAsyncArgs args, TProgress progessReceiver) where TProgress : IProgress { if (_completedSteps == 0) { yield return initialize(contentPack, progessReceiver); } bool contagiousItemProviderInContentPack = false; if (Object.op_Implicit((Object)(object)_contagiousItemRelationshipType)) { List list = new List(); Enumerator enumerator = args.peerLoadInfos.GetEnumerator(); try { while (enumerator.MoveNext()) { ReadOnlyContentPack previousContentPack = enumerator.Current.previousContentPack; if (!(((ReadOnlyContentPack)(ref previousContentPack)).identifier != contentPack.identifier)) { continue; } AssetEnumerator enumerator2 = ((ReadOnlyContentPack)(ref previousContentPack)).itemRelationshipProviders.GetEnumerator(); try { while (enumerator2.MoveNext()) { ItemRelationshipProvider current = enumerator2.Current; if ((Object)(object)current.relationshipType == (Object)(object)_contagiousItemRelationshipType) { list.AddRange(current.relationships); } } } finally { ((IDisposable)enumerator2).Dispose(); } } } finally { ((IDisposable)enumerator).Dispose(); } List list2 = new List(); foreach (Pair item in list) { ItemDef itemDef = item.itemDef1; ItemDef itemDef2 = item.itemDef2; if (!Object.op_Implicit((Object)(object)itemDef) || !Object.op_Implicit((Object)(object)itemDef2) || !_baseItemToGroupLookup.TryGetValue(itemDef, out var value)) { continue; } ItemQualityGroup valueOrDefault = System.Collections.Generic.CollectionExtensions.GetValueOrDefault(_baseItemToGroupLookup, itemDef2); for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { ItemDef itemDef3 = value.GetItemDef(qualityTier); ItemDef val = (Object.op_Implicit((Object)(object)valueOrDefault) ? valueOrDefault.GetItemDef(qualityTier) : null); if (!Object.op_Implicit((Object)(object)val)) { val = itemDef2; } if (Object.op_Implicit((Object)(object)itemDef3) && Object.op_Implicit((Object)(object)val)) { list2.Add(new Pair { itemDef1 = itemDef3, itemDef2 = val }); } } } if (list2.Count > 0) { if (!Object.op_Implicit((Object)(object)_contagiousQualityItemProvider)) { _contagiousQualityItemProvider = ScriptableObject.CreateInstance(); ((Object)_contagiousQualityItemProvider).name = "QualityContagiousItemProvider"; _contagiousQualityItemProvider.relationshipType = _contagiousItemRelationshipType; } _contagiousQualityItemProvider.relationships = list2.ToArray(); args.output.itemRelationshipProviders.Add(_contagiousQualityItemProvider); contagiousItemProviderInContentPack = true; } } _contagiousItemProviderInContentPack = contagiousItemProviderInContentPack; _completedSteps++; progessReceiver.Report(1f); } public void Dispose() { AssetAsyncReferenceManager.UnloadAsset(_contagiousItemRelationshipTypeRef); _contagiousItemRelationshipType = null; foreach (AssetReferenceT itemDefReference in _itemDefReferences) { AssetAsyncReferenceManager.UnloadAsset(itemDefReference); } _itemDefReferences.Clear(); _baseItemToGroupLookup.Clear(); if (Object.op_Implicit((Object)(object)_contagiousQualityItemProvider)) { if (!_contagiousItemProviderInContentPack) { Object.Destroy((Object)(object)_contagiousQualityItemProvider); } _contagiousQualityItemProvider = null; } } } public sealed class QualityContentLoadArgs { private readonly List _itemQualityGroups; private readonly List _equipmentQualityGroups; private readonly List _buffQualityGroups; public IProgress ProgressReceiver { get; } internal QualityContentLoadArgs(List itemQualityGroups, List equipmentQualityGroups, List buffQualityGroups, IProgress progressReceiver) { _itemQualityGroups = itemQualityGroups; _equipmentQualityGroups = equipmentQualityGroups; _buffQualityGroups = buffQualityGroups; ProgressReceiver = progressReceiver; } public ItemQualityGroup CreateItemQualityGroup(ItemDef baseItem) { if (!Object.op_Implicit((Object)(object)baseItem)) { throw new ArgumentNullException("baseItem"); } ItemQualityGroup itemQualityGroup = ScriptableObject.CreateInstance(); ((Object)itemQualityGroup).name = "ig" + ((Object)baseItem).name; itemQualityGroup.BaseItem = baseItem; _itemQualityGroups.Add(itemQualityGroup); return itemQualityGroup; } public ItemQualityGroup CreateItemQualityGroup(AssetReferenceT baseItemReference) { if (baseItemReference == null || !((AssetReference)baseItemReference).RuntimeKeyIsValid()) { throw new ArgumentException("Base item reference must be a valid asset key", "baseItemReference"); } ItemQualityGroup itemQualityGroup = ScriptableObject.CreateInstance(); ((Object)itemQualityGroup).name = "ig" + ((AssetReference)baseItemReference).RuntimeKey; itemQualityGroup.BaseItemReference = baseItemReference; _itemQualityGroups.Add(itemQualityGroup); return itemQualityGroup; } public EquipmentQualityGroup CreateEquipmentQualityGroup(EquipmentDef baseEquipment) { if (!Object.op_Implicit((Object)(object)baseEquipment)) { throw new ArgumentNullException("baseEquipment"); } EquipmentQualityGroup equipmentQualityGroup = ScriptableObject.CreateInstance(); ((Object)equipmentQualityGroup).name = "eg" + ((Object)baseEquipment).name; equipmentQualityGroup.BaseEquipment = baseEquipment; _equipmentQualityGroups.Add(equipmentQualityGroup); return equipmentQualityGroup; } public EquipmentQualityGroup CreateEquipmentQualityGroup(AssetReferenceT baseEquipmentReference) { if (baseEquipmentReference == null || !((AssetReference)baseEquipmentReference).RuntimeKeyIsValid()) { throw new ArgumentException("Base equipment reference must be a valid asset key", "baseEquipmentReference"); } EquipmentQualityGroup equipmentQualityGroup = ScriptableObject.CreateInstance(); ((Object)equipmentQualityGroup).name = "eg" + ((AssetReference)baseEquipmentReference).RuntimeKey; equipmentQualityGroup.BaseEquipmentReference = baseEquipmentReference; _equipmentQualityGroups.Add(equipmentQualityGroup); return equipmentQualityGroup; } public BuffQualityGroup CreateBuffQualityGroup(BuffDef baseBuff) { if (!Object.op_Implicit((Object)(object)baseBuff)) { throw new ArgumentNullException("baseBuff"); } BuffQualityGroup buffQualityGroup = ScriptableObject.CreateInstance(); ((Object)buffQualityGroup).name = "bg" + ((Object)baseBuff).name; buffQualityGroup.BaseBuff = baseBuff; _buffQualityGroups.Add(buffQualityGroup); return buffQualityGroup; } public BuffQualityGroup CreateBuffQualityGroup(AssetReferenceT baseBuffReference) { if (baseBuffReference == null || !((AssetReference)baseBuffReference).RuntimeKeyIsValid()) { throw new ArgumentException("Base buff reference must be a valid asset key", "baseBuffReference"); } BuffQualityGroup buffQualityGroup = ScriptableObject.CreateInstance(); ((Object)buffQualityGroup).name = "bg" + ((AssetReference)baseBuffReference).RuntimeKey; buffQualityGroup.BaseBuffReference = baseBuffReference; _buffQualityGroups.Add(buffQualityGroup); return buffQualityGroup; } } public static class QualityContentManager { public delegate IEnumerator LoadContentAsyncDelegate(QualityContentLoadArgs args); private static bool _hasCollectedLoadCoroutines; private static event LoadContentAsyncDelegate loadContentInternal; public static event LoadContentAsyncDelegate LoadContentAsync { add { if (_hasCollectedLoadCoroutines) { Log.Error("Cannot add content load callback after content initialization has already started.", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ContentManagement\\QualityContentManager.cs", "LoadContentAsync", 22); } else { loadContentInternal += value; } } remove { loadContentInternal -= value; } } [ContentInitializer] private static IEnumerator LoadContent(ContentInitializerArgs args) { if (QualityContentManager.loadContentInternal == null) { args.ProgressReceiver.Report(1f); yield break; } PartitionedProgress> partitionedProgress = new PartitionedProgress>((IProgress)args.ProgressReceiver); ProgressPartition progressPartition = partitionedProgress.AddPartition(); ProgressPartition generateAssetsProgress = partitionedProgress.AddPartition(); ParallelProgressCoroutine val = new ParallelProgressCoroutine((IProgress)progressPartition); List itemQualityGroups = new List(); List equipmentQualityGroups = new List(); List buffQualityGroups = new List(); foreach (LoadContentAsyncDelegate item in QualityContentManager.loadContentInternal.GetInvocationList().OfType()) { if (item != null) { ReadableProgress val2 = new ReadableProgress(); QualityContentLoadArgs args2 = new QualityContentLoadArgs(itemQualityGroups, equipmentQualityGroups, buffQualityGroups, (IProgress)val2); val.Add(safeCoroutineWrapper(item, args2), val2); } } _hasCollectedLoadCoroutines = true; yield return val; ParallelProgressCoroutine val3 = new ParallelProgressCoroutine((IProgress)generateAssetsProgress); foreach (ItemQualityGroup item2 in itemQualityGroups) { val3.AddProgressCoroutine(item2.GenerateRuntimeAssetsAsync>, args.ContentPack); } foreach (EquipmentQualityGroup item3 in equipmentQualityGroups) { val3.AddProgressCoroutine(item3.GenerateRuntimeAssetsAsync>, args.ContentPack); } foreach (BuffQualityGroup item4 in buffQualityGroups) { val3.AddProgressCoroutine(item4.GenerateRuntimeAssetsAsync>, args.ContentPack); } yield return val3; if (itemQualityGroups.Count > 0) { args.ContentPack.itemQualityGroups.Add(itemQualityGroups.ToArray()); } if (equipmentQualityGroups.Count > 0) { args.ContentPack.equipmentQualityGroups.Add(equipmentQualityGroups.ToArray()); } if (buffQualityGroups.Count > 0) { args.ContentPack.buffQualityGroups.Add(buffQualityGroups.ToArray()); } args.ProgressReceiver.Report(1f); } private static bool safeMoveNext(IEnumerator enumerator, out object current) { try { if (enumerator.MoveNext()) { current = enumerator.Current; return true; } } catch (Exception ex) { Log.Error_NoCallerPrefix(ex.ToString()); } current = null; return false; } private static IEnumerator safeCoroutineWrapper(LoadContentAsyncDelegate loadContentDelegate, QualityContentLoadArgs args) { IEnumerator coroutine; try { coroutine = loadContentDelegate(args); } catch (Exception ex) { Log.Error_NoCallerPrefix(ex.ToString()); coroutine = null; } if (coroutine != null) { object current; while (safeMoveNext(coroutine, out current)) { yield return current; } } args.ProgressReceiver.Report(1f); } } } namespace ItemQualities.Config { public sealed class AcceptableValueMax : AcceptableValueBase where T : IComparable { private readonly string _cachedMaxValueString; public T MaxValue { get; } public AcceptableValueMax(T maxValue, string customValueFormat = null) : base(typeof(T)) { if (maxValue == null) { throw new ArgumentNullException("maxValue"); } MaxValue = maxValue; _cachedMaxValueString = (string.IsNullOrEmpty(customValueFormat) ? MaxValue.ToString() : string.Format("{0:" + customValueFormat + "}", MaxValue)); } public override object Clamp(object value) { if (MaxValue.CompareTo(value) < 0) { return MaxValue; } return value; } public override bool IsValid(object value) { return MaxValue.CompareTo(value) >= 0; } public override string ToDescriptionString() { return "# Acceptable value range: Lesser than or equal to " + _cachedMaxValueString; } } public sealed class AcceptableValueMin : AcceptableValueBase where T : IComparable { private readonly string _cachedMinValueString; public T MinValue { get; } public AcceptableValueMin(T minValue, string customValueFormat = null) : base(typeof(T)) { if (minValue == null) { throw new ArgumentNullException("minValue"); } MinValue = minValue; _cachedMinValueString = (string.IsNullOrEmpty(customValueFormat) ? MinValue.ToString() : string.Format("{0:" + customValueFormat + "}", MinValue)); } public override object Clamp(object value) { if (MinValue.CompareTo(value) > 0) { return MinValue; } return value; } public override bool IsValid(object value) { return MinValue.CompareTo(value) <= 0; } public override string ToDescriptionString() { return "# Acceptable value range: Greater than or equal to " + _cachedMinValueString; } } } namespace ItemQualities.Buffs { internal static class BuffHooks { public delegate void BodyBuffGainedOrLostDelegate(CharacterBody body, BuffDef buffDef); public delegate void BodyBuffCountChangedDelegate(CharacterBody body, BuffIndex buffIndex, int newCount); public readonly ref struct DisableBuffCountHooksScope { private readonly CharacterBody _body; public DisableBuffCountHooksScope(CharacterBody body) { _body = body; _disableBuffCountHooksForBodies.Add(_body); } public void Dispose() { _disableBuffCountHooksForBodies.Remove(_body); } } private static readonly List _disableBuffCountHooksForBodies = new List(); public static event BodyBuffGainedOrLostDelegate OnBuffFirstStackGainedGlobal; public static event BodyBuffGainedOrLostDelegate OnBuffFinalStackLostGlobal; public static event BodyBuffCountChangedDelegate OnBodyBuffCountChangedGlobal; [SystemInitializer(new Type[] { })] private static void Init() { //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 //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown CharacterBody.SetBuffCount += new hook_SetBuffCount(On_CharacterBody_SetBuffCount); CharacterBody.GetBuffCount_BuffIndex += new hook_GetBuffCount_BuffIndex(CharacterBody_GetBuffCount_BuffIndex); CharacterBody.ClearTimedBuffs_BuffIndex += new hook_ClearTimedBuffs_BuffIndex(CharacterBody_ClearTimedBuffs_BuffIndex); CharacterBody.RemoveBuff_BuffIndex += new hook_RemoveBuff_BuffIndex(CharacterBody_RemoveBuff_BuffIndex); CharacterBody.ClearAllBuffs += new hook_ClearAllBuffs(CharacterBody_ClearAllBuffs); BuffDisplay.AllocateIcons += new hook_AllocateIcons(BuffDisplay_AllocateIcons); CharacterBody.SetBuffCount += new Manipulator(CharacterBody_SetBuffCount); CharacterBody.RemoveBuff_BuffIndex += new Manipulator(patchBuffEqualityComparison); CharacterBody.OnBuffFinalStackLost += new Manipulator(patchBuffEqualityComparison); CharacterBody.AddOrRemoveEliteItemBehavior += new Manipulator(patchBuffEqualityComparison); CharacterBody.OnBuffFirstStackGained += new Manipulator(patchBuffEqualityComparison); CharacterBody.OnBuffFirstStackGained += new hook_OnBuffFirstStackGained(CharacterBody_OnBuffFirstStackGained); CharacterBody.OnBuffFinalStackLost += new hook_OnBuffFinalStackLost(CharacterBody_OnBuffFinalStackLost); } private static void On_CharacterBody_SetBuffCount(orig_SetBuffCount orig, CharacterBody self, BuffIndex buffType, int newCount) { //IL_0002: 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) orig.Invoke(self, buffType, newCount); if (BuffHooks.OnBodyBuffCountChangedGlobal != null) { try { BuffHooks.OnBodyBuffCountChangedGlobal(self, buffType, newCount); } catch (Exception ex) { Log.Warning_NoCallerPrefix(ex.ToString()); } } } private static void CharacterBody_OnBuffFirstStackGained(orig_OnBuffFirstStackGained orig, CharacterBody self, BuffDef buffDef) { orig.Invoke(self, buffDef); if (BuffHooks.OnBuffFirstStackGainedGlobal == null) { return; } foreach (BodyBuffGainedOrLostDelegate item in BuffHooks.OnBuffFirstStackGainedGlobal.GetInvocationList().OfType()) { try { item(self, buffDef); } catch (Exception ex) { Log.Warning_NoCallerPrefix("Failed to invoke event listener for OnBuffFirstStackGained: " + ex); } } } private static void CharacterBody_OnBuffFinalStackLost(orig_OnBuffFinalStackLost orig, CharacterBody self, BuffDef buffDef) { orig.Invoke(self, buffDef); if (BuffHooks.OnBuffFinalStackLostGlobal == null) { return; } foreach (BodyBuffGainedOrLostDelegate item in BuffHooks.OnBuffFinalStackLostGlobal.GetInvocationList().OfType()) { try { item(self, buffDef); } catch (Exception ex) { Log.Warning_NoCallerPrefix("Failed to invoke event listener for OnBuffFinalStackLost: " + ex); } } } private static int CharacterBody_GetBuffCount_BuffIndex(orig_GetBuffCount_BuffIndex orig, CharacterBody self, BuffIndex buffType) { //IL_0002: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Invalid comparison between Unknown and I4 //IL_004d: Unknown result type (might be due to invalid IL or missing references) int num = orig.Invoke(self, buffType); if (!_disableBuffCountHooksForBodies.Contains(self)) { try { if (QualityCatalog.GetQualityTier(buffType) == QualityTier.None) { BuffQualityGroupIndex buffQualityGroupIndex = QualityCatalog.FindBuffQualityGroupIndex(buffType); if (buffQualityGroupIndex != BuffQualityGroupIndex.Invalid) { BuffQualityGroup buffQualityGroup = QualityCatalog.GetBuffQualityGroup(buffQualityGroupIndex); if (buffQualityGroup.InheritBaseBuffBehavior) { for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { BuffIndex buffIndex = buffQualityGroup.GetBuffIndex(qualityTier); if ((int)buffIndex != -1) { num += self.GetBuffCountRaw(buffIndex); } } } } } } catch (Exception ex) { Log.Warning_NoCallerPrefix(ex.ToString()); } } return num; } private static void CharacterBody_ClearTimedBuffs_BuffIndex(orig_ClearTimedBuffs_BuffIndex orig, CharacterBody self, BuffIndex buffType) { //IL_0002: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Invalid comparison between Unknown and I4 //IL_004b: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, buffType); if (_disableBuffCountHooksForBodies.Contains(self)) { return; } try { if (QualityCatalog.GetQualityTier(buffType) != QualityTier.None) { return; } BuffQualityGroupIndex buffQualityGroupIndex = QualityCatalog.FindBuffQualityGroupIndex(buffType); if (buffQualityGroupIndex == BuffQualityGroupIndex.Invalid) { return; } BuffQualityGroup buffQualityGroup = QualityCatalog.GetBuffQualityGroup(buffQualityGroupIndex); if (!buffQualityGroup.InheritBaseBuffBehavior) { return; } for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { BuffIndex buffIndex = buffQualityGroup.GetBuffIndex(qualityTier); if ((int)buffIndex != -1) { self.ClearTimedBuffs(buffIndex); } } } catch (Exception ex) { Log.Warning_NoCallerPrefix(ex.ToString()); } } private static void CharacterBody_RemoveBuff_BuffIndex(orig_RemoveBuff_BuffIndex orig, CharacterBody self, BuffIndex buffType) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) if (!_disableBuffCountHooksForBodies.Contains(self)) { try { if (self.GetBuffCountRaw(buffType) == 0 && QualityCatalog.GetQualityTier(buffType) == QualityTier.None) { BuffQualityGroupIndex buffQualityGroupIndex = QualityCatalog.FindBuffQualityGroupIndex(buffType); if (buffQualityGroupIndex != BuffQualityGroupIndex.Invalid) { BuffQualityGroup buffQualityGroup = QualityCatalog.GetBuffQualityGroup(buffQualityGroupIndex); if (buffQualityGroup.InheritBaseBuffBehavior) { for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { BuffIndex buffIndex = buffQualityGroup.GetBuffIndex(qualityTier); if ((int)buffIndex != -1 && self.GetBuffCountRaw(buffIndex) > 0) { buffType = buffIndex; break; } } } } } } catch (Exception ex) { Log.Warning_NoCallerPrefix(ex.ToString()); } } orig.Invoke(self, buffType); } private static void CharacterBody_ClearAllBuffs(orig_ClearAllBuffs orig, CharacterBody self, BuffDef buffToSet) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Invalid comparison between Unknown and I4 //IL_005f: 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) if (_disableBuffCountHooksForBodies.Contains(self)) { orig.Invoke(self, buffToSet); return; } try { BuffIndex buffIndex = (BuffIndex)((!Object.op_Implicit((Object)(object)buffToSet)) ? (-1) : ((int)buffToSet.buffIndex)); if (QualityCatalog.GetQualityTier(buffIndex) == QualityTier.None) { BuffQualityGroupIndex buffQualityGroupIndex = QualityCatalog.FindBuffQualityGroupIndex(buffIndex); if (buffQualityGroupIndex != BuffQualityGroupIndex.Invalid) { BuffQualityGroup buffQualityGroup = QualityCatalog.GetBuffQualityGroup(buffQualityGroupIndex); if (buffQualityGroup.InheritBaseBuffBehavior) { for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { BuffIndex buffIndex2 = buffQualityGroup.GetBuffIndex(qualityTier); if ((int)buffIndex2 != -1 && self.GetBuffCountRaw(buffIndex2) > 0) { using (new DisableBuffCountHooksScope(self)) { self.ClearAllBuffs(BuffCatalog.GetBuffDef(buffIndex2)); } } } } } } } catch (Exception ex) { Log.Warning_NoCallerPrefix(ex.ToString()); } using (new DisableBuffCountHooksScope(self)) { orig.Invoke(self, buffToSet); } } private static void BuffDisplay_AllocateIcons(orig_AllocateIcons orig, BuffDisplay self) { using (new DisableBuffCountHooksScope(self.source)) { orig.Invoke(self); } } private static void CharacterBody_SetBuffCount(ILContext il) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); VariableDefinition buffDefVar = null; Instruction afterFinalBuffStackLostInstruction = null; if (val.TryGotoNext((MoveType)0, new Func[4] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => x.MatchLdloc(il, out buffDefVar), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "OnBuffFinalStackLost"), (Instruction x) => x.MatchAny(out afterFinalBuffStackLostInstruction) })) { ILLabel val2 = val.DefineLabel(); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc, buffDefVar); val.EmitDelegate>((Func)shouldInvokeBuffGainedOrLost); val.Emit(OpCodes.Brfalse, (object)val2); val.Goto(afterFinalBuffStackLostInstruction, (MoveType)0, false); val.MarkLabel(val2); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc, buffDefVar); val.EmitDelegate>((Action)tryInvokeOnFinalBaseBuffStackLost); } else { Log.Error("Failed to find OnBuffFinalStackLost patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Buffs\\BuffHooks.cs", "CharacterBody_SetBuffCount", 360); } val.Goto(0, (MoveType)0, false); Instruction afterFirstBuffStackGainedInstruction = null; if (val.TryGotoNext((MoveType)0, new Func[4] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => x.MatchLdloc(il, out buffDefVar), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "OnBuffFirstStackGained"), (Instruction x) => x.MatchAny(out afterFirstBuffStackGainedInstruction) })) { ILLabel val3 = val.DefineLabel(); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc, buffDefVar); val.EmitDelegate>((Func)shouldInvokeBuffGainedOrLost); val.Emit(OpCodes.Brfalse, (object)val3); val.Goto(afterFirstBuffStackGainedInstruction, (MoveType)0, false); val.MarkLabel(val3); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc, buffDefVar); val.EmitDelegate>((Action)tryInvokeOnFirstBaseBuffStackGained); } else { Log.Error("Failed to find OnBuffFirstStackGained patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Buffs\\BuffHooks.cs", "CharacterBody_SetBuffCount", 401); } static bool shouldInvokeBaseBuffGainedOrLost(CharacterBody body, BuffIndex buffIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between Unknown and I4 //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_0048: Invalid comparison between Unknown and I4 //IL_004b: Unknown result type (might be due to invalid IL or missing references) QualityTier qualityTier = QualityCatalog.GetQualityTier(buffIndex); if (qualityTier == QualityTier.None) { return false; } BuffQualityGroupIndex buffQualityGroupIndex = QualityCatalog.FindBuffQualityGroupIndex(buffIndex); if (buffQualityGroupIndex == BuffQualityGroupIndex.Invalid) { return false; } BuffQualityGroup buffQualityGroup = QualityCatalog.GetBuffQualityGroup(buffQualityGroupIndex); if (!buffQualityGroup.InheritBaseBuffBehavior || (int)buffQualityGroup.BaseBuffIndex == -1) { return false; } for (QualityTier qualityTier2 = QualityTier.None; qualityTier2 < QualityTier.Count; qualityTier2++) { if (qualityTier2 != qualityTier) { BuffIndex buffIndex2 = buffQualityGroup.GetBuffIndex(qualityTier2); if ((int)buffIndex2 != -1 && body.HasBuffRaw(buffIndex2)) { return false; } } } return true; } static bool shouldInvokeBuffGainedOrLost(CharacterBody body, BuffDef buffDef) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) BuffIndex buffIndex3 = (BuffIndex)((!Object.op_Implicit((Object)(object)buffDef)) ? (-1) : ((int)buffDef.buffIndex)); BuffQualityGroupIndex buffQualityGroupIndex2 = QualityCatalog.FindBuffQualityGroupIndex(buffIndex3); if (buffQualityGroupIndex2 != BuffQualityGroupIndex.Invalid && !QualityCatalog.GetBuffQualityGroup(buffQualityGroupIndex2).InheritBaseBuffBehavior) { return true; } if (QualityCatalog.GetQualityTier(buffIndex3) <= QualityTier.None && buffQualityGroupIndex2 != BuffQualityGroupIndex.Invalid) { return body.GetBuffCounts(buffQualityGroupIndex2).TotalQualityCount == 0; } return true; } static void tryInvokeOnFinalBaseBuffStackLost(CharacterBody body, BuffDef buffDef) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) BuffIndex val5 = (BuffIndex)((!Object.op_Implicit((Object)(object)buffDef)) ? (-1) : ((int)buffDef.buffIndex)); if ((int)val5 != -1 && shouldInvokeBaseBuffGainedOrLost(body, val5)) { BuffIndex buffIndexOfQuality2 = QualityCatalog.GetBuffIndexOfQuality(val5, QualityTier.None); if (buffIndexOfQuality2 != val5) { body.OnBuffFinalStackLost(BuffCatalog.GetBuffDef(buffIndexOfQuality2)); } } } static void tryInvokeOnFirstBaseBuffStackGained(CharacterBody body, BuffDef buffDef) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) BuffIndex val4 = (BuffIndex)((!Object.op_Implicit((Object)(object)buffDef)) ? (-1) : ((int)buffDef.buffIndex)); if ((int)val4 != -1 && shouldInvokeBaseBuffGainedOrLost(body, val4)) { BuffIndex buffIndexOfQuality = QualityCatalog.GetBuffIndexOfQuality(val4, QualityTier.None); if (buffIndexOfQuality != val4) { body.OnBuffFirstStackGained(BuffCatalog.GetBuffDef(buffIndexOfQuality)); } } } } private static void patchBuffEqualityComparison(ILContext il) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) bool flag = false; bool flag2 = false; ParameterDefinition buffDefParameter = ((IEnumerable)((MethodReference)il.Method).Parameters).FirstOrDefault((Func)((ParameterDefinition p) => Extensions.Is((MemberReference)(object)((ParameterReference)p).ParameterType, (MemberInfo)typeof(BuffDef)))); if (buffDefParameter != null) { ILCursor val = new ILCursor(il); int num = 0; FieldReference buffField = null; Instruction buffMatchInstruction2 = null; ILLabel val7 = default(ILLabel); while (val.TryGotoNext((MoveType)1, new Func[5] { (Instruction x) => x.MatchLdarg(buffDefParameter), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, ref buffField), (Instruction x) => x.MatchOpEquality(), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val7), (Instruction x) => x.MatchAny(out buffMatchInstruction2) })) { ILLabel val2 = val.DefineLabel(); val.Emit(OpCodes.Ldarg, buffDefParameter); val.Emit(OpCodes.Ldsfld, buffField); val.EmitDelegate>((Func)matchBuffsWithQuality); val.Emit(OpCodes.Brtrue, (object)val2); val.Goto(buffMatchInstruction2, (MoveType)0, false); val.MarkLabel(val2); num++; } flag = true; if (num != 0) { flag2 = true; } } ParameterDefinition buffIndexParameter = ((IEnumerable)((MethodReference)il.Method).Parameters).FirstOrDefault((Func)((ParameterDefinition p) => Extensions.Is((MemberReference)(object)((ParameterReference)p).ParameterType, (MemberInfo)typeof(BuffIndex)))); if (buffIndexParameter != null) { ILCursor val3 = new ILCursor(il); int num2 = 0; FieldReference buffDefField = null; Instruction buffMatchInstruction = null; ILLabel val6 = default(ILLabel); while (val3.TryGotoNext((MoveType)1, new Func[5] { (Instruction x) => x.MatchLdarg(buffIndexParameter), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, ref buffDefField), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "get_buffIndex"), (Instruction x) => ILPatternMatchingExt.MatchBneUn(x, ref val6), (Instruction x) => x.MatchAny(out buffMatchInstruction) })) { ILLabel val4 = val3.DefineLabel(); val3.Emit(OpCodes.Ldarg, buffIndexParameter); val3.Emit(OpCodes.Ldsfld, buffDefField); val3.EmitDelegate>((Func)matchBuffsWithQuality); val3.Emit(OpCodes.Brtrue, (object)val4); val3.Goto(buffMatchInstruction, (MoveType)0, false); val3.MarkLabel(val4); num2++; } flag = true; if (num2 != 0) { flag2 = true; } } if (!flag) { Log.Error(((MemberReference)il.Method).FullName + ": Method is not valid for patch", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Buffs\\BuffHooks.cs", "patchBuffEqualityComparison", 531); } else if (!flag2) { Log.Error(((MemberReference)il.Method).FullName + ": Failed to find any patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Buffs\\BuffHooks.cs", "patchBuffEqualityComparison", 535); } static bool matchBuffsWithQuality(BuffDef buffA, BuffDef buffB) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)buffA == (Object)(object)buffB) { return false; } int num3 = ((!Object.op_Implicit((Object)(object)buffA)) ? (-1) : ((int)buffA.buffIndex)); num3 = ((!Object.op_Implicit((Object)(object)buffB)) ? (-1) : ((int)buffB.buffIndex)); BuffIndex buffIndex = (BuffIndex)num3; BuffQualityGroupIndex buffQualityGroupIndex3 = QualityCatalog.FindBuffQualityGroupIndex((BuffIndex)num3); if (buffQualityGroupIndex3 == BuffQualityGroupIndex.Invalid) { return false; } if (!QualityCatalog.GetBuffQualityGroup(buffQualityGroupIndex3).InheritBaseBuffBehavior) { return false; } BuffQualityGroupIndex buffQualityGroupIndex4 = QualityCatalog.FindBuffQualityGroupIndex(buffIndex); return buffQualityGroupIndex3 == buffQualityGroupIndex4; } static bool matchBuffsWithQuality(BuffIndex buffIndexA, BuffDef buffB) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) BuffIndex val5 = (BuffIndex)((!Object.op_Implicit((Object)(object)buffB)) ? (-1) : ((int)buffB.buffIndex)); if (buffIndexA == val5) { return false; } BuffQualityGroupIndex buffQualityGroupIndex = QualityCatalog.FindBuffQualityGroupIndex(buffIndexA); if (buffQualityGroupIndex == BuffQualityGroupIndex.Invalid) { return false; } if (!QualityCatalog.GetBuffQualityGroup(buffQualityGroupIndex).InheritBaseBuffBehavior) { return false; } BuffQualityGroupIndex buffQualityGroupIndex2 = QualityCatalog.FindBuffQualityGroupIndex(val5); return buffQualityGroupIndex == buffQualityGroupIndex2; } } } public sealed class BugBlockQualityBuffBehavior : QualityBuffBodyBehavior { private GameObject _swarmAttachmentObj; [BuffGroupAssociation(QualityBuffBehaviorUsageFlags.Server)] private static BuffQualityGroup GetBuffGroup() { return ItemQualitiesContent.BuffQualityGroups.BugBlock; } private void OnDisable() { setSwarmAttachmentActive(shouldBeActive: false); } protected override void OnStacksChanged() { base.OnStacksChanged(); setSwarmAttachmentActive(base.Stacks.TotalQualityCount > 0); } private void setSwarmAttachmentActive(bool shouldBeActive) { if (Object.op_Implicit((Object)(object)_swarmAttachmentObj) != shouldBeActive) { if (shouldBeActive) { _swarmAttachmentObj = Object.Instantiate(ItemQualitiesContent.NetworkedPrefabs.BugSwarmController); _swarmAttachmentObj.GetComponent().AttachToGameObjectAndSpawn(((Component)this).gameObject, (string)null); } else { Object.Destroy((Object)(object)_swarmAttachmentObj); _swarmAttachmentObj = null; } } } } internal static class Energized { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients); } private static void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (!Object.op_Implicit((Object)(object)sender) || !Object.op_Implicit((Object)(object)sender.inventory)) { return; } BuffQualityCounts buffCounts = sender.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.Energized); ItemQualityCounts itemCountsEffective = sender.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.EnergizedOnEquipmentUse); if (buffCounts.TotalQualityCount > 0) { if (itemCountsEffective.TotalQualityCount == 0) { itemCountsEffective.UncommonCount = 1; } float num = 0.1f * (float)itemCountsEffective.UncommonCount + 0.3f * (float)itemCountsEffective.RareCount + 0.6f * (float)itemCountsEffective.EpicCount + 1f * (float)itemCountsEffective.LegendaryCount; float num2 = 0.1f + 0.1f * (float)itemCountsEffective.UncommonCount + 0.3f * (float)itemCountsEffective.RareCount + 0.5f * (float)itemCountsEffective.EpicCount + 0.9f * (float)itemCountsEffective.LegendaryCount; args.attackSpeedMultAdd += num; args.allSkills.cooldownReductionMultAdd += num2; } } } internal static class LifeSteal { public const float LifeStealSpeedDuration = 60f; [SystemInitializer(new Type[] { })] private static void Init() { BuffHooks.OnBuffFirstStackGainedGlobal += onBuffFirstStackGainedGlobal; BuffHooks.OnBuffFinalStackLostGlobal += onBuffFinalStackLostGlobal; HealthComponent.onCharacterHealServer += onCharacterHealServer; } private static void onBuffFirstStackGainedGlobal(CharacterBody body, BuffDef buffDef) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } BuffIndex val = (BuffIndex)((!Object.op_Implicit((Object)(object)buffDef)) ? (-1) : ((int)buffDef.buffIndex)); QualityTier qualityTier = QualityCatalog.GetQualityTier(val); if (QualityCatalog.FindBuffQualityGroupIndex(val) != ItemQualitiesContent.BuffQualityGroups.LifeSteal.GroupIndex) { return; } for (QualityTier qualityTier2 = QualityTier.None; qualityTier2 < QualityTier.Count; qualityTier2++) { BuffIndex buffIndexOfQuality = QualityCatalog.GetBuffIndexOfQuality(val, qualityTier2); if (buffIndexOfQuality != val && body.HasBuffRaw(buffIndexOfQuality)) { if (qualityTier2 > qualityTier) { body.ClearTimedBuffsRaw(val); return; } body.ClearTimedBuffsRaw(buffIndexOfQuality); } } body.ClearTimedBuffs(ItemQualitiesContent.Buffs.LifeStealSpeed); } private static void onBuffFinalStackLostGlobal(CharacterBody body, BuffDef buffDef) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0047: 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_0077: 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) if (!NetworkServer.active) { return; } BuffIndex val = (BuffIndex)((!Object.op_Implicit((Object)(object)buffDef)) ? (-1) : ((int)buffDef.buffIndex)); QualityTier qualityTier = QualityCatalog.GetQualityTier(val); if (QualityCatalog.FindBuffQualityGroupIndex(val) != ItemQualitiesContent.BuffQualityGroups.LifeSteal.GroupIndex || qualityTier == QualityTier.None) { return; } for (QualityTier qualityTier2 = QualityTier.Uncommon; qualityTier2 < QualityTier.Count; qualityTier2++) { BuffIndex buffIndexOfQuality = QualityCatalog.GetBuffIndexOfQuality(val, qualityTier2); if (buffIndexOfQuality != val && body.HasBuffRaw(buffIndexOfQuality)) { return; } } foreach (TimedBuff timedBuff in body.timedBuffs) { if (timedBuff.buffIndex == ItemQualitiesContent.Buffs.LifeStealSpeed.buffIndex) { timedBuff.timer = Mathf.Max(timedBuff.timer, 60f); } } if (((Component)(object)body).TryGetComponentCached(out CharacterBodyExtraStatsTracker component)) { component.LeechBuffReserveFraction = 0f; } } private static void onCharacterHealServer(HealthComponent healthComponent, float amount, ProcChainMask procChainMask) { //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) QualityTier highestQuality = healthComponent.body.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.LifeSteal).HighestQuality; int num; switch (highestQuality) { case QualityTier.None: return; case QualityTier.Uncommon: num = 50; break; case QualityTier.Rare: num = 100; break; case QualityTier.Epic: num = 150; break; case QualityTier.Legendary: num = 250; break; default: Log.Warning($"Quality tier {highestQuality} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Buffs\\LifeSteal.cs", "onCharacterHealServer", 115); num = 0; break; } if (!((Component)(object)healthComponent).TryGetComponentCached(out CharacterBodyExtraStatsTracker component)) { return; } int buffCount = healthComponent.body.GetBuffCount(ItemQualitiesContent.Buffs.LifeStealSpeed); int num2 = Mathf.Max(0, num - buffCount); float num3 = amount / healthComponent.fullHealth; float num4 = Mathf.Min((float)num2, component.LeechBuffReserveFraction + 20f * num3); foreach (TimedBuff timedBuff in healthComponent.body.timedBuffs) { if (timedBuff.buffIndex == ItemQualitiesContent.Buffs.LifeStealSpeed.buffIndex) { timedBuff.timer = Mathf.Max(timedBuff.timer, 60f); } } for (int i = 0; i < (int)num4; i++) { healthComponent.body.AddTimedBuff(ItemQualitiesContent.Buffs.LifeStealSpeed, 60f); } component.LeechBuffReserveFraction = num4 - (float)(int)num4; } } internal static class LifeStealSpeed { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(getStatCoefficients); } private static void getStatCoefficients(CharacterBody sender, StatHookEventArgs args) { int buffCount = sender.GetBuffCount(ItemQualitiesContent.Buffs.LifeStealSpeed); if (buffCount > 0) { args.moveSpeedMultAdd += 0.01f * (float)buffCount; } } } public abstract class QualityBuffBodyBehavior : MonoBehaviour { private readonly struct BodyBehaviorInfo { public readonly QualityBuffBodyBehavior[] BehaviorComponents; public readonly int CollectionIndex; public BodyBehaviorInfo(QualityBuffBodyBehavior[] behaviors, int collectionIndex) { BehaviorComponents = behaviors; CollectionIndex = collectionIndex; } } private readonly struct QualityGroupBehaviorInfo { public readonly BuffQualityGroupIndex BuffGroupIndex; public readonly Type BehaviorType; public QualityGroupBehaviorInfo(BuffQualityGroupIndex groupIndex, Type qualityBuffBehaviorType) { BuffGroupIndex = groupIndex; BehaviorType = qualityBuffBehaviorType; } } private readonly struct QualityGroupBehaviorCollection { public readonly QualityGroupBehaviorInfo[] Behaviors; public readonly FixedSizeArrayPool BehaviorsArrayPool; public QualityGroupBehaviorCollection(QualityGroupBehaviorInfo[] buffGroups, FixedSizeArrayPool behaviorsArrayPool) { Behaviors = buffGroups; BehaviorsArrayPool = behaviorsArrayPool; } } [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] protected sealed class BuffGroupAssociationAttribute : SearchableAttribute { public MethodInfo target => ((SearchableAttribute)this).target as MethodInfo; public QualityBuffBehaviorUsageFlags Usage { get; } public BuffGroupAssociationAttribute(QualityBuffBehaviorUsageFlags usage) { Usage = usage; } } [Flags] public enum QualityBuffBehaviorUsageFlags : uint { None = 0u, Server = 1u, Client = 2u, Authority = 4u, All = 7u } private static BuffIndex[] _allBuffsToCheck = Array.Empty(); private static readonly QualityGroupBehaviorCollection[] _behaviorCollectionsLookup = new QualityGroupBehaviorCollection[7]; private static readonly Dictionary, BodyBehaviorInfo> _bodyQualityBehaviorInfoLookup = new Dictionary, BodyBehaviorInfo>(); private static CharacterBody _earlyAssignmentBody; private static BuffQualityCounts _earlyAssignmentStacks; private BuffQualityCounts _stacks; public CharacterBody Body { get; private set; } public ref readonly BuffQualityCounts Stacks { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return ref _stacks; } } protected virtual void Awake() { Body = _earlyAssignmentBody; _earlyAssignmentBody = null; _stacks = _earlyAssignmentStacks; _earlyAssignmentStacks = default(BuffQualityCounts); } protected virtual void OnStacksChanged() { } [SystemInitializer(new Type[] { typeof(QualityCatalog) })] private static void Init() { //IL_0474: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Invalid comparison between Unknown and I4 //IL_0481: Unknown result type (might be due to invalid IL or missing references) Span> span = new List[7]; Span> span2 = span; for (int i = 0; i < span2.Length; i++) { span2[i] = new List(); } foreach (BuffGroupAssociationAttribute item in SearchableAttribute.GetInstances().OfType()) { MethodInfo target = item.target; if (target == null) { Log.Error("Null target method for buff group attribute.", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Buffs\\QualityBuffBodyBehavior.cs", "Init", 63); continue; } QualityBuffBehaviorUsageFlags qualityBuffBehaviorUsageFlags = item.Usage & QualityBuffBehaviorUsageFlags.All; Type type = null; try { type = target.DeclaringType; if (qualityBuffBehaviorUsageFlags == QualityBuffBehaviorUsageFlags.None) { Log.Error("BuffGroupAssociationAttribute method (" + type.FullName + "." + target.Name + ") has no usage defined.", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Buffs\\QualityBuffBodyBehavior.cs", "Init", 76); continue; } if (!typeof(QualityBuffBodyBehavior).IsAssignableFrom(type)) { Log.Error("BuffGroupAssociationAttribute method (" + type.FullName + "." + target.Name + ") must be declared in a type that inherits from QualityBuffBodyBehavior. Found type: " + type.FullName, "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Buffs\\QualityBuffBodyBehavior.cs", "Init", 82); continue; } if (!target.IsStatic) { Log.Error("BuffGroupAssociationAttribute method (" + type.FullName + "." + target.Name + ") must be static", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Buffs\\QualityBuffBodyBehavior.cs", "Init", 88); continue; } if (target.ReturnType != typeof(BuffQualityGroup)) { Log.Error("BuffGroupAssociationAttribute method (" + type.FullName + "." + target.Name + ") must return BuffQualityGroup. Found return type: " + target.ReturnType.FullName, "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Buffs\\QualityBuffBodyBehavior.cs", "Init", 94); continue; } if (target.GetParameters().Length != 0) { Log.Error("BuffGroupAssociationAttribute method (" + type.FullName + "." + target.Name + ") cannot have parameters", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Buffs\\QualityBuffBodyBehavior.cs", "Init", 100); continue; } BuffQualityGroup buffQualityGroup = target.Invoke(null, Array.Empty()) as BuffQualityGroup; if (!Object.op_Implicit((Object)(object)buffQualityGroup)) { Log.Error("BuffGroupAssociationAttribute method (" + type.FullName + "." + target.Name + ") returned null", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Buffs\\QualityBuffBodyBehavior.cs", "Init", 107); continue; } if (buffQualityGroup.GroupIndex == BuffQualityGroupIndex.Invalid) { Log.Error("BuffGroupAssociationAttribute method (" + type.FullName + "." + target.Name + ") returned a group that is not registered in QualityCatalog.", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Buffs\\QualityBuffBodyBehavior.cs", "Init", 113); continue; } for (QualityBuffBehaviorUsageFlags qualityBuffBehaviorUsageFlags2 = QualityBuffBehaviorUsageFlags.Server; qualityBuffBehaviorUsageFlags2 <= QualityBuffBehaviorUsageFlags.All; qualityBuffBehaviorUsageFlags2++) { if ((qualityBuffBehaviorUsageFlags2 & qualityBuffBehaviorUsageFlags) != 0) { span[(int)(qualityBuffBehaviorUsageFlags2 - 1)].Add(new QualityGroupBehaviorInfo(buffQualityGroup.GroupIndex, type)); } } } catch (Exception arg) { Log.Error_NoCallerPrefix(string.Format("Failed to register quality buff behavior for {0} ({1}): {2}", type?.FullName ?? "[UNRESOLVED TYPE]", target.Name, arg)); } } Dictionary> dictionary = new Dictionary>(span.Length); HashSet hashSet = new HashSet(BuffCatalog.buffCount); int num = 0; for (int j = 0; j < span.Length; j++) { _ = j + 1; List list = span[j]; QualityGroupBehaviorInfo[] array = ((list.Count > 0) ? list.ToArray() : Array.Empty()); FixedSizeArrayPool value = null; if (array.Length != 0 && !dictionary.TryGetValue(array.Length, out value)) { value = new FixedSizeArrayPool(array.Length); dictionary.Add(array.Length, value); } _behaviorCollectionsLookup[j] = new QualityGroupBehaviorCollection(array, value); num += array.Length; QualityGroupBehaviorInfo[] array2 = array; for (int i = 0; i < array2.Length; i++) { BuffQualityGroup buffQualityGroup2 = QualityCatalog.GetBuffQualityGroup(array2[i].BuffGroupIndex); for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { BuffIndex buffIndex = buffQualityGroup2.GetBuffIndex(qualityTier); if ((int)buffIndex != -1) { hashSet.Add(buffIndex); } } } } if (num > 0) { CharacterBody.onBodyStartGlobal += onBodyStartGlobal; CharacterBody.onBodyDestroyGlobal += onBodyDestroyGlobal; BuffHooks.OnBodyBuffCountChangedGlobal += onBodyBuffCountChangedGlobal; } if (hashSet.Count > 0) { _allBuffsToCheck = hashSet.ToArray(); Array.Sort(_allBuffsToCheck); } } private static QualityBuffBehaviorUsageFlags getBehaviorFlagsForBody(CharacterBody body) { QualityBuffBehaviorUsageFlags qualityBuffBehaviorUsageFlags = QualityBuffBehaviorUsageFlags.None; if (NetworkServer.active) { qualityBuffBehaviorUsageFlags |= QualityBuffBehaviorUsageFlags.Server; } if (NetworkClient.active) { qualityBuffBehaviorUsageFlags |= QualityBuffBehaviorUsageFlags.Client; } if (Object.op_Implicit((Object)(object)body) && body.hasEffectiveAuthority) { qualityBuffBehaviorUsageFlags |= QualityBuffBehaviorUsageFlags.Authority; } return qualityBuffBehaviorUsageFlags; } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static int getBehaviorCollectionIndex(CharacterBody body) { return (int)(getBehaviorFlagsForBody(body) - 1); } private static void onBodyStartGlobal(CharacterBody body) { //IL_0006: 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) if (_bodyQualityBehaviorInfoLookup.ContainsKey(UnityObjectWrapperKey.op_Implicit(body))) { return; } int behaviorCollectionIndex = getBehaviorCollectionIndex(body); if (ArrayUtils.IsInBounds(_behaviorCollectionsLookup, behaviorCollectionIndex)) { ref QualityGroupBehaviorCollection reference = ref _behaviorCollectionsLookup[behaviorCollectionIndex]; if (reference.BehaviorsArrayPool != null) { QualityBuffBodyBehavior[] behaviors = reference.BehaviorsArrayPool.Request(); BodyBehaviorInfo bodyBehaviorInfo = new BodyBehaviorInfo(behaviors, behaviorCollectionIndex); _bodyQualityBehaviorInfoLookup.Add(UnityObjectWrapperKey.op_Implicit(body), bodyBehaviorInfo); refreshBodyQualityBehaviors(body, in bodyBehaviorInfo); } } } private static void onBodyDestroyGlobal(CharacterBody body) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) if (_bodyQualityBehaviorInfoLookup.Remove(UnityObjectWrapperKey.op_Implicit(body), out var value)) { _behaviorCollectionsLookup[value.CollectionIndex].BehaviorsArrayPool?.Return(value.BehaviorComponents, (ClearType)0); } } private static void onBodyBuffCountChangedGlobal(CharacterBody body, BuffIndex buffIndex, int newCount) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (Array.BinarySearch(_allBuffsToCheck, buffIndex) >= 0 && _bodyQualityBehaviorInfoLookup.TryGetValue(UnityObjectWrapperKey.op_Implicit(body), out var value)) { refreshBodyQualityBehaviors(body, in value); } } private static void refreshBodyQualityBehaviors(CharacterBody body, in BodyBehaviorInfo bodyBehaviorInfo) { if (Object.op_Implicit((Object)(object)body)) { ref QualityGroupBehaviorCollection reference = ref _behaviorCollectionsLookup[bodyBehaviorInfo.CollectionIndex]; for (int i = 0; i < reference.Behaviors.Length; i++) { ref QualityGroupBehaviorInfo reference2 = ref reference.Behaviors[i]; ref QualityBuffBodyBehavior buffBehavior = ref bodyBehaviorInfo.BehaviorComponents[i]; Type behaviorType = reference2.BehaviorType; BuffQualityCounts buffCounts = body.GetBuffCounts(reference2.BuffGroupIndex); updateBuffStacks(body, ref buffBehavior, behaviorType, in buffCounts); } return; } for (int j = 0; j < bodyBehaviorInfo.BehaviorComponents.Length; j++) { ref QualityBuffBodyBehavior reference3 = ref bodyBehaviorInfo.BehaviorComponents[j]; if (reference3 != null) { Object.Destroy((Object)(object)reference3); reference3 = null; } } } private static void updateBuffStacks(CharacterBody body, ref QualityBuffBodyBehavior buffBehavior, Type qualityBehaviorType, in BuffQualityCounts buffCounts) { bool flag = buffBehavior != null; bool flag2 = buffCounts.TotalQualityCount > 0; if (flag != flag2) { if (flag2) { _earlyAssignmentBody = body; _earlyAssignmentStacks = buffCounts; try { buffBehavior = (QualityBuffBodyBehavior)(object)((Component)body).gameObject.AddComponent(qualityBehaviorType); } finally { _earlyAssignmentBody = null; _earlyAssignmentStacks = default(BuffQualityCounts); } buffBehavior.OnStacksChanged(); flag = true; } else { Object.Destroy((Object)(object)buffBehavior); buffBehavior = null; flag = false; } } else if (flag && buffBehavior._stacks != buffCounts) { buffBehavior._stacks = buffCounts; buffBehavior.OnStacksChanged(); } } } internal static class Slow60 { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients); } private static void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args) { BuffQualityCounts buffCounts = sender.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.Slow60); args.moveSpeedReductionMultAdd += (float)(buffCounts.UncommonCount + 2 * buffCounts.RareCount + 3 * buffCounts.EpicCount + 5 * buffCounts.LegendaryCount); } } internal static class TeamWarCry { [SystemInitializer(new Type[] { })] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(getStatCoefficients); BuffHooks.OnBuffFirstStackGainedGlobal += onBuffFirstStackGainedGlobal; } private static void getStatCoefficients(CharacterBody sender, StatHookEventArgs args) { QualityTier highestQuality = sender.GetBuffCounts(ItemQualitiesContent.BuffQualityGroups.TeamWarCry).HighestQuality; float num; switch (highestQuality) { case QualityTier.None: return; case QualityTier.Uncommon: num = 2f; break; case QualityTier.Rare: num = 5f; break; case QualityTier.Epic: num = 8f; break; case QualityTier.Legendary: num = 15f; break; default: num = 0f; Log.Warning($"Quality tier {highestQuality} is not implemented", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\Buffs\\TeamWarCry.cs", "getStatCoefficients", 41); break; } if (num > 0f) { args.allSkills.cooldownFlatReduction += num; } } private static void onBuffFirstStackGainedGlobal(CharacterBody body, BuffDef buffDef) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (!body.hasEffectiveAuthority) { return; } BuffIndex buffIndex = (BuffIndex)((!Object.op_Implicit((Object)(object)buffDef)) ? (-1) : ((int)buffDef.buffIndex)); if (QualityCatalog.GetQualityTier(buffIndex) == QualityTier.None || QualityCatalog.FindBuffQualityGroupIndex(buffIndex) != ItemQualitiesContent.BuffQualityGroups.TeamWarCry.GroupIndex) { return; } GenericSkill[] allSkills = body.skillLocator.AllSkills; foreach (GenericSkill val in allSkills) { if (val.stock < val.maxStock) { val.AddOneStock(); body.OnSkillCooldown(val, 1); } } } } } namespace Unity { [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] public class GeneratedNetworkCode { public static void _WriteStoredInteractableInfo_None(NetworkWriter writer, StoredInteractableInfo value) { writer.WritePackedUInt32((uint)value.InteractableIndex); writer.WritePackedUInt32((uint)value.UpgradeValue); } public static StoredInteractableInfo _ReadStoredInteractableInfo_None(NetworkReader reader) { StoredInteractableInfo result = default(StoredInteractableInfo); result.InteractableIndex = (int)reader.ReadPackedUInt32(); result.UpgradeValue = (int)reader.ReadPackedUInt32(); return result; } } }