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 42 lines (32 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
42
local f = CreateFrame("Frame", nil, UIParent)
f:SetHeight(1)
f:SetPoint("TOPRIGHT", QuestWatchFrame, "TOPLEFT", -10, -13)
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, r, g, b)
  current = current + 1
  lines[current]:SetText(text)
  lines[current]:SetTextColor(r or .75, g or .61, b or 0)
  local w = lines[current]:GetStringWidth()
  if f:GetWidth() < w then f:SetWidth(w) end
end
 
 
function Quecho:UpdateTracker()
  current = 0
  for _,fs in ipairs(lines) do fs:SetText() end
  f:SetWidth(0)
 
  for sender,values in pairs(self.quests) do
    if next(values)then
      AddLine(sender)
      for i,v in pairs(values) do AddLine(" - "..i..": "..v, 0.8, 0.8, 0.8) end
    end
  end
end
 
 
local orig = QuestWatchFrame.Hide
local function posthook(frame, ...) frame:SetWidth(1); return ... end
QuestWatchFrame.Hide = function(frame, ...) return posthook(frame, orig(frame, ...)) end
 
if GetNumQuestWatches() == 0 then QuestWatchFrame:SetWidth(1) end