Delete core directory

This commit is contained in:
Wurmschwanz
2026-08-14 14:47:34 +02:00
committed by GitHub
parent 326e5d83ea
commit ce312cc1c1
7 changed files with 0 additions and 792 deletions
-10
View File
@@ -1,10 +0,0 @@
BNP = BNP or {}
function BNP:RegisterPlate(plate)
plate = plate or this
if not plate then return end
if BNP.plates[plate] then return end
BNP.plates[plate] = true
BNP.detected = BNP.detected + 1
end
-94
View File
@@ -1,94 +0,0 @@
BNP = BNP or {}
-- Robust ShaguTweaks compatibility.
-- BNP owns Scale / Class Colors / Castbar while loaded.
-- ShaguTweaks settings are NOT changed.
BNP.shaguCompat = BNP.shaguCompat or {
patched = {},
registerHooked = false,
}
local wanted = {
["Nameplate Scale"] = true,
["Nameplate Class Colors"] = true,
["Nameplate Castbar"] = true,
}
local function IsWantedTitle(title)
if not title then return false end
if wanted[title] then return true end
if ShaguTweaks and ShaguTweaks.T then
if title == ShaguTweaks.T["Nameplate Scale"] then return true end
if title == ShaguTweaks.T["Nameplate Class Colors"] then return true end
if title == ShaguTweaks.T["Nameplate Castbar"] then return true end
end
return false
end
local function DisableModule(mod)
if not mod or type(mod) ~= "table" then return false end
if not IsWantedTitle(mod.title) then return false end
if mod.BNPCompatibilityPatched then return true end
mod.BNPOriginalEnable = mod.enable
mod.enable = function(self)
return
end
mod.BNPCompatibilityPatched = true
BNP.shaguCompat.patched[mod.title or "?"] = true
return true
end
local function PatchExistingModules()
if not ShaguTweaks or not ShaguTweaks.mods then return end
local title, mod
for title, mod in pairs(ShaguTweaks.mods) do
-- Some registered module tables use localized title as the map key.
if mod and not mod.title then mod.title = title end
DisableModule(mod)
end
end
local function HookRegister()
if not ShaguTweaks or not ShaguTweaks.register then return end
if BNP.shaguCompat.registerHooked then return end
local originalRegister = ShaguTweaks.register
ShaguTweaks.register = function(self, mod)
local registered = originalRegister(self, mod)
DisableModule(registered or mod)
return registered
end
BNP.shaguCompat.registerHooked = true
end
function BNP:ApplyShaguTweaksCompatibility()
if not ShaguTweaks then return false end
-- Covers BNP loading before Shagu's modules register.
HookRegister()
-- Covers BNP loading after Shagu's modules registered.
PatchExistingModules()
return true
end
-- Try immediately in case ShaguTweaks is already loaded.
BNP:ApplyShaguTweaksCompatibility()
-- Also retry after every addon load. This safely covers all Vanilla/Turtle
-- load-order variations without touching ShaguTweaks saved settings.
local loader = CreateFrame("Frame")
loader:RegisterEvent("ADDON_LOADED")
loader:SetScript("OnEvent", function()
BNP:ApplyShaguTweaksCompatibility()
end)
-104
View File
@@ -1,104 +0,0 @@
BNP = BNP or {}
BNP.defaults = BNP.defaults or {
nameplateScale = 1.0,
iconSize = 18,
tankMode = false,
classColors = true,
castbars = true,
castbarHeight = 6,
minimapAngle = 225,
healthPercent = false,
healthText = "off",
targetFocus = true,
targetGlowColor = "white",
targetOnTop = true,
}
function BNP:InitConfig()
BNP_DB = BNP_DB or {}
if BNP_DB.nameplateScale == nil then BNP_DB.nameplateScale = self.defaults.nameplateScale end
if BNP_DB.iconSize == nil then BNP_DB.iconSize = self.defaults.iconSize end
if BNP_DB.tankMode == nil then BNP_DB.tankMode = self.defaults.tankMode end
if BNP_DB.classColors == nil then BNP_DB.classColors = self.defaults.classColors end
if BNP_DB.castbars == nil then BNP_DB.castbars = self.defaults.castbars end
if BNP_DB.castbarHeight == nil then BNP_DB.castbarHeight = self.defaults.castbarHeight end
if BNP_DB.minimapAngle == nil then BNP_DB.minimapAngle = self.defaults.minimapAngle end
if BNP_DB.healthPercent == nil then BNP_DB.healthPercent = self.defaults.healthPercent end
if BNP_DB.healthText == nil then
-- Backwards-compatible migration from the old Health % checkbox.
BNP_DB.healthText = BNP_DB.healthPercent and "percent" or self.defaults.healthText
end
if BNP_DB.targetFocus == nil then BNP_DB.targetFocus = self.defaults.targetFocus end
if BNP_DB.targetGlowColor == nil then BNP_DB.targetGlowColor = self.defaults.targetGlowColor end
if BNP_DB.targetOnTop == nil then BNP_DB.targetOnTop = self.defaults.targetOnTop end
end
function BNP:GetNameplateScale()
return (BNP_DB and tonumber(BNP_DB.nameplateScale)) or self.defaults.nameplateScale
end
function BNP:GetIconSize()
return (BNP_DB and tonumber(BNP_DB.iconSize)) or self.defaults.iconSize
end
function BNP:IsTankModeEnabled()
return BNP_DB and BNP_DB.tankMode and true or false
end
function BNP:AreClassColorsEnabled()
return not BNP_DB or BNP_DB.classColors ~= false
end
function BNP:AreCastbarsEnabled()
return not BNP_DB or BNP_DB.castbars ~= false
end
function BNP:GetCastbarHeight()
local value = (BNP_DB and tonumber(BNP_DB.castbarHeight)) or self.defaults.castbarHeight
if value < 4 then value = 4 end
if value > 14 then value = 14 end
return value
end
function BNP:GetHealthTextMode()
local mode = (BNP_DB and BNP_DB.healthText) or self.defaults.healthText or "off"
if mode ~= "off" and mode ~= "percent" and mode ~= "hp" and mode ~= "both" then
mode = "off"
end
return mode
end
function BNP:IsHealthPercentEnabled()
local mode = self:GetHealthTextMode()
return mode == "percent" or mode == "both"
end
function BNP:IsHealthTextEnabled()
return self:GetHealthTextMode() ~= "off"
end
function BNP:IsTargetFocusEnabled()
return not BNP_DB or BNP_DB.targetFocus ~= false
end
function BNP:IsTargetOnTopEnabled()
return not BNP_DB or BNP_DB.targetOnTop ~= false
end
function BNP:GetTargetGlowColor()
local key = (BNP_DB and BNP_DB.targetGlowColor) or self.defaults.targetGlowColor or "white"
local colors = {
white = { 1.00, 1.00, 1.00 },
gold = { 1.00, 0.82, 0.10 },
blue = { 0.25, 0.55, 1.00 },
green = { 0.25, 1.00, 0.35 },
red = { 1.00, 0.20, 0.20 },
purple = { 0.75, 0.35, 1.00 },
}
local c = colors[key] or colors.white
return c[1], c[2], c[3], key
end
-37
View File
@@ -1,37 +0,0 @@
BNP = BNP or {}
BNP.version = "1.0.5"
BNP.plates = BNP.plates or {}
BNP.detected = 0
BNP.debugEnabled = false
function BNP:Print(msg)
if DEFAULT_CHAT_FRAME then
DEFAULT_CHAT_FRAME:AddMessage("|cff33ff99Blizz Nameplates+:|r " .. tostring(msg))
end
end
local eventFrame = CreateFrame("Frame")
eventFrame:RegisterEvent("VARIABLES_LOADED")
eventFrame:SetScript("OnEvent", function()
BNP_DB = BNP_DB or {}
if BNP.InitConfig then BNP:InitConfig() end
if BNP.CreateMinimapButton then BNP:CreateMinimapButton() end
if BNP.InstallTankMode then BNP:InstallTankMode() end
if BNP_DB.debugEnabled == nil then BNP_DB.debugEnabled = false end
BNP.debugEnabled = BNP_DB.debugEnabled
if CombatLogAdd and SpellInfo then
BNP:Print(BNP.version .. " loaded. Standalone nameplates + SuperWoW tracking active.")
if ShaguTweaks then
BNP:ApplyShaguTweaksCompatibility()
local count = 0
local k
for k in pairs(BNP.shaguCompat.patched or {}) do count = count + 1 end
BNP:Print("ShaguTweaks compatibility active (" .. tostring(count) .. "/3 nameplate modules suppressed).")
end
else
BNP:Print("ERROR: SuperWoW API not detected. Blizz Nameplates+ requires SuperWoW.")
end
end)
-119
View File
@@ -1,119 +0,0 @@
BNP = BNP or {}
BNP.libnameplate = BNP.libnameplate or {
OnInit = {},
OnShow = {},
OnUpdate = {},
}
local lib = BNP.libnameplate
local known = {}
local initializedChildren = 0
local function IsNamePlate(frame)
if not frame or not frame.GetObjectType then return false end
if frame:GetObjectType() ~= "Button" then return false end
local firstRegion = frame:GetRegions()
if not firstRegion or not firstRegion.GetObjectType or not firstRegion.GetTexture then
return false
end
if firstRegion:GetObjectType() ~= "Texture" then return false end
return firstRegion:GetTexture() == "Interface\\Tooltips\\Nameplate-Border"
end
local function AttachPlateShortcuts(plate)
if plate.BNPShortcutsReady then return end
-- Vanilla Blizzard nameplates expose the health StatusBar as their first child.
local healthbar = plate:GetChildren()
plate.healthbar = healthbar
-- Vanilla region order:
-- 1 border, 2 glow, 3 name, 4 level, 5 level icon, 6 raid icon.
local regions = { plate:GetRegions() }
plate.border = regions[1]
plate.glow = regions[2]
plate.name = regions[3]
plate.level = regions[4]
plate.levelicon = regions[5]
plate.raidicon = regions[6]
plate.BNPShortcutsReady = true
end
local function Fire(list, plate)
plate = plate or this
if not plate then return end
local i
for i = 1, table.getn(list) do
if list[i] then
pcall(list[i], plate)
end
end
end
local function RegisterPlate(plate)
plate = plate or this
if not plate then return end
if known[plate] then return end
known[plate] = true
AttachPlateShortcuts(plate)
if BNP.RegisterPlate then
BNP:RegisterPlate(plate)
end
Fire(lib.OnInit, plate)
if plate:IsShown() then
Fire(lib.OnShow, plate)
end
-- Run OnShow callbacks when Blizzard reuses the same plate.
local oldOnShow = plate:GetScript("OnShow")
plate:SetScript("OnShow", function(self)
local current = self or this or plate
if not current then return end
if oldOnShow then oldOnShow(current) end
AttachPlateShortcuts(current)
Fire(lib.OnShow, current)
end)
end
local scanner = CreateFrame("Frame")
local scanElapsed = 0
scanner:SetScript("OnUpdate", function()
scanElapsed = scanElapsed + arg1
if scanElapsed < 0.10 then return end
scanElapsed = 0
local count = WorldFrame:GetNumChildren()
-- Full scan only when WorldFrame gained children. This mirrors the lightweight
-- discovery strategy used by Shagu's Vanilla nameplate code.
if count > initializedChildren then
local children = { WorldFrame:GetChildren() }
local i
for i = 1, table.getn(children) do
local frame = children[i]
if not known[frame] and IsNamePlate(frame) then
RegisterPlate(frame)
end
end
initializedChildren = count
end
-- Compatibility callback list for modules that want a throttled plate update.
if table.getn(lib.OnUpdate) > 0 then
local plate
for plate in pairs(known) do
if plate:IsShown() then
Fire(lib.OnUpdate, plate)
end
end
end
end)
-413
View File
@@ -1,413 +0,0 @@
BNP = BNP or {}
local function Round(value, step)
return math.floor((value / step) + 0.5) * step
end
local sliderCount = 0
local function CreateSlider(parent, label, minValue, maxValue, step, y)
sliderCount = sliderCount + 1
local slider = CreateFrame("Slider", "BNPOptionsSlider" .. sliderCount, parent, "OptionsSliderTemplate")
slider:SetPoint("TOPLEFT", parent, "TOPLEFT", 28, y)
slider:SetWidth(220)
slider:SetHeight(16)
slider:SetMinMaxValues(minValue, maxValue)
slider:SetValueStep(step)
getglobal(slider:GetName() .. "Low"):SetText(tostring(minValue))
getglobal(slider:GetName() .. "High"):SetText(tostring(maxValue))
getglobal(slider:GetName() .. "Text"):SetText(label)
return slider
end
local function CreateCheck(parent, label, y, onclick)
local check = CreateFrame("CheckButton", nil, parent, "UICheckButtonTemplate")
check:SetPoint("TOPLEFT", parent, "TOPLEFT", 22, y)
check:SetWidth(24)
check:SetHeight(24)
local text = parent:CreateFontString(nil, "OVERLAY", "GameFontNormal")
text:SetPoint("LEFT", check, "RIGHT", 4, 0)
text:SetText(label)
check:SetScript("OnClick", onclick)
return check
end
function BNP:CreateOptions()
if self.optionsFrame then return end
local frame = CreateFrame("Frame", "BNPOptionsFrame", UIParent)
frame:SetWidth(290)
frame:SetHeight(575)
frame:SetPoint("CENTER", UIParent, "CENTER", 0, 80)
frame:SetFrameStrata("DIALOG")
frame:SetBackdrop({
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
tile = true, tileSize = 32, edgeSize = 32,
insets = { left = 11, right = 12, top = 12, bottom = 11 }
})
frame:SetMovable(true)
frame:EnableMouse(true)
frame:RegisterForDrag("LeftButton")
frame:SetScript("OnDragStart", function() this:StartMoving() end)
frame:SetScript("OnDragStop", function() this:StopMovingOrSizing() end)
frame:Hide()
local title = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge")
title:SetPoint("TOP", frame, "TOP", 0, -18)
title:SetText("Blizz Nameplates+")
local version = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
version:SetPoint("TOP", title, "BOTTOM", 0, -4)
version:SetText("Version " .. tostring(BNP.version or "?"))
frame.versionText = version
local close = CreateFrame("Button", nil, frame, "UIPanelCloseButton")
close:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -5, -5)
local scale = CreateSlider(frame, "Nameplate Scale", 0.70, 1.50, 0.05, -78)
scale:SetScript("OnValueChanged", function()
if not BNP_DB then return end
local value = Round(this:GetValue(), 0.05)
BNP_DB.nameplateScale = value
getglobal(this:GetName() .. "Text"):SetText("Nameplate Scale: " .. string.format("%.2f", value))
if BNP.ApplyNameplateScaleAll then BNP:ApplyNameplateScaleAll() end
end)
frame.scaleSlider = scale
local icon = CreateSlider(frame, "Debuff Icon Size", 12, 32, 1, -133)
icon:SetScript("OnValueChanged", function()
if not BNP_DB then return end
local value = math.floor(this:GetValue() + 0.5)
BNP_DB.iconSize = value
getglobal(this:GetName() .. "Text"):SetText("Debuff Icon Size: " .. value)
if BNP.RefreshAllAuraLayouts then BNP:RefreshAllAuraLayouts() end
end)
frame.iconSlider = icon
local castbarHeight = CreateSlider(frame, "Castbar Height", 4, 14, 1, -188)
castbarHeight:SetScript("OnValueChanged", function()
if not BNP_DB then return end
local value = math.floor(this:GetValue() + 0.5)
BNP_DB.castbarHeight = value
getglobal(this:GetName() .. "Text"):SetText("Castbar Height: " .. value)
if BNP.RefreshCastbarHeights then BNP:RefreshCastbarHeights() end
end)
frame.castbarHeightSlider = castbarHeight
local classColors = CreateCheck(frame, "Class Colors", -226, function()
BNP_DB.classColors = this:GetChecked() and true or false
if BNP_DB.classColors then
local plate
for plate in pairs(BNP.plates or {}) do
plate.BNPClassColorApplied = nil
plate.BNPClassR = nil
plate.BNPClassG = nil
plate.BNPClassB = nil
end
end
end)
frame.classColorsCheck = classColors
local castbars = CreateCheck(frame, "Castbars", -256, function()
local enabled = this:GetChecked() and true or false
if BNP.SetCastbarsEnabled then
BNP:SetCastbarsEnabled(enabled)
else
BNP_DB.castbars = enabled
end
end)
frame.castbarsCheck = castbars
local tank = CreateCheck(frame, "Tank Mode", -286, function()
BNP_DB.tankMode = this:GetChecked() and true or false
if BNP.UpdateTankMode then BNP:UpdateTankMode() end
end)
frame.tankCheck = tank
local healthTextLabel = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
healthTextLabel:SetPoint("TOPLEFT", frame, "TOPLEFT", 28, -318)
healthTextLabel:SetText("Health Text")
local healthTextDropdown = CreateFrame("Frame", "BNPHealthTextDropdown", frame, "UIDropDownMenuTemplate")
healthTextDropdown:SetPoint("TOPLEFT", frame, "TOPLEFT", 10, -330)
UIDropDownMenu_SetWidth(150, healthTextDropdown)
local healthModeLabels = {
off = "Off",
percent = "Percent",
hp = "HP",
both = "HP + Percent",
}
local function SetHealthTextMode(mode)
if not healthModeLabels[mode] then mode = "off" end
BNP_DB.healthText = mode
-- Keep the legacy setting synchronized for backwards compatibility.
BNP_DB.healthPercent = (mode == "percent" or mode == "both")
UIDropDownMenu_SetSelectedValue(healthTextDropdown, mode)
UIDropDownMenu_SetText(healthModeLabels[mode], healthTextDropdown)
if BNP.RefreshHealthPercent then BNP:RefreshHealthPercent() end
end
UIDropDownMenu_Initialize(healthTextDropdown, function()
local modes = { "off", "percent", "hp", "both" }
local i
for i = 1, table.getn(modes) do
local mode = modes[i]
local info = {}
info.text = healthModeLabels[mode]
info.value = mode
info.func = function()
SetHealthTextMode(this.value)
end
info.checked = (BNP:GetHealthTextMode() == mode)
UIDropDownMenu_AddButton(info)
end
end)
frame.healthTextDropdown = healthTextDropdown
frame.SetHealthTextMode = SetHealthTextMode
local targetFocus = CreateCheck(frame, "Target Glow", -374, function()
BNP_DB.targetFocus = this:GetChecked() and true or false
if BNP.RefreshTargetFocus then BNP:RefreshTargetFocus() end
end)
frame.targetFocusCheck = targetFocus
local glowColorLabel = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
glowColorLabel:SetPoint("TOPLEFT", frame, "TOPLEFT", 28, -406)
glowColorLabel:SetText("Target Glow Color")
local glowColorDropdown = CreateFrame("Frame", "BNPTargetGlowColorDropdown", frame, "UIDropDownMenuTemplate")
glowColorDropdown:SetPoint("TOPLEFT", frame, "TOPLEFT", 10, -418)
UIDropDownMenu_SetWidth(150, glowColorDropdown)
local glowColorLabels = {
white = "White",
gold = "Gold",
blue = "Blue",
green = "Green",
red = "Red",
purple = "Purple",
}
local function SetTargetGlowColor(color)
if not glowColorLabels[color] then color = "white" end
BNP_DB.targetGlowColor = color
UIDropDownMenu_SetSelectedValue(glowColorDropdown, color)
UIDropDownMenu_SetText(glowColorLabels[color], glowColorDropdown)
if BNP.RefreshTargetFocus then BNP:RefreshTargetFocus() end
end
UIDropDownMenu_Initialize(glowColorDropdown, function()
local colors = { "white", "gold", "blue", "green", "red", "purple" }
local i
for i = 1, table.getn(colors) do
local color = colors[i]
local info = {}
info.text = glowColorLabels[color]
info.value = color
info.func = function()
SetTargetGlowColor(this.value)
end
info.checked = ((BNP_DB and BNP_DB.targetGlowColor) or "white") == color
UIDropDownMenu_AddButton(info)
end
end)
frame.glowColorDropdown = glowColorDropdown
frame.SetTargetGlowColor = SetTargetGlowColor
local targetOnTop = CreateCheck(frame, "Target Plate on Top", -462, function()
BNP_DB.targetOnTop = this:GetChecked() and true or false
if BNP.RefreshTargetOnTop then BNP:RefreshTargetOnTop() end
end)
frame.targetOnTopCheck = targetOnTop
local note = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
note:SetPoint("TOPLEFT", frame, "TOPLEFT", 28, -502)
note:SetWidth(235)
note:SetJustifyH("LEFT")
note:SetText("Changes are applied immediately.\nTank Mode: green = targeting you, red = targeting someone else.")
self.optionsFrame = frame
end
function BNP:SyncOptions()
self:CreateOptions()
local frame = self.optionsFrame
frame.scaleSlider:SetValue(self:GetNameplateScale())
frame.iconSlider:SetValue(self:GetIconSize())
frame.castbarHeightSlider:SetValue(self:GetCastbarHeight())
frame.classColorsCheck:SetChecked(self:AreClassColorsEnabled())
frame.castbarsCheck:SetChecked(self:AreCastbarsEnabled())
frame.tankCheck:SetChecked(self:IsTankModeEnabled())
if frame.healthTextDropdown then
local mode = self:GetHealthTextMode()
UIDropDownMenu_SetSelectedValue(frame.healthTextDropdown, mode)
local labels = { off = "Off", percent = "Percent", hp = "HP", both = "HP + Percent" }
UIDropDownMenu_SetText(labels[mode] or "Off", frame.healthTextDropdown)
end
frame.targetFocusCheck:SetChecked(self:IsTargetFocusEnabled())
if frame.glowColorDropdown then
local _, _, _, color = self:GetTargetGlowColor()
local labels = {
white = "White",
gold = "Gold",
blue = "Blue",
green = "Green",
red = "Red",
purple = "Purple",
}
UIDropDownMenu_SetSelectedValue(frame.glowColorDropdown, color or "white")
UIDropDownMenu_SetText(labels[color] or "White", frame.glowColorDropdown)
end
frame.targetOnTopCheck:SetChecked(self:IsTargetOnTopEnabled())
frame.versionText:SetText("Version " .. tostring(self.version or "?"))
end
function BNP:ToggleOptions()
self:SyncOptions()
if self.optionsFrame:IsShown() then
self.optionsFrame:Hide()
else
self.optionsFrame:Show()
end
end
function BNP:CreateMinimapButton()
if self.minimapButton then return end
BNP_DB = BNP_DB or {}
if BNP_DB.minimapAngle == nil then BNP_DB.minimapAngle = 225 end
local button = CreateFrame("Button", "BNPMinimapButton", Minimap)
button:SetWidth(31)
button:SetHeight(31)
button:SetFrameStrata("MEDIUM")
button:SetFrameLevel((Minimap:GetFrameLevel() or 1) + 8)
button:RegisterForClicks("LeftButtonUp")
button:RegisterForDrag("LeftButton")
button:EnableMouse(true)
button:SetMovable(true)
-- Classic round minimap-button background.
local bg = button:CreateTexture(nil, "BACKGROUND")
bg:SetTexture("Interface\\Minimap\\UI-Minimap-Background")
bg:SetWidth(22)
bg:SetHeight(22)
bg:SetPoint("CENTER", button, "CENTER", 0, 0)
button.bg = bg
-- Addon identity: simple BN+ lettering instead of a spell/item icon.
-- Rendered directly by the client, so no external texture file is needed.
local iconBG = button:CreateTexture(nil, "ARTWORK")
iconBG:SetTexture(0.03, 0.03, 0.03, 1)
iconBG:SetWidth(20)
iconBG:SetHeight(20)
iconBG:SetPoint("CENTER", button, "CENTER", 0, 0)
button.iconBG = iconBG
local label = button:CreateFontString(nil, "OVERLAY")
label:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
label:SetPoint("CENTER", button, "CENTER", 0, 0)
label:SetText("BN+")
label:SetTextColor(0.20, 0.60, 1.00)
button.label = label
-- Standard Blizzard circular minimap border.
local border = button:CreateTexture(nil, "OVERLAY")
border:SetTexture("Interface\\Minimap\\MiniMap-TrackingBorder")
border:SetWidth(54)
border:SetHeight(54)
border:SetPoint("TOPLEFT", button, "TOPLEFT", 0, 0)
button.border = border
local highlight = button:CreateTexture(nil, "HIGHLIGHT")
highlight:SetTexture("Interface\\Minimap\\UI-Minimap-ZoomButton-Highlight")
highlight:SetBlendMode("ADD")
highlight:SetAllPoints(button)
button.highlight = highlight
local function UpdatePosition()
local angle = tonumber(BNP_DB.minimapAngle) or 225
local radius = 78
local rad = math.rad(angle)
button:ClearAllPoints()
button:SetPoint(
"CENTER",
Minimap,
"CENTER",
math.cos(rad) * radius,
math.sin(rad) * radius
)
end
local function UpdateAngleFromCursor()
local mx, my = Minimap:GetCenter()
local scale = 1
if UIParent.GetEffectiveScale then
scale = UIParent:GetEffectiveScale() or 1
elseif UIParent.GetScale then
scale = UIParent:GetScale() or 1
end
local cx, cy = GetCursorPosition()
cx = cx / scale
cy = cy / scale
local dx = cx - mx
local dy = cy - my
local angle
if math.atan2 then
angle = math.deg(math.atan2(dy, dx))
else
if dx == 0 then
angle = dy >= 0 and 90 or -90
else
angle = math.deg(math.atan(dy / dx))
if dx < 0 then angle = angle + 180 end
end
end
BNP_DB.minimapAngle = angle
UpdatePosition()
end
button:SetScript("OnDragStart", function()
this:SetScript("OnUpdate", UpdateAngleFromCursor)
end)
button:SetScript("OnDragStop", function()
this:SetScript("OnUpdate", nil)
UpdateAngleFromCursor()
end)
button:SetScript("OnClick", function()
BNP:ToggleOptions()
end)
button:SetScript("OnEnter", function()
GameTooltip:SetOwner(this, "ANCHOR_LEFT")
GameTooltip:SetText("Blizz Nameplates+")
GameTooltip:AddLine("Left-click: Open settings", 1, 1, 1)
GameTooltip:AddLine("Drag: Move minimap button", 0.8, 0.8, 0.8)
GameTooltip:Show()
end)
button:SetScript("OnLeave", function()
GameTooltip:Hide()
end)
UpdatePosition()
self.minimapButton = button
end
-15
View File
@@ -1,15 +0,0 @@
BNP = BNP or {}
-- Central visual constants. Keeping these values in one place lets us polish
-- the Blizzard-style presentation without touching aura tracking logic.
BNP.UI = BNP.UI or {
ICON_SIZE = 18,
ICON_OFFSET_Y = 15,
ICON_SPACING = 2,
TIMER_FONT = "Fonts\\FRIZQT__.TTF",
TIMER_SIZE = 8,
TIMER_OFFSET_X = 0,
TIMER_OFFSET_Y = 0,
TIMER_SHADOW_X = 1,
TIMER_SHADOW_Y = -1,
}