Compare commits

..
11 Commits
Author SHA1 Message Date
Brues ebb4b056c3 Nameplates: drive every plate from unit events, drop the per-tick loop
The module polled: a central OnUpdate at 100 Hz over every visible plate,
a full OnDataChanged refresh of each plate every 0.5 s, and per-tick reads
of the engine's name/level regions, frame size, mouse state and
SpellIsTargeting. ClassicAPI feeds every unit event to the nameplateN
tokens, so none of that is needed.

Each bound plate now registers its unit events on its own frame against
its token (UNIT_HEALTH/MAXHEALTH, UNIT_AURA_DELTA, UNIT_FLAGS,
UNIT_DYNAMIC_FLAGS, UNIT_FACTION, UNIT_LEVEL, UNIT_CLASSIFICATION_CHANGED,
UNIT_NAME_UPDATE, UNIT_TARGET, the casts) and each handler updates only
what that event can change; the module-level events (target, combat,
level-up, roster, guild, spell targeting) fan out to the plates they
concern. Health comes from UnitHealth on the token instead of the
engine bar's OnValueChanged hook; name, level and difficulty colour from
UnitName/UnitLevel/GetDifficultyColor instead of the blanked engine
regions (UnitLevel's -1 is exactly the engine's skull case, so "??B"
survives). The engine resets the plate's size at every bind, so the
engine frame's size and click routing are re-applied from its OnShow
instead of being checked every tick; the overlay steps aside for
ground-target spells on CURRENT_SPELL_CAST_CHANGED.

The only OnUpdate left is a driver frame, shown while a castbar sweeps or
the target zoom animates and hidden when both sets are empty; the zoom
is time-based now rather than per-tick multiplication. The
nameplates/nameplates_target/nameplates_mass throttle categories no
longer mean anything and are gone from libthrottle and the GUI;
nameplates_castbar stays as the sweep rate of non-target castbars.

