Snapshot for release 2026.10.28.1 (internal de8d80b)
This commit is contained in:
parent
f4246dbbd0
commit
8728446a27
46 changed files with 2522 additions and 259 deletions
25
src/RynthCore.Engine/ImGui/MonsterHud/DebuffIcon.cs
Normal file
25
src/RynthCore.Engine/ImGui/MonsterHud/DebuffIcon.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
// ============================================================================
|
||||
// RynthCore.Engine - ImGui/MonsterHud/DebuffIcon.cs
|
||||
// What one debuff icon stands for, shared by the monster plates' row
|
||||
// (PlateDebuffs: your debuffs on each monster) and your own plate's row
|
||||
// (SelfDebuffs: harmful spells on you), both painted by DebuffIconRow.
|
||||
// Plain data, no engine dependencies (the offline tests compile it in).
|
||||
// ============================================================================
|
||||
|
||||
namespace RynthCore.Engine.ImGuiBackend.Hud;
|
||||
|
||||
/// <summary>What an icon on the plate stands for (one icon per kind).</summary>
|
||||
internal enum DebuffKind : byte
|
||||
{
|
||||
VulnFire, VulnCold, VulnLightning, VulnAcid, VulnSlash, VulnPierce, VulnBludgeon,
|
||||
Imperil, MagicYield, Defense, Attributes, Vitals, Movement, Skills, Dot, Other,
|
||||
}
|
||||
|
||||
/// <summary>One icon: the kind, when its soonest entry expires, that entry's full length, and how many categories it merges.</summary>
|
||||
internal struct DebuffIcon
|
||||
{
|
||||
public DebuffKind Kind;
|
||||
public long Expiry; // Stopwatch ticks
|
||||
public float Duration; // seconds, of the entry expiring first
|
||||
public int Stack;
|
||||
}
|
||||
138
src/RynthCore.Engine/ImGui/MonsterHud/DebuffIconRow.cs
Normal file
138
src/RynthCore.Engine/ImGui/MonsterHud/DebuffIconRow.cs
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
// ============================================================================
|
||||
// RynthCore.Engine - ImGui/MonsterHud/DebuffIconRow.cs
|
||||
// The debuff icon row, shared by the monster plates (your debuffs on each
|
||||
// monster, under its health bar) and your own plate (harmful spells on you,
|
||||
// under your mana bar): one icon per kind (a Phosphor glyph in the kind's
|
||||
// tint on a dark square), a stack digit when a kind merges several spell
|
||||
// categories, a countdown line under each icon that runs out with the spell,
|
||||
// a blink in the last BlinkSec seconds, "+N" when more kinds than fit, and
|
||||
// (monster plates only) the "debuffed by others" marker.
|
||||
//
|
||||
// Moved out of MonsterHud.PaintIcons unchanged (2026-10-27) so the player
|
||||
// plate can draw the same row; the monster plates look exactly as before.
|
||||
// Render thread only. Engine-owned statics.
|
||||
// ============================================================================
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Numerics;
|
||||
using ImGuiNET;
|
||||
|
||||
namespace RynthCore.Engine.ImGuiBackend.Hud;
|
||||
|
||||
internal static class DebuffIconRow
|
||||
{
|
||||
/// <summary>Icons per row; more shows "+N" (the last slot makes room for it).</summary>
|
||||
internal const int MaxIcons = 5;
|
||||
/// <summary>Icons blink in their last seconds.</summary>
|
||||
internal const float BlinkSec = 5f;
|
||||
|
||||
private static readonly uint IconBack = MonsterHud.C(0xD80B1219), OthersTint = MonsterHud.C(0xFFFF8A7A);
|
||||
|
||||
// One glyph and tint per DebuffKind (index = kind).
|
||||
private static readonly string[] KindGlyph =
|
||||
{
|
||||
PhosphorIcons.Fire, PhosphorIcons.Snowflake, PhosphorIcons.Lightning, PhosphorIcons.Flask,
|
||||
PhosphorIcons.Sword, PhosphorIcons.Knife, PhosphorIcons.Hammer,
|
||||
PhosphorIcons.ShieldSlash, PhosphorIcons.MagicWand, PhosphorIcons.ShieldWarning,
|
||||
PhosphorIcons.ArrowFatLinesDown, PhosphorIcons.HeartBreak, PhosphorIcons.Footprints,
|
||||
PhosphorIcons.TrendDown, PhosphorIcons.Skull, PhosphorIcons.ArrowFatDown,
|
||||
};
|
||||
private static readonly uint[] KindTint =
|
||||
{
|
||||
MonsterHud.ElemFire, MonsterHud.ElemCold, MonsterHud.ElemLightning, MonsterHud.ElemAcid,
|
||||
MonsterHud.ElemSlash, MonsterHud.ElemPierce, MonsterHud.ElemBludgeon,
|
||||
MonsterHud.C(0xFF9FB4C8), // Imperil: steel
|
||||
MonsterHud.C(0xFFB98CFF), // Magic Yield: violet
|
||||
MonsterHud.C(0xFFFFB347), // melee / missile defense: orange
|
||||
MonsterHud.C(0xFFF2D24B), // attributes: yellow
|
||||
MonsterHud.C(0xFFFF6B8A), // vitals / regen: pink-red
|
||||
MonsterHud.C(0xFFA8C66C), // movement: moss
|
||||
MonsterHud.C(0xFF8FB8DE), // skills: blue-grey
|
||||
MonsterHud.C(0xFF7CE08A), // damage over time: green
|
||||
MonsterHud.C(0xFFC8C8C8), // other
|
||||
};
|
||||
private static readonly string[] StackDigits = { "", "", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||
|
||||
/// <summary>
|
||||
/// The row centred on <paramref name="cx"/> with its top at <paramref name="top"/>:
|
||||
/// <paramref name="count"/> kinds (may exceed <paramref name="icons"/>' length: the rest
|
||||
/// show as "+N"), then the "debuffed by others" marker when <paramref name="others"/>.
|
||||
/// <paramref name="sz"/> is the icon square, <paramref name="smallFont"/>/<paramref name="smallSize"/>
|
||||
/// draw the stack digit and "+N"; <paramref name="overflowKey"/>/<paramref name="overflowText"/>
|
||||
/// cache the "+N" string per row. <paramref name="now"/> is Stopwatch ticks.
|
||||
/// </summary>
|
||||
internal static void Paint(ImDrawListPtr dl, DebuffIcon[] icons, int count, bool others, float sz,
|
||||
ImFontPtr smallFont, float smallSize, ref int overflowKey, ref string overflowText,
|
||||
float cx, float top, float k, float a, long now)
|
||||
{
|
||||
float gap = MathF.Max(2f, MathF.Round(2f * k));
|
||||
int shown = count > icons.Length ? icons.Length - 1 : count;
|
||||
int overflow = count - shown;
|
||||
string more = "";
|
||||
float moreW = 0f;
|
||||
if (overflow > 0)
|
||||
{
|
||||
if (overflow != overflowKey)
|
||||
{
|
||||
overflowKey = overflow;
|
||||
overflowText = "+" + overflow.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
more = overflowText;
|
||||
moreW = MonsterHud.TextWidth(smallFont, smallSize, more) + 4f * k;
|
||||
}
|
||||
int slots = shown + (others ? 1 : 0);
|
||||
float rowW = slots * sz + Math.Max(0, slots - 1) * gap + (overflow > 0 ? gap + moreW : 0f);
|
||||
float x = MathF.Round(cx - rowW * 0.5f);
|
||||
float glyphPx = MathF.Round(sz * 0.8f);
|
||||
ImFontPtr iconFont = ImGuiFonts.Sharp(glyphPx, bold: false); // the icons are merged into every bake
|
||||
float lineH = MathF.Max(1f, MathF.Round(1.5f * k));
|
||||
|
||||
for (int i = 0; i < shown; i++)
|
||||
{
|
||||
DebuffIcon ic = icons[i];
|
||||
int kind = (int)ic.Kind;
|
||||
uint tint = kind < KindTint.Length ? KindTint[kind] : KindTint[^1];
|
||||
float remaining = (ic.Expiry - now) / (float)Stopwatch.Frequency;
|
||||
float frac = ic.Duration > 0 ? Math.Clamp(remaining / ic.Duration, 0f, 1f) : 0f;
|
||||
float blink = remaining < BlinkSec ? 0.45f + 0.55f * MathF.Abs(MathF.Cos(remaining * MathF.PI * 2f)) : 1f;
|
||||
|
||||
var i0 = new Vector2(x, top);
|
||||
var i1 = i0 + new Vector2(sz, sz);
|
||||
dl.AddRectFilled(i0, i1, MonsterHud.Mul(IconBack, a), 2f * k);
|
||||
dl.AddRect(i0, i1, MonsterHud.Mul(tint, a * 0.55f * blink), 2f * k, ImDrawFlags.None, 1f);
|
||||
PhosphorIcons.DrawCentered(dl, iconFont, glyphPx, KindGlyph[kind < KindGlyph.Length ? kind : KindGlyph.Length - 1],
|
||||
i0, new Vector2(sz, sz), MonsterHud.Mul(tint, a * blink));
|
||||
if (ic.Stack > 1 && ic.Stack < StackDigits.Length)
|
||||
{
|
||||
string digit = StackDigits[ic.Stack];
|
||||
float ds = MathF.Round(smallSize * 0.85f);
|
||||
var dp = new Vector2(i1.X - MonsterHud.TextWidth(smallFont, ds, digit) + 1f, i0.Y - 2f);
|
||||
MonsterHud.OutlinedText(dl, smallFont, ds, dp, a, digit);
|
||||
dl.AddText(smallFont, ds, dp, MonsterHud.Mul(MonsterHud.HpText, a), digit);
|
||||
}
|
||||
// Countdown: a line under the icon that shrinks to nothing at expiry.
|
||||
float ly = i1.Y + 1f;
|
||||
dl.AddRectFilled(new Vector2(i0.X, ly), new Vector2(i1.X, ly + lineH), MonsterHud.Mul(MonsterHud.Outline, a * 0.8f));
|
||||
if (frac > 0f)
|
||||
dl.AddRectFilled(new Vector2(i0.X, ly), new Vector2(i0.X + MathF.Max(1f, sz * frac), ly + lineH), MonsterHud.Mul(tint, a * blink));
|
||||
x += sz + gap;
|
||||
}
|
||||
|
||||
if (overflow > 0)
|
||||
{
|
||||
var mp = new Vector2(x, MathF.Round(top + (sz - smallSize) * 0.5f));
|
||||
MonsterHud.OutlinedText(dl, smallFont, smallSize, mp, a, more);
|
||||
dl.AddText(smallFont, smallSize, mp, MonsterHud.Mul(MonsterHud.DimText, a), more);
|
||||
x += moreW + gap;
|
||||
}
|
||||
|
||||
if (others)
|
||||
{
|
||||
var i0 = new Vector2(x, top);
|
||||
dl.AddRectFilled(i0, i0 + new Vector2(sz, sz), MonsterHud.Mul(IconBack, a * 0.8f), 2f * k);
|
||||
PhosphorIcons.DrawCentered(dl, iconFont, glyphPx, PhosphorIcons.UsersThree, i0, new Vector2(sz, sz), MonsterHud.Mul(OthersTint, a * 0.8f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -77,45 +77,23 @@ internal static class MonsterHud
|
|||
private const uint BfVendor = 0x200; // PublicWeenieDesc BF_VENDOR
|
||||
private const uint PetOwnerIid = 44; // PropertyInstanceId PetOwner (summoned pets)
|
||||
internal const float LandblockSize = 192f;
|
||||
private const int MaxIcons = 5; // debuff icons per plate; more shows "+N"
|
||||
private const float BlinkSec = 5f; // icons blink in their last seconds
|
||||
|
||||
// ── Palette (ARGB literals -> ImGui ABGR) ────────────────────────────
|
||||
private static readonly uint BarBack = C(0xE00C1118), BarEdge = C(0xFF000000), Tick = C(0x70000000),
|
||||
Shine = C(0x38FFFFFF), Trail = C(0xFFF3E2A8), Gold = C(0xFFE6C766), GoldBright = C(0xFFFFD966),
|
||||
GoldGlow = C(0x55E6C766), NameText = C(0xFFF2E8DC), AttackerText = C(0xFFFF8A7A), Outline = C(0xE6000000),
|
||||
HpText = C(0xFFFFFFFF), DimText = C(0xFFB8C4D0), BadgeBack = C(0xD0101820), Leader = C(0x60FFFFFF),
|
||||
HoverEdge = C(0xC0FFFFFF), UnknownFill = C(0xFF5E8A6A), IconBack = C(0xD80B1219), OthersTint = C(0xFFFF8A7A);
|
||||
GoldGlow = C(0x55E6C766), NameText = C(0xFFF2E8DC), AttackerText = C(0xFFFF8A7A),
|
||||
BadgeBack = C(0xD0101820), Leader = C(0x60FFFFFF),
|
||||
HoverEdge = C(0xC0FFFFFF), UnknownFill = C(0xFF5E8A6A);
|
||||
// Also the debuff icon row's (DebuffIconRow): outlines, stack digits, "+N".
|
||||
internal static readonly uint Outline = C(0xE6000000), HpText = C(0xFFFFFFFF), DimText = C(0xFFB8C4D0);
|
||||
private static uint BadgeEdge => RynthTheme.Border;
|
||||
private static readonly Vector3 HpHigh = new(0x3F, 0xD0, 0x6A), HpMid = new(0xE8, 0xB3, 0x33), HpLow = new(0xE0, 0x4A, 0x4A);
|
||||
|
||||
// Element colours, shared by the "weak to" pill and the vulnerability icons.
|
||||
private static readonly uint ElemSlash = C(0xFFC9D1DB), ElemPierce = C(0xFFD9C19A), ElemBludgeon = C(0xFFB59A7E),
|
||||
// Element colours, shared by the "weak to" pill and the vulnerability icons (DebuffIconRow's tints).
|
||||
internal static readonly uint ElemSlash = C(0xFFC9D1DB), ElemPierce = C(0xFFD9C19A), ElemBludgeon = C(0xFFB59A7E),
|
||||
ElemFire = C(0xFFFF7A3D), ElemCold = C(0xFF7FD3FF), ElemLightning = C(0xFFC89BFF), ElemAcid = C(0xFF8FE36A);
|
||||
|
||||
// One glyph and tint per DebuffKind (index = kind).
|
||||
private static readonly string[] KindGlyph =
|
||||
{
|
||||
PhosphorIcons.Fire, PhosphorIcons.Snowflake, PhosphorIcons.Lightning, PhosphorIcons.Flask,
|
||||
PhosphorIcons.Sword, PhosphorIcons.Knife, PhosphorIcons.Hammer,
|
||||
PhosphorIcons.ShieldSlash, PhosphorIcons.MagicWand, PhosphorIcons.ShieldWarning,
|
||||
PhosphorIcons.ArrowFatLinesDown, PhosphorIcons.HeartBreak, PhosphorIcons.Footprints,
|
||||
PhosphorIcons.TrendDown, PhosphorIcons.Skull, PhosphorIcons.ArrowFatDown,
|
||||
};
|
||||
private static readonly uint[] KindTint =
|
||||
{
|
||||
ElemFire, ElemCold, ElemLightning, ElemAcid, ElemSlash, ElemPierce, ElemBludgeon,
|
||||
C(0xFF9FB4C8), // Imperil: steel
|
||||
C(0xFFB98CFF), // Magic Yield: violet
|
||||
C(0xFFFFB347), // melee / missile defense: orange
|
||||
C(0xFFF2D24B), // attributes: yellow
|
||||
C(0xFFFF6B8A), // vitals / regen: pink-red
|
||||
C(0xFFA8C66C), // movement: moss
|
||||
C(0xFF8FB8DE), // skills: blue-grey
|
||||
C(0xFF7CE08A), // damage over time: green
|
||||
C(0xFFC8C8C8), // other
|
||||
};
|
||||
private static readonly string[] StackDigits = { "", "", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||
// The debuff icons' glyphs, tints and painter are in DebuffIconRow (shared with your own plate).
|
||||
|
||||
internal static uint C(uint argb) => RynthTheme.Argb(argb);
|
||||
|
||||
|
|
@ -160,8 +138,8 @@ internal static class MonsterHud
|
|||
public float LastX, LastY, LastZ;
|
||||
|
||||
// Debuff icons (this frame)
|
||||
public readonly DebuffIcon[] Icons = new DebuffIcon[MaxIcons];
|
||||
public int IconCount; // may exceed MaxIcons (overflow)
|
||||
public readonly DebuffIcon[] Icons = new DebuffIcon[DebuffIconRow.MaxIcons];
|
||||
public int IconCount; // may exceed DebuffIconRow.MaxIcons (overflow)
|
||||
public bool Others; // "debuffed by others" marker
|
||||
|
||||
// Layout (this frame)
|
||||
|
|
@ -290,6 +268,8 @@ internal static class MonsterHud
|
|||
if (!track) ClearPlates();
|
||||
SetDamageSubscription(monsters && MonsterHudSettings.ShowWeakness);
|
||||
if (monsters && MonsterHudSettings.ShowDebuffs) PortalSpellTable.EnsureLoadQueued();
|
||||
// Your own plate's "Debuffs on you" row reads it too, plates on or off.
|
||||
if (MonsterHudSettings.SelfPlate && MonsterHudSettings.SelfDebuffs) PortalSpellTable.EnsureLoadQueued();
|
||||
|
||||
long now = Stopwatch.GetTimestamp();
|
||||
if (now >= _nextSnapshotTicks)
|
||||
|
|
@ -1310,7 +1290,8 @@ internal static class MonsterHud
|
|||
|
||||
// Under the bar: the debuff icons.
|
||||
if (icons)
|
||||
PaintIcons(dl, p, cx, iconTop, k, a, now);
|
||||
DebuffIconRow.Paint(dl, p.Icons, p.IconCount, p.Others, p.IconSize, p.SmallFont, p.SmallSize,
|
||||
ref p.OverflowKey, ref p.OverflowString, cx, iconTop, k, a, now);
|
||||
|
||||
// ── Name line: [level badge] Name ──
|
||||
if (p.NameW > 0 || p.BadgeW > 0)
|
||||
|
|
@ -1394,13 +1375,18 @@ internal static class MonsterHud
|
|||
/// <summary>
|
||||
/// A bar: black edge, dark track, the chip (what the last drop took), the
|
||||
/// gradient fill with a shine line, and optional quarter ticks. Shared with
|
||||
/// the player plate.
|
||||
/// the player plate, whose options can leave out the edge and track
|
||||
/// (<paramref name="track"/>) and the chip (<paramref name="chip"/>);
|
||||
/// monster plates always draw both.
|
||||
/// </summary>
|
||||
internal static void PaintBar(ImDrawListPtr dl, Vector2 b0, Vector2 b1, float round, float a,
|
||||
float shownRatio, float trailRatio, uint baseCol, bool ticks)
|
||||
float shownRatio, float trailRatio, uint baseCol, bool ticks, bool track = true, bool chip = true)
|
||||
{
|
||||
dl.AddRectFilled(b0 - Vector2.One, b1 + Vector2.One, Mul(BarEdge, a * 0.9f), round + 1);
|
||||
dl.AddRectFilled(b0, b1, Mul(BarBack, a), round);
|
||||
if (track)
|
||||
{
|
||||
dl.AddRectFilled(b0 - Vector2.One, b1 + Vector2.One, Mul(BarEdge, a * 0.9f), round + 1);
|
||||
dl.AddRectFilled(b0, b1, Mul(BarBack, a), round);
|
||||
}
|
||||
|
||||
float innerW = b1.X - b0.X - 2f;
|
||||
var i0 = new Vector2(b0.X + 1, b0.Y + 1);
|
||||
|
|
@ -1409,7 +1395,7 @@ internal static class MonsterHud
|
|||
float shown = Math.Clamp(shownRatio, 0f, 1f);
|
||||
float trail = Math.Clamp(trailRatio, 0f, 1f);
|
||||
|
||||
if (trail > shown + 0.002f)
|
||||
if (chip && trail > shown + 0.002f)
|
||||
dl.AddRectFilled(new Vector2(i0.X + innerW * shown, i0.Y), new Vector2(i0.X + innerW * trail, innerBottom), Mul(Trail, a * 0.85f));
|
||||
|
||||
if (shown > 0.001f)
|
||||
|
|
@ -1428,84 +1414,6 @@ internal static class MonsterHud
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The debuff row, centred under the bar: one icon per kind with a shrinking
|
||||
/// countdown line, blinking in its last seconds; "+N" when more than fit;
|
||||
/// then the "debuffed by others" marker.
|
||||
/// </summary>
|
||||
private static void PaintIcons(ImDrawListPtr dl, Plate p, float cx, float top, float k, float a, long now)
|
||||
{
|
||||
float sz = p.IconSize;
|
||||
float gap = MathF.Max(2f, MathF.Round(2f * k));
|
||||
int count = p.IconCount;
|
||||
int shown = count > MaxIcons ? MaxIcons - 1 : count;
|
||||
int overflow = count - shown;
|
||||
string more = "";
|
||||
float moreW = 0f;
|
||||
if (overflow > 0)
|
||||
{
|
||||
if (overflow != p.OverflowKey)
|
||||
{
|
||||
p.OverflowKey = overflow;
|
||||
p.OverflowString = "+" + overflow.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
more = p.OverflowString;
|
||||
moreW = TextWidth(p.SmallFont, p.SmallSize, more) + 4f * k;
|
||||
}
|
||||
int slots = shown + (p.Others ? 1 : 0);
|
||||
float rowW = slots * sz + Math.Max(0, slots - 1) * gap + (overflow > 0 ? gap + moreW : 0f);
|
||||
float x = MathF.Round(cx - rowW * 0.5f);
|
||||
float glyphPx = MathF.Round(sz * 0.8f);
|
||||
ImFontPtr iconFont = ImGuiFonts.Sharp(glyphPx, bold: false); // the icons are merged into every bake
|
||||
float lineH = MathF.Max(1f, MathF.Round(1.5f * k));
|
||||
|
||||
for (int i = 0; i < shown; i++)
|
||||
{
|
||||
DebuffIcon ic = p.Icons[i];
|
||||
int kind = (int)ic.Kind;
|
||||
uint tint = kind < KindTint.Length ? KindTint[kind] : KindTint[^1];
|
||||
float remaining = (ic.Expiry - now) / (float)Stopwatch.Frequency;
|
||||
float frac = ic.Duration > 0 ? Math.Clamp(remaining / ic.Duration, 0f, 1f) : 0f;
|
||||
float blink = remaining < BlinkSec ? 0.45f + 0.55f * MathF.Abs(MathF.Cos(remaining * MathF.PI * 2f)) : 1f;
|
||||
|
||||
var i0 = new Vector2(x, top);
|
||||
var i1 = i0 + new Vector2(sz, sz);
|
||||
dl.AddRectFilled(i0, i1, Mul(IconBack, a), 2f * k);
|
||||
dl.AddRect(i0, i1, Mul(tint, a * 0.55f * blink), 2f * k, ImDrawFlags.None, 1f);
|
||||
PhosphorIcons.DrawCentered(dl, iconFont, glyphPx, KindGlyph[kind < KindGlyph.Length ? kind : KindGlyph.Length - 1],
|
||||
i0, new Vector2(sz, sz), Mul(tint, a * blink));
|
||||
if (ic.Stack > 1 && ic.Stack < StackDigits.Length)
|
||||
{
|
||||
string digit = StackDigits[ic.Stack];
|
||||
float ds = MathF.Round(p.SmallSize * 0.85f);
|
||||
var dp = new Vector2(i1.X - TextWidth(p.SmallFont, ds, digit) + 1f, i0.Y - 2f);
|
||||
OutlinedText(dl, p.SmallFont, ds, dp, a, digit);
|
||||
dl.AddText(p.SmallFont, ds, dp, Mul(HpText, a), digit);
|
||||
}
|
||||
// Countdown: a line under the icon that shrinks to nothing at expiry.
|
||||
float ly = i1.Y + 1f;
|
||||
dl.AddRectFilled(new Vector2(i0.X, ly), new Vector2(i1.X, ly + lineH), Mul(Outline, a * 0.8f));
|
||||
if (frac > 0f)
|
||||
dl.AddRectFilled(new Vector2(i0.X, ly), new Vector2(i0.X + MathF.Max(1f, sz * frac), ly + lineH), Mul(tint, a * blink));
|
||||
x += sz + gap;
|
||||
}
|
||||
|
||||
if (overflow > 0)
|
||||
{
|
||||
var mp = new Vector2(x, MathF.Round(top + (sz - p.SmallSize) * 0.5f));
|
||||
OutlinedText(dl, p.SmallFont, p.SmallSize, mp, a, more);
|
||||
dl.AddText(p.SmallFont, p.SmallSize, mp, Mul(DimText, a), more);
|
||||
x += moreW + gap;
|
||||
}
|
||||
|
||||
if (p.Others)
|
||||
{
|
||||
var i0 = new Vector2(x, top);
|
||||
dl.AddRectFilled(i0, i0 + new Vector2(sz, sz), Mul(IconBack, a * 0.8f), 2f * k);
|
||||
PhosphorIcons.DrawCentered(dl, iconFont, glyphPx, PhosphorIcons.UsersThree, i0, new Vector2(sz, sz), Mul(OthersTint, a * 0.8f));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>A soft 1 px outline under text (the text itself is drawn by the caller).</summary>
|
||||
internal static void OutlinedText(ImDrawListPtr dl, ImFontPtr font, float size, Vector2 pos, float a, string text)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -79,6 +79,18 @@ internal static class MonsterHudSettings
|
|||
public static float SelfFixedX = DefaultSelfFixedX, SelfFixedY = DefaultSelfFixedY;
|
||||
/// <summary>Just under a third-person character, clear of the chat in the bottom-left corner.</summary>
|
||||
public const float DefaultSelfFixedX = 0.5f, DefaultSelfFixedY = 0.68f;
|
||||
// Your plate's look (2026-10-27), each piece on its own; all on = the look before they existed.
|
||||
// Your plate only: the monster plates share the bar painter but always draw all of it.
|
||||
/// <summary>The dark track and 1 px black edge behind each of your bars.</summary>
|
||||
public static bool SelfBarTrack = true;
|
||||
/// <summary>The pale gold "chip" that shows what a drop took, then drains.</summary>
|
||||
public static bool SelfBarChip = true;
|
||||
/// <summary>The black outline around your plate's text (numbers, name).</summary>
|
||||
public static bool SelfTextOutline = true;
|
||||
/// <summary>The dark band behind the "cur / max" numbers.</summary>
|
||||
public static bool SelfNumberBand = true;
|
||||
/// <summary>"Debuffs on you": icons for harmful spells on you under your mana bar (only while you have one).</summary>
|
||||
public static bool SelfDebuffs = true;
|
||||
|
||||
// Combat text (CombatText): floating numbers and the kill burst.
|
||||
public static bool Numbers = true;
|
||||
|
|
@ -209,6 +221,11 @@ internal static class MonsterHudSettings
|
|||
case "selfLocked": SelfLocked = val == "1"; break;
|
||||
case "selfFixedX": if (TryF(val, out float fx)) SelfFixedX = Math.Clamp(fx, 0f, 1f); break;
|
||||
case "selfFixedY": if (TryF(val, out float fy)) SelfFixedY = Math.Clamp(fy, 0f, 1f); break;
|
||||
case "selfBarTrack": SelfBarTrack = val == "1"; break;
|
||||
case "selfBarChip": SelfBarChip = val == "1"; break;
|
||||
case "selfTextOutline": SelfTextOutline = val == "1"; break;
|
||||
case "selfNumberBand": SelfNumberBand = val == "1"; break;
|
||||
case "selfDebuffs": SelfDebuffs = val == "1"; break;
|
||||
case "numbers": Numbers = val == "1"; break;
|
||||
case "numDealt": NumDealt = val == "1"; break;
|
||||
case "numTaken": NumTaken = val == "1"; break;
|
||||
|
|
@ -291,6 +308,11 @@ internal static class MonsterHudSettings
|
|||
sw.WriteLine($"selfLocked={B(SelfLocked)}");
|
||||
sw.WriteLine(FormattableString.Invariant($"selfFixedX={SelfFixedX:0.####}"));
|
||||
sw.WriteLine(FormattableString.Invariant($"selfFixedY={SelfFixedY:0.####}"));
|
||||
sw.WriteLine($"selfBarTrack={B(SelfBarTrack)}");
|
||||
sw.WriteLine($"selfBarChip={B(SelfBarChip)}");
|
||||
sw.WriteLine($"selfTextOutline={B(SelfTextOutline)}");
|
||||
sw.WriteLine($"selfNumberBand={B(SelfNumberBand)}");
|
||||
sw.WriteLine($"selfDebuffs={B(SelfDebuffs)}");
|
||||
sw.WriteLine($"numbers={B(Numbers)}");
|
||||
sw.WriteLine($"numDealt={B(NumDealt)}");
|
||||
sw.WriteLine($"numTaken={B(NumTaken)}");
|
||||
|
|
@ -329,6 +351,7 @@ internal static class MonsterHudSettings
|
|||
NpcNames = true; NpcMaxDistance = 30f; MaxNpcLabels = 15; PlayerNames = false; PlayerBars = false;
|
||||
SelfPlate = true; SelfNumbers = false; SelfName = false; SelfHideFirstPerson = true;
|
||||
SelfPlacement = SelfPlacement.Fixed; SelfLocked = true; SelfFixedX = DefaultSelfFixedX; SelfFixedY = DefaultSelfFixedY;
|
||||
SelfBarTrack = true; SelfBarChip = true; SelfTextOutline = true; SelfNumberBand = true; SelfDebuffs = true;
|
||||
Numbers = true; NumDealt = true; NumTaken = true; NumHeals = true; NumKills = true;
|
||||
NumSize = 1.0f; NumTime = 1.0f; NumRestores = true; KeepOnScreen = true;
|
||||
GainSize = 1.0f; GainTime = 1.0f; SelfPosition = SelfPlatePosition.Above;
|
||||
|
|
@ -359,6 +382,22 @@ internal static class MonsterHudSettings
|
|||
Save();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Locks or unlocks your plate (not saved: the caller saves). Only a plate fixed on screen can be
|
||||
/// dragged, so unlocking one that follows your character fixes it on screen first, at its saved
|
||||
/// spot. True when that switch happened. Render / chat thread.
|
||||
/// </summary>
|
||||
public static bool SetSelfLocked(bool locked)
|
||||
{
|
||||
SelfLocked = locked;
|
||||
if (locked || SelfPlacement == SelfPlacement.Fixed) return false;
|
||||
SelfPlacement = SelfPlacement.Fixed;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>Your plate can be dragged right now: fixed on screen and unlocked.</summary>
|
||||
public static bool SelfMovable => SelfPlacement == SelfPlacement.Fixed && !SelfLocked;
|
||||
|
||||
/// <summary>Every master switch at once ("/rv plates all on|off").</summary>
|
||||
public static void SetAll(bool on)
|
||||
{
|
||||
|
|
@ -374,7 +413,9 @@ internal static class MonsterHudSettings
|
|||
$"distance {OnOff(ShowDistance)}, fade {OnOff(FadeWithDistance)}, click to select {OnOff(ClickToSelect)}), debuffs {OnOff(ShowDebuffs)} (others {OnOff(ShowOthersDebuff)}); " +
|
||||
$"NPC names {OnOff(NpcNames)} ({NpcMaxDistance:0}yd, max {MaxNpcLabels}), player names {OnOff(PlayerNames)} (bars {OnOff(PlayerBars)}); " +
|
||||
$"self {OnOff(SelfPlate)} ({(SelfPlacement == SelfPlacement.Fixed ? "fixed on screen, " + (SelfLocked ? "locked" : "unlocked") : "follows you, " + SelfPosition.ToString().ToLowerInvariant())}, " +
|
||||
$"numbers {OnOff(SelfNumbers)}, name {OnOff(SelfName)}, hide in first person {OnOff(SelfHideFirstPerson)}); " +
|
||||
$"numbers {OnOff(SelfNumbers)}, name {OnOff(SelfName)}, hide in first person {OnOff(SelfHideFirstPerson)}, " +
|
||||
$"debuffs on you {OnOff(SelfDebuffs)}, track {OnOff(SelfBarTrack)}, damage trail {OnOff(SelfBarChip)}, " +
|
||||
$"text outline {OnOff(SelfTextOutline)}, number band {OnOff(SelfNumberBand)}); " +
|
||||
$"combat text {OnOff(Numbers)} (dealt {OnOff(NumDealt)}, taken {OnOff(NumTaken)}, heals {OnOff(NumHeals)}, kills {OnOff(NumKills)}); " +
|
||||
$"gains {OnOff(Gains)} (xp {OnOff(GainXp)}, lum {OnOff(GainLum)}, radiance {OnOff(GainRadiance)}); " +
|
||||
$"sizes: monster bar {MonsterBarWidth:0.##}x{MonsterBarHeight:0.##} text {MonsterTextSize:0.##}, " +
|
||||
|
|
|
|||
|
|
@ -111,12 +111,25 @@ internal static class MonsterHudSettingsUi
|
|||
"Your own health, stamina and mana bars: fixed on screen, or following your character. Chat: /rv plates self.");
|
||||
changed |= Toggle("Numbers on your bars", ref MonsterHudSettings.SelfNumbers, "\"cur / max\" inside each bar (taller bars).", sub: true);
|
||||
changed |= Toggle("Your name", ref MonsterHudSettings.SelfName, null, sub: true);
|
||||
changed |= Toggle("Debuffs on you", ref MonsterHudSettings.SelfDebuffs,
|
||||
"Icons under your mana bar for harmful spells on you (vulnerabilities, Imperil, Magic Yield, attribute and skill debuffs...), " +
|
||||
"the monster plates' icons: one per kind, a line that runs out with the spell, blinking in its last 5 seconds, \"+N\" when more than fit. " +
|
||||
"Only shows while you have one.", sub: true);
|
||||
changed |= SizeSlider("Your bar width", ref MonsterHudSettings.SelfBarWidth, MonsterHudSettings.MinBarWidth, MonsterHudSettings.MaxBarWidth, w,
|
||||
"How wide your health, stamina and mana bars are (1.00x = the default).");
|
||||
changed |= SizeSlider("Your bar height", ref MonsterHudSettings.SelfBarHeight, MonsterHudSettings.MinBarHeight, MonsterHudSettings.MaxBarHeight, w,
|
||||
"How tall (thick) each of your bars is (1.00x = the default). The numbers need a bar at least 8 px tall.");
|
||||
changed |= SizeSlider("Your text size", ref MonsterHudSettings.SelfTextSize, MonsterHudSettings.MinTextSize, MonsterHudSettings.MaxTextSize, w,
|
||||
"Your plate's text: the cur / max numbers and your name (1.00x = the default).");
|
||||
// The plate's shading, piece by piece (your plate only; the monster plates keep theirs).
|
||||
changed |= Toggle("Dark track behind the bars", ref MonsterHudSettings.SelfBarTrack,
|
||||
"The dark background and thin black edge behind each of your bars. Off: only the coloured fill shows.", sub: true);
|
||||
changed |= Toggle("Damage trail", ref MonsterHudSettings.SelfBarChip,
|
||||
"The pale gold strip that shows what a drop just took, then drains away.", sub: true);
|
||||
changed |= Toggle("Text outline", ref MonsterHudSettings.SelfTextOutline,
|
||||
"The thin black outline around your numbers and your name.", sub: true);
|
||||
changed |= Toggle("Band behind the numbers", ref MonsterHudSettings.SelfNumberBand,
|
||||
"The dark band behind the cur / max numbers (with Numbers on your bars).", sub: true);
|
||||
|
||||
bool fixedOn = MonsterHudSettings.SelfPlacement == SelfPlacement.Fixed;
|
||||
if (Toggle("Fixed on screen", ref fixedOn,
|
||||
|
|
@ -132,9 +145,10 @@ internal static class MonsterHudSettingsUi
|
|||
bool locked = MonsterHudSettings.SelfLocked;
|
||||
if (Toggle("Lock position", ref locked,
|
||||
"Locked, the plate can't be grabbed or clicked, so play never moves it. " +
|
||||
"Untick it, then drag the plate (it shows a frame) and tick it again. Chat: /rv plates self lock on|off.", indent: 32))
|
||||
"Untick it, then drag the plate (it shows a frame) and tick it again. Also in Settings > UI > Vitals. " +
|
||||
"Chat: /rv plates self lock on|off.", indent: 32))
|
||||
{
|
||||
MonsterHudSettings.SelfLocked = locked;
|
||||
MonsterHudSettings.SetSelfLocked(locked);
|
||||
changed = true;
|
||||
}
|
||||
if (unlocked)
|
||||
|
|
|
|||
|
|
@ -44,21 +44,7 @@ using RynthCore.Engine.Compatibility;
|
|||
|
||||
namespace RynthCore.Engine.ImGuiBackend.Hud;
|
||||
|
||||
/// <summary>What an icon on the plate stands for (one icon per kind).</summary>
|
||||
internal enum DebuffKind : byte
|
||||
{
|
||||
VulnFire, VulnCold, VulnLightning, VulnAcid, VulnSlash, VulnPierce, VulnBludgeon,
|
||||
Imperil, MagicYield, Defense, Attributes, Vitals, Movement, Skills, Dot, Other,
|
||||
}
|
||||
|
||||
/// <summary>One icon: the kind, when its soonest entry expires, that entry's full length, and how many categories it merges.</summary>
|
||||
internal struct DebuffIcon
|
||||
{
|
||||
public DebuffKind Kind;
|
||||
public long Expiry; // Stopwatch ticks
|
||||
public float Duration; // seconds, of the entry expiring first
|
||||
public int Stack;
|
||||
}
|
||||
// DebuffKind and DebuffIcon (what an icon stands for) are in DebuffIcon.cs, shared with your own plate's row.
|
||||
|
||||
internal static class PlateDebuffs
|
||||
{
|
||||
|
|
|
|||
|
|
@ -29,10 +29,25 @@
|
|||
// (setting; on by default). The head point is published either way, for the
|
||||
// gain text.
|
||||
//
|
||||
// Look (2026-10-27, each its own setting, all on by default = the old look):
|
||||
// the dark track + black edge behind each bar, the damage chip, the text
|
||||
// outline and the dark band behind the numbers. Your plate only.
|
||||
//
|
||||
// "Debuffs on you" (2026-10-27, setting, on by default): the monster plates'
|
||||
// icon row (DebuffIconRow) under your mana bar, for harmful spells on you,
|
||||
// only while there is one. Data: the engine's player enchantment snapshot
|
||||
// (EnchantmentHooks.CopyPlayerStatMods: the main thread refreshes it every
|
||||
// 250 ms; here a lock and an array copy, four times a second, as the Buffs
|
||||
// tab reads it), picked by SelfDebuffs.Select with the spell table
|
||||
// (PortalSpellTable, queued by MonsterHud.Update while the row is on). The
|
||||
// row hangs under the bars: placement keeps the bars where they are and
|
||||
// only the clamp and the drag area grow to cover it.
|
||||
//
|
||||
// Render thread only. Engine-owned statics.
|
||||
// ============================================================================
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Numerics;
|
||||
using ImGuiNET;
|
||||
|
|
@ -63,6 +78,19 @@ internal static class PlayerPlate
|
|||
private static BarState _hp, _st, _mn;
|
||||
private static float _alpha;
|
||||
|
||||
// "Debuffs on you": the snapshot copy (preallocated, read 4x a second) and this read's icons.
|
||||
private const int MaxEnch = SelfDebuffs.MaxEntries;
|
||||
private const int DebuffReadMs = 250;
|
||||
private static readonly uint[] _eIds = new uint[MaxEnch], _eTypes = new uint[MaxEnch], _eKeys = new uint[MaxEnch], _eCats = new uint[MaxEnch];
|
||||
private static readonly double[] _eExp = new double[MaxEnch];
|
||||
private static readonly float[] _eVals = new float[MaxEnch];
|
||||
private static readonly DebuffIcon[] _icons = new DebuffIcon[DebuffIconRow.MaxIcons];
|
||||
private static int _iconCount;
|
||||
private static long _nextDebuffRead; // Environment.TickCount64
|
||||
private static int _overflowKey = -1;
|
||||
private static string _overflowText = "";
|
||||
private static readonly HarmfulSpellLookup Harmful = LookupHarmful;
|
||||
|
||||
// Fixed mode: dragging (unlocked only).
|
||||
private static bool _hover, _dragging, _wantsMouse;
|
||||
private static Vector2 _grab; // cursor minus the bars' centre when the drag began
|
||||
|
|
@ -85,6 +113,8 @@ internal static class PlayerPlate
|
|||
{
|
||||
_hp = default; _st = default; _mn = default;
|
||||
_alpha = 0f;
|
||||
_iconCount = 0;
|
||||
_nextDebuffRead = 0;
|
||||
HeadOnScreen = false;
|
||||
FirstPerson = false;
|
||||
DropDrag();
|
||||
|
|
@ -115,15 +145,16 @@ internal static class PlayerPlate
|
|||
PlayerVitalsHooks.TryGetSnapshot(out _);
|
||||
if (!Advance(ref f, show)) return;
|
||||
Layout l = Measure(f.UiScale);
|
||||
float k = l.K, barW = l.BarW, blockH = l.BlockH, nameH = l.NameH;
|
||||
float k = l.K, barW = l.BarW, blockH = l.BlockH, nameH = l.NameH, iconsH = l.IconsH;
|
||||
|
||||
// Where the block goes: above the head (default), under the feet, or beside the character.
|
||||
float left, y;
|
||||
SelfPlatePosition where = MonsterHudSettings.SelfPosition;
|
||||
if (where == SelfPlatePosition.Above)
|
||||
{
|
||||
// The debuff row (when there is one) sits between the bars and the head.
|
||||
left = head.X - barW * 0.5f;
|
||||
y = head.Y - 4f * k - blockH;
|
||||
y = head.Y - 4f * k - blockH - iconsH;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -151,9 +182,9 @@ internal static class PlayerPlate
|
|||
if (MonsterHudSettings.KeepOnScreen)
|
||||
{
|
||||
left = Math.Clamp(left, 4f, MathF.Max(4f, f.Display.X - barW - 4f));
|
||||
y = Math.Clamp(y, 4f + nameH, MathF.Max(4f + nameH, f.Display.Y - blockH - 4f));
|
||||
y = Math.Clamp(y, 4f + nameH, MathF.Max(4f + nameH, f.Display.Y - blockH - iconsH - 4f));
|
||||
}
|
||||
float top = Paint(f.Dl, ref l, MathF.Round(left), MathF.Round(y));
|
||||
float top = Paint(f.Dl, ref l, MathF.Round(left), MathF.Round(y), f.Now);
|
||||
// Gain text floats above the plate when it's over the head, else above the head itself.
|
||||
PlateTop = where == SelfPlatePosition.Above ? top : head.Y;
|
||||
}
|
||||
|
|
@ -189,8 +220,10 @@ internal static class PlayerPlate
|
|||
MonsterHudSettings.Save();
|
||||
}
|
||||
}
|
||||
// The saved spot is the bars' centre (a debuff row coming and going never moves them); the
|
||||
// clamp keeps the row under them on screen too.
|
||||
float left = Math.Clamp(cx - l.BarW * 0.5f, 4f, MathF.Max(4f, display.X - l.BarW - 4f));
|
||||
float y = Math.Clamp(cy - l.BlockH * 0.5f, 4f + l.NameH, MathF.Max(4f + l.NameH, display.Y - l.BlockH - 4f));
|
||||
float y = Math.Clamp(cy - l.BlockH * 0.5f, 4f + l.NameH, MathF.Max(4f + l.NameH, display.Y - l.BlockH - l.IconsH - 4f));
|
||||
left = MathF.Round(left);
|
||||
y = MathF.Round(y);
|
||||
if (_dragging && display.X > 1 && display.Y > 1)
|
||||
|
|
@ -200,10 +233,10 @@ internal static class PlayerPlate
|
|||
MonsterHudSettings.SelfFixedY = Math.Clamp((y + l.BlockH * 0.5f) / display.Y, 0f, 1f);
|
||||
}
|
||||
|
||||
// The plate's rect (name included), a little padded: the drag surface.
|
||||
// The plate's rect (name and debuff row included), a little padded: the drag surface.
|
||||
float pad = MathF.Round(4f * l.K);
|
||||
var r0 = new Vector2(left - pad, y - l.NameH - pad);
|
||||
var r1 = new Vector2(left + l.BarW + pad, y + l.BlockH + pad);
|
||||
var r1 = new Vector2(left + l.BarW + pad, y + l.BlockH + l.IconsH + pad);
|
||||
Drag(unlocked, r0, r1, new Vector2(left + l.BarW * 0.5f, y + l.BlockH * 0.5f));
|
||||
|
||||
ImDrawListPtr dl = ImGuiNET.ImGui.GetBackgroundDrawList();
|
||||
|
|
@ -215,7 +248,7 @@ internal static class PlayerPlate
|
|||
dl.AddRectFilled(r0, r1, MonsterHud.Mul(hot ? 0x40000000u : 0x28000000u, a), 3f);
|
||||
dl.AddRect(r0, r1, MonsterHud.Mul(hot ? FrameHot : FrameCol, a), 3f, ImDrawFlags.None, hot ? 1.5f : 1f);
|
||||
}
|
||||
Paint(dl, ref l, left, y);
|
||||
Paint(dl, ref l, left, y, f.Now);
|
||||
}
|
||||
|
||||
private static uint FrameCol => RynthTheme.WithAlpha(RynthTheme.Accent, 0xB0);
|
||||
|
|
@ -250,7 +283,7 @@ internal static class PlayerPlate
|
|||
_wantsMouse = _hover || _dragging;
|
||||
}
|
||||
|
||||
private const string DragTip = "Drag to move your plate.\nLock it again in Vision > Nameplates > Your plate (or /rv plates self lock).";
|
||||
private const string DragTip = "Drag to move your plate.\nLock it again in Settings > UI > Vitals or Vision > Nameplates > Your plate (or /rv plates self lock).";
|
||||
|
||||
/// <summary>Fades the plate in / out and steps the bars; false when nothing should be painted.</summary>
|
||||
private static bool Advance(ref MonsterHud.Frame f, bool show)
|
||||
|
|
@ -265,15 +298,49 @@ internal static class PlayerPlate
|
|||
Step(ref _hp, v.Health, v.MaxHealth, f.Now, kBar, f.Dt);
|
||||
Step(ref _st, v.Stamina, v.MaxStamina, f.Now, kBar, f.Dt);
|
||||
Step(ref _mn, v.Mana, v.MaxMana, f.Now, kBar, f.Dt);
|
||||
RefreshDebuffs(f.Now);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>The plate's sizes and fonts this frame.</summary>
|
||||
/// <summary>"Debuffs on you": the snapshot read and the icons picked, four times a second. Render thread.</summary>
|
||||
private static void RefreshDebuffs(long nowTicks)
|
||||
{
|
||||
if (!MonsterHudSettings.SelfDebuffs) { _iconCount = 0; return; }
|
||||
long ms = Environment.TickCount64;
|
||||
if (ms < _nextDebuffRead) return;
|
||||
_nextDebuffRead = ms + DebuffReadMs;
|
||||
if (!PortalSpellTable.Ready) { _iconCount = 0; return; } // MonsterHud.Update queued the load
|
||||
int n = EnchantmentHooks.CopyPlayerStatMods(_eIds, _eExp, _eTypes, _eKeys, _eVals, _eCats);
|
||||
_iconCount = n > 0
|
||||
? SelfDebuffs.Select(_eIds, _eExp, _eCats, n, TimeSyncHooks.GetCurrentServerTime(), nowTicks, Stopwatch.Frequency, Harmful, _icons)
|
||||
: 0;
|
||||
}
|
||||
|
||||
/// <summary>The spell table only holds non-beneficial enchantments: a hit is harmful. Its kind and base length.</summary>
|
||||
private static bool LookupHarmful(uint spellId, out DebuffKind kind, out float duration)
|
||||
{
|
||||
if (PortalSpellTable.TryGetById(spellId, out DebuffSpell s))
|
||||
{
|
||||
kind = PlateDebuffs.KindOf(s);
|
||||
duration = (float)s.Duration;
|
||||
return true;
|
||||
}
|
||||
kind = DebuffKind.Other;
|
||||
duration = 0f;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>The plate's sizes, fonts and look this frame.</summary>
|
||||
private struct Layout
|
||||
{
|
||||
public float K, BarW, BarH, Gap, Round, BlockH, NameH, SmallSize, NameSize;
|
||||
public bool Numbers;
|
||||
public ImFontPtr Small, NameFont;
|
||||
// Look options (MonsterHudSettings.SelfBarTrack ...), read once per frame.
|
||||
public bool Track, Chip, Outline, Band;
|
||||
// The debuff row under the bars: icon square, its text (stack digit, "+N"), and the room it takes (0 = none).
|
||||
public float IconSize, IconTextSize, IconsH;
|
||||
public ImFontPtr IconText;
|
||||
}
|
||||
|
||||
private static Layout Measure(float uiScale)
|
||||
|
|
@ -296,16 +363,31 @@ internal static class PlayerPlate
|
|||
l.NameSize = MathF.Round(ImGuiFonts.Get(UiFont.UiBold11).FontSize * text);
|
||||
l.NameFont = ImGuiFonts.Sharp(l.NameSize, bold: true);
|
||||
l.NameH = MonsterHudSettings.SelfName ? l.NameSize + 3f * k : 0f;
|
||||
l.Track = MonsterHudSettings.SelfBarTrack;
|
||||
l.Chip = MonsterHudSettings.SelfBarChip;
|
||||
l.Outline = MonsterHudSettings.SelfTextOutline;
|
||||
l.Band = MonsterHudSettings.SelfNumberBand;
|
||||
// The debuff row: the monster plates' icon size and small text, only while there is an icon.
|
||||
l.IconSize = MathF.Round(13f * k);
|
||||
l.IconTextSize = MathF.Round(ImGuiFonts.Get(UiFont.Ui9).FontSize * text);
|
||||
l.IconText = ImGuiFonts.Sharp(l.IconTextSize, bold: false);
|
||||
l.IconsH = _iconCount > 0 ? MathF.Round(3f * k) + l.IconSize + 3f : 0f;
|
||||
return l;
|
||||
}
|
||||
|
||||
/// <summary>Paints the three bars (and the name over them) with their top-left at (left, y); returns the plate's top.</summary>
|
||||
private static float Paint(ImDrawListPtr dl, ref Layout l, float left, float y)
|
||||
/// <summary>
|
||||
/// Paints the three bars (and the name over them, the debuff row under them) with the bars' top-left
|
||||
/// at (left, y); returns the plate's top. <paramref name="now"/> is Stopwatch ticks.
|
||||
/// </summary>
|
||||
private static float Paint(ImDrawListPtr dl, ref Layout l, float left, float y, long now)
|
||||
{
|
||||
float a = Math.Clamp(_alpha, 0f, 1f);
|
||||
PaintOne(dl, ref _hp, left, y, l.BarW, l.BarH, l.Round, a, HealthCol, l.Numbers, l.Small, l.SmallSize);
|
||||
PaintOne(dl, ref _st, left, y + l.BarH + l.Gap, l.BarW, l.BarH, l.Round, a, StaminaCol, l.Numbers, l.Small, l.SmallSize);
|
||||
PaintOne(dl, ref _mn, left, y + 2 * (l.BarH + l.Gap), l.BarW, l.BarH, l.Round, a, ManaCol, l.Numbers, l.Small, l.SmallSize);
|
||||
PaintOne(dl, ref _hp, ref l, left, y, a, HealthCol);
|
||||
PaintOne(dl, ref _st, ref l, left, y + l.BarH + l.Gap, a, StaminaCol);
|
||||
PaintOne(dl, ref _mn, ref l, left, y + 2 * (l.BarH + l.Gap), a, ManaCol);
|
||||
if (_iconCount > 0)
|
||||
DebuffIconRow.Paint(dl, _icons, _iconCount, others: false, l.IconSize, l.IconText, l.IconTextSize,
|
||||
ref _overflowKey, ref _overflowText, left + l.BarW * 0.5f, y + l.BlockH + MathF.Round(3f * l.K), l.K, a, now);
|
||||
float top = y - 1f;
|
||||
if (MonsterHudSettings.SelfName)
|
||||
{
|
||||
|
|
@ -314,7 +396,7 @@ internal static class PlayerPlate
|
|||
{
|
||||
float w = MonsterHud.TextWidth(l.NameFont, l.NameSize, name);
|
||||
var pos = new Vector2(MathF.Round(left + (l.BarW - w) * 0.5f), MathF.Round(y - 3f * l.K - l.NameSize));
|
||||
MonsterHud.OutlinedText(dl, l.NameFont, l.NameSize, pos, a, name);
|
||||
if (l.Outline) MonsterHud.OutlinedText(dl, l.NameFont, l.NameSize, pos, a, name);
|
||||
dl.AddText(l.NameFont, l.NameSize, pos, MonsterHud.Mul(NameCol, a), name);
|
||||
top = pos.Y;
|
||||
}
|
||||
|
|
@ -346,13 +428,14 @@ internal static class PlayerPlate
|
|||
MonsterHud.StepBar(ref b.Shown, ref b.Trail, ref b.Hold, ratio, now, kBar, dt);
|
||||
}
|
||||
|
||||
private static void PaintOne(ImDrawListPtr dl, ref BarState b, float left, float top, float w, float h, float round, float a,
|
||||
uint col, bool numbers, ImFontPtr font, float size)
|
||||
private static void PaintOne(ImDrawListPtr dl, ref BarState b, ref Layout l, float left, float top, float a, uint col)
|
||||
{
|
||||
float w = l.BarW, h = l.BarH, size = l.SmallSize;
|
||||
ImFontPtr font = l.Small;
|
||||
var b0 = new Vector2(left, top);
|
||||
var b1 = new Vector2(left + w, top + h);
|
||||
MonsterHud.PaintBar(dl, b0, b1, round, a, b.Shown, b.Trail, col, ticks: false);
|
||||
if (!numbers || h < 8f || b.Max == 0) return;
|
||||
MonsterHud.PaintBar(dl, b0, b1, l.Round, a, b.Shown, b.Trail, col, ticks: false, track: l.Track, chip: l.Chip);
|
||||
if (!l.Numbers || h < 8f || b.Max == 0) return;
|
||||
long key = ((long)b.Max << 32) | b.Cur;
|
||||
string? text = b.Text;
|
||||
if (key != b.TextKey || text == null)
|
||||
|
|
@ -362,11 +445,12 @@ internal static class PlayerPlate
|
|||
}
|
||||
float tw = MonsterHud.TextWidth(font, size, text);
|
||||
var pos = new Vector2(MathF.Round(left + (w - tw) * 0.5f), MathF.Round(top + (h - size) * 0.5f));
|
||||
// A dark band behind the text, then an outline, so it reads over bright and dark fills alike.
|
||||
// (Text sized bigger than the bar: the band grows to the text.)
|
||||
dl.AddRectFilled(new Vector2(pos.X - 3f, MathF.Min(top + 1f, pos.Y)), new Vector2(pos.X + tw + 3f, MathF.Max(top + h - 1f, pos.Y + size)),
|
||||
MonsterHud.Mul(0x70000000u, a), 2f);
|
||||
MonsterHud.OutlinedText(dl, font, size, pos, a, text);
|
||||
// A dark band behind the text, then an outline, so it reads over bright and dark fills alike
|
||||
// (each can be turned off). Text sized bigger than the bar: the band grows to the text.
|
||||
if (l.Band)
|
||||
dl.AddRectFilled(new Vector2(pos.X - 3f, MathF.Min(top + 1f, pos.Y)), new Vector2(pos.X + tw + 3f, MathF.Max(top + h - 1f, pos.Y + size)),
|
||||
MonsterHud.Mul(0x70000000u, a), 2f);
|
||||
if (l.Outline) MonsterHud.OutlinedText(dl, font, size, pos, a, text);
|
||||
dl.AddText(font, size, pos, MonsterHud.Mul(NumCol, a), text);
|
||||
}
|
||||
|
||||
|
|
@ -388,5 +472,8 @@ internal static class PlayerPlate
|
|||
$"Self plate {(MonsterHudSettings.SelfPlate ? "on" : "off")}" +
|
||||
(MonsterHudSettings.SelfPlacement == SelfPlacement.Fixed
|
||||
? (MonsterHudSettings.SelfLocked ? ", fixed on screen (locked)." : ", fixed on screen (unlocked: drag it).")
|
||||
: FirstPerson ? ", follows you (first person" + (MonsterHudSettings.SelfHideFirstPerson ? ", hidden)." : ").") : ", follows you.");
|
||||
: FirstPerson ? ", follows you (first person" + (MonsterHudSettings.SelfHideFirstPerson ? ", hidden)." : ").") : ", follows you.") +
|
||||
(MonsterHudSettings.SelfDebuffs
|
||||
? $" Debuffs on you: {_iconCount} icon(s){(PortalSpellTable.Ready ? "" : " (spell table not loaded)")}."
|
||||
: "");
|
||||
}
|
||||
|
|
|
|||
119
src/RynthCore.Engine/ImGui/MonsterHud/SelfDebuffs.cs
Normal file
119
src/RynthCore.Engine/ImGui/MonsterHud/SelfDebuffs.cs
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
// ============================================================================
|
||||
// RynthCore.Engine - ImGui/MonsterHud/SelfDebuffs.cs
|
||||
// "Debuffs on you" (2026-10-27): which harmful spells on the player get an
|
||||
// icon in the row under your plate's mana bar. A pure function over the
|
||||
// engine's player enchantment snapshot (EnchantmentHooks.CopyPlayerStatMods:
|
||||
// spell id, expiry in server seconds, spell category); PlayerPlate reads the
|
||||
// snapshot four times a second and hands it in with the server time and a
|
||||
// lookup (PortalSpellTable.TryGetById, which only holds non-beneficial
|
||||
// enchantments, so a hit means harmful; PlateDebuffs.KindOf gives the icon).
|
||||
//
|
||||
// Rules, the monster row's where they apply:
|
||||
// - only harmful spells; cooldowns (ids 0x8000+) and buffs never show;
|
||||
// - an entry already past its expiry is dropped, and so is one that never
|
||||
// ends (vitae, spells from items: a state, not a fight debuff; the Buffs
|
||||
// tab still lists them);
|
||||
// - one entry per spell category: AC runs the strongest of a category and
|
||||
// the rest wait under it, so the category lasts until its last entry ends;
|
||||
// - one icon per kind (DebuffKind); a kind merging several categories shows
|
||||
// their count and the soonest end, like the monster row;
|
||||
// - icons in kind order (the monster row's), as many as fit in dst; the
|
||||
// count returned includes the rest (the "+N").
|
||||
// No engine dependencies beyond DebuffIcon.cs (the offline tests compile it).
|
||||
// ============================================================================
|
||||
|
||||
using System;
|
||||
|
||||
namespace RynthCore.Engine.ImGuiBackend.Hud;
|
||||
|
||||
/// <summary>A harmful spell's icon kind and full length (s); false for a spell that isn't harmful.</summary>
|
||||
internal delegate bool HarmfulSpellLookup(uint spellId, out DebuffKind kind, out float duration);
|
||||
|
||||
internal static class SelfDebuffs
|
||||
{
|
||||
/// <summary>Expiries at or past this (server seconds) never end; the snapshot writes double.MaxValue for them.</summary>
|
||||
internal const double NoEnd = 1e12;
|
||||
/// <summary>Snapshot ids from here up are cooldowns, not spells.</summary>
|
||||
internal const uint FirstCooldownId = 0x8000;
|
||||
/// <summary>Snapshot entries looked at (the player rarely carries more than ~100).</summary>
|
||||
internal const int MaxEntries = 256;
|
||||
private const int KindCount = (int)DebuffKind.Other + 1;
|
||||
private const double MaxRemainingSec = 1e6; // keeps the tick conversion far from overflow
|
||||
|
||||
/// <summary>
|
||||
/// Fills <paramref name="dst"/> with the icons for the first <paramref name="n"/> snapshot entries
|
||||
/// (<paramref name="ids"/>, <paramref name="expiry"/> in server seconds, <paramref name="categories"/>)
|
||||
/// at server time <paramref name="serverNow"/>; icon expiries come out in Stopwatch ticks from
|
||||
/// <paramref name="nowTicks"/>. Returns the icon count (may exceed dst.Length: the overflow).
|
||||
/// 0 when the server time isn't known yet.
|
||||
/// </summary>
|
||||
internal static int Select(uint[] ids, double[] expiry, uint[] categories, int n, double serverNow,
|
||||
long nowTicks, long ticksPerSecond, HarmfulSpellLookup harmful, DebuffIcon[] dst)
|
||||
{
|
||||
if (serverNow <= 0 || n <= 0) return 0;
|
||||
n = Math.Min(Math.Min(n, MaxEntries), Math.Min(ids.Length, Math.Min(expiry.Length, categories.Length)));
|
||||
|
||||
// 1. Live harmful entries, one per spell category (the one that ends last).
|
||||
Span<uint> catKey = stackalloc uint[MaxEntries];
|
||||
Span<double> catEnd = stackalloc double[MaxEntries];
|
||||
Span<float> catDur = stackalloc float[MaxEntries];
|
||||
Span<byte> catKind = stackalloc byte[MaxEntries];
|
||||
int cats = 0;
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
uint id = ids[i];
|
||||
if (id == 0 || id >= FirstCooldownId) continue;
|
||||
double end = expiry[i];
|
||||
if (double.IsNaN(end) || end >= NoEnd || end <= serverNow) continue;
|
||||
if (!harmful(id, out DebuffKind kind, out float dur)) continue;
|
||||
// No category recorded: the spell stands alone (ids are below 0x8000, so no clash).
|
||||
uint key = categories[i] != 0 ? categories[i] : 0x80000000u | id;
|
||||
int c = 0;
|
||||
while (c < cats && catKey[c] != key) c++;
|
||||
if (c == cats)
|
||||
{
|
||||
catKey[c] = key;
|
||||
cats++;
|
||||
}
|
||||
else if (end <= catEnd[c])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
catEnd[c] = end;
|
||||
catDur[c] = dur;
|
||||
catKind[c] = (byte)Math.Min((int)kind, KindCount - 1);
|
||||
}
|
||||
if (cats == 0) return 0;
|
||||
|
||||
// 2. One icon per kind: the categories it merges and the soonest end among them.
|
||||
Span<long> kindEnd = stackalloc long[KindCount];
|
||||
Span<float> kindDur = stackalloc float[KindCount];
|
||||
Span<int> kindStack = stackalloc int[KindCount];
|
||||
kindEnd.Clear();
|
||||
kindDur.Clear();
|
||||
kindStack.Clear();
|
||||
for (int c = 0; c < cats; c++)
|
||||
{
|
||||
int k = catKind[c];
|
||||
double remaining = Math.Min(catEnd[c] - serverNow, MaxRemainingSec);
|
||||
long end = nowTicks + (long)(remaining * ticksPerSecond);
|
||||
if (kindStack[k] == 0 || end < kindEnd[k])
|
||||
{
|
||||
kindEnd[k] = end;
|
||||
kindDur[k] = catDur[c];
|
||||
}
|
||||
kindStack[k]++;
|
||||
}
|
||||
|
||||
// 3. In kind order, as many as fit; the count includes the rest.
|
||||
int count = 0;
|
||||
for (int k = 0; k < KindCount; k++)
|
||||
{
|
||||
if (kindStack[k] == 0) continue;
|
||||
if (count < dst.Length)
|
||||
dst[count] = new DebuffIcon { Kind = (DebuffKind)k, Expiry = kindEnd[k], Duration = kindDur[k], Stack = kindStack[k] };
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
|
@ -1267,6 +1267,15 @@ internal sealed class ChatFace : IImGuiPanel
|
|||
/// </summary>
|
||||
private void DrawLineColours()
|
||||
{
|
||||
bool retail = ChatLineColors.RetailColors;
|
||||
if (ImGuiNET.ImGui.Checkbox("Retail colours", ref retail))
|
||||
{
|
||||
ChatLineColors.RetailColors = retail;
|
||||
SaveColours();
|
||||
}
|
||||
SafeImGui.SetItemTooltip("Each kind of line in AC's own colour: magic and spells blue, combat red, tells yellow,\n" +
|
||||
"system purple, allegiance orange. RynthCore's own lines (the Rynth and Items tabs) keep theirs.\n" +
|
||||
"Off: every line takes its tab's colour. A colour you set below still wins.");
|
||||
Label("A rule's colour wins over these.", Mute);
|
||||
ColourGroup("Chat", ChatLineColors.ChatKinds);
|
||||
|
||||
|
|
@ -1320,7 +1329,9 @@ internal sealed class ChatFace : IImGuiPanel
|
|||
ImGuiNET.ImGui.SameLine();
|
||||
Label(kind.Label, RynthTheme.Argb(argb));
|
||||
SafeImGui.SetItemTooltip(kind.Hint + (set ? "" : kind.Key.StartsWith(ChatLineColors.TabPrefix, StringComparison.Ordinal)
|
||||
? "\nThe built-in colour." : $"\nNot set: the {kind.Tab} tab's colour."));
|
||||
? (ChatLineColors.RetailColors ? "\nThe built-in colour, for lines AC has no colour for (Retail colours on)." : "\nThe built-in colour.")
|
||||
: ChatLineColors.RetailColors && ChatLineColors.Get(ChatLineColors.TabPrefix + kind.Tab) == null
|
||||
? "\nNot set: AC's own colour." : $"\nNot set: the {kind.Tab} tab's colour."));
|
||||
if (set)
|
||||
{
|
||||
ImGuiNET.ImGui.SameLine();
|
||||
|
|
|
|||
|
|
@ -627,7 +627,7 @@ internal sealed class ChatFiltersFace : IImGuiPanel
|
|||
if (route.Tabs != null) tabs.AddRange(route.Tabs);
|
||||
where = tabs.Count == 0 ? "Shown nowhere." : "Shows in: " + string.Join(", ", tabs) + ".";
|
||||
}
|
||||
uint color = RynthTheme.Argb(ChatLineColors.Resolve(route.LineArgb, ChatLineColors.KindOf(type, channel, text), channel));
|
||||
uint color = RynthTheme.Argb(ChatLineColors.Resolve(route.LineArgb, ChatLineColors.KindOf(type, channel, text), channel, type));
|
||||
_testResult.Add((where + (route.LineArgb != null ? " (this is its colour)" : ""), route.Hidden ? Faded(Mute) : color));
|
||||
|
||||
// Not hidden: name a standard filter that would hide it (one not in the rules yet).
|
||||
|
|
|
|||
|
|
@ -207,6 +207,7 @@ internal sealed class ClassicMonstersTab : IClassicTab
|
|||
// Debuffs and shapes: three gems a row.
|
||||
float gw = w / 3;
|
||||
y = GemGrid("Debuffs", DamageCommands.DebuffDefs, sel, name, new Vector2(o.X, y), gw);
|
||||
y = GemGrid("Void", DamageCommands.VoidDebuffDefs, sel, name, new Vector2(o.X, y), gw);
|
||||
y = GemGrid("Spells", DamageCommands.ShapeDefs, sel, name, new Vector2(o.X, y), gw);
|
||||
return y;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -478,6 +478,7 @@ internal sealed class DamageDetailFace : IImGuiPanel
|
|||
|
||||
// A name rule has no Damage panel row: its debuffs, off hand and pet are set here.
|
||||
ToggleRow("Debuffs", DamageCommands.DebuffDefs, view, name);
|
||||
ToggleRow("Void", DamageCommands.VoidDebuffDefs, view, name);
|
||||
int off = view.OffhandId;
|
||||
string offText = off >= 0 && off < DamageCommands.OffhandModeNames.Length ? DamageCommands.OffhandModeNames[off] : "Item " + unchecked((uint)off);
|
||||
Combo("Off hand", "##offhand", DamageCommands.OffhandModeNames, offText,
|
||||
|
|
|
|||
|
|
@ -1046,6 +1046,7 @@ internal sealed class DamageFace : IImGuiPanel
|
|||
{
|
||||
var parts = new List<string>();
|
||||
foreach (var (field, label, _) in DamageCommands.DebuffDefs) if (v.GetToggle(field)) parts.Add(label);
|
||||
foreach (var (field, _, tip) in DamageCommands.VoidDebuffDefs) if (v.GetToggle(field)) parts.Add(tip[..tip.IndexOf(':')]);
|
||||
if (!string.IsNullOrEmpty(v.ExVuln) && !v.ExVuln.Equals("None", StringComparison.OrdinalIgnoreCase)) parts.Add("Extra Vuln: " + v.ExVuln);
|
||||
if (!string.IsNullOrWhiteSpace(v.CustomDebuffs)) parts.Add("Yours: " + v.CustomDebuffs);
|
||||
return string.Join("\n", parts);
|
||||
|
|
@ -1099,6 +1100,22 @@ internal sealed class DamageFace : IImGuiPanel
|
|||
SafeImGui.SetItemTooltip(tip);
|
||||
}
|
||||
|
||||
// The Void debuffs, two to a row.
|
||||
ImGuiNET.ImGui.TextColored(RynthTheme.VecOf(RynthTheme.MuteAlt), "Void Magic");
|
||||
for (int i = 0; i < DamageCommands.VoidDebuffDefs.Length; i++)
|
||||
{
|
||||
var (field, label, tip) = DamageCommands.VoidDebuffDefs[i];
|
||||
if (i % 2 == 1) ImGuiNET.ImGui.SameLine(140);
|
||||
bool on = view.GetToggle(field);
|
||||
if (ImGuiNET.ImGui.Checkbox(label + "##db_" + field, ref on))
|
||||
{
|
||||
bool v = on;
|
||||
string f = field;
|
||||
DamageCommands.EditRule(name, rule => rule.SetToggle(f, v));
|
||||
}
|
||||
SafeImGui.SetItemTooltip(tip);
|
||||
}
|
||||
|
||||
ImGuiNET.ImGui.TextColored(RynthTheme.VecOf(RynthTheme.MuteAlt), "Extra Vuln");
|
||||
ImGuiNET.ImGui.SameLine();
|
||||
string ex = string.IsNullOrEmpty(view.ExVuln) ? "None" : view.ExVuln;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,19 @@
|
|||
// here is saved the same way and a pin made here is the same pin. A drawer
|
||||
// that wasn't drawn in a frame drops its hub subscriptions (EndFrame).
|
||||
//
|
||||
// AC thread only (inside RynthAi's window, and EndFrame after the panels).
|
||||
// 2026-10-27: RynthVision draws the whole Vision window itself (it takes over
|
||||
// the engine's VisionFace, "takeOver"), but two of its tabs set things that are
|
||||
// still RynthCore's: the nameplates and the combat text (ImGui/MonsterHud,
|
||||
// MonsterHudSettings) are drawn by the engine until they move to RynthVision.
|
||||
// So RynthVision's window asks for those two tab bodies here, the same rows the
|
||||
// engine's Vision panel shows (MonsterHudSettingsUi), saved the same way:
|
||||
// nameplates the "Nameplates" tab
|
||||
// combattext the "Combat text" tab
|
||||
// They draw popped out too (the engine's Vision panel did); the three drawers
|
||||
// above stay docked-only (UiKit.RenderSettingsDrawer, DrawsPoppedOut).
|
||||
//
|
||||
// AC thread only (inside RynthAi's or RynthVision's window, and EndFrame after
|
||||
// the panels).
|
||||
// ============================================================================
|
||||
|
||||
using System;
|
||||
|
|
@ -43,6 +55,7 @@ internal static class SettingsDrawerBodies
|
|||
{
|
||||
Vector2 at = ImGuiNET.ImGui.GetCursorScreenPos();
|
||||
float w = MathF.Max(1, width);
|
||||
if (key is "nameplates" or "combattext") return DrawVisionTab(key, at, w);
|
||||
float k = MathF.Max(1f, ImGuiFonts.Get(UiFont.Dash11).FontSize / 11f);
|
||||
ImGuiNET.ImGui.PushFont(ImGuiFonts.Get(UiFont.Dash10));
|
||||
try
|
||||
|
|
@ -101,6 +114,30 @@ internal static class SettingsDrawerBodies
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>True for the bodies that draw in a popped-out window too (the Vision tabs).</summary>
|
||||
public static bool DrawsPoppedOut(string key) => key is "nameplates" or "combattext";
|
||||
|
||||
/// <summary>
|
||||
/// A Vision tab RynthVision's window shows (the engine's rows: MonsterHudSettingsUi), in Ui11 as the
|
||||
/// engine's Vision panel drew them. Returns the height drawn.
|
||||
/// </summary>
|
||||
private static float DrawVisionTab(string key, Vector2 at, float w)
|
||||
{
|
||||
ImGuiNET.ImGui.PushFont(ImGuiFonts.Get(UiFont.Ui11));
|
||||
ImGuiNET.ImGui.PushID(key == "nameplates" ? "##sdb_plates" : "##sdb_ctext");
|
||||
try
|
||||
{
|
||||
if (key == "nameplates") Hud.MonsterHudSettingsUi.DrawNameplates(w);
|
||||
else Hud.MonsterHudSettingsUi.DrawCombatText(w);
|
||||
}
|
||||
finally
|
||||
{
|
||||
ImGuiNET.ImGui.PopID();
|
||||
ImGuiNET.ImGui.PopFont();
|
||||
}
|
||||
return MathF.Max(0f, ImGuiNET.ImGui.GetCursorScreenPos().Y - at.Y);
|
||||
}
|
||||
|
||||
/// <summary>After the panels each frame: a body that wasn't drawn this frame lets its hub sources go.</summary>
|
||||
public static void EndFrame()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,6 +11,14 @@
|
|||
// your own plate), engine-side (Hud/MonsterHudSettingsUi);
|
||||
// Combat text floating damage / heal numbers, kill burst and gains.
|
||||
//
|
||||
// 2026-10-27: RynthVision draws the Vision window itself (its manifest's
|
||||
// "takeOver" window, RynthVision Ui/VisionWindow.cs, on engines with plugin
|
||||
// API v91): this face then steps aside (ImGuiPanelHost.TakeOver; same key, so
|
||||
// the saved place, bar button, hotkeys and /rc commands carry over) and comes back
|
||||
// when RynthVision unloads. Its Nameplates and Combat text tabs are drawn into
|
||||
// RynthVision's window by the engine (SettingsDrawerBodies "nameplates" /
|
||||
// "combattext"). Kept for an older RynthVision; goes a release after.
|
||||
//
|
||||
// Terrain edits a private copy and saves just the changed field
|
||||
// (VisionCommands) when a control finishes changing (a slider on release).
|
||||
// A newer snapshot replaces the copy unless a control is in use. The other
|
||||
|
|
|
|||
Loading…
Reference in a new issue