diff --git a/img/pvp.tga b/img/pvp.tga new file mode 100644 index 00000000..088e00a1 Binary files /dev/null and b/img/pvp.tga differ diff --git a/modules/config.lua b/modules/config.lua index 0569d4fd..a6d16721 100644 --- a/modules/config.lua +++ b/modules/config.lua @@ -12,6 +12,8 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", "player", "width", "200") pfUI:UpdateConfig("unitframes", "player", "height", "50") pfUI:UpdateConfig("unitframes", "player", "pheight", "10") + pfUI:UpdateConfig("unitframes", "player", "showPVPMinimap", "0") + pfUI:UpdateConfig("unitframes", "player", "showPVP", "0") pfUI:UpdateConfig("unitframes", "target", "width", "200") pfUI:UpdateConfig("unitframes", "target", "height", "50") pfUI:UpdateConfig("unitframes", "target", "pheight", "10") diff --git a/modules/gui.lua b/modules/gui.lua index a166069c..abcfe2e8 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -513,6 +513,8 @@ pfUI:RegisterModule("gui", function () pfUI.gui:CreateConfig(pfUI.gui.uf, "Player width", pfUI_config.unitframes.player, "width") pfUI.gui:CreateConfig(pfUI.gui.uf, "Player height", pfUI_config.unitframes.player, "height") pfUI.gui:CreateConfig(pfUI.gui.uf, "Player powerbar height", pfUI_config.unitframes.player, "pheight") + 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, "Target width", pfUI_config.unitframes.target, "width") pfUI.gui:CreateConfig(pfUI.gui.uf, "Target height", pfUI_config.unitframes.target, "height") pfUI.gui:CreateConfig(pfUI.gui.uf, "Target powerbar height", pfUI_config.unitframes.target, "pheight") diff --git a/modules/player.lua b/modules/player.lua index 4ba67270..89e51791 100644 --- a/modules/player.lua +++ b/modules/player.lua @@ -42,12 +42,38 @@ pfUI:RegisterModule("player", function () 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:RegisterEvent("UPDATE_FACTION") pfUI.uf.player:SetScript("OnEvent", function() if ( event == "UNIT_DISPLAYPOWER" and arg1 and arg1 == "player" ) or event == "PLAYER_ENTERING_WORLD" then pfUI.uf.player.power.bar:SetValue(0) end + if event == "UPDATE_FACTION" then + if pfUI_config.unitframes.player.showPVP == "1" and UnitIsPVP("player") then + if pfUI.uf.player.pvpicon == nil then + pfUI.uf.player.pvpicon = CreateFrame("Frame", "pfPvPIcon", UIParent) + pfUI.uf.player.pvpicon:SetFrameStrata("HIGH") + pfUI.uf.player.pvpicon.texture = pfUI.uf.player.pvpicon:CreateTexture(nil,"DIALOG") + pfUI.uf.player.pvpicon.texture:SetTexture("Interface\\AddOns\\pfUI\\img\\pvp") + pfUI.uf.player.pvpicon.texture:SetAllPoints(pfUI.uf.player.pvpicon) + end + if pfUI_config.unitframes.player.showPVPMinimap == "1" then + pfUI.uf.player.pvpicon:SetWidth(16) + pfUI.uf.player.pvpicon:SetHeight(16) + pfUI.uf.player.pvpicon:SetParent(pfUI.minimap) + pfUI.uf.player.pvpicon:SetPoint("BOTTOMRIGHT", pfUI.minimap, "BOTTOMRIGHT", -5, 5) + else + pfUI.uf.player.pvpicon:SetWidth(10) + pfUI.uf.player.pvpicon:SetHeight(10) + pfUI.uf.player.pvpicon:SetParent(pfUI.uf.player.hp.bar) + pfUI.uf.player.pvpicon:SetPoint("CENTER", pfUI.uf.player, "BOTTOMLEFT", 0,0) + end + pfUI.uf.player.pvpicon:Show() + elseif pfUI.uf.player.pvpicon then + pfUI.uf.player.pvpicon:Hide() + end + end local raidIcon = GetRaidTargetIndex("player") if raidIcon then SetRaidTargetIconTexture(pfUI.uf.player.hp.raidIcon.texture, raidIcon) @@ -140,7 +166,7 @@ pfUI:RegisterModule("player", function () 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:SetPoint("CENTER", pfUI.uf.player.hp, "TOPLEFT", 0, 0) pfUI.uf.player.hp.leaderIcon:Hide() pfUI.uf.player.hp.lootIcon = CreateFrame("Frame",nil,pfUI.uf.player.hp) @@ -149,7 +175,7 @@ pfUI:RegisterModule("player", function () 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:SetPoint("CENTER", pfUI.uf.player.hp, "LEFT", 0, 0) pfUI.uf.player.hp.lootIcon:Hide() pfUI.uf.player.hp.raidIcon = CreateFrame("Frame",nil,pfUI.uf.player.hp)