Mouseover tracking is gone (the token already names the unit), and
libhealth's "known" return now decides whether absolute health is shown,
so a unit whose health is only known as a percentage no longer prints
"57 | 57%".
2026-11-01 21:40:50 -06:00
Brues b17f5bcd3d Unit frames: only the player's pet wakes them with UNIT_HAPPINESS
Shown frames registered UNIT_HAPPINESS unfiltered, so every hunter pet in view woke them. It is now a unit event for "pet".
2026-11-01 21:08:57 -06:00
Brues e60f9eb410 libpredict: drop the always-running cleanup OnUpdate
The events table it pruned was never read; expired heals already drop out of UnitGetIncomingHeals by their own timeout. Resurrection offers are now checked by a ticker that runs only while an offer is open.
2026-11-01 20:57:55 -06:00
Brues 66171d5354 libpredict: stop the sender's per-frame work
The Regrowth HoT now goes out on a one-shot timer instead of an always-running OnUpdate, and other units' spellcast events are filtered to the group's tokens, the only casters libpredict can resolve; solo, no one else's casts arrive.
2026-11-01 20:54:40 -06:00
Brues 8b239a5532 Castbars: hide idle bars instead of fading them to alpha 0
An idle bar stayed shown at alpha 0, so its OnUpdate ran every frame. The fade-out now ends in Hide, a cast shows the bar, and unlock mode keeps it shown for dragging.
2026-11-01 20:44:24 -06:00
Brues b6d570df97 Unit frames: hidden frames only hear the events that can show them
Every frame registered the same global events whether shown or not. A frame now keeps only the visibility events for the unit it was created for, and registers the display-only events while shown; OnShow does a full refresh to catch up on what it missed.
2026-11-01 20:44:24 -06:00
Brues 698dedcb7a Chat: cut the per-line work of the AddMessage hook
- Save the chat history from the frames when leaving the world, through
  GetMessageInfo, instead of on every line. Lines written back from the
  history carry a mark, so they are saved as they are. History is no longer
  recorded while it is off, keeps 30 lines instead of 29, and whispers are
  dimmed in the whisper colour (gsub's match count was taken as red).
- Skip the CLINK and URL passes on lines that cannot hold them.
- Colour player links in one gsub with a callback instead of a gsub per name.
- Read a chat line that several frames show only once, by its line ID.
- Build the timestamp once per second.
- Lay the tabs out on hover only when their bar comes back, not 10 times a
  second.
- Drop ChatFrame_OnUpdate: it only blinks the flash of the bottom button
  pfUI hides. The lines fade in the engine's update.
2026-11-01 19:59:53 -06:00
AbyssandBrues e609809fff Raid unitframes: add option to reverse group order (#75)
* Add raidreverse default to unitframes config

Defaults to off, so existing layouts are unchanged.

* Raid frames: add option to reverse group order

Read the new raidreverse setting and mirror the column index when placing raid frames, so group 1 sits on the far right and the following groups grow to the left.

* Add "Reverse Group Order" checkbox to raid settings

Placed under "Raid Fill Direction" in the raid frame options.
/pfui > Settings > Unit Frames > Raid > Layout

* Raid frames: rename reverse option to "Grow Right To Left"

The option mirrors columns in both fill directions, so name it for what
it does. Mirror across the columns maxraid can fill instead of the whole
layout, so smaller raids stay next to the anchor. Lay the raid grid out
through SlotToCoord like the pet grid, move the default next to the other
raid layout keys, and add the label to the locale tables.

---------

Co-authored-by: Brues <5278969+brues-code@users.noreply.github.com>
2026-11-01 18:02:31 -06:00
Brues 3651341697 Scroll every chat copy box to the newest line when it opens
The caret at the end scrolled only the box with the focus, and each
visible chat frame's box takes the focus as it opens, so only the last
one shown reached the bottom. Even that one stopped short: 1.12's
OnCursorChanged has no input context, so ScrollCursorIntoView lets the
last line clip.

Each box now measures its scroll box and scrolls it to the end on the
next frame, after the edit box has laid the new text out.
2026-11-01 17:22:06 -06:00
Antoine ChedinandBrues 77be27094a Add Offsets to unit frame buff/debuff (#74)
* Add anchor offset for unitframe buff or defuff

* Fix default values

* Stack a shared-corner aura block past the other block's Y offset, read the offsets without a table per icon

---------

Co-authored-by: Brues <5278969+brues-code@users.noreply.github.com>
2026-11-01 16:39:48 -06:00
Brues 3e50a0b34f Turn on countdownForCooldowns when migrating the old cooldown settings
pfUI drew its own cooldown numbers before; the native countdown shows
them only with the countdownForCooldowns cvar on, and only the first-run
setup set it. Upgraded installs showed no numbers at all, so the
cooldown settings migration turns the cvar on as it removes
appearance.cd.
2026-11-01 00:23:39 -05:00
18 changed files with 1569 additions and 1865 deletions
+10 -1
View File
@@ -460,6 +460,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "raid", "raidlayout", "8x5")
pfUI:UpdateConfig("unitframes", "raid", "raidpadding", "3")
pfUI:UpdateConfig("unitframes", "raid", "raidfill", "VERTICAL")
pfUI:UpdateConfig("unitframes", "raid", "raidgrowleft", "0")
pfUI:UpdateConfig("unitframes", "raid", "collapse", "0")
pfUI:UpdateConfig("unitframes", "raid", "raidgrouplabel", "0")
pfUI:UpdateConfig("unitframes", "raid", "grouplabelxoff", "0")
@@ -550,6 +551,8 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", unit, "bufflimit", "32")
pfUI:UpdateConfig("unitframes", unit, "buffperrow", "8")
pfUI:UpdateConfig("unitframes", unit, "ownbuffsize", "-1")
pfUI:UpdateConfig("unitframes", unit, "buffoffx", "0")
pfUI:UpdateConfig("unitframes", unit, "buffoffy", "0")
pfUI:UpdateConfig("unitframes", unit, "buffspacingx", "1")
pfUI:UpdateConfig("unitframes", unit, "buffspacingy", "1")
pfUI:UpdateConfig("unitframes", unit, "debuffs", "TOPLEFT")
@@ -557,6 +560,8 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", unit, "debufflimit", "32")
pfUI:UpdateConfig("unitframes", unit, "debuffperrow", "8")
pfUI:UpdateConfig("unitframes", unit, "owndebuffsize", "-1")
pfUI:UpdateConfig("unitframes", unit, "debuffoffx", "0")
pfUI:UpdateConfig("unitframes", unit, "debuffoffy", "0")
pfUI:UpdateConfig("unitframes", unit, "debuffspacingx", "1")
pfUI:UpdateConfig("unitframes", unit, "debuffspacingy", "1")
pfUI:UpdateConfig("unitframes", unit, "invert_healthbar", "0")
@@ -1453,6 +1458,10 @@ function pfUI:MigrateConfig()
cooldown.blizzard.text = cooldown.foreign.text
end
-- pfUI drew its own numbers before; the native countdown shows them
-- only with this cvar on, which only the first-run setup sets
SetCVar("countdownForCooldowns", "1")
pfUI_config.appearance.cd = nil
end
@@ -1520,4 +1529,4 @@ function pfUI:MigrateConfig()
else
pfUI_config.version = pfUI.version.string
end
end
end
+65 -22
View File
@@ -19,11 +19,11 @@ local auraCorners = {
}
-- Flows the shown icons of an aura block outward from the frame edge, starting
-- `offset` away from it (its own row gap when nil): `perrow` icons per row,
-- each row as tall as its largest icon. The first `icons.own` icons are the
-- player's (C_UnitAuras lists them first) and use `icons.ownsize`. Returns the
-- offset just past the block's last row, where a block sharing the same corner
-- continues.
-- `offset` away from it (its own row gap when nil) and shifted on screen by
-- `offx`/`offy`: `perrow` icons per row, each row as tall as its largest icon.
-- The first `icons.own` icons are the player's (C_UnitAuras lists them first)
-- and use `icons.ownsize`. Returns the offset just past the block's last
-- shifted row, where a block sharing the same corner continues.
local function LayoutAuraBlock(unit, icons, offset)
local corner = auraCorners[icons.pos]
local anchor = unit.config.portraitheight ~= "-1" and unit.hp or unit
@@ -42,7 +42,7 @@ local function LayoutAuraBlock(unit, icons, offset)
local size = i <= icons.own and icons.ownsize or icons.size
icons[i]:SetSize(size, size)
icons[i]:ClearAllPoints()
icons[i]:SetPoint(corner[1], anchor, icons.pos, corner[2] * x, corner[3] * offset)
icons[i]:SetPoint(corner[1], anchor, icons.pos, icons.offx + corner[2] * x, icons.offy + corner[3] * offset)
x = x + size + icons.gapx
if size > rowsize then rowsize = size end
@@ -50,7 +50,7 @@ local function LayoutAuraBlock(unit, icons, offset)
i = i + 1
end
if col > 0 then offset = offset + rowsize + icons.gapy end
if col > 0 then offset = offset + rowsize + icons.gapy + corner[3] * icons.offy end
return offset
end
@@ -248,6 +248,43 @@ local VISIBILITY_EVENTS = {
UNIT_TARGET = true, -- a link of a chained frame's unit retargeted
}
-- The events a frame hears hidden or not: the visibility events that concern
-- the unit it was created for (raid.lua remaps a raid frame's label, so this is
-- decided once, at creation), and the logout guard. UNIT_TARGET belongs to
-- RegisterChainEvents, and focus.lua drives the focus frames itself.
local function GetIdleEvents(label, fname)
local events = { PLAYER_ENTERING_WORLD = true, PLAYER_LOGOUT = true }
if label:find("^party") or label:find("^raid")
or fname == "Group0" or fname == "PartyPet0" or fname == "Party0Target" then
events.PARTY_MEMBERS_CHANGED = true
events.RAID_ROSTER_UPDATE = true
end
if label:find("^target") then events.PLAYER_TARGET_CHANGED = true end
if label:find("pet") then events.UNIT_PET = true end
return events
end
-- The events that only redraw what a frame shows. A hidden frame drops them,
-- and OnShow's full refresh catches up on whatever it missed.
local SHOWN_EVENTS = {
"PLAYER_AURAS_CHANGED", -- label=player && frame=buff
"PLAYER_EQUIPMENT_CHANGED", -- label=player && frame=buff (ClassicAPI: weapon-enchant buffs)
"PARTY_MEMBERS_CHANGED", -- frame=leaderIcon
"PARTY_LEADER_CHANGED", -- frame=leaderIcon
"RAID_ROSTER_UPDATE", -- frame=raidIcon
"PLAYER_UPDATE_RESTING", -- frame=restIcon
"PARTY_LOOT_METHOD_CHANGED", -- frame=lootIcon
"RAID_TARGET_UPDATE", -- frame=raidIcon
}
local function RegisterShownEvents(frame)
for i = 1, table.getn(SHOWN_EVENTS) do
frame:RegisterEvent(SHOWN_EVENTS[i])
end
-- label=pet; the player's own pet only, not every pet in view
frame:RegisterUnitEvent("UNIT_HAPPINESS", "pet")
end
-- ============================================================================
-- GetUnitStats - health + power for a unit token.
-- Returns: hp, maxHp, power, maxPower, powerType
@@ -877,6 +914,8 @@ function pfUI.uf:UpdateConfig()
f.buffs.size = tonumber(f.config.buffsize)
f.buffs.ownsize = f.config.ownbuffsize == "-1" and f.buffs.size or tonumber(f.config.ownbuffsize)
f.buffs.perrow = tonumber(f.config.buffperrow)
f.buffs.offx = tonumber(f.config.buffoffx)
f.buffs.offy = tonumber(f.config.buffoffy)
f.buffs.gapx = aura_border + tonumber(f.config.buffspacingx)
f.buffs.gapy = aura_border + tonumber(f.config.buffspacingy)
f.buffs.own = 0
@@ -927,6 +966,8 @@ function pfUI.uf:UpdateConfig()
f.debuffs.size = tonumber(f.config.debuffsize)
f.debuffs.ownsize = f.config.owndebuffsize == "-1" and f.debuffs.size or tonumber(f.config.owndebuffsize)
f.debuffs.perrow = tonumber(f.config.debuffperrow)
f.debuffs.offx = tonumber(f.config.debuffoffx)
f.debuffs.offy = tonumber(f.config.debuffoffy)
f.debuffs.gapx = aura_border + tonumber(f.config.debuffspacingx)
f.debuffs.gapy = aura_border + tonumber(f.config.debuffspacingy)
f.debuffs.own = 0
@@ -980,8 +1021,17 @@ function pfUI.uf:UpdateConfig()
end
function pfUI.uf.OnShow()
pfUI.uf:RefreshUnit(this, "portrait")
pfUI.uf:RefreshUnit(this, "base")
RegisterShownEvents(this)
pfUI.uf:RefreshUnit(this, "all")
end
function pfUI.uf.OnHide()
for i = 1, table.getn(SHOWN_EVENTS) do
if not this.idleevents[SHOWN_EVENTS[i]] then
this:UnregisterEvent(SHOWN_EVENTS[i])
end
end
this:UnregisterEvent("UNIT_HAPPINESS")
end
function pfUI.uf.OnEvent()
@@ -1403,19 +1453,10 @@ end
function pfUI.uf:EnableEvents()
local f = self
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:RegisterEvent("PLAYER_LOGOUT")
f:RegisterEvent("PLAYER_AURAS_CHANGED") -- label=player && frame=buff
f:RegisterEvent("PLAYER_EQUIPMENT_CHANGED") -- label=player && frame=buff (ClassicAPI: weapon-enchant buffs)
f:RegisterEvent("PARTY_MEMBERS_CHANGED") -- label=party, frame=leaderIcon
f:RegisterEvent("PARTY_LEADER_CHANGED") -- frame=leaderIcon
f:RegisterEvent("RAID_ROSTER_UPDATE") -- label=raidIcon
f:RegisterEvent("PLAYER_UPDATE_RESTING") -- label=restIcon
f:RegisterEvent("PLAYER_TARGET_CHANGED") -- label=target
f:RegisterEvent("PARTY_LOOT_METHOD_CHANGED") -- frame=lootIcon
f:RegisterEvent("RAID_TARGET_UPDATE") -- frame=raidIcon
f:RegisterEvent("UNIT_PET")
f:RegisterEvent("UNIT_HAPPINESS")
for event in pairs(f.idleevents) do
f:RegisterEvent(event)
end
if f:IsShown() then RegisterShownEvents(f) end
f:RegisterForClicks('LeftButtonUp', 'RightButtonUp',
'MiddleButtonUp', 'Button4Up', 'Button5Up')
@@ -1481,6 +1522,7 @@ function pfUI.uf:EnableScripts()
end
f:SetScript("OnShow", pfUI.uf.OnShow)
f:SetScript("OnHide", pfUI.uf.OnHide)
f:SetScript("OnEvent", pfUI.uf.OnEvent)
f:SetScript("OnUpdate", pfUI.uf.OnUpdate)
@@ -1528,6 +1570,7 @@ function pfUI.uf:CreateUnitFrame(unit, id, config, tick)
f.id = id
f.config = config or pfUI_config.unitframes.fallback
f.tick = tick
f.idleevents = GetIdleEvents(f.label, fname)
CreateBackdropShadow(f)
+1 -2
View File
@@ -359,6 +359,7 @@ pfUI_translation["deDE"] = {
["Group Options"] = nil,
["Group-Pet"] = nil,
["Group-Target"] = nil,
["Grow Right To Left"] = nil,
["Gryphon"] = nil,
["Gryphons"] = nil,
["Guild Online"] = nil,
@@ -908,8 +909,6 @@ pfUI_translation["deDE"] = {
["Panel Alignment"] = "Panel Ausrichtung",
["Nameplate Update Rate"] = "Namensplaketten Aktualisierungsrate",
["Target/Casting Plates"] = "Ziel/Cast Plaketten",
["Normal Plates"] = "Normale Plaketten",
["Mass Pulls (20+ Plates)"] = "Große Pulls (20+ Plaketten)",
["Tooltip Update Rate"] = "Tooltip Aktualisierungsrate",
["Cursor Follow"] = "Cursor Folgen",
["Health/Status Bar"] = "Leben/Status Leiste",
+5 -2
View File
@@ -90,6 +90,8 @@ pfUI_translation["enUS"] = {
["Buffs"] = nil,
["Buff Size"] = nil,
["Buff Spacing"] = nil,
["Buff X-Offset"] = nil,
["Buff Y-Offset"] = nil,
["Buff X-Spacing"] = nil,
["Buff Y-Spacing"] = nil,
["Buffs Per Row"] = nil,
@@ -196,6 +198,8 @@ pfUI_translation["enUS"] = {
["Debuff Position"] = nil,
["Debuffs"] = nil,
["Debuff Size"] = nil,
["Debuff X-Offset"] = nil,
["Debuff Y-Offset"] = nil,
["Debuff X-Spacing"] = nil,
["Debuff Y-Spacing"] = nil,
["Debuffs Per Row"] = nil,
@@ -369,6 +373,7 @@ pfUI_translation["enUS"] = {
["Group Options"] = nil,
["Group-Pet"] = nil,
["Group-Target"] = nil,
["Grow Right To Left"] = nil,
["Gryphon"] = nil,
["Gryphons"] = nil,
["Guild Online"] = nil,
@@ -936,8 +941,6 @@ pfUI_translation["enUS"] = {
["Panel Alignment"] = nil,
["Nameplate Update Rate"] = nil,
["Target/Casting Plates"] = nil,
["Normal Plates"] = nil,
["Mass Pulls (20+ Plates)"] = nil,
["Tooltip Update Rate"] = nil,
["Cursor Follow"] = nil,
["Health/Status Bar"] = nil,
+1
View File
@@ -359,6 +359,7 @@ pfUI_translation["esES"] = {
["Group Options"] = "Opciones de grupo",
["Group-Pet"] = "Mascota-Grupo",
["Group-Target"] = "Objetivo-Grupo",
["Grow Right To Left"] = nil,
["Gryphon"] = nil,
["Gryphons"] = nil,
["Guild Online"] = "Conectados en hermandad",
+1
View File
@@ -359,6 +359,7 @@ pfUI_translation["frFR"] = {
["Group Options"] = "Options de groupe",
["Group-Pet"] = "Groupe des familiers",
["Group-Target"] = "Groupe des cibles",
["Grow Right To Left"] = nil,
["Gryphon"] = nil,
["Gryphons"] = nil,
["Guild Online"] = "Membres de guilde connectés",
+1
View File
@@ -359,6 +359,7 @@ pfUI_translation["koKR"] = {
["Group Options"] = nil,
["Group-Pet"] = "파티-팻",
["Group-Target"] = "파티-타켓",
["Grow Right To Left"] = nil,
["Gryphon"] = nil,
["Gryphons"] = nil,
["Guild Online"] = "접속중인 길드원",
+1
View File
@@ -359,6 +359,7 @@ pfUI_translation["ruRU"] = {
["Group Options"] = "Настройки группы",
["Group-Pet"] = "Группа-питомец",
["Group-Target"] = "Группа-цель",
["Grow Right To Left"] = nil,
["Gryphon"] = nil,
["Gryphons"] = nil,
["Guild Online"] = "Члены гильдии в сети",
+1
View File
@@ -359,6 +359,7 @@ pfUI_translation["zhCN"] = {
["Group Options"] = "队伍选项",
["Group-Pet"] = "小队宠物",
["Group-Target"] = "小队目标",
["Grow Right To Left"] = nil,
["Gryphon"] = "狮鹫",
["Gryphons"] = "狮鹫(多个)",
["Guild Online"] = "公会在线",
+1
View File
@@ -359,6 +359,7 @@ pfUI_translation["zhTW"] = {
["Group Options"] = nil,
["Group-Pet"] = "小隊寵物",
["Group-Target"] = "小隊目標",
["Grow Right To Left"] = nil,
["Gryphon"] = nil,
["Gryphons"] = nil,
["Guild Online"] = "公會線上",
+54 -86
View File
@@ -25,7 +25,7 @@ setfenv(1, pfUI:GetEnvironment())
-- return instantly when another libpredict is already active
if pfUI.api.libpredict then return end
local heals, events, hots = {}, {}, {}
local heals, hots = {}, {}
local spell_queue = { "DUMMY", "DUMMYRank 9", "TARGET" }
local player = UnitName("player")
local cache, gear_string = {}, ""
@@ -134,19 +134,6 @@ local function OnOwnCastStart(spellId, castGUID)
local amount = cache[spell_queue[2]][1]
local casttime = castTime
if spellName == REGROWTH then
local fullSpell = spell_queue[2]
local _, _, rankStr = fullSpell and string.find(fullSpell, "Rank (%d+)")
local rankNum = rankStr and tonumber(rankStr) or nil
if libpredict.sender.regrowth_timer then
libpredict.sender.regrowth_target_next = target
libpredict.sender.regrowth_rank_next = rankNum
else
libpredict.sender.regrowth_target = target
libpredict.sender.regrowth_rank = rankNum
end
end
if spellName == PRAYER_OF_HEALING then
-- target is already correctly set from spell_queue[3]:
-- selfcast (ALT) = player, otherwise = current target
@@ -207,34 +194,35 @@ local function OnOwnCastSucceeded(spellId, castGUID)
libpredict:HealStop(player)
local spellName = C_Spell.GetSpellName(spellId)
if spellName == REGROWTH then
local now = pfUI.uf.now or GetTime()
if libpredict.sender.regrowth_timer then
libpredict.sender.regrowth_start_next = now
else
libpredict.sender.regrowth_start = now
end
libpredict.sender.regrowth_timer = now + 0.1
end
libpredict.sender.castGUID = nil
libpredict.sender.current_cast = nil
libpredict.sender.current_cast_target = nil
if not target then return end
-- Instant HoTs — classify by name (rank-independent) instead of a
-- hardcoded per-rank ID table.
-- HoTs — classify by name (rank-independent) instead of a hardcoded
-- per-rank ID table.
local hotType
if spellName == REJUVENATION then hotType = "Reju"
elseif spellName == RENEW then hotType = "Renew"
elseif spellName == REGROWTH then hotType = "Regr"
end
if hotType then
local duration = hotType == "Reju" and rejuvDuration or renewDuration
local rank = 0
local rankSub = C_Spell.GetSpellSubtext(spellId)
if rankSub and rankSub ~= "" then
rank = tonumber((string.gsub(rankSub, "Rank ", ""))) or 0
end
if hotType == "Regr" then
-- Regrowth's HoT follows its direct heal a moment later
local start = GetTime()
C_Timer.After(0.1, function()
libpredict:Hot(player, target, hotType, 20, start, "UNIT_SPELLCAST_SUCCEEDED", rank)
libpredict.sender:SendHealCommMsg(hotType .. "/" .. target .. "/20/" .. rank .. "/")
end)
return
end
local duration = hotType == "Reju" and rejuvDuration or renewDuration
libpredict:Hot(player, target, hotType, duration, nil, "UNIT_SPELLCAST_SUCCEEDED", rank)
libpredict.sender:SendHealCommMsg(hotType .. "/" .. target .. "/" .. duration .. "/" .. rank .. "/")
end
@@ -326,20 +314,11 @@ local function RefreshResFrames(guid)
end
end
libpredict:SetScript("OnUpdate", function()
-- throttle cleanup - no need to check every frame
local now = pfUI.uf.now or GetTime()
if (this.tick or 0) > now then return end
this.tick = now + pfUI.throttle:Get("libpredict") -- Default: Normal (10 FPS)
-- update on timeout events
for timestamp, targets in pairs(events) do
if now >= timestamp then
events[timestamp] = nil
end
end
-- drop resurrection offers the target accepted or let run out
-- Drop resurrection offers the target accepted or let run out. Nothing reports
-- either, so a ticker checks while any offer is open.
local resTicker
local function CheckResOffers()
local now = GetTime()
for guid, expiry in pairs(resOffers) do
local unit = UnitTokenFromGUID(guid)
if now >= expiry or not (unit and UnitIsDeadOrGhost(unit)) then
@@ -347,7 +326,11 @@ libpredict:SetScript("OnUpdate", function()
RefreshResFrames(guid)
end
end
end)
if not next(resOffers) then
resTicker:Cancel()
resTicker = nil
end
end
function libpredict:ParseComm(sender, msg)
local msgtype, target, heal, time, rank
@@ -496,11 +479,6 @@ function libpredict:ParseChatMessage(sender, msg)
end
end
function libpredict:AddEvent(time, target)
events[time] = events[time] or {}
table.insert(events[time], target)
end
function libpredict:Heal(sender, target, amount, duration, senderGuid)
if not sender or not target or not amount or not duration then
return
@@ -511,7 +489,6 @@ function libpredict:Heal(sender, target, amount, duration, senderGuid)
heals[target] = heals[target] or {}
heals[target][sender] = { amount, timeout }
if senderGuid then healGuidToName[senderGuid] = sender end
libpredict:AddEvent(timeout, target)
end
-- Debug flag
@@ -596,7 +573,6 @@ function libpredict:HealDelay(sender, delay)
for tsender, amount in pairs(heals[target]) do
if sender == tsender then
amount[2] = amount[2] + delay
libpredict:AddEvent(amount[2], target)
end
end
end
@@ -932,39 +908,33 @@ libpredict.sender.SendResCommMsg = function(self, msg)
-- BG groups are handled by RAID channel
end
libpredict.sender:SetScript("OnUpdate", function()
-- trigger delayed regrowth timers
local now = pfUI.uf.now or GetTime()
if this.regrowth_timer and now > this.regrowth_timer then
local target = this.regrowth_target or player
local duration = 20
local startTime = this.regrowth_start
local rank = this.regrowth_rank
libpredict:Hot(player, target, "Regr", duration, startTime, "OnUpdate", rank)
local rankStr = rank and tostring(rank) or "0"
libpredict.sender:SendHealCommMsg("Regr/"..target.."/"..duration.."/"..rankStr.."/")
-- Apply next queued Regrowth if available
this.regrowth_target = this.regrowth_target_next
this.regrowth_start = this.regrowth_start_next
this.regrowth_rank = this.regrowth_rank_next
this.regrowth_target_next = nil
this.regrowth_start_next = nil
this.regrowth_rank_next = nil
this.regrowth_timer = nil
-- Own casts arrive as "player". Other casters only matter as group members
-- (the only names resolveNameFromGuid knows), so their events are filtered to
-- the group's tokens, and solo nobody else's casts arrive at all. A member in
-- a raid also fires as raidN for its own casts; the handler drops those by
-- UnitIsUnit, and other repeats by castGUID.
local GROUP_CAST_EVENTS = {
"UNIT_SPELLCAST_START", "UNIT_SPELLCAST_SUCCEEDED", "UNIT_SPELLCAST_INTERRUPTED",
}
local castunits = {}
local function RegisterCastEvents()
local n, token = 0, IsInRaid() and "raid" or "party"
castunits[1] = "player"
for i = 1, IsInRaid() and GetNumRaidMembers() or GetNumPartyMembers() do
castunits[i + 1] = token .. i
n = i
end
end)
-- Own casts arrive as "player"; every other caster fires once per unit token
-- it currently holds (raidN, target, nameplateN, ...), so other-unit handlers
-- drop the repeats by castGUID.
libpredict.sender:RegisterEvent("UNIT_SPELLCAST_SENT")
libpredict.sender:RegisterEvent("UNIT_SPELLCAST_START")
libpredict.sender:RegisterEvent("UNIT_SPELLCAST_DELAYED")
libpredict.sender:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
libpredict.sender:RegisterEvent("UNIT_SPELLCAST_FAILED")
libpredict.sender:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED")
for i = table.getn(castunits), n + 2, -1 do castunits[i] = nil end
for i = 1, table.getn(GROUP_CAST_EVENTS) do
libpredict.sender:RegisterUnitEvent(GROUP_CAST_EVENTS[i], unpack(castunits))
end
end
RegisterCastEvents()
libpredict.sender:RegisterUnitEvent("UNIT_SPELLCAST_SENT", "player")
libpredict.sender:RegisterUnitEvent("UNIT_SPELLCAST_DELAYED", "player")
libpredict.sender:RegisterUnitEvent("UNIT_SPELLCAST_FAILED", "player")
libpredict.sender:RegisterEvent("PARTY_MEMBERS_CHANGED")
libpredict.sender:RegisterEvent("RAID_ROSTER_UPDATE")
libpredict.sender:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
-- Shared cleanup helper for failed/interrupted casts
@@ -980,12 +950,6 @@ local function onCastFailed()
s:SendResCommMsg("RESNO " .. (target or ""))
s.resurrecting = nil
end
if s.current_cast == REGROWTH then
s.regrowth_timer = nil
s.regrowth_start = nil
s.regrowth_target_next = nil
s.regrowth_start_next = nil
end
s.castGUID = nil
s.current_cast = nil
s.current_cast_target = nil
@@ -1032,6 +996,7 @@ local function OnResurrect()
-- arg8=destGUID
resOffers[arg8] = GetTime() + RES_OFFER_TIMEOUT
RefreshResFrames(arg8)
resTicker = resTicker or C_Timer.NewTicker(.1, CheckResOffers)
end
local lastOtherCast = {} -- [event] = castGUID of the last other-unit event handled
@@ -1041,6 +1006,9 @@ libpredict.sender:SetScript("OnEvent", function()
if arg2 == "SPELL_HEAL" then OnHeal()
elseif arg2 == "SPELL_RESURRECT" then OnResurrect() end
return
elseif event == "PARTY_MEMBERS_CHANGED" or event == "RAID_ROSTER_UPDATE" then
RegisterCastEvents()
return
end
-- UNIT_SPELLCAST_SENT: arg1=unit, arg2=target token, arg3=castGUID, arg4=spellID
-6
View File
@@ -31,10 +31,7 @@ libthrottle.presetNames = {
-- Default throttle categories
libthrottle.defaults = {
nameplates = "custom",
nameplates_target = "custom",
nameplates_castbar = "custom",
nameplates_mass = "custom",
tooltip_cursor = "fastest",
chat_tab = "custom",
swingtimer = "custom",
@@ -158,10 +155,7 @@ libthrottle:SetScript("OnEvent", function()
end
-- Set defaults for custom fields if missing
if not _G.pfUI_throttle.nameplates_target_custom then _G.pfUI_throttle.nameplates_target_custom = "50" end
if not _G.pfUI_throttle.nameplates_custom then _G.pfUI_throttle.nameplates_custom = "10" end
if not _G.pfUI_throttle.nameplates_castbar_custom then _G.pfUI_throttle.nameplates_castbar_custom = "100" end
if not _G.pfUI_throttle.nameplates_mass_custom then _G.pfUI_throttle.nameplates_mass_custom = "7" end
if not _G.pfUI_throttle.tooltip_cursor_custom then _G.pfUI_throttle.tooltip_cursor_custom = "10" end
if not _G.pfUI_throttle.chat_tab_custom then _G.pfUI_throttle.chat_tab_custom = "10" end
if not _G.pfUI_throttle.swingtimer_custom then _G.pfUI_throttle.swingtimer_custom = "50" end
+11 -8
View File
@@ -36,7 +36,7 @@ pfUI:RegisterModule("castbar", function ()
cb.bar:SetValue(1)
end
if cb.bar.spark then cb.bar.spark:Hide() end
if cb:GetAlpha() > 0 and not cb.fade:IsPlaying() then cb.fade:Play() end
if cb:IsShown() and not cb.fade:IsPlaying() then cb.fade:Play() end
end
-- "Spellname (N)" label for an active tradeskill merge — N is the number
@@ -95,7 +95,7 @@ pfUI:RegisterModule("castbar", function ()
cb.isTradeskill = isTradeskill
cb.delay = (delayMs or 0) / 1000
cb.fade:Stop()
cb:SetAlpha(1)
cb:Show()
-- Shield an uninterruptible cast. Not on the player's own bar: the flag is
-- measured against the reader's own interrupts and silences, so on your own
@@ -247,12 +247,16 @@ pfUI:RegisterModule("castbar", function ()
cb.bar.spark:SetPoint("BOTTOM", cb.bar, "BOTTOMLEFT", 0, 0)
cb.bar.spark:Hide()
-- Fade-out after a cast ends. The bar stays at alpha 0 while idle.
-- Fade-out after a cast ends. The bar is hidden while idle, so its OnUpdate
-- only runs during a cast; unlock mode keeps it shown for dragging.
local function unlocked() return cb.drag and cb.drag:IsShown() end
cb.fade = cb:CreateAnimationGroup()
local fade = cb.fade:CreateAnimation("Alpha")
fade:SetChange(-1)
fade:SetDuration(.4)
cb.fade:SetScript("OnFinished", function() cb:SetAlpha(0) end)
cb.fade:SetScript("OnFinished", function()
if not unlocked() then cb:Hide() end
end)
-- OnUpdate animates the bar fill. All state transitions (cast start/stop/interrupt, channel start/stop,
-- pushback) come from the event handler below — we never poll C_Spell
@@ -261,16 +265,15 @@ pfUI:RegisterModule("castbar", function ()
if (this.tick or 0) > GetTime() then return end
this.tick = GetTime() + 0.020 -- ~50 FPS
if this.drag and this.drag:IsShown() then
if unlocked() then
this.fade:Stop()
this:SetAlpha(1)
return
end
if this.fade:IsPlaying() then return end
if not this.endTime then
if this:GetAlpha() ~= 0 then this:SetAlpha(0) end
this:Hide()
return
end
@@ -443,7 +446,7 @@ pfUI:RegisterModule("castbar", function ()
end
end)
cb:SetAlpha(0)
cb:Hide()
return cb
end
+150 -109
View File
@@ -30,39 +30,6 @@ pfUI:RegisterModule("chat", function ()
end
end)
local realm = GetRealmName()
local player = UnitName("player")
local history
local function SaveChatHistory(id, msg, r, g, b)
-- create cache tables if not existing
pfUI_cache = pfUI_cache or {}
pfUI_cache["chathistory"] = pfUI_cache["chathistory"] or {}
pfUI_cache["chathistory"][realm] = pfUI_cache["chathistory"][realm] or {}
pfUI_cache["chathistory"][realm][player] = pfUI_cache["chathistory"][realm][player] or {}
pfUI_cache["chathistory"][realm][player][id] = pfUI_cache["chathistory"][realm][player][id] or {}
if r and g and b then
local color = rgbhex(r*.5+.2, g*.5+.2, b*.5+.2)
msg = string.gsub(msg, "^", color)
msg = string.gsub(msg, "|r", "|r" .. color)
end
history = pfUI_cache["chathistory"][realm][player][id]
table.insert(history, 1, msg)
if history[30] then table.remove(history, 30) end
end
local function GetChatHistory(id)
-- create cache tables if not existing
pfUI_cache = pfUI_cache or {}
pfUI_cache["chathistory"] = pfUI_cache["chathistory"] or {}
pfUI_cache["chathistory"][realm] = pfUI_cache["chathistory"][realm] or {}
pfUI_cache["chathistory"][realm][player] = pfUI_cache["chathistory"][realm][player] or {}
pfUI_cache["chathistory"][realm][player][id] = pfUI_cache["chathistory"][realm][player][id] or {}
return pfUI_cache["chathistory"][realm][player][id]
end
-- [ Chat Panel Colors ]
-- The panels normally inherit pfUI's global appearance theme; custom colors let chat
-- deviate from it. CreateBackdrop is re-run first to restore the theme, so toggling
@@ -456,15 +423,20 @@ pfUI:RegisterModule("chat", function ()
if pfUI.chat.hideLock then return end
-- the dock lays the tabs out again only when their bar comes back
if pfUI.chat.left:IsMouseOver(10, -10, -10, 10) then
pfUI.chat.left.panelTop:Show()
FCF_DockUpdate()
if not pfUI.chat.left.panelTop:IsShown() then
pfUI.chat.left.panelTop:Show()
FCF_DockUpdate()
end
elseif pfUI.chat.right:IsMouseOver(10, -10, -10, 10) then
-- disable while dock is active
if pfUI.chat.right:GetAlpha() == 0 then return end
pfUI.chat.right.panelTop:Show()
FCF_DockUpdate()
if not pfUI.chat.right.panelTop:IsShown() then
pfUI.chat.right.panelTop:Show()
FCF_DockUpdate()
end
else
pfUI.chat.left.panelTop:Hide()
pfUI.chat.right.panelTop:Hide()
@@ -587,6 +559,9 @@ pfUI:RegisterModule("chat", function ()
end
for i=1, NUM_CHAT_WINDOWS do
-- ChatFrame_OnUpdate only blinks the flash of the bottom button hidden
-- below; the lines fade in the engine's own update
_G["ChatFrame" .. i]:SetScript("OnUpdate", nil)
_G["ChatFrame" .. i .. "UpButton"]:Hide()
_G["ChatFrame" .. i .. "UpButton"].Show = function() return end
_G["ChatFrame" .. i .. "DownButton"]:Hide()
@@ -732,6 +707,62 @@ pfUI:RegisterModule("chat", function ()
return pfUI_playerDB[name].level
end
-- the sender of the line AddMessage is reading, from its chat event
local lineSender, lineSenderClass, lineSenderRace, lineSenderSex
-- [ FormatPlayerLink ]
-- The gsub callback for a player link: the name in its class colour, with
-- the level and icons the settings ask for. Returns the link unchanged when
-- there is nothing to add, as a Lua 5.0 callback that returns nil deletes
-- the match.
local function FormatPlayerLink(link, name, shown)
local real = strsplit(":", name)
if shown ~= real then return link end
local color, icon = "", ""
if C.chat.text.classcolor == "1" then
local _, class, raceKey, sex
if lineSenderClass and real == lineSender then
class, raceKey, sex = lineSenderClass, lineSenderRace, lineSenderSex
else
_, class, _, raceKey, sex = C_PlayerCache.GetPlayerInfoByName(real)
end
if not class then
class = GetUnitInfo(real)
end
if class and class ~= UNKNOWN then
color = "|c" .. PFUI_CLASS_COLORS[class].colorStr
if C.chat.text.factionicons == "1" then
icon = GetFactionIcon(raceKey)
end
if C.chat.text.raceicons == "1" then
icon = icon .. GetRaceIcon(raceKey, sex)
end
elseif C.chat.text.tintunknown == "1" then
color = unknowncolorhex
end
end
local suffix = ""
local level = C.chat.text.playerlevel == "1" and GetPlayerLevel(real)
if level and level > 0 then
suffix = " " .. rgbhex(GetDifficultyColor(level)) .. level .. "|r"
elseif level then
-- Show ?? for unknown levels (e.g. -1 from UnitLevel)
suffix = " |cffff0000??|r"
end
if color == "" and suffix == "" then return link end
return left .. icon .. color .. "|Hplayer:" .. name .. "|h" .. color .. real .. "|h|r" .. suffix .. right
end
-- the timestamp of the current second
local stampTime, stamp
-- the last chat line read and what it became. A line shown in several
-- frames is read once: nothing in the result depends on the frame.
local lastLineID, lastText, lastResult
-- Passes every argument after the text on: GetMessageInfo returns them all,
-- and a hook that drops some loses them for every frame after it.
local function AddMessage(frame, text, ...)
@@ -744,76 +775,40 @@ pfUI:RegisterModule("chat", function ()
-- payload of the CHAT_MSG event printing this line; nil for lines
-- that don't come from one (system text, addon output, history)
local event, _, sender, _, _, _, _, _, _, _, _, _, guid = GetCurrentChatEvent()
local event, _, sender, _, _, _, _, _, _, _, _, lineID, guid = GetCurrentChatEvent()
-- Remove prat CLINKs
text = gsub(text, "{CLINK:(%x+):([%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-):([^}]-)}", "|c%1|Hitem:%2|h[%3]|h|r") -- tbc
text = gsub(text, "{CLINK:(%x+):([%d-]-:[%d-]-:[%d-]-:[%d-]-):([^}]-)}", "|c%1|Hitem:%2|h[%3]|h|r") -- vanilla
-- text emotes all have line 0
if lineID and lineID ~= 0 and lineID == lastLineID and text == lastText then
return frame:HookAddMessage(lastResult, ...)
end
local input = text
-- Remove chatter CLINKs
text = gsub(text, "{CLINK:item:(%x+):([%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-):([^}]-)}", "|c%1|Hitem:%2|h[%3]|h|r")
text = gsub(text, "{CLINK:enchant:(%x+):([%d-]-):([^}]-)}", "|c%1|Henchant:%2|h[%3]|h|r")
text = gsub(text, "{CLINK:spell:(%x+):([%d-]-):([^}]-)}", "|c%1|Hspell:%2|h[%3]|h|r")
text = gsub(text, "{CLINK:quest:(%x+):([%d-]-):([%d-]-):([^}]-)}", "|c%1|Hquest:%2:%3|h[%4]|h|r")
-- Remove prat and chatter CLINKs
if text:find("{CLINK:", 1, true) then
text = gsub(text, "{CLINK:(%x+):([%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-):([^}]-)}", "|c%1|Hitem:%2|h[%3]|h|r") -- tbc
text = gsub(text, "{CLINK:(%x+):([%d-]-:[%d-]-:[%d-]-:[%d-]-):([^}]-)}", "|c%1|Hitem:%2|h[%3]|h|r") -- vanilla
text = gsub(text, "{CLINK:item:(%x+):([%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-):([^}]-)}", "|c%1|Hitem:%2|h[%3]|h|r")
text = gsub(text, "{CLINK:enchant:(%x+):([%d-]-):([^}]-)}", "|c%1|Henchant:%2|h[%3]|h|r")
text = gsub(text, "{CLINK:spell:(%x+):([%d-]-):([^}]-)}", "|c%1|Hspell:%2|h[%3]|h|r")
text = gsub(text, "{CLINK:quest:(%x+):([%d-]-):([%d-]-):([^}]-)}", "|c%1|Hquest:%2:%3|h[%4]|h|r")
end
-- detect urls
if C.chat.text.detecturl == "1" then
-- detect urls; every pattern needs a dot between name characters or a "://"
if C.chat.text.detecturl == "1" and (text:find("[%w_-]%.[%w_-]") or text:find("://", 1, true)) then
text = pfUI.chat:HandleLink(text)
end
-- display class colors and player levels if already indexed
local classcolor = C.chat.text.classcolor == "1"
local playerlevel = C.chat.text.playerlevel == "1"
if classcolor or playerlevel then
if classcolor or C.chat.text.playerlevel == "1" then
-- the engine name-queries a chat sender before the event fires,
-- so the sender's GUID always resolves; other names in the text
-- fall back to the name-keyed lookups
local _, senderClass, senderRace, senderSex
lineSender, lineSenderClass, lineSenderRace, lineSenderSex = sender, nil, nil, nil
if classcolor and guid and guid ~= "" then
_, senderClass, _, senderRace, senderSex = GetPlayerInfoByGUID(guid)
end
for name in gfind(text, "|Hplayer:(.-)|h") do
local real, _ = strsplit(":", name)
local color, icon = "", ""
if classcolor then
local class, raceKey, sex
if senderClass and real == sender then
class, raceKey, sex = senderClass, senderRace, senderSex
else
_, class, _, raceKey, sex = C_PlayerCache.GetPlayerInfoByName(real)
end
if not class then
class = GetUnitInfo(real)
end
if class and class ~= UNKNOWN then
color = "|c" .. PFUI_CLASS_COLORS[class].colorStr
if C.chat.text.factionicons == "1" then
icon = GetFactionIcon(raceKey)
end
if C.chat.text.raceicons == "1" then
icon = icon .. GetRaceIcon(raceKey, sex)
end
elseif C.chat.text.tintunknown == "1" then
color = unknowncolorhex
end
end
local suffix = ""
local level = playerlevel and GetPlayerLevel(real)
if level and level > 0 then
suffix = " " .. rgbhex(GetDifficultyColor(level)) .. level .. "|r"
elseif level then
-- Show ?? for unknown levels (e.g. -1 from UnitLevel)
suffix = " |cffff0000??|r"
end
if color ~= "" or suffix ~= "" then
text = string.gsub(text, "|Hplayer:"..name.."|h%["..real.."%]|h(.-:-)",
left..icon..color.."|Hplayer:"..name.."|h" .. color .. real .. "|h|r"..suffix..right.."%1")
end
_, lineSenderClass, _, lineSenderRace, lineSenderSex = GetPlayerInfoByGUID(guid)
end
text = text:gsub("(|Hplayer:([^|]*)|h%[([^%]]*)%]|h)", FormatPlayerLink)
end
-- reduce channel name to number
@@ -823,9 +818,7 @@ pfUI:RegisterModule("chat", function ()
-- detect the whisper prefix BEFORE prepending a timestamp; the timestamp
-- pushes the whisper colour code off position 1 and the find below fails
local isWhisper = C.chat.global.whispermod == "1" and string.find(text, wcol, 1) == 1
if isWhisper then
if C.chat.global.whispermod == "1" and string.find(text, wcol, 1) == 1 then
-- patch incoming whisper string to match the colors, before the
-- timestamp so it keeps the form StripTimestamp looks for
text = string.gsub(text, "|r", "|r" .. wcol)
@@ -833,19 +826,66 @@ pfUI:RegisterModule("chat", function ()
-- show timestamp in chat
if C.chat.text.time == "1" then
text = timestampStart .. date(C.chat.text.timeformat) .. timestampEnd .. text
end
-- save chat history
if isWhisper then
SaveChatHistory(frame:GetID(), string.gsub(text, wcol, ""), cr, cg, cb)
else
SaveChatHistory(frame:GetID(), text, ...)
local now = time()
if now ~= stampTime then
stampTime, stamp = now, timestampStart .. date(C.chat.text.timeformat) .. timestampEnd
end
text = stamp .. text
end
lastLineID, lastText, lastResult = lineID, input, text
frame:HookAddMessage(text, ...)
end
-- [ Chat History ]
-- The newest lines of each chat frame, kept per character and written back
-- at login, newest first and dimmed. They are read from the frames when
-- leaving the world, which logout and reload both do before the saved
-- variables are written.
local HISTORY_LINES = 30
local function GetChatHistory()
local realm, player = GetRealmName(), UnitName("player")
pfUI_cache["chathistory"] = pfUI_cache["chathistory"] or {}
pfUI_cache["chathistory"][realm] = pfUI_cache["chathistory"][realm] or {}
pfUI_cache["chathistory"][realm][player] = pfUI_cache["chathistory"][realm][player] or {}
return pfUI_cache["chathistory"][realm][player]
end
-- a line dimmed in its colour, which also comes back after every |r in it
local function DimHistoryLine(text, r, g, b)
local color = rgbhex(r*.5+.2, g*.5+.2, b*.5+.2)
return color .. text:gsub("|r", "|r" .. color)
end
local function SaveChatHistory()
local history = GetChatHistory()
for i=1, NUM_CHAT_WINDOWS do
local frame = _G["ChatFrame"..i]
if not frame.pfCombatLog then
local lines = {}
local num = frame:GetNumMessages()
for index = num, math.max(1, num - HISTORY_LINES + 1), -1 do
local text, r, g, b, _, restored = frame:GetMessageInfo(index)
-- lines written back from the history are dimmed already
if not restored then
-- an incoming whisper is in the whisper colour, not its own
if C.chat.global.whispermod == "1" and pfUI.chat.StripTimestamp(text):sub(1, #wcol) == wcol then
text, r, g, b = text:gsub(wcol, ""), cr, cg, cb
end
text = DimHistoryLine(text, r, g, b)
end
table.insert(lines, text)
end
history[i] = lines
end
end
end
if C.chat.text.history == "1" then
pfUI.events:RegisterFrameEventAndCallback("PLAYER_LEAVING_WORLD", SaveChatHistory)
end
for i=1,NUM_CHAT_WINDOWS do
if C.chat.global.maxlines ~= "128" then
_G["ChatFrame"..i]:SetMaxLines(tonumber(C.chat.global.maxlines) or 128)
@@ -853,13 +893,14 @@ pfUI:RegisterModule("chat", function ()
if not _G["ChatFrame"..i].HookAddMessage then
if C.chat.text.history == "1" then
-- write history to chat, newest first, above the lines already there
for _, msg in ipairs(GetChatHistory(i)) do
_G["ChatFrame"..i]:BackFillMessage(msg, .7,.7,.7)
-- write history to chat, newest first, above the lines already there;
-- after the colour come the id slot and the mark SaveChatHistory reads
for _, msg in ipairs(GetChatHistory()[i] or {}) do
_G["ChatFrame"..i]:BackFillMessage(msg, .7,.7,.7, nil, true)
end
end
-- add chat parse and history hooks
-- add chat parse hooks
_G["ChatFrame"..i].HookAddMessage = _G["ChatFrame"..i].AddMessage
_G["ChatFrame"..i].AddMessage = AddMessage
end
+8 -2
View File
@@ -85,10 +85,16 @@ pfUI:RegisterModule("chatcopy", function ()
scroll:SetFont(frame:GetFont())
scroll:SetText(text)
-- the cursor at the end scrolls the box to the newest line
scroll:SetFocus()
scroll:SetCursorPosition(#text)
-- the edit box lays the text out in this frame's update, so scroll to
-- the newest line after it; the caret only scrolls the focused box
RunNextFrame(function()
local scrollBox = scroll:GetScrollBox()
scrollBox:FullUpdate(ScrollBoxConstants.UpdateImmediately)
scrollBox:ScrollToEnd(ScrollBoxConstants.NoScrollInterpolation)
end)
end)
frame.scroll = scroll
+21 -166
View File
@@ -1669,115 +1669,6 @@ pfUI:RegisterModule("gui", function ()
local header = CreateConfig(nil, T["Nameplate Update Rate"], nil, nil, "header")
header:GetParent().objectCount = header:GetParent().objectCount - 1
header:SetHeight(20)
local targetCustom -- declare first so callback can use it
CreateConfig(function()
-- Callback when dropdown changes - update custom field immediately
if targetCustom and targetCustom.input then
local isCustom = pfUI.throttle:IsCustom("nameplates_target")
if not isCustom then
-- Preset selected - show FPS from preset, make readonly
targetCustom.input:EnableMouse(false)
targetCustom.input:EnableKeyboard(false)
targetCustom.input:ClearFocus()
targetCustom.input:SetTextColor(.5,.5,.5,1)
targetCustom.input:SetText(tostring(pfUI.throttle:GetFps("nameplates_target")))
else
-- Custom selected - make editable
targetCustom.input:EnableMouse(true)
targetCustom.input:EnableKeyboard(true)
targetCustom.input:SetTextColor(.2,1,.8,1)
if _G.pfUI_throttle.nameplates_target_custom then
targetCustom.input:SetText(_G.pfUI_throttle.nameplates_target_custom)
end
end
end
end, T["Target Plates"], _G.pfUI_throttle, "nameplates_target", "dropdown", {
"very_slow:" .. T["Very Slow"] .. " (2 FPS)",
"slow:" .. T["Slow"] .. " (5 FPS)",
"normal:" .. T["Normal"] .. " (10 FPS)",
"fast:" .. T["Fast"] .. " (20 FPS)",
"very_fast:" .. T["Very Fast"] .. " (30 FPS)",
"fastest:" .. T["Fastest"] .. " (50 FPS)",
"custom:" .. T["Custom"],
})
-- Now create custom field AFTER dropdown
targetCustom = CreateConfig(nil, T["Custom FPS"], _G.pfUI_throttle, "nameplates_target_custom")
-- Set initial state
local isCustom = pfUI.throttle:IsCustom("nameplates_target")
if not isCustom then
targetCustom.input:EnableMouse(false)
targetCustom.input:EnableKeyboard(false)
targetCustom.input:SetTextColor(.5,.5,.5,1)
targetCustom.input:SetText(tostring(pfUI.throttle:GetFps("nameplates_target")))
else
targetCustom.input:EnableMouse(true)
targetCustom.input:EnableKeyboard(true)
targetCustom.input:SetTextColor(.2,1,.8,1)
if _G.pfUI_throttle.nameplates_target_custom then
targetCustom.input:SetText(_G.pfUI_throttle.nameplates_target_custom)
end
end
-- Spacer after custom field
local spacer1 = CreateConfig(nil, " ", nil, nil, "header")
spacer1:GetParent().objectCount = spacer1:GetParent().objectCount - 1
spacer1:SetHeight(5)
local normalCustom
CreateConfig(function()
if normalCustom and normalCustom.input then
local isCustom = pfUI.throttle:IsCustom("nameplates")
if not isCustom then
normalCustom.input:EnableMouse(false)
normalCustom.input:EnableKeyboard(false)
normalCustom.input:ClearFocus()
normalCustom.input:SetTextColor(.5,.5,.5,1)
normalCustom.input:SetText(tostring(pfUI.throttle:GetFps("nameplates")))
else
normalCustom.input:EnableMouse(true)
normalCustom.input:EnableKeyboard(true)
normalCustom.input:SetTextColor(.2,1,.8,1)
if _G.pfUI_throttle.nameplates_custom then
normalCustom.input:SetText(_G.pfUI_throttle.nameplates_custom)
end
end
end
end, T["Normal Plates"], _G.pfUI_throttle, "nameplates", "dropdown", {
"very_slow:" .. T["Very Slow"] .. " (2 FPS)",
"slow:" .. T["Slow"] .. " (5 FPS)",
"normal:" .. T["Normal"] .. " (10 FPS)",
"fast:" .. T["Fast"] .. " (20 FPS)",
"very_fast:" .. T["Very Fast"] .. " (30 FPS)",
"fastest:" .. T["Fastest"] .. " (50 FPS)",
"custom:" .. T["Custom"],
})
normalCustom = CreateConfig(nil, T["Custom FPS"], _G.pfUI_throttle, "nameplates_custom")
local isCustom2 = pfUI.throttle:IsCustom("nameplates")
if not isCustom2 then
normalCustom.input:EnableMouse(false)
normalCustom.input:EnableKeyboard(false)
normalCustom.input:SetTextColor(.5,.5,.5,1)
normalCustom.input:SetText(tostring(pfUI.throttle:GetFps("nameplates")))
else
normalCustom.input:EnableMouse(true)
normalCustom.input:EnableKeyboard(true)
normalCustom.input:SetTextColor(.2,1,.8,1)
if _G.pfUI_throttle.nameplates_custom then
normalCustom.input:SetText(_G.pfUI_throttle.nameplates_custom)
end
end
-- Spacer after custom field
local spacer2 = CreateConfig(nil, " ", nil, nil, "header")
spacer2:GetParent().objectCount = spacer2:GetParent().objectCount - 1
spacer2:SetHeight(5)
local castbarCustom
@@ -1811,71 +1702,30 @@ pfUI:RegisterModule("gui", function ()
castbarCustom = CreateConfig(nil, T["Custom FPS"], _G.pfUI_throttle, "nameplates_castbar_custom")
local spacer3 = CreateConfig(nil, " ", nil, nil, "header")
spacer3:GetParent().objectCount = spacer3:GetParent().objectCount - 1
spacer3:SetHeight(5)
local massCustom
CreateConfig(function()
if massCustom and massCustom.input then
local isCustom = pfUI.throttle:IsCustom("nameplates_mass")
if not isCustom then
massCustom.input:EnableMouse(false)
massCustom.input:EnableKeyboard(false)
massCustom.input:ClearFocus()
massCustom.input:SetTextColor(.5,.5,.5,1)
massCustom.input:SetText(tostring(pfUI.throttle:GetFps("nameplates_mass")))
else
massCustom.input:EnableMouse(true)
massCustom.input:EnableKeyboard(true)
massCustom.input:SetTextColor(.2,1,.8,1)
if _G.pfUI_throttle.nameplates_mass_custom then
massCustom.input:SetText(_G.pfUI_throttle.nameplates_mass_custom)
end
end
end
end, T["Mass Pulls (20+ Plates)"], _G.pfUI_throttle, "nameplates_mass", "dropdown", {
"very_slow:" .. T["Very Slow"] .. " (2 FPS)",
"slow:" .. T["Slow"] .. " (5 FPS)",
"normal:" .. T["Normal"] .. " (10 FPS)",
"fast:" .. T["Fast"] .. " (20 FPS)",
"very_fast:" .. T["Very Fast"] .. " (30 FPS)",
"fastest:" .. T["Fastest"] .. " (50 FPS)",
"custom:" .. T["Custom"],
})
massCustom = CreateConfig(nil, T["Custom FPS"], _G.pfUI_throttle, "nameplates_mass_custom")
local isCustom3 = pfUI.throttle:IsCustom("nameplates_mass")
if not isCustom3 then
massCustom.input:EnableMouse(false)
massCustom.input:EnableKeyboard(false)
massCustom.input:SetTextColor(.5,.5,.5,1)
massCustom.input:SetText(tostring(pfUI.throttle:GetFps("nameplates_mass")))
local isCustom = pfUI.throttle:IsCustom("nameplates_castbar")
if not isCustom then
castbarCustom.input:EnableMouse(false)
castbarCustom.input:EnableKeyboard(false)
castbarCustom.input:SetTextColor(.5,.5,.5,1)
castbarCustom.input:SetText(tostring(pfUI.throttle:GetFps("nameplates_castbar")))
else
massCustom.input:EnableMouse(true)
massCustom.input:EnableKeyboard(true)
massCustom.input:SetTextColor(.2,1,.8,1)
if _G.pfUI_throttle.nameplates_mass_custom then
massCustom.input:SetText(_G.pfUI_throttle.nameplates_mass_custom)
castbarCustom.input:EnableMouse(true)
castbarCustom.input:EnableKeyboard(true)
castbarCustom.input:SetTextColor(.2,1,.8,1)
if _G.pfUI_throttle.nameplates_castbar_custom then
castbarCustom.input:SetText(_G.pfUI_throttle.nameplates_castbar_custom)
end
end
-- Spacer before reset button
local spacer = CreateConfig(nil, " ", nil, nil, "header")
spacer:GetParent().objectCount = spacer:GetParent().objectCount - 1
spacer:SetHeight(10)
-- Reset to defaults button
CreateConfig(nil, T["Reset to Defaults"], nil, nil, "button", function()
pfUI.throttle:ResetToDefault("nameplates_target")
pfUI.throttle:ResetToDefault("nameplates")
pfUI.throttle:ResetToDefault("nameplates_mass")
-- Also reset custom fields to their default FPS values
_G.pfUI_throttle.nameplates_target_custom = "50"
_G.pfUI_throttle.nameplates_custom = "10"
_G.pfUI_throttle.nameplates_mass_custom = "7"
pfUI.throttle:ResetToDefault("nameplates_castbar")
_G.pfUI_throttle.nameplates_castbar_custom = "100"
Reload()
end, true)
end)
@@ -2294,6 +2144,7 @@ pfUI:RegisterModule("gui", function ()
CreateConfig(U["raid"], T["Raid Padding"], C.unitframes[c], "raidpadding")
CreateConfig(U["raid"], T["Raid Layout"], C.unitframes[c], "raidlayout", "dropdown", pfUI.gui.dropdowns.uf_raidlayout)
CreateConfig(U["raid"], T["Raid Fill Direction"], C.unitframes[c], "raidfill", "dropdown", pfUI.gui.dropdowns.orientation)
CreateConfig(U["raid"], T["Grow Right To Left"], C.unitframes[c], "raidgrowleft", "checkbox")
CreateConfig(U["raid"], T["Collapse Empty Slots"], C.unitframes[c], "collapse", "checkbox")
elseif c == "raidpet" then
CreateConfig(U[c], T["Layout"], nil, nil, "header")
@@ -2360,6 +2211,8 @@ pfUI:RegisterModule("gui", function ()
CreateConfig(U[c], T["Buff Limit"], C.unitframes[c], "bufflimit")
CreateConfig(U[c], T["Buffs Per Row"], C.unitframes[c], "buffperrow")
CreateConfig(U[c], T["Own Buff Size"], C.unitframes[c], "ownbuffsize")
CreateConfig(U[c], T["Buff X-Offset"], C.unitframes[c], "buffoffx")
CreateConfig(U[c], T["Buff Y-Offset"], C.unitframes[c], "buffoffy")
CreateConfig(U[c], T["Buff X-Spacing"], C.unitframes[c], "buffspacingx")
CreateConfig(U[c], T["Buff Y-Spacing"], C.unitframes[c], "buffspacingy")
@@ -2369,6 +2222,8 @@ pfUI:RegisterModule("gui", function ()
CreateConfig(U[c], T["Debuff Limit"], C.unitframes[c], "debufflimit")
CreateConfig(U[c], T["Debuffs Per Row"], C.unitframes[c], "debuffperrow")
CreateConfig(U[c], T["Own Debuff Size"], C.unitframes[c], "owndebuffsize")
CreateConfig(U[c], T["Debuff X-Offset"], C.unitframes[c], "debuffoffx")
CreateConfig(U[c], T["Debuff Y-Offset"], C.unitframes[c], "debuffoffy")
CreateConfig(U[c], T["Debuff X-Spacing"], C.unitframes[c], "debuffspacingx")
CreateConfig(U[c], T["Debuff Y-Spacing"], C.unitframes[c], "debuffspacingy")
@@ -3084,4 +2939,4 @@ pfUI:RegisterModule("gui", function ()
end
end)
end
end)
end)
+1222 -1439
View File
File diff suppressed because it is too large Load Diff
+16 -22
View File
@@ -30,8 +30,8 @@ pfUI:RegisterModule("raid", function ()
-- flat pool of pet frames, laid out by LayoutPets (mirror or collapsed)
pfUI.uf.raid.pets = {}
-- 1-based grid slot -> (row, col) for the current fill direction, matching
-- the raid grid's own fill loops.
-- 1-based grid slot -> (col, row) for the current fill direction, shared by
-- the raid and pet grids.
local function SlotToCoord(slot, fill, x, y)
slot = slot - 1
if fill == "VERTICAL" then
@@ -75,12 +75,12 @@ pfUI:RegisterModule("raid", function ()
end
end
local i = 1
local width = pfUI.uf.raid[1]:GetWidth()+2*default_border
local height = pfUI.uf.raid[1]:GetHeight()+2*default_border
local layout = pfUI.uf.raid[1].config.raidlayout
local padding = tonumber(pfUI.uf.raid[1].config.raidpadding)*GetPerfectPixel()
local fill = pfUI.uf.raid[1].config.raidfill
local growleft = pfUI.uf.raid[1].config.raidgrowleft == "1"
local _, _, x, y = string.find(layout,"(.+)x(.+)")
x, y = tonumber(x), tonumber(y)
@@ -95,24 +95,18 @@ pfUI:RegisterModule("raid", function ()
}
end
if fill == "VERTICAL" then
for r=1, x do for g=1, y do
if pfUI.uf.raid[i] then
pfUI.uf.raid[i]:ClearAllPoints()
pfUI.uf.raid[i]:SetPoint("BOTTOMLEFT", (r-1)*(padding+width), (g-1)*(padding+height))
UpdateMovable(pfUI.uf.raid[i], true)
end
i = i + 1
end end
else
for g=1, y do for r=1, x do
if pfUI.uf.raid[i] then
pfUI.uf.raid[i]:ClearAllPoints()
pfUI.uf.raid[i]:SetPoint("BOTTOMLEFT", (r-1)*(padding+width), (g-1)*(padding+height))
UpdateMovable(pfUI.uf.raid[i], true)
end
i = i + 1
end end
-- right to left mirrors across the columns maxraid can fill, so a smaller
-- raid stays next to the anchor instead of the far edge of the layout
local cols = min(x, fill == "VERTICAL" and ceil(maxraid / y) or maxraid)
for i=1, x*y do
if pfUI.uf.raid[i] then
local r, g = SlotToCoord(i, fill, x, y)
if growleft then r = cols - r + 1 end
pfUI.uf.raid[i]:ClearAllPoints()
pfUI.uf.raid[i]:SetPoint("BOTTOMLEFT", (r-1)*(padding+width), (g-1)*(padding+height))
UpdateMovable(pfUI.uf.raid[i], true)
end
end
self:LayoutPets()
@@ -303,4 +297,4 @@ pfUI:RegisterModule("raid", function ()
pfUI.uf.raid:QueueUpdate(0)
end
end)
end)
end)