View difference between Paste ID: pzvZBJ7f and jxuu4LQJ
SHOW: | | - or go back to the newest paste.
1
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
2
local NP = E:GetModule('NamePlates')
3
4
local strlower = strlower
5
6
function NP:PvPIndicator_PostUpdate(_, status)
7
	if status and status ~= 'FFA' and (not self.Badge or not self.Badge:IsShown()) then
8
		self:SetAtlas('bfa-landingbutton-'..strlower(status)..'-up')
9
		self:SetTexCoord(0, 1, 0, 1)
10
	end
11
end
12
13
function NP:Construct_PvPIndicator(nameplate)
14
	local PvPIndicator = nameplate:CreateTexture(nil, 'OVERLAY')
15
	PvPIndicator.Badge_ = nameplate:CreateTexture(nil, 'ARTWORK')
16
	PvPIndicator.PostUpdate = NP.PvPIndicator_PostUpdate
17
18
	return PvPIndicator
19
end
20
21
function NP:Update_PvPIndicator(nameplate)
22
	local db = NP:PlateDB(nameplate)
23
24
	if db.pvpindicator and db.pvpindicator.enable then
25
		if not nameplate:IsElementEnabled('PvPIndicator') then
26
			nameplate:EnableElement('PvPIndicator')
27
		end
28
29
		nameplate.PvPIndicator:Size(db.pvpindicator.size, db.pvpindicator.size)
30
		nameplate.PvPIndicator.Badge_:Size(db.pvpindicator.size + 14, db.pvpindicator.size + 16)
31
32
		nameplate.PvPIndicator.Badge = nil
33
34
		if db.pvpindicator.showBadge then
35
			nameplate.PvPIndicator.Badge = nameplate.PvPIndicator.Badge_
36
		end
37
38
		nameplate.PvPIndicator:ClearAllPoints()
39
		nameplate.PvPIndicator:Point(E.InversePoints[db.pvpindicator.position], nameplate, db.pvpindicator.position, db.pvpindicator.xOffset, db.pvpindicator.yOffset)
40
	elseif nameplate:IsElementEnabled('PvPIndicator') then
41
		nameplate:DisableElement('PvPIndicator')
42
	end
43
end
44
45
function NP:Construct_PvPClassificationIndicator(nameplate)
46
    local PvPClassificationIndicator = nameplate:CreateTexture(nil, 'OVERLAY')
47
	return PvPClassificationIndicator
48
end
49
50
function NP:Update_PvPClassificationIndicator(nameplate)
51
	local db = NP:PlateDB(nameplate)
52
53
	if (nameplate.frameType == 'ENEMY_PLAYER' or nameplate.frameType == 'FRIENDLY_PLAYER' or nameplate.frameType == 'PLAYER') and db.pvpclassificationindicator and db.pvpclassificationindicator.enable then
54
		if not nameplate:IsElementEnabled('PvPClassificationIndicator') then
55
			nameplate:EnableElement('PvPClassificationIndicator')
56
		end
57
58
		nameplate.PvPClassificationIndicator:ClearAllPoints()
59
		nameplate.PvPClassificationIndicator:Point(E.InversePoints[db.pvpclassificationindicator.position], nameplate, db.pvpclassificationindicator.position, db.pvpclassificationindicator.xOffset, db.pvpclassificationindicator.yOffset)
60
		nameplate.PvPClassificationIndicator:Size(db.pvpclassificationindicator.size)
61
	elseif nameplate:IsElementEnabled('PvPClassificationIndicator') then
62
		nameplate:DisableElement('PvPClassificationIndicator')
63
	end
64
end
65