3 local TourGuide
= TourGuide
4 local OptionHouse
= DongleStub("OptionHouse-1.0")
5 local ww
= WidgetWarlock
11 local NUMROWS
= math
.floor(305/(ROWHEIGHT
+4))
17 Accepted
= "Accepted",
18 Complete
= "|cffF07902Complete",
19 Finished
= "|cff00ff00Finished",
23 local function OnShow()
24 offset
= TourGuide
.current
- NUMROWS
/2 - 1
25 if offset
< 0 then offset
= 0
26 elseif (offset
+ NUMROWS
) > #TourGuide
.actions
then offset
= #TourGuide
.actions
- NUMROWS
end
27 TourGuide
:UpdateOHPanel()
31 function TourGuide
:CreateOHPanel()
32 local self
= TourGuide
34 local frame
= ww
.SummonOptionHouseBaseFrame()
38 local row
= CreateFrame("Button", nil, frame
)
39 row
:SetPoint("TOPLEFT", i
== 1 and frame
or frame
.rows
[i
-1], i
== 1 and "TOPLEFT" or "BOTTOMLEFT", 0, -ROWOFFSET
)
41 row
:SetHeight(ROWHEIGHT
)
43 local check
= ww
.SummonCheckBox(ROWHEIGHT
, row
, "TOPLEFT", ROWOFFSET
, 0)
44 local icon
= ww
.SummonTexture(row
, ROWHEIGHT
, ROWHEIGHT
, nil, "TOPLEFT", check
, "TOPRIGHT", ROWOFFSET
, 0)
45 local text
= ww
.SummonFontString(row
, nil, nil, "GameFontNormal", nil, "LEFT", icon
, "RIGHT", ROWOFFSET
, 0)
47 check
:SetScript("OnClick", function(f
)
48 self
.turnedin
[text
:GetText()] = f
:GetChecked()
50 self
:UpdateStatusFrame()
60 frame
:EnableMouseWheel()
61 frame
:SetScript("OnMouseWheel", function(f
, val
)
63 if offset
< 0 then offset
= 0
64 elseif (offset
+ NUMROWS
) > #self
.actions
then offset
= #self
.actions
- NUMROWS
end
69 frame
:SetScript("OnShow", OnShow
)
75 function TourGuide
:UpdateOHPanel()
76 if not self
.OHFrame
or not self
.OHFrame
:IsVisible() then return end
77 for i
,row
in ipairs(self
.OHFrame
.rows
) do
78 local action
, name
, note
, logi
, complete
, itemstarted
= self
:GetObjectiveInfo(i
+offset
)
79 local checked
= self
.turnedin
[name
] or (action
== "ACCEPT" and logi
) or (action
== "COMPLETE" and complete
)
81 row
.icon
:SetTexture(self
.icons
[action
])
82 row
.text
:SetText(name
)
83 row
.check
:SetChecked(checked
)
88 local _
, title
= GetAddOnInfo("TourGuide")
89 local author
, version
= GetAddOnMetadata("TourGuide", "Author"), GetAddOnMetadata("TourGuide", "Version")
90 local oh
= OptionHouse
:RegisterAddOn("Tour Guide", title
, author
, version
)
91 oh
:RegisterCategory("Eversong Woods", TourGuide
.CreateOHPanel
)