mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-27 01:46:03 +00:00
75c4657ab9
* nameplates: source totem icons from UnitCreatedBySpell
Read the totem's icon from the totem-drop spell (UnitCreatedBySpell +
GetSpellTexture) instead of the self-aura at index 1 plus a
UNIT_SPELLCAST_SUCCEEDED capture for active totems. The drop spell is a
broadcast descriptor field present for every summoned unit in range, so
it resolves immediately for passive and active totems alike and gives the
totem's own icon rather than the attack-spell proxy. Drops the
UNIT_SPELLCAST_SUCCEEDED registration and handler.
Re-read the spell each render and key the cached texture on the spell id
so an in-place totem swap (same unit, new drop spell -- no plate re-add)
refreshes the icon without needing the plate to leave and re-enter view.
* CAPI min bumped to 1.13.1
* Gracefully disable pfUI when ClassicAPI is missing
Add API_Check.lua as the first TOC entry. When the ClassicAPI DLL is
absent or below the minimum version it sets pfUI_disabled and stands up
an inert stub so the rest of the addon no-ops instead of flooding load
errors: modules and skins register their bodies into no-ops, and the
setfenv'd api/lib files run inside an environment where CreateFrame and
any missing global resolve to a null object -- so no real frames or live
handlers are created and missing API calls just return null. pfUI.lua
bails early on pfUI_disabled.
* auras: scan through GetAuraSlots instead of by-index loops
Every aura scan loop (unit frame buffs/debuffs, dispel indicators, buff and
custom indicators, player buff frame, buffwatch bars, tooltip buff row) now
enumerates a unit's auras once with C_UnitAuras.GetAuraSlots and reads each
aura by slot id via the positional C_UnitAuras.UnitAuraBySlot. The by-index
getters re-walk the aura array from slot 0 on every call, so a per-button
loop over them was quadratic in the aura count; one enumeration plus a
by-slot read per aura is linear.
pfUI.api.ScanAuraSlots(unit, filter, buf, max) wraps GetAuraSlots' fill-a-
table form (table as the 5th argument) so no vararg Lua frame is involved:
Lua 5.0 allocates an `arg` table for every vararg call, which showed up as
nameplate OnUpdate/OnEvent memory growth in the first cut of this change.
Single by-index reads in tooltip and click handlers are unchanged (one call
each, and SetUnitAura takes the same index).
Requires the ClassicAPI build that adds GetAuraSlots' fill form; on an older
DLL the 5th argument is ignored and ScanAuraSlots would read the first slot
id as the count.
* Show Faction/Race icons in chat
* Load pfUI through ClassicAPI's flavor TOCs
ClassicAPI redirects the read of pfUI\pfUI.toc to a flavored file whenever
the DLL is installed, so which TOC the client opens already answers whether
ClassicAPI is there. Split the manifest three ways and let that do the work:
pfUI.toc fallback, reached only when ClassicAPI is missing;
loads API_Check.lua and nothing else
pfUI_ClassicAPI.toc full addon, every non-Turtle client
pfUI_Turtle.toc full addon plus init\turtle.xml, on Turtle
The fallback TOC declares no SavedVariables. It used to, while API_Check.lua
reset pfUI_profiles to an empty table on the disabled path -- which truncated
the player's profiles on logout.
With the missing-DLL case handled by TOC selection, API_Check.lua drops the
null object stub that kept the other ~140 files quiet, along with
pfUI_disabled and the now unreachable early return in pfUI.lua. It keeps the
version gate, which still matters: the flavor redirect landed in ClassicAPI
v1.11.0, below the v1.13.1 pfUI needs, so an old DLL still gets served a
flavor TOC. pfUI.lua also loses a verbatim duplicate of the whole check.
Turtle-only files move to init\turtle.xml: modules\turtle-wow.lua (its
TURTLE_WOW_VERSION guard is now redundant) and the lft, turtle_shop,
barbershop, transmog and ebc skins. turtle-wow registers last instead of
75th of 84; the only ordering it relies on is pfUI.chat, registered 8th.
pfSellData moves to env\selldata.lua, listed only in pfUI_ClassicAPI.toc,
since turtle-wow.lua replaces the table wholesale on Turtle. env\tables.lua
keeps an empty declaration so sellvalue.lua has something to index when the
turtle-wow module is disabled.
The release workflow pinned PFUI_CLASSIC_API_LATEST in pfUI.lua, which has
not held that constant since it moved to API_Check.lua, so the pin was
silently doing nothing. It also switches to brues-code/packager@vCAPI, which
recognizes the _ClassicAPI and _Turtle suffixes and applies the TOC build
type filters to them.
* Split the vendor price tables into their own manifests
Turtle's pfSellData moves out of modules\turtle-wow.lua into
env\selldata_turtle.lua, matching env\selldata.lua for the stock list, and
each is pulled in by the manifest for its client: init\stock.xml from
pfUI_ClassicAPI.toc, init\turtle.xml from pfUI_Turtle.toc. Either way it
loads after init\env.xml and replaces the empty pfSellData declared there.
Turtle's prices used to be assigned inside the turtle-wow module body, which
put them on pfUI.env and skipped them entirely when that module was
disabled. At file scope they land on _G and apply either way.
* Drop the vanilla compat layer
compat\vanilla.lua named the handful of things that differed between clients
back when pfUI targeted several. Only one client remains, so every constant
had exactly one value. Inline each at its use site and delete the file,
init\compat.xml, and both TOC entries.
COOLDOWN_FRAME_TYPE -> "Model"
LOOT_BUTTON_FRAME_TYPE -> "LootButton"
MINIMAP_TRACKING_FRAME -> _G.MiniMapTrackingFrame
FRIENDS_NAME_LOCATION -> "ButtonTextNameLocation"
EVENTS_MINIMAP_ZONE_UPDATE -> the event list, in panel.lua
MICRO_BUTTONS -> a local in panel.lua
NAMEPLATE_OBJECTORDER -> a local in nameplates.lua
ACTIONBAR_SECURE_TEMPLATE_BAR/_BUTTON -> nil, so the argument goes away
NAMEPLATE_FRAMETYPE and PLAYER_BUFF_START_ID had no readers left.
RunMacroText moves to pfUI.lua. compat\vanilla.lua was setfenv'd into the
pfUI environment, so the function only ever existed on pfUI.env; at file
scope it lands on _G as a real export instead. Nothing in pfUI calls it, and
ClassicAPI neither defines nor looks for a RunMacroText global -- it does
the same throwaway edit box natively in src/macro/Execute.cpp and only
defers to a global RunMacro.
* bump CAPI min to 11303
* auras: uncap the self-debuff tooltip lookup
With selfdebuff on, the displayed debuff list is PLAYER-filtered while
GameTooltip:SetUnitAura indexes the unfiltered HARMFUL list, so both
handlers map one to the other by matching name + sourceGUID. That mapping
scanned slots 1..16 only.
The unfiltered harmful list is not capped at 16. Once a unit's 16 debuff
slots are full the server parks further debuffs in buff slots, and
C_UnitAuras classifies by the aura's polarity flag rather than its slot
range, so it reports those as harmful too -- verified live at 18 harmful on
a 20-aura target. Past the sixteenth the lookup found nothing and fell
through to the raw filtered index, opening the wrong tooltip or none.
Both now enumerate however many harmful auras the unit actually has, via
ScanAuraSlots, which also drops the per-index rescan the by-index accessor
was doing. Each handler gets its own slot buffer: OnEnter can fire while a
refresh is showing/hiding frames under the cursor, so sharing the refresh
buffer could clobber a scan mid-walk.
The nameplate module still collects at most 16 debuffs per plate. That one
is a display cap matching its 16 configured icon frames, not an aura-count
assumption, so it is left alone.
* bump CAPI min to 11304
514 lines
16 KiB
Lua
514 lines
16 KiB
Lua
SLASH_RELOAD1 = '/rl'
|
|
function SlashCmdList.RELOAD(msg, editbox)
|
|
ReloadUI()
|
|
end
|
|
|
|
local addonName = ...
|
|
|
|
SLASH_PFUI1 = '/pfui'
|
|
function SlashCmdList.PFUI(msg, editbox)
|
|
pfUI.gui:SetShown(not pfUI.gui:IsShown())
|
|
end
|
|
|
|
SLASH_GM1, SLASH_GM2 = '/gm', '/support'
|
|
function SlashCmdList.GM(msg, editbox)
|
|
ToggleHelpFrame(1)
|
|
end
|
|
|
|
local pfUI = CreateFrame("Frame", addonName, UIParent)
|
|
pfUI:RegisterEvent("ADDON_LOADED")
|
|
|
|
-- setup bootvar
|
|
pfUI.bootup = true
|
|
|
|
pfUI_playerDB = pfUI_playerDB or {}
|
|
pfUI_config = pfUI_config or {}
|
|
pfUI_init = pfUI_init or {}
|
|
pfUI_profiles = pfUI_profiles or {}
|
|
pfUI_addon_profiles = pfUI_addon_profiles or {}
|
|
pfUI_cache = pfUI_cache or {}
|
|
pfUI_throttle = pfUI_throttle or {}
|
|
|
|
-- localization
|
|
pfUI_locale = {}
|
|
pfUI_translation = {}
|
|
|
|
-- initialize default variables
|
|
pfUI.cache = {}
|
|
pfUI.module = {}
|
|
pfUI.modules = {}
|
|
pfUI.skin = {}
|
|
pfUI.skins = {}
|
|
pfUI.environment = {}
|
|
pfUI.movables = {}
|
|
pfUI.version = {}
|
|
pfUI.env = {}
|
|
|
|
-- Capability flag: this fork's pfActionBar buttons correctly handle the modern
|
|
-- HookScript widget method, so ClassicAPI's AddOnCompat shim must NOT shadow
|
|
-- HookScript during actionbar load (older forks branch on `if button.HookScript`
|
|
-- and take a modern path they were never written for). This describes behavior,
|
|
-- not identity: a fork that keeps the HookScript-correct actionbar code keeps
|
|
-- the flag; one that lacks it should drop the flag and get the safe fallback.
|
|
pfUI.handlesHookScript = true
|
|
|
|
pfUI.events = Mixin({}, CallbackRegistryMixin)
|
|
pfUI.events:OnLoad()
|
|
pfUI.events:SetUndefinedEventsAllowed(true)
|
|
|
|
-- check if macro addons are loaded (disables macrotweak/macroscan)
|
|
function pfUI:MacroAddonsLoaded()
|
|
return IsAddOnLoaded("Supermacro") or IsAddOnLoaded("SuperCleveRoidMacros") or IsAddOnLoaded("UltimaMacros")
|
|
end
|
|
|
|
pfUI.name = addonName
|
|
pfUI.path = "Interface\\AddOns\\" .. addonName
|
|
|
|
-- handle/convert media dir paths
|
|
pfUI.media = setmetatable({}, { __index = function(tab,key)
|
|
local value = tostring(key)
|
|
if value:find("img:") then
|
|
value = string.gsub(value, "img:", pfUI.path .. "\\img\\")
|
|
elseif value:find("font:") then
|
|
value = string.gsub(value, "font:", pfUI.path .. "\\fonts\\")
|
|
else
|
|
value = string.gsub(value, "Interface\\AddOns\\pfUI\\", pfUI.path .. "\\")
|
|
end
|
|
rawset(tab,key,value)
|
|
return value
|
|
end})
|
|
|
|
pfUI.client = INTERFACE_VERSION
|
|
|
|
-- setup pfUI namespace
|
|
setmetatable(pfUI.env, {__index = getfenv(0)})
|
|
|
|
PFUI_CLASS_COLORS = setmetatable({
|
|
WARRIOR = { r = 0.78, g = 0.61, b = 0.43 },
|
|
MAGE = { r = 0.25, g = 0.78, b = 0.92 },
|
|
ROGUE = { r = 1, g = 0.96, b = 0.41 },
|
|
DRUID = { r = 1, g = 0.49, b = 0.04 },
|
|
HUNTER = { r = 0.67, g = 0.83, b = 0.45 },
|
|
SHAMAN = { r = 0, g = 0.44, b = 0.87 },
|
|
PRIEST = { r = 1, g = 1, b = 1 },
|
|
WARLOCK = { r = 0.53, g = 0.53, b = 0.93 },
|
|
PALADIN = { r = 0.96, g = 0.55, b = 0.73 },
|
|
}, { __index = function(t,k)
|
|
local unknownColor = CreateColor(0.6, 0.6, 0.6, 1)
|
|
unknownColor.colorStr = unknownColor:GenerateHexColor()
|
|
return unknownColor
|
|
end})
|
|
|
|
for _, classColor in pairs(PFUI_CLASS_COLORS) do
|
|
Mixin(classColor, ColorMixin)
|
|
classColor.a = 1
|
|
classColor.colorStr = classColor:GenerateHexColor()
|
|
end
|
|
|
|
function pfUI:UpdateFonts()
|
|
-- abort when config is not ready yet
|
|
if not pfUI_config or not pfUI_config.global then return end
|
|
|
|
-- load font configuration
|
|
local default, tooltip, unit, unit_name, combat
|
|
if pfUI_config.global.force_region == "1" and GetLocale() == "zhCN" then
|
|
-- force locale compatible fonts (zhCN 1.12)
|
|
default = "Fonts\\FZXHLJW.TTF"
|
|
tooltip = "Fonts\\FZXHLJW.TTF"
|
|
combat = "Fonts\\FZXHLJW.TTF"
|
|
unit = "Fonts\\FZXHLJW.TTF"
|
|
unit_name = "Fonts\\FZXHLJW.TTF"
|
|
elseif pfUI_config.global.force_region == "1" and GetLocale() == "zhTW" then
|
|
-- force locale compatible fonts (zhTW 1.12)
|
|
default = "Fonts\\FZXHLJW.ttf"
|
|
tooltip = "Fonts\\FZXHLJW.ttf"
|
|
combat = "Fonts\\FZXHLJW.ttf"
|
|
unit = "Fonts\\FZXHLJW.ttf"
|
|
unit_name = "Fonts\\FZXHLJW.ttf"
|
|
elseif pfUI_config.global.force_region == "1" and GetLocale() == "koKR" then
|
|
-- force locale compatible fonts (koKR)
|
|
default = "Fonts\\2002.TTF"
|
|
tooltip = "Fonts\\2002.TTF"
|
|
combat = "Fonts\\2002.TTF"
|
|
unit = "Fonts\\2002.TTF"
|
|
unit_name = "Fonts\\2002.TTF"
|
|
else
|
|
-- use default entries
|
|
default = pfUI.media[pfUI_config.global.font_default]
|
|
tooltip = pfUI.media[pfUI_config.tooltip.font_tooltip]
|
|
combat = pfUI.media[pfUI_config.global.font_combat]
|
|
unit = pfUI.media[pfUI_config.global.font_unit]
|
|
unit_name = pfUI.media[pfUI_config.global.font_unit_name]
|
|
end
|
|
|
|
-- write setting shortcuts
|
|
pfUI.font_default = default
|
|
pfUI.font_combat = combat
|
|
pfUI.font_unit = unit
|
|
pfUI.font_unit_name = unit_name
|
|
|
|
-- skip setting fonts, keep blizzard defaults
|
|
if pfUI_config.global.font_blizzard == "1" then
|
|
return
|
|
end
|
|
|
|
-- set game constants
|
|
STANDARD_TEXT_FONT = default
|
|
DAMAGE_TEXT_FONT = combat
|
|
NAMEPLATE_FONT = default
|
|
UNIT_NAME_FONT = unit_name
|
|
|
|
-- If the Invisible font is selected, suppress all combat text entirely
|
|
if string.find(combat or "", "AdobeBlank") then
|
|
SHOW_COMBAT_TEXT = "0"
|
|
end
|
|
|
|
-- set dropdown font to default size
|
|
UIDROPDOWNMENU_DEFAULT_TEXT_HEIGHT = 11
|
|
|
|
-- change default game font objects
|
|
SystemFont:SetFont(default, 15)
|
|
GameFontNormal:SetFont(default, 12)
|
|
GameFontBlack:SetFont(default, 12)
|
|
GameFontNormalSmall:SetFont(default, 11)
|
|
GameFontNormalLarge:SetFont(default, 16)
|
|
GameFontNormalHuge:SetFont(default, 20)
|
|
NumberFontNormal:SetFont(default, 14, "OUTLINE")
|
|
NumberFontNormalSmall:SetFont(default, 14, "OUTLINE")
|
|
NumberFontNormalLarge:SetFont(default, 16, "OUTLINE")
|
|
NumberFontNormalHuge:SetFont(default, 30, "OUTLINE")
|
|
QuestTitleFont:SetFont(default, 18)
|
|
QuestFont:SetFont(default, 13)
|
|
QuestFontHighlight:SetFont(default, 14)
|
|
ItemTextFontNormal:SetFont(default, 15)
|
|
MailTextFontNormal:SetFont(default, 15)
|
|
SubSpellFont:SetFont(default, 12)
|
|
DialogButtonNormalText:SetFont(default, 16)
|
|
ZoneTextFont:SetFont(default, 34, "OUTLINE")
|
|
SubZoneTextFont:SetFont(default, 24, "OUTLINE")
|
|
GameTooltipText:SetFont(tooltip, pfUI_config.tooltip.font_tooltip_size)
|
|
GameTooltipTextSmall:SetFont(tooltip, pfUI_config.tooltip.font_tooltip_size)
|
|
GameTooltipHeaderText:SetFont(tooltip, pfUI_config.tooltip.font_tooltip_size + 1)
|
|
WorldMapTextFont:SetFont(default, 102, "THICK")
|
|
InvoiceTextFontNormal:SetFont(default, 12)
|
|
InvoiceTextFontSmall:SetFont(default, 12)
|
|
CombatTextFont:SetFont(combat, 25)
|
|
ChatFontNormal:SetFont(default, 13, pfUI_config.chat.text.outline == "1" and "OUTLINE")
|
|
|
|
if TextStatusBarTextSmall then -- does not exist in koKR
|
|
TextStatusBarTextSmall:SetFont(default, 12, "NORMAL")
|
|
end
|
|
end
|
|
|
|
local translations
|
|
function pfUI:GetEnvironment()
|
|
-- load api into environment
|
|
for m, func in pairs(pfUI.api or {}) do
|
|
pfUI.env[m] = func
|
|
end
|
|
|
|
if pfUI_config and pfUI_config.global and pfUI_config.global.language and not translations then
|
|
local lang = pfUI_config and pfUI_config.global and pfUI_config.global.language and pfUI_translation[pfUI_config.global.language] and pfUI_config.global.language or GetLocale()
|
|
pfUI.env.T = setmetatable(pfUI_translation[lang] or {}, { __index = function(tab,key)
|
|
local value = tostring(key)
|
|
rawset(tab,key,value)
|
|
return value
|
|
end})
|
|
translations = true
|
|
end
|
|
|
|
pfUI.env._G = getfenv(0)
|
|
pfUI.env.C = pfUI_config
|
|
pfUI.env.pfUI_throttle = _G.pfUI_throttle
|
|
pfUI.env.L = (pfUI_locale[GetLocale()] or pfUI_locale["enUS"])
|
|
pfUI.env.L["class"] = pfUI.env.L["class"] or tInvert(LOCALIZED_CLASS_NAMES_MALE)
|
|
if not pfUI.env.L["race"] then
|
|
pfUI.env.L["race"] = {}
|
|
local i = 1
|
|
local raceInfo = C_CreatureInfo.GetRaceInfo(i)
|
|
while raceInfo ~= nil do
|
|
pfUI.env.L["race"][raceInfo.clientFileString] = {
|
|
raceName = raceInfo.raceName,
|
|
raceID = raceInfo.raceID,
|
|
faction = C_CreatureInfo.GetFactionInfo(i).groupTag,
|
|
}
|
|
i = i + 1
|
|
raceInfo = C_CreatureInfo.GetRaceInfo(i)
|
|
end
|
|
end
|
|
|
|
return pfUI.env
|
|
end
|
|
|
|
-- [ New Module Registry ]
|
|
-- Tracks modules introduced after initial release so existing users get
|
|
-- a one-time prompt asking if they want to enable them.
|
|
pfUI.new_modules = {}
|
|
|
|
function pfUI:RegisterNewModule(name, label, class)
|
|
table.insert(pfUI.new_modules, { name = name, label = label, class = class })
|
|
end
|
|
|
|
function pfUI:CheckNewModules()
|
|
pfUI_init.seen_modules = pfUI_init.seen_modules or {}
|
|
|
|
local pending = 0
|
|
local playerClass = UnitClassBase("player")
|
|
for _, entry in pairs(pfUI.new_modules) do
|
|
if not pfUI_init.seen_modules[entry.name] and pfUI_init["finalize"] then
|
|
if not entry.class or entry.class == playerClass then
|
|
pending = pending + 1
|
|
end
|
|
end
|
|
end
|
|
|
|
if pending == 0 then return end
|
|
|
|
local remaining = pending
|
|
local needsReload = false
|
|
|
|
local function onAnswer()
|
|
remaining = remaining - 1
|
|
if remaining <= 0 and needsReload then
|
|
ReloadUI()
|
|
end
|
|
end
|
|
|
|
for _, entry in pairs(pfUI.new_modules) do
|
|
local name = entry.name
|
|
if not pfUI_init.seen_modules[name] then
|
|
-- Skip modules restricted to a different class
|
|
if entry.class and entry.class ~= playerClass then
|
|
-- don't mark as seen - player might have a druid alt later
|
|
else
|
|
pfUI_init.seen_modules[name] = true
|
|
|
|
-- Only prompt existing users (firstrun wizard already ran)
|
|
if pfUI_init["finalize"] then
|
|
StaticPopupDialogs["PFUI_NEW_MODULE_" .. strupper(name)] = {
|
|
text = "|cff33ffccpfUI|r: New module available!\n\n|cffffffffDo you want to enable |cff33ffcc" .. (entry.label or name) .. "|r|cffffffff?\n\nYou can always change this later in the pfUI settings.|r",
|
|
button1 = "Yes",
|
|
button2 = "No",
|
|
OnAccept = function()
|
|
pfUI_config["disabled"] = pfUI_config["disabled"] or {}
|
|
pfUI_config["disabled"][name] = nil
|
|
onAnswer()
|
|
end,
|
|
OnCancel = function()
|
|
pfUI_config["disabled"] = pfUI_config["disabled"] or {}
|
|
pfUI_config["disabled"][name] = "1"
|
|
needsReload = true
|
|
onAnswer()
|
|
end,
|
|
timeout = 0,
|
|
whileDead = true,
|
|
hideOnEscape = false,
|
|
}
|
|
StaticPopup_Show("PFUI_NEW_MODULE_" .. strupper(name))
|
|
end
|
|
end -- else (class match)
|
|
end
|
|
end
|
|
end
|
|
|
|
local function BackwardsCompatRegister(func, arg3)
|
|
if arg3 and type(func) == "string" and type(arg3) == "function" and func:find("vanilla") then
|
|
return arg3
|
|
end
|
|
return func
|
|
end
|
|
|
|
function pfUI:RegisterModule(name, func, arg3)
|
|
if pfUI.module[name] then return end
|
|
func = BackwardsCompatRegister(func, arg3)
|
|
pfUI.module[name] = func
|
|
table.insert(pfUI.modules, name)
|
|
if not pfUI.bootup then
|
|
pfUI:LoadModule(name)
|
|
end
|
|
end
|
|
|
|
function pfUI:RegisterSkin(name, func, arg3)
|
|
if pfUI.skin[name] then return end
|
|
func = BackwardsCompatRegister(func, arg3)
|
|
pfUI.skin[name] = func
|
|
table.insert(pfUI.skins, name)
|
|
if not pfUI.bootup then
|
|
pfUI:LoadSkin(name)
|
|
end
|
|
end
|
|
|
|
function pfUI:LoadModule(m)
|
|
setfenv(pfUI.module[m], pfUI:GetEnvironment())
|
|
pfUI.module[m]()
|
|
end
|
|
|
|
function pfUI:LoadSkin(s)
|
|
setfenv(pfUI.skin[s], pfUI:GetEnvironment())
|
|
pfUI.skin[s]()
|
|
end
|
|
|
|
pfUI:SetScript("OnEvent", function()
|
|
|
|
-- make sure to initialize and set our fonts
|
|
-- each time an addon got loaded but only
|
|
-- when the config is already accessible
|
|
if not pfUI.bootup then
|
|
pfUI:UpdateFonts()
|
|
end
|
|
|
|
if arg1 == pfUI.name then
|
|
-- read pfUI version from .toc file. Source/dev installs leave Version as
|
|
-- "@project-version@" until release tooling substitutes it — mark those
|
|
-- explicitly as "dev" instead of pretending they're a real numbered build.
|
|
local raw = tostring(GetAddOnMetadata(pfUI.name, "Version"))
|
|
if raw:find("@") then
|
|
pfUI.version.major, pfUI.version.minor, pfUI.version.fix = 0, 0, 0
|
|
pfUI.version.string = "dev"
|
|
else
|
|
local major, minor, fix = pfUI.api.strsplit(".", string.gsub(raw, "^[vV]", ""))
|
|
pfUI.version.major = tonumber(major) or 0
|
|
pfUI.version.minor = tonumber(minor) or 0
|
|
pfUI.version.fix = tonumber(fix) or 0
|
|
pfUI.version.string = pfUI.version.major .. "." .. pfUI.version.minor .. "." .. pfUI.version.fix
|
|
end
|
|
|
|
-- use "Modern" as default profile on a fresh install
|
|
if pfUI.api.isempty(pfUI_init) and pfUI.api.isempty(pfUI_config) then
|
|
pfUI_config = pfUI.api.CopyTable(pfUI_profiles["Modern"]) or {}
|
|
end
|
|
|
|
pfUI:LoadConfig()
|
|
pfUI:MigrateConfig()
|
|
pfUI:UpdateFonts()
|
|
|
|
-- load modules
|
|
for _, m in pairs(this.modules) do
|
|
if not ( pfUI_config["disabled"] and pfUI_config["disabled"][m] == "1" ) then
|
|
pfUI:LoadModule(m)
|
|
end
|
|
end
|
|
|
|
-- load skins
|
|
for _, s in pairs(this.skins) do
|
|
if not ( pfUI_config["disabled"] and pfUI_config["disabled"]["skin_" .. s] == "1" ) then
|
|
pfUI:LoadSkin(s)
|
|
end
|
|
end
|
|
|
|
pfUI.bootup = nil
|
|
|
|
-- Prompt existing users about newly introduced modules
|
|
pfUI:CheckNewModules()
|
|
end
|
|
end)
|
|
|
|
pfUI.backdrop = {
|
|
bgFile = "Interface\\BUTTONS\\WHITE8X8", tile = false, tileSize = 0,
|
|
edgeFile = "Interface\\BUTTONS\\WHITE8X8", edgeSize = 1,
|
|
insets = {left = -1, right = -1, top = -1, bottom = -1},
|
|
}
|
|
pfUI.backdrop_no_top = pfUI.backdrop
|
|
|
|
pfUI.backdrop_thin = {
|
|
bgFile = "Interface\\BUTTONS\\WHITE8X8", tile = false, tileSize = 0,
|
|
edgeFile = "Interface\\BUTTONS\\WHITE8X8", edgeSize = 1,
|
|
insets = {left = 0, right = 0, top = 0, bottom = 0},
|
|
}
|
|
|
|
pfUI.backdrop_hover = {
|
|
edgeFile = "Interface\\BUTTONS\\WHITE8X8", edgeSize = 24,
|
|
insets = {left = -1, right = -1, top = -1, bottom = -1},
|
|
}
|
|
|
|
pfUI.backdrop_shadow = {
|
|
edgeFile = pfUI.media["img:glow2"], edgeSize = 8,
|
|
insets = {left = 0, right = 0, top = 0, bottom = 0},
|
|
}
|
|
|
|
pfUI.backdrop_blizz_bg = {
|
|
bgFile = "Interface\\BUTTONS\\WHITE8X8", tile = true, tileSize = 8,
|
|
insets = { left = 3, right = 3, top = 3, bottom = 3 }
|
|
}
|
|
|
|
pfUI.backdrop_blizz_border = {
|
|
edgeFile = pfUI.media["img:border_blizz"], edgeSize = 6,
|
|
insets = { left = 3, right = 3, top = 3, bottom = 3 }
|
|
}
|
|
|
|
pfUI.backdrop_blizz_full = {
|
|
bgFile = "Interface\\BUTTONS\\WHITE8X8", tile = true, tileSize = 8,
|
|
edgeFile = pfUI.media["img:border_blizz"], edgeSize = 6,
|
|
insets = { left = 3, right = 3, top = 3, bottom = 3 }
|
|
}
|
|
|
|
message = function(msg)
|
|
DEFAULT_CHAT_FRAME:AddMessage("|cffcccc33INFO: |cffffff55" .. ( msg or "nil" ))
|
|
end
|
|
print = print or message
|
|
|
|
error = function(msg)
|
|
if PF_DEBUG_MODE then message(debugstack()) end
|
|
if string.find(msg, "AddOns\\pfUI") then
|
|
DEFAULT_CHAT_FRAME:AddMessage("|cffcc3333ERROR: |cffff5555".. (msg or "nil" ))
|
|
elseif not pfUI_config or (pfUI_config.global and pfUI_config.global.errors == "1") then
|
|
DEFAULT_CHAT_FRAME:AddMessage("|cffcc3333ERROR: |cffff5555".. (msg or "nil" ))
|
|
end
|
|
end
|
|
seterrorhandler(error)
|
|
|
|
function pfUI.SetupCVars()
|
|
ClearTutorials()
|
|
TutorialFrame_HideAllAlerts()
|
|
|
|
ConsoleExec("CameraDistanceMaxFactor 5")
|
|
|
|
SetCVar("autoSelfCast", "1")
|
|
SetCVar("profanityFilter", "0")
|
|
|
|
MultiActionBar_ShowAllGrids()
|
|
ALWAYS_SHOW_MULTIBARS = "1"
|
|
|
|
SHOW_BUFF_DURATIONS = "1"
|
|
QUEST_FADING_DISABLE = "1"
|
|
NAMEPLATES_ON = "1"
|
|
SIMPLE_CHAT = "0"
|
|
|
|
-- Only force combat text CVars when not using the Invisible font.
|
|
-- If AdobeBlank is selected, the player wants no combat text -- respect that.
|
|
local isInvisible = pfUI_config.global.font_combat and
|
|
string.find(pfUI_config.global.font_combat, "AdobeBlank")
|
|
if not isInvisible then
|
|
SHOW_COMBAT_TEXT = "1"
|
|
COMBAT_TEXT_SHOW_LOW_HEALTH_MANA = "1"
|
|
COMBAT_TEXT_SHOW_AURAS = "1"
|
|
COMBAT_TEXT_SHOW_AURA_FADE = "1"
|
|
COMBAT_TEXT_SHOW_COMBAT_STATE = "1"
|
|
COMBAT_TEXT_SHOW_DODGE_PARRY_MISS = "1"
|
|
COMBAT_TEXT_SHOW_RESISTANCES = "1"
|
|
COMBAT_TEXT_SHOW_REPUTATION = "1"
|
|
COMBAT_TEXT_SHOW_REACTIVES = "1"
|
|
COMBAT_TEXT_SHOW_FRIENDLY_NAMES = "1"
|
|
COMBAT_TEXT_SHOW_COMBO_POINTS = "1"
|
|
COMBAT_TEXT_SHOW_MANA = "1"
|
|
COMBAT_TEXT_FLOAT_MODE = "1"
|
|
COMBAT_TEXT_SHOW_HONOR_GAINED = "1"
|
|
end
|
|
UIParentLoadAddOn("Blizzard_CombatText")
|
|
end
|
|
|
|
do -- RunMacroText
|
|
local obj = setmetatable({ ["GetText"] = function(self) return self.text end }, {
|
|
__index = function(tab,key)
|
|
local value = function() return end
|
|
rawset(tab,key,value)
|
|
return value
|
|
end
|
|
})
|
|
|
|
function RunMacroText(text)
|
|
obj.text = text
|
|
ChatEdit_ParseText(obj, 1)
|
|
end
|
|
end
|