From 65678da3d263545b3c90a1a4e639b02fb3529164 Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Sat, 27 Jun 2026 19:28:40 -0500 Subject: [PATCH] tooltip: optional movement-speed line via GetUnitSpeed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New tooltip.movespeed config knob (default off, checkbox in the GUI's tooltip page). When on, the unit tooltip gains a "Speed: N%" line where N is the unit's run speed normalized to vanilla's 7.0 yd/s base — 100 unmounted, 160 on a 60% mount, 200 on epic, less under snares. Uses runSpeed (return 2 of GetUnitSpeed), not currentSpeed, so the number reflects what the unit *would* be running at — visible even while they're standing still. runSpeed is 0 for out-of-range units, so the line is skipped in that case. --- api/config.lua | 1 + modules/gui.lua | 1 + modules/tooltip.lua | 8 ++++++++ 3 files changed, 10 insertions(+) diff --git a/api/config.lua b/api/config.lua index a158de86..f17ad9ed 100644 --- a/api/config.lua +++ b/api/config.lua @@ -748,6 +748,7 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("tooltip", nil, "cursoroffset", "20") pfUI:UpdateConfig("tooltip", nil, "extguild", "1") pfUI:UpdateConfig("tooltip", nil, "itemid", "0") + pfUI:UpdateConfig("tooltip", nil, "movespeed", "0") pfUI:UpdateConfig("tooltip", nil, "alpha", "0.8") pfUI:UpdateConfig("tooltip", nil, "alwaysperc", "0") pfUI:UpdateConfig("tooltip", "compare", "basestats", "1") diff --git a/modules/gui.lua b/modules/gui.lua index dbef2af4..6f1df601 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -2745,6 +2745,7 @@ pfUI:RegisterModule("gui", function () CreateConfig(nil, T["Enable Extended Guild Information"], C.tooltip, "extguild", "checkbox") CreateConfig(nil, T["Always Show Health In Percent"], C.tooltip, "alwaysperc", "checkbox") CreateConfig(nil, T["Show Item IDs"], C.tooltip, "itemid", "checkbox") + CreateConfig(nil, T["Show Movement Speed"], C.tooltip, "movespeed", "checkbox") CreateConfig(nil, T["Custom Transparency"], C.tooltip, "alpha") CreateConfig(nil, T["Status Bar Texture"], C.tooltip.statusbar, "texture", "dropdown", pfUI.gui.dropdowns.uf_bartexture) CreateConfig(nil, T["Compare Item Base Stats"], C.tooltip.compare, "basestats", "checkbox") diff --git a/modules/tooltip.lua b/modules/tooltip.lua index 62e45e0b..622bb93a 100644 --- a/modules/tooltip.lua +++ b/modules/tooltip.lua @@ -233,6 +233,14 @@ pfUI:RegisterModule("tooltip", function () end end + if C.tooltip.movespeed == "1" then + local currentSpeed = GetUnitSpeed(unit) + if currentSpeed and currentSpeed > 0 then + local pct = floor(currentSpeed / 7 * 100 + 0.5) + GameTooltip:AddLine(T["Speed"] .. ": " .. pct .. "%", 0.7, 0.7, 1) + end + end + if hp and hpm then if hp >= 1000 then hp = round(hp / 1000, 1) .. "k" end if hpm >= 1000 then hpm = round(hpm / 1000, 1) .. "k" end