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 newtext
= self
.quests
[i
]..(self
.notes
[i
] and " [?]" or "")
56 if text
:GetText() ~= newtext
or icon
:GetTexture() ~= self
.icons
[self
.actions
[i]]
then
57 oldsize
= f
:GetWidth()
61 f2
:SetPoint("RIGHT", f
, "RIGHT", 0, 0)
63 icon2
:SetTexture(icon
:GetTexture())
64 text2
:SetText(text
:GetText())
68 icon
:SetTexture(self
.icons
[self
.actions
[i]]
)
70 check
:SetChecked(false)
71 if i
== 1 then f
:SetWidth(72 + text
:GetWidth()) end
72 newsize
= 72 + text
:GetWidth()
76 function TourGuide
:UpdateStatusFrame()
79 for i
in ipairs(self
.actions
) do
80 local name
= self
.quests
[i
]
81 if not self
.turnedin
[name
] and not nextstep
then
82 local action
, name
, note
, logi
, complete
, itemstarted
= self
:GetObjectiveInfo(i
)
83 if not nextstep
and (not logi
or (action
== "TURNIN" or action
== "COMPLETE" and not complete
)) then nextstep
= i
end
85 if action
== "COMPLETE" and logi
and complete
then RemoveQuestWatch(logi
) -- Un-watch if completed quest
86 elseif action
== "COMPLETE" and logi
then
89 action
, _
, _
, logi
, complete
= self
:GetObjectiveInfo(j
)
90 if action
== "COMPLETE" and logi
and not complete
then AddQuestWatch(logi
) -- Watch if we're in a 'COMPLETE' block
91 elseif action
== "COMPLETE" and logi
then RemoveQuestWatch(logi
) end -- or unwatch if done
93 until action
~= "COMPLETE"
101 self
:SetText(nextstep
or 1)
105 f
:SetScript("OnClick", function(self
, btn
)
106 if btn
== "RightButton" then
107 OptionHouse
:Open("Tour Guide", "Eversong Woods")
109 local i
= TourGuide
:GetQuestLogIndexByName()
110 if not i
then return end
111 SelectQuestLogEntry(i
)
112 ShowUIPanel(QuestLogFrame
)
117 check
:SetScript("OnClick", function(self
, btn
)
118 TourGuide
.turnedin
[TourGuide
.quests
[TourGuide
.current]]
= true
119 TourGuide
:UpdateStatusFrame()
120 TourGuide
:UpdateOHPanel()
124 f
:SetScript("OnDragStart", function(self
) self
:StartMoving() end)
125 f
:SetScript("OnDragStop", function(self
) self
:StopMovingOrSizing() end)