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 CaptainCombatDamage v0.1.50
CaptainCombatDamage.dll
Decompiled 2 days agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; 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(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("CaptainCombatDamage")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.1.49.0")] [assembly: AssemblyInformationalVersion("0.1.49+d46643831ef54439773f325c251b479c05dfac78")] [assembly: AssemblyProduct("CaptainCombatDamage")] [assembly: AssemblyTitle("CaptainCombatDamage")] [assembly: AssemblyVersion("0.1.49.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 CaptainCombatDamage { internal class BundleInstance { public string Key; public GameObject Go; public Animator Anim; public TMP_Text Number; public TMP_Text Label; public GameObject Fx; public GameObject FxLow; public GameObject FxMed; public GameObject FxHigh; public GameObject Tier2; public GameObject Tier3; public GameObject Accent; public Graphic Rim; public CanvasGroup[] Fade; } internal static class BundleStyle { private const string BundleName = "combatdamagetext"; private const int PoolMax = 24; private static bool _tried; private static AssetBundle _bundle; private static readonly Dictionary<string, GameObject> _prefabs = new Dictionary<string, GameObject>(); private static readonly Dictionary<string, Stack<BundleInstance>> _pool = new Dictionary<string, Stack<BundleInstance>>(); public static bool Available { get { if (!_tried) { Load(); } return (Object)(object)_bundle != (Object)null; } } private static void Load() { _tried = true; if (!Plugin.UseBundle.Value) { return; } try { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string text = null; string[] manifestResourceNames = executingAssembly.GetManifestResourceNames(); foreach (string text2 in manifestResourceNames) { if (text2 == "combatdamagetext" || text2.EndsWith(".combatdamagetext")) { text = text2; break; } } if (text == null) { Plugin.Log.LogInfo((object)"[Bundle] not embedded, using code style"); return; } byte[] array; using (Stream stream = executingAssembly.GetManifestResourceStream(text)) { using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); array = memoryStream.ToArray(); } _bundle = AssetBundle.LoadFromMemory(array); if ((Object)(object)_bundle == (Object)null) { Plugin.Log.LogWarning((object)"[Bundle] LoadFromMemory failed, using code style"); return; } GameObject[] array2 = _bundle.LoadAllAssets<GameObject>(); foreach (GameObject val in array2) { _prefabs[((Object)val).name] = val; } foreach (KeyValuePair<string, GameObject> prefab in _prefabs) { TMP_Text componentInChildren = prefab.Value.GetComponentInChildren<TMP_Text>(true); if ((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren.fontSharedMaterial != (Object)null && (Object)(object)componentInChildren.fontSharedMaterial.shader != (Object)null && !componentInChildren.fontSharedMaterial.shader.isSupported) { Plugin.Log.LogWarning((object)"[Bundle] TMP shader unsupported, using code style"); _bundle.Unload(true); _bundle = null; _prefabs.Clear(); return; } } Plugin.Log.LogInfo((object)("[Bundle] loaded " + _prefabs.Count + " prefabs")); } catch (Exception ex) { _bundle = null; Plugin.Log.LogWarning((object)("[Bundle] load error, using code style: " + ex.Message)); } } public static bool Has(string prefabName) { return Available && _prefabs.ContainsKey(prefabName); } public static BundleInstance Get(string prefabName, Transform parent) { if (!Has(prefabName)) { return null; } if (_pool.TryGetValue(prefabName, out var value)) { while (value.Count > 0) { BundleInstance bundleInstance = value.Pop(); if ((Object)(object)bundleInstance.Go != (Object)null && (Object)(object)bundleInstance.Number != (Object)null) { return bundleInstance; } } } GameObject val = Object.Instantiate<GameObject>(_prefabs[prefabName], parent); ((Object)val).name = prefabName; val.SetActive(false); BundleInstance bundleInstance2 = new BundleInstance { Key = prefabName, Go = val, Anim = val.GetComponent<Animator>(), Number = Child<TMP_Text>(val, "Number"), Label = Child<TMP_Text>(val, "Label"), Fx = Find(val, "Fx"), FxLow = Find(val, "Fx/Low"), FxMed = Find(val, "Fx/Medium"), FxHigh = Find(val, "Fx/High"), Tier2 = Find(val, "Fx/Tier2"), Tier3 = Find(val, "Fx/Tier3"), Accent = Find(val, "Accent"), Rim = Child<Graphic>(val, "Accent/Rim") }; bundleInstance2.Fade = (CanvasGroup[])(object)new CanvasGroup[4] { AddGroup(Find(val, "Backdrop")), AddGroup(bundleInstance2.Fx), AddGroup(bundleInstance2.Accent), AddGroup(Find(val, "Icon")) }; return ((Object)(object)bundleInstance2.Number == (Object)null) ? null : bundleInstance2; } public static void ApplyOpacity(BundleInstance b) { float value = Plugin.EffectOpacity.Value; if (b.Fade == null) { return; } CanvasGroup[] fade = b.Fade; foreach (CanvasGroup val in fade) { if ((Object)(object)val != (Object)null) { val.alpha = value; } } } private static CanvasGroup AddGroup(GameObject go) { if ((Object)(object)go == (Object)null) { return null; } CanvasGroup val = go.GetComponent<CanvasGroup>(); if ((Object)(object)val == (Object)null) { val = go.AddComponent<CanvasGroup>(); } val.interactable = false; val.blocksRaycasts = false; return val; } public static void Release(BundleInstance b) { b.Go.SetActive(false); if (!_pool.TryGetValue(b.Key, out var value)) { value = (_pool[b.Key] = new Stack<BundleInstance>()); } if (value.Count >= 24) { Object.Destroy((Object)(object)b.Go); } else { value.Push(b); } } public static void ApplyFx(BundleInstance b, int activeCount, int tier) { bool flag = Plugin.FxEnabled.Value && activeCount <= 80; FxLevel fxLevel = ((activeCount <= 40) ? Plugin.FxLevelSetting.Value : FxLevel.Low); Set(b.Fx, flag); Set(b.FxLow, flag); Set(b.FxMed, flag && fxLevel >= FxLevel.Medium); Set(b.FxHigh, flag && fxLevel >= FxLevel.High); Set(b.Tier2, flag && fxLevel >= FxLevel.Medium && tier >= 2); Set(b.Tier3, flag && fxLevel >= FxLevel.Medium && tier >= 3); } public static void ApplyAccent(BundleInstance b, bool on, Color color) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) Set(b.Accent, on); if (on && (Object)(object)b.Rim != (Object)null) { b.Rim.color = color; } } private static void Set(GameObject go, bool v) { if ((Object)(object)go != (Object)null && go.activeSelf != v) { go.SetActive(v); } } private static GameObject Find(GameObject root, string path) { Transform val = root.transform.Find(path); return ((Object)(object)val != (Object)null) ? ((Component)val).gameObject : null; } private static T Child<T>(GameObject root, string path) where T : Component { Transform val = root.transform.Find(path); return ((Object)(object)val != (Object)null) ? ((Component)val).GetComponent<T>() : default(T); } } internal class CombatTextManager : MonoBehaviour { private enum Kind { Normal, Crit, Poison, Fire, Frost, Lightning, Blunt, Pierce, Slash, Dot, Player, Spirit } private class KindInfo { public readonly string Prefab; public readonly string PrefabNoLabel; public readonly string Label; public readonly int LabelPct; public readonly Color Color; public KindInfo(string prefab, string noLabel, string label, int pct, Color color) { //IL_002b: 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) Prefab = prefab; PrefabNoLabel = noLabel ?? prefab; Label = label; LabelPct = pct; Color = color; } } private class Entry { public GameObject Go; public TMP_Text Text; public Vector3 World; public Vector2 Drift; public float Phase; public float Timer; public float Duration; public Kind Kind; public Color Color; public BundleInstance Inst; public float DistScale = 1f; public bool Strong; public bool IsDot; } private static readonly Color Gold = new Color(1f, 0.91f, 0.16f, 1f); private static readonly Color Titanium = new Color(0.78f, 0.86f, 1f, 1f); private static readonly Color Amber = new Color(1f, 0.5f, 0f, 1f); private static readonly Color Green = new Color(0.35f, 0.9f, 0.2f, 1f); private static readonly Color Red = new Color(1f, 0.22f, 0.1f, 1f); private static readonly Color Ice = new Color(0.29f, 0.63f, 0.96f, 1f); private static readonly Color Soul = new Color(0.94f, 0.96f, 1f, 1f); private static readonly Color Grey = new Color(0.5f, 0.51f, 0.55f, 1f); private static readonly KindInfo[] Infos = new KindInfo[12] { new KindInfo(null, null, null, 0, Color.white), new KindInfo("CD_Crit", null, "CRIT!", 70, Amber), new KindInfo("CD_Poison", null, "POISON", 60, Green), new KindInfo("CD_Fire", null, "FIRE", 60, Red), new KindInfo("CD_Ice", null, "ICE", 60, Ice), new KindInfo("CD_Lightning", null, "LIGHTNING", 60, Gold), new KindInfo("CD_Blunt", "CD_Blunt_NoLabel", "BLUNT", 60, Titanium), new KindInfo("CD_Pierce", "CD_Pierce_NoLabel", "PIERCE", 60, Titanium), new KindInfo("CD_Slash", "CD_Slash_NoLabel", "SLASH", 60, Titanium), new KindInfo("CD_Dot", null, "DoT", 60, Grey), new KindInfo(null, null, null, 0, new Color(1f, 0.25f, 0.2f, 1f)), new KindInfo("CD_Spirit", null, "SPIRIT", 60, Soul) }; private static CombatTextManager _inst; private readonly List<Entry> _active = new List<Entry>(); private readonly Stack<Entry> _pool = new Stack<Entry>(); private int _bundleCount; private static Camera _cam; private static int _camFrame = -1; private static readonly Queue<float> _recent = new Queue<float>(); private static float _recentSum; private static bool _noOutline; private static bool _noDilate; private const float PlainAlpha = 1f; private static Camera Cam() { if (_camFrame != Time.frameCount) { _cam = Utils.GetMainCamera(); _camFrame = Time.frameCount; } return _cam; } public static void Show(Vector3 pos, string text, float value, int flags, int baseType, bool targetIsPlayer) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) DamageText instance = DamageText.instance; if (!((Object)(object)instance == (Object)null) && !((Object)(object)instance.m_worldTextBase == (Object)null)) { if ((Object)(object)_inst == (Object)null) { _inst = ((Component)instance).gameObject.AddComponent<CombatTextManager>(); } _inst.Spawn(instance, pos, text, value, flags, baseType, targetIsPlayer); } } private static bool IsStrong(int flags, float value, bool dotOrEnv, bool targetIsPlayer) { if ((flags & 7) != 0) { return true; } if (dotOrEnv || targetIsPlayer || value <= 0f) { return false; } bool flag = _recent.Count >= 5 && value >= _recentSum / (float)_recent.Count * Plugin.StrongHitRatio.Value; if (!flag) { _recent.Enqueue(value); _recentSum += value; if (_recent.Count > 20) { _recentSum -= _recent.Dequeue(); } } return flag; } private static Vector3 Anchor(Vector3 pos, out float distScale, float heightMul) { //IL_001d: 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_004b: 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_005d: 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_0067: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) Camera val = Cam(); float num = (((Object)(object)val != (Object)null) ? Vector3.Distance(((Component)val).transform.position, pos) : 10f); distScale = Mathf.Clamp(12f / Mathf.Max(num, 1f), 0.45f, 1f); return pos + Vector3.up * (Plugin.HeightOffset.Value * heightMul) + Random.insideUnitSphere * 0.3f; } private static Kind PickKind(int flags, bool targetIsPlayer) { if ((flags & 0x100) != 0) { if ((flags & 0x800000) != 0) { return Kind.Spirit; } if ((flags & 0x800) != 0) { return Kind.Poison; } if ((flags & 0x1000) != 0) { return Kind.Fire; } if ((flags & 0x2000) != 0) { return Kind.Frost; } return Kind.Normal; } if ((flags & 7) != 0) { return Kind.Crit; } if (targetIsPlayer) { return Kind.Player; } if ((flags & 0x4000) != 0) { return Kind.Lightning; } if ((flags & 0x8000) != 0) { return Kind.Frost; } if ((flags & 0x1000) != 0) { return Kind.Fire; } if ((flags & 0x800) != 0) { return Kind.Poison; } if ((flags & 0x800000) != 0) { return Kind.Spirit; } if ((flags & 0x20000) != 0) { return Kind.Pierce; } if ((flags & 0x40000) != 0) { return Kind.Slash; } if ((flags & 0x10000) != 0) { return Kind.Blunt; } return Kind.Normal; } private static Color ColorOf(Kind kind, int baseType) { //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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (kind != Kind.Normal) { return Infos[(int)kind].Color; } if (baseType == 1 || baseType == 3) { return Grey; } return Titanium; } private static bool RimFor(Kind kind, int flags, out Color rim) { //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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_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_005a: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_00d1: Unknown result type (might be due to invalid IL or missing references) rim = Color.white; if ((flags & 0x80000) != 0) { rim = Gold; return true; } if ((flags & 0x100000) != 0) { rim = Ice; return true; } if ((flags & 8) != 0) { rim = Red; return true; } if ((flags & 0x10) != 0) { rim = Green; return true; } if ((flags & 0x20) != 0) { rim = Soul; return true; } if ((kind == Kind.Lightning || kind == Kind.Frost || kind == Kind.Fire || kind == Kind.Poison || kind == Kind.Spirit) && (flags & 0x70000) != 0) { rim = Titanium; return true; } return false; } private static string BuildText(Kind kind, string number, bool label) { KindInfo kindInfo = Infos[(int)kind]; if (!label || kindInfo.Label == null) { return number; } string[] obj = new string[6] { "<size=", null, null, null, null, null }; int labelPct = kindInfo.LabelPct; obj[1] = labelPct.ToString(); obj[2] = "%>"; obj[3] = kindInfo.Label; obj[4] = "</size>\n"; obj[5] = number; return string.Concat(obj); } private static float DurationFor(Kind k) { float value = Plugin.Duration.Value; switch (k) { case Kind.Crit: return value * 1.4f; default: if (k != Kind.Spirit) { return value; } goto case Kind.Poison; case Kind.Poison: case Kind.Fire: case Kind.Frost: case Kind.Dot: return value * 1.1f; } } private void Retire(int i) { Entry entry = _active[i]; _active.RemoveAt(i); if (entry.Inst != null) { _bundleCount--; BundleStyle.Release(entry.Inst); } else { entry.Go.SetActive(false); _pool.Push(entry); } } private bool EvictOldestBundle() { for (int i = 0; i < _active.Count; i++) { if (_active[i].Inst != null) { Retire(i); return true; } } return false; } private void Spawn(DamageText dt, Vector3 pos, string text, float value, int flags, int baseType, bool targetIsPlayer) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) if (_active.Count >= 120) { Retire(0); } Kind kind = PickKind(flags, targetIsPlayer); bool flag = (flags & 0x100) != 0; bool flag2 = flag || (flags & 0x200) != 0; bool flag3 = IsStrong(flags, value, flag2, targetIsPlayer); if ((flag3 || flag) && TrySpawnBundle(dt, kind, pos, text, flags, flag3, flag)) { return; } Entry entry = null; try { entry = ((_pool.Count > 0) ? _pool.Pop() : Create(dt)); entry.Go.SetActive(true); entry.Kind = ((kind == Kind.Player || flag3 || flag2) ? kind : Kind.Normal); entry.Inst = null; entry.Strong = flag3; entry.IsDot = flag; float num = (float)dt.m_largeFontSize * 1.5f * Plugin.FontScale.Value; if (flag3) { num *= ((kind == Kind.Crit) ? Plugin.SpecialScale.Value : 1.45f); } else if (flag2) { num *= (flag ? 1.4625f : 0.75f); } Color val = ColorOf(kind, baseType); entry.World = Anchor(pos, out entry.DistScale, flag ? 0.7f : 1f); entry.Timer = 0f; entry.Duration = (flag3 ? DurationFor(kind) : (0.5f * Plugin.Duration.Value / 1.2f)); entry.Phase = Random.value * 6.28f; entry.Drift = NewDrift(flag3); entry.Color = (flag3 ? Vivid(val) : val); entry.Text.text = (flag3 ? BuildText(kind, text, Plugin.ShowLabel.Value) : text); entry.Text.richText = true; entry.Text.fontStyle = (FontStyles)((!flag3) ? 1 : 3); Color32 color = default(Color32); ((Color32)(ref color))..ctor((byte)20, (byte)10, (byte)10, byte.MaxValue); float width = (flag3 ? 0.42f : 0.34f); if (flag3 && RimFor(kind, flags, out var rim)) { color = Color32.op_Implicit(rim); width = 0.32f; } ApplyOutline(entry.Text, color, width); ((Graphic)entry.Text).color = entry.Color; entry.Text.fontSize = num; _active.Add(entry); } catch (Exception ex) { Guard.Error("Spawn", ex); if (entry != null && (Object)(object)entry.Go != (Object)null) { entry.Go.SetActive(false); _pool.Push(entry); } } } private static void ApplyOutline(TMP_Text t, Color32 color, float width) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (_noOutline) { return; } try { t.outlineWidth = width; t.outlineColor = color; } catch (Exception) { _noOutline = true; Plugin.Log.LogInfo((object)"[Outline] not supported by this font; using bold numbers only"); } } private static void Thicken(TMP_Text t, float dilate) { if (_noDilate) { return; } try { Material fontMaterial = t.fontMaterial; if ((Object)(object)fontMaterial != (Object)null && fontMaterial.HasProperty("_FaceDilate")) { fontMaterial.SetFloat("_FaceDilate", dilate); return; } _noDilate = true; Plugin.Log.LogInfo((object)"[Thicken] face dilate not available; using bold only"); } catch (Exception) { _noDilate = true; Plugin.Log.LogInfo((object)"[Thicken] face dilate not supported; using bold only"); } } private bool TrySpawnBundle(DamageText dt, Kind kind, Vector3 pos, string text, int flags, bool strong, bool isDot) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) BundleInstance used = null; try { return TrySpawnBundleCore(dt, kind, pos, text, flags, strong, isDot, ref used); } catch (Exception ex) { Guard.Error("TrySpawnBundle", ex); if (used != null) { BundleStyle.Release(used); } return false; } } private bool TrySpawnBundleCore(DamageText dt, Kind kind, Vector3 pos, string text, int flags, bool strong, bool isDot, ref BundleInstance used) { //IL_00d0: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) KindInfo kindInfo = Infos[(int)kind]; string text2 = (Plugin.ShowLabel.Value ? kindInfo.Prefab : kindInfo.PrefabNoLabel); if (text2 == null || !BundleStyle.Has(text2)) { return false; } if (_bundleCount >= Plugin.MaxBundleCount.Value && (!strong || !EvictOldestBundle())) { return false; } BundleInstance bundleInstance = BundleStyle.Get(text2, ((Component)dt).transform); if (bundleInstance == null) { return false; } used = bundleInstance; Entry entry = new Entry { Kind = kind, Inst = bundleInstance, Go = bundleInstance.Go, Strong = strong, IsDot = isDot }; entry.World = Anchor(pos, out entry.DistScale, isDot ? 0.7f : 1f); entry.Duration = DurationFor(kind); entry.Phase = Random.value * 6.28f; entry.Drift = NewDrift(strong); bundleInstance.Number.text = text; if ((Object)(object)bundleInstance.Label != (Object)null) { bool flag = strong && Plugin.ShowLabel.Value && kindInfo.Label != null; ((Component)bundleInstance.Label).gameObject.SetActive(flag); if (flag) { bundleInstance.Label.text = kindInfo.Label; } } BundleStyle.ApplyAccent(bundleInstance, RimFor(kind, flags, out var rim), rim); int tier = (((flags & 0x400000) != 0) ? 3 : (((flags & 0x200000) != 0) ? 2 : 0)); BundleStyle.ApplyFx(bundleInstance, _active.Count, tier); BundleStyle.ApplyOpacity(bundleInstance); bundleInstance.Go.SetActive(true); if ((Object)(object)bundleInstance.Anim != (Object)null) { bundleInstance.Anim.speed = 1f / entry.Duration; bundleInstance.Anim.Play(0, 0, 0f); } _bundleCount++; _active.Add(entry); used = null; return true; } private static Entry Create(DamageText dt) { GameObject val = Object.Instantiate<GameObject>(dt.m_worldTextBase, ((Component)dt).transform); val.SetActive(true); Entry entry = new Entry { Go = val, Text = val.GetComponent<TMP_Text>() }; Thicken(entry.Text, 0.3f); return entry; } private static Color Vivid(Color c) { //IL_0001: 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_0033: 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); return Color.HSVToRGB(num, Mathf.Min(1f, num2 * 1.3f + 0.05f), 1f); } private static Vector2 NewDrift(bool strong) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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) float num = ((Random.value < 0.5f) ? (-1f) : 1f); float value = Plugin.ScatterWidth.Value; float num2 = num * (strong ? Random.Range(110f, 260f) : Random.Range(59f, 332f)) * value; float num3 = (strong ? Random.Range(50f, 80f) : Random.Range(10f, 33f)); return new Vector2(num2, num3); } private static float Fountain(float a) { return 4.44f * a - 4.94f * a * a; } private static void Motion(Entry e, float t, out Vector2 offset, out float scale) { //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_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_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) scale = 1f; if (e.Strong) { scale = ((t < 0.1f) ? Mathf.Lerp(0.4f, 1.3f, t / 0.1f) : Mathf.Lerp(1.3f, 1f, Mathf.Clamp01((t - 0.1f) / 0.1f))); float num = Mathf.Clamp01(t / 0.55f); offset = new Vector2(e.Drift.x * num * num, e.Drift.y * Fountain(num) + 10f); return; } switch (e.Kind) { case Kind.Poison: offset = new Vector2(Mathf.Sin(e.Phase + t * 9f) * 10f, 10.5f + 45f * t); break; case Kind.Fire: offset = new Vector2(Mathf.Sin(e.Phase + t * 40f) * 4f, 7f + 90f * t); scale = 1f + Mathf.Sin(e.Phase + t * 30f) * 0.06f; break; case Kind.Frost: scale = Mathf.Lerp(1.25f, 0.9f, Mathf.Clamp01(t * 3f)); offset = new Vector2(0f, 14f + 12f * t); break; case Kind.Spirit: offset = new Vector2(Mathf.Sin(e.Phase + t * 5f) * 7f, 12f + 38f * t); break; case Kind.Blunt: scale = ((t < 0.12f) ? Mathf.Lerp(1.6f, 1f, t / 0.12f) : 1f); offset = new Vector2((t < 0.2f) ? (Mathf.Sin(t * 120f) * 5f * (1f - t / 0.2f)) : 0f, 20f + 25f * t); break; case Kind.Pierce: offset = new Vector2(Mathf.Lerp(-90f * Mathf.Sign(e.Drift.x), 0f, Mathf.Clamp01(t / 0.12f)), 22f + 25f * t); break; case Kind.Slash: { float num3 = Mathf.Lerp(-1.1f, 1.1f, Mathf.Clamp01(t * 2.2f)) * Mathf.Sign(e.Drift.x); offset = new Vector2(Mathf.Sin(num3) * 55f, Mathf.Cos(num3) * 25f + 20f + 20f * t); break; } case Kind.Lightning: { float num2 = Mathf.Floor(t * 14f); offset = new Vector2(Mathf.Sin(e.Phase + num2 * 2.3f) * 16f, 20f + 40f * t); scale = ((t < 0.12f) ? Mathf.Lerp(1.4f, 1f, t / 0.12f) : 1f); break; } case Kind.Dot: offset = new Vector2(0f, 10.5f + 40f * t); break; default: offset = new Vector2(e.Drift.x * t, e.Drift.y * Fountain(t) + 10f); break; } } private void LateUpdate() { //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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_0140: 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_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) Camera val = Cam(); if ((Object)(object)val == (Object)null) { return; } float deltaTime = Time.deltaTime; float value = Plugin.ScreenLift.Value; float value2 = Plugin.FontScale.Value; float value3 = Plugin.BundleScale.Value; for (int num = _active.Count - 1; num >= 0; num--) { Entry entry = _active[num]; entry.Timer += deltaTime; float num2 = entry.Timer / entry.Duration; if (num2 >= 1f) { Retire(num); } else { Vector3 val2 = Utils.WorldToScreenPointScaled(val, entry.World); if (val2.z < 0f) { if (entry.Inst != null) { entry.Go.transform.localScale = Vector3.zero; } else { entry.Go.SetActive(false); } } else { Motion(entry, num2, out var offset, out var scale); entry.Go.transform.position = val2 + Vector2.op_Implicit(offset + new Vector2(0f, value * (entry.IsDot ? 0.7f : 1f))); if (entry.Inst != null) { float num3 = ((entry.Kind == Kind.Crit) ? 1.05f : ((entry.Kind == Kind.Frost) ? 1.1f : ((entry.Kind == Kind.Lightning) ? 1.15f : 1.3f))); entry.Go.transform.localScale = Vector3.one * (Mathf.Min(scale, num3) * value2 * value3 * entry.DistScale); } else { entry.Go.SetActive(true); entry.Go.transform.localScale = Vector3.one * scale; Color color = entry.Color; color.a = (entry.Strong ? (1f - Mathf.Pow(num2, 6f)) : (1f * (1f - Mathf.Pow(num2, 4f)))); ((Graphic)entry.Text).color = color; } } } } } } internal static class HitFlags { public const int Marker = 128; public const int Backstab = 1; public const int Stagger = 2; public const int Weak = 4; public const int Dot = 256; public const int Env = 512; public const int Tamed = 1024; public const int DotPoison = 2048; public const int DotFire = 4096; public const int DotFrost = 8192; public const int HitLightning = 16384; public const int HitFrost = 32768; public const int PhysBlunt = 65536; public const int PhysPierce = 131072; public const int PhysSlash = 262144; public const int AccentLightning = 524288; public const int AccentFrost = 1048576; public const int Tier2 = 2097152; public const int Tier3 = 4194304; public const int DotSpirit = 8388608; public const int AccentFire = 8; public const int AccentPoison = 16; public const int AccentSpirit = 32; public const int Special = 7; public const int Shift = 8; public static int Classify(DamageTypes d) { //IL_0001: 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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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) //IL_0105: 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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) float blunt = d.m_blunt; float num = d.m_pierce + d.m_pickaxe; float num2 = d.m_slash + d.m_chop; float num3 = blunt + num + num2; float totalDamage = ((DamageTypes)(ref d)).GetTotalDamage(); if (totalDamage <= 0f) { return 0; } int num4 = 0; if (num3 > 0f) { num4 = ((num >= num2 && num >= blunt) ? (num4 | 0x20000) : ((!(num2 >= blunt)) ? (num4 | 0x10000) : (num4 | 0x40000))); } float num5 = d.m_frost; int num6 = 32768; int num7 = 1048576; if (d.m_lightning > num5) { num5 = d.m_lightning; num6 = 16384; num7 = 524288; } if (d.m_fire > num5) { num5 = d.m_fire; num6 = 4096; num7 = 8; } if (d.m_poison > num5) { num5 = d.m_poison; num6 = 2048; num7 = 16; } if (d.m_spirit > num5) { num5 = d.m_spirit; num6 = 8388608; num7 = 32; } float num8 = num5 / totalDamage; if (num8 >= 0.5f) { num4 |= num6; } else if (num8 >= 0.25f) { num4 |= num7; } return num4; } public static bool IsDot(HitType t) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 return (int)t == 5 || (int)t == 7 || (int)t == 6 || (int)t == 9; } public static bool IsDirect(HitType t) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Invalid comparison between Unknown and I4 //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 return (int)t == 0 || (int)t == 1 || (int)t == 2 || (int)t == 14 || (int)t == 16; } } internal static class DisplayFilter { public static bool Allow(int flags, int baseType, bool targetIsPlayer, float value, out int effectiveFlags) { effectiveFlags = flags & -8; if ((flags & 0x400) != 0) { if (!Plugin.ShowTamed.Value) { return false; } } else { DisplayMode value2 = Plugin.Mode.Value; if (targetIsPlayer ? (value2 == DisplayMode.MonstersOnly) : (value2 == DisplayMode.PlayersOnly)) { return false; } } if ((flags & 0x100) != 0) { if (!Plugin.ShowDot.Value) { return false; } } else if ((flags & 0x200) != 0) { if (!Plugin.ShowEnvironment.Value) { return false; } } else { int num = 0; if ((flags & 1) != 0 && Plugin.StyleBackstab.Value) { num |= 1; } if ((flags & 2) != 0 && Plugin.StyleStagger.Value) { num |= 2; } if ((flags & 4) != 0 && Plugin.StyleWeak.Value) { num |= 4; } effectiveFlags |= num; if (num == 0 && !Plugin.ShowNormal.Value) { return false; } } if (!Plugin.ShowResisted.Value && (baseType == 1 || baseType == 3)) { return false; } if (Plugin.MinDamage.Value > 0f && value < Plugin.MinDamage.Value) { return false; } return true; } public static string Format(string text, float v) { CultureInfo invariantCulture = CultureInfo.InvariantCulture; bool value = Plugin.ThousandsSeparator.Value; if (Plugin.ShowDecimals.Value) { return v.ToString(value ? "N1" : "0.#", invariantCulture); } return Mathf.Max(1, Mathf.RoundToInt(v)).ToString(value ? "N0" : "0", invariantCulture); } } internal static class Guard { private static readonly HashSet<string> Logged = new HashSet<string>(); public static readonly FieldRef<Character, float> BackstabTime = TryRef("m_backstabTime"); public static readonly FieldRef<Character, float> StaggerDamage = TryRef("m_staggerDamage"); private static FieldRef<Character, float> TryRef(string name) { try { return AccessTools.FieldRefAccess<Character, float>(name); } catch (Exception) { return null; } } public static void Error(string where, Exception ex) { if (Logged.Add(where)) { Plugin.Log.LogError((object)("[" + where + "] " + ex?.ToString() + " (repeats suppressed)")); } } } [HarmonyPatch(typeof(Character), "ApplyDamage")] internal static class ApplyDamage_Context { internal static Character Target; internal static HitData Hit; [HarmonyPrefix] private static void Prefix(Character __instance, HitData hit) { Target = __instance; Hit = hit; } [HarmonyFinalizer] private static void Finalizer() { Target = null; Hit = null; } } [HarmonyPatch(typeof(DamageText), "ShowText", new Type[] { typeof(DamageModifier), typeof(Vector3), typeof(float), typeof(bool) })] internal static class ShowText_ActualDamage { [HarmonyPrefix] private static void Prefix(ref float dmg) { try { if (ApplyDamage_Context.Hit != null) { dmg = ApplyDamage_Context.Hit.GetTotalDamage(); } } catch (Exception ex) { Guard.Error("ShowText_ActualDamage", ex); } } } [HarmonyPatch(typeof(DamageText), "ShowText", new Type[] { typeof(TextType), typeof(Vector3), typeof(string), typeof(bool) })] internal static class ShowText_Flags { [HarmonyPrefix] private static void Prefix(ref TextType type) { try { Build(ref type); } catch (Exception ex) { Guard.Error("ShowText_Flags", ex); } } private static void Build(ref TextType type) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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) Character target = ApplyDamage_Context.Target; HitData hit = ApplyDamage_Context.Hit; if ((Object)(object)target == (Object)null || hit == null) { return; } int num = 128; if (hit.m_backstabBonus > 1f && Guard.BackstabTime != null && Mathf.Approximately(Guard.BackstabTime.Invoke(target), Time.time)) { num |= 1; } if (target.IsTamed()) { num |= 0x400; } if (!HitFlags.IsDot(hit.m_hitType)) { num = (HitFlags.IsDirect(hit.m_hitType) ? (num | HitFlags.Classify(hit.m_damage)) : (num | 0x200)); } else { num |= 0x100; DamageTypes damage = hit.m_damage; float num2 = 0f; int num3 = 0; if (damage.m_poison > num2) { num2 = damage.m_poison; num3 = 2048; } if (damage.m_fire > num2) { num2 = damage.m_fire; num3 = 4096; } if (damage.m_spirit > num2) { num2 = damage.m_spirit; num3 = 8388608; } if (damage.m_frost > num2) { num2 = damage.m_frost; num3 = 8192; } num |= num3; } float maxHealth = target.GetMaxHealth(); if (maxHealth > 0f) { float num4 = hit.GetTotalDamage() / maxHealth; if (num4 >= 0.35f) { num |= 0x400000; } else if (num4 >= 0.15f) { num |= 0x200000; } } if (!target.IsPlayer()) { float num5 = ((DamageTypes)(ref hit.m_damage)).GetTotalStaggerDamage() * hit.m_staggerMultiplier; if (target.IsStaggering() || (target.m_staggerDamageFactor > 0f && Guard.StaggerDamage != null && Guard.StaggerDamage.Invoke(target) + num5 >= target.GetMaxHealth() * target.m_staggerDamageFactor)) { num |= 2; } } if ((int)type == 2) { num |= 4; } type = (TextType)((uint)type | (uint)(num << 8)); } } [HarmonyPatch(typeof(DamageText), "RPC_DamageText")] internal static class RPC_DamageText_Intercept { [HarmonyPrefix] private static bool Prefix(ZPackage pkg) { int pos = pkg.GetPos(); try { return Intercept(pkg, pos); } catch (Exception ex) { Guard.Error("RPC_DamageText_Intercept", ex); pkg.SetPos(pos); return true; } } private static bool Intercept(ZPackage pkg, int start) { //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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) int num = pkg.ReadInt(); int num2 = num >> 8; if ((num2 & 0x80) == 0) { pkg.SetPos(start); return true; } Vector3 val = pkg.ReadVector3(); string text = pkg.ReadString(); bool targetIsPlayer = pkg.ReadBool(); Camera mainCamera = Utils.GetMainCamera(); if (Hud.IsUserHidden() || !Object.op_Implicit((Object)(object)mainCamera)) { return false; } int baseType = num & 0xFF; float.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out var result); if (!DisplayFilter.Allow(num2, baseType, targetIsPlayer, result, out var effectiveFlags)) { return false; } if (Vector3.Distance(((Component)mainCamera).transform.position, val) > Plugin.MaxDistance.Value) { return false; } CombatTextManager.Show(val, DisplayFilter.Format(text, result), result, effectiveFlags, baseType, targetIsPlayer); return false; } } public enum DisplayMode { MonstersOnly, PlayersOnly, Both } public enum FxLevel { Low, Medium, High } [BepInPlugin("korCaptain.CaptainCombatDamage", "Captain Combat Damage", "0.1.50")] public class Plugin : BaseUnityPlugin { internal static Plugin Instance; internal static ManualLogSource Log; internal static ConfigEntry<DisplayMode> Mode; internal static ConfigEntry<bool> ShowTamed; internal static ConfigEntry<bool> ShowNormal; internal static ConfigEntry<bool> ShowDot; internal static ConfigEntry<bool> ShowEnvironment; internal static ConfigEntry<bool> ShowResisted; internal static ConfigEntry<float> MinDamage; internal static ConfigEntry<bool> StyleBackstab; internal static ConfigEntry<bool> StyleStagger; internal static ConfigEntry<bool> StyleWeak; internal static ConfigEntry<float> FontScale; internal static ConfigEntry<float> SpecialScale; internal static ConfigEntry<float> Duration; internal static ConfigEntry<float> MaxDistance; internal static ConfigEntry<bool> UseBundle; internal static ConfigEntry<bool> FxEnabled; internal static ConfigEntry<FxLevel> FxLevelSetting; internal static ConfigEntry<float> EffectOpacity; internal static ConfigEntry<float> BundleScale; internal static ConfigEntry<float> HeightOffset; internal static ConfigEntry<float> ScreenLift; internal static ConfigEntry<float> ScatterWidth; internal static ConfigEntry<int> MaxBundleCount; internal static ConfigEntry<float> StrongHitRatio; internal static ConfigEntry<bool> ShowLabel; internal static ConfigEntry<bool> ThousandsSeparator; internal static ConfigEntry<bool> ShowDecimals; private void Awake() { //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Expected O, but got Unknown //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Expected O, but got Unknown //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Expected O, but got Unknown //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Expected O, but got Unknown //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Expected O, but got Unknown //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Expected O, but got Unknown //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Expected O, but got Unknown //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Expected O, but got Unknown //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Expected O, but got Unknown //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Expected O, but got Unknown //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Expected O, but got Unknown //IL_04c9: Unknown result type (might be due to invalid IL or missing references) Instance = this; Log = ((BaseUnityPlugin)this).Logger; Mode = ((BaseUnityPlugin)this).Config.Bind<DisplayMode>("1. Target", "DisplayMode", DisplayMode.MonstersOnly, "MonstersOnly: damage monsters take. PlayersOnly: damage players take. Both: all. / 표시 대상(몬스터만, 플레이어만, 둘 다)"); ShowTamed = ((BaseUnityPlugin)this).Config.Bind<bool>("1. Target", "ShowTamed", true, "Show damage taken by tamed creatures (independent of DisplayMode). / 길들인 동물이 받는 피해 표시"); ShowNormal = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Damage Types", "ShowNormal", true, "Show plain direct hits (hits without a special style). If off, special-style hits are still shown. / 일반 직접 타격 표시"); ShowDot = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Damage Types", "ShowDot", true, "Show damage-over-time ticks (burning, poison, frost, smoke). / 도트 데미지(화상·독·냉기·연기) 표시"); ShowEnvironment = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Damage Types", "ShowEnvironment", true, "Show environmental damage (fall, drowning, lava, etc.). / 환경 피해(낙하·익사·용암 등) 표시"); ShowResisted = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Damage Types", "ShowResisted", true, "Show hits the target resists or is immune to (grey). / 저항·면역 타격 표시"); MinDamage = ((BaseUnityPlugin)this).Config.Bind<float>("2. Damage Types", "MinDamage", 0f, new ConfigDescription("Hide numbers below this value. / 이 값 미만의 피해는 숨김", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1000f), Array.Empty<object>())); StyleBackstab = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Special Hit Styles", "StyleBackstab", true, "Special style for backstabs. Off = shown as a plain hit. (Valheim has no true crit; these are its crit-like hits.) / 백스탭 특수 연출"); StyleStagger = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Special Hit Styles", "StyleStagger", true, "Special style for hits that stagger the target or land on a staggered target. / 스태거 특수 연출"); StyleWeak = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Special Hit Styles", "StyleWeak", true, "Special style for weakness hits (extra damage from that damage type). / 약점 특수 연출"); FontScale = ((BaseUnityPlugin)this).Config.Bind<float>("4. Appearance", "FontScale", 1f, new ConfigDescription("Text size multiplier. / 글자 크기 배율", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 3f), Array.Empty<object>())); SpecialScale = ((BaseUnityPlugin)this).Config.Bind<float>("4. Appearance", "SpecialScale", 1.8f, new ConfigDescription("Extra size multiplier for special hits. / 특수 타격 추가 크기 배율", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 3f), Array.Empty<object>())); Duration = ((BaseUnityPlugin)this).Config.Bind<float>("4. Appearance", "Duration", 1.6f, new ConfigDescription("Seconds a number stays on screen. / 표시 시간(초)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 4f), Array.Empty<object>())); MaxDistance = ((BaseUnityPlugin)this).Config.Bind<float>("4. Appearance", "MaxDistance", 60f, new ConfigDescription("Hide numbers farther than this many meters. / 이 거리(m)보다 멀면 숨김", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 100f), Array.Empty<object>())); UseBundle = ((BaseUnityPlugin)this).Config.Bind<bool>("4. Appearance", "UseBundle", true, "Use the Unity bundle styles when the bundle is present (restart required). Off = simple built-in style. / Unity 번들 연출 사용(재시작 필요)"); FxEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("4. Appearance", "FxEnabled", true, "Show particle-like effects around numbers (bundle style only). / 번들 연출의 부가 효과 표시"); FxLevelSetting = ((BaseUnityPlugin)this).Config.Bind<FxLevel>("4. Appearance", "FxLevel", FxLevel.High, "Effect intensity: Low = lightest, High = most particles. Many simultaneous numbers drop to Low automatically. / 효과 강도(숫자가 많으면 자동 Low)"); EffectOpacity = ((BaseUnityPlugin)this).Config.Bind<float>("4. Appearance", "EffectOpacity", 0.8f, new ConfigDescription("Opacity of the bundle plate/effects behind strong-hit numbers (numbers stay fully opaque). / 강한 타격 연출 판·이펙트의 불투명도(숫자는 그대로)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); BundleScale = ((BaseUnityPlugin)this).Config.Bind<float>("4. Appearance", "BundleScale", 0.55f, new ConfigDescription("Size multiplier of bundle-style (strong hit) numbers. / 번들 연출(강한 타격) 크기 배율", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.2f, 2f), Array.Empty<object>())); HeightOffset = ((BaseUnityPlugin)this).Config.Bind<float>("4. Appearance", "HeightOffset", 0.6f, new ConfigDescription("Start the numbers this many meters above the hit point. / 타격 지점보다 위에서 시작하는 높이(m)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f), Array.Empty<object>())); ScatterWidth = ((BaseUnityPlugin)this).Config.Bind<float>("4. Appearance", "ScatterWidth", 1.2f, new ConfigDescription("Horizontal spread of the left/right fountain arc (1 = default, higher = wider). / 좌우로 튀는 폭 배율(클수록 넓게)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.3f, 3f), Array.Empty<object>())); ScreenLift = ((BaseUnityPlugin)this).Config.Bind<float>("4. Appearance", "ScreenLift", 0f, new ConfigDescription("Extra upward shift of every number in screen pixels (raise if numbers feel too low). / 모든 숫자를 화면에서 추가로 위로 올리는 픽셀 수", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 300f), Array.Empty<object>())); MaxBundleCount = ((BaseUnityPlugin)this).Config.Bind<int>("4. Appearance", "MaxBundleCount", 12, new ConfigDescription("Max simultaneous bundle-style numbers; when full, the oldest one is replaced by the new strong hit. / 동시에 표시할 번들 연출 최대 개수(가득 차면 가장 오래된 것을 새 강한 타격으로 교체)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 60), Array.Empty<object>())); StrongHitRatio = ((BaseUnityPlugin)this).Config.Bind<float>("4. Appearance", "StrongHitRatio", 2f, new ConfigDescription("A hit is 'strong' when it is at least this many times the recent average (needs 5 hits). Backstab/stagger/weak hits are always strong. / 최근 평균의 몇 배 이상이면 강한 타격(5회 표본 후). 백스탭·스태거·약점은 항상 강함", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), Array.Empty<object>())); ShowLabel = ((BaseUnityPlugin)this).Config.Bind<bool>("4. Appearance", "ShowLabel", true, "Show the type name (CRIT!, FIRE, ICE, LIGHTNING, POISON, DoT) above the number. / 수치 위에 종류 이름 표시"); ThousandsSeparator = ((BaseUnityPlugin)this).Config.Bind<bool>("4. Appearance", "ThousandsSeparator", true, "Format 12345 as 12,345. / 천 단위 쉼표"); ShowDecimals = ((BaseUnityPlugin)this).Config.Bind<bool>("4. Appearance", "ShowDecimals", false, "Show one decimal place (default rounds to a whole number, minimum 1). / 소수 첫째 자리 표시"); new Harmony("korCaptain.CaptainCombatDamage").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Captain Combat Damage loaded"); } } }