18 Commits
Author SHA1 Message Date
Brues d02fcaa8ee We no longer use these features from SuperWoW/Nampower 2026-07-31 21:47:00 -05:00
Brues 5dd42a8d86 Drive nameplate castbars off UNIT_SPELLCAST_*
ClassicAPI now fires UNIT_SPELLCAST_* for nameplate tokens, so populate the
per-GUID castState cache from UNIT_SPELLCAST_{START,CHANNEL_START} (poll
PollCastInfo for the timing the payload omits) and clear it on
{STOP,CHANNEL_STOP} -- the remote poll fires STOP for natural end, interrupt,
and cancel alike. Replaces the nampower SPELL_{START,FAILED}_OTHER path; the
^nameplate arg1 gate ignores the target/focus/party fires of the same events,
and the NAME_PLATE_UNIT_ADDED seed still catches a plate spawning mid-cast.
Nameplate cast detection is now nampower-free.
2026-07-31 18:11:18 -05:00
Brues 1a342adfca Route target/focus castbars through remote UNIT_SPELLCAST_*
ClassicAPI now fires UNIT_SPELLCAST_* for remote tokens (target/focus/...)
via PollRemote, so drop the nampower SPELL_*_OTHER path and drive all three
bars off one event model. The gate is now token-based (arg1 == this.unitstr,
plus the arg1=="player" + UnitIsUnit case for target=self); the RunNextFrame
defer is gone since the remote poll fires after UnitCastingInfo is readable.
Cast detection is now nampower-free across every bar.

Use the event's rank payload (arg5): thread it through RefreshBar into
StampBar, which now only calls C_Spell.GetSpellSubtext as a fallback on the
retarget re-poll (PLAYER_TARGET/FOCUS_CHANGED) where no event is in hand.
2026-07-31 18:04:50 -05:00
Brues 892b48e60f Migrate player castbar to ClassicAPI UNIT_SPELLCAST_* events
Drive the player cast path off ClassicAPI's synthesized, player-only
UNIT_SPELLCAST_* events instead of the vanilla SPELLCAST_* plus nampower
SPELL_{START,GO,DELAYED}_SELF mix. START/CHANNEL_START poll UnitCastingInfo/
UnitChannelInfo and stamp; STOP/CHANNEL_STOP/FAILED/INTERRUPTED clear;
SUCCEEDED drives tradeskill craft counting; DELAYED/CHANNEL_UPDATE re-poll.
Since UNIT_SPELLCAST_START fires for chained same-spell recasts, the nampower
SELF deps and their RunNextFrame co-hook-ordering workarounds are gone.
Remote target/focus bars keep SPELL_*_OTHER (the new events are player-only).

Fix the cast-start flash: StampBar now primes the fill on the stamp frame,
and ClearBar no longer snaps the bar to full (that snap lingered in the fade
tail and flashed when the next cast stamped).

Add a red flash on a cancelled cast: new appearance.castbar.failcolor,
flashed by ClearBar only when a cast was actually in progress.

Handle pushback Quartz-style: DELAYED/CHANNEL_UPDATE re-poll just the times
and accumulate the endMs shift into this.delay for the +/- indicator (cast
+X, channel -X), rather than a full restamp.
2026-07-31 13:22:36 -05:00
Brues c994d00596 Toggle bagslots visibility via SetShown
Replace explicit if/else calling :Hide()/:Show() with :SetShown(not IsShown())
2026-07-31 13:22:17 -05:00
Brues 4be680183a Use GetSize/SetSize for size operations
Replace separate GetWidth/GetHeight and SetWidth/SetHeight calls with GetSize/SetSize for consistency and brevity. Updated modules: addonbuttons (store size via GetSize), chatcopy (use SetSize), easteregg (use SetSize for explosions), farmmode (use GetSize/SetSize when adjusting map size), and game_menu (use GetSize/SetSize when resizing frame).
2026-07-30 14:29:30 -05:00
Brues 2352f1c6ed Use GetSize/SetSize for map frame and buttons
Replace separate GetWidth/GetHeight and SetWidth/SetHeight calls with GetSize and SetSize in modules/map.lua.
2026-07-30 14:11:34 -05:00
Brues 305ff6c86e Collapse frameState.hasTarget into targetGuid
hasTarget was always snapshotted alongside targetGuid (UnitExists("target")
next to UnitGUID("target")), so it was just targetGuid ~= nil. Drop the
field and derive it from targetGuid at both read sites; remove the now-unused
UnitExists perf-cache local.
2026-07-30 13:45:53 -05:00
Brues a8b131898b Event-drive nameplate target state; drop per-tick poll and targetPlateGuid
frameState.hasTarget/targetGuid were polled via UnitExists("target") every
central-loop tick, while targetPlateGuid held the same guid but was already
event-driven -- redundant. Set frameState target fields in PLAYER_TARGET_CHANGED
(seeded on PLAYER_ENTERING_WORLD for a target held across reload), remove the
poll, and collapse targetPlateGuid into frameState.targetGuid (the castbar
frame now reads that). The central loop's only remaining per-tick poll is
GetTime().
2026-07-30 11:59:56 -05:00
Brues 1f9be33772 Use GetStringColorObject for buffbar colors; numeric border check
Store the buffbar color/bordercolor/textcolor as cached read-only ColorMixins
via GetStringColorObject instead of building per-bar {r,g,b,a} tables from
GetStringColor. These color tables are only ever read (SetStatusBarColor /
SetTextColor / the border check), so sharing the cached objects is safe and
drops the intermediate locals and per-bar allocations.

