1 QuestHelper_File
["objtips.lua"] = "Development Version"
3 local real_GameTooltipOnShow
= GameTooltip
:GetScript("OnShow") or QuestHelper
.nop
5 local function addObjectiveObjTip(tooltip
, objective
, depth
)
6 if objective
.watched
or objective
.progress
then
7 if objective
.quest
then
8 tooltip
:AddLine((" "):rep(depth
)..QHFormat("TOOLTIP_QUEST", string.match(objective
.quest
.obj
or "", "^%d*/%d*/(.*)$") or "???"), 1, 1, 1)
13 if objective
.progress
then
14 QuestHelper
:AppendObjectiveProgressToTooltip(objective
, tooltip
, nil, depth
)
16 tooltip
:AddLine((" "):rep(depth
)..QHText("TOOLTIP_WATCHED"), unpack(QuestHelper
:GetColourTheme().tooltip
))
19 -- Calling Show again to cause the tooltip's dimensions to be recalculated.
20 -- Since the frame should already be shown, the OnShow event shouldn't be called again.
24 if objective
.used
then
25 for obj
, text
in pairs(objective
.used
) do
26 tooltip
:AddLine((" "):rep(depth
)..QHFormat(text
, obj
.obj
), 1, 1, 1)
27 addObjectiveObjTip(tooltip
, obj
, depth
+1)
32 local function addObjectiveTip(tooltip
, cat
, obj
)
33 local list
= QuestHelper
.objective_objects
[cat
]
35 local objective
= list
[obj
]
37 addObjectiveObjTip(tooltip
, objective
, 0)
42 GameTooltip
:SetScript("OnShow", function(self
, ...)
44 -- Some other AddOns hook this function, but don't bother to pass the values they were called with.
48 if QuestHelper_Pref
.tooltip
then
49 local monster
, item
= self
:GetUnit(), self
:GetItem()
52 addObjectiveTip(self
, "monster", monster
)
56 addObjectiveTip(self
, "item", item
)
60 return real_GameTooltipOnShow(self
, ...)