using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using HutongGames.PlayMaker; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("RainbowHealth")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0")] [assembly: AssemblyProduct("RainbowHealth")] [assembly: AssemblyTitle("RainbowHealth")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/JasonForNian/RainbowHealth")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace RainbowHealth { [BepInPlugin("io.github.jasonfornian.rainbowhealth", "RainbowHealth", "0.1.0")] public class RainbowHealthPlugin : BaseUnityPlugin { public static ConfigEntry Speed; public static ConfigEntry EnableRainbow; public const string Id = "io.github.jasonfornian.rainbowhealth"; public static string Name => "RainbowHealth"; public static string Version => "0.1.0"; private void Awake() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown Speed = ((BaseUnityPlugin)this).Config.Bind("General", "Speed", 5f, "Speed of the rainbow color change"); EnableRainbow = ((BaseUnityPlugin)this).Config.Bind("General", "EnableRainbow", true, "Enable rainbow health colors"); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Plugin " + Name + " (io.github.jasonfornian.rainbowhealth) has loaded!")); Harmony val = new Harmony("io.github.jasonfornian.rainbowhealth"); val.PatchAll(); } } [HarmonyPatch(typeof(tk2dSpriteAnimator), "UpdateAnimation")] internal class Patch_UpdateAnimation { private static void Postfix(tk2dSpriteAnimator __instance) { //IL_010f: 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) tk2dBaseSprite sprite = __instance.Sprite; if ((Object)(object)sprite == (Object)null) { return; } PlayMakerFSM[] componentsInParent = ((Component)__instance).GetComponentsInParent(); PlayMakerFSM val = null; PlayMakerFSM[] array = componentsInParent; foreach (PlayMakerFSM val2 in array) { if (val2.FsmVariables.FindFsmInt("Health Number") != null) { val = val2; break; } } if ((Object)(object)val == (Object)null) { return; } FsmInt val3 = val.FsmVariables.FindFsmInt("Health Number"); if (val3 == null) { return; } int value = val3.Value; if (value > 0 && value <= 10) { Color[] rainbowColors = GetRainbowColors(10); if (!RainbowHealthPlugin.EnableRainbow.Value) { sprite.color = rainbowColors[value - 1]; return; } int num = Mathf.FloorToInt(Time.time * RainbowHealthPlugin.Speed.Value) % 10; int num2 = (value - 1 + num) % 10; sprite.color = rainbowColors[num2]; } } public static Color[] GetRainbowColors(int count) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) Color[] array = (Color[])(object)new Color[count]; for (int i = 0; i < count + 2; i++) { float num = (float)i / ((float)count + 2f); if (i < 10) { array[i] = Color.HSVToRGB(num, 1f, 1f); array[i].a = 1f; } } return array; } } }