forked from Kreolix/CovenantMissionHelper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MissionHelperFrame.lua
121 lines (99 loc) · 3.99 KB
/
MissionHelperFrame.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
local CovenantMissionHelper, CMH = ...
local MissionHelperFrame = _G["MissionHelperFrame"]
local L = MissionHelper.L
function MissionHelperFrame:updateMissionHeader(missionInfo)
if self.board and self.board.missionID == missionInfo.missionID then return end
self.missionHeader.info = missionInfo -- for compatibility
GarrisonMissionButton_SetRewards(self.missionHeader, missionInfo.rewards)
for _, reward in pairs(self.missionHeader.Rewards) do
reward:SetSize(58, 58)
end
self.missionHeader.Level:SetText(missionInfo.missionScalar)
self.missionHeader.Duration:SetText(L['Duration'] .. ': ' ..tostring(missionInfo.duration))
if missionInfo.offerTimeRemaining and not missionInfo.canBeCompleted then
self.missionHeader.OfferTime:SetText(L['Offer time'] .. ': ' .. tostring(missionInfo.offerTimeRemaining))
end
end
function MissionHelperFrame:clearFrames()
self.combatLogFrame.CombatLogMessageFrame:Clear()
self.combatLogFrame.CombatLogMessageFrame.ScrollBar:SetMinMaxValues(0, 10)
self.combatLogFrame.CombatLogMessageFrame:SetScrollOffset(0)
self:setResultHeader('')
self:setResultInfo('')
self:hideButtonsFrame()
wipe(CMH.Board.CombatLog)
wipe(CMH.Board.HiddenCombatLog)
wipe(CMH.Board.CombatLogEvents)
end
function MissionHelperFrame:setResultHeader(message)
self.resultHeader.text:SetText(message)
end
function MissionHelperFrame:setResultInfo(message)
self.resultInfo.text:SetText(message)
end
function MissionHelperFrame:AddCombatLogMessage(message)
self.combatLogFrame.CombatLogMessageFrame:AddMessage(message)
end
function MissionHelperFrame:hidePredictButton()
self.buttonsFrame.predictButton:Hide()
end
function MissionHelperFrame:hideBestDispositionButton()
self.buttonsFrame.BestDispositionByPercentButton:Hide()
self.buttonsFrame.BestDispositionByMinPercentButton:Hide()
end
function MissionHelperFrame:disableBestDispositionButton()
self.buttonsFrame.BestDispositionByPercentButton:Show()
self.buttonsFrame.BestDispositionByPercentButton:Disable()
self.buttonsFrame.BestDispositionByMinPercentButton:Show()
self.buttonsFrame.BestDispositionByMinPercentButton:Disable()
end
function MissionHelperFrame:enableBestDispositionButton()
self.buttonsFrame.BestDispositionByPercentButton:Show()
self.buttonsFrame.BestDispositionByPercentButton:Enable()
self.buttonsFrame.BestDispositionByMinPercentButton:Show()
self.buttonsFrame.BestDispositionByMinPercentButton:Enable()
end
function MissionHelperFrame:disablePredictButton()
self.buttonsFrame.predictButton:Show()
self.buttonsFrame.predictButton:Disable()
end
function MissionHelperFrame:enablePredictButton()
self.buttonsFrame.predictButton:Show()
self.buttonsFrame.predictButton:Enable()
end
function MissionHelperFrame:showButtonsFrame()
self.buttonsFrame:Show()
end
function MissionHelperFrame:hideButtonsFrame()
self.buttonsFrame:Hide()
end
local function setSelectedTab(tab, isSelected)
tab.Left:SetShown(isSelected)
tab.Middle:SetShown(isSelected)
tab.Right:SetShown(isSelected)
tab.LeftDisabled:SetShown(not isSelected)
tab.MiddleDisabled:SetShown(not isSelected)
tab.RightDisabled:SetShown(not isSelected)
end
function MissionHelperFrame_SelectTab(tab)
PlaySound(SOUNDKIT.UI_GARRISON_NAV_TABS)
local id = tab:GetID()
local parentFrame = tab:GetParent()
if (id == 1) then
parentFrame.resultInfo:Show()
parentFrame.combatLogFrame:Hide()
setSelectedTab(parentFrame.ResultTab, true)
setSelectedTab(parentFrame.CombatLogTab, false)
elseif (id == 2) then
parentFrame.resultInfo:Hide()
parentFrame.combatLogFrame:Show()
setSelectedTab(parentFrame.ResultTab, false)
setSelectedTab(parentFrame.CombatLogTab, true)
end
end
function MissionHelperFrame_TabOnShow(self)
if self.LeftDisabled:IsShown() then self.HighlightTexture:Show() end
end
function MissionHelperFrame_TabOnLeave(self)
self.HighlightTexture:Hide()
end