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 AllyClarity v1.0.0
AllyClarity.dll
Decompiled 7 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security.Permissions; using AllyClarity.Hooks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.VagrantMonster; using EntityStates.VagrantNovaItem; using IL.RoR2.UI; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using On.EntityStates.VagrantNovaItem; using On.RoR2; using On.RoR2.UI; using RiskOfOptions; using RiskOfOptions.Options; using RoR2; using RoR2.UI; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("AllyClarity")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("AllyClarity")] [assembly: AssemblyTitle("AllyClarity")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.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 AllyClarity { [BepInPlugin("revor.AllyClarity", "AllyClarity", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class AllyClarityPlugin : BaseUnityPlugin { public const string PluginGUID = "revor.AllyClarity"; public const string PluginName = "AllyClarity"; public const string PluginVersion = "1.0.0"; internal static ManualLogSource Log { get; private set; } private void Awake() { Log = ((BaseUnityPlugin)this).Logger; PluginConfig.Init(((BaseUnityPlugin)this).Config); OutlineHooks.Init((Object)(object)this); PingHooks.Init(); GenesisLoopHooks.Init(); if (RiskOfOptionsCompat.IsInstalled) { RiskOfOptionsCompat.Init(); } } } internal static class AllyUtil { public static bool IsAlly(CharacterBody body) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 return (int)body.teamComponent.teamIndex == 1; } public static Color GetColor(CharacterBody body, CharacterMaster viewerMaster) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (!IsOwn(body, viewerMaster)) { return PluginConfig.TeammateColor.Value; } return PluginConfig.OwnColor.Value; } private static bool IsOwn(CharacterBody body, CharacterMaster viewerMaster) { CharacterMaster master = body.master; if (!Object.op_Implicit((Object)(object)master) || !Object.op_Implicit((Object)(object)viewerMaster)) { return false; } if (!((Object)(object)master == (Object)(object)viewerMaster)) { return (Object)(object)master.minionOwnership.ownerMaster == (Object)(object)viewerMaster; } return true; } } internal readonly struct ColorShift { private const float VanillaHue = 0.575f; private static readonly int RemapTexProperty = Shader.PropertyToID("_RemapTex"); private static readonly int TintColorProperty = Shader.PropertyToID("_TintColor"); private static readonly Dictionary<(Material, Color), Material> materials = new Dictionary<(Material, Color), Material>(); private static readonly Dictionary<(Texture, Color), Texture2D> ramps = new Dictionary<(Texture, Color), Texture2D>(); private readonly Color target; private readonly float hueOffset; private readonly float saturation; private readonly float value; public ColorShift(Color target) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) this.target = target; float num = default(float); Color.RGBToHSV(target, ref num, ref saturation, ref value); hueOffset = num - 0.575f; } public Color Apply(Color color) { //IL_0000: 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_0036: 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) float num = default(float); float num2 = default(float); float num3 = default(float); Color.RGBToHSV(color, ref num, ref num2, ref num3); Color result = Color.HSVToRGB(Mathf.Repeat(num + hueOffset, 1f), num2 * saturation, num3 * value); result.a = color.a; return result; } public Gradient Apply(Gradient gradient) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_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_003a: 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_0052: Expected O, but got Unknown GradientColorKey[] colorKeys = gradient.colorKeys; for (int i = 0; i < colorKeys.Length; i++) { colorKeys[i].color = Apply(colorKeys[i].color); } Gradient val = new Gradient { mode = gradient.mode }; val.SetKeys(colorKeys, gradient.alphaKeys); return val; } public MinMaxGradient Apply(MinMaxGradient gradient) { //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_001e: Expected I4, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_00a2: Unknown result type (might be due to invalid IL or missing references) ParticleSystemGradientMode mode = ((MinMaxGradient)(ref gradient)).mode; switch ((int)mode) { case 0: return new MinMaxGradient(Apply(((MinMaxGradient)(ref gradient)).color)); case 2: return new MinMaxGradient(Apply(((MinMaxGradient)(ref gradient)).colorMin), Apply(((MinMaxGradient)(ref gradient)).colorMax)); case 1: return new MinMaxGradient(Apply(((MinMaxGradient)(ref gradient)).gradient)); case 3: return new MinMaxGradient(Apply(((MinMaxGradient)(ref gradient)).gradientMin), Apply(((MinMaxGradient)(ref gradient)).gradientMax)); default: { MinMaxGradient result = default(MinMaxGradient); ((MinMaxGradient)(ref result))..ctor(Apply(((MinMaxGradient)(ref gradient)).gradient)); ((MinMaxGradient)(ref result)).mode = (ParticleSystemGradientMode)4; return result; } } } public Material GetMaterial(Material material) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) if (!materials.TryGetValue((material, target), out var val)) { val = new Material(material); ((Object)val).hideFlags = (HideFlags)32; val.SetTexture(RemapTexProperty, (Texture)(object)GetRamp(material.GetTexture(RemapTexProperty))); val.SetColor(TintColorProperty, Apply(material.GetColor(TintColorProperty))); materials.Add((material, target), val); } return val; } private Texture2D GetRamp(Texture ramp) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_00ee: Unknown result type (might be due to invalid IL or missing references) if (!ramps.TryGetValue((ramp, target), out var val)) { RenderTexture active = RenderTexture.active; RenderTexture temporary = RenderTexture.GetTemporary(ramp.width, ramp.height, 0, (RenderTextureFormat)0, (RenderTextureReadWrite)2); Graphics.Blit(ramp, temporary); RenderTexture.active = temporary; val = new Texture2D(ramp.width, ramp.height, (TextureFormat)4, ramp.mipmapCount > 1, false); val.ReadPixels(new Rect(0f, 0f, (float)ramp.width, (float)ramp.height), 0, 0); RenderTexture.active = active; RenderTexture.ReleaseTemporary(temporary); Color[] pixels = val.GetPixels(); for (int i = 0; i < pixels.Length; i++) { pixels[i] = Apply(pixels[i]); } val.SetPixels(pixels); val.Apply(); ((Texture)val).wrapMode = ramp.wrapMode; ((Texture)val).filterMode = ramp.filterMode; ((Object)val).hideFlags = (HideFlags)32; ramps.Add((ramp, target), val); } return val; } } internal static class EmbeddedSprites { public static Sprite Load(string resourceName) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0079: 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) byte[] array; using (Stream stream = typeof(EmbeddedSprites).Assembly.GetManifestResourceStream(resourceName)) { using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); array = memoryStream.ToArray(); } Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); ImageConversion.LoadImage(val, array); ((Texture)val).wrapMode = (TextureWrapMode)1; ((Object)val).name = resourceName; return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } } internal sealed class NovaRecolor : MonoBehaviour { private (ParticleSystem system, MinMaxGradient startColor, MinMaxGradient lifetimeColor)[] particleSystems; private (Light light, Color color)[] lights; private (Renderer renderer, Material[] materials)[] renderers; private (Behaviour volume, bool enabled)[] screenTints; private bool recolored; private const string PostProcessVolumeType = "UnityEngine.Rendering.PostProcessing.PostProcessVolume"; public static void Apply(GameObject effect, Color color) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) NovaRecolor novaRecolor = default(NovaRecolor); if (!effect.TryGetComponent<NovaRecolor>(ref novaRecolor)) { novaRecolor = effect.AddComponent<NovaRecolor>(); novaRecolor.StoreVanillaValues(); } novaRecolor.SetColor(color); } public static void Restore(GameObject effect) { NovaRecolor novaRecolor = default(NovaRecolor); if (effect.TryGetComponent<NovaRecolor>(ref novaRecolor) && novaRecolor.recolored) { novaRecolor.SetVanillaValues(); } } private void StoreVanillaValues() { //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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) ParticleSystem[] componentsInChildren = ((Component)this).GetComponentsInChildren<ParticleSystem>(true); particleSystems = new(ParticleSystem, MinMaxGradient, MinMaxGradient)[componentsInChildren.Length]; for (int i = 0; i < componentsInChildren.Length; i++) { (ParticleSystem system, MinMaxGradient startColor, MinMaxGradient lifetimeColor)[] array = particleSystems; int num = i; ParticleSystem item = componentsInChildren[i]; MainModule main = componentsInChildren[i].main; MinMaxGradient startColor = ((MainModule)(ref main)).startColor; ColorOverLifetimeModule colorOverLifetime = componentsInChildren[i].colorOverLifetime; array[num] = (system: item, startColor: startColor, lifetimeColor: ((ColorOverLifetimeModule)(ref colorOverLifetime)).color); } Light[] componentsInChildren2 = ((Component)this).GetComponentsInChildren<Light>(true); lights = new(Light, Color)[componentsInChildren2.Length]; for (int j = 0; j < componentsInChildren2.Length; j++) { lights[j] = (light: componentsInChildren2[j], color: componentsInChildren2[j].color); } Renderer[] componentsInChildren3 = ((Component)this).GetComponentsInChildren<Renderer>(true); renderers = new(Renderer, Material[])[componentsInChildren3.Length]; for (int k = 0; k < componentsInChildren3.Length; k++) { renderers[k] = (renderer: componentsInChildren3[k], materials: componentsInChildren3[k].sharedMaterials); } List<(Behaviour, bool)> list = new List<(Behaviour, bool)>(); Behaviour[] componentsInChildren4 = ((Component)this).GetComponentsInChildren<Behaviour>(true); foreach (Behaviour val in componentsInChildren4) { if (((object)val).GetType().FullName == "UnityEngine.Rendering.PostProcessing.PostProcessVolume") { list.Add((val, val.enabled)); } } screenTints = list.ToArray(); } private void SetColor(Color color) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_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_0054: 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_0086: 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_0091: 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) ColorShift colorShift = new ColorShift(color); (ParticleSystem, MinMaxGradient, MinMaxGradient)[] array = particleSystems; for (int i = 0; i < array.Length; i++) { (ParticleSystem, MinMaxGradient, MinMaxGradient) tuple = array[i]; ParticleSystem item = tuple.Item1; MinMaxGradient item2 = tuple.Item2; MinMaxGradient item3 = tuple.Item3; MainModule main = item.main; ((MainModule)(ref main)).startColor = colorShift.Apply(item2); ColorOverLifetimeModule colorOverLifetime = item.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = colorShift.Apply(item3); } (Light, Color)[] array2 = lights; for (int i = 0; i < array2.Length; i++) { var (val, color2) = array2[i]; val.color = colorShift.Apply(color2); } (Renderer, Material[])[] array3 = renderers; for (int i = 0; i < array3.Length; i++) { (Renderer, Material[]) tuple3 = array3[i]; Renderer item4 = tuple3.Item1; Material[] item5 = tuple3.Item2; Material[] array4 = (Material[])(object)new Material[item5.Length]; for (int j = 0; j < item5.Length; j++) { array4[j] = (Object.op_Implicit((Object)(object)item5[j]) ? colorShift.GetMaterial(item5[j]) : null); } item4.sharedMaterials = array4; } (Behaviour, bool)[] array5 = screenTints; for (int i = 0; i < array5.Length; i++) { array5[i].Item1.enabled = false; } recolored = true; } private void SetVanillaValues() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_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_0031: 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_0041: 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_0077: Unknown result type (might be due to invalid IL or missing references) (ParticleSystem, MinMaxGradient, MinMaxGradient)[] array = particleSystems; for (int i = 0; i < array.Length; i++) { (ParticleSystem, MinMaxGradient, MinMaxGradient) tuple = array[i]; ParticleSystem item = tuple.Item1; MinMaxGradient item2 = tuple.Item2; MinMaxGradient item3 = tuple.Item3; MainModule main = item.main; ((MainModule)(ref main)).startColor = item2; ColorOverLifetimeModule colorOverLifetime = item.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = item3; } (Light, Color)[] array2 = lights; for (int i = 0; i < array2.Length; i++) { var (val, color) = array2[i]; val.color = color; } (Renderer, Material[])[] array3 = renderers; for (int i = 0; i < array3.Length; i++) { var (val2, sharedMaterials) = array3[i]; val2.sharedMaterials = sharedMaterials; } (Behaviour, bool)[] array4 = screenTints; for (int i = 0; i < array4.Length; i++) { var (val3, enabled) = array4[i]; val3.enabled = enabled; } recolored = false; } } internal static class PluginConfig { private const string Section = "General"; public static ConfigEntry<Color> OwnColor { get; private set; } public static ConfigEntry<Color> TeammateColor { get; private set; } public static ConfigEntry<bool> OutlineAllies { get; private set; } public static ConfigEntry<bool> AllyPings { get; private set; } public static ConfigEntry<bool> AllyGenesisLoop { get; private set; } public static void Init(ConfigFile config) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) OwnColor = config.Bind<Color>("General", "OwnColor", new Color(0.3f, 1f, 0.3f), "The color of you, your summons (drones, turrets, ...) and the pings on them, and of every ally's Genesis Loop explosion."); TeammateColor = config.Bind<Color>("General", "TeammateColor", new Color(0.45f, 0.8f, 1f), "The color of the other players, their summons and allies that nobody owns, and the pings on them. Not used for Genesis Loop explosions: those are in OwnColor for every ally."); OutlineAllies = config.Bind<bool>("General", "OutlineAllies", true, "Outline allied summons (yours, your teammates' and allies that nobody owns) in the colors above, so they are easy to tell from enemies. Players aren't outlined."); AllyPings = config.Bind<bool>("General", "AllyPings", true, "Pinging an ally marks it as an ally instead of an enemy: no combat icon, its outline and the ping text in the colors above, and a chat line that says so instead of \"wants to attack\"."); AllyGenesisLoop = config.Bind<bool>("General", "AllyGenesisLoop", true, "Show the Genesis Loop of every ally (yours, your teammates' and allied summons') in OwnColor instead of the Wandering Vagrant's blue, which the item reuses and which makes it look like an enemy's: the charge sphere, the area indicator and the explosion. Enemies' Genesis Loop and the Wandering Vagrant stay blue."); } } internal static class RiskOfOptionsCompat { public const string Guid = "com.rune580.riskofoptions"; private const string IconResource = "AllyClarity.icon.png"; public static bool IsInstalled => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void Init() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown ModSettingsManager.SetModDescription("Tells your allies from enemies: outlines allied summons and marks pinged allies as allies, in one color for you and your summons and one for your teammates, and shows allies' Genesis Loop in your color instead of the Wandering Vagrant's blue. Everything is local: only you see it, and nobody else needs the mod."); ModSettingsManager.SetModIcon(EmbeddedSprites.Load("AllyClarity.icon.png")); ModSettingsManager.AddOption((BaseOption)new ColorOption(PluginConfig.OwnColor)); ModSettingsManager.AddOption((BaseOption)new ColorOption(PluginConfig.TeammateColor)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(PluginConfig.OutlineAllies)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(PluginConfig.AllyPings)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(PluginConfig.AllyGenesisLoop)); } } } namespace AllyClarity.Hooks { internal static class GenesisLoopHooks { [CompilerGenerated] private static class <>O { public static Action <0>__RoR2Application_onLoad; public static hook_OnEnter <1>__ChargeState_OnEnter; public static hook_Reset <2>__EffectComponent_Reset; } private static EffectIndex novaEffectIndex = (EffectIndex)(-1); public static void Init() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(RoR2Application_onLoad)); object obj = <>O.<1>__ChargeState_OnEnter; if (obj == null) { hook_OnEnter val = ChargeState_OnEnter; <>O.<1>__ChargeState_OnEnter = val; obj = (object)val; } ChargeState.OnEnter += (hook_OnEnter)obj; object obj2 = <>O.<2>__EffectComponent_Reset; if (obj2 == null) { hook_Reset val2 = EffectComponent_Reset; <>O.<2>__EffectComponent_Reset = val2; obj2 = (object)val2; } EffectComponent.Reset += (hook_Reset)obj2; } private static void RoR2Application_onLoad() { //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) novaEffectIndex = EffectCatalog.FindEffectIndexFromPrefab(FireMegaNova.novaEffectPrefab); } private static Color GetColor() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return PluginConfig.OwnColor.Value; } private static void ChargeState_OnEnter(orig_OnEnter orig, ChargeState self) { //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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (PluginConfig.AllyGenesisLoop.Value && Object.op_Implicit((Object)(object)((BaseBodyAttachmentState)self).attachedBody) && AllyUtil.IsAlly(((BaseBodyAttachmentState)self).attachedBody)) { Color color = GetColor(); NovaRecolor.Apply(self.chargeVfxInstance, color); NovaRecolor.Apply(self.areaIndicatorVfxInstance, color); } } private static void EffectComponent_Reset(orig_Reset orig, EffectComponent self) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (self.effectIndex == novaEffectIndex) { EffectData effectData = self.effectData; GameObject val = ((effectData != null) ? effectData.rootObject : null); CharacterBody body = default(CharacterBody); if (PluginConfig.AllyGenesisLoop.Value && Object.op_Implicit((Object)(object)val) && val.TryGetComponent<CharacterBody>(ref body) && AllyUtil.IsAlly(body)) { NovaRecolor.Apply(((Component)self).gameObject, GetColor()); } else { NovaRecolor.Restore(((Component)self).gameObject); } } } } internal static class OutlineHooks { private static Object requester; public static void Init(Object requester) { OutlineHooks.requester = requester; UpdateRequest(); PluginConfig.OutlineAllies.SettingChanged += OutlineAllies_SettingChanged; OutlineHighlight.onPreRenderOutlineHighlight = (Action<OutlineHighlight>)Delegate.Combine(OutlineHighlight.onPreRenderOutlineHighlight, new Action<OutlineHighlight>(OutlineHighlight_onPreRenderOutlineHighlight)); } private static void OutlineAllies_SettingChanged(object sender, EventArgs e) { UpdateRequest(); } private static void UpdateRequest() { if (PluginConfig.OutlineAllies.Value) { OutlineHighlight.AddPreRenderHighlightRequest(requester); } else { OutlineHighlight.ReleasePreRenderHighlightRequest(requester); } } private static void OutlineHighlight_onPreRenderOutlineHighlight(OutlineHighlight outlineHighlight) { //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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Invalid comparison between Unknown and I4 //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_0106: Unknown result type (might be due to invalid IL or missing references) if (!PluginConfig.OutlineAllies.Value) { return; } CameraRigController cameraRigController = outlineHighlight.sceneCamera.cameraRigController; if (!Object.op_Implicit((Object)(object)cameraRigController) || cameraRigController.localUserViewer == null) { return; } CharacterMaster cachedMaster = cameraRigController.localUserViewer.cachedMaster; List<CharacterModel> instancesList = InstanceTracker.GetInstancesList<CharacterModel>(); Highlight val2 = default(Highlight); for (int i = 0; i < instancesList.Count; i++) { CharacterModel val = instancesList[i]; CharacterBody body = val.body; if (!Object.op_Implicit((Object)(object)body) || !AllyUtil.IsAlly(body) || body.isPlayerControlled) { continue; } VisibilityLevel visibility = val.visibility; bool flag = (int)visibility <= 1; if (flag || (((Component)val).TryGetComponent<Highlight>(ref val2) && ((Behaviour)val2).enabled && val2.isOn)) { continue; } Color color = AllyUtil.GetColor(body, cachedMaster); RendererInfo[] baseRendererInfos = val.baseRendererInfos; foreach (RendererInfo val3 in baseRendererInfos) { Renderer renderer = val3.renderer; if (!val3.ignoreOverlays && Object.op_Implicit((Object)(object)renderer) && renderer.enabled && ((Component)renderer).gameObject.activeInHierarchy) { outlineHighlight.AddHighlight(renderer, color); } } } } } internal static class PingHooks { [CompilerGenerated] private static class <>O { public static hook_RebuildPing <0>__PingIndicator_RebuildPing; public static Manipulator <1>__PingIndicator_RebuildPing; public static Func<string, PingIndicator, string> <2>__GetChatLine; } public static void Init() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown object obj = <>O.<0>__PingIndicator_RebuildPing; if (obj == null) { hook_RebuildPing val = PingIndicator_RebuildPing; <>O.<0>__PingIndicator_RebuildPing = val; obj = (object)val; } PingIndicator.RebuildPing += (hook_RebuildPing)obj; object obj2 = <>O.<1>__PingIndicator_RebuildPing; if (obj2 == null) { Manipulator val2 = PingIndicator_RebuildPing; <>O.<1>__PingIndicator_RebuildPing = val2; obj2 = (object)val2; } PingIndicator.RebuildPing += (Manipulator)obj2; } private static void PingIndicator_RebuildPing(orig_RebuildPing orig, PingIndicator self) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if ((int)self.pingType == 1 && TryGetAllyColor(self, out var color)) { GameObject[] enemyPingGameObjects = self.enemyPingGameObjects; for (int i = 0; i < enemyPingGameObjects.Length; i++) { enemyPingGameObjects[i].SetActive(false); } enemyPingGameObjects = self.defaultPingGameObjects; for (int i = 0; i < enemyPingGameObjects.Length; i++) { enemyPingGameObjects[i].SetActive(true); } self.activeColor = color; self.pingColor = color; ((Graphic)self.pingText).color = self.textBaseColor * color; } } private static void PingIndicator_RebuildPing(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "PLAYER_PING_ENEMY") })) { AllyClarityPlugin.Log.LogError((object)("IL hook " + ((MemberReference)il.Method).Name + " failed: PLAYER_PING_ENEMY not found. Pings on allies keep the chat line \"wants to attack\" until AllyClarity is updated.")); return; } val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<string, PingIndicator, string>>((Func<string, PingIndicator, string>)GetChatLine); } private static string GetChatLine(string enemyToken, PingIndicator ping) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (!TryGetAllyColor(ping, out var color)) { return enemyToken; } return "<color=#" + ColorUtility.ToHtmlStringRGB(color) + ">{0} pinged an ally: {1}.</color>"; } private static bool TryGetAllyColor(PingIndicator ping, out Color color) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) CharacterBody component = ping.pingTarget.GetComponent<CharacterBody>(); if (!PluginConfig.AllyPings.Value || !AllyUtil.IsAlly(component)) { color = default(Color); return false; } color = AllyUtil.GetColor(component, LocalUserManager.GetFirstLocalUser().cachedMaster); return true; } } }