View Single Post
12-17-12, 02:28 AM   #11
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Added:
  • in yellow: hints at the bottom of the tooltip that span all 3 cells,
  • in pink: item counts instead of just "No" for not-yet-completed quests, with quests that are ready to turn in no longer highlighted in red,
  • in green: auto-switching back to showing completed quests once all quests have been completed (you might want to use a second variable for this so as not to mess with the saved variable, or just take it out).

Code:
tooltip:AddHeader(TILLERS, ITEMS, COMPLETE)
local line
for i = 1, #npcs do
	local npc = npcs[i]
	if not npc.item then
		npc.item = GetItemInfo(npc.itemID)
	end
	if not IsQuestFlaggedCompleted(npc.questID) then
		-- note "line" is no longer local to this scope!
		local count = GetItemCount(npc.itemID)
		line = tooltip:AddLine(npc.name, npc.item, format("%d/%d", count, 5))
		if count < 5 then
			tooltip:SetLineColor(line, 1, 0.1, 0.1, 0.3)
		end
	elseif not hideComplete then
		line = tooltip:AddLine(npc.name, npc.item, YES)
		tooltip:SetLineColor(line, 0.1, 1, 0.1, 0.3)
	end
end

if not line then
	hideComplete = nil
	self:GetScript("OnLeave")(self)
	return self:GetScript("OnEnter")(self)
end

line = tooltip:AddLine(" ") -- blank line

line = tooltip:AddLine(" ")
tooltip:SetCell(line, 1, NORMAL_FONT_COLOR_CODE .. L.CLICK_SORT, "LEFT", 3)

line = tooltip:AddLine(" ")
tooltip:SetCell(line, 1, NORMAL_FONT_COLOR_CODE .. L.SHIFT_DOWN, "LEFT", 3)

tooltip:SmartAnchorTo(self)
tooltip:Show()
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote