--Plater main software file --Calls with : are functions imported from the framework --whenever a variable or function has a --private comment attached to it, means scripts cannot access it (read, write, override), anything else can be overriden with scripts --with that, you can make your own version of Plater by modifying and overriding functions entirelly using a hooking script, them you can export the script and upload to wago.io (have fun :) --check the list of available functions and members to override at 'Plater.CanOverride_Functions' and 'Plater.CanOverride_Members' --Weakauras Scripters: if you need to attach something to Plater nameplates: -- local namePlate = C_NamePlate.GetNamePlateForUnit (unitID) -- local unitFrame = namePlate.unitFrame --unitFrame is the main frame where all things is attached, it has SetAllPoints() on the namePlate frame. -- local healthBar = unitFrame.healthBar -- local castBar = unitFrame.castBar -- update localization -- navigate within the code using search tags: ~color ~border, etc... if (true) then --return --but not today end --> details! framework local DF = _G ["DetailsFramework"] if (not DF) then print ("|cFFFFAA00Plater: framework not found, if you just installed or updated the addon, please restart your client.|r") return end --/run UIErrorsFrame:HookScript ("OnEnter", function() UIErrorsFrame:EnableMouse (false);Plater:Msg("UIErrorsFrame had MouseEnabled, its disabled now.") end) --> some WA or addon are enabling the mouse on the error frame making nameplates unclickable if (UIErrorsFrame) then UIErrorsFrame:HookScript ("OnEnter", function() --safe disable the mouse on error frame avoiding mouse interactions and warn the user UIErrorsFrame:EnableMouse (false) Plater:Msg ("something enabled the mouse on UIErrorsFrame, Plater disabled.") end) UIErrorsFrame:EnableMouse (false) end --> locals local unpack = unpack local ipairs = ipairs local rawset = rawset --local rawget = rawget --200 locals limit --local setfenv = setfenv --200 locals limit local xpcall = xpcall local InCombatLockdown = InCombatLockdown local UnitIsPlayer = UnitIsPlayer local UnitClassification = UnitClassification local UnitDetailedThreatSituation = UnitDetailedThreatSituation local UnitCanAttack = UnitCanAttack --local IsSpellInRange = IsSpellInRange --200 locals limit local abs = math.abs local format = string.format local GetSpellInfo = GetSpellInfo or function(spellID) if not spellID then return nil end local si = C_Spell.GetSpellInfo(spellID) if si then return si.name, nil, si.iconID, si.castTime, si.minRange, si.maxRange, si.spellID, si.originalIconID end end local UnitIsUnit = UnitIsUnit local type = type local select = select local UnitGUID = UnitGUID local strsplit = strsplit local lower = string.lower local floor = floor local max = math.max local min = math.min local IS_WOW_PROJECT_MAINLINE = WOW_PROJECT_ID == WOW_PROJECT_MAINLINE local IS_WOW_PROJECT_NOT_MAINLINE = WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE local IS_WOW_PROJECT_CLASSIC_ERA = WOW_PROJECT_ID == WOW_PROJECT_CLASSIC local IS_WOW_PROJECT_CLASSIC_WRATH = IS_WOW_PROJECT_NOT_MAINLINE and ClassicExpansionAtLeast and LE_EXPANSION_WRATH_OF_THE_LICH_KING and ClassicExpansionAtLeast(LE_EXPANSION_WRATH_OF_THE_LICH_KING) --local IS_WOW_PROJECT_CLASSIC_CATACLYSM = IS_WOW_PROJECT_NOT_MAINLINE and ClassicExpansionAtLeast and LE_EXPANSION_CATACLYSM and ClassicExpansionAtLeast(LE_EXPANSION_CATACLYSM) local PixelUtil = PixelUtil or DFPixelUtil local parserFunctions --reference needed local LibSharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0") -- https://www.curseforge.com/wow/addons/libsharedmedia-3-0 local LCG = LibStub:GetLibrary("LibCustomGlow-1.0") -- https://github.com/Stanzilla/LibCustomGlow local LibRangeCheck = LibStub:GetLibrary ("LibRangeCheck-3.0") -- https://github.com/WeakAuras/LibRangeCheck-3.0 local LibTranslit = LibStub:GetLibrary ("LibTranslit-1.0") -- https://github.com/Vardex/LibTranslit local LDB = LibStub ("LibDataBroker-1.1", true) local LDBIcon = LDB and LibStub ("LibDBIcon-1.0", true) local addonId, platerInternal = ... local _ = nil --localization local LOC = DF.Language.GetLanguageTable(addonId) ---@type plater local Plater = DF:CreateAddOn ("Plater", "PlaterDB", PLATER_DEFAULT_SETTINGS, InterfaceOptionsFrame and { --options table --TODO: DISABLED FOR DRAGONFLIGHT FOR NOW! name = "Plater Nameplates", type = "group", args = { openOptions = { name = "Open Plater Options", desc = "Opens the Plater Options Menu.", type = "execute", func = function() if InterfaceOptionsFrame then InterfaceOptionsFrame:Hide() elseif SettingsPanel then SettingsPanel:Hide() end HideUIPanel(GameMenuFrame) Plater.OpenOptionsPanel() end, }, } }) local GetAddOnMetadata = C_AddOns and C_AddOns.GetAddOnMetadata or GetAddOnMetadata Plater.versionString = GetAddOnMetadata("Plater", "Version") Plater.fullVersionInfo = Plater.versionString .. " - DF v" .. select(2,LibStub:GetLibrary("DetailsFramework-1.0")) .. " - " .. GetBuildInfo() function Plater.GetVersionInfo(printOut) -- update, just in case... Plater.versionString = GetAddOnMetadata("Plater", "Version") Plater.fullVersionInfo = Plater.versionString .. " - DF v" .. select(2,LibStub:GetLibrary("DetailsFramework-1.0")) .. " - " .. GetBuildInfo() if printOut then print("Plater version info:\n" .. Plater.fullVersionInfo) end return Plater.fullVersionInfo end --> when a hook script is compiled, it increases the build version, so the handler for running scripts will notice in the change and update the script in real time local PLATER_HOOK_BUILD = 1 function Plater.IncreaseHookBuildID() --private PLATER_HOOK_BUILD = PLATER_HOOK_BUILD + 1 end --> if a widget has a RefreshID lower than the addon, it needs to be updated local PLATER_REFRESH_ID = 1 function Plater.IncreaseRefreshID() --private PLATER_REFRESH_ID = PLATER_REFRESH_ID + 1 Plater.IncreaseRefreshID_Auras() end platerInternal.CreateDataTables(Plater) Plater.ForceBlizzardNameplateUnits = { -- } Plater.AddForceBlizzardNameplateUnits = function(npcID) if type(npcID) == "number" then Plater.ForceBlizzardNameplateUnits[npcID] = true end end Plater.RemoveForceBlizzardNameplateUnits = function(npcID) if type(npcID) == "number" then Plater.ForceBlizzardNameplateUnits[npcID] = nil end end --store npc names and spell names from the current/latest combat --used to sort data in the options panel: Spell List, Spell Colors and Npc Colors Plater.LastCombat = { npcNames = {}, spellNames = {}, } Plater.MDTSettings = { button_width = 18, --button and icon width button_height = 18, enemyinfo_button_point = {"topright", "topright", 4.682, -21.361}, spellinfo_button_point = {"bottomright", "bottomright", -12, 2}, icon_texture = [[Interface\Buttons\UI-Panel-BiggerButton-Up]], icon_coords = {0.2, 0.8, 0.2, 0.8}, alpha = 0.834, --button alpha } -- ~hook (hook scripts are cached in the indexed part of these tales, for performance the member ScriptAmount caches the amount of scripts inside the indexed table) local HOOK_NAMEPLATE_ADDED = {ScriptAmount = 0} local HOOK_NAMEPLATE_CREATED = {ScriptAmount = 0} local HOOK_NAMEPLATE_REMOVED = {ScriptAmount = 0} local HOOK_NAMEPLATE_UPDATED = {ScriptAmount = 0} local HOOK_TARGET_CHANGED = {ScriptAmount = 0} local HOOK_CAST_START = {ScriptAmount = 0} local HOOK_CAST_UPDATE = {ScriptAmount = 0} local HOOK_CAST_STOP = {ScriptAmount = 0} local HOOK_RAID_TARGET = {ScriptAmount = 0} local HOOK_COMBAT_ENTER = {ScriptAmount = 0} local HOOK_COMBAT_LEAVE = {ScriptAmount = 0} local HOOK_NAMEPLATE_CONSTRUCTOR = {ScriptAmount = 0} local HOOK_PLAYER_POWER_UPDATE = {ScriptAmount = 0} local HOOK_PLAYER_TALENT_UPDATE = {ScriptAmount = 0} local HOOK_HEALTH_UPDATE = {ScriptAmount = 0} local HOOK_ZONE_CHANGED = {ScriptAmount = 0} local HOOK_UNITNAME_UPDATE = {ScriptAmount = 0} local HOOK_LOAD_SCREEN = {ScriptAmount = 0} local HOOK_PLAYER_LOGON = {ScriptAmount = 0} local HOOK_MOD_INITIALIZATION = {ScriptAmount = 0} local HOOK_MOD_DEINITIALIZATION = {ScriptAmount = 0} local HOOK_COMM_RECEIVED_MESSAGE = {ScriptAmount = 0} local HOOK_COMM_SEND_MESSAGE = {ScriptAmount = 0} local HOOK_OPTION_CHANGED = {ScriptAmount = 0} local HOOK_MOD_OPTION_CHANGED = {ScriptAmount = 0} local HOOK_NAMEPLATE_DESTRUCTOR = {ScriptAmount = 0} platerInternal.HOOK_MOD_OPTION_CHANGED = HOOK_MOD_OPTION_CHANGED --triggered from Plater.ScriptingOptions.lua local PLATER_GLOBAL_MOD_ENV = {} -- contains modEnv for each mod, identified by "" local PLATER_GLOBAL_SCRIPT_ENV = {} -- contains modEnv for each script, identified by "