QuestMapFrame.lua 6.13 KB
Newer Older
Merathilis's avatar
Merathilis committed
1
local MER, E, L, V, P, G = unpack(select(2, ...))
Merathilis's avatar
Merathilis committed
2
local MERS = MER:GetModule("muiSkins")
Merathilis's avatar
Merathilis committed
3 4 5 6 7
local S = E:GetModule("Skins")

-- Cache global variables
-- Lua functions
local _G = _G
Merathilis's avatar
Merathilis committed
8
local next, select, unpack = next, select, unpack
Merathilis's avatar
Merathilis committed
9
-- WoW API / Variables
10 11
local C_CampaignInfo_GetCampaignInfo = C_CampaignInfo.GetCampaignInfo
local C_CampaignInfo_GetCurrentCampaignID = C_CampaignInfo.GetCurrentCampaignID
Merathilis's avatar
Merathilis committed
12
local hooksecurefunc = hooksecurefunc
Merathilis's avatar
Merathilis committed
13 14 15
--Global variables that we don't cache, list them here for the mikk's Find Globals script
-- GLOBALS:

16 17
local r, g, b = unpack(E["media"].rgbvaluecolor)

Merathilis's avatar
Merathilis committed
18 19 20
local function styleQuestMapFrame()
	if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.quest ~= true or E.private.muiSkins.blizzard.quest ~= true then return; end

21 22 23
	-- Stop here if parchment reomover is enabled.
	if E.private.skins.parchmentRemover.enable then return end

Merathilis's avatar
Merathilis committed
24
	local QuestMapFrame = _G.QuestMapFrame
25 26

	-- Quest scroll frame
Merathilis's avatar
Merathilis committed
27
	local QuestScrollFrame = _G.QuestScrollFrame
28
	local campaignHeader = QuestScrollFrame.Contents.WarCampaignHeader
Merathilis's avatar
Merathilis committed
29
	local storyHeader = QuestScrollFrame.Contents.StoryHeader
30 31 32 33 34 35 36

	QuestMapFrame.VerticalSeparator:SetAlpha(0)
	QuestScrollFrame.Background:SetAlpha(0)
	QuestScrollFrame.DetailFrame.TopDetail:SetAlpha(0)
	QuestScrollFrame.DetailFrame.BottomDetail:SetAlpha(0)
	QuestScrollFrame.Contents.Separator:SetAlpha(0)

Merathilis's avatar
Merathilis committed
37 38 39 40 41 42
	_G.QuestScrollFrameScrollBar:ClearAllPoints()
	_G.QuestScrollFrameScrollBar:SetPoint("TOPLEFT", QuestScrollFrame, "TOPRIGHT", 4, -16)
	_G.QuestScrollFrameScrollBar:SetPoint("BOTTOMLEFT", QuestScrollFrame, "BOTTOMRIGHT", 4, 15)

	_G.QuestMapDetailsScrollFrameScrollBar:SetPoint("TOPLEFT", _G.QuestMapDetailsScrollFrame, "TOPRIGHT", 0, -18)

43 44 45 46
	local questHeader = {
		QuestScrollFrame.Contents.WarCampaignHeader,
		QuestScrollFrame.Contents.StoryHeader
	}
47

48 49 50 51 52
	for i = 1, #questHeader do
		local frame = questHeader[i]
		frame.HighlightTexture:Hide()
		frame.Background:Hide()
		frame.Text:SetPoint("TOPLEFT", 15, -20)
Merathilis's avatar
Merathilis committed
53

54 55 56 57 58
		frame:CreateBackdrop("Transparent")
		if i == 1 then -- WarCampaignHeader
			local newTex = frame:CreateTexture(nil, "OVERLAY")
			newTex:SetPoint("TOPRIGHT", -15, -7)
			newTex:SetSize(40, 40)
59 60
			newTex:SetBlendMode("ADD")
			newTex:SetAlpha(0)
61 62 63 64 65
			frame.newTex = newTex

			frame.backdrop:SetPoint("TOPLEFT", 6, -5)
		else  -- StoryHeader
			frame.backdrop:SetPoint("TOPLEFT", 6, -9)
Merathilis's avatar
Merathilis committed
66
		end
67
		frame.backdrop:SetPoint("BOTTOMRIGHT", -6, 11)
Merathilis's avatar
Merathilis committed
68

69 70
		frame:HookScript("OnEnter", function()
			frame.backdrop:SetBackdropColor(r, g, b, .25)
71
		end)
72 73
		frame:HookScript("OnLeave", function()
			frame.backdrop:SetBackdropColor(0, 0, 0, .25)
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
		end)
	end

	local idToTexture = {
		[261] = "Interface\\FriendsFrame\\PlusManz-Alliance",
		[262] = "Interface\\FriendsFrame\\PlusManz-Horde",
	}

	local function UpdateCampaignHeader()
		campaignHeader.newTex:SetAlpha(0)
		if campaignHeader:IsShown() then
			local warCampaignInfo = C_CampaignInfo_GetCampaignInfo(C_CampaignInfo_GetCurrentCampaignID())
			local textureID = warCampaignInfo.uiTextureKitID
			if textureID and idToTexture[textureID] then
				campaignHeader.newTex:SetTexture(idToTexture[textureID])
				campaignHeader.newTex:SetAlpha(.7)
Merathilis's avatar
Merathilis committed
90 91 92 93
			end
		end
	end

Merathilis's avatar
Merathilis committed
94 95 96 97
	hooksecurefunc("QuestLogQuests_Update", function()
		UpdateCampaignHeader()
	end)

