AnySCT 0.3.0

This commit is contained in:
2026-10-15 14:49:24 +02:00
parent 521342f1b6
commit 4600cc0719
8 changed files with 405 additions and 67 deletions
+26 -4
View File
@@ -28,6 +28,9 @@ AnySCT_DEFAULTS = {
maxLinesPerTarget = 16,
onlyWhileSourceFights = false, -- true: hide text while the listed source itself is not in combat (renamed from showOnlyInCombat, which gated on the PLAYER)
colourize = false, -- false: everything orange like the pet text; true: crit yellow, miss red, block blue, ...
mergeHits = true, -- identical attacks (same source, victim, attack, hit/crit) within a short window become ONE line with the running sum
mergeWindow = 0.4, -- seconds a line keeps absorbing identical hits
mergeCount = false, -- append " x5" to a merged line
markGlancing = false, -- true: add "glancing" / "crushing" after the number
guessTotemOwner = false, -- unknown totem owner = the only listed shaman (can misattribute enemy / own totems)
classColours = false, -- numbers / words take the source's class colour (pets: the owner's)
@@ -49,7 +52,7 @@ AnySCT_DEFAULTS = {
minimap = true,
mmAngle = 200,
importMain = true,
placement = "clamp", -- "clamp" | "anchorOff" | "anchor"
placement = "clamp", -- "clamp" | "anchorOff" | "anchor" | "both"
noPlate = "anchor", -- "anchor" | "hide"
edgeMargin = 40,
xOffset = 40, -- plate modes: shift right so targetSCT numbers sit beside the player's own
@@ -1242,6 +1245,23 @@ function C.LeadFromPos(p)
return p * 100
end
-- Fixed-anchor geometry. Frame rects (GetCenter/GetLeft/...) and SetPoint offsets live in one
-- coordinate system; UIParent:GetWidth()/GetHeight() do NOT (1834x768 against a 2580x1080 rect on a
-- UI scale of 0.711), so the screen centre must come from UIParent's own rect, never from its size.
function C.AnchorPosFromCenter(cx, cy, ux, uy)
return { point = "CENTER", x = math.floor(cx - ux + 0.5), y = math.floor(cy - uy + 0.5) }
end
-- Half extents of the screen as slider limits: rounded up to a multiple of 5, at least 100.
function C.ScreenHalfRange(left, right, bottom, top)
local function half(a, b)
local h = math.ceil(((b or 0) - (a or 0)) / 2 / 5) * 5
if h < 100 then h = 100 end
return h
end
return half(left, right), half(bottom, top)
end
function C.PosFromLead(v)
v = v or 0
if v < 0 then v = 0 end
@@ -1346,6 +1366,8 @@ local function threatSrcName(name)
return nil
end
C.ThreatSrcName = threatSrcName
local function threatHide()
if TH.shown then
TH.shown = false
@@ -1427,7 +1449,7 @@ local HELP = {
" clear remove every targetSCT",
" colours re-assign the targetSCT colours automatically",
" threat state of the experimental threat GO / WAIT label",
" place clamp|anchoroff|anchor where the text appears",
" place clamp|anchoroff|anchor|both where the text appears",
" unlock | lock move the fixed anchor",
" demo show sample text",
" mem measure memory use (10 s idle, then a demo burst)",
@@ -1449,7 +1471,7 @@ function C.Canon(n)
return nil
end
local PLACE = { clamp = "clamp", anchoroff = "anchorOff", anchor = "anchor" }
local PLACE = { clamp = "clamp", anchoroff = "anchorOff", anchor = "anchor", both = "both" }
function C.Slash(msg)
msg = msg or ""
@@ -1482,7 +1504,7 @@ function C.Slash(msg)
C.Print("targetSCT colours re-assigned")
elseif cmd == "place" then
local p = PLACE[string.lower(rest)]
if p then C.SetOpt("placement", p) C.Print("placement: " .. p) else C.Print("usage: /anysct place clamp|anchoroff|anchor") end
if p then C.SetOpt("placement", p) C.Print("placement: " .. p) else C.Print("usage: /anysct place clamp|anchoroff|anchor|both") end
elseif cmd == "unlock" or cmd == "lock" then
if AnySCT_SCT and AnySCT_SCT.SetMoveMode then AnySCT_SCT.SetMoveMode(cmd == "unlock") end
elseif cmd == "demo" then