forked from brues/pfUI
- Replace 42 pfUI keys whose English text matches a stock 1.12.1 or ClassicAPI global (YES, NO, NONE, SEARCH, TARGET, MINIMAP_LABEL, ...) with the global; they come translated by the client in every locale. Same for UNKNOWN, FACTION_ALLIANCE/HORDE and the ADDON_MEM_* / TOTAL_MEM_* formats. Drop those keys from all 8 locale files. - Rename the tooltip position key "Dodge" to "Above Right Chat" and fix the esES/frFR/ruRU values that translated it literally. - bgscore: clear the frame and mover anchors before applying the saved position, drop the unused pfUI.unlock.frames registration, and localize the "position saved" message. All 8 locale files hold the same 1076 keys the code uses.
57 lines
2.2 KiB
Lua
57 lines
2.2 KiB
Lua
pfUI:RegisterModule("bgscore", function ()
|
|
local bgframe = WorldStateAlwaysUpFrame
|
|
if not bgframe then
|
|
bgframe = CreateFrame("Frame", "WorldStateAlwaysUpFrame", UIParent)
|
|
bgframe:SetSize(200, 25)
|
|
bgframe:SetPoint("TOP", UIParent, "TOP", 0, -100)
|
|
end
|
|
|
|
local mover = CreateFrame("Frame", "pfUIBGScoreMover", UIParent)
|
|
mover:SetSize(220, 30)
|
|
mover:SetPoint("TOP", UIParent, "TOP", 0, -100)
|
|
mover:SetFrameStrata("DIALOG")
|
|
mover:SetMovable(true)
|
|
mover:EnableMouse(true)
|
|
mover:RegisterForDrag("LeftButton")
|
|
mover:SetScript("OnDragStart", function() mover:StartMoving() end)
|
|
mover:SetScript("OnDragStop", function()
|
|
mover:StopMovingOrSizing()
|
|
local x = mover:GetLeft()
|
|
local y = mover:GetTop()
|
|
pfUI_config = pfUI_config or {}
|
|
pfUI_config.positions = pfUI_config.positions or {}
|
|
pfUI_config.positions["WorldStateAlwaysUpFrame"] = { x = x, y = y }
|
|
bgframe:ClearAllPoints()
|
|
bgframe:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", x, y)
|
|
DEFAULT_CHAT_FRAME:AddMessage(T["|cff33ffccBG Score Frame|r position saved."])
|
|
end)
|
|
mover:Hide()
|
|
|
|
pfUI.api.CreateBackdrop(mover, nil, nil, .8)
|
|
|
|
-- Title label
|
|
local title = mover:CreateFontString(nil, "OVERLAY")
|
|
title:SetFont("Fonts\\FRIZQT__.TTF", 14, "OUTLINE")
|
|
title:SetText(T["Battleground Frames"])
|
|
title:SetPoint("TOP", mover, "TOP", 0, -2)
|
|
|
|
-- BG score preview text
|
|
local bgscore = mover:CreateFontString(nil, "OVERLAY")
|
|
bgscore:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
|
|
bgscore:SetText(format("|cff3399ff%s: 123|r | |cffff4444%s: 456|r", FACTION_ALLIANCE, FACTION_HORDE))
|
|
bgscore:SetPoint("BOTTOM", mover, "BOTTOM", 0, 2)
|
|
|
|
local pos = pfUI_config and pfUI_config.positions and pfUI_config.positions["WorldStateAlwaysUpFrame"]
|
|
if pos then
|
|
bgframe:ClearAllPoints()
|
|
bgframe:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", pos.x, pos.y)
|
|
mover:ClearAllPoints()
|
|
mover:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", pos.x, pos.y)
|
|
end
|
|
|
|
local origShow = pfUI.unlock.Show
|
|
local origHide = pfUI.unlock.Hide
|
|
pfUI.unlock.Show = function(self) origShow(self); mover:Show() end
|
|
pfUI.unlock.Hide = function(self) origHide(self); mover:Hide(); bgframe:Show() end
|
|
end)
|