mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-09 23:20:00 +00:00
Various cleanup
Removes version compatibility checks for TBC/Vanilla, consolidating code to target a single WoW version. Refactors repetitive SetWidth/SetHeight calls to SetSize for cleaner code. Removes duplicate function definitions from unitxp module and simplifies conditional show/hide operations using SetShown.
This commit is contained in:
@@ -64,6 +64,10 @@ end
|
||||
-- Requires UnitXP_SP3
|
||||
function pfUI.api.UnitInLineOfSight(unit1, unit2)
|
||||
if not pfUI.api.HasUnitXP() then return nil end
|
||||
if not unit2 then
|
||||
unit2 = unit1
|
||||
unit1 = "player"
|
||||
end
|
||||
local success, inSight = pcall(UnitXP, "inSight", unit1, unit2)
|
||||
if success then return inSight end
|
||||
return nil
|
||||
@@ -74,6 +78,10 @@ end
|
||||
-- Requires UnitXP_SP3
|
||||
function pfUI.api.UnitIsBehind(unit1, unit2)
|
||||
if not pfUI.api.HasUnitXP() then return nil end
|
||||
if not unit2 then
|
||||
unit2 = unit1
|
||||
unit1 = "player"
|
||||
end
|
||||
local success, behind = pcall(UnitXP, "behind", unit1, unit2)
|
||||
if success then return behind end
|
||||
return nil
|
||||
|
||||
@@ -331,26 +331,6 @@ pfUI:RegisterModule("unitxp", function ()
|
||||
return success and found
|
||||
end
|
||||
|
||||
pfUI.api.UnitInLineOfSight = function(unit1, unit2)
|
||||
if not unit2 then
|
||||
unit2 = unit1
|
||||
unit1 = "player"
|
||||
end
|
||||
local success, inSight = pcall(UnitXP, "inSight", unit1, unit2)
|
||||
if success then return inSight end
|
||||
return nil
|
||||
end
|
||||
|
||||
pfUI.api.UnitIsBehind = function(unit1, unit2)
|
||||
if not unit2 then
|
||||
unit2 = unit1
|
||||
unit1 = "player"
|
||||
end
|
||||
local success, behind = pcall(UnitXP, "behind", unit1, unit2)
|
||||
if success then return behind end
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Debug command to test UnitXP indicators
|
||||
pfUI.api.RegisterSlashCommand("PFUNITXP", { "/pfunitxp" }, function()
|
||||
local chat = DEFAULT_CHAT_FRAME
|
||||
|
||||
@@ -3,8 +3,7 @@ pfUI:RegisterModule("whisperproxy", function ()
|
||||
|
||||
local proxy = CreateFrame("Button", "pfWhisperProxy", pfUI.chat.left.panelTop)
|
||||
proxy:SetPoint("TOPRIGHT", pfUI.chat.left, "TOPRIGHT", -22, -5)
|
||||
proxy:SetWidth(12)
|
||||
proxy:SetHeight(12)
|
||||
proxy:SetSize(12, 12)
|
||||
proxy.tex = proxy:CreateTexture(nil, "OVERLAY")
|
||||
proxy.tex:SetAllPoints()
|
||||
proxy.tex:SetTexture(pfUI.media["img:proxy"])
|
||||
|
||||
+2
-10
@@ -183,11 +183,7 @@ end
|
||||
local self = self or this
|
||||
|
||||
if self.text_mouse == "1" then
|
||||
if MouseIsOver(self) then
|
||||
self.bar.text:Show()
|
||||
else
|
||||
self.bar.text:Hide()
|
||||
end
|
||||
self.bar.text:SetShown(MouseIsOver(self))
|
||||
end
|
||||
|
||||
if self.always then return end
|
||||
@@ -352,11 +348,7 @@ end
|
||||
b.bar.text:SetJustifyH("CENTER")
|
||||
b.bar.text:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE")
|
||||
|
||||
if b.text == "1" then
|
||||
b.bar.text:Show()
|
||||
else
|
||||
b.bar.text:Hide()
|
||||
end
|
||||
b.bar.text:SetShown(b.text == "1")
|
||||
|
||||
b.restedbar = b.restedbar or CreateFrame("StatusBar", nil, b)
|
||||
b.restedbar:SetStatusBarTexture(pfUI.media[C.panel.xp.texture])
|
||||
|
||||
@@ -2,15 +2,10 @@ pfUI:RegisterSkin("Auctionhouse", function ()
|
||||
local rawborder, border = GetBorderSize()
|
||||
local bpad = rawborder > 1 and border - GetPerfectPixel() or GetPerfectPixel()
|
||||
HookAddonOrVariable("Blizzard_AuctionUI", function()
|
||||
-- Compatibility
|
||||
if BrowseResetButton then -- tbc
|
||||
SkinButton(BrowseResetButton)
|
||||
else -- vanilla
|
||||
SkinArrowButton(BidPrevPageButton, "left", 18)
|
||||
SkinArrowButton(BidNextPageButton, "right", 18)
|
||||
SkinArrowButton(AuctionsPrevPageButton, "left", 18)
|
||||
SkinArrowButton(AuctionsNextPageButton, "right", 18)
|
||||
end
|
||||
SkinArrowButton(BidPrevPageButton, "left", 18)
|
||||
SkinArrowButton(BidNextPageButton, "right", 18)
|
||||
SkinArrowButton(AuctionsPrevPageButton, "left", 18)
|
||||
SkinArrowButton(AuctionsNextPageButton, "right", 18)
|
||||
|
||||
hooksecurefunc("AuctionFrame_OnShow", function()
|
||||
AuctionFrame:ClearAllPoints()
|
||||
|
||||
@@ -52,8 +52,7 @@ pfUI:RegisterSkin("Battlefield", function ()
|
||||
end)
|
||||
|
||||
BattlefieldFrame.textbox = CreateFrame("Frame", "BattlefieldFrameTextBox", BattlefieldFrame)
|
||||
BattlefieldFrame.textbox:SetWidth(320)
|
||||
BattlefieldFrame.textbox:SetHeight(110)
|
||||
BattlefieldFrame.textbox:SetSize(320, 110)
|
||||
CreateBackdrop(BattlefieldFrame.textbox)
|
||||
BattlefieldFrame.textbox:SetPoint("BOTTOM", BattlefieldFrame.backdrop, "BOTTOM", 0, 36)
|
||||
BattlefieldFrameZoneDescription:ClearAllPoints()
|
||||
|
||||
@@ -6,8 +6,7 @@ pfUI:RegisterSkin("Battlefield Minimap", function ()
|
||||
CreateBackdrop(BattlefieldMinimap, nil, nil, 0)
|
||||
CreateBackdropShadow(BattlefieldMinimap)
|
||||
|
||||
BattlefieldMinimap:SetWidth(220)
|
||||
BattlefieldMinimap:SetHeight(146)
|
||||
BattlefieldMinimap:SetSize(220, 146)
|
||||
|
||||
SkinCloseButton(BattlefieldMinimapCloseButton, BattlefieldMinimap, 0, 0)
|
||||
|
||||
|
||||
@@ -177,8 +177,7 @@ pfUI:RegisterSkin("Character", function ()
|
||||
|
||||
for i,c in pairs(magicResTextureCords) do
|
||||
local magicResFrame = _G["MagicResFrame"..i]
|
||||
magicResFrame:SetWidth(26)
|
||||
magicResFrame:SetHeight(26)
|
||||
magicResFrame:SetSize(26, 26)
|
||||
CreateBackdrop(magicResFrame)
|
||||
SetAllPointsOffset(magicResFrame.backdrop, magicResFrame, 2)
|
||||
local icon = GetNoNameObject(magicResFrame, "Texture", "BACKGROUND", "ResistanceIcons")
|
||||
@@ -236,8 +235,7 @@ pfUI:RegisterSkin("Character", function ()
|
||||
|
||||
for i,c in pairs(magicResTextureCords) do
|
||||
local magicResFrame = _G["PetMagicResFrame"..i]
|
||||
magicResFrame:SetWidth(26)
|
||||
magicResFrame:SetHeight(26)
|
||||
magicResFrame:SetSize(26, 26)
|
||||
CreateBackdrop(magicResFrame)
|
||||
SetAllPointsOffset(magicResFrame.backdrop, magicResFrame, 2)
|
||||
local icon = GetNoNameObject(magicResFrame, "Texture", "BACKGROUND", "ResistanceIcons")
|
||||
@@ -257,8 +255,7 @@ pfUI:RegisterSkin("Character", function ()
|
||||
|
||||
local war = _G["ReputationBar"..i.."AtWarCheck"]
|
||||
StripTextures(war)
|
||||
war:SetWidth(13)
|
||||
war:SetHeight(13)
|
||||
war:SetSize(13, 13)
|
||||
war:ClearAllPoints()
|
||||
war:SetPoint("LEFT", bar.backdrop, "RIGHT", 6, 0)
|
||||
war.icon = war:CreateTexture(nil, "OVERLAY")
|
||||
@@ -356,8 +353,7 @@ pfUI:RegisterSkin("Character", function ()
|
||||
SkillDetailStatusBar:SetParent(SkillDetailScrollFrame)
|
||||
|
||||
StripTextures(SkillDetailStatusBarUnlearnButton)
|
||||
SkillDetailStatusBarUnlearnButton:SetWidth(20)
|
||||
SkillDetailStatusBarUnlearnButton:SetHeight(20)
|
||||
SkillDetailStatusBarUnlearnButton:SetSize(20, 20)
|
||||
SkillDetailStatusBarUnlearnButton:SetHitRectInsets(0,0,0,0)
|
||||
SkillDetailStatusBarUnlearnButton:ClearAllPoints()
|
||||
SkillDetailStatusBarUnlearnButton:SetPoint("LEFT", SkillDetailStatusBar, "RIGHT", 6, 0)
|
||||
|
||||
@@ -167,12 +167,10 @@ pfUI:RegisterSkin("Turtle LFT", function ()
|
||||
local sep = LFTGroupReadyFrame:CreateTexture(nil, "ARTWORK")
|
||||
sep:SetTexture("Interface\\FrameXML\\LFT\\images\\ui-lfg-separator")
|
||||
sep:SetPoint("TOPLEFT", LFTGroupReadyFrame, "TOPLEFT", 10, -125)
|
||||
sep:SetWidth(288)
|
||||
sep:SetHeight(16)
|
||||
sep:SetSize(288, 16)
|
||||
|
||||
-- Restore role icon (updated dynamically by LFT_GroupReadyShow)
|
||||
LFTGroupReadyFrameRoleTexture:SetWidth(56)
|
||||
LFTGroupReadyFrameRoleTexture:SetHeight(56)
|
||||
LFTGroupReadyFrameRoleTexture:SetSize(56, 56)
|
||||
LFTGroupReadyFrameRoleTexture:ClearAllPoints()
|
||||
LFTGroupReadyFrameRoleTexture:SetPoint("LEFT", LFTGroupReadyFrame, "LEFT", 20, -20)
|
||||
LFTGroupReadyFrameRoleTexture:Show()
|
||||
|
||||
@@ -6,31 +6,15 @@ pfUI:RegisterSkin("Quest Log", function ()
|
||||
_G.MAX_WATCHABLE_QUESTS = 20 -- TODO
|
||||
|
||||
do -- quest log frame
|
||||
-- Compatibility
|
||||
local QUEST_COUNT
|
||||
if QuestLogCount then -- tbc
|
||||
QUEST_COUNT = QuestLogCount
|
||||
|
||||
StripTextures(QUEST_COUNT)
|
||||
QUEST_COUNT:ClearAllPoints()
|
||||
hooksecurefunc("QuestLogUpdateQuestCount", function(numQuests)
|
||||
QUEST_COUNT:ClearAllPoints()
|
||||
QUEST_COUNT:SetPoint("BOTTOMRIGHT", QuestLogFrame, "TOPRIGHT", 0, -50)
|
||||
end)
|
||||
else -- vanilla
|
||||
QUEST_COUNT = QuestLogQuestCount
|
||||
|
||||
QUEST_COUNT:ClearAllPoints()
|
||||
QUEST_COUNT:SetPoint("TOPRIGHT", -10, -30)
|
||||
end
|
||||
QuestLogQuestCount:ClearAllPoints()
|
||||
QuestLogQuestCount:SetPoint("TOPRIGHT", -10, -30)
|
||||
|
||||
hooksecurefunc("QuestLog_OnShow", function()
|
||||
QuestLogFrame:ClearAllPoints()
|
||||
QuestLogFrame:SetPoint("TOPLEFT", 10, -104)
|
||||
end)
|
||||
|
||||
QuestLogFrame:SetWidth(676)
|
||||
QuestLogFrame:SetHeight(440)
|
||||
QuestLogFrame:SetSize(676, 440)
|
||||
QuestLogFrame:DisableDrawLayer("BACKGROUND")
|
||||
|
||||
StripTextures(QuestLogFrame, true)
|
||||
@@ -64,10 +48,9 @@ pfUI:RegisterSkin("Quest Log", function ()
|
||||
QuestLogFrameLevelsCheckButtonText:SetText(T["Quest Levels"])
|
||||
|
||||
CreateBackdrop(QuestLogTrack)
|
||||
QuestLogTrack:SetHeight(8)
|
||||
QuestLogTrack:SetWidth(8)
|
||||
QuestLogTrack:SetSize(8, 8)
|
||||
QuestLogTrack:ClearAllPoints()
|
||||
QuestLogTrack:SetPoint("RIGHT", QUEST_COUNT, "LEFT", -5, 0)
|
||||
QuestLogTrack:SetPoint("RIGHT", QuestLogQuestCount, "LEFT", -5, 0)
|
||||
|
||||
StripTextures(QuestLogTrack)
|
||||
QuestLogTrackTracking:SetTexture(.8,.8,.8,1)
|
||||
@@ -228,8 +211,7 @@ pfUI:RegisterSkin("Quest Log", function ()
|
||||
SetAllPointsOffset(item.backdrop, item, 4)
|
||||
SetHighlight(item)
|
||||
|
||||
icon:SetWidth(ysize)
|
||||
icon:SetHeight(ysize)
|
||||
icon:SetSize(ysize, ysize)
|
||||
icon:ClearAllPoints()
|
||||
icon:SetPoint("LEFT", 6, 0)
|
||||
icon:SetTexCoord(.08, .92, .08, .92)
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
pfUI:RegisterSkin("Readycheck", function ()
|
||||
HookAddonOrVariable("Blizzard_RaidUI", function()
|
||||
-- Compatibility
|
||||
local update_func
|
||||
if ReadyCheckFrame_OnUpdate then -- tbc
|
||||
update_func = "ReadyCheckFrame_OnUpdate"
|
||||
else -- vanilla
|
||||
update_func = "ReadyCheck_OnUpdate"
|
||||
end
|
||||
|
||||
StripTextures(ReadyCheckFrame, true)
|
||||
CreateBackdrop(ReadyCheckFrame, nil, nil, .75)
|
||||
CreateBackdropShadow(ReadyCheckFrame)
|
||||
@@ -25,8 +17,7 @@ pfUI:RegisterSkin("Readycheck", function ()
|
||||
|
||||
local frame = CreateFrame("Button", nil, ReadyCheckFrame)
|
||||
frame:SetPoint("TOP", ReadyCheckFrameText, "BOTTOM", 0, -6)
|
||||
frame:SetWidth(220)
|
||||
frame:SetHeight(10)
|
||||
frame:SetSize(220, 10)
|
||||
|
||||
frame.bar = CreateFrame("StatusBar", "ReadyCheckFrameStatusBar", ReadyCheckFrame)
|
||||
frame.bar:SetStatusBarTexture(pfUI.media["img:bar"])
|
||||
@@ -35,7 +26,7 @@ pfUI:RegisterSkin("Readycheck", function ()
|
||||
frame.bar.text = frame.bar:CreateFontString("Status", "DIALOG", "GameFontNormal")
|
||||
frame.bar.text:SetFontObject(GameFontWhite)
|
||||
frame.bar.text:SetFont(pfUI.font_default, 12, "OUTLINE")
|
||||
frame.bar.text:SetPoint("CENTER", 0, 0)
|
||||
frame.bar.text:SetPoint("CENTER")
|
||||
|
||||
local max
|
||||
hooksecurefunc("ShowReadyCheck", function()
|
||||
@@ -43,7 +34,7 @@ pfUI:RegisterSkin("Readycheck", function ()
|
||||
frame.bar:SetMinMaxValues(0, max)
|
||||
end)
|
||||
|
||||
hooksecurefunc(update_func, function()
|
||||
hooksecurefunc("ReadyCheck_OnUpdate", function()
|
||||
if not ReadyCheckFrame.timer then return end
|
||||
|
||||
local perc = ReadyCheckFrame.timer/max
|
||||
|
||||
@@ -4,14 +4,7 @@ pfUI:RegisterSkin("Talents", function ()
|
||||
|
||||
HookAddonOrVariable("Blizzard_TalentUI", function()
|
||||
-- Compatibility
|
||||
local TALENT_FRAME, TALENT_FRAME_NAME
|
||||
if PlayerTalentFrame then -- tbc
|
||||
TALENT_FRAME = _G.PlayerTalentFrame
|
||||
else -- vanilla
|
||||
TALENT_FRAME = _G.TalentFrame
|
||||
end
|
||||
TALENT_FRAME_NAME = TALENT_FRAME:GetName()
|
||||
|
||||
local TALENT_FRAME, TALENT_FRAME_NAME = _G.TalentFrame, _G.TalentFrame:GetName()
|
||||
|
||||
StripTextures(TALENT_FRAME)
|
||||
CreateBackdrop(TALENT_FRAME, nil, nil, .75)
|
||||
|
||||
Reference in New Issue
Block a user