3 local TourGuide
= TourGuide
4 local OptionHouse
= DongleStub("OptionHouse-1.0")
5 local ww
= WidgetWarlock
8 local f
= CreateFrame("Button", nil, UIParent
)
9 f
:SetPoint("BOTTOMRIGHT", QuestWatchFrame
, "TOPRIGHT", 0, 10)
12 f
:RegisterForDrag("LeftButton")
13 f
:RegisterForClicks("anyUp")
15 f
:SetClampedToScreen(true)
16 f
:SetBackdrop(ww
.TooltipBorderBG
)
17 f
:SetBackdropColor(0,0,0,0.3)
18 f
:SetBackdropBorderColor(0,0,0,0.7)
20 local check
= ww
.SummonCheckBox(20, f
, "LEFT", 8, 0)
21 local icon
= ww
.SummonTexture(f
, 24, 24, nil, "LEFT", check
, "RIGHT", 4, 0)
22 local text
= ww
.SummonFontString(f
, nil, nil, "GameFontNormal", nil, "RIGHT", -12, 0)
23 text
:SetPoint("LEFT", icon
, "RIGHT", 4, 0)
25 local f2
= CreateFrame("Frame", nil, UIParent
)
28 local text2
= ww
.SummonFontString(f2
, nil, nil, "GameFontNormal", nil, "RIGHT", -12, 0)
29 local icon2
= ww
.SummonTexture(f2
, 24, 24, nil, "RIGHT", text2
, "LEFT", -4, 0)
30 local check2
= ww
.SummonCheckBox(20, f2
, "RIGHT", icon2
, "LEFT", -4, 0)
31 check2
:SetChecked(true)
35 local elapsed
, oldsize
, newsize
36 f2
:SetScript("OnUpdate", function(self
, el
)
37 elapsed
= elapsed
+ el
44 self
:SetPoint("RIGHT", f
, "RIGHT", 0, elapsed
*40)
45 self
:SetAlpha(1 - elapsed
)
46 text
:SetAlpha(elapsed
)
47 icon
:SetAlpha(elapsed
)
48 f
:SetWidth(oldsize
+ (newsize
-oldsize
)*elapsed
)
52 function TourGuide
:SetText(i
)
54 local action
, quest
, note
, logi
, complete
, hasitem
= self
:GetObjectiveInfo(i
)
56 local newtext
= (quest
or"???")..(note
and " [?]" or "")
58 if text
:GetText() ~= newtext
or icon
:GetTexture() ~= self
.icons
[action
] then
59 oldsize
= f
:GetWidth()
63 f2
:SetPoint("RIGHT", f
, "RIGHT", 0, 0)
65 icon2
:SetTexture(icon
:GetTexture())
66 text2
:SetText(text
:GetText())
70 icon
:SetTexture(self
.icons
[action
])
72 check
:SetChecked(false)
73 if i
== 1 then f
:SetWidth(72 + text
:GetWidth()) end
74 newsize
= 72 + text
:GetWidth()
78 function TourGuide
:UpdateStatusFrame()
81 for i
in ipairs(self
.actions
) do
82 local name
= self
.quests
[i
]
83 if not self
.turnedin
[name
] and not nextstep
then
84 local action
, name
, note
, logi
, complete
, hasitem
= self
:GetObjectiveInfo(i
)
87 if action
== "ITEM" then incomplete
= hasitem
88 elseif action
== "TURNIN" then incomplete
= true
89 elseif action
== "COMPLETE" then incomplete
= not complete
90 else incomplete
= not logi
end
91 if incomplete
then nextstep
= i
end
94 if action
== "COMPLETE" and logi
then
97 action
, _
, _
, logi
, complete
= self
:GetObjectiveInfo(j
)
98 if action
== "COMPLETE" and logi
and not complete
then AddQuestWatch(logi
) -- Watch if we're in a 'COMPLETE' block
99 elseif action
== "COMPLETE" and logi
then RemoveQuestWatch(logi
) end -- or unwatch if done
101 until action
~= "COMPLETE"
108 if not nextstep
and self
.nextzones
[self
.db
.char
.currentguide
] then
110 return self
:UpdateStatusFrame()
113 if not nextstep
then return end
115 self
:SetText(nextstep
)
116 self
.current
= nextstep
117 local action
, quest
, note
, logi
, complete
, hasitem
= self
:GetObjectiveInfo(nextstep
)
119 -- TomTom coord mapping
120 if note
and TomTom
then
121 for x
,y
in note
:gmatch("%(([%d.]+),([%d.]+)%)") do
122 TomTom
:AddWaypoint(tonumber(x
), tonumber(y
), quest
)
127 local newtext
= (quest
or"???")..(note
and " [?]" or "")
129 if text
:GetText() ~= newtext
or icon
:GetTexture() ~= self
.icons
[action
] then
130 oldsize
= f
:GetWidth()
134 f2
:SetPoint("RIGHT", f
, "RIGHT", 0, 0)
136 icon2
:SetTexture(icon
:GetTexture())
137 text2
:SetText(text
:GetText())
141 icon
:SetTexture(self
.icons
[action
])
142 text
:SetText(newtext
)
143 check
:SetChecked(false)
144 if not f2
:IsVisible() then f
:SetWidth(72 + text
:GetWidth()) end
145 newsize
= 72 + text
:GetWidth()
151 f
:SetScript("OnClick", function(self
, btn
)
152 if btn
== "RightButton" then
153 OptionHouse
:Open("Tour Guide", "Objectives")
155 local i
= TourGuide
:GetQuestLogIndexByName()
156 if not i
then return end
157 SelectQuestLogEntry(i
)
158 ShowUIPanel(QuestLogFrame
)
163 check
:SetScript("OnClick", function(self
, btn
) TourGuide
:SetTurnedIn() end)
166 f
:SetScript("OnDragStart", function(self
) self
:StartMoving() end)
167 f
:SetScript("OnDragStop", function(self
) self
:StopMovingOrSizing() end)
170 f
:SetScript("OnLeave", function() GameTooltip
:Hide() end)
171 f
:SetScript("OnEnter", function(self
)
172 local tip
= TourGuide
.notes
[TourGuide
.current
]
173 if not tip
then return end
175 GameTooltip
:SetOwner(self
, "ANCHOR_NONE")
176 GameTooltip
:SetPoint("TOPRIGHT", self
, "TOPLEFT")
177 GameTooltip
:SetText(tip
, nil, nil, nil, nil, true)