Delete core directory
This commit is contained in:
@@ -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
|
||||
@@ -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)
|
||||
-325
@@ -1,325 +0,0 @@
|
||||
BNP = BNP or {}
|
||||
|
||||
BNP.defaults = BNP.defaults or {
|
||||
nameplateScale = 1.0,
|
||||
nameplateYOffset = 0,
|
||||
nonTargetAlpha = 1.0,
|
||||
iconSize = 18,
|
||||
ccIconSize = 18,
|
||||
debuffPosition = "top",
|
||||
ccPosition = "top",
|
||||
tankMode = false,
|
||||
classColors = true,
|
||||
hidePlayerNames = false,
|
||||
hideNPCNames = false,
|
||||
castbars = true,
|
||||
debuffs = true,
|
||||
crowdControl = true,
|
||||
separateCCRow = true,
|
||||
showOtherCCs = true,
|
||||
pvpImmunities = true,
|
||||
immunityIconSize = 18,
|
||||
immunityPosition = "top",
|
||||
castbarHeight = 6,
|
||||
castbarSpacing = 4,
|
||||
minimapAngle = 225,
|
||||
healthPercent = false,
|
||||
healthText = "off",
|
||||
targetFocus = true,
|
||||
targetGlowColor = "white",
|
||||
targetGlowSize = 0,
|
||||
targetGlowOpacity = 1.0,
|
||||
targetArrows = false,
|
||||
targetArrowColor = "match",
|
||||
targetArrowSize = 14,
|
||||
targetArrowThick = false,
|
||||
targetArrowStyle = "chevron",
|
||||
comboPoints = true,
|
||||
totemIndicators = true,
|
||||
totemIconSize = 24,
|
||||
}
|
||||
|
||||
function BNP:InitConfig()
|
||||
BNP_DB = BNP_DB or {}
|
||||
|
||||
if BNP_DB.nameplateScale == nil then BNP_DB.nameplateScale = self.defaults.nameplateScale end
|
||||
if BNP_DB.nameplateYOffset == nil then BNP_DB.nameplateYOffset = self.defaults.nameplateYOffset end
|
||||
if BNP_DB.nonTargetAlpha == nil then BNP_DB.nonTargetAlpha = self.defaults.nonTargetAlpha end
|
||||
if BNP_DB.iconSize == nil then BNP_DB.iconSize = self.defaults.iconSize end
|
||||
if BNP_DB.ccIconSize == nil then BNP_DB.ccIconSize = BNP_DB.iconSize or self.defaults.ccIconSize end
|
||||
if BNP_DB.debuffPosition == nil then BNP_DB.debuffPosition = self.defaults.debuffPosition end
|
||||
if BNP_DB.ccPosition == nil then BNP_DB.ccPosition = BNP_DB.debuffPosition or self.defaults.ccPosition 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.hidePlayerNames == nil then BNP_DB.hidePlayerNames = self.defaults.hidePlayerNames end
|
||||
if BNP_DB.hideNPCNames == nil then BNP_DB.hideNPCNames = self.defaults.hideNPCNames end
|
||||
if BNP_DB.castbars == nil then BNP_DB.castbars = self.defaults.castbars end
|
||||
if BNP_DB.debuffs == nil then BNP_DB.debuffs = self.defaults.debuffs end
|
||||
if BNP_DB.crowdControl == nil then BNP_DB.crowdControl = (BNP_DB.debuffs ~= false) and true or false end
|
||||
if BNP_DB.separateCCRow == nil then BNP_DB.separateCCRow = self.defaults.separateCCRow end
|
||||
if BNP_DB.showOtherCCs == nil then BNP_DB.showOtherCCs = self.defaults.showOtherCCs end
|
||||
if BNP_DB.pvpImmunities == nil then BNP_DB.pvpImmunities = self.defaults.pvpImmunities end
|
||||
if BNP_DB.immunityIconSize == nil then BNP_DB.immunityIconSize = BNP_DB.iconSize or self.defaults.immunityIconSize end
|
||||
if BNP_DB.immunityPosition == nil then BNP_DB.immunityPosition = self.defaults.immunityPosition end
|
||||
-- Position migration from the temporary all-Bottom test build.
|
||||
if BNP_DB.debuffPosition == "bottom" then BNP_DB.debuffPosition = "bottom_mid" end
|
||||
if BNP_DB.ccPosition == "bottom" then BNP_DB.ccPosition = "top" end
|
||||
if BNP_DB.immunityPosition == "bottom" then BNP_DB.immunityPosition = "top" end
|
||||
if BNP_DB.castbarHeight == nil then BNP_DB.castbarHeight = self.defaults.castbarHeight end
|
||||
if BNP_DB.castbarSpacing == nil then BNP_DB.castbarSpacing = self.defaults.castbarSpacing 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.targetGlowSize == nil then BNP_DB.targetGlowSize = self.defaults.targetGlowSize end
|
||||
if BNP_DB.targetGlowOpacity == nil then BNP_DB.targetGlowOpacity = self.defaults.targetGlowOpacity end
|
||||
if BNP_DB.targetArrows == nil then BNP_DB.targetArrows = self.defaults.targetArrows end
|
||||
if BNP_DB.targetArrowColor == nil then BNP_DB.targetArrowColor = self.defaults.targetArrowColor end
|
||||
if BNP_DB.targetArrowSize == nil then BNP_DB.targetArrowSize = self.defaults.targetArrowSize end
|
||||
if BNP_DB.targetArrowThick == nil then BNP_DB.targetArrowThick = self.defaults.targetArrowThick end
|
||||
if BNP_DB.targetArrowStyle == nil then BNP_DB.targetArrowStyle = self.defaults.targetArrowStyle end
|
||||
if BNP_DB.comboPoints == nil then BNP_DB.comboPoints = self.defaults.comboPoints end
|
||||
if BNP_DB.totemIndicators == nil then BNP_DB.totemIndicators = self.defaults.totemIndicators end
|
||||
if BNP_DB.totemIconSize == nil then BNP_DB.totemIconSize = self.defaults.totemIconSize end
|
||||
end
|
||||
|
||||
function BNP:GetNameplateScale()
|
||||
return (BNP_DB and tonumber(BNP_DB.nameplateScale)) or self.defaults.nameplateScale
|
||||
end
|
||||
|
||||
function BNP:GetNameplateYOffset()
|
||||
local value = (BNP_DB and tonumber(BNP_DB.nameplateYOffset)) or self.defaults.nameplateYOffset or 0
|
||||
if value < 0 then value = 0 end
|
||||
if value > 50 then value = 50 end
|
||||
return value
|
||||
end
|
||||
|
||||
function BNP:GetNonTargetAlpha()
|
||||
local value = (BNP_DB and tonumber(BNP_DB.nonTargetAlpha)) or self.defaults.nonTargetAlpha or 1.0
|
||||
if value < 0.30 then value = 0.30 end
|
||||
if value > 1.00 then value = 1.00 end
|
||||
return value
|
||||
end
|
||||
|
||||
function BNP:GetIconSize()
|
||||
return (BNP_DB and tonumber(BNP_DB.iconSize)) or self.defaults.iconSize
|
||||
end
|
||||
|
||||
function BNP:GetCCIconSize()
|
||||
local value = (BNP_DB and tonumber(BNP_DB.ccIconSize)) or self.defaults.ccIconSize or self:GetIconSize()
|
||||
if value < 12 then value = 12 end
|
||||
if value > 32 then value = 32 end
|
||||
return value
|
||||
end
|
||||
|
||||
function BNP:GetDebuffPosition()
|
||||
local position = (BNP_DB and BNP_DB.debuffPosition) or self.defaults.debuffPosition or "top"
|
||||
-- Migrate the first Bottom implementation to the new centered Bottom option.
|
||||
if position == "bottom" then position = "bottom_mid" end
|
||||
if position ~= "top" and position ~= "top_left" and position ~= "top_right"
|
||||
and position ~= "left" and position ~= "right"
|
||||
and position ~= "bottom_mid" and position ~= "bottom_left" and position ~= "bottom_right" then
|
||||
position = "top"
|
||||
end
|
||||
return position
|
||||
end
|
||||
|
||||
function BNP:GetCCPosition()
|
||||
local position = (BNP_DB and BNP_DB.ccPosition) or self.defaults.ccPosition or "top"
|
||||
-- Bottom is intentionally not supported for CCs.
|
||||
if position ~= "top" and position ~= "left" and position ~= "right" then
|
||||
position = "top"
|
||||
end
|
||||
return position
|
||||
end
|
||||
|
||||
function BNP:GetImmunityIconSize()
|
||||
local value = (BNP_DB and tonumber(BNP_DB.immunityIconSize)) or self.defaults.immunityIconSize or self:GetIconSize()
|
||||
if value < 12 then value = 12 end
|
||||
if value > 32 then value = 32 end
|
||||
return value
|
||||
end
|
||||
|
||||
function BNP:GetImmunityPosition()
|
||||
local position = (BNP_DB and BNP_DB.immunityPosition) or self.defaults.immunityPosition or "top"
|
||||
-- Bottom is intentionally not supported for immunities.
|
||||
if position ~= "top" and position ~= "left" and position ~= "right" then
|
||||
position = "top"
|
||||
end
|
||||
return position
|
||||
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:HidePlayerNamesEnabled()
|
||||
return BNP_DB and BNP_DB.hidePlayerNames and true or false
|
||||
end
|
||||
|
||||
function BNP:HideNPCNamesEnabled()
|
||||
return BNP_DB and BNP_DB.hideNPCNames and true or 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:GetCastbarSpacing()
|
||||
local value = (BNP_DB and tonumber(BNP_DB.castbarSpacing)) or self.defaults.castbarSpacing or 4
|
||||
if value < 0 then value = 0 end
|
||||
if value > 10 then value = 10 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: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
|
||||
|
||||
|
||||
function BNP:GetTargetGlowSize()
|
||||
local value = (BNP_DB and tonumber(BNP_DB.targetGlowSize)) or self.defaults.targetGlowSize or 0
|
||||
if value < 0 then value = 0 end
|
||||
if value > 20 then value = 20 end
|
||||
return value
|
||||
end
|
||||
|
||||
function BNP:GetTargetGlowOpacity()
|
||||
local value = (BNP_DB and tonumber(BNP_DB.targetGlowOpacity)) or self.defaults.targetGlowOpacity or 1.0
|
||||
if value < 0.20 then value = 0.20 end
|
||||
if value > 1.00 then value = 1.00 end
|
||||
return value
|
||||
end
|
||||
|
||||
function BNP:AreTargetArrowsEnabled()
|
||||
return BNP_DB and BNP_DB.targetArrows == true
|
||||
end
|
||||
|
||||
function BNP:GetTargetArrowColor()
|
||||
local key = (BNP_DB and BNP_DB.targetArrowColor) or self.defaults.targetArrowColor or "match"
|
||||
if key == "match" then
|
||||
local r, g, b = self:GetTargetGlowColor()
|
||||
return r, g, b, key
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
function BNP:GetTargetArrowSize()
|
||||
local value = (BNP_DB and tonumber(BNP_DB.targetArrowSize)) or self.defaults.targetArrowSize or 14
|
||||
if value < 10 then value = 10 end
|
||||
if value > 24 then value = 24 end
|
||||
return value
|
||||
end
|
||||
|
||||
function BNP:AreTargetArrowsThick()
|
||||
return BNP_DB and BNP_DB.targetArrowThick == true
|
||||
end
|
||||
|
||||
function BNP:GetTargetArrowStyle()
|
||||
local style = (BNP_DB and BNP_DB.targetArrowStyle) or self.defaults.targetArrowStyle or "chevron"
|
||||
if style ~= "chevron" and style ~= "triangle" and style ~= "slim_triangle"
|
||||
and style ~= "double_chevron" and style ~= "diamond_tip" then
|
||||
style = "chevron"
|
||||
end
|
||||
return style
|
||||
end
|
||||
|
||||
function BNP:AreComboPointsEnabled()
|
||||
return not BNP_DB or BNP_DB.comboPoints ~= false
|
||||
end
|
||||
|
||||
function BNP:AreTotemIndicatorsEnabled()
|
||||
return not BNP_DB or BNP_DB.totemIndicators ~= false
|
||||
end
|
||||
|
||||
function BNP:GetTotemIconSize()
|
||||
local value = (BNP_DB and tonumber(BNP_DB.totemIconSize)) or self.defaults.totemIconSize or 24
|
||||
if value < 16 then value = 16 end
|
||||
if value > 36 then value = 36 end
|
||||
return value
|
||||
end
|
||||
|
||||
|
||||
function BNP:AreDebuffsEnabled()
|
||||
return not BNP_DB or BNP_DB.debuffs ~= false
|
||||
end
|
||||
|
||||
function BNP:AreCrowdControlEnabled()
|
||||
return not BNP_DB or BNP_DB.crowdControl ~= false
|
||||
end
|
||||
|
||||
function BNP:AreAnyAurasEnabled()
|
||||
return self:AreDebuffsEnabled() or self:AreCrowdControlEnabled()
|
||||
end
|
||||
|
||||
function BNP:IsSeparateCCRowEnabled()
|
||||
return not BNP_DB or BNP_DB.separateCCRow ~= false
|
||||
end
|
||||
|
||||
function BNP:ShowOtherPlayersCCs()
|
||||
return not BNP_DB or BNP_DB.showOtherCCs ~= false
|
||||
end
|
||||
|
||||
function BNP:ArePvPImmunitiesEnabled()
|
||||
return not BNP_DB or BNP_DB.pvpImmunities ~= false
|
||||
end
|
||||
@@ -1,43 +0,0 @@
|
||||
BNP = BNP or {}
|
||||
BNP.version = "1.0.9"
|
||||
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
|
||||
|
||||
local classicNameplates = CLASSIC_API_VERSION and C_NamePlate and
|
||||
type(C_NamePlate.GetNamePlateForUnit) == "function"
|
||||
|
||||
if CombatLogAdd and SpellInfo and classicNameplates then
|
||||
BNP:Print(BNP.version .. " loaded. SuperWoW + ClassicAPI nameplate tracking active.")
|
||||
BNP:Print("Dragon command test build loaded.")
|
||||
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
|
||||
elseif not CombatLogAdd or not SpellInfo then
|
||||
BNP:Print("ERROR: SuperWoW API not detected. Blizz Nameplates+ requires SuperWoW.")
|
||||
else
|
||||
BNP:Print("ERROR: ClassicAPI nameplate API not detected. Please update ClassicAPI.dll.")
|
||||
end
|
||||
end)
|
||||
@@ -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)
|
||||
-1496
File diff suppressed because it is too large
Load Diff
-15
@@ -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,
|
||||
}
|
||||
Reference in New Issue
Block a user