mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-03 20:20:01 +00:00
api: portrait function rewrite
This commit is contained in:
+8
-1
@@ -43,12 +43,14 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("unitframes", nil, "custom", "0")
|
||||
pfUI:UpdateConfig("unitframes", nil, "customcolor", ".2,.2,.2,1")
|
||||
pfUI:UpdateConfig("unitframes", nil, "animation_speed", "5")
|
||||
pfUI:UpdateConfig("unitframes", nil, "portrait", "1")
|
||||
pfUI:UpdateConfig("unitframes", nil, "portraitalpha", "0.1")
|
||||
|
||||
pfUI:UpdateConfig("unitframes", nil, "buff_size", "20")
|
||||
pfUI:UpdateConfig("unitframes", nil, "debuff_size", "20")
|
||||
pfUI:UpdateConfig("unitframes", nil, "layout", "default")
|
||||
pfUI:UpdateConfig("unitframes", nil, "globalclick", "0")
|
||||
|
||||
pfUI:UpdateConfig("unitframes", "player", "portrait", "bar")
|
||||
pfUI:UpdateConfig("unitframes", "player", "width", "200")
|
||||
pfUI:UpdateConfig("unitframes", "player", "height", "50")
|
||||
pfUI:UpdateConfig("unitframes", "player", "pheight", "10")
|
||||
@@ -58,6 +60,7 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("unitframes", "player", "buffs", "top")
|
||||
pfUI:UpdateConfig("unitframes", "player", "energy", "1")
|
||||
|
||||
pfUI:UpdateConfig("unitframes", "target", "portrait", "bar")
|
||||
pfUI:UpdateConfig("unitframes", "target", "animation", "0")
|
||||
pfUI:UpdateConfig("unitframes", "target", "width", "200")
|
||||
pfUI:UpdateConfig("unitframes", "target", "height", "50")
|
||||
@@ -65,6 +68,7 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("unitframes", "target", "pspace", "-3")
|
||||
pfUI:UpdateConfig("unitframes", "target", "buffs", "top")
|
||||
|
||||
pfUI:UpdateConfig("unitframes", "group", "portrait", "off")
|
||||
pfUI:UpdateConfig("unitframes", "group", "pspace", "-3")
|
||||
pfUI:UpdateConfig("unitframes", "group", "hide_in_raid", "0")
|
||||
pfUI:UpdateConfig("unitframes", "group", "clickcast", "0")
|
||||
@@ -85,7 +89,10 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("unitframes", "raid", "debuffs_enable", "0")
|
||||
pfUI:UpdateConfig("unitframes", "raid", "debuffs_class", "0")
|
||||
|
||||
pfUI:UpdateConfig("unitframes", "ttarget", "portrait", "bar")
|
||||
pfUI:UpdateConfig("unitframes", "ttarget", "pspace", "-3")
|
||||
|
||||
pfUI:UpdateConfig("unitframes", "pet", "portrait", "bar")
|
||||
pfUI:UpdateConfig("unitframes", "pet", "pspace", "-3")
|
||||
|
||||
pfUI:UpdateConfig("bars", nil, "icon_size", "20")
|
||||
|
||||
+5
-1
@@ -7,6 +7,8 @@ pfUI:RegisterModule("group", function ()
|
||||
default_border = pfUI_config.appearance.border.groupframes
|
||||
end
|
||||
|
||||
local spacing = pfUI_config.unitframes.group.pspace
|
||||
|
||||
-- hide blizzard group frames
|
||||
for i=1, 4 do
|
||||
if getglobal("PartyMemberFrame" .. i) then
|
||||
@@ -83,7 +85,7 @@ pfUI:RegisterModule("group", function ()
|
||||
pfUI.uf.group[i] = CreateFrame("Button","pfGroup" .. i,UIParent)
|
||||
|
||||
pfUI.uf.group[i]:SetWidth(175)
|
||||
pfUI.uf.group[i]:SetHeight(40 + 2*default_border + pfUI_config.unitframes.group.pspace)
|
||||
pfUI.uf.group[i]:SetHeight(40 + 2*default_border + spacing)
|
||||
pfUI.uf.group[i]:SetPoint("TOPLEFT", 5, -5 - ((i-1)*55))
|
||||
pfUI.api:UpdateMovable(pfUI.uf.group[i])
|
||||
pfUI.uf.group[i]:Hide()
|
||||
@@ -113,6 +115,8 @@ pfUI:RegisterModule("group", function ()
|
||||
pfUI.uf.group[i].power.bar:SetAllPoints(pfUI.uf.group[i].power)
|
||||
pfUI.uf.group[i].power.bar:SetMinMaxValues(0, 100)
|
||||
|
||||
pfUI.uf:CreatePortrait(pfUI.uf.group[i], pfUI_config.unitframes.group.portrait, spacing)
|
||||
|
||||
pfUI.uf.group[i].caption = pfUI.uf.group[i]:CreateFontString("Status", "HIGH", "GameFontNormal")
|
||||
pfUI.uf.group[i].caption:SetFont(pfUI.font_square, pfUI_config.global.font_size, "OUTLINE")
|
||||
pfUI.uf.group[i].caption:ClearAllPoints()
|
||||
|
||||
+14
-7
@@ -862,39 +862,43 @@ pfUI:RegisterModule("gui", function ()
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Use custom color for healthbars", pfUI_config.unitframes, "custom", "checkbox")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Custom healthbar color", pfUI_config.unitframes, "customcolor", "color")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Animation speed", pfUI_config.unitframes, "animation_speed")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Show portrait", pfUI_config.unitframes, "portrait", "checkbox")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Portrait Alpha on Bars", pfUI_config.unitframes, "portraitalpha")
|
||||
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Buff size", pfUI_config.unitframes, "buff_size")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Debuff size", pfUI_config.unitframes, "debuff_size")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Layout", pfUI_config.unitframes, "layout", "dropdown", { "default", "tukui" })
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Enable Clickcast for all frames", pfUI_config.unitframes, "globalclick", "checkbox")
|
||||
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Player", nil, nil, "header")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Portrait position", pfUI_config.unitframes.player, "portrait", "dropdown", { "bar", "left", "right", "off" })
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Health width", pfUI_config.unitframes.player, "width")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Health height", pfUI_config.unitframes.player, "height")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Powerbar height", pfUI_config.unitframes.player, "pheight")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Powerbar spacing", pfUI_config.unitframes.player, "pspace")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Element spacing", pfUI_config.unitframes.player, "pspace")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Show PvP Icon", pfUI_config.unitframes.player, "showPVP", "checkbox")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Align PvP Icon to Minimap", pfUI_config.unitframes.player, "showPVPMinimap", "checkbox")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Buff position", pfUI_config.unitframes.player, "buffs", "dropdown", { "top", "bottom", "hide"})
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Show energy ticks", pfUI_config.unitframes.player, "energy", "checkbox")
|
||||
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Target", nil, nil, "header")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Portrait position", pfUI_config.unitframes.target, "portrait", "dropdown", { "bar", "left", "right", "off" })
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Enable target switch animation", pfUI_config.unitframes.target, "animation", "checkbox")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Health width", pfUI_config.unitframes.target, "width")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Health height", pfUI_config.unitframes.target, "height")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Powerbar height", pfUI_config.unitframes.target, "pheight")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Powerbar spacing", pfUI_config.unitframes.target, "pspace")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Element spacing", pfUI_config.unitframes.target, "pspace")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Buff position", pfUI_config.unitframes.target, "buffs", "dropdown", { "top", "bottom", "hide"})
|
||||
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Group", nil, nil, "header")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Powerbar spacing", pfUI_config.unitframes.group, "pspace")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Portrait position", pfUI_config.unitframes.group, "portrait", "dropdown", { "bar", "left", "right", "off" })
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Element spacing", pfUI_config.unitframes.group, "pspace")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Hide group while in raid", pfUI_config.unitframes.group, "hide_in_raid", "checkbox")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Enable Clickcast", pfUI_config.unitframes.group, "clickcast", "checkbox")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Enable Raidframe's buff behaviour for Group", pfUI_config.unitframes.group, "raid_buffs", "checkbox")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Enable Raidframe's debuff behaviour for Group", pfUI_config.unitframes.group, "raid_debuffs", "checkbox")
|
||||
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Raid", nil, nil, "header")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Powerbar spacing", pfUI_config.unitframes.raid, "pspace")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Element spacing", pfUI_config.unitframes.raid, "pspace")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Invert Raid-healthbar", pfUI_config.unitframes.raid, "invert_healthbar", "checkbox")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Show missing HP on raidframes", pfUI_config.unitframes.raid, "show_missing", "checkbox")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Click-cast", pfUI_config.unitframes.raid, "clickcast")
|
||||
@@ -909,8 +913,11 @@ pfUI:RegisterModule("gui", function ()
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Only display Debuffs for my class", pfUI_config.unitframes.raid, "debuffs_class", "checkbox")
|
||||
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Other", nil, nil, "header")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "TargetTarget powerbar spacing", pfUI_config.unitframes.ttarget, "pspace")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Pet powerbar spacing", pfUI_config.unitframes.pet, "pspace")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "TargetTarget Portrait position", pfUI_config.unitframes.ttarget, "portrait", "dropdown", { "bar", "left", "right", "off" })
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "TargetTarget element spacing", pfUI_config.unitframes.ttarget, "pspace")
|
||||
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Pet Portrait position", pfUI_config.unitframes.pet, "portrait", "dropdown", { "bar", "left", "right", "off" })
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Pet element spacing", pfUI_config.unitframes.pet, "pspace")
|
||||
|
||||
-- actionbar
|
||||
pfUI.gui.bar = pfUI.gui:CreateConfigTab("ActionBar")
|
||||
|
||||
+5
-1
@@ -7,12 +7,14 @@ pfUI:RegisterModule("pet", function ()
|
||||
default_border = pfUI_config.appearance.border.unitframes
|
||||
end
|
||||
|
||||
local spacing = pfUI_config.unitframes.pet.pspace
|
||||
|
||||
pfUI.uf.pet = CreateFrame("Button","pfPet",UIParent)
|
||||
pfUI.uf.pet.label = "pet"
|
||||
pfUI.uf.pet.id = ""
|
||||
pfUI.uf.pet:SetFrameStrata("LOW")
|
||||
pfUI.uf.pet:SetWidth(100)
|
||||
pfUI.uf.pet:SetHeight(20 + 2*default_border + pfUI_config.unitframes.pet.pspace)
|
||||
pfUI.uf.pet:SetHeight(20 + 2*default_border + spacing)
|
||||
pfUI.uf.pet:ClearAllPoints()
|
||||
pfUI.uf.pet:SetPoint("BOTTOM", UIParent , "BOTTOM", 0, 163)
|
||||
pfUI.api:UpdateMovable(pfUI.uf.pet)
|
||||
@@ -173,6 +175,8 @@ pfUI:RegisterModule("pet", function ()
|
||||
pfUI.uf.pet.power.bar:SetAllPoints(pfUI.uf.pet.power)
|
||||
pfUI.uf.pet.power.bar:SetMinMaxValues(0, 100)
|
||||
|
||||
pfUI.uf:CreatePortrait(pfUI.uf.pet, pfUI_config.unitframes.pet.portrait, spacing)
|
||||
|
||||
pfUI.uf.pet.hp.text = pfUI.uf.pet.hp.bar:CreateFontString("Status", "LOW", "GameFontNormal")
|
||||
pfUI.uf.pet.hp.text:SetFont(pfUI.font_square, pfUI_config.global.font_size - 2, "OUTLINE")
|
||||
pfUI.uf.pet.hp.text:ClearAllPoints()
|
||||
|
||||
+5
-17
@@ -7,6 +7,8 @@ pfUI:RegisterModule("player", function ()
|
||||
default_border = pfUI_config.appearance.border.unitframes
|
||||
end
|
||||
|
||||
local spacing = pfUI_config.unitframes.player.pspace
|
||||
|
||||
PlayerFrame:Hide()
|
||||
PlayerFrame:UnregisterAllEvents()
|
||||
|
||||
@@ -15,7 +17,7 @@ pfUI:RegisterModule("player", function ()
|
||||
pfUI.uf.player.id = ""
|
||||
pfUI.uf.player:SetFrameStrata("LOW")
|
||||
pfUI.uf.player:SetWidth(pfUI_config.unitframes.player.width)
|
||||
pfUI.uf.player:SetHeight(pfUI_config.unitframes.player.height + pfUI_config.unitframes.player.pheight + 2*default_border + pfUI_config.unitframes.player.pspace)
|
||||
pfUI.uf.player:SetHeight(pfUI_config.unitframes.player.height + pfUI_config.unitframes.player.pheight + 2*default_border + spacing)
|
||||
pfUI.uf.player:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOM", -75, 125)
|
||||
pfUI.api:UpdateMovable(pfUI.uf.player)
|
||||
pfUI.uf.player:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
|
||||
@@ -282,22 +284,6 @@ pfUI:RegisterModule("player", function ()
|
||||
pfUI.uf.player.hp.raidIcon:SetPoint("TOP", pfUI.uf.player.hp, "TOP", 0, 6)
|
||||
pfUI.uf.player.hp.raidIcon:Hide()
|
||||
|
||||
if pfUI_config.unitframes.portrait == "1" then
|
||||
pfUI.uf.player.hp.bar.portrait = CreateFrame("PlayerModel",nil,pfUI.uf.player.hp.bar)
|
||||
pfUI.uf.player.hp.bar.portrait:SetAllPoints(pfUI.uf.player.hp.bar)
|
||||
pfUI.uf.player.hp.bar.portrait:RegisterEvent("UNIT_PORTRAIT_UPDATE")
|
||||
pfUI.uf.player.hp.bar.portrait:RegisterEvent("UNIT_MODEL_CHANGED")
|
||||
pfUI.uf.player.hp.bar.portrait:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
pfUI.uf.player.hp.bar.portrait:SetScript("OnEvent", function() this:Update() end)
|
||||
pfUI.uf.player.hp.bar.portrait:SetScript("OnShow", function() this:Update() end)
|
||||
|
||||
function pfUI.uf.player.hp.bar.portrait.Update()
|
||||
pfUI.uf.player.hp.bar.portrait:SetUnit("player")
|
||||
pfUI.uf.player.hp.bar.portrait:SetCamera(0)
|
||||
pfUI.uf.player.hp.bar.portrait:SetAlpha(0.10)
|
||||
end
|
||||
end
|
||||
|
||||
pfUI.uf.player.power = CreateFrame("Frame",nil, pfUI.uf.player)
|
||||
pfUI.uf.player.power:SetPoint("BOTTOM", 0, 0)
|
||||
pfUI.uf.player.power:SetWidth(pfUI_config.unitframes.player.width)
|
||||
@@ -309,6 +295,8 @@ pfUI:RegisterModule("player", function ()
|
||||
pfUI.uf.player.power.bar:SetAllPoints(pfUI.uf.player.power)
|
||||
pfUI.uf.player.power.bar:SetMinMaxValues(0, 100)
|
||||
|
||||
pfUI.uf:CreatePortrait(pfUI.uf.player, pfUI_config.unitframes.player.portrait, spacing)
|
||||
|
||||
if pfUI_config.unitframes.player.energy == "1" then
|
||||
pfUI.uf.player.power.tick = CreateFrame("Frame", nil, pfUI.uf.player.power.bar)
|
||||
pfUI.uf.player.power.tick:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
|
||||
+6
-21
@@ -7,7 +7,9 @@ pfUI:RegisterModule("target", function ()
|
||||
default_border = pfUI_config.appearance.border.unitframes
|
||||
end
|
||||
|
||||
-- Hide Blizzard target frame and unregister all events to prevent it from popping up again
|
||||
local spacing = pfUI_config.unitframes.target.pspace
|
||||
|
||||
-- Hide Blizzard target frame and unregister all events to prevent it from popping up again
|
||||
TargetFrame:Hide()
|
||||
TargetFrame:UnregisterAllEvents()
|
||||
|
||||
@@ -21,7 +23,7 @@ pfUI:RegisterModule("target", function ()
|
||||
pfUI.uf.target:SetFrameStrata("LOW")
|
||||
pfUI.uf.target:Hide()
|
||||
pfUI.uf.target:SetWidth(pfUI_config.unitframes.target.width)
|
||||
pfUI.uf.target:SetHeight(pfUI_config.unitframes.target.height + pfUI_config.unitframes.target.pheight + 2*default_border + pfUI_config.unitframes.target.pspace)
|
||||
pfUI.uf.target:SetHeight(pfUI_config.unitframes.target.height + pfUI_config.unitframes.target.pheight + 2*default_border + spacing)
|
||||
pfUI.uf.target:SetPoint("BOTTOMLEFT", UIParent, "BOTTOM", 75, 125)
|
||||
pfUI.api:UpdateMovable(pfUI.uf.target)
|
||||
pfUI.uf.target:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
|
||||
@@ -310,25 +312,6 @@ pfUI:RegisterModule("target", function ()
|
||||
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)
|
||||
pfUI.uf.target.hp.bar.portrait:RegisterEvent("UNIT_PORTRAIT_UPDATE")
|
||||
pfUI.uf.target.hp.bar.portrait:RegisterEvent("UNIT_MODEL_CHANGED")
|
||||
pfUI.uf.target.hp.bar.portrait:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
pfUI.uf.target.hp.bar.portrait:RegisterEvent("PLAYER_TARGET_CHANGED")
|
||||
|
||||
pfUI.uf.target.hp.bar.portrait:SetScript("OnEvent", function() this:Update() end)
|
||||
pfUI.uf.target.hp.bar.portrait:SetScript("OnShow", function() this:Update() end)
|
||||
|
||||
function pfUI.uf.target.hp.bar.portrait.Update()
|
||||
pfUI.uf.target.hp.bar.portrait:SetUnit("target")
|
||||
pfUI.uf.target.hp.bar.portrait:SetCamera(0)
|
||||
pfUI.uf.target.hp.bar.portrait:SetAlpha(0.10)
|
||||
end
|
||||
end
|
||||
|
||||
pfUI.uf.target.power = CreateFrame("Frame",nil, pfUI.uf.target)
|
||||
pfUI.uf.target.power:SetPoint("BOTTOM", 0, 0)
|
||||
pfUI.uf.target.power:SetWidth(pfUI_config.unitframes.target.width)
|
||||
@@ -340,6 +323,8 @@ pfUI:RegisterModule("target", function ()
|
||||
pfUI.uf.target.power.bar:SetAllPoints(pfUI.uf.target.power)
|
||||
pfUI.uf.target.power.bar:SetMinMaxValues(0, 100)
|
||||
|
||||
pfUI.uf:CreatePortrait(pfUI.uf.target, pfUI_config.unitframes.target.portrait, spacing)
|
||||
|
||||
pfUI.uf.target.hpText = pfUI.uf.target:CreateFontString("Status", "HIGH", "GameFontNormal")
|
||||
pfUI.uf.target.hpText:SetFont(pfUI.font_square, pfUI_config.global.font_size, "OUTLINE")
|
||||
pfUI.uf.target.hpText:ClearAllPoints()
|
||||
|
||||
@@ -7,6 +7,8 @@ pfUI:RegisterModule("targettarget", function ()
|
||||
default_border = pfUI_config.appearance.border.unitframes
|
||||
end
|
||||
|
||||
local spacing = pfUI_config.unitframes.ttarget.pspace
|
||||
|
||||
pfUI.uf.targettargetNotify = CreateFrame("Button",nil,UIParent)
|
||||
pfUI.uf.targettargetNotify:SetScript("OnUpdate", function()
|
||||
if UnitExists("targettarget") or (pfUI.gitter and pfUI.gitter:IsShown()) then
|
||||
@@ -21,7 +23,7 @@ pfUI:RegisterModule("targettarget", function ()
|
||||
pfUI.uf.targettarget.id = ""
|
||||
pfUI.uf.targettarget:SetFrameStrata("LOW")
|
||||
pfUI.uf.targettarget:SetWidth(100)
|
||||
pfUI.uf.targettarget:SetHeight(20 + 2*default_border + pfUI_config.unitframes.ttarget.pspace)
|
||||
pfUI.uf.targettarget:SetHeight(20 + 2*default_border + spacing)
|
||||
pfUI.uf.targettarget:SetPoint("BOTTOM", UIParent , "BOTTOM", 0, 125)
|
||||
pfUI.api:UpdateMovable(pfUI.uf.targettarget)
|
||||
|
||||
@@ -179,24 +181,6 @@ pfUI:RegisterModule("targettarget", function ()
|
||||
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)
|
||||
pfUI.uf.targettarget.hp.bar.portrait:RegisterEvent("UNIT_PORTRAIT_UPDATE")
|
||||
pfUI.uf.targettarget.hp.bar.portrait:RegisterEvent("UNIT_MODEL_CHANGED")
|
||||
pfUI.uf.targettarget.hp.bar.portrait:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
pfUI.uf.targettarget.hp.bar.portrait:RegisterEvent("PLAYER_TARGET_CHANGED")
|
||||
|
||||
pfUI.uf.targettarget.hp.bar.portrait:SetScript("OnEvent", function() this.Update() end)
|
||||
pfUI.uf.targettarget.hp.bar.portrait:SetScript("OnShow", function() this.Update() end)
|
||||
|
||||
function pfUI.uf.targettarget.hp.bar.portrait.Update()
|
||||
pfUI.uf.targettarget.hp.bar.portrait:SetUnit("targettarget")
|
||||
pfUI.uf.targettarget.hp.bar.portrait:SetCamera(0)
|
||||
pfUI.uf.targettarget.hp.bar.portrait:SetAlpha(0.10)
|
||||
end
|
||||
end
|
||||
|
||||
pfUI.uf.targettarget.power = CreateFrame("Frame",nil, pfUI.uf.targettarget)
|
||||
pfUI.api:CreateBackdrop(pfUI.uf.targettarget.power, default_border)
|
||||
pfUI.uf.targettarget.power:SetPoint("BOTTOM", 0, 0)
|
||||
@@ -208,6 +192,8 @@ pfUI:RegisterModule("targettarget", function ()
|
||||
pfUI.uf.targettarget.power.bar:SetAllPoints(pfUI.uf.targettarget.power)
|
||||
pfUI.uf.targettarget.power.bar:SetMinMaxValues(0, 100)
|
||||
|
||||
pfUI.uf:CreatePortrait(pfUI.uf.targettarget, pfUI_config.unitframes.ttarget.portrait, spacing)
|
||||
|
||||
pfUI.uf.targettarget.hp.text = pfUI.uf.targettarget.hp.bar:CreateFontString("Status", "LOW", "GameFontNormal")
|
||||
pfUI.uf.targettarget.hp.text:SetFont(pfUI.font_square, pfUI_config.global.font_size - 2, "OUTLINE")
|
||||
pfUI.uf.targettarget.hp.text:ClearAllPoints()
|
||||
|
||||
@@ -301,6 +301,101 @@ function pfUI.uf:RefreshUnit(unit)
|
||||
end
|
||||
end
|
||||
|
||||
function pfUI.uf:CreatePortrait(frame, pos, spacing)
|
||||
if not frame then return end
|
||||
if pos == "off" then return end
|
||||
|
||||
local default_border = pfUI_config.appearance.border.default
|
||||
if pfUI_config.appearance.border.unitframes ~= "-1" then
|
||||
default_border = pfUI_config.appearance.border.unitframes
|
||||
end
|
||||
|
||||
local unit = frame.label
|
||||
local id = frame.id or ""
|
||||
local unitstr = unit .. id
|
||||
|
||||
frame.portrait = CreateFrame("PlayerModel", "pfPortrait" .. unitstr, frame)
|
||||
frame.portrait:RegisterEvent("UNIT_PORTRAIT_UPDATE")
|
||||
frame.portrait:RegisterEvent("UNIT_MODEL_CHANGED")
|
||||
frame.portrait:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
frame.portrait:RegisterEvent("PLAYER_TARGET_CHANGED")
|
||||
|
||||
frame.portrait.base = frame
|
||||
|
||||
frame.portrait:SetScript("OnEvent", function()
|
||||
local unit = this.base.label
|
||||
local id = this.base.id or ""
|
||||
local unitstr = unit .. id
|
||||
|
||||
if event == "PLAYER_ENTERING_WORLD" or event == "PLAYER_TARGET_CHANGED" or ( arg1 and arg1 == unitstr ) then
|
||||
pfUI.uf:UpdatePortrait()
|
||||
end
|
||||
end)
|
||||
|
||||
frame.portrait:SetScript("OnShow", function()
|
||||
pfUI.uf:UpdatePortrait()
|
||||
end)
|
||||
|
||||
if unitstr == "targettarget" then
|
||||
frame.portrait:SetScript("OnUpdate", function()
|
||||
if not this.tick or this.tick < GetTime() then this.tick = GetTime() + 1 else return end
|
||||
pfUI.uf:UpdatePortrait()
|
||||
end)
|
||||
end
|
||||
|
||||
if pos == "bar" then
|
||||
frame.portrait:SetParent(frame.hp.bar)
|
||||
frame.portrait:SetAllPoints(frame.hp.bar)
|
||||
frame.portrait:SetAlpha(pfUI_config.unitframes.portraitalpha)
|
||||
elseif pos == "left" then
|
||||
frame.portrait:SetWidth(frame:GetHeight())
|
||||
frame.portrait:SetHeight(frame:GetHeight())
|
||||
frame:SetWidth(frame:GetWidth() + default_border*2 + spacing + frame.portrait:GetWidth())
|
||||
frame.portrait:SetPoint("LEFT", frame, "LEFT", 0, 0)
|
||||
|
||||
frame.hp:ClearAllPoints()
|
||||
frame.hp:SetPoint("TOPRIGHT", frame, "TOPRIGHT", 0, 0)
|
||||
frame.power:ClearAllPoints()
|
||||
frame.power:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", 0, 0)
|
||||
|
||||
pfUI.api:CreateBackdrop(frame.portrait)
|
||||
elseif pos == "right" then
|
||||
frame.portrait:SetWidth(frame:GetHeight())
|
||||
frame.portrait:SetHeight(frame:GetHeight())
|
||||
frame:SetWidth(frame:GetWidth() + default_border*2 + spacing + frame.portrait:GetWidth())
|
||||
frame.portrait:SetPoint("RIGHT", frame, "RIGHT", 0, 0)
|
||||
|
||||
frame.hp:ClearAllPoints()
|
||||
frame.hp:SetPoint("TOPLEFT", frame, "TOPLEFT", 0, 0)
|
||||
frame.power:ClearAllPoints()
|
||||
frame.power:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 0, 0)
|
||||
|
||||
pfUI.api:CreateBackdrop(frame.portrait)
|
||||
end
|
||||
end
|
||||
|
||||
function pfUI.uf:UpdatePortrait()
|
||||
local unit = this.base.label
|
||||
local id = this.base.id or ""
|
||||
local unitstr = unit .. id
|
||||
local name = UnitName(unitstr) or ""
|
||||
|
||||
if this.name then this:SetCamera(0) end
|
||||
|
||||
if this.name == name then return end
|
||||
|
||||
if not UnitIsVisible(unitstr) or not UnitIsConnected(unitstr) then
|
||||
this:SetModelScale(4.25)
|
||||
this:SetPosition(0, 0, -1.0)
|
||||
this:SetModel("Interface\\Buttons\\talktomequestionmark.mdx")
|
||||
this.name = nil
|
||||
else
|
||||
this:SetUnit(unitstr)
|
||||
this:SetCamera(0)
|
||||
this.name = name
|
||||
end
|
||||
end
|
||||
|
||||
function pfUI.uf:CreateUnit(unit)
|
||||
unit:RegisterEvent("UNIT_AURA")
|
||||
unit:RegisterEvent("UNIT_HEALTH")
|
||||
|
||||
Reference in New Issue
Block a user