add raid target and group icons to frames

This commit is contained in:
Eric Mauser
2016-07-10 21:30:44 +02:00
parent 0703f8071d
commit c12d1cf386
5 changed files with 145 additions and 3 deletions
+1 -1
View File
@@ -129,7 +129,7 @@ pfUI:RegisterModule("group", function ()
pfUI.uf.group[i].hp.raidIcon:SetWidth(24)
pfUI.uf.group[i].hp.raidIcon:SetHeight(24)
pfUI.uf.group[i].hp.raidIcon.texture = pfUI.uf.group[i].hp.raidIcon:CreateTexture(nil,"ARTWORK")
pfUI.uf.group[i].hp.raidIcon.texture:SetTexture("Interface\\TargetingFrame\\UI-RaidTargetingIcons")
pfUI.uf.group[i].hp.raidIcon.texture:SetTexture("Interface\\AddOns\\pfUI\\img\\raidicons")
pfUI.uf.group[i].hp.raidIcon.texture:SetAllPoints(pfUI.uf.group[i].hp.raidIcon)
pfUI.uf.group[i].hp.raidIcon:SetPoint("TOP", pfUI.uf.group[i].hp, "TOP", -4, 4)
pfUI.uf.group[i].hp.raidIcon:Hide()
+20
View File
@@ -31,6 +31,7 @@ pfUI:RegisterModule("pet", function ()
pfUI.uf.pet:RegisterEvent("UNIT_MAXENERGY")
pfUI.uf.pet:RegisterEvent("UNIT_FOCUS")
pfUI.uf.pet:RegisterEvent("UNIT_MAXFOCUS")
pfUI.uf.pet:RegisterEvent("RAID_TARGET_UPDATE")
pfUI.uf.pet:SetScript("OnEvent", function(arg1)
if UnitExists("pet") then
@@ -42,6 +43,14 @@ pfUI:RegisterModule("pet", function ()
pfUI.uf.pet:Hide()
end
local raidIcon = GetRaidTargetIndex("pet")
if raidIcon then
SetRaidTargetIconTexture(pfUI.uf.pet.hp.raidIcon.texture, raidIcon)
pfUI.uf.pet.hp.raidIcon:Show()
else
pfUI.uf.pet.hp.raidIcon:Hide()
end
local hp, hpmax = UnitHealth("pet"), UnitHealthMax("pet")
local power, powermax = UnitMana("pet"), UnitManaMax("pet")
@@ -105,6 +114,17 @@ pfUI:RegisterModule("pet", function ()
pfUI.uf.pet.hp.bar:SetMinMaxValues(0, 100)
pfUI.uf.pet.hp.bar:SetValue(100)
pfUI.uf.pet.hp.raidIcon = CreateFrame("Frame",nil,pfUI.uf.pet.hp)
pfUI.uf.pet.hp.raidIcon:SetFrameStrata("MEDIUM")
pfUI.uf.pet.hp.raidIcon:SetParent(pfUI.uf.pet.hp.bar)
pfUI.uf.pet.hp.raidIcon:SetWidth(16)
pfUI.uf.pet.hp.raidIcon:SetHeight(16)
pfUI.uf.pet.hp.raidIcon.texture = pfUI.uf.pet.hp.raidIcon:CreateTexture(nil,"ARTWORK")
pfUI.uf.pet.hp.raidIcon.texture:SetTexture("Interface\\AddOns\\pfUI\\img\\raidicons")
pfUI.uf.pet.hp.raidIcon.texture:SetAllPoints(pfUI.uf.pet.hp.raidIcon)
pfUI.uf.pet.hp.raidIcon:SetPoint("TOP", pfUI.uf.pet.hp, "TOP", 0, 6)
pfUI.uf.pet.hp.raidIcon:Hide()
pfUI.uf.pet.power = CreateFrame("Frame",nil, pfUI.uf.pet)
pfUI.uf.pet.power:SetBackdrop(pfUI.backdrop)
pfUI.uf.pet.power:SetWidth(100)
+51
View File
@@ -39,12 +39,35 @@ pfUI:RegisterModule("player", function ()
pfUI.uf.player:RegisterEvent("UNIT_MAXRAGE")
pfUI.uf.player:RegisterEvent("UNIT_ENERGY")
pfUI.uf.player:RegisterEvent("UNIT_MAXENERGY")
pfUI.uf.player:RegisterEvent("RAID_TARGET_UPDATE")
pfUI.uf.player:RegisterEvent("PARTY_LEADER_CHANGED")
pfUI.uf.player:RegisterEvent("PARTY_LOOT_METHOD_CHANGED")
pfUI.uf.player:SetScript("OnEvent", function()
if event == "UNIT_DISPLAYPOWER" or event == "PLAYER_ENTERING_WORLD" then
pfUI.uf.player.power.bar:SetValue(0)
end
local raidIcon = GetRaidTargetIndex("player")
if raidIcon then
SetRaidTargetIconTexture(pfUI.uf.player.hp.raidIcon.texture, raidIcon)
pfUI.uf.player.hp.raidIcon:Show()
else
pfUI.uf.player.hp.raidIcon:Hide()
end
if UnitIsPartyLeader("player") then
pfUI.uf.player.hp.leaderIcon:Show()
else
pfUI.uf.player.hp.leaderIcon:Hide()
end
local _, lootmaster = GetLootMethod()
if lootmaster and pfUI.uf.player.id == lootmaster then
pfUI.uf.player.hp.lootIcon:Show()
else
pfUI.uf.player.hp.lootIcon:Hide()
end
local hp, hpmax = UnitHealth("player"), UnitHealthMax("player")
local power, powermax = UnitMana("player"), UnitManaMax("player")
_, class = UnitClass("player")
@@ -111,6 +134,34 @@ pfUI:RegisterModule("player", function ()
pfUI.uf.player.hp:SetPoint("TOPRIGHT",pfUI.uf.player,"TOPRIGHT")
pfUI.uf.player.hp:SetPoint("TOPLEFT",pfUI.uf.player,"TOPLEFT")
pfUI.uf.player.hp.leaderIcon = CreateFrame("Frame",nil,pfUI.uf.player.hp)
pfUI.uf.player.hp.leaderIcon:SetWidth(10)
pfUI.uf.player.hp.leaderIcon:SetHeight(10)
pfUI.uf.player.hp.leaderIcon.texture = pfUI.uf.player.hp.leaderIcon:CreateTexture(nil,"BACKGROUND")
pfUI.uf.player.hp.leaderIcon.texture:SetTexture("Interface\\GROUPFRAME\\UI-Group-LeaderIcon")
pfUI.uf.player.hp.leaderIcon.texture:SetAllPoints(pfUI.uf.player.hp.leaderIcon)
pfUI.uf.player.hp.leaderIcon:SetPoint("TOPLEFT", pfUI.uf.player.hp, "TOPLEFT", -4, 4)
pfUI.uf.player.hp.leaderIcon:Hide()
pfUI.uf.player.hp.lootIcon = CreateFrame("Frame",nil,pfUI.uf.player.hp)
pfUI.uf.player.hp.lootIcon:SetWidth(10)
pfUI.uf.player.hp.lootIcon:SetHeight(10)
pfUI.uf.player.hp.lootIcon.texture = pfUI.uf.player.hp.lootIcon:CreateTexture(nil,"BACKGROUND")
pfUI.uf.player.hp.lootIcon.texture:SetTexture("Interface\\GROUPFRAME\\UI-Group-MasterLooter")
pfUI.uf.player.hp.lootIcon.texture:SetAllPoints(pfUI.uf.player.hp.lootIcon)
pfUI.uf.player.hp.lootIcon:SetPoint("TOPLEFT", pfUI.uf.player.hp, "LEFT", -4, 4)
pfUI.uf.player.hp.lootIcon:Hide()
pfUI.uf.player.hp.raidIcon = CreateFrame("Frame",nil,pfUI.uf.player.hp)
pfUI.uf.player.hp.raidIcon:SetFrameStrata("HIGH")
pfUI.uf.player.hp.raidIcon:SetWidth(24)
pfUI.uf.player.hp.raidIcon:SetHeight(24)
pfUI.uf.player.hp.raidIcon.texture = pfUI.uf.player.hp.raidIcon:CreateTexture(nil,"ARTWORK")
pfUI.uf.player.hp.raidIcon.texture:SetTexture("Interface\\AddOns\\pfUI\\img\\raidicons")
pfUI.uf.player.hp.raidIcon.texture:SetAllPoints(pfUI.uf.player.hp.raidIcon)
pfUI.uf.player.hp.raidIcon:SetPoint("TOP", pfUI.uf.player.hp, "TOP", 0, 6)
pfUI.uf.player.hp.raidIcon:Hide()
pfUI.uf.player.hp.bar = CreateFrame("StatusBar", nil, pfUI.uf.player.hp)
pfUI.uf.player.hp.bar:SetStatusBarTexture("Interface\\AddOns\\pfUI\\img\\bar")
+54 -2
View File
@@ -41,6 +41,9 @@ pfUI:RegisterModule("target", function ()
pfUI.uf.target:RegisterEvent("UNIT_MAXRAGE")
pfUI.uf.target:RegisterEvent("UNIT_ENERGY")
pfUI.uf.target:RegisterEvent("UNIT_MAXENERGY")
pfUI.uf.target:RegisterEvent("RAID_TARGET_UPDATE")
pfUI.uf.target:RegisterEvent("PARTY_LEADER_CHANGED")
pfUI.uf.target:RegisterEvent("PARTY_LOOT_METHOD_CHANGED")
pfUI.uf.target:SetScript("OnEvent", function()
if UnitExists("target") then
@@ -53,6 +56,27 @@ pfUI:RegisterModule("target", function ()
return
end
local raidIcon = GetRaidTargetIndex("target")
if raidIcon then
SetRaidTargetIconTexture(pfUI.uf.target.hp.raidIcon.texture, raidIcon)
pfUI.uf.target.hp.raidIcon:Show()
else
pfUI.uf.target.hp.raidIcon:Hide()
end
if UnitIsPartyLeader("target") then
pfUI.uf.target.hp.leaderIcon:Show()
else
pfUI.uf.target.hp.leaderIcon:Hide()
end
local _, lootmaster = GetLootMethod()
if lootmaster and pfUI.uf.target.id == lootmaster then
pfUI.uf.target.hp.lootIcon:Show()
else
pfUI.uf.target.hp.lootIcon:Hide()
end
if event == "PLAYER_TARGET_CHANGED" or event == "PLAYER_ENTERING_WORLD" then
pfUI.uf.target.power.bar:SetValue(0)
pfUI.uf.target.hp.bar:SetValue(0)
@@ -169,14 +193,42 @@ pfUI:RegisterModule("target", function ()
pfUI.uf.target.hp.bar = CreateFrame("StatusBar", nil, pfUI.uf.target.hp)
pfUI.uf.target.hp.bar:SetStatusBarTexture("Interface\\AddOns\\pfUI\\img\\bar")
pfUI.uf.target.hp.bar:ClearAllPoints()
pfUI.uf.target.hp.bar:SetPoint("TOPLEFT", pfUI.uf.target.hp, "TOPLEFT", 3, -3)
pfUI.uf.target.hp.bar:SetPoint("BOTTOMRIGHT", pfUI.uf.target.hp, "BOTTOMRIGHT", -3, 3)
pfUI.uf.target.hp.bar:SetMinMaxValues(0, 100)
pfUI.uf.target.hp.bar:SetValue(100)
pfUI.uf.target.hp.leaderIcon = CreateFrame("Frame",nil,pfUI.uf.target.hp)
pfUI.uf.target.hp.leaderIcon:SetWidth(10)
pfUI.uf.target.hp.leaderIcon:SetHeight(10)
pfUI.uf.target.hp.leaderIcon.texture = pfUI.uf.target.hp.leaderIcon:CreateTexture(nil,"BACKGROUND")
pfUI.uf.target.hp.leaderIcon.texture:SetTexture("Interface\\GROUPFRAME\\UI-Group-LeaderIcon")
pfUI.uf.target.hp.leaderIcon.texture:SetAllPoints(pfUI.uf.target.hp.leaderIcon)
pfUI.uf.target.hp.leaderIcon:SetPoint("TOPLEFT", pfUI.uf.target.hp, "TOPLEFT", -4, 4)
pfUI.uf.target.hp.leaderIcon:Hide()
pfUI.uf.target.hp.lootIcon = CreateFrame("Frame",nil,pfUI.uf.target.hp)
pfUI.uf.target.hp.lootIcon:SetWidth(10)
pfUI.uf.target.hp.lootIcon:SetHeight(10)
pfUI.uf.target.hp.lootIcon.texture = pfUI.uf.target.hp.lootIcon:CreateTexture(nil,"BACKGROUND")
pfUI.uf.target.hp.lootIcon.texture:SetTexture("Interface\\GROUPFRAME\\UI-Group-MasterLooter")
pfUI.uf.target.hp.lootIcon.texture:SetAllPoints(pfUI.uf.target.hp.lootIcon)
pfUI.uf.target.hp.lootIcon:SetPoint("TOPLEFT", pfUI.uf.target.hp, "LEFT", -4, 4)
pfUI.uf.target.hp.lootIcon:Hide()
pfUI.uf.target.hp.raidIcon = CreateFrame("Frame",nil,pfUI.uf.target.hp)
pfUI.uf.target.hp.raidIcon:SetFrameStrata("MEDIUM")
pfUI.uf.target.hp.raidIcon:SetParent(pfUI.uf.target.hp.bar)
pfUI.uf.target.hp.raidIcon:SetWidth(24)
pfUI.uf.target.hp.raidIcon:SetHeight(24)
pfUI.uf.target.hp.raidIcon.texture = pfUI.uf.target.hp.raidIcon:CreateTexture(nil,"ARTWORK")
pfUI.uf.target.hp.raidIcon.texture:SetTexture("Interface\\AddOns\\pfUI\\img\\raidicons")
pfUI.uf.target.hp.raidIcon.texture:SetAllPoints(pfUI.uf.target.hp.raidIcon)
pfUI.uf.target.hp.raidIcon:SetPoint("TOP", pfUI.uf.target.hp, "TOP", 0, 6)
pfUI.uf.target.hp.raidIcon:Hide()
if pfUI_config.unitframes.portrait == "1" then
pfUI.uf.target.hp.bar.portrait = CreateFrame("PlayerModel",nil,pfUI.uf.target.hp.bar)
pfUI.uf.target.hp.bar.portrait:SetAllPoints(pfUI.uf.target.hp.bar)
+19
View File
@@ -35,6 +35,14 @@ pfUI:RegisterModule("targettarget", function ()
return
end
local raidIcon = GetRaidTargetIndex("targettarget")
if raidIcon then
SetRaidTargetIconTexture(pfUI.uf.targettarget.hp.raidIcon.texture, raidIcon)
pfUI.uf.targettarget.hp.raidIcon:Show()
else
pfUI.uf.targettarget.hp.raidIcon:Hide()
end
local color
if UnitIsPlayer("targettarget") then
_, class = UnitClass("targettarget")
@@ -89,6 +97,17 @@ pfUI:RegisterModule("targettarget", function ()
pfUI.uf.targettarget.hp.bar:SetMinMaxValues(0, 100)
pfUI.uf.targettarget.hp.bar:SetValue(100)
pfUI.uf.targettarget.hp.raidIcon = CreateFrame("Frame",nil,pfUI.uf.targettarget.hp)
pfUI.uf.targettarget.hp.raidIcon:SetFrameStrata("MEDIUM")
pfUI.uf.targettarget.hp.raidIcon:SetParent(pfUI.uf.targettarget.hp.bar)
pfUI.uf.targettarget.hp.raidIcon:SetWidth(16)
pfUI.uf.targettarget.hp.raidIcon:SetHeight(16)
pfUI.uf.targettarget.hp.raidIcon.texture = pfUI.uf.targettarget.hp.raidIcon:CreateTexture(nil,"ARTWORK")
pfUI.uf.targettarget.hp.raidIcon.texture:SetTexture("Interface\\AddOns\\pfUI\\img\\raidicons")
pfUI.uf.targettarget.hp.raidIcon.texture:SetAllPoints(pfUI.uf.targettarget.hp.raidIcon)
pfUI.uf.targettarget.hp.raidIcon:SetPoint("TOP", pfUI.uf.targettarget.hp, "TOP", 0, 6)
pfUI.uf.targettarget.hp.raidIcon:Hide()
if pfUI_config.unitframes.portrait == "1" then
pfUI.uf.targettarget.hp.bar.portrait = CreateFrame("PlayerModel",nil,pfUI.uf.targettarget.hp.bar)
pfUI.uf.targettarget.hp.bar.portrait:SetAllPoints(pfUI.uf.targettarget.hp.bar)