View Single Post
Old 12-17-12, 01:28 AM   #11
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 3,977
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()
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote