From 96c005239db189255682e9d6abaa5ef349441db2 Mon Sep 17 00:00:00 2001 From: Meow <30401521+me0wg4ming@users.noreply.github.com> Date: Sat, 3 Jan 2026 12:33:07 +0100 Subject: [PATCH] performance update --- modules/actionbar.lua | 93 +---- modules/actionbar_nodebug.lua | 35 +- modules/addonbuttons.lua | 2 +- modules/addons.lua | 2 +- modules/afkcam.lua | 2 +- modules/autovendor.lua | 2 +- modules/bags.lua | 6 +- modules/bgscore.lua | 2 +- modules/bubbles.lua | 2 +- modules/buff.lua | 2 +- modules/buffwatch.lua | 2 +- modules/castbar.lua | 21 +- modules/chat.lua | 26 +- modules/chatcopy.lua | 2 +- modules/combopoints.lua | 2 +- modules/cooldown.lua | 15 +- modules/easteregg.lua | 2 +- modules/energytick.lua | 2 +- modules/farmmode.lua | 2 +- modules/feigndeath.lua | 2 +- modules/firstrun.lua | 2 +- modules/focus.lua | 2 +- modules/group.lua | 2 +- modules/gryphons.lua | 2 +- modules/gui.lua | 64 +-- modules/hoverbind.lua | 2 +- modules/infight.lua | 2 +- modules/loot.lua | 2 +- modules/map.lua | 2 +- modules/mapreveal.lua | 2 +- modules/minimap.lua | 4 +- modules/mirrortimers.lua | 2 +- modules/nameplates.lua | 3 +- modules/nampower.lua | 743 +++++++++++++++++++++++++++++++++ modules/panel.lua | 2 +- modules/pet.lua | 2 +- modules/pettarget.lua | 2 +- modules/pixelperfect.lua | 2 +- modules/player.lua | 2 +- modules/questitem.lua | 6 +- modules/raid.lua | 7 +- modules/roll.lua | 2 +- modules/screenshot.lua | 2 +- modules/sellvalue.lua | 2 +- modules/share.lua | 2 +- modules/skin.lua | 2 +- modules/socialmod.lua | 2 +- modules/superwow.lua | 379 +++++++++++++++-- modules/target.lua | 2 +- modules/targettarget.lua | 2 +- modules/targettargettarget.lua | 2 +- modules/thirdparty.lua | 14 +- modules/tooltip.lua | 2 +- modules/totems.lua | 5 +- modules/uf_tukui.lua | 2 +- modules/unitxp.lua | 234 +++++++++++ modules/unlock.lua | 2 +- modules/unusable.lua | 2 +- modules/updatenotify.lua | 2 +- modules/xpbar.lua | 2 +- 60 files changed, 1485 insertions(+), 258 deletions(-) create mode 100644 modules/nampower.lua create mode 100644 modules/unitxp.lua diff --git a/modules/actionbar.lua b/modules/actionbar.lua index df1eae1a..10e542dc 100644 --- a/modules/actionbar.lua +++ b/modules/actionbar.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("actionbar", "vanilla:tbc", function () +pfUI:RegisterModule("actionbar", "vanilla", function () local _, class = UnitClass("player") local color = RAID_CLASS_COLORS[class] local cr, cg, cb = color.r , color.g, color.b @@ -395,14 +395,6 @@ pfUI:RegisterModule("actionbar", "vanilla:tbc", function () for line in gfind(body, "[^%\n]+") do _, _, match = string.find(line, '^#showtooltip (.+)') - -- skip any further manual macro scanning on - -- gameclients with native macro spell detection - if pfUI.client > 11200 and match then - self.spellslot = nil - self.booktype = nil - return - end - -- allow the user to disable the scan if match and strfind(match, "disable") then return @@ -1176,39 +1168,6 @@ pfUI:RegisterModule("actionbar", "vanilla:tbc", function () buttoncache[id] = f end - -- set required attributes for regular tbc buttons - if pfUI.client > 11200 then - if bar == 11 then - f:SetAttribute("type", "spell") - f:SetAttribute('spell', select(2, GetShapeshiftFormInfo(button))) - elseif bar == 12 then - f:SetAttribute("type1", "pet") - f:SetAttribute("action1", button) - f:SetAttribute("type2", "macro") - f:SetAttribute("macrotext2", "/click PetActionButton".. button .. " RightButton") - else - bars[bar]:SetAttribute("addchild", f) - f:SetAttribute("type", "action") - f:SetAttribute("action", id) - f:SetAttribute("checkselfcast", true) - f:SetAttribute("useparent-unit", true) - f:SetAttribute("useparent-statebutton", true) - - for state = 0, 11 do -- add custom states - local action = ((state == 0 and bar or state)-1)*12+button - f:SetAttribute(string.format("*type-S%d", state), "action") - f:SetAttribute(string.format("*type-S%dRight", state), "action") - f:SetAttribute(string.format("*action-S%d", state), action) - f:SetAttribute(string.format("*action-S%dRight", state), action) - if C.bars.rightself == "1" then - f:SetAttribute(string.format("*unit-S%dRight", state), "player") - else - f:SetAttribute(string.format("*unit-S%dRight", state), nil) - end - end - end - end - -- set keydown option if C.bars.keydown == "1" then f:RegisterForClicks("LeftButtonDown", "RightButtonDown") @@ -1335,40 +1294,26 @@ pfUI:RegisterModule("actionbar", "vanilla:tbc", function () if enable == "1" then -- handle pet bar if i == 12 then - if pfUI.client > 11200 then - if InCombatLockdown and InCombatLockdown() then - -- don't process those events during combat - else - -- set state driver for pet bars - bars[i]:SetAttribute("unit", "pet") - local visibility = pfUI.unlock and pfUI.unlock:IsShown() and "show" or petvisibility - if bars[i].visibility ~= visibility then - RegisterStateDriver(bars[i], 'visibility', visibility) - bars[i].visibility = visibility - end - end + -- only show when pet actions exists + if PetHasActionBar() or pfUI.unlock and pfUI.unlock:IsShown() then + bars[i]:Show() else - -- only show when pet actions exists - if PetHasActionBar() or pfUI.unlock and pfUI.unlock:IsShown() then - bars[i]:Show() - else - bars[i]:Hide() - end + bars[i]:Hide() + end - -- show/hide petbar on petbar updates - if init then - bars[i]:RegisterEvent("PET_BAR_UPDATE") - bars[i]:SetScript("OnEvent", function() - -- hide obsolete buttons - for i=1, NUM_PET_ACTION_SLOTS do - if not PetHasActionBar() and bars[12][i] then - bars[12][i]:Hide() - end - end - -- refresh layout - CreateActionBar(12) - end) - end + -- show/hide petbar on petbar updates + if init then + bars[i]:RegisterEvent("PET_BAR_UPDATE") + bars[i]:SetScript("OnEvent", function() + -- hide obsolete buttons + for i=1, NUM_PET_ACTION_SLOTS do + if not PetHasActionBar() and bars[12][i] then + bars[12][i]:Hide() + end + end + -- refresh layout + CreateActionBar(12) + end) end -- handle shapeshift bar diff --git a/modules/actionbar_nodebug.lua b/modules/actionbar_nodebug.lua index ca9a91ba..9edd0469 100644 --- a/modules/actionbar_nodebug.lua +++ b/modules/actionbar_nodebug.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("actionbar", "vanilla:tbc", function () +pfUI:RegisterModule("actionbar", "vanilla", function () local _, class = UnitClass("player") local color = RAID_CLASS_COLORS[class] local cr, cg, cb = color.r , color.g, color.b @@ -1184,39 +1184,6 @@ pfUI:RegisterModule("actionbar", "vanilla:tbc", function () buttoncache[id] = f end - -- set required attributes for regular tbc buttons - if pfUI.client > 11200 then - if bar == 11 then - f:SetAttribute("type", "spell") - f:SetAttribute('spell', select(2, GetShapeshiftFormInfo(button))) - elseif bar == 12 then - f:SetAttribute("type1", "pet") - f:SetAttribute("action1", button) - f:SetAttribute("type2", "macro") - f:SetAttribute("macrotext2", "/click PetActionButton".. button .. " RightButton") - else - bars[bar]:SetAttribute("addchild", f) - f:SetAttribute("type", "action") - f:SetAttribute("action", id) - f:SetAttribute("checkselfcast", true) - f:SetAttribute("useparent-unit", true) - f:SetAttribute("useparent-statebutton", true) - - for state = 0, 11 do -- add custom states - local action = ((state == 0 and bar or state)-1)*12+button - f:SetAttribute(string.format("*type-S%d", state), "action") - f:SetAttribute(string.format("*type-S%dRight", state), "action") - f:SetAttribute(string.format("*action-S%d", state), action) - f:SetAttribute(string.format("*action-S%dRight", state), action) - if C.bars.rightself == "1" then - f:SetAttribute(string.format("*unit-S%dRight", state), "player") - else - f:SetAttribute(string.format("*unit-S%dRight", state), nil) - end - end - end - end - -- set keydown option if C.bars.keydown == "1" then f:RegisterForClicks("LeftButtonDown", "RightButtonDown") diff --git a/modules/addonbuttons.lua b/modules/addonbuttons.lua index c083163f..319ebf3d 100644 --- a/modules/addonbuttons.lua +++ b/modules/addonbuttons.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("addonbuttons", "vanilla:tbc", function () +pfUI:RegisterModule("addonbuttons", "vanilla", function () if not pfUI.minimap then return end if C.abuttons.enable == "0" then return end diff --git a/modules/addons.lua b/modules/addons.lua index 220035c8..da35d396 100644 --- a/modules/addons.lua +++ b/modules/addons.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("addons", "vanilla:tbc", function () +pfUI:RegisterModule("addons", "vanilla", function () local rawborder, border = GetBorderSize() -- add main menu button diff --git a/modules/afkcam.lua b/modules/afkcam.lua index a9d55d0d..504ad036 100644 --- a/modules/afkcam.lua +++ b/modules/afkcam.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("afkcam", "vanilla:tbc", function () +pfUI:RegisterModule("afkcam", "vanilla", function () local MARKED_AFK_CAPTURE = SanitizePattern(MARKED_AFK_MESSAGE) local social_chats = { "CHAT_MSG_SAY", diff --git a/modules/autovendor.lua b/modules/autovendor.lua index 57c259ab..5dc88369 100644 --- a/modules/autovendor.lua +++ b/modules/autovendor.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("autovendor", "vanilla:tbc", function () +pfUI:RegisterModule("autovendor", "vanilla", function () local rawborder, border = GetBorderSize() local bpad = rawborder > 1 and border - GetPerfectPixel() or GetPerfectPixel() local processed = {} diff --git a/modules/bags.lua b/modules/bags.lua index d343d98a..49d5a084 100644 --- a/modules/bags.lua +++ b/modules/bags.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("bags", "vanilla:tbc", function () +pfUI:RegisterModule("bags", "vanilla", function () local rawborder, default_border = GetBorderSize("bags") local knownInventorySpellTextures = { @@ -573,8 +573,8 @@ pfUI:RegisterModule("bags", "vanilla:tbc", function () SlotLeave() end) - -- On TBC, the OnEvent function of the template scans for framenames, - -- and obviously doesn't know the pf-Names. Therefore, triggering + -- The OnEvent function of the template scans for framenames, + -- and doesn't know the pf-Names. Therefore, triggering -- the update function on each frame manually if frame == pfUI.bag.left and BankFrameItemButton_Update then local SlotUpdate = frame.bagslots.slots[slot].frame:GetScript("OnUpdate") diff --git a/modules/bgscore.lua b/modules/bgscore.lua index 932f3918..693c6560 100644 --- a/modules/bgscore.lua +++ b/modules/bgscore.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("bgscore", "vanilla:tbc", function () +pfUI:RegisterModule("bgscore", "vanilla", function () local bgframe = WorldStateAlwaysUpFrame if not bgframe then bgframe = CreateFrame("Frame", "WorldStateAlwaysUpFrame", UIParent) diff --git a/modules/bubbles.lua b/modules/bubbles.lua index 61f9e991..16f4dba6 100644 --- a/modules/bubbles.lua +++ b/modules/bubbles.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("bubbles", "vanilla:tbc", function () +pfUI:RegisterModule("bubbles", "vanilla", function () local alpha = tonumber(C.chat.bubbles.alpha) diff --git a/modules/buff.lua b/modules/buff.lua index f7114416..7dfbabf6 100644 --- a/modules/buff.lua +++ b/modules/buff.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("buff", "vanilla:tbc", function () +pfUI:RegisterModule("buff", "vanilla", function () -- Hide Blizz BuffFrame:Hide() BuffFrame:UnregisterAllEvents() diff --git a/modules/buffwatch.lua b/modules/buffwatch.lua index e9109b2a..f9c7a154 100644 --- a/modules/buffwatch.lua +++ b/modules/buffwatch.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("buffwatch", "vanilla:tbc", function () +pfUI:RegisterModule("buffwatch", "vanilla", function () local rawborder, border = GetBorderSize("panels") local scanner = libtipscan:GetScanner("buffwatch") diff --git a/modules/castbar.lua b/modules/castbar.lua index bb2b071e..b8ad0df7 100644 --- a/modules/castbar.lua +++ b/modules/castbar.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("castbar", "vanilla:tbc", function () +pfUI:RegisterModule("castbar", "vanilla", function () local font = C.castbar.use_unitfonts == "1" and pfUI.font_unit or pfUI.font_default local font_size = C.castbar.use_unitfonts == "1" and C.global.font_unit_size or C.global.font_size local rawborder, default_border = GetBorderSize("unitframes") @@ -86,11 +86,20 @@ pfUI:RegisterModule("castbar", "vanilla:tbc", function () local query = this.unitstr ~= "" and this.unitstr or this.unitname if not query then return end - -- transform all non player unitstrings to unit guids - if superwow_active and this.unitstr and not UnitIsUnit(this.unitstr, 'player') then + -- transform unitstrings to unit guids when SuperWoW is active + -- SuperWoW stores cast data by GUID for all units INCLUDING player + -- BUT: For player casts, we need to use libcast data because it handles pushback correctly + local useLibcastForPlayer = this.unitstr == "player" + + if superwow_active and this.unitstr and not useLibcastForPlayer then local _, guid = UnitExists(this.unitstr) query = guid or query end + + -- For player: use player name to query libcast.db directly + if useLibcastForPlayer then + query = UnitName("player") + end local cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo(query) if not cast then @@ -149,10 +158,10 @@ pfUI:RegisterModule("castbar", "vanilla:tbc", function () if this.showtimer then if this.delay and this.delay > 0 then - local delay = "|cffffaaaa" .. (channel and "-" or "+") .. round(this.delay,1) .. " |r " - this.bar.right:SetText(delay .. string.format("%.1f",cur) .. " / " .. round(max,1)) + local delay = "|cffffaaaa" .. (channel and "-" or "+") .. round(this.delay,2) .. " |r " + this.bar.right:SetText(delay .. string.format("%.2f",cur) .. " / " .. round(max,2)) else - this.bar.right:SetText(string.format("%.1f",cur) .. " / " .. round(max,1)) + this.bar.right:SetText(string.format("%.2f",cur) .. " / " .. round(max,2)) end end diff --git a/modules/chat.lua b/modules/chat.lua index 884d027a..6268bd4f 100644 --- a/modules/chat.lua +++ b/modules/chat.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("chat", "vanilla:tbc", function () +pfUI:RegisterModule("chat", "vanilla", function () local panelfont = C.panel.use_unitfonts == "1" and pfUI.font_unit or pfUI.font_default local panelfont_size = C.panel.use_unitfonts == "1" and C.global.font_unit_size or C.global.font_size local rawborder, default_border = GetBorderSize("chat") @@ -727,6 +727,12 @@ pfUI:RegisterModule("chat", "vanilla:tbc", function () end end) + local function GetPlayerLevel(name) + if not pfUI_playerDB then return nil end + if not pfUI_playerDB[name] then return nil end + return pfUI_playerDB[name].level + end + local function ScanWhoName(name) -- abort if another query is ongoing if who_query.pending then return end @@ -747,8 +753,7 @@ pfUI:RegisterModule("chat", "vanilla:tbc", function () end -- Remove prat CLINKs - text = gsub(text, "{CLINK:(%x+):([%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-):([^}]-)}", "|c%1|Hitem:%2|h[%3]|h|r") -- tbc - text = gsub(text, "{CLINK:(%x+):([%d-]-:[%d-]-:[%d-]-:[%d-]-):([^}]-)}", "|c%1|Hitem:%2|h[%3]|h|r") -- vanilla + text = gsub(text, "{CLINK:(%x+):([%d-]-:[%d-]-:[%d-]-:[%d-]-):([^}]-)}", "|c%1|Hitem:%2|h[%3]|h|r") -- Remove chatter CLINKs text = gsub(text, "{CLINK:item:(%x+):([%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-):([^}]-)}", "|c%1|Hitem:%2|h[%3]|h|r") @@ -785,6 +790,21 @@ pfUI:RegisterModule("chat", "vanilla:tbc", function () end end + -- display player levels if available + if C.chat.text.playerlevel == "1" then + for name in gfind(text, "|Hplayer:(.-)|h") do + local real, _ = strsplit(":", name) + local level = GetPlayerLevel(real) + + if level then + local levelcolor = rgbhex(GetDifficultyColor(level)) + -- Add level after the player name, before the closing bracket + text = string.gsub(text, "(|Hplayer:" .. name .. "|h.-|h|r)" .. right, + "%1 " .. levelcolor .. level .. "|r" .. right) + end + end + end + -- reduce channel name to number if C.chat.text.channelnumonly == "1" then local channel = string.gsub(text, ".*%[(.-)%]%s+(.*|Hplayer).+", "%1") diff --git a/modules/chatcopy.lua b/modules/chatcopy.lua index 11da75e0..c67b2a01 100644 --- a/modules/chatcopy.lua +++ b/modules/chatcopy.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("chatcopy", "vanilla:tbc", function () +pfUI:RegisterModule("chatcopy", "vanilla", function () local limit = 100 local f = CreateFrame("Frame") f:RegisterEvent("PLAYER_ENTERING_WORLD") diff --git a/modules/combopoints.lua b/modules/combopoints.lua index f874974e..839f50d7 100644 --- a/modules/combopoints.lua +++ b/modules/combopoints.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("combopoints", "vanilla:tbc", function () +pfUI:RegisterModule("combopoints", "vanilla", function () local rawborder, border = GetBorderSize() -- Hide Blizzard combo point frame and unregister all events to prevent it from popping up again diff --git a/modules/cooldown.lua b/modules/cooldown.lua index 0a293940..9561cf83 100644 --- a/modules/cooldown.lua +++ b/modules/cooldown.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("cooldown", "vanilla:tbc", function () +pfUI:RegisterModule("cooldown", "vanilla", function () -- cache values local lowcolor = {strsplit(",", C.appearance.cd.lowcolor)} local normalcolor = {strsplit(",", C.appearance.cd.normalcolor)} @@ -134,14 +134,7 @@ pfUI:RegisterModule("cooldown", "vanilla:tbc", function () end end - if pfUI.expansion == "vanilla" then - -- vanilla does not have a cooldown frame type, so we hook the - -- regular SetTimer function that each one is calling. - hooksecurefunc("CooldownFrame_SetTimer", SetCooldown) - else - -- tbc and later expansion have a cooldown frametype, so we can - -- hook directly into the frame creation and add our function there. - local methods = getmetatable(CreateFrame('Cooldown', nil, nil, 'CooldownFrameTemplate')).__index - hooksecurefunc(methods, 'SetCooldown', SetCooldown) - end + -- vanilla does not have a cooldown frame type, so we hook the + -- regular SetTimer function that each one is calling. + hooksecurefunc("CooldownFrame_SetTimer", SetCooldown) end) diff --git a/modules/easteregg.lua b/modules/easteregg.lua index 35a76c6d..9c5a7512 100644 --- a/modules/easteregg.lua +++ b/modules/easteregg.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("easteregg", "vanilla:tbc", function () +pfUI:RegisterModule("easteregg", "vanilla", function () -- merry x-mas! if date("%m%d") == "1224" or date("%m%d") == "1225" then local title = (UnitFactionGroup("player") == "Horde") and PVP_RANK_18_0 or PVP_RANK_18_1 diff --git a/modules/energytick.lua b/modules/energytick.lua index d3c8e24d..cfcffb71 100644 --- a/modules/energytick.lua +++ b/modules/energytick.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("energytick", "vanilla:tbc", function () +pfUI:RegisterModule("energytick", "vanilla", function () if not pfUI.uf or not pfUI.uf.player then return end local energytick = CreateFrame("Frame", nil, pfUI.uf.player.power.bar) diff --git a/modules/farmmode.lua b/modules/farmmode.lua index 19478884..0a1e3bad 100644 --- a/modules/farmmode.lua +++ b/modules/farmmode.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("farmmode", "vanilla:tbc", function () +pfUI:RegisterModule("farmmode", "vanilla", function () local function ToggleFarmMode() if pfUI.farmmap:IsShown() then pfUI.farmmap:Hide() diff --git a/modules/feigndeath.lua b/modules/feigndeath.lua index ba4e5fcd..01a5e41f 100644 --- a/modules/feigndeath.lua +++ b/modules/feigndeath.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("feigndeath", "vanilla:tbc", function () +pfUI:RegisterModule("feigndeath", "vanilla", function () local cache = { } local scanner = libtipscan:GetScanner("feigndeath") local healthbar = scanner:GetChildren() diff --git a/modules/firstrun.lua b/modules/firstrun.lua index f27bd7f2..582cbe45 100644 --- a/modules/firstrun.lua +++ b/modules/firstrun.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("firstrun", "vanilla:tbc", function () +pfUI:RegisterModule("firstrun", "vanilla", function () pfUI.firstrun = CreateFrame("Frame", "pfFirstRunWizard", UIParent) pfUI.firstrun.steps = {} diff --git a/modules/focus.lua b/modules/focus.lua index a2e24582..16f4124a 100644 --- a/modules/focus.lua +++ b/modules/focus.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("focus", "vanilla:tbc", function () +pfUI:RegisterModule("focus", "vanilla", function () -- do not go further on disabled UFs if C.unitframes.disable == "1" then return end diff --git a/modules/group.lua b/modules/group.lua index 5aa0aaa2..81684f70 100644 --- a/modules/group.lua +++ b/modules/group.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("group", "vanilla:tbc", function () +pfUI:RegisterModule("group", "vanilla", function () -- do not go further on disabled UFs if C.unitframes.disable == "1" then return end diff --git a/modules/gryphons.lua b/modules/gryphons.lua index 96eba04e..287ae5b8 100644 --- a/modules/gryphons.lua +++ b/modules/gryphons.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("gryphons", "vanilla:tbc", function () +pfUI:RegisterModule("gryphons", "vanilla", function () pfUI.gryphons = { frames = { left = CreateFrame("Frame"), diff --git a/modules/gui.lua b/modules/gui.lua index 2827caa8..64785efe 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("gui", "vanilla:tbc", function () +pfUI:RegisterModule("gui", "vanilla", function () local Reload, U, CreateConfig, CreateTabFrame, CreateArea, CreateGUIEntry, EntryUpdate -- "searchDB" gets populated when CreateConfig is called. The table holds @@ -1657,6 +1657,19 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function () CreateConfig(nil, T["Show Druid Mana Bar"], C.unitframes, "druidmanabar", "checkbox", nil, nil, nil, nil, "vanilla" ) CreateConfig(nil, T["Druid Mana Bar Height"], C.unitframes, "druidmanaheight", nil, nil, nil, nil, nil, "vanilla" ) CreateConfig(nil, T["Druid Mana Bar Text"], C.unitframes, "druidmanatext", "checkbox", nil, nil, nil, nil, "vanilla" ) + CreateConfig(nil, T["Track Group on Minimap"], C.unitframes, "track_group", "checkbox", nil, nil, nil, nil, "vanilla" ) + + CreateConfig(nil, T["Nampower Settings"], nil, nil, "header") + CreateConfig(nil, T["Show Spell Queue Indicator"], C.unitframes, "spellqueue", "checkbox", nil, nil, nil, nil, "vanilla" ) + CreateConfig(nil, T["Spell Queue Icon Size"], C.unitframes, "spellqueuesize", nil, nil, nil, nil, nil, "vanilla" ) + CreateConfig(nil, T["Show Reactive Spell Indicator"], C.unitframes, "reactive_indicator", "checkbox", nil, nil, nil, nil, "vanilla" ) + CreateConfig(nil, T["Reactive Indicator Size"], C.unitframes, "reactive_size", nil, nil, nil, nil, nil, "vanilla" ) + CreateConfig(nil, T["Enhanced Buff Tracking"], C.unitframes, "nampower_buffs", "checkbox", nil, nil, nil, nil, "vanilla" ) + + CreateConfig(nil, T["UnitXP Settings"], nil, nil, "header") + CreateConfig(nil, T["Show Line of Sight Indicator"], C.unitframes, "los_indicator", "checkbox", nil, nil, nil, nil, "vanilla" ) + CreateConfig(nil, T["Show Behind Indicator"], C.unitframes, "behind_indicator", "checkbox", nil, nil, nil, nil, "vanilla" ) + CreateConfig(nil, T["Enable OS Notifications"], C.unitframes, "unitxp_notify", "checkbox", nil, nil, nil, nil, "vanilla" ) end) -- Shared Unit- and Groupframes @@ -2263,6 +2276,7 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function () CreateConfig(nil, T["Generate Playerlinks"], C.chat.text, "playerlinks", "checkbox") CreateConfig(nil, T["Enable URL Detection"], C.chat.text, "detecturl", "checkbox") CreateConfig(nil, T["Enable Class Colors"], C.chat.text, "classcolor", "checkbox") + CreateConfig(nil, T["Enable Player Levels"], C.chat.text, "playerlevel", "checkbox") CreateConfig(nil, T["Who Search Unknown Classes (|cffffaaaaExperimental|r)"], C.chat.text, "whosearchunknown", "checkbox") CreateConfig(nil, T["Colorize Unknown Classes"], C.chat.text, "tintunknown", "checkbox") CreateConfig(nil, T["Unknown Class Color"], C.chat.text, "unknowncolor", "color") @@ -2388,36 +2402,26 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function () CreateConfig(nil, "ShaguDPS (" .. T["Dock"] .. ")", C.thirdparty.shagudps, "dock", "checkbox") CreateConfig(nil, "DPSMate (" .. T["Skin"] .. ")", C.thirdparty.dpsmate, "skin", "checkbox") CreateConfig(nil, "DPSMate (" .. T["Dock"] .. ")", C.thirdparty.dpsmate, "dock", "checkbox") - CreateConfig(nil, "Recount (" .. T["Skin"] .. ")", C.thirdparty.recount, "skin", "checkbox", nil, nil, nil, nil, "tbc") - CreateConfig(nil, "Recount (" .. T["Dock"] .. ")", C.thirdparty.recount, "dock", "checkbox", nil, nil, nil, nil, "tbc") - CreateConfig(nil, "Omen (" .. T["Skin"] .. ")", C.thirdparty.omen, "skin", "checkbox", nil, nil, nil, nil, "tbc") - CreateConfig(nil, "Omen (" .. T["Dock"] .. ")", C.thirdparty.omen, "dock", "checkbox", nil, nil, nil, nil, "tbc") - CreateConfig(nil, "SWStats (" .. T["Skin"] .. ")", C.thirdparty.swstats, "skin", "checkbox", nil, nil, nil, nil, "vanilla") - CreateConfig(nil, "SWStats (" .. T["Dock"] .. ")", C.thirdparty.swstats, "dock", "checkbox", nil, nil, nil, nil, "vanilla") - CreateConfig(nil, "KLH Threat Meter (" .. T["Skin"] .. ")", C.thirdparty.ktm, "skin", "checkbox", nil, nil, nil, nil, "vanilla") - CreateConfig(nil, "KLH Threat Meter (" .. T["Dock"] .. ")", C.thirdparty.ktm, "dock", "checkbox", nil, nil, nil, nil, "vanilla") - CreateConfig(nil, "TW Threatmeter (" .. T["Skin"] .. ")", C.thirdparty.twt, "skin", "checkbox", nil, nil, nil, nil, "vanilla") - CreateConfig(nil, "TW Threatmeter (" .. T["Dock"] .. ")", C.thirdparty.twt, "dock", "checkbox", nil, nil, nil, nil, "vanilla") - CreateConfig(nil, "WIM", C.thirdparty.wim, "enable", "checkbox", nil, nil, nil, nil, "vanilla") - CreateConfig(nil, "HealComm", C.thirdparty.healcomm, "enable", "checkbox", nil, nil, nil, nil, "vanilla") - CreateConfig(nil, "SortBags", C.thirdparty.sortbags, "enable", "checkbox", nil, nil, nil, nil, "vanilla") - CreateConfig(nil, "Bag_Sort", C.thirdparty.bag_sort, "enable", "checkbox", nil, nil, nil, nil, "tbc") + CreateConfig(nil, "SWStats (" .. T["Skin"] .. ")", C.thirdparty.swstats, "skin", "checkbox") + CreateConfig(nil, "SWStats (" .. T["Dock"] .. ")", C.thirdparty.swstats, "dock", "checkbox") + CreateConfig(nil, "KLH Threat Meter (" .. T["Skin"] .. ")", C.thirdparty.ktm, "skin", "checkbox") + CreateConfig(nil, "KLH Threat Meter (" .. T["Dock"] .. ")", C.thirdparty.ktm, "dock", "checkbox") + CreateConfig(nil, "TW Threatmeter (" .. T["Skin"] .. ")", C.thirdparty.twt, "skin", "checkbox") + CreateConfig(nil, "TW Threatmeter (" .. T["Dock"] .. ")", C.thirdparty.twt, "dock", "checkbox") + CreateConfig(nil, "WIM", C.thirdparty.wim, "enable", "checkbox") + CreateConfig(nil, "HealComm", C.thirdparty.healcomm, "enable", "checkbox") + CreateConfig(nil, "SortBags", C.thirdparty.sortbags, "enable", "checkbox") CreateConfig(nil, "MrPlow", C.thirdparty.mrplow, "enable", "checkbox") - CreateConfig(nil, "BetterCharacterStats", C.thirdparty.bcs, "enable", "checkbox", nil, nil, nil, nil, "vanilla") - CreateConfig(nil, "Crafty", C.thirdparty.crafty, "enable", "checkbox", nil, nil, nil, nil, "vanilla") - CreateConfig(nil, "CleverMacro", C.thirdparty.clevermacro, "enable", "checkbox", nil, nil, nil, nil, "vanilla") - CreateConfig(nil, "AckisRecipeList", C.thirdparty.ackis, "enable", "checkbox", nil, nil, nil, nil, "tbc") - CreateConfig(nil, "SheepWatch", C.thirdparty.sheepwatch, "enable", "checkbox", nil, nil, nil, nil, "tbc") - CreateConfig(nil, "TotemTimers", C.thirdparty.totemtimers, "enable", "checkbox", nil, nil, nil, nil, "tbc") - CreateConfig(nil, "DruidBar", C.thirdparty.druidbar, "enable", "checkbox", nil, nil, nil, nil, "tbc") - CreateConfig(nil, "BCEPGP", C.thirdparty.bcepgp, "enable", "checkbox", nil, nil, nil, nil, "tbc") - CreateConfig(nil, "FlightMap", C.thirdparty.flightmap, "enable", "checkbox", nil, nil, nil, nil, "vanilla") - CreateConfig(nil, "TheoryCraft", C.thirdparty.theorycraft, "enable", "checkbox", nil, nil, nil, nil, "vanilla") - CreateConfig(nil, "SuperMacro", C.thirdparty.supermacro, "enable", "checkbox", nil, nil, nil, nil, "vanilla") - CreateConfig(nil, "AtlasLoot", C.thirdparty.atlasloot, "enable", "checkbox", nil, nil, nil, nil, "vanilla") - CreateConfig(nil, "MyRolePlay", C.thirdparty.myroleplay, "enable", "checkbox", nil, nil, nil, nil, "vanilla") - CreateConfig(nil, "DruidManaBar", C.thirdparty.druidmana, "enable", "checkbox", nil, nil, nil, nil, "vanilla") - CreateConfig(nil, "NoteIt", C.thirdparty.noteit, "enable", "checkbox", nil, nil, nil, nil, "vanilla") + CreateConfig(nil, "BetterCharacterStats", C.thirdparty.bcs, "enable", "checkbox") + CreateConfig(nil, "Crafty", C.thirdparty.crafty, "enable", "checkbox") + CreateConfig(nil, "CleverMacro", C.thirdparty.clevermacro, "enable", "checkbox") + CreateConfig(nil, "FlightMap", C.thirdparty.flightmap, "enable", "checkbox") + CreateConfig(nil, "TheoryCraft", C.thirdparty.theorycraft, "enable", "checkbox") + CreateConfig(nil, "SuperMacro", C.thirdparty.supermacro, "enable", "checkbox") + CreateConfig(nil, "AtlasLoot", C.thirdparty.atlasloot, "enable", "checkbox") + CreateConfig(nil, "MyRolePlay", C.thirdparty.myroleplay, "enable", "checkbox") + CreateConfig(nil, "DruidManaBar", C.thirdparty.druidmana, "enable", "checkbox") + CreateConfig(nil, "NoteIt", C.thirdparty.noteit, "enable", "checkbox") end) CreateGUIEntry(T["Components"], T["Modules"], function() diff --git a/modules/hoverbind.lua b/modules/hoverbind.lua index 00f4a162..a838a5c2 100644 --- a/modules/hoverbind.lua +++ b/modules/hoverbind.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("hoverbind", "vanilla:tbc", function () +pfUI:RegisterModule("hoverbind", "vanilla", function () local keymap = { -- buttons to binding association ["pfActionBarMainButton"] = "ACTIONBUTTON", diff --git a/modules/infight.lua b/modules/infight.lua index 95531a8e..b48b4e88 100644 --- a/modules/infight.lua +++ b/modules/infight.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("infight", "vanilla:tbc", function () +pfUI:RegisterModule("infight", "vanilla", function () local function OnUpdate() if not this.infight and not this.aggro and not this.health then return end if ( this.tick or 1) > GetTime() then return else this.tick = GetTime() + .1 end diff --git a/modules/loot.lua b/modules/loot.lua index a2284398..bfa2ab1a 100644 --- a/modules/loot.lua +++ b/modules/loot.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("loot", "vanilla:tbc", function () +pfUI:RegisterModule("loot", "vanilla", function () local rawborder, border = GetBorderSize() pfUI.loot = CreateFrame("Frame", "pfLootFrame", UIParent) diff --git a/modules/map.lua b/modules/map.lua index 806f1e17..247e1150 100644 --- a/modules/map.lua +++ b/modules/map.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("map", "vanilla:tbc", function () +pfUI:RegisterModule("map", "vanilla", function () table.insert(UISpecialFrames, "WorldMapFrame") local function UpdateTooltipScale() diff --git a/modules/mapreveal.lua b/modules/mapreveal.lua index 594b0ff3..c8120a6c 100644 --- a/modules/mapreveal.lua +++ b/modules/mapreveal.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("mapreveal", "vanilla:tbc", function () +pfUI:RegisterModule("mapreveal", "vanilla", function () -- do not load if other map addon is loaded if Cartographer then return end if METAMAP_TITLE then return end diff --git a/modules/minimap.lua b/modules/minimap.lua index 53bc3374..3ea5f343 100644 --- a/modules/minimap.lua +++ b/modules/minimap.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("minimap", "vanilla:tbc", function () +pfUI:RegisterModule("minimap", "vanilla", function () local rawborder, border = GetBorderSize() local size = tonumber(C.appearance.minimap.size) or 140 @@ -39,7 +39,7 @@ pfUI:RegisterModule("minimap", "vanilla:tbc", function () Minimap:SetWidth(size) Minimap:SetHeight(size) - -- vanilla+tbc: do the best to detect the minimap arrow + -- do the best to detect the minimap arrow local arrowscale = tonumber(C.appearance.minimap.arrowscale) local minimaparrow = ({Minimap:GetChildren()})[9] for k, v in pairs({Minimap:GetChildren()}) do diff --git a/modules/mirrortimers.lua b/modules/mirrortimers.lua index 6b08f395..311e6683 100644 --- a/modules/mirrortimers.lua +++ b/modules/mirrortimers.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("mirrortimers", "vanilla:tbc", function () +pfUI:RegisterModule("mirrortimers", "vanilla", function () local font = pfUI.font_default local fontsize = tonumber(C.global.font_size) local height = fontsize * 1.3 diff --git a/modules/nameplates.lua b/modules/nameplates.lua index c181418a..ce25a161 100644 --- a/modules/nameplates.lua +++ b/modules/nameplates.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("nameplates", "vanilla:tbc", function () +pfUI:RegisterModule("nameplates", "vanilla", function () -- disable original castbars pcall(SetCVar, "ShowVKeyCastbar", 0) @@ -1115,7 +1115,6 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function () if pfUI.client <= 11200 then -- handle vanilla only settings - -- due to the secured lua api, those settings can't be applied to TBC and later. local hookOnConfigChange = nameplates.OnConfigChange nameplates.OnConfigChange = function(self) hookOnConfigChange(self) diff --git a/modules/nampower.lua b/modules/nampower.lua new file mode 100644 index 00000000..8e71ecc5 --- /dev/null +++ b/modules/nampower.lua @@ -0,0 +1,743 @@ +-- Nampower integration module +-- Provides spell queue indicator and enhanced cast information +-- Requires Nampower DLL: https://gitea.com/avitasia/nampower + +pfUI:RegisterModule("nampower", "vanilla", function () + -- Only load if Nampower is available + if not GetNampowerVersion then return end + + local rawborder, border = GetBorderSize() + + -- Spell Queue Indicator + -- Shows the currently queued spell icon near the castbar + if C.unitframes.spellqueue == "1" then + local size = tonumber(C.unitframes.spellqueuesize) or 32 + + pfUI.spellqueue = CreateFrame("Frame", "pfSpellQueue", UIParent) + pfUI.spellqueue:SetFrameStrata("HIGH") + pfUI.spellqueue:SetWidth(size) + pfUI.spellqueue:SetHeight(size) + pfUI.spellqueue:Hide() + + -- Position near player castbar if available + if pfUI.castbar and pfUI.castbar.player then + pfUI.spellqueue:SetPoint("LEFT", pfUI.castbar.player, "RIGHT", border*3, 0) + else + pfUI.spellqueue:SetPoint("CENTER", UIParent, "CENTER", 100, -100) + end + + pfUI.spellqueue.icon = pfUI.spellqueue:CreateTexture("OVERLAY") + pfUI.spellqueue.icon:SetAllPoints(pfUI.spellqueue) + pfUI.spellqueue.icon:SetTexCoord(.08, .92, .08, .92) + + UpdateMovable(pfUI.spellqueue) + CreateBackdrop(pfUI.spellqueue) + CreateBackdropShadow(pfUI.spellqueue) + + -- Event codes from Nampower + local ON_SWING_QUEUED = 0 + local ON_SWING_QUEUE_POPPED = 1 + local NORMAL_QUEUED = 2 + local NORMAL_QUEUE_POPPED = 3 + local NON_GCD_QUEUED = 4 + local NON_GCD_QUEUE_POPPED = 5 + + local queue = CreateFrame("Frame") + queue:RegisterEvent("SPELL_QUEUE_EVENT") + queue:SetScript("OnEvent", function() + local eventCode = arg1 + local spellId = arg2 + + if eventCode == NORMAL_QUEUED or eventCode == NON_GCD_QUEUED or eventCode == ON_SWING_QUEUED then + -- Get spell texture from SpellInfo (SuperWoW) or GetSpellTexture + local texture + if SpellInfo then + local _, _, tex = SpellInfo(spellId) + texture = tex + end + + if texture then + pfUI.spellqueue.icon:SetTexture(texture) + pfUI.spellqueue:Show() + end + elseif eventCode == NORMAL_QUEUE_POPPED or eventCode == NON_GCD_QUEUE_POPPED or eventCode == ON_SWING_QUEUE_POPPED then + pfUI.spellqueue:Hide() + end + end) + end + + -- Enhanced Debuff Tracking using Nampower events + -- DEBUFF_ADDED_OTHER/DEBUFF_REMOVED_OTHER provide accurate debuff tracking with spellId + if libdebuff then + -- Storage for GUID-based debuff tracking + pfUI.nampower_debuffs = pfUI.nampower_debuffs or {} + local debuffdb = pfUI.nampower_debuffs + + -- Get player GUID for tracking own debuffs + local playerGuid + + local debuffTracker = CreateFrame("Frame") + debuffTracker:RegisterEvent("PLAYER_ENTERING_WORLD") + debuffTracker:RegisterEvent("DEBUFF_ADDED_OTHER") + debuffTracker:RegisterEvent("DEBUFF_REMOVED_OTHER") + debuffTracker:RegisterEvent("DEBUFF_ADDED_SELF") + debuffTracker:RegisterEvent("DEBUFF_REMOVED_SELF") + + debuffTracker:SetScript("OnEvent", function() + if event == "PLAYER_ENTERING_WORLD" then + -- Cache player GUID + if UnitExists then + local _, guid = UnitExists("player") + playerGuid = guid + end + return + end + + -- DEBUFF events: arg1=guid, arg2=slot, arg3=spellId, arg4=stackCount, arg5=auraLevel + local guid = arg1 + local slot = arg2 + local spellId = arg3 + local stackCount = arg4 + local auraLevel = arg5 + + if not guid or not spellId then return end + + if event == "DEBUFF_ADDED_OTHER" or event == "DEBUFF_ADDED_SELF" then + -- Initialize storage for this GUID + if not debuffdb[guid] then debuffdb[guid] = {} end + + -- Get spell info + local spellName, spellRank, texture + if SpellInfo then + spellName, spellRank, texture = SpellInfo(spellId) + end + if GetSpellNameAndRankForId then + spellName, spellRank = GetSpellNameAndRankForId(spellId) + end + + if spellName then + -- Get duration from libdebuff's duration table or GetSpellRec + local duration = 0 + if libdebuff.GetDuration then + duration = libdebuff:GetDuration(spellName, spellRank) + end + + -- Try GetSpellRec for duration if libdebuff doesn't have it + if duration == 0 and GetSpellRec then + local spellRec = GetSpellRec(spellId) + if spellRec and spellRec.durationIndex and spellRec.durationIndex > 0 then + -- Duration index maps to spell duration - common values: + -- This is a rough approximation since we don't have the duration table + duration = 30 -- Default fallback + end + end + + -- Store debuff data + debuffdb[guid][spellId] = { + spellId = spellId, + name = spellName, + rank = spellRank, + texture = texture, + stacks = stackCount or 1, + start = GetTime(), + duration = duration, + slot = slot, + auraLevel = auraLevel, + caster = (event == "DEBUFF_ADDED_SELF" or guid == playerGuid) and "player" or nil + } + + -- Also update libdebuff's internal tracking if we have unit info + local unitName = UnitName and guid and UnitName(guid) + local unitLevel = UnitLevel and guid and UnitLevel(guid) + if unitName and duration > 0 then + libdebuff:AddEffect(unitName, unitLevel or 0, spellName, duration, "player") + end + end + + elseif event == "DEBUFF_REMOVED_OTHER" or event == "DEBUFF_REMOVED_SELF" then + -- Remove debuff from tracking + if debuffdb[guid] and debuffdb[guid][spellId] then + debuffdb[guid][spellId] = nil + end + end + end) + + -- Enhanced UnitDebuff function that uses Nampower data + -- This provides more accurate debuff information when available + local originalUnitDebuff = libdebuff.UnitDebuff + function libdebuff:UnitDebuffNampower(unit, id) + -- First try the original method + local effect, rank, texture, stacks, dtype, duration, timeleft, caster = originalUnitDebuff(self, unit, id) + + -- If we have Nampower data for this unit, try to enhance it + local _, guid = UnitExists(unit) + if guid and debuffdb[guid] then + -- Find the debuff by slot + for spellId, data in pairs(debuffdb[guid]) do + if data.slot == id then + -- Use Nampower data for more accurate timing + if data.duration and data.duration > 0 and data.start then + duration = data.duration + timeleft = data.duration + data.start - GetTime() + if timeleft < 0 then timeleft = 0 end + caster = data.caster + stacks = data.stacks or stacks + end + break + end + end + end + + return effect, rank, texture, stacks, dtype, duration, timeleft, caster + end + + -- Expose enhanced function + pfUI.api.libdebuff_nampower = libdebuff.UnitDebuffNampower + end + + -- Enhanced buff tracking using BUFF events + if C.unitframes.nampower_buffs == "1" then + pfUI.nampower_buffs = pfUI.nampower_buffs or {} + local buffdb = pfUI.nampower_buffs + + local buffTracker = CreateFrame("Frame") + buffTracker:RegisterEvent("BUFF_ADDED_OTHER") + buffTracker:RegisterEvent("BUFF_REMOVED_OTHER") + buffTracker:RegisterEvent("BUFF_ADDED_SELF") + buffTracker:RegisterEvent("BUFF_REMOVED_SELF") + + buffTracker:SetScript("OnEvent", function() + local guid = arg1 + local slot = arg2 + local spellId = arg3 + local stackCount = arg4 + local auraLevel = arg5 + + if not guid or not spellId then return end + + if event == "BUFF_ADDED_OTHER" or event == "BUFF_ADDED_SELF" then + if not buffdb[guid] then buffdb[guid] = {} end + + local spellName, spellRank, texture + if SpellInfo then + spellName, spellRank, texture = SpellInfo(spellId) + end + if GetSpellNameAndRankForId then + spellName, spellRank = GetSpellNameAndRankForId(spellId) + end + + buffdb[guid][spellId] = { + spellId = spellId, + name = spellName, + rank = spellRank, + texture = texture, + stacks = stackCount or 1, + start = GetTime(), + slot = slot, + auraLevel = auraLevel + } + elseif event == "BUFF_REMOVED_OTHER" or event == "BUFF_REMOVED_SELF" then + if buffdb[guid] and buffdb[guid][spellId] then + buffdb[guid][spellId] = nil + end + end + end) + end + + -- Direct Aura Access API using GetUnitField + -- Much faster than tooltip scanning - reads aura arrays directly from unit fields + if GetUnitField then + pfUI.api.GetUnitAuras = function(unit) + local auras = GetUnitField(unit, "aura") + local auraLevels = GetUnitField(unit, "auraLevels") + local auraStacks = GetUnitField(unit, "auraApplications") + + if not auras then return nil end + + local result = {} + for i = 1, 48 do + local spellId = auras[i] + if spellId and spellId > 0 then + local name, rank, texture + if SpellInfo then + name, rank, texture = SpellInfo(spellId) + elseif GetSpellNameAndRankForId then + name, rank = GetSpellNameAndRankForId(spellId) + end + + result[i] = { + spellId = spellId, + name = name, + rank = rank, + texture = texture, + level = auraLevels and auraLevels[i] or 0, + stacks = auraStacks and auraStacks[i] or 1, + isBuff = i <= 32, -- First 32 slots are buffs, rest are debuffs + } + end + end + return result + end + + -- Quick check if unit has specific aura by spellId + pfUI.api.UnitHasAura = function(unit, spellId) + local auras = GetUnitField(unit, "aura") + if not auras then return false end + for i = 1, 48 do + if auras[i] == spellId then return true, i end + end + return false + end + + -- Get unit resistances directly + pfUI.api.GetUnitResistances = function(unit) + local res = GetUnitField(unit, "resistances") + if not res then return nil end + return { + armor = res[1], + holy = res[2], + fire = res[3], + nature = res[4], + frost = res[5], + shadow = res[6], + arcane = res[7] + } + end + end + + -- Reactive Spell Indicator using IsSpellUsable + -- Shows when reactive abilities like Overpower, Revenge, Execute are usable + if IsSpellUsable and C.unitframes.reactive_indicator == "1" then + local size = tonumber(C.unitframes.reactive_size) or 28 + local _, class = UnitClass("player") + + -- Reactive spells by class + local reactiveSpells = { + WARRIOR = { + { name = "Overpower", texture = "Interface\\Icons\\Ability_MeleeDamage" }, + { name = "Revenge", texture = "Interface\\Icons\\Ability_Warrior_Revenge" }, + { name = "Execute", texture = "Interface\\Icons\\INV_Sword_48" }, + }, + ROGUE = { + { name = "Riposte", texture = "Interface\\Icons\\Ability_Warrior_Challange" }, + }, + HUNTER = { + { name = "Mongoose Bite", texture = "Interface\\Icons\\Ability_Hunter_SwiftStrike" }, + { name = "Counterattack", texture = "Interface\\Icons\\Ability_Warrior_Challange" }, + }, + } + + local spells = reactiveSpells[class] + if spells then + pfUI.reactive = CreateFrame("Frame", "pfReactiveIndicator", UIParent) + pfUI.reactive:SetFrameStrata("HIGH") + local spellCount = table.getn(spells) + pfUI.reactive:SetWidth(size * spellCount + 4 * (spellCount - 1)) + pfUI.reactive:SetHeight(size) + pfUI.reactive:SetPoint("CENTER", UIParent, "CENTER", 0, -200) + pfUI.reactive:Hide() + + pfUI.reactive.icons = {} + for i, spell in ipairs(spells) do + local icon = CreateFrame("Frame", nil, pfUI.reactive) + icon:SetWidth(size) + icon:SetHeight(size) + icon:SetPoint("LEFT", pfUI.reactive, "LEFT", (i-1) * (size + 4), 0) + + icon.texture = icon:CreateTexture(nil, "ARTWORK") + icon.texture:SetAllPoints(icon) + icon.texture:SetTexture(spell.texture) + icon.texture:SetTexCoord(.08, .92, .08, .92) + + icon.glow = icon:CreateTexture(nil, "OVERLAY") + icon.glow:SetPoint("TOPLEFT", icon, "TOPLEFT", -4, 4) + icon.glow:SetPoint("BOTTOMRIGHT", icon, "BOTTOMRIGHT", 4, -4) + icon.glow:SetTexture(pfUI.media["img:glow"]) + icon.glow:SetVertexColor(1, 1, 0, 0.8) + + CreateBackdrop(icon) + icon:Hide() + icon.spellName = spell.name + pfUI.reactive.icons[i] = icon + end + + UpdateMovable(pfUI.reactive) + + pfUI.reactive:SetScript("OnUpdate", function() + local anyVisible = false + for _, icon in ipairs(this.icons) do + local usable = IsSpellUsable(icon.spellName) + if usable == 1 then + icon:Show() + anyVisible = true + else + icon:Hide() + end + end + if anyVisible then + this:Show() + else + this:Hide() + end + end) + end + end + + -- Enhanced Cooldown Tracking API using GetSpellIdCooldown + if GetSpellIdCooldown then + pfUI.api.GetPreciseCooldown = function(spellId) + local cd = GetSpellIdCooldown(spellId) + if not cd then return nil end + return { + onCooldown = cd.isOnCooldown == 1, + remaining = cd.cooldownRemainingMs / 1000, + remainingMs = cd.cooldownRemainingMs, + gcdRemaining = cd.gcdCategoryRemainingMs / 1000, + gcdRemainingMs = cd.gcdCategoryRemainingMs, + individualRemaining = cd.individualRemainingMs / 1000, + categoryRemaining = cd.categoryRemainingMs / 1000, + } + end + + -- Item cooldown helper + pfUI.api.GetPreciseItemCooldown = function(itemId) + if not GetItemIdCooldown then return nil end + local cd = GetItemIdCooldown(itemId) + if not cd then return nil end + return { + onCooldown = cd.isOnCooldown == 1, + remaining = cd.cooldownRemainingMs / 1000, + remainingMs = cd.cooldownRemainingMs, + } + end + end + + -- UNIT_DIED event handling + -- Can be used to clear tracking data or trigger effects on unit death + local deathTracker = CreateFrame("Frame") + deathTracker:RegisterEvent("UNIT_DIED") + deathTracker:SetScript("OnEvent", function() + local guid = arg1 + if not guid then return end + + -- Clean up debuff tracking for dead units + if pfUI.nampower_debuffs and pfUI.nampower_debuffs[guid] then + pfUI.nampower_debuffs[guid] = nil + end + if pfUI.nampower_buffs and pfUI.nampower_buffs[guid] then + pfUI.nampower_buffs[guid] = nil + end + end) + + -- Trinket Management API + if GetTrinkets then + pfUI.api.GetEquippedTrinkets = function() + local trinkets = GetTrinkets() + local equipped = {} + for _, trinket in pairs(trinkets) do + if trinket.bagIndex == nil then -- nil bagIndex = equipped + table.insert(equipped, trinket) + end + end + return equipped + end + + pfUI.api.GetTrinketCooldown = function(slot) + if not GetTrinketCooldown then return nil end + local cd = GetTrinketCooldown(slot) + if cd == -1 then return nil end + return { + onCooldown = cd.isOnCooldown == 1, + remaining = cd.cooldownRemainingMs / 1000, + remainingMs = cd.cooldownRemainingMs, + } + end + + pfUI.api.UseTrinket = function(slot, target) + if not UseTrinket then return false end + return UseTrinket(slot, target) == 1 + end + end + + -- Nampower Item Stats API (use distinct name to avoid conflicts) + if GetItemStats then + pfUI.api.GetNampowerItemStats = function(itemId) + local success, stats = pcall(GetItemStats, itemId, true) + if not success or not stats then return nil end + return stats + end + + -- Quick item level lookup + pfUI.api.GetNampowerItemLevel = function(itemId) + if GetItemLevel then + return GetItemLevel(itemId) + end + local success, stats = pcall(GetItemStats, itemId, true) + if success and stats then + return stats.itemLevel + end + return nil + end + end + + -- Spell Modifiers API for damage/heal predictions + if GetSpellModifiers then + pfUI.api.GetSpellBonus = function(spellId, modType) + -- modType: 0=DAMAGE, 1=DURATION, 6=RADIUS, 7=CRIT, 10=CAST_TIME, 14=COST, etc. + local flat, percent, hasmod = GetSpellModifiers(spellId, modType or 0) + return { + flat = flat or 0, + percent = percent or 0, + hasModifier = hasmod and hasmod ~= 0, + } + end + + -- Common spell modifier lookups + pfUI.api.GetSpellDamageBonus = function(spellId) + return pfUI.api.GetSpellBonus(spellId, 0) -- DAMAGE + end + + pfUI.api.GetSpellCritBonus = function(spellId) + return pfUI.api.GetSpellBonus(spellId, 7) -- CRITICAL_CHANCE + end + + pfUI.api.GetSpellCostReduction = function(spellId) + return pfUI.api.GetSpellBonus(spellId, 14) -- COST + end + end + + -- Inventory/Bag API + if GetBagItems then + pfUI.api.GetAllBagItems = function() + return GetBagItems() + end + + pfUI.api.FindItem = function(itemIdOrName) + if FindPlayerItemSlot then + local bag, slot = FindPlayerItemSlot(itemIdOrName) + return bag, slot + end + return nil, nil + end + + pfUI.api.UseItem = function(itemIdOrName, target) + if UseItemIdOrName then + return UseItemIdOrName(itemIdOrName, target) == 1 + end + return false + end + end + + -- Equipment Inspection API + if GetEquippedItems then + pfUI.api.GetPlayerEquipment = function() + return GetEquippedItems("player") + end + + pfUI.api.GetTargetEquipment = function() + return GetEquippedItems("target") + end + + pfUI.api.GetEquippedItemInfo = function(unit, slot) + if GetEquippedItem then + return GetEquippedItem(unit, slot) + end + return nil + end + end + + -- Spell Lookup Helpers + if GetSpellIdForName then + pfUI.api.GetMaxRankSpellId = function(spellName) + return GetSpellIdForName(spellName) + end + end + + if GetSpellSlotTypeIdForName then + pfUI.api.GetSpellSlotInfo = function(spellName) + local slot, bookType, spellId = GetSpellSlotTypeIdForName(spellName) + return { + slot = slot, + bookType = bookType, + spellId = spellId, + } + end + end + + -- Queue Script API for advanced macro functionality + if QueueScript then + pfUI.api.QueueLuaScript = function(script, priority) + QueueScript(script, priority or 1) + end + end + + if QueueSpellByName then + pfUI.api.QueueSpell = function(spellName) + QueueSpellByName(spellName) + end + end + + -- Channel optimization + if ChannelStopCastingNextTick then + pfUI.api.StopChannelNextTick = function() + ChannelStopCastingNextTick() + end + end + + -- Spell Database Access via GetSpellRec + if GetSpellRec then + pfUI.api.GetSpellRecord = function(spellId) + local rec = GetSpellRec(spellId) + if not rec then return nil end + return { + spellId = spellId, + name = rec.name, + rank = rec.rank, + description = rec.description, + manaCost = rec.manaCost, + baseLevel = rec.baseLevel, + spellLevel = rec.spellLevel, + maxLevel = rec.maxLevel, + maxTargetLevel = rec.maxTargetLevel, + maxTargets = rec.maxTargets, + durationIndex = rec.durationIndex, + powerType = rec.powerType, + rangeIndex = rec.rangeIndex, + speed = rec.speed, + schoolMask = rec.schoolMask, + runeCostID = rec.runeCostID, + spellMissileID = rec.spellMissileID, + iconID = rec.iconID, + activeIconID = rec.activeIconID, + nameSubtext = rec.nameSubtext, + castingTimeIndex = rec.castingTimeIndex, + categoryRecoveryTime = rec.categoryRecoveryTime, + recoveryTime = rec.recoveryTime, + startRecoveryCategory = rec.startRecoveryCategory, + startRecoveryTime = rec.startRecoveryTime, + } + end + + -- Get spell school (fire, frost, nature, etc.) + pfUI.api.GetSpellSchool = function(spellId) + local rec = GetSpellRec(spellId) + if not rec then return nil end + local schools = { + [1] = "Physical", + [2] = "Holy", + [4] = "Fire", + [8] = "Nature", + [16] = "Frost", + [32] = "Shadow", + [64] = "Arcane", + } + return schools[rec.schoolMask] or "Unknown" + end + end + + -- Disenchant All utility + if DisenchantAll then + pfUI.api.DisenchantAllItems = function() + DisenchantAll() + end + + SLASH_PFDISENCHANTALL1 = "/disenchantall" + SLASH_PFDISENCHANTALL2 = "/dea" + SlashCmdList["PFDISENCHANTALL"] = function() + DisenchantAll() + DEFAULT_CHAT_FRAME:AddMessage("|cff33ffccpfUI|r: Disenchanting all eligible items...") + end + end + + -- Enhanced Heal Prediction with AURA_CAST events + -- This helps libpredict detect HoT applications more accurately + if libpredict then + local auraCastFrame = CreateFrame("Frame") + auraCastFrame:RegisterEvent("AURA_CAST_ON_SELF") + auraCastFrame:RegisterEvent("AURA_CAST_ON_OTHER") + + auraCastFrame:SetScript("OnEvent", function() + local casterGuid = arg1 + local targetGuid = arg2 + local spellId = arg3 + + if not spellId or not targetGuid then return end + + -- Get spell name + local spellName + if SpellInfo then + spellName = SpellInfo(spellId) + elseif GetSpellNameAndRankForId then + spellName = GetSpellNameAndRankForId(spellId) + end + + if not spellName then return end + + -- Check if this is a HoT spell we care about + local hotSpells = { + ["Rejuvenation"] = true, + ["Renew"] = true, + ["Regrowth"] = true, + ["Verjüngung"] = true, -- German + ["Erneuerung"] = true, + ["Nachwachsen"] = true, + } + + if hotSpells[spellName] then + -- Signal to libpredict that a HoT was applied + -- This can be used to update heal predictions + if pfUI.api.libpredict and pfUI.api.libpredict.OnHotApplied then + pfUI.api.libpredict:OnHotApplied(targetGuid, spellName, spellId) + end + end + end) + end + + -- Swing Timer Integration + -- Track auto-attack swing timers for melee classes + local swingFrame = CreateFrame("Frame") + swingFrame.mainHand = { start = 0, speed = 0 } + swingFrame.offHand = { start = 0, speed = 0 } + swingFrame.ranged = { start = 0, speed = 0 } + + swingFrame:RegisterEvent("PLAYER_ENTER_COMBAT") + swingFrame:RegisterEvent("PLAYER_LEAVE_COMBAT") + swingFrame:RegisterEvent("CHAT_MSG_COMBAT_SELF_HITS") + swingFrame:RegisterEvent("CHAT_MSG_COMBAT_SELF_MISSES") + + swingFrame:SetScript("OnEvent", function() + if event == "PLAYER_ENTER_COMBAT" then + local mainSpeed, offSpeed = UnitAttackSpeed("player") + this.mainHand.speed = mainSpeed or 2 + this.offHand.speed = offSpeed or 0 + this.mainHand.start = GetTime() + if this.offHand.speed > 0 then + this.offHand.start = GetTime() + end + elseif event == "CHAT_MSG_COMBAT_SELF_HITS" or event == "CHAT_MSG_COMBAT_SELF_MISSES" then + -- Reset swing timer on hit/miss + local mainSpeed, offSpeed = UnitAttackSpeed("player") + this.mainHand.speed = mainSpeed or 2 + this.mainHand.start = GetTime() + end + end) + + pfUI.api.GetSwingTimers = function() + local now = GetTime() + local mainRemaining = swingFrame.mainHand.speed - (now - swingFrame.mainHand.start) + local offRemaining = swingFrame.offHand.speed > 0 and (swingFrame.offHand.speed - (now - swingFrame.offHand.start)) or 0 + + return { + mainHand = { + remaining = math.max(0, mainRemaining), + speed = swingFrame.mainHand.speed, + progress = swingFrame.mainHand.speed > 0 and (1 - math.max(0, mainRemaining) / swingFrame.mainHand.speed) or 0, + }, + offHand = { + remaining = math.max(0, offRemaining), + speed = swingFrame.offHand.speed, + progress = swingFrame.offHand.speed > 0 and (1 - math.max(0, offRemaining) / swingFrame.offHand.speed) or 0, + }, + } + end +end) diff --git a/modules/panel.lua b/modules/panel.lua index 755cd079..8f235776 100644 --- a/modules/panel.lua +++ b/modules/panel.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("panel", "vanilla:tbc", function() +pfUI:RegisterModule("panel", "vanilla", function() -- initialize gold cache if not yet happened pfUI_cache["gold"] = pfUI_cache["gold"] or {} diff --git a/modules/pet.lua b/modules/pet.lua index 223c633c..46a45ede 100644 --- a/modules/pet.lua +++ b/modules/pet.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("pet", "vanilla:tbc", function () +pfUI:RegisterModule("pet", "vanilla", function () -- do not go further on disabled UFs if C.unitframes.disable == "1" then return end pfUI.uf.pet = pfUI.uf:CreateUnitFrame("Pet", nil, C.unitframes.pet) diff --git a/modules/pettarget.lua b/modules/pettarget.lua index 017c30c4..1fe945df 100644 --- a/modules/pettarget.lua +++ b/modules/pettarget.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("pettarget", "vanilla:tbc", function () +pfUI:RegisterModule("pettarget", "vanilla", function () -- do not go further on disabled UFs if C.unitframes.disable == "1" then return end local rawborder, default_border = GetBorderSize("unitframes") diff --git a/modules/pixelperfect.lua b/modules/pixelperfect.lua index ec4166d4..16862787 100644 --- a/modules/pixelperfect.lua +++ b/modules/pixelperfect.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("pixelperfect", "vanilla:tbc", function () +pfUI:RegisterModule("pixelperfect", "vanilla", function () -- pre-calculated min values local statics = { [4] = 1.4222222222222, diff --git a/modules/player.lua b/modules/player.lua index 59979fff..91302d80 100644 --- a/modules/player.lua +++ b/modules/player.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("player", "vanilla:tbc", function () +pfUI:RegisterModule("player", "vanilla", function () -- do not go further on disabled UFs if C.unitframes.disable == "1" then return end diff --git a/modules/questitem.lua b/modules/questitem.lua index 7a8715c6..290495e2 100644 --- a/modules/questitem.lua +++ b/modules/questitem.lua @@ -96,11 +96,7 @@ pfUI:RegisterModule("questitem", function () SelectQuestLogEntry(quest) -- detect and ignore quest headers - if pfUI.client <= 11200 then -- vanilla - _, _, _, header = GetQuestLogTitle(quest) - elseif pfUI.client > 11200 then -- tbc - _, _, _, _, header = GetQuestLogTitle(quest) - end + _, _, _, header = GetQuestLogTitle(quest) if not header then text, objective = GetQuestLogQuestText() diff --git a/modules/raid.lua b/modules/raid.lua index 5aaca7c8..6b3577ae 100644 --- a/modules/raid.lua +++ b/modules/raid.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("raid", "vanilla:tbc", function () +pfUI:RegisterModule("raid", "vanilla", function () -- do not go further on disabled UFs if C.unitframes.disable == "1" then return end @@ -109,6 +109,11 @@ pfUI:RegisterModule("raid", "vanilla:tbc", function () end end + -- rebuild unitmap after frame IDs are assigned + if pfUI.uf.RebuildUnitmap then + pfUI.uf.RebuildUnitmap() + end + this:Hide() end) diff --git a/modules/roll.lua b/modules/roll.lua index 7762774c..8580e514 100644 --- a/modules/roll.lua +++ b/modules/roll.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("roll", "vanilla:tbc", function () +pfUI:RegisterModule("roll", "vanilla", function () pfUI.roll = CreateFrame("Frame", "pfLootRoll", UIParent) pfUI.roll.frames = {} diff --git a/modules/screenshot.lua b/modules/screenshot.lua index 54bb3425..d6ac5b8f 100644 --- a/modules/screenshot.lua +++ b/modules/screenshot.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("screenshot", "vanilla:tbc", function () +pfUI:RegisterModule("screenshot", "vanilla", function () if C.screenshot.interval == "0" and C.screenshot.levelup == "0" and C.screenshot.pvprank == "0" diff --git a/modules/sellvalue.lua b/modules/sellvalue.lua index f854d089..a14427f8 100644 --- a/modules/sellvalue.lua +++ b/modules/sellvalue.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("sellvalue", "vanilla:tbc", function () +pfUI:RegisterModule("sellvalue", "vanilla", function () local function AddVendorPrices(frame, id, count) if pfSellData[id] then local _, _, sell, buy = strfind(pfSellData[id], "(.*),(.*)") diff --git a/modules/share.lua b/modules/share.lua index a49841bc..d5cc522e 100644 --- a/modules/share.lua +++ b/modules/share.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("share", "vanilla:tbc", function () +pfUI:RegisterModule("share", "vanilla", function () local function serialize(tbl, comp, name, ignored, spacing) local spacing = spacing or "" local match = nil diff --git a/modules/skin.lua b/modules/skin.lua index 7c890016..390a03f7 100644 --- a/modules/skin.lua +++ b/modules/skin.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("skin", "vanilla:tbc", function () +pfUI:RegisterModule("skin", "vanilla", function () -- align UIParent panels pfUI.panelalign = CreateFrame("Frame", "pfUIParentPanelAlign", UIParent) pfUI.panelalign:SetScript("OnUpdate", function() diff --git a/modules/socialmod.lua b/modules/socialmod.lua index e18fea58..a3da0610 100644 --- a/modules/socialmod.lua +++ b/modules/socialmod.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("socialmod", "vanilla:tbc", function () +pfUI:RegisterModule("socialmod", "vanilla", function () local playerdb = _G.pfUI_playerDB pfUI.socialmod = CreateFrame("Frame", "pfSocialMod", UIParent) pfUI.socialmod:RegisterEvent("CHAT_MSG_SYSTEM") diff --git a/modules/superwow.lua b/modules/superwow.lua index af30210d..0ffdf4c3 100644 --- a/modules/superwow.lua +++ b/modules/superwow.lua @@ -1,6 +1,82 @@ -- Compatibility layer to use castbars provided by SuperWoW: -- https://github.com/balakethelock/SuperWoW +-- DLL Status Check Command (always available) +SLASH_PFDLLSTATUS1 = "/pfdll" +SlashCmdList["PFDLLSTATUS"] = function() + local chat = DEFAULT_CHAT_FRAME + chat:AddMessage("|cff33ffccpfUI|r: DLL Status Check") + + -- SuperWoW + if SUPERWOW_VERSION then + chat:AddMessage(" |cff00ff00SuperWoW|r: v" .. tostring(SUPERWOW_VERSION)) + elseif SpellInfo or SetAutoloot then + chat:AddMessage(" |cffffff00SuperWoW|r: Detected (old version)") + else + chat:AddMessage(" |cffff0000SuperWoW|r: Not detected") + end + + -- Nampower + if GetNampowerVersion then + chat:AddMessage(" |cff00ff00Nampower|r: v" .. tostring(GetNampowerVersion())) + else + chat:AddMessage(" |cffff0000Nampower|r: Not detected") + end + + -- UnitXP + local hasUnitXP = pcall(UnitXP, "nop", "nop") + if hasUnitXP then + chat:AddMessage(" |cff00ff00UnitXP_SP3|r: Detected") + else + chat:AddMessage(" |cffff0000UnitXP_SP3|r: Not detected") + end + + -- Check if castbar exists for indicator positioning + if pfUI.castbar and pfUI.castbar.player then + chat:AddMessage(" |cff00ff00Castbar|r: Available for indicator anchoring") + else + chat:AddMessage(" |cffffff00Castbar|r: Not available (indicators use fallback position)") + end + + -- Check indicator frames + if pfUI.uf and pfUI.uf.target then + chat:AddMessage(" |cff00ff00Target frame|r: exists") + if pfUI.uf.target.behindIndicator then + chat:AddMessage(" |cff00ff00Behind indicator|r: created") + else + chat:AddMessage(" |cffff0000Behind indicator|r: NOT created") + end + if pfUI.uf.target.losIndicator then + chat:AddMessage(" |cff00ff00LOS indicator|r: created") + else + chat:AddMessage(" |cffff0000LOS indicator|r: NOT created") + end + else + chat:AddMessage(" |cffff0000Target frame|r: NOT found") + end +end + +-- UnitXP Behind/LOS test command +SLASH_PFBEHIND1 = "/pfbehind" +SlashCmdList["PFBEHIND"] = function() + local chat = DEFAULT_CHAT_FRAME + if not UnitExists("target") then + chat:AddMessage("|cff33ffccpfUI|r: No target") + return + end + + local hasUnitXP = pcall(UnitXP, "nop", "nop") + if not hasUnitXP then + chat:AddMessage("|cff33ffccpfUI|r: UnitXP not available") + return + end + + local successB, behind = pcall(UnitXP, "behind", "player", "target") + local successL, inSight = pcall(UnitXP, "inSight", "player", "target") + + chat:AddMessage("|cff33ffccpfUI|r: Behind=" .. tostring(behind) .. " LOS=" .. tostring(inSight)) +end + pfUI:RegisterModule("superwow", "vanilla", function () if SetAutoloot and SpellInfo and not SUPERWOW_VERSION then -- Turn every enchanting link that we create in the enchanting frame, @@ -248,12 +324,264 @@ pfUI:RegisterModule("superwow", "vanilla", function () libdebuff:AddEffect(unit, unitlevel, effect, duration, caster) end) - -- Enhance libcast with SuperWoW data + -- TrackUnit API for adding group members to minimap + -- Tracks friendly units on the minimap for easier group coordination + if TrackUnit and C.unitframes.track_group == "1" then + local trackFrame = CreateFrame("Frame") + trackFrame:RegisterEvent("PARTY_MEMBERS_CHANGED") + trackFrame:RegisterEvent("RAID_ROSTER_UPDATE") + trackFrame:RegisterEvent("PLAYER_ENTERING_WORLD") + + trackFrame:SetScript("OnEvent", function() + -- Track party members + for i = 1, 4 do + local unit = "party" .. i + if UnitExists(unit) and UnitIsConnected(unit) then + pcall(TrackUnit, unit) + end + end + + -- Track raid members + for i = 1, 40 do + local unit = "raid" .. i + if UnitExists(unit) and UnitIsConnected(unit) and not UnitIsUnit(unit, "player") then + pcall(TrackUnit, unit) + end + end + end) + end + + -- Raid Marker Targeting API + -- Allows targeting units by raid marker ("mark1" to "mark8") + if SUPERWOW_VERSION then + pfUI.api.GetMarkedUnit = function(markIndex) + local markUnit = "mark" .. markIndex + if UnitExists(markUnit) then + return markUnit + end + return nil + end + + pfUI.api.TargetMark = function(markIndex) + local markUnit = "mark" .. markIndex + if UnitExists(markUnit) then + TargetUnit(markUnit) + return true + end + return false + end + + -- Get owner of pet/totem using "owner" suffix + pfUI.api.GetUnitOwner = function(unit) + local ownerUnit = unit .. "owner" + if UnitExists(ownerUnit) then + return UnitName(ownerUnit), ownerUnit + end + return nil + end + end + + -- Enhanced SpellInfo API wrapper + if SpellInfo then + pfUI.api.GetSpellInfo = function(spellId) + local name, rank, texture, minRange, maxRange = SpellInfo(spellId) + return { + name = name, + rank = rank, + texture = texture, + minRange = minRange, + maxRange = maxRange, + spellId = spellId + } + end + end + + -- Clickthrough Mode API + -- Allows clicking through corpses to loot underneath + if Clickthrough then + pfUI.api.SetClickthrough = function(enabled) + Clickthrough(enabled and 1 or 0) + end + + pfUI.api.GetClickthrough = function() + return Clickthrough() == 1 + end + + pfUI.api.ToggleClickthrough = function() + local current = Clickthrough() + Clickthrough(current == 1 and 0 or 1) + return Clickthrough() == 1 + end + + -- Add slash command for clickthrough toggle + SLASH_PFCLICKTHROUGH1 = "/clickthrough" + SLASH_PFCLICKTHROUGH2 = "/ct" + SlashCmdList["PFCLICKTHROUGH"] = function() + local enabled = pfUI.api.ToggleClickthrough() + DEFAULT_CHAT_FRAME:AddMessage("|cff33ffccpfUI|r: Clickthrough mode " .. (enabled and "|cff00ff00enabled|r" or "|cffff0000disabled|r")) + end + end + + -- Autoloot Control API + if SetAutoloot then + pfUI.api.SetAutoloot = function(enabled) + SetAutoloot(enabled and 1 or 0) + end + + pfUI.api.GetAutoloot = function() + return SetAutoloot() == 1 + end + + pfUI.api.ToggleAutoloot = function() + local current = SetAutoloot() + SetAutoloot(current == 1 and 0 or 1) + return SetAutoloot() == 1 + end + end + + -- Config Import/Export API using ImportFile/ExportFile + if ImportFile and ExportFile then + pfUI.api.ExportConfig = function(filename) + filename = filename or "pfUI_config_backup.txt" + local configStr = "" + + -- Serialize config to string + local function serialize(tbl, indent) + indent = indent or "" + local result = "{\n" + for k, v in pairs(tbl) do + local keyStr = type(k) == "string" and '["' .. k .. '"]' or "[" .. tostring(k) .. "]" + if type(v) == "table" then + result = result .. indent .. " " .. keyStr .. " = " .. serialize(v, indent .. " ") .. ",\n" + elseif type(v) == "string" then + result = result .. indent .. " " .. keyStr .. ' = "' .. v .. '",\n' + else + result = result .. indent .. " " .. keyStr .. " = " .. tostring(v) .. ",\n" + end + end + return result .. indent .. "}" + end + + if pfUI_config then + configStr = "pfUI_config = " .. serialize(pfUI_config) + ExportFile(filename, configStr) + DEFAULT_CHAT_FRAME:AddMessage("|cff33ffccpfUI|r: Config exported to imports/" .. filename) + return true + end + return false + end + + pfUI.api.ImportConfig = function(filename) + filename = filename or "pfUI_config_backup.txt" + local content = ImportFile(filename) + if content and content ~= "" then + -- Load the config string + local func, err = loadstring(content) + if func then + func() + DEFAULT_CHAT_FRAME:AddMessage("|cff33ffccpfUI|r: Config imported from imports/" .. filename) + DEFAULT_CHAT_FRAME:AddMessage("|cff33ffccpfUI|r: Please /reload to apply changes") + return true + else + DEFAULT_CHAT_FRAME:AddMessage("|cff33ffccpfUI|r: Error parsing config: " .. (err or "unknown")) + end + else + DEFAULT_CHAT_FRAME:AddMessage("|cff33ffccpfUI|r: Could not read imports/" .. filename) + end + return false + end + + -- Slash commands for config backup + SLASH_PFEXPORT1 = "/pfexport" + SlashCmdList["PFEXPORT"] = function(msg) + pfUI.api.ExportConfig(msg ~= "" and msg or nil) + end + + SLASH_PFIMPORT1 = "/pfimport" + SlashCmdList["PFIMPORT"] = function(msg) + pfUI.api.ImportConfig(msg ~= "" and msg or nil) + end + end + + -- GetPlayerBuffID wrapper + if GetPlayerBuffID then + pfUI.api.GetPlayerBuffSpellId = function(buffIndex) + return GetPlayerBuffID(buffIndex) + end + end + + -- CombatLogAdd wrapper for logging + if CombatLogAdd then + pfUI.api.LogToCombatLog = function(text, raw) + CombatLogAdd(text, raw and 1 or nil) + end + end + + -- Local Raid Markers (marks only visible to self) + if SetRaidTarget then + local origSetRaidTarget = SetRaidTarget + pfUI.api.SetLocalRaidTarget = function(unit, index) + origSetRaidTarget(unit, index, "local") + end + end + + -- Enhanced GetContainerItemInfo for charges + -- SuperWoW returns charges as negative numbers + pfUI.api.GetItemCharges = function(bag, slot) + local texture, count = GetContainerItemInfo(bag, slot) + if count and count < 0 then + return math.abs(count) -- Return positive charge count + end + return nil -- Not a charged item + end + + -- Weapon Enchant Info on other players + if GetWeaponEnchantInfo then + local origGetWeaponEnchantInfo = GetWeaponEnchantInfo + pfUI.api.GetUnitWeaponEnchants = function(unit) + if unit and unit ~= "player" then + local mhName, ohName = GetWeaponEnchantInfo(unit) + return { + mainHand = mhName, + offHand = ohName, + } + else + local hasMainHandEnchant, mainHandExpiration, mainHandCharges, hasOffHandEnchant, offHandExpiration, offHandCharges = origGetWeaponEnchantInfo() + return { + mainHand = hasMainHandEnchant and true or false, + mainHandExpiration = mainHandExpiration, + mainHandCharges = mainHandCharges, + offHand = hasOffHandEnchant and true or false, + offHandExpiration = offHandExpiration, + offHandCharges = offHandCharges, + } + end + end + end + + -- Enhance libcast with SuperWoW data for NPCs and other players only + -- Player casts use SPELLCAST_* events for proper pushback handling local supercast = CreateFrame("Frame") + local playerGuid = nil + + supercast:RegisterEvent("PLAYER_ENTERING_WORLD") supercast:RegisterEvent("UNIT_CASTEVENT") supercast:SetScript("OnEvent", function() - if not supercast.init then - -- disable combat parsing events in superwow mode + if event == "PLAYER_ENTERING_WORLD" then + -- Cache player GUID + if UnitExists then + local _, guid = UnitExists("player") + playerGuid = guid + end + return + end + + local guid = arg1 + local isPlayer = guid == playerGuid + + -- For non-player units: disable combat parsing events (one-time init) + if not isPlayer and not supercast.init then + -- disable combat parsing events in superwow mode (for non-player units) libcast:UnregisterEvent("CHAT_MSG_SPELL_SELF_DAMAGE") libcast:UnregisterEvent("CHAT_MSG_SPELL_HOSTILEPLAYER_DAMAGE") libcast:UnregisterEvent("CHAT_MSG_SPELL_HOSTILEPLAYER_BUFF") @@ -276,13 +604,10 @@ pfUI:RegisterModule("superwow", "vanilla", function () end if arg3 == "START" or arg3 == "CAST" or arg3 == "CHANNEL" then - -- human readable argument list - local guid = arg1 local target = arg2 local event_type = arg3 local spell_id = arg4 local timer = arg5 - local start = GetTime() -- get spell info from spell id local spell, icon, _ @@ -297,35 +622,31 @@ pfUI:RegisterModule("superwow", "vanilla", function () -- skip on buff procs during cast if event_type == "CAST" then if not libcast.db[guid] or libcast.db[guid].cast ~= spell then - -- ignore casts without 'START' event, while there is already another cast. - -- those events can be for example a frost shield proc while casting frostbolt. - -- we want to keep the cast itself, so we simply skip those. return end end + -- For player: store in libcast.db[playerName] so pushback tracking works + -- For others: store by GUID + local dbKey = isPlayer and UnitName("player") or guid + -- add cast action to the database - if not libcast.db[guid] then libcast.db[guid] = {} end - libcast.db[guid].cast = spell - libcast.db[guid].rank = nil - libcast.db[guid].start = GetTime() - libcast.db[guid].casttime = timer - libcast.db[guid].icon = icon - libcast.db[guid].channel = event_type == "CHANNEL" or false - - -- write state variable - superwow_active = true + if not libcast.db[dbKey] then libcast.db[dbKey] = {} end + libcast.db[dbKey].cast = spell + libcast.db[dbKey].rank = nil + libcast.db[dbKey].start = GetTime() + libcast.db[dbKey].casttime = timer or 0 + libcast.db[dbKey].icon = icon + libcast.db[dbKey].channel = event_type == "CHANNEL" or false elseif arg3 == "FAIL" then - local guid = arg1 - - -- delete all cast entries of guid - if libcast.db[guid] then - libcast.db[guid].cast = nil - libcast.db[guid].rank = nil - libcast.db[guid].start = nil - libcast.db[guid].casttime = nil - libcast.db[guid].icon = nil - libcast.db[guid].channel = nil + local dbKey = isPlayer and UnitName("player") or guid + if libcast.db[dbKey] then + libcast.db[dbKey].cast = nil + libcast.db[dbKey].rank = nil + libcast.db[dbKey].start = nil + libcast.db[dbKey].casttime = nil + libcast.db[dbKey].icon = nil + libcast.db[dbKey].channel = nil end end end) diff --git a/modules/target.lua b/modules/target.lua index 9522b8d0..11104094 100644 --- a/modules/target.lua +++ b/modules/target.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("target", "vanilla:tbc", function () +pfUI:RegisterModule("target", "vanilla", function () -- do not go further on disabled UFs if C.unitframes.disable == "1" then return end diff --git a/modules/targettarget.lua b/modules/targettarget.lua index 893ad670..e8310065 100644 --- a/modules/targettarget.lua +++ b/modules/targettarget.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("targettarget", "vanilla:tbc", function () +pfUI:RegisterModule("targettarget", "vanilla", function () -- do not go further on disabled UFs if C.unitframes.disable == "1" then return end diff --git a/modules/targettargettarget.lua b/modules/targettargettarget.lua index 6e912b3b..ec31d90c 100644 --- a/modules/targettargettarget.lua +++ b/modules/targettargettarget.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("targettargettarget", "vanilla:tbc", function () +pfUI:RegisterModule("targettargettarget", "vanilla", function () -- do not go further on disabled UFs if C.unitframes.disable == "1" then return end diff --git a/modules/thirdparty.lua b/modules/thirdparty.lua index f480df7f..f84037f7 100644 --- a/modules/thirdparty.lua +++ b/modules/thirdparty.lua @@ -1,10 +1,7 @@ -pfUI:RegisterModule("thirdparty", "vanilla:tbc", function() +pfUI:RegisterModule("thirdparty", "vanilla", function() -- This module includes the core logic of thirdparty modules. -- Right now, in particular the functions to register addons to the -- dockframe of the chat panel aswell as the thirdparty root-table. - -- This module is supposed to be loaded on all expansions, so only - -- addons that can share the same glue code across expansions will go here. - -- For expansion related code, see: thirdparty-vanilla and thirdparty-tbc. pfUI.thirdparty = {} @@ -196,8 +193,7 @@ pfUI:RegisterModule("thirdparty", "vanilla:tbc", function() end -- MrPlow Bag Sorting Addon. - -- Vanilla: https://www.wowace.com/projects/mr-plow/files/288059 - -- TBC: https://www.wowace.com/projects/mr-plow/files/136162 + -- https://www.wowace.com/projects/mr-plow/files/288059 HookAddonOrVariable("MrPlow", function() if C.thirdparty.mrplow.enable == "0" then return end @@ -232,8 +228,7 @@ pfUI:RegisterModule("thirdparty", "vanilla:tbc", function() end) -- ShaguDPS Damage Meter - -- Vanilla: https://github.com/shagu/ShaguDPS - -- TBC: https://github.com/shagu/ShaguDPS + -- https://github.com/shagu/ShaguDPS HookAddonOrVariable("ShaguDPS", function() local docktable = { "shagudps", "ShaguDPS", "ShaguDPSWindow", function() -- single @@ -333,8 +328,7 @@ pfUI:RegisterModule("thirdparty", "vanilla:tbc", function() end) -- DPSMate Damage Meter - -- Vanilla: https://github.com/Geigerkind/DPSMate - -- TBC: https://github.com/Geigerkind/DPSMateTBC + -- https://github.com/Geigerkind/DPSMate HookAddonOrVariable("DPSMate_DPSMate", function() local docktable = { "dpsmate", "DPSMate", "DPSMate_DPSMate", function() -- single diff --git a/modules/tooltip.lua b/modules/tooltip.lua index 03c51040..054b604b 100644 --- a/modules/tooltip.lua +++ b/modules/tooltip.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("tooltip", "vanilla:tbc", function () +pfUI:RegisterModule("tooltip", "vanilla", function () local rawborder, default_border = GetBorderSize() pfUI.tooltip = CreateFrame('Frame', "pfTooltip", GameTooltip) diff --git a/modules/totems.lua b/modules/totems.lua index 59eab973..56ab9480 100644 --- a/modules/totems.lua +++ b/modules/totems.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("totems", "vanilla:tbc", function () +pfUI:RegisterModule("totems", "vanilla", function () local _, class = UnitClass("player") local slots = { @@ -42,9 +42,6 @@ pfUI:RegisterModule("totems", "vanilla:tbc", function () -- Try to recast totem on left click in vanilla local active, name, start, duration, icon = GetTotemInfo(this.id) if name then CastSpellByName(name) end - elseif pfUI.client > 11200 and this.id and arg1 and arg1 == "RightButton" then - -- Try to cancel totem on right click in tbc+ - DestroyTotem(this.id) end end diff --git a/modules/uf_tukui.lua b/modules/uf_tukui.lua index b48e3829..e798043c 100644 --- a/modules/uf_tukui.lua +++ b/modules/uf_tukui.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("uf_tukui", "vanilla:tbc", function () +pfUI:RegisterModule("uf_tukui", "vanilla", function () if C.unitframes.disable == "1" or C.unitframes.layout ~= "tukui" then return end -- update player layout diff --git a/modules/unitxp.lua b/modules/unitxp.lua new file mode 100644 index 00000000..bc9b1833 --- /dev/null +++ b/modules/unitxp.lua @@ -0,0 +1,234 @@ +-- UnitXP_SP3 integration module +-- Provides Line of Sight indicator, OS notifications, and enhanced targeting +-- Requires UnitXP_SP3 DLL: https://github.com/allfoxwy/UnitXP_SP3 + +pfUI:RegisterModule("unitxp", "vanilla", function () + -- Check if UnitXP is available + local hasUnitXP = pcall(UnitXP, "nop", "nop") + if not hasUnitXP then return end + + local rawborder, border = GetBorderSize() + + -- Helper to create indicators after target frame exists + local function CreateTargetIndicators() + if not pfUI.uf or not pfUI.uf.target then return false end + + -- Behind Indicator for all units (TOP) + if C.unitframes.behind_indicator == "1" and not pfUI.uf.target.behindIndicator then + local behindFrame = CreateFrame("Frame", "pfBehindIndicator", pfUI.uf.target) + behindFrame:SetAllPoints(pfUI.uf.target) + behindFrame:SetFrameLevel(pfUI.uf.target:GetFrameLevel() + 10) + + behindFrame.text = behindFrame:CreateFontString(nil, "OVERLAY") + behindFrame.text:SetFont(pfUI.font_default, 13, "OUTLINE") + behindFrame.text:SetPoint("RIGHT", behindFrame, "RIGHT", -1, 7) + behindFrame.text:SetTextColor(0.3, 1, 0.3, 1) + behindFrame.text:SetText("BEHIND") + behindFrame.text:Hide() + + local lastCheck = 0 + behindFrame:SetScript("OnUpdate", function() + if GetTime() - lastCheck < 0.1 then return end + lastCheck = GetTime() + + if not UnitExists("target") then + this.text:Hide() + return + end + + local success, behind = pcall(UnitXP, "behind", "player", "target") + if success and behind then + this.text:Show() + else + this.text:Hide() + end + end) + + pfUI.uf.target.behindIndicator = behindFrame + end + + -- Line of Sight Indicator on Target Frame (BELOW BEHIND) + if C.unitframes.los_indicator == "1" and not pfUI.uf.target.losIndicator then + local losFrame = CreateFrame("Frame", "pfLoSIndicator", pfUI.uf.target) + losFrame:SetAllPoints(pfUI.uf.target) + losFrame:SetFrameLevel(pfUI.uf.target:GetFrameLevel() + 10) + + losFrame.text = losFrame:CreateFontString(nil, "OVERLAY") + losFrame.text:SetFont(pfUI.font_default, 13, "OUTLINE") + losFrame.text:SetPoint("RIGHT", losFrame, "RIGHT", -1, -7) + losFrame.text:SetTextColor(1, 0.3, 0.3, 1) + losFrame.text:SetText("NO LOS") + losFrame.text:Hide() + + local lastCheck = 0 + losFrame:SetScript("OnUpdate", function() + if GetTime() - lastCheck < 0.2 then return end + lastCheck = GetTime() + + if not UnitExists("target") then + this.text:Hide() + return + end + + local success, inSight = pcall(UnitXP, "inSight", "player", "target") + if success and inSight == false then + this.text:Show() + else + this.text:Hide() + end + end) + + pfUI.uf.target.losIndicator = losFrame + end + + return true + end + + -- Try to create indicators now + CreateTargetIndicators() + + -- Also try on PLAYER_ENTERING_WORLD in case target frame wasn't ready + local initFrame = CreateFrame("Frame") + initFrame:RegisterEvent("PLAYER_ENTERING_WORLD") + initFrame:SetScript("OnEvent", function() + CreateTargetIndicators() + this:UnregisterAllEvents() + end) + + -- OS Notification Support + if C.unitframes.unitxp_notify == "1" then + local notifyFrame = CreateFrame("Frame") + notifyFrame:RegisterEvent("CHAT_MSG_WHISPER") + notifyFrame:RegisterEvent("CHAT_MSG_BN_WHISPER") + notifyFrame:RegisterEvent("READY_CHECK") + notifyFrame:RegisterEvent("RAID_INSTANCE_WELCOME") + + notifyFrame:SetScript("OnEvent", function() + pcall(UnitXP, "notify", "taskbarIcon") + pcall(UnitXP, "notify", "systemSound") + end) + + -- Also notify on BG queue pop + local origBattlefieldPortShow = BattlefieldFrame_Show + if origBattlefieldPortShow then + BattlefieldFrame_Show = function() + pcall(UnitXP, "notify", "taskbarIcon") + pcall(UnitXP, "notify", "systemSound") + return origBattlefieldPortShow() + end + end + end + + -- Enhanced Distance API + pfUI.api.GetPreciseDistance = function(unit1, unit2) + if not unit2 then + unit2 = unit1 + unit1 = "player" + end + local success, distance = pcall(UnitXP, "distanceBetween", unit1, unit2) + if success then return distance end + return nil + end + + pfUI.api.IsInMeleeRange = function(unit) + local success, distance = pcall(UnitXP, "distanceBetween", "player", unit, "meleeAutoAttack") + if success and distance then + return distance <= 5 + end + return nil + end + + pfUI.api.GetAoEDistance = function(unit1, unit2) + if not unit2 then + unit2 = unit1 + unit1 = "player" + end + local success, distance = pcall(UnitXP, "distanceBetween", unit1, unit2, "AoE") + if success then return distance end + return nil + end + + -- Smart Targeting Helpers + pfUI.api.TargetNearestEnemy = function() + local success, found = pcall(UnitXP, "target", "nearestEnemy") + return success and found + end + + pfUI.api.TargetHighestHP = function() + local success, found = pcall(UnitXP, "target", "mostHP") + return success and found + end + + pfUI.api.TargetNextEnemy = function() + local success, found = pcall(UnitXP, "target", "nextEnemyInCycle") + return success and found + end + + pfUI.api.TargetPreviousEnemy = function() + local success, found = pcall(UnitXP, "target", "previousEnemyInCycle") + return success and found + end + + pfUI.api.TargetNextMarked = function(order) + local success, found = pcall(UnitXP, "target", "nextMarkedEnemyInCycle", order) + 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 + SLASH_PFUNITXP1 = "/pfunitxp" + SlashCmdList["PFUNITXP"] = function() + local chat = DEFAULT_CHAT_FRAME + chat:AddMessage("|cff33ffccpfUI|r: UnitXP Indicator Debug") + + -- Check if target exists + if not UnitExists("target") then + chat:AddMessage(" |cffff0000No target selected|r") + return + end + + -- Test behind + local successB, behind = pcall(UnitXP, "behind", "player", "target") + chat:AddMessage(" Behind check: success=" .. tostring(successB) .. " value=" .. tostring(behind) .. " type=" .. type(behind)) + + -- Test LOS + local successL, inSight = pcall(UnitXP, "inSight", "player", "target") + chat:AddMessage(" LOS check: success=" .. tostring(successL) .. " value=" .. tostring(inSight) .. " type=" .. type(inSight)) + + -- Check if indicator frames exist + if pfUI.uf and pfUI.uf.target then + chat:AddMessage(" Target frame: |cff00ff00exists|r") + if pfUI.uf.target.behindIndicator then + chat:AddMessage(" Behind indicator: |cff00ff00created|r, visible=" .. tostring(pfUI.uf.target.behindIndicator:IsVisible())) + else + chat:AddMessage(" Behind indicator: |cffff0000NOT created|r (check settings)") + end + if pfUI.uf.target.losIndicator then + chat:AddMessage(" LOS indicator: |cff00ff00created|r") + else + chat:AddMessage(" LOS indicator: |cffff0000NOT created|r (check settings)") + end + else + chat:AddMessage(" Target frame: |cffff0000NOT found|r") + end + end +end) diff --git a/modules/unlock.lua b/modules/unlock.lua index 59fcd473..629097d4 100644 --- a/modules/unlock.lua +++ b/modules/unlock.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("unlock", "vanilla:tbc", function () +pfUI:RegisterModule("unlock", "vanilla", function () local rawborder, default_border = GetBorderSize() -- grouped frames diff --git a/modules/unusable.lua b/modules/unusable.lua index 73a9d992..f51c2b6b 100644 --- a/modules/unusable.lua +++ b/modules/unusable.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("unusable", "vanilla:tbc", function () +pfUI:RegisterModule("unusable", "vanilla", function () if not pfUI.bag then return end if C.appearance.bags.unusable ~= "1" then return end diff --git a/modules/updatenotify.lua b/modules/updatenotify.lua index a88730dd..31aa9cdc 100644 --- a/modules/updatenotify.lua +++ b/modules/updatenotify.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("updatenotify", "vanilla:tbc", function () +pfUI:RegisterModule("updatenotify", "vanilla", function () local alreadyshown = false local localversion = tonumber(pfUI.version.major*10000 + pfUI.version.minor*100 + pfUI.version.fix) local remoteversion = tonumber(pfUI_init.updateavailable) or 0 diff --git a/modules/xpbar.lua b/modules/xpbar.lua index 7b1ed36f..54ca6a7d 100644 --- a/modules/xpbar.lua +++ b/modules/xpbar.lua @@ -1,4 +1,4 @@ -pfUI:RegisterModule("xpbar", "vanilla:tbc", function () +pfUI:RegisterModule("xpbar", "vanilla", function () local rawborder, default_border = GetBorderSize() local parse_faction = SanitizePattern(FACTION_STANDING_INCREASED)