Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of StormChilledWorms v0.1.3
plugins/StormChilledWorms/StormChilledWorms.dll
Decompiled 8 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Bootstrap; using HarmonyLib; using Microsoft.CodeAnalysis; using R2API; using R2API.Utils; using RoR2; using RoR2.Orbs; using RoR2.Projectile; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace StormChilledWorms { public sealed class StormLightningOrb : LightningStrikeOrb { } [HarmonyPatch(typeof(LightningStrikeOrb), "OnArrival")] internal static class LightningColor { internal static DamageColorIndex ResolveColor(LightningStrikeOrb orb) { if (orb is StormLightningOrb) { return (DamageColorIndex)16; } return (DamageColorIndex)3; } private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); FieldInfo objB = AccessTools.Field(typeof(BlastAttack), "damageColorIndex"); MethodInfo methodInfo = AccessTools.Method(typeof(LightningColor), "ResolveColor", (Type[])null, (Type[])null); int num = 0; for (int i = 1; i < list.Count; i++) { if (!(list[i].opcode != OpCodes.Stfld) && object.Equals(list[i].operand, objB)) { if (list[i - 1].opcode != OpCodes.Ldc_I4_3) { throw new InvalidOperationException("Native lightning damage-color assignment changed."); } list[i - 1].opcode = OpCodes.Ldarg_0; list[i - 1].operand = null; list.Insert(i, new CodeInstruction(OpCodes.Call, (object)methodInfo)); i++; num++; } } if (num != 1) { throw new InvalidOperationException("Could not identify the native lightning damage-color assignment."); } return list; } } [BepInPlugin("wreckzog.stormchilledworms", "Storm-Chilled Worms", "0.1.3")] [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.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { public const string Guid = "wreckzog.stormchilledworms"; public const string Version = "0.1.3"; private Harmony harmony; private void Awake() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown object? obj = ((object)Chainloader.PluginInfos["wreckzog.glacialperforator"].Instance).GetType().GetField("Item", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null); ItemDef val = (ItemDef)((obj is ItemDef) ? obj : null); if (!Object.op_Implicit((Object)(object)val) || ((Object)val).name != "GlacialPerforator") { throw new InvalidOperationException("Glacial Perforator's recipe ingredient is unavailable; use a compatible Glacial Perforator installation."); } ItemDef charged = Visuals.Load<ItemDef>((object)"RoR2/Base/LightningStrikeOnHit/LightningStrikeOnHit.asset"); StormWorms.Register(val, charged); harmony = new Harmony("wreckzog.stormchilledworms"); harmony.PatchAll(typeof(Plugin).Assembly); GlobalEventManager.onServerDamageDealt += StormWorms.OnDamage; RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(Verify)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Storm-Chilled Worms loaded as a separate plugin; Glacial + Charged Perforator recipe."); } private void Verify() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 try { if (!Object.op_Implicit((Object)(object)StormWorms.Item) || (int)StormWorms.Item.itemIndex == -1 || ProjectileCatalog.GetProjectileIndex(StormWorms.Projectile) < 0) { throw new InvalidOperationException("Storm-Chilled Worms catalog registration failed."); } StormWorms.AddDisplays(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"STORM CATALOG CHECK PASSED: separate food item, projectile and worn displays."); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("STORM VALIDATION FAILED: " + ex)); } } private void OnDestroy() { GlobalEventManager.onServerDamageDealt -= StormWorms.OnDamage; RoR2Application.onLoad = (Action)Delegate.Remove(RoR2Application.onLoad, new Action(Verify)); Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } } } internal static class StormWorms { internal static ItemDef Item; internal static ItemDef Source; internal static GameObject Projectile; internal static GameObject Ghost; internal static GameObject SummonEffect; internal static CraftableDef Recipe; internal static ModdedProcType Proc; internal const float Lifetime = 10f; internal const float DamageCoefficient = 5f; internal static readonly Color Blue = new Color(0.24f, 0.7f, 1f); private static readonly Dictionary<Material, Material> materials = new Dictionary<Material, Material>(); private static readonly Dictionary<Texture, Texture2D> ramps = new Dictionary<Texture, Texture2D>(); internal static void Register(ItemDef glacial, ItemDef charged) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Expected O, but got Unknown Proc = ProcTypeAPI.ReserveProcType(); Source = Visuals.Load<ItemDef>((object)"RoR2/DLC3/Items/WyrmOnHit/WyrmOnHit.asset"); Item = Object.Instantiate<ItemDef>(Source); ((Object)Item).name = "StormChilledWorms"; Item.nameToken = "STORM_CHILLED_WORMS_NAME"; Item.pickupToken = "STORM_CHILLED_WORMS_PICKUP"; Item.descriptionToken = "STORM_CHILLED_WORMS_DESCRIPTION"; Item.loreToken = "STORM_CHILLED_WORMS_LORE"; Item.tags = (ItemTag[])Source.tags.Clone(); Item.pickupModelPrefab = CloneBlue(Visuals.Load<GameObject>(((AssetReference)Source.pickupModelReference).RuntimeKey), "PickupStormChilledWorms"); Item.pickupModelReference = null; Item.pickupIconSprite = BlueIcon(Visuals.Load<Sprite>(((AssetReference)Source.pickupIconSpriteReference).RuntimeKey)); Item.pickupIconSpriteReference = null; if (!ContentAddition.AddItemDef(Item)) { throw new InvalidOperationException("Storm-Chilled Worms registration failed."); } LanguageAPI.Add(Item.nameToken, "Storm-Chilled Worms"); LanguageAPI.Add(Item.pickupToken, "Summon light-blue worms that freeze enemies and call down lightning."); LanguageAPI.Add(Item.descriptionToken, "<style=cIsDamage>10%</style> chance on hit to summon a <style=cIsUtility>light-blue worm</style> for <style=cIsUtility>10 seconds</style>, dealing <style=cIsDamage>100%</style> <style=cStack>(+100% per stack)</style> TOTAL damage per contact, up to 5 times per second. Worm hits <style=cIsUtility>slow by 80% for 3s</style> and <style=cIsUtility>freeze for 2s</style> (3s cooldown per target). Each worm calls down <style=cIsDamage>150%</style> <style=cStack>(+150% per stack)</style> TOTAL damage lightning at most once per second. Maximum <style=cIsUtility>8</style> worms, with a 1s summon cooldown. Summon chance decreases with active worms."); LanguageAPI.Add(Item.loreToken, "CHEF'S NOTES:\n\nDo not thaw.\nDo not ground.\nServe before the plate learns to fly."); Projectile = PrefabAPI.InstantiateClone(Visuals.Load<GameObject>((object)"RoR2/DLC3/Items/WyrmOnHit/WyrmProjectile.prefab"), "StormChilledWormProjectile", true); ProjectileController component = Projectile.GetComponent<ProjectileController>(); GameObject val = component.ghostPrefab; if (!Object.op_Implicit((Object)(object)val)) { val = Visuals.Load<GameObject>(((AssetReference)component.ghostPrefabAddress).RuntimeKey); } Ghost = CloneBlue(val, "StormChilledWormGhost"); component.ghostPrefab = Ghost; component.ghostPrefabAddress = null; Object.DestroyImmediate((Object)(object)Projectile.GetComponent<ProjectileDeployToOwner>()); Projectile.AddComponent<StormWormProjectile>(); Projectile.GetComponent<ProjectileDamage>().damageType = DamageTypeCombo.op_Implicit((DamageType)0); ProjectileOverlapAttack component2 = Projectile.GetComponent<ProjectileOverlapAttack>(); if (Object.op_Implicit((Object)(object)component2.impactEffect)) { component2.impactEffect = BlueEffect(component2.impactEffect, "StormWormContact"); } ProjectileBurrowOnImpact component3 = Projectile.GetComponent<ProjectileBurrowOnImpact>(); component3.burrowPrefab = BlueEffect(component3.burrowPrefab, "StormWormBurrow"); SummonEffect = BlueEffect(Visuals.Load<GameObject>((object)"RoR2/DLC3/Items/WyrmOnHit/WyrmSummonFX.prefab"), "StormWormSummon"); if (!ContentAddition.AddProjectile(Projectile)) { throw new InvalidOperationException("Storm worm projectile registration failed."); } Recipe = ScriptableObject.CreateInstance<CraftableDef>(); ((Object)Recipe).name = "CraftableStormChilledWorms"; Recipe.pickup = (Object)(object)Item; CraftableDef recipe = Recipe; Recipe[] array = new Recipe[1]; Recipe val2 = new Recipe(); val2.amountToDrop = 1; val2.ingredients = (RecipeIngredient[])(object)new RecipeIngredient[2] { Ingredient(glacial), Ingredient(charged) }; array[0] = val2; recipe.recipes = (Recipe[])(object)array; if (!ContentAddition.AddCraftableDef(Recipe)) { throw new InvalidOperationException("Storm worm recipe registration failed."); } } private static RecipeIngredient Ingredient(ItemDef item) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown return new RecipeIngredient { type = (IngredientTypeIndex)0, pickup = (Object)(object)item, requiredTags = Array.Empty<ItemTag>(), forbiddenTags = Array.Empty<ItemTag>() }; } private static GameObject BlueEffect(GameObject source, string name) { GameObject obj = CloneBlue(source, name); if (!ContentAddition.AddEffect(obj)) { throw new InvalidOperationException(name + " registration failed."); } return obj; } internal static GameObject CloneBlue(GameObject source, string name) { //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) GameObject val = PrefabAPI.InstantiateClone(source, name, false); Visuals.FrostModel(val); Renderer[] componentsInChildren = val.GetComponentsInChildren<Renderer>(true); foreach (Renderer val2 in componentsInChildren) { Material[] sharedMaterials = val2.sharedMaterials; for (int j = 0; j < sharedMaterials.Length; j++) { sharedMaterials[j] = BlueMaterial(sharedMaterials[j]); } val2.sharedMaterials = sharedMaterials; } ItemDisplay[] componentsInChildren2 = val.GetComponentsInChildren<ItemDisplay>(true); foreach (ItemDisplay val3 in componentsInChildren2) { RendererInfo[] array = (RendererInfo[])val3.rendererInfos.Clone(); for (int k = 0; k < array.Length; k++) { array[k].defaultMaterial = BlueMaterial(array[k].defaultMaterial); } val3.rendererInfos = array; } ParticleSystem[] componentsInChildren3 = val.GetComponentsInChildren<ParticleSystem>(true); for (int i = 0; i < componentsInChildren3.Length; i++) { MainModule main = componentsInChildren3[i].main; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(Blue); } Light[] componentsInChildren4 = val.GetComponentsInChildren<Light>(true); foreach (Light obj in componentsInChildren4) { obj.color = Blue; obj.intensity = Mathf.Min(obj.intensity, 1f); } return val; } private static Material BlueMaterial(Material source) { //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_0038: Expected O, but got Unknown //IL_0076: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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_0111: 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_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: 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) if (!Object.op_Implicit((Object)(object)source)) { return null; } if (materials.TryGetValue(source, out var value)) { return value; } Material val = new Material(source) { name = "StormChilled_" + ((Object)source).name }; Color val2 = (Color)((((Object)source).name.Contains("Default-Material") || ((Object)source).name.EndsWith("matWyrmOnHitPickup", StringComparison.Ordinal)) ? new Color(0.96f, 0.98f, 1f) : Blue); string[] array = new string[4] { "_Color", "_TintColor", "_EmColor", "_EmissionColor" }; foreach (string text in array) { if (val.HasProperty(text)) { Color color = val.GetColor(text); val.SetColor(text, val2 * new Color(Mathf.Max(color.r, Mathf.Max(color.g, color.b)), Mathf.Max(color.r, Mathf.Max(color.g, color.b)), Mathf.Max(color.r, Mathf.Max(color.g, color.b)), color.a)); } } array = new string[3] { "_FlowHeightRamp", "_FresnelRamp", "_FresnelRemapTex" }; foreach (string text2 in array) { if (source.HasProperty(text2) && Object.op_Implicit((Object)(object)source.GetTexture(text2))) { val.SetTexture(text2, (Texture)(object)BlueRamp(source.GetTexture(text2))); } } if (source.HasProperty("_FlowHeightRamp") && Object.op_Implicit((Object)(object)source.GetTexture("_FlowHeightRamp"))) { if (val.HasProperty("_Color")) { val.SetColor("_Color", new Color(0.84f, 0.89f, 0.94f)); } if (val.HasProperty("_FlowDiffuseStrength")) { val.SetFloat("_FlowDiffuseStrength", 0.65f); } if (val.HasProperty("_FlowEmissionStrength")) { val.SetFloat("_FlowEmissionStrength", 1.2f); } } array = new string[2] { "_RimTint", "_SpecularTint" }; foreach (string text3 in array) { if (val.HasProperty(text3)) { val.SetColor(text3, new Color(0.7f, 0.86f, 1f)); } } materials.Add(source, val); return val; } private static Texture2D BlueRamp(Texture source) { //IL_006d: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_00ad: Unknown result type (might be due to invalid IL or missing references) if (ramps.TryGetValue(source, out var value)) { return value; } Texture2D val = Object.Instantiate<Texture2D>(Visuals.FrostTexture(source)); Color[] pixels = val.GetPixels(); for (int i = 0; i < pixels.Length; i++) { float num = Mathf.Max(pixels[i].r, Mathf.Max(pixels[i].g, pixels[i].b)); Color val2 = Color.Lerp(new Color(0.06f, 0.24f, 0.48f), new Color(0.38f, 0.82f, 1f), num) * num; val2.a = pixels[i].a; pixels[i] = val2; } val.SetPixels(pixels); val.Apply(); ((Object)val).name = "StormChilled_" + ((Object)source).name; ramps.Add(source, val); return val; } private static Sprite BlueIcon(Sprite source) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_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_007b: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) RenderTexture active = RenderTexture.active; RenderTexture temporary = RenderTexture.GetTemporary(((Texture)source.texture).width, ((Texture)source.texture).height, 0, (RenderTextureFormat)0, (RenderTextureReadWrite)2); Texture2D val = null; try { Graphics.Blit((Texture)(object)source.texture, temporary); RenderTexture.active = temporary; val = new Texture2D(((Texture)temporary).width, ((Texture)temporary).height, (TextureFormat)4, true, false) { name = "texStormChilledWorms", filterMode = ((Texture)source.texture).filterMode, wrapMode = ((Texture)source.texture).wrapMode }; val.ReadPixels(new Rect(0f, 0f, (float)((Texture)temporary).width, (float)((Texture)temporary).height), 0, 0); Color32[] pixels = val.GetPixels32(); bool[] array = FoodFrameMask(pixels, ((Texture)val).width, ((Texture)val).height); for (int i = 0; i < pixels.Length; i++) { if (!array[i]) { Color32 val2 = pixels[i]; float num = Mathf.Pow((float)Mathf.Max((int)val2.r, Mathf.Max((int)val2.g, (int)val2.b)) / 255f, 0.72f); pixels[i] = Color32.op_Implicit(new Color(num * (0.82f + 0.18f * num) * Blue.r, num * (0.94f + 0.06f * num) * Blue.g, num * Blue.b, (float)(int)val2.a / 255f)); } } val.SetPixels32(pixels); val.Apply(); Texture2D obj = val; Rect rect = source.rect; float x = source.pivot.x; Rect rect2 = source.rect; float num2 = x / ((Rect)(ref rect2)).width; float y = source.pivot.y; rect2 = source.rect; return Sprite.Create(obj, rect, new Vector2(num2, y / ((Rect)(ref rect2)).height), source.pixelsPerUnit); } catch { if (Object.op_Implicit((Object)(object)val)) { Object.Destroy((Object)(object)val); } throw; } finally { RenderTexture.active = active; RenderTexture.ReleaseTemporary(temporary); } } internal static bool[] FoodFrameMask(Color32[] pixels, int width, int height) { //IL_0020: 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) bool[] array = new bool[pixels.Length]; List<int> list = new List<int>(); for (int i = 0; i < pixels.Length; i++) { if (array[i] || !WarmIconPixel(pixels[i])) { continue; } List<int> list2 = new List<int>(); Queue<int> queue = new Queue<int>(); queue.Enqueue(i); array[i] = true; while (queue.Count > 0) { int num = queue.Dequeue(); list2.Add(num); int num2 = num % width; int num3 = num / width; for (int j = -1; j <= 1; j++) { for (int k = -1; k <= 1; k++) { int num4 = num2 + k; int num5 = num3 + j; if (num4 >= 0 && num4 < width && num5 >= 0 && num5 < height) { int num6 = num5 * width + num4; if (!array[num6] && WarmIconPixel(pixels[num6])) { array[num6] = true; queue.Enqueue(num6); } } } } } if (list2.Count > list.Count) { list = list2; } } bool[] array2 = new bool[pixels.Length]; foreach (int item in list) { array2[item] = true; } return array2; } private static bool WarmIconPixel(Color32 pixel) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (pixel.r > pixel.b + 12 && pixel.g > pixel.b + 8) { return (float)(int)pixel.r > (float)(int)pixel.g * 0.9f; } return false; } internal static void OnDamage(DamageReport report) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_009a: Invalid comparison between Unknown and I4 //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0214: 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_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_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_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || report?.damageInfo == null || !Object.op_Implicit((Object)(object)Item)) { return; } DamageInfo damageInfo = report.damageInfo; CharacterBody attackerBody = report.attackerBody; if (!Object.op_Implicit((Object)(object)attackerBody) || !Object.op_Implicit((Object)(object)attackerBody.inventory) || !Object.op_Implicit((Object)(object)report.victim) || !Object.op_Implicit((Object)(object)report.victimBody) || (Object)(object)attackerBody == (Object)(object)report.victimBody || report.attackerTeamIndex == report.victimTeamIndex || (int)report.victimTeamIndex == 0 || damageInfo.rejected || damageInfo.delayedDamageSecondHalf || (int)damageInfo.dotIndex != -1 || !PositiveFinite(report.damageDealt)) { return; } StormWormProjectile stormWormProjectile = (Object.op_Implicit((Object)(object)damageInfo.inflictor) ? damageInfo.inflictor.GetComponent<StormWormProjectile>() : null); if (Object.op_Implicit((Object)(object)stormWormProjectile)) { stormWormProjectile.OnHit(report); } else { if (!Object.op_Implicit((Object)(object)ProjectileManager.instance) || !PositiveFinite(damageInfo.procCoefficient) || ProcTypeAPI.HasModdedProc(damageInfo.procChainMask, Proc) || ((ProcChainMask)(ref damageInfo.procChainMask)).HasProc((ProcType)27)) { return; } int itemCountEffective = attackerBody.inventory.GetItemCountEffective(Item); float num = Damage(damageInfo.damage, itemCountEffective); if (!(num <= 0f) && Object.op_Implicit((Object)(object)attackerBody.healthComponent) && attackerBody.healthComponent.alive) { StormWormOwner stormWormOwner = ((Component)attackerBody).GetComponent<StormWormOwner>(); if (!Object.op_Implicit((Object)(object)stormWormOwner)) { stormWormOwner = ((Component)attackerBody).gameObject.AddComponent<StormWormOwner>(); } int num2 = StormWormProjectile.Count(((Component)attackerBody).gameObject); if (!(Time.fixedTime < stormWormOwner.nextSummon) && num2 < 8 && Util.CheckRoll(Mathf.Min(100f, 10f * damageInfo.procCoefficient / (float)(1 + num2)), attackerBody.master)) { ProcChainMask procChainMask = damageInfo.procChainMask; ProcTypeAPI.AddModdedProc(ref procChainMask, Proc); ((ProcChainMask)(ref procChainMask)).AddProc((ProcType)27); stormWormOwner.nextSummon = Time.fixedTime + 1f; ProjectileManager instance = ProjectileManager.instance; FireProjectileInfo val = new FireProjectileInfo { projectilePrefab = Projectile, owner = ((Component)attackerBody).gameObject, position = attackerBody.corePosition, rotation = Util.QuaternionSafeLookRotation(damageInfo.position - attackerBody.corePosition + Random.onUnitSphere * 0.1f), target = (Object.op_Implicit((Object)(object)damageInfo.inflictedHurtbox) ? ((Component)damageInfo.inflictedHurtbox).gameObject : ((Component)report.victimBody).gameObject), damage = num, crit = damageInfo.crit, procChainMask = procChainMask, damageColorIndex = (DamageColorIndex)3, useFuseOverride = true }; ((FireProjectileInfo)(ref val)).fuseOverride = 10f; instance.FireProjectile(val); } } } } internal static bool PositiveFinite(float x) { if (x > 0f && !float.IsNaN(x)) { return !float.IsInfinity(x); } return false; } internal static float Damage(float hit, int count) { double num = (double)hit * 5.0 * (double)count; if (!PositiveFinite(hit) || count <= 0 || !(num <= 3.4028234663852886E+38)) { return 0f; } return (float)num; } internal static void AddDisplays() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_015a: 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) HashSet<ItemDisplayRuleSet> hashSet = new HashSet<ItemDisplayRuleSet>(); Dictionary<GameObject, GameObject> dictionary = new Dictionary<GameObject, GameObject>(); foreach (GameObject allBodyPrefab in BodyCatalog.allBodyPrefabs) { CharacterModel[] componentsInChildren = allBodyPrefab.GetComponentsInChildren<CharacterModel>(true); for (int i = 0; i < componentsInChildren.Length; i++) { ItemDisplayRuleSet itemDisplayRuleSet = componentsInChildren[i].itemDisplayRuleSet; if (!Object.op_Implicit((Object)(object)itemDisplayRuleSet) || !hashSet.Add(itemDisplayRuleSet)) { continue; } DisplayRuleGroup itemDisplayRuleGroup = itemDisplayRuleSet.GetItemDisplayRuleGroup(Source.itemIndex); if (itemDisplayRuleGroup.rules == null || itemDisplayRuleGroup.rules.Length == 0) { continue; } ItemDisplayRule[] array = (ItemDisplayRule[])itemDisplayRuleGroup.rules.Clone(); for (int j = 0; j < array.Length; j++) { GameObject val = array[j].followerPrefab; if (!Object.op_Implicit((Object)(object)val) && array[j].followerPrefabAddress != null && ((AssetReference)array[j].followerPrefabAddress).RuntimeKeyIsValid()) { val = Visuals.Load<GameObject>(((AssetReference)array[j].followerPrefabAddress).RuntimeKey); } if (Object.op_Implicit((Object)(object)val)) { if (!dictionary.TryGetValue(val, out var value)) { value = CloneBlue(val, "DisplayStormChilledWorms"); dictionary.Add(val, value); } array[j].followerPrefab = value; array[j].followerPrefabAddress = null; } } itemDisplayRuleSet.SetDisplayRuleGroup((Object)(object)Item, new DisplayRuleGroup { rules = array }); itemDisplayRuleSet.GenerateRuntimeValues(); } } } } [HarmonyPatch(typeof(EventFunctions), "CreateLocalEffect")] internal static class StormWormLocalEffect { private static void Prefix(EventFunctions __instance, ref GameObject __0) { if (Object.op_Implicit((Object)(object)__0) && ((Object)__0).name == "WyrmSummonFX" && Object.op_Implicit((Object)(object)((Component)__instance).GetComponent<StormWormProjectile>())) { __0 = StormWorms.SummonEffect; } } } public sealed class StormWormOwner : MonoBehaviour { internal float nextSummon; } public sealed class StormWormFreezeCooldown : MonoBehaviour { internal float nextFreeze; } public sealed class StormWormProjectile : MonoBehaviour { private static readonly HashSet<StormWormProjectile> active = new HashSet<StormWormProjectile>(); private ProjectileController controller; private ProjectileOverlapAttack overlap; private float nextLightning; private void Awake() { controller = ((Component)this).GetComponent<ProjectileController>(); overlap = ((Component)this).GetComponent<ProjectileOverlapAttack>(); } private void OnEnable() { nextLightning = 0f; active.Add(this); } private void OnDisable() { active.Remove(this); } internal static int Count(GameObject owner) { int num = 0; foreach (StormWormProjectile item in active) { if (Object.op_Implicit((Object)(object)item) && Object.op_Implicit((Object)(object)item.controller) && (Object)(object)item.controller.owner == (Object)(object)owner && Object.op_Implicit((Object)(object)item.overlap) && ((Behaviour)item.overlap).enabled) { num++; } } return num; } internal void OnHit(DamageReport report) { //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) CharacterBody victimBody = report.victimBody; if (report.victim.alive) { victimBody.AddTimedBuff(Buffs.Slow80, 3f); SetStateOnHurt component = ((Component)victimBody).GetComponent<SetStateOnHurt>(); if (Object.op_Implicit((Object)(object)component) && component.canBeFrozen) { StormWormFreezeCooldown stormWormFreezeCooldown = ((Component)victimBody).GetComponent<StormWormFreezeCooldown>(); if (!Object.op_Implicit((Object)(object)stormWormFreezeCooldown)) { stormWormFreezeCooldown = ((Component)victimBody).gameObject.AddComponent<StormWormFreezeCooldown>(); } if (Time.fixedTime >= stormWormFreezeCooldown.nextFreeze) { stormWormFreezeCooldown.nextFreeze = Time.fixedTime + 3f; component.SetFrozen(2f); } } } if (Object.op_Implicit((Object)(object)OrbManager.instance) && !(Time.fixedTime < nextLightning) && Object.op_Implicit((Object)(object)controller) && Object.op_Implicit((Object)(object)controller.owner)) { ProjectileDamage component2 = ((Component)this).GetComponent<ProjectileDamage>(); if (Object.op_Implicit((Object)(object)component2) && StormWorms.PositiveFinite(component2.damage)) { nextLightning = Time.fixedTime + 1f; ProcChainMask procChainMask = controller.procChainMask; ProcTypeAPI.AddModdedProc(ref procChainMask, StormWorms.Proc); ((ProcChainMask)(ref procChainMask)).AddProc((ProcType)27); ((ProcChainMask)(ref procChainMask)).AddProc((ProcType)18); OrbManager.instance.AddOrb((Orb)(object)new StormLightningOrb { attacker = controller.owner, teamIndex = report.attackerTeamIndex, origin = report.damageInfo.position, target = victimBody.mainHurtBox, damageValue = component2.damage * 0.3f, isCrit = component2.crit, procChainMask = procChainMask, procCoefficient = 0.2f, damageColorIndex = (DamageColorIndex)16 }); } } } } internal static class Visuals { private static readonly Dictionary<Texture, Texture2D> textures = new Dictionary<Texture, Texture2D>(); private static readonly Dictionary<Texture, Texture2D> iconTextures = new Dictionary<Texture, Texture2D>(); private static readonly Dictionary<Texture, Texture2D> wormTextures = new Dictionary<Texture, Texture2D>(); private static readonly Dictionary<Texture, Texture2D> snowTextures = new Dictionary<Texture, Texture2D>(); private static readonly Dictionary<Material, Material> materials = new Dictionary<Material, Material>(); private static readonly Dictionary<Material, Material> wormMaterials = new Dictionary<Material, Material>(); internal static readonly Color Ice = new Color(0.78f, 0.92f, 1f, 1f); internal static T Load<T>(object key) where T : Object { //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) T val = Addressables.LoadAssetAsync<T>(key).WaitForCompletion(); if (!Object.op_Implicit((Object)(object)val)) { throw new InvalidOperationException("Missing native asset: " + key); } return val; } internal static Texture2D FrostTexture(Texture source, bool preserveBossOutline = false, bool wormAlbedo = false, bool neutralSnow = false) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_009f: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: 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_0185: 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_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0274: 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_01ff: 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_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)source)) { return null; } Dictionary<Texture, Texture2D> dictionary = (preserveBossOutline ? iconTextures : (neutralSnow ? snowTextures : (wormAlbedo ? wormTextures : textures))); if (dictionary.TryGetValue(source, out var value)) { return value; } if ((int)SystemInfo.graphicsDeviceType == 4) { return (Texture2D)(object)((source is Texture2D) ? source : null); } RenderTexture active = RenderTexture.active; RenderTexture temporary = RenderTexture.GetTemporary(source.width, source.height, 0, (RenderTextureFormat)0, (RenderTextureReadWrite)2); Texture2D val = null; try { Graphics.Blit(source, temporary); RenderTexture.active = temporary; val = new Texture2D(source.width, source.height, (TextureFormat)4, true, false) { name = "Glacial_" + ((Object)source).name, filterMode = source.filterMode, wrapMode = source.wrapMode }; val.ReadPixels(new Rect(0f, 0f, (float)source.width, (float)source.height), 0, 0); Color32[] pixels = val.GetPixels32(); for (int i = 0; i < pixels.Length; i++) { Color32 val2 = pixels[i]; if (!preserveBossOutline || Mathf.Min((int)val2.r, (int)val2.g) - val2.b <= 12 || !((float)(int)val2.r > (float)(int)val2.g * 0.65f) || !((float)(int)val2.g > (float)(int)val2.r * 0.65f)) { float num = Mathf.Pow((float)Mathf.Max((int)val2.r, Mathf.Max((int)val2.g, (int)val2.b)) / 255f, 0.72f); if (neutralSnow) { float num2 = (float)Mathf.Max((int)val2.r, Mathf.Max((int)val2.g, (int)val2.b)) / 255f; pixels[i] = Color32.op_Implicit(new Color(num2, num2, num2, (float)(int)val2.a / 255f)); } else if (wormAlbedo) { Color val3 = Color.Lerp(new Color(0.38f, 0.55f, 0.64f), new Color(0.94f, 0.98f, 1f), num); val3.a = (float)(int)val2.a / 255f; pixels[i] = Color32.op_Implicit(val3); } else { pixels[i] = Color32.op_Implicit(new Color(num * (0.82f + 0.18f * num), num * (0.94f + 0.06f * num), num, (float)(int)val2.a / 255f)); } } } val.SetPixels32(pixels); val.Apply(true, false); dictionary.Add(source, val); return val; } catch { if (Object.op_Implicit((Object)(object)val)) { Object.Destroy((Object)(object)val); } throw; } finally { RenderTexture.active = active; RenderTexture.ReleaseTemporary(temporary); } } internal static Sprite FrostIcon(Sprite source) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)source)) { throw new InvalidOperationException("Native Perforator icon missing."); } Texture2D obj = FrostTexture((Texture)(object)source.texture, preserveBossOutline: true); Rect rect = source.rect; float x = source.pivot.x; Rect rect2 = source.rect; float num = x / ((Rect)(ref rect2)).width; float y = source.pivot.y; rect2 = source.rect; Sprite obj2 = Sprite.Create(obj, rect, new Vector2(num, y / ((Rect)(ref rect2)).height), source.pixelsPerUnit); ((Object)obj2).name = "Glacial_" + ((Object)source).name; return obj2; } internal static Material FrostMaterial(Material source) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)source)) { return null; } if (((Object)source).name.StartsWith("Glacial_", StringComparison.Ordinal)) { return source; } if (materials.TryGetValue(source, out var value)) { return value; } Material val = new Material(source) { name = "Glacial_" + ((Object)source).name }; string[] array = new string[4] { "_MainTex", "_EmTex", "_EmissionMap", "_RemapTex" }; foreach (string text in array) { if (val.HasProperty(text) && Object.op_Implicit((Object)(object)val.GetTexture(text))) { val.SetTexture(text, (Texture)(object)FrostTexture(val.GetTexture(text))); } } array = new string[4] { "_Color", "_TintColor", "_EmColor", "_EmissionColor" }; foreach (string text2 in array) { if (val.HasProperty(text2)) { Color color = val.GetColor(text2); float num = Mathf.Max(color.r, Mathf.Max(color.g, color.b)); val.SetColor(text2, new Color(Ice.r * num, Ice.g * num, num, color.a)); } } materials.Add(source, val); return val; } private static Material FrostWormMaterial(Material source) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_0119: 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_0153: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)source)) { return null; } if (((Object)source).name.StartsWith("GlacialWorm_", StringComparison.Ordinal)) { return source; } if (wormMaterials.TryGetValue(source, out var value)) { return value; } Material val = new Material(FrostMaterial(source)) { name = "GlacialWorm_" + ((Object)source).name }; if (source.HasProperty("_MainTex") && Object.op_Implicit((Object)(object)source.GetTexture("_MainTex"))) { val.SetTexture("_MainTex", (Texture)(object)FrostTexture(source.GetTexture("_MainTex"), preserveBossOutline: false, wormAlbedo: true)); } if (source.HasProperty("_FlowHeightRamp") && Object.op_Implicit((Object)(object)source.GetTexture("_FlowHeightRamp"))) { val.SetTexture("_FlowHeightRamp", (Texture)(object)FrostTexture(source.GetTexture("_FlowHeightRamp"))); } if (val.HasProperty("_FlowEmissionStrength")) { val.SetFloat("_FlowEmissionStrength", 2.2f); } if (val.HasProperty("_FlowDiffuseStrength")) { val.SetFloat("_FlowDiffuseStrength", 0.5f); } if (val.HasProperty("_Color")) { val.SetColor("_Color", Color.white); } if (val.HasProperty("_SpecularTint")) { val.SetColor("_SpecularTint", Ice); } if (val.HasProperty("_RimTint")) { val.SetColor("_RimTint", Ice); } if (val.HasProperty("_EmColor")) { val.SetColor("_EmColor", new Color(0.72f, 0.93f, 1f)); } if (val.HasProperty("_EmPower")) { val.SetFloat("_EmPower", Mathf.Min(val.GetFloat("_EmPower"), 1.4f)); } if (val.HasProperty("_Smoothness")) { val.SetFloat("_Smoothness", 0.65f); } if (val.HasProperty("_SpecularStrength")) { val.SetFloat("_SpecularStrength", 0.25f); } wormMaterials.Add(source, val); return val; } internal static GameObject FrostPrefab(GameObject source, string name) { if (!Object.op_Implicit((Object)(object)source)) { throw new InvalidOperationException("Native model missing: " + name); } GameObject obj = PrefabAPI.InstantiateClone(source, name, false); FrostModel(obj); return obj; } internal static void FrostModel(GameObject root, bool wormBody = false) { //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Expected O, but got Unknown //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: 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_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = root.GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { Material[] sharedMaterials = val.sharedMaterials; for (int j = 0; j < sharedMaterials.Length; j++) { sharedMaterials[j] = ((wormBody && !(val is ParticleSystemRenderer)) ? FrostWormMaterial(sharedMaterials[j]) : FrostMaterial(sharedMaterials[j])); } val.sharedMaterials = sharedMaterials; } CharacterModel[] componentsInChildren2 = root.GetComponentsInChildren<CharacterModel>(true); foreach (CharacterModel val2 in componentsInChildren2) { if (val2.baseRendererInfos == null) { continue; } RendererInfo[] array = (RendererInfo[])val2.baseRendererInfos.Clone(); for (int k = 0; k < array.Length; k++) { Material val3 = array[k].defaultMaterial; if (!Object.op_Implicit((Object)(object)val3) && array[k].defaultMaterialAddress != null && ((AssetReference)array[k].defaultMaterialAddress).RuntimeKeyIsValid()) { val3 = Visuals.Load<Material>(((AssetReference)array[k].defaultMaterialAddress).RuntimeKey); } array[k].defaultMaterial = ((wormBody && !(array[k].renderer is ParticleSystemRenderer)) ? FrostWormMaterial(val3) : FrostMaterial(val3)); array[k].defaultMaterialAddress = null; } val2.baseRendererInfos = array; val2.forceUpdate = true; } ItemDisplay[] componentsInChildren3 = root.GetComponentsInChildren<ItemDisplay>(true); foreach (ItemDisplay val4 in componentsInChildren3) { if (val4.rendererInfos == null) { continue; } RendererInfo[] array2 = (RendererInfo[])val4.rendererInfos.Clone(); for (int l = 0; l < array2.Length; l++) { Material val5 = array2[l].defaultMaterial; if (!Object.op_Implicit((Object)(object)val5) && array2[l].defaultMaterialAddress != null && ((AssetReference)array2[l].defaultMaterialAddress).RuntimeKeyIsValid()) { val5 = Visuals.Load<Material>(((AssetReference)array2[l].defaultMaterialAddress).RuntimeKey); } array2[l].defaultMaterial = FrostMaterial(val5); array2[l].defaultMaterialAddress = null; } val4.rendererInfos = array2; val4.canBeEliteRecolored = false; } Light[] componentsInChildren4 = root.GetComponentsInChildren<Light>(true); for (int i = 0; i < componentsInChildren4.Length; i++) { componentsInChildren4[i].color = Ice; } ParticleSystem[] componentsInChildren5 = root.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem obj in componentsInChildren5) { MainModule main = obj.main; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(Ice); ColorOverLifetimeModule colorOverLifetime = obj.colorOverLifetime; if (((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled) { Gradient val6 = new Gradient(); MinMaxGradient color = ((ColorOverLifetimeModule)(ref colorOverLifetime)).color; GradientAlphaKey[] array3 = (GradientAlphaKey[])((((MinMaxGradient)(ref color)).gradient != null) ? ((Array)((MinMaxGradient)(ref color)).gradient.alphaKeys) : ((Array)new GradientAlphaKey[2] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(0f, 1f) })); val6.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(Ice, 0f), new GradientColorKey(Color.white, 1f) }, array3); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val6); } } } } }