PageRenderTime 123ms CodeModel.GetById 60ms app.highlight 7ms RepoModel.GetById 54ms app.codeStats 0ms

/Tukui/modules/skins/merchant.lua

http://github.com/Asphyxia/Tukui
Lua | 115 lines | 95 code | 15 blank | 5 comment | 7 complexity | 1dc73c716d5fbf47193b2063a7cd48ab MD5 | raw file
  1local T, C, L = unpack(select(2, ...))
  2
  3local function LoadSkin()
  4	local frames = {
  5		"MerchantBuyBackItem",
  6		"MerchantFrame",
  7	}
  8	
  9	-- skin main frames
 10	for i = 1, #frames do
 11		_G[frames[i]]:StripTextures(true)
 12		_G[frames[i]]:CreateBackdrop("Transparent")
 13	end
 14	MerchantBuyBackItem.backdrop:Point("TOPLEFT", -6, 6)
 15	MerchantBuyBackItem.backdrop:Point("BOTTOMRIGHT", 6, -6)
 16	MerchantFrame.backdrop:Point("TOPLEFT", 6, 0)
 17	MerchantFrame.backdrop:Point("BOTTOMRIGHT", 0, 35)
 18	MerchantFrame.backdrop:Point("BOTTOMRIGHT", 0, 60)
 19	-- skin tabs
 20	for i= 1, 2 do
 21		T.SkinTab(_G["MerchantFrameTab"..i])
 22	end
 23	
 24	-- skin icons / merchant slots
 25	for i = 1, 12 do
 26		local b = _G["MerchantItem"..i.."ItemButton"]
 27		local t = _G["MerchantItem"..i.."ItemButtonIconTexture"]
 28		local item_bar = _G["MerchantItem"..i]
 29		item_bar:StripTextures(true)
 30		item_bar:CreateBackdrop("Default")
 31		
 32		b:StripTextures()
 33		b:StyleButton(false)
 34		b:SetTemplate("Default", true)
 35		b:Point("TOPLEFT", item_bar, "TOPLEFT", 4, -4)
 36		t:SetTexCoord(.08, .92, .08, .92)
 37		t:ClearAllPoints()
 38		t:Point("TOPLEFT", 2, -2)
 39		t:Point("BOTTOMRIGHT", -2, 2)
 40		
 41		_G["MerchantItem"..i.."MoneyFrame"]:ClearAllPoints()
 42		_G["MerchantItem"..i.."MoneyFrame"]:Point("BOTTOMLEFT", b, "BOTTOMRIGHT", 3, 0)
 43		
 44	end
 45	
 46	-- Skin buyback item frame + icon
 47	MerchantBuyBackItemItemButton:StripTextures()
 48	MerchantBuyBackItemItemButton:StyleButton(false)
 49	MerchantBuyBackItemItemButton:SetTemplate("Default", true)
 50	MerchantBuyBackItemItemButtonIconTexture:SetTexCoord(.08, .92, .08, .92)
 51	MerchantBuyBackItemItemButtonIconTexture:ClearAllPoints()
 52	MerchantBuyBackItemItemButtonIconTexture:Point("TOPLEFT", 2, -2)
 53	MerchantBuyBackItemItemButtonIconTexture:Point("BOTTOMRIGHT", -2, 2)
 54
 55	
 56	MerchantRepairItemButton:StyleButton(false)
 57	MerchantRepairItemButton:SetTemplate("Default", true)
 58	for i=1, MerchantRepairItemButton:GetNumRegions() do
 59		local region = select(i, MerchantRepairItemButton:GetRegions())
 60		if region:GetObjectType() == "Texture" and region:GetTexture() == "Interface\\MerchantFrame\\UI-Merchant-RepairIcons" then
 61			region:SetTexCoord(0.04, 0.24, 0.06, 0.5)
 62			region:ClearAllPoints()
 63			region:Point("TOPLEFT", 2, -2)
 64			region:Point("BOTTOMRIGHT", -2, 2)
 65		end
 66	end
 67	
 68	MerchantGuildBankRepairButton:StyleButton()
 69	MerchantGuildBankRepairButton:SetTemplate("Default", true)
 70	MerchantGuildBankRepairButtonIcon:SetTexCoord(0.61, 0.82, 0.1, 0.52)
 71	MerchantGuildBankRepairButtonIcon:ClearAllPoints()
 72	MerchantGuildBankRepairButtonIcon:Point("TOPLEFT", 2, -2)
 73	MerchantGuildBankRepairButtonIcon:Point("BOTTOMRIGHT", -2, 2)
 74	
 75	MerchantRepairAllButton:StyleButton(false)
 76	MerchantRepairAllButton:SetTemplate("Default", true)
 77	MerchantRepairAllIcon:SetTexCoord(0.34, 0.1, 0.34, 0.535, 0.535, 0.1, 0.535, 0.535)
 78	MerchantRepairAllIcon:ClearAllPoints()
 79	MerchantRepairAllIcon:Point("TOPLEFT", 2, -2)
 80	MerchantRepairAllIcon:Point("BOTTOMRIGHT", -2, 2)
 81	
 82	-- Skin misc frames
 83	MerchantFrame:Width(360)
 84	T.SkinCloseButton(MerchantFrameCloseButton, MerchantFrame.backdrop)
 85	
 86	MerchantPrevPageButton:StripTextures()
 87	MerchantPrevPageButton:FontString("text", C.media.font, 20)
 88	MerchantPrevPageButton.text:SetText("<")
 89	MerchantPrevPageButton.text:SetPoint("CENTER", 0, 0)
 90	MerchantPrevPageButton.text:SetTextColor(1, 1, 0)
 91	MerchantPrevPageButton:SetScript("OnEnter", function()
 92		MerchantPrevPageButton.text:SetPoint("CENTER", 0, 0)
 93		MerchantPrevPageButton.text:SetTextColor(1, 1, 1)
 94	end)
 95	MerchantPrevPageButton:SetScript("OnLeave", function()
 96		MerchantPrevPageButton.text:SetPoint("CENTER", 0, 0)
 97		MerchantPrevPageButton.text:SetTextColor(1, 1, 0)
 98	end)
 99
100	MerchantNextPageButton:StripTextures()
101	MerchantNextPageButton:FontString("text", C.media.font, 20)
102	MerchantNextPageButton.text:SetText(">")
103	MerchantNextPageButton.text:SetPoint("CENTER", 0, 0)
104	MerchantNextPageButton.text:SetTextColor(1, 1, 0)
105	MerchantNextPageButton:SetScript("OnEnter", function()
106		MerchantNextPageButton.text:SetPoint("CENTER", 0, 0)
107		MerchantNextPageButton.text:SetTextColor(1, 1, 1)
108	end)
109	MerchantNextPageButton:SetScript("OnLeave", function()
110		MerchantNextPageButton.text:SetPoint("CENTER", 0, 0)
111		MerchantNextPageButton.text:SetTextColor(1, 1, 0)
112	end)
113end
114
115tinsert(T.SkinFuncs["Tukui"], LoadSkin)