GetStringColorObject's components are numbers, so fix CreateBuffBarFrame's
border check from ~= "0" (string) to ~= 0.
2026-07-30 02:44:56 -05:00
Brues a798e67b7f Use GetStringColor for buffbar color parsing
Route the three buffbar color config splits through GetStringColor (cached)
instead of bare strsplit. GetStringColor returns strings, so this is
behavior-preserving -- including the bordercolor ~= "0" check in
CreateBuffBarFrame -- and just adds the shared color cache and consistency
with the rest of the codebase.
2026-07-30 02:39:56 -05:00
Brues 8b87e30266 Revert GetStringColor to strings; keep object numeric; tidy cmatch
- GetStringColor returns strings again (its lifelong contract). The earlier
  numeric conversion was a return-type change that could break any caller
  doing string comparisons on components (e.g. buffwatch's `~= "0"`); every
  caller was written against strings and color setters coerce, so reverting
  is the safe fix without a codebase-wide audit.
- GetStringColorObject now tonumbers its own inputs, so its ColorMixin stays
  numerically correct (GenerateHexColor/IsEqualTo) independent of the above.
- cmatch: move its a-e / va-ve / ra-re scratch out of module scope into clear
  function-locals (idx*/val*/out*). Strict 1:1 rename, logic unchanged; also
  drops the shared-upvalue reentrancy concern.
2026-07-30 02:39:16 -05:00
Brues f68b14e53b Use SetSize instead of SetWidth/SetHeight
Replaced numerous SetWidth/SetHeight calls with SetSize for consistency and brevity across UI code. Touched api/ui-widgets.lua, api/unitframes.lua and multiple modules (actionbar, addonbuttons, addons, afkcam, autovendor, bags, bgscore, buff, buffwatch, nameplates). Also simplified some sizing math in buff module. No functional behavior intended to change — code modernization only.
2026-07-30 02:27:03 -05:00
Brues 8ab6fab04f Event-drive nameplate mouseover via UPDATE_MOUSEOVER_UNIT
ClassicAPI polyfills UPDATE_MOUSEOVER_UNIT to fire on mouseover loss as well
as gain (src/unit/Mouseover.cpp), so the per-tick UnitGUID("mouseover") poll
in the central loop is no longer needed. Update frameState.mouseoverGuid on
the event and flag just the plates losing/gaining hover (via plateByGuid,
which holds overlays) for an immediate refresh.
2026-07-30 02:01:10 -05:00
Brues 6d1bfe805e Use UnitClassBase for class detection 2026-07-30 01:26:29 -05:00
Brues 838f7f5d25 guard against nil units
UPDATE_MOUSEOVER_UNIT can fire when unit is dropped now so guard against that
2026-07-30 01:20:50 -05:00
Brues fad078fa87 Drop dead GUID-label branch in unit frame OnEnter
No unit frame ever has a GUID label -- CreateUnitFrame is only ever called
with fixed type names (Player/Target/Focus/Party/Raid/...), and .label is only
ever assigned those. The string.find(this.label, "^0x") branch was a leftover
from an older focus implementation; focus now uses the real "focus" unit
token, so OnEnter always resolves the mouseover via the normal unitstr path.
2026-07-30 01:09:53 -05:00
Brues 48d76138ed Iterate active nameplates only; fix global eventcache propagation
- The central OnUpdate looped the entire plate pool (registry) every tick with
  an IsVisible guard. Maintain a visiblePlates set via NAME_PLATE_UNIT_ADDED/
  _REMOVED and iterate that instead, so hidden pool slots aren't touched. The
  IsVisible guard stays as a safety net.
- Fix the global refresh propagation: it set .eventcache on the base frame,
  but OnUpdate reads/clears it on the overlay (nameplate) -- so the propagation
  was a no-op and global refreshes (e.g. target-change alpha/strata) fell
  through to the 0.5s catch-all timer. Set plate.nameplate.eventcache and scope
  to visiblePlates, so those refreshes land on the next tick as intended.

OnConfigChange still iterates the full registry (hidden plates must pick up
config changes before they next show).
2026-07-29 23:43:27 -05:00
35 changed files with 343 additions and 449 deletions
-3
View File
@@ -41,7 +41,6 @@ Provides:
### [SuperWoW](https://github.com/balakethelock/SuperWoW) ### [SuperWoW](https://github.com/balakethelock/SuperWoW)
Provides: Provides:
- UnitPosition for distance calculations
- SetMouseoverUnit for improved targeting - SetMouseoverUnit for improved targeting
### [Nampower](https://github.com/brues-code/nampower) ### [Nampower](https://github.com/brues-code/nampower)
@@ -49,8 +48,6 @@ Provides:
Provides: Provides:
- Spell queue indicator - Spell queue indicator
- GCD indicator - GCD indicator
- Reactive spell detection
- Enhanced cast information
### [UnitXP_SP3](https://codeberg.org/konaka/UnitXP_SP3) ### [UnitXP_SP3](https://codeberg.org/konaka/UnitXP_SP3)
+15 -19
View File
@@ -231,7 +231,7 @@ end
-- unit [string] the unitstring -- unit [string] the unitstring
-- return: [table] string, r, g, b -- return: [table] string, r, g, b
function pfUI.api.GetUnitColor(unitstr) function pfUI.api.GetUnitColor(unitstr)
local _, class = UnitClass(unitstr) local class = UnitClassBase(unitstr)
local classColor = PFUI_CLASS_COLORS[class] local classColor = PFUI_CLASS_COLORS[class]
return classColor:GenerateHexColorMarkup(), classColor:GetRGB() return classColor:GenerateHexColorMarkup(), classColor:GetRGB()
end end
@@ -377,22 +377,20 @@ end
-- 'str' [string] input string that should be matched -- 'str' [string] input string that should be matched
-- 'pat' [string] unformatted pattern -- 'pat' [string] unformatted pattern
-- returns: [strings] matched string in capture order -- returns: [strings] matched string in capture order
local a, b, c, d, e
local _, va, vb, vc, vd, ve
local ra, rb, rc, rd, re
function pfUI.api.cmatch(str, pat) function pfUI.api.cmatch(str, pat)
-- read capture indexes -- idx* = the logical %N index of each physical capture slot (nil when the
a, b, c, d, e = GetCaptures(pat) -- pattern has no %N$ markers); val* = the matched values in physical order.
_, _, va, vb, vc, vd, ve = string.find(str, pfUI.api.SanitizePattern(pat)) local idx1, idx2, idx3, idx4, idx5 = GetCaptures(pat)
local _, _, val1, val2, val3, val4, val5 = string.find(str, pfUI.api.SanitizePattern(pat))
-- put entries into the proper return values -- reorder the physical matches into logical (%1..%5) order
ra = e == 1 and ve or d == 1 and vd or c == 1 and vc or b == 1 and vb or va local out1 = idx5 == 1 and val5 or idx4 == 1 and val4 or idx3 == 1 and val3 or idx2 == 1 and val2 or val1
rb = e == 2 and ve or d == 2 and vd or c == 2 and vc or a == 2 and va or vb local out2 = idx5 == 2 and val5 or idx4 == 2 and val4 or idx3 == 2 and val3 or idx1 == 2 and val1 or val2
rc = e == 3 and ve or d == 3 and vd or a == 3 and va or b == 3 and vb or vc local out3 = idx5 == 3 and val5 or idx4 == 3 and val4 or idx1 == 3 and val1 or idx2 == 3 and val2 or val3
rd = e == 4 and ve or a == 4 and va or c == 4 and vc or b == 4 and vb or vd local out4 = idx5 == 4 and val5 or idx1 == 4 and val1 or idx3 == 4 and val3 or idx2 == 4 and val2 or val4
re = a == 5 and va or d == 5 and vd or c == 5 and vc or b == 5 and vb or ve local out5 = idx1 == 5 and val1 or idx4 == 5 and val4 or idx3 == 5 and val3 or idx2 == 5 and val2 or val5
return ra, rb, rc, rd, re return out1, out2, out3, out4, out5
end end
-- [ GetItemLinkByName ] -- [ GetItemLinkByName ]
@@ -997,13 +995,10 @@ end
-- [ GetStringColor ] -- [ GetStringColor ]
-- Queries the pfUI setting strings and extract its color codes -- Queries the pfUI setting strings and extract its color codes
-- returns r,g,b,a as numbers -- returns r,g,b,a as strings
local color_cache = setmetatable({}, { local color_cache = setmetatable({}, {
__index = function(t, k) __index = function(t, k)
local color = { pfUI.api.strsplit(",", k) } local color = { pfUI.api.strsplit(",", k) }
for i = 1, table.getn(color) do
color[i] = tonumber(color[i])
end
rawset(t, k, color) rawset(t, k, color)
return color return color
end end
@@ -1018,7 +1013,8 @@ end
-- returns a ColorMixin -- returns a ColorMixin
local color_object_cache = setmetatable({}, { local color_object_cache = setmetatable({}, {
__index = function(t, k) __index = function(t, k)
local color = CreateColor(pfUI.api.GetStringColor(k)) local r,g,b,a = pfUI.api.GetStringColor(k)
local color = CreateColor(tonumber(r), tonumber(g), tonumber(b), tonumber(a))
rawset(t, k, color) rawset(t, k, color)
return color return color
end end
+1
View File
@@ -155,6 +155,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("appearance", "cd", "dynamicsize", "1") pfUI:UpdateConfig("appearance", "cd", "dynamicsize", "1")
pfUI:UpdateConfig("appearance", "castbar", "castbarcolor", ".7,.7,.9,.8") pfUI:UpdateConfig("appearance", "castbar", "castbarcolor", ".7,.7,.9,.8")
pfUI:UpdateConfig("appearance", "castbar", "channelcolor", ".9,.9,.7,.8") pfUI:UpdateConfig("appearance", "castbar", "channelcolor", ".9,.9,.7,.8")
pfUI:UpdateConfig("appearance", "castbar", "failcolor", "1,.2,.2,.8")
pfUI:UpdateConfig("appearance", "castbar", "texture", "Interface\\AddOns\\pfUI\\img\\bar") pfUI:UpdateConfig("appearance", "castbar", "texture", "Interface\\AddOns\\pfUI\\img\\bar")
pfUI:UpdateConfig("appearance", "infight", "screen", "0") pfUI:UpdateConfig("appearance", "infight", "screen", "0")
pfUI:UpdateConfig("appearance", "infight", "aggro", "0") pfUI:UpdateConfig("appearance", "infight", "aggro", "0")
+1 -2
View File
@@ -895,8 +895,7 @@ function pfUI.api.SkinDropDown(frame, cr, cg, cb, useSmall)
CreateBackdrop(button) CreateBackdrop(button)
button.backdrop:ClearAllPoints() button.backdrop:ClearAllPoints()
button.backdrop:SetWidth(18) button.backdrop:SetSize(18, 18)
button.backdrop:SetHeight(18)
button.backdrop:SetPoint("RIGHT", frame.backdrop, "RIGHT", -2, 0) button.backdrop:SetPoint("RIGHT", frame.backdrop, "RIGHT", -2, 0)
if not button.icon then if not button.icon then
+15 -30
View File
@@ -397,8 +397,7 @@ function pfUI.uf:UpdateConfig()
f.power:ClearAllPoints() f.power:ClearAllPoints()
f.power:SetPoint(f.config.panchor, f.hp, relative_point, f.config.poffx, -2 * default_border - spacing + f.config.poffy * GetPerfectPixel()) f.power:SetPoint(f.config.panchor, f.hp, relative_point, f.config.poffx, -2 * default_border - spacing + f.config.poffy * GetPerfectPixel())
f.power:SetWidth((f.config.pwidth ~= "-1" and f.config.pwidth or f.config.width)) f.power:SetSize((f.config.pwidth ~= "-1" and f.config.pwidth or f.config.width), f.config.pheight)
f.power:SetHeight(f.config.pheight)
if tonumber(f.config.pheight) < 0 then f.power:Hide() end if tonumber(f.config.pheight) < 0 then f.power:Hide() end
pfUI.api.CreateBackdrop(f.power, default_border) pfUI.api.CreateBackdrop(f.power, default_border)
@@ -790,8 +789,7 @@ function pfUI.uf:UpdateConfig()
f.debuffs[i]:SetFrameLevel(12) f.debuffs[i]:SetFrameLevel(12)
f.debuffs[i]:RegisterForClicks("RightButtonUp") f.debuffs[i]:RegisterForClicks("RightButtonUp")
f.debuffs[i]:ClearAllPoints() f.debuffs[i]:ClearAllPoints()
f.debuffs[i]:SetWidth(f.config.debuffsize) f.debuffs[i]:SetSize(f.config.debuffsize, f.config.debuffsize)
f.debuffs[i]:SetHeight(f.config.debuffsize)
f.debuffs[i]:SetNormalTexture(nil) f.debuffs[i]:SetNormalTexture(nil)
-- Create CD frame if it doesn't exist -- Create CD frame if it doesn't exist
@@ -1182,15 +1180,9 @@ end
function pfUI.uf.OnEnter() function pfUI.uf.OnEnter()
if not this.label then return end if not this.label then return end
-- Nampower: Set native mouseover unit for macro/addon compatibility local unitstr = this.label .. this.id
if SetMouseoverUnit then if UnitExists(unitstr) then
local unitstr = this.label .. this.id SetMouseoverUnit(unitstr)
-- For GUID-based frames (focus), use the GUID directly
if this.label and string.find(this.label, "^0x") then
SetMouseoverUnit(this.label)
elseif UnitExists(unitstr) then
SetMouseoverUnit(unitstr)
end
end end
if this.config.showtooltip == "0" then return end if this.config.showtooltip == "0" then return end
@@ -1200,10 +1192,7 @@ function pfUI.uf.OnEnter()
end end
function pfUI.uf.OnLeave() function pfUI.uf.OnLeave()
-- Nampower: Clear native mouseover unit SetMouseoverUnit("")
if SetMouseoverUnit then
SetMouseoverUnit()
end
GameTooltip:FadeOut() GameTooltip:FadeOut()
end end
@@ -1528,7 +1517,7 @@ function pfUI.uf:RefreshIndicators(unit)
end end
if unit.happinessIcon and unit:GetName() == "pfPet" then -- Happiness Icon if unit.happinessIcon and unit:GetName() == "pfPet" then -- Happiness Icon
local _, pclass = UnitClass("player") local pclass = UnitClassBase("player")
if unit.config.happinessicon == "0" or pclass ~= "HUNTER" then if unit.config.happinessicon == "0" or pclass ~= "HUNTER" then
unit.happinessIcon:Hide() unit.happinessIcon:Hide()
else else
@@ -1572,7 +1561,7 @@ function pfUI.uf:UpdateDruidMana(unit)
local unitstr = unit.label .. unit.id local unitstr = unit.label .. unit.id
if not UnitExists(unitstr) then bar:Hide() return end if not UnitExists(unitstr) then bar:Hide() return end
if unit.label ~= "player" then if unit.label ~= "player" then
local _, cls = UnitClass(unitstr) local cls = UnitClassBase(unitstr)
if cls ~= "DRUID" then bar:Hide() return end if cls ~= "DRUID" then bar:Hide() return end
end end
if UnitPowerType(unitstr) == Enum.PowerType.Mana then bar:Hide() return end if UnitPowerType(unitstr) == Enum.PowerType.Mana then bar:Hide() return end
@@ -1791,8 +1780,7 @@ function pfUI.uf:RefreshUnit(unit, component)
if size ~= indicator.size or disptype ~= indicator.disp or indipos ~= indicator.ipos then if size ~= indicator.size or disptype ~= indicator.disp or indipos ~= indicator.ipos then
indicator:ClearAllPoints() indicator:ClearAllPoints()
indicator:SetPoint(indipos, 0, 0) indicator:SetPoint(indipos, 0, 0)
indicator:SetHeight(size) indicator:SetSize(size, size)
indicator:SetWidth(size)
indicator.size = size indicator.size = size
indicator.disp = disptype indicator.disp = disptype
indicator.ipos = indipos indicator.ipos = indipos
@@ -1821,16 +1809,14 @@ function pfUI.uf:RefreshUnit(unit, component)
indicator[debuff].tex:SetVertexColor(dispelColor:GetRGBA()) indicator[debuff].tex:SetVertexColor(dispelColor:GetRGBA())
indicator[debuff].tex:Show() indicator[debuff].tex:Show()
indicator[debuff]:ClearAllPoints() indicator[debuff]:ClearAllPoints()
indicator[debuff]:SetHeight(size) indicator[debuff]:SetSize(size, size)
indicator[debuff]:SetWidth(size)
indicator[debuff]:SetBackdrop(nil) indicator[debuff]:SetBackdrop(nil)
elseif disptype == "3" then elseif disptype == "3" then
indicator[debuff].tex:SetTexture(dispelColor:GetRGBA()) indicator[debuff].tex:SetTexture(dispelColor:GetRGBA())
indicator[debuff].tex:SetVertexColor(1,1,1,1) indicator[debuff].tex:SetVertexColor(1,1,1,1)
indicator[debuff].tex:Show() indicator[debuff].tex:Show()
indicator[debuff]:ClearAllPoints() indicator[debuff]:ClearAllPoints()
indicator[debuff]:SetHeight(size) indicator[debuff]:SetSize(size, size)
indicator[debuff]:SetWidth(size)
indicator[debuff]:SetBackdrop(nil) indicator[debuff]:SetBackdrop(nil)
elseif disptype == "2" then elseif disptype == "2" then
indicator[debuff].tex:Hide() indicator[debuff].tex:Hide()
@@ -2226,7 +2212,7 @@ function pfUI.uf:ClickAction(button)
-- drop food on petframe -- drop food on petframe
if label == "pet" and CursorHasItem() then if label == "pet" and CursorHasItem() then
local _, playerClass = UnitClass("player") local playerClass = UnitClassBase("player")
if playerClass == "HUNTER" then if playerClass == "HUNTER" then
DropItemOnUnit("pet") DropItemOnUnit("pet")
return return
@@ -2279,8 +2265,7 @@ function pfUI.uf:AddIcon(frame, pos, icon, timeleft, stacks, start, duration)
-- update icon configuration -- update icon configuration
if frame.icon[pos].iconsize ~= iconsize or frame.icon[pos].spacing ~= spacing then if frame.icon[pos].iconsize ~= iconsize or frame.icon[pos].spacing ~= spacing then
frame.icon[pos]:SetWidth(iconsize) frame.icon[pos]:SetSize(iconsize, iconsize)
frame.icon[pos]:SetHeight(iconsize)
frame.icon[pos]:SetPoint("TOPLEFT", frame.icon, "TOPLEFT", (pos-1)*(iconsize + spacing), 0) frame.icon[pos]:SetPoint("TOPLEFT", frame.icon, "TOPLEFT", (pos-1)*(iconsize + spacing), 0)
frame.icon[pos].stacks:SetFont(pfUI.font_unit, math.max(iconsize/3, 10), "OUTLINE") frame.icon[pos].stacks:SetFont(pfUI.font_unit, math.max(iconsize/3, 10), "OUTLINE")
frame.icon[pos].iconsize = iconsize frame.icon[pos].iconsize = iconsize
@@ -2336,7 +2321,7 @@ function pfUI.uf:HideIcon(frame, pos)
end end
function pfUI.uf:SetupDebuffFilter(allclasses) function pfUI.uf:SetupDebuffFilter(allclasses)
local _, myclass = UnitClass("player") local myclass = UnitClassBase("player")
local debuffs = {} local debuffs = {}
if myclass == "PALADIN" or myclass == "PRIEST" or myclass == "WARLOCK" or allclasses then if myclass == "PALADIN" or myclass == "PRIEST" or myclass == "WARLOCK" or allclasses then
@@ -2359,7 +2344,7 @@ function pfUI.uf:SetupDebuffFilter(allclasses)
end end
function pfUI.uf:SetupBuffIndicators(config) function pfUI.uf:SetupBuffIndicators(config)
local _, myclass = UnitClass("player") local myclass = UnitClassBase("player")
local indicators = {} local indicators = {}
if config.show_buffs == "1" then -- buffs if config.show_buffs == "1" then -- buffs
+1 -2
View File
@@ -29,8 +29,7 @@ if GetLocale() == "ruRU" then
end end
local libdebuff = CreateFrame("Frame", "pfdebuffsScanner", UIParent) local libdebuff = CreateFrame("Frame", "pfdebuffsScanner", UIParent)
local _, class = UnitClass("player") local class = UnitClassBase("player")
local lastspell
-- Nampower Support -- Nampower Support
local hasNampower = false local hasNampower = false
+22 -20
View File
@@ -89,7 +89,7 @@ libunitscan:SetScript("OnEvent", function()
-- update own character details -- update own character details
local name = UnitName("player") local name = UnitName("player")
local _, class = UnitClass("player") local class = UnitClassBase("player")
local level = UnitLevel("player") local level = UnitLevel("player")
local guild = GetGuildInfo("player") local guild = GetGuildInfo("player")
AddData("players", name, class, level, nil, guild) AddData("players", name, class, level, nil, guild)
@@ -128,7 +128,7 @@ libunitscan:SetScript("OnEvent", function()
local name, class, level, unit, _, guild local name, class, level, unit, _, guild
for i = 1, GetNumPartyMembers() do for i = 1, GetNumPartyMembers() do
unit = "party" .. i unit = "party" .. i
_, class = UnitClass(unit) class = UnitClassBase(unit)
name = UnitName(unit) name = UnitName(unit)
level = UnitLevel(unit) level = UnitLevel(unit)
guild = GetGuildInfo(unit) guild = GetGuildInfo(unit)
@@ -149,24 +149,26 @@ libunitscan:SetScript("OnEvent", function()
or event == "NAME_PLATE_UNIT_ADDED" and arg1 or event == "NAME_PLATE_UNIT_ADDED" and arg1
or "mouseover" or "mouseover"
local name, class, level, elite, guild, _ local name, class, level, elite, guild, _
if UnitIsPlayer(scan) then if UnitExists(scan) then
_, class = UnitClass(scan) if UnitIsPlayer(scan) then
level = UnitLevel(scan) class = UnitClassBase(scan)
-- UnitLevel returns -1 for unknown levels, don't overwrite known values level = UnitLevel(scan)
level = level > 0 and level or nil -- UnitLevel returns -1 for unknown levels, don't overwrite known values
name = UnitName(scan) level = level > 0 and level or nil
guild = GetGuildInfo(scan) name = UnitName(scan)
AddData("players", name, class, level, nil, guild) guild = GetGuildInfo(scan)
RememberByUnit(scan, name, class) AddData("players", name, class, level, nil, guild)
else RememberByUnit(scan, name, class)
_, class = UnitClass(scan) else
elite = UnitClassification(scan) class = UnitClassBase(scan)
level = UnitLevel(scan) elite = UnitClassification(scan)
-- UnitLevel returns -1 for unknown levels, don't overwrite known values level = UnitLevel(scan)
level = level > 0 and level or nil -- UnitLevel returns -1 for unknown levels, don't overwrite known values
name = UnitName(scan) level = level > 0 and level or nil
guild = UnitSubName(scan) name = UnitName(scan)
AddData("mobs", name, class, level, elite, guild) guild = UnitSubName(scan)
AddData("mobs", name, class, level, elite, guild)
end
end end
end end
end) end)
+7 -13
View File
@@ -1,5 +1,5 @@
pfUI:RegisterModule("actionbar", function () pfUI:RegisterModule("actionbar", function ()
local _, class = UnitClass("player") local class = UnitClassBase("player")
local _, cr, cg, cb = GetUnitColor('player') local _, cr, cg, cb = GetUnitColor('player')
local er, eg, eb, ea = GetStringColor(pfUI_config.appearance.border.color) local er, eg, eb, ea = GetStringColor(pfUI_config.appearance.border.color)
@@ -168,8 +168,7 @@ pfUI:RegisterModule("actionbar", function ()
["zoomfade"] = function() ["zoomfade"] = function()
if this.active == 0 then if this.active == 0 then
-- init animation -- init animation
this:SetWidth(this.parent:GetWidth()) this:SetSize(this.parent:GetSize())
this:SetHeight(this.parent:GetHeight())
this:SetScale(this.parent:GetScale()) this:SetScale(this.parent:GetScale())
this.tex:SetTexture(this.parent.icon:GetTexture()) this.tex:SetTexture(this.parent.icon:GetTexture())
this.tex:SetVertexColor(this.parent.icon:GetVertexColor()) this.tex:SetVertexColor(this.parent.icon:GetVertexColor())
@@ -191,8 +190,7 @@ pfUI:RegisterModule("actionbar", function ()
["shrinkreturn"] = function() ["shrinkreturn"] = function()
if this.active == 0 then if this.active == 0 then
-- init animation -- init animation
this:SetWidth(this.parent:GetWidth()) this:SetSize(this.parent:GetSize())
this:SetHeight(this.parent:GetHeight())
this:SetScale(this.parent:GetScale()) this:SetScale(this.parent:GetScale())
this.tex:SetTexture(this.parent.icon:GetTexture()) this.tex:SetTexture(this.parent.icon:GetTexture())
this.tex:SetVertexColor(this.parent.icon:GetVertexColor()) this.tex:SetVertexColor(this.parent.icon:GetVertexColor())
@@ -218,8 +216,7 @@ pfUI:RegisterModule("actionbar", function ()
["elasticzoom"] = function() ["elasticzoom"] = function()
if this.active == 0 then if this.active == 0 then
-- init animation -- init animation
this:SetWidth(this.parent:GetWidth()) this:SetSize(this.parent:GetSize())
this:SetHeight(this.parent:GetHeight())
this:SetScale(this.parent:GetScale()) this:SetScale(this.parent:GetScale())
this.tex:SetTexture(this.parent.icon:GetTexture()) this.tex:SetTexture(this.parent.icon:GetTexture())
this.tex:SetVertexColor(this.parent.icon:GetVertexColor()) this.tex:SetVertexColor(this.parent.icon:GetVertexColor())
@@ -245,8 +242,7 @@ pfUI:RegisterModule("actionbar", function ()
["wobblezoom"] = function() ["wobblezoom"] = function()
if this.active == 0 then if this.active == 0 then
-- init animation -- init animation
this:SetWidth(this.parent:GetWidth()) this:SetSize(this.parent:GetSize())
this:SetHeight(this.parent:GetHeight())
this:SetScale(this.parent:GetScale()) this:SetScale(this.parent:GetScale())
this.tex:SetTexture(this.parent.icon:GetTexture()) this.tex:SetTexture(this.parent.icon:GetTexture())
this.tex:SetVertexColor(this.parent.icon:GetVertexColor()) this.tex:SetVertexColor(this.parent.icon:GetVertexColor())
@@ -1176,8 +1172,7 @@ pfUI:RegisterModule("actionbar", function ()
-- general appearance -- general appearance
f.showempty = showempty == "1" and true or nil f.showempty = showempty == "1" and true or nil
f:SetHeight(size) f:SetSize(size, size)
f:SetWidth(size)
CreateBackdrop(f, border) CreateBackdrop(f, border)
return f return f
@@ -1349,8 +1344,7 @@ pfUI:RegisterModule("actionbar", function ()
-- adjust actionbar size -- adjust actionbar size
BarLayoutSize(bars[i], buttons, formfactor, size, border, spacing, uneven, fillmode) BarLayoutSize(bars[i], buttons, formfactor, size, border, spacing, uneven, fillmode)
bars[i]:SetWidth(bars[i]._size[1]) bars[i]:SetSize(bars[i]._size[1], bars[i]._size[2])
bars[i]:SetHeight(bars[i]._size[2])
bars[i]:ClearAllPoints() bars[i]:ClearAllPoints()
if i == 1 then -- main if i == 1 then -- main
bars[i]:SetPoint("BOTTOM", 0, 2*border) bars[i]:SetPoint("BOTTOM", 0, 2*border)
+10 -18
View File
@@ -37,15 +37,10 @@ pfUI:RegisterModule("addonbuttons", function ()
pfUI.addonbuttons.minimapbutton = CreateFrame("Button", "pfMinimapButton", pfUI.minimap or UIParent) pfUI.addonbuttons.minimapbutton = CreateFrame("Button", "pfMinimapButton", pfUI.minimap or UIParent)
pfUI.addonbuttons.minimapbutton:SetFrameLevel(24) pfUI.addonbuttons.minimapbutton:SetFrameLevel(24)
pfUI.addonbuttons.minimapbutton:SetWidth(12) pfUI.addonbuttons.minimapbutton:SetSize(12, 12)
pfUI.addonbuttons.minimapbutton:SetHeight(12)
pfUI.addonbuttons.minimapbutton:SetScript("OnClick", function() pfUI.addonbuttons.minimapbutton:SetScript("OnClick", function()
if pfUI.addonbuttons:IsShown() then pfUI.addonbuttons:SetShown(not pfUI.addonbuttons:IsShown())
pfUI.addonbuttons:Hide()
else
pfUI.addonbuttons:Show()
end
end) end)
pfUI.addonbuttons.buttons = {} pfUI.addonbuttons.buttons = {}
@@ -163,27 +158,25 @@ pfUI:RegisterModule("addonbuttons", function ()
pfUI.addonbuttons:SetScale(pfUI.minimap:GetScale()) pfUI.addonbuttons:SetScale(pfUI.minimap:GetScale())
pfUI.addonbuttons.minimapbutton:ClearAllPoints() pfUI.addonbuttons.minimapbutton:ClearAllPoints()
local mbtnWidth, mbtnHeight = pfUI.minimap:GetSize()
local dynamicSize = ceil((GetNumButtons() > 0 and GetNumButtons() or 1) / tonumber(C.abuttons.rowsize)) * GetStringSize() + tonumber(C.abuttons.spacing)
if C.abuttons.position == "bottom" then if C.abuttons.position == "bottom" then
pfUI.addonbuttons:SetWidth(pfUI.minimap:GetWidth()) pfUI.addonbuttons:SetSize(mbtnWidth, dynamicSize)
pfUI.addonbuttons:SetHeight(ceil((GetNumButtons() > 0 and GetNumButtons() or 1) / tonumber(C.abuttons.rowsize)) * GetStringSize() + tonumber(C.abuttons.spacing))
pfUI.addonbuttons:SetPoint("TOP", pfUI.minimap, "BOTTOM", 0 , -default_border * 3) pfUI.addonbuttons:SetPoint("TOP", pfUI.minimap, "BOTTOM", 0 , -default_border * 3)
SkinArrowButton(pfUI.addonbuttons.minimapbutton, "down") SkinArrowButton(pfUI.addonbuttons.minimapbutton, "down")
pfUI.addonbuttons.minimapbutton:SetPoint("BOTTOM", pfUI.minimap, "BOTTOM", 0, 4) pfUI.addonbuttons.minimapbutton:SetPoint("BOTTOM", pfUI.minimap, "BOTTOM", 0, 4)
elseif C.abuttons.position == "left" then elseif C.abuttons.position == "left" then
pfUI.addonbuttons:SetWidth(ceil((GetNumButtons() > 0 and GetNumButtons() or 1) / tonumber(C.abuttons.rowsize)) * GetStringSize() + tonumber(C.abuttons.spacing)) pfUI.addonbuttons:SetSize(dynamicSize, mbtnHeight)
pfUI.addonbuttons:SetHeight(pfUI.minimap:GetHeight())
pfUI.addonbuttons:SetPoint("TOPRIGHT", pfUI.minimap, "TOPLEFT", -default_border * 3, 0) pfUI.addonbuttons:SetPoint("TOPRIGHT", pfUI.minimap, "TOPLEFT", -default_border * 3, 0)
SkinArrowButton(pfUI.addonbuttons.minimapbutton, "left") SkinArrowButton(pfUI.addonbuttons.minimapbutton, "left")
pfUI.addonbuttons.minimapbutton:SetPoint("LEFT", pfUI.minimap, "LEFT", 4, 0) pfUI.addonbuttons.minimapbutton:SetPoint("LEFT", pfUI.minimap, "LEFT", 4, 0)
elseif C.abuttons.position == "top" then elseif C.abuttons.position == "top" then
pfUI.addonbuttons:SetWidth(pfUI.minimap:GetWidth()) pfUI.addonbuttons:SetSize(mbtnWidth, dynamicSize)
pfUI.addonbuttons:SetHeight(ceil((GetNumButtons() > 0 and GetNumButtons() or 1) / tonumber(C.abuttons.rowsize)) * GetStringSize() + tonumber(C.abuttons.spacing))
pfUI.addonbuttons:SetPoint("BOTTOM", pfUI.minimap, "TOP", 0 , default_border * 3) pfUI.addonbuttons:SetPoint("BOTTOM", pfUI.minimap, "TOP", 0 , default_border * 3)
SkinArrowButton(pfUI.addonbuttons.minimapbutton, "up") SkinArrowButton(pfUI.addonbuttons.minimapbutton, "up")
pfUI.addonbuttons.minimapbutton:SetPoint("TOP", pfUI.minimap, "TOP", 0, -4) pfUI.addonbuttons.minimapbutton:SetPoint("TOP", pfUI.minimap, "TOP", 0, -4)
elseif C.abuttons.position == "right" then elseif C.abuttons.position == "right" then
pfUI.addonbuttons:SetWidth(ceil((GetNumButtons() > 0 and GetNumButtons() or 1) / tonumber(C.abuttons.rowsize)) * GetStringSize() + tonumber(C.abuttons.spacing)) pfUI.addonbuttons:SetSize(dynamicSize, mbtnHeight)
pfUI.addonbuttons:SetHeight(pfUI.minimap:GetHeight())
pfUI.addonbuttons:SetPoint("TOPLEFT", pfUI.minimap, "TOPRIGHT", default_border * 3, 0) pfUI.addonbuttons:SetPoint("TOPLEFT", pfUI.minimap, "TOPRIGHT", default_border * 3, 0)
SkinArrowButton(pfUI.addonbuttons.minimapbutton, "right") SkinArrowButton(pfUI.addonbuttons.minimapbutton, "right")
pfUI.addonbuttons.minimapbutton:SetPoint("RIGHT", pfUI.minimap, "RIGHT", -4, 0) pfUI.addonbuttons.minimapbutton:SetPoint("RIGHT", pfUI.minimap, "RIGHT", -4, 0)
@@ -231,7 +224,7 @@ pfUI:RegisterModule("addonbuttons", function ()
frame.backup.is_clamped_to_screen = frame:IsClampedToScreen() frame.backup.is_clamped_to_screen = frame:IsClampedToScreen()
frame.backup.is_movable = frame:IsMovable() frame.backup.is_movable = frame:IsMovable()
frame.backup.point = {frame:GetPoint()} frame.backup.point = {frame:GetPoint()}
frame.backup.size = {frame:GetHeight(), frame:GetWidth()} frame.backup.size = {frame:GetSize()}
frame.backup.scale = frame:GetScale() frame.backup.scale = frame:GetScale()
if frame:HasScript("OnDragStart") then if frame:HasScript("OnDragStart") then
frame.backup.on_drag_start = frame:GetScript("OnDragStart") frame.backup.on_drag_start = frame:GetScript("OnDragStart")
@@ -256,8 +249,7 @@ pfUI:RegisterModule("addonbuttons", function ()
frame:SetClampedToScreen(frame.backup.is_clamped_to_screen) frame:SetClampedToScreen(frame.backup.is_clamped_to_screen)
frame:SetMovable(frame.backup.is_movable) frame:SetMovable(frame.backup.is_movable)
frame:SetScale(frame.backup.scale) frame:SetScale(frame.backup.scale)
frame:SetHeight(frame.backup.size[1]) frame:SetSize(frame.backup.size[2], frame.backup.size[1])
frame:SetWidth(frame.backup.size[2])
frame:ClearAllPoints() frame:ClearAllPoints()
frame:SetPoint(frame.backup.point[1], frame.backup.point[2], frame.backup.point[3], frame.backup.point[4], frame.backup.point[5]) frame:SetPoint(frame.backup.point[1], frame.backup.point[2], frame.backup.point[3], frame.backup.point[4], frame.backup.point[5])
if frame.backup.on_drag_start ~= nil then if frame.backup.on_drag_start ~= nil then
+7 -14
View File
@@ -18,8 +18,7 @@ pfUI:RegisterModule("addons", function ()
-- addon window -- addon window
pfUI.addons = CreateFrame("Frame", "pfAddons", UIParent) pfUI.addons = CreateFrame("Frame", "pfAddons", UIParent)
pfUI.addons:SetFrameStrata("DIALOG") pfUI.addons:SetFrameStrata("DIALOG")
pfUI.addons:SetHeight(490) pfUI.addons:SetSize(380, 490)
pfUI.addons:SetWidth(380)
pfUI.addons:SetPoint("CENTER", 0,0) pfUI.addons:SetPoint("CENTER", 0,0)
pfUI.addons:EnableMouseWheel(1) pfUI.addons:EnableMouseWheel(1)
pfUI.addons:SetMovable(true) pfUI.addons:SetMovable(true)
@@ -51,8 +50,7 @@ pfUI:RegisterModule("addons", function ()
pfUI.addons.close = CreateFrame("Button", "pfBagClose", pfUI.addons) pfUI.addons.close = CreateFrame("Button", "pfBagClose", pfUI.addons)
pfUI.addons.close:SetPoint("TOPRIGHT", -border*2,-border*2 ) pfUI.addons.close:SetPoint("TOPRIGHT", -border*2,-border*2 )
CreateBackdrop(pfUI.addons.close) CreateBackdrop(pfUI.addons.close)
pfUI.addons.close:SetHeight(15) pfUI.addons.close:SetSize(15, 15)
pfUI.addons.close:SetWidth(15)
pfUI.addons.close.texture = pfUI.addons.close:CreateTexture("pfBagClose") pfUI.addons.close.texture = pfUI.addons.close:CreateTexture("pfBagClose")
pfUI.addons.close.texture:SetTexture(pfUI.media["img:close"]) pfUI.addons.close.texture:SetTexture(pfUI.media["img:close"])
pfUI.addons.close.texture:ClearAllPoints() pfUI.addons.close.texture:ClearAllPoints()
@@ -125,8 +123,7 @@ pfUI:RegisterModule("addons", function ()
end) end)
pfUI.addons.profile:SetPoint("TOP", pfUI.addons, "TOP", 0, -30) pfUI.addons.profile:SetPoint("TOP", pfUI.addons, "TOP", 0, -30)
pfUI.addons.profile:SetHeight(30) pfUI.addons.profile:SetSize(370, 30)
pfUI.addons.profile:SetWidth(370)
CreateBackdrop(pfUI.addons.profile, nil, true) CreateBackdrop(pfUI.addons.profile, nil, true)
-- addon profile: title -- addon profile: title
@@ -139,8 +136,7 @@ pfUI:RegisterModule("addons", function ()
-- addon profile: delete -- addon profile: delete
pfUI.addons.profile.del = CreateFrame("Button", nil, pfUI.addons.profile, "UIPanelButtonTemplate") pfUI.addons.profile.del = CreateFrame("Button", nil, pfUI.addons.profile, "UIPanelButtonTemplate")
SkinButton(pfUI.addons.profile.del) SkinButton(pfUI.addons.profile.del)
pfUI.addons.profile.del:SetWidth(16) pfUI.addons.profile.del:SetSize(16, 16)
pfUI.addons.profile.del:SetHeight(16)
pfUI.addons.profile.del:SetPoint("RIGHT", -10, 0) pfUI.addons.profile.del:SetPoint("RIGHT", -10, 0)
pfUI.addons.profile.del:GetFontString():SetPoint("CENTER", 1, 0) pfUI.addons.profile.del:GetFontString():SetPoint("CENTER", 1, 0)
pfUI.addons.profile.del:SetText("-") pfUI.addons.profile.del:SetText("-")
@@ -157,8 +153,7 @@ pfUI:RegisterModule("addons", function ()
-- addon profile: create -- addon profile: create
pfUI.addons.profile.add = CreateFrame("Button", nil, pfUI.addons.profile, "UIPanelButtonTemplate") pfUI.addons.profile.add = CreateFrame("Button", nil, pfUI.addons.profile, "UIPanelButtonTemplate")
SkinButton(pfUI.addons.profile.add) SkinButton(pfUI.addons.profile.add)
pfUI.addons.profile.add:SetWidth(16) pfUI.addons.profile.add:SetSize(16, 16)
pfUI.addons.profile.add:SetHeight(16)
pfUI.addons.profile.add:SetPoint("RIGHT", pfUI.addons.profile.del, "LEFT", -4, 0) pfUI.addons.profile.add:SetPoint("RIGHT", pfUI.addons.profile.del, "LEFT", -4, 0)
pfUI.addons.profile.add:GetFontString():SetPoint("CENTER", 1, 0) pfUI.addons.profile.add:GetFontString():SetPoint("CENTER", 1, 0)
pfUI.addons.profile.add:SetText("+") pfUI.addons.profile.add:SetText("+")
@@ -201,8 +196,7 @@ pfUI:RegisterModule("addons", function ()
-- addon list: scroll frame -- addon list: scroll frame
pfUI.addons.scroll = CreateScrollFrame("pfAddonListScroll", pfUI.addons) pfUI.addons.scroll = CreateScrollFrame("pfAddonListScroll", pfUI.addons)
pfUI.addons.scroll:SetWidth(360) pfUI.addons.scroll:SetSize(360, 410)
pfUI.addons.scroll:SetHeight(410)
pfUI.addons.scroll:SetPoint("BOTTOM", 0, 10) pfUI.addons.scroll:SetPoint("BOTTOM", 0, 10)
pfUI.addons.scroll.backdrop = CreateFrame("Frame", nil, pfUI.addons.scroll) pfUI.addons.scroll.backdrop = CreateFrame("Frame", nil, pfUI.addons.scroll)
@@ -292,8 +286,7 @@ pfUI:RegisterModule("addons", function ()
frame.adeps = { GetAddOnDependencies(i) } -- required (.toc Dependencies) frame.adeps = { GetAddOnDependencies(i) } -- required (.toc Dependencies)
frame.aoptdeps = { C_AddOns.GetAddOnOptionalDependencies(i) } -- optional (.toc OptionalDeps) frame.aoptdeps = { C_AddOns.GetAddOnOptionalDependencies(i) } -- optional (.toc OptionalDeps)
frame:SetWidth(340) frame:SetSize(340, 25)
frame:SetHeight(25)
frame:SetPoint("TOPLEFT", 5, i * -25 + 20) frame:SetPoint("TOPLEFT", 5, i * -25 + 20)
frame:SetBackdrop(pfUI.backdrop_hover) frame:SetBackdrop(pfUI.backdrop_hover)
+1 -2
View File
@@ -48,8 +48,7 @@ pfUI:RegisterModule("afkcam", function ()
local chat = CreateFrame("ScrollingMessageFrame", "pfAFKCamChat", overlay) local chat = CreateFrame("ScrollingMessageFrame", "pfAFKCamChat", overlay)
chat:EnableMouse(false) chat:EnableMouse(false)
chat:EnableMouseWheel(true) chat:EnableMouseWheel(true)
chat:SetHeight(150) chat:SetSize(500, 150)
chat:SetWidth(500)
chat:SetPoint("BOTTOMLEFT",overlay,"BOTTOMLEFT", 10, 10) chat:SetPoint("BOTTOMLEFT",overlay,"BOTTOMLEFT", 10, 10)
chat:SetTimeVisible(1800.0) chat:SetTimeVisible(1800.0)
chat:SetMaxLines(500) chat:SetMaxLines(500)
+1 -2
View File
@@ -56,8 +56,7 @@ pfUI:RegisterModule("autovendor", function ()
-- Setup Autosell button -- Setup Autosell button
autovendor.button = CreateFrame("Button", "pfMerchantAutoVendorButton", MerchantFrame) autovendor.button = CreateFrame("Button", "pfMerchantAutoVendorButton", MerchantFrame)
autovendor.button:SetWidth(36) autovendor.button:SetSize(36, 36)
autovendor.button:SetHeight(36)
autovendor.button.icon = autovendor.button:CreateTexture("ARTWORK") autovendor.button.icon = autovendor.button:CreateTexture("ARTWORK")
autovendor.button.icon:SetTexture("Interface\\Icons\\Spell_Shadow_SacrificialShield") autovendor.button.icon:SetTexture("Interface\\Icons\\Spell_Shadow_SacrificialShield")
autovendor.button:SetScript("OnEnter", function() autovendor.button:SetScript("OnEnter", function()
+15 -33
View File
@@ -326,8 +326,7 @@ pfUI:RegisterModule("bags", function ()
default_border + x*(frame.button_size+default_border*3), default_border + x*(frame.button_size+default_border*3),
-default_border*2 - y*(frame.button_size+default_border*3) - topspace) -default_border*2 - y*(frame.button_size+default_border*3) - topspace)
pfUI.bags[bag].slots[slot].frame:SetHeight(frame.button_size) pfUI.bags[bag].slots[slot].frame:SetSize(frame.button_size, frame.button_size)
pfUI.bags[bag].slots[slot].frame:SetWidth(frame.button_size)
if x >= rowlength - 1 then if x >= rowlength - 1 then
y = y + 1 y = y + 1
@@ -545,8 +544,7 @@ pfUI:RegisterModule("bags", function ()
local width = (frame.button_size/5*4 + default_border*2) * (max-min+1+extra) local width = (frame.button_size/5*4 + default_border*2) * (max-min+1+extra)
local height = default_border + (frame.button_size/5*4 + default_border) local height = default_border + (frame.button_size/5*4 + default_border)
frame.bagslots:SetWidth(width) frame.bagslots:SetSize(width, height)
frame.bagslots:SetHeight(height)
for slot=min, max do for slot=min, max do
if not frame.bagslots.slots[slot] then if not frame.bagslots.slots[slot] then
frame.bagslots.slots[slot] = {} frame.bagslots.slots[slot] = {}
@@ -606,8 +604,7 @@ pfUI:RegisterModule("bags", function ()
frame.bagslots.slots[slot].frame:ClearAllPoints() frame.bagslots.slots[slot].frame:ClearAllPoints()
frame.bagslots.slots[slot].frame:SetPoint("TOPLEFT", frame.bagslots, "TOPLEFT", left, top) frame.bagslots.slots[slot].frame:SetPoint("TOPLEFT", frame.bagslots, "TOPLEFT", left, top)
frame.bagslots.slots[slot].frame:SetHeight(frame.button_size/5*4) frame.bagslots.slots[slot].frame:SetSize(frame.button_size/5*4, frame.button_size/5*4)
frame.bagslots.slots[slot].frame:SetWidth(frame.button_size/5*4)
CreateBackdrop(frame.bagslots.slots[slot].frame, default_border) CreateBackdrop(frame.bagslots.slots[slot].frame, default_border)
frame.bagslots.slots[slot].frame:Show() frame.bagslots.slots[slot].frame:Show()
@@ -626,8 +623,7 @@ pfUI:RegisterModule("bags", function ()
end end
frame.bagslots.buy:SetPoint("RIGHT", frame.bagslots, "RIGHT", -default_border, 0) frame.bagslots.buy:SetPoint("RIGHT", frame.bagslots, "RIGHT", -default_border, 0)
CreateBackdrop(frame.bagslots.buy, default_border) CreateBackdrop(frame.bagslots.buy, default_border)
frame.bagslots.buy:SetHeight(frame.button_size/5*4) frame.bagslots.buy:SetSize(frame.button_size/5*4, frame.button_size/5*4)
frame.bagslots.buy:SetWidth(frame.button_size/5*4)
frame.bagslots.buy:SetText("+") frame.bagslots.buy:SetText("+")
frame.bagslots.buy:SetTextColor(.5,.5,1,1) frame.bagslots.buy:SetTextColor(.5,.5,1,1)
frame.bagslots.buy:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE") frame.bagslots.buy:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE")
@@ -719,8 +715,7 @@ pfUI:RegisterModule("bags", function ()
frame.close = CreateFrame("Button", "pfBagClose", frame) frame.close = CreateFrame("Button", "pfBagClose", frame)
frame.close:SetPoint("TOPRIGHT", -default_border*1,-default_border ) frame.close:SetPoint("TOPRIGHT", -default_border*1,-default_border )
CreateBackdrop(frame.close, default_border) CreateBackdrop(frame.close, default_border)
frame.close:SetHeight(12) frame.close:SetSize(12, 12)
frame.close:SetWidth(12)
frame.close.texture = frame.close:CreateTexture("pfBagClose") frame.close.texture = frame.close:CreateTexture("pfBagClose")
frame.close.texture:SetTexture(pfUI.media["img:close"]) frame.close.texture:SetTexture(pfUI.media["img:close"])
frame.close.texture:ClearAllPoints() frame.close.texture:ClearAllPoints()
@@ -745,8 +740,7 @@ pfUI:RegisterModule("bags", function ()
frame.bags = CreateFrame("Button", "pfBagSlotShow", frame) frame.bags = CreateFrame("Button", "pfBagSlotShow", frame)
frame.bags:SetPoint("TOPRIGHT", frame.close, "TOPLEFT", -default_border*3, 0) frame.bags:SetPoint("TOPRIGHT", frame.close, "TOPLEFT", -default_border*3, 0)
CreateBackdrop(frame.bags, default_border) CreateBackdrop(frame.bags, default_border)
frame.bags:SetHeight(12) frame.bags:SetSize(12, 12)
frame.bags:SetWidth(12)
frame.bags:SetTextColor(1,1,.25,1) frame.bags:SetTextColor(1,1,.25,1)
frame.bags:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE") frame.bags:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE")
frame.bags.texture = frame.bags:CreateTexture("pfBagArrowUp") frame.bags.texture = frame.bags:CreateTexture("pfBagArrowUp")
@@ -773,11 +767,7 @@ pfUI:RegisterModule("bags", function ()
end) end)
frame.bags:SetScript("OnClick", function() frame.bags:SetScript("OnClick", function()
if pfUI.bag.right.bagslots:IsShown() then pfUI.bag.right.bagslots:SetShown(not pfUI.bag.right.bagslots:IsShown())
pfUI.bag.right.bagslots:Hide()
else
pfUI.bag.right.bagslots:Show()
end
end) end)
end end
@@ -786,8 +776,7 @@ pfUI:RegisterModule("bags", function ()
frame.open = CreateFrame("Button", "pfBagSlotOpen", frame) frame.open = CreateFrame("Button", "pfBagSlotOpen", frame)
frame.open:SetPoint("TOPRIGHT", frame.bags, "TOPLEFT", -default_border*3, 0) frame.open:SetPoint("TOPRIGHT", frame.bags, "TOPLEFT", -default_border*3, 0)
CreateBackdrop(frame.open, default_border) CreateBackdrop(frame.open, default_border)
frame.open:SetHeight(12) frame.open:SetSize(12, 12)
frame.open:SetWidth(12)
frame.open:SetTextColor(1,1,.25,1) frame.open:SetTextColor(1,1,.25,1)
frame.open:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE") frame.open:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE")
frame.open.texture = frame.open:CreateTexture("pfBagOpenContainer") frame.open.texture = frame.open:CreateTexture("pfBagOpenContainer")
@@ -845,8 +834,7 @@ pfUI:RegisterModule("bags", function ()
frame.disenchant = CreateFrame("Button", "pfBagSlotDisenchant", frame) frame.disenchant = CreateFrame("Button", "pfBagSlotDisenchant", frame)
frame.disenchant:SetPoint("TOPRIGHT", frame.open, "TOPLEFT", -default_border*3, 0) frame.disenchant:SetPoint("TOPRIGHT", frame.open, "TOPLEFT", -default_border*3, 0)
CreateBackdrop(frame.disenchant, default_border) CreateBackdrop(frame.disenchant, default_border)
frame.disenchant:SetHeight(12) frame.disenchant:SetSize(12, 12)
frame.disenchant:SetWidth(12)
frame.disenchant:SetTextColor(1,1,.25,1) frame.disenchant:SetTextColor(1,1,.25,1)
frame.disenchant:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE") frame.disenchant:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE")
frame.disenchant.texture = frame.disenchant:CreateTexture("pfBagDisenchant") frame.disenchant.texture = frame.disenchant:CreateTexture("pfBagDisenchant")
@@ -888,8 +876,7 @@ pfUI:RegisterModule("bags", function ()
frame.picklock = CreateFrame("Button", "pfBagSlotPicklock", frame) frame.picklock = CreateFrame("Button", "pfBagSlotPicklock", frame)
frame.picklock:SetPoint("TOPRIGHT", frame.disenchant, "TOPLEFT", -default_border*3, 0) frame.picklock:SetPoint("TOPRIGHT", frame.disenchant, "TOPLEFT", -default_border*3, 0)
CreateBackdrop(frame.picklock, default_border) CreateBackdrop(frame.picklock, default_border)
frame.picklock:SetHeight(12) frame.picklock:SetSize(12, 12)
frame.picklock:SetWidth(12)
frame.picklock:SetTextColor(1,1,.25,1) frame.picklock:SetTextColor(1,1,.25,1)
frame.picklock:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE") frame.picklock:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE")
frame.picklock.texture = frame.picklock:CreateTexture("pfBagPicklock") frame.picklock.texture = frame.picklock:CreateTexture("pfBagPicklock")
@@ -931,8 +918,7 @@ pfUI:RegisterModule("bags", function ()
frame.keys = CreateFrame("Button", "pfBagSlotShow", frame) frame.keys = CreateFrame("Button", "pfBagSlotShow", frame)
frame.keys:SetPoint("TOPRIGHT", frame.picklock, "TOPLEFT", -default_border*3, 0) frame.keys:SetPoint("TOPRIGHT", frame.picklock, "TOPLEFT", -default_border*3, 0)
CreateBackdrop(frame.keys, default_border) CreateBackdrop(frame.keys, default_border)
frame.keys:SetHeight(12) frame.keys:SetSize(12, 12)
frame.keys:SetWidth(12)
frame.keys:SetTextColor(1,1,.25,1) frame.keys:SetTextColor(1,1,.25,1)
frame.keys:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE") frame.keys:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE")
frame.keys.texture = frame.keys:CreateTexture("pfBagArrowUp") frame.keys.texture = frame.keys:CreateTexture("pfBagArrowUp")
@@ -974,8 +960,7 @@ pfUI:RegisterModule("bags", function ()
frame.sort = CreateFrame("Button", "pfBagSort", frame) frame.sort = CreateFrame("Button", "pfBagSort", frame)
frame.sort:SetPoint("TOPRIGHT", frame.keys, "TOPLEFT", -default_border*3, 0) frame.sort:SetPoint("TOPRIGHT", frame.keys, "TOPLEFT", -default_border*3, 0)
CreateBackdrop(frame.sort, default_border) CreateBackdrop(frame.sort, default_border)
frame.sort:SetHeight(12) frame.sort:SetSize(12, 12)
frame.sort:SetWidth(12)
frame.sort.texture = frame.sort:CreateTexture("pfBagSortIcon") frame.sort.texture = frame.sort:CreateTexture("pfBagSortIcon")
frame.sort.texture:SetTexture(pfUI.media["img:sort"]) frame.sort.texture:SetTexture(pfUI.media["img:sort"])
frame.sort.texture:ClearAllPoints() frame.sort.texture:ClearAllPoints()
@@ -1008,8 +993,7 @@ pfUI:RegisterModule("bags", function ()
if not frame.gold and (C.appearance.bags.movable == "1" or not pfUI.panel) then if not frame.gold and (C.appearance.bags.movable == "1" or not pfUI.panel) then
frame.gold = CreateFrame("Frame", "pfBagGoldString", frame) frame.gold = CreateFrame("Frame", "pfBagGoldString", frame)
frame.gold:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -4, 1) frame.gold:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -4, 1)
frame.gold:SetWidth(200) frame.gold:SetSize(200, 18)
frame.gold:SetHeight(18)
frame.gold:RegisterEvent("PLAYER_ENTERING_WORLD") frame.gold:RegisterEvent("PLAYER_ENTERING_WORLD")
frame.gold:RegisterEvent("PLAYER_MONEY") frame.gold:RegisterEvent("PLAYER_MONEY")
frame.gold:SetScript("OnEvent", function() frame.gold:SetScript("OnEvent", function()
@@ -1145,8 +1129,7 @@ pfUI:RegisterModule("bags", function ()
frame.close = CreateFrame("Button", "pfBagClose", frame) frame.close = CreateFrame("Button", "pfBagClose", frame)
frame.close:SetPoint("TOPRIGHT", -default_border*1,-default_border ) frame.close:SetPoint("TOPRIGHT", -default_border*1,-default_border )
CreateBackdrop(frame.close, default_border) CreateBackdrop(frame.close, default_border)
frame.close:SetHeight(12) frame.close:SetSize(12, 12)
frame.close:SetWidth(12)
frame.close.texture = frame.close:CreateTexture("pfBagClose") frame.close.texture = frame.close:CreateTexture("pfBagClose")
frame.close.texture:SetTexture(pfUI.media["img:close"]) frame.close.texture:SetTexture(pfUI.media["img:close"])
frame.close.texture:ClearAllPoints() frame.close.texture:ClearAllPoints()
@@ -1171,8 +1154,7 @@ pfUI:RegisterModule("bags", function ()
frame.bags = CreateFrame("Button", "pfBagSlotShow", frame) frame.bags = CreateFrame("Button", "pfBagSlotShow", frame)
frame.bags:SetPoint("TOPRIGHT", frame.close, "TOPLEFT", -default_border*3, 0) frame.bags:SetPoint("TOPRIGHT", frame.close, "TOPLEFT", -default_border*3, 0)
CreateBackdrop(frame.bags, default_border) CreateBackdrop(frame.bags, default_border)
frame.bags:SetHeight(12) frame.bags:SetSize(12, 12)
frame.bags:SetWidth(12)
frame.bags:SetTextColor(1,1,.25,1) frame.bags:SetTextColor(1,1,.25,1)
frame.bags:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE") frame.bags:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE")
frame.bags.texture = frame.bags:CreateTexture("pfBagArrowUp") frame.bags.texture = frame.bags:CreateTexture("pfBagArrowUp")
+2 -4
View File
@@ -2,14 +2,12 @@ pfUI:RegisterModule("bgscore", function ()
local bgframe = WorldStateAlwaysUpFrame local bgframe = WorldStateAlwaysUpFrame
if not bgframe then if not bgframe then
bgframe = CreateFrame("Frame", "WorldStateAlwaysUpFrame", UIParent) bgframe = CreateFrame("Frame", "WorldStateAlwaysUpFrame", UIParent)
bgframe:SetWidth(200) bgframe:SetSize(200, 25)
bgframe:SetHeight(25)
bgframe:SetPoint("TOP", UIParent, "TOP", 0, -100) bgframe:SetPoint("TOP", UIParent, "TOP", 0, -100)
end end
local mover = CreateFrame("Frame", "pfUIBGScoreMover", UIParent) local mover = CreateFrame("Frame", "pfUIBGScoreMover", UIParent)
mover:SetWidth(220) mover:SetSize(220, 30)
mover:SetHeight(30)
mover:SetPoint("TOP", UIParent, "TOP", 0, -100) mover:SetPoint("TOP", UIParent, "TOP", 0, -100)
mover:SetFrameStrata("DIALOG") mover:SetFrameStrata("DIALOG")
mover:SetMovable(true) mover:SetMovable(true)
+21 -16
View File
@@ -277,28 +277,27 @@ pfUI:RegisterModule("buff", function ()
-- config loading -- config loading
function pfUI.buff:UpdateConfigBuffButton(buff) function pfUI.buff:UpdateConfigBuffButton(buff)
local fontsize = C.buffs.fontsize == "-1" and C.global.font_size or C.buffs.fontsize local fontsize = C.buffs.fontsize == "-1" and C.global.font_size or C.buffs.fontsize
local buffSize, buffSpacing = tonumber(C.buffs.size), tonumber(C.buffs.spacing)
local rowcount, relFrame, offsetX, offsetY local rowcount, relFrame, offsetX, offsetY
if buff.btype == "HELPFUL" then if buff.btype == "HELPFUL" then
if buff.weapon == 1 and C.buffs.separateweapons == "1" then if buff.weapon == 1 and C.buffs.separateweapons == "1" then
rowcount = floor((buff.gid-1) / tonumber(C.buffs.wepbuffrowsize)) rowcount = floor((buff.gid-1) / tonumber(C.buffs.wepbuffrowsize))
relFrame = pfUI.buff.wepbuffs relFrame = pfUI.buff.wepbuffs
offsetX = -(buff.gid-1-rowcount*tonumber(C.buffs.wepbuffrowsize))*(tonumber(C.buffs.size)+2*tonumber(C.buffs.spacing)) offsetX = -(buff.gid-1-rowcount*tonumber(C.buffs.wepbuffrowsize))*(buffSize+2*buffSpacing)
offsetY = -(rowcount) * ((C.buffs.textinside == "1" and 0 or (fontsize*1.5))+tonumber(C.buffs.size)+2*tonumber(C.buffs.spacing)) offsetY = -(rowcount) * ((C.buffs.textinside == "1" and 0 or (fontsize*1.5))+buffSize+2*buffSpacing)
else else
rowcount = floor((buff.gid-1) / tonumber(C.buffs.buffrowsize)) rowcount = floor((buff.gid-1) / tonumber(C.buffs.buffrowsize))
relFrame = pfUI.buff.buffs relFrame = pfUI.buff.buffs
offsetX = -(buff.gid-1-rowcount*tonumber(C.buffs.buffrowsize))*(tonumber(C.buffs.size)+2*tonumber(C.buffs.spacing)) offsetX = -(buff.gid-1-rowcount*tonumber(C.buffs.buffrowsize))*(buffSize+2*buffSpacing)
offsetY = -(rowcount) * ((C.buffs.textinside == "1" and 0 or (fontsize*1.5))+tonumber(C.buffs.size)+2*tonumber(C.buffs.spacing)) offsetY = -(rowcount) * ((C.buffs.textinside == "1" and 0 or (fontsize*1.5))+buffSize+2*buffSpacing)
end end
else else
rowcount = floor((buff.gid-1) / tonumber(C.buffs.debuffrowsize)) rowcount = floor((buff.gid-1) / tonumber(C.buffs.debuffrowsize))
relFrame = pfUI.buff.debuffs relFrame = pfUI.buff.debuffs
offsetX = -(buff.gid-1-rowcount*tonumber(C.buffs.debuffrowsize))*(tonumber(C.buffs.size)+2*tonumber(C.buffs.spacing)) offsetX = -(buff.gid-1-rowcount*tonumber(C.buffs.debuffrowsize))*(buffSize+2*buffSpacing)
offsetY = -(rowcount) * ((C.buffs.textinside == "1" and 0 or (fontsize*1.5))+tonumber(C.buffs.size)+2*tonumber(C.buffs.spacing)) offsetY = -(rowcount) * ((C.buffs.textinside == "1" and 0 or (fontsize*1.5))+buffSize+2*buffSpacing)
end end
buff:SetSize(buffSize, buffSize)
buff:SetWidth(tonumber(C.buffs.size))
buff:SetHeight(tonumber(C.buffs.size))
buff:ClearAllPoints() buff:ClearAllPoints()
buff:SetPoint("TOPRIGHT", relFrame, "TOPRIGHT",offsetX, offsetY) buff:SetPoint("TOPRIGHT", relFrame, "TOPRIGHT",offsetX, offsetY)
@@ -318,20 +317,26 @@ pfUI:RegisterModule("buff", function ()
function pfUI.buff:UpdateConfig() function pfUI.buff:UpdateConfig()
local fontsize = C.buffs.fontsize == "-1" and C.global.font_size or C.buffs.fontsize local fontsize = C.buffs.fontsize == "-1" and C.global.font_size or C.buffs.fontsize
pfUI.buff.buffs:SetWidth(tonumber(C.buffs.buffrowsize) * (tonumber(C.buffs.size)+2*tonumber(C.buffs.spacing))) local spacing = tonumber(C.buffs.spacing)
pfUI.buff.buffs:SetHeight(ceil(32/tonumber(C.buffs.buffrowsize)) * ((C.buffs.textinside == "1" and 0 or (fontsize*1.5))+tonumber(C.buffs.size)+2*tonumber(C.buffs.spacing))) local cell = tonumber(C.buffs.size) + 2 * spacing
pfUI.buff.buffs:SetPoint("TOPRIGHT", pfUI.minimap or UIParent, "TOPLEFT", -4*tonumber(C.buffs.spacing), 0) local rowextra = C.buffs.textinside == "1" and 0 or (fontsize * 1.5)
local function SizeBuffFrame(frame, rowsize, count)
rowsize = tonumber(rowsize)
frame:SetSize(rowsize * cell, ceil(count / rowsize) * (rowextra + cell))
end
SizeBuffFrame(pfUI.buff.buffs, C.buffs.buffrowsize, 32)
pfUI.buff.buffs:SetPoint("TOPRIGHT", pfUI.minimap or UIParent, "TOPLEFT", -4 * spacing, 0)
UpdateMovable(pfUI.buff.buffs) UpdateMovable(pfUI.buff.buffs)
pfUI.buff.debuffs:SetWidth(tonumber(C.buffs.debuffrowsize) * (tonumber(C.buffs.size)+2*tonumber(C.buffs.spacing))) SizeBuffFrame(pfUI.buff.debuffs, C.buffs.debuffrowsize, 16)
pfUI.buff.debuffs:SetHeight(ceil(16/tonumber(C.buffs.debuffrowsize)) * ((C.buffs.textinside == "1" and 0 or (fontsize*1.5))+tonumber(C.buffs.size)+2*tonumber(C.buffs.spacing)))
pfUI.buff.debuffs:SetPoint("TOPRIGHT", pfUI.buff.buffs, "BOTTOMRIGHT", 0, 0) pfUI.buff.debuffs:SetPoint("TOPRIGHT", pfUI.buff.buffs, "BOTTOMRIGHT", 0, 0)
UpdateMovable(pfUI.buff.debuffs) UpdateMovable(pfUI.buff.debuffs)
if C.buffs.separateweapons == "1" then if C.buffs.separateweapons == "1" then
pfUI.buff.wepbuffs:ClearAllPoints() pfUI.buff.wepbuffs:ClearAllPoints()
pfUI.buff.wepbuffs:SetWidth(tonumber(C.buffs.wepbuffrowsize) * (tonumber(C.buffs.size)+2*tonumber(C.buffs.spacing))) SizeBuffFrame(pfUI.buff.wepbuffs, C.buffs.wepbuffrowsize, 2)
pfUI.buff.wepbuffs:SetHeight(ceil(2/tonumber(C.buffs.wepbuffrowsize)) * ((C.buffs.textinside == "1" and 0 or (fontsize*1.5))+tonumber(C.buffs.size)+2*tonumber(C.buffs.spacing)))
pfUI.buff.wepbuffs:SetPoint("TOPRIGHT", pfUI.buff.debuffs, "BOTTOMRIGHT", 0, 0) pfUI.buff.wepbuffs:SetPoint("TOPRIGHT", pfUI.buff.debuffs, "BOTTOMRIGHT", 0, 0)
pfUI.buff.wepbuffs:Show() pfUI.buff.wepbuffs:Show()
UpdateMovable(pfUI.buff.wepbuffs) UpdateMovable(pfUI.buff.wepbuffs)
+13 -25
View File
@@ -162,8 +162,7 @@ pfUI:RegisterModule("buffwatch", function ()
local color = parent.color local color = parent.color
local bordercolor = parent.bordercolor local bordercolor = parent.bordercolor
local textcolor = parent.textcolor local textcolor = parent.textcolor
local width = parent:GetWidth() local width, height = parent:GetSize()
local height = parent:GetHeight()
local framename = "pf" .. parent.unit .. ( parent.type == "HARMFUL" and "Debuff" or "Buff" ) .. "Bar" .. bar local framename = "pf" .. parent.unit .. ( parent.type == "HARMFUL" and "Debuff" or "Buff" ) .. "Bar" .. bar
local font = parent.config.use_unitfonts == "1" and pfUI.font_unit or pfUI.font_default local font = parent.config.use_unitfonts == "1" and pfUI.font_unit or pfUI.font_default
@@ -172,8 +171,7 @@ pfUI:RegisterModule("buffwatch", function ()
frame:EnableMouse(1) frame:EnableMouse(1)
frame:Hide() frame:Hide()
frame:SetPoint("BOTTOM", 0, (bar-1)*(height+2*border+1)) frame:SetPoint("BOTTOM", 0, (bar-1)*(height+2*border+1))
frame:SetWidth(width) frame:SetSize(width, height)
frame:SetHeight(height)
frame.bar = CreateFrame("StatusBar", "pfBuffBar" .. bar, frame) frame.bar = CreateFrame("StatusBar", "pfBuffBar" .. bar, frame)
frame.bar:SetPoint("TOPLEFT", frame, "TOPLEFT", height+1, 0) frame.bar:SetPoint("TOPLEFT", frame, "TOPLEFT", height+1, 0)
@@ -202,8 +200,7 @@ pfUI:RegisterModule("buffwatch", function ()
frame.time:SetJustifyH("RIGHT") frame.time:SetJustifyH("RIGHT")
frame.icon = frame:CreateTexture(nil, "OVERLAY") frame.icon = frame:CreateTexture(nil, "OVERLAY")
frame.icon:SetWidth(height) frame.icon:SetSize(height, height)
frame.icon:SetHeight(height)
frame.icon:SetPoint("LEFT", frame, "LEFT", 0, 0) frame.icon:SetPoint("LEFT", frame, "LEFT", 0, 0)
frame.icon:SetTexCoord(.07,.93,.07,.93) frame.icon:SetTexCoord(.07,.93,.07,.93)
@@ -225,7 +222,7 @@ pfUI:RegisterModule("buffwatch", function ()
CreateBackdrop(frame) CreateBackdrop(frame)
CreateBackdropShadow(frame) CreateBackdropShadow(frame)
if bordercolor.r ~= "0" and bordercolor.g ~= "0" and bordercolor.b ~= "0" and bordercolor.a ~= "0" then if bordercolor.r ~= 0 and bordercolor.g ~= 0 and bordercolor.b ~= 0 and bordercolor.a ~= 0 then
frame.backdrop:SetBackdropBorderColor(bordercolor.r,bordercolor.g,bordercolor.b,1) frame.backdrop:SetBackdropBorderColor(bordercolor.r,bordercolor.g,bordercolor.b,1)
end end
@@ -422,18 +419,15 @@ pfUI:RegisterModule("buffwatch", function ()
if pfUI.uf.player and C.buffbar.pbuff.enable == "1" then if pfUI.uf.player and C.buffbar.pbuff.enable == "1" then
pfUI.uf.player.buffbar = CreateBuffBarFrame("Player", "HELPFUL") pfUI.uf.player.buffbar = CreateBuffBarFrame("Player", "HELPFUL")
local config = C.buffbar.pbuff local config = C.buffbar.pbuff
local r, g, b, a = strsplit(",", config.color)
local br, bg, bb, ba = strsplit(",", config.bordercolor)
local tr, tg, tb, ta = strsplit(",", config.textcolor)
pfUI.uf.player.buffbar:SetWidth(config.width == "-1" and pfUI.uf.player:GetWidth() or config.width) pfUI.uf.player.buffbar:SetWidth(config.width == "-1" and pfUI.uf.player:GetWidth() or config.width)
pfUI.uf.player.buffbar:SetHeight(config.height) pfUI.uf.player.buffbar:SetHeight(config.height)
pfUI.uf.player.buffbar.threshold = tonumber(config.threshold) pfUI.uf.player.buffbar.threshold = tonumber(config.threshold)
pfUI.uf.player.buffbar.config = config pfUI.uf.player.buffbar.config = config
pfUI.uf.player.buffbar.buffcmp = config.sort == "asc" and asc or desc pfUI.uf.player.buffbar.buffcmp = config.sort == "asc" and asc or desc
pfUI.uf.player.buffbar.color = { r = r, g = g, b = b, a = a } pfUI.uf.player.buffbar.color = GetStringColorObject(config.color)
pfUI.uf.player.buffbar.bordercolor = { r = br, g = bg, b = bb, a = ba } pfUI.uf.player.buffbar.bordercolor = GetStringColorObject(config.bordercolor)
pfUI.uf.player.buffbar.textcolor = { r = tr, g = tg, b = tb, a = ta } pfUI.uf.player.buffbar.textcolor = GetStringColorObject(config.textcolor)
pfUI.uf.player.buffbar.anchors = { pfUI.uf.player.buffbar.anchors = {
pfUI.uf.player, pfUI.uf.player,
pfUI.uf.player and pfUI.uf.player.debuffs, pfUI.uf.player and pfUI.uf.player.debuffs,
@@ -448,9 +442,6 @@ pfUI:RegisterModule("buffwatch", function ()
-- create player debuffbars -- create player debuffbars
if pfUI.uf.player and C.buffbar.pdebuff.enable == "1" then if pfUI.uf.player and C.buffbar.pdebuff.enable == "1" then
local config = C.buffbar.pdebuff local config = C.buffbar.pdebuff
local r, g, b, a = strsplit(",", config.color)
local br, bg, bb, ba = strsplit(",", config.bordercolor)
local tr, tg, tb, ta = strsplit(",", config.textcolor)
pfUI.uf.player.debuffbar = CreateBuffBarFrame("Player", "HARMFUL") pfUI.uf.player.debuffbar = CreateBuffBarFrame("Player", "HARMFUL")
pfUI.uf.player.debuffbar:SetWidth(config.width == "-1" and pfUI.uf.player:GetWidth() or config.width) pfUI.uf.player.debuffbar:SetWidth(config.width == "-1" and pfUI.uf.player:GetWidth() or config.width)
@@ -458,9 +449,9 @@ pfUI:RegisterModule("buffwatch", function ()
pfUI.uf.player.debuffbar.threshold = tonumber(config.threshold) pfUI.uf.player.debuffbar.threshold = tonumber(config.threshold)
pfUI.uf.player.debuffbar.config = config pfUI.uf.player.debuffbar.config = config
pfUI.uf.player.debuffbar.buffcmp = config.sort == "asc" and asc or desc pfUI.uf.player.debuffbar.buffcmp = config.sort == "asc" and asc or desc
pfUI.uf.player.debuffbar.color = { r = r, g = g, b = b, a = a } pfUI.uf.player.debuffbar.color = GetStringColorObject(config.color)
pfUI.uf.player.debuffbar.bordercolor = { r = br, g = bg, b = bb, a = ba } pfUI.uf.player.debuffbar.bordercolor = GetStringColorObject(config.bordercolor)
pfUI.uf.player.debuffbar.textcolor = { r = tr, g = tg, b = tb, a = ta } pfUI.uf.player.debuffbar.textcolor = GetStringColorObject(config.textcolor)
pfUI.uf.player.debuffbar.anchors = { pfUI.uf.player.debuffbar.anchors = {
pfUI.uf.player, pfUI.uf.player,
pfUI.uf.player and pfUI.uf.player.buffbar and pfUI.uf.player.buffbar.bars, pfUI.uf.player and pfUI.uf.player.buffbar and pfUI.uf.player.buffbar.bars,
@@ -476,18 +467,15 @@ pfUI:RegisterModule("buffwatch", function ()
-- create target debuffbars -- create target debuffbars
if pfUI.uf.target and C.buffbar.tdebuff.enable == "1" then if pfUI.uf.target and C.buffbar.tdebuff.enable == "1" then
local config = C.buffbar.tdebuff local config = C.buffbar.tdebuff
local r, g, b, a = strsplit(",", config.color)
local br, bg, bb, ba = strsplit(",", config.bordercolor)
local tr, tg, tb, ta = strsplit(",", config.textcolor)
pfUI.uf.target.debuffbar = CreateBuffBarFrame("Target", "HARMFUL") pfUI.uf.target.debuffbar = CreateBuffBarFrame("Target", "HARMFUL")
pfUI.uf.target.debuffbar:SetWidth(config.width == "-1" and pfUI.uf.target:GetWidth() or config.width) pfUI.uf.target.debuffbar:SetWidth(config.width == "-1" and pfUI.uf.target:GetWidth() or config.width)
pfUI.uf.target.debuffbar:SetHeight(config.height) pfUI.uf.target.debuffbar:SetHeight(config.height)
pfUI.uf.target.debuffbar.config = config pfUI.uf.target.debuffbar.config = config
pfUI.uf.target.debuffbar.buffcmp = config.sort == "asc" and asc or desc pfUI.uf.target.debuffbar.buffcmp = config.sort == "asc" and asc or desc
pfUI.uf.target.debuffbar.color = { r = r, g = g, b = b, a = a } pfUI.uf.target.debuffbar.color = GetStringColorObject(config.color)
pfUI.uf.target.debuffbar.bordercolor = { r = br, g = bg, b = bb, a = ba } pfUI.uf.target.debuffbar.bordercolor = GetStringColorObject(config.bordercolor)
pfUI.uf.target.debuffbar.textcolor = { r = tr, g = tg, b = tb, a = ta } pfUI.uf.target.debuffbar.textcolor = GetStringColorObject(config.textcolor)
pfUI.uf.target.debuffbar.threshold = tonumber(config.threshold) pfUI.uf.target.debuffbar.threshold = tonumber(config.threshold)
pfUI.uf.target.debuffbar.anchors = { pfUI.uf.target.debuffbar.anchors = {
pfUI.uf.target, pfUI.uf.target,
+112 -137
View File
@@ -16,9 +16,13 @@ pfUI:RegisterModule("castbar", function ()
end end
end end
-- Clear cast state on the bar. Shows the bar full for one frame, then -- Clear cast state on the bar and start the fade-out. On a normal end the bar
-- OnUpdate fades it out. -- is left at its current fill (a completed cast is already ~full; nothing
local function ClearBar(cb) -- snaps to full, which used to flash for a frame when the next cast stamped
-- the bar). When `failed` is set for a cast that was actually in progress, the
-- bar flashes full red before fading — the cancelled-cast indicator.
local function ClearBar(cb, failed)
local wasActive = cb.endTime ~= nil
cb.startTime, cb.endTime, cb.isChannel = nil, nil, nil cb.startTime, cb.endTime, cb.isChannel = nil, nil, nil
cb.activeName, cb.spellID = nil, nil cb.activeName, cb.spellID = nil, nil
cb.isTradeskill = nil cb.isTradeskill = nil
@@ -26,8 +30,11 @@ pfUI:RegisterModule("castbar", function ()
cb.tradeskillSingleMs, cb.currentCraftStart = nil, nil cb.tradeskillSingleMs, cb.currentCraftStart = nil, nil
cb.lastMax = nil cb.lastMax = nil
cb.delay = 0 cb.delay = 0
cb.bar:SetMinMaxValues(1, 100) if failed and wasActive then
cb.bar:SetValue(100) cb.bar:SetStatusBarColor(GetStringColor(C.appearance.castbar.failcolor))
cb.bar:SetMinMaxValues(0, 1)
cb.bar:SetValue(1)
end
if cb.bar.spark then cb.bar.spark:Hide() end if cb.bar.spark then cb.bar.spark:Hide() end
cb.fadeout = 1 cb.fadeout = 1
end end
@@ -65,8 +72,8 @@ pfUI:RegisterModule("castbar", function ()
end end
-- Mark the start of craft 2..N within an active merge (called from the -- Mark the start of craft 2..N within an active merge (called from the
-- SPELLCAST_START / SPELL_START_SELF handlers). Resets the per-craft -- UNIT_SPELLCAST_START handler). Resets the per-craft spark to the left
-- spark to the left edge of the bar. -- edge of the bar.
local function StartTradeskillCraft(cb) local function StartTradeskillCraft(cb)
cb.currentCraftStart = GetTime() * 1000 cb.currentCraftStart = GetTime() * 1000
local remaining = cb.tradeskillTotal - (cb.tradeskillCompleted or 0) local remaining = cb.tradeskillTotal - (cb.tradeskillCompleted or 0)
@@ -79,7 +86,7 @@ pfUI:RegisterModule("castbar", function ()
-- Stamp the bar with cast data and render text/icon/lag once. OnUpdate -- Stamp the bar with cast data and render text/icon/lag once. OnUpdate
-- then animates the fill from this state without touching C_Spell. -- then animates the fill from this state without touching C_Spell.
local function StampBar(cb, name, tex, startMs, endMs, spellID, isChannel, delayMs, isTradeskill) local function StampBar(cb, name, tex, startMs, endMs, spellID, isChannel, delayMs, isTradeskill, rank)
cb.startTime = startMs cb.startTime = startMs
cb.endTime = endMs cb.endTime = endMs
cb.isChannel = isChannel cb.isChannel = isChannel
@@ -92,10 +99,13 @@ pfUI:RegisterModule("castbar", function ()
cb.bar:SetStatusBarColor(GetStringColor(C.appearance.castbar[isChannel and "channelcolor" or "castbarcolor"])) cb.bar:SetStatusBarColor(GetStringColor(C.appearance.castbar[isChannel and "channelcolor" or "castbarcolor"]))
local rank = "" -- Rank: prefer the value the UNIT_SPELLCAST_* event delivered (arg5, passed
if spellID then -- through by RefreshBar). Only the retarget re-poll has no event in hand, so
-- it falls back to a lookup.
if not rank and spellID then
rank = C_Spell.GetSpellSubtext(spellID) or "" rank = C_Spell.GetSpellSubtext(spellID) or ""
end end
rank = rank or ""
local spellname = (cb.showname and name) and (name .. " ") or "" local spellname = (cb.showname and name) and (name .. " ") or ""
local rankstr = (cb.showrank and rank ~= "") and string.format("|cffaaffcc[%s]|r", rank) or "" local rankstr = (cb.showrank and rank ~= "") and string.format("|cffaaffcc[%s]|r", rank) or ""
cb.bar.left:SetText(spellname .. rankstr) cb.bar.left:SetText(spellname .. rankstr)
@@ -122,11 +132,21 @@ pfUI:RegisterModule("castbar", function ()
cb.bar:SetMinMaxValues(0, duration) cb.bar:SetMinMaxValues(0, duration)
cb.lastMax = duration cb.lastMax = duration
-- Prime the fill on this frame. StampBar otherwise leaves the previous
-- value in place (ClearBar, run on the prior cast's STOP, leaves it full),
-- so the bar would flash full for the frame between here and the next
-- OnUpdate tick. Reset the throttle too so the timer text updates promptly.
local nowSec = GetTime()
local cur = isChannel and (endMs / 1000 - nowSec) or (nowSec - startMs / 1000)
if cur < 0 then cur = 0 elseif cur > duration then cur = duration end
cb.bar:SetValue(cur)
cb.tick = 0
end end
-- One-shot poll: read C_Spell for the bar's unit, stamp or clear. Called -- One-shot poll: read C_Spell for the bar's unit, stamp or clear. Called
-- from event handlers (cast start, target/focus change), never per-frame. -- from event handlers (cast start, target/focus change), never per-frame.
local function RefreshBar(cb) local function RefreshBar(cb, rank)
local query = cb.unitstr ~= "" and cb.unitstr or cb.unitname local query = cb.unitstr ~= "" and cb.unitstr or cb.unitname
if not query or (cb.unitstr ~= "" and not UnitExists(cb.unitstr)) then if not query or (cb.unitstr ~= "" and not UnitExists(cb.unitstr)) then
ClearBar(cb) ClearBar(cb)
@@ -149,7 +169,7 @@ pfUI:RegisterModule("castbar", function ()
end end
end end
if name and startMs and endMs then if name and startMs and endMs then
StampBar(cb, name, tex, startMs, endMs, spellID, isChan, delayMs, isTradeskill) StampBar(cb, name, tex, startMs, endMs, spellID, isChan, delayMs, isTradeskill, rank)
else else
ClearBar(cb) ClearBar(cb)
end end
@@ -294,35 +314,27 @@ pfUI:RegisterModule("castbar", function ()
end end
end) end)
-- Cast lifecycle events. Player bars react to vanilla SPELLCAST_*; non- -- Cast lifecycle, entirely on ClassicAPI's UNIT_SPELLCAST_* events. They
-- player bars also react to Nampower SPELL_*_OTHER (gated by the -- fire per unit token: arg1=="player" for the player's own casts, and the
-- NP_EnableSpell{Start,Go}Events CVars, enabled by libdebuff) plus the -- remote token(s) ("target", "focus", ...) for other units -- so one set of
-- retarget event. Player events also feed non-player bars for the -- events drives every bar with no Nampower dependency. The handler routes an
-- target=self case. -- event to this bar when arg1 matches its unit, or -- since the player's own
cb:RegisterEvent("SPELLCAST_START") -- casts only ever fire arg1=="player" -- when the bar's unit resolves to the
cb:RegisterEvent("SPELLCAST_STOP") -- player (target=self). PLAYER_TARGET/FOCUS_CHANGED re-polls so a unit
cb:RegisterEvent("SPELLCAST_FAILED") -- already mid-cast when it becomes the target/focus still shows.
cb:RegisterEvent("SPELLCAST_INTERRUPTED") cb:RegisterEvent("UNIT_SPELLCAST_START")
cb:RegisterEvent("SPELLCAST_CHANNEL_START") cb:RegisterEvent("UNIT_SPELLCAST_STOP")
cb:RegisterEvent("SPELLCAST_CHANNEL_STOP") cb:RegisterEvent("UNIT_SPELLCAST_FAILED")
cb:RegisterEvent("SPELLCAST_CHANNEL_UPDATE") cb:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED")
cb:RegisterEvent("SPELL_DELAYED_SELF") cb:RegisterEvent("UNIT_SPELLCAST_DELAYED")
-- Chained same-spell recasts never run the client cast path (the 1.12 cb:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
-- engine short-circuits at spellID == current-cast), so vanilla cb:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START")
-- SPELLCAST_START never fires for them. nampower's SPELL_START_SELF cb:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP")
-- (server-driven) is the only signal that shows them. cb:RegisterEvent("UNIT_SPELLCAST_CHANNEL_UPDATE")
cb:RegisterEvent("SPELL_START_SELF") if unitstr == "target" then
if unitstr == "player" then cb:RegisterEvent("PLAYER_TARGET_CHANGED")
cb:RegisterEvent("SPELL_GO_SELF") elseif unitstr == "focus" then
end cb:RegisterEvent("PLAYER_FOCUS_CHANGED")
if unitstr ~= "player" and unitstr ~= "" then
cb:RegisterEvent("SPELL_START_OTHER")
cb:RegisterEvent("SPELL_FAILED_OTHER")
if unitstr == "target" then
cb:RegisterEvent("PLAYER_TARGET_CHANGED")
elseif unitstr == "focus" then
cb:RegisterEvent("PLAYER_FOCUS_CHANGED")
end
end end
cb:SetScript("OnEvent", function() cb:SetScript("OnEvent", function()
@@ -333,83 +345,33 @@ pfUI:RegisterModule("castbar", function ()
return return
end end
if event == "SPELL_START_OTHER" then -- UNIT_SPELLCAST_* fire per unit token (arg1). Handle an event when it's
-- arg3=casterGuid. Defer one frame so ClassicAPI's UnitChannelInfo -- for this bar's unit, or -- since the player's own casts only ever fire
-- can see the engine's +0x228 broadcast for remote-unit channels -- arg1=="player" -- when this bar's unit currently resolves to the player
-- (the cohook+packet handler runs in the same frame; the broadcast -- (target=self / focus=self).
-- propagates after). -- Args: arg1=unit, arg2=castGUID, arg3=spellID, arg4=name, arg5=rank.
if arg3 == UnitGUID(unit) then if arg1 ~= unit and not (arg1 == "player" and UnitIsUnit(unit, "player")) then
local target = this
RunNextFrame(function() RefreshBar(target) end)
end
return return
end end
if event == "SPELL_FAILED_OTHER" then if event == "UNIT_SPELLCAST_START" or event == "UNIT_SPELLCAST_CHANNEL_START" then
if arg1 == UnitGUID(unit) then ClearBar(this) end -- START also fires per craft in a same-spell chain, so an active merge
return -- just resyncs the current craft's spark/label instead of restamping.
end
-- Vanilla SPELLCAST_* + SPELL_DELAYED_SELF fire only for the local
-- player. Non-player bars handle them only when their unit currently
-- resolves to the player (target=self / focus=self).
if not UnitIsUnit(unit, 'player') then return end
if event == "SPELLCAST_START" or event == "SPELLCAST_CHANNEL_START" then
if this.tradeskillTotal then if this.tradeskillTotal then
-- Mid-chain craft N+1 of N. Keep the merged bar; resync the spark
-- to the new craft's start and refresh the "(N)" count label.
StartTradeskillCraft(this) StartTradeskillCraft(this)
else else
RefreshBar(this) RefreshBar(this, arg5)
if this.isTradeskill and (this.pendingTradeskillCount or 0) > 1 if this.isTradeskill and (this.pendingTradeskillCount or 0) > 1
and C.castbar.player.mergetradeskill == "1" then and C.castbar.player.mergetradeskill == "1" then
EnterTradeskillMerge(this, this.startTime, this.endTime, this.pendingTradeskillCount) EnterTradeskillMerge(this, this.startTime, this.endTime, this.pendingTradeskillCount)
end end
this.pendingTradeskillCount = nil this.pendingTradeskillCount = nil
end end
elseif event == "SPELL_START_SELF" then elseif event == "UNIT_SPELLCAST_SUCCEEDED" then
-- Catches chained same-spell recasts (no SPELLCAST_START fires) — -- Per-craft completion during a tradeskill merge (arg3 = spellID):
-- including tradeskill chaining where craft 2..N reuse one spell. -- count and clear when the chain is done. A no-op for normal casts,
-- Defer one frame so ClassicAPI's SMSG_SPELL_START co-hook has -- which are cleared by UNIT_SPELLCAST_STOP.
-- stamped g_cast before we poll, regardless of co-hook order. if this.tradeskillTotal and arg3 == this.tradeskillSpellID then
if this.tradeskillTotal then
StartTradeskillCraft(this)
else
local target = this
RunNextFrame(function()
-- Re-check: SPELL_START_SELF (nampower co-hook) fires before vanilla
-- SPELLCAST_START on the same packet, so SPELLCAST_START may have
-- entered merge in this same frame. Don't restamp over it.
if target.tradeskillTotal then
StartTradeskillCraft(target)
return
end
RefreshBar(target)
if target.unitstr == "player" and target.isTradeskill
and (target.pendingTradeskillCount or 0) > 1
and C.castbar.player.mergetradeskill == "1" then
EnterTradeskillMerge(target, target.startTime, target.endTime, target.pendingTradeskillCount)
end
target.pendingTradeskillCount = nil
end)
end
elseif event == "SPELLCAST_CHANNEL_STOP" then
-- A channel's stop can arrive after a following cast already claimed
-- the bar (channel->cast transition); only clear if a channel is
-- actually being shown, so it doesn't wipe an active cast bar.
if this.isChannel then ClearBar(this) end
elseif event == "SPELLCAST_STOP" then
-- During a tradeskill chain, SPELL_GO_SELF already counted this craft
-- and either cleared the bar (chain done) or kept it running. Only a
-- non-merge cast clears here.
if not this.tradeskillTotal then ClearBar(this) end
elseif event == "SPELLCAST_FAILED" or event == "SPELLCAST_INTERRUPTED" then
ClearBar(this)
elseif event == "SPELL_GO_SELF" then
-- arg2 = spellId. In a tradeskill merge, count each successful craft
-- and clear when the chain is done.
if this.tradeskillTotal and arg2 == this.tradeskillSpellID then
this.tradeskillCompleted = (this.tradeskillCompleted or 0) + 1 this.tradeskillCompleted = (this.tradeskillCompleted or 0) + 1
if this.tradeskillCompleted >= this.tradeskillTotal then if this.tradeskillCompleted >= this.tradeskillTotal then
ClearBar(this) ClearBar(this)
@@ -417,33 +379,46 @@ pfUI:RegisterModule("castbar", function ()
UpdateTradeskillLabel(this) UpdateTradeskillLabel(this)
end end
end end
elseif event == "SPELL_DELAYED_SELF" then elseif event == "UNIT_SPELLCAST_CHANNEL_STOP" then
-- Cast pushback. nampower's event carries the delay (arg2); apply it -- A channel's stop can arrive after a following cast already claimed
-- locally rather than re-polling, so the bar doesn't depend on -- the bar (channel->cast transition); only clear if a channel is
-- ClassicAPI's SMSG_SPELL_DELAYED co-hook having bumped g_cast before -- actually being shown, so it doesn't wipe an active cast bar.
-- this fires (co-hook order vs nampower is not guaranteed). if this.isChannel then ClearBar(this) end
if not this.endTime or not arg2 then return end elseif event == "UNIT_SPELLCAST_STOP" then
local delayMs = tonumber(arg2) or 0 -- STOP fires between crafts in a merge too (each craft is a new cast);
if delayMs > 0 then -- UNIT_SPELLCAST_SUCCEEDED owns the count, so only a non-merge cast
this.delay = (this.delay or 0) + delayMs / 1000 -- clears here.
this.endTime = this.endTime + delayMs if not this.tradeskillTotal then ClearBar(this) end
local newDuration = (this.endTime - this.startTime) / 1000 elseif event == "UNIT_SPELLCAST_FAILED" or event == "UNIT_SPELLCAST_INTERRUPTED" then
this.bar:SetMinMaxValues(0, newDuration) ClearBar(this, true)
this.lastMax = newDuration elseif event == "UNIT_SPELLCAST_DELAYED" or event == "UNIT_SPELLCAST_CHANNEL_UPDATE" then
end -- Pushback: a cast delayed later or a channel shortened. Following
elseif event == "SPELLCAST_CHANNEL_UPDATE" then -- Quartz, re-poll just the times and accumulate the shift into a running
-- Channel pushback. ClassicAPI doesn't track channel delay in -- this.delay for the +/- indicator, rather than a full restamp (which
-- g_channel, so we adjust endTime + delay locally and resize the -- would reset that total and re-render icon/text). ClassicAPI moves
-- bar so OnUpdate animates against the new total. -- endMs (SpellDelayed_h bumps g_cast.endMs; the MSG_CHANNEL_UPDATE
if not this.endTime or not arg1 then return end -- co-hook rewrites g_channel.endMs) while startMs stays put, so we diff
local newEndMs = GetTime() * 1000 + arg1 -- endMs. delay is a positive magnitude; OnUpdate signs it "+" for casts
local diff = this.endTime - newEndMs -- and "-" for channels. Skipped during a tradeskill merge.
if diff > 50 then if this.endTime and not this.tradeskillTotal then
this.delay = (this.delay or 0) + diff / 1000 local query = this.unitstr ~= "" and this.unitstr or this.unitname
this.endTime = newEndMs local startMs, endMs
local newDuration = (this.endTime - this.startTime) / 1000 if this.isChannel then
this.bar:SetMinMaxValues(0, newDuration) local _, _, _, s, e = C_Spell.UnitChannelInfo(query)
this.lastMax = newDuration startMs, endMs = s, e
else
local _, _, _, s, e = C_Spell.UnitCastingInfo(query)
startMs, endMs = s, e
end
if startMs and endMs then
local shift = this.isChannel and (this.endTime - endMs) or (endMs - this.endTime)
this.delay = (this.delay or 0) + shift / 1000
this.startTime = startMs
this.endTime = endMs
local newDuration = (endMs - startMs) / 1000
this.bar:SetMinMaxValues(0, newDuration)
this.lastMax = newDuration
end
end end
end end
end) end)
@@ -489,10 +464,10 @@ pfUI:RegisterModule("castbar", function ()
UpdateMovable(pfUI.castbar.player) UpdateMovable(pfUI.castbar.player)
-- Tradeskill merge: hook DoTradeSkill so the player castbar knows the -- Tradeskill merge: hook DoTradeSkill so the player castbar knows the
-- requested count before the first SPELLCAST_START fires. Always-on hook -- requested count before the first UNIT_SPELLCAST_START fires. Always-on
-- (the config knob is read at event time so toggling takes effect on the -- hook (the config knob is read at event time so toggling takes effect on
-- next craft without a /reload). DoTradeSkill is synchronous; the server -- the next craft without a /reload). DoTradeSkill is synchronous; the
-- roundtrip to SPELLCAST_START gives us plenty of time after this hook. -- server roundtrip to UNIT_SPELLCAST_START gives us plenty of time.
hooksecurefunc("DoTradeSkill", function(index, num) hooksecurefunc("DoTradeSkill", function(index, num)
if pfUI.castbar.player then if pfUI.castbar.player then
pfUI.castbar.player.pendingTradeskillCount = tonumber(num) or 1 pfUI.castbar.player.pendingTradeskillCount = tonumber(num) or 1
+1 -1
View File
@@ -429,7 +429,7 @@ pfUI:RegisterModule("chat", function ()
_G["ChatFrame" .. i .. "TabFlash"].Show = function() return end _G["ChatFrame" .. i .. "TabFlash"].Show = function() return end
end end
local _, class = UnitClass("player") local class = UnitClassBase("player")
local classColor = PFUI_CLASS_COLORS[class] local classColor = PFUI_CLASS_COLORS[class]
_G["ChatFrame" .. i .. "TabText"]:SetTextColor((classColor.r + .3) * .5, (classColor.g + .3) * .5, (classColor.b + .3) * .5, 1) _G["ChatFrame" .. i .. "TabText"]:SetTextColor((classColor.r + .3) * .5, (classColor.g + .3) * .5, (classColor.b + .3) * .5, 1)
_G["ChatFrame" .. i .. "TabText"]:SetFont(panelfont,panelfont_size, "OUTLINE") _G["ChatFrame" .. i .. "TabText"]:SetFont(panelfont,panelfont_size, "OUTLINE")
+1 -2
View File
@@ -96,8 +96,7 @@ pfUI:RegisterModule("chatcopy", function ()
scroll:Hide() scroll:Hide()
local editbox = CreateFrame("EditBox", "pfChatCopyBox" .. i, scroll) local editbox = CreateFrame("EditBox", "pfChatCopyBox" .. i, scroll)
editbox:SetHeight(frame:GetHeight()) editbox:SetSize(frame:GetSize())
editbox:SetWidth(frame:GetWidth())
editbox:SetAllPoints(scroll) editbox:SetAllPoints(scroll)
editbox:SetTextColor(1,1,1,1) editbox:SetTextColor(1,1,1,1)
editbox:SetFontObject(ChatFontNormal) editbox:SetFontObject(ChatFontNormal)
+1 -1
View File
@@ -5,7 +5,7 @@ pfUI:RegisterModule("combopoints", function ()
ComboFrame:Hide() ComboFrame:Hide()
ComboFrame:UnregisterAllEvents() ComboFrame:UnregisterAllEvents()
local _, class = UnitClass("player") local class = UnitClassBase("player")
local combo_width = C["unitframes"]["combowidth"] local combo_width = C["unitframes"]["combowidth"]
local combo_height = C["unitframes"]["comboheight"] local combo_height = C["unitframes"]["comboheight"]
pfUI.combopoints = {} pfUI.combopoints = {}
+2 -4
View File
@@ -123,8 +123,7 @@ pfUI:RegisterModule("easteregg", function ()
local f = GetExplosion() local f = GetExplosion()
f:ClearAllPoints() f:ClearAllPoints()
f:SetPoint("CENTER", fireworks, "TOPLEFT", x, y) f:SetPoint("CENTER", fireworks, "TOPLEFT", x, y)
f:SetWidth(25) f:SetSize(25, 25)
f:SetHeight(25)
f.tex:SetTexture(1,1,1,.5) f.tex:SetTexture(1,1,1,.5)
f:SetAlpha(1) f:SetAlpha(1)
f:Show() f:Show()
@@ -134,8 +133,7 @@ pfUI:RegisterModule("easteregg", function ()
local f = GetExplosion() local f = GetExplosion()
f:ClearAllPoints() f:ClearAllPoints()
f:SetPoint("CENTER", fireworks, "TOPLEFT", x+(math.random(0,100)-50), y+(math.random(0,100)-50)) f:SetPoint("CENTER", fireworks, "TOPLEFT", x+(math.random(0,100)-50), y+(math.random(0,100)-50))
f:SetWidth(2) f:SetSize(2, 2)
f:SetHeight(2)
f.tex:SetTexture(math.random(),math.random(),math.random(),1) f.tex:SetTexture(math.random(),math.random(),math.random(),1)
f:SetAlpha(1) f:SetAlpha(1)
f:Show() f:Show()
+1 -1
View File
@@ -2,7 +2,7 @@ local function getAdjustedTickTimer()
local adjustedEnergyTick = 2 local adjustedEnergyTick = 2
-- Check rogue talents and compute energy tick timing reduction for Combat spec (1.18.0 Blade Rush Talent) -- Check rogue talents and compute energy tick timing reduction for Combat spec (1.18.0 Blade Rush Talent)
if UnitClass("player") == "Rogue" then if UnitClassBase("player") == "ROGUE" then
local _, _, _, _, currRank = GetTalentInfo(2, 16) local _, _, _, _, currRank = GetTalentInfo(2, 16)
local bladeRushRank = currRank or 0 local bladeRushRank = currRank or 0
+3 -2
View File
@@ -41,8 +41,9 @@ pfUI:RegisterModule("farmmode", function ()
pfUI.farmmap:RegisterForDrag("LeftButton") pfUI.farmmap:RegisterForDrag("LeftButton")
pfUI.farmmap:SetScript("OnMouseWheel", function() pfUI.farmmap:SetScript("OnMouseWheel", function()
if IsControlKeyDown() then if IsControlKeyDown() then
this:SetWidth(this:GetWidth() + (arg1 > 0 and 10 or -10)) local adjust = (arg1 > 0 and 10 or -10)
this:SetHeight(this:GetHeight() + (arg1 > 0 and 10 or -10)) local width, height = this:GetSize()
this:SetSize(width + adjust, height + adjust)
Minimap_ZoomIn() Minimap_ZoomIn()
Minimap_ZoomOut() Minimap_ZoomOut()
elseif IsShiftKeyDown() then elseif IsShiftKeyDown() then
+1 -1
View File
@@ -1,5 +1,5 @@
pfUI:RegisterModule("hunterbar", function () pfUI:RegisterModule("hunterbar", function ()
local _,class = UnitClass("player") local class = UnitClassBase("player")
if class ~= "HUNTER" or C.bars.hunterbar == "0" then return end if class ~= "HUNTER" or C.bars.hunterbar == "0" then return end
-- Wing Clip (any rank) and Arcane Shot (any rank) spell IDs. -- Wing Clip (any rank) and Arcane Shot (any rank) spell IDs.
+1 -2
View File
@@ -7,8 +7,7 @@ pfUI:RegisterModule("innervatecall", function ()
if not GetNampowerVersion then return end if not GetNampowerVersion then return end
-- Only load for druids -- Only load for druids
local _, playerClass = UnitClass("player") if UnitClassBase("player") ~= "DRUID" then return end
if playerClass ~= "DRUID" then return end
local INNERVATE_SPELLID = 29166 local INNERVATE_SPELLID = 29166
+4 -6
View File
@@ -103,8 +103,8 @@ pfUI:RegisterModule("map", function ()
WorldMapFrame:ClearAllPoints() WorldMapFrame:ClearAllPoints()
WorldMapFrame:SetPoint("CENTER", UIParent, "CENTER", 0, 0) WorldMapFrame:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
WorldMapFrame:SetWidth(WorldMapButton:GetWidth() + 15) local wmWidth, wmHeight = WorldMapButton:GetSize()
WorldMapFrame:SetHeight(WorldMapButton:GetHeight() + 55) WorldMapFrame:SetSize(wmWidth + 15, wmHeight + 55)
LoadMovable(WorldMapFrame) LoadMovable(WorldMapFrame)
-- skin -- skin
@@ -126,8 +126,7 @@ pfUI:RegisterModule("map", function ()
btn:SetHighlightTexture("") btn:SetHighlightTexture("")
btn.text = _G["pfUI_map_autozoneswitchText"] btn.text = _G["pfUI_map_autozoneswitchText"]
CreateBackdrop(btn, nil, true) CreateBackdrop(btn, nil, true)
btn:SetWidth(14) btn:SetSize(14, 14)
btn:SetHeight(14)
btn:SetPoint("RIGHT", WorldMapContinentDropDown, "LEFT", -8, 2) btn:SetPoint("RIGHT", WorldMapContinentDropDown, "LEFT", -8, 2)
btn.text:ClearAllPoints() btn.text:ClearAllPoints()
btn.text:SetPoint("RIGHT", btn, "LEFT", -4, 1) btn.text:SetPoint("RIGHT", btn, "LEFT", -4, 1)
@@ -165,8 +164,7 @@ pfUI:RegisterModule("map", function ()
WorldMapButton.coords.text:SetJustifyH("RIGHT") WorldMapButton.coords.text:SetJustifyH("RIGHT")
WorldMapButton.coords:SetScript("OnUpdate", function() WorldMapButton.coords:SetScript("OnUpdate", function()
local width = WorldMapButton:GetWidth() local width, height = WorldMapButton:GetSize()
local height = WorldMapButton:GetHeight()
local mx, my = WorldMapButton:GetCenter() local mx, my = WorldMapButton:GetCenter()
local scale = WorldMapButton:GetEffectiveScale() local scale = WorldMapButton:GetEffectiveScale()
local x, y = GetCursorPosition() local x, y = GetCursorPosition()
+1 -1
View File
@@ -85,7 +85,7 @@ pfUI:RegisterModule("mapcolors", function ()
end end
local function ColorizeName(frame) local function ColorizeName(frame)
local _, class = UnitClass(frame.unit) local class = UnitClassBase(frame.unit)
local color = PFUI_CLASS_COLORS[class] local color = PFUI_CLASS_COLORS[class]
frame.name = frame.name or UnitName(frame.unit) frame.name = frame.name or UnitName(frame.unit)
frame.name = '|c'..color.colorStr..frame.name..'|r' frame.name = '|c'..color.colorStr..frame.name..'|r'
+73 -78
View File
@@ -4,7 +4,6 @@ pfUI:RegisterModule("nameplates", function ()
-- Local function references for performance -- Local function references for performance
local GetTime = GetTime local GetTime = GetTime
local UnitExists = UnitExists
local UnitName = UnitName local UnitName = UnitName
local UnitClass = UnitClass local UnitClass = UnitClass
local UnitLevel = UnitLevel local UnitLevel = UnitLevel
@@ -58,22 +57,26 @@ pfUI:RegisterModule("nameplates", function ()
local inFriendlyZone = false local inFriendlyZone = false
local platecount = 0 local platecount = 0
local registry = {} local registry = {}
-- Subset of registry that currently has a unit assigned (between
-- NAME_PLATE_UNIT_ADDED and _REMOVED). The central loop iterates this instead
-- of the full pool so hidden pool slots aren't touched every tick.
local visiblePlates = {}
local raidGuidCache = {} -- guid -> name (rebuilt on RAID_ROSTER_UPDATE/PARTY_MEMBERS_CHANGED) local raidGuidCache = {} -- guid -> name (rebuilt on RAID_ROSTER_UPDATE/PARTY_MEMBERS_CHANGED)
-- Per-GUID cast state, populated by nampower's SPELL_START_OTHER events and -- Per-GUID cast state, populated from ClassicAPI's UNIT_SPELLCAST_* events
-- cleared on SPELL_FAILED_OTHER / plate removal / expiry. This replaces the -- (which now fire for nameplate tokens) and cleared on STOP / plate removal /
-- old per-tick C_Spell poll on every visible plate: cast detection is now -- expiry. This replaces the old per-tick C_Spell poll on every visible plate:
-- event driven, and GetCastInfo just reads this cache. -- cast detection is event driven, and GetCastInfo just reads this cache.
local castState = {} local castState = {}
-- guid -> nameplate, maintained on NAME_PLATE_UNIT_ADDED/_REMOVED so a cast -- guid -> nameplate, maintained on NAME_PLATE_UNIT_ADDED/_REMOVED so a cast
-- event can find its plate in O(1) and only cache casts we actually show. -- event can find its plate in O(1) and only cache casts we actually show.
local plateByGuid = {} local plateByGuid = {}
local targetPlateGuid = nil
-- One-shot C_Spell poll. Only used to seed a plate that spawns while its -- One-shot C_Spell poll. Builds the cast struct for a UNIT_SPELLCAST_* event
-- unit is already mid-cast (its SPELL_START_OTHER fired before the plate -- (the payload carries no timing) and seeds a plate that spawns while its unit
-- existed). Never called per frame. -- is already mid-cast (its START fired before the plate existed). Picks cast
-- vs channel itself. Never called per frame.
local function PollCastInfo(unit) local function PollCastInfo(unit)
if not unit then return nil end if not unit then return nil end
local name, _, texture, startMs, endMs, _, _, _, spellID = C_Spell.UnitCastingInfo(unit) local name, _, texture, startMs, endMs, _, _, _, spellID = C_Spell.UnitCastingInfo(unit)
@@ -113,7 +116,7 @@ pfUI:RegisterModule("nameplates", function ()
local debuffDisplayBuf = {} -- [i] = { effect, texture, stacks, dtype, duration, timeleft } local debuffDisplayBuf = {} -- [i] = { effect, texture, stacks, dtype, duration, timeleft }
for i = 1, 16 do debuffDisplayBuf[i] = {} end for i = 1, 16 do debuffDisplayBuf[i] = {} end
local threatMemory = {} -- guid -> true if mob had player targeted local threatMemory = {} -- guid -> true if mob had player targeted
local debuffSeen = {} -- reusable table for debuff tracking (avoid GC churn) -- local debuffSeen = {} -- reusable table for debuff tracking (avoid GC churn)
-- PERF: visiblePlateCount maintained event-driven (NAME_PLATE_UNIT_ADDED/_REMOVED) -- PERF: visiblePlateCount maintained event-driven (NAME_PLATE_UNIT_ADDED/_REMOVED)
local visiblePlateCount = 0 local visiblePlateCount = 0
@@ -177,7 +180,6 @@ pfUI:RegisterModule("nameplates", function ()
-- ============================================================================ -- ============================================================================
local frameState = { local frameState = {
now = 0, now = 0,
hasTarget = false,
targetGuid = nil, targetGuid = nil,
mouseoverGuid = nil, mouseoverGuid = nil,
} }
@@ -448,8 +450,7 @@ pfUI:RegisterModule("nameplates", function ()
nameplate.debuffs[i]:SetPoint(aligna, nameplate.debuffs[i-limit], alignb, 0, space) nameplate.debuffs[i]:SetPoint(aligna, nameplate.debuffs[i-limit], alignb, 0, space)
end end
nameplate.debuffs[i]:SetWidth(tonumber(C.nameplates.debuffsize)) nameplate.debuffs[i]:SetSize(debuffsize, debuffsize)
nameplate.debuffs[i]:SetHeight(tonumber(C.nameplates.debuffsize))
-- Update cooldown display settings -- Update cooldown display settings
if nameplate.debuffs[i].cd then if nameplate.debuffs[i].cd then
@@ -476,11 +477,11 @@ nameplates:RegisterEvent("NAME_PLATE_UNIT_ADDED")
nameplates:RegisterEvent("NAME_PLATE_UNIT_REMOVED") nameplates:RegisterEvent("NAME_PLATE_UNIT_REMOVED")
nameplates:RegisterEvent("UNIT_AURA") nameplates:RegisterEvent("UNIT_AURA")
nameplates:RegisterEvent("UNIT_FLAGS") nameplates:RegisterEvent("UNIT_FLAGS")
-- nampower cast lifecycle for other units (gated by NP_EnableSpell{Start,Go} nameplates:RegisterEvent("UPDATE_MOUSEOVER_UNIT")
-- Events, enabled by libdebuff). Drives castbars event-first instead of nameplates:RegisterEvent("UNIT_SPELLCAST_START")
-- polling C_Spell on every plate each tick. Mirrors castbar.lua's target bar. nameplates:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START")
nameplates:RegisterEvent("SPELL_START_OTHER") nameplates:RegisterEvent("UNIT_SPELLCAST_STOP")
nameplates:RegisterEvent("SPELL_FAILED_OTHER") nameplates:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP")
nameplates:SetScript("OnEvent", function() nameplates:SetScript("OnEvent", function()
-- Stop event handling during logout to prevent crash 132 -- Stop event handling during logout to prevent crash 132
@@ -498,7 +499,7 @@ nameplates:RegisterEvent("SPELL_FAILED_OTHER")
CacheConfig() CacheConfig()
this:SetGameVariables() this:SetGameVariables()
RebuildRaidGuidCache() RebuildRaidGuidCache()
targetPlateGuid = UnitExists("target") and UnitGUID("target") or nil frameState.targetGuid = UnitGUID("target")
end end
-- Handle friendly zone nameplate disable feature -- Handle friendly zone nameplate disable feature
@@ -558,14 +559,15 @@ nameplates:RegisterEvent("SPELL_FAILED_OTHER")
-- token itself for token-based UnitX reads (stable per plate lifetime). -- token itself for token-based UnitX reads (stable per plate lifetime).
local plate = C_NamePlate.GetNamePlateForUnit(arg1) local plate = C_NamePlate.GetNamePlateForUnit(arg1)
if plate and plate.nameplate then if plate and plate.nameplate then
visiblePlates[plate] = plate
local guid = UnitGUID(arg1) local guid = UnitGUID(arg1)
plate.nameplate.cachedGuid = guid plate.nameplate.cachedGuid = guid
plate.nameplate.unit = arg1 plate.nameplate.unit = arg1
if guid then if guid then
plateByGuid[guid] = plate.nameplate plateByGuid[guid] = plate.nameplate
-- Seed: the unit may already be mid-cast (its SPELL_START_OTHER fired -- Seed: the unit may already be mid-cast (its UNIT_SPELLCAST_START
-- before this plate existed). One poll here catches that; ongoing -- fired before this plate existed). One poll here catches that;
-- casts arrive via the event. -- ongoing casts arrive via the event.
castState[guid] = PollCastInfo(arg1) castState[guid] = PollCastInfo(arg1)
end end
nameplates.OnShow(plate) nameplates.OnShow(plate)
@@ -576,6 +578,8 @@ nameplates:RegisterEvent("SPELL_FAILED_OTHER")
visiblePlateCount = visiblePlateCount > 0 and visiblePlateCount - 1 or 0 visiblePlateCount = visiblePlateCount > 0 and visiblePlateCount - 1 or 0
-- arg1 = "nameplateN" unit token; UnitGUID still resolves inside the -- arg1 = "nameplateN" unit token; UnitGUID still resolves inside the
-- handler (the slot is freed after dispatch returns) -- handler (the slot is freed after dispatch returns)
local plate = C_NamePlate.GetNamePlateForUnit(arg1)
if plate then visiblePlates[plate] = nil end
local guid = UnitGUID(arg1) local guid = UnitGUID(arg1)
if guid then if guid then
if debuffCache[guid] then debuffCache[guid] = nil end if debuffCache[guid] then debuffCache[guid] = nil end
@@ -583,7 +587,6 @@ nameplates:RegisterEvent("SPELL_FAILED_OTHER")
if combatColorCache[guid] then combatColorCache[guid] = nil end if combatColorCache[guid] then combatColorCache[guid] = nil end
if castState[guid] then castState[guid] = nil end if castState[guid] then castState[guid] = nil end
if plateByGuid[guid] then plateByGuid[guid] = nil end if plateByGuid[guid] then plateByGuid[guid] = nil end
local plate = C_NamePlate.GetNamePlateForUnit(arg1)
if plate and plate.nameplate and plate.nameplate.cachedGuid == guid then if plate and plate.nameplate and plate.nameplate.cachedGuid == guid then
plate.nameplate.cachedGuid = nil plate.nameplate.cachedGuid = nil
plate.nameplate.unit = nil plate.nameplate.unit = nil
@@ -591,10 +594,6 @@ nameplates:RegisterEvent("SPELL_FAILED_OTHER")
end end
elseif event == "UNIT_FLAGS" then elseif event == "UNIT_FLAGS" then
-- ClassicAPI: fires with arg1 == "nameplateN" when a unit's flags change
-- (stun, combat enter/leave). Flag that plate for an immediate update,
-- bypassing the throttle. Guard on the token prefix -- UNIT_FLAGS also
-- fires for target/party/raid, which aren't ours to handle here.
if arg1 and strfind(arg1, "^nameplate") then if arg1 and strfind(arg1, "^nameplate") then
local plate = C_NamePlate.GetNamePlateForUnit(arg1) local plate = C_NamePlate.GetNamePlateForUnit(arg1)
if plate and plate.nameplate then if plate and plate.nameplate then
@@ -602,39 +601,43 @@ nameplates:RegisterEvent("SPELL_FAILED_OTHER")
end end
end end
elseif event == "SPELL_START_OTHER" then elseif event == "UPDATE_MOUSEOVER_UNIT" then
-- nampower: arg2=spellId, arg3=casterGuid, arg6=castTime(ms), local new = UnitGUID("mouseover")
-- arg7=channel duration(ms, 0 if not a channel), arg8=spellType local old = frameState.mouseoverGuid
-- (1 = channel). Cache the cast only for a unit we have a plate for, so if new ~= old then
frameState.mouseoverGuid = new
local po = old and plateByGuid[old]
if po then po.eventcache = true end
local pn = new and plateByGuid[new]
if pn then pn.eventcache = true end
end
elseif event == "UNIT_SPELLCAST_START" or event == "UNIT_SPELLCAST_CHANNEL_START" then
-- ClassicAPI fires UNIT_SPELLCAST_* per unit token, including the caster's
-- "nameplateN". The payload has no timing, so poll it (PollCastInfo picks
-- cast vs channel) and cache -- only for a unit we have a plate for, so
-- the table stays bounded to on-screen casters. -- the table stays bounded to on-screen casters.
local casterGuid = arg3 if arg1 and strfind(arg1, "^nameplate") then
local plate = casterGuid and plateByGuid[casterGuid] local guid = UnitGUID(arg1)
if plate then local plate = guid and plateByGuid[guid]
local isChannel = arg8 == 1 if plate then
local durationMs = isChannel and arg7 or arg6 castState[guid] = PollCastInfo(arg1)
if durationMs and durationMs > 0 then if castState[guid] then
local spellId = arg2 plate.castUpdate = true -- bypass the throttle so the bar shows now
local now = GetTime() end
castState[casterGuid] = {
spellName = C_Spell.GetSpellName(spellId),
spellID = spellId,
icon = C_Spell.GetSpellTexture(spellId),
startTime = now,
endTime = now + durationMs / 1000,
duration = durationMs / 1000,
isChannel = isChannel,
}
plate.castUpdate = true -- bypass the throttle so the bar shows now
end end
end end
elseif event == "SPELL_FAILED_OTHER" then elseif event == "UNIT_SPELLCAST_STOP" or event == "UNIT_SPELLCAST_CHANNEL_STOP" then
-- nampower: arg1=casterGuid, arg2=spellId. Clear on interrupt/failure. -- Cast/channel ended (natural, interrupted, or cancelled -- the poll fires
local casterGuid = arg1 -- STOP for all three). Clear the cached cast and refresh its plate.
if casterGuid and castState[casterGuid] then if arg1 and strfind(arg1, "^nameplate") then
castState[casterGuid] = nil local guid = UnitGUID(arg1)
local plate = plateByGuid[casterGuid] if guid and castState[guid] then
if plate then plate.castUpdate = true end castState[guid] = nil
local plate = plateByGuid[guid]
if plate then plate.castUpdate = true end
end
end end
elseif event == "UNIT_AURA" then elseif event == "UNIT_AURA" then
@@ -652,7 +655,7 @@ nameplates:RegisterEvent("SPELL_FAILED_OTHER")
end end
elseif event == "PLAYER_TARGET_CHANGED" then elseif event == "PLAYER_TARGET_CHANGED" then
targetPlateGuid = UnitExists("target") and UnitGUID("target") or nil frameState.targetGuid = UnitGUID('target')
-- Flag the target's plate for update -- Flag the target's plate for update
local plate = C_NamePlate.GetNamePlateForUnit("target") local plate = C_NamePlate.GetNamePlateForUnit("target")
if plate and plate.nameplate then if plate and plate.nameplate then
@@ -681,21 +684,15 @@ nameplates:RegisterEvent("SPELL_FAILED_OTHER")
-- PERF: Cache GetTime() once per frame -- PERF: Cache GetTime() once per frame
frameState.now = now frameState.now = now
frameState.hasTarget, frameState.targetGuid = UnitExists("target")
frameState.mouseoverGuid = UnitGUID("mouseover")
-- propagate events to all nameplates
if this.eventcache then if this.eventcache then
this.eventcache = nil this.eventcache = nil
for plate in pairs(registry) do for plate in pairs(visiblePlates) do
plate.eventcache = true plate.nameplate.eventcache = true
end end
end end
-- visiblePlateCount is maintained event-driven via NAME_PLATE_UNIT_ADDED/_REMOVED. for plate in pairs(visiblePlates) do
-- Central OnUpdate for all visible plates
for plate in pairs(registry) do
if plate:IsVisible() then if plate:IsVisible() then
nameplates.OnUpdate(plate, frameState) nameplates.OnUpdate(plate, frameState)
end end
@@ -728,7 +725,7 @@ nameplates:RegisterEvent("SPELL_FAILED_OTHER")
nameplates.OnCreate = function(frame) nameplates.OnCreate = function(frame)
local parent = frame or this local parent = frame or this
platecount = platecount + 1 platecount = platecount + 1
platename = "pfNamePlate" .. platecount local platename = "pfNamePlate" .. platecount
-- create pfUI nameplate overlay -- create pfUI nameplate overlay
local nameplate = CreateFrame("Button", platename, parent) local nameplate = CreateFrame("Button", platename, parent)
@@ -793,8 +790,7 @@ nameplates:RegisterEvent("SPELL_FAILED_OTHER")
nameplate.totem = CreateFrame("Frame", nil, nameplate) nameplate.totem = CreateFrame("Frame", nil, nameplate)
nameplate.totem:SetPoint("CENTER", nameplate, "CENTER", 0, 0) nameplate.totem:SetPoint("CENTER", nameplate, "CENTER", 0, 0)
nameplate.totem:SetHeight(32) nameplate.totem:SetSize(32, 32)
nameplate.totem:SetWidth(32)
nameplate.totem.icon = nameplate.totem:CreateTexture(nil, "OVERLAY") nameplate.totem.icon = nameplate.totem:CreateTexture(nil, "OVERLAY")
nameplate.totem.icon:SetTexCoord(.078, .92, .079, .937) nameplate.totem.icon:SetTexCoord(.078, .92, .079, .937)
nameplate.totem.icon:SetAllPoints() nameplate.totem.icon:SetAllPoints()
@@ -882,11 +878,11 @@ nameplates:RegisterEvent("SPELL_FAILED_OTHER")
local plate_width = C.nameplates.width + 50 local plate_width = C.nameplates.width + 50
local plate_height = C.nameplates.heighthealth + font_size + 5 local plate_height = C.nameplates.heighthealth + font_size + 5
local plate_height_cast = C.nameplates.heighthealth + font_size + 5 + C.nameplates.heightcast + 5 -- local plate_height_cast = C.nameplates.heighthealth + font_size + 5 + C.nameplates.heightcast + 5
local combo_size = 5 local combo_size = 5
local width = tonumber(C.nameplates.width) -- local width = tonumber(C.nameplates.width)
local debuffsize = tonumber(C.nameplates.debuffsize) -- local debuffsize = tonumber(C.nameplates.debuffsize)
local healthoffset = tonumber(C.nameplates.health.offset) local healthoffset = tonumber(C.nameplates.health.offset)
local orientation = C.nameplates.verticalhealth == "1" and "VERTICAL" or "HORIZONTAL" local orientation = C.nameplates.verticalhealth == "1" and "VERTICAL" or "HORIZONTAL"
@@ -1337,7 +1333,7 @@ nameplates:RegisterEvent("SPELL_FAILED_OTHER")
-- and immediately correct on de-target (unlike istarget which updates one tick later) -- and immediately correct on de-target (unlike istarget which updates one tick later)
local targetGuid = state and state.targetGuid local targetGuid = state and state.targetGuid
local target = (targetGuid and nameplate.cachedGuid and targetGuid == nameplate.cachedGuid) or local target = (targetGuid and nameplate.cachedGuid and targetGuid == nameplate.cachedGuid) or
(state and state.hasTarget and frame:GetAlpha() >= 0.99) or nil (state and state.targetGuid and frame:GetAlpha() >= 0.99) or nil
-- Target plate castbar runs on its own dedicated frame (nameplates.castbarFrame). -- Target plate castbar runs on its own dedicated frame (nameplates.castbarFrame).
-- For non-target plates with castbar active, use castbar throttle to ensure -- For non-target plates with castbar active, use castbar throttle to ensure
-- smooth animation without overloading the central loop. -- smooth animation without overloading the central loop.
@@ -1451,7 +1447,7 @@ nameplates:RegisterEvent("SPELL_FAILED_OTHER")
-- Set non-target plate alpha -- Set non-target plate alpha
local configAlpha = cfg.notargalpha or 0.5 local configAlpha = cfg.notargalpha or 0.5
local desiredAlpha = (target or not state.hasTarget) and 1 or configAlpha local desiredAlpha = (target or not state.targetGuid) and 1 or configAlpha
if nameplate.cachedAlpha ~= desiredAlpha then if nameplate.cachedAlpha ~= desiredAlpha then
nameplate:SetAlpha(desiredAlpha) nameplate:SetAlpha(desiredAlpha)
@@ -1542,8 +1538,7 @@ nameplates:RegisterEvent("SPELL_FAILED_OTHER")
nameplate.health.zoomTransition = true nameplate.health.zoomTransition = true
else else
if nameplate.health.zoomTransition then if nameplate.health.zoomTransition then
nameplate.health:SetWidth(wc) nameplate.health:SetSize(wc, hc)
nameplate.health:SetHeight(hc)
nameplate.health.zoomTransition = nil nameplate.health.zoomTransition = nil
end end
nameplate.health.zoomed = true nameplate.health.zoomed = true
@@ -1668,8 +1663,8 @@ nameplates:RegisterEvent("SPELL_FAILED_OTHER")
-- loop's nameplates_castbar gate.) -- loop's nameplates_castbar gate.)
nameplates.castbarFrame = CreateFrame("Frame", nil, UIParent) nameplates.castbarFrame = CreateFrame("Frame", nil, UIParent)
nameplates.castbarFrame:SetScript("OnUpdate", function() nameplates.castbarFrame:SetScript("OnUpdate", function()
if not cfg.showcastbar or not targetPlateGuid then return end if not cfg.showcastbar or not frameState.targetGuid then return end
local nameplate = plateByGuid[targetPlateGuid] local nameplate = plateByGuid[frameState.targetGuid]
if not nameplate then return end if not nameplate then return end
nameplates.UpdateCastbar(nameplate, GetTime()) nameplates.UpdateCastbar(nameplate, GetTime())
end) end)
+1 -1
View File
@@ -34,7 +34,7 @@ pfUI:RegisterModule("player", function ()
playerFrame.infoTopCenterText:SetHeight(14) playerFrame.infoTopCenterText:SetHeight(14)
end end
local _, myclass = UnitClass("player") local myclass = UnitClassBase("player")
playerFrame.myclass = myclass playerFrame.myclass = myclass
playerFrame.isSpellCaster = myclass ~= "WARRIOR" and myclass ~= "ROGUE" and myclass ~= "HUNTER" playerFrame.isSpellCaster = myclass ~= "WARRIOR" and myclass ~= "ROGUE" and myclass ~= "HUNTER"
+2 -2
View File
@@ -82,7 +82,7 @@ pfUI:RegisterModule("swingtimer", function ()
local ohR, ohG, ohB, ohA = ParseColor(C.unitframes.swingtimerohcolor, 0.3, 0.8, 0.3, 1) local ohR, ohG, ohB, ohA = ParseColor(C.unitframes.swingtimerohcolor, 0.3, 0.8, 0.3, 1)
local raR, raG, raB, raA = ParseColor(C.unitframes.swingtimerrangedcolor, 0.3, 0.6, 1.0, 1) local raR, raG, raB, raA = ParseColor(C.unitframes.swingtimerrangedcolor, 0.3, 0.6, 1.0, 1)
local rwR, rwG, rwB, rwA = ParseColor(C.unitframes.swingtimerrangedwarncolor, 0.9, 0.0, 0.0, 1) local rwR, rwG, rwB, rwA = ParseColor(C.unitframes.swingtimerrangedwarncolor, 0.9, 0.0, 0.0, 1)
local isHunter = UnitClass("player") == "Hunter" local isHunter = UnitClassBase("player") == "HUNTER"
local mhDefaultR, mhDefaultG, mhDefaultB = mhR, mhG, mhB local mhDefaultR, mhDefaultG, mhDefaultB = mhR, mhG, mhB
@@ -908,7 +908,7 @@ pfUI:RegisterModule("swingtimer", function ()
S.autoAttackActive = false S.autoAttackActive = false
elseif event == "PLAYER_ENTERING_WORLD" then elseif event == "PLAYER_ENTERING_WORLD" then
local _, class = UnitClass("player") local class = UnitClassBase("player")
S.isWarrior = (class == "WARRIOR") S.isWarrior = (class == "WARRIOR")
S.isDruid = (class == "DRUID") S.isDruid = (class == "DRUID")
UpdateWeaponSpeeds() UpdateWeaponSpeeds()
+2 -2
View File
@@ -201,7 +201,7 @@ pfUI:RegisterModule("tooltip", function ()
local pvpname = UnitPVPName(unit) local pvpname = UnitPVPName(unit)
local name = UnitName(unit) local name = UnitName(unit)
local validTarget, target = pcall(UnitName, unit .. 'target') local validTarget, target = pcall(UnitName, unit .. 'target')
local _, class = UnitClass(unit) local class = UnitClassBase(unit)
local guild, rankstr, rankid = GetGuildInfo(unit) local guild, rankstr, rankid = GetGuildInfo(unit)
local reaction = UnitReaction(unit, "player") local reaction = UnitReaction(unit, "player")
local pvptitle = gsub(gsub(pvpname or name, name, "", 1), "^%s*(.-)%s*$", "%1") local pvptitle = gsub(gsub(pvpname or name, name, "", 1), "^%s*(.-)%s*$", "%1")
@@ -236,7 +236,7 @@ pfUI:RegisterModule("tooltip", function ()
end end
if validTarget and target then if validTarget and target then
local _, targetClass = UnitClass(unit .. "target") local targetClass = UnitClassBase(unit .. "target")
local targetReaction = UnitReaction("player",unit .. "target") local targetReaction = UnitReaction("player",unit .. "target")
if UnitIsPlayer(unit .. "target") and targetClass then if UnitIsPlayer(unit .. "target") and targetClass then
local color = PFUI_CLASS_COLORS[targetClass] local color = PFUI_CLASS_COLORS[targetClass]
+1 -1
View File
@@ -128,7 +128,7 @@ pfUI:RegisterModule("tracking", function ()
end) end)
function pfUI.tracking:RefreshSpells() function pfUI.tracking:RefreshSpells()
local _, playerClass = UnitClass("player") local playerClass = UnitClassBase("player")
local isCatForm = pfUI.tracking:PlayerIsDruidInCatForm(playerClass) local isCatForm = pfUI.tracking:PlayerIsDruidInCatForm(playerClass)
-- Build set of valid SpellIDs for this class -- Build set of valid SpellIDs for this class
+1 -1
View File
@@ -309,7 +309,7 @@ function pfUI:CheckNewModules()
pfUI_init.seen_modules = pfUI_init.seen_modules or {} pfUI_init.seen_modules = pfUI_init.seen_modules or {}
local pending = 0 local pending = 0
local _, playerClass = UnitClass("player") local playerClass = UnitClassBase("player")
for _, entry in pairs(pfUI.new_modules) do for _, entry in pairs(pfUI.new_modules) do
if not pfUI_init.seen_modules[entry.name] and pfUI_init["finalize"] then if not pfUI_init.seen_modules[entry.name] and pfUI_init["finalize"] then
if not entry.class or entry.class == playerClass then if not entry.class or entry.class == playerClass then
+2 -2
View File
@@ -3,8 +3,8 @@ pfUI:RegisterSkin("Game Menu", function ()
CreateBackdrop(GameMenuFrame, nil, true, .75) CreateBackdrop(GameMenuFrame, nil, true, .75)
CreateBackdropShadow(GameMenuFrame) CreateBackdropShadow(GameMenuFrame)
GameMenuFrame:SetWidth(GameMenuFrame:GetWidth() - 30) local menuWidth, menuHeight = GameMenuFrame:GetSize()
GameMenuFrame:SetHeight(GameMenuFrame:GetHeight() + 6) GameMenuFrame:SetSize(menuWidth - 30, menuHeight + 6)
local title = GetNoNameObject(GameMenuFrame, "FontString", "ARTWORK", MAIN_MENU) local title = GetNoNameObject(GameMenuFrame, "FontString", "ARTWORK", MAIN_MENU)
title:SetTextColor(1,1,1,1) title:SetTextColor(1,1,1,1)
+1 -1
View File
@@ -105,7 +105,7 @@ pfUI:RegisterSkin("Options - New", function ()
local er, eg, eb = pfUI.api.GetStringColor(pfUI_config.appearance.border.color) local er, eg, eb = pfUI.api.GetStringColor(pfUI_config.appearance.border.color)
btn:SetBackdropColor(br, bg, bb, 0.75) btn:SetBackdropColor(br, bg, bb, 0.75)
btn:SetBackdropBorderColor(er, eg, eb, 1) btn:SetBackdropBorderColor(er, eg, eb, 1)
local _, class = UnitClass("player") local class = UnitClassBase("player")
local color = PFUI_CLASS_COLORS[class] local color = PFUI_CLASS_COLORS[class]
SetHighlight(btn, color.r, color.g, color.b) SetHighlight(btn, color.r, color.g, color.b)
btn:SetFont(pfUI.font_default, pfUI_config.global.font_size, "OUTLINE") btn:SetFont(pfUI.font_default, pfUI_config.global.font_size, "OUTLINE")