3 local TourGuide
= TourGuide
4 local ww
= WidgetWarlock
9 local NUMROWS
= math
.floor(305/(ROWHEIGHT
+4))
12 local offset
, elapsed
= 0, 0
17 local function OnShow()
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()
29 function TourGuide
:CreateObjectivePanel()
30 fader
= CreateFrame("Frame")
32 fader
:SetScript("OnUpdate", function(self
, elap
)
33 elapsed
= elapsed
+ elap
37 else frame
:SetAlpha(elapsed
) end
40 frame
= ww
.SummonOptionHouseBaseFrame()
43 local row
= CreateFrame("Button", nil, frame
)
44 row
:SetPoint("TOPLEFT", i
== 1 and frame
or rows
[i
-1], i
== 1 and "TOPLEFT" or "BOTTOMLEFT", 0, -ROWOFFSET
)
46 row
:SetHeight(ROWHEIGHT
)
48 local check
= ww
.SummonCheckBox(ROWHEIGHT
, row
, "TOPLEFT", ROWOFFSET
, 0)
49 local icon
= ww
.SummonTexture(row
, ROWHEIGHT
, ROWHEIGHT
, nil, "TOPLEFT", check
, "TOPRIGHT", ROWOFFSET
, 0)
50 local text
= ww
.SummonFontString(row
, nil, nil, "GameFontNormal", nil, "LEFT", icon
, "RIGHT", ROWOFFSET
, 0)
51 local detail
= ww
.SummonFontString(row
, nil, nil, "GameFontNormal", nil, "RIGHT", -ROWOFFSET
, 0)
52 detail
:SetPoint("LEFT", text
, "RIGHT", ROWOFFSET
*3, 0)
53 detail
:SetJustifyH("RIGHT")
54 detail
:SetTextColor(240/255, 121/255, 2/255)
56 check
:SetScript("OnClick", function(f
) self
:SetTurnedIn(row
.i
, f
:GetChecked()) end)
65 frame
:EnableMouseWheel()
66 frame
:SetScript("OnMouseWheel", function(f
, val
)
68 if (offset
+ NUMROWS
) > #self
.actions
then offset
= #self
.actions
- NUMROWS
end
69 if offset
< 0 then offset
= 0 end
73 frame
:SetScript("OnShow", OnShow
)
80 function TourGuide
:UpdateOHPanel()
81 if not frame
or not frame
:IsVisible() then return end
83 for i
in pairs(accepted
) do accepted
[i
] = nil end
86 local action
, name
, note
, logi
, complete
, hasitem
, turnedin
, fullquestname
= self
:GetObjectiveInfo(i
+ offset
)
88 local shortname
= name
:gsub("%s%(Part %d+%)", "")
89 if action
== "ACCEPT" and not turnedin
and (accepted
[name
] or not accepted
[shortname
]) then
91 accepted
[shortname
] = true
96 for i
,row
in ipairs(rows
) do
98 local action
, name
, note
, logi
, complete
, hasitem
, turnedin
, fullquestname
= self
:GetObjectiveInfo(i
+ offset
)
99 if not name
then row
:Hide()
103 local shortname
= name
:gsub("%s%(Part %d+%)", "")
104 logi
= not turnedin
and (accepted
[name
] or not accepted
[shortname
]) and logi
105 complete
= not turnedin
and (accepted
[name
] or not accepted
[shortname
]) and complete
106 local checked
= turnedin
or action
== "ACCEPT" and logi
or action
== "COMPLETE" and complete
108 if action
== "ACCEPT" and logi
then
109 accepted
[name
] = true
110 accepted
[shortname
] = true
113 row
.icon
:SetTexture(self
.icons
[action
])
114 row
.text
:SetText(name
)
115 row
.detail
:SetText(note
)
116 row
.check
:SetChecked(checked
)