Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of RainrotSUL v1.1.3
RainrotSharedUtils.dll
Decompiled 2 days agousing System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using EntityStates; using On.EntityStates; using On.RoR2; using On.RoR2.Projectile; using On.RoR2.Skills; using R2API; using R2API.Utils; using RainrotSharedUtils.Components; using RainrotSharedUtils.Frost; using RainrotSharedUtils.Shelters; using RainrotSharedUtils.Status; using RoR2; using RoR2.Projectile; using RoR2.Skills; using RoR2BepInExPack.GameAssetPathsBetter; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("RainrotSharedUtils")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RainrotSharedUtils")] [assembly: AssemblyTitle("RainrotSharedUtils")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: UnverifiableCode] namespace RainrotSharedUtils { public static class Assets { internal static GameObject iceDelayBlastPrefab; public static GameObject iceNovaEffectStrong; public static GameObject iceNovaEffectWeak; public static GameObject iceNovaEffectLowPriority; public static Texture2D iceNovaRamp; public static Texture2D iceNovaRampPersistent; public static BuffDef shockMarker; public static int shockMarkerDuration = 4; public static BuffDef shockHealCooldown; public static Color32 sparkBoosterColor = new Color32((byte)35, (byte)115, byte.MaxValue, byte.MaxValue); public static BuffDef sparkBoosterBuff; public static float sparkBoosterDuration = 8f; public static float sparkBoosterAspdBonus = 0.25f; public const int maxNebulaBoosterStackCount = 5; public static float nebulaBoosterBuffDuration = 5f; public static float nebulaBoosterBuffRadius = 50f; public static GameObject sparkBoosterObject; public static EffectDef RegisterEffect(GameObject effect) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown if ((Object)(object)effect == (Object)null) { Debug.LogError((object)"Effect prefab was null"); return null; } EffectComponent component = effect.GetComponent<EffectComponent>(); if ((Object)(object)component == (Object)null) { Debug.LogErrorFormat("Effect prefab: \"{0}\" does not have an EffectComponent.", new object[1] { ((Object)effect).name }); return null; } VFXAttributes component2 = effect.GetComponent<VFXAttributes>(); if ((Object)(object)component2 == (Object)null) { Debug.LogErrorFormat("Effect prefab: \"{0}\" does not have a VFXAttributes component.", new object[1] { ((Object)effect).name }); return null; } ContentAddition.AddEffect(effect); return new EffectDef { prefab = effect, prefabEffectComponent = component, prefabVfxAttributes = component2, prefabName = ((Object)effect).name, spawnSoundEventName = component.soundName }; } private static Texture2D CreateNewRampTex(Gradient grad) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(256, 8, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[8]; for (int i = 0; i < 256; i++) { Color val2 = grad.Evaluate((float)i / 255f); for (int j = 0; j < 8; j++) { array[j] = val2; } val.SetPixels(i, 0, 1, 8, array); } ((Texture)val).wrapMode = (TextureWrapMode)1; val.Apply(); return val; } public static void Init() { CreateFrostNovaAssets(); CreateShockReworkAssets(); } private static void CreateFrostNovaAssets() { iceNovaRamp = GetIceRemap(1.1f, 0f); iceNovaRampPersistent = GetIceRemap(0.4f, 0.1f); iceNovaEffectStrong = CreateSingleIceNova(iceNovaRamp, "Strong", 1.2f); iceNovaEffectWeak = CreateSingleIceNova(iceNovaRamp, "Weak", 0.85f); iceNovaEffectLowPriority = CreateSingleIceNova(iceNovaRamp, "LowPriority", 0.3f); iceDelayBlastPrefab = CreateIceDelayBlastPrefab(); static Texture2D GetIceRemap(float alphaMod, float alphaAdd) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: 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_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: 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_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) Gradient val = new Gradient(); val.mode = (GradientMode)0; val.alphaKeys = (GradientAlphaKey[])(object)new GradientAlphaKey[8] { new GradientAlphaKey(0f * alphaMod + alphaAdd, 0f), new GradientAlphaKey(0f * alphaMod + alphaAdd, 0.14f), new GradientAlphaKey(0.22f * alphaMod + alphaAdd, 0.46f), new GradientAlphaKey(0.22f * alphaMod + alphaAdd, 0.61f), new GradientAlphaKey(0.72f * alphaMod + alphaAdd, 0.63f), new GradientAlphaKey(0.72f * alphaMod + alphaAdd, 0.8f), new GradientAlphaKey(0.87f * alphaMod + alphaAdd, 0.81f), new GradientAlphaKey(0.87f * alphaMod + alphaAdd, 1f) }; val.colorKeys = (GradientColorKey[])(object)new GradientColorKey[8] { new GradientColorKey(new Color(0f + alphaAdd, 0f + alphaAdd, 0f + alphaAdd), 0f), new GradientColorKey(new Color(0f + alphaAdd, 0f + alphaAdd, 0f + alphaAdd), 0.14f), new GradientColorKey(new Color(0.179f + alphaAdd, 0.278f + alphaAdd, 0.25f + alphaAdd), 0.46f), new GradientColorKey(new Color(0.179f + alphaAdd, 0.278f + alphaAdd, 0.25f + alphaAdd), 0.61f), new GradientColorKey(new Color(0.5f + alphaAdd, 0.8f + alphaAdd, 0.75f + alphaAdd), 0.63f), new GradientColorKey(new Color(0.5f + alphaAdd, 0.8f + alphaAdd, 0.75f + alphaAdd), 0.8f), new GradientColorKey(new Color(0.6f + alphaAdd, 0.9f + alphaAdd, 0.85f + alphaAdd), 0.81f), new GradientColorKey(new Color(0.6f + alphaAdd, 0.9f + alphaAdd, 0.85f + alphaAdd), 1f) }; Gradient grad = val; return CreateNewRampTex(grad); } } private static GameObject CreateSingleIceNova(Texture2D remapTex, string s, float alphaMod) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ImpactEffects/AffixWhiteExplosion"), "IceExplosion" + s, false); ParticleSystemRenderer component = ((Component)val.transform.Find("Nova Sphere")).GetComponent<ParticleSystemRenderer>(); Material val2 = Object.Instantiate<Material>(((Renderer)component).material); val2.SetTexture("_RemapTex", (Texture)(object)remapTex); Color color = val2.GetColor("_TintColor"); color.a *= alphaMod; val2.SetColor("_TintColor", color); ((Renderer)component).material = val2; RegisterEffect(val); return val; } private static GameObject CreateIceDelayBlastPrefab() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/GenericDelayBlast"), "IceDelayBlast", false); DelayBlast component = val.GetComponent<DelayBlast>(); component.crit = false; component.procCoefficient = 1f; component.maxTimer = 0.2f; component.falloffModel = (FalloffModel)0; component.explosionEffect = iceNovaEffectWeak; component.delayEffect = CreateIceDelayEffect(); component.damageType = DamageTypeCombo.op_Implicit((DamageType)256); component.baseForce = 250f; ProjectileController val2 = val.AddComponent<ProjectileController>(); ContentAddition.AddProjectile(val); return val; } private static GameObject CreateIceDelayEffect() { GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/AffixWhiteDelayEffect"), "iceDelay", false); val.GetComponent<DestroyOnTimer>().duration = 0.2f; ParticleSystemRenderer component = ((Component)val.transform.Find("Nova Sphere")).GetComponent<ParticleSystemRenderer>(); Material val2 = Object.Instantiate<Material>(((Renderer)component).material); val2.SetTexture("_RemapTex", (Texture)(object)iceNovaRamp); ((Renderer)component).material = val2; RegisterEffect(val); return val; } private static void CreateShockReworkAssets() { AddShockDebuff(); AddShockCooldown(); CreateSparkBuff(); CreateSparkPickup(); } private static void CreateSparkPickup() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown sparkBoosterObject = NewNebulaBooster("SparkBoosterPickup", sparkBoosterBuff, sparkBoosterColor, sparkBoosterDuration, 0.8f, 1.8f); RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(SparkBoosterStats); } private static void SparkBoosterStats(CharacterBody sender, StatHookEventArgs args) { int buffCount = sender.GetBuffCount(sparkBoosterBuff); if (buffCount > 0) { args.attackSpeedMultAdd += sparkBoosterAspdBonus * (float)buffCount; } } private static GameObject NewNebulaBooster(string boosterName, BuffDef boosterBuff, Color32 boosterColor, float boosterDuration, float antiGravity = 1f, float pickupRangeMultiplier = 3f) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_0113: 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_0319: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"7f9217d45f824f245862e65716abc746").WaitForCompletion(); GameObject val2 = PrefabAPI.InstantiateClone(val, boosterName, true); ParticleSystemRenderer[] componentsInChildren = val2.GetComponentsInChildren<ParticleSystemRenderer>(); foreach (ParticleSystemRenderer val3 in componentsInChildren) { string name = ((Object)((Component)val3).gameObject).name; Color32 val4 = Color32.op_Implicit(Color.white); string text = ""; if (name == "Core") { text = "matSparkPickupCore"; val4 = boosterColor; } if (name == "Trail") { text = "matSparkPickupTrail"; val4 = Color32.op_Implicit(Color.clear); } if (name == "Pulseglow") { text = "matSparkPickupGlow"; val4 = boosterColor; } if (text != "") { Material val6 = (((Renderer)val3).material = Object.Instantiate<Material>(((Renderer)val3).material)); ((Object)val6).name = text; val6.DisableKeyword("VERTEXCOLOR"); val6.SetFloat("_VertexColorOn", 0f); val6.SetColor("_TintColor", Color32.op_Implicit(val4)); } } VelocityRandomOnStart component = val2.GetComponent<VelocityRandomOnStart>(); if ((Object)(object)component != (Object)null) { component.minSpeed = 15f; component.maxSpeed = 25f; component.coneAngle = 360f; component.directionMode = (DirectionMode)0; } else { Debug.Log((object)(boosterName + " HAS NO VROS????")); } DestroyOnTimer component2 = val2.GetComponent<DestroyOnTimer>(); if ((Object)(object)component2 != (Object)null) { component2.duration = boosterDuration; } else { Debug.Log((object)(boosterName + " HAS NO DOT????")); } BeginRapidlyActivatingAndDeactivating component3 = val2.GetComponent<BeginRapidlyActivatingAndDeactivating>(); if ((Object)(object)component3 != (Object)null) { component3.delayBeforeBeginningBlinking = boosterDuration - 2f; component3.blinkFrequency = 5f; } else { Debug.Log((object)(boosterName + " HAS NO BRAAD????")); } if (antiGravity != 0f) { Rigidbody component4 = val2.GetComponent<Rigidbody>(); if (antiGravity == 1f) { component4.useGravity = true; } else { AntiGravityForce val7 = val2.AddComponent<AntiGravityForce>(); val7.rb = component4; val7.antiGravityCoefficient = antiGravity; } } HealthPickup componentInChildren = val2.GetComponentInChildren<HealthPickup>(); NebulaPickup nebulaPickup = ((Component)componentInChildren).gameObject.AddComponent<NebulaPickup>(); nebulaPickup.pickupEffect = componentInChildren.pickupEffect; nebulaPickup.baseObject = componentInChildren.baseObject; nebulaPickup.teamFilter = val2.GetComponent<TeamFilter>(); if ((Object)(object)boosterBuff != (Object)null) { nebulaPickup.buffDef = boosterBuff; } else { Debug.Log((object)(boosterName + "BOOSTER BUFFDEF WAS NULL")); } GravitatePickup componentInChildren2 = val2.GetComponentInChildren<GravitatePickup>(); if ((Object)(object)componentInChildren2 != (Object)null) { componentInChildren2.acceleration = 2f; componentInChildren2.maxSpeed = 50f; Collider component5 = ((Component)componentInChildren2).gameObject.GetComponent<Collider>(); if (component5.isTrigger) { Transform transform = ((Component)component5).transform; transform.localScale *= pickupRangeMultiplier; } } else { Debug.Log((object)(boosterName + " HAS NO GRAVITATION????")); } Object.Destroy((Object)(object)componentInChildren); ContentAddition.AddNetworkedObject(val2); return val2; } private static void CreateSparkBuff() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) sparkBoosterBuff = ScriptableObject.CreateInstance<BuffDef>(); ((Object)sparkBoosterBuff).name = "bdSparkBoost"; sparkBoosterBuff.buffColor = Color32.op_Implicit(sparkBoosterColor); sparkBoosterBuff.canStack = true; AsyncOperationHandle<Sprite> val = Addressables.LoadAssetAsync<Sprite>((object)RoR2_Base_ShockNearby.texBuffTeslaIcon_tif); val.Completed += delegate(AsyncOperationHandle<Sprite> ctx) { sparkBoosterBuff.iconSprite = ctx.Result; }; ContentAddition.AddBuffDef(sparkBoosterBuff); } private static void AddShockDebuff() { //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_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) shockMarker = ScriptableObject.CreateInstance<BuffDef>(); ((Object)shockMarker).name = "bdShockDebuff"; shockMarker.buffColor = new Color(0f, 0f, 0.6f); shockMarker.canStack = false; shockMarker.isDebuff = true; shockMarker.isHidden = true; AsyncOperationHandle<Sprite> val = Addressables.LoadAssetAsync<Sprite>((object)RoR2_Base_ShockNearby.texBuffTeslaIcon_tif); val.Completed += delegate(AsyncOperationHandle<Sprite> ctx) { shockMarker.iconSprite = ctx.Result; }; ContentAddition.AddBuffDef(shockMarker); } private static void AddShockCooldown() { //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_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) shockHealCooldown = ScriptableObject.CreateInstance<BuffDef>(); ((Object)shockHealCooldown).name = "bdShockDebuff"; shockHealCooldown.buffColor = new Color(0f, 0f, 0.6f); shockHealCooldown.canStack = true; shockHealCooldown.isDebuff = false; shockHealCooldown.isCooldown = true; AsyncOperationHandle<Sprite> val = Addressables.LoadAssetAsync<Sprite>((object)RoR2_Base_ShockNearby.texBuffTeslaIcon_tif); val.Completed += delegate(AsyncOperationHandle<Sprite> ctx) { shockHealCooldown.iconSprite = ctx.Result; }; ContentAddition.AddBuffDef(shockHealCooldown); } } public static class Hooks { public static void DoHooks() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown IcicleAuraController.Awake += new hook_Awake(AuraControllerFix); BuffWard.BuffTeam += new hook_BuffTeam(ApplyDotWard); ProjectileOverlapLimitHits.CountOverlapHits += new hook_CountOverlapHits(DecayProjectileOverlapDamage); ProjectileOverlapLimitHits.OnEnable += new hook_OnEnable(DecayProjectileRecordInitialDamage); ShockState.OnExit += new hook_OnExit(ShockSparkOnExit); ShockState.OnEnter += new hook_OnEnter(ShockBuffEnter); } private static void DecayProjectileRecordInitialDamage(orig_OnEnable orig, ProjectileOverlapLimitHits self) { orig.Invoke(self); if (self is ProjectileOverlapDecayDamage) { (self as ProjectileOverlapDecayDamage).initialDamageCoefficient = self.projectileOverlapAttack.damageCoefficient; (self as ProjectileOverlapDecayDamage).initialProcCoefficient = self.projectileOverlapAttack.overlapProcCoefficient; } } private static void DecayProjectileOverlapDamage(orig_CountOverlapHits orig, ProjectileOverlapLimitHits self) { orig.Invoke(self); if (self is ProjectileOverlapDecayDamage) { ProjectileOverlapDecayDamage projectileOverlapDecayDamage = self as ProjectileOverlapDecayDamage; if (self.hitCount < self.hitLimit) { self.projectileOverlapAttack.damageCoefficient = projectileOverlapDecayDamage.initialDamageCoefficient * projectileOverlapDecayDamage.firstHitDamageMultiplier * Mathf.Pow(projectileOverlapDecayDamage.onHitDamageMultiplier, (float)(self.hitCount - 1)); self.projectileOverlapAttack.overlapProcCoefficient = projectileOverlapDecayDamage.initialProcCoefficient * projectileOverlapDecayDamage.firstHitDamageMultiplier * Mathf.Pow(projectileOverlapDecayDamage.onHitDamageMultiplier, (float)(self.hitCount - 1)); } } } private static void AuraControllerFix(orig_Awake orig, IcicleAuraController self) { orig.Invoke(self); if (Object.op_Implicit((Object)(object)self.buffWard) && self.buffWard is DotWard dotWard) { dotWard.ownerObject = self.cachedOwnerInfo.gameObject; dotWard.ownerBody = self.cachedOwnerInfo.characterBody; } } private static void ApplyDotWard(orig_BuffTeam orig, BuffWard self, IEnumerable<TeamComponent> recipients, float radiusSqr, Vector3 currentPosition) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Invalid comparison between Unknown and I4 //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Invalid comparison between Unknown and I4 //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: 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_0169: Unknown result type (might be due to invalid IL or missing references) if (!(self is DotWard dotWard)) { orig.Invoke(self, recipients, radiusSqr, currentPosition); } else { if (!NetworkServer.active || (int)dotWard.dotIndex == -1) { return; } GameObject ownerObject = dotWard.ownerObject; CharacterBody ownerBody = dotWard.ownerBody; Inventory ownerInventory = dotWard.ownerInventory; foreach (TeamComponent recipient in recipients) { Vector3 val = ((Component)recipient).transform.position - currentPosition; if ((int)self.shape == 1) { val.y = 0f; } if (!(((Vector3)(ref val)).sqrMagnitude <= radiusSqr)) { continue; } CharacterBody component = ((Component)recipient).GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component) && (!self.requireGrounded || !Object.op_Implicit((Object)(object)component.characterMotor) || component.characterMotor.isGrounded)) { InflictDotInfo val2 = default(InflictDotInfo); val2.attackerObject = ownerObject; val2.victimObject = ((Component)component).gameObject; val2.totalDamage = dotWard.damageCoefficient * ownerBody.damage; val2.damageMultiplier = 1f; val2.dotIndex = dotWard.dotIndex; val2.maxStacksFromAttacker = null; InflictDotInfo val3 = val2; if ((Object)(object)ownerInventory != (Object)null) { StrengthenBurnUtils.CheckDotForUpgrade(ownerInventory, ref val3); } DotController.InflictDot(ref val3); } } } } private static void ShockSparkOnExit(orig_OnExit orig, ShockState self) { //IL_0073: 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) if (ShockUtilsModule.UseShockSparks) { float num = self.healthFraction - ((EntityState)self).healthComponent.combinedHealthFraction; if (num >= self.healthFractionToForceExit) { GameObject lastHitAttacker = ((EntityState)self).healthComponent.lastHitAttacker; if ((Object)(object)lastHitAttacker != (Object)null) { CharacterBody component = lastHitAttacker.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component)) { Debug.Log((object)"break make spark"); NebulaPickup.CreateBoosterPickup(((EntityState)self).transform.position, component.teamComponent.teamIndex, Assets.sparkBoosterObject); } } } } orig.Invoke(self); } private static void ShockHit(orig_TakeDamageProcess orig, HealthComponent self, DamageInfo damageInfo) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (ShockUtilsModule.UseShockSparks && ((Enum)damageInfo.damageType.damageType).HasFlag((Enum)(object)(DamageType)16777216)) { self.body.AddTimedBuff(Assets.shockMarker, (float)Assets.shockMarkerDuration); } orig.Invoke(self, damageInfo); } private static void ShockBuffEnter(orig_OnEnter orig, ShockState self) { orig.Invoke(self); if (ShockUtilsModule.UseShockSparks) { self.healthFractionToForceExit = ShockUtilsModule.shockForceExitFraction; } } private static void ShockBuffExit(orig_OnExit orig, ShockState self) { if (ShockUtilsModule.UseShockSparks && self != null && (Object)(object)((EntityState)self).characterBody != (Object)null && ((EntityState)self).characterBody.HasBuff(Assets.shockMarker)) { HealthComponent healthComponent = ((EntityState)self).healthComponent; GameObject lastHitAttacker = healthComponent.lastHitAttacker; if (!((Object)(object)lastHitAttacker == (Object)null)) { CharacterBody component = lastHitAttacker.GetComponent<CharacterBody>(); if ((Object)(object)component != (Object)null && component.maxShield > 0f && component.healthComponent?.shield != component.maxShield) { ShockHeal(component.healthComponent); } } } orig.Invoke(self); } private static void ShockHeal(HealthComponent attacker) { if (!attacker.body.HasBuff(Assets.shockHealCooldown)) { float num = (attacker.body.maxShield - attacker.shield) / attacker.body.maxShield; float num2 = attacker.body.maxShield / attacker.fullCombinedHealth; int num3 = (int)(num2 * num * 20f); for (int i = 0; i < num3; i++) { attacker.body.AddTimedBuff(Assets.shockHealCooldown, (float)(i + 1)); } attacker.ForceShieldRegen(); } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.RiskOfBrainrot.RainrotSharedUtils", "RainrotSharedUtils", "1.1.1")] [R2APISubmoduleDependency(new string[] { "LanguageAPI" })] public class SharedUtilsPlugin : BaseUnityPlugin { public const string guid = "com.RiskOfBrainrot.RainrotSharedUtils"; public const string teamName = "RiskOfBrainrot"; public const string modName = "RainrotSharedUtils"; public const string version = "1.1.1"; public const string shelterKeywordToken = "2R4R_SHELTER_KEYWORD"; public const string executeKeywordToken = "2R4R_EXECUTION_KEYWORD"; public const string noAttackSpeedKeywordToken = "2R4R_NOATTACKSPEED_KEYWORD"; public const string sparkPickupKeywordToken = "2R4R_SPARKPICKUP_KEYWORD"; public const float survivorExecuteThreshold = 0.15f; public static PluginInfo PInfo { get; private set; } public void Awake() { Assets.Init(); ShelterUtilsModule.Init(); FrostUtilsModule.Init(); Hooks.DoHooks(); LanguageAPI.Add("2R4R_EXECUTION_KEYWORD", "<style=cKeywordName>Finisher</style><style=cSub>Enemies targeted by this skill can be <style=cIsHealth>instantly killed</style> if below " + $"<style=cIsHealth>{15.000001f}% health</style>.</style>"); LanguageAPI.Add("2R4R_NOATTACKSPEED_KEYWORD", "<style=cKeywordName>Exacting</style><style=cSub>This skill <style=cIsHealth>does not gain attack speed bonuses</style>. Instead, attack speed <style=cIsDamage>increases total damage</style>.</style>"); LanguageAPI.Add("2R4R_SHELTER_KEYWORD", "<style=cKeywordName>Shelter</style><style=cSub>Protects from storms and fog.</style>"); LanguageAPI.Add("2R4R_SPARKPICKUP_KEYWORD", "<style=cKeywordName>Energizing Sparks</style><style=cSub>Creates <style=cIsDamage>spark pickups</style> that increase the " + $"<style=cIsDamage>attack speed</style> of all allies within <style=cIsDamage>{Assets.nebulaBoosterBuffRadius}m</style> " + $"by <style=cIsDamage>{Assets.sparkBoosterAspdBonus * 100f}%</style> for {Assets.nebulaBoosterBuffDuration} seconds. " + $"Can stack up to {5} times.</style>"); } } } namespace RainrotSharedUtils.Status { public static class ShockUtilsModule { public static float shockForceExitFraction = 0.1f; private static bool _UseShockSparks = false; public static bool UseShockSparks { get { return _UseShockSparks; } set { if (value) { LanguageAPI.Add("KEYWORD_SHOCKING", "<style=cKeywordName>Shocking</style><style=cSub>Interrupts enemies and stuns them. The stun is broken if the target takes more than " + $"<style=cIsHealth>{shockForceExitFraction * 100f}%</style> " + "of their maximum health in damage. Breaking shock creates <style=cIsUtility>Energizing Sparks</style>.</style>"); } _UseShockSparks = true; } } public static void Init() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown SkillCatalog.Init += new hook_Init(OnSkillCatalogInit); } private static void OnSkillCatalogInit(orig_Init orig) { orig.Invoke(); if (!UseShockSparks) { return; } foreach (SkillDef allSkillDef in SkillCatalog.allSkillDefs) { if (allSkillDef.keywordTokens.Contains("KEYWORD_SHOCKING")) { string text = "2R4R_SPARKPICKUP_KEYWORD"; HGArrayUtilities.ArrayAppend<string>(ref allSkillDef.keywordTokens, ref text); } } } } } namespace RainrotSharedUtils.Frost { public static class FrostUtilsModule { public static int maxIceExplosionsPerSecond = 4; public static int iceExplosionsThisSecond = 0; public const int chillStacksMax = 6; public const float chillProcDuration = 6f; private static float iceExplosionTrackerTimer = 0f; public static GameObject iceExplosion => Assets.iceDelayBlastPrefab; public static void Init() { FixSnapfreeze(); } public static void FixedUpdate() { if (maxIceExplosionsPerSecond <= 0 || iceExplosionsThisSecond <= 0) { iceExplosionsThisSecond = 0; iceExplosionTrackerTimer = 1 / maxIceExplosionsPerSecond; return; } iceExplosionTrackerTimer -= Time.fixedDeltaTime; while (iceExplosionTrackerTimer < 0f) { iceExplosionTrackerTimer += 1 / maxIceExplosionsPerSecond; iceExplosionsThisSecond--; } } public static void FixSnapfreeze() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"65d14128d015b6946b0dec7981dfe63a").WaitForCompletion(); ProjectileImpactExplosion componentInChildren = val.GetComponentInChildren<ProjectileImpactExplosion>(); if (Object.op_Implicit((Object)(object)componentInChildren)) { componentInChildren.destroyOnEnemy = false; } } public static void CreateIceBlast(CharacterBody attackerBody, float baseForce, float damage, float procCoefficient, float radius, bool crit, Vector3 blastPosition, bool isStrongBlast = false, DamageSource damageSource = 0) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { EffectManager.SpawnEffect(GetIceBlastEffect(isStrongBlast), new EffectData { origin = blastPosition, scale = radius }, true); BlastAttack val = new BlastAttack(); val.radius = radius; val.procCoefficient = procCoefficient; val.position = blastPosition; val.attacker = ((Component)attackerBody).gameObject; val.crit = crit; val.baseDamage = damage; val.falloffModel = (FalloffModel)0; val.baseForce = baseForce; val.teamIndex = attackerBody.teamComponent.teamIndex; val.attackerFiltering = (AttackerFiltering)2; val.damageType = new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)0), (DamageTypeExtended)131072, damageSource); val.Fire(); } } public static GameObject GetIceBlastEffect(bool isStrongBlast) { if (isStrongBlast) { return Assets.iceNovaEffectStrong; } iceExplosionsThisSecond++; if (iceExplosionsThisSecond < maxIceExplosionsPerSecond) { return Assets.iceNovaEffectWeak; } return Assets.iceNovaEffectLowPriority; } public static void ApplyChillSphere(Vector3 origin, float radius, TeamIndex teamIndex, float duration = 6f, float chillCount = 3f) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } SphereSearch val = new SphereSearch(); val.origin = origin; val.mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask; val.radius = radius; val.RefreshCandidates(); val.FilterCandidatesByHurtBoxTeam(TeamMask.GetUnprotectedTeams(teamIndex)); val.FilterCandidatesByDistinctHurtBoxEntities(); val.OrderCandidatesByDistance(); List<HurtBox> list = new List<HurtBox>(); val.GetHurtBoxes(list); val.ClearCandidates(); for (int i = 0; i < list.Count; i++) { HurtBox val2 = list[i]; CharacterBody val3 = val2.healthComponent?.body; if (Object.op_Implicit((Object)(object)val3)) { bool flag = val3.HasBuff(Buffs.FreezeImmune); bool isInFrozenState = val3.healthComponent.isInFrozenState; if (!flag && !isInFrozenState) { ApplyChillStacks(val3, 100f, chillCount, duration); } } } list.Clear(); } public static void ApplyChillStacks(CharacterMaster attackerMaster, CharacterBody vBody, float procChance, float chillCount = 1f, float chillDuration = 6f) { ApplyChillStacks(vBody, procChance, chillCount, chillDuration, Object.op_Implicit((Object)(object)attackerMaster) ? attackerMaster.luck : 1f); } public static void ApplyChillStacks(CharacterBody vBody, float procChance, float totalChillToApply = 1f, float chillDuration = 6f, float luck = 1f) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) int buffCount = vBody.GetBuffCount(Buffs.Frost); int num = 0; int num2 = 10 - 3 * num; if (buffCount > num2) { return; } totalChillToApply = Mathf.Min(totalChillToApply, (float)(num2 - buffCount)); for (int i = 0; (float)i < totalChillToApply; i++) { if (Util.CheckRoll(procChance, luck, (CharacterMaster)null)) { vBody.AddTimedBuff(Buffs.Frost.buffIndex, chillDuration); } } } } } namespace RainrotSharedUtils.Shelters { public class MockShelterComponent : ShelterProviderBehavior { public float scaleMultiplier = 1f; private Vector3 baseScale; public GameObject areaIndicatorReference; public float startingRadius; public float endRadius = 10f; public float durationBeforeShrink = 1f; public float durationForMaxShrink = 15f; private float age = 0f; private bool hasStartedShrink = false; private void FixedUpdate() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) if (age >= durationForMaxShrink) { return; } age += Time.fixedDeltaTime; if (!(age > durationBeforeShrink)) { return; } if (!hasStartedShrink) { hasStartedShrink = true; if (Object.op_Implicit((Object)(object)areaIndicatorReference)) { baseScale = areaIndicatorReference.transform.localScale / startingRadius; } } if (age >= durationForMaxShrink) { SetSize(endRadius); return; } float num = (age - durationBeforeShrink) / durationForMaxShrink; float size = Mathf.Lerp(startingRadius, endRadius, num); SetSize(size); } private void SetSize(float radius) { //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_0038: Unknown result type (might be due to invalid IL or missing references) base.fallbackRadius = radius; if (!((Object)(object)areaIndicatorReference == (Object)null)) { areaIndicatorReference.transform.localScale = radius * baseScale * scaleMultiplier; } } } public class ShelterProviderBehavior : MonoBehaviour { private static List<ShelterProviderBehavior> instancesList = new List<ShelterProviderBehavior>(); public static ReadOnlyCollection<ShelterProviderBehavior> readOnlyInstancesList = new ReadOnlyCollection<ShelterProviderBehavior>(instancesList); public HoldoutZoneController holdoutZoneController; public bool isSuperShelter = false; public bool isHazardZone = false; public float _fallbackRadius; public IZone zoneBehavior; public float fallbackRadius { get { if (!Object.op_Implicit((Object)(object)holdoutZoneController)) { return _fallbackRadius; } if (holdoutZoneController.charge <= 0f || holdoutZoneController.charge >= 1f || !((Behaviour)holdoutZoneController).isActiveAndEnabled) { return 0f; } return holdoutZoneController.currentRadius; } set { _fallbackRadius = value; } } public bool IsInBounds(Vector3 position, float radius = 0f) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) Vector3 val = position; if (radius > 0f) { Vector3 val2 = position - ((Component)this).transform.position; val = position - ((Vector3)(ref val2)).normalized * radius; } if (zoneBehavior != null) { return zoneBehavior.IsInBounds(val); } if (fallbackRadius < 1f) { return false; } Vector3 val3 = val - ((Component)this).transform.position; return ((Vector3)(ref val3)).sqrMagnitude <= fallbackRadius * fallbackRadius; } private void OnEnable() { if (!ShelterUtilsModule.UseGlobalShelters && !ShelterUtilsModule.UseCustomShelters) { Debug.LogError((object)"Shelter Provider cannot initialize: Shelter Module not enabled. (Set UseGlobalShelters or UseCustomShelters to true!)"); Object.Destroy((Object)(object)this); } instancesList.Add(this); } private void OnDisable() { if (instancesList.Contains(this)) { instancesList.Remove(this); } } } public static class ShelterUtilsModule { public static bool UseGlobalShelters; public static bool UseCustomShelters; public static bool IsBodySuperSheltered(CharacterBody body, float radius = 0f) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) foreach (ShelterProviderBehavior readOnlyInstances in ShelterProviderBehavior.readOnlyInstancesList) { if (!readOnlyInstances.isSuperShelter || !readOnlyInstances.IsInBounds(body.corePosition, radius)) { continue; } return true; } return false; } public static bool IsPositionSuperSheltered(Vector3 position, float radius = 0f) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) foreach (ShelterProviderBehavior readOnlyInstances in ShelterProviderBehavior.readOnlyInstancesList) { if (!readOnlyInstances.isSuperShelter || !readOnlyInstances.IsInBounds(position, radius)) { continue; } return true; } return false; } public static bool IsBodySheltered(CharacterBody body, float radius = 0f) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) foreach (ShelterProviderBehavior readOnlyInstances in ShelterProviderBehavior.readOnlyInstancesList) { if (readOnlyInstances.isHazardZone || !readOnlyInstances.IsInBounds(body.corePosition, radius)) { continue; } return true; } return false; } public static bool IsPositionSheltered(Vector3 position, float radius = 0f) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) foreach (ShelterProviderBehavior readOnlyInstances in ShelterProviderBehavior.readOnlyInstancesList) { if (readOnlyInstances.isHazardZone || !readOnlyInstances.IsInBounds(position, radius)) { continue; } return true; } return false; } public static void Init() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown TeleporterInteraction.Awake += new hook_Awake(SheltersOnTeleporterAwake); HoldoutZoneController.Awake += new hook_Awake(SheltersOnHoldoutAwake); SphereZone.OnEnable += new hook_OnEnable(SheltersOnSphereZoneEnable); VerticalTubeZone.OnEnable += new hook_OnEnable(SheltersOnTubeZoneEnable); FogDamageController.EvaluateTeam += new hook_EvaluateTeam(EvaluateShelteredTeam); FogDamageController.GetAffectedBodiesOnTeam += new hook_GetAffectedBodiesOnTeam(GetFogAffectedBodies); GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/ShrineHalcyonite.prefab").WaitForCompletion(); if (Object.op_Implicit((Object)(object)val)) { HalcyoniteShrineInteractable component = val.GetComponent<HalcyoniteShrineInteractable>(); if (Object.op_Implicit((Object)(object)component)) { ShelterProviderBehavior shelterProviderBehavior = val.AddComponent<ShelterProviderBehavior>(); shelterProviderBehavior.fallbackRadius = component.radius; } } HalcyoniteShrineInteractable.DrainConditionMet += new hook_DrainConditionMet(MockShelter_Halcyon); ChargingState.OnExit += new hook_OnExit(MockShelter_TP); Run.onRunDestroyGlobal += SheltersOnRunDestroy; } private static void MockShelter_TP(orig_OnExit orig, ChargingState self) { HoldoutZoneController holdoutZoneController = ((BaseTeleporterState)self).teleporterInteraction.holdoutZoneController; float currentRadius = holdoutZoneController.currentRadius; GameObject gameObject = ((Component)holdoutZoneController.radiusIndicator).gameObject; MakeMockShelter(gameObject, currentRadius, 25f); orig.Invoke(self); } private static void MockShelter_Halcyon(orig_DrainConditionMet orig, HalcyoniteShrineInteractable self) { float radius = self.radius; GameObject gameObject = self.shrineHalcyoniteBubble.gameObject; MakeMockShelter(gameObject, radius, 15f, 2f); orig.Invoke(self); } private static void MakeMockShelter(GameObject indicator, float startRadius, float endRadius, float stupidBullshit = 1f) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (!UseGlobalShelters) { return; } GameObject val = new GameObject(); ((Object)val).name = "MockShelter"; val.transform.position = indicator.transform.position; MockShelterComponent mockShelterComponent = val.AddComponent<MockShelterComponent>(); mockShelterComponent.startingRadius = startRadius; mockShelterComponent.endRadius = endRadius; mockShelterComponent.scaleMultiplier = stupidBullshit; if (!((Object)(object)indicator == (Object)null)) { GameObject val2 = Object.Instantiate<GameObject>(indicator, val.transform); if (!val2.activeInHierarchy) { val2.SetActive(true); } val2.transform.parent = val.transform; mockShelterComponent.areaIndicatorReference = val2; ShelterProviderBehavior shelterProviderBehavior = default(ShelterProviderBehavior); if (val2.TryGetComponent<ShelterProviderBehavior>(ref shelterProviderBehavior)) { ((Behaviour)shelterProviderBehavior).enabled = false; } } } private static void EvaluateShelteredTeam(orig_EvaluateTeam orig, FogDamageController self, TeamIndex teamIndex) { //IL_0027: 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_0099: Unknown result type (might be due to invalid IL or missing references) if (!UseCustomShelters && !UseGlobalShelters) { orig.Invoke(self, teamIndex); return; } foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers(teamIndex)) { CharacterBody body = teamMember.body; bool flag = self.characterBodyToStacks.ContainsKey(body); bool flag2 = IsBodySheltered(body); bool flag3 = body.HasBuff(Buffs.VoidFogStackCooldown); if (!flag2) { foreach (IZone safeZone in self.safeZones) { if (safeZone.IsInBounds(((Component)teamMember).transform.position)) { flag2 = true; break; } } } if (flag2) { if (flag) { self.characterBodyToStacks.Remove(body); if (flag3) { body.RemoveOldestTimedBuff(Buffs.VoidFogStackCooldown); } } } else if (!flag) { self.characterBodyToStacks.Add(body, 1); self.DumpArenaDamageInfo(body); body.AddTimedBuff(Buffs.VoidFogStackCooldown, self.healthFractionRampIncreaseCooldown); } else if (!flag3) { self.characterBodyToStacks[body]++; self.DumpArenaDamageInfo(body); body.AddTimedBuff(Buffs.VoidFogStackCooldown, self.healthFractionRampIncreaseCooldown); } } } private static IEnumerable<CharacterBody> GetFogAffectedBodies(orig_GetAffectedBodiesOnTeam orig, FogDamageController self, TeamIndex teamIndex) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) IEnumerable<CharacterBody> source = orig.Invoke(self, teamIndex); return source.Where((CharacterBody body) => !IsBodySheltered(body)); } private static ShelterProviderBehavior AddShelterProvider(GameObject obj, IZone zone, bool inverted = false, float radius = 0f) { ShelterProviderBehavior shelterProviderBehavior = obj.GetComponent<ShelterProviderBehavior>(); if (!Object.op_Implicit((Object)(object)shelterProviderBehavior)) { shelterProviderBehavior = obj.AddComponent<ShelterProviderBehavior>(); shelterProviderBehavior.isHazardZone = inverted; } shelterProviderBehavior.zoneBehavior = zone; shelterProviderBehavior.fallbackRadius = radius; return shelterProviderBehavior; } private static void SheltersOnRunDestroy(Run obj) { ReadOnlyCollection<ShelterProviderBehavior> readOnlyInstancesList = ShelterProviderBehavior.readOnlyInstancesList; for (int num = readOnlyInstancesList.Count - 1; num >= 0; num--) { if (Object.op_Implicit((Object)(object)readOnlyInstancesList[num])) { Object.Destroy((Object)(object)((Component)readOnlyInstancesList[num]).gameObject); } } } private static void SheltersOnTeleporterAwake(orig_Awake orig, TeleporterInteraction self) { orig.Invoke(self); if (UseGlobalShelters) { ShelterProviderBehavior shelterProviderBehavior = AddShelterProvider(((Component)self).gameObject, (IZone)(object)self.holdoutZoneController, inverted: false, self.holdoutZoneController.baseRadius); shelterProviderBehavior.holdoutZoneController = self.holdoutZoneController; shelterProviderBehavior.isSuperShelter = true; } } private static void SheltersOnTubeZoneEnable(orig_OnEnable orig, VerticalTubeZone self) { orig.Invoke(self); if (UseGlobalShelters) { AddShelterProvider(((Component)self).gameObject, (IZone)(object)self, inverted: false, self.radius); } } private static void SheltersOnSphereZoneEnable(orig_OnEnable orig, SphereZone self) { orig.Invoke(self); if (UseGlobalShelters) { AddShelterProvider(((Component)self).gameObject, (IZone)(object)self, self.isInverted, self.radius); } } private static void SheltersOnHoldoutAwake(orig_Awake orig, HoldoutZoneController self) { orig.Invoke(self); if (UseGlobalShelters) { ShelterProviderBehavior shelterProviderBehavior = AddShelterProvider(((Component)self).gameObject, (IZone)(object)self, inverted: false, self.baseRadius); shelterProviderBehavior.holdoutZoneController = self; } } } } namespace RainrotSharedUtils.Components { public class DotWard : BuffWard { public DotIndex dotIndex = (DotIndex)(-1); public float damageCoefficient = 1f; private ProjectileController _projectileController; private GameObject _ownerObject; private CharacterBody _ownerBody; private Inventory _ownerInventory; public ProjectileController projectileController { get { if ((Object)(object)_projectileController == (Object)null) { _projectileController = ((Component)this).GetComponent<ProjectileController>(); } return _projectileController; } set { _projectileController = value; } } public GameObject ownerObject { get { if ((Object)(object)_ownerObject == (Object)null && (Object)(object)projectileController != (Object)null) { _ownerObject = projectileController.owner; } return _ownerObject; } set { _ownerObject = value; } } public CharacterBody ownerBody { get { if ((Object)(object)_ownerBody == (Object)null && (Object)(object)ownerObject != (Object)null) { _ownerBody = ownerObject.GetComponent<CharacterBody>(); } return _ownerBody; } set { _ownerBody = value; } } public Inventory ownerInventory { get { if ((Object)(object)_ownerInventory == (Object)null && (Object)(object)ownerBody != (Object)null) { _ownerInventory = ownerBody.inventory; } return _ownerInventory; } set { _ownerInventory = value; } } } public class NebulaPickup : MonoBehaviour { public BuffDef buffDef; [Tooltip("The base object to destroy when this pickup is consumed.")] public GameObject baseObject; [Tooltip("The team filter object which determines who can pick up this pack.")] public TeamFilter teamFilter; public GameObject pickupEffect; private bool alive = true; private void OnTriggerStay(Collider other) { //IL_0025: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown if ((Object)(object)other != (Object)null && NetworkServer.active && alive && TeamComponent.GetObjectTeam(((Component)other).gameObject) == teamFilter.teamIndex) { CharacterBody component = ((Component)other).GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component)) { ApplyNebulaBooster(buffDef, component); EffectManager.SpawnEffect(pickupEffect, new EffectData { origin = ((Component)this).transform.position }, true); Object.Destroy((Object)(object)baseObject); } } } public static void ApplyNebulaBooster(BuffDef buffDef, CharacterBody targetBody) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || !Object.op_Implicit((Object)(object)buffDef)) { return; } AddBoosterBuff(buffDef, targetBody); IEnumerable<TeamComponent> teamMembers = TeamComponent.GetTeamMembers(targetBody.teamComponent.teamIndex); foreach (TeamComponent item in teamMembers) { if (!((Object)(object)item != (Object)(object)targetBody.teamComponent)) { continue; } Vector3 val = ((Component)item).transform.position - targetBody.corePosition; if (((Vector3)(ref val)).sqrMagnitude <= Assets.nebulaBoosterBuffRadius * Assets.nebulaBoosterBuffRadius) { CharacterBody body = item.body; if (Object.op_Implicit((Object)(object)body)) { AddBoosterBuff(buffDef, body); } } } } public static void AddBoosterBuff(BuffDef buffDef, CharacterBody body) { body.AddTimedBuff(buffDef, Assets.nebulaBoosterBuffDuration, 5); } public static void CreateBoosterPickup(Vector3 spawnPoint, TeamIndex team, GameObject boosterPrefab, int boosterCount = 1) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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) if (!((Object)(object)boosterPrefab != (Object)null)) { return; } for (int i = 0; i < boosterCount; i++) { GameObject val = Object.Instantiate<GameObject>(boosterPrefab, spawnPoint, Random.rotation); val.GetComponent<TeamFilter>().teamIndex = team; VelocityRandomOnStart component = val.GetComponent<VelocityRandomOnStart>(); if ((Object)(object)component != (Object)null) { component.baseDirection = new Vector3((float)Random.Range(-1, 1), Random.Range(-0.6f, 0.2f), (float)Random.Range(-1, 1)); } NetworkServer.Spawn(val); } } } public class NebulaGravitate : GravitatePickup { private void FixedUpdate() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)base.gravitateTarget)) { Rigidbody rigidbody = base.rigidbody; Vector3 velocity = base.rigidbody.velocity; Vector3 val = ((Component)base.gravitateTarget).transform.position - ((Component)this).transform.position; rigidbody.velocity = Vector3.MoveTowards(velocity, ((Vector3)(ref val)).normalized * base.maxSpeed, base.acceleration); } } } [RequireComponent(typeof(ProjectileDamage))] public class ProjectileIncreaseDamageAfterDistance : MonoBehaviour { private ProjectileDamage projectileDamage; public float requiredDistance = 21f; public float damageMultiplierOnIncrease = 1f; public GameObject effectPrefab; private Vector3 initialPosition; private bool damageIncreased; private float requiredDistanceSqr => requiredDistance * requiredDistance; private void OnEnable() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) initialPosition = ((Component)this).transform.position; projectileDamage = ((Component)this).GetComponent<ProjectileDamage>(); } private void FixedUpdate() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown if (!NetworkServer.active || damageIncreased) { return; } Vector3 val = ((Component)this).transform.position - initialPosition; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude >= requiredDistanceSqr) { damageIncreased = true; ProjectileDamage obj = projectileDamage; obj.damage *= damageMultiplierOnIncrease; if ((Object)(object)effectPrefab != (Object)null) { EffectData val2 = new EffectData { origin = ((Component)this).transform.position }; EffectManager.SpawnEffect(effectPrefab, val2, true); } } } } public class ProjectileOverlapDecayDamage : ProjectileOverlapLimitHits { internal float initialDamageCoefficient = 1f; internal float initialProcCoefficient = 1f; public float firstHitDamageMultiplier = 1f; public float onHitDamageMultiplier = 1f; } }