public
Description: WoW Addon - Echos quest objective completion to your party
Homepage: http://www.tekkub.net
Clone URL: git://github.com/tekkub/quecho.git
Click here to lend your support to: quecho and make a donation at www.pledgie.com !
quecho / Tracker.lua
100644 41 lines (30 sloc) 1.175 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
local f = CreateFrame("Frame", nil, UIParent)
f:SetWidth(1) f:SetHeight(1)
local lines = setmetatable({}, {__index = function(t, i)
local fs = f:CreateFontString(nil, nil, "GameFontNormal")
if i == 1 then fs:SetPoint("TOPLEFT") else fs:SetPoint("TOPLEFT", t[i-1], "BOTTOMLEFT") end
rawset(t, i, fs)
return fs
end})
 
 
local current = 0
local function AddLine(text, maxwidth, heightUsed, r, g, b)
current = current + 1
local l = lines[current]
l:SetText(text)
l:SetTextColor(r or .75, g or .61, b or 0)
return math.max(maxwidth, l:GetStringWidth()), heightUsed + l:GetHeight()
end
 
 
WatchFrame_AddObjectiveHandler(function(lineFrame, initialOffset, maxHeight, frameWidth)
local maxWidth = 0
local heightUsed = 0
 
f:SetPoint("TOPLEFT", lineFrame, "TOPLEFT", 0, initialOffset - WATCHFRAME_QUEST_OFFSET)
 
current = 0
for _,fs in ipairs(lines) do fs:SetText() end
 
for sender,values in pairs(Quecho.quests) do
if next(values)then
maxWidth, heightUsed = AddLine(sender, maxWidth, heightUsed)
for i,v in pairs(values) do maxWidth, heightUsed = AddLine(" - "..i..": "..v, maxWidth, heightUsed, 0.8, 0.8, 0.8) end
end
end
 
return heightUsed, maxWidth
end)