--[[ ############################################################################## _____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# ___\///////////___________\///___________\/////////_____\///////////_# ############################################################################## S U P E R - V I L L A I N - U I By: Munglunch # ############################################################################## ########################################################## LOCALIZED LUA FUNCTIONS ########################################################## ]]-- --[[ GLOBALS ]]-- local _G = _G; local unpack = _G.unpack; local select = _G.select; local pairs = _G.pairs; local next = _G.next; local type = _G.type; local error = _G.error; local rawset = _G.rawset; local rawget = _G.rawget; local table = _G.table; --[[ TABLE METHODS ]]-- local tremove, tcopy, twipe, tsort, tconcat, tdump = table.remove, table.copy, table.wipe, table.sort, table.concat, table.dump; --[[ ########################################################## GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(select(2, ...)); SuperVillain.Shared = LibStub("LibSharedMedia-3.0") local realm = GetRealmName() local name = UnitName("player") local pkey = ("%s - %s"):format(name, realm) local logoutListener = CreateFrame("Frame", nil) local CONFIGS = SuperVillain.Configs --[[ ########################################################## DEFINE SHARED MEDIA ########################################################## ]]-- SuperVillain.Shared:Register("background","SVUI Backdrop 1",[[Interface\AddOns\SVUI\assets\artwork\Template\Background\PATTERN1]]) SuperVillain.Shared:Register("background","SVUI Backdrop 2",[[Interface\AddOns\SVUI\assets\artwork\Template\Background\PATTERN2]]) SuperVillain.Shared:Register("background","SVUI Backdrop 3",[[Interface\AddOns\SVUI\assets\artwork\Template\Background\PATTERN3]]) SuperVillain.Shared:Register("background","SVUI Backdrop 4",[[Interface\AddOns\SVUI\assets\artwork\Template\Background\PATTERN4]]) SuperVillain.Shared:Register("background","SVUI Backdrop 5",[[Interface\AddOns\SVUI\assets\artwork\Template\Background\PATTERN5]]) SuperVillain.Shared:Register("background","SVUI Comic 1",[[Interface\AddOns\SVUI\assets\artwork\Template\Background\COMIC1]]) SuperVillain.Shared:Register("background","SVUI Comic 2",[[Interface\AddOns\SVUI\assets\artwork\Template\Background\COMIC2]]) SuperVillain.Shared:Register("background","SVUI Comic 3",[[Interface\AddOns\SVUI\assets\artwork\Template\Background\COMIC3]]) SuperVillain.Shared:Register("background","SVUI Comic 4",[[Interface\AddOns\SVUI\assets\artwork\Template\Background\COMIC4]]) SuperVillain.Shared:Register("background","SVUI Comic 5",[[Interface\AddOns\SVUI\assets\artwork\Template\Background\COMIC5]]) SuperVillain.Shared:Register("background","SVUI Comic 6",[[Interface\AddOns\SVUI\assets\artwork\Template\Background\COMIC6]]) SuperVillain.Shared:Register("background","SVUI Unit BG 1",[[Interface\AddOns\SVUI\assets\artwork\Unitframe\Background\UNIT-BG1]]) SuperVillain.Shared:Register("background","SVUI Unit BG 2",[[Interface\AddOns\SVUI\assets\artwork\Unitframe\Background\UNIT-BG2]]) SuperVillain.Shared:Register("background","SVUI Unit BG 3",[[Interface\AddOns\SVUI\assets\artwork\Unitframe\Background\UNIT-BG3]]) SuperVillain.Shared:Register("background","SVUI Unit BG 4",[[Interface\AddOns\SVUI\assets\artwork\Unitframe\Background\UNIT-BG4]]) SuperVillain.Shared:Register("background","SVUI Small BG 1",[[Interface\AddOns\SVUI\assets\artwork\Unitframe\Background\UNIT-SMALL-BG1]]) SuperVillain.Shared:Register("background","SVUI Small BG 2",[[Interface\AddOns\SVUI\assets\artwork\Unitframe\Background\UNIT-SMALL-BG2]]) SuperVillain.Shared:Register("background","SVUI Small BG 3",[[Interface\AddOns\SVUI\assets\artwork\Unitframe\Background\UNIT-SMALL-BG3]]) SuperVillain.Shared:Register("background","SVUI Small BG 4",[[Interface\AddOns\SVUI\assets\artwork\Unitframe\Background\UNIT-SMALL-BG4]]) SuperVillain.Shared:Register("statusbar","SVUI BasicBar",[[Interface\AddOns\SVUI\assets\artwork\Bars\DEFAULT]]) SuperVillain.Shared:Register("statusbar","SVUI MultiColorBar",[[Interface\AddOns\SVUI\assets\artwork\Bars\GRADIENT]]) SuperVillain.Shared:Register("statusbar","SVUI SmoothBar",[[Interface\AddOns\SVUI\assets\artwork\Bars\SMOOTH]]) SuperVillain.Shared:Register("statusbar","SVUI PlainBar",[[Interface\AddOns\SVUI\assets\artwork\Bars\FLAT]]) SuperVillain.Shared:Register("statusbar","SVUI FancyBar",[[Interface\AddOns\SVUI\assets\artwork\Bars\TEXTURED]]) SuperVillain.Shared:Register("statusbar","SVUI GlossBar",[[Interface\AddOns\SVUI\assets\artwork\Bars\GLOSS]]) SuperVillain.Shared:Register("statusbar","SVUI GlowBar",[[Interface\AddOns\SVUI\assets\artwork\Bars\GLOWING]]) SuperVillain.Shared:Register("statusbar","SVUI LazerBar",[[Interface\AddOns\SVUI\assets\artwork\Bars\LAZER]]) SuperVillain.Shared:Register("sound", "Whisper Alert", [[Interface\AddOns\SVUI\assets\sounds\whisper.mp3]]) SuperVillain.Shared:Register("sound", "Toasty", [[Interface\AddOns\SVUI\assets\sounds\toasty.mp3]]) SuperVillain.Shared:Register("font","SVUI Default Font",[[Interface\AddOns\SVUI\assets\fonts\Default.ttf]]) SuperVillain.Shared:Register("font","SVUI System Font",[[Interface\AddOns\SVUI\assets\fonts\System.ttf]]) SuperVillain.Shared:Register("font","SVUI Dialog Font",[[Interface\AddOns\SVUI\assets\fonts\Dialog.ttf]]) SuperVillain.Shared:Register("font","SVUI Narrator Font",[[Interface\AddOns\SVUI\assets\fonts\Narrative.ttf]]) SuperVillain.Shared:Register("font","SVUI Number Font",[[Interface\AddOns\SVUI\assets\fonts\Numbers.ttf]]) SuperVillain.Shared:Register("font","SVUI Combat Font",[[Interface\AddOns\SVUI\assets\fonts\Combat.ttf]]) SuperVillain.Shared:Register("font","SVUI Action Font",[[Interface\AddOns\SVUI\assets\fonts\Action.ttf]]) SuperVillain.Shared:Register("font","SVUI Name Font",[[Interface\AddOns\SVUI\assets\fonts\Names.ttf]]) SuperVillain.Shared:Register("font","SVUI Alert Font",[[Interface\AddOns\SVUI\assets\fonts\Alert.ttf]]) SuperVillain.Shared:Register("font","Roboto",[[Interface\AddOns\SVUI\assets\fonts\Roboto.ttf]],SuperVillain.Shared.LOCALE_BIT_ruRU+SuperVillain.Shared.LOCALE_BIT_western) --[[ ########################################################## POPULATE MEDIA TABLE ########################################################## ]]-- do local myclass = select(2,UnitClass("player")) local cColor1 = SVUI_CLASS_COLORS[myclass] local cColor2 = RAID_CLASS_COLORS[myclass] local r1,g1,b1 = cColor1.r,cColor1.g,cColor1.b local r2,g2,b2 = cColor2.r*.25, cColor2.g*.25, cColor2.b*.25 local ir1,ig1,ib1 = (1 - r1), (1 - g1), (1 - b1) local ir2,ig2,ib2 = (1 - cColor2.r)*.25, (1 - cColor2.g)*.25, (1 - cColor2.b)*.25 local Shared = SuperVillain.Shared SuperVillain.Media["color"] = { ["default"] = {0.2, 0.2, 0.2, 1}, ["special"] = {.37, .32, .29, 1}, ["unique"] = {0.32, 0.258, 0.21, 1}, ["class"] = {r1, g1, b1, 1}, ["bizzaro"] = {ir1, ig1, ib1, 1}, ["dark"] = {0, 0, 0, 1}, ["light"] = {0.95, 0.95, 0.95, 1}, ["highlight"] = {0.1, 0.8, 0.8, 1}, ["green"] = {0.25, 0.9, 0.08, 1}, ["red"] = {0.9, 0.08, 0.08, 1}, ["yellow"] = {1, 1, 0, 1}, ["transparent"] = {0, 0, 0, 0.5}, } SuperVillain.Media["font"] = { ["default"] = Shared:Fetch("font", "SVUI Default Font"), ["system"] = Shared:Fetch("font", "SVUI System Font"), ["combat"] = Shared:Fetch("font", "SVUI Combat Font"), ["dialog"] = Shared:Fetch("font", "SVUI Dialog Font"), ["narrator"] = Shared:Fetch("font", "SVUI Narrator Font"), ["action"] = Shared:Fetch("font", "SVUI Action Font"), ["names"] = Shared:Fetch("font", "SVUI Name Font"), ["alert"] = Shared:Fetch("font", "SVUI Alert Font"), ["numbers"] = Shared:Fetch("font", "SVUI Number Font"), ["roboto"] = Shared:Fetch("font", "Roboto") } SuperVillain.Media["bar"] = { ["default"] = Shared:Fetch("statusbar", "SVUI BasicBar"), ["gradient"] = Shared:Fetch("statusbar", "SVUI MultiColorBar"), ["smooth"] = Shared:Fetch("statusbar", "SVUI SmoothBar"), ["flat"] = Shared:Fetch("statusbar", "SVUI PlainBar"), ["textured"] = Shared:Fetch("statusbar", "SVUI FancyBar"), ["gloss"] = Shared:Fetch("statusbar", "SVUI GlossBar"), ["glow"] = Shared:Fetch("statusbar", "SVUI GlowBar"), ["lazer"] = Shared:Fetch("statusbar", "SVUI LazerBar"), } SuperVillain.Media["bg"] = { ["pattern"] = Shared:Fetch("background", "SVUI Backdrop 1"), ["comic"] = Shared:Fetch("background", "SVUI Comic 1"), ["unitlarge"] = Shared:Fetch("background", "SVUI Unit BG 3"), ["unitsmall"] = Shared:Fetch("background", "SVUI Small BG 3") } SuperVillain.Media["gradient"] = { ["default"] = {"VERTICAL", 0.08, 0.08, 0.08, 0.22, 0.22, 0.22}, ["special"] = {"VERTICAL", 0.33, 0.25, 0.13, 0.47, 0.39, 0.27}, ["class"] = {"VERTICAL", r2, g2, b2, r1, g1, b1}, ["bizzaro"] = {"VERTICAL", ir2, ig2, ib2, ir1, ig1, ib1}, ["dark"] = {"VERTICAL", 0.02, 0.02, 0.02, 0.22, 0.22, 0.22}, ["darkest"] = {"VERTICAL", 0.15, 0.15, 0.15, 0, 0, 0}, ["darkest2"] = {"VERTICAL", 0, 0, 0, 0.12, 0.12, 0.12}, ["light"] = {"VERTICAL", 0.65, 0.65, 0.65, 0.95, 0.95, 0.95}, ["highlight"] = {"VERTICAL", 0.1, 0.8, 0.8, 0.2, 0.5, 1}, ["green"] = {"VERTICAL", 0.08, 0.5, 0, 0.25, 0.9, 0.08}, ["red"] = {"VERTICAL", 0.5, 0, 0, 0.9, 0.08, 0.08}, ["yellow"] = {"VERTICAL", 1, 0.3, 0, 1, 1, 0}, ["inverse"] = {"VERTICAL", 0.25, 0.25, 0.25, 0.12, 0.12, 0.12}, ["icon"] = {"VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1} } end --[[ ########################################################## DB BUILD HELPERS ########################################################## ]]-- local function SpellName(id) local name, _, _, _, _, _, _, _, _ = GetSpellInfo(id) if not name then print('|cffFF9900SVUI:|r Spell not found: (#ID) '..id) name = "Voodoo Doll"; end return name end --[[ ########################################################## DB PROFILE ########################################################## ]]-- CONFIGS["copyKey"] = pkey CONFIGS["profileKey"] = pkey CONFIGS["framelocations"] = {} CONFIGS["system"] = { ["cooldown"] = true, ["autoScale"] = true, ["multiMonitor"] = false, ["taintLog"] = false, ["stickyFrames"] = true, ["loginmessage"] = true, ["hideErrorFrame"] = true, ["threatbar"] = false, ["bubbles"] = true, ["comix"] = true, ["bigComix"] = true, ["questWatch"] = true, ["woot"] = true, ["pvpinterrupt"] = true, ["lookwhaticando"] = false, ["sharingiscaring"] = false, ["arenadrink"] = true, ["stupidhat"] = true, ["totems"] = { ["enable"] = true, ["showBy"] = "VERTICAL", ["sortDirection"] = "ASCENDING", ["size"] = 40, ["spacing"] = 4 }, } CONFIGS["media"] = { ["fonts"] = { ["default"] = "SVUI System Font", ["name"] = "SVUI Name Font", ["number"] = "SVUI Number Font", ["combat"] = "SVUI Combat Font", ["giant"] = "SVUI Action Font", ["size"] = 10, ["unicodeSize"] = 12, }, ["textures"] = { ["pattern"] = "SVUI Backdrop 1", ["comic"] = "SVUI Comic 1", ["unitlarge"] = "SVUI Unit BG 3", ["unitsmall"] = "SVUI Small BG 3" }, ["colors"] = { ["default"] = {0.2, 0.2, 0.2, 1}, ["special"] = {0.37, 0.32, 0.29, 1}, }, ["unitframes"] = { ["health"] = {0.3, 0.5, 0.3}, ["power"] = { ["MANA"] = {0.41, 0.85, 1}, ["RAGE"] = {1, 0.31, 0.31}, ["FOCUS"] = {1, 0.63, 0.27}, ["ENERGY"] = {0.85, 0.83, 0.25}, ["RUNES"] = {0.55, 0.57, 0.61}, ["RUNIC_POWER"] = {0, 0.82, 1}, ["FUEL"] = {0, 0.75, 0.75} }, ["reaction"] = { [1] = {0.92, 0.15, 0.15}, [2] = {0.92, 0.15, 0.15}, [3] = {0.92, 0.15, 0.15}, [4] = {0.85, 0.85, 0.13}, [5] = {0.19, 0.85, 0.13}, [6] = {0.19, 0.85, 0.13}, [7] = {0.19, 0.85, 0.13}, [8] = {0.19, 0.85, 0.13}, }, ["tapped"] = {0.55, 0.57, 0.61}, ["disconnected"] = {0.84, 0.75, 0.65}, ["casting"] = {0.8, 0.8, 0}, ["spark"] = {1, 0.72, 0}, ["interrupt"] = {0.78, 0.25, 0.25}, ["shield_bars"] = {0.56, 0.4, 0.62}, ["buff_bars"] = {0.31, 0.31, 0.31}, ["debuff_bars"] = {0.8, 0.1, 0.1}, ["predict"] = { ["personal"] = {0, 1, 0.5, 0.25}, ["others"] = {0, 1, 0, 0.25}, ["absorbs"] = {1, 1, 0, 0.25} }, ["spellcolor"] = { [SpellName(2825)] = {0.98, 0.57, 0.11}, --Bloodlust [SpellName(32182)] = {0.98, 0.57, 0.11}, --Heroism [SpellName(80353)] = {0.98, 0.57, 0.11}, --Time Warp [SpellName(90355)] = {0.98, 0.57, 0.11}, --Ancient Hysteria [SpellName(84963)] = {0.98, 0.57, 0.11}, --Inquisition [SpellName(86659)] = {0.98, 0.57, 0.11}, --Guardian of Ancient Kings } } } CONFIGS["filter"] = { ["CC"] = {}, ["Shield"] = {}, ["Player"] = {}, ["Blocked"] = {}, ["Allowed"] = {}, ["Strict"] = {}, ["Raid"] = {}, } --[[ ########################################################## CONSTRUCT FILTER DEFAULTS ########################################################## ]]-- local CLASS_WATCH_INDEX = { PRIEST = { {-- Weakened Soul ["enabled"] = true, ["id"] = 6788, ["point"] = "TOPRIGHT", ["color"] = {["r"] = 1, ["g"] = 0, ["b"] = 0}, ["anyUnit"] = true, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, {-- Prayer of Mending ["enabled"] = true, ["id"] = 41635, ["point"] = "BOTTOMRIGHT", ["color"] = {["r"] = 0.2, ["g"] = 0.7, ["b"] = 0.2}, ["anyUnit"] = false, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, {-- Renew ["enabled"] = true, ["id"] = 139, ["point"] = "BOTTOMLEFT", ["color"] = {["r"] = 0.4, ["g"] = 0.7, ["b"] = 0.2}, ["anyUnit"] = false, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, {-- Power Word: Shield ["enabled"] = true, ["id"] = 17, ["point"] = "TOPLEFT", ["color"] = {["r"] = 0.81, ["g"] = 0.85, ["b"] = 0.1}, ["anyUnit"] = true, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, {-- Power Word: Shield Power Insight ["enabled"] = true, ["id"] = 123258, ["point"] = "TOPLEFT", ["color"] = {["r"] = 0.81, ["g"] = 0.85, ["b"] = 0.1}, ["anyUnit"] = true, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, {-- Power Infusion ["enabled"] = true, ["id"] = 10060, ["point"] = "RIGHT", ["color"] = {["r"] = 0.89, ["g"] = 0.09, ["b"] = 0.05}, ["anyUnit"] = false, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, {-- Guardian Spirit ["enabled"] = true, ["id"] = 47788, ["point"] = "LEFT", ["color"] = {["r"] = 0.86, ["g"] = 0.44, ["b"] = 0}, ["anyUnit"] = true, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, {-- Pain Suppression ["enabled"] = true, ["id"] = 33206, ["point"] = "LEFT", ["color"] = {["r"] = 0.89, ["g"] = 0.09, ["b"] = 0.05}, ["anyUnit"] = true, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, }, DRUID = { {-- Rejuvenation ["enabled"] = true, ["id"] = 774, ["point"] = "TOPRIGHT", ["color"] = {["r"] = 0.8, ["g"] = 0.4, ["b"] = 0.8}, ["anyUnit"] = false, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, {-- Regrowth ["enabled"] = true, ["id"] = 8936, ["point"] = "BOTTOMLEFT", ["color"] = {["r"] = 0.2, ["g"] = 0.8, ["b"] = 0.2}, ["anyUnit"] = false, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, {-- Lifebloom ["enabled"] = true, ["id"] = 33763, ["point"] = "TOPLEFT", ["color"] = {["r"] = 0.4, ["g"] = 0.8, ["b"] = 0.2}, ["anyUnit"] = false, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, {-- Wild Growth ["enabled"] = true, ["id"] = 48438, ["point"] = "BOTTOMRIGHT", ["color"] = {["r"] = 0.8, ["g"] = 0.4, ["b"] = 0}, ["anyUnit"] = false, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, }, PALADIN = { {-- Beacon of Light ["enabled"] = true, ["id"] = 53563, ["point"] = "TOPRIGHT", ["color"] = {["r"] = 0.7, ["g"] = 0.3, ["b"] = 0.7}, ["anyUnit"] = false, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, {-- Hand of Protection ["enabled"] = true, ["id"] = 1022, ["point"] = "BOTTOMRIGHT", ["color"] = {["r"] = 0.2, ["g"] = 0.2, ["b"] = 1}, ["anyUnit"] = true, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, {-- Hand of Freedom ["enabled"] = true, ["id"] = 1044, ["point"] = "BOTTOMRIGHT", ["color"] = {["r"] = 0.89, ["g"] = 0.45, ["b"] = 0}, ["anyUnit"] = true, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, {-- Hand of Salvation ["enabled"] = true, ["id"] = 1038, ["point"] = "BOTTOMRIGHT", ["color"] = {["r"] = 0.93, ["g"] = 0.75, ["b"] = 0}, ["anyUnit"] = true, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, {-- Hand of Sacrifice ["enabled"] = true, ["id"] = 6940, ["point"] = "BOTTOMRIGHT", ["color"] = {["r"] = 0.89, ["g"] = 0.1, ["b"] = 0.1}, ["anyUnit"] = true, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, {-- Hand of Purity ["enabled"] = true, ["id"] = 114039, ["point"] = "BOTTOMRIGHT", ["color"] = {["r"] = 0.64, ["g"] = 0.41, ["b"] = 0.72}, ["anyUnit"] = false, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, {-- Sacred Shield ["enabled"] = true, ["id"] = 20925, ["point"] = "TOPLEFT", ["color"] = {["r"] = 0.93, ["g"] = 0.75, ["b"] = 0}, ["anyUnit"] = false, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, {-- Eternal Flame ["enabled"] = true, ["id"] = 114163, ["point"] = "BOTTOMLEFT", ["color"] = {["r"] = 0.87, ["g"] = 0.7, ["b"] = 0.03}, ["anyUnit"] = false, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, }, SHAMAN = { {-- Riptide ["enabled"] = true, ["id"] = 61295, ["point"] = "TOPRIGHT", ["color"] = {["r"] = 0.7, ["g"] = 0.3, ["b"] = 0.7}, ["anyUnit"] = false, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, {-- Earth Shield ["enabled"] = true, ["id"] = 974, ["point"] = "BOTTOMLEFT", ["color"] = {["r"] = 0.2, ["g"] = 0.7, ["b"] = 0.2}, ["anyUnit"] = true, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, {-- Earthliving ["enabled"] = true, ["id"] = 51945, ["point"] = "BOTTOMRIGHT", ["color"] = {["r"] = 0.7, ["g"] = 0.4, ["b"] = 0.4}, ["anyUnit"] = false, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, }, MONK = { {--Renewing Mist ["enabled"] = true, ["id"] = 119611, ["point"] = "TOPLEFT", ["color"] = {["r"] = 0.8, ["g"] = 0.4, ["b"] = 0.8}, ["anyUnit"] = false, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, {-- Life Cocoon ["enabled"] = true, ["id"] = 116849, ["point"] = "TOPRIGHT", ["color"] = {["r"] = 0.2, ["g"] = 0.8, ["b"] = 0.2}, ["anyUnit"] = false, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, {-- Enveloping Mist ["enabled"] = true, ["id"] = 132120, ["point"] = "BOTTOMLEFT", ["color"] = {["r"] = 0.4, ["g"] = 0.8, ["b"] = 0.2}, ["anyUnit"] = false, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, {-- Zen Sphere ["enabled"] = true, ["id"] = 124081, ["point"] = "BOTTOMRIGHT", ["color"] = {["r"] = 0.7, ["g"] = 0.4, ["b"] = 0}, ["anyUnit"] = false, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, }, ROGUE = { {-- Tricks of the Trade ["enabled"] = true, ["id"] = 57934, ["point"] = "TOPRIGHT", ["color"] = {["r"] = 0.89, ["g"] = 0.09, ["b"] = 0.05}, ["anyUnit"] = false, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, }, MAGE = { {-- Ice Ward ["enabled"] = true, ["id"] = 111264, ["point"] = "TOPLEFT", ["color"] = {["r"] = 0.2, ["g"] = 0.2, ["b"] = 1}, ["anyUnit"] = false, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, }, WARRIOR = { {-- Vigilance ["enabled"] = true, ["id"] = 114030, ["point"] = "TOPLEFT", ["color"] = {["r"] = 0.2, ["g"] = 0.2, ["b"] = 1}, ["anyUnit"] = false, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, {-- Intervene ["enabled"] = true, ["id"] = 3411, ["point"] = "TOPRIGHT", ["color"] = {["r"] = 0.89, ["g"] = 0.09, ["b"] = 0.05}, ["anyUnit"] = false, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, {-- Safe Guard ["enabled"] = true, ["id"] = 114029, ["point"] = "TOPRIGHT", ["color"] = {["r"] = 0.89, ["g"] = 0.09, ["b"] = 0.05}, ["anyUnit"] = false, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, }, DEATHKNIGHT = { {-- Unholy Frenzy ["enabled"] = true, ["id"] = 49016, ["point"] = "TOPRIGHT", ["color"] = {["r"] = 0.89, ["g"] = 0.09, ["b"] = 0.05}, ["anyUnit"] = false, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, }, } local PET_WATCH = { {-- Frenzy ["enabled"] = true, ["id"] = 19615, ["point"] = "TOPLEFT", ["color"] = {["r"] = 0.89, ["g"] = 0.09, ["b"] = 0.05}, ["anyUnit"] = true, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, {-- Mend Pet ["enabled"] = true, ["id"] = 136, ["point"] = "TOPRIGHT", ["color"] = {["r"] = 0.2, ["g"] = 0.8, ["b"] = 0.2}, ["anyUnit"] = true, ["onlyShowMissing"] = false, ['style'] = 'coloredIcon', ['displayText'] = false, ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, ['textThreshold'] = -1, ['xOffset'] = 0, ['yOffset'] = 0 }, } local FilterIDs = { ["Blocked"] = [[36900,36901,36893,114216,97821,36032,132365,8733,57724,25771,57723,36032,58539,26013,6788,71041,41425,55711,8326,23445,24755,25163,80354,95809,95223,124275,124274,124273,117870,123981,15007,113942,89140]], ["Allowed"] = [[31821,2825,32182,80353,90355,47788,33206,116849,22812,1490,116202,123059,136431,137332,137375,144351,142863,142864,142865,143198]], ["Strict"] = [[123059,136431,137332,137375,144351,142863,142864,142865,143198]], ["CC"] = [[47476,91800,91807,91797,108194,115001,33786,2637,339,78675,22570,5211,9005,102359,99,127797,45334,102795,114238,113004,3355,1513,19503,34490,24394,64803,19386,117405,128405,50519,91644,90337,54706,4167,90327,56626,50245,50541,96201,96201,31661,118,55021,122,82691,118271,44572,33395,102051,20066,10326,853,105593,31935,105421,605,64044,8122,9484,15487,114404,88625,113792,87194,2094,1776,6770,1833,51722,1330,408,88611,115197,113953,51514,64695,63685,76780,118905,118345,710,6789,118699,5484,6358,30283,24259,115782,115268,118093,89766,137143,20511,7922,676,105771,107566,132168,107570,118895,18498,116706,117368,115078,122242,119392,119381,120086,116709,123407,140023,25046,20549,107079]], ["Shield"] = [[17,47515,45243,45438,115610,48797,48792,49039,87256,55233,50461,33206,47788,62618,47585,104773,110913,108359,22812,102342,106922,61336,19263,53480,1966,31224,74001,5277,45182,98007,30823,108271,1022,6940,114039,31821,498,642,86659,31850,118038,55694,97463,12975,114029,871,114030,120954,131523,122783,122278,115213,116849,20594]], ["Player"] = [[17,47515,45243,45438,45438,115610,110909,12051,12472,80353,12042,32612,110960,108839,111264,108843,48797,48792,49039,87256,49222,55233,50461,49016,51271,96268,33206,47788,62618,47585,6346,10060,114239,119032,27827,104773,110913,108359,113860,113861,113858,88448,22812,102342,106922,61336,117679,102543,102558,102560,16689,132158,106898,1850,106951,29166,52610,69369,112071,124974,19263,53480,51755,54216,34471,3045,3584,131894,90355,90361,31224,74001,5277,45182,51713,114018,2983,121471,11327,108212,57933,79140,13750,98007,30823,108271,16188,2825,79206,16191,8178,58875,108281,108271,16166,114896,1044,1022,1038,6940,114039,31821,498,642,86659,20925,31850,31884,53563,31842,54428,105809,85499,118038,55694,97463,12975,114029,871,114030,18499,1719,23920,114028,46924,3411,107574,120954,131523,122783,122278,115213,116849,125174,116841,20594,59545,20572,26297,68992]], ["Raid"] = [[116281,116784,116417,116942,116161,117708,118303,118048,118135,117878,117949,116835,116778,116525,122761,122760,122740,123812,123180,123474,122835,123081,122125,121885,121949,117436,118091,117519,122752,123011,116161,123121,119985,119086,119775,122151,138349,137371,136767,137641,137359,137972,136903,136753,137633,137731,133767,133768,136050,138569,134691,137440,137408,137360,135000,143436,143579,147383,146124,144851,144358,144774,147207,144215,143990,144330,143494,142990,143919,143766,143773,146589,143777,143385,143974,145183]] } local FilterOverrides = { ["45438"] = 5, ["48797"] = 5, ["87256"] = 4, ["33206"] = 3, ["47585"] = 5, ["22812"] = 2, ["102342"] = 2, ["19263"] = 5, ["5277"] = 5, ["1022"] = 5, ["31821"] = 3, ["498"] = 2, ["642"] = 5, ["86659"] = 4, ["31850"] = 4, ["118038"] = 5, ["114029"] = 2, ["871"] = 3, ["120954"] = 2, ["131523"] = 5 } local function safename(id) local n = GetSpellInfo(id) if not n then if type(id) == "string" then n = id else print('|cffFF9900SVUI:|r Spell not found: (#ID) '..id) n = "Voodoo Doll"; end end return n end for k, x in pairs(FilterIDs) do local src = {}; for id in x:gmatch("([^,]+)") do if(id) then local saved local n = safename(id); local p = FilterOverrides[tostring(id)] or 0; if k == "Strict" then saved = {['enable'] = true, ['spellID'] = id, ['priority'] = p} else saved = {['enable'] = true, ['priority'] = p} end src[n] = saved end end CONFIGS.filter[k] = src end CONFIGS.filter.BuffWatch = CLASS_WATCH_INDEX[SuperVillain.class] or {} CONFIGS.filter.PetBuffWatch = PET_WATCH --[[ ########################################################## CREATE DB ########################################################## ]]-- local function tablecopy(d, s) if type(s) ~= "table" then return end if type(d) == "table" then for k, v in pairs(s) do if(k ~= "SAFEDATA") then if type(v) == "table" then if not rawget(d, k) then rawset(d, k, {}) end tablecopy(d[k], v) else if rawget(d, k) == nil then rawset(d, k, v) end end end end end end local function importdata(s, d) if type(d) ~= "table" then d = {} end if type(s) == "table" then for k,v in pairs(s) do if(k ~= "SAFEDATA") then if type(v) == "table" then v = importdata(v, d[k]) end d[k] = v end end end return d end local function setdefaults(t, key, sub, sub2) local sv = rawget(t, "profile") local src = rawget(t, "defaults") local savedProfile = sv[key] if(sub2 and sv[key] and sv[key][sub]) then savedProfile = sv[key][sub][sub2] elseif(sub and sv[key]) then savedProfile = sv[key][sub] else savedProfile = sv[key] end if(savedProfile) then for k,v in pairs(savedProfile) do savedProfile[k] = nil end else sv[key] = {} end tablecopy(sv[key], src[key]) end local function getdefaults(t, key) local src = rawget(t, "defaults") return src[key] or {} end local function removedefaults(db, src, nometa) if(type(src) ~= "table") then return end if(not nometa) then setmetatable(db, nil) end for k,v in pairs(src) do if(k ~= "SAFEDATA") then if type(v) == "table" and type(db[k]) == "table" then removedefaults(db[k], v, nometa) if next(db[k]) == nil then db[k] = nil end else if db[k] == v then db[k] = nil end end end end end local function resetprofile(t) local sv = rawget(t, "profile") local src = rawget(t, "defaults") for k,v in pairs(sv) do if(k ~= "SAFEDATA") then sv[k] = nil end end end local function importprofile(t, key) local sv = rawget(t, "profile") local dv = rawget(t, "defaults") local globals = SuperVillain.Global local src = globals.profiles[key] if(not src) then return end for k,v in pairs(sv) do if(k ~= "SAFEDATA") then sv[k] = nil end end tablecopy(sv, src) sv.copyKey = key ReloadUI() end local function importprompt(t, key) SuperVillain.SystemAlert["COPY_PROFILE_PROMPT"].text = L["Are you sure you want to copy the profile '" .. key .. "'?"] SuperVillain.SystemAlert["COPY_PROFILE_PROMPT"].OnAccept = function() importprofile(t, key) end SuperVillain:StaticPopup_Show("COPY_PROFILE_PROMPT") end local function exportprofile(t, key) local sv = rawget(t, "profile") local dv = rawget(t, "defaults") local globals = SuperVillain.Global if(not globals.profiles[key]) then globals.profiles[key] = {} end local saved = globals.profiles[key] tablecopy(saved, sv) for k,v in pairs(saved) do removedefaults(saved[k], dv[k]) end globals.profileKeys[key] = key SuperVillain:SavedPopup() end local function removeprofile(t, key) local globals = SuperVillain.Global if(globals.profiles[key]) then globals.profiles[key] = nil end if(globals.profileKeys[key]) then globals.profileKeys[key] = nil end collectgarbage("collect") end local function insertdata(t, src) local sv = rawget(t, "profile") local dv = rawget(t, "defaults") for k,v in pairs(src) do if(not sv[k]) then sv[k] = {} end tablecopy(sv[k], src[k]) if(not dv[k]) then dv[k] = {} end tablecopy(dv[k], src[k]) rawset(t, k, sv[k]) end end local function initializedata(t) local sv = rawget(t, "profile") if(not sv.copyKey or (sv.copyKey and type(sv.copyKey) ~= "string")) then sv.copyKey = pkey end end local function SanitizeDatabase() if(not SuperVillain.db) then return end local db = SuperVillain.db local src = SuperVillain.Configs for k,v in pairs(db) do if(k ~= "SAFEDATA" and src[k]) then removedefaults(db[k], src[k]) end end end local LogOut_OnEvent = function(self, event) if event == "PLAYER_LOGOUT" then SanitizeDatabase() end end local metadatabase = { __index = function(t, k) if(not k or k == "") then return end local sv = rawget(t, "profile") local dv = rawget(t, "defaults") local src = dv and dv[k] if(not sv[k]) then sv[k] = {} end if(src) then tablecopy(sv[k], src) end rawset(t, k, sv[k]) return rawget(t, k) end, } local METAPROFILE = function(sv) local db = setmetatable({}, metadatabase) db.profile = sv db.defaults = CONFIGS db.Init = initializedata db.Append = insertdata db.Reset = resetprofile db.SetDefault = setdefaults db.GetDefault = getdefaults db.Import = importprompt db.Export = exportprofile db.Remove = removeprofile return db end function SuperVillain:AppendDefaults(newIndex, newData) self.Configs[newIndex] = newData end function SuperVillain:GetProfiles() return self.Global.profileKeys or {} end function SuperVillain:CheckProfiles() local hasProfile = false local list = self.Global.profileKeys or {} for key,_ in pairs(list) do hasProfile = true end return hasProfile end function SuperVillain:HexColor(arg1,arg2,arg3) local r,g,b; if arg1 and type(arg1) == "string" then local t if(self.Media or self.db.media) then t = self.Media.color[arg1] or self.db.media.unitframes[arg1] else t = self.Configs.media.colors[arg1] or self.Configs.media.unitframes[arg1] end if t then r,g,b = t[1],t[2],t[3] else r,g,b = 0,0,0 end else r = type(arg1) == "number" and arg1 or 0; g = type(arg2) == "number" and arg2 or 0; b = type(arg3) == "number" and arg3 or 0; end r = (r < 0 or r > 1) and 0 or (r * 255) g = (g < 0 or g > 1) and 0 or (g * 255) b = (b < 0 or b > 1) and 0 or (b * 255) local hexString = ("%02x%02x%02x"):format(r,g,b) return hexString end function SuperVillain:TableSplice(targetTable, mergeTable) if type(targetTable) ~= "table" then targetTable = {} end if type(mergeTable) == 'table' then for key,val in pairs(mergeTable) do if type(val) == "table" then val = self:TableSplice(targetTable[key], val) end targetTable[key] = val end end return targetTable end function SuperVillain:SetDatabaseObjects(init) if(init) then self.db = tcopy(self.Configs, true) else self.Global = self:TableSplice(SVUI_Global, self.Global) self.Global.profileKeys = {} for k,v in pairs(self.Global.profiles) do self.Global.profileKeys[k] = k end local sv = _G["SVUI_Profile"] twipe(self.db) self.db = METAPROFILE(sv) self.db:Init() self.db.profileKey = pkey logoutListener:RegisterEvent("PLAYER_LOGOUT") logoutListener:SetScript("OnEvent", LogOut_OnEvent) end end