mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-30 07:30:52 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76efd5b490 | ||
|
|
393b37b8c3 | ||
|
|
7928db33bf | ||
|
|
5d8314b2d4 | ||
|
|
3987cfb8a0 | ||
|
|
796f20eadf | ||
|
|
26c55bddb0 | ||
|
|
8c22fdb850 | ||
|
|
2d275c53fa | ||
|
|
ba752056ad | ||
|
|
1ccf87c61a | ||
|
|
dc89f01dda | ||
|
|
a917a70b1c | ||
|
|
03ea3d5aa5 | ||
|
|
2b4d33d46a | ||
|
|
94dcfb3dad | ||
|
|
0890905eb6 | ||
|
|
6c76a88467 | ||
|
|
35c32f365e | ||
|
|
6dcb5162be | ||
|
|
8afafe71cf | ||
|
|
99ed538ee7 | ||
|
|
f382039f21 | ||
|
|
8307dd757e |
+1
-1
@@ -13,7 +13,7 @@ do
|
||||
-- on. There pfUI does load, and will throw wherever it reaches for something
|
||||
-- the installed DLL doesn't have yet -- the popup names the cause so those
|
||||
-- errors aren't a mystery.
|
||||
local PFUI_CLASSIC_API_MIN = 11703 -- (X*10000 + Y*100 + Z)
|
||||
local PFUI_CLASSIC_API_MIN = 11802 -- (X*10000 + Y*100 + Z)
|
||||
local PFUI_CLASSIC_API_LATEST = PFUI_CLASSIC_API_MIN
|
||||
local PFUI_CLASSIC_API_WEBSITE = "https://github.com/brues-code/ClassicAPI"
|
||||
local PFUI_CLASSIC_API_LATEST_URL = PFUI_CLASSIC_API_WEBSITE .. "/releases/latest"
|
||||
|
||||
+22
-62
@@ -722,20 +722,7 @@ end
|
||||
function pfUI.api.CreateGoldString(money)
|
||||
if type(money) ~= "number" then return "-" end
|
||||
|
||||
if _G.GetCoinTextureString then
|
||||
return "|cffffffff" .. _G.GetCoinTextureString(money) .. "|r"
|
||||
end
|
||||
|
||||
local gold = floor(money/ 100 / 100)
|
||||
local silver = floor(mod((money/100),100))
|
||||
local copper = floor(mod(money,100))
|
||||
|
||||
local string = ""
|
||||
if gold > 0 then string = string .. "|cffffffff" .. gold .. "|cffffd700g" end
|
||||
if silver > 0 or gold > 0 then string = string .. "|cffffffff " .. silver .. "|cffc7c7cfs" end
|
||||
string = string .. "|cffffffff " .. copper .. "|cffeda55fc"
|
||||
|
||||
return string
|
||||
return "|cffffffff" .. _G.GetCoinTextureString(money) .. "|r"
|
||||
end
|
||||
|
||||
-- [ Enable Movable ]
|
||||
@@ -1353,15 +1340,18 @@ end
|
||||
|
||||
-- [ Bar Layout Options ] --
|
||||
-- 'barsize' size of bar in number of buttons
|
||||
-- returns: array of options as strings for pfUI.gui.bar
|
||||
-- returns: array of options as strings for pfUI.gui.bar: every grid
|
||||
-- that fits the bar exactly, plus common uneven ones
|
||||
function pfUI.api.BarLayoutOptions(barsize)
|
||||
assert(barsize > 0 and barsize <= NUM_ACTIONBAR_BUTTONS,"BarLayoutOptions: barsize "..tostring(barsize).." is invalid")
|
||||
local options, seen = {}, {}
|
||||
local function add(option)
|
||||
if not seen[option] then table.insert(options, option); seen[option] = true end
|
||||
end
|
||||
for i,layout in ipairs(pfGridmath[barsize]) do
|
||||
add(string.format("%d x %d",layout[1],layout[2]))
|
||||
for cols = 1, barsize do
|
||||
if barsize % cols == 0 then
|
||||
add(string.format("%d x %d", cols, barsize / cols))
|
||||
end
|
||||
end
|
||||
for _, option in ipairs({
|
||||
"1 x 12", "1 x 10", "2 x 10", "2 x 5", "3 x 10", "3 x 5", "3 x 3",
|
||||
@@ -1381,49 +1371,23 @@ function pfUI.api.BarLayoutOptions(barsize)
|
||||
return options
|
||||
end
|
||||
|
||||
-- [ Bar Layout Formfactor ] --
|
||||
-- 'option' string option as used in pfUI_config.bars[bar].option
|
||||
-- returns: integer formfactor
|
||||
local formfactors = {}
|
||||
setmetatable(formfactors, {__mode = "v"}) -- weak table so values not referenced are collected on next gc
|
||||
function pfUI.api.BarLayoutFormfactor(option)
|
||||
if formfactors[option] then
|
||||
return formfactors[option]
|
||||
else
|
||||
for barsize,_ in ipairs(pfGridmath) do
|
||||
local options = pfUI.api.BarLayoutOptions(barsize)
|
||||
for i,opt in ipairs(options) do
|
||||
if opt == option then
|
||||
formfactors[option] = i
|
||||
return formfactors[option]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- 'formfactor' has to be a "cols x rows" string; the actionbar module resets
|
||||
-- a stored layout that isn't one before it lays out a bar
|
||||
local function ResolveBarLayout(barsize, formfactor, uneven)
|
||||
local layout = tostring(formfactor or "")
|
||||
local _, _, a, b = string.find(layout, "(%d+)%s*x%s*(%d+)")
|
||||
if a and b then
|
||||
local cols, rows = tonumber(a), tonumber(b)
|
||||
cols = math.min(NUM_ACTIONBAR_BUTTONS, math.max(1, cols))
|
||||
rows = math.min(NUM_ACTIONBAR_BUTTONS, math.max(1, rows))
|
||||
local orientation = string.upper(uneven or "DOWN")
|
||||
local mode = (orientation == "LEFT" or orientation == "RIGHT") and "cols" or "rows"
|
||||
if mode == "rows" then
|
||||
cols = math.max(1, math.min(cols, barsize))
|
||||
rows = math.max(1, math.ceil(barsize / cols))
|
||||
else
|
||||
rows = math.max(1, math.min(rows, barsize))
|
||||
cols = math.max(1, math.ceil(barsize / rows))
|
||||
end
|
||||
return cols, rows, mode, orientation
|
||||
local _, _, a, b = string.find(formfactor, "(%d+)%s*x%s*(%d+)")
|
||||
local cols, rows = tonumber(a), tonumber(b)
|
||||
cols = math.min(NUM_ACTIONBAR_BUTTONS, math.max(1, cols))
|
||||
rows = math.min(NUM_ACTIONBAR_BUTTONS, math.max(1, rows))
|
||||
local orientation = string.upper(uneven or "DOWN")
|
||||
local mode = (orientation == "LEFT" or orientation == "RIGHT") and "cols" or "rows"
|
||||
if mode == "rows" then
|
||||
cols = math.max(1, math.min(cols, barsize))
|
||||
rows = math.max(1, math.ceil(barsize / cols))
|
||||
else
|
||||
rows = math.max(1, math.min(rows, barsize))
|
||||
cols = math.max(1, math.ceil(barsize / rows))
|
||||
end
|
||||
local index = pfUI.api.BarLayoutFormfactor(layout)
|
||||
if not index then return nil end
|
||||
local cols, rows = unpack(pfGridmath[barsize][index])
|
||||
return cols, rows, "rows", "DOWN"
|
||||
return cols, rows, mode, orientation
|
||||
end
|
||||
|
||||
-- [ Bar Layout Size ] --
|
||||
@@ -1434,7 +1398,6 @@ end
|
||||
function pfUI.api.BarLayoutSize(bar,barsize,formfactor,iconsize,bordersize,padding,uneven,fillmode)
|
||||
assert(barsize > 0 and barsize <= NUM_ACTIONBAR_BUTTONS,"BarLayoutSize: barsize "..tostring(barsize).." is invalid")
|
||||
local cols, rows = ResolveBarLayout(barsize, formfactor, uneven)
|
||||
if not cols or not rows then cols, rows = unpack(pfGridmath[barsize][1]) end
|
||||
local width = (iconsize + bordersize*2+padding) * cols + padding
|
||||
local height = (iconsize + bordersize*2+padding) * rows + padding
|
||||
bar._size = {width,height}
|
||||
@@ -1452,9 +1415,6 @@ end
|
||||
function pfUI.api.BarButtonAnchor(button,basename,buttonindex,barsize,formfactor,iconsize,bordersize,padding,uneven,fillmode)
|
||||
assert(barsize > 0 and barsize <= NUM_ACTIONBAR_BUTTONS,"BarButtonAnchor: barsize "..tostring(barsize).." is invalid")
|
||||
local cols, rows, mode, orientation = ResolveBarLayout(barsize, formfactor, uneven)
|
||||
if not cols or not rows then
|
||||
cols, rows, mode, orientation = unpack(pfGridmath[barsize][1]), "rows", "DOWN"
|
||||
end
|
||||
|
||||
-- fillmode: remap buttonindex to slotindex (grid position in native fill order)
|
||||
-- only needed when fill direction differs from layout mode
|
||||
|
||||
+1
-1
@@ -171,7 +171,6 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("appearance", "bags", "newitem_color", "1,1,1,1")
|
||||
pfUI:UpdateConfig("appearance", "bags", "borderlimit", "1")
|
||||
pfUI:UpdateConfig("appearance", "bags", "borderonlygear", "0")
|
||||
pfUI:UpdateConfig("appearance", "bags", "fulltext", "1")
|
||||
pfUI:UpdateConfig("appearance", "bags", "movable", "0")
|
||||
pfUI:UpdateConfig("appearance", "bags", "abovechat", "0")
|
||||
pfUI:UpdateConfig("appearance", "bags", "hidechat", "0")
|
||||
@@ -826,6 +825,7 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("chat", "text", "timeformat", "%H:%M:%S")
|
||||
pfUI:UpdateConfig("chat", "text", "timebracket", "[]")
|
||||
pfUI:UpdateConfig("chat", "text", "timecolor", ".8,.8,.8,1")
|
||||
pfUI:UpdateConfig("chat", "text", "copytime", "1")
|
||||
pfUI:UpdateConfig("chat", "text", "tintunknown", "1")
|
||||
pfUI:UpdateConfig("chat", "text", "unknowncolor", ".7,.7,.7,1")
|
||||
pfUI:UpdateConfig("chat", "text", "channelnumonly", "1")
|
||||
|
||||
+117
-323
@@ -3,19 +3,19 @@ setfenv(1, pfUI:GetEnvironment())
|
||||
|
||||
do -- statusbars
|
||||
local animations = {}
|
||||
local stepsize, val
|
||||
local width, height, point
|
||||
local stepsize
|
||||
|
||||
-- ClassicAPI before v1.18.0 leaves the UI scale in the size of an anchored
|
||||
-- frame, so the bar has to divide it back out
|
||||
local scaledsize = CLASSIC_API_VERSION < 11800
|
||||
-- native StatusBar methods the bar overrides
|
||||
local statusbar = CreateFrame("StatusBar")
|
||||
local SetValue, SetMinMaxValues = statusbar.SetValue, statusbar.SetMinMaxValues
|
||||
local SetOrientation, SetFrameLevel = statusbar.SetOrientation, statusbar.SetFrameLevel
|
||||
|
||||
local animate = CreateFrame("Frame", "pfStatusBarAnimation", UIParent)
|
||||
animate:SetScript("OnUpdate", function()
|
||||
stepsize = tonumber(pfUI_config.unitframes.animation_speed)
|
||||
|
||||
for bar in pairs(animations) do
|
||||
if not bar.val_ or abs(bar.val_ - bar.val) < stepsize or bar.instant then
|
||||
if not bar.val_ or abs(bar.val_ - bar.val) < stepsize then
|
||||
bar:DisplayValue(bar.val)
|
||||
elseif bar.val ~= bar.val_ then
|
||||
bar:DisplayValue(bar.val_ + min((bar.val-bar.val_) / stepsize, max(bar.val-bar.val_, 30 / GetFramerate())))
|
||||
@@ -25,7 +25,8 @@ do -- statusbars
|
||||
|
||||
local handlers = {
|
||||
["DisplayValue"] = function(self, val)
|
||||
val = Clamp(val, self.min, self.max)
|
||||
local smin, smax = self:GetMinMaxValues()
|
||||
val = Clamp(val, smin, smax)
|
||||
|
||||
-- remove animation queue
|
||||
if val == self.val_ then
|
||||
@@ -34,53 +35,20 @@ do -- statusbars
|
||||
|
||||
-- set current visible value
|
||||
self.val_ = val
|
||||
SetValue(self, val)
|
||||
|
||||
if self.mode == "vertical" then
|
||||
height = self:GetHeight()
|
||||
if scaledsize then height = height / self:GetEffectiveScale() end
|
||||
point = height / (self.max - self.min) * (val - self.min)
|
||||
|
||||
-- keep values in limits
|
||||
point = Clamp(point, 0, height)
|
||||
|
||||
-- set point to zero if value and max is zero
|
||||
if val == 0 then point = 0 end
|
||||
|
||||
-- set status bar position/size
|
||||
self.bar:SetPoint("TOPLEFT", self, "TOPLEFT", 0, - height + point)
|
||||
self.bar:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 0, 0)
|
||||
|
||||
-- set background bar position/size
|
||||
self.bg:SetPoint("TOPLEFT", self, "TOPLEFT", 0, 0)
|
||||
self.bg:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 0, point)
|
||||
else
|
||||
width = self:GetWidth()
|
||||
if scaledsize then width = width / self:GetEffectiveScale() end
|
||||
point = width / (self.max - self.min) * (val - self.min)
|
||||
|
||||
-- keep values in limits
|
||||
point = Clamp(point, 0, width)
|
||||
|
||||
-- set point to zero if value and max is zero
|
||||
if val == 0 then point = 0 end
|
||||
|
||||
-- set status bar position/size
|
||||
self.bar:SetPoint("TOPLEFT", self, "TOPLEFT", 0, 0)
|
||||
self.bar:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", - width + point, 0)
|
||||
|
||||
-- set background bar position/size
|
||||
self.bg:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 0, 0)
|
||||
self.bg:SetPoint("TOPLEFT", self, "TOPLEFT", point, 0)
|
||||
end
|
||||
-- the background fills the missing part, all of an empty range
|
||||
self.bg:SetValue(smax > smin and (smax - val) / (smax - smin) or 1)
|
||||
end,
|
||||
|
||||
["SetMinMaxValues"] = function(self, smin, smax, smooth)
|
||||
-- smoothen the transition by keeping the value at the same percentage as before
|
||||
if smooth and self.max and self.max > 0 and smax > 0 and self.max ~= smax then
|
||||
self.val_ = (self.val_ or self.val) / self.max * smax
|
||||
local _, oldmax = self:GetMinMaxValues()
|
||||
if smooth and oldmax > 0 and smax > 0 and oldmax ~= smax then
|
||||
self.val_ = (self.val_ or self.val) / oldmax * smax
|
||||
end
|
||||
|
||||
self.min, self.max = smin, smax
|
||||
SetMinMaxValues(self, smin, smax)
|
||||
self:DisplayValue(self.val_ or self.val)
|
||||
end,
|
||||
|
||||
@@ -93,41 +61,35 @@ do -- statusbars
|
||||
end
|
||||
end,
|
||||
|
||||
["SetStatusBarTexture"] = function(self, r, g, b, a)
|
||||
self.bar:SetTexture(r, g, b, a)
|
||||
end,
|
||||
|
||||
["SetStatusBarColor"] = function(self, r, g, b, a)
|
||||
self.bar:SetVertexColor(r, g, b, a)
|
||||
end,
|
||||
|
||||
["SetStatusBarBackgroundTexture"] = function(self, r, g, b, a)
|
||||
self.bg:SetTexture(r, g, b, a)
|
||||
end,
|
||||
|
||||
["SetStatusBarBackgroundColor"] = function(self, r, g, b, a)
|
||||
self.bg:SetVertexColor(r, g, b, a)
|
||||
self.bg:SetColorFill(r, g, b, a)
|
||||
end,
|
||||
|
||||
["SetOrientation"] = function(self, mode)
|
||||
self.mode = strlower(mode)
|
||||
["SetOrientation"] = function(self, orientation)
|
||||
SetOrientation(self, orientation)
|
||||
self.bg:SetOrientation(orientation)
|
||||
end,
|
||||
|
||||
-- the background stays one level below the fill, under anything else
|
||||
-- drawn on the fill's frame
|
||||
["SetFrameLevel"] = function(self, level)
|
||||
SetFrameLevel(self, level)
|
||||
self.bg:SetFrameLevel(level - 1)
|
||||
end,
|
||||
}
|
||||
|
||||
function pfUI.api.CreateStatusBar(name, parent)
|
||||
local f = CreateFrame("Button", name, parent)
|
||||
f:EnableMouse(false)
|
||||
local f = CreateFrame("StatusBar", name, parent)
|
||||
SetMinMaxValues(f, 0, 100)
|
||||
SetValue(f, 0)
|
||||
f.val = 0
|
||||
|
||||
f.bar = f:CreateTexture(nil, "NORMAL")
|
||||
f.bar:SetPoint("TOPLEFT", f, "TOPLEFT", 0, 0)
|
||||
f.bar:SetPoint("BOTTOMRIGHT", f, "BOTTOMRIGHT", 0, 0)
|
||||
|
||||
f.bg = f:CreateTexture(nil, "BACKGROUND")
|
||||
f.bg:SetPoint("TOPLEFT", f, "TOPLEFT", 0, 0)
|
||||
f.bg:SetPoint("BOTTOMRIGHT", f, "BOTTOMRIGHT", 0, 0)
|
||||
|
||||
-- set some default values
|
||||
f.min, f.max, f.val = 0, 100, 0
|
||||
f.bg = CreateFrame("StatusBar", nil, f)
|
||||
f.bg:SetFrameLevel(f:GetFrameLevel() - 1)
|
||||
f.bg:SetAllPoints(f)
|
||||
f.bg:SetReverseFill(true)
|
||||
f.bg:SetMinMaxValues(0, 1)
|
||||
f.bg:SetValue(1)
|
||||
|
||||
-- add all handler functions to the object
|
||||
for name, func in pairs(handlers) do
|
||||
@@ -354,186 +316,28 @@ do -- dropdown
|
||||
end
|
||||
end
|
||||
|
||||
function pfUI.api.CreateTabChild(self, title, bwidth, bheight, bottom, static)
|
||||
-- create tab button
|
||||
local b = CreateFrame("Button", "pfConfig" .. title .. "Button", self, "UIPanelButtonTemplate")
|
||||
b:SetText(title)
|
||||
-- [ pfUIScrollingEditBoxTemplate ]
|
||||
-- Mixin of the template in ui-widgets.xml: ClassicAPI's scrolling edit box
|
||||
-- with pfUI's scroll bar beside it.
|
||||
_G.pfUIScrollingEditBoxMixin = {}
|
||||
|
||||
-- setup env
|
||||
local childcount = table.getn(self.childs) + 1
|
||||
local button_width = bwidth
|
||||
local button_height = bheight or 20
|
||||
local border = 4
|
||||
|
||||
if not button_width then
|
||||
button_width = 150
|
||||
elseif button_width == true then
|
||||
button_width = _G["pfConfig" .. title .. "ButtonText"]:GetStringWidth() + 4 * border
|
||||
end
|
||||
|
||||
-- set dimensions
|
||||
b:SetSize(button_width, button_height)
|
||||
b:SetID(childcount)
|
||||
|
||||
if not self.align or self.align == "LEFT" then
|
||||
local outside = self.outside and -2 * border - button_width or 0
|
||||
if bottom then
|
||||
b:SetPoint("BOTTOMLEFT", self, "BOTTOMLEFT", border + outside, (self.bottomcount-1) * (button_height) + (self.bottomcount * border) )
|
||||
else
|
||||
b:SetPoint("TOPLEFT", self, "TOPLEFT", border + outside, -(childcount-1) * (button_height) - (childcount * border) )
|
||||
end
|
||||
elseif self.align == "TOP" then
|
||||
local outside = self.outside and 2 * border + button_height or 0
|
||||
local prev_button = self.buttons[getn(self.buttons)]
|
||||
if prev_button then
|
||||
b:SetPoint("TOPLEFT", prev_button, "TOPRIGHT", border, 0)
|
||||
else
|
||||
b:SetPoint("TOPLEFT", self, "TOPLEFT", border + (self.outside and -border), -border + outside )
|
||||
end
|
||||
end
|
||||
|
||||
SkinButton(b,.2,1,.8)
|
||||
|
||||
if childcount ~= 1 then
|
||||
b:SetTextColor(.5,.5,.5)
|
||||
else
|
||||
b:SetTextColor(.2,1,.8)
|
||||
end
|
||||
|
||||
b:SetScript("OnClick", function()
|
||||
for k,v in pairs(self.childs) do
|
||||
v:Hide()
|
||||
end
|
||||
self.childs[this:GetID()]:Show()
|
||||
|
||||
for k,v in pairs(self.buttons) do
|
||||
v.active = false
|
||||
v:SetTextColor(.5,.5,.5)
|
||||
end
|
||||
self.buttons[this:GetID()]:SetTextColor(.2,1,.8)
|
||||
end)
|
||||
|
||||
self.buttons[childcount] = b
|
||||
self.bottomcount = bottom and self.bottomcount + 1 or self.bottomcount
|
||||
|
||||
-- create child frame
|
||||
local child, scrollchild = nil, nil
|
||||
if not static then
|
||||
child = CreateScrollFrame("pfConfig" .. title .. "Frame", self)
|
||||
scrollchild = CreateScrollChild("pfConfig" .. title .. "ScrollChild", child)
|
||||
else
|
||||
child = CreateFrame("Frame", "pfConfig" .. title .. "Frame", self)
|
||||
end
|
||||
|
||||
if childcount ~= 1 then child:Hide() end
|
||||
|
||||
if not self.align or self.align == "LEFT" then
|
||||
child:SetPoint("TOPLEFT", self, "TOPLEFT", button_width + 2*border + 5, -border -5)
|
||||
child:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -border -5 , border + 5)
|
||||
elseif self.align == "TOP" then
|
||||
if self.outside then
|
||||
child:SetPoint("TOPLEFT", self, "TOPLEFT", 5, -5)
|
||||
child:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -5, 5)
|
||||
end
|
||||
end
|
||||
|
||||
CreateBackdrop(child)
|
||||
SetAllPointsOffset(child.backdrop, child, -5,5)
|
||||
|
||||
local ret = scrollchild or child
|
||||
ret.button = b
|
||||
table.insert(self.childs, child)
|
||||
return ret
|
||||
function pfUIScrollingEditBoxMixin:InitScrollBar()
|
||||
local scrollBox = self:GetScrollBox()
|
||||
scrollBox:ClearAllPoints()
|
||||
scrollBox:SetPoint("TOPLEFT")
|
||||
scrollBox:SetPoint("BOTTOMRIGHT", self.ScrollBar, "BOTTOMLEFT")
|
||||
ScrollUtil.RegisterScrollBoxWithScrollBar(scrollBox, self.ScrollBar)
|
||||
end
|
||||
|
||||
function pfUI.api.CreateTabFrame(parent, align, outside)
|
||||
local f = CreateFrame("Frame", nil, parent)
|
||||
|
||||
f:SetPoint("TOPLEFT", parent, "TOPLEFT", -5, 5)
|
||||
f:SetPoint("BOTTOMRIGHT", parent, "BOTTOMRIGHT", 5, -5)
|
||||
|
||||
-- setup env
|
||||
f.childs = { }
|
||||
f.buttons = { }
|
||||
f.align = align
|
||||
f.outside = outside
|
||||
f.bottomcount = 1
|
||||
|
||||
-- Create Child Frame
|
||||
f.CreateTabChild = pfUI.api.CreateTabChild
|
||||
|
||||
return f
|
||||
end
|
||||
|
||||
function pfUI.api.CreateScrollFrame(name, parent)
|
||||
local f = CreateFrame("ScrollFrame", name, parent)
|
||||
|
||||
-- create slider
|
||||
f.slider = CreateFrame("Slider", nil, f)
|
||||
f.slider:SetOrientation('VERTICAL')
|
||||
f.slider:SetPoint("TOPLEFT", f, "TOPRIGHT", -7, 0)
|
||||
f.slider:SetPoint("BOTTOMRIGHT", 0, 0)
|
||||
f.slider:SetThumbTexture(pfUI.media["img:col"])
|
||||
f.slider.thumb = f.slider:GetThumbTexture()
|
||||
f.slider.thumb:SetHeight(50)
|
||||
f.slider.thumb:SetTexture(.3,1,.8,.5)
|
||||
|
||||
f.slider:SetScript("OnValueChanged", function()
|
||||
f:SetVerticalScroll(this:GetValue())
|
||||
f.UpdateScrollState()
|
||||
end)
|
||||
|
||||
f.UpdateScrollState = function()
|
||||
f.slider:SetMinMaxValues(0, f:GetVerticalScrollRange())
|
||||
f.slider:SetValue(f:GetVerticalScroll())
|
||||
|
||||
local m = f:GetHeight()+f:GetVerticalScrollRange()
|
||||
local v = f:GetHeight()
|
||||
local ratio = v / m
|
||||
|
||||
if ratio < 1 then
|
||||
local size = math.floor(v * ratio)
|
||||
f.slider.thumb:SetHeight(size)
|
||||
f.slider:Show()
|
||||
else
|
||||
f.slider:Hide()
|
||||
end
|
||||
-- The edit box takes its font from a font object and sets that object again
|
||||
-- on every SetText, so a font path goes through a font object of the frame's own.
|
||||
function pfUIScrollingEditBoxMixin:SetFont(font, size, flags)
|
||||
if not self.font then
|
||||
self.font = CreateFont(self:GetName() .. "Font")
|
||||
self:GetEditBox().fontName = self.font
|
||||
end
|
||||
|
||||
f.Scroll = function(self, step)
|
||||
local step = step or 0
|
||||
|
||||
local current = f:GetVerticalScroll()
|
||||
local max = f:GetVerticalScrollRange()
|
||||
local new = current - step
|
||||
|
||||
f:SetVerticalScroll(Clamp(new, 0, max))
|
||||
|
||||
f:UpdateScrollState()
|
||||
end
|
||||
|
||||
f:EnableMouseWheel(1)
|
||||
f:SetScript("OnMouseWheel", function()
|
||||
this:Scroll(arg1*10)
|
||||
end)
|
||||
|
||||
return f
|
||||
end
|
||||
|
||||
function pfUI.api.CreateScrollChild(name, parent)
|
||||
local f = CreateFrame("Frame", name, parent)
|
||||
|
||||
-- dummy values required
|
||||
f:SetSize(1, 1)
|
||||
f:SetAllPoints(parent)
|
||||
|
||||
parent:SetScrollChild(f)
|
||||
|
||||
f:SetScript("OnUpdate", function()
|
||||
this:GetParent():UpdateScrollState()
|
||||
end)
|
||||
|
||||
return f
|
||||
self.font:SetFont(font, size, flags)
|
||||
self:SetFontObject(self.font)
|
||||
end
|
||||
|
||||
-- [ CreateTextBox ]
|
||||
@@ -1266,7 +1070,7 @@ end
|
||||
-- survives filter changes -- a spell icon you picked still saves after you
|
||||
-- switch the filter to "Items" and it drops out of the visible grid.
|
||||
--
|
||||
-- name global-name prefix for the scroll frame and editboxes
|
||||
-- name global-name prefix for the icon grid and editboxes
|
||||
-- parent the popup frame to attach the widgets to
|
||||
-- extraType IconDataProviderExtraType.* seed (Spellbook / Equipment)
|
||||
-- nameLabelText header shown above the name field
|
||||
@@ -1336,17 +1140,13 @@ function pfUI.api.CreateIconPicker(name, parent, extraType, nameLabelText)
|
||||
parent.iconLabel:SetPoint("TOPLEFT", parent, "TOPLEFT", 14, -86)
|
||||
parent.iconLabel:SetText(MACRO_POPUP_CHOOSE_ICON)
|
||||
|
||||
-- Icon grid + scroll
|
||||
local iconScroll = CreateFrame("ScrollFrame", name.."Scroll", parent, "FauxScrollFrameTemplate")
|
||||
iconScroll:SetPoint("TOPLEFT", parent, "TOPLEFT", 14, -116)
|
||||
iconScroll:SetWidth(ICON_GRID_COLS * (ICON_BTN_SIZE + ICON_BTN_PAD) - ICON_BTN_PAD)
|
||||
iconScroll:SetHeight(ICON_GRID_ROWS * (ICON_BTN_SIZE + ICON_BTN_PAD) - ICON_BTN_PAD)
|
||||
|
||||
local scrollbar = _G[name.."ScrollScrollBar"]
|
||||
scrollbar:ClearAllPoints()
|
||||
scrollbar:SetPoint("TOPLEFT", iconScroll, "TOPRIGHT", 8, -16)
|
||||
scrollbar:SetPoint("BOTTOMLEFT", iconScroll, "BOTTOMRIGHT", 8, 16)
|
||||
SkinScrollbar(scrollbar)
|
||||
-- Icon grid: the template keeps 5px around the grid and its 7px scroll bar,
|
||||
-- and the grid leaves 4px before the bar
|
||||
local gridWidth = ICON_GRID_COLS * (ICON_BTN_SIZE + ICON_BTN_PAD) - ICON_BTN_PAD
|
||||
local gridHeight = ICON_GRID_ROWS * (ICON_BTN_SIZE + ICON_BTN_PAD) - ICON_BTN_PAD
|
||||
local grid = CreateFrame("Frame", name.."Icons", parent, "pfUIScrollBoxListTemplate")
|
||||
grid:SetPoint("TOPLEFT", parent, "TOPLEFT", 9, -111)
|
||||
grid:SetSize(gridWidth + 4 + 7 + 10, gridHeight + 10)
|
||||
|
||||
-- Filter dropdown: All / Spells / Items
|
||||
local filterDropdown = CreateFrame("Frame", name.."Filter", parent, "UIDropDownMenuTemplate")
|
||||
@@ -1381,38 +1181,54 @@ function pfUI.api.CreateIconPicker(name, parent, extraType, nameLabelText)
|
||||
UIDropDownMenu_SetSelectedValue(filterDropdown, "all")
|
||||
SkinDropDown(filterDropdown)
|
||||
|
||||
local iconButtons = {}
|
||||
for r = 1, ICON_GRID_ROWS do
|
||||
for c = 1, ICON_GRID_COLS do
|
||||
local i = (r - 1) * ICON_GRID_COLS + c
|
||||
local btn = CreateFrame("Button", nil, parent)
|
||||
btn:SetSize(ICON_BTN_SIZE, ICON_BTN_SIZE)
|
||||
btn:SetPoint("TOPLEFT", iconScroll, "TOPLEFT", (c-1) * (ICON_BTN_SIZE + ICON_BTN_PAD), -(r-1) * (ICON_BTN_SIZE + ICON_BTN_PAD))
|
||||
-- the selected icon gets a gold border in the grid and shows in the preview
|
||||
local function UpdateSelection()
|
||||
grid.ScrollBox:ReinitializeFrames()
|
||||
parent.selectedPreview.tex:SetTexture(selectedIconPath)
|
||||
end
|
||||
|
||||
local function IconOnClick()
|
||||
local path = provider:GetIconByIndex(this.iconIndex)
|
||||
if path then selectedIconPath = path end
|
||||
UpdateSelection()
|
||||
end
|
||||
|
||||
local function IconOnEnter()
|
||||
local path = provider:GetIconByIndex(this.iconIndex)
|
||||
if type(path) == "string" then
|
||||
GameTooltip:SetOwner(this, "ANCHOR_RIGHT")
|
||||
GameTooltip:SetText(IconKey(path), 1, 1, 1)
|
||||
GameTooltip:Show()
|
||||
end
|
||||
end
|
||||
|
||||
local function InitIconButton(btn, icon)
|
||||
-- one-time setup of a pooled button
|
||||
if not btn.texture then
|
||||
CreateBackdrop(btn)
|
||||
btn.texture = btn:CreateTexture(nil, "ARTWORK")
|
||||
btn.texture:SetAllPoints(btn)
|
||||
btn.texture:SetTexCoord(.08, .92, .08, .92)
|
||||
btn:SetScript("OnClick", function()
|
||||
if this.iconIndex and provider then
|
||||
local path = provider:GetIconByIndex(this.iconIndex)
|
||||
if path then selectedIconPath = path end
|
||||
RefreshIconGrid()
|
||||
end
|
||||
end)
|
||||
btn:SetScript("OnEnter", function()
|
||||
if not this.iconIndex or not provider then return end
|
||||
local path = provider:GetIconByIndex(this.iconIndex)
|
||||
if type(path) == "string" then
|
||||
GameTooltip:SetOwner(this, "ANCHOR_RIGHT")
|
||||
GameTooltip:SetText(IconKey(path), 1, 1, 1)
|
||||
GameTooltip:Show()
|
||||
end
|
||||
end)
|
||||
btn:SetScript("OnClick", IconOnClick)
|
||||
btn:SetScript("OnEnter", IconOnEnter)
|
||||
btn:SetScript("OnLeave", GameTooltip_Hide)
|
||||
iconButtons[i] = btn
|
||||
end
|
||||
|
||||
btn.iconIndex = icon.index
|
||||
local path = provider:GetIconByIndex(icon.index)
|
||||
btn.texture:SetTexture(path)
|
||||
if IconKey(path) == IconKey(selectedIconPath) then
|
||||
btn.backdrop:SetBackdropBorderColor(1, 0.82, 0, 1)
|
||||
else
|
||||
btn.backdrop:SetBackdropBorderColor(pfUI.cache.er, pfUI.cache.eg, pfUI.cache.eb, pfUI.cache.ea)
|
||||
end
|
||||
end
|
||||
|
||||
local view = CreateScrollBoxListGridView(ICON_GRID_COLS, 0, 0, 0, 4, ICON_BTN_PAD, ICON_BTN_PAD)
|
||||
view:SetElementSize(ICON_BTN_SIZE, ICON_BTN_SIZE)
|
||||
view:SetElementInitializer("Button", InitIconButton)
|
||||
ScrollUtil.InitScrollBoxListWithScrollBar(grid.ScrollBox, grid.ScrollBar, view)
|
||||
|
||||
-- Rebuild the search-filtered index list (provider indices whose icon
|
||||
-- basename contains the search text); nil when the search box is empty.
|
||||
function RebuildFilter()
|
||||
@@ -1430,38 +1246,17 @@ function pfUI.api.CreateIconPicker(name, parent, extraType, nameLabelText)
|
||||
end
|
||||
end
|
||||
|
||||
-- one grid entry per provider index the filter lets through, scrolled to the top
|
||||
function RefreshIconGrid()
|
||||
EnsureProvider()
|
||||
local numIcons = filtered and table.getn(filtered) or provider:GetNumIcons()
|
||||
local numRows = math.ceil(numIcons / ICON_GRID_COLS)
|
||||
FauxScrollFrame_Update(iconScroll, numRows, ICON_GRID_ROWS, ICON_BTN_SIZE + ICON_BTN_PAD)
|
||||
local offset = FauxScrollFrame_GetOffset(iconScroll)
|
||||
for i = 1, ICON_GRID_ROWS * ICON_GRID_COLS do
|
||||
local listIdx = i + offset * ICON_GRID_COLS
|
||||
local btn = iconButtons[i]
|
||||
if listIdx <= numIcons then
|
||||
btn:Show()
|
||||
local providerIdx = filtered and filtered[listIdx] or listIdx
|
||||
btn.iconIndex = providerIdx
|
||||
local path = provider:GetIconByIndex(providerIdx)
|
||||
btn.texture:SetTexture(path)
|
||||
if IconKey(path) == IconKey(selectedIconPath) then
|
||||
btn.backdrop:SetBackdropBorderColor(1, 0.82, 0, 1)
|
||||
else
|
||||
btn.backdrop:SetBackdropBorderColor(pfUI.cache.er, pfUI.cache.eg, pfUI.cache.eb, pfUI.cache.ea)
|
||||
end
|
||||
else
|
||||
btn:Hide()
|
||||
btn.iconIndex = nil
|
||||
end
|
||||
if filtered then
|
||||
grid.ScrollBox:SetDataProvider(CreateDataProviderWithAssignedKey(filtered, "index"))
|
||||
else
|
||||
grid.ScrollBox:SetDataProvider(CreateDataProviderByIndexCount(provider:GetNumIcons()))
|
||||
end
|
||||
parent.selectedPreview.tex:SetTexture(selectedIconPath)
|
||||
end
|
||||
|
||||
iconScroll:SetScript("OnVerticalScroll", function()
|
||||
FauxScrollFrame_OnVerticalScroll(ICON_BTN_SIZE + ICON_BTN_PAD, function() RefreshIconGrid() end)
|
||||
end)
|
||||
|
||||
-- Search box (bottom-left) filters the grid by icon name.
|
||||
parent.searchLabel = parent:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||
parent.searchLabel:SetPoint("BOTTOMLEFT", parent, "BOTTOMLEFT", 16, 18)
|
||||
@@ -1476,13 +1271,14 @@ function pfUI.api.CreateIconPicker(name, parent, extraType, nameLabelText)
|
||||
parent.search:SetScript("OnTextChanged", function()
|
||||
searchText = strupper(strtrim(this:GetText()))
|
||||
RebuildFilter()
|
||||
scrollbar:SetValue(0)
|
||||
RefreshIconGrid()
|
||||
end)
|
||||
|
||||
-- Release the provider when the popup closes so its icon cache GCs.
|
||||
-- Release the provider when the popup closes so its icon cache GCs, and
|
||||
-- the grid's entries that index into it.
|
||||
parent:HookScript("OnHide", function()
|
||||
if provider then provider:Release(); provider = nil end
|
||||
grid.ScrollBox:RemoveDataProvider()
|
||||
end)
|
||||
|
||||
local handle = { editbox = parent.editbox, search = parent.search }
|
||||
@@ -1490,15 +1286,13 @@ function pfUI.api.CreateIconPicker(name, parent, extraType, nameLabelText)
|
||||
function handle.SetIcon(path) selectedIconPath = path or QUESTION_MARK end
|
||||
function handle.Refresh() RefreshIconGrid() end
|
||||
function handle.SetIconAreaShown(shown)
|
||||
local method = shown and "Show" or "Hide"
|
||||
iconScroll[method](iconScroll)
|
||||
for _, b in ipairs(iconButtons) do b[method](b) end
|
||||
parent.iconLabel[method](parent.iconLabel)
|
||||
parent.selectedLabel[method](parent.selectedLabel)
|
||||
parent.selectedPreview[method](parent.selectedPreview)
|
||||
filterDropdown[method](filterDropdown)
|
||||
parent.searchLabel[method](parent.searchLabel)
|
||||
parent.search[method](parent.search)
|
||||
grid:SetShown(shown)
|
||||
parent.iconLabel:SetShown(shown)
|
||||
parent.selectedLabel:SetShown(shown)
|
||||
parent.selectedPreview:SetShown(shown)
|
||||
filterDropdown:SetShown(shown)
|
||||
parent.searchLabel:SetShown(shown)
|
||||
parent.search:SetShown(shown)
|
||||
end
|
||||
return handle
|
||||
end
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/">
|
||||
<!--
|
||||
pfUI's scroll bar for ClassicAPI's ScrollBox: a thin track with a flat
|
||||
thumb. ScrollBarMixin needs Back and Forward steppers, so they exist but
|
||||
stay hidden. Hook it up with ScrollUtil.InitScrollBoxListWithScrollBar.
|
||||
-->
|
||||
<EventFrame name="pfUIScrollBarTemplate" inherits="VerticalScrollBarTemplate" virtual="true">
|
||||
<Size x="7"/>
|
||||
<KeyValues>
|
||||
<KeyValue key="hideIfUnscrollable" value="true" type="boolean"/>
|
||||
</KeyValues>
|
||||
<Frames>
|
||||
<Frame parentKey="Track" setAllPoints="true" enableMouse="true">
|
||||
<Frames>
|
||||
<EventButton parentKey="Thumb">
|
||||
<Size x="7"/>
|
||||
<Layers>
|
||||
<Layer level="ARTWORK">
|
||||
<Texture setAllPoints="true">
|
||||
<Color r=".3" g="1" b=".8" a=".5"/>
|
||||
</Texture>
|
||||
</Layer>
|
||||
</Layers>
|
||||
</EventButton>
|
||||
</Frames>
|
||||
</Frame>
|
||||
<EventButton parentKey="Back" hidden="true"/>
|
||||
<EventButton parentKey="Forward" hidden="true"/>
|
||||
</Frames>
|
||||
</EventFrame>
|
||||
|
||||
<!--
|
||||
A ScrollFrame for free-form content, with pfUIScrollBarTemplate inside its
|
||||
right edge. Put the content in frame.Content, which spans the frame: the
|
||||
engine measures the scroll range from the shown frames inside it, so the
|
||||
content needs no height. Changes inside it are not measured until
|
||||
frame:UpdateScrollChildRect().
|
||||
-->
|
||||
<ScrollFrame name="pfUIScrollFrameTemplate" virtual="true">
|
||||
<Frames>
|
||||
<EventFrame parentKey="ScrollBar" inherits="pfUIScrollBarTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOPRIGHT"/>
|
||||
<Anchor point="BOTTOMRIGHT"/>
|
||||
</Anchors>
|
||||
</EventFrame>
|
||||
</Frames>
|
||||
<ScrollChild>
|
||||
<Frame parentKey="Content">
|
||||
<Size x="1" y="1"/>
|
||||
</Frame>
|
||||
</ScrollChild>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
self.Content:SetAllPoints()
|
||||
self:EnableMouseWheel(true)
|
||||
ScrollUtil.InitScrollFrameWithScrollBar(self, self.ScrollBar)
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</ScrollFrame>
|
||||
|
||||
<!--
|
||||
A WowScrollBoxList with pfUIScrollBarTemplate beside it, both 5px inside the
|
||||
frame so CreateBackdrop(frame, nil, true) can frame them. Fill it with
|
||||
ScrollUtil.InitScrollBoxListWithScrollBar(frame.ScrollBox, frame.ScrollBar, view).
|
||||
-->
|
||||
<Frame name="pfUIScrollBoxListTemplate" virtual="true">
|
||||
<Frames>
|
||||
<EventFrame parentKey="ScrollBar" inherits="pfUIScrollBarTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOPRIGHT" x="-5" y="-5"/>
|
||||
<Anchor point="BOTTOMRIGHT" x="-5" y="5"/>
|
||||
</Anchors>
|
||||
</EventFrame>
|
||||
<Frame parentKey="ScrollBox" inherits="WowScrollBoxList">
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT" x="5" y="-5"/>
|
||||
<Anchor point="BOTTOMRIGHT" relativeKey="$parent.ScrollBar" relativePoint="BOTTOMLEFT"/>
|
||||
</Anchors>
|
||||
</Frame>
|
||||
</Frames>
|
||||
</Frame>
|
||||
|
||||
<!--
|
||||
ClassicAPI's ScrollingEditBoxTemplate with pfUIScrollBarTemplate beside the
|
||||
text. The frame needs a name: SetFont(font, size, flags) names its font
|
||||
object after it.
|
||||
-->
|
||||
<Frame name="pfUIScrollingEditBoxTemplate" inherits="ScrollingEditBoxTemplate" mixin="pfUIScrollingEditBoxMixin" virtual="true">
|
||||
<KeyValues>
|
||||
<KeyValue key="maxLetters" value="0" type="number"/>
|
||||
</KeyValues>
|
||||
<Frames>
|
||||
<EventFrame parentKey="ScrollBar" inherits="pfUIScrollBarTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOPRIGHT"/>
|
||||
<Anchor point="BOTTOMRIGHT"/>
|
||||
</Anchors>
|
||||
</EventFrame>
|
||||
</Frames>
|
||||
<Scripts>
|
||||
<OnLoad method="InitScrollBar" inherit="prepend"/>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
</Ui>
|
||||
+64
-44
@@ -235,7 +235,50 @@ function pfUI.api.GetUnitStats(unitstr)
|
||||
end
|
||||
|
||||
local aggrodata = { }
|
||||
local aggroScan = nil -- static { u, t, tt } triples, built once so the hot scan allocates nothing
|
||||
|
||||
-- every unit whose target or target's target UnitHasAggro checks, as static
|
||||
-- { u, t, tt } triples so the hot scan allocates nothing
|
||||
local aggroScan = { }
|
||||
do
|
||||
local function add(u)
|
||||
local t = u .. "target"
|
||||
table.insert(aggroScan, { u = u, t = t, tt = t .. "target" })
|
||||
end
|
||||
|
||||
add("pet")
|
||||
add("player")
|
||||
add("target")
|
||||
add("mouseover")
|
||||
|
||||
add("focus")
|
||||
add("focustarget")
|
||||
add("focustargettarget")
|
||||
|
||||
add("pettarget")
|
||||
add("playertarget")
|
||||
add("targettarget")
|
||||
add("mouseovertarget")
|
||||
add("targettargettarget")
|
||||
|
||||
for i=1,4 do
|
||||
add("party" .. i)
|
||||
add("party" .. i .. "target")
|
||||
add("partypet" .. i)
|
||||
add("partypet" .. i .. "target")
|
||||
end
|
||||
|
||||
for i=1,40 do
|
||||
add("raid" .. i)
|
||||
add("raid" .. i .. "target")
|
||||
|
||||
add("raidpet" .. i)
|
||||
add("raidpet" .. i .. "target")
|
||||
|
||||
add("nameplate" .. i)
|
||||
add("nameplate" .. i .. "target")
|
||||
end
|
||||
end
|
||||
|
||||
function pfUI.api.UnitHasAggro(unit)
|
||||
local now = GetTime()
|
||||
local data = aggrodata[unit]
|
||||
@@ -250,16 +293,6 @@ function pfUI.api.UnitHasAggro(unit)
|
||||
data.state = 0
|
||||
|
||||
if UnitExists(unit) and UnitIsFriend(unit, "player") then
|
||||
-- pfValidUnits never changes after load, so precompute the "<u>target" /
|
||||
-- "<u>targettarget" token strings once instead of concatenating per call.
|
||||
if not aggroScan then
|
||||
aggroScan = {}
|
||||
for u in pairs(pfValidUnits) do
|
||||
local t = u .. "target"
|
||||
table.insert(aggroScan, { u = u, t = t, tt = t .. "target" })
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, table.getn(aggroScan) do
|
||||
local s = aggroScan[i]
|
||||
if UnitExists(s.t) and UnitIsUnit(s.t, unit) and UnitCanAttack(s.u, unit) then
|
||||
@@ -349,11 +382,10 @@ function pfUI.uf:UpdateVisibility()
|
||||
|
||||
-- this runs for every frame five times a second, so only touch the
|
||||
-- attribute when the unit actually changed
|
||||
local unitstr = (self.label or "") .. (self.id or "")
|
||||
local unit = unitstr ~= "" and unitstr or nil
|
||||
if unit ~= self.unitstr then
|
||||
self.unitstr = unit
|
||||
self:SetAttribute("unit", unit)
|
||||
local unitstr = self.label .. self.id
|
||||
if unitstr ~= self.unitstr then
|
||||
self.unitstr = unitstr
|
||||
self:SetAttribute("unit", unitstr)
|
||||
end
|
||||
-- anything but "show"/"hide" means "show if the unit exists"
|
||||
local visibility = "exists"
|
||||
@@ -395,9 +427,7 @@ function pfUI.uf:UpdateVisibility()
|
||||
self:RegisterUnitEvents(visibility ~= "hide" and self.unitstr or nil)
|
||||
|
||||
-- vanilla visibility
|
||||
if self.unitname then
|
||||
self:Show()
|
||||
elseif visibility == "hide" then
|
||||
if visibility == "hide" then
|
||||
self:Hide()
|
||||
elseif visibility == "show" then
|
||||
self:Show()
|
||||
@@ -508,6 +538,8 @@ function pfUI.uf:UpdateConfig()
|
||||
if tonumber(f.config.height) < 0 then f.hp:Hide() end
|
||||
pfUI.api.CreateBackdrop(f.hp, default_border)
|
||||
|
||||
-- one level above the backdrop for the bar's background, one more for its fill
|
||||
f.hp.bar:SetFrameLevel(f.hp.backdrop:GetFrameLevel() + 2)
|
||||
f.hp.bar:SetStatusBarTexture(pfUI.media[f.config.bartexture])
|
||||
f.hp.bar:SetAllPoints(f.hp)
|
||||
if f.config.verticalbar == "1" then
|
||||
@@ -522,7 +554,7 @@ function pfUI.uf:UpdateConfig()
|
||||
if custombg == "1" then
|
||||
local cr, cg, cb, ca = GetStringColor(custombgcolor)
|
||||
cr, cg, cb, ca = tonumber(cr), tonumber(cg), tonumber(cb), tonumber(ca)
|
||||
f.hp.bar:SetStatusBarBackgroundTexture(cr,cg,cb,ca)
|
||||
f.hp.bar:SetStatusBarBackgroundColor(cr,cg,cb,ca)
|
||||
end
|
||||
|
||||
f.power:ClearAllPoints()
|
||||
@@ -531,7 +563,7 @@ function pfUI.uf:UpdateConfig()
|
||||
if tonumber(f.config.pheight) < 0 then f.power:Hide() end
|
||||
|
||||
pfUI.api.CreateBackdrop(f.power, default_border)
|
||||
f.power.bar:SetFrameLevel(f.power.backdrop:GetFrameLevel() + 1)
|
||||
f.power.bar:SetFrameLevel(f.power.backdrop:GetFrameLevel() + 2)
|
||||
f.power.bar:SetStatusBarTexture(pfUI.media[f.config.pbartexture])
|
||||
f.power.bar:SetAllPoints(f.power)
|
||||
|
||||
@@ -541,7 +573,7 @@ function pfUI.uf:UpdateConfig()
|
||||
if custompbg == "1" then
|
||||
local cr, cg, cb, ca = GetStringColor(custompbgcolor)
|
||||
cr, cg, cb, ca = tonumber(cr), tonumber(cg), tonumber(cb), tonumber(ca)
|
||||
f.power.bar:SetStatusBarBackgroundTexture(cr,cg,cb,ca)
|
||||
f.power.bar:SetStatusBarBackgroundColor(cr,cg,cb,ca)
|
||||
end
|
||||
|
||||
local fontname, fontsize, fontstyle
|
||||
@@ -1019,6 +1051,8 @@ function pfUI.uf.OnEvent()
|
||||
this.update_pvp = true
|
||||
elseif event == "UNIT_COMBAT" then
|
||||
CombatFeedback_OnCombatEvent(arg2, arg3, arg4, arg5)
|
||||
elseif event == "INCOMING_RESURRECT_CHANGED" then
|
||||
this.update_indicators = true
|
||||
else
|
||||
this.update_base = true
|
||||
end
|
||||
@@ -1189,10 +1223,6 @@ function pfUI.uf.OnUpdate()
|
||||
this.incHeal:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
-- update ressurections
|
||||
local ress = libpredict:UnitHasIncomingResurrection(unit)
|
||||
this.ressIcon:SetShown(ress and UnitIsDeadOrGhost(unit))
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1244,8 +1274,6 @@ function pfUI.uf.OnUpdate()
|
||||
end
|
||||
end
|
||||
|
||||
if not this.label or this.label == "" then return end
|
||||
|
||||
-- update portrait on first visible frame
|
||||
if this.portrait and this.portrait.model and this.portrait.model.update then
|
||||
this.portrait.model.lastUnit = UnitName(this.portrait.model.update)
|
||||
@@ -1272,6 +1300,7 @@ local UNIT_EVENTS = {
|
||||
"UNIT_PORTRAIT_UPDATE", "UNIT_MODEL_CHANGED",
|
||||
"UNIT_FACTION",
|
||||
"UNIT_AURA", -- frame=buff, frame=debuff
|
||||
"INCOMING_RESURRECT_CHANGED", -- frame=ressIcon
|
||||
}
|
||||
|
||||
-- Point this frame's unit-event subscriptions at `unitstr`, or drop them when
|
||||
@@ -1332,11 +1361,7 @@ end
|
||||
-- ============================================================
|
||||
|
||||
function pfUI.uf.OnClick()
|
||||
if not this.label and this.unitname then
|
||||
TargetByName(this.unitname, true)
|
||||
else
|
||||
pfUI.uf:ClickAction(arg1)
|
||||
end
|
||||
pfUI.uf:ClickAction(arg1)
|
||||
end
|
||||
|
||||
function pfUI.uf:ClickAction(button)
|
||||
@@ -1433,13 +1458,6 @@ function pfUI.uf:CreateUnitFrame(unit, id, config, tick)
|
||||
f.config = config or pfUI_config.unitframes.fallback
|
||||
f.tick = tick
|
||||
|
||||
-- disable events for unknown unitstrings
|
||||
if not pfValidUnits[strlower(unit) .. id] then
|
||||
f.unitname = unit
|
||||
f.label, f.id = "", ""
|
||||
f.RegisterEvent = function() return end
|
||||
end
|
||||
|
||||
CreateBackdropShadow(f)
|
||||
|
||||
f.hp = CreateFrame("Frame",nil, f)
|
||||
@@ -1490,7 +1508,7 @@ function pfUI.uf:CreateUnitFrame(unit, id, config, tick)
|
||||
|
||||
f.incHeal = CreateFrame("Frame", nil, f.hp)
|
||||
-- Texture lives on hp.bar for correct draw order:
|
||||
-- hp.bar.bg (BACKGROUND) < incHeal (BORDER) < hp.bar.bar (NORMAL)
|
||||
-- hp.bar.bg (a level below) < incHeal (BORDER) < hp.bar's fill (ARTWORK)
|
||||
f.incHeal.texture = f.hp.bar:CreateTexture(nil, "BORDER")
|
||||
f.incHeal.texture:SetAllPoints(f.incHeal)
|
||||
-- Override Show/Hide since texture lives on hp.bar, not incHeal
|
||||
@@ -1556,9 +1574,7 @@ function pfUI.uf:CreateUnitFrame(unit, id, config, tick)
|
||||
f:Hide()
|
||||
end
|
||||
|
||||
if f.label ~= "" then
|
||||
f:SetAttribute("unit", f.label .. f.id)
|
||||
end
|
||||
f:SetAttribute("unit", f.label .. f.id)
|
||||
|
||||
-- register frame for clique
|
||||
_G.ClickCastFrames = ClickCastFrames or {}
|
||||
@@ -1632,6 +1648,10 @@ function pfUI.uf:RefreshIndicators(unit)
|
||||
unit.pvpIcon:SetShown(unit.config.showPVP == "1" and UnitIsPVP(unitstr))
|
||||
end
|
||||
|
||||
if unit.ressIcon then -- Resurrection Icon
|
||||
unit.ressIcon:SetShown(libpredict:UnitHasResurrection(unitstr))
|
||||
end
|
||||
|
||||
if unit.restIcon and unit:GetName() == "pfPlayer" then -- Rest Icon
|
||||
unit.restIcon:SetShown(C.unitframes.player.showRest == "1" and UnitIsUnit(unitstr, "player") and IsResting())
|
||||
end
|
||||
|
||||
Vendored
-50
@@ -1,50 +0,0 @@
|
||||
-- barlength = {[formfactor]={cols, rows}}
|
||||
pfGridmath = {
|
||||
[1] = {{1,1}},
|
||||
[2] = {{2,1},{1,2}},
|
||||
[3] = {{3,1},{1,3}},
|
||||
[4] = {{4,1},{2,2},{1,4}},
|
||||
[5] = {{5,1},{1,5}},
|
||||
[6] = {{6,1},{3,2},{2,3},{1,6}},
|
||||
[7] = {{7,1},{1,7}},
|
||||
[8] = {{8,1},{4,2},{2,4},{1,8}},
|
||||
[9] = {{9,1},{3,3},{1,9}},
|
||||
[10] = {{10,1},{5,2},{2,5},{1,10}},
|
||||
[11] = {{11,1},{1,11}},
|
||||
[12] = {{12,1},{6,2},{4,3},{3,4},{2,6},{1,12}}
|
||||
}
|
||||
|
||||
-- list of valid unitstrings
|
||||
pfValidUnits = {}
|
||||
pfValidUnits["pet"] = true
|
||||
pfValidUnits["player"] = true
|
||||
pfValidUnits["target"] = true
|
||||
pfValidUnits["mouseover"] = true
|
||||
|
||||
pfValidUnits["focus"] = true
|
||||
pfValidUnits["focustarget"] = true
|
||||
pfValidUnits["focustargettarget"] = true
|
||||
|
||||
pfValidUnits["pettarget"] = true
|
||||
pfValidUnits["playertarget"] = true
|
||||
pfValidUnits["targettarget"] = true
|
||||
pfValidUnits["mouseovertarget"] = true
|
||||
pfValidUnits["targettargettarget"] = true
|
||||
|
||||
for i=1,4 do
|
||||
pfValidUnits["party" .. i] = true
|
||||
pfValidUnits["party" .. i .. "target"] = true
|
||||
pfValidUnits["partypet" .. i] = true
|
||||
pfValidUnits["partypet" .. i .. "target"] = true
|
||||
end
|
||||
|
||||
for i=1,40 do
|
||||
pfValidUnits["raid" .. i] = true
|
||||
pfValidUnits["raid" .. i .. "target"] = true
|
||||
|
||||
pfValidUnits["raidpet" .. i] = true
|
||||
pfValidUnits["raidpet" .. i .. "target"] = true
|
||||
|
||||
pfValidUnits["nameplate" .. i] = true
|
||||
pfValidUnits["nameplate" .. i .. "target"] = true
|
||||
end
|
||||
Vendored
-1
@@ -281,7 +281,6 @@ pfUI_translation["deDE"] = {
|
||||
["Enable Energy Ticks"] = nil,
|
||||
["Enable Extended Guild Information"] = nil,
|
||||
["Enable Frame Shadow"] = nil,
|
||||
["Enable Full-Text Search"] = nil,
|
||||
["Enable Indicators"] = nil,
|
||||
["Enable Item Quality Color For Equipment Only"] = nil,
|
||||
["Enable \"Loot & Spam\" Chat Window"] = nil,
|
||||
|
||||
Vendored
-1
@@ -290,7 +290,6 @@ pfUI_translation["enUS"] = {
|
||||
["Enable Energy Ticks"] = nil,
|
||||
["Enable Extended Guild Information"] = nil,
|
||||
["Enable Frame Shadow"] = nil,
|
||||
["Enable Full-Text Search"] = nil,
|
||||
["Enable Indicators"] = nil,
|
||||
["Enable Item Quality Color For Equipment Only"] = nil,
|
||||
["Enable \"Loot & Spam\" Chat Window"] = nil,
|
||||
|
||||
Vendored
-1
@@ -281,7 +281,6 @@ pfUI_translation["esES"] = {
|
||||
["Enable Energy Ticks"] = "Activar tics de energía",
|
||||
["Enable Extended Guild Information"] = "Activar información de hermandad extendida",
|
||||
["Enable Frame Shadow"] = "Activar sombra del marco",
|
||||
["Enable Full-Text Search"] = nil,
|
||||
["Enable Indicators"] = "Activar indicadores",
|
||||
["Enable Item Quality Color For Equipment Only"] = "Mostrar el color de calidad de objetos solo para equipo",
|
||||
["Enable \"Loot & Spam\" Chat Window"] = "Activar ventana de chat \"Botín y spam\"",
|
||||
|
||||
Vendored
-1
@@ -281,7 +281,6 @@ pfUI_translation["frFR"] = {
|
||||
["Enable Energy Ticks"] = "Activer la barre de rechargement d'énergie",
|
||||
["Enable Extended Guild Information"] = "Activer les informations de guilde étendues",
|
||||
["Enable Frame Shadow"] = "Activer l'ombre des cadres",
|
||||
["Enable Full-Text Search"] = nil,
|
||||
["Enable Indicators"] = "Activer les indicateurs",
|
||||
["Enable Item Quality Color For Equipment Only"] = "Activer la couleur de la qualité des objets seulement sur les pièces d'équipement",
|
||||
["Enable \"Loot & Spam\" Chat Window"] = "Activer la fenêtre de chat \"Butins & Spam\"",
|
||||
|
||||
Vendored
-1
@@ -281,7 +281,6 @@ pfUI_translation["koKR"] = {
|
||||
["Enable Energy Ticks"] = "Energy Ticks 활성화",
|
||||
["Enable Extended Guild Information"] = "길드 정보 확장 사용",
|
||||
["Enable Frame Shadow"] = nil,
|
||||
["Enable Full-Text Search"] = nil,
|
||||
["Enable Indicators"] = nil,
|
||||
["Enable Item Quality Color For Equipment Only"] = "착용장비 전용 아이템품질 색상 활성화",
|
||||
["Enable \"Loot & Spam\" Chat Window"] = "\"루팅 & 스팜\"채팅 창 사용",
|
||||
|
||||
Vendored
-1
@@ -281,7 +281,6 @@ pfUI_translation["ruRU"] = {
|
||||
["Enable Energy Ticks"] = "Включить восполнение энергии",
|
||||
["Enable Extended Guild Information"] = "Включить расширенную информацию о гильдии",
|
||||
["Enable Frame Shadow"] = "Включить тень окон",
|
||||
["Enable Full-Text Search"] = nil,
|
||||
["Enable Indicators"] = "Включить индикаторы",
|
||||
["Enable Item Quality Color For Equipment Only"] = "Включить цвет качества предметов только для экипировки",
|
||||
["Enable \"Loot & Spam\" Chat Window"] = "Включить окно чата \"Добыча & Спам\"",
|
||||
|
||||
Vendored
-1
@@ -281,7 +281,6 @@ pfUI_translation["zhCN"] = {
|
||||
["Enable Energy Ticks"] = "显示能量刻度",
|
||||
["Enable Extended Guild Information"] = "公会信息扩展显示",
|
||||
["Enable Frame Shadow"] = "启用框架阴影",
|
||||
["Enable Full-Text Search"] = "启用全文搜索",
|
||||
["Enable Indicators"] = "启用指示器",
|
||||
["Enable Item Quality Color For Equipment Only"] = "仅在装备上显示品质颜色",
|
||||
["Enable \"Loot & Spam\" Chat Window"] = "启用[拾取、综合]聊天窗口",
|
||||
|
||||
Vendored
-1
@@ -281,7 +281,6 @@ pfUI_translation["zhTW"] = {
|
||||
["Enable Energy Ticks"] = "顯示能量刻度",
|
||||
["Enable Extended Guild Information"] = "公會資訊擴展顯示",
|
||||
["Enable Frame Shadow"] = "啟用框架陰影",
|
||||
["Enable Full-Text Search"] = nil,
|
||||
["Enable Indicators"] = nil,
|
||||
["Enable Item Quality Color For Equipment Only"] = "僅在裝備上顯示品質顏色",
|
||||
["Enable \"Loot & Spam\" Chat Window"] = "啟用[拾取、綜合]聊天視窗",
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
<Include file="..\api\api.lua"/>
|
||||
<Include file="..\api\config.lua"/>
|
||||
<Include file="..\api\ui-widgets.lua"/>
|
||||
<Include file="..\api\ui-widgets.xml"/>
|
||||
<Include file="..\api\unitframes.lua"/>
|
||||
</Ui>
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
<Include file="..\env\locales_esES.lua"/>
|
||||
<Include file="..\env\locales_ruRU.lua"/>
|
||||
|
||||
<Include file="..\env\tables.lua"/>
|
||||
<Include file="..\env\profiles.lua"/>
|
||||
|
||||
<Include file="..\env\translations_enUS.lua"/>
|
||||
|
||||
+58
-167
@@ -2,16 +2,21 @@
|
||||
setfenv(1, pfUI:GetEnvironment())
|
||||
|
||||
--[[ libpredict ]]--
|
||||
-- A pfUI library that detects, receives and sends heal and resurrection predictions.
|
||||
-- A pfUI library that detects, receives and sends heal predictions.
|
||||
-- Healing predictions are done by caching the last known "normal" heal value of the
|
||||
-- spell when last being used. Those chaches are cleared when new talents are detected.
|
||||
-- The API provides function calls similar to later WoW expansions such as:
|
||||
-- UnitGetIncomingHeals(unit)
|
||||
-- UnitHasIncomingResurrection(unit)
|
||||
-- UnitHasResurrection(unit)
|
||||
--
|
||||
-- The library is able to receive and send compatible messages to HealComm
|
||||
-- including resurrections. It has an option to disable the sending of those
|
||||
-- messages in case HealComm is already active.
|
||||
-- UnitHasResurrection extends ClassicAPI's UnitHasIncomingResurrection, which
|
||||
-- ends with the cast, to a resurrection that landed and waits for the target
|
||||
-- to accept it.
|
||||
--
|
||||
-- The library is able to receive and send compatible messages to HealComm,
|
||||
-- and announces the player's resurrections to HealComm and CTRA. It has an
|
||||
-- option to disable the sending of those messages in case HealComm is
|
||||
-- already active.
|
||||
--
|
||||
-- Casts are read from ClassicAPI's UNIT_SPELLCAST_* events and heal amounts
|
||||
-- from COMBAT_LOG_EVENT_UNFILTERED. GetHotDuration() reads live HoT timers
|
||||
@@ -20,18 +25,16 @@ setfenv(1, pfUI:GetEnvironment())
|
||||
-- return instantly when another libpredict is already active
|
||||
if pfUI.api.libpredict then return end
|
||||
|
||||
local heals, ress, events, hots = {}, {}, {}, {}
|
||||
local heals, events, hots = {}, {}, {}
|
||||
local spell_queue = { "DUMMY", "DUMMYRank 9", "TARGET" }
|
||||
local player = UnitName("player")
|
||||
local cache, gear_string = {}, ""
|
||||
local foreignCache = {} -- [casterName][spellKey] = amount, in-memory cache for other healers
|
||||
local rejuvDuration, renewDuration = 12, 15 --default durations
|
||||
local ressGuidToName = {} -- [casterGuid] = casterName, for interrupted-cast cleanup
|
||||
local healGuidToName = {} -- [casterGuid] = casterName, for interrupted-cast cleanup
|
||||
local sentTargets = {} -- [castGUID] = target name of an own cast, from UNIT_SPELLCAST_SENT
|
||||
local castTargets = {} -- [castGUID] = target name of a foreign cast, from UNIT_SPELLCAST_START
|
||||
local ress_timers = {} -- [target][sender] = expiry_timestamp (60s rez window)
|
||||
local RESS_TIMEOUT = 60 -- Vanilla: rez offer expires after 60s
|
||||
local resOffers = {} -- [guid] = expiry of a landed resurrection the target has yet to accept
|
||||
local RES_OFFER_TIMEOUT = 60 -- the target's resurrect popup declines itself after 60s
|
||||
|
||||
-- Localized spell names resolved once from canonical rank-1 spellIDs.
|
||||
-- Every rank shares the same name, so per-rank comparisons elsewhere can
|
||||
@@ -42,7 +45,6 @@ local RENEW = C_Spell.GetSpellName(139) -- Renew (Rank 1)
|
||||
local REGROWTH = C_Spell.GetSpellName(8936) -- Regrowth (Rank 1)
|
||||
|
||||
local libpredict = CreateFrame("Frame")
|
||||
libpredict:RegisterEvent("UNIT_HEALTH")
|
||||
libpredict:RegisterEvent("CHAT_MSG_ADDON")
|
||||
libpredict:RegisterEvent("PLAYER_TARGET_CHANGED")
|
||||
libpredict:RegisterEvent("PLAYER_LOGOUT")
|
||||
@@ -55,13 +57,8 @@ libpredict:SetScript("OnEvent", function()
|
||||
return
|
||||
end
|
||||
|
||||
if event == "CHAT_MSG_ADDON" and (arg1 == "HealComm" or arg1 == "CTRA") then
|
||||
this:ParseChatMessage(arg4, arg2, arg1)
|
||||
elseif event == "UNIT_HEALTH" then
|
||||
local name = UnitName(arg1)
|
||||
if name and ress[name] and not UnitIsDeadOrGhost(arg1) then
|
||||
ress[name] = nil
|
||||
end
|
||||
if event == "CHAT_MSG_ADDON" and arg1 == "HealComm" then
|
||||
this:ParseChatMessage(arg4, arg2)
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -95,12 +92,6 @@ local function cacheRaidNames()
|
||||
if pguid then guidNameCache[pguid] = UnitName("player") end
|
||||
end
|
||||
|
||||
local function isRezSpell(spellId)
|
||||
if not L["resurrections"] then return false end
|
||||
local spellName = C_Spell.GetSpellName(spellId)
|
||||
return spellName and L["resurrections"][spellName]
|
||||
end
|
||||
|
||||
-- Build cache on world enter
|
||||
libpredict:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
libpredict:RegisterEvent("RAID_ROSTER_UPDATE")
|
||||
@@ -131,7 +122,6 @@ local function OnOwnCastStart(spellId, castGUID)
|
||||
|
||||
if L["resurrections"][spellName] then
|
||||
if target then
|
||||
libpredict:Ress(player, target, UnitGUID("player"))
|
||||
libpredict.sender:SendHealCommMsg("Resurrection/" .. target .. "/start/")
|
||||
libpredict.sender:SendResCommMsg("RES " .. target)
|
||||
libpredict.sender.resurrecting = true
|
||||
@@ -212,7 +202,7 @@ local function OnOwnCastStart(spellId, castGUID)
|
||||
end
|
||||
end
|
||||
|
||||
-- Own cast landed: HealStop, Regrowth timer, instant HoTs, own rez timer
|
||||
-- Own cast landed: HealStop, Regrowth timer, instant HoTs
|
||||
local function OnOwnCastSucceeded(spellId, castGUID)
|
||||
local target = sentTargets[castGUID] or spell_queue[3]
|
||||
sentTargets[castGUID] = nil
|
||||
@@ -250,14 +240,10 @@ local function OnOwnCastSucceeded(spellId, castGUID)
|
||||
libpredict:Hot(player, target, hotType, duration, nil, "UNIT_SPELLCAST_SUCCEEDED", rank)
|
||||
libpredict.sender:SendHealCommMsg(hotType .. "/" .. target .. "/" .. duration .. "/" .. rank .. "/")
|
||||
end
|
||||
|
||||
if isRezSpell(spellId) then
|
||||
libpredict:RessSetTimer(player, target)
|
||||
end
|
||||
end
|
||||
|
||||
-- Foreign cast-time spell started (heals + rez)
|
||||
local function OnOtherCastStart(unit, spellId, castGUID)
|
||||
-- Foreign cast-time heal started
|
||||
local function OnOtherCastStart(unit, spellId)
|
||||
local spellName = C_Spell.GetSpellName(spellId)
|
||||
if not spellName then return end
|
||||
|
||||
@@ -267,13 +253,6 @@ local function OnOtherCastStart(unit, spellId, castGUID)
|
||||
|
||||
local targetName = UnitSpellTargetName(unit)
|
||||
if not targetName then return end
|
||||
castTargets[castGUID] = targetName
|
||||
|
||||
-- Resurrection cast
|
||||
if L["resurrections"][spellName] then
|
||||
libpredict:Ress(casterName, targetName, casterGuid)
|
||||
return
|
||||
end
|
||||
|
||||
-- Heal cast: look up cached amount from a previous cast by this healer
|
||||
local _, _, _, startMs, endMs = C_Spell.UnitCastingInfo(unit)
|
||||
@@ -324,35 +303,31 @@ local function OnOtherCastStart(unit, spellId, castGUID)
|
||||
libpredict:Heal(casterName, targetName, amount, castTime, casterGuid)
|
||||
end
|
||||
|
||||
-- Foreign cast landed: rez timer, or the predicted heal is fulfilled
|
||||
local function OnOtherCastSucceeded(unit, spellId, castGUID)
|
||||
local casterGuid = UnitGUID(unit)
|
||||
local casterName = resolveNameFromGuid(casterGuid)
|
||||
-- Foreign cast landed: the predicted heal is fulfilled
|
||||
local function OnOtherCastSucceeded(unit)
|
||||
local casterName = resolveNameFromGuid(UnitGUID(unit))
|
||||
if not casterName then return end
|
||||
|
||||
if isRezSpell(spellId) then
|
||||
local targetName = castTargets[castGUID]
|
||||
if targetName then
|
||||
libpredict:RessSetTimer(casterName, targetName)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
libpredict:HealStop(casterName)
|
||||
end
|
||||
|
||||
-- Foreign cast interrupted: remove cancelled resses/heals
|
||||
-- Foreign cast interrupted: remove cancelled heals
|
||||
local function OnOtherCastInterrupted(unit)
|
||||
local casterGuid = UnitGUID(unit)
|
||||
if not casterGuid then return end
|
||||
local ressName = ressGuidToName[casterGuid]
|
||||
if ressName then
|
||||
libpredict:RessStop(ressName)
|
||||
end
|
||||
local healName = healGuidToName[casterGuid]
|
||||
if healName then libpredict:HealStop(healName) end
|
||||
end
|
||||
|
||||
-- Flag the unit frames showing `guid` to redraw their resurrection icon
|
||||
local function RefreshResFrames(guid)
|
||||
for _, frame in pairs(pfUI.uf.frames) do
|
||||
if frame.unitstr and UnitGUID(frame.unitstr) == guid then
|
||||
frame.update_indicators = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
libpredict:SetScript("OnUpdate", function()
|
||||
-- throttle cleanup - no need to check every frame
|
||||
local now = pfUI.uf.now or GetTime()
|
||||
@@ -366,13 +341,12 @@ libpredict:SetScript("OnUpdate", function()
|
||||
end
|
||||
end
|
||||
|
||||
-- Rez timeout: remove offer after 60s if player doesn't accept
|
||||
for target, senders in pairs(ress_timers) do
|
||||
for sender, expiry in pairs(senders) do
|
||||
if now >= expiry then
|
||||
senders[sender] = nil
|
||||
if ress[target] then ress[target][sender] = nil end
|
||||
end
|
||||
-- drop resurrection offers the target accepted or let run out
|
||||
for guid, expiry in pairs(resOffers) do
|
||||
local unit = UnitTokenFromGUID(guid)
|
||||
if now >= expiry or not (unit and UnitIsDeadOrGhost(unit)) then
|
||||
resOffers[guid] = nil
|
||||
RefreshResFrames(guid)
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -386,8 +360,6 @@ function libpredict:ParseComm(sender, msg)
|
||||
if libpredict.debug then
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cff00ffff[libpredict RX]|r HealStop from " .. tostring(sender))
|
||||
end
|
||||
elseif msg == "Resurrection/stop/" then
|
||||
msgtype = "RessStop"
|
||||
elseif msg then
|
||||
local msgobj = {strsplit("/", msg)}
|
||||
|
||||
@@ -397,10 +369,6 @@ function libpredict:ParseComm(sender, msg)
|
||||
msgtype, time = "Delay", msgobj[2]
|
||||
end
|
||||
|
||||
if msgobj[1] and msgobj[1] == "Resurrection" and msgobj[2] then
|
||||
msgtype, target = "Ress", msgobj[2]
|
||||
end
|
||||
|
||||
if msgobj[1] == "Heal" and msgobj[2] then
|
||||
msgtype, target, heal, time = "Heal", msgobj[2], msgobj[3], msgobj[4]
|
||||
end
|
||||
@@ -472,25 +440,12 @@ end
|
||||
local recentHots = {}
|
||||
local DUPLICATE_WINDOW = 0.5 -- Ignoriere gleiche Nachricht innerhalb 0.5s
|
||||
|
||||
function libpredict:ParseChatMessage(sender, msg, comm)
|
||||
local msgtype, target, heal, time, rank
|
||||
|
||||
if comm == "HealComm" then
|
||||
msgtype, target, heal, time, rank = libpredict:ParseComm(sender, msg)
|
||||
elseif comm == "CTRA" then
|
||||
local _, _, cmd, ctratarget = string.find(msg, "(%a+)%s?([^#]*)")
|
||||
if cmd and ctratarget and cmd == "RES" and ctratarget ~= "" and ctratarget ~= UNKNOWN then
|
||||
msgtype = "Ress"
|
||||
target = ctratarget
|
||||
end
|
||||
end
|
||||
function libpredict:ParseChatMessage(sender, msg)
|
||||
local msgtype, target, heal, time, rank = libpredict:ParseComm(sender, msg)
|
||||
|
||||
if msgtype == "Stop" and sender then
|
||||
libpredict:HealStop(sender)
|
||||
return
|
||||
elseif ( msg == "RessStop" or msg == "RESNO" ) and sender then
|
||||
libpredict:RessStop(sender)
|
||||
return
|
||||
elseif msgtype == "Delay" and time then
|
||||
libpredict:HealDelay(sender, time)
|
||||
elseif msgtype == "Heal" and target and heal and time then
|
||||
@@ -501,29 +456,6 @@ function libpredict:ParseChatMessage(sender, msg, comm)
|
||||
else
|
||||
libpredict:Heal(sender, target, heal, time)
|
||||
end
|
||||
elseif msgtype == "Ress" then
|
||||
-- HealComm: only for other players (own resses tracked via UNIT_SPELLCAST_START)
|
||||
local playerName = UnitName("player")
|
||||
if sender ~= playerName then
|
||||
local senderGuid
|
||||
for i = 1, GetNumRaidMembers() do
|
||||
local unit = "raid" .. i
|
||||
if UnitName(unit) == sender then
|
||||
senderGuid = UnitGUID(unit)
|
||||
break
|
||||
end
|
||||
end
|
||||
if not senderGuid then
|
||||
for i = 1, GetNumPartyMembers() do
|
||||
local unit = "party" .. i
|
||||
if UnitName(unit) == sender then
|
||||
senderGuid = UnitGUID(unit)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
libpredict:Ress(sender, target, senderGuid)
|
||||
end
|
||||
elseif msgtype == "Hot" then
|
||||
-- Duplicate check: ignore same sender+target+spell within DUPLICATE_WINDOW
|
||||
local now = pfUI.uf.now or GetTime()
|
||||
@@ -672,41 +604,6 @@ function libpredict:HealDelay(sender, delay)
|
||||
end
|
||||
end
|
||||
|
||||
function libpredict:Ress(sender, target, senderGuid)
|
||||
ress[target] = ress[target] or {}
|
||||
ress[target][sender] = true
|
||||
if senderGuid then ressGuidToName[senderGuid] = sender end
|
||||
-- no timer here - timer is only set once the cast actually completes
|
||||
end
|
||||
|
||||
function libpredict:RessSetTimer(sender, target)
|
||||
ress_timers[target] = ress_timers[target] or {}
|
||||
local existing = ress_timers[target][sender]
|
||||
if not existing or GetTime() >= existing then
|
||||
ress_timers[target][sender] = GetTime() + RESS_TIMEOUT
|
||||
else
|
||||
end
|
||||
end
|
||||
|
||||
function libpredict:RessStop(sender)
|
||||
local now = GetTime()
|
||||
for ttarget, t in pairs(ress) do
|
||||
for tsender in pairs(ress[ttarget]) do
|
||||
if sender == tsender then
|
||||
local expiry = ress_timers[ttarget] and ress_timers[ttarget][tsender]
|
||||
if not expiry or now >= expiry then
|
||||
ress[ttarget][tsender] = nil
|
||||
if ress_timers[ttarget] then ress_timers[ttarget][tsender] = nil end
|
||||
else
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
for guid, name in pairs(ressGuidToName) do
|
||||
if name == sender then ressGuidToName[guid] = nil end
|
||||
end
|
||||
end
|
||||
|
||||
function libpredict:UnitGetIncomingHeals(unit)
|
||||
if not unit then return 0 end
|
||||
local name = UnitName(unit)
|
||||
@@ -729,21 +626,10 @@ function libpredict:UnitGetIncomingHeals(unit)
|
||||
return sumheal
|
||||
end
|
||||
|
||||
function libpredict:UnitHasIncomingResurrection(unit)
|
||||
if not unit then return nil end
|
||||
local name = UnitName(unit)
|
||||
if not name then return nil end
|
||||
|
||||
if not ress[name] then
|
||||
return nil
|
||||
else
|
||||
for sender, val in pairs(ress[name]) do
|
||||
if val == true then
|
||||
return val
|
||||
end
|
||||
end
|
||||
end
|
||||
return nil
|
||||
-- Whether a resurrection is being cast at the unit, or landed and waits for
|
||||
-- the unit to accept it
|
||||
function libpredict:UnitHasResurrection(unit)
|
||||
return UnitHasIncomingResurrection(unit) or resOffers[UnitGUID(unit)] ~= nil
|
||||
end
|
||||
|
||||
local realm = GetRealmName()
|
||||
@@ -834,7 +720,6 @@ local pendingHots = {}
|
||||
|
||||
-- Gather Data by User Actions
|
||||
hooksecurefunc("CastSpell", function(id, bookType)
|
||||
if not libpredict.sender.enabled then return end
|
||||
local effect, rank = libspell.GetSpellInfo(id, bookType)
|
||||
if not effect then return end
|
||||
spell_queue[1] = effect
|
||||
@@ -887,7 +772,6 @@ hooksecurefunc("CastSpell", function(id, bookType)
|
||||
end)
|
||||
|
||||
hooksecurefunc("CastSpellByName", function(effect, target)
|
||||
if not libpredict.sender.enabled then return end
|
||||
local effect, rank = libspell.GetSpellInfo(effect)
|
||||
if not effect then return end
|
||||
|
||||
@@ -951,7 +835,6 @@ hooksecurefunc("CastSpellByName", function(effect, target)
|
||||
end)
|
||||
|
||||
hooksecurefunc("UseAction", function(slot, target, selfcast)
|
||||
if not libpredict.sender.enabled then return end
|
||||
if not IsCurrentAction(slot) then return end
|
||||
local kind, id = GetActionInfo(slot)
|
||||
local effect, rank
|
||||
@@ -1012,8 +895,10 @@ hooksecurefunc("UseAction", function(slot, target, selfcast)
|
||||
end)
|
||||
|
||||
libpredict.sender = CreateFrame("Frame", "pfPredictionSender", UIParent)
|
||||
-- cleared when a HealComm addon already broadcasts this player's casts
|
||||
libpredict.sender.enabled = true
|
||||
libpredict.sender.SendHealCommMsg = function(self, msg)
|
||||
if not self.enabled then return end
|
||||
-- Smart channel selection: Only send to relevant channel to avoid duplicates
|
||||
if IsInRaid() then
|
||||
-- In raid: Only send to RAID (includes all raid members)
|
||||
@@ -1026,6 +911,7 @@ libpredict.sender.SendHealCommMsg = function(self, msg)
|
||||
-- BG groups are handled by RAID channel
|
||||
end
|
||||
libpredict.sender.SendResCommMsg = function(self, msg)
|
||||
if not self.enabled then return end
|
||||
-- Smart channel selection: Only send to relevant channel to avoid duplicates
|
||||
if IsInRaid() then
|
||||
-- In raid: Only send to RAID (includes all raid members)
|
||||
@@ -1071,7 +957,6 @@ libpredict.sender:RegisterEvent("UNIT_SPELLCAST_DELAYED")
|
||||
libpredict.sender:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
|
||||
libpredict.sender:RegisterEvent("UNIT_SPELLCAST_FAILED")
|
||||
libpredict.sender:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED")
|
||||
libpredict.sender:RegisterEvent("UNIT_SPELLCAST_STOP")
|
||||
libpredict.sender:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
|
||||
|
||||
-- Shared cleanup helper for failed/interrupted casts
|
||||
@@ -1083,7 +968,6 @@ local function onCastFailed()
|
||||
s.healing = nil
|
||||
elseif s.resurrecting then
|
||||
local target = s.current_cast_target or spell_queue[3]
|
||||
libpredict:RessStop(UnitName("player"))
|
||||
s:SendHealCommMsg("Resurrection/stop/")
|
||||
s:SendResCommMsg("RESNO " .. (target or ""))
|
||||
s.resurrecting = nil
|
||||
@@ -1134,11 +1018,20 @@ local function OnHeal()
|
||||
end
|
||||
end
|
||||
|
||||
-- A landed resurrection: the target has an offer to accept, which outlasts
|
||||
-- UnitHasIncomingResurrection's end with the cast
|
||||
local function OnResurrect()
|
||||
-- arg8=destGUID
|
||||
resOffers[arg8] = GetTime() + RES_OFFER_TIMEOUT
|
||||
RefreshResFrames(arg8)
|
||||
end
|
||||
|
||||
local lastOtherCast = {} -- [event] = castGUID of the last other-unit event handled
|
||||
|
||||
libpredict.sender:SetScript("OnEvent", function()
|
||||
if event == "COMBAT_LOG_EVENT_UNFILTERED" then
|
||||
if arg2 == "SPELL_HEAL" then OnHeal() end
|
||||
if arg2 == "SPELL_HEAL" then OnHeal()
|
||||
elseif arg2 == "SPELL_RESURRECT" then OnResurrect() end
|
||||
return
|
||||
end
|
||||
|
||||
@@ -1174,13 +1067,11 @@ libpredict.sender:SetScript("OnEvent", function()
|
||||
lastOtherCast[event] = arg2
|
||||
|
||||
if event == "UNIT_SPELLCAST_START" then
|
||||
OnOtherCastStart(unit, arg3, arg2)
|
||||
OnOtherCastStart(unit, arg3)
|
||||
elseif event == "UNIT_SPELLCAST_SUCCEEDED" then
|
||||
OnOtherCastSucceeded(unit, arg3, arg2)
|
||||
OnOtherCastSucceeded(unit)
|
||||
elseif event == "UNIT_SPELLCAST_INTERRUPTED" then
|
||||
OnOtherCastInterrupted(unit)
|
||||
elseif event == "UNIT_SPELLCAST_STOP" then
|
||||
castTargets[arg2] = nil
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
+1
-14
@@ -382,8 +382,6 @@ pfUI:RegisterModule("actionbar", function ()
|
||||
end
|
||||
elseif self.spellID then
|
||||
GameTooltip:SetSpellByID(self.spellID)
|
||||
elseif self.spellslot and self.booktype then
|
||||
GameTooltip:SetSpell(self.spellslot, self.booktype)
|
||||
else
|
||||
GameTooltip:SetAction(self.id)
|
||||
end
|
||||
@@ -456,11 +454,6 @@ pfUI:RegisterModule("actionbar", function ()
|
||||
id = self.bar == 1 and self.slot or sid-((self.bar)-1)*12
|
||||
end
|
||||
|
||||
-- overwrite with spell macro texture where possible
|
||||
if self.spellslot and self.booktype then
|
||||
texture = GetSpellTexture(self.spellslot, self.booktype)
|
||||
end
|
||||
|
||||
if not self.showempty and self.backdrop and not texture and grid == 0 then
|
||||
self.backdrop:Hide()
|
||||
self.hide = true
|
||||
@@ -590,9 +583,6 @@ pfUI:RegisterModule("actionbar", function ()
|
||||
start, duration, enable = GetShapeshiftFormCooldown(button.id)
|
||||
elseif button.bar == 12 then
|
||||
start, duration, enable = GetPetActionCooldown(button.id)
|
||||
elseif button.spellslot and button.booktype then
|
||||
start, duration = GetSpellCooldown(button.spellslot, button.booktype)
|
||||
enable = 1
|
||||
else
|
||||
start, duration, enable = GetActionCooldown(button.id)
|
||||
end
|
||||
@@ -1150,8 +1140,6 @@ pfUI:RegisterModule("actionbar", function ()
|
||||
f.count:SetJustifyH("RIGHT")
|
||||
f.count:SetJustifyV("BOTTOM")
|
||||
|
||||
f.scanmacro, f.spellslot, f.booktype = nil, nil, nil
|
||||
|
||||
-- range glow color
|
||||
f.rangeColor = GetStringColorObject(C.bars.rangecolor)
|
||||
|
||||
@@ -1218,8 +1206,7 @@ pfUI:RegisterModule("actionbar", function ()
|
||||
end
|
||||
|
||||
-- the stored layout is invalid, temporary fallback
|
||||
local _, _, fcols, frows = string.find(tostring(formfactor or ""), "(%d+)%s*x%s*(%d+)")
|
||||
if not ((fcols and frows) or pfGridmath[buttons][BarLayoutFormfactor(formfactor)]) then
|
||||
if not fcols2 or not frows2 then
|
||||
formfactor = BarLayoutOptions(buttons)[1]
|
||||
end
|
||||
|
||||
|
||||
+108
-144
@@ -69,12 +69,42 @@ pfUI:RegisterModule("addons", function ()
|
||||
pfUI.addons:Hide()
|
||||
end)
|
||||
|
||||
-- installed addons, one entry per row of the addon list
|
||||
local addons = {}
|
||||
for i = 1, GetNumAddOns() do
|
||||
local name, title, notes = GetAddOnInfo(i)
|
||||
addons[i] = {
|
||||
index = i,
|
||||
name = name,
|
||||
title = title,
|
||||
notes = notes,
|
||||
author = GetAddOnMetadata(name, "Author"),
|
||||
version = GetAddOnMetadata(name, "Version"),
|
||||
deps = { GetAddOnDependencies(i) }, -- required (.toc Dependencies)
|
||||
optdeps = { C_AddOns.GetAddOnOptionalDependencies(i) }, -- optional (.toc OptionalDeps)
|
||||
}
|
||||
end
|
||||
|
||||
local function IsAddonEnabled(index)
|
||||
local _, _, _, enabled = GetAddOnInfo(index)
|
||||
return enabled
|
||||
end
|
||||
|
||||
local function SetAddonEnabled(index, enabled)
|
||||
if enabled then
|
||||
EnableAddOn(index)
|
||||
else
|
||||
DisableAddOn(index)
|
||||
end
|
||||
pfUI.addons.hasChanged = true
|
||||
end
|
||||
|
||||
-- addons profile
|
||||
local function GetSelectedAddonsList()
|
||||
local selected_addons = {}
|
||||
for i, frame in ipairs(pfUI.addons.list) do
|
||||
if frame.input:GetChecked() then
|
||||
table.insert(selected_addons, frame.aname)
|
||||
for i, addon in ipairs(addons) do
|
||||
if IsAddonEnabled(i) then
|
||||
table.insert(selected_addons, addon.name)
|
||||
end
|
||||
end
|
||||
return selected_addons
|
||||
@@ -90,28 +120,20 @@ pfUI:RegisterModule("addons", function ()
|
||||
pfUI.addons.profile.dropdown:SetSelectionByText(profile)
|
||||
|
||||
-- load profile
|
||||
local selected_list = pfUI_addon_profiles[profile]
|
||||
for i=1, GetNumAddOns() do
|
||||
local active = false
|
||||
local f = pfUI.addons.list[i]
|
||||
local selected = {}
|
||||
for _, name in ipairs(pfUI_addon_profiles[profile]) do
|
||||
selected[name] = true
|
||||
end
|
||||
|
||||
for i_i, n in ipairs(selected_list) do
|
||||
if f.aname == n then
|
||||
active = true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if active then
|
||||
if not f.input:GetChecked() then
|
||||
f.input:Click()
|
||||
end
|
||||
else
|
||||
if f.input:GetChecked() then
|
||||
f.input:Click()
|
||||
end
|
||||
for i, addon in ipairs(addons) do
|
||||
if selected[addon.name] and not IsAddonEnabled(i) then
|
||||
SetAddonEnabled(i, true)
|
||||
elseif not selected[addon.name] and IsAddonEnabled(i) then
|
||||
SetAddonEnabled(i, false)
|
||||
end
|
||||
end
|
||||
|
||||
pfUI.addons.list.ScrollBox:ReinitializeFrames()
|
||||
end
|
||||
|
||||
-- addon profiles
|
||||
@@ -193,23 +215,6 @@ pfUI:RegisterModule("addons", function ()
|
||||
return menu
|
||||
end)
|
||||
|
||||
-- addon list: scroll frame
|
||||
pfUI.addons.scroll = CreateScrollFrame("pfAddonListScroll", pfUI.addons)
|
||||
pfUI.addons.scroll:SetSize(360, 410)
|
||||
pfUI.addons.scroll:SetPoint("BOTTOM", 0, 10)
|
||||
|
||||
pfUI.addons.scroll.backdrop = CreateFrame("Frame", nil, pfUI.addons.scroll)
|
||||
pfUI.addons.scroll.backdrop:SetFrameLevel(1)
|
||||
pfUI.addons.scroll.backdrop:SetPoint("TOPLEFT", pfUI.addons.scroll, "TOPLEFT", -5, 5)
|
||||
pfUI.addons.scroll.backdrop:SetPoint("BOTTOMRIGHT", pfUI.addons.scroll, "BOTTOMRIGHT", 5, -5)
|
||||
CreateBackdrop(pfUI.addons.scroll.backdrop, nil, true)
|
||||
|
||||
-- addon list: scroll parent
|
||||
pfUI.addons.list = CreateScrollChild("pfAddonList", pfUI.addons.scroll)
|
||||
pfUI.addons.list:RegisterEvent("ADDON_LOADED")
|
||||
pfUI.addons.list:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
pfUI.addons.list:SetHeight(GetNumAddOns() * 25 + 26)
|
||||
|
||||
local function AddDependencyLines(header, deps)
|
||||
if not deps or table.getn(deps) == 0 then return end
|
||||
GameTooltip:AddLine(" ")
|
||||
@@ -225,137 +230,96 @@ pfUI:RegisterModule("addons", function ()
|
||||
end
|
||||
end
|
||||
|
||||
local function AddonOnEnter()
|
||||
this:SetBackdropBorderColor(1,1,1,.08)
|
||||
local function RowOnEnter(self)
|
||||
local addon = self.addon
|
||||
self:SetBackdropBorderColor(1,1,1,.08)
|
||||
|
||||
GameTooltip:SetOwner(this, "ANCHOR_RIGHT")
|
||||
GameTooltip:SetText(this.atitle)
|
||||
if this.aversion then
|
||||
GameTooltip:AddDoubleLine(T["Version"], this.aversion, 1,1,1, .2,1,.8)
|
||||
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
|
||||
GameTooltip:SetText(addon.title)
|
||||
if addon.version then
|
||||
GameTooltip:AddDoubleLine(T["Version"], addon.version, 1,1,1, .2,1,.8)
|
||||
end
|
||||
|
||||
if this.aauthor then
|
||||
GameTooltip:AddDoubleLine(T["Author"], this.aauthor, 1,1,1, .2,1,.8)
|
||||
if addon.author then
|
||||
GameTooltip:AddDoubleLine(T["Author"], addon.author, 1,1,1, .2,1,.8)
|
||||
end
|
||||
|
||||
GameTooltip:AddLine(this.anote, .75,.75,.75,1)
|
||||
AddDependencyLines(T["Dependencies"], this.adeps)
|
||||
AddDependencyLines(T["Optional Dependencies"], this.aoptdeps)
|
||||
GameTooltip:AddLine(addon.notes, .75,.75,.75,1)
|
||||
AddDependencyLines(T["Dependencies"], addon.deps)
|
||||
AddDependencyLines(T["Optional Dependencies"], addon.optdeps)
|
||||
GameTooltip:SetWidth(180)
|
||||
GameTooltip:Show()
|
||||
end
|
||||
|
||||
local function AddonOnLeave()
|
||||
this:SetBackdropBorderColor(1,1,1,.04)
|
||||
local function RowOnLeave(self)
|
||||
self:SetBackdropBorderColor(1,1,1,.04)
|
||||
GameTooltip:Hide()
|
||||
end
|
||||
|
||||
local function AddonOnClick()
|
||||
this.input:Click()
|
||||
local function RowOnClick(self)
|
||||
self.input:Click()
|
||||
end
|
||||
|
||||
local function InputOnClick()
|
||||
if this:GetChecked() then
|
||||
EnableAddOn(this:GetID())
|
||||
else
|
||||
DisableAddOn(this:GetID())
|
||||
end
|
||||
pfUI.addons.hasChanged = true
|
||||
local function InputOnClick(self)
|
||||
SetAddonEnabled(self:GetParent().addon.index, self:GetChecked())
|
||||
|
||||
local id, name = pfUI.addons.profile.dropdown:GetSelection()
|
||||
local _, name = pfUI.addons.profile.dropdown:GetSelection()
|
||||
name = name or T["Current"]
|
||||
pfUI_addon_profiles[name] = GetSelectedAddonsList()
|
||||
end
|
||||
|
||||
pfUI.addons.list:SetScript("OnEvent", function()
|
||||
for i=1, GetNumAddOns() do
|
||||
local aname, atitle, anote = GetAddOnInfo(i)
|
||||
local aauthor = GetAddOnMetadata(aname, "Author")
|
||||
local aversion = GetAddOnMetadata(aname, "Version")
|
||||
local function InitRow(row, addon)
|
||||
-- one-time setup of a pooled row
|
||||
if not row.input then
|
||||
row:SetBackdrop(pfUI.backdrop_hover)
|
||||
row:SetBackdropBorderColor(1,1,1,.04)
|
||||
|
||||
-- basic frame
|
||||
if not pfUI.addons.list[i] then
|
||||
pfUI.addons.list[i] = CreateFrame("Button", nil, pfUI.addons.list)
|
||||
local frame = pfUI.addons.list[i]
|
||||
frame.aname = aname
|
||||
frame.atitle = atitle
|
||||
frame.anote = anote
|
||||
frame.aauthor = aauthor
|
||||
frame.aversion = aversion
|
||||
frame.adeps = { GetAddOnDependencies(i) } -- required (.toc Dependencies)
|
||||
frame.aoptdeps = { C_AddOns.GetAddOnOptionalDependencies(i) } -- optional (.toc OptionalDeps)
|
||||
row:EnableMouse(true)
|
||||
row:SetScript("OnEnter", RowOnEnter)
|
||||
row:SetScript("OnLeave", RowOnLeave)
|
||||
row:SetScript("OnClick", RowOnClick)
|
||||
|
||||
frame:SetSize(340, 25)
|
||||
frame:SetPoint("TOPLEFT", 5, i * -25 + 20)
|
||||
-- caption
|
||||
row.caption = row:CreateFontString(nil, "LOW", "GameFontNormal")
|
||||
row.caption:SetFont(pfUI.font_default, C.global.font_size + 2, "OUTLINE")
|
||||
row.caption:SetPoint("LEFT", row, "LEFT", 2, 0)
|
||||
row.caption:SetFontObject(GameFontWhite)
|
||||
row.caption:SetJustifyH("LEFT")
|
||||
|
||||
frame:SetBackdrop(pfUI.backdrop_hover)
|
||||
frame:SetBackdropBorderColor(1,1,1,.04)
|
||||
|
||||
frame:EnableMouse(1)
|
||||
frame:SetScript("OnEnter", AddonOnEnter)
|
||||
frame:SetScript("OnLeave", AddonOnLeave)
|
||||
frame:SetScript("OnClick", AddonOnClick)
|
||||
|
||||
-- caption
|
||||
frame.caption = frame:CreateFontString("Status", "LOW", "GameFontNormal")
|
||||
frame.caption:SetFont(pfUI.font_default, C.global.font_size + 2, "OUTLINE")
|
||||
frame.caption:SetPoint("LEFT", frame, "LEFT", 2, 0)
|
||||
frame.caption:SetFontObject(GameFontWhite)
|
||||
frame.caption:SetJustifyH("LEFT")
|
||||
frame.caption:SetText(atitle)
|
||||
|
||||
-- input field
|
||||
frame.input = CreateFrame("CheckButton", nil, frame, "UICheckButtonTemplate")
|
||||
frame.input:SetFrameLevel(3)
|
||||
frame.input:SetNormalTexture("")
|
||||
frame.input:SetPushedTexture("")
|
||||
frame.input:SetHighlightTexture("")
|
||||
CreateBackdrop(frame.input, nil, true)
|
||||
frame.input:SetBackdropBorderColor(.3,.3,.3,1)
|
||||
frame.input:SetWidth(14)
|
||||
frame.input:SetHeight(14)
|
||||
frame.input:SetPoint("RIGHT" , -5, 1)
|
||||
frame.input:SetID(i)
|
||||
frame.input:SetScript("OnClick", InputOnClick)
|
||||
end
|
||||
|
||||
if IsAddOnLoaded(i) then
|
||||
pfUI.addons.list[i].input:SetChecked()
|
||||
pfUI.addons.list[i].caption:SetAlpha(1)
|
||||
else
|
||||
pfUI.addons.list[i].caption:SetAlpha(.5)
|
||||
end
|
||||
-- input field
|
||||
row.input = CreateFrame("CheckButton", nil, row, "UICheckButtonTemplate")
|
||||
row.input:SetNormalTexture("")
|
||||
row.input:SetPushedTexture("")
|
||||
row.input:SetHighlightTexture("")
|
||||
CreateBackdrop(row.input, nil, true)
|
||||
row.input:SetBackdropBorderColor(.3,.3,.3,1)
|
||||
row.input:SetSize(14, 14)
|
||||
row.input:SetPoint("RIGHT" , -5, 1)
|
||||
row.input:SetScript("OnClick", InputOnClick)
|
||||
end
|
||||
end)
|
||||
|
||||
-- show only frames in visible range
|
||||
function pfUI.addons.scroll:ShowVisibleRange()
|
||||
local top_index, bottom_index, range
|
||||
range = floor(pfUI.addons.scroll:GetHeight() / 25) + 1
|
||||
top_index = floor(pfUI.addons.scroll:GetVerticalScroll() / 25) > 0 and floor(pfUI.addons.scroll:GetVerticalScroll() / 25) or 1
|
||||
bottom_index = top_index + range
|
||||
for i=1, GetNumAddOns() do
|
||||
if i >= top_index and i <= bottom_index then
|
||||
pfUI.addons.list[i]:Show()
|
||||
else
|
||||
pfUI.addons.list[i]:Hide()
|
||||
end
|
||||
end
|
||||
row.addon = addon
|
||||
row.caption:SetText(addon.title)
|
||||
row.caption:SetAlpha(IsAddOnLoaded(addon.index) and 1 or .5)
|
||||
row.input:SetChecked(IsAddonEnabled(addon.index))
|
||||
end
|
||||
|
||||
pfUI.addons.scroll.slider:SetScript("OnValueChanged", function()
|
||||
this:GetParent():SetVerticalScroll(this:GetValue())
|
||||
end)
|
||||
pfUI.addons.scroll:SetScript("OnScrollRangeChanged", function()
|
||||
this.slider:SetMinMaxValues(1, floor(this:GetVerticalScrollRange() + 25))
|
||||
end)
|
||||
pfUI.addons.scroll:SetScript("OnShow", function()
|
||||
this.slider:SetValue(floor(this:GetVerticalScroll()))
|
||||
pfUI.addons.scroll:ShowVisibleRange()
|
||||
end)
|
||||
pfUI.addons.scroll:SetScript("OnVerticalScroll", function()
|
||||
pfUI.addons.scroll:ShowVisibleRange()
|
||||
this.slider:SetValue(floor(this:GetVerticalScroll()))
|
||||
-- addon list: a ScrollBox keeps rows only for the addons in view
|
||||
pfUI.addons.list = CreateFrame("Frame", "pfAddonList", pfUI.addons, "pfUIScrollBoxListTemplate")
|
||||
pfUI.addons.list:SetSize(370, 420)
|
||||
pfUI.addons.list:SetPoint("BOTTOM", 0, 5)
|
||||
CreateBackdrop(pfUI.addons.list, nil, true)
|
||||
|
||||
local view = CreateScrollBoxListLinearView(5, 5, 5, 8)
|
||||
view:SetElementExtent(25)
|
||||
view:SetElementInitializer("Button", InitRow)
|
||||
ScrollUtil.InitScrollBoxListWithScrollBar(pfUI.addons.list.ScrollBox, pfUI.addons.list.ScrollBar, view)
|
||||
pfUI.addons.list.ScrollBox:SetDataProvider(CreateDataProvider(addons))
|
||||
|
||||
-- a load-on-demand addon that loads brightens its row
|
||||
pfUI.addons.list:RegisterEvent("ADDON_LOADED")
|
||||
pfUI.addons.list:SetScript("OnEvent", function(self)
|
||||
self.ScrollBox:ReinitializeFrames()
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
+10
-11
@@ -29,20 +29,20 @@ pfUI:RegisterModule("afkcam", function ()
|
||||
overlay:SetFrameStrata("DIALOG")
|
||||
overlay:SetAllPoints(WorldFrame)
|
||||
|
||||
overlay:SetScript("OnMouseUp",function()
|
||||
SendChatMessage("","AFK")
|
||||
this._parent:stop()
|
||||
end)
|
||||
-- /afk toggles, so send it only while AFK is still set: once the client
|
||||
-- or the server has cleared it, /afk would set it again
|
||||
local function Wake()
|
||||
if IsChatAFK() then SendChatMessage("", "AFK") end
|
||||
afkcam:stop()
|
||||
end
|
||||
overlay:SetScript("OnMouseUp", Wake)
|
||||
overlay:SetScript("OnShow", function()
|
||||
this:EnableKeyboard(true)
|
||||
end)
|
||||
overlay:SetScript("OnHide", function()
|
||||
this:EnableKeyboard(false)
|
||||
end)
|
||||
overlay:SetScript("OnKeyUp",function()
|
||||
SendChatMessage("","AFK")
|
||||
this._parent:stop()
|
||||
end)
|
||||
overlay:SetScript("OnKeyUp", Wake)
|
||||
overlay:Hide()
|
||||
|
||||
local chat = CreateFrame("ScrollingMessageFrame", "pfAFKCamChat", overlay)
|
||||
@@ -82,7 +82,6 @@ pfUI:RegisterModule("afkcam", function ()
|
||||
end)
|
||||
overlay.chat = chat
|
||||
|
||||
overlay._parent = afkcam
|
||||
afkcam.overlay = overlay
|
||||
|
||||
local clock = CreateFrame("Frame", "pfAFKClock", overlay)
|
||||
@@ -166,9 +165,9 @@ pfUI:RegisterModule("afkcam", function ()
|
||||
if event == "PLAYER_FLAGS_CHANGED" then
|
||||
if UnitIsAFK('player') then
|
||||
delay:Show()
|
||||
elseif delay:IsVisible() then
|
||||
else
|
||||
delay:Hide()
|
||||
this:stop()
|
||||
if this._spinning then this:stop() end
|
||||
end
|
||||
else
|
||||
if this._spinning then
|
||||
|
||||
+29
-55
@@ -6,8 +6,6 @@ pfUI:RegisterModule("bags", function ()
|
||||
[1804] = {frame="picklock"},
|
||||
}
|
||||
|
||||
local scanner = libtipscan:GetScanner("input_search")
|
||||
|
||||
local function BagSortOpts()
|
||||
return {
|
||||
reverse = C.appearance.bags.sortreverse == "1",
|
||||
@@ -95,6 +93,7 @@ pfUI:RegisterModule("bags", function ()
|
||||
pfUI.bag:RegisterEvent("ITEM_LOCK_CHANGED")
|
||||
pfUI.bag:RegisterEvent("SPELLS_CHANGED")
|
||||
pfUI.bag:RegisterEvent("MERCHANT_CLOSED")
|
||||
pfUI.bag:RegisterEvent("INVENTORY_SEARCH_UPDATE")
|
||||
|
||||
pfUI.bag.delay = { UpdateBag = {} }
|
||||
|
||||
@@ -122,6 +121,11 @@ pfUI:RegisterModule("bags", function ()
|
||||
pfUI.bag:UpdateItemLock()
|
||||
end
|
||||
|
||||
if this.delay.UpdateSearch then
|
||||
this.delay.UpdateSearch = nil
|
||||
pfUI.bag:UpdateSearch()
|
||||
end
|
||||
|
||||
for bag in pairs(this.delay.UpdateBag) do
|
||||
this.delay.UpdateBag[bag] = nil
|
||||
pfUI.bag:UpdateBag(bag)
|
||||
@@ -159,6 +163,10 @@ pfUI:RegisterModule("bags", function ()
|
||||
this.delay.UpdateItemLock = true
|
||||
end
|
||||
|
||||
if event == "INVENTORY_SEARCH_UPDATE" then
|
||||
this.delay.UpdateSearch = true
|
||||
end
|
||||
|
||||
if event == "PLAYERBANKSLOTS_CHANGED" then
|
||||
this.delay.UpdateBag[-1] = true
|
||||
end
|
||||
@@ -377,6 +385,21 @@ pfUI:RegisterModule("bags", function ()
|
||||
end
|
||||
end
|
||||
|
||||
-- dim the slots that the bag search (C_Container.SetItemSearch) filters out
|
||||
local searchInfo = {}
|
||||
function pfUI.bag:UpdateSlotSearch(bag, slot)
|
||||
local info = C_Container.GetContainerItemInfo(bag, slot, searchInfo)
|
||||
pfUI.bags[bag].slots[slot].frame:SetAlpha(info and info.isFiltered and .25 or 1)
|
||||
end
|
||||
|
||||
function pfUI.bag:UpdateSearch()
|
||||
for bag = -2, 11 do
|
||||
for slot in ipairs(pfUI.bags[bag].slots) do
|
||||
pfUI.bag:UpdateSlotSearch(bag, slot)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function pfUI.bag:UpdateSlot(bag, slot)
|
||||
if not pfUI.bags[bag] then return end
|
||||
|
||||
@@ -465,6 +488,7 @@ pfUI:RegisterModule("bags", function ()
|
||||
SetItemButtonTexture(pfUI.bags[bag].slots[slot].frame, texture)
|
||||
SetItemButtonCount(pfUI.bags[bag].slots[slot].frame, count)
|
||||
SetItemButtonDesaturated(pfUI.bags[bag].slots[slot].frame, locked, 0.5, 0.5, 0.5)
|
||||
pfUI.bag:UpdateSlotSearch(bag, slot)
|
||||
|
||||
local hasItem = texture and 1 or nil
|
||||
pfUI.bags[bag].slots[slot].frame.hasItem = hasItem
|
||||
@@ -1010,7 +1034,6 @@ pfUI:RegisterModule("bags", function ()
|
||||
-- bag search
|
||||
if not frame.search then
|
||||
frame.search = CreateFrame("Frame", "pfBagSearch", frame)
|
||||
frame.search.db = {}
|
||||
frame.search:SetHeight(12)
|
||||
frame.search:SetPoint("TOPLEFT", frame, "TOPLEFT", default_border, -default_border)
|
||||
frame.search:SetPoint("TOPRIGHT", frame.sort, "TOPLEFT", -default_border*3, -default_border)
|
||||
@@ -1035,51 +1058,12 @@ pfUI:RegisterModule("bags", function ()
|
||||
|
||||
frame.search.edit:SetScript("OnEditFocusLost", function()
|
||||
this:SetText(T["Search"])
|
||||
for bag=-2, 11 do
|
||||
local bagsize = GetContainerNumSlots(bag)
|
||||
if bag == -2 and pfUI.bag.showKeyring == true then bagsize = GetKeyRingSize() end
|
||||
for slot=1, bagsize do
|
||||
pfUI.bags[bag].slots[slot].frame:SetAlpha(1)
|
||||
end
|
||||
end
|
||||
C_Container.SetItemSearch("")
|
||||
end)
|
||||
|
||||
frame.search.edit:SetScript("OnTextChanged", function()
|
||||
if this:GetText() == T["Search"] then return end
|
||||
for bag=-2, 11 do
|
||||
local bagsize = GetContainerNumSlots(bag)
|
||||
if bag == -2 and pfUI.bag.showKeyring == true then bagsize = GetKeyRingSize() end
|
||||
for slot=1, bagsize do
|
||||
pfUI.bags[bag].slots[slot].frame:SetAlpha(.25)
|
||||
local texture, itemCount, locked, quality, readable = GetContainerItemInfo(bag, slot)
|
||||
if itemCount then
|
||||
local itemLink = GetContainerItemLink(bag, slot)
|
||||
local itemstring = string.sub(itemLink, string.find(itemLink, "%[")+1, string.find(itemLink, "%]")-1)
|
||||
|
||||
if C.appearance.bags.fulltext == "1" then
|
||||
if not frame.search.db[itemLink] then
|
||||
scanner:SetBagItem(bag, slot)
|
||||
local text = scanner:Text()
|
||||
|
||||
local str = ""
|
||||
for k, v in pairs(text) do
|
||||
str = str .. (v[1] or "") .. (v[2] or "")
|
||||
end
|
||||
|
||||
frame.search.db[itemLink] = strlower(str)
|
||||
end
|
||||
|
||||
if strfind(frame.search.db[itemLink], strlower(this:GetText()), 1, true) then
|
||||
pfUI.bags[bag].slots[slot].frame:SetAlpha(1)
|
||||
end
|
||||
end
|
||||
|
||||
if strfind(strlower(itemstring), strlower(this:GetText()), 1, true) then
|
||||
pfUI.bags[bag].slots[slot].frame:SetAlpha(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
C_Container.SetItemSearch(this:GetText())
|
||||
end)
|
||||
|
||||
frame.search:SetScript("OnLeave", function()
|
||||
@@ -1094,17 +1078,7 @@ pfUI:RegisterModule("bags", function ()
|
||||
|
||||
frame.search:SetScript("OnHide", function()
|
||||
frame.search.edit:SetText(T["Search"])
|
||||
for bag = -2, 11 do
|
||||
if pfUI.bags[bag] then
|
||||
local bagsize = GetContainerNumSlots(bag)
|
||||
if bag == -2 and pfUI.bag.showKeyring == true then bagsize = GetKeyRingSize() end
|
||||
for slot = 1, bagsize do
|
||||
if pfUI.bags[bag] and pfUI.bags[bag].slots[slot] then
|
||||
pfUI.bags[bag].slots[slot].frame:SetAlpha(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
C_Container.SetItemSearch("")
|
||||
end)
|
||||
end
|
||||
else
|
||||
|
||||
+6
-11
@@ -150,8 +150,8 @@ pfUI:RegisterModule("castbar", function ()
|
||||
-- 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.
|
||||
local function RefreshBar(cb, rank)
|
||||
local query = cb.unitstr ~= "" and cb.unitstr or cb.unitname
|
||||
if not query or (cb.unitstr ~= "" and not UnitExists(cb.unitstr)) then
|
||||
local query = cb.unitstr
|
||||
if not UnitExists(query) then
|
||||
ClearBar(cb)
|
||||
return
|
||||
end
|
||||
@@ -178,7 +178,7 @@ pfUI:RegisterModule("castbar", function ()
|
||||
end
|
||||
end
|
||||
|
||||
local function CreateCastbar(name, parent, unitstr, unitname)
|
||||
local function CreateCastbar(name, parent, unitstr)
|
||||
local cb = CreateFrame("Frame", name, parent or UIParent)
|
||||
|
||||
cb:SetHeight(C.global.font_size * 1.5)
|
||||
@@ -186,7 +186,6 @@ pfUI:RegisterModule("castbar", function ()
|
||||
cb:SetFrameLevel(8)
|
||||
|
||||
cb.unitstr = unitstr
|
||||
cb.unitname = unitname
|
||||
|
||||
-- icon
|
||||
cb.icon = CreateFrame("Frame", nil, cb)
|
||||
@@ -277,7 +276,7 @@ pfUI:RegisterModule("castbar", function ()
|
||||
|
||||
-- Non-player bars: if the unit disappears (target died / detarget),
|
||||
-- drop the bar immediately.
|
||||
if this.unitstr ~= "" and this.unitstr ~= "player" and not UnitExists(this.unitstr) then
|
||||
if this.unitstr ~= "player" and not UnitExists(this.unitstr) then
|
||||
ClearBar(this)
|
||||
return
|
||||
end
|
||||
@@ -423,13 +422,12 @@ pfUI:RegisterModule("castbar", function ()
|
||||
-- endMs. delay is a positive magnitude; OnUpdate signs it "+" for casts
|
||||
-- and "-" for channels. Skipped during a tradeskill merge.
|
||||
if this.endTime and not this.tradeskillTotal then
|
||||
local query = this.unitstr ~= "" and this.unitstr or this.unitname
|
||||
local startMs, endMs
|
||||
if this.isChannel then
|
||||
local _, _, _, s, e = C_Spell.UnitChannelInfo(query)
|
||||
local _, _, _, s, e = C_Spell.UnitChannelInfo(unit)
|
||||
startMs, endMs = s, e
|
||||
else
|
||||
local _, _, _, s, e = C_Spell.UnitCastingInfo(query)
|
||||
local _, _, _, s, e = C_Spell.UnitCastingInfo(unit)
|
||||
startMs, endMs = s, e
|
||||
end
|
||||
if startMs and endMs then
|
||||
@@ -544,9 +542,6 @@ pfUI:RegisterModule("castbar", function ()
|
||||
pfUI.castbar.focus:SetHeight(C.castbar.focus.height)
|
||||
end
|
||||
|
||||
-- bind castbar to the "focus" unit token; the GUID resolves at read time
|
||||
pfUI.castbar.focus.unitstr = "focus"
|
||||
|
||||
UpdateMovable(pfUI.castbar.focus)
|
||||
end
|
||||
end)
|
||||
+27
-10
@@ -779,6 +779,20 @@ pfUI:RegisterModule("chat", function ()
|
||||
local r,g,b,a = GetStringColor(C.chat.text.timecolor)
|
||||
local timecolorhex = rgbhex(r,g,b,a)
|
||||
|
||||
-- AddMessage puts the time between these at the start of each line
|
||||
local timestampStart = timecolorhex .. tleft
|
||||
local timestampEnd = tright .. "|r "
|
||||
|
||||
-- [ StripTimestamp ]
|
||||
-- Returns a chat line without the timestamp AddMessage put before it.
|
||||
function pfUI.chat.StripTimestamp(text)
|
||||
if C.chat.text.time ~= "1" or text:sub(1, #timestampStart) ~= timestampStart then
|
||||
return text
|
||||
end
|
||||
local _, last = text:find(timestampEnd, #timestampStart + 1, true)
|
||||
return last and text:sub(last + 1) or text
|
||||
end
|
||||
|
||||
local r,g,b = GetStringColor(C.chat.text.unknowncolor)
|
||||
local unknowncolorhex = rgbhex(r,g,b)
|
||||
|
||||
@@ -788,12 +802,14 @@ pfUI:RegisterModule("chat", function ()
|
||||
return pfUI_playerDB[name].level
|
||||
end
|
||||
|
||||
local function AddMessage(frame, text, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17)
|
||||
-- Passes every argument after the text on: GetMessageInfo returns them all,
|
||||
-- and a hook that drops some loses them for every frame after it.
|
||||
local function AddMessage(frame, text, ...)
|
||||
if not text then return end
|
||||
|
||||
-- skip chat parsing on combat log
|
||||
if frame.pfCombatLog then
|
||||
return frame:HookAddMessage(text, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17)
|
||||
return frame:HookAddMessage(text, ...)
|
||||
end
|
||||
|
||||
-- payload of the CHAT_MSG event printing this line; nil for lines
|
||||
@@ -879,24 +895,25 @@ pfUI:RegisterModule("chat", function ()
|
||||
-- pushes the whisper colour code off position 1 and the find below fails
|
||||
local isWhisper = C.chat.global.whispermod == "1" and string.find(text, wcol, 1) == 1
|
||||
|
||||
if isWhisper then
|
||||
-- patch incoming whisper string to match the colors, before the
|
||||
-- timestamp so it keeps the form StripTimestamp looks for
|
||||
text = string.gsub(text, "|r", "|r" .. wcol)
|
||||
end
|
||||
|
||||
-- show timestamp in chat
|
||||
if C.chat.text.time == "1" then
|
||||
text = timecolorhex .. tleft .. date(C.chat.text.timeformat) .. tright .. "|r " .. text
|
||||
text = timestampStart .. date(C.chat.text.timeformat) .. timestampEnd .. text
|
||||
end
|
||||
|
||||
-- save chat history
|
||||
if isWhisper then
|
||||
SaveChatHistory(frame:GetID(), string.gsub(text, wcol, ""), cr, cg, cb)
|
||||
else
|
||||
SaveChatHistory(frame:GetID(), text, a1, a2, a3)
|
||||
SaveChatHistory(frame:GetID(), text, ...)
|
||||
end
|
||||
|
||||
if isWhisper then
|
||||
-- patch incoming whisper string to match the colors
|
||||
text = string.gsub(text, "|r", "|r" .. wcol)
|
||||
end
|
||||
|
||||
frame:HookAddMessage(text, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17)
|
||||
frame:HookAddMessage(text, ...)
|
||||
end
|
||||
|
||||
for i=1,NUM_CHAT_WINDOWS do
|
||||
|
||||
+50
-106
@@ -1,5 +1,4 @@
|
||||
pfUI:RegisterModule("chatcopy", function ()
|
||||
local limit = 100
|
||||
local f = CreateFrame("Frame")
|
||||
f:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
f:SetScript("OnEvent", function()
|
||||
@@ -15,26 +14,27 @@ pfUI:RegisterModule("chatcopy", function ()
|
||||
button.icon:SetTexture("Interface\\Buttons\\UI-GuildButton-PublicNote-Disabled")
|
||||
button.icon:SetAllPoints()
|
||||
|
||||
-- show or hide the copy box of every chat frame
|
||||
local function SetCopyMode(state)
|
||||
button.state = state
|
||||
|
||||
for i=1, _G.NUM_CHAT_WINDOWS do
|
||||
local scroll = _G["ChatFrame"..i].scroll
|
||||
if scroll then
|
||||
scroll:SetShown(state)
|
||||
end
|
||||
end
|
||||
|
||||
if state then
|
||||
button.icon:SetTexture("Interface\\Buttons\\UI-GuildButton-PublicNote-Up")
|
||||
else
|
||||
button.icon:SetTexture("Interface\\Buttons\\UI-GuildButton-PublicNote-Disabled")
|
||||
end
|
||||
end
|
||||
|
||||
button:SetScript("OnClick", function()
|
||||
if arg1 == "LeftButton" then
|
||||
this.state = not this.state
|
||||
|
||||
for i=1, _G.NUM_CHAT_WINDOWS do
|
||||
local frame = _G["ChatFrame"..i]
|
||||
local scroll = frame.scroll
|
||||
|
||||
if scroll and this.state then
|
||||
scroll:Show()
|
||||
elseif scroll then
|
||||
scroll:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
if this.state then
|
||||
button.icon:SetTexture("Interface\\Buttons\\UI-GuildButton-PublicNote-Up")
|
||||
else
|
||||
button.icon:SetTexture("Interface\\Buttons\\UI-GuildButton-PublicNote-Disabled")
|
||||
end
|
||||
SetCopyMode(not this.state)
|
||||
elseif arg1 == "RightButton" then
|
||||
if ChatMenu:IsShown() then
|
||||
ChatMenu:Hide()
|
||||
@@ -56,98 +56,42 @@ pfUI:RegisterModule("chatcopy", function ()
|
||||
|
||||
for i=1, _G.NUM_CHAT_WINDOWS do
|
||||
local frame = _G["ChatFrame"..i]
|
||||
local name = frame:GetName()
|
||||
|
||||
local combat = 0
|
||||
for i, msg in pairs(frame.messageTypeList) do
|
||||
if strfind(msg, "SPELL", 1) or strfind(msg, "COMBAT", 1) then
|
||||
combat = combat + 1
|
||||
-- the chat frame's messages in an edit box to copy from
|
||||
local scroll = CreateFrame("Frame", "pfChatCopy" .. i, frame, "pfUIScrollingEditBoxTemplate")
|
||||
scroll:SetAllPoints(frame)
|
||||
scroll.tex = scroll:CreateTexture(nil, "BACKGROUND")
|
||||
scroll.tex:SetTexture(0,0,0,.95)
|
||||
scroll.tex:SetPoint("TOPLEFT", -3, 3)
|
||||
scroll.tex:SetPoint("BOTTOMRIGHT", 3, -3)
|
||||
scroll:Hide()
|
||||
|
||||
scroll:RegisterCallback("OnEscapePressed", function()
|
||||
SetCopyMode(false)
|
||||
end, scroll)
|
||||
|
||||
scroll:HookScript("OnShow", function()
|
||||
-- each line in its own color, which also replaces the |r resets inside it
|
||||
local lines = {}
|
||||
for index=1, frame:GetNumMessages() do
|
||||
local text, r, g, b = frame:GetMessageInfo(index)
|
||||
if C.chat.text.copytime == "0" then
|
||||
text = pfUI.chat.StripTimestamp(text)
|
||||
end
|
||||
local color = rgbhex(r, g, b)
|
||||
table.insert(lines, color .. text:gsub("|r", color))
|
||||
end
|
||||
end
|
||||
local text = table.concat(lines, "\n")
|
||||
|
||||
if combat < 5 then
|
||||
-- initialize message cache
|
||||
local history = {}
|
||||
local AddMessage = frame.AddMessage
|
||||
frame.AddMessage = function(self,msg,r,g,b)
|
||||
if msg and r and g and b then
|
||||
local col = rgbhex(r,g,b)
|
||||
table.insert(history, 1, col..string.gsub(msg, "|r", col))
|
||||
elseif msg then
|
||||
table.insert(history, 1, "|cffffffff"..msg)
|
||||
end
|
||||
scroll:SetFont(frame:GetFont())
|
||||
scroll:SetText(text)
|
||||
|
||||
if history[limit] then
|
||||
table.remove(history, limit)
|
||||
end
|
||||
AddMessage(self,msg,r,g,b)
|
||||
end
|
||||
-- the cursor at the end scrolls the box to the newest line
|
||||
scroll:SetFocus()
|
||||
scroll:SetCursorPosition(#text)
|
||||
end)
|
||||
|
||||
-- read chat defaults
|
||||
local font, size, flags = frame:GetFont()
|
||||
|
||||
-- build the frames
|
||||
local scroll = CreateScrollFrame("ChatFrameScroll"..i, frame)
|
||||
scroll:SetAllPoints(frame)
|
||||
scroll.tex = scroll:CreateTexture(nil, "BACKGROUND")
|
||||
scroll.tex:SetTexture(0,0,0,.95)
|
||||
scroll.tex:SetPoint("TOPLEFT", -3, 3)
|
||||
scroll.tex:SetPoint("BOTTOMRIGHT", 3, -3)
|
||||
scroll:Hide()
|
||||
|
||||
local editbox = CreateFrame("EditBox", "pfChatCopyBox" .. i, scroll)
|
||||
editbox:SetSize(frame:GetSize())
|
||||
editbox:SetAllPoints(scroll)
|
||||
editbox:SetTextColor(1,1,1,1)
|
||||
editbox:SetFontObject(ChatFontNormal)
|
||||
editbox:SetFont(font, size, flags)
|
||||
editbox:SetAutoFocus(true)
|
||||
editbox:SetMultiLine(true)
|
||||
editbox:SetMaxLetters(0)
|
||||
|
||||
editbox:SetScript("OnMouseDown", function()
|
||||
editbox.hasFocus = true
|
||||
end)
|
||||
|
||||
editbox:SetScript("OnEscapePressed", function()
|
||||
if editbox.hasFocus then
|
||||
editbox:HighlightText(0, 0)
|
||||
editbox:ClearFocus()
|
||||
editbox.hasFocus = false
|
||||
else
|
||||
editbox:GetParent():Hide()
|
||||
pfChatCopyButton.icon:SetTexture("Interface\\Buttons\\UI-GuildButton-PublicNote-Disabled")
|
||||
pfChatCopyButton.state = false
|
||||
end
|
||||
end)
|
||||
|
||||
scroll:SetScrollChild(editbox)
|
||||
scroll:SetScript("OnShow", function()
|
||||
editbox:SetText("")
|
||||
for i=limit,0,-1 do
|
||||
if history[i] then
|
||||
editbox:Insert("\n" .. history[i])
|
||||
end
|
||||
end
|
||||
|
||||
editbox:SetScript("OnUpdate", function()
|
||||
if not this.count then this.count = 0 end
|
||||
|
||||
scroll:UpdateScrollChildRect()
|
||||
scroll:SetVerticalScroll(scroll:GetVerticalScrollRange())
|
||||
scroll:Scroll()
|
||||
this.count = this.count + 1
|
||||
|
||||
-- the scroll frame takes a while to update
|
||||
if this.count >= 3 then
|
||||
this:SetScript("OnUpdate", nil)
|
||||
this.count = 0
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
frame.scroll = scroll
|
||||
end
|
||||
frame.scroll = scroll
|
||||
end
|
||||
|
||||
this:UnregisterAllEvents()
|
||||
|
||||
+154
-238
@@ -270,39 +270,20 @@ pfUI:RegisterModule("equipmentmanager", function()
|
||||
-- ============================================================
|
||||
|
||||
local LIST_VISIBLE_ROWS = 7
|
||||
local LIST_ROW_STRIDE = SET_ROW_HEIGHT + 2
|
||||
local listFrame = CreateFrame("Frame", nil, frame)
|
||||
-- The template keeps 5px around the rows, which sit 2px apart.
|
||||
local listFrame = CreateFrame("Frame", nil, frame, "pfUIScrollBoxListTemplate")
|
||||
listFrame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -58)
|
||||
-- Height fits N rows + (N-1) inter-row gaps + 3px top/bottom padding.
|
||||
listFrame:SetSize(180, LIST_VISIBLE_ROWS * LIST_ROW_STRIDE + 4)
|
||||
listFrame:SetSize(180, LIST_VISIBLE_ROWS * (SET_ROW_HEIGHT + 2) - 2 + 10)
|
||||
CreateBackdrop(listFrame, nil, nil, .75)
|
||||
|
||||
-- Mouse-wheel scroll: list of [sets..., newSetRow] is virtualized
|
||||
-- through LIST_VISIBLE_ROWS slots. Refresh() consumes listFrame.offset
|
||||
-- and the wheel handler clamps + bumps it.
|
||||
listFrame.offset = 0
|
||||
listFrame:EnableMouseWheel(true)
|
||||
listFrame:SetScript("OnMouseWheel", function()
|
||||
listFrame.offset = listFrame.offset - (arg1 or 0)
|
||||
pfUI.equipmentmanager.Refresh()
|
||||
end)
|
||||
|
||||
local setRows = {}
|
||||
local function CreateSetRow()
|
||||
local row = CreateFrame("Button", nil, listFrame)
|
||||
row:SetSize(170, SET_ROW_HEIGHT)
|
||||
-- Position is set per-Refresh based on the row's visible slot;
|
||||
-- start anchored to avoid uninitialized geometry before first Refresh.
|
||||
row:SetPoint("TOPLEFT", listFrame, "TOPLEFT", 5, -3)
|
||||
|
||||
-- One-time setup of a pooled row. A row shows a set or, last in the
|
||||
-- list, the "New Set" entry; InitSetRow sets what differs.
|
||||
local function SetupSetRow(row)
|
||||
row.icon = row:CreateTexture(nil, "ARTWORK")
|
||||
row.icon:SetSize(30, 30)
|
||||
row.icon:SetPoint("LEFT", row, "LEFT", 2, 0)
|
||||
row.icon:SetTexCoord(.08, .92, .08, .92)
|
||||
row.icon:SetPoint("CENTER", row, "LEFT", 17, 0)
|
||||
|
||||
row.text = row:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||
row.text:SetPoint("LEFT", row.icon, "RIGHT", 6, 0)
|
||||
row.text:SetPoint("RIGHT", row, "RIGHT", -22, 0)
|
||||
row.text:SetPoint("LEFT", row, "LEFT", 38, 0)
|
||||
row.text:SetJustifyH("LEFT")
|
||||
|
||||
row.highlight = row:CreateTexture(nil, "BACKGROUND")
|
||||
@@ -316,7 +297,11 @@ pfUI:RegisterModule("equipmentmanager", function()
|
||||
row.gear.tex = row.gear:CreateTexture(nil, "ARTWORK")
|
||||
row.gear.tex:SetAllPoints(row.gear)
|
||||
row.gear.tex:SetTexture(pfUI.path.."\\img\\Gear_64Grey")
|
||||
row.gear:SetHighlightTexture("Interface\\Buttons\\ButtonHilight-Square", "ADD")
|
||||
row.gear.tex:SetAlpha(.5)
|
||||
-- the gear drawn again additively lights up the gear itself
|
||||
row.gear:SetHighlightTexture(pfUI.path.."\\img\\Gear_64Grey", "ADD")
|
||||
-- moving onto the gear does not leave the row
|
||||
row.gear:SetPropagateMouseMotion(true)
|
||||
row.gear:Hide()
|
||||
row.gear:SetScript("OnClick", function()
|
||||
if not row.setID then return end
|
||||
@@ -335,39 +320,30 @@ pfUI:RegisterModule("equipmentmanager", function()
|
||||
end)
|
||||
|
||||
row:SetScript("OnClick", function()
|
||||
selectedSetID = row.setID
|
||||
-- Detect double-click manually; vanilla Button has no native event.
|
||||
local now = GetTime()
|
||||
if row.lastClick and (now - row.lastClick) < 0.4 then
|
||||
row.lastClick = nil
|
||||
EquipSet(row.setID)
|
||||
if row.setID then
|
||||
selectedSetID = row.setID
|
||||
pfUI.equipmentmanager.Refresh()
|
||||
else
|
||||
row.lastClick = now
|
||||
OpenNamePopup("new")
|
||||
end
|
||||
pfUI.equipmentmanager.Refresh()
|
||||
end)
|
||||
row:SetScript("OnDoubleClick", function()
|
||||
if row.setID then EquipSet(row.setID) end
|
||||
end)
|
||||
|
||||
-- Drag a set onto an action bar. PickupEquipmentSet is newer than
|
||||
-- the rest of C_EquipmentSet, so dragging stays inert on ClassicAPI
|
||||
-- builds that don't ship it yet.
|
||||
if C_EquipmentSet.PickupEquipmentSet then
|
||||
row:RegisterForDrag("LeftButton")
|
||||
row:SetScript("OnDragStart", function()
|
||||
if row.setID then C_EquipmentSet.PickupEquipmentSet(row.setID) end
|
||||
end)
|
||||
end
|
||||
-- Drag a set onto an action bar.
|
||||
row:RegisterForDrag("LeftButton")
|
||||
row:SetScript("OnDragStart", function()
|
||||
if row.setID then C_EquipmentSet.PickupEquipmentSet(row.setID) end
|
||||
end)
|
||||
|
||||
-- Show the gear and tooltip while the cursor is over the row or its
|
||||
-- gear child. The gear sits inside the row's rectangle, so a single
|
||||
-- MouseIsOverHitRect(row) check covers both. OnLeave on the row and the
|
||||
-- gear catches every exit path, so no OnUpdate poll is needed.
|
||||
local function HideRowHover()
|
||||
if MouseIsOverHitRect(row) then return end
|
||||
GameTooltip:Hide()
|
||||
row.gear:Hide()
|
||||
end
|
||||
-- A set row shows its gear and tooltip while the cursor is over it;
|
||||
-- the "New Set" row lights up.
|
||||
row:SetScript("OnEnter", function()
|
||||
if not row.setID then return end
|
||||
if not row.setID then
|
||||
row.highlight:Show()
|
||||
return
|
||||
end
|
||||
local name = C_EquipmentSet.GetEquipmentSetInfo(row.setID)
|
||||
if name then
|
||||
GameTooltip:SetOwner(row, "ANCHOR_RIGHT")
|
||||
@@ -376,40 +352,50 @@ pfUI:RegisterModule("equipmentmanager", function()
|
||||
end
|
||||
row.gear:Show()
|
||||
end)
|
||||
row:SetScript("OnLeave", HideRowHover)
|
||||
row.gear:SetScript("OnLeave", HideRowHover)
|
||||
|
||||
return row
|
||||
row:SetScript("OnLeave", function()
|
||||
GameTooltip:Hide()
|
||||
row.gear:Hide()
|
||||
if not row.setID then row.highlight:Hide() end
|
||||
end)
|
||||
end
|
||||
|
||||
-- Rows are allocated lazily in Refresh — ClassicAPI no longer caps
|
||||
-- the number of equipment sets, so we grow the pool to numSets on
|
||||
-- demand. The set list is wheel-scrolled, so only LIST_VISIBLE_ROWS
|
||||
-- are ever positioned in-frame at a time, but each row is bound to a
|
||||
-- specific set index (row[i] always shows ids[i]).
|
||||
local function InitSetRow(row, entry)
|
||||
if not row.text then SetupSetRow(row) end
|
||||
|
||||
local newSetRow = CreateFrame("Button", nil, listFrame)
|
||||
newSetRow:SetSize(170, SET_ROW_HEIGHT);
|
||||
row.setID = entry.setID
|
||||
row.gear:Hide()
|
||||
|
||||
newSetRow.icon = newSetRow:CreateTexture(nil, "ARTWORK")
|
||||
newSetRow.icon:SetSize(24, 24);
|
||||
newSetRow.icon:SetPoint("LEFT", newSetRow, "LEFT", 5, 0)
|
||||
newSetRow.icon:SetTexture(pfUI.path.."\\img\\Character-Plus")
|
||||
if not entry.setID then
|
||||
row.icon:SetSize(24, 24)
|
||||
row.icon:SetTexCoord(0, 1, 0, 1)
|
||||
row.icon:SetTexture(pfUI.path.."\\img\\Character-Plus")
|
||||
row.text:SetPoint("RIGHT", row, "RIGHT", -4, 0)
|
||||
row.text:SetText(PAPERDOLL_NEWEQUIPMENTSET)
|
||||
row.text:SetTextColor(0.2, 1, 0.2)
|
||||
row.highlight:Hide()
|
||||
return
|
||||
end
|
||||
|
||||
newSetRow.text = newSetRow:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||
newSetRow.text:SetPoint("LEFT", newSetRow.icon, "RIGHT", 8, 0)
|
||||
newSetRow.text:SetPoint("RIGHT", newSetRow, "RIGHT", -4, 0)
|
||||
newSetRow.text:SetJustifyH("LEFT")
|
||||
newSetRow.text:SetText(PAPERDOLL_NEWEQUIPMENTSET)
|
||||
newSetRow.text:SetTextColor(0.2, 1, 0.2)
|
||||
local name, icon, _, isEquipped, _, _, _, numMissing = C_EquipmentSet.GetEquipmentSetInfo(entry.setID)
|
||||
row.icon:SetSize(30, 30)
|
||||
row.icon:SetTexCoord(.08, .92, .08, .92)
|
||||
if icon then
|
||||
row.icon:SetTexture(string.find(icon, "\\") and icon or ("Interface\\Icons\\" .. icon))
|
||||
else
|
||||
row.icon:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark")
|
||||
end
|
||||
-- Color precedence: missing items (red) > equipped (green) > normal (white).
|
||||
local color = (numMissing and numMissing > 0) and "|cffff5555"
|
||||
or isEquipped and "|cff33ff33" or "|cffffffff"
|
||||
row.text:SetPoint("RIGHT", row, "RIGHT", -22, 0)
|
||||
row.text:SetText(color .. (name or "?") .. "|r")
|
||||
row.highlight:SetShown(entry.setID == selectedSetID)
|
||||
end
|
||||
|
||||
newSetRow.highlight = newSetRow:CreateTexture(nil, "BACKGROUND")
|
||||
newSetRow.highlight:SetAllPoints(newSetRow)
|
||||
newSetRow.highlight:SetTexture(.3, .3, .3, .4)
|
||||
newSetRow.highlight:Hide()
|
||||
newSetRow:SetScript("OnEnter", function() newSetRow.highlight:Show() end)
|
||||
newSetRow:SetScript("OnLeave", function() newSetRow.highlight:Hide() end)
|
||||
newSetRow:SetScript("OnClick", function() OpenNamePopup("new") end)
|
||||
local setView = CreateScrollBoxListLinearView(0, 0, 0, 2, 2)
|
||||
setView:SetElementExtent(SET_ROW_HEIGHT)
|
||||
setView:SetElementInitializer("Button", InitSetRow)
|
||||
ScrollUtil.InitScrollBoxListWithScrollBar(listFrame.ScrollBox, listFrame.ScrollBar, setView)
|
||||
|
||||
local function MakeButton(name, label, parent, anchor, ax, ay, width)
|
||||
local b = CreateFrame("Button", name, parent, "UIPanelButtonTemplate")
|
||||
@@ -863,60 +849,21 @@ pfUI:RegisterModule("equipmentmanager", function()
|
||||
selectedSetID = nil
|
||||
end
|
||||
|
||||
-- Virtual list = sets ++ newSetRow. Clamp the current scroll
|
||||
-- offset against the visible window before laying out rows so
|
||||
-- deleting sets snaps the list back into view.
|
||||
local totalItems = numSets + 1
|
||||
local maxOffset = math.max(0, totalItems - LIST_VISIBLE_ROWS)
|
||||
if listFrame.offset > maxOffset then listFrame.offset = maxOffset end
|
||||
if listFrame.offset < 0 then listFrame.offset = 0 end
|
||||
local off = listFrame.offset
|
||||
|
||||
-- Set rows: lazy-grow the pool to numSets, then position visible
|
||||
-- ones into slots and hide the rest. Each row stays bound to a
|
||||
-- specific set index (row[i] always shows ids[i]).
|
||||
for i = 1, numSets do
|
||||
if not setRows[i] then setRows[i] = CreateSetRow() end
|
||||
local row = setRows[i]
|
||||
local slot = i - off
|
||||
if slot >= 1 and slot <= LIST_VISIBLE_ROWS then
|
||||
local setID = ids[i]
|
||||
local name, icon, _, isEquipped, _, _, _, numMissing = C_EquipmentSet.GetEquipmentSetInfo(setID)
|
||||
row.setID = setID
|
||||
-- Color precedence: missing items (red) > equipped (green) > normal (white).
|
||||
local color = (numMissing and numMissing > 0) and "|cffff5555"
|
||||
or isEquipped and "|cff33ff33" or "|cffffffff"
|
||||
row.text:SetText(color .. (name or "?") .. "|r")
|
||||
if icon then
|
||||
local full = string.find(icon, "\\") and icon or ("Interface\\Icons\\" .. icon)
|
||||
row.icon:SetTexture(full)
|
||||
else
|
||||
row.icon:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark")
|
||||
end
|
||||
if setID == selectedSetID then row.highlight:Show() else row.highlight:Hide() end
|
||||
row:ClearAllPoints()
|
||||
row:SetPoint("TOPLEFT", listFrame, "TOPLEFT", 5, -3 - (slot - 1) * LIST_ROW_STRIDE)
|
||||
row:Show()
|
||||
else
|
||||
row:Hide()
|
||||
row.setID = nil
|
||||
-- The rows are the sets, then the "New Set" entry. They are rebuilt
|
||||
-- only when the sets change; otherwise the shown rows refresh in
|
||||
-- place, so the row under the cursor stays the same frame and a
|
||||
-- double-click reaches it.
|
||||
local setsKey = table.concat(ids, ",")
|
||||
if setsKey ~= listFrame.setsKey then
|
||||
listFrame.setsKey = setsKey
|
||||
local entries = {}
|
||||
for _, setID in ipairs(ids) do
|
||||
table.insert(entries, { setID = setID })
|
||||
end
|
||||
end
|
||||
-- Hide pool entries past the current set count (left over from a
|
||||
-- previous Refresh with more sets — e.g. just deleted one).
|
||||
for i = numSets + 1, table.getn(setRows) do
|
||||
setRows[i]:Hide()
|
||||
setRows[i].setID = nil
|
||||
end
|
||||
|
||||
-- "+ New Set" row occupies virtual index numSets+1.
|
||||
local newSlot = (numSets + 1) - off
|
||||
if newSlot >= 1 and newSlot <= LIST_VISIBLE_ROWS then
|
||||
newSetRow:ClearAllPoints()
|
||||
newSetRow:SetPoint("TOPLEFT", listFrame, "TOPLEFT", 5, -3 - (newSlot - 1) * LIST_ROW_STRIDE)
|
||||
newSetRow:Show()
|
||||
table.insert(entries, { newSet = true })
|
||||
listFrame.ScrollBox:SetDataProvider(CreateDataProvider(entries), ScrollBoxConstants.RetainScrollPosition)
|
||||
else
|
||||
newSetRow:Hide()
|
||||
listFrame.ScrollBox:ReinitializeFrames()
|
||||
end
|
||||
|
||||
-- Update the ignored-overlay textures attached to each paperdoll
|
||||
@@ -1102,11 +1049,14 @@ pfUI:RegisterModule("equipmentmanager", function()
|
||||
|
||||
local UNUSED_COLS, UNUSED_ROWS = 7, 8
|
||||
local UNUSED_SIZE, UNUSED_GAP = 30, 4
|
||||
local UNUSED_STRIDE = UNUSED_SIZE + UNUSED_GAP
|
||||
|
||||
-- The grid's list template keeps 5px around the buttons and a 7px scroll
|
||||
-- bar 2px right of them.
|
||||
local UNUSED_GRID_W = UNUSED_COLS * (UNUSED_SIZE + UNUSED_GAP) - UNUSED_GAP + 2 + 7 + 10
|
||||
local UNUSED_GRID_H = UNUSED_ROWS * (UNUSED_SIZE + UNUSED_GAP) - UNUSED_GAP + 10
|
||||
|
||||
local unusedPanel = CreateSubPanel("pfEqMgrUnusedFrame",
|
||||
UNUSED_COLS * UNUSED_STRIDE + 24, frame:GetHeight(), T["Items Not In Any Set"])
|
||||
unusedPanel.offset = 0 -- first visible row
|
||||
UNUSED_GRID_W + 22, frame:GetHeight(), T["Items Not In Any Set"])
|
||||
|
||||
unusedPanel.info = unusedPanel:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
||||
unusedPanel.info:SetPoint("TOPLEFT", unusedPanel, "TOPLEFT", 14, -34)
|
||||
@@ -1118,14 +1068,13 @@ pfUI:RegisterModule("equipmentmanager", function()
|
||||
unusedPanel.showIgnored.label:SetPoint("RIGHT", unusedPanel.showIgnored, "LEFT", -4, 0)
|
||||
unusedPanel.showIgnored.label:SetText(T["Show Ignored"])
|
||||
|
||||
local unusedGrid = CreateFrame("Frame", nil, unusedPanel)
|
||||
unusedGrid:SetPoint("TOPLEFT", unusedPanel, "TOPLEFT", 12 + UNUSED_GAP/2, -54)
|
||||
unusedGrid:SetSize(UNUSED_COLS * UNUSED_STRIDE, UNUSED_ROWS * UNUSED_STRIDE)
|
||||
unusedGrid:EnableMouseWheel(true)
|
||||
local unusedGrid = CreateFrame("Frame", nil, unusedPanel, "pfUIScrollBoxListTemplate")
|
||||
unusedGrid:SetPoint("TOPLEFT", unusedPanel, "TOPLEFT", 11, -51)
|
||||
unusedGrid:SetSize(UNUSED_GRID_W, UNUSED_GRID_H)
|
||||
|
||||
unusedPanel.empty = unusedPanel:CreateFontString(nil, "OVERLAY", "GameFontDisable")
|
||||
unusedPanel.empty:SetPoint("CENTER", unusedGrid, "CENTER", 0, 0)
|
||||
unusedPanel.empty:SetWidth(UNUSED_COLS * UNUSED_STRIDE - 10)
|
||||
unusedPanel.empty:SetWidth(UNUSED_GRID_W - 20)
|
||||
unusedPanel.empty:SetText(T["Every equippable item is part of a set."])
|
||||
|
||||
unusedPanel.hint = unusedPanel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
||||
@@ -1135,7 +1084,6 @@ pfUI:RegisterModule("equipmentmanager", function()
|
||||
unusedPanel.hint:SetText(T["Shift-Click: Link Ctrl-Click: Preview\nRight-Click: Ignore / Unignore"])
|
||||
|
||||
local RefreshUnusedPanel -- forward decl
|
||||
local unusedButtons = {}
|
||||
|
||||
-- Bag highlight: while the panel is open, items of the list glow in
|
||||
-- pfUI's bag and bank frames and every other item is dimmed.
|
||||
@@ -1203,12 +1151,8 @@ pfUI:RegisterModule("equipmentmanager", function()
|
||||
local WHERE_TAG = { equipped = "|cff33ff33E|r", bags = "", bank = "|cff66aaffB|r" }
|
||||
local WHERE_TEXT = { equipped = T["Equipped"], bags = T["In Bags"], bank = T["In Bank"] }
|
||||
|
||||
local function CreateUnusedButton(i)
|
||||
local b = CreateFrame("Button", nil, unusedGrid)
|
||||
b:SetSize(UNUSED_SIZE, UNUSED_SIZE)
|
||||
local col = math.mod(i - 1, UNUSED_COLS)
|
||||
local row = math.floor((i - 1) / UNUSED_COLS)
|
||||
b:SetPoint("TOPLEFT", unusedGrid, "TOPLEFT", col * UNUSED_STRIDE + UNUSED_GAP/2, -row * UNUSED_STRIDE - UNUSED_GAP/2)
|
||||
-- one-time setup of a pooled grid button
|
||||
local function SetupUnusedButton(b)
|
||||
CreateBackdrop(b)
|
||||
b:RegisterForClicks("LeftButtonUp", "RightButtonUp")
|
||||
|
||||
@@ -1252,14 +1196,24 @@ pfUI:RegisterModule("equipmentmanager", function()
|
||||
DressUpItemLink(e.link)
|
||||
end
|
||||
end)
|
||||
|
||||
return b
|
||||
end
|
||||
|
||||
unusedGrid:SetScript("OnMouseWheel", function()
|
||||
unusedPanel.offset = unusedPanel.offset - (arg1 or 0)
|
||||
RefreshUnusedPanel()
|
||||
end)
|
||||
local function InitUnusedButton(b, e)
|
||||
if not b.icon then SetupUnusedButton(b) end
|
||||
|
||||
b.entry = e
|
||||
b.icon:SetTexture(e.icon or "Interface\\Icons\\INV_Misc_QuestionMark")
|
||||
b.icon:SetDesaturated(e.ignored and true or false)
|
||||
b.icon:SetAlpha(e.ignored and .5 or 1)
|
||||
b.tag:SetText(WHERE_TAG[e.where] or "")
|
||||
local r, g, bl = GetItemQualityColor(e.quality or 1)
|
||||
b.backdrop:SetBackdropBorderColor(r, g, bl, 1)
|
||||
end
|
||||
|
||||
local unusedView = CreateScrollBoxListGridView(UNUSED_COLS, 0, 0, 0, 2, UNUSED_GAP, UNUSED_GAP)
|
||||
unusedView:SetElementSize(UNUSED_SIZE, UNUSED_SIZE)
|
||||
unusedView:SetElementInitializer("Button", InitUnusedButton)
|
||||
ScrollUtil.InitScrollBoxListWithScrollBar(unusedGrid.ScrollBox, unusedGrid.ScrollBar, unusedView)
|
||||
|
||||
function RefreshUnusedPanel()
|
||||
local list, numIgnored = ScanUnusedItems(unusedPanel.showIgnored:GetChecked() and true or nil)
|
||||
@@ -1267,33 +1221,7 @@ pfUI:RegisterModule("equipmentmanager", function()
|
||||
local numShownIgnored = unusedPanel.showIgnored:GetChecked() and numIgnored or 0
|
||||
unusedPanel.info:SetText(string.format(T["%d items, %d ignored"], total - numShownIgnored, numIgnored))
|
||||
|
||||
local totalRows = math.ceil(total / UNUSED_COLS)
|
||||
local maxOffset = math.max(0, totalRows - UNUSED_ROWS)
|
||||
if unusedPanel.offset > maxOffset then unusedPanel.offset = maxOffset end
|
||||
if unusedPanel.offset < 0 then unusedPanel.offset = 0 end
|
||||
local first = unusedPanel.offset * UNUSED_COLS
|
||||
|
||||
for i = 1, UNUSED_COLS * UNUSED_ROWS do
|
||||
local e = list[first + i]
|
||||
local b = unusedButtons[i]
|
||||
if e then
|
||||
if not b then
|
||||
b = CreateUnusedButton(i)
|
||||
unusedButtons[i] = b
|
||||
end
|
||||
b.entry = e
|
||||
b.icon:SetTexture(e.icon or "Interface\\Icons\\INV_Misc_QuestionMark")
|
||||
b.icon:SetDesaturated(e.ignored and true or false)
|
||||
b.icon:SetAlpha(e.ignored and .5 or 1)
|
||||
b.tag:SetText(WHERE_TAG[e.where] or "")
|
||||
local r, g, bl = GetItemQualityColor(e.quality or 1)
|
||||
if b.backdrop then b.backdrop:SetBackdropBorderColor(r, g, bl, 1) end
|
||||
b:Show()
|
||||
elseif b then
|
||||
b.entry = nil
|
||||
b:Hide()
|
||||
end
|
||||
end
|
||||
unusedGrid.ScrollBox:SetDataProvider(CreateDataProvider(list), ScrollBoxConstants.RetainScrollPosition)
|
||||
|
||||
if total == 0 then unusedPanel.empty:Show() else unusedPanel.empty:Hide() end
|
||||
|
||||
@@ -1690,10 +1618,8 @@ pfUI:RegisterModule("equipmentmanager", function()
|
||||
-- ============================================================
|
||||
|
||||
local TRIGGER_ROWS, TRIGGER_ROW_H = 5, 24
|
||||
local TRIGGER_STRIDE = TRIGGER_ROW_H + 2
|
||||
local triggerPanel = CreateSubPanel("pfEqMgrTriggerFrame", 310, 404, T["Automatic Set Switching"])
|
||||
local selectedTriggerID = nil
|
||||
triggerPanel.offset = 0
|
||||
|
||||
local cbAuto = CreateCheckbox(triggerPanel, T["Enable Automatic Set Switching"])
|
||||
cbAuto:SetPoint("TOPLEFT", triggerPanel, "TOPLEFT", 12, -30)
|
||||
@@ -1702,15 +1628,11 @@ pfUI:RegisterModule("equipmentmanager", function()
|
||||
UpdateEngine()
|
||||
end)
|
||||
|
||||
local triggerList = CreateFrame("Frame", nil, triggerPanel)
|
||||
-- The template keeps 5px around the rows, which sit 2px apart.
|
||||
local triggerList = CreateFrame("Frame", nil, triggerPanel, "pfUIScrollBoxListTemplate")
|
||||
triggerList:SetPoint("TOPLEFT", triggerPanel, "TOPLEFT", 14, -56)
|
||||
triggerList:SetSize(282, TRIGGER_ROWS * TRIGGER_STRIDE + 4)
|
||||
triggerList:SetSize(282, TRIGGER_ROWS * (TRIGGER_ROW_H + 2) - 2 + 10)
|
||||
CreateBackdrop(triggerList, nil, nil, .75)
|
||||
triggerList:EnableMouseWheel(true)
|
||||
triggerList:SetScript("OnMouseWheel", function()
|
||||
triggerPanel.offset = triggerPanel.offset - (arg1 or 0)
|
||||
RefreshTriggerPanel()
|
||||
end)
|
||||
|
||||
triggerList.empty = triggerList:CreateFontString(nil, "OVERLAY", "GameFontDisable")
|
||||
triggerList.empty:SetPoint("CENTER", triggerList, "CENTER", 0, 0)
|
||||
@@ -1725,12 +1647,8 @@ pfUI:RegisterModule("equipmentmanager", function()
|
||||
RefreshTriggerPanel()
|
||||
end
|
||||
|
||||
local triggerRows = {}
|
||||
for i = 1, TRIGGER_ROWS do
|
||||
local row = CreateFrame("Button", nil, triggerList)
|
||||
row:SetSize(272, TRIGGER_ROW_H)
|
||||
row:SetPoint("TOPLEFT", triggerList, "TOPLEFT", 5, -3 - (i - 1) * TRIGGER_STRIDE)
|
||||
|
||||
-- one-time setup of a pooled trigger row
|
||||
local function SetupTriggerRow(row)
|
||||
row.highlight = row:CreateTexture(nil, "BACKGROUND")
|
||||
row.highlight:SetAllPoints(row)
|
||||
row.highlight:SetTexture(.3, .3, .3, .4)
|
||||
@@ -1792,10 +1710,39 @@ pfUI:RegisterModule("equipmentmanager", function()
|
||||
GameTooltip:Show()
|
||||
end)
|
||||
row:SetScript("OnLeave", function() GameTooltip:Hide() end)
|
||||
|
||||
triggerRows[i] = row
|
||||
end
|
||||
|
||||
local function InitTriggerRow(row, entry)
|
||||
if not row.check then SetupTriggerRow(row) end
|
||||
|
||||
local t, index = entry.trigger, entry.index
|
||||
row.trigger = t
|
||||
row.index = index
|
||||
row.check:SetChecked(t.enabled)
|
||||
|
||||
local color = "|cffffffff"
|
||||
if not t.enabled then
|
||||
color = "|cff808080"
|
||||
elseif not SetExists(t.setID) then
|
||||
color = "|cffff5555"
|
||||
elseif db.applied == t.id then
|
||||
color = "|cff33ff33"
|
||||
elseif ConditionActive(t) then
|
||||
color = "|cffffd100"
|
||||
end
|
||||
local target = SetExists(t.setID) and SetName(t.setID) or T["No set selected"]
|
||||
row.text:SetText(color .. DescribeTrigger(t) .. "|r |cffaaaaaa>|r " .. color .. target .. "|r")
|
||||
|
||||
row.highlight:SetShown(t.id == selectedTriggerID)
|
||||
row.up:SetEnabled(index > 1)
|
||||
row.down:SetEnabled(index < table.getn(db.triggers))
|
||||
end
|
||||
|
||||
local triggerView = CreateScrollBoxListLinearView(0, 0, 0, 2, 2)
|
||||
triggerView:SetElementExtent(TRIGGER_ROW_H)
|
||||
triggerView:SetElementInitializer("Button", InitTriggerRow)
|
||||
ScrollUtil.InitScrollBoxListWithScrollBar(triggerList.ScrollBox, triggerList.ScrollBar, triggerView)
|
||||
|
||||
local btnNewTrigger = CreateFrame("Button", nil, triggerPanel, "UIPanelButtonTemplate")
|
||||
btnNewTrigger:SetSize(110, 22)
|
||||
btnNewTrigger:SetPoint("TOPLEFT", triggerList, "BOTTOMLEFT", 0, -6)
|
||||
@@ -1813,10 +1760,10 @@ pfUI:RegisterModule("equipmentmanager", function()
|
||||
db.nextID = db.nextID + 1
|
||||
table.insert(db.triggers, t)
|
||||
selectedTriggerID = t.id
|
||||
-- Scroll so the new trigger is visible.
|
||||
triggerPanel.offset = math.max(0, table.getn(db.triggers) - TRIGGER_ROWS)
|
||||
UpdateEngine()
|
||||
RefreshTriggerPanel()
|
||||
-- the new trigger is the last row
|
||||
triggerList.ScrollBox:ScrollToEnd()
|
||||
end)
|
||||
|
||||
-- Editor for the selected trigger
|
||||
@@ -2016,43 +1963,12 @@ pfUI:RegisterModule("equipmentmanager", function()
|
||||
local function RefreshTriggerRows()
|
||||
cbAuto:SetChecked(C.equipmentmanager.autoswitch == "1")
|
||||
|
||||
local num = table.getn(db.triggers)
|
||||
local maxOffset = math.max(0, num - TRIGGER_ROWS)
|
||||
if triggerPanel.offset > maxOffset then triggerPanel.offset = maxOffset end
|
||||
if triggerPanel.offset < 0 then triggerPanel.offset = 0 end
|
||||
|
||||
for i, row in ipairs(triggerRows) do
|
||||
local index = i + triggerPanel.offset
|
||||
local t = db.triggers[index]
|
||||
if t then
|
||||
row.trigger = t
|
||||
row.index = index
|
||||
row.check:SetChecked(t.enabled)
|
||||
|
||||
local color = "|cffffffff"
|
||||
if not t.enabled then
|
||||
color = "|cff808080"
|
||||
elseif not SetExists(t.setID) then
|
||||
color = "|cffff5555"
|
||||
elseif db.applied == t.id then
|
||||
color = "|cff33ff33"
|
||||
elseif ConditionActive(t) then
|
||||
color = "|cffffd100"
|
||||
end
|
||||
local target = SetExists(t.setID) and SetName(t.setID) or T["No set selected"]
|
||||
row.text:SetText(color .. DescribeTrigger(t) .. "|r |cffaaaaaa>|r " .. color .. target .. "|r")
|
||||
|
||||
if t.id == selectedTriggerID then row.highlight:Show() else row.highlight:Hide() end
|
||||
if index > 1 then row.up:Enable() else row.up:Disable() end
|
||||
if index < num then row.down:Enable() else row.down:Disable() end
|
||||
row:Show()
|
||||
else
|
||||
row.trigger = nil
|
||||
row.index = nil
|
||||
row:Hide()
|
||||
end
|
||||
local entries = {}
|
||||
for index, t in ipairs(db.triggers) do
|
||||
table.insert(entries, { trigger = t, index = index })
|
||||
end
|
||||
if num == 0 then triggerList.empty:Show() else triggerList.empty:Hide() end
|
||||
triggerList.ScrollBox:SetDataProvider(CreateDataProvider(entries), ScrollBoxConstants.RetainScrollPosition)
|
||||
triggerList.empty:SetShown(table.getn(entries) == 0)
|
||||
end
|
||||
|
||||
function RefreshTriggerPanel()
|
||||
|
||||
+5
-28
@@ -29,38 +29,15 @@ pfUI:RegisterModule("focus", function ()
|
||||
end)
|
||||
|
||||
-- /focus and /clearfocus live in ClassicAPI's SlashCommandsRegistry now.
|
||||
-- /focusname is pfUI-specific because the engine has no name→GUID
|
||||
-- lookup for off-screen units — we resolve via a short target-swap.
|
||||
-- `/focus Name` takes the nearest prefix match; /focusname tries the exact
|
||||
-- name first, so "Bob" still wins over a nearer "Bobby".
|
||||
|
||||
pfUI.api.RegisterSlashCommand("PFFOCUSNAME", { '/focusname', '/pffocusname' }, function(msg)
|
||||
if msg == "" then return end
|
||||
|
||||
local prevGUID = UnitGUID("target")
|
||||
local prevPlayer = UnitIsUnit("target", "player")
|
||||
|
||||
-- Suppress async "Unknown unit" errors fired by TargetByName misses.
|
||||
UIErrorsFrame:UnregisterEvent("UI_ERROR_MESSAGE")
|
||||
|
||||
-- Try exact match first, then prefix match via /target.
|
||||
TargetByName(msg, true)
|
||||
if not UnitExists("target") then
|
||||
SlashCmdList.TARGET(msg)
|
||||
end
|
||||
|
||||
if UnitExists("target") then
|
||||
FocusUnit("target")
|
||||
end
|
||||
|
||||
RunNextFrame(function()
|
||||
UIErrorsFrame:RegisterEvent("UI_ERROR_MESSAGE")
|
||||
end)
|
||||
|
||||
if prevGUID and prevGUID ~= "0x0000000000000000" then
|
||||
TargetUnit(prevGUID)
|
||||
elseif prevPlayer then
|
||||
TargetUnit("player")
|
||||
else
|
||||
ClearTarget()
|
||||
local unit = UnitTokenFromName(msg, true) or UnitTokenFromName(msg)
|
||||
if unit then
|
||||
FocusUnit(unit)
|
||||
end
|
||||
end, true)
|
||||
|
||||
|
||||
+12
-14
@@ -515,14 +515,15 @@ pfUI:RegisterModule("gui", function ()
|
||||
|
||||
-- are we a frame with contents?
|
||||
if func then
|
||||
f.scroll = CreateScrollFrame(nil, f)
|
||||
f.scroll = CreateFrame("ScrollFrame", nil, f, "pfUIScrollFrameTemplate")
|
||||
SetAllPointsOffset(f.scroll, f, 2)
|
||||
f.scroll.content = CreateScrollChild(nil, f.scroll)
|
||||
f.scroll.content = f.scroll.Content
|
||||
f.scroll.content.parent = f.scroll
|
||||
f.scroll.content:SetScript("OnShow", function()
|
||||
if not this.setup then
|
||||
func()
|
||||
this.setup = true
|
||||
this.parent:UpdateScrollChildRect()
|
||||
end
|
||||
end)
|
||||
end
|
||||
@@ -774,7 +775,10 @@ pfUI:RegisterModule("gui", function ()
|
||||
end
|
||||
end
|
||||
|
||||
if strlen(this:GetText()) < 1 then return end
|
||||
if strlen(this:GetText()) < 1 then
|
||||
parent:UpdateScrollChildRect()
|
||||
return
|
||||
end
|
||||
|
||||
local i = 1
|
||||
local search = strlower(this:GetText())
|
||||
@@ -798,16 +802,9 @@ pfUI:RegisterModule("gui", function ()
|
||||
end
|
||||
end
|
||||
|
||||
-- reload scroll frames
|
||||
scroll:Hide()
|
||||
scroll:SetHeight(i * 25 )
|
||||
scroll:Show()
|
||||
parent:SetScrollChild(scroll)
|
||||
QueueFunction(function()
|
||||
parent:SetVerticalScroll(0)
|
||||
parent:UpdateScrollState()
|
||||
parent:Scroll()
|
||||
end)
|
||||
-- measure the new results and start at the top
|
||||
parent:UpdateScrollChildRect()
|
||||
parent:SetVerticalScroll(0)
|
||||
end)
|
||||
|
||||
pfUI.gui.search:SetScript("OnEditFocusGained", function(self)
|
||||
@@ -2459,7 +2456,6 @@ pfUI:RegisterModule("gui", function ()
|
||||
CreateConfig(nil, T["Hide Chat When Bags Are Opened"], C.appearance.bags, "hidechat", "checkbox")
|
||||
CreateConfig(nil, T["Bagslots Per Row"], C.appearance.bags, "bagrowlength")
|
||||
CreateConfig(nil, T["Bankslots Per Row"], C.appearance.bags, "bankrowlength")
|
||||
CreateConfig(nil, T["Enable Full-Text Search"], C.appearance.bags, "fulltext")
|
||||
CreateConfig(nil, T["Item Slot Size"], C.appearance.bags, "icon_size")
|
||||
CreateConfig(Reload, T["Reverse Cooldown Animation"], C.appearance.bags, "cooldown_reverse", "checkbox")
|
||||
CreateConfig(nil, T["Auto Sell Grey Items"], C.global, "autosell", "checkbox")
|
||||
@@ -2896,6 +2892,8 @@ pfUI:RegisterModule("gui", function ()
|
||||
CreateConfig(nil, T["Timestamp Format"], C.chat.text, "timeformat", nil, nil, nil, nil, "STRING")
|
||||
CreateConfig(nil, T["Timestamp Brackets"], C.chat.text, "timebracket", nil, nil, nil, nil, "STRING")
|
||||
CreateConfig(nil, T["Timestamp Color"], C.chat.text, "timecolor", "color")
|
||||
-- read each time chat copy opens, so no reload
|
||||
CreateConfig(function() end, T["Show Timestamps In Chat Copy"], C.chat.text, "copytime", "checkbox")
|
||||
CreateConfig(nil, T["Hide Channel Names"], C.chat.text, "channelnumonly", "checkbox")
|
||||
CreateConfig(nil, T["Generate Playerlinks"], C.chat.text, "playerlinks", "checkbox")
|
||||
CreateConfig(nil, T["Enable URL Detection"], C.chat.text, "detecturl", "checkbox")
|
||||
|
||||
+61
-88
@@ -1,9 +1,9 @@
|
||||
pfUI:RegisterModule("loothistory", function ()
|
||||
local rawborder, border = GetBorderSize()
|
||||
|
||||
-- Layout
|
||||
local ITEM_H, PLAYER_H = 24, 18
|
||||
local ITEM_W, PLAYER_W = 350, 330
|
||||
-- Layout (rows are 2px apart)
|
||||
local ITEM_H, PLAYER_H = 24, 16
|
||||
local PLAYER_INDENT = 18
|
||||
|
||||
-- rollType constants returned by C_LootHistory.GetPlayerInfo (0/1/2; vanilla
|
||||
-- has no disenchant roll).
|
||||
@@ -86,30 +86,24 @@ pfUI:RegisterModule("loothistory", function ()
|
||||
pfUI.loothistory.clear:SetText(T["Clear"])
|
||||
pfUI.loothistory.clear:SetScript("OnClick", function() C_LootHistory.Clear() end)
|
||||
|
||||
-- scroll frame
|
||||
pfUI.loothistory.scroll = CreateScrollFrame("pfLootHistoryScroll", pfUI.loothistory)
|
||||
pfUI.loothistory.scroll:SetSize(360, 440)
|
||||
pfUI.loothistory.scroll:SetPoint("BOTTOM", 0, 10)
|
||||
|
||||
pfUI.loothistory.scroll.backdrop = CreateFrame("Frame", nil, pfUI.loothistory.scroll)
|
||||
pfUI.loothistory.scroll.backdrop:SetFrameLevel(1)
|
||||
pfUI.loothistory.scroll.backdrop:SetPoint("TOPLEFT", pfUI.loothistory.scroll, "TOPLEFT", -5, 5)
|
||||
pfUI.loothistory.scroll.backdrop:SetPoint("BOTTOMRIGHT", pfUI.loothistory.scroll, "BOTTOMRIGHT", 5, -5)
|
||||
CreateBackdrop(pfUI.loothistory.scroll.backdrop, nil, true)
|
||||
|
||||
local list = CreateScrollChild("pfLootHistoryList", pfUI.loothistory.scroll)
|
||||
-- ==========================================================================
|
||||
-- List: a row per item and, under an expanded item, a row per player
|
||||
-- ==========================================================================
|
||||
local list = CreateFrame("Frame", "pfLootHistoryList", pfUI.loothistory, "pfUIScrollBoxListTemplate")
|
||||
list:SetSize(370, 450)
|
||||
list:SetPoint("BOTTOM", 0, 5)
|
||||
CreateBackdrop(list, nil, true)
|
||||
pfUI.loothistory.list = list
|
||||
|
||||
-- ==========================================================================
|
||||
-- Frame pools
|
||||
-- ==========================================================================
|
||||
local itemFrames = {}
|
||||
|
||||
local FullUpdate -- forward declaration (toggle handlers call it)
|
||||
|
||||
local function CreateItemFrame()
|
||||
local f = CreateFrame("Button", nil, list)
|
||||
f:SetSize(ITEM_W, ITEM_H)
|
||||
local function ToggleExpanded(f)
|
||||
local id = f.rollID
|
||||
if id then expanded[id] = not expanded[id]; FullUpdate() end
|
||||
end
|
||||
|
||||
-- one-time setup of a pooled item row
|
||||
local function SetupItemRow(f)
|
||||
f:SetBackdrop(pfUI.backdrop_hover)
|
||||
f:SetBackdropBorderColor(1, 1, 1, .04)
|
||||
f:EnableMouse(1)
|
||||
@@ -118,10 +112,7 @@ pfUI:RegisterModule("loothistory", function ()
|
||||
f.toggle = CreateFrame("Button", nil, f)
|
||||
f.toggle:SetSize(14, 14)
|
||||
f.toggle:SetPoint("LEFT", 4, 0)
|
||||
f.toggle:SetScript("OnClick", function()
|
||||
local id = f.rollID
|
||||
if id then expanded[id] = not expanded[id]; FullUpdate() end
|
||||
end)
|
||||
f.toggle:SetScript("OnClick", function() ToggleExpanded(f) end)
|
||||
|
||||
-- icon + quality-colored border
|
||||
f.iconbg = CreateFrame("Frame", nil, f)
|
||||
@@ -138,18 +129,18 @@ pfUI:RegisterModule("loothistory", function ()
|
||||
f.winicon:SetSize(14, 14)
|
||||
f.winicon:SetPoint("RIGHT", f, "RIGHT", -6, 0)
|
||||
|
||||
f.winroll = f:CreateFontString("Status", "OVERLAY", "GameFontNormal")
|
||||
f.winroll = f:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||
f.winroll:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE")
|
||||
f.winroll:SetPoint("RIGHT", f.winicon, "LEFT", -2, 0)
|
||||
f.winroll:SetTextColor(1, 1, 1, 1)
|
||||
|
||||
f.winname = f:CreateFontString("Status", "OVERLAY", "GameFontNormal")
|
||||
f.winname = f:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||
f.winname:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE")
|
||||
f.winname:SetPoint("RIGHT", f.winroll, "LEFT", -4, 0)
|
||||
f.winname:SetJustifyH("RIGHT")
|
||||
|
||||
-- item name (leaves room on the right for the winner block)
|
||||
f.name = f:CreateFontString("Status", "OVERLAY", "GameFontNormal")
|
||||
f.name = f:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||
f.name:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE")
|
||||
f.name:SetPoint("LEFT", f.iconbg, "RIGHT", 5, 0)
|
||||
f.name:SetPoint("RIGHT", f, "RIGHT", -100, 0)
|
||||
@@ -167,20 +158,13 @@ pfUI:RegisterModule("loothistory", function ()
|
||||
this:SetBackdropBorderColor(1, 1, 1, .04)
|
||||
GameTooltip:Hide()
|
||||
end)
|
||||
f:SetScript("OnClick", function()
|
||||
local id = this.rollID
|
||||
if id then expanded[id] = not expanded[id]; FullUpdate() end
|
||||
end)
|
||||
|
||||
return f
|
||||
f:SetScript("OnClick", function() ToggleExpanded(f) end)
|
||||
end
|
||||
|
||||
local function CreatePlayerFrame()
|
||||
local f = CreateFrame("Frame", nil, list)
|
||||
f:SetSize(PLAYER_W, PLAYER_H)
|
||||
|
||||
-- one-time setup of a pooled player row
|
||||
local function SetupPlayerRow(f)
|
||||
-- name is indented to leave room for the winner checkmark on its left
|
||||
f.name = f:CreateFontString("Status", "OVERLAY", "GameFontNormal")
|
||||
f.name = f:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||
f.name:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE")
|
||||
f.name:SetPoint("LEFT", 20, 0)
|
||||
f.name:SetJustifyH("LEFT")
|
||||
@@ -189,7 +173,7 @@ pfUI:RegisterModule("loothistory", function ()
|
||||
f.rollicon:SetSize(16, 16)
|
||||
f.rollicon:SetPoint("RIGHT", -4, 0)
|
||||
|
||||
f.rolltext = f:CreateFontString("Status", "OVERLAY", "GameFontNormal")
|
||||
f.rolltext = f:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||
f.rolltext:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE")
|
||||
f.rolltext:SetPoint("RIGHT", f.rollicon, "LEFT", -3, 0)
|
||||
f.rolltext:SetTextColor(1, 1, 1, 1)
|
||||
@@ -199,15 +183,8 @@ pfUI:RegisterModule("loothistory", function ()
|
||||
f.winmark:SetSize(16, 16)
|
||||
f.winmark:SetTexture(WINMARK)
|
||||
f.winmark:SetPoint("RIGHT", f.name, "LEFT", -1, 0)
|
||||
|
||||
return f
|
||||
end
|
||||
|
||||
local playerPool = CreateObjectPool(CreatePlayerFrame, function(_, pf)
|
||||
pf:Hide()
|
||||
pf:ClearAllPoints()
|
||||
end)
|
||||
|
||||
local function SetToggleTexture(toggle, isExpanded)
|
||||
if isExpanded then
|
||||
toggle:SetNormalTexture("Interface\\Buttons\\UI-MinusButton-Up")
|
||||
@@ -221,13 +198,13 @@ pfUI:RegisterModule("loothistory", function ()
|
||||
-- ==========================================================================
|
||||
-- Rendering
|
||||
-- ==========================================================================
|
||||
local function UpdateItemFrame(f, i)
|
||||
local rollID, itemLink, numPlayers, isDone, winnerIdx = C_LootHistory.GetItem(i)
|
||||
local function InitItemRow(f, row)
|
||||
if not f.toggle then SetupItemRow(f) end
|
||||
|
||||
local i = row.item
|
||||
local rollID, itemLink, _, isDone, winnerIdx = C_LootHistory.GetItem(i)
|
||||
f.rollID = rollID
|
||||
f.itemIdx = i
|
||||
f.itemLink = itemLink
|
||||
f.numPlayers = numPlayers or 0
|
||||
f.isDone = isDone
|
||||
|
||||
local isExpanded = rollID and expanded[rollID]
|
||||
SetToggleTexture(f.toggle, isExpanded)
|
||||
@@ -279,7 +256,10 @@ pfUI:RegisterModule("loothistory", function ()
|
||||
end
|
||||
end
|
||||
|
||||
local function RenderPlayerFrame(pf, name, class, rollType, roll, isWinner)
|
||||
local function InitPlayerRow(pf, row)
|
||||
if not pf.name then SetupPlayerRow(pf) end
|
||||
|
||||
local name, class, rollType, roll, isWinner = C_LootHistory.GetPlayerInfo(row.item, row.player)
|
||||
pf.name:SetText(name or UNKNOWN)
|
||||
pf.name:SetTextColor(PFUI_CLASS_COLORS[class]:GetRGB())
|
||||
|
||||
@@ -289,6 +269,22 @@ pfUI:RegisterModule("loothistory", function ()
|
||||
if isWinner then pf.winmark:Show() else pf.winmark:Hide() end
|
||||
end
|
||||
|
||||
local view = CreateScrollBoxListLinearView(2, 2, 4, 4, 2)
|
||||
view:SetElementFactory(function(factory, row)
|
||||
if row.player then
|
||||
factory("Frame", InitPlayerRow)
|
||||
else
|
||||
factory("Button", InitItemRow)
|
||||
end
|
||||
end)
|
||||
view:SetElementExtentCalculator(function(_, row)
|
||||
return row.player and PLAYER_H or ITEM_H
|
||||
end)
|
||||
view:SetElementIndentCalculator(function(row)
|
||||
return row.player and PLAYER_INDENT or 0
|
||||
end)
|
||||
ScrollUtil.InitScrollBoxListWithScrollBar(list.ScrollBox, list.ScrollBar, view)
|
||||
|
||||
-- A player row is worth showing while the roll is undecided (see everyone),
|
||||
-- or afterwards only if they actually rolled or it's you (hide the passers'
|
||||
-- noise on a decided roll) — mirrors Blizzard's ShouldDisplayPlayer.
|
||||
@@ -298,46 +294,23 @@ pfUI:RegisterModule("loothistory", function ()
|
||||
|
||||
function FullUpdate()
|
||||
if not pfUI.loothistory:IsShown() then return end
|
||||
playerPool:ReleaseAll()
|
||||
|
||||
local num = C_LootHistory.GetNumItems()
|
||||
local y = -2
|
||||
local rows = {}
|
||||
for i = 1, C_LootHistory.GetNumItems() do
|
||||
local rollID, _, numPlayers, isDone = C_LootHistory.GetItem(i)
|
||||
table.insert(rows, { item = i })
|
||||
|
||||
for i = 1, num do
|
||||
local f = itemFrames[i] or CreateItemFrame()
|
||||
itemFrames[i] = f
|
||||
UpdateItemFrame(f, i)
|
||||
f:ClearAllPoints()
|
||||
f:SetPoint("TOPLEFT", list, "TOPLEFT", 4, y)
|
||||
f:Show()
|
||||
y = y - ITEM_H - 2
|
||||
|
||||
if f.rollID and expanded[f.rollID] then
|
||||
for p = 1, f.numPlayers do
|
||||
local name, class, rollType, roll, isWinner, isMe = C_LootHistory.GetPlayerInfo(i, p)
|
||||
if ShouldDisplayPlayer(f.isDone, roll, isMe) then
|
||||
local pf = playerPool:Acquire()
|
||||
RenderPlayerFrame(pf, name, class, rollType, roll, isWinner)
|
||||
pf:ClearAllPoints()
|
||||
pf:SetPoint("TOPLEFT", list, "TOPLEFT", 22, y)
|
||||
pf:Show()
|
||||
y = y - PLAYER_H
|
||||
if rollID and expanded[rollID] then
|
||||
for p = 1, numPlayers or 0 do
|
||||
local _, _, _, roll, _, isMe = C_LootHistory.GetPlayerInfo(i, p)
|
||||
if ShouldDisplayPlayer(isDone, roll, isMe) then
|
||||
table.insert(rows, { item = i, player = p })
|
||||
end
|
||||
end
|
||||
y = y - 2
|
||||
end
|
||||
end
|
||||
|
||||
for i = num + 1, table.getn(itemFrames) do
|
||||
itemFrames[i]:Hide()
|
||||
end
|
||||
|
||||
-- Resize the scroll child and re-attach it: SetHeight alone on a
|
||||
-- SetAllPoints'd child doesn't make the ScrollFrame recompute its scroll
|
||||
-- range, so a dynamically-grown list wouldn't scroll until a /reload.
|
||||
list:SetHeight(math.max(1, -y + 2))
|
||||
pfUI.loothistory.scroll:SetScrollChild(list)
|
||||
pfUI.loothistory.scroll:UpdateScrollState()
|
||||
list.ScrollBox:SetDataProvider(CreateDataProvider(rows), ScrollBoxConstants.RetainScrollPosition)
|
||||
end
|
||||
|
||||
pfUI.loothistory:SetScript("OnShow", function() FullUpdate() end)
|
||||
|
||||
+53
-3
@@ -105,11 +105,12 @@ pfUI:RegisterModule("panel", function()
|
||||
|
||||
do -- FPS & Lag
|
||||
local widget = CreateFrame("Frame", "pfPanelWidgetLag", UIParent)
|
||||
local lag, fps, laghex, fpshex, _
|
||||
widget.Tooltip = function()
|
||||
local lag, fps, laghex, fpshex, owner, _
|
||||
widget.Tooltip = function(self)
|
||||
owner = self
|
||||
local active = 0
|
||||
GameTooltip:ClearLines()
|
||||
GameTooltip_SetDefaultAnchor(GameTooltip, this)
|
||||
GameTooltip_SetDefaultAnchor(GameTooltip, self)
|
||||
GameTooltip:AddLine("|cff555555" .. T["Systeminfo"])
|
||||
for i=1, GetNumAddOns() do
|
||||
if IsAddOnLoaded(i) then
|
||||
@@ -128,6 +129,51 @@ pfUI:RegisterModule("panel", function()
|
||||
GameTooltip:AddLine(" ")
|
||||
GameTooltip:AddDoubleLine(T["Memory Usage"], "|cffffffff" .. memmb)
|
||||
GameTooltip:AddDoubleLine(T["Next Memory Cleanup"], "|cffffffff" .. gcmb)
|
||||
-- AddOn memory usage (see MainMenuBarPerformanceBarFrame_OnEnter in MainMenuBar.lua)
|
||||
|
||||
local ADDON_MEM_KB_ABBR = _G.ADDON_MEM_KB_ABBR or "(%.0f KB) %s";
|
||||
local ADDON_MEM_MB_ABBR = _G.ADDON_MEM_MB_ABBR or "(%.2f MB) %s";
|
||||
local TOTAL_MEM_KB_ABBR = _G.TOTAL_MEM_KB_ABBR or "AddOn Memory: %.0f KB";
|
||||
local TOTAL_MEM_MB_ABBR = _G.TOTAL_MEM_MB_ABBR or "AddOn Memory: %.2f MB";
|
||||
|
||||
|
||||
UpdateAddOnMemoryUsage()
|
||||
local totalMem = 0
|
||||
local topAddOns = {}
|
||||
for i = 1, GetNumAddOns() do
|
||||
local mem = GetAddOnMemoryUsage(i)
|
||||
if mem and mem > 0 then
|
||||
totalMem = totalMem + mem
|
||||
for j = 1, 3 do
|
||||
if not topAddOns[j] or mem > topAddOns[j].value then
|
||||
for k = 3, j + 1, -1 do
|
||||
topAddOns[k] = topAddOns[k - 1]
|
||||
end
|
||||
topAddOns[j] = { value = mem, name = C_AddOns.GetAddOnName(i) }
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if totalMem > 0 then
|
||||
local str
|
||||
if totalMem > 1000 then
|
||||
str = format(TOTAL_MEM_MB_ABBR, totalMem / 1000)
|
||||
else
|
||||
str = format(TOTAL_MEM_KB_ABBR, totalMem)
|
||||
end
|
||||
GameTooltip:AddLine(" ")
|
||||
GameTooltip:AddLine(str, 1, 1, 1)
|
||||
for i = 1, 3 do
|
||||
if not topAddOns[i] then break end
|
||||
if topAddOns[i].value > 1000 then
|
||||
str = format(ADDON_MEM_MB_ABBR, topAddOns[i].value / 1000, topAddOns[i].name)
|
||||
else
|
||||
str = format(ADDON_MEM_KB_ABBR, topAddOns[i].value, topAddOns[i].name)
|
||||
end
|
||||
GameTooltip:AddLine(str, 1, 1, 1)
|
||||
end
|
||||
end
|
||||
GameTooltip:AddLine(" ")
|
||||
GameTooltip:AddDoubleLine(T["Network Down"], "|cffffffff" .. round(nin,1) .. "KB/s")
|
||||
GameTooltip:AddDoubleLine(T["Network Up"], "|cffffffff" .. round(nout,1) .. "KB/s")
|
||||
@@ -157,6 +203,10 @@ pfUI:RegisterModule("panel", function()
|
||||
end
|
||||
|
||||
pfUI.panel:OutputPanel("fps", fps .. " " .. T["fps"] .. " & " .. lag .. " " .. T["ms"], widget.Tooltip, widget.Click)
|
||||
|
||||
if owner and GameTooltip:IsOwned(owner) then
|
||||
widget.Tooltip(owner)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
+17
-33
@@ -205,36 +205,23 @@ pfUI:RegisterModule("share", function ()
|
||||
table.insert(UISpecialFrames, "pfShare")
|
||||
|
||||
do -- Edit Box
|
||||
f.scroll = pfUI.api.CreateScrollFrame("pfShareScroll", f)
|
||||
f.scroll = CreateFrame("Frame", "pfShareScroll", f, "pfUIScrollingEditBoxTemplate")
|
||||
f.scroll:SetPoint("TOPLEFT", f, "TOPLEFT", 10, -30)
|
||||
f.scroll:SetPoint("BOTTOMRIGHT", f, "BOTTOMRIGHT", -10, 50)
|
||||
f.scroll:SetWidth(560)
|
||||
f.scroll:SetHeight(400)
|
||||
f.scroll:SetFont(pfUI.media["font:RobotoMono.ttf"], 9)
|
||||
f.scroll:SetTextInsets(15,15,15,15)
|
||||
|
||||
f.scroll.backdrop = CreateFrame("Frame", "pfShareScrollBackdrop", f.scroll)
|
||||
f.scroll.backdrop:SetFrameLevel(1)
|
||||
-- the ScrollBox clips its children, so the backdrop is a sibling
|
||||
f.scroll.backdrop = CreateFrame("Frame", "pfShareScrollBackdrop", f)
|
||||
f.scroll.backdrop:SetPoint("TOPLEFT", f.scroll, "TOPLEFT", -5, 5)
|
||||
f.scroll.backdrop:SetPoint("BOTTOMRIGHT", f.scroll, "BOTTOMRIGHT", 5, -5)
|
||||
pfUI.api.CreateBackdrop(f.scroll.backdrop, nil, true)
|
||||
f.scroll.backdrop.tint = f.scroll.backdrop:CreateTexture(nil, "ARTWORK")
|
||||
f.scroll.backdrop.tint:SetAllPoints(f.scroll)
|
||||
f.scroll.backdrop.tint:SetTexture(1,1,1,.05)
|
||||
|
||||
f.scroll.text = CreateFrame("EditBox", "pfShareEditBox", f.scroll)
|
||||
f.scroll.text.bg = f.scroll.text:CreateTexture(nil, "OVERLAY")
|
||||
f.scroll.text.bg:SetAllPoints(f.scroll.text)
|
||||
f.scroll.text.bg:SetTexture(1,1,1,.05)
|
||||
f.scroll.text:SetMultiLine(true)
|
||||
f.scroll.text:SetWidth(560)
|
||||
f.scroll.text:SetHeight(400)
|
||||
f.scroll.text:SetAllPoints(f.scroll)
|
||||
f.scroll.text:SetTextInsets(15,15,15,15)
|
||||
f.scroll.text:SetFont(pfUI.media["font:RobotoMono.ttf"], 9)
|
||||
f.scroll.text:SetAutoFocus(false)
|
||||
f.scroll.text:SetJustifyH("LEFT")
|
||||
f.scroll.text:SetScript("OnEscapePressed", function() this:ClearFocus() end)
|
||||
f.scroll.text:SetScript("OnTextChanged", function()
|
||||
this:GetParent():UpdateScrollChildRect()
|
||||
this:GetParent():UpdateScrollState()
|
||||
|
||||
local text = this:GetText()
|
||||
f.scroll:RegisterCallback("OnTextChanged", function()
|
||||
local text = f.scroll:GetText()
|
||||
local blob = Decode(text)
|
||||
local json = not blob and DecodeJSON(text) or nil
|
||||
local legacy = not blob and not json and DecodeLegacy(text) or nil
|
||||
@@ -253,27 +240,26 @@ pfUI:RegisterModule("share", function ()
|
||||
f.readButton:Enable()
|
||||
f.readButton.text:SetText(T["Decode"])
|
||||
f.readButton.func = function()
|
||||
local current = f.scroll.text:GetText()
|
||||
local current = f.scroll:GetText()
|
||||
local config = Decode(current) or DecodeLegacy(current)
|
||||
if config then
|
||||
f.scroll.text:SetText(C_EncodingUtil.SerializeJSON(config))
|
||||
f.scroll:SetText(C_EncodingUtil.SerializeJSON(config))
|
||||
end
|
||||
end
|
||||
elseif json then
|
||||
f.readButton:Enable()
|
||||
f.readButton.text:SetText(T["Encode"])
|
||||
f.readButton.func = function()
|
||||
local config = DecodeJSON(f.scroll.text:GetText())
|
||||
local config = DecodeJSON(f.scroll:GetText())
|
||||
if config then
|
||||
f.scroll.text:SetText(Encode(config))
|
||||
f.scroll:SetText(Encode(config))
|
||||
end
|
||||
end
|
||||
else
|
||||
f.readButton:Disable()
|
||||
f.readButton.text:SetText(T["N/A"])
|
||||
end
|
||||
end)
|
||||
f.scroll:SetScrollChild(f.scroll.text)
|
||||
end, f)
|
||||
end
|
||||
|
||||
do -- button: close
|
||||
@@ -322,7 +308,7 @@ pfUI:RegisterModule("share", function ()
|
||||
f.loadButton.text:SetFont(pfUI.font_default, pfUI_config.global.font_size, "OUTLINE")
|
||||
f.loadButton.text:SetText(T["Import"])
|
||||
f.loadButton:SetScript("OnClick", function()
|
||||
local text = f.scroll.text:GetText()
|
||||
local text = f.scroll:GetText()
|
||||
local config = Decode(text) or DecodeJSON(text) or DecodeLegacy(text)
|
||||
if not config then return end
|
||||
|
||||
@@ -383,9 +369,7 @@ pfUI:RegisterModule("share", function ()
|
||||
ignored["disabled"] = f.ignorePosition:GetChecked()
|
||||
|
||||
local encoded = Encode(DiffConfig(myconfig, defconfig, ignored) or {})
|
||||
f.scroll.text:SetText(encoded)
|
||||
f.scroll.text.value = encoded
|
||||
f.scroll:SetVerticalScroll(0)
|
||||
f.scroll:SetText(encoded)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
@@ -1172,21 +1172,9 @@ pfUI:RegisterModule("thirdparty-vanilla", function()
|
||||
end)
|
||||
|
||||
local EnableHealComm = function()
|
||||
-- hook healcomm's addon message to parse single-player events
|
||||
-- HealComm-1.0 already broadcasts this player's casts: keep libpredict
|
||||
-- tracking them, but stop it sending a second copy
|
||||
if AceLibrary and AceLibrary:HasInstance("HealComm-1.0") and pfUI.api.libpredict then
|
||||
local HealComm = AceLibrary("HealComm-1.0")
|
||||
|
||||
-- use pfUI frames to draw healComm predictions
|
||||
local pfHookHealCommSendAddonMessage = HealComm.SendAddonMessage
|
||||
function HealComm.SendAddonMessage(this, msg)
|
||||
if not IsInGroup() then
|
||||
libpredict:ParseChatMessage(UnitName("player"), msg, "HealComm")
|
||||
end
|
||||
pfHookHealCommSendAddonMessage(this, msg)
|
||||
end
|
||||
|
||||
-- disable pfUI predictions
|
||||
pfUI.api.libpredict.sender:UnregisterAllEvents()
|
||||
pfUI.api.libpredict.sender.enabled = nil
|
||||
end
|
||||
end
|
||||
|
||||
@@ -497,19 +497,4 @@ function pfUI.SetupCVars()
|
||||
UIParentLoadAddOn("Blizzard_CombatText")
|
||||
end
|
||||
|
||||
if not RunMacroText then
|
||||
local obj = setmetatable({ ["GetText"] = function(self) return self.text end }, {
|
||||
__index = function(tab,key)
|
||||
local value = function() return end
|
||||
rawset(tab,key,value)
|
||||
return value
|
||||
end
|
||||
})
|
||||
|
||||
function RunMacroText(text)
|
||||
obj.text = text
|
||||
ChatEdit_ParseText(obj, 1)
|
||||
end
|
||||
end
|
||||
|
||||
_G.PLAYER_BUFF_START_ID = -1
|
||||
|
||||
@@ -279,6 +279,36 @@ pfUI:RegisterSkin("Character", function ()
|
||||
SkinCheckbox(ReputationDetailInactiveCheckBox)
|
||||
SkinCheckbox(ReputationDetailMainScreenCheckBox)
|
||||
|
||||
-- Expand or collapse every header at once, as the Skills tab's button
|
||||
-- does. It shows "+" while any header is collapsed.
|
||||
local collapseAll = CreateFrame("Button", "pfReputationCollapseAllButton", ReputationFrame, "ReputationHeaderTemplate")
|
||||
collapseAll:SetText(ALL)
|
||||
collapseAll:SetWidth(collapseAll:GetTextWidth() + 20)
|
||||
-- on the "Faction" label's row, in the headers' +/- column
|
||||
collapseAll:SetPoint("LEFT", ReputationFrameFactionLabel, "LEFT", -43, 0)
|
||||
collapseAll:SetScript("OnClick", function()
|
||||
if this.isCollapsed then
|
||||
ExpandAllFactionHeaders()
|
||||
else
|
||||
CollapseAllFactionHeaders()
|
||||
end
|
||||
end)
|
||||
SkinCollapseButton(collapseAll, true)
|
||||
|
||||
-- GetFactionInfo, not C_Reputation.GetFactionDataByIndex: the latter
|
||||
-- returns nil for the Other and Inactive headers.
|
||||
hooksecurefunc("ReputationFrame_Update", function()
|
||||
collapseAll.isCollapsed = nil
|
||||
for i = 1, GetNumFactions() do
|
||||
local _, _, _, _, _, _, _, _, isHeader, isCollapsed = GetFactionInfo(i)
|
||||
if isHeader and isCollapsed then
|
||||
collapseAll.isCollapsed = true
|
||||
break
|
||||
end
|
||||
end
|
||||
collapseAll:SetNormalTexture(collapseAll.isCollapsed and "Interface\\Buttons\\UI-PlusButton-Up" or "Interface\\Buttons\\UI-MinusButton-Up")
|
||||
end)
|
||||
|
||||
-- Append "(N)" to each standing label where N is rep remaining to the
|
||||
-- next reaction. Skip exalted (reaction 8) and effectively-capped bars.
|
||||
-- Each bar's OnLeave handler (Blizzard's ReputationFrame.xml) restores
|
||||
|
||||
Reference in New Issue
Block a user