using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; 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.SaveData; using ItemQualities.Serialization; 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 ProperSave; using ProperSave.Data; 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.AddressableAssets.ResourceLocators; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.ResourceManagement.ResourceLocations; 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) AddressableUtil.LoadAssetAsync(RoR2_Base_QuestVolatileBattery.VolatileBatteryPreDetonation_prefab, (AsyncReferenceHandleUnloadType)2).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 & 1) != 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 ((num & 1) != 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", 66); 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", 119); 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")] [EditorBrowsable(EditorBrowsableState.Never)] public BuffQualityCounts GetBuffCounts(CharacterBody body) { if (!Object.op_Implicit((Object)(object)body)) { return default(BuffQualityCounts); } return body.GetBuffCounts(this); } [MethodImpl(MethodImplOptions.AggressiveInlining)] [Obsolete("Use CharacterBodyExtensions.GetBuffCounts() instead")] [EditorBrowsable(EditorBrowsableState.Never)] public bool HasBuff(CharacterBody body) { QualityTier buffQualityTier; return HasBuff(body, out buffQualityTier); } [MethodImpl(MethodImplOptions.AggressiveInlining)] [Obsolete("Use CharacterBodyExtensions.GetBuffCounts() instead")] [EditorBrowsable(EditorBrowsableState.Never)] public bool HasBuff(CharacterBody body, out QualityTier buffQualityTier) { BuffQualityCounts buffCounts = GetBuffCounts(body); buffQualityTier = buffCounts.HighestQuality; return buffCounts.TotalCount > 0; } [MethodImpl(MethodImplOptions.AggressiveInlining)] [Obsolete("Use CharacterBodyExtensions.GetBuffCounts() instead")] [EditorBrowsable(EditorBrowsableState.Never)] public bool HasQualityBuff(CharacterBody body) { QualityTier buffQualityTier; return HasQualityBuff(body, out buffQualityTier); } [MethodImpl(MethodImplOptions.AggressiveInlining)] [Obsolete("Use CharacterBodyExtensions.GetBuffCounts() instead")] [EditorBrowsable(EditorBrowsableState.Never)] 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")] [EditorBrowsable(EditorBrowsableState.Never)] 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", 228); } 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", 242); } 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", 278); } 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", 311); } 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 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; public static event Action OnSkillActivatedAuthorityGlobal; public static event Action OnSkillActivatedServerGlobal; [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; } _body.onSkillActivatedAuthority += onSkillActivatedAuthority; _body.onSkillActivatedServer += onSkillActivatedServer; 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; } _body.onSkillActivatedAuthority -= onSkillActivatedAuthority; _body.onSkillActivatedServer -= onSkillActivatedServer; refreshModelReference(null); InstanceTracker.Remove(this); } private void FixedUpdate() { //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) if (NetworkServer.active && !HasHadAnyQualityDeathMarkDebuffServer && DeathMark.HasAnyQualityDeathMarkDebuff(_body)) { HasHadAnyQualityDeathMarkDebuffServer = true; } if (HasEffectiveAuthority) { if (QuailJumpComboAuthority > 0 && !IsPerformingQuailJump) { FixedTimeStamp lastQuailLandTimeAuthority = LastQuailLandTimeAuthority; if (((FixedTimeStamp)(ref lastQuailLandTimeAuthority)).timeSince > 0.15f) { QuailJumpComboAuthority = 0; } } if (_gatewayTeleportCooldown > 0f) { _gatewayTeleportCooldown -= Time.fixedDeltaTime; } 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; } } updateOverlays(); } 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 onSkillActivatedAuthority(GenericSkill skill) { CharacterBodyExtraStatsTracker.OnSkillActivatedAuthorityGlobal?.Invoke(this, skill); } private void onSkillActivatedServer(GenericSkill skill) { CharacterBodyExtraStatsTracker.OnSkillActivatedServerGlobal?.Invoke(this, skill); } 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", 551); 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 & 1) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32((uint)_weakPointHurtBoxIndexPlusOne); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 2) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32((uint)ParryStoredProjectileIndex); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 4) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32((uint)_parryStoredProjectileAttackerBodyIndexInt); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 8) != 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 ((num & 1) != 0) { _weakPointHurtBoxIndexPlusOne = (byte)reader.ReadPackedUInt32(); } if ((num & 2) != 0) { ParryStoredProjectileIndex = (int)reader.ReadPackedUInt32(); } if ((num & 4) != 0) { _parryStoredProjectileAttackerBodyIndexInt = (int)reader.ReadPackedUInt32(); } if ((num & 8) != 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; } public void GetItemUpgradeIndices(List dest) { //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) ListUtils.EnsureCapacity(dest, dest.Count + ((SyncList)(object)_upgradeItemIndices).Count); foreach (uint item2 in (SyncList)(object)_upgradeItemIndices) { ItemIndex item = (ItemIndex)item2; dest.Add(item); } } [Server] public ItemIndex TryPermanentUpgradeRandomItemToQualityTier(Xoroshiro128Plus rng, QualityTier targetQualityTier) { //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_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_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_0085: 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_00a3: 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_0257: 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_0267: 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_0120: 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_0128: 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_02a5: Expected I4, but got Unknown //IL_02c4: 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_02c3: Expected I4, but got Unknown //IL_0139: 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_0307: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: 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; WeightedSelection availableUpgradeItemsSelection = new WeightedSelection(8); List list = default(List); DisposableRental> val = CollectionPool>.RentCollection(ref list); try { ((ItemCollection)(ref _master.inventory.permanentItemStacks)).GetNonZeroIndices(list); availableUpgradeItemsSelection.EnsureCapacity(list.Count); foreach (ItemIndex item in list) { if (canUpgrade(item)) { availableUpgradeItemsSelection.AddChoice(item, (float)_master.inventory.GetItemCountPermanent(item)); } } } finally { val.Dispose(); } if (availableUpgradeItemsSelection.Count == 0) { List list2 = default(List); val = CollectionPool>.RentCollection(ref list2); try { ((TempItemsStorage)(ref _master.inventory.tempItemsStorage)).GetNonZeroIndices(list2); availableUpgradeItemsSelection.EnsureCapacity(list2.Count); foreach (ItemIndex item2 in list2) { if (canUpgrade(item2)) { availableUpgradeItemsSelection.AddChoice(item2, (float)_master.inventory.GetItemCountEffective(item2)); } } } finally { val.Dispose(); } } if (availableUpgradeItemsSelection.Count == 0) { 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); } if (availableUpgradeItemsSelection.Count == 0) { return (ItemIndex)(-1); } ItemIndex itemIndexOfQuality = QualityCatalog.GetItemIndexOfQuality(availableUpgradeItemsSelection.Evaluate(rng.nextNormalizedFloat), targetQualityTier2); ItemQualityGroupIndex itemQualityGroupIndex = QualityCatalog.FindItemQualityGroupIndex(itemIndexOfQuality); bool flag = false; for (int num = ((SyncList)(object)_upgradeItemIndices).Count - 1; num >= 0; num--) { if (QualityCatalog.FindItemQualityGroupIndex((ItemIndex)((SyncList)(object)_upgradeItemIndices)[num]) == itemQualityGroupIndex) { ((SyncList)(object)_upgradeItemIndices)[num] = (uint)(int)itemIndexOfQuality; flag = true; break; } } if (!flag) { ((SyncList)(object)_upgradeItemIndices).Add((uint)(int)itemIndexOfQuality); } if (!checkItemQualityUpgrade(itemIndexOfQuality)) { CustomOverrideInfo val2 = new CustomOverrideInfo().SetDescriptionText("QUALITY_HEALANDREVIVE_PICKUP_NOTIFICATION_UPGRADED_" + targetQualityTier2.ToString().ToUpper()); CharacterMasterNotificationQueue.SendCustomNotification(_master, itemIndexOfQuality, val2); } return itemIndexOfQuality; void addDropListToSelection(List dropList, float weight) { //IL_0028: 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: Invalid comparison between Unknown and I4 //IL_0041: 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) availableUpgradeItemsSelection.EnsureCapacity(availableUpgradeItemsSelection.Count + dropList.Count); foreach (PickupIndex drop in dropList) { PickupDef pickupDef = PickupCatalog.GetPickupDef(drop); if (pickupDef != null && (int)pickupDef.itemIndex != -1 && canUpgrade(pickupDef.itemIndex)) { availableUpgradeItemsSelection.AddChoice(pickupDef.itemIndex, weight); } } } 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(); } } [Server] internal void InitializeFromSaveServer(MasterSaveData masterSaveData) { //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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected I4, but got Unknown if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void ItemQualities.CharacterMasterExtraStatsTracker::InitializeFromSaveServer(ItemQualities.SaveData.MasterSaveData)' called on client"); return; } NetworkSteakBonus = masterSaveData.SteakBonus; NetworkSpeedOnPickupBonus = masterSaveData.SpeedOnPickupBonus; NetworkBossDamageBonusTicks = masterSaveData.BossDamageBonusTicks; NetworkCardStoredInteractableInfo = masterSaveData.CardStoredInteractableInfo; ((SyncList)(object)_upgradeItemIndices).Clear(); foreach (ItemIndex upgradeItemIndex in masterSaveData.UpgradeItemIndices) { ItemIndex current = upgradeItemIndex; if (ItemCatalog.IsIndexValid(ref current)) { ((SyncList)(object)_upgradeItemIndices).Add((uint)(int)current); } } } 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 & 1) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(SteakBonus); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 2) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32((uint)SpeedOnPickupBonus); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 4) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32((uint)BossDamageBonusTicks); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 8) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } GeneratedNetworkCode._WriteStoredInteractableInfo_None(writer, CardStoredInteractableInfo); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 0x10) != 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 ((num & 1) != 0) { hookSetSteakBonus(reader.ReadSingle()); } if ((num & 2) != 0) { hookSetSpeedOnPickupBonus((int)reader.ReadPackedUInt32()); } if ((num & 4) != 0) { hookSetBossDamageBonusTicks((int)reader.ReadPackedUInt32()); } if ((num & 8) != 0) { CardStoredInteractableInfo = GeneratedNetworkCode._ReadStoredInteractableInfo_None(reader); } if ((num & 0x10) != 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_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_0065: 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_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Invalid comparison between Unknown and I4 //IL_0079: 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_0163: 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_008a: 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_00b8: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: 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_02fb: 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_0325: 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_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0330: 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_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0366: 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_038b: 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) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Invalid comparison between Unknown and I4 //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Invalid comparison between Unknown and I4 //IL_03d4: 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_0491: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Invalid comparison between Unknown and I4 //IL_0156: 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) //IL_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_04e9: Unknown result type (might be due to invalid IL or missing references) //IL_04f5: Expected O, but got Unknown //IL_0509: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_047d: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Expected O, but got Unknown //IL_0484: Unknown result type (might be due to invalid IL or missing references) List itemsToTake = default(List); if (Object.op_Implicit((Object)(object)context.activatorInventory)) { DisposableRental> val = CollectionPool>.RentCollection(ref itemsToTake); try { ListUtils.EnsureCapacity(itemsToTake, context.cost); WeightedSelection val2 = new WeightedSelection(8); WeightedSelection[] array = new WeightedSelection[4]; WeightedSelection[] array2 = new WeightedSelection[4]; WeightedSelection[] array3 = 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) { continue; } ItemQualityGroupIndex itemQualityGroupIndex2 = QualityCatalog.FindItemQualityGroupIndex(val3); if (itemQualityGroupIndex2 == itemQualityGroupIndex) { continue; } int itemCountPermanent = context.activatorInventory.GetItemCountPermanent(val3); if (itemCountPermanent <= 0) { continue; } ItemDef itemDef = ItemCatalog.GetItemDef(val3); if (itemDef.tier == context.costTypeDef.itemTier && itemDef.canRemove && !itemDef.ContainsTag((ItemTag)33)) { WeightedSelection[] array4 = null; if (itemQualityGroupIndex2 == ItemQualitiesContent.ItemQualityGroups.RegeneratingScrap.GroupIndex) { array4 = array3; } else if (itemDef.ContainsTag((ItemTag)14)) { array4 = array2; } else if (itemDef.ContainsTag((ItemTag)10)) { array4 = array; } WeightedSelection val4; if (array4 != null) { WeightedSelection[] array5 = array4; int num = (int)qualityTier; val4 = array5[num] ?? (array5[num] = new WeightedSelection(8)); } else { val4 = val2; } val4.AddChoice(val3, (float)itemCountPermanent); } } TryTakeSingleItemFromWeightedSelectionsDescending(array3); TakeItemsFromWeightedSelectionsDescending(array2); TakeItemsFromWeightedSelectionsDescending(array); TakeItemsFromWeightedSelectionsAscending(array3); TakeItemsFromWeightedSelection(val2); if (itemsToTake.Count < context.cost) { ItemQualityGroup itemQualityGroup = QualityCatalog.GetItemQualityGroup(itemQualityGroupIndex); if (Object.op_Implicit((Object)(object)itemQualityGroup)) { 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 = context.activatorInventory.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) { List list = itemsToTake; ItemIndex itemIndex = itemQualityGroup.GetItemIndex(qualityTier3); ListUtils.AddMultiple(list, ref itemIndex, num2); if (itemsToTake.Count >= context.cost) { break; } } } } else { ListUtils.AddMultiple(itemsToTake, ref context.avoidedItemIndex, context.cost - itemsToTake.Count); } } 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)); val6.transformationType = (ItemTransformationTypeIndex)0; } if (((ItemTransformation)(ref val6)).TryTransform(context.activatorInventory, 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 choiceIndex = weightedSelection.EvaluateToChoiceIndex(context.rng.nextNormalizedFloat); TakeItemFromWeightedSelection(weightedSelection, choiceIndex); } } void TakeItemsFromWeightedSelectionsAscending(WeightedSelection[] weightedSelections) { for (int i = 0; i < weightedSelections.Length; i++) { if (weightedSelections[i] != null) { TakeItemsFromWeightedSelection(weightedSelections[i]); } } } void TakeItemsFromWeightedSelectionsDescending(WeightedSelection[] weightedSelections) { for (int num4 = weightedSelections.Length - 1; num4 >= 0; num4--) { if (weightedSelections[num4] != null) { TakeItemsFromWeightedSelection(weightedSelections[num4]); } } } bool TryTakeSingleItemFromWeightedSelection(WeightedSelection weightedSelection) { if (weightedSelection.Count > 0 && itemsToTake.Count < context.cost) { int choiceIndex = weightedSelection.EvaluateToChoiceIndex(context.rng.nextNormalizedFloat); TakeItemFromWeightedSelection(weightedSelection, choiceIndex); return true; } return false; } void TryTakeSingleItemFromWeightedSelectionsDescending(WeightedSelection[] weightedSelections) { int num4 = weightedSelections.Length - 1; while (num4 >= 0 && (weightedSelections[num4] == null || !TryTakeSingleItemFromWeightedSelection(weightedSelections[num4]))) { num4--; } } } 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); AddressableUtil.LoadAssetAsync(RoR2_Base_Chest1StealthedVariant.Chest1StealthedVariant_prefab, (AsyncReferenceHandleUnloadType)2).OnSuccess(delegate(GameObject cloakedChest) { ChestBehavior val = default(ChestBehavior); if (cloakedChest.TryGetComponent(ref val)) { PickupDropTable val2 = null; ChestBehavior val3 = 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 val3)) { val2 = val3.dropTable; } if (Object.op_Implicit((Object)(object)val2)) { val.dropTable = val2; } } }); 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 = (TransformationType)104; public const TransformationType QualityUpgradeUncommon = (TransformationType)104; public const TransformationType QualityUpgradeRare = (TransformationType)105; public const TransformationType QualityUpgradeEpic = (TransformationType)106; public const TransformationType QualityUpgradeLegendary = (TransformationType)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 num = default(int); if (c.TryGotoNext((MoveType)1, new Func[6] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num), (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; if (c.TryGotoNext((MoveType)1, new Func[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num), (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; if (c.TryGotoNext((MoveType)1, new Func[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num), (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; if (c.TryGotoNext((MoveType)1, new Func[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num), (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; 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 & 1) != 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 ((num & 1) != 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 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_0129: 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 Unknown //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); BlastAttack 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, teamIndex = (TeamIndex)((!Object.op_Implicit((Object)(object)_cachedOwnerMaster)) ? (-1) : ((int)_cachedOwnerMaster.teamIndex)), attackerFiltering = (AttackerFiltering)2 }; val2.Fire(); if (Object.op_Implicit((Object)(object)ExplosionEffect)) { EffectData val3 = new EffectData { origin = val2.position, scale = val2.radius }; EffectManager.SpawnEffect(ExplosionEffect, val3, 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 & 1) != 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 ((num & 1) != 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); AddressableUtil.LoadAssetAsync(RoR2_Base_SurvivorPod.SurvivorPod_prefab, (AsyncReferenceHandleUnloadType)2).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; pickupController.pickup = ((UniquePickup)(ref pickup)).WithPickupIndex(DropTableQualityHandler.RollQuality(_pickupController.pickup.pickupIndex, rng, new PickupRollInfo(null, (TeamIndex)1))); } 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) && itemDef.ContainsTag((ItemTag)4)) { return false; } return true; } 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; } return RollQuality(pickupIndex, rng, GetCurrentPickupRollInfo(master), 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_0041: 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_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) PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex); ItemDef itemDef = ItemCatalog.GetItemDef((ItemIndex)((pickupDef == null) ? (-1) : ((int)pickupDef.itemIndex))); if (Object.op_Implicit((Object)(object)itemDef) && (requiredItemTags.Length != 0 || bannedItemTags.Length != 0)) { 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", 392); } 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", 407); 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", 430); 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", 450); 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", 496); } 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", 511); 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", 533); 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", 553); 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", 560); 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", 583); 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", 619); 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 _effectIndexByPrefabName.GetValueOrDefault(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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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); if (defaultRadius <= 0f) { Log.Warning($"Default radius must be a positive value! effectPrefab={effectPrefab}, defaultRadius={defaultRadius}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EffectScalingFixer.cs", "GetOrCreateFixedScalingCopy", 54); return null; } 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", 111); } 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) AddressableUtil.LoadAssetAsync(RoR2_Base_QuestVolatileBattery.VolatileBatteryPreDetonation_prefab, (AsyncReferenceHandleUnloadType)2).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 obj = Event; if (obj != null) { obj.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(); } else if (string.IsNullOrEmpty(explosionInfoDef.Name)) { explosionInfoDef.Name = explosionInfoIndex.ToString("D"); } 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", 126); } 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", 111); } else { Log.Error("Failed to find entity state configuration for type '" + entityStateType.FullName + "'", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ExplosionInfoCatalog.cs", "Init", 116); } 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_0137: 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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) 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; } if (num <= 0f) { Log.Warning($"Invalid base scale ({num}) for {Util.GetGameObjectHierarchyName(((Component)this).gameObject)}, aborting indicator scale adjustment", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ExplosionRangeIndicatorScaler.cs", "recalculateIndicatorsScale", 193); return; } 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", 204); 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 & 1) != 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 ((num & 1) != 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 & 1) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(_attachedToObject); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 2) != 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 ((num & 1) != 0) { onSyncAttachedToObject(reader.ReadGameObject()); } if ((num & 2) != 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 ignoreLowHealthItemIndices = CollectionPool>.RentCollection(); if (Object.op_Implicit((Object)(object)inventory)) { handleCustomQualityLowHealthThreshold(ItemQualitiesContent.ItemQualityGroups.Phasing); } if (ignoreLowHealthItemIndices.Count == 0) { ignoreLowHealthItemIndices = CollectionPool>.ReturnCollection(ignoreLowHealthItemIndices); } return ignoreLowHealthItemIndices; 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) { ignoreLowHealthItemIndices.Add(itemGroup.BaseItemIndex); } for (QualityTier qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { if (itemCountsEffective[qualityTier] > 0) { ItemIndex itemIndex = itemGroup.GetItemIndex(qualityTier); if ((int)itemIndex != -1) { ignoreLowHealthItemIndices.Add(itemIndex); } } } } } } 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 barInfoField in lowHealthUnderBarInfoFields) { emitHandleBarInfoField(val2, barInfoField); } } 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 barInfoField2 in lowHealthUnderBarInfoFields) { emitHandleBarInfoField(val3, barInfoField2); } } 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 barInfoField3 in lowHealthUnderBarInfoFields) { emitHandleBarInfoField(val4, barInfoField3); } } 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 barInfoField4 in lowHealthUnderBarInfoFields) { emitHandleBarInfoField(val5, barInfoField4); } } 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 barInfoField5 in lowHealthUnderBarInfoFields) { emitHandleBarInfoField(val6, barInfoField5); } } 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 barInfoField6 in lowHealthUnderBarInfoFields) { emitHandleBarInfoField(val, barInfoField6); } } 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 fieldInfo) { //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, fieldInfo); 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 underBarInfo = lowHealthUnderBarInfo; BarInfo overBarInfo = lowHealthOverBarInfo; underBarInfo.enabled = false; overBarInfo.enabled = false; if (val2.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Phasing).TotalQualityCount > 0) { setupHealthThresholdBarInfos(ref underBarInfo, ref overBarInfo, 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 underBarInfo, in overBarInfo, 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 reference, ref BarInfo reference2, float healthThreshold) { bool flag = healthComponent.IsHealthBelowThreshold(healthThreshold); reference.enabled = flag && healthBar.style.lowHealthUnderStyle.enabled; reference.normalizedXMin = 0f; reference.normalizedXMax = healthThreshold * (1f - healthBarValues.curseFraction); reference2.enabled = !flag && healthBar.style.lowHealthOverStyle.enabled; reference2.normalizedXMin = healthThreshold * (1f - healthBarValues.curseFraction); reference2.normalizedXMax = reference2.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(GenericNetworkedObjectAttachment))] public sealed class InteractableAttachment : MonoBehaviour, INetworkedObjectAttachmentListener { private GameObject _lastAttachedObject; private SpecialObjectAttributes _attachedSpecialObjectAttributes; private void OnDestroy() { SetAttachedObject(null); } private void SetAttachedObject(GameObject newAttachedObject) { if (newAttachedObject != _lastAttachedObject) { if (_attachedSpecialObjectAttributes != null) { _attachedSpecialObjectAttributes.childObjectsToDisable.Remove(((Component)this).gameObject); } _lastAttachedObject = newAttachedObject; _attachedSpecialObjectAttributes = (Object.op_Implicit((Object)(object)newAttachedObject) ? newAttachedObject.GetComponent() : null); if (_attachedSpecialObjectAttributes != null) { _attachedSpecialObjectAttributes.childObjectsToDisable.Add(((Component)this).gameObject); } } } public void OnAttachedObjectDiscovered(GenericNetworkedObjectAttachment attachment, GameObject attachedObject) { SetAttachedObject(attachedObject); } } [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 _interactablePrefabNameToIndex = new Dictionary(); public static ResourceAvailability Availability; public static int InteractableCount => _interactableDefs.Length; [InitDuringStartupPhase(/*Could not decode attribute arguments.*/)] private static void Init() { //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_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Invalid comparison between Unknown and I4 //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Expected O, but got Unknown //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Expected O, but got Unknown //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Expected O, but got Unknown InteractableSpawnCard[] array = Array.Empty(); HashSet hashSet = new HashSet(); Stopwatch.StartNew(); hashSet.UnionWith(Resources.FindObjectsOfTypeAll()); try { List list = new List(); foreach (IResourceLocator resourceLocator in Addressables.ResourceLocators) { ResourceLocationMap val = (ResourceLocationMap)(object)((resourceLocator is ResourceLocationMap) ? resourceLocator : null); if (val == null) { continue; } foreach (var (_, list3) in val.Locations) { if (list3 == null || list3.Count == 0) { continue; } foreach (IResourceLocation item in list3) { if (typeof(InteractableSpawnCard).IsAssignableFrom(item.ResourceType)) { ListUtils.AddIfUnique(list, item); } } } } if (list.Count > 0) { AsyncOperationHandle> val2 = Addressables.LoadAssetsAsync((IList)list, (Action)null, false); val2.WaitForCompletion(); if ((int)val2.Status == 1 && val2.Result != null) { hashSet.UnionWith(val2.Result); } else { Log.Warning($"InteractableSpawnCard loads failed: {val2.OperationException}", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\InteractableCatalog.cs", "Init", 79); } } } catch (Exception arg) { Log.Warning_NoCallerPrefix($"Failed to load InteractableSpawnCards from addressables: {arg}"); } if (hashSet.Count > 0) { array = (from c in hashSet where Object.op_Implicit((Object)(object)c) && Object.op_Implicit((Object)(object)((SpawnCard)c).prefab) orderby ((Object)c).name select c).ToArray(); } if (array.Length != 0) { InteractableSpawnCard[] array2 = array; for (int num = 0; num < array2.Length; num++) { UnityObjectExtensions.EnsureComponent(((SpawnCard)array2[num]).prefab); } _interactableDefs = array.Select((InteractableSpawnCard spawnCard) => new InteractableDef(spawnCard)).ToArray(); Array.Sort(_interactableDefs, Comparer.Create((InteractableDef a, InteractableDef b) => StringComparer.Ordinal.Compare(a.Name, b.Name))); _interactablePrefabNameToIndex.EnsureCapacity(_interactableDefs.Length); for (int num2 = 0; num2 < _interactableDefs.Length; num2++) { InteractableDef interactableDef = _interactableDefs[num2]; GameObject prefab = interactableDef.Prefab; interactableDef.PrefabInfoProviderComponent.CatalogIndex = num2; if (!allowCopy(prefab)) { interactableDef.CanCopy = false; } string name = interactableDef.Name; if (!_interactablePrefabNameToIndex.ContainsKey(name)) { _interactablePrefabNameToIndex[name] = num2; } else { Log.Warning("Duplicate interactable name '" + name + "'", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\InteractableCatalog.cs", "Init", 150); } } _interactablePrefabNameToIndex.TrimExcess(); SpecialObjectAttributes.Start += new hook_Start(SpecialObjectAttributes_Start); PurchaseInteraction.Start += new hook_Start(PurchaseInteraction_Start); DroneVendorMultiShopController.Start += new hook_Start(DroneVendorMultiShopController_Start); overrideCanCopy("GauntletEntranceOrb", canCopy: false); overrideCanCopy("GoldshoresBeacon", canCopy: false); overrideCanCopy("ScavBackpack", canCopy: false); overrideCanCopy("ScavLunarBackpack", canCopy: false); overrideCanCopy("VoidCamp", canCopy: false); overrideCanCopy("VoidRaidSafeWard", canCopy: false); } ((ResourceAvailability)(ref Availability)).MakeAvailable(); static bool allowCopy(GameObject val3) { if (Object.op_Implicit((Object)(object)val3.GetComponent()) || Object.op_Implicit((Object)(object)val3.GetComponent()) || Object.op_Implicit((Object)(object)val3.GetComponent()) || Object.op_Implicit((Object)(object)val3.GetComponent()) || Object.op_Implicit((Object)(object)val3.GetComponent()) || Object.op_Implicit((Object)(object)val3.GetComponent()) || Object.op_Implicit((Object)(object)val3.GetComponent())) { return false; } return true; } static void overrideCanCopy(string interactablePrefabName, bool canCopy) { InteractableDef interactableDef2 = GetInteractableDef(FindInteractableIndex(interactablePrefabName)); if (interactableDef2 != null) { interactableDef2.CanCopy = canCopy; } else { Log.Warning("Failed to find interactable '" + interactablePrefabName + "'", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\InteractableCatalog.cs", "Init", 169); } } } 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, "\\s*(-\\s*\\d+)?\\s*(\\(\\d+\\))?\\s*$", string.Empty); text = text.Trim(); return FindInteractableIndex(text); } public static int FindInteractableIndex(string interactablePrefabName) { return _interactablePrefabNameToIndex.GetValueOrDefault(interactablePrefabName, -1); } [ConCommand(commandName = "quality_list_clonable_interactables")] private static void CCListClonableInteractables(ConCommandArgs args) { ((ConCommandArgs)(ref args)).Log("=== Clonable Interactables ==="); InteractableDef[] interactableDefs = _interactableDefs; foreach (InteractableDef interactableDef in interactableDefs) { if (interactableDef.CanCopy) { ((ConCommandArgs)(ref args)).Log(interactableDef.Name); } } ((ConCommandArgs)(ref args)).Log("=== Non-Clonable Interactables ==="); interactableDefs = _interactableDefs; foreach (InteractableDef interactableDef2 in interactableDefs) { if (!interactableDef2.CanCopy) { ((ConCommandArgs)(ref args)).Log(interactableDef2.Name); } } } } internal sealed class InteractableDef { public readonly GameObject Prefab; public readonly 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(InteractableSpawnCard spawnCard) { SpawnCard = spawnCard; Prefab = ((SpawnCard)SpawnCard).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 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 forbidDuplicated; public readonly bool PassesFilter(InteractableInfoProvider interactable) { InteractableDef interactableDef = InteractableCatalog.GetInteractableDef(interactable.CatalogIndex); if (interactableDef == null) { 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 interface IObjectCollideFilter { event Action OnFilterDirty; bool PassesFilter(ObjectCollisionManager collisionManager); } internal static class ItemCostQualityPatch { private delegate bool CostTypeCatalog_IsAffordableItem_orig(CostTypeDef costTypeDef, IsAffordableContext context); private delegate void SetTransformedItemQualityDelegate(ref ItemTransformation itemTransformation); [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_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) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.Goto(0, (MoveType)0, false); VariableDefinition itemIndexVar = null; ILLabel skipItemLabel = null; FieldReference val2 = default(FieldReference); int num = default(int); if (val.TryGotoNext((MoveType)2, new Func[5] { (Instruction x) => x.MatchLdloc(il, out itemIndexVar), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, ref val2), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "avoidedItemIndex"), (Instruction x) => ILPatternMatchingExt.MatchBeq(x, ref skipItemLabel) })) { val.Emit(OpCodes.Ldloc, itemIndexVar); val.EmitDelegate>((Func)isItemAllowed); val.Emit(OpCodes.Brfalse, (object)skipItemLabel); } else { Log.Error("Failed to find quality item filter patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ItemCostQualityPatch.cs", "CostTypeCatalog_PayCostItems", 92); } val.Goto(0, (MoveType)0, false); VariableDefinition itemTransformationVar = null; if (val.TryGotoNext((MoveType)1, new Func[4] { (Instruction x) => x.MatchLdloca(il, out itemTransformationVar), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchLdloca(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "TryTransform") })) { val.Emit(OpCodes.Ldloca, itemTransformationVar); val.EmitDelegate((SetTransformedItemQualityDelegate)setTransformedItemQuality); } else { Log.Error("Failed to find item transformation quality patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\ItemCostQualityPatch.cs", "CostTypeCatalog_PayCostItems", 130); } [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; } static void setTransformedItemQuality(ref ItemTransformation itemTransformation) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //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_001b: Unknown result type (might be due to invalid IL or missing references) if ((int)((ItemTransformation)(ref itemTransformation)).newItemIndex != -1) { ((ItemTransformation)(ref itemTransformation)).newItemIndex = QualityCatalog.GetItemIndexOfQuality(((ItemTransformation)(ref itemTransformation)).newItemIndex, QualityCatalog.GetQualityTier(((ItemTransformation)(ref itemTransformation)).originalItemIndex)); } } } 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_00b9: 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) 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))); } } QualityTier qualityTier = QualityTier.None; foreach (UniquePickup item in list) { QualityTier qualityTier2 = QualityCatalog.GetQualityTier(item.pickupIndex); qualityTier = QualityCatalog.Max(qualityTier, qualityTier2); } return qualityTier; } 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", 197); 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", 233); 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", 258); 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 BuffQualityGroup TeleportOnLowHealthOrbCharge; } 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 QualityDuplicatorMinionInventory; 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 GameObject QualityScrapper; } public static class ProjectilePrefabs { public static GameObject IncreasePrimaryDamageQualityDotZone; public static GameObject TeleportOnLowHealthOrbProjectile; } public static class Materials { public static Material HealCritBoost; public static Material QualityScrapper; } 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 ReadOnlyCollection AllSpawnCards { get; internal set; } = Empty.ReadOnlyCollection; } 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); SpawnCards.AllSpawnCards = new ReadOnlyCollection(((IEnumerable)_contentPack.spawnCards).ToArray()); 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", 413); } } } } [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.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.Gorakh.ItemQualities", "ItemQualities", "0.7.8")] 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.8"; 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", 70); 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", 104); 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")] [EditorBrowsable(EditorBrowsableState.Never)] 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")] [EditorBrowsable(EditorBrowsableState.Never)] 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")] [EditorBrowsable(EditorBrowsableState.Never)] 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")] [EditorBrowsable(EditorBrowsableState.Never)] 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")] [EditorBrowsable(EditorBrowsableState.Never)] 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", 200); } 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", 214); } 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", 289); } 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", 307); } 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); } } internal static class MinionHooks { public delegate void MinionMemberDelegate(MinionGroup minionGroup, CharacterMaster ownerMaster, CharacterMaster memberMaster); public static event MinionMemberDelegate OnMinionGroupMemberDiscoveredGlobal; public static event MinionMemberDelegate OnMinionGroupMemberLostGlobal; [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 MinionOwnership.HandleGroupDiscovery += new hook_HandleGroupDiscovery(MinionOwnership_HandleGroupDiscovery); } private static void MinionOwnership_HandleGroupDiscovery(orig_HandleGroupDiscovery orig, MinionOwnership self, MinionGroup newGroup) { CharacterMaster memberMaster = null; if (MinionHooks.OnMinionGroupMemberLostGlobal != null || MinionHooks.OnMinionGroupMemberDiscoveredGlobal != null) { memberMaster = ((Component)self).GetComponent(); } if (self.group?.resolvedOwnerMaster != null && MinionHooks.OnMinionGroupMemberLostGlobal != null) { try { MinionHooks.OnMinionGroupMemberLostGlobal(self.group, self.group.resolvedOwnerMaster, memberMaster); } catch (Exception ex) { Log.Error_NoCallerPrefix(ex.ToString()); } } orig.Invoke(self, newGroup); if (self.group?.resolvedOwnerMaster != null && MinionHooks.OnMinionGroupMemberDiscoveredGlobal != null) { try { MinionHooks.OnMinionGroupMemberDiscoveredGlobal(self.group, self.group.resolvedOwnerMaster, memberMaster); } catch (Exception ex2) { Log.Error_NoCallerPrefix(ex2.ToString()); } } } } 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 purchaseResults2 = (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 purchaseResults2 = (objectPurchaseContext2.FirstInteractionResults = purchaseResults); } objectPurchaseContext.Results = purchaseResults; } } internal static class PickupHooks { public delegate void OnPickupEventDelegate(in GrantContext context); public static event OnPickupEventDelegate OnPickupGlobalServer; [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.AttemptGrant += new Manipulator(GenericPickupController_AttemptGrant); } private static void GenericPickupController_AttemptGrant(ILContext il) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_00c5: Unknown result type (might be due to invalid IL or missing references) if (!((MethodReference)(object)il.Method).TryFindParameter(out var _)) { Log.Error("Failed to find body parameter", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\PickupHooks.cs", "GenericPickupController_AttemptGrant", 26); return; } ILCursor val = new ILCursor(il); VariableDefinition grantContextVar = null; ILLabel val2 = default(ILLabel); if (!val.TryGotoNext((MoveType)1, new Func[3] { (Instruction x) => x.MatchLdloc(il, out grantContextVar), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "shouldNotify"), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val2) })) { Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\PickupHooks.cs", "GenericPickupController_AttemptGrant", 45); return; } val.Emit(OpCodes.Ldloca, grantContextVar); val.EmitDelegate((OnPickupEventDelegate)invokeOnPickupEvent); [MethodImpl(MethodImplOptions.AggressiveInlining)] static void invokeOnPickupEvent(in GrantContext context) { PickupHooks.OnPickupGlobalServer?.Invoke(in context); } } } 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", 28); } 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", 38); } 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", 46); 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", 72); 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_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_006e: 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) { ItemQualityGroupIndex itemQualityGroupIndex = QualityCatalog.FindItemQualityGroupIndex(ContagiousItemManager.GetTransformedItemIndex(pickupDef.itemIndex)); if (itemQualityGroupIndex != ItemQualityGroupIndex.Invalid && val2.inventory.GetItemCountsEffective(itemQualityGroupIndex).TotalCount > 0) { return false; } if (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 right = 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) { right += instances.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Clover); } } bool flag = right.TotalQualityCount > 0; if (flag) { left += right; } 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] >= right[qualityTier]) { right2[qualityTier] -= right[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 qualityTier = QualityTier.Uncommon; qualityTier < QualityTier.Count; qualityTier++) { ItemIndex itemIndex = itemQualityGroup.GetItemIndex(qualityTier); if ((int)itemIndex == -1) { ItemDef itemDef = itemQualityGroup.GetItemDef(qualityTier); if (Object.op_Implicit((Object)(object)itemDef)) { Log.Error($"Item '{((Object)itemDef).name}' ({qualityTier} 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 {qualityTier} variant in group '{((Object)itemQualityGroup).name}'", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityCatalog.cs", "setQualityGroups", 145); } } else { recordItemInGroup(itemIndex, qualityTier); } } 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 val7, QualityTier qualityTier8) { //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)val7 != -1) { if (_itemIndexToQualityGroupIndex[val7] != ItemQualityGroupIndex.Invalid) { Log.Error($"Item {ItemCatalog.GetItemDef(val7)} is registered in several quality groups, ({GetItemQualityGroup(_itemIndexToQualityGroupIndex[val7])} & {GetItemQualityGroup(itemQualityGroupIndex)})", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityCatalog.cs", "setQualityGroups", 125); } else { _itemIndexToQuality[val7] = qualityTier8; _itemIndexToQualityGroupIndex[val7] = itemQualityGroupIndex; } } } } for (int l = 0; l < _allEquipmentQualityGroups.Length; l++) { EquipmentQualityGroupIndex equipmentQualityGroupIndex = (EquipmentQualityGroupIndex)l; EquipmentQualityGroup equipmentQualityGroup = _allEquipmentQualityGroups[l]; equipmentQualityGroup.GroupIndex = equipmentQualityGroupIndex; for (QualityTier qualityTier2 = QualityTier.Uncommon; qualityTier2 < QualityTier.Count; qualityTier2++) { EquipmentIndex equipmentIndex = equipmentQualityGroup.GetEquipmentIndex(qualityTier2); if ((int)equipmentIndex == -1) { EquipmentDef equipmentDef = equipmentQualityGroup.GetEquipmentDef(qualityTier2); if (Object.op_Implicit((Object)(object)equipmentDef)) { Log.Error($"Equipment {((Object)equipmentDef).name} ({qualityTier2} 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 {qualityTier2} variant in group '{((Object)equipmentQualityGroup).name}'", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityCatalog.cs", "setQualityGroups", 213); } } else { recordEquipmentInGroup(equipmentIndex, qualityTier2); } } 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 val7, QualityTier qualityTier8) { //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)val7 != -1) { if (_equipmentIndexToQualityGroupIndex[val7] != EquipmentQualityGroupIndex.Invalid) { Log.Error("Equipment '" + ((Object)EquipmentCatalog.GetEquipmentDef(val7)).name + "' is registered in several quality groups, ('" + ((Object)GetEquipmentQualityGroup(_equipmentIndexToQualityGroupIndex[val7])).name + "' and '" + ((Object)GetEquipmentQualityGroup(equipmentQualityGroupIndex)).name + "')", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityCatalog.cs", "setQualityGroups", 193); } else { _equipmentIndexToQuality[val7] = qualityTier8; _equipmentIndexToQualityGroupIndex[val7] = equipmentQualityGroupIndex; } } } } for (int m = 0; m < _allBuffQualityGroups.Length; m++) { BuffQualityGroupIndex buffQualityGroupIndex = (BuffQualityGroupIndex)m; BuffQualityGroup buffQualityGroup = _allBuffQualityGroups[m]; buffQualityGroup.GroupIndex = buffQualityGroupIndex; for (QualityTier qualityTier3 = QualityTier.Uncommon; qualityTier3 < QualityTier.Count; qualityTier3++) { BuffIndex buffIndex = buffQualityGroup.GetBuffIndex(qualityTier3); if ((int)buffIndex == -1) { BuffDef buffDef = buffQualityGroup.GetBuffDef(qualityTier3); if (Object.op_Implicit((Object)(object)buffDef)) { Log.Error($"Buff {((Object)buffDef).name} ({qualityTier3} 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 {qualityTier3} variant in group '{((Object)buffQualityGroup).name}'", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityCatalog.cs", "setQualityGroups", 285); } } else { recordBuffInGroup(buffIndex, qualityTier3); } } 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 val7, QualityTier qualityTier8) { //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)val7 != -1) { if (_buffIndexToQualityGroupIndex[val7] != BuffQualityGroupIndex.Invalid) { Log.Error($"Buff {BuffCatalog.GetBuffDef(val7)} is registered in several quality groups, ({GetBuffQualityGroup(_buffIndexToQualityGroupIndex[val7])} & {GetBuffQualityGroup(buffQualityGroupIndex)})", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityCatalog.cs", "setQualityGroups", 265); } else { _buffIndexToQuality[val7] = qualityTier8; _buffIndexToQualityGroupIndex[val7] = buffQualityGroupIndex; } } } } yield return val; List[] array = new List[5]; List[] array2 = new List[5]; List[] array3 = new List[5]; for (QualityTier qualityTier4 = QualityTier.None; qualityTier4 < QualityTier.Count; qualityTier4++) { List list = CollectionPool>.RentCollection(); ListUtils.EnsureCapacity(list, ItemCatalog.itemCount / 5); array[(int)(qualityTier4 + 1)] = list; List list2 = CollectionPool>.RentCollection(); ListUtils.EnsureCapacity(list2, EquipmentCatalog.equipmentCount / 5); array2[(int)(qualityTier4 + 1)] = list2; List list3 = CollectionPool>.RentCollection(); ListUtils.EnsureCapacity(list3, BuffCatalog.buffCount / 5); array3[(int)(qualityTier4 + 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 qualityTier5 = QualityTier.None; qualityTier5 < QualityTier.Count; qualityTier5++) { List list4 = array[(int)(qualityTier5 + 1)]; _itemsByQualityTier[(int)(qualityTier5 + 1)] = ReadOnlyArray.op_Implicit((list4.Count > 0) ? list4.ToArray() : Array.Empty()); CollectionPool>.ReturnCollection(list4); List list5 = array2[(int)(qualityTier5 + 1)]; _equipmentsByQualityTier[(int)(qualityTier5 + 1)] = ReadOnlyArray.op_Implicit((list5.Count > 0) ? list5.ToArray() : Array.Empty()); CollectionPool>.ReturnCollection(list5); List list6 = array3[(int)(qualityTier5 + 1)]; _buffsByQualityTier[(int)(qualityTier5 + 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 qualityTier6 = QualityTier.Uncommon; qualityTier6 < QualityTier.Count; qualityTier6++) { ItemDef itemDef3 = ItemCatalog.GetItemDef(itemQualityGroup2.GetItemIndex(qualityTier6)); if (Object.op_Implicit((Object)(object)itemDef3)) { string text = qualityTier6.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 qualityTier7 = QualityTier.Uncommon; qualityTier7 < QualityTier.Count; qualityTier7++) { EquipmentDef equipmentDef3 = EquipmentCatalog.GetEquipmentDef(equipmentQualityGroup2.GetEquipmentIndex(qualityTier7)); if (Object.op_Implicit((Object)(object)equipmentDef3)) { string text2 = qualityTier7.ToString().ToUpper(); string qualityModifierToken = "QUALITY_" + text2 + "_MODIFIER"; formatQualityNameTokens(equipmentDef2.nameToken, equipmentDef3.nameToken, qualityModifierToken, 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 text3, Dictionary> qualityLanguageDictionary) { if (string.IsNullOrEmpty(qualityNameToken)) { return; } foreach (Language allLanguage3 in Language.GetAllLanguages()) { if (!allLanguage3.TokenIsRegistered(qualityNameToken)) { string localizedFormattedStringByToken = allLanguage3.GetLocalizedFormattedStringByToken(text3, 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 unsafe 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*)(&enumerator2))/*cast due to .constrained prefix*/).Dispose(); } if (hashSet2.Count > 0) { span3[k] = hashSet2.ToArray(); continue; } flag = false; } finally { val7.Dispose(); } break; } 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 val2 = default(MethodReference); if (!val.TryGotoNext((MoveType)2, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(CraftableCatalog), "allRecipes"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val2) && ((val2 != null) ? ((MemberReference)val2).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 val2) && ((val2 != null) ? ((MemberReference)val2).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; bool num = default(bool); if (!val.TryGotoNext((MoveType)2, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val2) && ((val2 != null) ? ((MemberReference)val2).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; } 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 & 1) != 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 ((num & 1) != 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) AddressableUtil.LoadAssetAsync(RoR2_Base_Common.PickupDroplet_prefab, (AsyncReferenceHandleUnloadType)2).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 & 1) != 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 ((num & 1) != 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 itemQualityGroupIndex = QualityCatalog.FindItemQualityGroupIndex(val2); if (itemQualityGroupIndex != ItemQualityGroupIndex.Invalid && !filter(val2)) { ItemQualityGroup itemQualityGroup = QualityCatalog.GetItemQualityGroup(itemQualityGroupIndex); 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) { int result = calculateBonusItemCountFromQualities(itemIndex, otherInventory.GetItemCountsPermanent(itemQualityGroupIndex), 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 itemIndex = itemsList[i]; if (QualityCatalog.FindItemQualityGroupIndex(itemIndex) == itemGroupIndex) { if (firstFoundIndex == -1) { firstFoundIndex = i; } recordItemInGroup(itemIndex); itemsList.RemoveAt(i); i--; if (extractedGroup.Count >= 5) { break; } } } void recordItemInGroup(ItemIndex item) { //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(item, _itemQualityComparer); if (num < 0) { num = ~num; } extractedGroup.Insert(num, item); } } 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)); } } public sealed class QualityScrapperController : MonoBehaviour { private static SceneIndex _moon2SceneIndex = (SceneIndex)(-1); private PickupPickerController _pickupPickerController; [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 _moon2SceneIndex = SceneCatalog.FindSceneIndex("moon2"); if ((int)_moon2SceneIndex != -1) { Stage.onServerStageBegin += onServerStageBegin; } else { Log.Warning("Failed to find moon2 scene index", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityScrapperController.cs", "Init", 32); } } 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_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_0045: 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) 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 && val2 == _moon2SceneIndex) { NetworkServer.Spawn(Object.Instantiate(ItemQualitiesContent.NetworkedPrefabs.QualityScrapper, new Vector3(-208.6049f, -144.4923f, -335.8936f), Quaternion.Euler(352.3429f, 0.425f, 353.6553f))); } } [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_Scrapper.iscScrapper_asset); handle.OnSuccess(delegate(InteractableSpawnCard scrapperSpawnCard) { InteractableSpawnCard val = Object.Instantiate(scrapperSpawnCard); ((Object)val).name = "iscQualityScrapper"; GameObject val2 = PrefabAPI.InstantiateClone(((SpawnCard)scrapperSpawnCard).prefab, "QualityScrapper"); QualityScrapperController qualityScrapperController = val2.AddComponent(); Renderer val3 = null; ModelLocator val4 = default(ModelLocator); val3 = (Renderer)(object)((!val2.TryGetComponent(ref val4) || !Object.op_Implicit((Object)(object)val4.modelTransform)) ? val2.GetComponentInChildren() : ((Component)val4.modelTransform).GetComponentInChildren()); if (Object.op_Implicit((Object)(object)val3)) { if (args.ContentPack.materials.TryGetAsset("matQualityScrapper", out var asset)) { val3.sharedMaterial = asset; } else { Log.Error("Failed to find asset matQualityScrapper in content pack", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityScrapperController.cs", "LoadContent", 83); } } PickupPickerController val5 = default(PickupPickerController); if (val2.TryGetComponent(ref val5)) { int num = -1; int persistentEventCount = ((UnityEventBase)val5.onServerInteractionBegin).GetPersistentEventCount(); for (int i = 0; i < persistentEventCount; i++) { Object persistentTarget = ((UnityEventBase)val5.onServerInteractionBegin).GetPersistentTarget(i); string persistentMethodName = ((UnityEventBase)val5.onServerInteractionBegin).GetPersistentMethodName(i); if (persistentTarget is PickupPickerController && persistentMethodName == "SetOptionsFromInteractor") { num = i; break; } } if (num != -1) { ((UnityEventBase)val5.onServerInteractionBegin).SetPersistentListenerState(num, (UnityEventCallState)0); } else { Log.Warning("Failed to find PickupPickerController.SetOptionsFromInteractor call in onServerInteractionBegin", "D:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\QualityScrapperController.cs", "LoadContent", 110); } ((UnityEvent)(object)val5.onServerInteractionBegin).AddPersistentListener(qualityScrapperController.SetOptionsFromInteractor); val5.contextString = "QUALITY_SCRAPPER_CONTEXT"; GameObject val6 = PrefabAPI.InstantiateClone(val5.panelPrefab, "QualityScrapperPickerPanel", false); Transform val7 = val6.transform.Find("MainPanel/Juice/Label"); LanguageTextMeshController val8 = default(LanguageTextMeshController); if (Object.op_Implicit((Object)(object)val7) && ((Component)val7).TryGetComponent(ref val8)) { val8._token = "QUALITY_SCRAPPER_POPUP_TEXT"; } val5.panelPrefab = val6; args.ContentPack.prefabs.Add(val6); } GenericDisplayNameProvider val9 = default(GenericDisplayNameProvider); if (val2.TryGetComponent(ref val9)) { val9.displayToken = "QUALITY_SCRAPPER_NAME"; } GenericInspectInfoProvider val10 = default(GenericInspectInfoProvider); if (val2.TryGetComponent(ref val10)) { val10.InspectInfo = Object.Instantiate(val10.InspectInfo); ((Object)val10.InspectInfo).name = "idQualityScrapper"; val10.InspectInfo.Info.TitleToken = "QUALITY_SCRAPPER_NAME"; val10.InspectInfo.Info.DescriptionToken = "QUALITY_SCRAPPER_DESCRIPTION"; } ((SpawnCard)val).prefab = val2; args.ContentPack.networkedObjectPrefabs.Add(val2); args.ContentPack.spawnCards.Add((SpawnCard)(object)val); }); return handle.AsProgressCoroutine>(args.ProgressReceiver); } private void Awake() { _pickupPickerController = ((Component)this).GetComponent(); } public void SetOptionsFromInteractor(Interactor interactor) { //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) List