LunaUnitFrames

LunaUnitFrames

268k Downloads

Suggestion (including working code): Rare Indicator for the playerframe

stan1226 opened this issue ยท 1 comments

commented

With the recent addition of the gold dragon indicator for the playerframe, I would really like to see an option to use the silver rare dragon instead.

commented

I actually found a way to implement that really simple. Would be awesome if you could add the following code changes to the next version:

Options.lua - Line 2490:

				elite = {
					name = L["Elite"],
					type = "group",
					order = 11,
					inline = true,
					hidden = function(info) return not LunaUF.db.profile.units[info[1]].indicators[info[3]] end,
					args = {
						enabled = {
							name = L["Enable"],
							desc = string.format(L["Enable or disable the %s."],L["Elite"]),
							type = "toggle",
							order = 1,
						},
						side = {
							name = L["Side"],
							desc = L["Elite indicator alignment"],
							type = "select",
							order = 2,
							values = {["LEFT"] = L["Left"], ["RIGHT"] = L["Right"]},
						},
						type = {
							name = L["Type"],
							desc = L["Type"],
							type = "select",
							order = 3,
							values = {["ELITE"] = L["elite"], ["RARE"] = L["rare"]},
						},
					},
				},

defaults.lua - Line 238:
elite = { enabled = false, side = "LEFT", type = "ELITE" },

indicators.lua - Line 64:

function Indicators:UpdateElite(frame)
	if( not frame.indicators.elite or not frame.indicators.elite.enabled ) then return end
	local suffix = LunaUF.db.profile.units[frame.unitType].indicators.elite.side == "LEFT" and "" or "-right"
	
	local classif = UnitClassification(frame.unit)
	if( classif == "rare" or 
		UnitIsUnit("player", frame.unit) and LunaUF.db.profile.units.player.indicators.elite.enabled and LunaUF.db.profile.units.player.indicators.elite.type == "RARE" 
		or UnitIsUnit("pet", frame.unit) and LunaUF.db.profile.units.pet.indicators.elite.enabled and LunaUF.db.profile.units.pet.indicators.elite.type == "RARE" ) then
		frame.indicators.elite:SetTexture("Interface\\AddOns\\LunaUnitFrames\\media\\textures\\UI-DialogBox-Silver-Dragon"..suffix)
		frame.indicators.elite:Show()
	elseif classif == "normal" and not (UnitIsUnit("player", frame.unit) and LunaUF.db.profile.units.player.indicators.elite.enabled and LunaUF.db.profile.units.player.indicators.elite.type == "ELITE" or 
										UnitIsUnit("pet", frame.unit) and LunaUF.db.profile.units.pet.indicators.elite.enabled  and LunaUF.db.profile.units.pet.indicators.elite.type == "ELITE" ) then
		frame.indicators.elite:Hide()
	else
		frame.indicators.elite:SetTexture("Interface\\AddOns\\LunaUnitFrames\\media\\textures\\UI-DialogBox-Gold-Dragon"..suffix)
		frame.indicators.elite:Show()
	end
end