PageRenderTime 124ms CodeModel.GetById 60ms app.highlight 8ms RepoModel.GetById 52ms app.codeStats 0ms

/Tukui/modules/skins/questlog.lua

http://github.com/Asphyxia/Tukui
Lua | 132 lines | 111 code | 16 blank | 5 comment | 7 complexity | 5ab583b90477bf871a22ed5da8cfb132 MD5 | raw file
  1local T, C, L = unpack(select(2, ...))
  2local function LoadSkin()
  3	T.SkinCloseButton(QuestLogFrameCloseButton)
  4	QuestLogFrame:StripTextures()
  5	QuestLogFrame:SetTemplate("Transparent")
  6	QuestLogFrame:CreateShadow("Transparent")
  7	QuestLogCount:StripTextures()
  8
  9	EmptyQuestLogFrame:StripTextures()
 10
 11	QuestLogFrameShowMapButton:StripTextures()
 12	T.SkinButton(QuestLogFrameShowMapButton)
 13	QuestLogFrameShowMapButton.text:ClearAllPoints()
 14	QuestLogFrameShowMapButton.text:SetPoint("CENTER")
 15	QuestLogFrameShowMapButton:Size(QuestLogFrameShowMapButton:GetWidth() - 30, QuestLogFrameShowMapButton:GetHeight(), - 40)
 16	
 17	QuestLogFrameCompleteButton:StripTextures()
 18	T.SkinButton(QuestLogFrameCompleteButton)
 19
 20	local buttons = {
 21		"QuestLogFrameAbandonButton",
 22		"QuestLogFramePushQuestButton",
 23		"QuestLogFrameTrackButton",
 24		"QuestLogFrameCancelButton",
 25	}
 26
 27	for _, button in pairs(buttons) do
 28		T.SkinButton(_G[button])
 29	end
 30	QuestLogFramePushQuestButton:Point("LEFT", QuestLogFrameAbandonButton, "RIGHT", 2, 0)
 31	QuestLogFramePushQuestButton:Point("RIGHT", QuestLogFrameTrackButton, "LEFT", -2, 0)
 32
 33	for i=1, MAX_NUM_ITEMS do
 34		_G["QuestInfoItem"..i]:StripTextures()
 35		_G["QuestInfoItem"..i]:StyleButton()
 36		_G["QuestInfoItem"..i]:Width(_G["QuestInfoItem"..i]:GetWidth() - 4)
 37		_G["QuestInfoItem"..i]:SetFrameLevel(_G["QuestInfoItem"..i]:GetFrameLevel() + 2)
 38		_G["QuestInfoItem"..i.."IconTexture"]:SetTexCoord(.08, .92, .08, .92)
 39		_G["QuestInfoItem"..i.."IconTexture"]:SetDrawLayer("OVERLAY")
 40		_G["QuestInfoItem"..i.."IconTexture"]:Point("TOPLEFT", 2, -2)
 41		_G["QuestInfoItem"..i.."IconTexture"]:Size(_G["QuestInfoItem"..i.."IconTexture"]:GetWidth() - 2, _G["QuestInfoItem"..i.."IconTexture"]:GetHeight() - 2)
 42		_G["QuestInfoItem"..i]:SetTemplate("Transparent")
 43		_G["QuestInfoItem"..i.."Count"]:SetDrawLayer("OVERLAY")
 44	end
 45
 46	QuestInfoSkillPointFrame:StripTextures()
 47	QuestInfoSkillPointFrame:StyleButton()
 48	QuestInfoSkillPointFrame:Width(QuestInfoSkillPointFrame:GetWidth() - 4)
 49	QuestInfoSkillPointFrame:SetFrameLevel(QuestInfoSkillPointFrame:GetFrameLevel() + 2)
 50	QuestInfoSkillPointFrameIconTexture:SetTexCoord(.08, .92, .08, .92)
 51	QuestInfoSkillPointFrameIconTexture:SetDrawLayer("OVERLAY")
 52	QuestInfoSkillPointFrameIconTexture:Point("TOPLEFT", 2, -2)
 53	QuestInfoSkillPointFrameIconTexture:Size(QuestInfoSkillPointFrameIconTexture:GetWidth() - 2, QuestInfoSkillPointFrameIconTexture:GetHeight() - 2)
 54	QuestInfoSkillPointFrame:SetTemplate("Transparent")
 55	QuestInfoSkillPointFrameCount:SetDrawLayer("OVERLAY")
 56	QuestInfoSkillPointFramePoints:ClearAllPoints()
 57	QuestInfoSkillPointFramePoints:Point("BOTTOMRIGHT", QuestInfoSkillPointFrameIconTexture, "BOTTOMRIGHT")
 58
 59	QuestInfoItemHighlight:StripTextures()
 60	QuestInfoItemHighlight:SetTemplate("Transparent")
 61	QuestInfoItemHighlight:SetBackdropBorderColor(1, 1, 0)
 62	QuestInfoItemHighlight:SetBackdropColor(0, 0, 0, 0)
 63	QuestInfoItemHighlight:Size(142, 40)
 64
 65	hooksecurefunc("QuestInfoItem_OnClick", function(self)
 66		QuestInfoItemHighlight:ClearAllPoints()
 67		QuestInfoItemHighlight:SetAllPoints(self)
 68	end)
 69
 70	--Everything here to make the text a readable color
 71	local function QuestObjectiveText()
 72		local numObjectives = GetNumQuestLeaderBoards()
 73		local objective
 74		local type, finished
 75		local numVisibleObjectives = 0
 76		for i = 1, numObjectives do
 77			_, type, finished = GetQuestLogLeaderBoard(i)
 78			if (type ~= "spell") then
 79				numVisibleObjectives = numVisibleObjectives+1
 80				objective = _G["QuestInfoObjective"..numVisibleObjectives]
 81				if ( finished ) then
 82					objective:SetTextColor(1, 1, 0)
 83				else
 84					objective:SetTextColor(0.6, 0.6, 0.6)
 85				end
 86			end
 87		end			
 88	end
 89
 90	hooksecurefunc("QuestInfo_Display", function(template, parentFrame, acceptButton, material)								
 91		local textColor = {1, 1, 1}
 92		local titleTextColor = {1, 1, 0}
 93		
 94		-- headers
 95		QuestInfoTitleHeader:SetTextColor(unpack(titleTextColor))
 96		QuestInfoDescriptionHeader:SetTextColor(unpack(titleTextColor))
 97		QuestInfoObjectivesHeader:SetTextColor(unpack(titleTextColor))
 98		QuestInfoRewardsHeader:SetTextColor(unpack(titleTextColor))
 99		-- other text
100		QuestInfoDescriptionText:SetTextColor(unpack(textColor))
101		QuestInfoObjectivesText:SetTextColor(unpack(textColor))
102		QuestInfoGroupSize:SetTextColor(unpack(textColor))
103		QuestInfoRewardText:SetTextColor(unpack(textColor))
104		-- reward frame text
105		QuestInfoItemChooseText:SetTextColor(unpack(textColor))
106		QuestInfoItemReceiveText:SetTextColor(unpack(textColor))
107		QuestInfoSpellLearnText:SetTextColor(unpack(textColor))
108		QuestInfoXPFrameReceiveText:SetTextColor(unpack(textColor))	
109		
110		QuestObjectiveText()
111	end)
112
113	hooksecurefunc("QuestInfo_ShowRequiredMoney", function()
114		local requiredMoney = GetQuestLogRequiredMoney()
115		if ( requiredMoney > 0 ) then
116			if ( requiredMoney > GetMoney() ) then
117				-- Not enough money
118				QuestInfoRequiredMoneyText:SetTextColor(0.6, 0.6, 0.6)
119			else
120				QuestInfoRequiredMoneyText:SetTextColor(1, 1, 0)
121			end
122		end			
123	end)
124
125	QuestLogFrame:HookScript("OnShow", function()
126		QuestLogDetailScrollFrame:Height(QuestLogScrollFrame:GetHeight() - 4)
127		QuestLogScrollFrame:SetTemplate("Transparent")
128		QuestLogDetailScrollFrame:SetTemplate("Transparent")
129	end)
130end	
131
132tinsert(T.SkinFuncs["Tukui"], LoadSkin)