using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using EntityStates; using EntityStates.CaptainDefenseMatrixItem; using EntityStates.Headstompers; using EntityStates.LaserTurbine; using EntityStates.QuestVolatileBattery; using EntityStates.VagrantNovaItem; using HG; using IL.RoR2; using ItemQualities; using ItemQualities.ContentManagement; using ItemQualities.Utilities.Extensions; using LookingGlass.ItemStatsNameSpace; using LookingGlass.LookingGlassLanguage; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using On.EntityStates.CaptainDefenseMatrixItem; using On.EntityStates.LaserTurbine; using On.RoR2; using On.RoR2.Items; using On.RoR2.Orbs; using On.RoR2.Projectile; using R2API; using R2API.Networking; using R2API.Networking.Interfaces; using RoR2; using RoR2.ContentManagement; using RoR2.ExpansionManagement; using RoR2.Items; using RoR2.Orbs; using RoR2.Projectile; using RoR2.Skills; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] namespace RiskOfImpact; public class RiskOfImpactContent : IContentPackProvider { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static StatHookEventHandler <>9__38_0; internal void b__38_0(CharacterBody body, StatHookEventArgs statArgs) { if (!Object.op_Implicit((Object)(object)body.inventory)) { return; } float mugStatBonus = GetMugStatBonus(body.inventory); if (mugStatBonus > 0f) { statArgs.moveSpeedMultAdd += mugStatBonus; statArgs.attackSpeedMultAdd += mugStatBonus; } if (Object.op_Implicit((Object)(object)_caffeineRushBuff) && body.HasBuff(_caffeineRushBuff)) { statArgs.healthTotalMult *= 1.5f; statArgs.regenTotalMult *= 4f; statArgs.moveSpeedTotalMult *= 1.3f; statArgs.damageTotalMult *= 2f; statArgs.attackSpeedTotalMult *= 1.7f; statArgs.armorAdd += 20f; statArgs.allSkills.cooldownMultiplier *= 1f / 3f; } int comboStarItemCount = GetComboStarItemCount(body.inventory); if (comboStarItemCount <= 0) { return; } int buffCount = body.GetBuffCount(_comboStarBuff); if (buffCount <= 0) { return; } float num = (0.03f + (float)(comboStarItemCount - 1) * 0.005f) * (float)buffCount; statArgs.damageMultAdd += num; if (body.GetBuffCount(_comboStarMaxBuff) > 0) { statArgs.critAdd += 5f + (float)(comboStarItemCount - 1) * 2.5f; if (RiskOfImpactMain.IsItemQualitiesInstalled) { statArgs.critDamageMultAdd += GetQualityComboCritDamageBonus(body.inventory); } } } } private static ItemDef _mug; private static BuffDef _caffeineFeedbackBuff; private static BuffDef _caffeineRushBuff; private static EquipmentDef _lanceEquipmentDef; private static AssetBundle _myBundle; private static AssetBundleCreateRequest _assetBundleLoadRequest; private static GameObject _lanceProjectilePrefab; private static GameObject _lanceGhost; private static ItemDef _comboStarItem; private static BuffDef _comboStarBuff; private static BuffDef _comboStarMaxBuff; private static GameObject _comboStarDisplayPrefab; private static GameObject _mugDisplayPrefab; private static ItemDef _redshifter; private static GameObject _redshifterDisplayPrefab; private static GameObject _redshifterDisplayFollowerPrefab; private static ItemDef _bioticShell; private static GameObject _bioticShellDisplayPrefab; private static ItemDef _doomedMoon; private static GameObject _doomedMoonDisplayPrefab; private static GameObject _doomedMoonDisplayFollowerPrefab; private static ItemDef _doomedMoonConsumed; private static ItemDef _doomedMoonStatToken; private static BuffDef _doomedMoonBuff; private static ItemDef _riskyDice; private static ItemDef _riskyDiceCount; private static ItemDef _riskyDiceAffliction; private static BuffDef _riskyDiceBuff; public string identifier => "com.MrE42.RiskOfImpact"; public static ReadOnlyContentPack readOnlyContentPack => new ReadOnlyContentPack(RiskOfImpactContentPack); internal static ContentPack RiskOfImpactContentPack { get; } = new ContentPack(); public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { IEnumerator qualityBaseItemsLoad = EnsureQualityBaseItemsLoadedAsync(); while (qualityBaseItemsLoad.MoveNext()) { if (_assetBundleLoadRequest != null) { args.ReportProgress(((AsyncOperation)_assetBundleLoadRequest).progress); } yield return qualityBaseItemsLoad.Current; } if (!Object.op_Implicit((Object)(object)_myBundle)) { RiskOfImpactMain.LogError("[RiskOfImpactContent] Failed to load asset bundle '" + RiskOfImpactMain.assetBundleDir + "'."); yield break; } _mugDisplayPrefab = _myBundle.LoadAsset("PickupDD"); _caffeineFeedbackBuff = ScriptableObject.CreateInstance(); ((Object)_caffeineFeedbackBuff).name = "CaffeineFeedbackBuff"; _caffeineFeedbackBuff.iconSprite = _mug.pickupIconSprite; _caffeineFeedbackBuff.buffColor = new Color(1f, 0.65f, 0.15f); _caffeineFeedbackBuff.canStack = true; _caffeineFeedbackBuff.isDebuff = false; _caffeineFeedbackBuff.isCooldown = false; _caffeineFeedbackBuff.ignoreGrowthNectar = true; _caffeineRushBuff = ScriptableObject.CreateInstance(); ((Object)_caffeineRushBuff).name = "CaffeineRushBuff"; _caffeineRushBuff.iconSprite = _mug.pickupIconSprite; _caffeineRushBuff.buffColor = new Color(1f, 0.9f, 0.2f); _caffeineRushBuff.canStack = false; _caffeineRushBuff.isDebuff = false; _caffeineRushBuff.isCooldown = false; _caffeineRushBuff.ignoreGrowthNectar = true; _comboStarBuff = _myBundle.LoadAsset("ComboStarBuff"); _comboStarMaxBuff = _myBundle.LoadAsset("MaxStarBuff"); _comboStarDisplayPrefab = _myBundle.LoadAsset("PickupCS"); _redshifterDisplayPrefab = _myBundle.LoadAsset("PlayerDisplayRS"); _redshifterDisplayFollowerPrefab = _myBundle.LoadAsset("DisplayFollowerRS"); _bioticShell.requiredExpansion = Addressables.LoadAssetAsync((object)"RoR2/DLC1/Common/DLC1.asset").WaitForCompletion(); _bioticShellDisplayPrefab = _myBundle.LoadAsset("PickupBS"); _doomedMoon = _myBundle.LoadAsset("DoomedMoon"); _doomedMoonDisplayPrefab = _myBundle.LoadAsset("PlayerDisplayDM"); _doomedMoonDisplayFollowerPrefab = _myBundle.LoadAsset("DisplayFollowerDM"); _doomedMoonConsumed = _myBundle.LoadAsset("DoomedMoonConsumed"); _doomedMoonStatToken = _myBundle.LoadAsset("DoomedMoonStatToken"); _doomedMoonBuff = _myBundle.LoadAsset("DoomedMoonBuff"); _riskyDice = _myBundle.LoadAsset("RiskyDice"); _riskyDiceCount = _myBundle.LoadAsset("RiskyDiceCount"); _riskyDiceAffliction = _myBundle.LoadAsset("RiskyDiceAffliction"); _riskyDiceBuff = _myBundle.LoadAsset("RiskyDiceBuff"); _lanceEquipmentDef = _myBundle.LoadAsset("LanceOfLonginusEquipmentDef"); _lanceProjectilePrefab = _myBundle.LoadAsset("LanceProjectilePrefab"); ExpansionDef val = _myBundle.LoadAsset("RiskOfImpactExpansion"); _myBundle.LoadAsset("ExtraExpansion"); _lanceGhost = _myBundle.LoadAsset("LanceGhost"); _lanceProjectilePrefab.GetComponent().ghostPrefab = _lanceGhost; ItemDisplayRuleDict val2 = new ItemDisplayRuleDict(Array.Empty()); ItemDisplayRuleDict val3 = new ItemDisplayRuleDict(Array.Empty()); ItemDisplayRuleDict val4 = new ItemDisplayRuleDict(Array.Empty()); ItemDisplayRuleDict val5 = new ItemDisplayRuleDict(Array.Empty()); ItemDisplayRuleDict val6 = new ItemDisplayRuleDict(Array.Empty()); ItemDisplayRuleDict val7 = new ItemDisplayRuleDict(Array.Empty()); val3.Add("mdlCommandoDualies", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _comboStarDisplayPrefab, childName = "Pelvis", localPos = new Vector3(0.20239f, -0.06471f, -0.01451f), localAngles = new Vector3(7.55425f, 100.9208f, 181.4531f), localScale = new Vector3(0.12f, 0.12f, 0.12f) } }); val2.Add("mdlCommandoDualies", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _mugDisplayPrefab, childName = "Pelvis", localPos = new Vector3(-0.22258f, -0.06758f, 0.03077f), localAngles = new Vector3(353.157f, 193.3047f, 206.7511f), localScale = new Vector3(0.1f, 0.1f, 0.1f) } }); val4.Add("mdlCommandoDualies", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _redshifterDisplayPrefab, childName = "Base", localPos = new Vector3(0.659f, 0.394f, -0.787f), localAngles = new Vector3(90.0003f, 180.079f, 180.4018f), localScale = new Vector3(1f, 1f, 1f) } }); val7.Add("mdlCommandoDualies", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _doomedMoonDisplayPrefab, childName = "Base", localPos = new Vector3(-0.92478f, -0.45384f, -1.30414f), localAngles = new Vector3(0f, 0f, 45f), localScale = new Vector3(0.8f, 0.8f, 0.8f) } }); val5.Add("mdlCommandoDualies", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _bioticShellDisplayPrefab, childName = "Chest", localPos = new Vector3(-3E-05f, 0.32895f, 0.17171f), localAngles = new Vector3(344.5746f, 359.8877f, 359.99f), localScale = new Vector3(0.12f, 0.12f, 0.12f) } }); val3.Add("mdlHuntress", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _comboStarDisplayPrefab, childName = "Pelvis", localPos = new Vector3(0.18116f, -0.05787f, 0.01043f), localAngles = new Vector3(32.08101f, 101.53f, 186.5844f), localScale = new Vector3(0.12f, 0.12f, 0.12f) } }); val2.Add("mdlHuntress", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _mugDisplayPrefab, childName = "Pelvis", localPos = new Vector3(-0.18304f, -0.07066f, -0.03466f), localAngles = new Vector3(1.01352f, 196.2477f, 177.5963f), localScale = new Vector3(0.1f, 0.1f, 0.1f) } }); val4.Add("mdlHuntress", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _redshifterDisplayPrefab, childName = "Base", localPos = new Vector3(0.659f, 0.394f, -0.787f), localAngles = new Vector3(90.0003f, 180.079f, 180.4018f), localScale = new Vector3(1f, 1f, 1f) } }); val7.Add("mdlHuntress", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _doomedMoonDisplayPrefab, childName = "Base", localPos = new Vector3(-0.92478f, -0.45384f, -1.30414f), localAngles = new Vector3(0f, 0f, 45f), localScale = new Vector3(0.8f, 0.8f, 0.8f) } }); val5.Add("mdlHuntress", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _bioticShellDisplayPrefab, childName = "Chest", localPos = new Vector3(-0.00947f, 0.15638f, 0.17891f), localAngles = new Vector3(337.9482f, 358.7204f, 52.48233f), localScale = new Vector3(0.12f, 0.12f, 0.12f) } }); val3.Add("mdlBandit2", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _comboStarDisplayPrefab, childName = "Pelvis", localPos = new Vector3(0.20239f, -0.06471f, -0.01451f), localAngles = new Vector3(7.55425f, 100.9208f, 181.4531f), localScale = new Vector3(0.12f, 0.12f, 0.12f) } }); val2.Add("mdlBandit2", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _mugDisplayPrefab, childName = "Pelvis", localPos = new Vector3(-0.24089f, -0.03475f, -0.08941f), localAngles = new Vector3(351.2207f, 180.0096f, 189.8164f), localScale = new Vector3(0.1f, 0.1f, 0.1f) } }); val4.Add("mdlBandit2", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _redshifterDisplayPrefab, childName = "ROOT", localPos = new Vector3(-0.36643f, 1.76863f, 0.55818f), localAngles = new Vector3(0.0713f, 344.7929f, 0f), localScale = new Vector3(1f, 1f, 1f) } }); val7.Add("mdlBandit2", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _doomedMoonDisplayPrefab, childName = "Base", localPos = new Vector3(0.76099f, 0.41951f, -1.30499f), localAngles = new Vector3(0f, 0f, 45f), localScale = new Vector3(0.8f, 0.8f, 0.8f) } }); val5.Add("mdlBandit2", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _bioticShellDisplayPrefab, childName = "UpperArmR", localPos = new Vector3(-0.00694f, 0.18783f, -0.07376f), localAngles = new Vector3(337.5303f, 183.404f, 317.6291f), localScale = new Vector3(0.12f, 0.12f, 0.12f) } }); val3.Add("mdlToolbot", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _comboStarDisplayPrefab, childName = "Chest", localPos = new Vector3(2.66884f, 1.38091f, 1.85382f), localAngles = new Vector3(0f, 90f, 0f), localScale = new Vector3(1f, 1f, 1f) } }); val2.Add("mdlToolbot", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _mugDisplayPrefab, childName = "Hip", localPos = new Vector3(2.45337f, 0.28995f, -0.52838f), localAngles = new Vector3(353.157f, 15.00789f, 206.7511f), localScale = new Vector3(1f, 1f, 1f) } }); val4.Add("mdlToolbot", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _redshifterDisplayPrefab, childName = "Chest", localPos = new Vector3(5.86281f, 6.67238f, 1.90503f), localAngles = new Vector3(0f, 90f, 0f), localScale = new Vector3(1f, 1f, 1f) } }); val7.Add("mdlToolbot", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _doomedMoonDisplayPrefab, childName = "Chest", localPos = new Vector3(-4.74067f, 8.84387f, -6.63475f), localAngles = new Vector3(0f, 0f, 45f), localScale = new Vector3(0.8f, 0.8f, 0.8f) } }); val5.Add("mdlToolbot", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _bioticShellDisplayPrefab, childName = "Chest", localPos = new Vector3(-0.06f, 1.16f, 3.24f), localAngles = new Vector3(8.85492f, 346.6888f, 13.30589f), localScale = new Vector3(0.5f, 0.5f, 0.5f) } }); val3.Add("mdlEngi", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _comboStarDisplayPrefab, childName = "Pelvis", localPos = new Vector3(0.24459f, -0.04413f, -0.01453f), localAngles = new Vector3(7.55425f, 100.9208f, 181.4531f), localScale = new Vector3(0.12f, 0.12f, 0.12f) } }); val2.Add("mdlEngi", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _mugDisplayPrefab, childName = "Pelvis", localPos = new Vector3(-0.27511f, -0.00163f, 0.03076f), localAngles = new Vector3(353.157f, 193.3047f, 206.7511f), localScale = new Vector3(0.1f, 0.1f, 0.1f) } }); val4.Add("mdlEngi", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _redshifterDisplayPrefab, childName = "Base", localPos = new Vector3(0.659f, 0.394f, -0.787f), localAngles = new Vector3(90.0003f, 180.079f, 180.4018f), localScale = new Vector3(1f, 1f, 1f) } }); val7.Add("mdlEngi", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _doomedMoonDisplayPrefab, childName = "Base", localPos = new Vector3(-0.92478f, -0.45384f, -1.30414f), localAngles = new Vector3(0f, 0f, 45f), localScale = new Vector3(0.8f, 0.8f, 0.8f) } }); val5.Add("mdlEngi", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _bioticShellDisplayPrefab, childName = "Chest", localPos = new Vector3(-0.0041f, 0.2951f, 0.2481f), localAngles = new Vector3(337.6299f, 359.5753f, 0.39165f), localScale = new Vector3(0.12f, 0.12f, 0.12f) } }); val3.Add("mdlMage", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _comboStarDisplayPrefab, childName = "Pelvis", localPos = new Vector3(0.20239f, -0.06471f, -0.01451f), localAngles = new Vector3(7.55425f, 100.9208f, 181.4531f), localScale = new Vector3(0.12f, 0.12f, 0.12f) } }); val2.Add("mdlMage", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _mugDisplayPrefab, childName = "Pelvis", localPos = new Vector3(-0.22258f, -0.06758f, 0.03077f), localAngles = new Vector3(353.157f, 193.3047f, 206.7511f), localScale = new Vector3(0.1f, 0.1f, 0.1f) } }); val4.Add("mdlMage", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _redshifterDisplayPrefab, childName = "Base", localPos = new Vector3(0.659f, 0.394f, -0.787f), localAngles = new Vector3(90.0003f, 180.079f, 180.4018f), localScale = new Vector3(1f, 1f, 1f) } }); val7.Add("mdlMage", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _doomedMoonDisplayPrefab, childName = "Base", localPos = new Vector3(-0.92478f, -0.45384f, -1.30414f), localAngles = new Vector3(0f, 0f, 45f), localScale = new Vector3(0.8f, 0.8f, 0.8f) } }); val5.Add("mdlMage", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _bioticShellDisplayPrefab, childName = "Chest", localPos = new Vector3(-0.006f, 0.202f, 0.135f), localAngles = new Vector3(328.7007f, 21.62506f, 345.3727f), localScale = new Vector3(0.12f, 0.12f, 0.12f) } }); val3.Add("mdlMerc", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _comboStarDisplayPrefab, childName = "Pelvis", localPos = new Vector3(0.21235f, 0.06133f, -0.02965f), localAngles = new Vector3(15.33725f, 100.263f, 182.9367f), localScale = new Vector3(0.12f, 0.12f, 0.12f) } }); val2.Add("mdlMerc", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _mugDisplayPrefab, childName = "Pelvis", localPos = new Vector3(-0.23385f, 0.04143f, -0.05599f), localAngles = new Vector3(353.3026f, 173.733f, 204.3656f), localScale = new Vector3(0.1f, 0.1f, 0.1f) } }); val4.Add("mdlMerc", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _redshifterDisplayPrefab, childName = "Base", localPos = new Vector3(0.659f, 0.394f, -0.787f), localAngles = new Vector3(90.0003f, 180.079f, 180.4018f), localScale = new Vector3(1f, 1f, 1f) } }); val7.Add("mdlMerc", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _doomedMoonDisplayPrefab, childName = "Base", localPos = new Vector3(-0.92478f, -0.45384f, -1.30414f), localAngles = new Vector3(0f, 0f, 45f), localScale = new Vector3(0.8f, 0.8f, 0.8f) } }); val5.Add("mdlMerc", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _bioticShellDisplayPrefab, childName = "Chest", localPos = new Vector3(0.024f, 0.206f, 0.174f), localAngles = new Vector3(324.9625f, 6.28376f, 355.0841f), localScale = new Vector3(0.12f, 0.12f, 0.12f) } }); val3.Add("mdlTreebot", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _comboStarDisplayPrefab, childName = "PlatformBase", localPos = new Vector3(0.7219f, 0.13116f, 0.2195f), localAngles = new Vector3(351.8981f, 73.25513f, 358.5338f), localScale = new Vector3(0.4f, 0.4f, 0.4f) } }); val2.Add("mdlTreebot", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _mugDisplayPrefab, childName = "PlatformBase", localPos = new Vector3(-0.75075f, 0.07669f, 0.03075f), localAngles = new Vector3(5.2294f, 355.3522f, 20.07811f), localScale = new Vector3(0.4f, 0.4f, 0.4f) } }); val4.Add("mdlTreebot", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _redshifterDisplayPrefab, childName = "PlatformBase", localPos = new Vector3(2.24017f, 2.11404f, 0.21945f), localAngles = new Vector3(351.8981f, 73.25513f, 358.5338f), localScale = new Vector3(1f, 1f, 1f) } }); val7.Add("mdlTreebot", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _doomedMoonDisplayPrefab, childName = "PlatformBase", localPos = new Vector3(-1.57404f, 3.24967f, -1.88479f), localAngles = new Vector3(0f, 0f, 45f), localScale = new Vector3(1.5f, 1.5f, 1.5f) } }); val5.Add("mdlTreebot", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _bioticShellDisplayPrefab, childName = "PlatformBase", localPos = new Vector3(0.661f, -0.186f, 0.157f), localAngles = new Vector3(352.855f, 89.99998f, 351.2419f), localScale = new Vector3(0.12f, 0.12f, 0.12f) } }); val3.Add("mdlLoader", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _comboStarDisplayPrefab, childName = "Chest", localPos = new Vector3(0.23944f, 0.01208f, -0.05754f), localAngles = new Vector3(0f, 90f, 0f), localScale = new Vector3(0.12f, 0.12f, 0.12f) } }); val2.Add("mdlLoader", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _mugDisplayPrefab, childName = "Chest", localPos = new Vector3(-0.2722f, -0.06754f, 0.03045f), localAngles = new Vector3(6.94817f, 3.35957f, 26.3395f), localScale = new Vector3(0.1f, 0.1f, 0.1f) } }); val4.Add("mdlLoader", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _redshifterDisplayPrefab, childName = "Chest", localPos = new Vector3(0.79858f, 0.55478f, 0.42963f), localAngles = new Vector3(6.94817f, 3.35957f, 26.3395f), localScale = new Vector3(1f, 1f, 1f) } }); val7.Add("mdlLoader", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _doomedMoonDisplayPrefab, childName = "Chest", localPos = new Vector3(-0.9262f, 1.13019f, -1.1029f), localAngles = new Vector3(0f, 0f, 45f), localScale = new Vector3(0.8f, 0.8f, 0.8f) } }); val5.Add("mdlLoader", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _bioticShellDisplayPrefab, childName = "Chest", localPos = new Vector3(-0.25771f, 0.01213f, -0.06079f), localAngles = new Vector3(0f, 90f, 0f), localScale = new Vector3(0.12f, 0.12f, 0.12f) } }); val3.Add("mdlCroco", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _comboStarDisplayPrefab, childName = "Hip", localPos = new Vector3(1.94228f, 0.39972f, -0.40409f), localAngles = new Vector3(7.55425f, 100.9208f, 181.4531f), localScale = new Vector3(1f, 1f, 1f) } }); val2.Add("mdlCroco", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _mugDisplayPrefab, childName = "Hip", localPos = new Vector3(-2.45304f, 0.54139f, 0.25251f), localAngles = new Vector3(19.53804f, 194.0312f, 213.1425f), localScale = new Vector3(1f, 1f, 1f) } }); val4.Add("mdlCroco", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _redshifterDisplayPrefab, childName = "Base", localPos = new Vector3(-5.04f, -3.02f, 5.34f), localAngles = new Vector3(84.9998f, 359.9714f, 359.584f), localScale = new Vector3(1f, 1f, 1f) } }); val7.Add("mdlCroco", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _doomedMoonDisplayPrefab, childName = "Chest", localPos = new Vector3(-7.60114f, 1.59776f, 9.56897f), localAngles = new Vector3(0f, 0f, 45f), localScale = new Vector3(1f, 1f, 1f) } }); val5.Add("mdlCroco", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _bioticShellDisplayPrefab, childName = "Chest", localPos = new Vector3(-2.55f, 2.94f, -0.59f), localAngles = new Vector3(356.9059f, 69.76768f, 25.01778f), localScale = new Vector3(1f, 1f, 1f) } }); val3.Add("mdlCaptain", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _comboStarDisplayPrefab, childName = "Pelvis", localPos = new Vector3(0.2758f, -0.10375f, -0.02017f), localAngles = new Vector3(7.55425f, 100.9208f, 181.4531f), localScale = new Vector3(0.12f, 0.12f, 0.12f) } }); val2.Add("mdlCaptain", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _mugDisplayPrefab, childName = "Pelvis", localPos = new Vector3(-0.30334f, -0.12005f, 0.02085f), localAngles = new Vector3(356.783f, 191.9943f, 191.5501f), localScale = new Vector3(0.1f, 0.1f, 0.1f) } }); val4.Add("mdlCaptain", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _redshifterDisplayPrefab, childName = "Base", localPos = new Vector3(0.659f, 0.394f, -0.787f), localAngles = new Vector3(90.0003f, 180.079f, 180.4018f), localScale = new Vector3(1f, 1f, 1f) } }); val7.Add("mdlCaptain", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _doomedMoonDisplayPrefab, childName = "Base", localPos = new Vector3(-0.92478f, -0.45384f, -1.30414f), localAngles = new Vector3(0f, 0f, 45f), localScale = new Vector3(0.8f, 0.8f, 0.8f) } }); val5.Add("mdlCaptain", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _bioticShellDisplayPrefab, childName = "Chest", localPos = new Vector3(-0.00288f, 0.22976f, 0.21501f), localAngles = new Vector3(343.283f, 350.7494f, 320.7523f), localScale = new Vector3(0.12f, 0.12f, 0.12f) } }); val3.Add("mdlHeretic", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _comboStarDisplayPrefab, childName = "Pelvis", localPos = new Vector3(-0.16834f, 0.20744f, -0.3221f), localAngles = new Vector3(321.7271f, 192.0575f, 270.6939f), localScale = new Vector3(0.2f, 0.2f, 0.2f) } }); val2.Add("mdlHeretic", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _mugDisplayPrefab, childName = "Pelvis", localPos = new Vector3(-0.21054f, 0.08455f, 0.4505f), localAngles = new Vector3(281.3847f, 102.9863f, 13.02637f), localScale = new Vector3(0.2f, 0.2f, 0.2f) } }); val4.Add("mdlHeretic", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _redshifterDisplayPrefab, childName = "Chest", localPos = new Vector3(-0.68984f, -1.22926f, -1.79202f), localAngles = new Vector3(295.4063f, 217.6076f, 232.8437f), localScale = new Vector3(1f, 1f, 1f) } }); val7.Add("mdlHeretic", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _doomedMoonDisplayPrefab, childName = "Chest", localPos = new Vector3(-1.06155f, -0.90547f, 1.83211f), localAngles = new Vector3(0f, 0f, 45f), localScale = new Vector3(1f, 1f, 1f) } }); val3.Add("mdlRailGunner", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _comboStarDisplayPrefab, childName = "GunRoot", localPos = new Vector3(0f, -0.12961f, 0.06076f), localAngles = new Vector3(0f, 0f, 180f), localScale = new Vector3(0.05f, 0.05f, 0.05f) } }); val2.Add("mdlRailGunner", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _mugDisplayPrefab, childName = "Backpack", localPos = new Vector3(0.37979f, -0.509f, 0.0309f), localAngles = new Vector3(24.20953f, 182.6858f, 49.19599f), localScale = new Vector3(0.1f, 0.1f, 0.1f) } }); val4.Add("mdlRailGunner", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _redshifterDisplayPrefab, childName = "Base", localPos = new Vector3(0.799f, 0.04025f, -0.28362f), localAngles = new Vector3(90.00027f, 180.079f, 180.4018f), localScale = new Vector3(1f, 1f, 1f) } }); val7.Add("mdlRailGunner", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _doomedMoonDisplayPrefab, childName = "Base", localPos = new Vector3(-0.92478f, -0.45384f, -1.30414f), localAngles = new Vector3(0f, 0f, 45f), localScale = new Vector3(0.8f, 0.8f, 0.8f) } }); val5.Add("mdlRailGunner", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _bioticShellDisplayPrefab, childName = "UpperArmL", localPos = new Vector3(0.00072f, 0.08052f, 0.06183f), localAngles = new Vector3(5.06661f, 358.0723f, 116.7787f), localScale = new Vector3(0.12f, 0.12f, 0.12f) } }); val3.Add("mdlVoidSurvivor", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _comboStarDisplayPrefab, childName = "Pelvis", localPos = new Vector3(-0.00645f, 0.02082f, 0.15709f), localAngles = new Vector3(11.41105f, 359.2993f, 165.3926f), localScale = new Vector3(0.12f, 0.12f, 0.12f) } }); val2.Add("mdlVoidSurvivor", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _mugDisplayPrefab, childName = "Pelvis", localPos = new Vector3(0.03053f, 0.00479f, -0.20481f), localAngles = new Vector3(10.27088f, 86.79462f, 192.5363f), localScale = new Vector3(0.1f, 0.1f, 0.1f) } }); val4.Add("mdlVoidSurvivor", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _redshifterDisplayPrefab, childName = "Base", localPos = new Vector3(0.81593f, 0.92553f, 0.42535f), localAngles = new Vector3(88.27319f, 357.384f, 352.9297f), localScale = new Vector3(1f, 1f, 1f) } }); val7.Add("mdlVoidSurvivor", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _doomedMoonDisplayPrefab, childName = "Base", localPos = new Vector3(-0.92478f, 0.24515f, 0.64663f), localAngles = new Vector3(0f, 0f, 45f), localScale = new Vector3(0.8f, 0.8f, 0.8f) } }); val5.Add("mdlVoidSurvivor", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _bioticShellDisplayPrefab, childName = "UpperArmR", localPos = new Vector3(0.21565f, -0.04918f, 0.00468f), localAngles = new Vector3(10.95605f, 105.0443f, 191.8376f), localScale = new Vector3(0.12f, 0.12f, 0.12f) } }); val3.Add("mdlSeeker", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _comboStarDisplayPrefab, childName = "Pelvis", localPos = new Vector3(0.22783f, 0.02224f, -0.00465f), localAngles = new Vector3(339.8495f, 78.9239f, 353.0269f), localScale = new Vector3(0.12f, 0.12f, 0.12f) } }); val2.Add("mdlSeeker", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _mugDisplayPrefab, childName = "Pelvis", localPos = new Vector3(-0.26268f, 0.04164f, -0.02405f), localAngles = new Vector3(354.4812f, 351.9723f, 342.0317f), localScale = new Vector3(0.1f, 0.1f, 0.1f) } }); val4.Add("mdlSeeker", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _redshifterDisplayPrefab, childName = "Base", localPos = new Vector3(0.649f, 1.727f, -0.109f), localAngles = new Vector3(14.33531f, 0.39733f, 0.22404f), localScale = new Vector3(1f, 1f, 1f) } }); val7.Add("mdlSeeker", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _doomedMoonDisplayPrefab, childName = "Base", localPos = new Vector3(-0.91217f, 2.18543f, -0.30558f), localAngles = new Vector3(0f, 0f, 45f), localScale = new Vector3(0.8f, 0.8f, 0.8f) } }); val5.Add("mdlSeeker", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _bioticShellDisplayPrefab, childName = "Chest", localPos = new Vector3(-0.0041f, 0.07456f, 0.1186f), localAngles = new Vector3(352.4757f, 353.3727f, 4.8746f), localScale = new Vector3(0.12f, 0.12f, 0.12f) } }); val3.Add("mdlFalseSon", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _comboStarDisplayPrefab, childName = "Pelvis", localPos = new Vector3(0.31534f, 0.11852f, -0.14177f), localAngles = new Vector3(339.1165f, 125.6798f, 352.5457f), localScale = new Vector3(0.12f, 0.12f, 0.12f) } }); val2.Add("mdlFalseSon", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _mugDisplayPrefab, childName = "Pelvis", localPos = new Vector3(-0.27259f, 0.11521f, -0.22216f), localAngles = new Vector3(358.424f, 318.1652f, 346.5849f), localScale = new Vector3(0.1f, 0.1f, 0.1f) } }); val4.Add("mdlFalseSon", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _redshifterDisplayPrefab, childName = "Root", localPos = new Vector3(0.966f, 3.37f, -0.347f), localAngles = new Vector3(11.01017f, 359.0091f, 0.39317f), localScale = new Vector3(1f, 1f, 1f) } }); val7.Add("mdlFalseSon", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _doomedMoonDisplayPrefab, childName = "Root", localPos = new Vector3(-1.25927f, 3.85099f, -1.37428f), localAngles = new Vector3(0f, 0f, 45f), localScale = new Vector3(1f, 1f, 1f) } }); val5.Add("mdlFalseSon", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _bioticShellDisplayPrefab, childName = "Chest", localPos = new Vector3(0.02305f, 0.42224f, 0.16099f), localAngles = new Vector3(308.0242f, 354.2237f, 354.7403f), localScale = new Vector3(0.12f, 0.12f, 0.12f) } }); val3.Add("mdlChef", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _comboStarDisplayPrefab, childName = "Chest", localPos = new Vector3(0.1323f, 0.20992f, -0.3466f), localAngles = new Vector3(352.6544f, 180.1904f, 314.3582f), localScale = new Vector3(0.12f, 0.12f, 0.12f) } }); val2.Add("mdlChef", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _mugDisplayPrefab, childName = "OvenDoor", localPos = new Vector3(-0.58416f, 0.06339f, 0.09305f), localAngles = new Vector3(4.14493f, 2.58369f, 8.85832f), localScale = new Vector3(0.1f, 0.1f, 0.1f) } }); val4.Add("mdlChef", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _redshifterDisplayPrefab, childName = "Root", localPos = new Vector3(-0.787f, 1.34229f, 0.41002f), localAngles = new Vector3(0.11209f, 89.41496f, 19.53264f), localScale = new Vector3(1f, 1f, 1f) } }); val7.Add("mdlChef", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _doomedMoonDisplayPrefab, childName = "Root", localPos = new Vector3(1.08621f, 2.5569f, -1.11563f), localAngles = new Vector3(0f, 0f, 45f), localScale = new Vector3(0.8f, 0.8f, 0.8f) } }); val5.Add("mdlChef", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _bioticShellDisplayPrefab, childName = "Chest", localPos = new Vector3(-0.2804f, 0.1809f, 0.0058f), localAngles = new Vector3(359.487f, 89.95702f, 183.1426f), localScale = new Vector3(0.12f, 0.12f, 0.12f) } }); val3.Add("mdlDroneTech", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _comboStarDisplayPrefab, childName = "Pelvis", localPos = new Vector3(0.18679f, 0.07799f, 0.0409f), localAngles = new Vector3(347.8549f, 103.8105f, 359.8152f), localScale = new Vector3(0.12f, 0.12f, 0.12f) } }); val2.Add("mdlDroneTech", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _mugDisplayPrefab, childName = "Pelvis", localPos = new Vector3(-0.14239f, 0.08143f, 0.07492f), localAngles = new Vector3(26.93316f, 359.0482f, 33.11788f), localScale = new Vector3(0.1f, 0.1f, 0.1f) } }); val4.Add("mdlDroneTech", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _redshifterDisplayPrefab, childName = "Base", localPos = new Vector3(-0.568f, 1.189f, 0f), localAngles = new Vector3(350.118f, 180f, 180f), localScale = new Vector3(1f, 1f, 1f) } }); val7.Add("mdlDroneTech", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _doomedMoonDisplayPrefab, childName = "Base", localPos = new Vector3(1.80938f, 1.72888f, 0.44503f), localAngles = new Vector3(0f, 0f, 45f), localScale = new Vector3(0.8f, 0.8f, 0.8f) } }); val5.Add("mdlDroneTech", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _bioticShellDisplayPrefab, childName = "Chest", localPos = new Vector3(-0.001f, -0.0999f, -0.0822f), localAngles = new Vector3(286.3296f, 353.8997f, 22.19561f), localScale = new Vector3(0.06f, 0.06f, 0.06f) } }); val3.Add("mdlDrifter", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _comboStarDisplayPrefab, childName = "Pelvis", localPos = new Vector3(-0.1024f, 0.00187f, -0.37851f), localAngles = new Vector3(357.0724f, 189.1636f, 280.7911f), localScale = new Vector3(0.12f, 0.12f, 0.12f) } }); val2.Add("mdlDrifter", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _mugDisplayPrefab, childName = "Pelvis", localPos = new Vector3(-0.18712f, -0.06656f, 0.3887f), localAngles = new Vector3(275.4132f, 1.23565f, 85.85339f), localScale = new Vector3(0.1f, 0.1f, 0.1f) } }); val4.Add("mdlDrifter", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _redshifterDisplayPrefab, childName = "Base", localPos = new Vector3(0.39681f, -0.65566f, 0.66076f), localAngles = new Vector3(318.5939f, 293.7787f, 169.5416f), localScale = new Vector3(1f, 1f, 1f) } }); val7.Add("mdlDrifter", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _doomedMoonDisplayPrefab, childName = "Base", localPos = new Vector3(-0.62317f, -1.03718f, -1.42457f), localAngles = new Vector3(0f, 0f, 45f), localScale = new Vector3(0.8f, 0.8f, 0.8f) } }); val5.Add("mdlDrifter", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _bioticShellDisplayPrefab, childName = "Chest", localPos = new Vector3(-0.03096f, 0.27478f, -0.01272f), localAngles = new Vector3(315.9871f, 247.1702f, 194.6353f), localScale = new Vector3(0.06f, 0.06f, 0.06f) } }); val3.Add("mdlBasicTank", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _comboStarDisplayPrefab, childName = "Bruiser_Hull", localPos = new Vector3(-0.94709f, 0.66307f, 0.0552f), localAngles = new Vector3(0f, 270f, 0f), localScale = new Vector3(0.2f, 0.2f, 0.2f) } }); val2.Add("mdlBasicTank", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _mugDisplayPrefab, childName = "CannonMuzzle0", localPos = new Vector3(0f, 0.16607f, -0.07901f), localAngles = new Vector3(0f, 270f, 0f), localScale = new Vector3(0.1f, 0.1f, 0.1f) } }); val4.Add("mdlBasicTank", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _redshifterDisplayPrefab, childName = "ROOT", localPos = new Vector3(1.50346f, 2.04334f, -0.38996f), localAngles = new Vector3(-1E-05f, 180f, 180f), localScale = new Vector3(1f, 1f, 1f) } }); val7.Add("mdlBasicTank", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _doomedMoonDisplayPrefab, childName = "ROOT", localPos = new Vector3(-1.71963f, 2.4493f, -1.30414f), localAngles = new Vector3(0f, 0f, 45f), localScale = new Vector3(1f, 1f, 1f) } }); val2.Add("mdlDefectiveUnit (1)", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _mugDisplayPrefab, childName = "Body", localPos = new Vector3(0.53761f, 0.58974f, 0.39026f), localAngles = new Vector3(65.78642f, 158.3518f, 326.1167f), localScale = new Vector3(0.2f, 0.2f, 0.2f) } }); val3.Add("mdlEngiTurret", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _comboStarDisplayPrefab, childName = "Head", localPos = new Vector3(0f, 0.83617f, -0.7562f), localAngles = new Vector3(298.6673f, 0f, 1E-05f), localScale = new Vector3(0.3f, 0.3f, 0.3f) } }); val2.Add("mdlEngiTurret", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _mugDisplayPrefab, childName = "Head", localPos = new Vector3(0f, 0.84778f, -1.66701f), localAngles = new Vector3(0f, 270f, 20.28025f), localScale = new Vector3(0.3f, 0.3f, 0.3f) } }); val4.Add("mdlEngiTurret", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _redshifterDisplayPrefab, childName = "Base", localPos = new Vector3(2.07f, 3.72f, 0.41f), localAngles = new Vector3(-0.0003f, 180.079f, 180.4018f), localScale = new Vector3(1f, 1f, 1f) } }); val7.Add("mdlEngiTurret", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _doomedMoonDisplayPrefab, childName = "Base", localPos = new Vector3(-2.34182f, 3.93022f, -1.91096f), localAngles = new Vector3(0f, 0f, 45f), localScale = new Vector3(0.8f, 0.8f, 0.8f) } }); val5.Add("mdlEngiTurret", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = _bioticShellDisplayPrefab, childName = "Head", localPos = new Vector3(0f, 0f, -0.326f), localAngles = new Vector3(358.6553f, 0f, 0f), localScale = new Vector3(0.42f, 0.42f, 0.42f) } }); _lanceEquipmentDef.requiredExpansion = val; _comboStarItem.requiredExpansion = val; _redshifter.requiredExpansion = val; _doomedMoon.requiredExpansion = val; _mug.requiredExpansion = val; _riskyDice.requiredExpansion = val; _riskyDiceCount.requiredExpansion = val; _riskyDiceAffliction.requiredExpansion = val; _riskyDiceCount.hidden = true; ItemAPI.Add(new CustomItem(_mug, val2)); ItemAPI.Add(new CustomItem(_comboStarItem, val3)); ItemAPI.Add(new CustomItem(_redshifter, val4)); ItemAPI.Add(new CustomItem(_bioticShell, val5)); ItemAPI.Add(new CustomEquipment(_lanceEquipmentDef, val6)); ItemAPI.Add(new CustomItem(_doomedMoon, val7)); ItemAPI.Add(new CustomItem(_doomedMoonConsumed, new ItemDisplayRuleDict(Array.Empty()))); ItemAPI.Add(new CustomItem(_doomedMoonStatToken, new ItemDisplayRuleDict(Array.Empty()))); ItemAPI.Add(new CustomItem(_riskyDice, new ItemDisplayRuleDict(Array.Empty()))); ItemAPI.Add(new CustomItem(_riskyDiceCount, new ItemDisplayRuleDict(Array.Empty()))); ItemAPI.Add(new CustomItem(_riskyDiceAffliction, new ItemDisplayRuleDict(Array.Empty()))); RiskOfImpactContentPack.itemDefs.Add((ItemDef[])(object)new ItemDef[1] { _mug }); RiskOfImpactContentPack.buffDefs.Add((BuffDef[])(object)new BuffDef[1] { _caffeineFeedbackBuff }); RiskOfImpactContentPack.buffDefs.Add((BuffDef[])(object)new BuffDef[1] { _caffeineRushBuff }); RiskOfImpactContentPack.itemDefs.Add((ItemDef[])(object)new ItemDef[1] { _comboStarItem }); RiskOfImpactContentPack.buffDefs.Add((BuffDef[])(object)new BuffDef[1] { _comboStarBuff }); RiskOfImpactContentPack.buffDefs.Add((BuffDef[])(object)new BuffDef[1] { _comboStarMaxBuff }); RiskOfImpactContentPack.itemDefs.Add((ItemDef[])(object)new ItemDef[1] { _redshifter }); RiskOfImpactContentPack.itemDefs.Add((ItemDef[])(object)new ItemDef[1] { _doomedMoon }); RiskOfImpactContentPack.itemDefs.Add((ItemDef[])(object)new ItemDef[1] { _doomedMoonConsumed }); RiskOfImpactContentPack.itemDefs.Add((ItemDef[])(object)new ItemDef[1] { _doomedMoonStatToken }); RiskOfImpactContentPack.buffDefs.Add((BuffDef[])(object)new BuffDef[1] { _doomedMoonBuff }); RiskOfImpactContentPack.itemDefs.Add((ItemDef[])(object)new ItemDef[1] { _riskyDice }); RiskOfImpactContentPack.itemDefs.Add((ItemDef[])(object)new ItemDef[1] { _riskyDiceCount }); RiskOfImpactContentPack.itemDefs.Add((ItemDef[])(object)new ItemDef[1] { _riskyDiceAffliction }); RiskOfImpactContentPack.buffDefs.Add((BuffDef[])(object)new BuffDef[1] { _riskyDiceBuff }); RiskOfImpactContentPack.itemDefs.Add((ItemDef[])(object)new ItemDef[1] { _bioticShell }); RiskOfImpactContentPack.equipmentDefs.Add((EquipmentDef[])(object)new EquipmentDef[1] { _lanceEquipmentDef }); RiskOfImpactContentPack.projectilePrefabs.Add((GameObject[])(object)new GameObject[1] { _lanceProjectilePrefab }); RiskOfImpactContentPack.expansionDefs.Add((ExpansionDef[])(object)new ExpansionDef[1] { val }); LanguageAPI.Add("EQUIPMENT_LANCEOFLONGINUS_NAME", "Lance of Longinus"); LanguageAPI.Add("EQUIPMENT_LANCEOFLONGINUS_PICKUP", "Throw a mighty lance that impales enemies and can be retrieved, but at a cost."); LanguageAPI.Add("EQUIPMENT_LANCEOFLONGINUS_DESC", "Throw a spear for 9000% damage, but lose 20% maximum health."); LanguageAPI.Add("DD_NAME", "Cheerful Mug"); LanguageAPI.Add("DD_PICKUP", "Wait, are those marshmallows or sugar cubes?"); LanguageAPI.Add("DD_DESC", "Gain 69% (+69% per stack) movement and attack speed"); LanguageAPI.Add("COMBOSTAR_NAME", "Combo Star"); LanguageAPI.Add("COMBOSTAR_PICKUP", "Hitting enemies builds damage, missing a hit resets it."); LanguageAPI.Add("COMBOSTAR_DESC", "Hitting an enemy increases your damage by 3% (+0.5% per stack), up to 20 (+10 per stack). Missing a skill hit resets all stacks. At maximum stacks, gain 5% (+2.5% per stack) crit chance."); LanguageAPI.Add("RS_NAME", "Redshifter"); LanguageAPI.Add("RS_PICKUP", "Expand space to your benefit"); LanguageAPI.Add("RS_DESC", "Gain 50% (+50% per stack) radius and range bonuses"); LanguageAPI.Add("BIOTICSHELL_NAME", "Biotic Shell"); LanguageAPI.Add("BIOTICSHELL_PICKUP", "Corrupts all Personal Shield Generators. Slows the degradation of temporary barriers."); LanguageAPI.Add("BIOTICSHELL_DESC", "Corrupts all Personal Shield Generators. Temporary barriers decay 12% (+12% per stack) slower."); LanguageAPI.Add("DM_NAME", "Doomed Moon"); LanguageAPI.Add("DM_PICKUP", "Revive each stage, but but lose items"); LanguageAPI.Add("DM_DESC", "Gain a revive (per stack) each stage. Breaks 10% of your items (5 items minimum) on revive (excluding Void items). After reviving, permanently gain +10% to all stats. Fails if fewer than 5 eligible items exist."); LanguageAPI.Add("DMC_NAME", "Doomed Moon (Consumed)"); LanguageAPI.Add("DMC_DESC", "Gain a revive (per stack) each stage. Breaks 10% of your items (5 items minimum) on revive (excluding Void items). After reviving, permanently gain +10% to all stats. Fails if fewer than 5 eligible items exist."); LanguageAPI.Add("RD_NAME", "Risky Dice"); LanguageAPI.Add("RD_PICKUP", "Roll fate at chests and Shrines of Chance for bonus rewards... or pay the price."); LanguageAPI.Add("RD_DESC", "Chests and Shrines of Chance roll once (per stack) per interaction.\nSuccess (19 in 20): Gain 1 Risk and the interactable drops +1 extra item per successful roll.\nMisfortune (1 in 20): You still pay the cost, the interaction is canceled, and your Risk resets.\nYou'll receive permanent debuffs to all stats equal to your total Risk (2% per Risk).\nIf you have 20 or more Risk upon rolling Misfortune, you will die."); LanguageAPI.Add("RDA_NAME", "Buyer's Remorse"); LanguageAPI.Add("RDA_DESC", "Permanent.\nReduce all stats by 2% (+2% per stack)."); ItemRelationshipType relationshipType = Addressables.LoadAssetAsync((object)"RoR2/DLC1/Common/ContagiousItem.asset").WaitForCompletion(); ItemDef val8 = Addressables.LoadAssetAsync((object)"RoR2/Base/PersonalShield/PersonalShield.asset").WaitForCompletion(); if (!Object.op_Implicit((Object)(object)val8) || !Object.op_Implicit((Object)(object)_bioticShell)) { RiskOfImpactMain.LogError("[RiskOfImpact] BioticShell void corruption failed: missing PersonalShield or BioticShell ItemDef."); } else { ItemRelationshipProvider val9 = ScriptableObject.CreateInstance(); val9.relationshipType = relationshipType; val9.relationships = (Pair[])(object)new Pair[1] { new Pair { itemDef1 = val8, itemDef2 = _bioticShell } }; RiskOfImpactContentPack.itemRelationshipProviders.Add((ItemRelationshipProvider[])(object)new ItemRelationshipProvider[1] { val9 }); } RiskOfImpactMain.LogDebug("[RiskOfImpactContent] Assets and language tokens registered."); } internal static IEnumerator EnsureQualityBaseItemsLoadedAsync() { if (!Object.op_Implicit((Object)(object)_myBundle)) { if (_assetBundleLoadRequest == null) { _assetBundleLoadRequest = AssetBundle.LoadFromFileAsync(RiskOfImpactMain.assetBundleDir); } while (!((AsyncOperation)_assetBundleLoadRequest).isDone) { yield return null; } _myBundle = _assetBundleLoadRequest.assetBundle; } if (Object.op_Implicit((Object)(object)_myBundle)) { if (!Object.op_Implicit((Object)(object)_mug)) { _mug = _myBundle.LoadAsset("Mug"); } if (!Object.op_Implicit((Object)(object)_comboStarItem)) { _comboStarItem = _myBundle.LoadAsset("ComboStar"); } if (!Object.op_Implicit((Object)(object)_redshifter)) { _redshifter = _myBundle.LoadAsset("Redshifter"); } if (!Object.op_Implicit((Object)(object)_bioticShell)) { _bioticShell = _myBundle.LoadAsset("BioticShell"); } } } public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { ContentPack.Copy(RiskOfImpactContentPack, args.output); args.ReportProgress(1f); yield break; } public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { object obj = <>c.<>9__38_0; if (obj == null) { StatHookEventHandler val = delegate(CharacterBody body, StatHookEventArgs statArgs) { if (Object.op_Implicit((Object)(object)body.inventory)) { float mugStatBonus = GetMugStatBonus(body.inventory); if (mugStatBonus > 0f) { statArgs.moveSpeedMultAdd += mugStatBonus; statArgs.attackSpeedMultAdd += mugStatBonus; } if (Object.op_Implicit((Object)(object)_caffeineRushBuff) && body.HasBuff(_caffeineRushBuff)) { statArgs.healthTotalMult *= 1.5f; statArgs.regenTotalMult *= 4f; statArgs.moveSpeedTotalMult *= 1.3f; statArgs.damageTotalMult *= 2f; statArgs.attackSpeedTotalMult *= 1.7f; statArgs.armorAdd += 20f; statArgs.allSkills.cooldownMultiplier *= 1f / 3f; } int comboStarItemCount = GetComboStarItemCount(body.inventory); if (comboStarItemCount > 0) { int buffCount = body.GetBuffCount(_comboStarBuff); if (buffCount > 0) { float num = (0.03f + (float)(comboStarItemCount - 1) * 0.005f) * (float)buffCount; statArgs.damageMultAdd += num; if (body.GetBuffCount(_comboStarMaxBuff) > 0) { statArgs.critAdd += 5f + (float)(comboStarItemCount - 1) * 2.5f; if (RiskOfImpactMain.IsItemQualitiesInstalled) { statArgs.critDamageMultAdd += GetQualityComboCritDamageBonus(body.inventory); } } } } } }; <>c.<>9__38_0 = val; obj = (object)val; } RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj; args.ReportProgress(1f); yield break; } private static float GetMugStatBonus(Inventory inventory) { if (!RiskOfImpactMain.IsItemQualitiesInstalled) { return 0.69f * (float)inventory.GetItemCountEffective(_mug); } return GetQualityMugStatBonus(inventory); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static float GetQualityMugStatBonus(Inventory inventory) { return ItemQualitiesCompat.GetMugStatBonus(inventory); } private static int GetComboStarItemCount(Inventory inventory) { if (!RiskOfImpactMain.IsItemQualitiesInstalled) { return inventory.GetItemCountEffective(_comboStarItem); } return GetQualityComboStarItemCount(inventory); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static int GetQualityComboStarItemCount(Inventory inventory) { return ItemQualitiesCompat.GetComboStarItemCount(inventory); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static float GetQualityComboCritDamageBonus(Inventory inventory) { return ItemQualitiesCompat.GetComboCritDamageBonus(inventory); } private void AddSelf(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)this); } internal RiskOfImpactContent() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(AddSelf); } public static EquipmentDef GetLanceEquipmentDef() { return _lanceEquipmentDef; } public static GameObject GetLanceProjectilePrefab() { return _lanceProjectilePrefab; } public static ItemDef GetComboStarItemDef() { return _comboStarItem; } public static BuffDef GetComboStarBuffDef() { return _comboStarBuff; } public static BuffDef GetComboStarMaxBuffDef() { return _comboStarMaxBuff; } public static ItemDef GetMugItemDef() { return _mug; } public static BuffDef GetCaffeineFeedbackBuffDef() { return _caffeineFeedbackBuff; } public static BuffDef GetCaffeineRushBuffDef() { return _caffeineRushBuff; } public static ItemDef GetRedshifterItemDef() { return _redshifter; } public static ItemDef GetDoomedMoonItemDef() { return _doomedMoon; } public static ItemDef GetDoomedMoonConsumedItemDef() { return _doomedMoonConsumed; } public static ItemDef GetDoomedMoonStatTokenItemDef() { return _doomedMoonStatToken; } public static BuffDef GetDoomedMoonBuffDef() { return _doomedMoonBuff; } public static ItemDef GetRiskyDiceItemDef() { return _riskyDice; } public static ItemDef GetRiskyDiceCountItemDef() { return _riskyDiceCount; } public static ItemDef GetRiskyDiceAfflictionItemDef() { return _riskyDiceAffliction; } public static BuffDef GetRiskyDiceBuffDef() { return _riskyDiceBuff; } public static ItemDef GetBioticShellItemDef() { return _bioticShell; } } [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.MrE42.RiskOfImpact", "Risk Of Impact", "0.5.0")] public class RiskOfImpactMain : BaseUnityPlugin { public const string GUID = "com.MrE42.RiskOfImpact"; public const string MODNAME = "Risk Of Impact"; public const string VERSION = "0.5.0"; public static PluginInfo pluginInfo { get; private set; } public static RiskOfImpactMain instance { get; private set; } internal static bool DebugMode { get; private set; } internal static AssetBundle assetBundle { get; private set; } internal static string assetBundleDir => Path.Combine(Path.GetDirectoryName(pluginInfo.Location), "RiskOfImpactAssets"); public static bool IsLookingGlassInstalled => Chainloader.PluginInfos.ContainsKey("droppod.lookingglass"); public static bool IsItemQualitiesInstalled => Chainloader.PluginInfos.ContainsKey("com.Gorakh.ItemQualities"); private void Awake() { instance = this; pluginInfo = ((BaseUnityPlugin)this).Info; DebugMode = ((BaseUnityPlugin)this).Config.Bind("General", "Enable Debug Logging", false, "Enables verbose RiskOfImpact diagnostic logs. Requires a restart.").Value; LogDebug("[RiskOfImpactMain] Awake: Initializing mod..."); new RiskOfImpactContent(); if (IsItemQualitiesInstalled) { InitializeItemQualitiesCompat(); } LogDebug("[RiskOfImpactMain] Content loaded. Initializing Equipment Hook..."); if (IsLookingGlassInstalled) { LookingGlassCompat.Init(); } LanceOfLonginusEquipmentHook.Init(); ComboStarHooks.Init(); RedshifterHooks.Init(); BioticShellHooks.Init(); DoomedMoonHooks.Init(); RiskyDiceHooks.Init(); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void InitializeItemQualitiesCompat() { ItemQualitiesCompat.Init(); } internal static void LogFatal(object data) { ((BaseUnityPlugin)instance).Logger.LogFatal(data); } internal static void LogError(object data) { ((BaseUnityPlugin)instance).Logger.LogError(data); } internal static void LogWarning(object data) { ((BaseUnityPlugin)instance).Logger.LogWarning(data); } internal static void LogMessage(object data) { if (DebugMode) { ((BaseUnityPlugin)instance).Logger.LogMessage(data); } } internal static void LogInfo(object data) { if (DebugMode) { ((BaseUnityPlugin)instance).Logger.LogInfo(data); } } internal static void LogDebug(object data) { if (DebugMode) { ((BaseUnityPlugin)instance).Logger.LogDebug(data); } } } public static class BioticShellHooks { private const float k = 0.12f; private const float MoltingRadius = 12f; [ThreadStatic] private static bool _isMoltingBlastActive; internal static bool IsMoltingBlastActive => _isMoltingBlastActive; public 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 HealthComponent.GetBarrierDecayRate += new hook_GetBarrierDecayRate(HealthComponent_GetBarrierDecayRate); HealthComponent.TakeDamageProcess += new hook_TakeDamageProcess(HealthComponent_TakeDamageProcess); HealthComponent.ServerFixedUpdate += new hook_ServerFixedUpdate(HealthComponent_ServerFixedUpdate); } private static float HealthComponent_GetBarrierDecayRate(orig_GetBarrierDecayRate orig, HealthComponent self) { float num = orig.Invoke(self); CharacterBody obj = self?.body; Inventory val = ((obj != null) ? obj.inventory : null); ItemDef bioticShellItemDef = RiskOfImpactContent.GetBioticShellItemDef(); if ((Object)(object)val != (Object)null && (Object)(object)bioticShellItemDef != (Object)null) { float num2 = (RiskOfImpactMain.IsItemQualitiesInstalled ? GetQualityContributionBonus(val) : (0.12f * (float)val.GetItemCountEffective(bioticShellItemDef))); if (num2 > 0f) { float num3 = 1f / (1f + num2); num *= num3; } } return num; } private static void HealthComponent_TakeDamageProcess(orig_TakeDamageProcess orig, HealthComponent self, DamageInfo damageInfo) { float barrierBefore = (Object.op_Implicit((Object)(object)self) ? self.barrier : 0f); orig.Invoke(self, damageInfo); TryTriggerMolting(self, barrierBefore); } private static void HealthComponent_ServerFixedUpdate(orig_ServerFixedUpdate orig, HealthComponent self, float deltaTime) { float barrierBefore = (Object.op_Implicit((Object)(object)self) ? self.barrier : 0f); orig.Invoke(self, deltaTime); TryTriggerMolting(self, barrierBefore); } private static void TryTriggerMolting(HealthComponent healthComponent, float barrierBefore) { //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_006f: 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_0084: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Expected O, but got Unknown if (!NetworkServer.active || !Object.op_Implicit((Object)(object)healthComponent) || barrierBefore <= 0f || healthComponent.barrier > 0f) { return; } CharacterBody body = healthComponent.body; if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.inventory) || !RiskOfImpactMain.IsItemQualitiesInstalled) { return; } float qualityMoltingDamageCoefficient = GetQualityMoltingDamageCoefficient(body.inventory); if (!(qualityMoltingDamageCoefficient <= 0f)) { BlastAttack val = new BlastAttack { attacker = ((Component)body).gameObject, attackerFiltering = (AttackerFiltering)2, baseDamage = body.damage * qualityMoltingDamageCoefficient, baseForce = 0f, canRejectForce = false, crit = body.RollCrit(), damageColorIndex = (DamageColorIndex)9, damageType = DamageTypeCombo.op_Implicit((DamageType)131072), falloffModel = (FalloffModel)0, position = body.corePosition, procCoefficient = 0f, radius = 12f, teamIndex = body.teamComponent.teamIndex }; bool isMoltingBlastActive = _isMoltingBlastActive; _isMoltingBlastActive = true; try { val.Fire(); } finally { _isMoltingBlastActive = isMoltingBlastActive; } GameObject igniteOnKillExplosionEffectPrefab = CommonAssets.igniteOnKillExplosionEffectPrefab; if (Object.op_Implicit((Object)(object)igniteOnKillExplosionEffectPrefab)) { EffectManager.SpawnEffect(igniteOnKillExplosionEffectPrefab, new EffectData { origin = body.corePosition, scale = 12f * RedshifterHooks.GetRadiusMultiplier(body) }, true); } } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static float GetQualityContributionBonus(Inventory inventory) { return ItemQualitiesCompat.GetBioticShellContributionBonus(inventory); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static float GetQualityMoltingDamageCoefficient(Inventory inventory) { return ItemQualitiesCompat.GetBioticShellMoltingDamageCoefficient(inventory); } } public static class ComboStarHooks { public const int BaseMaxStacks = 20; public const int ExtraStacksPerItem = 10; public const float SkillHitTimeout = 5f; public static bool VerboseLogs => RiskOfImpactMain.DebugMode; public static void Init() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown RiskOfImpactMain.LogInfo("[ComboStar] Init: registering hooks + net messages."); NetworkingAPI.RegisterMessageType(); CharacterBody.onBodyStartGlobal += OnBodyStart; GlobalEventManager.OnHitEnemy += new hook_OnHitEnemy(GlobalEventManager_OnHitEnemy); GenericSkill.OnExecute += new hook_OnExecute(GenericSkill_OnExecute); } private static bool SkillCountsForCombo(GenericSkill skill) { if (!Object.op_Implicit((Object)(object)skill) || (Object)(object)skill.skillDef == (Object)null) { RiskOfImpactMain.LogDebug("[ComboStar] SkillCountsForCombo: skill or skillDef is null -> false"); return false; } SkillDef skillDef = skill.skillDef; string skillNameToken = skillDef.skillNameToken; switch (skillNameToken) { case "RAILGUNNER_SECONDARY_NAME": RiskOfImpactMain.LogDebug("[ComboStar] SkillCountsForCombo: " + skillNameToken + " is blacklisted (setup skill) -> false"); return false; case "RAILGUNNER_SPECIAL_NAME": RiskOfImpactMain.LogDebug("[ComboStar] SkillCountsForCombo: " + skillNameToken + " is blacklisted (setup skill) -> false"); return false; default: if (skillNameToken.StartsWith("CHEESEWITHHOLES_BASICTANK_BODY_UTILITY")) { RiskOfImpactMain.LogDebug("[ComboStar] SkillCountsForCombo: " + skillNameToken + " is exempt (tank utility) -> false"); return false; } break; case null: break; } if (!skillDef.isCombatSkill) { RiskOfImpactMain.LogDebug("[ComboStar] SkillCountsForCombo: " + skillNameToken + " isCombatSkill=false -> false"); return false; } RiskOfImpactMain.LogDebug("[ComboStar] SkillCountsForCombo: " + skillNameToken + " isCombatSkill=true -> true"); return true; } private static void OnBodyStart(CharacterBody body) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && Object.op_Implicit((Object)(object)body) && !Object.op_Implicit((Object)(object)((Component)body).GetComponent())) { ((Component)body).gameObject.AddComponent(); if (VerboseLogs) { NetworkIdentity component = ((Component)body).GetComponent(); RiskOfImpactMain.LogInfo("[ComboStar] OnBodyStart: Added tracker on SERVER. body=" + body.GetDisplayName() + " netId=" + (Object.op_Implicit((Object)(object)component) ? ((object)component.netId/*cast due to .constrained prefix*/).ToString() : "noNetId")); } } } private static void GlobalEventManager_OnHitEnemy(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim) { //IL_007b: 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_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) orig.Invoke(self, damageInfo, victim); if (!NetworkServer.active || BioticShellHooks.IsMoltingBlastActive) { return; } if (!Object.op_Implicit((Object)(object)damageInfo.attacker)) { if (VerboseLogs) { RiskOfImpactMain.LogDebug("[ComboStar] OnHitEnemy(SERVER): attacker is null, ignoring."); } return; } if (damageInfo.rejected || damageInfo.damage <= 0f) { if (VerboseLogs) { RiskOfImpactMain.LogDebug($"[ComboStar] OnHitEnemy(SERVER): rejected or zero damage (rejected={damageInfo.rejected}, damage={damageInfo.damage}), ignoring."); } return; } if (DamageTypeCombo.op_Implicit(damageInfo.damageType & DamageTypeCombo.op_Implicit((DamageType)67108864)) != 0L) { if (VerboseLogs) { RiskOfImpactMain.LogDebug("[ComboStar] OnHitEnemy(SERVER): DoT damage type, ignoring."); } return; } CharacterBody component = damageInfo.attacker.GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { if (VerboseLogs) { RiskOfImpactMain.LogDebug("[ComboStar] OnHitEnemy(SERVER): attacker has no CharacterBody, ignoring."); } return; } ComboStarTracker component2 = ((Component)component).GetComponent(); if ((Object)(object)component2 != (Object)null) { if (VerboseLogs) { NetworkIdentity component3 = ((Component)component).GetComponent(); RiskOfImpactMain.LogDebug(string.Format("[ComboStar] OnHitEnemy(SERVER): RegisterHit body={0} netId={1} dmg={2:0.0}", component.GetDisplayName(), Object.op_Implicit((Object)(object)component3) ? ((object)component3.netId/*cast due to .constrained prefix*/).ToString() : "noNetId", damageInfo.damage)); } component2.RegisterHit(); } else if (VerboseLogs) { RiskOfImpactMain.LogDebug("[ComboStar] OnHitEnemy(SERVER): NO tracker found on " + component.GetDisplayName()); } } private static void GenericSkill_OnExecute(orig_OnExecute orig, GenericSkill self) { //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_0152: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (!Object.op_Implicit((Object)(object)self)) { return; } CharacterBody characterBody = self.characterBody; if (!Object.op_Implicit((Object)(object)characterBody) || !SkillCountsForCombo(self)) { return; } string text = (Object.op_Implicit((Object)(object)self.skillDef) ? self.skillDef.skillNameToken : ""); NetworkIdentity component = ((Component)characterBody).GetComponent(); string text2 = (Object.op_Implicit((Object)(object)component) ? ((object)component.netId/*cast due to .constrained prefix*/).ToString() : "noNetId"); if (NetworkServer.active) { ComboStarTracker component2 = ((Component)characterBody).GetComponent(); if ((Object)(object)component2 != (Object)null) { if (VerboseLogs) { RiskOfImpactMain.LogDebug("[ComboStar] GenericSkill_OnExecute(SERVER): body=" + characterBody.GetDisplayName() + " netId=" + text2 + " token=" + text); } component2.OnEligibleSkillExecutedToken(text); } else if (VerboseLogs) { RiskOfImpactMain.LogDebug("[ComboStar] GenericSkill_OnExecute(SERVER): NO tracker on body=" + characterBody.GetDisplayName() + " netId=" + text2); } } else if (NetworkClient.active && ((NetworkBehaviour)characterBody).hasAuthority && Object.op_Implicit((Object)(object)component)) { if (VerboseLogs) { RiskOfImpactMain.LogDebug("[ComboStar] GenericSkill_OnExecute(CLIENT->SERVER SEND): body=" + characterBody.GetDisplayName() + " netId=" + text2 + " token=" + text); } NetMessageExtensions.Send((INetMessage)(object)new ComboStarSkillExecuteMessage(component.netId, text), (NetworkDestination)2); } else if (VerboseLogs) { RiskOfImpactMain.LogDebug("[ComboStar] GenericSkill_OnExecute(CLIENT ignored): body=" + characterBody.GetDisplayName() + " netId=" + text2 + " " + $"NetworkClient.active={NetworkClient.active} hasAuthority={((NetworkBehaviour)characterBody).hasAuthority} hasNetId={(Object)(object)component != (Object)null} token={text}"); } } } public class ComboStarSkillExecuteMessage : INetMessage, ISerializableObject { private NetworkInstanceId bodyNetId; private string skillToken; public ComboStarSkillExecuteMessage() { } public ComboStarSkillExecuteMessage(NetworkInstanceId bodyNetId, string skillToken) { //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) this.bodyNetId = bodyNetId; this.skillToken = skillToken; } public void Serialize(NetworkWriter writer) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) writer.Write(bodyNetId); writer.Write(skillToken ?? ""); } public void Deserialize(NetworkReader reader) { //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) bodyNetId = reader.ReadNetworkId(); skillToken = reader.ReadString(); } public void OnReceived() { //IL_0009: 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_004c: 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_00a4: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } GameObject val = Util.FindNetworkObject(bodyNetId); if (!Object.op_Implicit((Object)(object)val)) { RiskOfImpactMain.LogDebug($"[ComboStarNet] OnReceived(SERVER): Could not find body object for netId={bodyNetId}"); return; } CharacterBody component = val.GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { RiskOfImpactMain.LogDebug($"[ComboStarNet] OnReceived(SERVER): netId={bodyNetId} has no CharacterBody"); return; } ComboStarTracker component2 = ((Component)component).GetComponent(); if (!Object.op_Implicit((Object)(object)component2)) { RiskOfImpactMain.LogDebug($"[ComboStarNet] OnReceived(SERVER): netId={bodyNetId} body={component.GetDisplayName()} has NO tracker"); return; } if (ComboStarHooks.VerboseLogs) { RiskOfImpactMain.LogDebug($"[ComboStarNet] OnReceived(SERVER): Apply skill execute. body={component.GetDisplayName()} netId={bodyNetId} token={skillToken}"); } component2.OnEligibleSkillExecutedToken(skillToken); } } public class ComboStarTracker : MonoBehaviour { private struct Bucket { public float expiresAt; public bool hadHit; } private CharacterBody body; private readonly Queue buckets = new Queue(); private float currentBucketStartTime = -999f; private bool stackGrantedThisSkill; private const float BucketSeconds = 0.2f; private float lastEligibleExecuteTime = -1f; private float ewmaExecuteInterval = 0.15f; private const float ExecuteIntervalAlpha = 0.2f; private const float ActiveMinTimeout = 0.35f; private const float ActiveMaxTimeout = 2f; private const float ActiveBaseTimeout = 0.1f; private const float ActiveIntervalMultiplier = 4f; private const float DelayedSkillHitTimeout = 10f; private bool delayedPending; private float delayedPendingExpiresAt; private string delayedPendingToken; private static readonly HashSet DelayedSkillTokens = new HashSet { "ENGI_PRIMARY_NAME", "CHEESEWITHHOLES_BASICTANK_BODY_SECONDARY_OBLITERATOR_CANNON_NAME" }; private static bool SkillIsDelayedHitToken(string token) { if (!string.IsNullOrEmpty(token)) { return DelayedSkillTokens.Contains(token); } return false; } private void Awake() { body = ((Component)this).GetComponent(); } private void OnEnable() { ResetCombo("OnEnable"); } private void OnDisable() { ResetCombo("OnDisable"); } private float ComputeBucketTimeoutSeconds(bool comboActive) { if (!comboActive) { return 5f; } return Mathf.Clamp(0.1f + 4f * ewmaExecuteInterval, 0.35f, Mathf.Min(2f, 5f)); } public void OnEligibleSkillExecutedToken(string token) { if (!NetworkServer.active || !Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.inventory) || GetComboStarItemCount(body.inventory) <= 0) { return; } BuffDef comboStarBuffDef = RiskOfImpactContent.GetComboStarBuffDef(); int buffCount = body.GetBuffCount(comboStarBuffDef); float time = Time.time; if (lastEligibleExecuteTime > 0f) { float num = time - lastEligibleExecuteTime; if (num > 0f && num < 1f) { ewmaExecuteInterval = Mathf.Lerp(ewmaExecuteInterval, num, 0.2f); } } lastEligibleExecuteTime = time; if (SkillIsDelayedHitToken(token)) { if (buffCount > 0) { delayedPending = true; delayedPendingExpiresAt = time + 10f; delayedPendingToken = token; if (ComboStarHooks.VerboseLogs) { RiskOfImpactMain.LogDebug($"[ComboStarTracker] Delayed pending started. body={body.GetDisplayName()}, token={token}, expiresAt={delayedPendingExpiresAt:0.00}"); } } stackGrantedThisSkill = false; return; } if (buckets.Count == 0 || time - currentBucketStartTime > 0.2f) { currentBucketStartTime = time; bool comboActive = buffCount > 0; float num2 = ComputeBucketTimeoutSeconds(comboActive); buckets.Enqueue(new Bucket { hadHit = false, expiresAt = time + num2 }); if (ComboStarHooks.VerboseLogs) { RiskOfImpactMain.LogDebug($"[ComboStarTracker] New bucket. body={body.GetDisplayName()}, token={token}, stacks={buffCount}, buckets={buckets.Count}, expiresAt={time + num2:0.00}"); } } else if (ComboStarHooks.VerboseLogs) { RiskOfImpactMain.LogDebug($"[ComboStarTracker] Reuse bucket. body={body.GetDisplayName()}, token={token}, stacks={buffCount}, buckets={buckets.Count}"); } stackGrantedThisSkill = false; } public void RegisterHit() { if (!NetworkServer.active || !Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.inventory)) { return; } int comboStarItemCount = GetComboStarItemCount(body.inventory); if (comboStarItemCount <= 0) { return; } if (delayedPending) { delayedPending = false; if (ComboStarHooks.VerboseLogs) { RiskOfImpactMain.LogDebug("[ComboStarTracker] Delayed window satisfied by hit. body=" + body.GetDisplayName() + ", token=" + delayedPendingToken); } } if (buckets.Count > 0) { int count = buckets.Count; Bucket item = default(Bucket); for (int i = 0; i < count; i++) { Bucket bucket = buckets.Dequeue(); if (i == count - 1) { item = bucket; } else { buckets.Enqueue(bucket); } } item.hadHit = true; buckets.Enqueue(item); } else if (ComboStarHooks.VerboseLogs) { RiskOfImpactMain.LogDebug("[ComboStarTracker] RegisterHit: NO buckets (hit happened without execute tracking). body=" + body.GetDisplayName()); } BuffDef comboStarBuffDef = RiskOfImpactContent.GetComboStarBuffDef(); int buffCount = body.GetBuffCount(comboStarBuffDef); if (stackGrantedThisSkill) { if (ComboStarHooks.VerboseLogs) { RiskOfImpactMain.LogDebug($"[ComboStarTracker] RegisterHit: stack already granted this skill. body={body.GetDisplayName()} stacks={buffCount}"); } return; } int num = 20 + 10 * (comboStarItemCount - 1); BuffDef comboStarMaxBuffDef = RiskOfImpactContent.GetComboStarMaxBuffDef(); if (buffCount >= num) { return; } body.AddBuff(comboStarBuffDef); buffCount++; stackGrantedThisSkill = true; if (ComboStarHooks.VerboseLogs) { RiskOfImpactMain.LogDebug($"[ComboStarTracker] +STACK. body={body.GetDisplayName()} stacksNow={buffCount}/{num}"); } if (buffCount == num) { body.AddBuff(comboStarMaxBuffDef); if (ComboStarHooks.VerboseLogs) { RiskOfImpactMain.LogDebug("[ComboStarTracker] MAX reached. body=" + body.GetDisplayName() + " added max buff."); } } } private void FixedUpdate() { if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.inventory)) { return; } int comboStarItemCount = GetComboStarItemCount(body.inventory); BuffDef comboStarBuffDef = RiskOfImpactContent.GetComboStarBuffDef(); int buffCount = body.GetBuffCount(comboStarBuffDef); int num = 20 + 10 * (comboStarItemCount - 1); if (comboStarItemCount <= 0) { if (buffCount > 0) { ResetCombo("Lost all items"); } return; } if (delayedPending && buffCount > 0 && Time.time >= delayedPendingExpiresAt) { RiskOfImpactMain.LogInfo("[ComboStarTracker] Delayed expired -> reset. body=" + body.GetDisplayName() + ", token=" + delayedPendingToken); ResetCombo("Delayed skill hit window expired", retainQualityStacks: true); return; } while (buckets.Count > 0 && Time.time >= buckets.Peek().expiresAt) { Bucket bucket = buckets.Dequeue(); if (buffCount > 0 && !bucket.hadHit) { RiskOfImpactMain.LogInfo("[ComboStarTracker] Bucket expired without hit -> reset. body=" + body.GetDisplayName()); ResetCombo("Bucket expired without hit", retainQualityStacks: true); return; } } BuffDef comboStarMaxBuffDef = RiskOfImpactContent.GetComboStarMaxBuffDef(); int buffCount2 = body.GetBuffCount(comboStarMaxBuffDef); if (buffCount < num && buffCount2 > 0) { body.RemoveBuff(comboStarMaxBuffDef); if (ComboStarHooks.VerboseLogs) { RiskOfImpactMain.LogDebug($"[ComboStarTracker] Removed max buff because stacks dropped. body={body.GetDisplayName()} stacks={buffCount}/{num}"); } } } private void ResetCombo(string reason, bool retainQualityStacks = false) { if (!Object.op_Implicit((Object)(object)body)) { return; } BuffDef comboStarBuffDef = RiskOfImpactContent.GetComboStarBuffDef(); int buffCount = body.GetBuffCount(comboStarBuffDef); if (buffCount > 0) { float num = Mathf.Min((retainQualityStacks && RiskOfImpactMain.IsItemQualitiesInstalled) ? GetQualityComboRetention(body.inventory) : 0f, 1f); int num2 = Mathf.FloorToInt((float)buffCount * num); int num3 = buffCount - num2; RiskOfImpactMain.LogInfo($"[ComboStarTracker] ResetCombo: reason={reason}, body={body.GetDisplayName()}, removing {num3} stacks and retaining {num2}."); for (int i = 0; i < num3; i++) { body.RemoveBuff(comboStarBuffDef); } BuffDef comboStarMaxBuffDef = RiskOfImpactContent.GetComboStarMaxBuffDef(); int buffCount2 = body.GetBuffCount(comboStarMaxBuffDef); if (num3 > 0 && buffCount2 > 0) { body.RemoveBuff(comboStarMaxBuffDef); } } else if (ComboStarHooks.VerboseLogs) { RiskOfImpactMain.LogDebug("[ComboStarTracker] ResetCombo: reason=" + reason + ", body=" + body.GetDisplayName() + ", no stacks to remove."); } buckets.Clear(); currentBucketStartTime = -999f; delayedPending = false; delayedPendingExpiresAt = 0f; delayedPendingToken = null; stackGrantedThisSkill = false; } private static int GetComboStarItemCount(Inventory inventory) { if (!RiskOfImpactMain.IsItemQualitiesInstalled) { return inventory.GetItemCountEffective(RiskOfImpactContent.GetComboStarItemDef()); } return GetQualityComboStarItemCount(inventory); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static float GetQualityComboRetention(Inventory inventory) { return ItemQualitiesCompat.GetComboRetention(inventory); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static int GetQualityComboStarItemCount(Inventory inventory) { return ItemQualitiesCompat.GetComboStarItemCount(inventory); } } public static class DoomedMoonHooks { private const int ItemsToBreak = 5; private const float PctToBreak = 0.1f; private const float PctPerToken = 0.1f; private const float CritPerToken = 10f; private const float ArmorPerToken = 10f; private const float RegenBase = 0.1f; private const float RegenAddPerExtra = 0.02f; private static ItemIndex _doomedMoonIndex = (ItemIndex)(-1); private static ItemDef _doomedMoonDef; private static ItemDef _doomedMoonConsumedDef; private static ItemIndex _doomedMoonConsumedIndex = (ItemIndex)(-1); private static ItemDef _doomedMoonStatTokenDef; private static ItemIndex _doomedMoonStatTokenIndex = (ItemIndex)(-1); private static BuffDef _doomedMoonBuffDef; private static BuffIndex _doomedMoonBuffIndex = (BuffIndex)(-1); private static bool _initialized; private static bool _resolvedOnceLogged; internal static void Init() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown if (!_initialized) { _initialized = true; Stage.onServerStageBegin += OnServerStageBegin; CharacterMaster.TryReviveOnBodyDeath += new hook_TryReviveOnBodyDeath(CharacterMaster_TryReviveOnBodyDeath); RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(ApplyStatBonuses); RiskOfImpactMain.LogInfo("[DoomedMoon] Hooks initialized."); } } private static bool EnsureResolved() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Invalid comparison between Unknown and I4 //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Invalid comparison between Unknown and I4 //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Invalid comparison between Unknown and I4 //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Invalid comparison between Unknown and I4 if ((int)_doomedMoonIndex != -1 && (int)_doomedMoonConsumedIndex != -1 && (int)_doomedMoonStatTokenIndex != -1 && (int)_doomedMoonBuffIndex != -1 && Object.op_Implicit((Object)(object)_doomedMoonDef) && Object.op_Implicit((Object)(object)_doomedMoonConsumedDef) && Object.op_Implicit((Object)(object)_doomedMoonStatTokenDef) && Object.op_Implicit((Object)(object)_doomedMoonBuffDef)) { return true; } try { _doomedMoonDef = RiskOfImpactContent.GetDoomedMoonItemDef(); _doomedMoonConsumedDef = RiskOfImpactContent.GetDoomedMoonConsumedItemDef(); _doomedMoonStatTokenDef = RiskOfImpactContent.GetDoomedMoonStatTokenItemDef(); _doomedMoonBuffDef = RiskOfImpactContent.GetDoomedMoonBuffDef(); } catch (Exception arg) { if (!_resolvedOnceLogged) { _resolvedOnceLogged = true; RiskOfImpactMain.LogWarning($"[DoomedMoon] EnsureResolved failed to fetch defs from content provider: {arg}"); } return false; } if (!Object.op_Implicit((Object)(object)_doomedMoonDef) || !Object.op_Implicit((Object)(object)_doomedMoonConsumedDef) || !Object.op_Implicit((Object)(object)_doomedMoonStatTokenDef) || !Object.op_Implicit((Object)(object)_doomedMoonBuffDef)) { return false; } _doomedMoonIndex = _doomedMoonDef.itemIndex; _doomedMoonConsumedIndex = _doomedMoonConsumedDef.itemIndex; _doomedMoonStatTokenIndex = _doomedMoonStatTokenDef.itemIndex; _doomedMoonBuffIndex = _doomedMoonBuffDef.buffIndex; if ((Object)(object)_doomedMoonConsumedDef.requiredExpansion == (Object)null) { _doomedMoonConsumedDef.requiredExpansion = _doomedMoonDef.requiredExpansion; } if ((Object)(object)_doomedMoonStatTokenDef.requiredExpansion == (Object)null) { _doomedMoonStatTokenDef.requiredExpansion = _doomedMoonDef.requiredExpansion; } if ((int)_doomedMoonIndex != -1 && (int)_doomedMoonConsumedIndex != -1 && (int)_doomedMoonStatTokenIndex != -1) { return (int)_doomedMoonBuffIndex != -1; } return false; } private static void OnServerStageBegin(Stage stage) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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) if (!NetworkServer.active || !EnsureResolved()) { return; } TryTransformResult val3 = default(TryTransformResult); foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { Inventory val = ((readOnlyInstances != null) ? readOnlyInstances.inventory : null); if (Object.op_Implicit((Object)(object)val)) { int itemCountPermanent = val.GetItemCountPermanent(_doomedMoonConsumedIndex); if (itemCountPermanent > 0) { ItemTransformation val2 = default(ItemTransformation); ((ItemTransformation)(ref val2)).originalItemIndex = _doomedMoonConsumedIndex; ((ItemTransformation)(ref val2)).newItemIndex = _doomedMoonIndex; ((ItemTransformation)(ref val2)).minToTransform = itemCountPermanent; ((ItemTransformation)(ref val2)).maxToTransform = itemCountPermanent; val2.transformationType = (ItemTransformationTypeIndex)7; ((ItemTransformation)(ref val2)).TryTransform(val, ref val3); } } } } private static bool CharacterMaster_TryReviveOnBodyDeath(orig_TryReviveOnBodyDeath orig, CharacterMaster self, CharacterBody body) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00bf: 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_00ef: 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_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_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: 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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) if (orig.Invoke(self, body)) { return true; } if (!NetworkServer.active) { return false; } if (!Object.op_Implicit((Object)(object)self) || !Object.op_Implicit((Object)(object)body)) { return false; } if (!EnsureResolved()) { return false; } if (self.IsExtraLifePendingServer()) { return true; } Inventory inventory = self.inventory; if (!Object.op_Implicit((Object)(object)inventory)) { return false; } if (inventory.GetItemCountPermanent(_doomedMoonIndex) <= 0) { return false; } if (!BreakRandomItems(inventory, 5, 0.1f)) { return false; } ItemTransformation val = default(ItemTransformation); ((ItemTransformation)(ref val)).originalItemIndex = _doomedMoonIndex; ((ItemTransformation)(ref val)).newItemIndex = _doomedMoonConsumedIndex; ((ItemTransformation)(ref val)).minToTransform = 1; ((ItemTransformation)(ref val)).maxToTransform = 1; val.transformationType = (ItemTransformationTypeIndex)0; TakeResult pendingTransformation = default(TakeResult); if (!((ItemTransformation)(ref val)).TryTake(inventory, ref pendingTransformation)) { return false; } inventory.GiveItemPermanent(_doomedMoonStatTokenIndex, 1); ExtraLifeServerBehavior obj = ((Component)self).gameObject.AddComponent(); obj.pendingTransformation = pendingTransformation; obj.consumedItemIndex = _doomedMoonConsumedIndex; obj.completionTime = FixedTimeStamp.now + 2f; obj.completionCallback = delegate { RespawnDoomedMoon(self); }; obj.soundTime = obj.completionTime - 1f; obj.soundCallback = delegate { PlayDoomedMoonSfx(self); }; return true; } private static void RespawnDoomedMoon(CharacterMaster master) { //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_0069: 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_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_0106: 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_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_0128: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0059: 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)master)) { return; } Vector3 val = master.deathFootPosition; if (master.killedByUnsafeArea) { CharacterBody val2 = (Object.op_Implicit((Object)(object)master.bodyPrefab) ? master.bodyPrefab.GetComponent() : null); if (Object.op_Implicit((Object)(object)val2)) { val = (Vector3)(((??)TeleportHelper.FindSafeTeleportDestination(master.deathFootPosition, val2, RoR2Application.rng)) ?? master.deathFootPosition); } } master.Respawn(val, Quaternion.Euler(0f, Random.Range(0f, 360f), 0f), true); CharacterBody body = master.GetBody(); if (Object.op_Implicit((Object)(object)body)) { body.AddTimedBuff(Buffs.Immune, 3f); EntityStateMachine[] components = ((Component)body).GetComponents(); foreach (EntityStateMachine obj in components) { obj.initialStateType = obj.mainStateType; } SyncDoomedMoonBuff(body); } GameObject val3 = LegacyResourcesAPI.Load("Prefabs/Effects/HippoRezEffect"); if (Object.op_Implicit((Object)(object)val3) && Object.op_Implicit((Object)(object)master.bodyInstanceObject)) { EffectManager.SpawnEffect(val3, new EffectData { origin = val, rotation = master.bodyInstanceObject.transform.rotation }, true); } } private static void PlayDoomedMoonSfx(CharacterMaster master) { if (Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)master.bodyInstanceObject)) { Util.PlaySound("Play_item_proc_extraLife", master.bodyInstanceObject); } } private static void ApplyStatBonuses(CharacterBody body, StatHookEventArgs args) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.inventory) && EnsureResolved()) { if (NetworkServer.active) { SyncDoomedMoonBuff(body); } int itemCountPermanent = body.inventory.GetItemCountPermanent(_doomedMoonStatTokenIndex); if (itemCountPermanent > 0) { float num = 0.1f * (float)itemCountPermanent; float num2 = 1f + num; args.healthTotalMult *= num2; args.damageTotalMult *= num2; args.moveSpeedTotalMult *= num2; args.attackSpeedTotalMult *= num2; args.critAdd += 10f * (float)itemCountPermanent; args.armorAdd += 10f * (float)itemCountPermanent; args.baseRegenAdd += 0.1f + 0.02f * (float)Mathf.Max(0, itemCountPermanent - 1); } } } private unsafe static bool BreakRandomItems(Inventory inv, int toBreak, float pctBreak) { //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_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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_00a1: Unknown result type (might be due to invalid IL or missing references) List list = new List(256); AllItemsEnumerator enumerator = ItemCatalog.allItems.GetEnumerator(); try { while (((AllItemsEnumerator)(ref enumerator)).MoveNext()) { ItemIndex current = ((AllItemsEnumerator)(ref enumerator)).Current; if (IsBreakable(inv, current)) { int itemCountPermanent = inv.GetItemCountPermanent(current); for (int i = 0; i < itemCountPermanent; i++) { list.Add(current); } } } } finally { ((IDisposable)(*(AllItemsEnumerator*)(&enumerator))/*cast due to .constrained prefix*/).Dispose(); } if (list.Count < toBreak) { return false; } int num = Mathf.Max(toBreak, Mathf.CeilToInt(pctBreak * (float)list.Count)); for (int j = 0; j < num; j++) { int index = Random.Range(0, list.Count); ItemIndex val = list[index]; inv.RemoveItemPermanent(val, 1); list.RemoveAt(index); } return true; } private static bool IsBreakable(Inventory inv, ItemIndex idx) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //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_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_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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Invalid comparison between Unknown and I4 //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Invalid comparison between Unknown and I4 //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Invalid comparison between Unknown and I4 //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Invalid comparison between Unknown and I4 //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Invalid comparison between Unknown and I4 //IL_007c: Unknown result type (might be due to invalid IL or missing references) if ((int)idx == -1) { return false; } if (!Object.op_Implicit((Object)(object)inv)) { return false; } if (idx == _doomedMoonIndex) { return false; } if (idx == _doomedMoonConsumedIndex) { return false; } if (idx == _doomedMoonStatTokenIndex) { return false; } ItemDef itemDef = ItemCatalog.GetItemDef(idx); if (!Object.op_Implicit((Object)(object)itemDef)) { return false; } if ((int)itemDef.tier == 6 || (int)itemDef.tier == 7 || (int)itemDef.tier == 8 || (int)itemDef.tier == 9) { return false; } if ((int)itemDef.tier == 5) { return false; } if (!itemDef.canRemove) { return false; } return inv.GetItemCountPermanent(idx) > 0; } private static void SyncDoomedMoonBuff(CharacterBody body) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between Unknown and I4 //IL_002d: 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) if (NetworkServer.active && Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.inventory) && (int)_doomedMoonBuffIndex != -1) { int itemCountPermanent = body.inventory.GetItemCountPermanent(_doomedMoonStatTokenIndex); itemCountPermanent = Mathf.Clamp(itemCountPermanent, 0, 255); body.SetBuffCount(_doomedMoonBuffIndex, itemCountPermanent); } } } internal static class ItemQualitiesCompat { private sealed class QualityGameplayTracker : MonoBehaviour { private CharacterBody _body; private int _caffeinePerHit; private float _caffeineRemainder; private float _redHorizonDamagePerMeter; private float _redHorizonMaximumDamage; private void Awake() { _body = ((Component)this).GetComponent(); } internal void RegisterHit(float procCoefficient) { //IL_00cb: 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) if (!Object.op_Implicit((Object)(object)_body) || !Object.op_Implicit((Object)(object)_body.inventory) || _caffeinePerHit <= 0) { return; } BuffDef caffeineFeedbackBuffDef = RiskOfImpactContent.GetCaffeineFeedbackBuffDef(); BuffDef caffeineRushBuffDef = RiskOfImpactContent.GetCaffeineRushBuffDef(); if (!Object.op_Implicit((Object)(object)caffeineFeedbackBuffDef) || !Object.op_Implicit((Object)(object)caffeineRushBuffDef) || _body.HasBuff(caffeineRushBuffDef)) { return; } float num = (float)_caffeinePerHit * procCoefficient + _caffeineRemainder; int num2 = Mathf.FloorToInt(num); _caffeineRemainder = num - (float)num2; if (num2 > 0) { int num3 = _body.GetBuffCount(caffeineFeedbackBuffDef) + num2; if (num3 >= 400) { _caffeineRemainder = 0f; _body.SetBuffCount(caffeineFeedbackBuffDef.buffIndex, 0); _body.AddTimedBuff(caffeineRushBuffDef, 30f); } else { _body.SetBuffCount(caffeineFeedbackBuffDef.buffIndex, num3); } } } internal void RefreshInventory() { if (Object.op_Implicit((Object)(object)_body) && Object.op_Implicit((Object)(object)_body.inventory)) { _caffeinePerHit = GetMugCaffeinePerHit(_body.inventory); CalculateRedHorizonScaling(_body.inventory, out _redHorizonDamagePerMeter, out _redHorizonMaximumDamage); if (_caffeinePerHit <= 0) { ResetCaffeineState(clearRush: true); } } } internal void ResetCaffeineState(bool clearRush) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_body)) { return; } _caffeineRemainder = 0f; BuffDef caffeineFeedbackBuffDef = RiskOfImpactContent.GetCaffeineFeedbackBuffDef(); if (Object.op_Implicit((Object)(object)caffeineFeedbackBuffDef) && _body.GetBuffCount(caffeineFeedbackBuffDef) > 0) { _body.SetBuffCount(caffeineFeedbackBuffDef.buffIndex, 0); } if (clearRush) { BuffDef caffeineRushBuffDef = RiskOfImpactContent.GetCaffeineRushBuffDef(); if (Object.op_Implicit((Object)(object)caffeineRushBuffDef) && _body.HasBuff(caffeineRushBuffDef)) { _body.ClearTimedBuffs(caffeineRushBuffDef); } } } internal void GetRedHorizonScaling(out float damageBonusPerMeter, out float maximumDamageBonus) { damageBonusPerMeter = _redHorizonDamagePerMeter; maximumDamageBonus = _redHorizonMaximumDamage; } } private const int CaffeineThreshold = 400; private const float CaffeineRushDuration = 30f; private static ItemQualityGroup _mugGroup; private static ItemQualityGroup _comboStarGroup; private static ItemQualityGroup _redshifterGroup; private static ItemQualityGroup _bioticShellGroup; internal static void Init() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown RegisterContentCallbackSafe(); CharacterBody.onBodyStartGlobal += OnBodyStart; CharacterBody.onBodyInventoryChangedGlobal += OnBodyInventoryChanged; Stage.onServerStageBegin += OnServerStageBegin; GlobalEventManager.OnHitEnemy += new hook_OnHitEnemy(GlobalEventManager_OnHitEnemy); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void RegisterContentCallbackSafe() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown try { QualityContentManager.LoadContentAsync += new LoadContentAsyncDelegate(LoadContentAsync); RiskOfImpactMain.LogDebug("[ItemQualitiesCompat] Registered Quality content callback."); } catch (Exception arg) { RiskOfImpactMain.LogError($"[ItemQualitiesCompat] Failed to initialize Quality compatibility: {arg}"); } } internal static float GetMugStatBonus(Inventory inventory) { if (!TryGetCounts(inventory, _mugGroup, out var counts)) { return 0.69f * (float)inventory.GetItemCountEffective(RiskOfImpactContent.GetMugItemDef()); } return 0.69f * (float)((ItemQualityCounts)(ref counts)).TotalCount; } internal static int GetMugCaffeinePerHit(Inventory inventory) { //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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (!TryGetCounts(inventory, _mugGroup, out var counts)) { return 0; } return counts.UncommonCount + 2 * counts.RareCount + 4 * counts.EpicCount + 8 * counts.LegendaryCount; } internal static int GetComboStarItemCount(Inventory inventory) { if (!TryGetCounts(inventory, _comboStarGroup, out var counts)) { return inventory.GetItemCountEffective(RiskOfImpactContent.GetComboStarItemDef()); } return ((ItemQualityCounts)(ref counts)).TotalCount; } internal static float GetComboRetention(Inventory inventory) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) if (!TryGetCounts(inventory, _comboStarGroup, out var counts)) { return 0f; } return 0.15f * (float)counts.UncommonCount + 0.3f * (float)counts.RareCount + 0.6f * (float)counts.EpicCount + 1f * (float)counts.LegendaryCount; } internal static float GetComboCritDamageBonus(Inventory inventory) { return Mathf.Max(0f, GetComboRetention(inventory) - 1f) * 0.5f; } internal static float GetRedshifterRadiusBonus(Inventory inventory) { if (!TryGetCounts(inventory, _redshifterGroup, out var counts)) { return 0.5f * (float)inventory.GetItemCountEffective(RiskOfImpactContent.GetRedshifterItemDef()); } return 0.5f * (float)((ItemQualityCounts)(ref counts)).TotalCount; } internal static void GetRedHorizonScaling(CharacterBody body, out float damageBonusPerMeter, out float maximumDamageBonus) { damageBonusPerMeter = 0f; maximumDamageBonus = 0f; (Object.op_Implicit((Object)(object)body) ? ((Component)body).GetComponent() : null)?.GetRedHorizonScaling(out damageBonusPerMeter, out maximumDamageBonus); } private static void CalculateRedHorizonScaling(Inventory inventory, out float damageBonusPerMeter, out float maximumDamageBonus) { //IL_0024: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) damageBonusPerMeter = 0f; maximumDamageBonus = 0f; if (TryGetCounts(inventory, _redshifterGroup, out var counts)) { damageBonusPerMeter = 0.0025f * (float)counts.UncommonCount + 0.005f * (float)counts.RareCount + 0.01f * (float)counts.EpicCount + 0.02f * (float)counts.LegendaryCount; maximumDamageBonus = 0.25f * (float)counts.UncommonCount + 0.5f * (float)counts.RareCount + 1f * (float)counts.EpicCount + 2f * (float)counts.LegendaryCount; } } internal static float GetBioticShellContributionBonus(Inventory inventory) { if (!TryGetCounts(inventory, _bioticShellGroup, out var counts)) { return 0.12f * (float)inventory.GetItemCountEffective(RiskOfImpactContent.GetBioticShellItemDef()); } return 0.12f * (float)((ItemQualityCounts)(ref counts)).TotalCount; } internal static float GetBioticShellMoltingDamageCoefficient(Inventory inventory) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) if (!TryGetCounts(inventory, _bioticShellGroup, out var counts)) { return 0f; } return 1f * (float)counts.UncommonCount + 2.5f * (float)counts.RareCount + 5f * (float)counts.EpicCount + 10f * (float)counts.LegendaryCount; } private static void OnBodyStart(CharacterBody body) { if (NetworkServer.active && Object.op_Implicit((Object)(object)body) && !Object.op_Implicit((Object)(object)((Component)body).GetComponent())) { ((Component)body).gameObject.AddComponent().RefreshInventory(); } } private static void OnBodyInventoryChanged(CharacterBody body) { if (NetworkServer.active && Object.op_Implicit((Object)(object)body)) { ((Component)body).GetComponent()?.RefreshInventory(); } } private static void OnServerStageBegin(Stage stage) { if (!NetworkServer.active) { return; } foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList) { (Object.op_Implicit((Object)(object)readOnlyInstances) ? ((Component)readOnlyInstances).GetComponent() : null)?.ResetCaffeineState(clearRush: true); } } private static void GlobalEventManager_OnHitEnemy(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim) { //IL_0040: 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_004f: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, damageInfo, victim); if (NetworkServer.active && Object.op_Implicit((Object)(object)damageInfo.attacker) && !damageInfo.rejected && !(damageInfo.damage <= 0f) && !(damageInfo.procCoefficient <= 0f) && DamageTypeCombo.op_Implicit(damageInfo.damageType & DamageTypeCombo.op_Implicit((DamageType)67108864)) == 0L) { CharacterBody component = damageInfo.attacker.GetComponent(); (Object.op_Implicit((Object)(object)component) ? ((Component)component).GetComponent() : null)?.RegisterHit(damageInfo.procCoefficient); } } private static IEnumerator LoadContentAsync(QualityContentLoadArgs args) { IEnumerator baseItemsLoad = RiskOfImpactContent.EnsureQualityBaseItemsLoadedAsync(); while (baseItemsLoad.MoveNext()) { yield return baseItemsLoad.Current; } ItemDef mugItemDef = RiskOfImpactContent.GetMugItemDef(); ItemDef comboStarItemDef = RiskOfImpactContent.GetComboStarItemDef(); ItemDef redshifterItemDef = RiskOfImpactContent.GetRedshifterItemDef(); ItemDef bioticShellItemDef = RiskOfImpactContent.GetBioticShellItemDef(); if (!Object.op_Implicit((Object)(object)mugItemDef) || !Object.op_Implicit((Object)(object)comboStarItemDef) || !Object.op_Implicit((Object)(object)redshifterItemDef) || !Object.op_Implicit((Object)(object)bioticShellItemDef)) { RiskOfImpactMain.LogError("[ItemQualitiesCompat] Failed to load one or more base ItemDefs; Quality compatibility is disabled."); yield break; } _mugGroup = args.CreateItemQualityGroup(mugItemDef); _comboStarGroup = args.CreateItemQualityGroup(comboStarItemDef); _redshifterGroup = args.CreateItemQualityGroup(redshifterItemDef); _bioticShellGroup = args.CreateItemQualityGroup(bioticShellItemDef); RegisterLanguage(); RiskOfImpactMain.LogDebug("[ItemQualitiesCompat] Registered four item quality groups."); } private static bool TryGetCounts(Inventory inventory, ItemQualityGroup group, out ItemQualityCounts counts) { //IL_0001: 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) counts = default(ItemQualityCounts); if (!Object.op_Implicit((Object)(object)inventory) || !Object.op_Implicit((Object)(object)group) || !((ResourceAvailability)(ref QualityCatalog.Availability)).available) { return false; } counts = InventoryExtensions.GetItemCountsEffective(inventory, group); return true; } private static void RegisterLanguage() { RegisterMugLanguage(); RegisterComboStarLanguage(); RegisterRedshifterLanguage(); RegisterBioticShellLanguage(); } private static void RegisterMugLanguage() { RegisterQualityText("MUG", "{0}\n Hits brew caffeine. At 400, enter Caffeine Rush.", "{0}\nHits grant {VALUE} caffeine (+{VALUE} per stack) per proc coefficient. At 400 caffeine, consume all caffeine to enter Caffeine Rush for 30 seconds, gaining +100% TOTAL damage, +70% attack speed, +30% movement speed, +50% maximum health, +300% regeneration, +20 armor, and 200% faster skill cooldowns. Caffeine cannot be gained during the Rush.", "1", "2", "4", "8"); } private static void RegisterComboStarLanguage() { RegisterQualityText("COMBOSTAR", "{0}\n Retain part of your combo when it would reset.", "{0}\nAdd {VALUE}% (+{VALUE}% per stack) combo retention. At 100%, misses preserve the combo. While at maximum combo, every 1% excess retention grants +0.5% critical damage.", "15", "30", "60", "100"); } private static void RegisterRedshifterLanguage() { RegisterTierText("REDSHIFTER", "UNCOMMON", "{0}\n Deal more damage for every meter between you and an enemy.", "{0}\nDeal an additional {VALUE}% TOTAL damage (+{VALUE}% per stack) per meter of distance, up to {MAX}% (+{MAX}% per stack).", "0.25", "25"); RegisterTierText("REDSHIFTER", "RARE", "{0}\n Deal more damage for every meter between you and an enemy.", "{0}\nDeal an additional {VALUE}% TOTAL damage (+{VALUE}% per stack) per meter of distance, up to {MAX}% (+{MAX}% per stack).", "0.5", "50"); RegisterTierText("REDSHIFTER", "EPIC", "{0}\n Deal more damage for every meter between you and an enemy.", "{0}\nDeal an additional {VALUE}% TOTAL damage (+{VALUE}% per stack) per meter of distance, up to {MAX}% (+{MAX}% per stack).", "1", "100"); RegisterTierText("REDSHIFTER", "LEGENDARY", "{0}\n Deal more damage for every meter between you and an enemy.", "{0}\nDeal an additional {VALUE}% TOTAL damage (+{VALUE}% per stack) per meter of distance, up to {MAX}% (+{MAX}% per stack).", "2", "200"); } private static void RegisterBioticShellLanguage() { RegisterQualityText("BIOTICSHELL", "{0}\n Breaking your barrier releases a damaging molt.", "{0}\nWhen your barrier breaks, explode for {VALUE}% base damage (+{VALUE}% per stack) in a 12m radius.", "100", "250", "500", "1000"); } private static void RegisterQualityText(string itemName, string pickupFormat, string descriptionFormat, string uncommonValue, string rareValue, string epicValue, string legendaryValue) { RegisterTierText(itemName, "UNCOMMON", pickupFormat, descriptionFormat, uncommonValue); RegisterTierText(itemName, "RARE", pickupFormat, descriptionFormat, rareValue); RegisterTierText(itemName, "EPIC", pickupFormat, descriptionFormat, epicValue); RegisterTierText(itemName, "LEGENDARY", pickupFormat, descriptionFormat, legendaryValue); } private static void RegisterTierText(string itemName, string qualityName, string pickupFormat, string descriptionFormat, string value, string maximumValue = null) { LanguageAPI.Add("ITEM_" + itemName + "_" + qualityName + "_PICKUP", FormatQualityText(pickupFormat, value)); string text = FormatQualityText(descriptionFormat, value); if (maximumValue != null) { text = text.Replace("{MAX}", maximumValue); } LanguageAPI.Add("ITEM_" + itemName + "_" + qualityName + "_DESC", text); } private static string FormatQualityText(string format, string value) { return format.Replace("{VALUE}", value); } } public class LanceOfLonginusEquipment : MonoBehaviour { public EquipmentDef lanceEquipmentDef; public GameObject lanceProjectilePrefab; public float damageCoefficient = 90f; public float projectileSpeed = 200f; public float projectileForce; public bool Activate(EquipmentSlot slot) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_009d: 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_00a5: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)slot) || !Object.op_Implicit((Object)(object)slot.characterBody)) { return false; } if (!NetworkServer.active) { return false; } CharacterBody characterBody = slot.characterBody; Ray aimRay = slot.GetAimRay(); Vector3 position = characterBody.corePosition + Vector3.up * 1f + ((Ray)(ref aimRay)).direction * 1.5f; Quaternion rotation = Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction) * Quaternion.Euler(90f, 0f, 0f); FireProjectileInfo val = new FireProjectileInfo { projectilePrefab = lanceProjectilePrefab, position = position, rotation = rotation, owner = ((Component)characterBody).gameObject, damage = characterBody.damage * damageCoefficient, force = projectileForce, crit = Util.CheckRoll(characterBody.crit, characterBody.master) }; ((FireProjectileInfo)(ref val)).speedOverride = projectileSpeed; val.damageColorIndex = (DamageColorIndex)0; FireProjectileInfo val2 = val; ProjectileManager.instance.FireProjectile(val2); slot.stock = 0; if (Object.op_Implicit((Object)(object)characterBody.inventory)) { characterBody.inventory.SetEquipmentIndex((EquipmentIndex)(-1)); } else { slot.equipmentIndex = (EquipmentIndex)(-1); } characterBody.AddBuff(Buffs.SoulCost); characterBody.AddBuff(Buffs.SoulCost); return true; } } public static class LanceOfLonginusEquipmentHook { public static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown RiskOfImpactMain.LogDebug("[LanceHook] Initializing hook..."); EquipmentSlot.PerformEquipmentAction += new hook_PerformEquipmentAction(EquipmentSlot_PerformEquipmentAction); RiskOfImpactMain.LogDebug("[LanceHook] Hook added."); } private static bool EquipmentSlot_PerformEquipmentAction(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef) { EquipmentDef lanceEquipmentDef = RiskOfImpactContent.GetLanceEquipmentDef(); if ((Object)(object)equipmentDef == (Object)(object)lanceEquipmentDef) { RiskOfImpactMain.LogDebug("[LanceHook] Detected Lance activation on " + ((Object)self.characterBody).name); LanceOfLonginusEquipment lanceOfLonginusEquipment = ((Component)self).GetComponent(); if ((Object)(object)lanceOfLonginusEquipment == (Object)null) { RiskOfImpactMain.LogDebug("[LanceHook] Lance behavior not found; adding component."); lanceOfLonginusEquipment = ((Component)self).gameObject.AddComponent(); lanceOfLonginusEquipment.lanceEquipmentDef = lanceEquipmentDef; lanceOfLonginusEquipment.lanceProjectilePrefab = RiskOfImpactContent.GetLanceProjectilePrefab(); } RiskOfImpactMain.LogDebug("[LanceHook] Activation result: " + lanceOfLonginusEquipment.Activate(self)); return false; } return orig.Invoke(self, equipmentDef); } } [RequireComponent(typeof(ProjectileController))] [RequireComponent(typeof(ProjectileDamage))] [RequireComponent(typeof(TeamFilter))] [RequireComponent(typeof(Rigidbody))] [RequireComponent(typeof(Collider))] public class LanceOfLonginusProjectile : MonoBehaviour { [Header("Behavior")] public bool pierceEnemies = true; public int maxEnemyHits = 999; public float pickupDelaySeconds = 0.35f; public float lifetimeSeconds = 600f; [Tooltip("If the lance spawns intersecting ground/walls, it can instantly stick. This gives it a grace period.")] public float stickArmTime = 0.15f; [Header("Reliability (anti-tunneling)")] [Tooltip("Layer mask used by the per-tick sweep. Leave as Everything unless you know what you're doing.")] public LayerMask sweepMask = LayerMask.op_Implicit(-1); [Tooltip("SphereCast radius is derived from the projectile collider bounds extents, multiplied by this.")] public float sweepRadiusScale = 0.55f; [Tooltip("Minimum sphere sweep radius (in meters).")] public float minSweepRadius = 0.18f; [Header("Debug")] public bool debugHits = true; public bool verboseDamageDebug = true; public float debugInterval = 0.25f; [Header("Sweep radii")] public float enemySweepRadiusScale = 0.75f; public float worldSweepRadiusScale = 0.35f; public float minEnemySweepRadius = 0.3f; public float minWorldSweepRadius = 0.12f; private ProjectileController controller; private ProjectileDamage projectileDamage; private TeamFilter teamFilter; private Rigidbody rb; private Collider hitCollider; private bool stuck; private int hitCount; private readonly HashSet hitHealthComponents = new HashSet(); private float spawnTime; private Vector3 spawnPos; private Vector3 lastPos; private float nextDebugTime; private const float FallbackSpeed = 200f; private void Awake() { //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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) debugHits = debugHits && RiskOfImpactMain.DebugMode; spawnTime = Time.time; spawnPos = ((Component)this).transform.position; controller = ((Component)this).GetComponent(); projectileDamage = ((Component)this).GetComponent(); teamFilter = ((Component)this).GetComponent(); rb = ((Component)this).GetComponent(); hitCollider = ((Component)this).GetComponent(); hitCollider.isTrigger = true; rb.useGravity = false; rb.isKinematic = false; rb.constraints = (RigidbodyConstraints)0; rb.collisionDetectionMode = (CollisionDetectionMode)2; rb.interpolation = (RigidbodyInterpolation)1; lastPos = rb.position; if (debugHits) { RiskOfImpactMain.LogDebug($"[LanceProj] Awake netActive={NetworkServer.active} layer={((Component)this).gameObject.layer} " + $"sweepMask=0x{((LayerMask)(ref sweepMask)).value:X} trigger={hitCollider.isTrigger} pos={((Component)this).transform.position}"); } Object.Destroy((Object)(object)((Component)this).gameObject, lifetimeSeconds); } private void Start() { //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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_0053: Unknown result type (might be due to invalid IL or missing references) ProjectileSimple component = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { ((Behaviour)component).enabled = false; } Vector3 velocity; if (Object.op_Implicit((Object)(object)rb)) { velocity = rb.velocity; if (((Vector3)(ref velocity)).sqrMagnitude <= 0.01f) { rb.velocity = ((Component)this).transform.up * 200f; } } if (debugHits) { object arg = rb.velocity; velocity = rb.velocity; RiskOfImpactMain.LogDebug($"[LanceProj] Start vel={arg} speed={((Vector3)(ref velocity)).magnitude:F1} " + string.Format("up={0} owner={1}", ((Component)this).transform.up, (Object.op_Implicit((Object)(object)controller) && Object.op_Implicit((Object)(object)controller.owner)) ? ((Object)controller.owner).name : "null")); } } private unsafe void FixedUpdate() { //IL_0045: 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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_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_015e: 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) //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_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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { SweepForMissedHits(); } Vector3 val; if (debugHits && Time.time >= nextDebugTime) { nextDebugTime = Time.time + debugInterval; object arg = ((Component)this).transform.position; object arg2; if (!Object.op_Implicit((Object)(object)rb)) { arg2 = "noRB"; } else { val = rb.position; arg2 = ((object)(*(Vector3*)(&val))/*cast due to .constrained prefix*/).ToString(); } string text = $"[LanceProj] Tick pos={arg} rbPos={arg2} "; object arg3; if (!Object.op_Implicit((Object)(object)rb)) { arg3 = "noRB"; } else { val = rb.velocity; arg3 = ((object)(*(Vector3*)(&val))/*cast due to .constrained prefix*/).ToString(); } RiskOfImpactMain.LogDebug(text + $"vel={arg3} stuck={stuck}"); } if (!stuck && Object.op_Implicit((Object)(object)rb)) { val = rb.velocity; if (((Vector3)(ref val)).sqrMagnitude > 0.01f) { Transform transform = ((Component)this).transform; val = rb.velocity; transform.rotation = Quaternion.LookRotation(((Vector3)(ref val)).normalized) * Quaternion.Euler(90f, 0f, 0f); } } lastPos = (Object.op_Implicit((Object)(object)rb) ? rb.position : ((Component)this).transform.position); } private void OnTriggerEnter(Collider other) { //IL_007d: 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_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_00e8: 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_00f3: 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) if (stuck || !Object.op_Implicit((Object)(object)other) || (Object)(object)other == (Object)(object)hitCollider || (Object.op_Implicit((Object)(object)controller) && Object.op_Implicit((Object)(object)controller.owner) && ((Component)other).transform.IsChildOf(controller.owner.transform))) { return; } Vector3 hitPosition = (Object.op_Implicit((Object)(object)rb) ? rb.position : ((Component)this).transform.position); if (TryDealDamage(other, hitPosition, "TRIGGER")) { if (!pierceEnemies) { Object.Destroy((Object)(object)((Component)this).gameObject); } return; } bool flag = Object.op_Implicit((Object)(object)((Component)other).GetComponentInParent()) || Object.op_Implicit((Object)(object)((Component)other).GetComponentInParent()); if (other.isTrigger || flag || Time.time - spawnTime < stickArmTime) { return; } Vector3 val = rb.position - spawnPos; if (!(((Vector3)(ref val)).sqrMagnitude < 0.0625f)) { if (debugHits) { RiskOfImpactMain.LogDebug("[LanceProj] TRIGGER_STICK other=" + ((Object)other).name); } StickIntoWorld(); } } private void SweepForMissedHits() { //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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_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_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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0252: 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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: 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_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_01df: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Unknown result type (might be due to invalid IL or missing references) if (stuck || (Object)(object)rb == (Object)null) { return; } Vector3 val = lastPos; Vector3 position = rb.position; Vector3 val2 = position - val; float magnitude = ((Vector3)(ref val2)).magnitude; if (magnitude < 0.001f) { return; } float num = 0.25f; if (Object.op_Implicit((Object)(object)hitCollider)) { Bounds bounds = hitCollider.bounds; Vector3 extents = ((Bounds)(ref bounds)).extents; num = Mathf.Max(extents.x, Mathf.Max(extents.y, extents.z)); } float num2 = Mathf.Max(minEnemySweepRadius, num * enemySweepRadiusScale); float num3 = Mathf.Max(minWorldSweepRadius, num * worldSweepRadiusScale); Vector3 val3 = val2 / magnitude; RaycastHit[] array = Physics.SphereCastAll(val, num2, val3, magnitude, LayerMask.op_Implicit(sweepMask), (QueryTriggerInteraction)2); RaycastHit[] array2; if (array != null && array.Length != 0) { Array.Sort(array, (RaycastHit a, RaycastHit b) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance)); if (debugHits) { RiskOfImpactMain.LogDebug($"[LanceProj] SWEEP_ENEMY from={val} to={position} dist={magnitude:F3} r={num2:F3} hits={array.Length}"); } array2 = array; for (int num4 = 0; num4 < array2.Length; num4++) { RaycastHit val4 = array2[num4]; Collider collider = ((RaycastHit)(ref val4)).collider; if (Object.op_Implicit((Object)(object)collider) && !((Object)(object)collider == (Object)(object)hitCollider) && (!Object.op_Implicit((Object)(object)controller) || !Object.op_Implicit((Object)(object)controller.owner) || !((Component)collider).transform.IsChildOf(controller.owner.transform)) && TryDealDamage(collider, ((RaycastHit)(ref val4)).point, "SWEEP_ENEMY")) { if (debugHits) { RiskOfImpactMain.LogDebug($"[LanceProj] SWEEP_ENEMY_DAMAGE other={((Object)collider).name} point={((RaycastHit)(ref val4)).point} dist={((RaycastHit)(ref val4)).distance:F3}"); } if (!pierceEnemies) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } } } } RaycastHit[] array3 = Physics.SphereCastAll(val, num3, val3, magnitude, LayerMask.op_Implicit(sweepMask), (QueryTriggerInteraction)2); if (array3 == null || array3.Length == 0) { return; } Array.Sort(array3, (RaycastHit a, RaycastHit b) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance)); if (debugHits) { RiskOfImpactMain.LogDebug($"[LanceProj] SWEEP_WORLD from={val} to={position} dist={magnitude:F3} r={num3:F3} hits={array3.Length}"); } array2 = array3; for (int num4 = 0; num4 < array2.Length; num4++) { RaycastHit val5 = array2[num4]; Collider collider2 = ((RaycastHit)(ref val5)).collider; if (!Object.op_Implicit((Object)(object)collider2) || (Object)(object)collider2 == (Object)(object)hitCollider || (Object.op_Implicit((Object)(object)controller) && Object.op_Implicit((Object)(object)controller.owner) && ((Component)collider2).transform.IsChildOf(controller.owner.transform))) { continue; } bool flag = Object.op_Implicit((Object)(object)((Component)collider2).GetComponentInParent()) || Object.op_Implicit((Object)(object)((Component)collider2).GetComponentInParent()); if (collider2.isTrigger || flag || Time.time - spawnTime < stickArmTime) { continue; } Vector3 val6 = rb.position - spawnPos; if (!(((Vector3)(ref val6)).sqrMagnitude < 0.0625f)) { if (debugHits) { RiskOfImpactMain.LogDebug($"[LanceProj] SWEEP_WORLD_STICK other={((Object)collider2).name} point={((RaycastHit)(ref val5)).point} dist={((RaycastHit)(ref val5)).distance:F3}"); } StickIntoWorld(); break; } } } private bool TryDealDamage(Collider other, Vector3 hitPosition, string srcTag) { //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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: 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_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: 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_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: 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_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Expected O, but got Unknown //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return false; } HurtBox val = ((Component)other).GetComponent() ?? ((Component)other).GetComponentInParent(); HealthComponent val2 = (Object.op_Implicit((Object)(object)val) ? val.healthComponent : ((Component)other).GetComponentInParent()); if (!Object.op_Implicit((Object)(object)val2)) { if (debugHits && verboseDamageDebug) { RiskOfImpactMain.LogDebug($"[LanceProj] {srcTag}_NO_HC other={((Object)other).name} layer={((Component)other).gameObject.layer} trig={other.isTrigger}"); } return false; } if (Object.op_Implicit((Object)(object)controller) && Object.op_Implicit((Object)(object)controller.owner) && (Object)(object)((Component)val2).gameObject == (Object)(object)controller.owner) { if (debugHits && verboseDamageDebug) { RiskOfImpactMain.LogDebug("[LanceProj] " + srcTag + "_SKIP_OWNER hc=" + ((Object)val2).name + " other=" + ((Object)other).name); } return false; } TeamIndex val3 = (Object.op_Implicit((Object)(object)val) ? val.teamIndex : ((Object.op_Implicit((Object)(object)val2.body) && Object.op_Implicit((Object)(object)val2.body.teamComponent)) ? val2.body.teamComponent.teamIndex : TeamComponent.GetObjectTeam(((Component)val2).gameObject))); TeamIndex val4 = (TeamIndex)((!Object.op_Implicit((Object)(object)teamFilter)) ? ((Object.op_Implicit((Object)(object)controller) && Object.op_Implicit((Object)(object)controller.owner)) ? ((int)TeamComponent.GetObjectTeam(controller.owner)) : (-1)) : ((int)teamFilter.teamIndex)); if (val3 == val4) { if (debugHits && verboseDamageDebug) { RiskOfImpactMain.LogDebug($"[LanceProj] {srcTag}_SKIP_SAME_TEAM victimTeam={val3} myTeam={val4} hc={((Object)val2).name}"); } return false; } if (hitCount >= maxEnemyHits) { if (debugHits && verboseDamageDebug) { RiskOfImpactMain.LogDebug("[LanceProj] " + srcTag + "_MAX_HITS_REACHED hc=" + ((Object)val2).name); } return true; } HealthComponent val5 = ((Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.healthComponent)) ? val.healthComponent : val2); if (Object.op_Implicit((Object)(object)val5) && hitHealthComponents.Contains(val5)) { if (debugHits && verboseDamageDebug) { RiskOfImpactMain.LogDebug("[LanceProj] " + srcTag + "_ALREADY_HIT hc=" + ((Object)val5).name + " other=" + ((Object)other).name); } return true; } if (Object.op_Implicit((Object)(object)val5)) { hitHealthComponents.Add(val5); } hitCount++; DamageInfo val6 = new DamageInfo { attacker = (Object.op_Implicit((Object)(object)controller) ? controller.owner : null), inflictor = ((Component)this).gameObject, damage = (Object.op_Implicit((Object)(object)projectileDamage) ? projectileDamage.damage : 0f), crit = (Object.op_Implicit((Object)(object)projectileDamage) && projectileDamage.crit), position = hitPosition, force = (Object.op_Implicit((Object)(object)rb) ? rb.velocity : Vector3.zero), procCoefficient = (Object.op_Implicit((Object)(object)controller) ? controller.procCoefficient : 1f), damageType = DamageTypeCombo.op_Implicit((DamageType)0), damageColorIndex = (DamageColorIndex)0 }; if (debugHits && verboseDamageDebug) { RiskOfImpactMain.LogDebug("[LanceProj] " + srcTag + "_DAMAGE hc=" + ((Object)val2).name + " body=" + (Object.op_Implicit((Object)(object)val2.body) ? ((Object)val2.body).name : "none") + " " + string.Format("victimTeam={0} myTeam={1} dmg={2:F1} pos={3} vel={4}", val3, val4, val6.damage, hitPosition, Object.op_Implicit((Object)(object)rb) ? ((object)rb.velocity/*cast due to .constrained prefix*/).ToString() : "noRB")); } val2.TakeDamage(val6); GlobalEventManager.instance.OnHitEnemy(val6, ((Component)val2).gameObject); GlobalEventManager.instance.OnHitAll(val6, ((Component)val2).gameObject); return true; } private void StickIntoWorld() { //IL_0023: 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_0087: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) if (!stuck) { stuck = true; if (debugHits) { RiskOfImpactMain.LogDebug(string.Format("[LanceProj] STUCK pos={0} vel={1}", ((Component)this).transform.position, Object.op_Implicit((Object)(object)rb) ? ((object)rb.velocity/*cast due to .constrained prefix*/).ToString() : "noRB")); } if (Object.op_Implicit((Object)(object)rb)) { rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; rb.isKinematic = true; } if (Object.op_Implicit((Object)(object)projectileDamage)) { ((Behaviour)projectileDamage).enabled = false; } Collider obj = hitCollider; BoxCollider val = (BoxCollider)(object)((obj is BoxCollider) ? obj : null); if (val != null) { val.size *= 3f; } if (!Object.op_Implicit((Object)(object)((Component)this).GetComponent())) { LancePickupTrigger lancePickupTrigger = ((Component)this).gameObject.AddComponent(); lancePickupTrigger.lanceEquipmentDef = RiskOfImpactContent.GetLanceEquipmentDef(); lancePickupTrigger.pickupActivationTime = Time.time + pickupDelaySeconds; } } } } public class LancePickupTrigger : MonoBehaviour { public EquipmentDef lanceEquipmentDef; public float pickupActivationTime; private void Start() { Collider component = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.isTrigger = true; } } private void OnTriggerEnter(Collider other) { //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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Invalid comparison between Unknown and I4 //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_0081: 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) if (!NetworkServer.active || Time.time < pickupActivationTime) { return; } CharacterBody componentInParent = ((Component)other).GetComponentInParent(); if (!Object.op_Implicit((Object)(object)componentInParent) || !componentInParent.isPlayerControlled) { return; } EquipmentSlot component = ((Component)componentInParent).GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { return; } EquipmentIndex val = lanceEquipmentDef.equipmentIndex; if ((int)val == -1) { val = EquipmentCatalog.FindEquipmentIndex(((Object)lanceEquipmentDef).name); } if ((int)val != -1) { if (Object.op_Implicit((Object)(object)componentInParent.inventory)) { componentInParent.inventory.SetEquipmentIndex(val, false); } else { component.equipmentIndex = val; } component.stock = 1; Object.Destroy((Object)(object)((Component)this).gameObject); } } } public class LanceTeam : TeamFilter { private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { bool flag = ((TeamFilter)this).OnSerialize(writer, forceAll); bool flag2 = default(bool); return flag2 || flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { ((TeamFilter)this).OnDeserialize(reader, initialState); } public override void PreStartClient() { ((TeamFilter)this).PreStartClient(); } } public static class LookingGlassCompat { public static void Init() { if (!Chainloader.PluginInfos.ContainsKey("droppod.lookingglass")) { RiskOfImpactMain.LogInfo("[RiskOfImpact LG] LookingGlass not detected, skipping compat."); } else { RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(RegisterItemStatsSafe)); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void RegisterItemStatsSafe() { try { RegisterBuffDescriptions(); RegisterComboStarItemStats(); RegisterMugItemStats(); RegisterRedshifterItemStats(); RoR2Application.onNextUpdate += RegisterRedshifterAdjustedOfficialStatsSafe; RegisterBioticShellItemStats(); RegisterRiskyDiceAfflictionItemStats(); } catch (Exception ex) { RiskOfImpactMain.LogError("[RiskOfImpact LG] Failed to register stats: " + ex); } } private static void RegisterBuffDescriptions() { if (!Language.languagesByName.TryGetValue("en", out var value)) { RiskOfImpactMain.LogWarning("[RiskOfImpact LG] English language unavailable; skipping buff descriptions."); return; } RegisterBuffDescription(value, RiskOfImpactContent.GetComboStarBuffDef(), "Combo Star", "Each stack increases damage by 3% (+0.5% per additional Combo Star). Missing an eligible hit resets all stacks."); RegisterBuffDescription(value, RiskOfImpactContent.GetCaffeineFeedbackBuffDef(), "Caffeine", "Each stack is 1 caffeine. At 400 stacks, consume all caffeine and enter Caffeine Rush for 30 seconds."); RegisterBuffDescription(value, RiskOfImpactContent.GetCaffeineRushBuffDef(), "Caffeine Rush", "Gain +100% total damage, +70% attack speed, +30% movement speed, +50% maximum health, +300% regeneration, +20 armor, and 200% faster skill cooldowns. Caffeine cannot be gained during the Rush."); RegisterBuffDescription(value, RiskOfImpactContent.GetComboStarMaxBuffDef(), "Maximum Combo", "Combo Star is at maximum stacks. Gain 5% critical strike chance (+2.5% per additional Combo Star). Excess Quality retention above 100% grants +0.5% critical damage per 1% excess retention."); RegisterBuffDescription(value, RiskOfImpactContent.GetDoomedMoonBuffDef(), "Doomed Moon Revival Bonus", "Each stack grants +10% total health, +10% total damage, +10% movement and attack speed, +10% critical strike chance, and +10 armor. The first stack grants +0.1 base regeneration, with +0.02 per additional stack."); RegisterBuffDescription(value, RiskOfImpactContent.GetRiskyDiceBuffDef(), "Risk", "Each stack is accumulated Risk. Misfortune applies permanent Buyer's Remorse based on current Risk, then resets all Risk. Misfortune at 20 or more Risk is fatal."); } private static void RegisterBuffDescription(Language language, BuffDef buff, string name, string description) { if (!Object.op_Implicit((Object)(object)buff)) { RiskOfImpactMain.LogWarning("[RiskOfImpact LG] Cannot register '" + name + "' because its BuffDef is missing."); return; } LookingGlassLanguageAPI.SetupToken(language, "NAME_" + ((Object)buff).name, name); LookingGlassLanguageAPI.SetupToken(language, "DESCRIPTION_" + ((Object)buff).name, description); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void RegisterMugItemStats() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected I4, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected I4, but got Unknown ItemDef mugItemDef = RiskOfImpactContent.GetMugItemDef(); if (!Object.op_Implicit((Object)(object)mugItemDef)) { RiskOfImpactMain.LogError("[Mug LG] Cheerful Mug ItemDef missing, aborting."); return; } Dictionary allItemDefinitions = ItemDefinitions.allItemDefinitions; if (allItemDefinitions == null) { RiskOfImpactMain.LogError("[Mug LG] ItemDefinitions.allItemDefinitions is null."); return; } if (!allItemDefinitions.TryGetValue((int)mugItemDef.itemIndex, out var value)) { value = new ItemStatsDef(); allItemDefinitions[(int)mugItemDef.itemIndex] = value; } value.descriptions.Clear(); value.valueTypes.Clear(); value.measurementUnits.Clear(); value.descriptions.Add("Current bonus: "); value.valueTypes.Add((ValueType)2); value.measurementUnits.Add((MeasurementUnits)1); value.calculateValuesNew = delegate(float luck, int itemCount, float procChance) { if (itemCount <= 0) { return new List { 0f, 0f, 0f }; } float num = 69f * (float)itemCount; return new List(1) { num / 100f }; }; RiskOfImpactMain.LogInfo("[Mug LG] Registered Cheerful Mug item stats with LookingGlass."); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void RegisterComboStarItemStats() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected I4, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected I4, but got Unknown ItemDef comboStarItemDef = RiskOfImpactContent.GetComboStarItemDef(); if (!Object.op_Implicit((Object)(object)comboStarItemDef)) { RiskOfImpactMain.LogError("[ComboStar LG] Combo Star ItemDef missing, aborting."); return; } Dictionary allItemDefinitions = ItemDefinitions.allItemDefinitions; if (allItemDefinitions == null) { RiskOfImpactMain.LogError("[ComboStar LG] ItemDefinitions.allItemDefinitions is null."); return; } if (!allItemDefinitions.TryGetValue((int)comboStarItemDef.itemIndex, out var value)) { value = new ItemStatsDef(); allItemDefinitions[(int)comboStarItemDef.itemIndex] = value; } value.descriptions.Clear(); value.valueTypes.Clear(); value.measurementUnits.Clear(); value.descriptions.Add("Damage per stack: "); value.valueTypes.Add((ValueType)1); value.measurementUnits.Add((MeasurementUnits)1); value.descriptions.Add("Max stacks: "); value.valueTypes.Add((ValueType)7); value.measurementUnits.Add((MeasurementUnits)4); value.descriptions.Add("Damage at max stacks: "); value.valueTypes.Add((ValueType)1); value.measurementUnits.Add((MeasurementUnits)1); value.descriptions.Add("Crit at max stacks: "); value.valueTypes.Add((ValueType)1); value.measurementUnits.Add((MeasurementUnits)1); value.calculateValuesNew = delegate(float luck, int itemCount, float procChance) { if (itemCount <= 0) { return new List { 0f, 0f, 0f }; } float num = 3f + 0.5f * (float)(itemCount - 1); float num2 = 20 + 10 * (itemCount - 1); float num3 = num * num2; float num4 = 5f + (float)(itemCount - 1) * 2.5f; return new List(3) { num / 100f, num2, num3 / 100f, num4 / 100f }; }; RiskOfImpactMain.LogInfo("[ComboStar LG] Registered Combo Star item stats with LookingGlass."); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void RegisterRedshifterItemStats() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected I4, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected I4, but got Unknown ItemDef redshifterItemDef = RiskOfImpactContent.GetRedshifterItemDef(); if (!Object.op_Implicit((Object)(object)redshifterItemDef)) { RiskOfImpactMain.LogError("[Redshifter LG] Redshifter ItemDef missing, aborting."); return; } Dictionary allItemDefinitions = ItemDefinitions.allItemDefinitions; if (allItemDefinitions == null) { RiskOfImpactMain.LogError("[Redshifter LG] ItemDefinitions.allItemDefinitions is null."); return; } if (!allItemDefinitions.TryGetValue((int)redshifterItemDef.itemIndex, out var value)) { value = new ItemStatsDef(); allItemDefinitions[(int)redshifterItemDef.itemIndex] = value; } value.descriptions.Clear(); value.valueTypes.Clear(); value.measurementUnits.Clear(); value.descriptions.Add("Range Increase: "); value.valueTypes.Add((ValueType)2); value.measurementUnits.Add((MeasurementUnits)1); value.calculateValuesNew = delegate(float luck, int itemCount, float procChance) { if (itemCount <= 0) { return new List { 0f }; } float item = 0.5f * (float)itemCount; return new List(3) { item }; }; RiskOfImpactMain.LogInfo("[Redshifter LG] Registered Redshifter item stats with LookingGlass."); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void RegisterRedshifterAdjustedOfficialStatsSafe() { try { RegisterRedshifterAdjustedOfficialStats(); } catch (Exception ex) { RiskOfImpactMain.LogError("[Redshifter LG] Failed to register adjusted official stats: " + ex); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void RegisterRedshifterAdjustedOfficialStats() { RegisterFocusCrystalStats(); RegisterItemSpatialStats(Items.BounceNearby, new string[1] { "Effective Hook Range: " }, (CharacterMaster master, int itemCount) => new float[1] { (itemCount > 0) ? (30f * GetRedshifterMultiplier(master)) : 0f }, (CharacterMaster master, float luck, int itemCount, float procChance) => new List { CalculateChanceWithLuck(GetHyperbolicStacking(0.2f, 0.2f, itemCount) * procChance, luck), itemCount, 30f, 0.33f }, (ValueType)1, 2); RegisterRazorwireStats(); RegisterTeslaCoilStats(); RegisterFormulaBasedRedshifterStats(); RegisterPrefabBasedRedshifterStats(); RegisterItemSpatialStats(Items.ChainLightning, new string[1] { "Effective Chain Range: " }, (CharacterMaster master, int itemCount) => new float[1] { (itemCount > 0) ? ((18f + 2f * (float)itemCount) * GetRedshifterMultiplier(master)) : 0f }, (CharacterMaster master, float luck, int itemCount, float procChance) => new List { CalculateChanceWithLuck(0.25f * procChance, luck), 1f + 2f * (float)itemCount, 18f + 2f * (float)itemCount, 0.2f }, (ValueType)1, 2); RegisterItemSpatialStats(Items.CaptainDefenseMatrix, new string[1] { "Effective Eraser Radius: " }, (CharacterMaster master, int itemCount) => new float[1] { (itemCount > 0) ? (DefenseMatrixOn.projectileEraserRadius * GetRedshifterMultiplier(master)) : 0f }, delegate(CharacterMaster master, float luck, int itemCount, float procChance) { CharacterBody val7 = (Object.op_Implicit((Object)(object)master) ? master.GetBody() : null); return new List { itemCount, Object.op_Implicit((Object)(object)val7) ? (1f / (2f * val7.attackSpeed)) : 0.5f }; }, (ValueType)2); RegisterItemSpatialStats(Items.LaserTurbine, new string[2] { "Effective Beam Radius: ", "Effective Beam Range: " }, delegate(CharacterMaster master, int itemCount) { if (itemCount > 0) { float redshifterMultiplier = GetRedshifterMultiplier(master); return new float[2] { FireMainBeamState.mainBeamRadius * redshifterMultiplier, FireMainBeamState.mainBeamMaxDistance * redshifterMultiplier }; } return new float[2]; }, (CharacterMaster master, float luck, int itemCount, float procChance) => new List { 3f * (float)itemCount, 10f * (float)itemCount, 1f }, (ValueType)1); SiphonNearbyController val = LoadLegacyComponent("Prefabs/NetworkedObjects/BodyAttachments/SiphonNearbyBodyAttachment"); if (Object.op_Implicit((Object)(object)val)) { float baseRadius = val.radius; RegisterItemSpatialStats(Items.SiphonOnLowHealth, new string[1] { "Effective Radius: " }, delegate(CharacterMaster master, int itemCount) { CharacterBody val7 = (Object.op_Implicit((Object)(object)master) ? master.GetBody() : null); float num = (Object.op_Implicit((Object)(object)val7) ? val7.radius : 0f); return new float[1] { (itemCount > 0) ? ((baseRadius + num) * GetRedshifterMultiplier(master)) : 0f }; }, (CharacterMaster master, float luck, int itemCount, float procChance) => new List { itemCount, 0f }, (ValueType)1); } HelfireController val2 = LoadLegacyComponent("Prefabs/NetworkedObjects/HelfireController"); if (Object.op_Implicit((Object)(object)val2)) { float baseRadius2 = val2.baseRadius; RegisterEquipmentSpatialStats(Equipment.BurnNearby, new string[1] { "Effective Radius: " }, (CharacterMaster master, int equipmentCount) => new float[1] { baseRadius2 * GetRedshifterMultiplier(master) }, (CharacterMaster master, float luck, int equipmentCount, float procChance) => new List { 0f }, (ValueType)1); } GameObject val3 = LegacyResourcesAPI.Load("Prefabs/Projectiles/BeamSphere"); ProjectileProximityBeamController val4 = (Object.op_Implicit((Object)(object)val3) ? val3.GetComponent() : null); ProjectileExplosion val5 = (Object.op_Implicit((Object)(object)val3) ? val3.GetComponent() : null); if (Object.op_Implicit((Object)(object)val4) && Object.op_Implicit((Object)(object)val5)) { float attackRange = val4.attackRange; float blastRadius = val5.blastRadius; RegisterEquipmentSpatialStats(Equipment.BFG, new string[2] { "Effective Tendril Range: ", "Effective Explosion Radius: " }, delegate(CharacterMaster master, int equipmentCount) { float redshifterMultiplier = GetRedshifterMultiplier(master); return new float[2] { attackRange * redshifterMultiplier, blastRadius * redshifterMultiplier }; }, (CharacterMaster master, float luck, int equipmentCount, float procChance) => new List { 1f }, (ValueType)1); } else { RiskOfImpactMain.LogWarning("[Redshifter LG] Could not read spatial values from 'Prefabs/Projectiles/BeamSphere'."); } RadialForce val6 = LoadLegacyComponent("Prefabs/Projectiles/GravSphere"); if (Object.op_Implicit((Object)(object)val6)) { float baseRadius3 = val6.radius; RegisterEquipmentSpatialStats(Equipment.Blackhole, new string[1] { "Effective Pull Radius: " }, (CharacterMaster master, int equipmentCount) => new float[1] { baseRadius3 * GetRedshifterMultiplier(master) }, null, (ValueType)2); } RiskOfImpactMain.LogInfo("[Redshifter LG] Registered adjusted official item and equipment ranges."); } private static void RegisterFormulaBasedRedshifterStats() { RegisterItemSpatialStats(Items.IgniteOnKill, new string[1] { "Effective Base Radius: " }, (CharacterMaster master, int itemCount) => new float[1] { (8f + 4f * (float)itemCount) * GetRedshifterMultiplier(master) }, (CharacterMaster master, float luck, int itemCount, float procChance) => new List { 2.25f + 0.75f * (float)itemCount, 1.5f + 1.5f * (float)itemCount, 8f + 4f * (float)itemCount, 0f }, (ValueType)1, 2, overrideReplacedValueType: true); RegisterItemSpatialStats(Items.Mushroom, new string[1] { "Effective Radius: " }, delegate(CharacterMaster master, int itemCount) { CharacterBody val = (Object.op_Implicit((Object)(object)master) ? master.GetBody() : null); float num = (Object.op_Implicit((Object)(object)val) ? val.radius : 0f); return new float[1] { (num + 1.5f + 1.5f * (float)itemCount) * GetRedshifterMultiplier(master) }; }, (CharacterMaster master, float luck, int itemCount, float procChance) => new List { 0.0225f + 0.0225f * (float)itemCount, 1.5f + 1.5f * (float)itemCount }, (ValueType)1, 1); RegisterItemSpatialStats(Items.AttackSpeedPerNearbyAllyOrEnemy, new string[1] { "Effective Radius: " }, (CharacterMaster master, int itemCount) => new float[1] { 20f * GetRedshifterMultiplier(master) }, delegate(CharacterMaster master, float luck, int itemCount, float procChance) { float num = 0.065f + 0.035f * (float)itemCount; return new List { num, num * (float)(2 + itemCount), 2 + itemCount }; }, (ValueType)2); RegisterItemSpatialStats(Items.WardOnLevel, new string[1] { "Effective Radius: " }, (CharacterMaster master, int itemCount) => new float[1] { (8f + 8f * (float)itemCount) * GetRedshifterMultiplier(master) }, (CharacterMaster master, float luck, int itemCount, float procChance) => new List { 8f + 8f * (float)itemCount }, (ValueType)1, 0); RegisterItemSpatialStats(Items.Icicle, new string[1] { "Effective Max Radius: " }, delegate(CharacterMaster master, int itemCount) { CharacterBody val = (Object.op_Implicit((Object)(object)master) ? master.GetBody() : null); float num = (Object.op_Implicit((Object)(object)val) ? val.radius : 0f); return new float[1] { (num + 22f + 6f * (float)(itemCount - 1)) * GetRedshifterMultiplier(master) }; }, (CharacterMaster master, float luck, int itemCount, float procChance) => new List { 6f + 12f * (float)itemCount, 6f * (float)itemCount, 0.2f }, (ValueType)1, 1); RegisterItemSpatialStats(Items.TriggerEnemyDebuffs, new string[1] { "Effective Range: " }, (CharacterMaster master, int itemCount) => new float[1] { (15f + 5f * (float)itemCount) * GetRedshifterMultiplier(master) }, (CharacterMaster master, float luck, int itemCount, float procChance) => new List { itemCount, 15f + 5f * (float)itemCount, 0f }, (ValueType)1, 1); RegisterItemSpatialStats(Items.JumpDamageStrike, new string[1] { "Effective Max Radius: " }, (CharacterMaster master, int itemCount) => new float[1] { (24.8f + 7.5f * (float)itemCount) * GetRedshifterMultiplier(master) }, (CharacterMaster master, float luck, int itemCount, float procChance) => new List { 1.2f + 2.8f * (float)itemCount, 24.8f + 7.5f * (float)itemCount, 1f }, (ValueType)1, 1); RegisterItemSpatialStats(Items.ShieldBooster, new string[1] { "Effective Explosion Radius: " }, (CharacterMaster master, int itemCount) => new float[1] { 12.5f * GetRedshifterMultiplier(master) }, delegate(CharacterMaster master, float luck, int itemCount, float procChance) { CharacterBody val = (Object.op_Implicit((Object)(object)master) ? master.GetBody() : null); float item = ((Object.op_Implicit((Object)(object)val) && val.damage > 0f) ? (val.maxShield * (0.9f + 0.1f * (float)itemCount) / val.damage + 1f) : 1f); return new List { 30f * (float)itemCount, item, 1f }; }, (ValueType)1); RegisterItemSpatialStats(Items.ShockDamageAura, new string[1] { "Effective Radius: " }, (CharacterMaster master, int itemCount) => new float[1] { 45f * GetRedshifterMultiplier(master) }, (CharacterMaster master, float luck, int itemCount, float procChance) => new List { 15f * Mathf.Pow(0.8f, (float)(itemCount - 1)) }, (ValueType)1); RegisterItemSpatialStats(Items.RandomDamageZone, new string[1] { "Effective Ward Radius: " }, (CharacterMaster master, int itemCount) => new float[1] { 16f * Mathf.Pow(1.5f, (float)(itemCount - 1)) * GetRedshifterMultiplier(master) }, (CharacterMaster master, float luck, int itemCount, float procChance) => new List { 16f * Mathf.Pow(1.5f, (float)(itemCount - 1)) }, (ValueType)1, 0); RegisterItemSpatialStats(Items.Behemoth, new string[1] { "Effective Max Explosion Radius: " }, (CharacterMaster master, int itemCount) => new float[1] { (1.5f + 2.5f * (float)itemCount) * GetRedshifterMultiplier(master) }, (CharacterMaster master, float luck, int itemCount, float procChance) => new List { 1.5f + 2.5f * (float)itemCount, 0f }, (ValueType)1, 0); RegisterItemSpatialStats(Items.ExplodeOnDeath, new string[1] { "Effective Radius: " }, (CharacterMaster master, int itemCount) => new float[1] { (9.6f + 2.4f * (float)itemCount) * GetRedshifterMultiplier(master) }, (CharacterMaster master, float luck, int itemCount, float procChance) => new List { 9.6f + 2.4f * (float)itemCount, 0.7f + 2.8f * (float)itemCount, 1f }, (ValueType)1, 0); RegisterItemSpatialStats(Items.ExplodeOnDeathVoid, new string[1] { "Effective Radius: " }, (CharacterMaster master, int itemCount) => new float[1] { (9.6f + 2.4f * (float)itemCount) * GetRedshifterMultiplier(master) }, (CharacterMaster master, float luck, int itemCount, float procChance) => new List { 9.6f + 2.4f * (float)itemCount, 1.04f + 1.56f * (float)itemCount, 1f }, (ValueType)1, 0); RegisterItemSpatialStats(Items.BleedOnHitAndExplode, new string[1] { "Effective Explosion Radius: " }, (CharacterMaster master, int itemCount) => new float[1] { 16f * GetRedshifterMultiplier(master) }, (CharacterMaster master, float luck, int itemCount, float procChance) => new List { 4f * (float)itemCount, 0.15f * (float)itemCount, 16f, CalculateChanceWithLuck(0.05f, luck), 1f }, (ValueType)1, 2); RegisterItemSpatialStats(Items.IncreasePrimaryDamage, new string[1] { "Effective Explosion Radius: " }, (CharacterMaster master, int itemCount) => new float[1] { 7f * GetRedshifterMultiplier(master) }, (CharacterMaster master, float luck, int itemCount, float procChance) => new List { 4f + (float)itemCount, 1.75f + (float)(itemCount - 1) * 0.5f, 0.2f, 1f }, (ValueType)1); RegisterItemSpatialStats(Items.NovaOnLowHealth, new string[1] { "Effective Explosion Radius: " }, (CharacterMaster master, int itemCount) => new float[1] { DetonateState.blastRadius * GetRedshifterMultiplier(master) }, (CharacterMaster master, float luck, int itemCount, float procChance) => new List { 30f / (1f + (float)itemCount), 1f }, (ValueType)1); RegisterItemSpatialStats(Items.FallBoots, new string[1] { "Effective Max Radius: " }, (CharacterMaster master, int itemCount) => new float[1] { HeadstompersFall.maximumRadius * GetRedshifterMultiplier(master) }, (CharacterMaster master, float luck, int itemCount, float procChance) => new List { GetExponentialRechargeTime(10f, 0.5f, itemCount), 1f }, (ValueType)1); RegisterItemSpatialStats(Items.MeteorAttackOnHighDamage, new string[1] { "Effective Explosion Radius: " }, (CharacterMaster master, int itemCount) => new float[1] { 10f * GetRedshifterMultiplier(master) }, (CharacterMaster master, float luck, int itemCount, float procChance) => new List { Mathf.Min(0.03f * (float)itemCount, 0.75f), Mathf.Min(1f + 0.5f * (float)itemCount, 75f), 0.5f }, (ValueType)1); RegisterItemSpatialStats(Items.LightningStrikeOnHit, new string[1] { "Effective Explosion Radius: " }, (CharacterMaster master, int itemCount) => new float[1] { 3f * GetRedshifterMultiplier(master) }, (CharacterMaster master, float luck, int itemCount, float procChance) => new List { CalculateChanceWithLuck(0.1f * procChance, luck), 5f * (float)itemCount, 1f }, (ValueType)1); RegisterEquipmentSpatialStats(Equipment.Lightning, new string[1] { "Effective Explosion Radius: " }, (CharacterMaster master, int equipmentCount) => new float[1] { 3f * GetRedshifterMultiplier(master) }, (CharacterMaster master, float luck, int equipmentCount, float procChance) => new List { 1f }, (ValueType)1); RegisterEquipmentSpatialStats(Equipment.QuestVolatileBattery, new string[1] { "Effective Explosion Radius: " }, (CharacterMaster master, int equipmentCount) => new float[1] { CountDown.explosionRadius * GetRedshifterMultiplier(master) }, (CharacterMaster master, float luck, int equipmentCount, float procChance) => new List { 0f }, (ValueType)1); } private static void RegisterPrefabBasedRedshifterStats() { DeskPlantController val = LoadLegacyComponent("Prefabs/NetworkedObjects/InterstellarDeskPlant"); if (Object.op_Implicit((Object)(object)val)) { float baseRadius = val.healingRadius; float radiusPerStack = val.radiusIncreasePerStack; RegisterItemSpatialStats(Items.Plant, new string[1] { "Effective Healing Radius: " }, (CharacterMaster master, int itemCount) => new float[1] { (baseRadius + radiusPerStack * (float)itemCount) * GetRedshifterMultiplier(master) }, (CharacterMaster master, float luck, int itemCount, float procChance) => new List { 5f + 5f * (float)itemCount }, (ValueType)0); } GameObject prefab = LegacyResourcesAPI.Load("Prefabs/Projectiles/FireTornado"); float fireTornadoRadius = GetLargestOverlapRadius(prefab); if (fireTornadoRadius > 0f) { RegisterItemSpatialStats(Items.FireRing, new string[1] { "Effective Hitbox Radius: " }, (CharacterMaster master, int itemCount) => new float[1] { fireTornadoRadius * GetRedshifterMultiplier(master) }, (CharacterMaster master, float luck, int itemCount, float procChance) => new List { 3f * (float)itemCount, 0f }, (ValueType)1); } GameObject val2 = LegacyResourcesAPI.Load("Prefabs/Projectiles/ElementalRingVoidBlackHole"); RadialForce val3 = (Object.op_Implicit((Object)(object)val2) ? val2.GetComponentInChildren(true) : null); ProjectileExplosion val4 = (Object.op_Implicit((Object)(object)val2) ? val2.GetComponentInChildren(true) : null); if (Object.op_Implicit((Object)(object)val3) || Object.op_Implicit((Object)(object)val4)) { List list = new List(); List baseValues = new List(); if (Object.op_Implicit((Object)(object)val3)) { list.Add("Effective Pull Radius: "); baseValues.Add(val3.radius); } if (Object.op_Implicit((Object)(object)val4)) { list.Add("Effective Explosion Radius: "); baseValues.Add(val4.blastRadius); } RegisterItemSpatialStats(Items.ElementalRingVoid, list.ToArray(), delegate(CharacterMaster master, int itemCount) { float redshifterMultiplier = GetRedshifterMultiplier(master); float[] array = new float[baseValues.Count]; for (int i = 0; i < array.Length; i++) { array[i] = baseValues[i] * redshifterMultiplier; } return array; }, (CharacterMaster master, float luck, int itemCount, float procChance) => new List { itemCount, 1f }, (ValueType)1); } RegisterProjectileExplosionItem(Items.StickyBomb, "Prefabs/Projectiles/StickyBomb", (CharacterMaster master, float luck, int itemCount, float procChance) => new List { CalculateChanceWithLuck(0.05f * (float)itemCount * procChance, luck), 10f, 0f }); RegisterProjectileExplosionItem(Items.Missile, "Prefabs/Projectiles/MissileProjectile", (CharacterMaster master, float luck, int itemCount, float procChance) => new List { CalculateChanceWithLuck(0.1f * procChance, luck), 3f * (float)itemCount, 1f }); RegisterProjectileExplosionItem(Items.FireballsOnHit, "Prefabs/Projectiles/FireMeatBall", (CharacterMaster master, float luck, int itemCount, float procChance) => new List { CalculateChanceWithLuck(0.1f * procChance, luck), 3f * (float)itemCount, 0.7f }); GameObject val5 = LegacyResourcesAPI.Load("Prefabs/FireworkLauncher"); FireworkLauncher val6 = (Object.op_Implicit((Object)(object)val5) ? val5.GetComponent() : null); ProjectileExplosion val7 = ((Object.op_Implicit((Object)(object)val6) && Object.op_Implicit((Object)(object)val6.projectilePrefab)) ? val6.projectilePrefab.GetComponentInChildren(true) : null); if (Object.op_Implicit((Object)(object)val7)) { float radius = val7.blastRadius; RegisterItemSpatialStats(Items.Firework, new string[1] { "Effective Explosion Radius: " }, (CharacterMaster master, int itemCount) => new float[1] { radius * GetRedshifterMultiplier(master) }, (CharacterMaster master, float luck, int itemCount, float procChance) => new List { 4f + 4f * (float)itemCount, 1f }, (ValueType)1); } ProjectileExplosion val8 = LoadLegacyComponentInChildren("Prefabs/Projectiles/MissileProjectile"); if (Object.op_Implicit((Object)(object)val8)) { float missileRadius = val8.blastRadius; RegisterEquipmentSpatialStats(Equipment.CommandMissile, new string[1] { "Effective Explosion Radius: " }, (CharacterMaster master, int equipmentCount) => new float[1] { missileRadius * GetRedshifterMultiplier(master) }, (CharacterMaster master, float luck, int equipmentCount, float procChance) => new List { 1f }, (ValueType)1); } ProjectileExplosion val9 = LoadLegacyComponentInChildren("Prefabs/Projectiles/MolotovClusterProjectile"); ProjectileExplosion val10 = LoadLegacyComponentInChildren("Prefabs/Projectiles/MolotovSingleProjectile"); if (Object.op_Implicit((Object)(object)val9) || Object.op_Implicit((Object)(object)val10)) { List list2 = new List(); List baseValues2 = new List(); if (Object.op_Implicit((Object)(object)val9)) { list2.Add("Effective Cluster Radius: "); baseValues2.Add(val9.blastRadius); } if (Object.op_Implicit((Object)(object)val10)) { list2.Add("Effective Child Radius: "); baseValues2.Add(val10.blastRadius); } RegisterEquipmentSpatialStats(Equipment.Molotov, list2.ToArray(), delegate(CharacterMaster master, int equipmentCount) { float redshifterMultiplier = GetRedshifterMultiplier(master); float[] array = new float[baseValues2.Count]; for (int i = 0; i < array.Length; i++) { array[i] = baseValues2[i] * redshifterMultiplier; } return array; }, (CharacterMaster master, float luck, int equipmentCount, float procChance) => new List { 1f }, (ValueType)1); } MeteorStormController val11 = LoadLegacyComponent("Prefabs/NetworkedObjects/MeteorStorm"); if (Object.op_Implicit((Object)(object)val11)) { float radius2 = val11.blastRadius; RegisterEquipmentSpatialStats(Equipment.Meteor, new string[1] { "Effective Blast Radius: " }, (CharacterMaster master, int equipmentCount) => new float[1] { radius2 * GetRedshifterMultiplier(master) }, (CharacterMaster master, float luck, int equipmentCount, float procChance) => new List { 1f }, (ValueType)1); } FireballVehicle val12 = LoadLegacyComponent("Prefabs/NetworkedObjects/FireballVehicle"); if (Object.op_Implicit((Object)(object)val12)) { float radius3 = val12.blastRadius; RegisterEquipmentSpatialStats(Equipment.FireBallDash, new string[1] { "Effective Explosion Radius: " }, (CharacterMaster master, int equipmentCount) => new float[1] { radius3 * GetRedshifterMultiplier(master) }, (CharacterMaster master, float luck, int equipmentCount, float procChance) => new List { 1f }, (ValueType)1); } } private static void RegisterProjectileExplosionItem(ItemDef itemDef, string prefabPath, Func> fallbackOriginalValues) { ProjectileExplosion val = LoadLegacyComponentInChildren(prefabPath); if (Object.op_Implicit((Object)(object)val)) { float radius = val.blastRadius; RegisterItemSpatialStats(itemDef, new string[1] { "Effective Explosion Radius: " }, (CharacterMaster master, int itemCount) => new float[1] { radius * GetRedshifterMultiplier(master) }, fallbackOriginalValues, (ValueType)1); } } private static float GetLargestOverlapRadius(GameObject prefab) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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) if (!Object.op_Implicit((Object)(object)prefab)) { return 0f; } ProjectileOverlapAttack component = prefab.GetComponent(); HitBoxGroup component2 = prefab.GetComponent(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component2) || component2.hitBoxes == null) { return 0f; } float num = 0f; for (int i = 0; i < component2.hitBoxes.Length; i++) { HitBox val = component2.hitBoxes[i]; if (Object.op_Implicit((Object)(object)val)) { Vector3 lossyScale = ((Component)val).transform.lossyScale; float num2 = Mathf.Max(lossyScale.x, Mathf.Max(lossyScale.y, lossyScale.z)); if (!component.isSphereOverlap) { num2 *= 0.5f; } num = Mathf.Max(num, num2); } } return num; } private static void RegisterFocusCrystalStats() { RegisterExplicitItemStats(Items.NearbyDamageBonus, new string[2] { "Bonus Damage: ", "Effective Radius: " }, (ValueType[])(object)new ValueType[2] { (ValueType)1, (ValueType)1 }, (MeasurementUnits[])(object)new MeasurementUnits[2] { (MeasurementUnits)1, default(MeasurementUnits) }, (CharacterMaster master, int itemCount) => new List { 0.2f * (float)itemCount, (itemCount > 0) ? (13f * GetRedshifterMultiplier(master)) : 0f }); } private static void RegisterRazorwireStats() { ItemDef thorns = Items.Thorns; string[] descriptions = new string[3] { "Targets: ", "Effective Radius: ", "Proc Coefficient: " }; ValueType[] array = new ValueType[3]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); RegisterExplicitItemStats(thorns, descriptions, (ValueType[])(object)array, (MeasurementUnits[])(object)new MeasurementUnits[3] { (MeasurementUnits)4, default(MeasurementUnits), (MeasurementUnits)9 }, (CharacterMaster master, int itemCount) => new List { 3f + 2f * (float)itemCount, (itemCount > 0) ? ((15f + 10f * (float)itemCount) * GetRedshifterMultiplier(master)) : 0f, 0.5f }); } private static void RegisterTeslaCoilStats() { ItemDef shockNearby = Items.ShockNearby; string[] descriptions = new string[3] { "Max Targets: ", "Proc Coefficient: ", "Effective Chain Range: " }; ValueType[] array = new ValueType[3]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); RegisterExplicitItemStats(shockNearby, descriptions, (ValueType[])(object)array, (MeasurementUnits[])(object)new MeasurementUnits[3] { (MeasurementUnits)4, (MeasurementUnits)9, default(MeasurementUnits) }, (CharacterMaster master, int itemCount) => new List { 1f + 2f * (float)itemCount, 0.3f, (itemCount > 0) ? (35f * GetRedshifterMultiplier(master)) : 0f }); } private static void RegisterExplicitItemStats(ItemDef itemDef, string[] descriptions, ValueType[] valueTypes, MeasurementUnits[] measurementUnits, Func> calculateValues) { //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_002f: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected I4, but got Unknown if (Object.op_Implicit((Object)(object)itemDef) && ItemDefinitions.allItemDefinitions != null) { ItemStatsDef val = new ItemStatsDef { descriptions = new List(descriptions), valueTypes = new List(valueTypes), measurementUnits = new List(measurementUnits), calculateValues = calculateValues }; val.calculateValuesNew = delegate(float luck, int itemCount, float procChance) { LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); return calculateValues((firstLocalUser != null) ? firstLocalUser.cachedMaster : null, itemCount); }; ItemDefinitions.allItemDefinitions[(int)itemDef.itemIndex] = val; } } private static void RegisterItemSpatialStats(ItemDef itemDef, string[] descriptions, Func calculateSpatialValues, Func> fallbackOriginalValues = null, ValueType spatialValueType = (ValueType)1, int replaceOriginalValueIndex = -1, bool overrideReplacedValueType = false) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected I4, but got Unknown if (Object.op_Implicit((Object)(object)itemDef)) { RegisterSpatialStats(ItemDefinitions.allItemDefinitions, (int)itemDef.itemIndex, descriptions, calculateSpatialValues, fallbackOriginalValues, spatialValueType, replaceOriginalValueIndex, overrideReplacedValueType); } } private static void RegisterEquipmentSpatialStats(EquipmentDef equipmentDef, string[] descriptions, Func calculateSpatialValues, Func> fallbackOriginalValues = null, ValueType spatialValueType = (ValueType)1, int replaceOriginalValueIndex = -1, bool overrideReplacedValueType = false) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected I4, but got Unknown if (Object.op_Implicit((Object)(object)equipmentDef)) { RegisterSpatialStats(ItemDefinitions.allEquipmentDefinitions, (int)equipmentDef.equipmentIndex, descriptions, calculateSpatialValues, fallbackOriginalValues, spatialValueType, replaceOriginalValueIndex, overrideReplacedValueType); } } private static void RegisterSpatialStats(Dictionary definitions, int catalogIndex, string[] descriptions, Func calculateSpatialValues, Func> fallbackOriginalValues, ValueType spatialValueType, int replaceOriginalValueIndex, bool overrideReplacedValueType) { //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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_0030: 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_0137: Unknown result type (might be due to invalid IL or missing references) if (definitions == null) { return; } definitions.TryGetValue(catalogIndex, out var value); value = (ItemStatsDef)(((object)value) ?? ((object)new ItemStatsDef())); Func> originalCalculateValues = value.calculateValues; Func> originalCalculateValuesNew = value.calculateValuesNew; int originalValueCount = value.descriptions.Count; ItemStatsDef val = new ItemStatsDef { descriptions = new List(value.descriptions), valueTypes = new List(value.valueTypes), measurementUnits = new List(value.measurementUnits), hasChance = value.hasChance, chanceScaling = value.chanceScaling }; bool replaceOriginalValue = descriptions.Length != 0 && replaceOriginalValueIndex >= 0 && replaceOriginalValueIndex < originalValueCount; int num = 0; if (replaceOriginalValue) { val.descriptions[replaceOriginalValueIndex] = descriptions[0]; val.measurementUnits[replaceOriginalValueIndex] = (MeasurementUnits)0; if (overrideReplacedValueType) { val.valueTypes[replaceOriginalValueIndex] = spatialValueType; } num = 1; } for (int i = num; i < descriptions.Length; i++) { val.descriptions.Add(descriptions[i]); val.valueTypes.Add(spatialValueType); val.measurementUnits.Add((MeasurementUnits)0); } val.calculateValues = (CharacterMaster master, int itemCount) => CalculateValuesWithSpatialStats(originalCalculateValues, originalCalculateValuesNew, fallbackOriginalValues, originalValueCount, calculateSpatialValues, replaceOriginalValue ? replaceOriginalValueIndex : (-1), master, itemCount, Object.op_Implicit((Object)(object)master) ? master.luck : 0f, 1f); val.calculateValuesNew = delegate(float luck, int itemCount, float procChance) { LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); CharacterMaster master = ((firstLocalUser != null) ? firstLocalUser.cachedMaster : null); return CalculateValuesWithSpatialStats(originalCalculateValues, originalCalculateValuesNew, fallbackOriginalValues, originalValueCount, calculateSpatialValues, replaceOriginalValue ? replaceOriginalValueIndex : (-1), master, itemCount, luck, procChance); }; definitions[catalogIndex] = val; } private static List CalculateValuesWithSpatialStats(Func> originalCalculateValues, Func> originalCalculateValuesNew, Func> fallbackOriginalValues, int originalValueCount, Func calculateSpatialValues, int replaceOriginalValueIndex, CharacterMaster master, int itemCount, float luck, float procChance) { List list = ((originalCalculateValues != null) ? originalCalculateValues(master, itemCount) : originalCalculateValuesNew?.Invoke(luck, itemCount, procChance)); if ((list == null || list.Count < originalValueCount) && fallbackOriginalValues != null) { list = fallbackOriginalValues(master, luck, itemCount, procChance); } List list2 = ((list != null) ? new List(list) : new List()); if (list2.Count > originalValueCount) { list2.RemoveRange(originalValueCount, list2.Count - originalValueCount); } while (list2.Count < originalValueCount) { list2.Add(0f); } float[] array = calculateSpatialValues(master, itemCount); int num = 0; if (replaceOriginalValueIndex >= 0 && array.Length != 0) { list2[replaceOriginalValueIndex] = array[0]; num = 1; } for (int i = num; i < array.Length; i++) { list2.Add(array[i]); } return list2; } private static float GetRedshifterMultiplier(CharacterMaster master) { ItemDef redshifterItemDef = RiskOfImpactContent.GetRedshifterItemDef(); if (!Object.op_Implicit((Object)(object)master) || !Object.op_Implicit((Object)(object)master.inventory) || !Object.op_Implicit((Object)(object)redshifterItemDef)) { return 1f; } int itemCountEffective = master.inventory.GetItemCountEffective(redshifterItemDef); if (itemCountEffective <= 0) { return 1f; } return 1f + 0.5f * (float)itemCountEffective; } private static float CalculateChanceWithLuck(float baseChance, float luck) { baseChance = Mathf.Min(baseChance, 1f); float num = Mathf.Floor(baseChance); float num2 = baseChance % 1f; int num3 = Mathf.CeilToInt(luck); if (num3 > 0) { return num + 1f - Mathf.Pow(1f - num2, (float)(num3 + 1)); } if (num3 < 0) { return num + Mathf.Pow(num2, (float)(Mathf.Abs(num3) + 1)); } return baseChance; } private static float GetHyperbolicStacking(float basePercent, float extraPercent, int count) { return 1f - 1f / (1f + basePercent + extraPercent * (float)(count - 1)); } private static float GetExponentialRechargeTime(float baseCooldown, float extraPercent, int count) { return baseCooldown * Mathf.Pow(1f - extraPercent, (float)(count - 1)); } private static T LoadLegacyComponent(string path) where T : Component { GameObject val = LegacyResourcesAPI.Load(path); T val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponent() : default(T)); if (!Object.op_Implicit((Object)(object)val2)) { RiskOfImpactMain.LogWarning("[Redshifter LG] Could not load " + typeof(T).Name + " from '" + path + "'."); } return val2; } private static T LoadLegacyComponentInChildren(string path) where T : Component { GameObject val = LegacyResourcesAPI.Load(path); T val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponentInChildren(true) : default(T)); if (!Object.op_Implicit((Object)(object)val2)) { RiskOfImpactMain.LogWarning("[Redshifter LG] Could not load " + typeof(T).Name + " from '" + path + "'."); } return val2; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void RegisterBioticShellItemStats() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected I4, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected I4, but got Unknown ItemDef bioticShellItemDef = RiskOfImpactContent.GetBioticShellItemDef(); if (!Object.op_Implicit((Object)(object)bioticShellItemDef)) { RiskOfImpactMain.LogError("[BioticShell LG] Biotic Shell ItemDef missing, aborting."); return; } Dictionary allItemDefinitions = ItemDefinitions.allItemDefinitions; if (allItemDefinitions == null) { RiskOfImpactMain.LogError("[BioticShell LG] ItemDefinitions.allItemDefinitions is null."); return; } if (!allItemDefinitions.TryGetValue((int)bioticShellItemDef.itemIndex, out var value)) { value = new ItemStatsDef(); allItemDefinitions[(int)bioticShellItemDef.itemIndex] = value; } value.descriptions.Clear(); value.valueTypes.Clear(); value.measurementUnits.Clear(); value.descriptions.Add("Barrier decay slowed by: "); value.valueTypes.Add((ValueType)2); value.measurementUnits.Add((MeasurementUnits)1); value.calculateValuesNew = delegate(float luck, int itemCount, float procChance) { if (itemCount <= 0) { return new List { 0f }; } float num = itemCount; float item = 0.12f * num / (0.12f * num + 1f); return new List(1) { item }; }; RiskOfImpactMain.LogInfo("[BioticShell LG] Registered Biotic Shell item stats with LookingGlass."); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void RegisterRiskyDiceAfflictionItemStats() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected I4, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected I4, but got Unknown ItemDef riskyDiceAfflictionItemDef = RiskOfImpactContent.GetRiskyDiceAfflictionItemDef(); if (!Object.op_Implicit((Object)(object)riskyDiceAfflictionItemDef)) { RiskOfImpactMain.LogError("[RiskyDice LG] Affliction ItemDef missing, aborting."); return; } Dictionary allItemDefinitions = ItemDefinitions.allItemDefinitions; if (allItemDefinitions == null) { RiskOfImpactMain.LogError("[RiskyDice LG] ItemDefinitions.allItemDefinitions is null."); return; } if (!allItemDefinitions.TryGetValue((int)riskyDiceAfflictionItemDef.itemIndex, out var value)) { value = new ItemStatsDef(); allItemDefinitions[(int)riskyDiceAfflictionItemDef.itemIndex] = value; } value.descriptions.Clear(); value.valueTypes.Clear(); value.measurementUnits.Clear(); value.descriptions.Add("Debuff: "); value.valueTypes.Add((ValueType)2); value.measurementUnits.Add((MeasurementUnits)1); value.descriptions.Add("Curse: "); value.valueTypes.Add((ValueType)2); value.measurementUnits.Add((MeasurementUnits)1); value.calculateValuesNew = delegate(float luck, int itemCount, float procChance) { if (itemCount <= 0) { return new List(2) { 0f, 0f }; } float num = 0.020000001f; float num2 = Mathf.Pow(1f - num, (float)itemCount); float item = 1f - num2; float item2 = 0.040000003f * (float)itemCount; return new List(2) { item, item2 }; }; RiskOfImpactMain.LogInfo("[RiskyDice LG] Registered Risky Dice affliction debuff with LookingGlass."); } } public static class RedshifterHooks { private class FocusIndicatorTracker : MonoBehaviour { public Vector3 baseScale; } private class MiredUrnRadiusTracker : MonoBehaviour { public float baseRadius; } private sealed class DeskPlantRadiusTracker : MonoBehaviour { public float multiplier = 1f; public bool applied; } private sealed class PreScaledBlastContext { public GameObject attacker; public GameObject inflictor; public float radius; } private sealed class RedshifterScaleTracker : MonoBehaviour { public Vector3 baseScale; } private sealed class FaultyConductorAuraScaleTracker : MonoBehaviour { public Vector3 baseScale; } private sealed class RedshifterHoldoutZoneScaler : MonoBehaviour { private HoldoutZoneController _zone; private void Awake() { _zone = ((Component)this).GetComponent(); } private void OnEnable() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown if ((Object)(object)_zone != (Object)null) { _zone.calcRadius += new CalcRadiusDelegate(ApplyRadius); } } private void OnDisable() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown if ((Object)(object)_zone != (Object)null) { _zone.calcRadius -= new CalcRadiusDelegate(ApplyRadius); } } private void ApplyRadius(ref float radius) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) float maxRedshifterMultiplierOnTeam = GetMaxRedshifterMultiplierOnTeam(_zone.chargingTeam); if (!(maxRedshifterMultiplierOnTeam <= 1f)) { radius *= maxRedshifterMultiplierOnTeam; } } } private sealed class RedshifterKillZoneScaler : MonoBehaviour { private KillZoneController _zone; private void Awake() { _zone = ((Component)this).GetComponent(); } private void OnEnable() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown if ((Object)(object)_zone != (Object)null) { _zone.calcRadius += new CalcRadiusDelegate(ApplyRadius); } } private void OnDisable() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown if ((Object)(object)_zone != (Object)null) { _zone.calcRadius -= new CalcRadiusDelegate(ApplyRadius); } } private void ApplyRadius(ref float radius) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) float maxRedshifterMultiplierOnTeam = GetMaxRedshifterMultiplierOnTeam(_zone.chargingTeam); if (!(maxRedshifterMultiplierOnTeam <= 1f)) { radius *= maxRedshifterMultiplierOnTeam; } } } [ThreadStatic] private static bool _pendingIceRingExplosionScale; [ThreadStatic] private static float _pendingIceRingExplosionMult; [ThreadStatic] private static float _pendingDeskPlantRadiusMultiplier; [ThreadStatic] private static CharacterBody _pendingBounceOrbAttackerBody; [ThreadStatic] private static PreScaledBlastContext _preScaledBlastContext; [ThreadStatic] private static bool _delayBlastRadiusAlreadyScaled; private static int _beamSphereProjectileIndex = -2; private static int _gravSphereProjectileIndex = -2; private const float RadiusBonusPerItem = 0.5f; private static readonly string[] _radiusFieldNames = new string[6] { "radius", "range", "maxDistance", "pullRadius", "suctionRadius", "searchRadius" }; private static ItemDef RedshifterItemDef => RiskOfImpactContent.GetRedshifterItemDef(); public static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Expected O, but got Unknown //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Expected O, but got Unknown //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Expected O, but got Unknown //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Expected O, but got Unknown //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Expected O, but got Unknown //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Expected O, but got Unknown //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Expected O, but got Unknown //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Expected O, but got Unknown //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Expected O, but got Unknown //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Expected O, but got Unknown //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Expected O, but got Unknown //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Expected O, but got Unknown //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Expected O, but got Unknown //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Expected O, but got Unknown //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Expected O, but got Unknown //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Expected O, but got Unknown //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Expected O, but got Unknown //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Expected O, but got Unknown //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Expected O, but got Unknown //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Expected O, but got Unknown //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Expected O, but got Unknown //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Expected O, but got Unknown RiskOfImpactMain.LogInfo("[Redshifter] Initializing hooks..."); BlastAttack.Fire += new hook_Fire(BlastAttack_Fire); ProjectileExplosion.DetonateServer += new hook_DetonateServer(ProjectileExplosion_DetonateServer); DelayBlast.FixedUpdate += new hook_FixedUpdate(DelayBlast_FixedUpdate); DelayBlast.Detonate += new hook_Detonate(DelayBlast_Detonate); GlobalEventManager.ProcIgniteOnKill += new hook_ProcIgniteOnKill(GlobalEventManager_ProcIgniteOnKill); GlobalEventManager.ProcessHitEnemy += new hook_ProcessHitEnemy(GlobalEventManager_ProcessHitEnemy); BounceOrb.SearchForTargets += new hook_SearchForTargets(BounceOrb_SearchForTargets); LightningOrb.PickNextTarget += new hook_PickNextTarget(LightningOrb_PickNextTarget); GlobalEventManager.OnHitEnemy += new hook_OnHitEnemy(GlobalEventManager_OnHitEnemy); HealthComponent.TakeDamageProcess += new hook_TakeDamageProcess(HealthComponent_TakeDamageProcessRedHorizon); MushroomBodyBehavior.FixedUpdate += new hook_FixedUpdate(MushroomBodyBehavior_FixedUpdate); HealthComponent.TakeDamageProcess += new Manipulator(HealthComponent_TakeDamageProcess); NearbyDamageBonusBodyBehavior.OnEnable += new hook_OnEnable(NearbyDamageBonusBodyBehavior_OnEnable); CharacterBody.onBodyInventoryChangedGlobal += OnBodyInventoryChanged; AttackSpeedPerNearbyCollider.UpdateValues += new hook_UpdateValues(AttackSpeedPerNearbyCollider_UpdateValues); WardOnLevelManager.OnCharacterLevelUp += new hook_OnCharacterLevelUp(WardOnLevelManager_OnCharacterLevelUp); GlobalEventManager.OnCharacterDeath += new hook_OnCharacterDeath(GlobalEventManager_OnCharacterDeath); DeskPlantController.Awake += new hook_Awake(DeskPlantController_Awake); MainState.OnEnter += new hook_OnEnter(DeskPlantMainState_OnEnter); IcicleAuraController.UpdateRadius += new hook_UpdateRadius(IcicleAuraController_UpdateRadius); SiphonOnLowHealthItemBodyBehavior.OnEnable += new hook_OnEnable(SiphonOnLowHealthItemBodyBehavior_OnEnable); HelfireController.FixedUpdate += new hook_FixedUpdate(HelfireController_FixedUpdate); DefenseMatrixOn.DeleteNearbyProjectile += new hook_DeleteNearbyProjectile(DefenseMatrixOn_DeleteNearbyProjectile); ProjectileProximityBeamController.FindNextTarget += new hook_FindNextTarget(ProjectileProximityBeamController_FindNextTarget); RadialForce.FixedUpdate += new hook_FixedUpdate(RadialForce_FixedUpdate); FireMainBeamState.FireBeamServer += new hook_FireBeamServer(FireMainBeamState_FireBeamServer); CharacterBody.TriggerEnemyDebuffs += new hook_TriggerEnemyDebuffs(CharacterBody_TriggerEnemyDebuffs); JumpDamageStrikeBodyBehavior.GetRadius += new hook_GetRadius(JumpDamageStrikeBodyBehavior_GetRadius); EffectManager.SpawnEffect_GameObject_EffectData_bool += new hook_SpawnEffect_GameObject_EffectData_bool(EffectManager_SpawnEffect_GameObject); DroneShockDamageBodyBehavior.Start += new hook_Start(DroneShockDamageBodyBehavior_Start); DroneShockDamageBodyBehavior.TriggerEnergize += new hook_TriggerEnergize(DroneShockDamageBodyBehavior_TriggerEnergize); ProjectileController.Start += new hook_Start(ProjectileController_Start); ProjectileGhostController.Start += new hook_Start(ProjectileGhostController_Start); RandomDamageZoneBodyBehavior.FixedUpdate += new hook_FixedUpdate(RandomDamageZoneBodyBehavior_FixedUpdate); HoldoutZoneController.Awake += new hook_Awake(HoldoutZoneController_Awake); KillZoneController.Awake += new hook_Awake(KillZoneController_Awake); } internal static float GetRadiusMultiplier(CharacterBody body) { if (!Object.op_Implicit((Object)(object)body) || (Object)(object)body.inventory == (Object)null) { return 1f; } float num = (RiskOfImpactMain.IsItemQualitiesInstalled ? GetQualityRadiusBonus(body.inventory) : (0.5f * (float)body.inventory.GetItemCountEffective(RedshifterItemDef))); return 1f + num; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static float GetQualityRadiusBonus(Inventory inventory) { return ItemQualitiesCompat.GetRedshifterRadiusBonus(inventory); } private static void HealthComponent_TakeDamageProcessRedHorizon(orig_TakeDamageProcess orig, HealthComponent self, DamageInfo damageInfo) { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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) if (RiskOfImpactMain.IsItemQualitiesInstalled && Object.op_Implicit((Object)(object)self?.body) && damageInfo != null && !damageInfo.rejected && !damageInfo.delayedDamageSecondHalf && damageInfo.damage > 0f && Object.op_Implicit((Object)(object)damageInfo.attacker)) { CharacterBody component = damageInfo.attacker.GetComponent(); if (Object.op_Implicit((Object)(object)component) && (Object)(object)component != (Object)(object)self.body && Object.op_Implicit((Object)(object)component.inventory) && Object.op_Implicit((Object)(object)component.teamComponent) && Object.op_Implicit((Object)(object)self.body.teamComponent) && TeamManager.IsTeamEnemy(component.teamComponent.teamIndex, self.body.teamComponent.teamIndex)) { GetQualityRedHorizonScaling(component, out var damageBonusPerMeter, out var maximumDamageBonus); if (damageBonusPerMeter > 0f && maximumDamageBonus > 0f) { float num = Vector3.Distance(component.corePosition, self.body.corePosition); float num2 = Mathf.Min(damageBonusPerMeter * num, maximumDamageBonus); damageInfo.damage *= 1f + num2; } } } orig.Invoke(self, damageInfo); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void GetQualityRedHorizonScaling(CharacterBody body, out float damageBonusPerMeter, out float maximumDamageBonus) { ItemQualitiesCompat.GetRedHorizonScaling(body, out damageBonusPerMeter, out maximumDamageBonus); } private static Result BlastAttack_Fire(orig_Fire orig, BlastAttack self) { //IL_0180: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Invalid comparison between Unknown and I4 //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Invalid comparison between Unknown and I4 //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) PreScaledBlastContext preScaledBlastContext = _preScaledBlastContext; if (preScaledBlastContext != null && (Object)(object)self.attacker == (Object)(object)preScaledBlastContext.attacker && (Object)(object)self.inflictor == (Object)(object)preScaledBlastContext.inflictor && Mathf.Approximately(self.radius, preScaledBlastContext.radius)) { _preScaledBlastContext = null; return orig.Invoke(self); } if (Object.op_Implicit((Object)(object)self.attacker)) { CharacterBody component = self.attacker.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { bool num = Object.op_Implicit((Object)(object)self.inflictor) && (Object)(object)self.inflictor.GetComponent() != (Object)null; bool flag = false; JumpDamageStrikeBodyBehavior component2 = ((Component)component).GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { int buffCount = component.GetBuffCount(Buffs.JumpDamageStrikeCharge); if (buffCount >= 25) { float radius = component2.GetRadius(buffCount, ((BaseItemBodyBehavior)component2).stack); if (Mathf.Abs(self.radius - radius) < 0.01f && self.procCoefficient == 1f && (int)self.damageColorIndex == 3 && (int)self.attackerFiltering == 2 && (int)self.falloffModel == 0 && (self.damageType.damageTypeExtended & 0x2000) != 0) { flag = true; } } } if (!num && !flag && self.radius > 0f) { float radiusMultiplier = GetRadiusMultiplier(component); if (radiusMultiplier != 1f) { float radius2 = self.radius; self.radius *= radiusMultiplier; RiskOfImpactMain.LogDebug($"[Redshifter] BlastAttack: radius {radius2:F1} -> {self.radius:F1} on {component.GetDisplayName()}"); } } } } return orig.Invoke(self); } private static void ProjectileExplosion_DetonateServer(orig_DetonateServer orig, ProjectileExplosion self) { CharacterBody val = null; if (Object.op_Implicit((Object)(object)self?.projectileController) && Object.op_Implicit((Object)(object)self.projectileController.owner)) { val = self.projectileController.owner.GetComponent(); } float radiusMultiplier = GetRadiusMultiplier(val); if (radiusMultiplier == 1f || self.blastRadius <= 0f) { orig.Invoke(self); return; } float blastRadius = self.blastRadius; PreScaledBlastContext preScaledBlastContext = _preScaledBlastContext; self.blastRadius = blastRadius * radiusMultiplier; _preScaledBlastContext = new PreScaledBlastContext { attacker = self.projectileController.owner, inflictor = ((Component)self).gameObject, radius = self.blastRadius }; try { RiskOfImpactMain.LogDebug($"[Redshifter] ProjectileExplosion: radius {blastRadius:F1} -> {self.blastRadius:F1} for {val.GetDisplayName()}"); orig.Invoke(self); } finally { _preScaledBlastContext = preScaledBlastContext; self.blastRadius = blastRadius; } } private static void DelayBlast_FixedUpdate(orig_FixedUpdate orig, DelayBlast self) { GameObject val = self?.blastAttackOverride?.attacker ?? self?.attacker; float radiusMultiplier = GetRadiusMultiplier(Object.op_Implicit((Object)(object)val) ? val.GetComponent() : null); if (radiusMultiplier == 1f) { orig.Invoke(self); return; } float radius = self.radius; float num = self.blastAttackOverride?.radius ?? 0f; float num2 = self.effectDataOverride?.scale ?? 0f; PreScaledBlastContext preScaledBlastContext = _preScaledBlastContext; bool delayBlastRadiusAlreadyScaled = _delayBlastRadiusAlreadyScaled; self.radius = radius * radiusMultiplier; if (self.blastAttackOverride != null) { self.blastAttackOverride.radius = num * radiusMultiplier; } if (self.effectDataOverride != null) { self.effectDataOverride.scale = num2 * radiusMultiplier; } _preScaledBlastContext = new PreScaledBlastContext { attacker = val, inflictor = (self.blastAttackOverride?.inflictor ?? self.inflictor), radius = (self.blastAttackOverride?.radius ?? self.radius) }; _delayBlastRadiusAlreadyScaled = true; try { orig.Invoke(self); } finally { _delayBlastRadiusAlreadyScaled = delayBlastRadiusAlreadyScaled; _preScaledBlastContext = preScaledBlastContext; self.radius = radius; if (self.blastAttackOverride != null) { self.blastAttackOverride.radius = num; } if (self.effectDataOverride != null) { self.effectDataOverride.scale = num2; } } } private static void DelayBlast_Detonate(orig_Detonate orig, DelayBlast self) { if (_delayBlastRadiusAlreadyScaled) { orig.Invoke(self); return; } GameObject val = self?.blastAttackOverride?.attacker ?? self?.attacker; CharacterBody val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponent() : null); float radiusMultiplier = GetRadiusMultiplier(val2); if (radiusMultiplier == 1f) { orig.Invoke(self); return; } float radius = self.radius; float num = self.blastAttackOverride?.radius ?? 0f; float num2 = self.effectDataOverride?.scale ?? 0f; PreScaledBlastContext preScaledBlastContext = _preScaledBlastContext; self.radius = radius * radiusMultiplier; if (self.blastAttackOverride != null) { self.blastAttackOverride.radius = num * radiusMultiplier; } if (self.effectDataOverride != null) { self.effectDataOverride.scale = num2 * radiusMultiplier; } _preScaledBlastContext = new PreScaledBlastContext { attacker = val, inflictor = (self.blastAttackOverride?.inflictor ?? self.inflictor), radius = (self.blastAttackOverride?.radius ?? self.radius) }; try { RiskOfImpactMain.LogDebug($"[Redshifter] DelayBlast: radius {radius:F1} -> {self.radius:F1} for {val2.GetDisplayName()}"); orig.Invoke(self); } finally { _preScaledBlastContext = preScaledBlastContext; self.radius = radius; if (self.blastAttackOverride != null) { self.blastAttackOverride.radius = num; } if (self.effectDataOverride != null) { self.effectDataOverride.scale = num2; } } } private static void GlobalEventManager_ProcIgniteOnKill(orig_ProcIgniteOnKill orig, DamageReport damageReport, int igniteOnKillCount, CharacterBody victimBody, TeamIndex attackerTeamIndex) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: 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_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0256: 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_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Expected O, but got Unknown CharacterBody attackerBody = damageReport.attackerBody; if (!Object.op_Implicit((Object)(object)attackerBody) || !Object.op_Implicit((Object)(object)victimBody)) { orig.Invoke(damageReport, igniteOnKillCount, victimBody, attackerTeamIndex); return; } float radiusMultiplier = GetRadiusMultiplier(attackerBody); if (radiusMultiplier == 1f) { orig.Invoke(damageReport, igniteOnKillCount, victimBody, attackerTeamIndex); return; } float num = 8f + 4f * (float)igniteOnKillCount + victimBody.radius; float num2 = 1.5f; float baseDamage = attackerBody.damage * num2; Vector3 corePosition = victimBody.corePosition; float num3 = num * radiusMultiplier; GlobalEventManager.igniteOnKillSphereSearch.origin = corePosition; GlobalEventManager.igniteOnKillSphereSearch.mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask; GlobalEventManager.igniteOnKillSphereSearch.radius = num3; GlobalEventManager.igniteOnKillSphereSearch.RefreshCandidates(); GlobalEventManager.igniteOnKillSphereSearch.FilterCandidatesByHurtBoxTeam(TeamMask.GetUnprotectedTeams(attackerTeamIndex)); GlobalEventManager.igniteOnKillSphereSearch.FilterCandidatesByDistinctHurtBoxEntities(); GlobalEventManager.igniteOnKillSphereSearch.OrderCandidatesByDistance(); GlobalEventManager.igniteOnKillSphereSearch.GetHurtBoxes(GlobalEventManager.igniteOnKillHurtBoxBuffer); GlobalEventManager.igniteOnKillSphereSearch.ClearCandidates(); float value = (1f + (float)igniteOnKillCount) * 0.75f * attackerBody.damage; for (int i = 0; i < GlobalEventManager.igniteOnKillHurtBoxBuffer.Count; i++) { HurtBox val = GlobalEventManager.igniteOnKillHurtBoxBuffer[i]; if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.healthComponent)) { InflictDotInfo val2 = new InflictDotInfo { victimObject = ((Component)val.healthComponent).gameObject, attackerObject = damageReport.attacker, totalDamage = value, dotIndex = (DotIndex)1, damageMultiplier = 1f, hitHurtBox = val }; object obj; if (damageReport == null) { obj = null; } else { CharacterMaster attackerMaster = damageReport.attackerMaster; obj = ((attackerMaster != null) ? attackerMaster.inventory : null); } if (Object.op_Implicit((Object)obj)) { StrengthenBurnUtils.CheckDotForUpgrade(damageReport.attackerMaster.inventory, ref val2); } DotController.InflictDot(ref val2); } } GlobalEventManager.igniteOnKillHurtBoxBuffer.Clear(); bool flag = ((ProcChainMask)(ref damageReport.damageInfo.procChainMask)).HasProc((ProcType)26); new BlastAttack { radius = num, baseDamage = baseDamage, procCoefficient = 0f, crit = (flag || Util.CheckRoll(attackerBody.crit, damageReport.attackerMaster)), damageColorIndex = (DamageColorIndex)3, attackerFiltering = (AttackerFiltering)0, falloffModel = (FalloffModel)0, attacker = damageReport.attacker, teamIndex = attackerTeamIndex, position = corePosition }.Fire(); EffectManager.SpawnEffect(CommonAssets.igniteOnKillExplosionEffectPrefab, new EffectData { origin = corePosition, scale = num3, rotation = Util.QuaternionSafeLookRotation(damageReport.damageInfo.force) }, true); RiskOfImpactMain.LogDebug($"[Redshifter] ProcIgniteOnKill: baseRadius={num:F1}, searchRadius={num3:F1}, mult={radiusMultiplier:F2}"); } private static void GlobalEventManager_ProcessHitEnemy(orig_ProcessHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim) { CharacterBody pendingBounceOrbAttackerBody = _pendingBounceOrbAttackerBody; _pendingBounceOrbAttackerBody = (Object.op_Implicit((Object)(object)damageInfo?.attacker) ? damageInfo.attacker.GetComponent() : null); try { orig.Invoke(self, damageInfo, victim); } finally { _pendingBounceOrbAttackerBody = pendingBounceOrbAttackerBody; } } private static void BounceOrb_SearchForTargets(orig_SearchForTargets orig, BullseyeSearch search, TeamIndex teamIndex, Vector3 position, float range, int maxTargets, List dest, List exclusions) { //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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) CharacterBody pendingBounceOrbAttackerBody = _pendingBounceOrbAttackerBody; if (!Object.op_Implicit((Object)(object)pendingBounceOrbAttackerBody) || !Object.op_Implicit((Object)(object)pendingBounceOrbAttackerBody.inventory) || pendingBounceOrbAttackerBody.inventory.GetItemCountEffective(Items.BounceNearby) <= 0) { orig.Invoke(search, teamIndex, position, range, maxTargets, dest, exclusions); return; } float radiusMultiplier = GetRadiusMultiplier(pendingBounceOrbAttackerBody); float num = range * radiusMultiplier; RiskOfImpactMain.LogDebug($"[Redshifter] Meat Hook: range {range:F1} -> {num:F1} for {pendingBounceOrbAttackerBody.GetDisplayName()}"); orig.Invoke(search, teamIndex, position, num, maxTargets, dest, exclusions); } private static HurtBox LightningOrb_PickNextTarget(orig_PickNextTarget orig, LightningOrb self, Vector3 position) { //IL_002c: 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) CharacterBody val = null; if (Object.op_Implicit((Object)(object)self.attacker)) { val = self.attacker.GetComponent(); } float radiusMultiplier = GetRadiusMultiplier(val); if (radiusMultiplier == 1f) { return orig.Invoke(self, position); } float range = self.range; self.range = range * radiusMultiplier; try { RiskOfImpactMain.LogDebug(string.Format("[Redshifter] LightningOrb: range {0:F1} -> {1:F1} on {2}", range, self.range, ((val != null) ? val.GetDisplayName() : null) ?? "")); return orig.Invoke(self, position); } finally { self.range = range; } } private static void GlobalEventManager_OnHitEnemy(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim) { bool pendingIceRingExplosionScale = _pendingIceRingExplosionScale; float pendingIceRingExplosionMult = _pendingIceRingExplosionMult; try { CharacterBody val = (Object.op_Implicit((Object)(object)damageInfo.attacker) ? damageInfo.attacker.GetComponent() : null); float radiusMultiplier = GetRadiusMultiplier(val); if (radiusMultiplier > 1f && Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.inventory)) { bool num = !((ProcChainMask)(ref damageInfo.procChainMask)).HasProc((ProcType)12); bool flag = val.damage > 0f && damageInfo.damage / val.damage >= 4f; bool flag2 = val.HasBuff(Buffs.ElementalRingsReady); if (num && flag && flag2 && val.inventory.GetItemCountEffective(Items.IceRing) > 0) { _pendingIceRingExplosionScale = true; _pendingIceRingExplosionMult = radiusMultiplier; } } orig.Invoke(self, damageInfo, victim); } finally { _pendingIceRingExplosionScale = pendingIceRingExplosionScale; _pendingIceRingExplosionMult = pendingIceRingExplosionMult; } } private static void HealthComponent_TakeDamageProcess(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_01a8: 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] { delegate(Instruction instruction) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) if (!(instruction.OpCode != OpCodes.Ldsfld)) { object operand = instruction.Operand; FieldReference val3 = (FieldReference)((operand is FieldReference) ? operand : null); if (val3 != null) { if (((MemberReference)val3).Name == "NearbyDamageBonus") { TypeReference declaringType = ((MemberReference)((MemberReference)val3).DeclaringType).DeclaringType; return ((declaringType != null) ? ((MemberReference)declaringType).FullName : null) == typeof(RoR2Content).FullName; } return false; } } return false; } }) || !val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instruction) => ILPatternMatchingExt.MatchLdcR4(instruction, 169f) })) { RiskOfImpactMain.LogError("[Redshifter] Focus Crystal hook failed: could not find the 13m proximity threshold in HealthComponent.TakeDamageProcess."); } else { val.Emit(OpCodes.Ldarg_1); val.EmitDelegate>((Func)ScaleFocusCrystalRadiusSqr); } ILCursor val2 = new ILCursor(il); if (!val2.TryGotoNext((MoveType)2, new Func[1] { IsItemCountsThornsField }) || !val2.TryGotoNext((MoveType)2, new Func[1] { IsItemCountsThornsField }) || !val2.TryGotoNext((MoveType)2, new Func[5] { (Instruction instruction) => instruction.OpCode == OpCodes.Ldc_I4_1, (Instruction instruction) => instruction.OpCode == OpCodes.Sub, (Instruction instruction) => instruction.OpCode == OpCodes.Conv_R4, (Instruction instruction) => instruction.OpCode == OpCodes.Mul, (Instruction instruction) => instruction.OpCode == OpCodes.Add })) { RiskOfImpactMain.LogError("[Redshifter] Razorwire hook failed: could not find the item radius calculation in HealthComponent.TakeDamageProcess."); return; } val2.Emit(OpCodes.Ldarg_0); val2.EmitDelegate>((Func)ScaleRazorwireRadius); } private static bool IsItemCountsThornsField(Instruction instruction) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) if (instruction.OpCode == OpCodes.Ldfld) { object operand = instruction.Operand; FieldReference val = (FieldReference)((operand is FieldReference) ? operand : null); if (val != null && ((MemberReference)val).Name == "thorns") { return ((MemberReference)((MemberReference)val).DeclaringType).Name == "ItemCounts"; } } return false; } private static float ScaleFocusCrystalRadiusSqr(float baseRadiusSqr, DamageInfo damageInfo) { float radiusMultiplier = GetRadiusMultiplier(Object.op_Implicit((Object)(object)damageInfo?.attacker) ? damageInfo.attacker.GetComponent() : null); return baseRadiusSqr * radiusMultiplier * radiusMultiplier; } private static float ScaleRazorwireRadius(float baseRadius, HealthComponent healthComponent) { float radiusMultiplier = GetRadiusMultiplier(healthComponent?.body); return baseRadius * radiusMultiplier; } private static void NearbyDamageBonusBodyBehavior_OnEnable(orig_OnEnable orig, NearbyDamageBonusBodyBehavior self) { orig.Invoke(self); UpdateFocusIndicatorScale(self); } private static void OnBodyInventoryChanged(CharacterBody body) { if (!Object.op_Implicit((Object)(object)body)) { return; } NearbyDamageBonusBodyBehavior[] components = ((Component)body).GetComponents(); if (components != null && components.Length != 0) { NearbyDamageBonusBodyBehavior[] array = components; for (int i = 0; i < array.Length; i++) { UpdateFocusIndicatorScale(array[i]); } } UpdateMiredUrnRadiusForBody(body); DroneShockDamageBodyBehavior component = ((Component)body).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { UpdateFaultyConductorAuraVisual(component); } } private static void UpdateFocusIndicatorScale(NearbyDamageBonusBodyBehavior self) { //IL_0079: 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_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) if ((Object)(object)self == (Object)null || (Object)(object)((BaseItemBodyBehavior)self).body == (Object)null || (Object)(object)self.nearbyDamageBonusIndicator == (Object)null) { return; } CharacterBody body = ((BaseItemBodyBehavior)self).body; float radiusMultiplier = GetRadiusMultiplier(body); if (radiusMultiplier != 1f) { GameObject nearbyDamageBonusIndicator = self.nearbyDamageBonusIndicator; Transform transform = nearbyDamageBonusIndicator.transform; FocusIndicatorTracker focusIndicatorTracker = nearbyDamageBonusIndicator.GetComponent(); if (!Object.op_Implicit((Object)(object)focusIndicatorTracker)) { focusIndicatorTracker = nearbyDamageBonusIndicator.gameObject.AddComponent(); focusIndicatorTracker.baseScale = transform.localScale; } transform.localScale = focusIndicatorTracker.baseScale * radiusMultiplier; RiskOfImpactMain.LogDebug($"[Redshifter] Focus Crystal indicator scaled by {radiusMultiplier:F2} on {body.GetDisplayName()}"); } } private static void MushroomBodyBehavior_FixedUpdate(orig_FixedUpdate orig, MushroomBodyBehavior self) { orig.Invoke(self); if (Object.op_Implicit((Object)(object)((BaseItemBodyBehavior)self).body) && !((Object)(object)((BaseItemBodyBehavior)self).body.inventory == (Object)null) && !((Object)(object)self.mushroomHealingWard == (Object)null)) { CharacterBody body = ((BaseItemBodyBehavior)self).body; float radiusMultiplier = GetRadiusMultiplier(body); if (radiusMultiplier != 1f) { float radius = self.mushroomHealingWard.radius; float num = radius * radiusMultiplier; self.mushroomHealingWard.radius = num; self.mushroomHealingWard.Networkradius = num; RiskOfImpactMain.LogDebug($"[Redshifter] Bustling Fungus: radius {radius:F1} -> {num:F1} " + "for " + body.GetDisplayName()); } } } private static void AttackSpeedPerNearbyCollider_UpdateValues(orig_UpdateValues orig, AttackSpeedPerNearbyCollider self, int itemCount, out float diameter) { orig.Invoke(self, itemCount, ref diameter); if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.body)) { float radiusMultiplier = GetRadiusMultiplier(self.body); if (!(radiusMultiplier <= 1f) && !(diameter <= 0f)) { float num = diameter; diameter *= radiusMultiplier; RiskOfImpactMain.LogDebug($"[Redshifter] Bolstering Lantern: diameter {num:F1} -> {diameter:F1} " + "for " + self.body.GetDisplayName()); } } } private static void WardOnLevelManager_OnCharacterLevelUp(orig_OnCharacterLevelUp orig, CharacterBody characterBody) { //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_00af: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || (Object)(object)characterBody == (Object)null) { orig.Invoke(characterBody); return; } Inventory inventory = characterBody.inventory; if (!Object.op_Implicit((Object)(object)inventory)) { orig.Invoke(characterBody); return; } int itemCountEffective = inventory.GetItemCountEffective(Items.WardOnLevel); if (itemCountEffective <= 0) { orig.Invoke(characterBody); return; } float radiusMultiplier = GetRadiusMultiplier(characterBody); if (radiusMultiplier == 1f) { orig.Invoke(characterBody); return; } if (!Object.op_Implicit((Object)(object)WardOnLevelManager.wardPrefab)) { orig.Invoke(characterBody); return; } GameObject obj = Object.Instantiate(WardOnLevelManager.wardPrefab, characterBody.transform.position, Quaternion.identity); TeamFilter component = obj.GetComponent(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)characterBody.teamComponent)) { component.teamIndex = characterBody.teamComponent.teamIndex; } BuffWard component2 = obj.GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { float num = 8f + 8f * (float)itemCountEffective; RiskOfImpactMain.LogDebug(string.Format(arg1: component2.Networkradius = num * radiusMultiplier, format: "[Redshifter] Warbanner: radius {0:F1} -> {1:F1} ", arg0: num) + $"for {characterBody.GetDisplayName()} (warbanners={itemCountEffective}, mult={radiusMultiplier:F2})"); } NetworkServer.Spawn(obj); } private static void GlobalEventManager_OnCharacterDeath(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport) { float pendingDeskPlantRadiusMultiplier = _pendingDeskPlantRadiusMultiplier; _pendingDeskPlantRadiusMultiplier = 1f; try { CharacterBody val = damageReport?.attackerBody; if (NetworkServer.active && Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.inventory) && val.inventory.GetItemCountEffective(Items.Plant) > 0) { _pendingDeskPlantRadiusMultiplier = GetRadiusMultiplier(val); } orig.Invoke(self, damageReport); } finally { _pendingDeskPlantRadiusMultiplier = pendingDeskPlantRadiusMultiplier; } } private static void DeskPlantController_Awake(orig_Awake orig, DeskPlantController self) { orig.Invoke(self); if (!(_pendingDeskPlantRadiusMultiplier <= 1f)) { ((Component)self).gameObject.AddComponent().multiplier = _pendingDeskPlantRadiusMultiplier; } } private static void DeskPlantMainState_OnEnter(orig_OnEnter orig, BaseState baseState) { MainState val = (MainState)(object)((baseState is MainState) ? baseState : null); if (val == null) { orig.Invoke(baseState); return; } DeskPlantController component = ((EntityState)val).GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { orig.Invoke(baseState); return; } DeskPlantRadiusTracker component2 = ((Component)component).GetComponent(); if (Object.op_Implicit((Object)(object)component2) && !component2.applied && component2.multiplier > 1f) { float healingRadius = component.healingRadius; float radiusIncreasePerStack = component.radiusIncreasePerStack; component.healingRadius *= component2.multiplier; component.radiusIncreasePerStack *= component2.multiplier; component2.applied = true; RiskOfImpactMain.LogDebug($"[Redshifter] Desk Plant: baseRadius {healingRadius:F1} -> {component.healingRadius:F1}, " + $"perStack {radiusIncreasePerStack:F1} -> {component.radiusIncreasePerStack:F1} " + $"(mult={component2.multiplier:F2})"); } orig.Invoke(baseState); } private static void IcicleAuraController_UpdateRadius(orig_UpdateRadius orig, IcicleAuraController self) { orig.Invoke(self); if ((Object)(object)self == (Object)null || !Object.op_Implicit((Object)(object)self.owner)) { return; } CharacterBody component = self.owner.GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { return; } float radiusMultiplier = GetRadiusMultiplier(component); if (radiusMultiplier != 1f && !(self.actualRadius <= 0f)) { float actualRadius = self.actualRadius; self.actualRadius *= radiusMultiplier; if ((Object)(object)self.buffWard != (Object)null) { self.buffWard.radius = self.actualRadius; self.buffWard.Networkradius = self.actualRadius; } RiskOfImpactMain.LogDebug($"[Redshifter] Frost Relic: radius {actualRadius:F1} -> {self.actualRadius:F1} " + "for " + component.GetDisplayName()); } } private static void SiphonOnLowHealthItemBodyBehavior_OnEnable(orig_OnEnable orig, SiphonOnLowHealthItemBodyBehavior self) { orig.Invoke(self); if (NetworkServer.active && !((Object)(object)((self != null) ? ((BaseItemBodyBehavior)self).body : null) == (Object)null) && !((Object)(object)self.siphonNearbyController == (Object)null)) { UpdateMiredUrnRadiusForBody(((BaseItemBodyBehavior)self).body, self.siphonNearbyController); } } private static void UpdateMiredUrnRadiusForBody(CharacterBody body) { if (NetworkServer.active && !((Object)(object)body == (Object)null)) { SiphonOnLowHealthItemBodyBehavior component = ((Component)body).GetComponent(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component.siphonNearbyController == (Object)null)) { UpdateMiredUrnRadiusForBody(body, component.siphonNearbyController); } } } private static void UpdateMiredUrnRadiusForBody(CharacterBody body, SiphonNearbyController controller) { if (NetworkServer.active && !((Object)(object)body == (Object)null) && !((Object)(object)controller == (Object)null)) { float radiusMultiplier = GetRadiusMultiplier(body); MiredUrnRadiusTracker miredUrnRadiusTracker = ((Component)controller).GetComponent(); if (!Object.op_Implicit((Object)(object)miredUrnRadiusTracker)) { miredUrnRadiusTracker = ((Component)controller).gameObject.AddComponent(); miredUrnRadiusTracker.baseRadius = controller.radius; } float radius = body.radius; float num = (miredUrnRadiusTracker.baseRadius + radius) * radiusMultiplier - radius; if (!Mathf.Approximately(controller.radius, num)) { float radius2 = controller.radius; controller.radius = num; controller.Networkradius = num; RiskOfImpactMain.LogDebug($"[Redshifter] Mired Urn: effective radius {radius2 + radius:F1} -> " + $"{num + radius:F1} for {body.GetDisplayName()}"); } } } private static void HelfireController_FixedUpdate(orig_FixedUpdate orig, HelfireController self) { float radiusMultiplier = GetRadiusMultiplier(Object.op_Implicit((Object)(object)((self != null) ? self.networkedBodyAttachment : null)) ? self.networkedBodyAttachment.attachedBody : null); if (radiusMultiplier == 1f) { orig.Invoke(self); return; } float baseRadius = self.baseRadius; self.baseRadius = baseRadius * radiusMultiplier; try { orig.Invoke(self); } finally { self.baseRadius = baseRadius; } } private static bool DefenseMatrixOn_DeleteNearbyProjectile(orig_DeleteNearbyProjectile orig, DefenseMatrixOn self) { float radiusMultiplier = GetRadiusMultiplier((self != null) ? ((BaseBodyAttachmentState)self).attachedBody : null); if (radiusMultiplier == 1f) { return orig.Invoke(self); } float projectileEraserRadius = DefenseMatrixOn.projectileEraserRadius; DefenseMatrixOn.projectileEraserRadius = projectileEraserRadius * radiusMultiplier; try { return orig.Invoke(self); } finally { DefenseMatrixOn.projectileEraserRadius = projectileEraserRadius; } } private static HurtBox ProjectileProximityBeamController_FindNextTarget(orig_FindNextTarget orig, ProjectileProximityBeamController self, Vector3 position, Vector3 forward) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) int projectileIndex = GetProjectileIndex(ref _beamSphereProjectileIndex, "BeamSphere"); if (projectileIndex < 0 || !Object.op_Implicit((Object)(object)self?.projectileController) || ProjectileCatalog.GetProjectileIndex(self.projectileController) != projectileIndex) { return orig.Invoke(self, position, forward); } float radiusMultiplier = GetRadiusMultiplier(Object.op_Implicit((Object)(object)self.projectileController.owner) ? self.projectileController.owner.GetComponent() : null); if (radiusMultiplier == 1f) { return orig.Invoke(self, position, forward); } float attackRange = self.attackRange; self.attackRange = attackRange * radiusMultiplier; try { return orig.Invoke(self, position, forward); } finally { self.attackRange = attackRange; } } private static void RadialForce_FixedUpdate(orig_FixedUpdate orig, RadialForce self) { ProjectileController val = (Object.op_Implicit((Object)(object)self) ? ((Component)self).GetComponentInParent() : null); int projectileIndex = GetProjectileIndex(ref _gravSphereProjectileIndex, "GravSphere"); if (projectileIndex < 0 || !Object.op_Implicit((Object)(object)val) || ProjectileCatalog.GetProjectileIndex(val) != projectileIndex) { orig.Invoke(self); return; } float radiusMultiplier = GetRadiusMultiplier(Object.op_Implicit((Object)(object)val.owner) ? val.owner.GetComponent() : null); if (radiusMultiplier == 1f) { orig.Invoke(self); return; } float radius = self.radius; self.radius = radius * radiusMultiplier; try { orig.Invoke(self); } finally { self.radius = radius; } } private static void FireMainBeamState_FireBeamServer(orig_FireBeamServer orig, FireMainBeamState self, Ray aimRay, GameObject tracerEffectPrefab, float maxDistance, bool isInitialBeam) { //IL_001c: 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) float radiusMultiplier = GetRadiusMultiplier((self != null) ? ((LaserTurbineBaseState)self).ownerBody : null); if (radiusMultiplier == 1f) { orig.Invoke(self, aimRay, tracerEffectPrefab, maxDistance, isInitialBeam); return; } float mainBeamRadius = FireMainBeamState.mainBeamRadius; float mainBeamMaxDistance = FireMainBeamState.mainBeamMaxDistance; FireMainBeamState.mainBeamRadius = mainBeamRadius * radiusMultiplier; if (isInitialBeam) { FireMainBeamState.mainBeamMaxDistance = mainBeamMaxDistance * radiusMultiplier; } try { float num = (isInitialBeam ? (maxDistance * radiusMultiplier) : maxDistance); orig.Invoke(self, aimRay, tracerEffectPrefab, num, isInitialBeam); } finally { FireMainBeamState.mainBeamRadius = mainBeamRadius; FireMainBeamState.mainBeamMaxDistance = mainBeamMaxDistance; } } private static int GetProjectileIndex(ref int cachedIndex, string projectileName) { if (cachedIndex == -2) { cachedIndex = ProjectileCatalog.FindProjectileIndex(projectileName); if (cachedIndex < 0) { RiskOfImpactMain.LogError("[Redshifter] Projectile support disabled: could not find '" + projectileName + "' in ProjectileCatalog."); } } return cachedIndex; } private static void CharacterBody_TriggerEnemyDebuffs(orig_TriggerEnemyDebuffs orig, CharacterBody self, DamageReport damageReport) { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: 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_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_01c9: 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_01df: 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_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0206: 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_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0167: 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_0189: 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_0136: 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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)self) || (Object)(object)self.inventory == (Object)null || damageReport == null || (Object)(object)damageReport.victimBody == (Object)null) { orig.Invoke(self, damageReport); RiskOfImpactMain.LogDebug("[Redshifter] Noxious Thorn: Original ran only"); return; } int itemCountEffective = self.inventory.GetItemCountEffective(Items.TriggerEnemyDebuffs); if (itemCountEffective == 0) { orig.Invoke(self, damageReport); RiskOfImpactMain.LogDebug("[Redshifter] Noxious Thorn: No thorn item detected, original ran"); return; } float radiusMultiplier = GetRadiusMultiplier(self); if (Mathf.Approximately(radiusMultiplier, 1f)) { orig.Invoke(self, damageReport); RiskOfImpactMain.LogDebug("[Redshifter] Noxious Thorn: No redshifter detected, original ran"); return; } List list = new List(); _ = damageReport.damageInfo; DotController val = DotController.FindDotController(((Component)damageReport.victimBody).gameObject); BuffIndex[] debuffAndDotsIndicesExcludingNoxiousThorns = BuffCatalog.debuffAndDotsIndicesExcludingNoxiousThorns; foreach (BuffIndex val2 in debuffAndDotsIndicesExcludingNoxiousThorns) { BuffDef buffDef = BuffCatalog.GetBuffDef(val2); int buffCount = damageReport.victimBody.GetBuffCount(buffDef); if (buffCount > 0) { int count = Mathf.CeilToInt((float)buffCount * 0.33f); bool isTimed = false; float duration = 0f; if (buffDef.isDOT && (Object)(object)val != (Object)null) { DotIndex dotDefIndex = DotController.GetDotDefIndex(buffDef); DotController.GetDotDef(dotDefIndex); isTimed = val.GetDotStackTotalDurationForIndex(dotDefIndex, ref duration); } else if (buffDef.isDebuff) { isTimed = damageReport.victimBody.GetTimedBuffTotalDurationForIndex(val2, ref duration); } SplitDebuffInformation item = new SplitDebuffInformation { attacker = ((Component)self).gameObject, attackerMaster = self.master, index = val2, isTimed = isTimed, duration = duration, count = count }; list.Add(item); } } if (list.Count == 0) { return; } SphereSearch val3 = new SphereSearch(); List list2 = CollectionPool>.RentCollection(); val3.mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask; val3.origin = ((Component)damageReport.victimBody).gameObject.transform.position; float num = 20f + 5f * (float)(itemCountEffective - 1); float num2 = (val3.radius = num * radiusMultiplier); val3.queryTriggerInteraction = (QueryTriggerInteraction)0; val3.RefreshCandidates(); val3.FilterCandidatesByHurtBoxTeam(TeamMask.GetEnemyTeams(self.teamComponent.teamIndex)); val3.OrderCandidatesByDistance(); val3.FilterCandidatesByDistinctHurtBoxEntities(); val3.GetHurtBoxes(list2); val3.ClearCandidates(); int num3 = itemCountEffective; for (int j = 0; j < list2.Count; j++) { HurtBox val4 = list2[j]; CharacterBody body = val4.healthComponent.body; if (Object.op_Implicit((Object)(object)val4) && Object.op_Implicit((Object)(object)val4.healthComponent) && val4.healthComponent.alive && (Object)(object)body != (Object)(object)damageReport.victimBody && (Object)(object)body != (Object)(object)self) { self.CreateVineOrbChain(((Component)damageReport.victimBody).gameObject, val4, list); num3--; if (num3 == 0) { CollectionPool>.ReturnCollection(list2); RiskOfImpactMain.LogDebug($"[Redshifter] Noxious Thorn: radius {num:F1} -> {num2:F1} " + $"for {self.GetDisplayName()} (thornStacks={itemCountEffective}, mult={radiusMultiplier:F2}) " + "(early exit after hitting max targets)"); return; } } } CollectionPool>.ReturnCollection(list2); RiskOfImpactMain.LogDebug($"[Redshifter] Noxious Thorn: radius {num:F1} -> {num2:F1} " + $"for {self.GetDisplayName()} (thornStacks={itemCountEffective}, mult={radiusMultiplier:F2})"); } private static float JumpDamageStrikeBodyBehavior_GetRadius(orig_GetRadius orig, JumpDamageStrikeBodyBehavior self, int charge, int stacks) { float num = orig.Invoke(self, charge, stacks); if (num <= 0f || (Object)(object)self == (Object)null || (Object)(object)((BaseItemBodyBehavior)self).body == (Object)null) { return num; } float radiusMultiplier = GetRadiusMultiplier(((BaseItemBodyBehavior)self).body); if (radiusMultiplier == 1f) { return num; } return num * radiusMultiplier; } private static void EffectManager_SpawnEffect_GameObject(orig_SpawnEffect_GameObject_EffectData_bool orig, GameObject effectPrefab, EffectData effectData, bool transmit) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) try { if (Object.op_Implicit((Object)(object)effectPrefab) && effectData != null) { if ((Object)(object)effectPrefab == (Object)(object)AssetReferences.shieldBoosterBreakPrefab || (Object)(object)effectPrefab == (Object)(object)AssetReferences.shieldBoosterBreakVoidPrefab) { CharacterBody val = FindClosestBody(effectData.origin, 3f); if (Object.op_Implicit((Object)(object)val) && (Object)(object)val.inventory != (Object)null) { float radiusMultiplier = GetRadiusMultiplier(val); if (radiusMultiplier > 1f) { float scale = effectData.scale; effectData.scale *= radiusMultiplier; RiskOfImpactMain.LogDebug($"[Redshifter] Kinetic Dampener visual: scale {scale:0.###} -> {effectData.scale:0.###} for {val.GetDisplayName()} (mult={radiusMultiplier:0.00})"); } } } if ((Object)(object)effectPrefab == (Object)(object)CommonAssets.shockDamagePulseEffect) { CharacterBody val2 = FindClosestBody(effectData.origin, 3f); if (Object.op_Implicit((Object)(object)val2) && (Object)(object)val2.inventory != (Object)null) { float radiusMultiplier2 = GetRadiusMultiplier(val2); if (radiusMultiplier2 > 1f) { float scale2 = effectData.scale; effectData.scale *= radiusMultiplier2; RiskOfImpactMain.LogDebug($"[Redshifter] Faulty Conductor pulse: scale {scale2:0.###} -> {effectData.scale:0.###} for {val2.GetDisplayName()} (mult={radiusMultiplier2:0.00})"); } } } if (_pendingIceRingExplosionScale && Object.op_Implicit((Object)(object)effectPrefab) && ((Object)effectPrefab).name == "IceRingExplosion") { effectData.scale *= _pendingIceRingExplosionMult; RiskOfImpactMain.LogDebug($"[Redshifter] IceRingExplosion visual scale *= {_pendingIceRingExplosionMult:0.##}"); } } } catch (Exception arg) { RiskOfImpactMain.LogWarning($"[Redshifter] EffectManager_SpawnEffect exception: {arg}"); } orig.Invoke(effectPrefab, effectData, transmit); } private static CharacterBody FindClosestBody(Vector3 pos, float maxDist) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) CharacterBody result = null; float num = maxDist * maxDist; ReadOnlyCollection readOnlyInstancesList = CharacterBody.readOnlyInstancesList; for (int i = 0; i < readOnlyInstancesList.Count; i++) { CharacterBody val = readOnlyInstancesList[i]; if (Object.op_Implicit((Object)(object)val)) { Vector3 val2 = val.transform.position - pos; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude <= num) { num = sqrMagnitude; result = val; } } } return result; } private static void DroneShockDamageBodyBehavior_Start(orig_Start orig, DroneShockDamageBodyBehavior self) { orig.Invoke(self); UpdateFaultyConductorAuraVisual(self); } private static void DroneShockDamageBodyBehavior_TriggerEnergize(orig_TriggerEnergize orig, DroneShockDamageBodyBehavior self) { CharacterBody val = ((self != null) ? ((BaseItemBodyBehavior)self).body : null); float radiusMultiplier = GetRadiusMultiplier(val); if (radiusMultiplier == 1f) { orig.Invoke(self); return; } float radius = DroneShockDamageBodyBehavior.radius; DroneShockDamageBodyBehavior.radius = radius * radiusMultiplier; try { orig.Invoke(self); } finally { DroneShockDamageBodyBehavior.radius = radius; } RiskOfImpactMain.LogDebug(string.Format("[Redshifter] Faulty Conductor: search radius {0:F1} -> {1:F1} for {2} (mult={3:F2})", radius, radius * radiusMultiplier, ((val != null) ? val.GetDisplayName() : null) ?? "?", radiusMultiplier)); } private static void UpdateFaultyConductorAuraVisual(DroneShockDamageBodyBehavior beh) { //IL_006b: 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_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) if (!((Object)(object)beh == (Object)null) && !((Object)(object)((BaseItemBodyBehavior)beh).body == (Object)null) && Object.op_Implicit((Object)(object)beh.auraInstance)) { float radiusMultiplier = GetRadiusMultiplier(((BaseItemBodyBehavior)beh).body); Transform transform = beh.auraInstance.transform; FaultyConductorAuraScaleTracker faultyConductorAuraScaleTracker = beh.auraInstance.GetComponent(); if (!Object.op_Implicit((Object)(object)faultyConductorAuraScaleTracker)) { faultyConductorAuraScaleTracker = beh.auraInstance.AddComponent(); faultyConductorAuraScaleTracker.baseScale = transform.localScale; } transform.localScale = faultyConductorAuraScaleTracker.baseScale * radiusMultiplier; } } private static void ApplyScaledLocalScale(Transform t, float mult) { //IL_003a: 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_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) if (Object.op_Implicit((Object)(object)t) && mult != 1f) { RedshifterScaleTracker redshifterScaleTracker = ((Component)t).GetComponent(); if (!Object.op_Implicit((Object)(object)redshifterScaleTracker)) { redshifterScaleTracker = ((Component)t).gameObject.AddComponent(); redshifterScaleTracker.baseScale = t.localScale; } t.localScale = redshifterScaleTracker.baseScale * mult; } } private static void ProjectileController_Start(orig_Start orig, ProjectileController self) { orig.Invoke(self); if (!Object.op_Implicit((Object)(object)self) || !Object.op_Implicit((Object)(object)self.owner)) { return; } float radiusMultiplier = GetRadiusMultiplier(self.owner.GetComponent()); if (!(radiusMultiplier <= 1f)) { string name = ((Object)((Component)self).gameObject).name; bool num = name.StartsWith("FireTornado"); bool flag = name.StartsWith("ElementalRingVoidBlackHole"); if (num || flag) { ApplyScaledLocalScale(((Component)self).transform, radiusMultiplier); MultiplyRadiusLikeFields(((Component)self).gameObject, radiusMultiplier); RiskOfImpactMain.LogDebug($"[Redshifter] Rings projectile scaled: {name} mult={radiusMultiplier:0.##}"); } } } private static void MultiplyRadiusLikeFields(GameObject go, float mult) { Component[] componentsInChildren = go.GetComponentsInChildren(true); foreach (Component val in componentsInChildren) { if (!Object.op_Implicit((Object)(object)val)) { continue; } Type type = ((object)val).GetType(); string[] radiusFieldNames = _radiusFieldNames; foreach (string name in radiusFieldNames) { FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (!(field == null) && !(field.FieldType != typeof(float))) { float num = (float)field.GetValue(val); if (!(num <= 0f)) { field.SetValue(val, num * mult); } } } } } private static void ProjectileGhostController_Start(orig_Start orig, ProjectileGhostController self) { orig.Invoke(self); if (!Object.op_Implicit((Object)(object)self)) { return; } string name = ((Object)((Component)self).gameObject).name; if (!name.Contains("FireTornadoGhost") && !name.Contains("ElementalRingVoidBlackHole")) { return; } Transform val = (Object.op_Implicit((Object)(object)self.authorityTransform) ? self.authorityTransform : self.predictionTransform); if (!Object.op_Implicit((Object)(object)val)) { return; } ProjectileController componentInParent = ((Component)val).GetComponentInParent(); if (!Object.op_Implicit((Object)(object)componentInParent) || !Object.op_Implicit((Object)(object)componentInParent.owner)) { return; } CharacterBody component = componentInParent.owner.GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { return; } float radiusMultiplier = GetRadiusMultiplier(component); if (!(radiusMultiplier <= 1f)) { self.inheritScaleFromProjectile = true; ApplyScaledLocalScale(self.transform, radiusMultiplier); if (name.Contains("FireTornadoGhost")) { FixFireTornadoGhostVisuals(((Component)self).gameObject, radiusMultiplier); } RiskOfImpactMain.LogDebug($"[Redshifter] Ring ghost scaled: {name} mult={radiusMultiplier:0.##} for {component.GetDisplayName()}"); } } private static void FixFireTornadoGhostVisuals(GameObject ghostRoot, float mult) { //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_0036: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)ghostRoot) || mult == 1f) { return; } ParticleSystem[] componentsInChildren = ghostRoot.GetComponentsInChildren(true); foreach (ParticleSystem val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val)) { MainModule main = val.main; if ((int)((MainModule)(ref main)).scalingMode != 0) { ((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)0; } } } LineRenderer[] componentsInChildren2 = ghostRoot.GetComponentsInChildren(true); foreach (LineRenderer val2 in componentsInChildren2) { if (Object.op_Implicit((Object)(object)val2)) { val2.widthMultiplier *= mult; } } TrailRenderer[] componentsInChildren3 = ghostRoot.GetComponentsInChildren(true); foreach (TrailRenderer val3 in componentsInChildren3) { if (Object.op_Implicit((Object)(object)val3)) { val3.widthMultiplier *= mult; } } MultiplyRadiusLikeFields(ghostRoot, mult); } private static void RandomDamageZoneBodyBehavior_FixedUpdate(orig_FixedUpdate orig, RandomDamageZoneBodyBehavior self) { if ((Object)(object)self == (Object)null || (Object)(object)((BaseItemBodyBehavior)self).body == (Object)null) { orig.Invoke(self); return; } float radiusMultiplier = GetRadiusMultiplier(((BaseItemBodyBehavior)self).body); if (radiusMultiplier <= 1f) { orig.Invoke(self); return; } CharacterMaster master = ((BaseItemBodyBehavior)self).body.master; bool flag = Object.op_Implicit((Object)(object)master) && master.IsDeployableSlotAvailable((DeployableSlot)9); float baseWardRadius = RandomDamageZoneBodyBehavior.baseWardRadius; RandomDamageZoneBodyBehavior.baseWardRadius = baseWardRadius * radiusMultiplier; try { orig.Invoke(self); } finally { RandomDamageZoneBodyBehavior.baseWardRadius = baseWardRadius; } bool flag2 = Object.op_Implicit((Object)(object)master) && master.IsDeployableSlotAvailable((DeployableSlot)9); if (flag && !flag2) { RiskOfImpactMain.LogDebug($"[Redshifter] Mercurial Rachis: baseWardRadius {baseWardRadius:F1} -> {baseWardRadius * radiusMultiplier:F1} " + $"for {((BaseItemBodyBehavior)self).body.GetDisplayName()} (mult={radiusMultiplier:F2})"); } } private static void HoldoutZoneController_Awake(orig_Awake orig, HoldoutZoneController self) { orig.Invoke(self); if (Object.op_Implicit((Object)(object)self) && !Object.op_Implicit((Object)(object)((Component)self).GetComponent())) { ((Component)self).gameObject.AddComponent(); } } private static void KillZoneController_Awake(orig_Awake orig, KillZoneController self) { orig.Invoke(self); if (Object.op_Implicit((Object)(object)self) && !Object.op_Implicit((Object)(object)((Component)self).GetComponent())) { ((Component)self).gameObject.AddComponent(); } } private static float GetMaxRedshifterMultiplierOnTeam(TeamIndex teamIndex) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) float num = 1f; ReadOnlyCollection teamMembers = TeamComponent.GetTeamMembers(teamIndex); for (int i = 0; i < teamMembers.Count; i++) { CharacterBody body = teamMembers[i].body; if (Object.op_Implicit((Object)(object)body) && body.isPlayerControlled && !body.isRemoteOp && Object.op_Implicit((Object)(object)body.inventory)) { float radiusMultiplier = GetRadiusMultiplier(body); if (radiusMultiplier > num) { num = radiusMultiplier; } } } return num; } } public static class RiskyDiceHooks { private sealed class PendingChestBonus : MonoBehaviour { public int bonus; } private sealed class RiskyDiceTracker : MonoBehaviour { public int pendingChanceShrineBonus; } public static int MisfortuneRollOutOf = 20; public static int MisfortuneRollHit = 0; public const int DeathRisk = 20; public static int Band1TonicAfflictionStacks = 2; public static int Band2TonicAfflictionStacks = 4; private static bool _initialized; private const string MisfortuneSoundEvent = "Play_UI_menuCancel"; private const string MisfortuneEffectPrefabPath = "Prefabs/Effects/OmniEffect/OmniImpactVFX"; public static bool DebugLogs => RiskOfImpactMain.DebugMode; public static void Init() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown if (!_initialized) { _initialized = true; CharacterBody.onBodyStartGlobal += OnBodyStartGlobal; CharacterBody.OnInventoryChanged += new hook_OnInventoryChanged(CharacterBody_OnInventoryChanged); PurchaseInteraction.OnInteractionBegin += new hook_OnInteractionBegin(PurchaseInteraction_OnInteractionBegin); ChestBehavior.Open += new hook_Open(ChestBehavior_Open); ShrineChanceBehavior.AddShrineStack += new hook_AddShrineStack(ShrineChanceBehavior_AddShrineStack); RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(ApplyMisfortuneAffliction); LogI("[RiskyDice] Hooks initialized."); } } public static void Cleanup() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown if (_initialized) { _initialized = false; CharacterBody.onBodyStartGlobal -= OnBodyStartGlobal; CharacterBody.OnInventoryChanged -= new hook_OnInventoryChanged(CharacterBody_OnInventoryChanged); PurchaseInteraction.OnInteractionBegin -= new hook_OnInteractionBegin(PurchaseInteraction_OnInteractionBegin); ChestBehavior.Open -= new hook_Open(ChestBehavior_Open); ShrineChanceBehavior.AddShrineStack -= new hook_AddShrineStack(ShrineChanceBehavior_AddShrineStack); RecalculateStatsAPI.GetStatCoefficients -= new StatHookEventHandler(ApplyMisfortuneAffliction); LogI("[RiskyDice] Hooks cleaned up."); } } private static void OnBodyStartGlobal(CharacterBody body) { if (NetworkServer.active && Object.op_Implicit((Object)(object)body)) { Inventory inventory = body.inventory; if (Object.op_Implicit((Object)(object)inventory)) { SyncRiskBuff(body, inventory); } } } private static void CharacterBody_OnInventoryChanged(orig_OnInventoryChanged orig, CharacterBody self) { orig.Invoke(self); if (NetworkServer.active && Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.inventory)) { SyncRiskBuff(self, self.inventory); } } private static void PurchaseInteraction_OnInteractionBegin(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator) { //IL_0208: 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_020d: 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) if (!NetworkServer.active) { orig.Invoke(self, activator); return; } if (!Object.op_Implicit((Object)(object)self) || !Object.op_Implicit((Object)(object)activator)) { orig.Invoke(self, activator); return; } CharacterBody component = ((Component)activator).GetComponent(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.master)) { orig.Invoke(self, activator); return; } Inventory inventory = component.inventory; if (!Object.op_Implicit((Object)(object)inventory)) { orig.Invoke(self, activator); return; } ChestBehavior component2 = ((Component)self).GetComponent(); ShrineChanceBehavior component3 = ((Component)self).GetComponent(); bool flag = (Object)(object)component2 != (Object)null; bool flag2 = (Object)(object)component3 != (Object)null; if (!flag && !flag2) { orig.Invoke(self, activator); return; } ItemDef riskyDiceItemDef = RiskOfImpactContent.GetRiskyDiceItemDef(); ItemDef riskyDiceCountItemDef = RiskOfImpactContent.GetRiskyDiceCountItemDef(); BuffDef riskyDiceBuffDef = RiskOfImpactContent.GetRiskyDiceBuffDef(); if ((Object)(object)riskyDiceItemDef == (Object)null || (Object)(object)riskyDiceCountItemDef == (Object)null || (Object)(object)riskyDiceBuffDef == (Object)null) { orig.Invoke(self, activator); return; } int itemCountEffective = inventory.GetItemCountEffective(riskyDiceItemDef); if (itemCountEffective <= 0) { orig.Invoke(self, activator); return; } SyncRiskBuff(component, inventory, riskyDiceCountItemDef, riskyDiceBuffDef); int num = inventory.GetItemCountEffective(riskyDiceCountItemDef); int num2 = 0; bool flag3 = false; int riskAtMoment = num; for (int i = 0; i < itemCountEffective; i++) { int num3 = (((Object)(object)Run.instance != (Object)null) ? Run.instance.treasureRng.RangeInt(0, MisfortuneRollOutOf) : Random.Range(0, MisfortuneRollOutOf)); bool flag4 = num3 == MisfortuneRollHit; if (DebugLogs) { LogI($"[RiskyDice] {((Object)self).name} user={component.GetDisplayName()} rollIdx={i + 1}/{itemCountEffective} riskNow={num} roll={num3}/{MisfortuneRollOutOf - 1} misfortune={flag4}"); } if (flag4) { riskAtMoment = num; flag3 = true; break; } num2++; num++; } if (flag3) { SpendCostOnly(self, activator); Vector3 pos = (Object.op_Implicit((Object)(object)component) ? component.corePosition : ((Component)self).transform.position); PlayMisfortuneFeedback(((Component)self).gameObject, pos); ApplyMisfortune(component, inventory, riskAtMoment); ResetRisk(inventory, component, riskyDiceCountItemDef, riskyDiceBuffDef); ClearPendingChanceBonus(component.master); return; } if (num2 > 0) { inventory.GiveItemPermanent(riskyDiceCountItemDef, num2); } int num4 = num2; if (num4 > 0) { if (flag) { AddOrSetPendingChestBonus(((Component)component2).gameObject, num4); if (DebugLogs) { LogI($"[RiskyDice] Pending chest bonus refreshed => +{num4} on {((Object)component2).name}"); } } else if (flag2) { SetPendingChanceBonus(component.master, num4); if (DebugLogs) { LogI($"[RiskyDice] ShrineChance pending bonus refreshed => +{num4} for {component.GetDisplayName()}"); } } } if (flag2) { float failureChance = component3.failureChance; component3.failureChance = -1f; try { orig.Invoke(self, activator); } finally { component3.failureChance = failureChance; } } else { orig.Invoke(self, activator); } SyncRiskBuff(component, inventory, riskyDiceCountItemDef, riskyDiceBuffDef); } private static void AddOrSetPendingChestBonus(GameObject go, int bonus) { PendingChestBonus pendingChestBonus = go.GetComponent(); if (!Object.op_Implicit((Object)(object)pendingChestBonus)) { pendingChestBonus = go.AddComponent(); } pendingChestBonus.bonus = bonus; } private static int ConsumePendingChestBonus(Component obj) { if (!Object.op_Implicit((Object)(object)obj)) { return 0; } PendingChestBonus component = obj.GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { return 0; } int bonus = component.bonus; component.bonus = 0; return bonus; } private static void ChestBehavior_Open(orig_Open orig, ChestBehavior self) { if (!NetworkServer.active) { orig.Invoke(self); return; } int num = ConsumePendingChestBonus((Component)(object)self); if (num > 0) { int dropCount = self.dropCount; self.dropCount = dropCount + num; if (DebugLogs) { LogI($"[RiskyDice] ChestBehavior.Open: dropCount {dropCount} -> {self.dropCount} (+{num}) on {((Object)self).name}"); } } orig.Invoke(self); } private static void ShrineChanceBehavior_AddShrineStack(orig_AddShrineStack orig, ShrineChanceBehavior self, Interactor activator) { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { orig.Invoke(self, activator); return; } int successfulPurchaseCount = self.successfulPurchaseCount; CharacterBody val = (Object.op_Implicit((Object)(object)activator) ? ((Component)activator).GetComponent() : null); CharacterMaster val2 = (Object.op_Implicit((Object)(object)val) ? val.master : null); orig.Invoke(self, activator); if (!Object.op_Implicit((Object)(object)val2) || self.successfulPurchaseCount <= successfulPurchaseCount) { return; } int pendingChanceBonus = GetPendingChanceBonus(val2); if (pendingChanceBonus <= 0) { return; } if ((Object)(object)self.dropTable != (Object)null && self.rng != null && (Object)(object)self.dropletOrigin != (Object)null) { Vector3 position = self.dropletOrigin.position; Vector3 val3 = self.dropletOrigin.forward * 20f; for (int i = 0; i < pendingChanceBonus; i++) { PickupDropletController.CreatePickupDroplet(self.dropTable.GeneratePickup(self.rng), position, val3); } if (DebugLogs) { LogI($"[RiskyDice] ShrineChance SUCCESS: spawned +{pendingChanceBonus} extra drops for {val2.GetBody().GetDisplayName()}"); } } ClearPendingChanceBonus(val2); } private static void ApplyMisfortune(CharacterBody body, Inventory inv, int riskAtMoment) { if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)inv)) { if (DebugLogs) { LogI($"[RiskyDice] MISFORTUNE triggered at risk={riskAtMoment} user={body.GetDisplayName()}"); } inv.GiveItemPermanent(RiskOfImpactContent.GetRiskyDiceAfflictionItemDef(), riskAtMoment); if (riskAtMoment >= 20) { ForceKill(body); } } } private static void ApplyMisfortuneAffliction(CharacterBody body, StatHookEventArgs args) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.inventory)) { int itemCountPermanent = body.inventory.GetItemCountPermanent(RiskOfImpactContent.GetRiskyDiceAfflictionItemDef()._itemIndex); if (itemCountPermanent > 0) { float num = 0.4f; float num2 = 0.05f * num; float num3 = 0.1f * num; float num4 = Mathf.Pow(1f - num2, (float)itemCountPermanent); args.damageTotalMult *= num4; args.moveSpeedTotalMult *= num4; args.attackSpeedTotalMult *= num4; args.regenTotalMult *= num4; args.armorTotalMult *= num4; args.baseCurseAdd += num3 * (float)itemCountPermanent; } } } private static void ResetRisk(Inventory inv, CharacterBody body, ItemDef riskCountDef, BuffDef riskBuffDef) { if ((Object)(object)riskCountDef != (Object)null) { int itemCountPermanent = inv.GetItemCountPermanent(riskCountDef); if (itemCountPermanent > 0) { inv.RemoveItemPermanent(riskCountDef, itemCountPermanent); } } SyncRiskBuff(body, inv, riskCountDef, riskBuffDef); } private static void SyncRiskBuff(CharacterBody body, Inventory inv) { ItemDef riskyDiceItemDef = RiskOfImpactContent.GetRiskyDiceItemDef(); ItemDef riskyDiceCountItemDef = RiskOfImpactContent.GetRiskyDiceCountItemDef(); BuffDef riskyDiceBuffDef = RiskOfImpactContent.GetRiskyDiceBuffDef(); SyncRiskBuff(body, inv, riskyDiceItemDef, riskyDiceCountItemDef, riskyDiceBuffDef); } private static void SyncRiskBuff(CharacterBody body, Inventory inv, ItemDef riskItemDef, ItemDef riskCountDef, BuffDef riskBuffDef) { if (!NetworkServer.active || !Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)inv) || (Object)(object)riskItemDef == (Object)null || (Object)(object)riskCountDef == (Object)null || (Object)(object)riskBuffDef == (Object)null) { return; } if (inv.GetItemCountEffective(riskItemDef) <= 0) { int itemCountPermanent = inv.GetItemCountPermanent(riskCountDef); body.inventory.RemoveItemPermanent(riskCountDef, itemCountPermanent); int buffCount = body.GetBuffCount(riskBuffDef); for (int i = 0; i < buffCount; i++) { body.RemoveBuff(riskBuffDef); } } SyncRiskBuff(body, inv, riskCountDef, riskBuffDef); } private static void SyncRiskBuff(CharacterBody body, Inventory inv, ItemDef riskCountDef, BuffDef riskBuffDef) { if (NetworkServer.active && Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)inv) && !((Object)(object)riskCountDef == (Object)null) && !((Object)(object)riskBuffDef == (Object)null)) { int itemCountEffective = inv.GetItemCountEffective(riskCountDef); int i; for (i = body.GetBuffCount(riskBuffDef); i < itemCountEffective; i++) { body.AddBuff(riskBuffDef); } while (i > itemCountEffective) { body.RemoveBuff(riskBuffDef); i--; } } } private static void ForceKill(CharacterBody body) { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_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_0084: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.healthComponent)) { HealthComponent healthComponent = body.healthComponent; DamageInfo val = new DamageInfo { attacker = null, inflictor = null, crit = false, damage = healthComponent.fullCombinedHealth * 1000f, position = body.corePosition, force = Vector3.zero, procCoefficient = 0f, damageColorIndex = (DamageColorIndex)9, damageType = DamageTypeCombo.op_Implicit((DamageType)262210) }; healthComponent.TakeDamage(val); healthComponent.Suicide((GameObject)null, (GameObject)null, DamageTypeCombo.op_Implicit((DamageType)2)); } } private static RiskyDiceTracker GetOrAddTracker(CharacterMaster master) { if (!Object.op_Implicit((Object)(object)master)) { return null; } GameObject gameObject = ((Component)master).gameObject; RiskyDiceTracker riskyDiceTracker = gameObject.GetComponent(); if (!Object.op_Implicit((Object)(object)riskyDiceTracker)) { riskyDiceTracker = gameObject.AddComponent(); } return riskyDiceTracker; } private static void SetPendingChanceBonus(CharacterMaster master, int bonus) { RiskyDiceTracker orAddTracker = GetOrAddTracker(master); if (Object.op_Implicit((Object)(object)orAddTracker)) { orAddTracker.pendingChanceShrineBonus = bonus; } } private static int GetPendingChanceBonus(CharacterMaster master) { RiskyDiceTracker orAddTracker = GetOrAddTracker(master); if (!Object.op_Implicit((Object)(object)orAddTracker)) { return 0; } return orAddTracker.pendingChanceShrineBonus; } private static void ClearPendingChanceBonus(CharacterMaster master) { RiskyDiceTracker orAddTracker = GetOrAddTracker(master); if (Object.op_Implicit((Object)(object)orAddTracker)) { orAddTracker.pendingChanceShrineBonus = 0; } } private static void LogI(string msg) { if ((Object)(object)RiskOfImpactMain.instance != (Object)null) { RiskOfImpactMain.LogInfo(msg); } else if (RiskOfImpactMain.DebugMode) { Debug.Log((object)msg); } } private static void PlayMisfortuneFeedback(GameObject target, Vector3 pos) { //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_002d: 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_003f: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)target)) { Util.PlaySound("Play_UI_menuCancel", target); } GameObject val = LegacyResourcesAPI.Load("Prefabs/Effects/OmniEffect/OmniImpactVFX"); if (Object.op_Implicit((Object)(object)val)) { EffectData val2 = new EffectData { origin = pos, scale = 1.2f }; EffectManager.SpawnEffect(val, val2, true); } } private static void SpendCostOnly(PurchaseInteraction pi, Interactor activator) { //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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || !Object.op_Implicit((Object)(object)pi) || !Object.op_Implicit((Object)(object)activator) || !pi.CanBeAffordedByInteractor(activator)) { return; } CharacterBody component = ((Component)activator).GetComponent(); CostTypeDef costTypeDef = CostTypeCatalog.GetCostTypeDef(pi.costType); int cost = TeamManager.AdjustCostForLongstandingSolitude(pi.costType, pi.cost, component); PayCostContext val2 = default(PayCostContext); DisposableRental val = ((BasePool)(object)PayCostContext.pool).Request(ref val2); try { val2.activator = activator; val2.activatorBody = component; val2.activatorMaster = (Object.op_Implicit((Object)(object)component) ? component.master : null); val2.activatorInventory = (Object.op_Implicit((Object)(object)component) ? component.inventory : null); val2.purchasedObject = ((Component)pi).gameObject; val2.purchaseInteraction = pi; val2.costTypeDef = costTypeDef; val2.cost = cost; val2.rng = pi.rng; val2.avoidedItemIndex = (ItemIndex)(-1); PayCostResults val4 = default(PayCostResults); DisposableRental val3 = ((BasePool)(object)PayCostResults.pool).Request(ref val4); try { costTypeDef.PayCost(val2, val4); pi.lastActivator = activator; } finally { val3.Dispose(); } } finally { val.Dispose(); } } } internal static class StartItemTester { internal static void Init() { Run.onRunStartGlobal += OnRunStart; } private static void OnRunStart(Run run) { if (!NetworkServer.active) { return; } foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { CharacterMaster obj = ((instance != null) ? instance.master : null); Inventory val = ((obj != null) ? obj.inventory : null); if (Object.op_Implicit((Object)(object)val)) { val.GiveItemPermanent(RiskOfImpactContent.GetDoomedMoonItemDef(), 2); val.GiveItemPermanent(RiskOfImpactContent.GetRiskyDiceItemDef(), 2); val.GiveItemPermanent(Items.LunarSun, 100); } } } }