Gossip.lua 2.97 KB
Newer Older
Azilroka's avatar
Azilroka committed
1
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
2 3
local S = E:GetModule('Skins')

4
local _G = _G
Simpy's avatar
Simpy committed
5
local next, pairs, ipairs = next, pairs, ipairs
6 7
local hooksecurefunc = hooksecurefunc

Simpy's avatar
nothing  
Simpy committed
8
local function handleGossipText()
9 10 11 12
	local buttons = _G.GossipFrame.buttons
	if buttons and next(buttons) then
		for _, button in ipairs(buttons) do
			local str = button:GetFontString()
Simpy's avatar
nothing  
Simpy committed
13 14 15 16 17 18 19 20 21
			if str then
				str:SetTextColor(1, 1, 1)

				local text = str:GetText()
				if text then
					local stripped = E:StripString(text)
					str:SetText(stripped)
				end
			end
22 23 24 25
		end
	end
end

Simpy's avatar
Simpy committed
26
function S:GossipFrame()
Simpy's avatar
-.-  
Simpy committed
27
	if not (E.private.skins.blizzard.enable and E.private.skins.blizzard.gossip) then return end
28

29
	_G.ItemTextFrame:StripTextures(true)
Simpy's avatar
Simpy committed
30
	_G.ItemTextFrame:CreateBackdrop('Transparent')
Azilroka's avatar
Azilroka committed
31

32
	_G.ItemTextScrollFrame:StripTextures()
Azilroka's avatar
Azilroka committed
33

Simpy's avatar
Simpy committed
34
	_G.GossipFrame:CreateBackdrop('Transparent')
35
	_G.GossipFramePortrait:Kill()
Azilroka's avatar
Azilroka committed
36

37
	S:HandleCloseButton(_G.ItemTextFrameCloseButton)
Azilroka's avatar
Azilroka committed
38

39 40
	S:HandleScrollBar(_G.GossipGreetingScrollFrameScrollBar, 5)
	S:HandleScrollBar(_G.ItemTextScrollFrameScrollBar)
Azilroka's avatar
Azilroka committed
41

42 43
	S:HandleNextPrevButton(_G.ItemTextPrevPageButton)
	S:HandleNextPrevButton(_G.ItemTextNextPageButton)
Azilroka's avatar
Azilroka committed
44

45
	_G.ItemTextPageText:SetTextColor(1, 1, 1)
Simpy's avatar
Simpy committed
46
	hooksecurefunc(_G.ItemTextPageText, 'SetTextColor', function(pageText, headerType, r, g, b)
47
		if r ~= 1 or g ~= 1 or b ~= 1 then
48
			pageText:SetTextColor(headerType, 1, 1, 1)
49 50 51
		end
	end)

Simpy's avatar
Simpy committed
52
	local StripAllTextures = { 'GossipFrameGreetingPanel', 'GossipGreetingScrollFrame' }
53 54 55 56 57

	for _, object in pairs(StripAllTextures) do
		_G[object]:StripTextures()
	end

58
	local GossipFrame = _G.GossipFrame
Simpy's avatar
Simpy committed
59
	S:HandlePortraitFrame(GossipFrame)
60

61
	local GossipGreetingScrollFrame = _G.GossipGreetingScrollFrame
Simpy's avatar
Simpy committed
62
	GossipGreetingScrollFrame:CreateBackdrop()
63

Azilroka's avatar
Azilroka committed
64
	if E.private.skins.parchmentRemoverEnable then
Simpy's avatar
Simpy committed
65
		hooksecurefunc('GossipFrameUpdate', handleGossipText)
66
		_G.GossipGreetingText:SetTextColor(1, 1, 1)
Simpy's avatar
nothing  
Simpy committed
67
		handleGossipText()
Azilroka's avatar
Azilroka committed
68 69 70
	else
		GossipGreetingScrollFrame.spellTex = GossipGreetingScrollFrame:CreateTexture(nil, 'ARTWORK')
		GossipGreetingScrollFrame.spellTex:SetTexture([[Interface\QuestFrame\QuestBG]])
Simpy's avatar
Simpy committed
71 72
		GossipGreetingScrollFrame.spellTex:Point('TOPLEFT', 2, -2)
		GossipGreetingScrollFrame.spellTex:Size(506, 615)
Azilroka's avatar
Azilroka committed
73
		GossipGreetingScrollFrame.spellTex:SetTexCoord(0, 1, 0.02, 1)
74 75
	end

76 77
	_G.GossipFrameGreetingGoodbyeButton:StripTextures()
	S:HandleButton(_G.GossipFrameGreetingGoodbyeButton)
78

Merathilis's avatar
Merathilis committed
79
	for i = 1, 4 do
Simpy's avatar
Simpy committed
80
		local notch = _G['NPCFriendshipStatusBarNotch'..i]
Merathilis's avatar
Merathilis committed
81 82
		if notch then
			notch:SetColorTexture(0, 0, 0)
Simpy's avatar
Simpy committed
83
			notch:Size(1, 16)
Merathilis's avatar
Merathilis committed
84 85 86
		end
	end

87
	local NPCFriendshipStatusBar = _G.NPCFriendshipStatusBar
88 89
	NPCFriendshipStatusBar:StripTextures()
	NPCFriendshipStatusBar:SetStatusBarTexture(E.media.normTex)
90
	NPCFriendshipStatusBar:CreateBackdrop()
Azilroka's avatar
Azilroka committed
91
	E:RegisterStatusBar(NPCFriendshipStatusBar)
Merathilis's avatar
Merathilis committed
92 93

	NPCFriendshipStatusBar.icon:ClearAllPoints()
Simpy's avatar
Simpy committed
94
	NPCFriendshipStatusBar.icon:Point('RIGHT', NPCFriendshipStatusBar, 'LEFT', 0, -3)
Merathilis's avatar
Merathilis committed
95
	S:HandleIcon(NPCFriendshipStatusBar.icon)
96 97
end

Simpy's avatar
Simpy committed
98
S:AddCallback('GossipFrame')