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 Lifeweaver Seeker v1.0.0
LifeweaverSeeker.dll
Decompiled a day agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Text; using BepInEx; using BepInEx.Logging; using EntityStates; using EntityStates.Seeker; using HarmonyLib; using Microsoft.CodeAnalysis; using R2API; using RoR2; using RoR2.PostProcessing; using RoR2.Projectile; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.AddressableAssets.ResourceLocators; using UnityEngine.Rendering; [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 LifeweaverSeeker { [DefaultExecutionOrder(10000)] public class LifeweaverController : MonoBehaviour { internal static SkinDef skin; private ModelSkinController skinController; private CharacterModel characterModel; private float nextEffectScan; private readonly HashSet<int> recoloured = new HashSet<int>(); private bool SkinActive { get { if (!Object.op_Implicit((Object)(object)skinController) || !Object.op_Implicit((Object)(object)skin)) { return false; } int currentSkinIndex = skinController.currentSkinIndex; if (currentSkinIndex >= 0 && currentSkinIndex < skinController.skins.Length) { return (Object)(object)skinController.skins[currentSkinIndex] == (Object)(object)skin; } return false; } } public static bool IsLifeweaver(CharacterBody body) { Transform val = ((Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.modelLocator)) ? body.modelLocator.modelTransform : null); LifeweaverController lifeweaverController = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<LifeweaverController>() : null); if (Object.op_Implicit((Object)(object)lifeweaverController)) { return lifeweaverController.SkinActive; } return false; } private void Awake() { skinController = ((Component)this).GetComponent<ModelSkinController>(); characterModel = ((Component)this).GetComponent<CharacterModel>(); } private void LateUpdate() { if (SkinActive && !(Time.time < nextEffectScan)) { nextEffectScan = Time.time + 0.2f; RecolourAttachedEffects(); } } private void RecolourAttachedEffects() { //IL_00ee: 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_0103: Unknown result type (might be due to invalid IL or missing references) CharacterBody val = (Object.op_Implicit((Object)(object)characterModel) ? characterModel.body : null); Transform val2 = (Object.op_Implicit((Object)(object)val) ? ((Component)val).transform : ((Component)this).transform); Renderer[] componentsInChildren = ((Component)val2).GetComponentsInChildren<Renderer>(true); foreach (Renderer val3 in componentsInChildren) { if (recoloured.Add(((Object)val3).GetInstanceID()) && !Object.op_Implicit((Object)(object)((Component)val3).GetComponentInParent<ItemDisplay>()) && (val3 is ParticleSystemRenderer || val3 is TrailRenderer || val3 is LineRenderer || Object.op_Implicit((Object)(object)((Component)val3).GetComponentInParent<EffectComponent>()) || Object.op_Implicit((Object)(object)((Component)val3).GetComponentInParent<VFXAttributes>()))) { Pink.All(((Component)val3).gameObject); } } Light[] componentsInChildren2 = ((Component)val2).GetComponentsInChildren<Light>(true); foreach (Light val4 in componentsInChildren2) { if (recoloured.Add(((Object)val4).GetInstanceID()) && !Object.op_Implicit((Object)(object)((Component)val4).GetComponentInParent<ItemDisplay>()) && Pink.IsColoured(val4.color)) { val4.color = Pink.Shift(val4.color); } } } } public class LifeweaverDisplay : MonoBehaviour { private CharacterModel characterModel; private SkinnedMeshRenderer bodyRenderer; private bool pink; private readonly Dictionary<Renderer, Material[]> materials = new Dictionary<Renderer, Material[]>(); private readonly Dictionary<ParticleSystem, (MinMaxGradient start, MinMaxGradient life)> particles = new Dictionary<ParticleSystem, (MinMaxGradient, MinMaxGradient)>(); private readonly Dictionary<Light, Color> lights = new Dictionary<Light, Color>(); private bool SkinActive { get { if (Object.op_Implicit((Object)(object)bodyRenderer) && Object.op_Implicit((Object)(object)bodyRenderer.sharedMesh)) { return ((Object)bodyRenderer.sharedMesh).name == "lw_body"; } return false; } } internal static void Install(string bodyName) { GameObject val = BodyCatalog.FindBodyPrefab(bodyName); SurvivorDef val2 = (Object.op_Implicit((Object)(object)val) ? SurvivorCatalog.FindSurvivorDefFromBody(val) : null); GameObject val3 = (Object.op_Implicit((Object)(object)val2) ? val2.displayPrefab : null); ModelSkinController val4 = (Object.op_Implicit((Object)(object)val3) ? val3.GetComponentInChildren<ModelSkinController>(true) : null); if (!Object.op_Implicit((Object)(object)val4)) { LifeweaverSeekerPlugin.Log.LogWarning((object)"Character select: no Seeker display model found"); } else if (!Object.op_Implicit((Object)(object)((Component)val4).GetComponent<LifeweaverDisplay>())) { ((Component)val4).gameObject.AddComponent<LifeweaverDisplay>(); } } private void Awake() { characterModel = ((Component)this).GetComponent<CharacterModel>(); Transform val = ((Component)this).transform.Find("meshSeekerBody"); bodyRenderer = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<SkinnedMeshRenderer>() : null); } private void LateUpdate() { bool skinActive = SkinActive; if (skinActive != pink) { pink = skinActive; if (pink) { MakePink(); } else { Restore(); } } } private IEnumerable<Renderer> Effects() { HashSet<Renderer> own = new HashSet<Renderer>((Object.op_Implicit((Object)(object)characterModel) && characterModel.baseRendererInfos != null) ? characterModel.baseRendererInfos.Select((RendererInfo r) => r.renderer) : Enumerable.Empty<Renderer>()); return from r in ((Component)this).GetComponentsInChildren<Renderer>(true) where Object.op_Implicit((Object)(object)r) && !own.Contains(r) select r; } private void MakePink() { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) foreach (Renderer item in Effects()) { if (!materials.ContainsKey(item)) { materials[item] = item.sharedMaterials; } Pink.Renderer(item); } ParticleSystem[] componentsInChildren = ((Component)this).GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val in componentsInChildren) { if (!particles.ContainsKey(val)) { Dictionary<ParticleSystem, (MinMaxGradient start, MinMaxGradient life)> dictionary = particles; MainModule main = val.main; MinMaxGradient startColor = ((MainModule)(ref main)).startColor; ColorOverLifetimeModule colorOverLifetime = val.colorOverLifetime; dictionary[val] = (startColor, ((ColorOverLifetimeModule)(ref colorOverLifetime)).color); } Pink.Particles(val); } Light[] componentsInChildren2 = ((Component)this).GetComponentsInChildren<Light>(true); foreach (Light val2 in componentsInChildren2) { if (!lights.ContainsKey(val2)) { lights[val2] = val2.color; } val2.color = Pink.Shift(val2.color); } } private void Restore() { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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) foreach (KeyValuePair<Renderer, Material[]> material in materials) { if (Object.op_Implicit((Object)(object)material.Key)) { material.Key.sharedMaterials = material.Value; } } foreach (KeyValuePair<ParticleSystem, (MinMaxGradient, MinMaxGradient)> particle in particles) { if (Object.op_Implicit((Object)(object)particle.Key)) { MainModule main = particle.Key.main; ((MainModule)(ref main)).startColor = particle.Value.Item1; ColorOverLifetimeModule colorOverLifetime = particle.Key.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = particle.Value.Item2; } } foreach (KeyValuePair<Light, Color> light in lights) { if (Object.op_Implicit((Object)(object)light.Key)) { light.Key.color = light.Value; } } } } [BepInPlugin("com.chaz.lifeweaverseeker", "LifeweaverSeeker", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class LifeweaverSeekerPlugin : BaseUnityPlugin { public const string PluginGUID = "com.chaz.lifeweaverseeker"; public const string PluginName = "LifeweaverSeeker"; public const string PluginVersion = "1.0.0"; private const string SkinNameToken = "CHAZ_LIFEWEAVERSEEKER_SKIN_NAME"; internal const string BodyMeshName = "lw_body"; internal static ManualLogSource Log; public static SkinDef Skin { get; private set; } private void Awake() { Log = ((BaseUnityPlugin)this).Logger; try { LanguageAPI.Add("CHAZ_LIFEWEAVERSEEKER_SKIN_NAME", "Lifeweaver"); AddSkin(); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Failed to add Lifeweaver skin: " + ex)); } } private void AddSkin() { //IL_0112: 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_013c: Expected O, but got Unknown //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0225: 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_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) GameObject val = Load<GameObject>("RoR2/DLC2/Seeker/SeekerBody.prefab"); GameObject gameObject = ((Component)val.GetComponent<ModelLocator>().modelTransform).gameObject; ModelSkinController component = gameObject.GetComponent<ModelSkinController>(); SkinnedMeshRenderer val2 = FindRenderer(gameObject, "meshSeekerBody"); SkinnedMeshRenderer val3 = FindRenderer(gameObject, "meshSeekerCloth"); SkinnedMeshRenderer val4 = FindRenderer(gameObject, "meshSeekerGlass"); Dictionary<string, Matrix4x4> bindposes = Assets.ReadBindposes("bindposes.bin"); Mesh mesh = Assets.ReadSkinnedMesh("lw_body.hkm", val2, bindposes); Mesh mesh2 = Assets.ReadSkinnedMesh("lw_gauntlet.hkm", val3, bindposes); Mesh mesh3 = Assets.ReadSkinnedMesh("lw_hair.hkm", val4, bindposes); Material template = Load<Material>("RoR2/DLC2/Seeker/matSeeker.mat"); Material m = Assets.MakeMaterial(template, "matLifeweaverBody", Assets.ReadTexture("lw_body.png"), cutout: false); Material m2 = Assets.MakeMaterial(template, "matLifeweaverGauntlet", Assets.ReadTexture("lw_gauntlet.png"), cutout: false); Material val5 = Assets.MakeMaterial(template, "matLifeweaverHair", Assets.ReadTexture("lw_hair.png"), cutout: true); val5.SetFloat("_Cull", 2f); val5.SetTexture("_EmTex", (Texture)(object)Assets.ReadTexture("lw_hair_emission.png")); val5.SetColor("_EmColor", new Color(1f, 0.55f, 0.7f)); val5.SetFloat("_EmPower", 1.5f); ProjectileGhostReplacement[] projectileGhostReplacements = PinkEffects.Setup(new Harmony("com.chaz.lifeweaverseeker")); Skin = Skins.CreateNewSkinDef(new SkinDefParamsInfo { Name = "skinSeekerLifeweaver", NameToken = "CHAZ_LIFEWEAVERSEEKER_SKIN_NAME", Icon = Skins.CreateSkinIcon(Color32.op_Implicit(new Color32((byte)232, (byte)228, (byte)220, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)120, (byte)186, (byte)170, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)226, (byte)92, (byte)120, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)150, (byte)98, (byte)66, byte.MaxValue))), RootObject = gameObject, BaseSkins = (SkinDef[])(object)new SkinDef[1] { component.skins[0] }, RendererInfos = (RendererInfo[])(object)new RendererInfo[3] { RendererInfo((Renderer)(object)val2, m), RendererInfo((Renderer)(object)val3, m2), RendererInfo((Renderer)(object)val4, val5) }, MeshReplacements = (MeshReplacement[])(object)new MeshReplacement[3] { new MeshReplacement { renderer = (Renderer)(object)val2, mesh = mesh }, new MeshReplacement { renderer = (Renderer)(object)val3, mesh = mesh2 }, new MeshReplacement { renderer = (Renderer)(object)val4, mesh = mesh3 } }, ProjectileGhostReplacements = projectileGhostReplacements, GameObjectActivations = Array.Empty<GameObjectActivation>(), MinionSkinReplacements = Array.Empty<MinionSkinReplacement>() }); if (!Skins.AddSkinToCharacter(val, Skin)) { throw new Exception("R2API refused the skin"); } LifeweaverController.skin = Skin; gameObject.AddComponent<LifeweaverController>(); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate { LifeweaverDisplay.Install("SeekerBody"); }); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Added Lifeweaver skin to Seeker"); } private static T Load<T>(string 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>((object)key).WaitForCompletion(); if (!Object.op_Implicit((Object)(object)val)) { throw new Exception("Missing addressable " + key); } return val; } private static SkinnedMeshRenderer FindRenderer(GameObject model, string path) { Transform val = model.transform.Find(path); SkinnedMeshRenderer obj = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<SkinnedMeshRenderer>() : null); if (!Object.op_Implicit((Object)(object)obj)) { throw new Exception("Renderer not found: " + path); } return obj; } private static RendererInfo RendererInfo(Renderer r, Material m) { //IL_0002: 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_0028: Unknown result type (might be due to invalid IL or missing references) return new RendererInfo { renderer = r, defaultMaterial = m, defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false }; } } internal static class Assets { private static Stream Open(string name) { return typeof(Assets).Assembly.GetManifestResourceStream(name) ?? throw new FileNotFoundException("Embedded resource missing: " + name); } public static Dictionary<string, Matrix4x4> ReadBindposes(string name) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) using BinaryReader binaryReader = new BinaryReader(Open(name)); Dictionary<string, Matrix4x4> dictionary = new Dictionary<string, Matrix4x4>(); int num = binaryReader.ReadInt32(); for (int i = 0; i < num; i++) { string key = ReadString(binaryReader); Matrix4x4 value = default(Matrix4x4); for (int j = 0; j < 16; j++) { ((Matrix4x4)(ref value))[j / 4, j % 4] = binaryReader.ReadSingle(); } dictionary[key] = value; } return dictionary; } public static Mesh ReadSkinnedMesh(string name, SkinnedMeshRenderer target, Dictionary<string, Matrix4x4> bindposes) { //IL_014e: 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) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Expected O, but got Unknown using BinaryReader binaryReader = new BinaryReader(Open(name)); if (new string(binaryReader.ReadChars(4)) != "HKM1") { throw new InvalidDataException(name); } int num = binaryReader.ReadInt32(); string[] array = new string[num]; for (int i = 0; i < num; i++) { array[i] = ReadString(binaryReader); } Transform[] bones = target.bones; Dictionary<string, int> byName = new Dictionary<string, int>(); for (int j = 0; j < bones.Length; j++) { if (Object.op_Implicit((Object)(object)bones[j]) && !byName.ContainsKey(((Object)bones[j]).name)) { byName[((Object)bones[j]).name] = j; } } Matrix4x4 value; int[] array2 = array.Select(delegate(string b) { if (!byName.TryGetValue(b, out value)) { throw new Exception(name + ": bone " + b + " not on " + ((Object)target).name); } return value; }).ToArray(); int num2 = binaryReader.ReadInt32(); Vector3[] array3 = (Vector3[])(object)new Vector3[num2]; Vector3[] array4 = (Vector3[])(object)new Vector3[num2]; Vector2[] array5 = (Vector2[])(object)new Vector2[num2]; for (int num3 = 0; num3 < num2; num3++) { array3[num3] = new Vector3(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()); } for (int num4 = 0; num4 < num2; num4++) { array4[num4] = new Vector3(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()); } for (int num5 = 0; num5 < num2; num5++) { array5[num5] = new Vector2(binaryReader.ReadSingle(), binaryReader.ReadSingle()); } int[] array6 = new int[num2 * 4]; for (int num6 = 0; num6 < array6.Length; num6++) { array6[num6] = array2[binaryReader.ReadInt32()]; } BoneWeight[] array7 = (BoneWeight[])(object)new BoneWeight[num2]; for (int num7 = 0; num7 < num2; num7++) { float weight = binaryReader.ReadSingle(); float weight2 = binaryReader.ReadSingle(); float weight3 = binaryReader.ReadSingle(); float weight4 = binaryReader.ReadSingle(); int num8 = num7; BoneWeight val = default(BoneWeight); ((BoneWeight)(ref val)).boneIndex0 = array6[num7 * 4]; ((BoneWeight)(ref val)).boneIndex1 = array6[num7 * 4 + 1]; ((BoneWeight)(ref val)).boneIndex2 = array6[num7 * 4 + 2]; ((BoneWeight)(ref val)).boneIndex3 = array6[num7 * 4 + 3]; ((BoneWeight)(ref val)).weight0 = weight; ((BoneWeight)(ref val)).weight1 = weight2; ((BoneWeight)(ref val)).weight2 = weight3; ((BoneWeight)(ref val)).weight3 = weight4; array7[num8] = val; } int num9 = binaryReader.ReadInt32(); int[] array8 = new int[num9]; for (int num10 = 0; num10 < num9; num10++) { array8[num10] = binaryReader.ReadInt32(); } Mesh val2 = new Mesh { name = Path.GetFileNameWithoutExtension(name) }; if (num2 > 65535) { val2.indexFormat = (IndexFormat)1; } val2.vertices = array3; val2.normals = array4; val2.uv = array5; val2.SetIndices(array8, (MeshTopology)0, 0); val2.boneWeights = array7; val2.bindposes = bones.Select((Transform b) => (!Object.op_Implicit((Object)(object)b) || !bindposes.TryGetValue(((Object)b).name, out value)) ? Matrix4x4.identity : value).ToArray(); val2.RecalculateTangents(); val2.RecalculateBounds(); return val2; } public static Texture2D ReadTexture(string name) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_0036: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown using Stream stream = Open(name); using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, true) { name = Path.GetFileNameWithoutExtension(name) }; ImageConversion.LoadImage(val, memoryStream.ToArray()); ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)2; ((Texture)val).anisoLevel = 4; val.Apply(true, true); return val; } public static Material MakeMaterial(Material template, string name, Texture2D tex, bool cutout) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_0020: 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) Material val = new Material(template) { name = name }; val.SetTexture("_MainTex", (Texture)(object)tex); val.SetColor("_Color", Color.white); val.SetTexture("_NormalTex", (Texture)null); val.SetFloat("_NormalStrength", 0f); val.SetColor("_EmColor", Color.black); val.SetTexture("_EmTex", (Texture)null); val.SetFloat("_EmPower", 0f); val.SetFloat("_SpecularStrength", 0.25f); val.SetFloat("_FlowmapOn", 0f); val.DisableKeyword("FLOWMAP"); val.SetFloat("_FEON", 0f); val.DisableKeyword("FRESNEL_EMISSION"); val.SetFloat("_LimbRemovalOn", 0f); val.DisableKeyword("LIMBREMOVAL"); val.SetFloat("_EnableCutout", cutout ? 1f : 0f); if (cutout) { val.EnableKeyword("CUTOUT"); } else { val.DisableKeyword("CUTOUT"); } return val; } private static string ReadString(BinaryReader r) { return Encoding.UTF8.GetString(r.ReadBytes(r.ReadInt32())); } } internal static class Pink { private const float TargetHue = 0.955f; private const float Tolerance = 0.02f; private static readonly Dictionary<Texture, Texture> textures = new Dictionary<Texture, Texture>(); private static readonly Dictionary<Material, Material> materials = new Dictionary<Material, Material>(); public static bool IsColoured(Color c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) float num = default(float); float num2 = default(float); float num3 = default(float); Color.RGBToHSV(c, ref num, ref num2, ref num3); float num4 = Mathf.Abs(num - 0.955f); num4 = Mathf.Min(num4, 1f - num4); if (num2 > 0.25f && num3 > 0.03f) { return num4 > 0.02f; } return false; } public static Color Shift(Color c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (!IsColoured(c)) { return c; } float num = default(float); float num2 = default(float); float num3 = default(float); Color.RGBToHSV(c, ref num, ref num2, ref num3); Color result = Color.HSVToRGB(0.955f, num2, num3, true); result.a = c.a; return result; } public static Gradient Shift(Gradient g) { //IL_0019: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown if (g == null) { return null; } GradientColorKey[] colorKeys = g.colorKeys; bool flag = false; for (int i = 0; i < colorKeys.Length; i++) { if (IsColoured(colorKeys[i].color)) { colorKeys[i].color = Shift(colorKeys[i].color); flag = true; } } if (!flag) { return g; } Gradient val = new Gradient { mode = g.mode }; val.SetKeys(colorKeys, g.alphaKeys); return val; } public static MinMaxGradient Shift(MinMaxGradient m) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected I4, 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_0030: 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_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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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) ParticleSystemGradientMode mode = ((MinMaxGradient)(ref m)).mode; switch ((int)mode) { case 0: return new MinMaxGradient(Shift(((MinMaxGradient)(ref m)).color)); case 2: return new MinMaxGradient(Shift(((MinMaxGradient)(ref m)).colorMin), Shift(((MinMaxGradient)(ref m)).colorMax)); case 1: return new MinMaxGradient(Shift(((MinMaxGradient)(ref m)).gradient)); case 3: return new MinMaxGradient(Shift(((MinMaxGradient)(ref m)).gradientMin), Shift(((MinMaxGradient)(ref m)).gradientMax)); case 4: { MinMaxGradient result = default(MinMaxGradient); ((MinMaxGradient)(ref result))..ctor(Shift(((MinMaxGradient)(ref m)).gradient)); ((MinMaxGradient)(ref result)).mode = (ParticleSystemGradientMode)4; return result; } default: return m; } } public static Texture Texture(Texture t) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)t) || !(t is Texture2D) || (int)t.dimension != 2) { return t; } if (textures.TryGetValue(t, out var value)) { return value; } Texture val = t; try { int w; int h; Color32[] array = Read(t, out w, out h); int num = 0; for (int i = 0; i < array.Length; i++) { Color c = Color32.op_Implicit(array[i]); if (IsColoured(c)) { array[i] = Color32.op_Implicit(Shift(c)); num++; } } if (num > array.Length / 200) { Texture2D val2 = new Texture2D(w, h, (TextureFormat)4, t.mipmapCount > 1) { name = ((Object)t).name + "_Pink", wrapMode = t.wrapMode, filterMode = t.filterMode, anisoLevel = t.anisoLevel }; val2.SetPixels32(array); val2.Apply(true, true); val = (Texture)val2; } } catch (Exception ex) { LifeweaverSeekerPlugin.Log.LogWarning((object)("Couldn't recolour " + ((Object)t).name + ": " + ex.Message)); } textures[t] = val; return val; } private static Color32[] Read(Texture t, out int w, out int h) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) Color32[] array = Blit(t, 64, 64); bool flag = false; Color32[] array2 = array; for (int i = 0; i < array2.Length; i++) { if (IsColoured(Color32.op_Implicit(array2[i]))) { flag = true; break; } } if (!flag) { w = 64; h = 64; return (Color32[])(object)new Color32[0]; } w = Mathf.Min(t.width, 1024); h = Mathf.Min(t.height, 1024); return Blit(t, w, h); } private static Color32[] Blit(Texture t, int w, int h) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown RenderTexture temporary = RenderTexture.GetTemporary(w, h, 0, (RenderTextureFormat)0, (RenderTextureReadWrite)2); Graphics.Blit(t, temporary); RenderTexture active = RenderTexture.active; RenderTexture.active = temporary; Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); val.ReadPixels(new Rect(0f, 0f, (float)w, (float)h), 0, 0); val.Apply(); RenderTexture.active = active; RenderTexture.ReleaseTemporary(temporary); Color32[] pixels = val.GetPixels32(); Object.Destroy((Object)val); return pixels; } public static Material Material(Material m) { //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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Invalid comparison between Unknown and I4 //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)m)) { return m; } if (materials.TryGetValue(m, out var value)) { return value; } Material val = null; Shader shader = m.shader; for (int i = 0; i < shader.GetPropertyCount(); i++) { string propertyName = shader.GetPropertyName(i); ShaderPropertyType propertyType = shader.GetPropertyType(i); if ((int)propertyType != 0) { if ((int)propertyType == 4 && !propertyName.Contains("Normal") && !propertyName.Contains("Bump")) { Texture texture = m.GetTexture(propertyName); Texture val2 = Texture(texture); if ((Object)(object)val2 != (Object)(object)texture) { val = (Material)(((object)val) ?? ((object)new Material(m) { name = ((Object)m).name + "_Pink" })); val.SetTexture(propertyName, val2); } } } else { Color color = m.GetColor(propertyName); if (IsColoured(color)) { val = (Material)(((object)val) ?? ((object)new Material(m) { name = ((Object)m).name + "_Pink" })); val.SetColor(propertyName, Shift(color)); } } } materials[m] = val ?? m; materials[val ?? m] = val ?? m; return val ?? m; } public static bool All(GameObject root) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) bool flag = false; Renderer[] componentsInChildren = root.GetComponentsInChildren<Renderer>(true); foreach (Renderer r in componentsInChildren) { flag |= Renderer(r); } ParticleSystem[] componentsInChildren2 = root.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem ps in componentsInChildren2) { flag |= Particles(ps); } Light[] componentsInChildren3 = root.GetComponentsInChildren<Light>(true); foreach (Light val in componentsInChildren3) { if (IsColoured(val.color)) { val.color = Shift(val.color); flag = true; } } return flag; } public static bool Renderer(Renderer r) { bool flag = false; Material[] sharedMaterials = r.sharedMaterials; for (int i = 0; i < sharedMaterials.Length; i++) { Material val = Material(sharedMaterials[i]); if ((Object)(object)val != (Object)(object)sharedMaterials[i]) { sharedMaterials[i] = val; flag = true; } } if (flag) { r.sharedMaterials = sharedMaterials; } ParticleSystemRenderer val2 = (ParticleSystemRenderer)(object)((r is ParticleSystemRenderer) ? r : null); if (val2 != null && Object.op_Implicit((Object)(object)val2.trailMaterial)) { Material val3 = Material(val2.trailMaterial); if ((Object)(object)val3 != (Object)(object)val2.trailMaterial) { val2.trailMaterial = val3; flag = true; } } TrailRenderer val4 = (TrailRenderer)(object)((r is TrailRenderer) ? r : null); if (val4 != null) { Gradient val5 = Shift(val4.colorGradient); if (val5 != val4.colorGradient) { val4.colorGradient = val5; flag = true; } } LineRenderer val6 = (LineRenderer)(object)((r is LineRenderer) ? r : null); if (val6 != null) { Gradient val7 = Shift(val6.colorGradient); if (val7 != val6.colorGradient) { val6.colorGradient = val7; flag = true; } } return flag; } public static bool Particles(ParticleSystem ps) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) MainModule main = ps.main; ((MainModule)(ref main)).startColor = Shift(((MainModule)(ref main)).startColor); ColorOverLifetimeModule colorOverLifetime = ps.colorOverLifetime; if (((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled) { ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = Shift(((ColorOverLifetimeModule)(ref colorOverLifetime)).color); } ColorBySpeedModule colorBySpeed = ps.colorBySpeed; if (((ColorBySpeedModule)(ref colorBySpeed)).enabled) { ((ColorBySpeedModule)(ref colorBySpeed)).color = Shift(((ColorBySpeedModule)(ref colorBySpeed)).color); } TrailModule trails = ps.trails; if (((TrailModule)(ref trails)).enabled) { ((TrailModule)(ref trails)).colorOverLifetime = Shift(((TrailModule)(ref trails)).colorOverLifetime); ((TrailModule)(ref trails)).colorOverTrail = Shift(((TrailModule)(ref trails)).colorOverTrail); } return true; } } internal static class PinkEffects { internal class PinkProjectile : MonoBehaviour { private float until; private bool doneSelf; private ProjectileController pc; private void OnEnable() { until = Time.time + 2f; doneSelf = false; pc = ((Component)this).GetComponent<ProjectileController>(); } private void LateUpdate() { if (!Object.op_Implicit((Object)(object)pc) || Time.time > until) { ((Behaviour)this).enabled = false; } else { if (!Object.op_Implicit((Object)(object)pc.owner)) { return; } CharacterBody component = pc.owner.GetComponent<CharacterBody>(); if (!Object.op_Implicit((Object)(object)component) || !LifeweaverController.IsLifeweaver(component)) { ((Behaviour)this).enabled = false; return; } if (!doneSelf) { doneSelf = true; Pink.All(((Component)this).gameObject); } if (Object.op_Implicit((Object)(object)pc.ghost)) { Pink.All(((Component)pc.ghost).gameObject); ((Behaviour)this).enabled = false; } } } } internal class PinkVehicle : MonoBehaviour { private float until; private VehicleSeat seat; private void Start() { until = Time.time + 5f; seat = ((Component)this).GetComponent<VehicleSeat>() ?? ((Component)this).GetComponentInChildren<VehicleSeat>(); } private void LateUpdate() { if (!Object.op_Implicit((Object)(object)seat) || Time.time > until) { ((Behaviour)this).enabled = false; return; } CharacterBody currentPassengerBody = seat.currentPassengerBody; if (Object.op_Implicit((Object)(object)currentPassengerBody)) { if (LifeweaverController.IsLifeweaver(currentPassengerBody)) { Pink.All(((Component)this).gameObject); } ((Behaviour)this).enabled = false; } } } [HarmonyPatch] private static class SojournPatches { [HarmonyPatch(typeof(SojournVehicleBase), "Start")] [HarmonyPostfix] private static void VehicleStart(SojournVehicleBase __instance) { if (Object.op_Implicit((Object)(object)__instance) && !Object.op_Implicit((Object)(object)((Component)__instance).GetComponent<PinkVehicle>())) { ((Component)__instance).gameObject.AddComponent<PinkVehicle>(); } } [HarmonyPatch(typeof(Sojourn), "OnEnter")] [HarmonyPostfix] private static void ScreenTint(Sojourn __instance) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) if (LifeweaverController.IsLifeweaver(Object.op_Implicit((Object)(object)((EntityState)__instance).outer) ? ((Component)((EntityState)__instance).outer).GetComponent<CharacterBody>() : null)) { ScreenDamageCalculator value = Traverse.Create((object)__instance).Field("screenDamageCalculator").GetValue<ScreenDamageCalculator>(); ScreenDamageData val = ((value != null) ? value.screenDamageData : null); if (val != null) { val.IntendedTintColor = Pink.Shift(val.IntendedTintColor); } } } } [HarmonyPatch] private static class SpawnPatches { [HarmonyPatch(typeof(EffectManager), "SpawnEffect", new Type[] { typeof(GameObject), typeof(EffectData), typeof(bool) })] [HarmonyPrefix] private static void ByPrefab(ref GameObject effectPrefab, EffectData effectData) { if (Object.op_Implicit((Object)(object)effectPrefab) && pinkByPrefab.TryGetValue(effectPrefab, out var value) && OwnedByLifeweaver(effectData)) { effectPrefab = value; } } [HarmonyPatch(typeof(EffectManager), "SpawnEffect", new Type[] { typeof(EffectIndex), typeof(EffectData), typeof(bool) })] [HarmonyPrefix] private static void ByIndex(ref EffectIndex effectIndex, EffectData effectData) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected I4, but got Unknown if (pinkByIndex.TryGetValue(effectIndex, out var value) && OwnedByLifeweaver(effectData)) { effectIndex = (EffectIndex)(int)value; } } } private const string Prefix = "RoR2/DLC2/Seeker/"; private static readonly HashSet<GameObject> trackedProjectiles = new HashSet<GameObject>(); private static readonly HashSet<int> trackedProjectileIndices = new HashSet<int>(); private static readonly Dictionary<GameObject, GameObject> pinkByPrefab = new Dictionary<GameObject, GameObject>(); private static readonly Dictionary<EffectIndex, EffectIndex> pinkByIndex = new Dictionary<EffectIndex, EffectIndex>(); private static BodyIndex seekerIndex = (BodyIndex)(-1); public static ProjectileGhostReplacement[] Setup(Harmony harmony) { //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_00f2: 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) List<ProjectileGhostReplacement> list = new List<ProjectileGhostReplacement>(); int num = 0; Stopwatch stopwatch = Stopwatch.StartNew(); foreach (string item in SeekerKeys()) { GameObject val; try { val = Addressables.LoadAssetAsync<GameObject>((object)item).WaitForCompletion(); } catch { continue; } if (!Object.op_Implicit((Object)(object)val)) { continue; } if (AddPinkEffect(val)) { num++; } foreach (GameObject item2 in ReferencedEffects(val)) { if (AddPinkEffect(item2)) { num++; } } ProjectileController component = val.GetComponent<ProjectileController>(); if (Object.op_Implicit((Object)(object)component)) { trackedProjectiles.Add(val); GameObject val2 = Ghost(component); if (Object.op_Implicit((Object)(object)val2) && HasColour(val2)) { GameObject val3 = PrefabAPI.InstantiateClone(val2, ((Object)val2).name + "LifeweaverPink", false); Pink.All(val3); list.Add(new ProjectileGhostReplacement { projectilePrefab = val, projectileGhostReplacementPrefab = val3 }); } } } harmony.PatchAll(typeof(SpawnPatches)); harmony.PatchAll(typeof(SojournPatches)); PatchProjectileSpawn(harmony); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(ResolveIndices)); LifeweaverSeekerPlugin.Log.LogInfo((object)$"Pink effects: {num} effects, {list.Count} projectile ghosts ({stopwatch.ElapsedMilliseconds} ms)"); return list.ToArray(); } private static bool AddPinkEffect(GameObject prefab) { if (!Object.op_Implicit((Object)(object)prefab) || !Object.op_Implicit((Object)(object)prefab.GetComponent<EffectComponent>()) || pinkByPrefab.ContainsKey(prefab) || !HasColour(prefab)) { return false; } GameObject val = PrefabAPI.InstantiateClone(prefab, ((Object)prefab).name + "LifeweaverPink", false); Pink.All(val); if (!ContentAddition.AddEffect(val)) { return false; } pinkByPrefab[prefab] = val; return true; } private static IEnumerable<GameObject> ReferencedEffects(GameObject prefab) { MonoBehaviour[] componentsInChildren = prefab.GetComponentsInChildren<MonoBehaviour>(true); foreach (MonoBehaviour c in componentsInChildren) { if (!Object.op_Implicit((Object)(object)c)) { continue; } Type t = ((object)c).GetType(); while (t != null && t != typeof(MonoBehaviour)) { FieldInfo[] fields = t.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.FieldType == typeof(GameObject)) { object? value = fieldInfo.GetValue(c); GameObject val = (GameObject)((value is GameObject) ? value : null); if (val != null && Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.GetComponent<EffectComponent>())) { yield return val; } } } t = t.BaseType; } } } private static IEnumerable<string> SeekerKeys() { HashSet<string> hashSet = new HashSet<string>(); foreach (IResourceLocator resourceLocator in Addressables.ResourceLocators) { foreach (object key in resourceLocator.Keys) { if (key is string text && text.StartsWith("RoR2/DLC2/Seeker/") && text.EndsWith(".prefab")) { hashSet.Add(text); } } } return hashSet.OrderBy((string k) => k); } private static GameObject Ghost(ProjectileController pc) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)pc.ghostPrefab)) { return pc.ghostPrefab; } FieldInfo[] fields = typeof(ProjectileController).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.Name.IndexOf("ghost", StringComparison.OrdinalIgnoreCase) >= 0) { object? value = fieldInfo.GetValue(pc); AssetReference val = (AssetReference)((value is AssetReference) ? value : null); if (val != null && val.RuntimeKeyIsValid()) { return Addressables.LoadAssetAsync<GameObject>(val.RuntimeKey).WaitForCompletion(); } } } return null; } private static bool HasColour(GameObject go) { //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_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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = go.GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { Material[] sharedMaterials = val.sharedMaterials; foreach (Material val2 in sharedMaterials) { if (Object.op_Implicit((Object)(object)val2) && (Object)(object)Pink.Material(val2) != (Object)(object)val2) { return true; } } ParticleSystemRenderer val3 = (ParticleSystemRenderer)(object)((val is ParticleSystemRenderer) ? val : null); if (val3 != null && Object.op_Implicit((Object)(object)val3.trailMaterial) && (Object)(object)Pink.Material(val3.trailMaterial) != (Object)(object)val3.trailMaterial) { return true; } TrailRenderer val4 = (TrailRenderer)(object)((val is TrailRenderer) ? val : null); if (val4 != null && Coloured(val4.colorGradient)) { return true; } LineRenderer val5 = (LineRenderer)(object)((val is LineRenderer) ? val : null); if (val5 != null && Coloured(val5.colorGradient)) { return true; } } ParticleSystem[] componentsInChildren2 = go.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val6 in componentsInChildren2) { MainModule main = val6.main; if (Coloured(((MainModule)(ref main)).startColor)) { return true; } ColorOverLifetimeModule colorOverLifetime = val6.colorOverLifetime; if (((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled) { colorOverLifetime = val6.colorOverLifetime; if (Coloured(((ColorOverLifetimeModule)(ref colorOverLifetime)).color)) { return true; } } } Light[] componentsInChildren3 = go.GetComponentsInChildren<Light>(true); for (int i = 0; i < componentsInChildren3.Length; i++) { if (Pink.IsColoured(componentsInChildren3[i].color)) { return true; } } return false; } private static bool Coloured(Gradient g) { if (g != null) { return g.colorKeys.Any((GradientColorKey k) => Pink.IsColoured(k.color)); } return false; } private static bool Coloured(MinMaxGradient g) { //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_001e: Unknown result type (might be due to invalid IL or missing references) if (!Pink.IsColoured(((MinMaxGradient)(ref g)).color) && !Pink.IsColoured(((MinMaxGradient)(ref g)).colorMin) && !Pink.IsColoured(((MinMaxGradient)(ref g)).colorMax) && !Coloured(((MinMaxGradient)(ref g)).gradient)) { return Coloured(((MinMaxGradient)(ref g)).gradientMax); } return true; } private static void ResolveIndices() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Invalid comparison between Unknown and I4 //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Invalid comparison between Unknown and I4 //IL_0092: 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) seekerIndex = BodyCatalog.FindBodyIndex("SeekerBody"); foreach (GameObject trackedProjectile in trackedProjectiles) { int projectileIndex = ProjectileCatalog.GetProjectileIndex(trackedProjectile); if (projectileIndex >= 0) { trackedProjectileIndices.Add(projectileIndex); } } foreach (KeyValuePair<GameObject, GameObject> item in pinkByPrefab) { EffectIndex val = EffectCatalog.FindEffectIndexFromPrefab(item.Key); EffectIndex val2 = EffectCatalog.FindEffectIndexFromPrefab(item.Value); if ((int)val != -1 && (int)val2 != -1) { pinkByIndex[val] = val2; } } } private static bool OwnedByLifeweaver(EffectData data) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) if (data == null) { return false; } GameObject rootObject = data.rootObject; if (Object.op_Implicit((Object)(object)rootObject)) { CharacterBody val = rootObject.GetComponent<CharacterBody>() ?? rootObject.GetComponentInParent<CharacterBody>(); if (!Object.op_Implicit((Object)(object)val)) { CharacterModel componentInParent = rootObject.GetComponentInParent<CharacterModel>(); val = (Object.op_Implicit((Object)(object)componentInParent) ? componentInParent.body : null); } if (Object.op_Implicit((Object)(object)val)) { return LifeweaverController.IsLifeweaver(val); } } CharacterBody val2 = null; float num = float.MaxValue; foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList) { if (Object.op_Implicit((Object)(object)readOnlyInstances) && readOnlyInstances.bodyIndex == seekerIndex) { Vector3 val3 = readOnlyInstances.corePosition - data.origin; float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; val2 = readOnlyInstances; } } } if (Object.op_Implicit((Object)(object)val2)) { return LifeweaverController.IsLifeweaver(val2); } return false; } private static void PatchProjectileSpawn(Harmony harmony) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown HarmonyMethod val = new HarmonyMethod(typeof(PinkEffects).GetMethod("OnProjectileSpawned", BindingFlags.Static | BindingFlags.NonPublic)); string[] array = new string[3] { "Start", "OnEnable", "Awake" }; foreach (string text in array) { MethodInfo methodInfo = AccessTools.Method(typeof(ProjectileController), text, (Type[])null, (Type[])null); if (!(methodInfo == null)) { harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); return; } } LifeweaverSeekerPlugin.Log.LogWarning((object)"Pink projectiles: no ProjectileController spawn method to hook"); } private static void OnProjectileSpawned(ProjectileController __instance) { if (Object.op_Implicit((Object)(object)__instance) && trackedProjectileIndices.Contains(__instance.catalogIndex) && !Object.op_Implicit((Object)(object)((Component)__instance).GetComponent<PinkProjectile>())) { ((Component)__instance).gameObject.AddComponent<PinkProjectile>(); } } } }