98 99 100 101
	-- Quest details
	local DetailsFrame = QuestMapFrame.DetailsFrame
	local RewardsFrame = DetailsFrame.RewardsFrame
	local CompleteQuestFrame = DetailsFrame.CompleteQuestFrame
Merathilis's avatar
Merathilis committed
102

103 104 105 106
	DetailsFrame:StripTextures()
	select(6, DetailsFrame.ShareButton:GetRegions()):SetAlpha(0)
	select(7, DetailsFrame.ShareButton:GetRegions()):SetAlpha(0)
	DetailsFrame.SealMaterialBG:SetAlpha(0)
Merathilis's avatar
Merathilis committed
107

108 109 110
	DetailsFrame.AbandonButton:ClearAllPoints()
	DetailsFrame.AbandonButton:SetPoint("BOTTOMLEFT", DetailsFrame, -1, 0)
	DetailsFrame.AbandonButton:SetWidth(95)
Merathilis's avatar
Merathilis committed
111

112 113 114
	DetailsFrame.ShareButton:ClearAllPoints()
	DetailsFrame.ShareButton:SetPoint("LEFT", DetailsFrame.AbandonButton, "RIGHT", 1, 0)
	DetailsFrame.ShareButton:SetWidth(94)
Merathilis's avatar
Merathilis committed
115

116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
	DetailsFrame.TrackButton:ClearAllPoints()
	DetailsFrame.TrackButton:SetPoint("LEFT", DetailsFrame.ShareButton, "RIGHT", 1, 0)
	DetailsFrame.TrackButton:SetWidth(96)

	-- Rewards frame
	RewardsFrame.Background:SetAlpha(0)
	select(2, RewardsFrame:GetRegions()):SetAlpha(0)

	-- Complete quest frame
	CompleteQuestFrame:GetRegions():SetAlpha(0)
	select(2, CompleteQuestFrame:GetRegions()):SetAlpha(0)
	select(6, CompleteQuestFrame.CompleteButton:GetRegions()):SetAlpha(0)
	select(7, CompleteQuestFrame.CompleteButton:GetRegions()):SetAlpha(0)

	-- Quest log popup detail frame
	local QuestLogPopupDetailFrame = _G["QuestLogPopupDetailFrame"]

	select(18, QuestLogPopupDetailFrame:GetRegions()):SetAlpha(0)
Merathilis's avatar
Merathilis committed
134 135 136 137 138 139 140 141
	_G.QuestLogPopupDetailFrameScrollFrameTop:SetAlpha(0)
	_G.QuestLogPopupDetailFrameScrollFrameBottom:SetAlpha(0)
	_G.QuestLogPopupDetailFrameScrollFrameMiddle:SetAlpha(0)

	_G.QuestLogPopupDetailFrameScrollFrame:HookScript("OnUpdate", function(self)
		_G.QuestLogPopupDetailFrameScrollFrame.backdrop:Hide()
		_G.QuestLogPopupDetailFrameInset:Hide()
		_G.QuestLogPopupDetailFrameBg:Hide()
Merathilis's avatar
Merathilis committed
142
		self:SetTemplate("Transparent")
143 144 145
		if not E.private.skins.parchmentRemover.enable then
			self.spellTex:SetTexture("")
		end
Merathilis's avatar
Merathilis committed
146
	end)
147
	QuestLogPopupDetailFrame:Styling()
Merathilis's avatar
Merathilis committed
148

149 150
	-- Show map button
	local ShowMapButton = QuestLogPopupDetailFrame.ShowMapButton
Merathilis's avatar
Merathilis committed
151

152 153 154
	ShowMapButton.Texture:SetAlpha(0)
	ShowMapButton.Highlight:SetTexture("")
	ShowMapButton.Highlight:SetTexture("")
155

156 157 158
	ShowMapButton:SetSize(ShowMapButton.Text:GetStringWidth() + 14, 22)
	ShowMapButton.Text:ClearAllPoints()
	ShowMapButton.Text:SetPoint("CENTER", 1, 0)
Merathilis's avatar
Merathilis committed
159

160 161
	ShowMapButton:ClearAllPoints()
	ShowMapButton:SetPoint("TOPRIGHT", QuestLogPopupDetailFrame, -30, -25)
Merathilis's avatar
Merathilis committed
162

163
	ShowMapButton:HookScript("OnEnter", function(self)
Merathilis's avatar
Merathilis committed
164
		self.Text:SetTextColor(_G.GameFontHighlight:GetTextColor())
165
	end)
Merathilis's avatar
Merathilis committed
166

167
	ShowMapButton:HookScript("OnLeave", function(self)
Merathilis's avatar
Merathilis committed
168
		self.Text:SetTextColor(_G.GameFontNormal:GetTextColor())
169
	end)
Merathilis's avatar
Merathilis committed
170

171 172 173 174
	-- Bottom buttons
	QuestLogPopupDetailFrame.ShareButton:ClearAllPoints()
	QuestLogPopupDetailFrame.ShareButton:SetPoint("LEFT", QuestLogPopupDetailFrame.AbandonButton, "RIGHT", 1, 0)
	QuestLogPopupDetailFrame.ShareButton:SetPoint("RIGHT", QuestLogPopupDetailFrame.TrackButton, "LEFT", -1, 0)
Merathilis's avatar
Merathilis committed
175 176
end

177
S:AddCallback("mUIQuestMapFrame", styleQuestMapFrame)