3 local TourGuide
= TourGuide
4 local ww
= WidgetWarlock
9 local NUMROWS
= math
.floor(305/(ROWHEIGHT
+4))
17 local function OnShow(self
)
18 offset
= TourGuide
.current
- NUMROWS
/2 - 1
19 if offset
< 0 then offset
= 0
20 elseif (offset
+ NUMROWS
) > #TourGuide
.actions
then offset
= #TourGuide
.actions
- NUMROWS
end
21 TourGuide
:UpdateOHPanel()
24 self
:SetScript("OnUpdate", ww
.FadeIn
)
28 function TourGuide
:CreateObjectivePanel()
29 frame
= CreateFrame("Frame", nil, UIParent
)
32 local row
= CreateFrame("Button", nil, frame
)
33 row
:SetPoint("TOPLEFT", i
== 1 and frame
or rows
[i
-1], i
== 1 and "TOPLEFT" or "BOTTOMLEFT", 0, -ROWOFFSET
)
35 row
:SetHeight(ROWHEIGHT
)
37 local check
= ww
.SummonCheckBox(ROWHEIGHT
, row
, "TOPLEFT", ROWOFFSET
, 0)
38 local icon
= ww
.SummonTexture(row
, nil, ROWHEIGHT
, ROWHEIGHT
, nil, "TOPLEFT", check
, "TOPRIGHT", ROWOFFSET
, 0)
39 local text
= ww
.SummonFontString(row
, nil, "GameFontNormal", nil, "LEFT", icon
, "RIGHT", ROWOFFSET
, 0)
40 local detail
= ww
.SummonFontString(row
, nil, "GameFontNormal", nil, "RIGHT", -ROWOFFSET
, 0)
41 detail
:SetPoint("LEFT", text
, "RIGHT", ROWOFFSET
*3, 0)
42 detail
:SetJustifyH("RIGHT")
43 detail
:SetTextColor(240/255, 121/255, 2/255)
45 check
:SetScript("OnClick", function(f
) self
:SetTurnedIn(row
.i
, f
:GetChecked()) end)
54 frame
:EnableMouseWheel()
55 frame
:SetScript("OnMouseWheel", function(f
, val
)
57 if (offset
+ NUMROWS
) > #self
.actions
then offset
= #self
.actions
- NUMROWS
end
58 if offset
< 0 then offset
= 0 end
62 frame
:SetScript("OnShow", OnShow
)
63 ww
.SetFadeTime(frame
, 0.5)
70 function TourGuide
:UpdateOHPanel()
71 if not frame
or not frame
:IsVisible() then return end
73 for i
in pairs(accepted
) do accepted
[i
] = nil end
76 local action
, name
, note
, logi
, complete
, hasitem
, turnedin
, fullquestname
= self
:GetObjectiveInfo(i
+ offset
)
78 local shortname
= name
:gsub("%s%(Part %d+%)", "")
79 if action
== "ACCEPT" and not turnedin
and (accepted
[name
] or not accepted
[shortname
]) then
81 accepted
[shortname
] = true
86 for i
,row
in ipairs(rows
) do
88 local action
, name
, note
, logi
, complete
, hasitem
, turnedin
, fullquestname
= self
:GetObjectiveInfo(i
+ offset
)
89 if not name
then row
:Hide()
93 local shortname
= name
:gsub("%s%(Part %d+%)", "")
94 logi
= not turnedin
and (accepted
[name
] or not accepted
[shortname
]) and logi
95 complete
= not turnedin
and (accepted
[name
] or not accepted
[shortname
]) and complete
96 local checked
= turnedin
or action
== "ACCEPT" and logi
or action
== "COMPLETE" and complete
98 if action
== "ACCEPT" and logi
then
100 accepted
[shortname
] = true
103 row
.icon
:SetTexture(self
.icons
[action
])
104 row
.text
:SetText(name
)
105 row
.detail
:SetText(note
)
106 row
.check
:SetChecked(checked
)