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 Empress DamageNumbers v1.0.3
EmpressDamageNumbers.dll
Decompiled 2 months agousing 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 BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.UI; [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("Omniscye")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("EmpressDamageNumbers")] [assembly: AssemblyTitle("EmpressDamageNumbers")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.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 Empress.DamageNumbers { [BepInPlugin("Empress.DamageNumbers", "EmpressDamageNumbers", "1.1.1")] public class EmpressDamageNumbers : BaseUnityPlugin { internal static Color TextColor = Color.white; internal static Color OutlineColor = Color.black; private ConfigEntry<string> cfgTextColorHex = null; private ConfigEntry<string> cfgOutlineColorHex = null; internal static EmpressDamageNumbers Instance { get; private set; } = null; internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_00cb: Expected O, but got Unknown Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; cfgTextColorHex = ((BaseUnityPlugin)this).Config.Bind<string>("Colors", "TextHex", "#FFFFFF", ""); cfgOutlineColorHex = ((BaseUnityPlugin)this).Config.Bind<string>("Colors", "OutlineHex", "#000000", ""); TextColor = ParseColor(cfgTextColorHex.Value, Color.white); OutlineColor = ParseColor(cfgOutlineColorHex.Value, Color.black); if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); Logger.LogInfo((object)"\n╔═╗┌┬┐┌─┐┬─┐┌─┐┌─┐┌─┐\n║╣ │││├─┘├┬┘├┤ └─┐└─┐\n╚═╝┴ ┴┴ ┴└─└─┘└─┘└─┘"); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} loaded"); } internal static Color ParseColor(string hex, Color fallback) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0049: 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_0045: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrWhiteSpace(hex)) { return fallback; } string text = hex.Trim(); if (!text.StartsWith("#")) { text = "#" + text; } Color result = default(Color); if (ColorUtility.TryParseHtmlString(text, ref result)) { return result; } return fallback; } } internal class EmpressDamagePopup : MonoBehaviour { private TextMeshPro tmp; private float life; private Vector3 velocity; internal void Init(Vector3 worldPos, int amount) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.position = worldPos + Vector3.up * 0.2f; tmp = ((Component)this).gameObject.AddComponent<TextMeshPro>(); ((TMP_Text)tmp).alignment = (TextAlignmentOptions)514; ((TMP_Text)tmp).fontSize = 2.5f; ((TMP_Text)tmp).enableWordWrapping = false; ((Graphic)tmp).raycastTarget = false; ((TMP_Text)tmp).fontStyle = (FontStyles)1; ((TMP_Text)tmp).outlineWidth = 0.15f; ((TMP_Text)tmp).outlineColor = Color32.op_Implicit(EmpressDamageNumbers.OutlineColor); ((TMP_Text)tmp).text = amount.ToString(); ((Graphic)tmp).color = EmpressDamageNumbers.TextColor; MeshRenderer component = ((Component)tmp).GetComponent<MeshRenderer>(); if (Object.op_Implicit((Object)(object)component)) { ((Renderer)component).shadowCastingMode = (ShadowCastingMode)0; } life = 1.2f; velocity = new Vector3(Random.Range(-0.3f, 0.3f), Random.Range(1.4f, 1.8f), 0f); } private void Update() { //IL_0019: 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_003d: 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_0051: 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_0060: 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_00a7: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) life -= Time.deltaTime; Color color = ((Graphic)tmp).color; color.a = Mathf.Clamp01(life / 1.2f); ((Graphic)tmp).color = color; Transform transform = ((Component)this).transform; transform.position += velocity * Time.deltaTime; velocity.y -= 3f * Time.deltaTime; Camera main = Camera.main; if (Object.op_Implicit((Object)(object)main)) { Vector3 val = ((Component)this).transform.position - ((Component)main).transform.position; if (((Vector3)(ref val)).sqrMagnitude > 0.0001f) { ((Component)this).transform.rotation = Quaternion.LookRotation(val); } } if (life <= 0f) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } internal static class AnchorUtil { internal static Vector3 GetAnchor(EnemyHealth h) { //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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)h).transform; EnemyHeadVisual componentInChildren = ((Component)h).GetComponentInChildren<EnemyHeadVisual>(); if (Object.op_Implicit((Object)(object)componentInChildren) && Object.op_Implicit((Object)(object)componentInChildren.FollowPosition)) { return componentInChildren.FollowPosition.position + Vector3.up * 0.2f; } if (TryGetCapsuleTop(transform, out var top, out var height)) { return top + Vector3.up * Mathf.Clamp(height * 0.08f, 0.05f, 0.5f); } if (TryGetControllerTop(transform, out var top2, out var height2)) { return top2 + Vector3.up * Mathf.Clamp(height2 * 0.08f, 0.05f, 0.5f); } if (TryGetWorldBounds(transform, out var bounds)) { return new Vector3(((Bounds)(ref bounds)).center.x, ((Bounds)(ref bounds)).max.y + Mathf.Clamp(((Bounds)(ref bounds)).size.y * 0.08f, 0.05f, 0.5f), ((Bounds)(ref bounds)).center.z); } return transform.position + Vector3.up * 1.6f; } private static bool TryGetCapsuleTop(Transform root, out Vector3 top, out float height) { //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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_005b: Unknown result type (might be due to invalid IL or missing references) top = Vector3.zero; height = 0f; CapsuleCollider val = null; float num = 0f; CapsuleCollider[] componentsInChildren = ((Component)root).GetComponentsInChildren<CapsuleCollider>(true); foreach (CapsuleCollider val2 in componentsInChildren) { if (Object.op_Implicit((Object)(object)val2) && ((Collider)val2).enabled) { float num2 = val2.height * Mathf.Abs(((Component)val2).transform.lossyScale.y); if (num2 > num) { num = num2; val = val2; } } } if ((Object)(object)val == (Object)null) { return false; } Vector3 up = ((Component)val).transform.up; float num3 = val.height * 0.5f * Mathf.Abs(((Component)val).transform.lossyScale.y); Vector3 val3 = ((Component)val).transform.TransformPoint(val.center); top = val3 + up * num3; height = num; return true; } private static bool TryGetControllerTop(Transform root, out Vector3 top, out float height) { //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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_005b: Unknown result type (might be due to invalid IL or missing references) top = Vector3.zero; height = 0f; CharacterController val = null; float num = 0f; CharacterController[] componentsInChildren = ((Component)root).GetComponentsInChildren<CharacterController>(true); foreach (CharacterController val2 in componentsInChildren) { if (Object.op_Implicit((Object)(object)val2) && ((Collider)val2).enabled) { float num2 = val2.height * Mathf.Abs(((Component)val2).transform.lossyScale.y); if (num2 > num) { num = num2; val = val2; } } } if ((Object)(object)val == (Object)null) { return false; } Vector3 up = ((Component)val).transform.up; float num3 = val.height * 0.5f * Mathf.Abs(((Component)val).transform.lossyScale.y); Vector3 val3 = ((Component)val).transform.TransformPoint(val.center); top = val3 + up * num3; height = num; return true; } private static bool TryGetWorldBounds(Transform root, out Bounds bounds) { //IL_0003: 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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) bounds = new Bounds(root.position, Vector3.zero); bool flag = false; Renderer[] componentsInChildren = ((Component)root).GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val) && val.enabled) { if (!flag) { bounds = val.bounds; flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(val.bounds); } } } Collider[] componentsInChildren2 = ((Component)root).GetComponentsInChildren<Collider>(true); foreach (Collider val2 in componentsInChildren2) { if (Object.op_Implicit((Object)(object)val2) && val2.enabled) { if (!flag) { bounds = val2.bounds; flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(val2.bounds); } } } return flag; } } [HarmonyPatch] internal static class Patches { [HarmonyPostfix] [HarmonyPatch(typeof(EnemyHealth), "HurtRPC")] private static void EnemyHealth_HurtRPC_Postfix(EnemyHealth __instance, int _damage, Vector3 _hurtDirection) { //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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_0019: 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) Vector3 anchor = AnchorUtil.GetAnchor(__instance); GameObject val = new GameObject("Empress_Damage"); val.transform.position = anchor; EmpressDamagePopup empressDamagePopup = val.AddComponent<EmpressDamagePopup>(); empressDamagePopup.Init(anchor, _damage); } } }